func t3d_widget(iq)
;block t3d_widget
 if defined($t3dwidget) eq 0 then {
 
 ;the compile_file is supposed to operate at top level and hence the edb's
 ;are temporary and don't add to our accumulation
 compile_file, getenv('ANA_WLIB') + '/trace3dwidgettool.ana'

 }
 xtpopup, $t3dwidget
 return, $t3dwidget
 endfunc
 ;endblock
 ;=============================================================================== 
 ;main for test
 ulib, getenv('ANA_WLIB') + '/'
 $help_path = getenv('ANA_HELP') + '/'
 $pix_path = getenv('ANA_PIXMAPS') + '/'
 $f2='-adobe-times-medium-i-normal--25*'
 $f8='-adobe-courier-bold-r-normal--12*'
 $f3='-schumacher-clean-bold-r-normal--13*'
 ;$f3='-adobe-times-medium-r-normal--14*'
 $f4='-adobe-helvetica-bold-r-normal--14*'
 $f5='-adobe-times-bold-i-normal--14*'
 $f6='-adobe-times-bold-i-normal--17*'
 $f7='-adobe-helvetica-bold-r-normal--17*'
 $f1='-adobe-times-bold-r-normal--14*'
 $f9='-*-screen-medium-r-normal--12-*-*-*-m-70-iso8859-1'
 run t3d_widget
 ;iq = t3d_widget()
 ;start here for view initializing

 ;define symbols for the data in each window
 $data0 = 0 $data1 = 0 $data2 = 0 $data3 = 0 $data4 = 0
 $data5 = 0 $data6 = 0 $data7 = 0 $data8 = 0 $data9 = 0
 ;and for some special windows used by some of the tools
 zeroifnotdefined, $data11	;vcr, movie window
 #play_window = 11
 $data12 = 0	;plot window used by various (may need to split up later)
 $data13 = 0	;first time slice window
 $data14 = 0	;second time slice window
 $data15 = 0	;blink window
 $data16 = 0	;histogram window
 $data17 = 0	;x vs y plot window
 !iorder = 2	;default orientation
 !maxhistsize = 200000		;something will always screw up
 !maxregridsize = 4000
 ;set up a view data base, just arrays with some info
 $view_exists = zero(intarr(20))
 $view_nx = intarr(20)
 $view_ny = intarr(20)
 $view_draw = intarr(20)
 $view_zoom_fac = zero(intarr(20)) + word(1)
 $view_ix = intarr(20)
 $view_iy = intarr(20)
 $view_ixc = intarr(20)
 $view_iyc = intarr(20)
 $view_xsize = intarr(20)
 $view_ysize = intarr(20)
 $view_width = intarr(20)
 $view_height = intarr(20)
 $view_order = intarr(20)
 $view_grid = zero(intarr(20)
 $view_scv = intarr(20)
 $view_sch = intarr(20)
 $view_scaletype = zero(intarr(20)) + word(2)	;pre-set
 $view_label = intarr(2,20)
 $view_zoom_widgets = zero(intarr(8,20))
 $window_title = strarr(20)
 zero, $view_label
 $view_scale_range = fltarr(2,20)
 $view_cb_case = intarr(20)
 zero, $view_cb_case
 $datapath =''
 pencolor,'red'
 #red_pixel = !foreground_color
 pencolor, 'green'
 #green_pixel = !foreground_color
 pencolor,'black'
 #black_pixel = !foreground_color
 #grid_pixel = !foreground_color
 pencolor,'white'
 #white_pixel = !foreground_color
 pencolor,'yellow'
 #yellow_pixel = !foreground_color
 ;the pencolor caused an xwin to be created, delete it now
 if xexist(0) then xdelete, 0
 $link_pending = 0
 $select_in_progress = 0
 ;init the color tables
 gamma_subrange, 1.0, 0, 255

 xtloop, 1
