;+ ;NAME: ; thm_ui_overplot_key ; ;PURPOSE: ; Pops up a window that displays the Themis overview plot key (the same one ; that's on the website). ; ;CALLING SEQUENCE: ; thm_ui_overplot_key, gui_id, historyWin, modal=modal ; ;INPUT: ; gui_id: The id of the main GUI window. ; historyWin: The history window object. ; ;KEYWORDS: ; modal = Flag to set the modal of the top level base ; ;OUTPUT: ; none ; ;$LastChangedBy: egrimes $ ;$LastChangedDate: 2013-04-03 14:18:44 -0700 (Wed, 03 Apr 2013) $ ;$LastChangedRevision: 11947 $ ;$URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/thmsoc/tags/tdas_8_00/idl/themis/thm_ui_new/panels/thm_ui_overplot_key.pro $ ;----------------------------------------------------------------------------------- pro thm_ui_overplot_key_draw, state compile_opt idl2, hidden getresourcepath,rpath key = read_png(rpath + 'overplotkey.png') keyImageObj = obj_new('IDLgrImage', key, dimen=[1,1]) model = obj_new('IDLgrModel') model->add, keyImageObj viewRect = [0.0, 0.0, 1.0, 1.0] view = Obj_New('IDLgrView', units=3, viewplane_rect=[0,0,1.,1.]) view->add, model scene = obj_new('IDLgrScene') scene->add, view widget_control, state.keyDisplay, get_value=drawWin drawWin->draw, scene end pro thm_ui_overplot_key_event, event compile_opt idl2, hidden Widget_Control, event.TOP, Get_UValue=state, /No_Copy ;catch block for future additions err_xxx = 0 Catch, err_xxx IF (err_xxx NE 0) THEN BEGIN Catch, /Cancel Help, /Last_Message, Output = err_msg thm_ui_sbar_hwin_update, state, err_msg, /error, err_msgbox_title='Error in Overplot Key' Widget_Control, event.TOP, Set_UValue=state, /No_Copy widget_control, event.top,/destroy RETURN ENDIF ;kill request block IF (Tag_Names(event, /Structure_Name) EQ 'WIDGET_KILL_REQUEST') THEN BEGIN dprint, 'Overview Plot Key widget killed' state.historyWin->Update,'THM_UI_OVERPLOT_KEY: Widget killed' Widget_Control, event.TOP, Set_UValue=state, /No_Copy Widget_Control, event.top, /Destroy RETURN ENDIF IF(TAG_NAMES(event, /STRUCTURE_NAME) EQ 'WIDGET_DRAW') THEN BEGIN ;this code redraws the window if manual redraw & expose events are enabled if event.type eq 4 then begin thm_ui_overplot_key_draw, state endif Widget_Control, event.top, Set_UValue=state, /No_Copy RETURN ENDIF ; what happened? ; widget_control, event.top, get_uval = state widget_control, event.id, get_uval = uval ; check for empty event coming from one of the other event handlers if size(uval,/type) eq 0 then begin Widget_Control, event.top, Set_UValue = state, /No_Copy RETURN endif Case uval Of 'EXIT': BEGIN dprint, 'Overview Plot Key dismissed.' Widget_Control, event.top, Set_UValue=state, /No_Copy widget_control, event.top, /destroy RETURN END ELSE: dprint, 'Not yet implemented' Endcase Widget_Control, event.top, Set_UValue=state, /No_Copy Return end pro thm_ui_overplot_key, gui_id, historyWin, modal=modal compile_opt idl2, hidden y_length = 0 screen_size = GET_SCREEN_SIZE() y_length = screen_size[1] - 140 if (screen_size[1] gt 900) then y_length=900 if (y_length le 450) then y_length=450 keyid = widget_base(/col, title='Overview Plot Key', modal=false, TLB_FRAME_ATTR=1) keyDisplay = widget_draw(keyid, graphics_level=2, renderer=1, retain=0, XSize=750, YSIZE=900, units=0, x_scroll_size=750, y_scroll_size=y_length, /expose_events) buttons= widget_base(keyid, /row, /align_center) exitButtonBase = widget_base(buttons, /col, /align_center) exitButton = widget_button(exitButtonBase, val=' Close ', uval='EXIT', /align_center) state = {gui_id:gui_id, historyWin:historyWin, keyDisplay:keyDisplay} Widget_Control, keyid, Set_UValue=state, /No_Copy CenterTLB, keyid Widget_Control, keyid, /Realize Widget_Control, keyid, Get_UValue=state, /No_Copy thm_ui_overplot_key_draw, state Widget_Control, keyid, Set_UValue=state, /No_Copy Widget_Control, keyid, /Realize xmanager, 'thm_ui_overplot_key', keyid, /no_block Return end