pro qSkyImage_ChangeTimes, state, event ;+ ; NAME: ; qSkyImage_ChangeTimes ; PURPOSE: ; Controls the units of the times (matrix start time and display time). ; Units are either UT or modified Carrington variable. ; CATEGORY: ; Widgets: qSkyImage ; CALLING SEQUENCE: ; qSkyImage_ChangeTimes, state, event ; INPUTS: ; state array[1]; type: structure ; qSkyImage state structure ; event array[1]; type: structure ; event structure with event.id=state.wid_uttime or ; state.wid_rotation ; OUTPUTS: ; (updates values of state.wid_tmatrix and state.wid.tdisplay) ; CALLS: ; Carrington, TimeGet, TimeSet, IsTime ; SIDE EFFECTS: ; For a conversion from UT time to Carrington time, the calculation of the ; UT time from the string stored in the value of the time widgets may fail. ; If it does the fields are not updated. ; RESTRICTIONS: ; PROCEDURE: ; The user value of state.wid_tlabel stores the information about which time units ; are currently in use: it stores the widget ID of state.wid_uttime of state.wid_rotation. ; If the event ID does not match this value and event.select=1 then the values ; of both time widgets are converted to the new units, and the user value of ; state.wid_tlabel is updated accordingly. ; STATE INFO USED: ; widget_control, state.wid_tlabel , get_uvalue=wid_unit ; widget_control, state.wid_tmatrix , get_value=tmatrix, get_uvalue=format ; widget_control, state.wid_tdisplay, get_value=tdisplay ; STATE INFO MODIFIED: ; widget_control, event.id, set_button=event.select, set_uvalue=event.select ; widget_control, state.wid_tmatrix , set_value=tmatrix ; widget_control, state.wid_tdisplay, set_value=tdisplay ; widget_control, state.wid_tlabel, set_uvalue=event.id ; MODIFICATION HISTORY: ; MAY-2000, Paul Hick (UCSD/CASS; pphick@ucsd.edu) ;- on_error, 2 ; On error, return to caller COMPILE_OPT hidden widget_control, event.id, set_button=event.select, set_uvalue=event.select if event.select then begin widget_control, state.wid_tlabel , get_uvalue=wid_unit if wid_unit ne event.id then begin widget_control, state.wid_tmatrix , get_value=tmatrix, get_uvalue=format widget_control, state.wid_tdisplay, get_value=tdisplay case event.id of state.wid_uttime: begin ; Rotation -> UT time tmatrix = double(tmatrix ) tdisplay = double(tdisplay) tmatrix = Carrington(tmatrix ) tdisplay = Carrington(tdisplay) tmatrix = TimeGet(tmatrix , /ymd) tdisplay = TimeGet(tdisplay, /ymd) OK = 1B end state.wid_rotation: begin ; UT time -> Rotation tmatrix = TimeSet(tmatrix ) tdisplay = TimeSet(tdisplay) OK = IsTime(tmatrix) and IsTime(tdisplay) if OK then begin tmatrix = string( Carrington(tmatrix ), format=format ) tdisplay = string( Carrington(tdisplay), format=format ) endif end endcase if OK then begin widget_control, state.wid_tmatrix , set_value=tmatrix widget_control, state.wid_tdisplay, set_value=tdisplay widget_control, state.wid_tlabel, set_uvalue=event.id endif endif endif return & end