PRO qRemoteView_ChangeTimes, state, event ;+ ; NAME: ; qRemoteView_ChangeTimes ; PURPOSE: ; Controls the units of the times (matrix start time and display time). ; Units are either UT or modified Carrington variable. ; CATEGORY: ; Widgets: qRemoteView ; CALLING SEQUENCE: ; qRemoteView_ChangeTimes, state, event ; INPUTS: ; state array[1]; type: structure ; qRemoteView 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) ; INCLUDE: @compile_opt.pro ; On error, return to caller ; CALLS: ; Carrington, TimeSet, TimeGet, 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) ;- 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