PRO tplottool_event, ev
@tplot_com
WIDGET_CONTROL, ev.top, GET_UVALUE=wid
debug=0
if keyword_set(debug) then begin
printdat,ev
endif
CASE ev.id OF
wid.tplot : begin
WIDGET_CONTROL, wid.tnames, get_value = names
WIDGET_CONTROL, wid.trange, get_value = times
WIDGET_CONTROL, wid.trange, set_value = time_string(times)
tplot,names,trange=times
end
wid.tlimit : begin
ctime,times,npoints=2
WIDGET_CONTROL, wid.tnames, get_value = names
WIDGET_CONTROL, wid.trange, set_value = time_string(times)
tplot,names,trange=times
end
wid.tzoom : tzoom
wid.ctime : begin
ctime,t
WIDGET_CONTROL, wid.ctime, set_uvalue=t
end
wid.tnames : begin
WIDGET_CONTROL, wid.tnames, get_value=tnames
dnames=wid.dnames_a
WIDGET_CONTROL, wid.dnames, set_value=array_union(dnames,tnames) ge 0
end
wid.names : begin
tplot_names
end
wid.exec : begin
WIDGET_CONTROL, wid.ctime, GET_UVALUE=t
WIDGET_CONTROL, wid.exectext, GET_VALUE=Command
d = execute(command[0])
end
wid.dnames : begin
dprint,phelp=2,wid
WIDGET_CONTROL, wid.tnames, get_value = tnames
WIDGET_CONTROL, wid.dnames, get_value=new_names
if ev.select then tnames = [tnames,ev.value] $
else begin
w = where(tnames ne ev.value,c)
if c ne 0 then tnames = tnames[w]
endelse
widget_control, wid.tnames, set_value = tnames
end
wid.done : WIDGET_CONTROL, ev.top, /DESTROY
else: dprint,'Do Nothing'
ENDCASE
END
PRO tplottool,execcom=execcom,width=width
if not keyword_set(width) then width = 16
base = WIDGET_BASE(/COLUMN,title='Tplot Tool')
str_element,/add,wid,'tplot' , WIDGET_BUTTON(base, VALUE='Tplot')
tnms=tnames(/tplot)
str_element,/add,wid,'tnames', WIDGET_TEXT(base,VALUE=tnms,/editable, $
/all,xsize=width,ysize=12,/scroll)
str_element,/add,wid,'tlimit', WIDGET_BUTTON(base, VALUE='Tlimit')
str_element,/add,wid,'trange', WIDGET_TEXT(base, /edit,ysize=2,xsize=width $
,VALUE=time_string(timerange(/current)))
str_element,/add,wid,'tzoom', WIDGET_BUTTON(base, VALUE='Zoom')
str_element,/add,wid,'ctime', WIDGET_BUTTON(base, VALUE='Ctime')
str_element,/add,wid,'names', WIDGET_BUTTON(base, VALUE='Names')
dnames = tnames()
str_element,/add,wid,'dnames_a',dnames
str_element,/add,wid,'dnames', CW_bgroup(base,dnames $
,x_scroll=width*10,y_scroll_size=8*30 ,space=0 $
,set_value=array_union(dnames,tnms) ge 0 $
,/scroll,/nonexcl,/return_name)
str_element,/add,wid,'exec', WIDGET_BUTTON(base,VALUE='Exec')
if n_elements(execcom) eq 0 then execcom=''
str_element,/add,wid,'exectext', WIDGET_TEXT(base,value=execcom,/editable, XSIZE=width)
str_element,/add,wid,'done', WIDGET_BUTTON(base, VALUE='Done')
WIDGET_CONTROL, base, SET_UVALUE=wid
WIDGET_CONTROL, base, /REALIZE
printdat,wid
XMANAGER, 'tplottool', base,/no_block
END