pro spd_ui_tplot_gui_make_plots, newpanel, varname,template
compile_opt idl2, hidden
group = !spd_gui.loadedData->getGroup(varname)
if ~obj_valid(group) then return
xname = group->getTimeName()
!spd_gui.loadedData->getDataInfo,varname,limit=l,dlimit=dl
extract_tags,dl,l
if (size(dl, /type) eq 8) then begin
if in_set('spec', strlowcase(tag_names(dl))) && dl.spec eq 1 then begin
groupname = group->getName()
yname = group->getYaxisName()
spd_ui_make_default_specplot, !spd_gui.loadedData, newpanel, xname, $
yname, groupname, template
endif else begin
ynames = group->getDataNames()
for j=0, n_elements(ynames)-1 do begin
spd_ui_make_default_lineplot, !spd_gui.loadedData, newpanel, xname, $
ynames[j], template
endfor
endelse
endif else begin
ynames = group->getDataNames()
for j=0, n_elements(ynames)-1 do begin
spd_ui_make_default_lineplot, !spd_gui.loadedData, newpanel, xname, $
ynames[j],template
endfor
endelse
end
pro tplot_gui, datanames,$
no_verify=no_verify,$
no_draw=no_draw,$
no_update=no_update,$
reset=reset,$
add_panel=add_panel,$
overplot=overplot,$
template_filename=template_filename,$
var_labels=var_label,$
trange=trange
compile_opt idl2
dt = size(/type,datanames)
ndim = size(/n_dimen,datanames)
if dt ne 0 then begin
if dt ne 7 or ndim ge 1 then dnames = strjoin(tnames(datanames,/all),' ') $
else dnames=datanames
endif else begin
last_tplot = tnames(/tplot)
dprint,'Recreating the last tplot command with the following tplot variables:'
dprint, last_tplot
dnames = strjoin(last_tplot,' ')
endelse
defsysv,'!SPD_GUI',exists=thm_exists
if keyword_set(reset) || keyword_set(add_panel) || keyword_set(overplot) || ~thm_exists then begin
newwin = 0
endif else begin
newwin = 1
endelse
if (xregistered('spd_gui') eq 0) then begin
spd_gui, reset=reset,template_filename=template_filename
endif else if keyword_set(reset) then begin
widget_control,!SPD_GUI.GUIID,/destroy
spd_gui, reset=reset,template_filename=template_filename
endif else begin
if keyword_set(template_filename) then begin
open_spedas_template,template=template,filename=template_filename,$
statusmsg=statusmsg,statuscode=statuscode
if statuscode lt 0 then begin
ok = dialog_message(statusmsg,/error,/center)
endif else begin
!spd_gui.windowstorage->setProperty,template=template
endelse
endif
endelse
!spd_gui.windowStorage->getProperty,template=template
spd_ui_tplot_gui_load_tvars,dnames,no_verify=no_verify,out_names=out_names,all_names=all_names
if n_elements(out_names) eq 0 then begin
if keyword_set(add_panel) then begin
spd_ui_make_default_panel, !spd_gui.windowStorage, template
endif
dprint,"No valid input names"
return
endif else begin
var_num = csvector(out_names,/l)
endelse
tplot_options,get_opt=opts
str_element,opts,'var_label',opts_vars,success=s
if n_elements(var_label) gt 0 then begin
var_list = var_label
endif else if s then begin
var_list = opts_vars
endif
if n_elements(var_list) gt 0 then begin
spd_ui_tplot_gui_load_tvars,var_list,no_verify=no_verify,out_names=out_varnames,all_names=all_varnames
all_names = array_concat(all_names,all_varnames)
endif
if n_elements(all_names) eq 0 then begin
dprint,"No valid names"
return
endif
all_names = all_names[uniq(all_names,sort(all_names))]
if ~keyword_set(no_verify) then begin
dprint,'verify data for main plots'
spd_ui_verify_data,!spd_gui.guiId, all_names, !spd_gui.loadedData, $
!spd_gui.windowStorage, !spd_gui.historywin, $
success=success,newnames=new_names
if ~success then begin
dprint,'Data verify canceled.'
!SPD_GUI.historyWin->update,'Data verify canceled.'
return
endif
endif else begin
new_names=all_names
endelse
if ~keyword_set(no_draw) then begin
if newwin then begin
if ~!spd_gui.windowStorage->add(isactive=1) then begin
ok = error_message('Error initializing new window for TPLOT_GUI.',/traceback, /center, $
title='Error in TPLOT_GUI')
endif
activeWindow = !spd_gui.windowStorage->GetActive()
activeWindow[0]->GetProperty, Name=name,settings=pagesettings
spd_ui_tplot_gui_page_options,pagesettings
!spd_gui.windowMenus->Add, name
!spd_gui.windowMenus->Update, !spd_gui.windowStorage
endif else begin
activeWindow = !spd_gui.windowStorage->GetActive()
activeWindow[0]->GetProperty,settings=pagesettings
spd_ui_tplot_gui_page_options,pagesettings
endelse
sub_idx = 0
for i=0L, var_num-1 do begin
spd_ui_make_default_panel, !spd_gui.windowStorage, template,outpanel=newpanel
add_names = csvector(i,out_names,/read)
for j = 0,n_elements(add_names)-1 do begin
idx = where(add_names[j] eq all_names,c)
if c ne 1 then begin
dprint,"Unexpected error detected"
return
endif
spd_ui_tplot_gui_make_plots, newpanel, new_names[idx[0]],template
endfor
spd_ui_tplot_gui_panel_options,newpanel,varnames=add_names,allnames=all_names,newnames=new_names,trange=trange
endfor
spd_ui_tplot_gui_make_var_labels,newpanel,pagesettings,varnames=out_varnames,allnames=all_names,newnames=new_names
if ~keyword_set(no_update) then begin
!spd_gui.drawObject->update,!spd_gui.windowStorage, !spd_gui.loadedData
!spd_gui.drawObject->draw
endif
endif
end