PRO spd_gui_event, event
COMPILE_OPT hidden
err_xxx = 0
catch, err_xxx
If(err_xxx Ne 0) Then Begin
catch, /cancel
help, /last_message, output = err_msg
For j = 0, n_elements(err_msg)-1 Do begin
if is_struct(info) && obj_valid(info.historywin) then begin
info.historywin->update,err_msg[j]
endif
print, err_msg[j]
endfor
If(is_struct(info)) Then Begin
info.drawDisabled = 0
x=info.master
if widget_valid(event.top) then begin
widget_control, event.top, set_uval = info, /no_copy
endif else begin
print,'Potentially catastrophic error. You may want to terminate the gui by selecting run->terminate'
endelse
if obj_valid(info.historywin) then begin
spd_gui_error,x,info.historywin
endif
Endif else begin
print,'Potentially catastrophic error. You may want to terminate the gui by selecting run->terminate'
endelse
return
Endif
IF(Tag_Names(event, /Structure_Name) EQ 'WIDGET_KILL_REQUEST') THEN BEGIN
spd_ui_exit,event,info=info
return
ENDIF
Widget_Control, event.top, Get_UValue=info
if ~is_struct(info) then begin
t = error_message('Unset info in Event Handler',/Traceback, /center, title='Error in GUI')
Widget_control,event.top,/destroy
return
endif
if info.contextMenuOn then begin
IF(TAG_NAMES(event, /STRUCTURE_NAME) EQ 'WIDGET_DRAW') && ~event.press && ~event.release && event.type eq 2 THEN BEGIN
info.contextMenuOn = 1
endif else info.contextMenuOn = 0
endif
IF(tag_names(event,/structure_name) eq 'WIDGET_BASE') then begin
tm = systime(/seconds)
if tm - info.resizetime gt .25 then begin
newx = event.x - info.interface_size[0]
newy = event.y - info.interface_size[1]
charSize = ceil(newx/!d.x_ch_size)
mincharsize = ceil(info.toolbar_xsize/!d.x_ch_size)
widget_control,info.master,update=0
if strlowcase(!version.os_family) eq 'windows' then begin
newx = newx + 19
newy = newy + 2
widget_control,info.drawID,scr_xsize=newx > info.toolbar_xsize,scr_ysize=newy>1
endif else begin
widget_control,info.drawID,xsize=newx > info.toolbar_xsize,ysize=newy>1
endelse
info.scrollbar->setProperty,xsize=newx > info.toolbar_xsize
res = info.statusBar->GetState()
if res EQ 0 then begin
info.statusBar->Delete
endif else begin
info.statusBar->setProperty,xsize=charsize > mincharsize,/refresh
info.statusBar->Draw
endelse
widget_control,info.master,update=1
info.screenSize=[newx > info.toolbar_xsize,newy>1]
info.resizetime = systime(/seconds)
info.drawObject->draw
endif
Widget_Control, event.top, Set_UValue=info, /No_Copy
RETURN
endif
IF tag_names(event, /structure_name) eq 'WIDGET_TRACKING' then begin
info.draw_select = event.enter
if info.marking ne 0 or info.rubberbanding ne 0 then begin
if event.enter EQ 0 then spd_ui_reset_tracking, info
endif
Widget_Control, event.top, Set_UValue=info, /No_Copy
return
endif
IF(TAG_NAMES(event, /STRUCTURE_NAME) EQ 'WIDGET_DRAW') THEN BEGIN
info=spd_ui_draw_event(event, info)
if ~is_struct(info) then return
if event.type eq 4 then begin
info.drawObject->draw
endif
Widget_Control, event.top, Set_UValue=info, /No_Copy
RETURN
ENDIF
IF (TAG_NAMES(event, /STRUCTURE_NAME) EQ 'WIDGET_KBRD_FOCUS') THEN BEGIN
Widget_Control, event.top, Set_UValue=info, /No_Copy
RETURN
ENDIF
uname = widget_info(event.id, /uname)
if uname eq 'GUI_PLUGIN' then begin
spd_ui_call_plugin, event, info
widget_control, event.top, set_uvalue=info, /no_copy
return
endif
Widget_Control, event.id, Get_UValue=userValue
info.drawDisabled = 1
Widget_Control, event.TOP, Set_UValue=info
info.contextMenuOn = 0
CASE userValue OF
'EXIT': BEGIN
spd_ui_exit,event,info=info
return
end
'OPEN': BEGIN
spd_ui_open,info
END
'SAVE': BEGIN
spd_ui_save,info
END
'SAVEAS': BEGIN
spd_ui_saveas,info
END
'OPEN_TEMPLATE': BEGIN
spd_ui_open_template,info
END
'SAVE_TEMPLATE': BEGIN
spd_ui_save_template,info
END
'SAVEAS_TEMPLATE': BEGIN
spd_ui_saveas_template,info
END
'SAVEDATAAS': BEGIN
data = info.loadedData->GetAll()
IF Is_Num(data) THEN info.statusBar->Update, 'There is no data to save. Please load data using the Load Data option under the File pull down menu.' $
ELSE BEGIN
spd_ui_save_data_as, info.master, info.loadedData, info.historywin,info.guiTree, info.saveDataDirPtr, info.statusbar
ENDELSE
END
'CLOSE': BEGIN
spd_ui_close_window, info
END
'LOAD': BEGIN
dataLoadSelectPtr = info.dataLoadSelectPtr
spd_ui_init_load_window, info.master, info.windowStorage, info.loadedData, $
info.historyWin, $
info.loadtr,info.guiTree,dataLoadSelectPtr
info.dataLoadSelectPtr = dataLoadSelectPtr
info.drawObject->Update,info.windowStorage,info.loadedData
info.drawObject->Draw
info.scrollbar->update
END
'LOADCDAWEB': BEGIN
if cdf_version_test() ne 0 then begin
info.windowStorage->getProperty,callsequence=callsequence
spd_ui_spdfcdawebchooser, historyWin=info.historyWin, GROUP_LEADER = info.master,timeRangeObj=info.loadtr,callsequence=callsequence
endif else begin
spd_ui_message, 'The CDF library is out-of-date. To install the required patch, see: http://cdf.gsfc.nasa.gov/html/cdf_patch_for_idl.html', hw=info.historyWin, sb=info.statusBar, /dialog
endelse
END
'LOADCDF': BEGIN
spd_ui_load_spedas_cdf, info
END
'MANAGEDATA': BEGIN
spd_ui_manage_data, info.master, info.loadedData, info.windowStorage, info.historywin,info.guiTree
info.drawObject->Update,info.windowStorage,info.loadedData
info.drawObject->Draw
END
'EXPORTMETA': BEGIN
info.drawObject->draw
saveObj = obj_new('spd_ui_draw_save',info.drawObject,info.loadedData,info.windowStorage)
fileStruct = spd_ui_image_export(info.master,info.drawObject,info.historywin,info.statusBar,info.imageOptions)
IF(Is_String(fileStruct.name)) THEN BEGIN
if obj_valid(saveObj) && saveObj->write(fileStruct) then begin
statusMessage = 'Successfully saved file: '+ fileStruct.name
info.statusBar->Update, statusMessage
info.historyWin->update,statusMessage
ptr_free,info.imageOptions
info.imageOptions = ptr_new(fileStruct)
endif else begin
info.statusBar->Update, 'Image Save Failed'
info.historyWin->Update,'Image Save Failed'
endelse
obj_destroy,saveObj
ENDIF ELSE BEGIN
info.statusBar->Update, 'Image Save Cancelled'
ENDELSE
END
'LOADTHEME': BEGIN
fileName = Dialog_Pickfile(Title='Open SPEDAS Theme File:', $
Filter='*.thm', Dialog_Parent=info.master)
IF(Is_String(fileName)) THEN BEGIN
statusMessage = 'Successfully opened SPEDAS Theme File: '+fileName
info.statusBar->Update, statusMessage
ENDIF ELSE BEGIN
statusMessage = 'Invalid Filename: '+fileName
info.statusBar->Update, statusMessage
ENDELSE
END
'SAVETHEME': BEGIN
fileName = Dialog_Pickfile(Title='Save SPEDAS Theme File:', $
Filter='*.thm', /Write, Dialog_Parent=info.master)
IF(Is_String(fileName)) THEN BEGIN
statusMessage = 'Successfully saved SPEDAS Theme File: '+fileName
info.statusBar->Update, statusMessage
ENDIF ELSE BEGIN
statusMessage = 'Invalid Filename: '+fileName
info.statusBar->Update, statusMessage
ENDELSE
END
'IMPORTM': BEGIN
dummy=dialog_message('Import Marker List not yet implemented',/ERROR,/CENTER, title='Error in GUI')
END
'EXPORTM': spd_ui_export_markers, info.master
'EXPORTML': BEGIN
fileName = Dialog_Pickfile(Title='Export SPEDAS Marker List:', $
Filter='*.mrk', /Write, Dialog_Parent=info.master)
IF(Is_String(fileName)) THEN BEGIN
save_marker_list,windowstorage=info.windowstorage,filename=fileName,$
statusmsg=statusmsg,statuscode=statuscode
IF (statuscode LT 0) THEN BEGIN
info.statusBar->Update, statusmsg
dummy=dialog_message(statusmsg,/ERROR,/CENTER, title='Error in GUI')
ENDIF ELSE BEGIN
info.statusBar->Update, statusmsg
ENDELSE
ENDIF
END
'PRINT': BEGIN
info.ctrl=0
spd_ui_print,info
END
'PSETUP': BEGIN
if info.printWarning eq 0 then begin
ok = dialog_message("IDL printer support can be unreliable." + ssl_newline() + $
'If you have trouble, try exporting from the "File->Export to Image File" menu.' + ssl_newline() + $
'"File->Export to Image File" supports eps, png, and numerous other image formats.',$
dialog_parent=info.master)
info.printwarning=1
endif
info.statusbar->update,'Warning: IDL printer support can be unreliable, if you have trouble try exporting to via the "File->Export to Image File" menu.'
info.printObj = Obj_New("IDLgrPRINTER", Print_Quality=2, Quality=2)
result=Dialog_Printersetup(info.printObj, Dialog_Parent=info.master)
IF result NE 0 THEN spd_ui_print,info
END
'COPY': spd_ui_copy, info
'DELETEM': spd_ui_delete_marker, info
'SUBPAGE': BEGIN
oldWindow = info.windowStorage->GetActive()
newWindow = oldWindow->Copy()
result = info.windowStorage->AddNewObject(newWindow)
activeWindow = info.windowStorage->GetActive()
oldWindow->getProperty,settings=settings
activeWindow->setProperty,settings=settings->copy()
activeWindow->GetProperty, Name=name
info.windowMenus->Add, name
info.windowMenus->Update, info.windowStorage
info.drawObject->update,info.windowStorage, info.loadedData
info.drawObject->draw
info.scrollbar->update
info.statusbar->update,'Subset page finished. New window displayed.'
END
'SUBMARKER': spd_ui_subset_marker, info
'SUBMARKERMULTI': spd_ui_subset_marker_multi,info
'EXMD': BEGIN
result = Widget_Info(event.id, /Button_Set)
IF result EQ 0 THEN BEGIN
example_data,info
info.statusBar->Update, 'Example window displayed'
ENDIF ELSE BEGIN
info.statusBar->Update, 'Example window not displayed'
ENDELSE
FOR i=0, N_Elements(info.panelButtons)-1 DO Widget_Control, info.panelButtons[i], sensitive=1
FOR i=0, N_Elements(info.markerButtons)-1 DO Widget_Control, info.markerButtons[i], sensitive=1
END
'TEST': BEGIN
spd_ui_widget_tree_test,info.master,info.loadedData, info.historywin
END
'CONF': BEGIN
spd_ui_init_fileconfig, info.master, info.historyWin
info.template_filename = !SPD_GUI.templatepath
!SPD_GUI.windowstorage->GetProperty,template = templateobj
info.template_object = templateobj
END
'JUMP': spd_ui_jump, info.master, info.historywin
'JOURNAL': BEGIN
result = Widget_Info(event.id, /Button_Set)
IF result EQ 0 THEN BEGIN
Widget_Control, event.id, Set_Button=1
Journal,'spd_ui_idlsave.pro'
info.statusBar->Update, 'Journaling has been turned on'
info.historyWin->Update, 'Journaling has been turned on'
ENDIF ELSE BEGIN
Widget_Control, event.id, Set_Button=0
Journal
info.statusBar->Update, 'Journaling has been turned off'
info.historyWin->Update, 'Journaling has been turned off'
ENDELSE
END
'REFRESH': BEGIN
info.ctrl=0
spd_ui_refresh,info
END
'SCROLLF':BEGIN
spd_ui_scrollf,info
END
'SCROLLB':BEGIN
spd_ui_scrollb,info
END
'EXPAND':BEGIN
spd_ui_expand,info
END
'REDUCE':BEGIN
spd_ui_reduce,info
END
'HISTORYW': BEGIN
result = Widget_Info(event.id, /Button_Set)
IF result EQ 0 THEN BEGIN
Widget_Control, event.id, Set_Button=1
info.historyWin->Draw
ENDIF ELSE BEGIN
Widget_Control, event.id, Set_Button=0
info.historyWin->Delete
ENDELSE
END
'PATHBAR': BEGIN
result = Widget_Info(event.id, /Button_Set)
IF result EQ 0 THEN BEGIN
Widget_Control, event.id, Set_Button=1
info.pathBar->Draw
ENDIF ELSE BEGIN
Widget_Control, event.id, Set_Button=0
info.pathBar->Delete
ENDELSE
END
'POSITIONBAR': BEGIN
result = Widget_Info(event.id, /Button_Set)
if result eq 0 then begin
info.legendOn = 1
info.tracking = 1
widget_control,info.showPositionMenu,set_button=1
widget_control,info.trackMenu,set_button=1
if info.trackAll then begin
info.trackOne = 0
info.trackAll = 1
widget_control,info.trackAllMenu,set_button=1
widget_control,info.trackOneMenu,set_button=0
all = 1
endif else begin
info.trackOne = 1
info.trackAll = 0
widget_control,info.trackAllMenu,set_button=0
widget_control,info.trackOneMenu,set_button=1
all = 0
endelse
info.drawObject->LegendOn,all=all
if info.trackingv then begin
info.trackingv = 1
widget_control,info.trackvMenu,set_button=1
info.drawObject->vBarOn,all=all
endif else begin
info.trackingv = 0
widget_control,info.trackvMenu,set_button=0
info.drawObject->vBarOff
endelse
if info.trackingh then begin
info.trackingh = 1
widget_control,info.trackhMenu,set_button=1
info.drawObject->hBarOn
endif else begin
info.trackingh = 0
widget_control,info.trackhMenu,set_button=0
info.drawObject->hBarOff
endelse
activeWindow=info.windowStorage->GetActive()
if n_elements(activeWindow) gt 0 && $
obj_valid(activeWindow[0]) then begin
activeWindow[0]->SetProperty, Tracking=1
endif
info.drawObject->Update,info.windowStorage,info.loadedData
info.drawObject->Draw
info.statusBar->Update, 'Legend tracking turned on'
endif else begin
info.legendOn = 0
widget_control,info.showPositionMenu,set_button=0
info.drawObject->legendOff
resultv = widget_info(info.trackvMenu,/button_set)
resulth = widget_info(info.trackhMenu,/button_set)
if ~resultv && ~resulth then begin
info.tracking = 0
info.trackingv = 0
info.trackingh = 0
widget_control,info.trackMenu,set_button=0
widget_control,info.trackAllMenu,set_button=0
widget_control,info.trackOneMenu,set_button=0
info.drawObject->vBarOff
info.drawObject->hBarOff
activeWindow=info.windowStorage->GetActive()
if n_elements(activeWindow) gt 0 && $
obj_valid(activeWindow[0]) then begin
activeWindow[0]->SetProperty, Tracking=0
endif
endif
info.statusBar->Update, 'Legend tracking turned off'
endelse
END
'TRACK': BEGIN
result = Widget_Info(event.id, /Button_Set)
IF result EQ 0 THEN BEGIN
if ~info.trackAll && info.trackOne then begin
Widget_Control, info.trackAllMenu, Set_Button=0
Widget_Control, info.trackOneMenu, Set_Button=1
info.trackAll=0
info.trackOne=1
endif else if info.trackAll && ~info.trackOne then begin
Widget_Control, info.trackAllMenu, Set_Button=1
Widget_Control, info.trackOneMenu, Set_Button=0
info.trackOne=0
info.trackAll=1
endif else begin
Widget_Control, info.trackAllMenu, Set_Button=1
Widget_Control, info.trackOneMenu, Set_Button=0
info.trackOne=0
info.trackAll=1
info.statusBar->update,'Tracking in unexpected or illegal internal state'
endelse
if (~info.trackingv && ~info.legendOn && ~info.trackingh) then begin
widget_control,info.showPositionMenu,set_button=1
widget_control,info.trackvMenu,set_button=1
widget_control,info.trackhMenu,set_button=1
info.drawObject->vBarOn,all=info.trackAll
info.drawObject->hBarOn
info.drawObject->legendOn,all=info.trackAll
info.trackingv = 1
info.trackingh = 1
info.legendOn = 1
endif else begin
if info.trackingv then begin
widget_control,info.trackvMenu,set_button=1
info.drawObject->vBarOn,all=info.trackAll
endif else begin
widget_control,info.trackvMenu,set_button=0
info.drawObject->vBarOff
endelse
if info.trackingh then begin
widget_control,info.trackhMenu,set_button=1
info.drawObject->hBarOn
endif else begin
widget_control,info.trackhMenu,set_button=0
info.drawObject->hBarOff
endelse
if info.legendOn then begin
widget_control,info.showPositionMenu,set_button=1
info.drawObject->legendOn,all=info.trackAll
endif else begin
widget_control,info.showPositionMenu,set_button=0
info.drawObject->legendOff
endelse
endelse
activeWindow=info.windowStorage->GetActive()
if n_elements(activeWindow) gt 0 && $
obj_valid(activeWindow[0]) then begin
activeWindow[0]->SetProperty, Tracking=1
endif
widget_control,event.id,set_button=1
info.tracking = 1
info.statusBar->Update, 'Tracking turned on'
info.drawObject->Update,info.windowStorage,info.loadedData
info.drawObject->Draw
endif else begin
Widget_Control, info.trackhMenu, Set_Button=0
Widget_Control, info.trackvMenu, Set_Button=0
Widget_Control, info.trackAllMenu, Set_Button=0
Widget_Control, info.trackOneMenu, Set_Button=0
widget_control, info.showPositionMenu,set_button=0
Widget_Control, event.id, Set_Button=0
activeWindow=info.windowStorage->GetActive()
if n_elements(activeWindow) gt 0 && $
obj_valid(activeWindow[0]) then begin
activeWindow[0]->SetProperty, Tracking=0
endif
info.drawObject->vBarOff
info.drawObject->hBarOff
info.drawObject->legendOff
info.tracking = 0
info.statusBar->Update, 'Tracking turned off'
endelse
end
'TRACKALL': BEGIN
result = Widget_Info(event.id, /Button_Set)
IF result EQ 0 THEN BEGIN
info.trackAll = 1
info.trackOne = 0
info.tracking = 1
Widget_Control, info.trackAllMenu, Set_Button=1
Widget_Control, info.trackOneMenu, Set_Button=0
Widget_Control, info.trackMenu, Set_Button=1
all = 1
ENDIF ELSE BEGIN
info.trackall = 0
info.trackOne = 1
info.tracking = 1
Widget_Control, info.trackAllMenu, Set_Button=0
Widget_Control, info.trackOneMenu, Set_Button=1
Widget_Control, info.trackMenu, Set_Button=1
all = 0
ENDELSE
if info.trackingv then begin
widget_control,info.trackvMenu,set_button=1
info.drawObject->vBarOn, all=all
endif
if info.legendOn then begin
widget_control,info.showPositionMenu,set_button=1
info.drawObject->legendOn,all=all
endif
if info.trackingh then begin
widget_control,info.trackhMenu,set_button=1
info.drawObject->hBarOn
endif
if ~info.trackingv && ~info.legendOn && ~info.trackingh then begin
info.trackingv = 1
info.trackingh = 1
info.legendOn = 1
widget_control,info.trackvMenu,set_button=1
info.drawObject->vBarOn, all=all
widget_control,info.trackhMenu,set_button=1
info.drawObject->hBarOn
widget_control,info.showPositionMenu,set_button=1
info.drawObject->legendOn,all=all
endif
activeWindow=info.windowStorage->GetActive()
if n_elements(activeWindow) gt 0 && $
obj_valid(activeWindow[0]) then begin
activeWindow[0]->SetProperty, Tracking=1
endif
info.drawObject->Update,info.windowStorage,info.loadedData
info.drawObject->Draw
if all then begin
info.statusBar->Update, 'Tracking turned on for all panels'
endif else begin
info.statusBar->Update, 'Tracking turned on for single panel'
endelse
END
'TRACKONE': BEGIN
result = Widget_Info(event.id, /Button_Set)
IF result EQ 1 THEN BEGIN
info.trackAll = 1
info.trackOne = 0
info.tracking = 1
Widget_Control, info.trackAllMenu, Set_Button=1
Widget_Control, info.trackOneMenu, Set_Button=0
Widget_Control, info.trackMenu, Set_Button=1
all = 1
ENDIF ELSE BEGIN
info.trackall = 0
info.trackOne = 1
info.tracking = 1
Widget_Control, info.trackAllMenu, Set_Button=0
Widget_Control, info.trackOneMenu, Set_Button=1
Widget_Control, info.trackMenu, Set_Button=1
all = 0
ENDELSE
if info.trackingv then begin
widget_control,info.trackvMenu,set_button=1
info.drawObject->vBarOn, all=all
endif
if info.trackingh then begin
widget_control,info.trackhMenu,set_button=1
info.drawObject->hBarOn
endif
if info.legendOn then begin
widget_control,info.showPositionMenu,set_button=1
info.drawObject->legendOn,all=all
endif
if ~info.trackingv && ~info.legendOn && ~info.trackingh then begin
info.trackingv = 1
info.trackingh = 1
info.legendOn = 1
widget_control,info.trackvMenu,set_button=1
info.drawObject->vBarOn, all=all
widget_control,info.trackhMenu,set_button=1
info.drawObject->hBarOn
widget_control,info.showPositionMenu,set_button=1
info.drawObject->legendOn,all=all
endif
activeWindow=info.windowStorage->GetActive()
if n_elements(activeWindow) gt 0 && $
obj_valid(activeWindow[0]) then begin
activeWindow[0]->SetProperty, Tracking=1
endif
info.drawObject->Update,info.windowStorage,info.loadedData
info.drawObject->Draw
if all then begin
info.statusBar->Update, 'Tracking turned on for all panels'
endif else begin
info.statusBar->Update, 'Tracking turned on for single panel'
endelse
END
'TRACKV': BEGIN
result = Widget_Info(event.id, /Button_Set)
if result eq 0 then begin
info.trackingv = 1
info.tracking = 1
widget_control,info.trackvMenu,set_button=1
widget_control,info.trackMenu,set_button=1
if info.trackAll then begin
info.trackOne = 0
info.trackAll = 1
widget_control,info.trackAllMenu,set_button=1
widget_control,info.trackOneMenu,set_button=0
all = 1
endif else begin
info.trackOne = 1
info.trackAll = 0
widget_control,info.trackAllMenu,set_button=0
widget_control,info.trackOneMenu,set_button=1
all = 0
endelse
info.drawObject->vBarOn,all=all
if info.legendOn then begin
info.legendOn = 1
widget_control,info.showPositionMenu,set_button=1
info.drawObject->legendOn,all=all
endif else begin
info.legendOn = 0
widget_control,info.showPositionMenu,set_button=0
info.drawObject->legendOff
endelse
if info.trackingh then begin
info.trackingh = 1
widget_control,info.trackhMenu,set_button=1
info.drawObject->hBarOn
endif else begin
info.trackingh = 0
widget_control,info.trackhMenu,set_button=0
info.drawObject->hBarOff
endelse
activeWindow=info.windowStorage->GetActive()
if n_elements(activeWindow) gt 0 && $
obj_valid(activeWindow[0]) then begin
activeWindow[0]->SetProperty, Tracking=1
endif
info.drawObject->Update,info.windowStorage,info.loadedData
info.drawObject->Draw
info.statusBar->Update, 'Vertical tracking turned on'
endif else begin
info.trackingv = 0
widget_control,info.trackvMenu,set_button=0
info.drawObject->vBarOff
resultL = widget_info(info.showPositionMenu,/button_set)
resultH = widget_info(info.trackHMenu,/button_set)
if ~resultL && ~resultH then begin
info.tracking = 0
info.legendOn = 0
info.trackingh = 0
widget_control,info.trackMenu,set_button=0
widget_control,info.trackAllMenu,set_button=0
widget_control,info.trackOneMenu,set_button=0
widget_control,info.trackHMenu,set_button=0
info.drawObject->legendOff
info.drawObject->hBarOff
activeWindow=info.windowStorage->GetActive()
if n_elements(activeWindow) gt 0 && $
obj_valid(activeWindow[0]) then begin
activeWindow[0]->SetProperty, Tracking=0
endif
endif
info.statusBar->Update, 'Vertical tracking turned off'
endelse
END
'TRACKH': BEGIN
result = Widget_Info(event.id, /Button_Set)
if result eq 0 then begin
info.trackingh = 1
info.tracking = 1
widget_control,info.trackhMenu,set_button=1
widget_control,info.trackMenu,set_button=1
if info.trackAll then begin
info.trackOne = 0
info.trackAll = 1
widget_control,info.trackAllMenu,set_button=1
widget_control,info.trackOneMenu,set_button=0
all = 1
endif else begin
info.trackOne = 1
info.trackAll = 0
widget_control,info.trackAllMenu,set_button=0
widget_control,info.trackOneMenu,set_button=1
all = 0
endelse
info.drawObject->hBarOn
if info.legendOn then begin
info.legendOn = 1
widget_control,info.showPositionMenu,set_button=1
info.drawObject->legendOn,all=all
endif else begin
info.legendOn = 0
widget_control,info.showPositionMenu,set_button=0
info.drawObject->legendOff
endelse
if info.trackingv then begin
info.trackingv = 1
widget_control,info.trackvMenu,set_button=1
info.drawObject->vBarOn,all=all
endif else begin
info.trackingv = 0
widget_control,info.trackvMenu,set_button=0
info.drawObject->vBarOff
endelse
activeWindow=info.windowStorage->GetActive()
if n_elements(activeWindow) gt 0 && $
obj_valid(activeWindow[0]) then begin
activeWindow[0]->SetProperty, Tracking=1
endif
info.drawObject->Update,info.windowStorage,info.loadedData
info.drawObject->Draw
info.statusBar->Update, 'Vertical tracking turned on'
endif else begin
info.trackingh = 0
widget_control,info.trackhMenu,set_button=0
info.drawObject->hBarOff
resultL = widget_info(info.showPositionMenu,/button_set)
resultV = widget_info(info.trackVMenu,/button_set)
if ~resultL && ~resultV then begin
info.tracking = 0
info.legendOn = 0
info.trackingv = 0
widget_control,info.trackMenu,set_button=0
widget_control,info.trackAllMenu,set_button=0
widget_control,info.trackOneMenu,set_button=0
widget_control,info.trackVMenu,set_button=0
info.drawObject->legendOff
info.drawObject->vBarOff
activeWindow=info.windowStorage->GetActive()
if n_elements(activeWindow) gt 0 && $
obj_valid(activeWindow[0]) then begin
activeWindow[0]->SetProperty, Tracking=0
endif
endif
info.statusBar->Update, 'Horizontal tracking turned off'
endelse
END
'RUBBERBANDX': BEGIN
controlid = widget_info(event.top,find_by_uname='RUBBERBANDX')
isset = widget_info(controlid,/button_set)
widget_control,controlid,set_button=~isset
END
'MARKER': BEGIN
result = widget_info(event.id, /button_set)
IF result EQ 0 THEN BEGIN
Widget_Control, event.id, Set_Button=1
info.markerTitleOn=1
ENDIF ELSE BEGIN
Widget_Control, event.id, Set_Button=0
info.markerTitleOn=0
ENDELSE
END
'PAGE': spd_ui_page_options, info
'PANEL': spd_ui_panel_options, info.master, info.windowStorage, info.loadedData, info.historyWin, $
info.drawObject,info.template_object, info.statusBar
'LINE': spd_ui_line_options, info.master, info.windowStorage, info.loadedData, info.historyWin, $
info.drawObject,info.template_object, info.statusBar
'LEGEND': spd_ui_legend_options, info, tlb_statusbar=info.statusBar
'LAYOUT': spd_ui_layout_options, info
'XAXIS': spd_ui_axis_options, info.master, info.windowStorage, info.loadedData, $
info.drawObject, info.historyWin, $
'X Axis Options', 0, $
info.scrollbar,info.template_object, info.statusBar
'YAXIS': spd_ui_axis_options, info.master, info.windowStorage, info.loadedData, $
info.drawObject, info.historyWin, $
'Y Axis Options', 1, $
info.scrollbar,info.template_object, info.statusBar
'ZAXIS': spd_ui_zaxis_options, info.master, info.windowStorage, info.zAxisSettings, info.drawObject, info.loadedData, info.historywin,info.template_object, info.statusBar
'MARKERP': spd_ui_marker_options, info.master, info.historywin
'VARIABLE': begin
spd_ui_variable_options, info.master, info.loadeddata, info.windowstorage, info.drawobject, info.historywin,info.template_object,info.guiTree
end
'NUDGE': BEGIN
info.windowStorage->getProperty,callSequence=callSequence
spd_ui_nudge_options, info.master, info,callSequence
END
'CALCULATE': BEGIN
info.windowStorage->getProperty,callSequence=callSequence
spd_ui_calculate, info.master,info.loadedData,info.calcSettings, info.historywin,info.guiTree,callSequence, $
info.drawObject, info.windowStorage, info.scrollbar, info.statusBar
END
'DPROC': spd_ui_dproc_panel, info
'ZOOM': BEGIN
widget_control,info.zoom,get_value=zoomval
if ~finite(zoomval,/nan) then begin
if obj_isa(info.drawWin,'IDLgrWindow') then begin
if ~event.valid && zoomval eq 200 then begin
info.statusBar->Update,"Maximum zoom is 200%"
endif else if ~event.valid && zoomval le 10 then begin
info.statusBar->Update, "Minimum zoom is 1%"
endif
if zoomval gt 200 then begin
info.statusBar->Update,"Maximum zoom is 200%"
endif else if zoomval lt 1 then begin
info.statusBar->Update,"Minimum zoom is 1%"
endif else begin
info.drawobject->setzoom,double(zoomval)/100
if event.valid then info.statusbar->update,"Zoom updated."
if strlowcase(!version.os_family) eq 'windows' then begin
info.scrollbar->getproperty, xsize=sb_xsize
info.scrollbar->setproperty, xsize=sb_xsize
endif
endelse
endif else begin
zoomval = 100
widget_control,info.zoom,set_value=zoomval
endelse
endif else info.statusbar->update,'Invalid Zoom value, please re-enter.'
END
'NEWWIN':BEGIN
info.ctrl=0
spd_ui_window, info
END
'WINBUTTON': BEGIN
result = Widget_Info(event.id, /Button_Set)
info.windowMenus->Clear
IF result EQ 0 THEN Widget_Control, event.id, Set_Button=1 $
ELSE Widget_Control, event.id, Set_Button=0
ids=info.windowMenus->GetIds()
names=info.windowMenus->GetNames()
IF N_Elements(ids) EQ 1 THEN index=0 ELSE index = Where(ids EQ event.id)
IF index GE 0 THEN BEGIN
windowObjs=info.windowStorage->GetObjects()
IF N_Elements(windowObjs) GT 0 THEN BEGIN
FOR i=0,N_Elements(windowObjs)-1 DO BEGIN
windowObjs[i]->GetProperty, Name=name, Id=id
IF name EQ names[index] THEN BEGIN
IF result EQ 0 THEN begin
info.windowStorage->SetActive, Id=id
spd_ui_orientation_update,info.drawObject,info.windowStorage
info.drawObject->Update,info.windowStorage, info.loadedData
info.drawObject->Draw
info.scrollbar->update
endif
ENDIF
ENDFOR
ENDIF
ENDIF
Widget_Control, event.id, Set_Button=1
END
'HELP': BEGIN
spd_ui_help_window, info.historyWin, info.master
END
'HELPFORM': spd_gui_error, info.master, info.historyWin
'HELPABOUT': spd_ui_help_about, info.master, info.historyWin
'RESET_PAGE_TEMPLATE':info.template_object->setProperty,page=obj_new()
'RESET_LEGEND_TEMPLATE':info.template_object->setProperty,legend=obj_new()
'RESET_PANEL_TEMPLATE': info.template_object->setProperty,panel=obj_new()
'RESET_XAXIS_TEMPLATE': info.template_object->setProperty,x_axis=obj_new()
'RESET_YAXIS_TEMPLATE': info.template_object->setProperty,y_axis=obj_new()
'RESET_ZAXIS_TEMPLATE': info.template_object->setProperty,z_axis=obj_new()
'RESET_LINE_TEMPLATE': info.template_object->setProperty,line=obj_new()
'RESET_VARIABLE_TEMPLATE': info.template_object->setProperty,variable=obj_new()
'FIELDMODELS': begin
spd_ui_field_models, info
end
ELSE: info.statusBar->Update, 'Feature Not Yet Implemented: ' + uservalue
ENDCASE
spd_ui_update_title, info
info.drawDisabled = 0
Widget_Control, event.TOP, Set_UValue=info, /No_Copy
RETURN
END
PRO spd_gui,reset=reset,template_filename=template_filename
If(xregistered('spd_gui') Ne 0) Then Begin
message, /info, 'You are already running spd_gui'
Return
Endif
thm_init
spedas_init
thm_graphics_config
spd_gui_init
cdf_leap_second_init
spd_ui_fix_performance, !spedas.linux_fix
!EXCEPT=0
if double(!version.release) ge 6.4d then begin
getresourcepath,rpath
palettebmp = read_bmp(rpath + 'thmLogo.bmp', /rgb)
palettebmp = transpose(palettebmp, [1,2,0])
_extra = {bitmap:palettebmp}
endif
gui_title = 'Space Physics Environment Data Analysis Software (SPEDAS)'
master = Widget_Base(Title=gui_title, MBar=bar, /TLB_Kill_Request_Events, $
/Col, XPad=10, /Kbrd_Focus_Events,tlb_size_events=1, _extra=_extra, TAB_MODE=1)
toolBarBase = Widget_Base(master, /Row, /ToolBar)
scrollbase = widget_base(master, /row, xpad=0, ypad=0, space=0)
pathBase = Widget_Base(master, /Col, /Align_Left)
graphBase = Widget_Base(master, /Row)
statusBase = Widget_Base(master, /Row)
fileMenu= Widget_Button(bar, Value='File ', /Menu)
openMenu = Widget_Button(fileMenu, Value='Open SPEDAS Document... ', UValue='OPEN', $
Accelerator="Ctrl+O")
saveMenu = Widget_Button(fileMenu, Value='Save SPEDAS Document... ', UValue='SAVE', $
Accelerator="Ctrl+S")
saveAsMenu = Widget_Button(fileMenu, Value='Save SPEDAS Document As... ', UValue='SAVEAS')
templateMenu = Widget_Button(fileMenu, Value='Template ',/menu)
openTemplate = Widget_Button(templateMenu, Value='Open Template... ', UValue='OPEN_TEMPLATE' )
saveTemplate = Widget_Button(templateMenu, Value='Save Template... ', UValue='SAVE_TEMPLATE' )
saveAsTemplate = Widget_Button(templateMenu, Value='Save Template As... ', UValue='SAVEAS_TEMPLATE')
resetTemplateMenu = Widget_Button(templateMenu, Value='Reset Template ',/menu)
resetPageTemplate = Widget_Button(resetTemplateMenu, Value='Reset Page Template', UValue='RESET_PAGE_TEMPLATE')
resetPanelTemplate = Widget_Button(resetTemplateMenu, Value='Reset Panel Template', UValue='RESET_PANEL_TEMPLATE')
resetLegendTemplate = Widget_Button(resetTemplateMenu, Value='Reset Legend Template', UValue='RESET_LEGEND_TEMPLATE')
resetXAxisTemplate = Widget_Button(resetTemplateMenu, Value='Reset X-Axis Template', UValue='RESET_XAXIS_TEMPLATE')
resetYAxisTemplate = Widget_Button(resetTemplateMenu, Value='Reset Y-Axis Template', UValue='RESET_YAXIS_TEMPLATE')
resetZAxisTemplate = Widget_Button(resetTemplateMenu, Value='Reset Z-Axis Template', UValue='RESET_ZAXIS_TEMPLATE')
resetLineTemplate = Widget_Button(resetTemplateMenu, Value='Reset Line Template', UValue='RESET_LINE_TEMPLATE')
resetVariableTemplate = Widget_Button(resetTemplateMenu, Value='Reset Variable Template', UValue='RESET_VARIABLE_TEMPLATE')
loadMenu = Widget_Button(fileMenu, Value='Load Data ', UValue='LOAD', /Separator)
loadCDAWebMenu = Widget_Button(fileMenu, Value='Load Data using CDAWeb', UValue='LOADCDAWEB')
loadCDFMenu = Widget_Button(fileMenu, Value='Load CDF', UValue='LOADCDF')
saveDataAsMenu = Widget_Button(fileMenu, Value='Save Data As... ', UValue='SAVEDATAAS')
importExportMenu = Widget_button(fileMenu, Value='Manage Data and Import/Export Tplot Variables...', UValue='MANAGEDATA')
exportMetaMenu = Widget_Button(fileMenu, Value='Export To Image File... ', $
UValue='EXPORTMETA', Sensitive=1, /Separator)
printMenu = Widget_Button(fileMenu, Value='Print... ', UValue='PRINT', /Separator, $
Accelerator="Ctrl+P")
psetupMenu = Widget_Button(fileMenu, Value='Print Setup ', UValue='PSETUP')
propertiesMenu = Widget_Button(fileMenu, Value='Configuration Settings... ', UValue='CONF', $
/Separator)
exitMenu = Widget_Button(fileMenu, value='Exit ',UValue='EXIT', /Separator, Accelerator="Ctrl+Q")
editMenu = Widget_Button(bar, Value='Edit ', /Menu)
copyMenu = Widget_Button(editMenu, Value='Copy ', UValue='COPY', $
Accelerator="Ctrl+C")
deletemMenu = Widget_Button(editMenu, Value='Delete Marker ', UValue='DELETEM', $
Sensitive=1)
subSetMenu = Widget_Button(editMenu, Value= 'Subset ', /menu, /Separator)
subPageMenu = Widget_Button(subSetMenu, Value='Page ', UValue='SUBPAGE')
subMarkerMenu = Widget_Button(subSetMenu, Value='Marker (Single Panel) ', UValue='SUBMARKER', $
Sensitive=1)
subMarkerMenu = Widget_Button(subSetMenu, Value='Marker (All Panels) ', UValue='SUBMARKERMULTI', $
Sensitive=1)
viewMenu=Widget_Button(bar, Value='View ', /Menu)
refreshMenu = Widget_Button(viewMenu, Value='Refresh ', UValue='REFRESH', Accelerator="Ctrl+R")
scrollfMenu = Widget_Button(viewMenu, Value='Scroll Forward (Right)', UValue='SCROLLF', $
/separator)
scrollbMenu = Widget_Button(viewMenu, Value='Scroll Backward (Left)', UValue='SCROLLB')
expandMenu = Widget_Button(viewMenu, Value='Expand (Tab)', UValue='EXPAND', $
/Separator)
reduceMenu = Widget_Button(viewMenu, Value='Reduce (Backspace)', UValue='REDUCE')
historyMenu = Widget_Button(viewMenu, Value='History Window', /Checked_Menu, $
UValue='HISTORYW', /Separator)
showPositionMenu = Widget_Button(viewMenu, Value='Legend', /Checked_Menu, $
UValue='POSITIONBAR')
Widget_Control, showPositionMenu, Set_Button=1
graphMenu = Widget_Button(bar, Value='Graph ', /Menu)
trackMenu = Widget_Button(graphMenu, Value='Panel Tracking', /Checked_Menu, $
UValue='TRACK')
trackOneMenu = Widget_Button(graphMenu, Value='Track One Panel', /Checked_Menu, $
UValue='TRACKONE')
trackAllMenu = Widget_Button(graphMenu, Value='Track All', /Checked_Menu, $
UValue='TRACKALL')
Widget_Control, trackMenu, Set_Button=1
Widget_Control, trackallMenu, Set_Button=1
trackHMenu = Widget_Button(graphMenu, Value='Show Horizontal Tracking', $
/Checked_Menu, UValue='TRACKH', /Separator)
widget_control,trackHMenu,set_button=1
trackVMenu = Widget_Button(graphMenu, Value='Show Vertical Tracking', $
/Checked_Menu, UValue='TRACKV')
Widget_Control, trackVMenu, Set_Button=1
rubberBandX = Widget_button(graphMenu, value='Rubber Band for X-Only',/checked_menu,uname='RUBBERBANDX',uvalue='RUBBERBANDX')
Widget_Control, rubberBandX, Set_Button=1
markerTitleMenu = Widget_Button(graphMenu, Value='Query for Marker Title', /checked_menu, $
Uvalue='MARKER', /separator)
Widget_Control, markerTitleMenu, set_button=1
layoutOptMenu = Widget_Button(graphMenu, Value='Plot/Layout Options... ', UValue='LAYOUT', /separator)
pageMenu = Widget_Button(graphMenu, Value='Page Options... ', UValue='PAGE')
panelMenu = Widget_Button(graphMenu, Value='Panel Options... ', UValue='PANEL')
lineMenu = Widget_Button(graphMenu, Value='Line Options... ', UValue='LINE')
legendMenu = Widget_Button(graphMenu, Value='Legend Options...', UValue='LEGEND')
xaxisMenu = Widget_Button(graphMenu, Value='X Axis Options... ', UValue='XAXIS')
yaxisMenu = Widget_Button(graphMenu, Value='Y Axis Options... ', UValue='YAXIS')
zaxisMenu = Widget_Button(graphMenu, Value='Z Axis Options... ', UValue='ZAXIS')
variableMenu = Widget_Button(graphMenu, Value='Variable Options... ', $
UValue='VARIABLE')
analysisMenu=Widget_Button(bar, Value='Analysis ', /Menu)
calculateMenu = Widget_Button(analysisMenu, Value='Calculate... ', UValue='CALCULATE')
nudgeMenu = Widget_Button(analysisMenu, Value='Nudge Traces ', UValue='NUDGE')
dprocMenu = Widget_Button(analysisMenu, Value = 'Data Processing... ', UValue = 'DPROC', $
sensitive = 1)
tsyMenu = widget_button(analysisMenu, value='Magnetic Field Models...', uval='FIELDMODELS')
pluginsMenu = widget_button(bar, value='Plugins ', /menu)
spd_ui_plugin_menu, pluginsMenu
windowMenu = Widget_Button(bar, Value='Pages ', /Menu, UValue=0)
newWinMenu = Widget_Button(windowMenu, Value='New ', UValue='NEWWIN',Accelerator="Ctrl+N")
closeWinMenu = Widget_Button(windowMenu, Value='Close ', UValue='CLOSE', Accelerator="Ctrl+Z")
helpMenu = Widget_Button(bar, Value='Help ', /Menu)
helpButton = Widget_Button(helpMenu, Value='Help Window...', uValue='HELP')
helpRequestButton = Widget_Button(helpMenu, Value='Help Request Form...', uValue='HELPFORM')
helpAboutButton = Widget_Button(helpMenu, Value='About...', uValue='HELPABOUT')
getresourcepath,rpath
openBMP = read_bmp(rpath + 'folder_horizontal_open.bmp',/rgb)
saveBMP = read_bmp(rpath + 'disk.bmp',/rgb)
printBMP = read_bmp(rpath + 'printer.bmp',/rgb)
copyBMP = read_bmp(rpath + 'copy.bmp',/rgb)
zoomInBMP = read_bmp(rpath + 'double_arrows_in.bmp',/rgb)
zoomOutBMP = read_bmp(rpath + 'double_arrows_out.bmp',/rgb)
plotBMP = read_bmp(rpath + 'np_icon.bmp',/rgb)
shiftRBMP = read_bmp(rpath + 'control_180.bmp',/rgb)
shiftLBMP = read_bmp(rpath + 'control.bmp',/rgb)
plusBMP = read_bmp(rpath + 'plus.bmp',/rgb)
minusBMP = read_bmp(rpath + 'minus.bmp',/rgb)
windowBMP = read_bmp(rpath + 'new_page.bmp',/rgb)
helpBMP = read_bmp(rpath + 'question.bmp',/rgb)
manageBMP = read_bmp(rpath + 'wrench_screwdriver.bmp',/rgb)
loadBMP = read_bmp(rpath + 'folder_open_image.bmp',/rgb)
spd_ui_match_background, master, openBMP
spd_ui_match_background, master, saveBMP
spd_ui_match_background, master, printBMP
spd_ui_match_background, master, copyBMP
spd_ui_match_background, master, zoomInBMP
spd_ui_match_background, master, zoomOutBMP
spd_ui_match_background, master, plotBMP
spd_ui_match_background, master, shiftRBMP
spd_ui_match_background, master, shiftLBMP
spd_ui_match_background, master, plusBMP
spd_ui_match_background, master, minusBMP
spd_ui_match_background, master, windowBMP
spd_ui_match_background, master, helpBMP
spd_ui_match_background, master, manageBMP
spd_ui_match_background, master, loadBMP
plusBMP = FilePath('plus.bmp', SubDir=['resource', 'bitmaps'])
minusBMP = FilePath('minus.bmp', SubDir=['resource', 'bitmaps'])
fileToolBase = Widget_Base(toolBarBase, /Row, XPad=2)
editToolBase = Widget_Base(toolBarBase, /Row, XPad=2)
moveToolBase = Widget_Base(toolBarBase, /Row, XPad=2)
shiftToolBase = Widget_base(toolBarBase, /Row, Xpad=2)
dataToolBase = Widget_base(toolBarBase, /Row, Xpad=2)
plotToolBase = Widget_Base(toolBarBase, /Row, XPad=2)
helpToolBase = Widget_Base(toolBarBase, /Row, XPad=2)
zoomBase = Widget_Base(toolBarBase, /Row, XPad=2)
openBmpButton = Widget_Button(fileToolBase, Value=openbmp, /Bitmap, UValue='OPEN', $
ToolTip='Open File')
saveBmpButton = Widget_Button(fileToolBase, Value=savebmp, /Bitmap, UValue='SAVE', $
ToolTip='Save File')
printBmpButton = Widget_Button(fileToolBase, Value=printbmp, /Bitmap, $
ToolTip='Print', UValue='PRINT')
copyBmpButton = Widget_Button(editToolBase, Value=copybmp, /Bitmap, ToolTip='Copy to clipboard', $
UValue='COPY')
zoomInBmpButton = Widget_Button(moveToolBase, Value=zoominbmp, /Bitmap, $
ToolTip='Reduces X range by major tick mark', UValue='REDUCE')
zoomOutBmpButton = Widget_Button(moveToolBase, Value=zoomoutbmp, /Bitmap, $
ToolTip='Expands X range by major tick mark', UValue='EXPAND')
shiftLBmpButton = Widget_Button(moveToolBase, Value=shiftrbmp, /Bitmap, $
ToolTip='Shift Left by major tick mark', UValue='SCROLLB')
shiftRBmpButton = Widget_Button(moveToolBase, Value=shiftlbmp, /Bitmap, $
ToolTip='Shift Right by major tick mark', UValue='SCROLLF')
plotBmpButton = Widget_Button(plotToolBase, Value=plotbmp, /Bitmap, $
ToolTip='Plot data', UValue='LAYOUT')
windowBmpButton = Widget_Button(plotToolBase, Value=windowbmp, /Bitmap, $
ToolTip='Create New Page', UValue='NEWWIN')
helpBmpButton = Widget_Button(helpToolBase, Value=helpbmp, /Bitmap, ToolTip='Help', $
UValue='HELP')
loadBmpButton = Widget_Button(dataToolBase, Value=loadBMP, /Bitmap, ToolTip='Load Data', $
UValue='LOAD')
manageBmpButton = Widget_Button(dataToolBase, Value=manageBMP, /Bitmap, ToolTip='Manage GUI Data and Import and Export Tplot data', $
UValue='MANAGEDATA')
zoomSpinner = spd_ui_spinner(zoomBase, Increment=10, Value=100, uval='ZOOM',UNITS='%', min_value=1, max_value=200, /disable_all_events)
dev = !d.name
plot_var = !P
if strlowcase(!version.os_family) eq 'windows' then begin
set_plot,'WIN'
endif else begin
set_plot,'X'
endelse
Device, get_screen_size=gss
x_scr_size=gss[0]-gss[0]*.25
y_scr_size=gss[1]-gss[1]*.35
defaultxsize = !D.X_PX_CM * 2.54 * 8.5
defaultysize = !D.Y_PX_CM * 2.54 * 11
xsize = defaultxsize
ysize = defaultysize
defsysv,'!SPD_GUI',exists=thm_exists
if thm_exists && in_set(strlowcase(tag_names(!SPD_GUI)),'loadeddata') && obj_valid(!SPD_GUI.loadeddata) then begin
if keyword_set(reset) then begin
obj_destroy,!SPD_GUI.loadedData
loadedData = Obj_New('SPD_UI_LOADED_DATA')
endif else begin
loadedData = !SPD_GUI.loadedData
endelse
endif else begin
loadedData = Obj_New('SPD_UI_LOADED_DATA')
endelse
template_file = ''
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)
template=obj_new()
endif else begin
template_file = template_filename
endelse
endif else if thm_exists && in_set(strlowcase(tag_names(!SPD_GUI)),'templatepath') && (size(!SPD_GUI.templatepath,/type) eq 7) then begin
if !SPD_GUI.templatepath ne '' then begin
open_spedas_template,template=template,filename=!SPD_GUI.templatepath,$
statusmsg=statusmsg,statuscode=statuscode
if statuscode lt 0 then begin
ok = dialog_message(statusmsg,/error,/center)
template=obj_new()
endif else begin
template_file = !SPD_GUI.templatepath
endelse
endif
endif
if thm_exists && in_set(strlowcase(tag_names(!SPD_GUI)),'windowstorage') && obj_valid(!SPD_GUI.windowstorage) then begin
if keyword_set(reset) then begin
obj_destroy,!SPD_GUI.windowStorage
windowStorage = obj_new('spd_ui_windows',loadedData)
endif else begin
windowStorage = !SPD_GUI.windowStorage
endelse
endif else begin
windowStorage = obj_new('spd_ui_windows',loadedData)
endelse
if obj_valid(template) then begin
windowStorage->setProperty,template=template
endif
windowStorage->getProperty,template=template
current_window = windowstorage->getactive()
if obj_valid(current_window) then begin
current_window->getproperty, settings=cwsettings
if obj_valid(cwsettings) then begin
cwsettings->GetProperty,canvassize=canvassize
xsize=canvasSize[0]*2.54*!D.X_PX_CM
ysize=canvasSize[1]*2.54*!D.Y_PX_CM
endif
endif
x_scr_size = min([defaultxSize,x_scr_size])
charSize = ceil(x_scr_size/!d.x_ch_size)
pathBar = Obj_New('SPD_UI_MESSAGE_BAR', pathBase, XSize=charSize, YSize=2, Value='Path Name')
pathBar->Delete
if !SPD_GUI.renderer eq 0 && strlowcase(!VERSION.os_family) eq 'windows' then begin
retain = 2
endif else begin
retain = 1
endelse
toolbarGeom = Widget_Info(toolbarbase, /Geometry)
drawID = WIDGET_DRAW(graphBase,/scroll,xsize=xsize,ysize=ysize,x_scroll_size=x_scr_size,y_scroll_size=y_scr_size,Frame=3, Motion_Event=1, $
/Button_Event,keyboard_events=2,graphics_level=2,renderer=!SPD_GUI.renderer,retain=retain,/expose_events,/tracking_events,/viewport_events)
drawContextBase = Widget_Base(drawID, /Context_Menu)
contextPanelButton = Widget_Button(drawContextBase, Value='Panel Options...', $
UValue='PANEL')
contextLayoutButton = Widget_Button(drawContextBase, Value='Layout Options...', $
UValue='LAYOUT')
contextLegendButton = Widget_Button(drawContextBase, Value='Legend Options...', $
UVAlue='LEGEND')
contextNudgeButton = Widget_Button(drawContextBase, Value='Nudge Traces', $
UValue='NUDGE')
contextSubSetButton = Widget_Button(drawContextBase, Value='Subset', UValue='SUBSET', $
/Menu, /Separator)
contextSubPageButton = Widget_Button(contextSubSetButton, Value='Page', UValue='SUBPAGE')
contextSubMarkButton = Widget_Button(contextSubSetButton, Value='Marker', UValue='SUBMARKER')
contextCalculateButton = Widget_Button(drawContextBase, Value='Calculate...', UValue='CALCULATE',/Separator)
contextDprocButton = Widget_Button(drawContextBase, Value='Data Processing...', UValue='DPROC')
statusBar = Obj_New('SPD_UI_MESSAGE_BAR', statusBase, XSize=charSize, YSize=1)
positionBase = Widget_Base(graphBase, /Col, ypad=5)
loadtr = Obj_New('SPD_UI_TIME_RANGE', starttime=0d)
historyWin = Obj_New('SPD_UI_HISTORY', historyMenu, master)
pageSettings = Obj_New('SPD_UI_PAGE_SETTINGS',backgroundcolor=[255,255,255])
markerSettings = Obj_New('SPD_UI_MARKER_SETTINGS')
panelSettings = Obj_New('SPD_UI_PANEL_SETTINGS')
lineSettings = Obj_New('SPD_UI_LINE_SETTINGS')
spectraSettings = Obj_New('SPD_UI_SPECTRA_SETTINGS')
xAxisSettings = Obj_New('SPD_UI_AXIS_SETTINGS')
yAxisSettings = Obj_New('SPD_UI_AXIS_SETTINGS')
zAxisSettings = Obj_New('SPD_UI_ZAXIS_SETTINGS')
fieldModelSettings = obj_new('SPD_UI_FIELDMODELS_SETTINGS')
markerButtons = [subMarkerMenu, deletemMenu]
panelButtons = [xaxisMenu, yaxisMenu, variableMenu]
info = {master:master,$
gui_title:gui_title, $
tracking:0,$
marking:0, $
markerFail:0, $
markers:[0.0, 0.0], $
drawID:drawID, $
draw_select:1, $
drawWin:OBJ_NEW(), $
prevEvent:'NODATA', $
screenSize:[x_scr_size,y_scr_size], $
drawDisabled:0,$
drawDisableTimer:0D,$
data:0, $
nWindows:0,$
mainFileName:'', $
lastClick: [0d,0], $
prevEventType:-1, $
statusBar:statusBar, $
pathBar:pathBar, $
trackingv:0, $
trackingh:0, $
trackvMenu:trackvMenu, $
trackhMenu:trackhMenu, $
markerButtons:markerButtons, $
trackMenu:trackMenu, $
prevEventX:0, $
drawingBox:0, $
windowMenu:windowMenu, $
viewPort:0, $
examButton:0, $
pageSettings:pageSettings, $
lineSettings:lineSettings, $
xAxisSettings:xAxisSettings, $
legendOn:0,$
cursorPosition:[0.0, 0.0], $
yAxisSettings:yAxisSettings, $
drawContextBase:drawContextBase, $
graphBase:graphBase,$
showPositionMenu:showPositionMenu, $
historyWin:historyWin, $
loadedData:obj_new(), $
loadtr:loadtr, $
drawObject:OBJ_NEW(), $
windowStorage:obj_new(), $
printObj:OBJ_NEW(), $
rubberBandTimer:0D, $
spectraSettings:spectraSettings, $
windowMenus:obj_new(), $
panelButtons:panelButtons, $
zAxisSettings:zAxisSettings, $
trackOneMenu:trackOneMenu, $
trackAllMenu:trackAllMenu, $
markerSettings:markerSettings, $
resizetime:0D, $
interface_size:[0.0,0.0], $
markerTitleOn:1, $
rubberBanding:0, $
trackAll:1, $
trackOne:0,$
calcSettings:obj_new('spd_ui_calculate_settings'),$
zoom:zoomSpinner,$
dimRatio:[1D,1D],$
ctrl:0,$
click:0,$
rubberBandBox:[0.0, 0.0, 0.0, 0.0],$
imageOptions:ptr_new(), $
oplot_calls:!SPD_GUI.oplot_calls,$
contextMenuOn:0,$
guiTree:ptr_new(0l), $
scrollbar:obj_new(), $
printWarning:0B, $
template_object:template, $
template_filename:template_file, $
dataLoadSelectPtr:ptr_new(), $
saveDataDirPtr:ptr_new(''),$
fieldModelSettings:fieldModelSettings, $
toolbar_ysize:0,$
toolbar_xsize:0 $
}
info.tracking = 1
info.trackingv = 1
info.trackingh = 1
info.legendon = 1
info.toolbar_ysize = toolbarGeom.ysize
info.toolbar_xsize = toolbarGeom.xsize
Widget_Control, master, Set_UValue=info, /No_Copy
Widget_Control, master, /Realize
Widget_Control, master, Get_UValue=info, /No_Copy
info.loadedData=loadedData
Widget_Control, drawID, Get_Value=drawWin
info.drawWin = drawWin
if thm_exists && in_set(strlowcase(tag_names(!SPD_GUI)),'drawobject') && obj_valid(!SPD_GUI.drawObject) then begin
if keyword_set(reset) then begin
obj_destroy,!SPD_GUI.drawObject
drawObj = OBJ_NEW('spd_ui_draw_object',drawWin,statusbar,historyWin)
endif else begin
drawObj = !SPD_GUI.drawObject
drawObj->setProperty,historyWin=historyWin,destination=drawWin,statusBar=statusBar
endelse
endif else begin
drawObj = OBJ_NEW('spd_ui_draw_object',drawWin,statusbar,historyWin)
endelse
windowObjects = windowStorage->getObjects()
if ~obj_valid(windowObjects[0]) then begin
if ~windowStorage->add(settings=pageSettings, isactive=1) then begin
out = error_message('Error initializing default window',/traceback, /center, title='Error in GUI')
widget_control,master,/destroy
return
endif
endif
scrollbar = obj_new('SPD_UI_SCROLL_BAR', scrollbase, x_scr_size, $
windowStorage, loadedData, drawObj, statusbar, $
value=500, range=[0,1000])
windowMenus = Obj_New("SPD_UI_WINDOW_MENUS", windowMenu)
windowMenus->sync, windowstorage
drawWin->setProperty,units=1
drawWin->getProperty,dimensions=dim
drawWin->setProperty,units=0
info.dimRatio = [xsize / 2.54*!D.X_PX_CM, $
ysize / 2.54*!D.X_PX_CM ] / dim
master_geo = widget_info(master,/geometry)
draw_geo = widget_info(drawid,/geometry)
if strlowcase(!version.os_family) eq 'windows' then begin
interface_size = [master_geo.xsize-draw_geo.xsize,master_geo.ysize-draw_geo.ysize]
endif else begin
interface_size = [master_geo.scr_xsize-draw_geo.xsize,master_geo.scr_ysize-draw_geo.ysize]
endelse
info.interface_size=interface_size
if strlowcase(!version.os_family) ne 'windows' then begin
spd_ui_set_cursor,drawWin
endif
drawObj->update,windowStorage,info.loadedData
drawObj->draw
drawObj->vBarOn, /All
drawObj->hBarOn
drawObj->legendOn, /All
scrollbar->update
info.drawObject = drawObj
info.windowStorage=windowStorage
info.windowMenus=windowMenus
info.scrollbar=scrollbar
spd_ui_update_title, info
!spd_gui.drawObject = drawObj
!spd_gui.windowStorage = windowStorage
!spd_gui.loadedData = loadedData
!spd_gui.windowmenus = windowmenus
!spd_gui.historyWin = historyWin
!spd_gui.guiId = master
Widget_Control, master, set_UValue=info, /No_Copy
set_plot,dev
!P=plot_var
XManager, 'spd_gui', master, /No_Block
RETURN
END