subr viewts, win
 ;a version of view specialized for time slices
 ;uses the view_data directly and no data array
 ;;ty,'win = ', win
 dst = '$view_data'+string(win)

 if num_dim(eval(dst)) ne 2 then { ty,'VIEW - array must be 2-D' return, 0 }
 nx = dimen(eval(dst),0)	ny = dimen(eval(dst),1)
 $view_nx(win) = nx
 $view_ny(win) = ny
 ;note that $view_zoom_fac should be 1 for these since zones are not
 ;done by tvplane
 $view_zoom_fac(win) = 1
 sw = string(win)		;a bit indirect
 $viewdespikestatus(win) = 0	;not used for time slices

 if defined(eval('$viewer'+sw)) eq 0 then {
   $view_scaletype(win) = 6
   $win = win

   ;doing this in a compile file causes a crash with a segment error in
   ;malloc, don't know why yet but somehow the xmtoplevel_form sets it up
   ;to happen, it does not happen on the PC's (not sure about the Sun's)
   sw = string(win)		;a bit indirect
   viq = xmtoplevel_form(0,0,'X' )
   equate, eval('$viewer'+sw), viq
   compile_file, getenv('ANA_WLIB') + '/view_widgettool'
   
   $window_title(win) = 'time slice viewer '+sw
   ;start without a text box
   info_box_hide_toggle, $win

   win = $win	;needed in case we called view from top level
   viq = eval('$viewer'+sw)
   xmsettitle, viq, $window_title(win)
   xtpopup, viq
   xtloop, 2
   $view_exists(win) = 1
 } else {
   viq = eval('$viewer'+str(win))
   xtpopup, viq
 }
 ;the time slice array is always prepared for iorder = 0 display, if the
 ;current display is not 0, we have to flip it here
 or2 = $view_order(win)
 if or2 then re_orient, 0, or2, win
 
 view_recompute, win
 endsubr
 ;=============================================================================
