FORWARD_FUNCTION gui_OutputDialog, gui_OutputDialog_event ;;----------------------------------------------------------------------------- ;; PURPOSE: ;; Creates a dialog box that queries the user for which type of output ;; he/she wants ;; ;; CALLING SEQUENCE: ;; gui_OutputDialog, group_leader, OPTIONS=options ;; ;; REQUIRED INPUTS: ;; group_leader - The owner of the dialog box ;; ;; OUTPUTS: ;; An {outputFiles} structure. If the user clicks 'cancel', this will ;; be a -1 ;; ;; OPTIONAL INPUT KEYWORDS: ;; options - The current output options. Will contain the new options ;; upon returning. ;; ;; EVENTS PRODUCED: ;; No event is returned ;; ;; EXAMPLE: ;; IDL> gui_OutputDialog, group_leader, OPTIONS=options ;; ;; PROCEDURES USED (i.e. called directly!): ;; ;; MODIFICATION HISTORY: ;; 2005-02-04 M. Desnoyer Created ;; ;;----------------------------------------------------------------------------- ;;--------------------------- ;; Event Handler ;;--------------------------- PRO gui_OutputDialog_event, ev ;; Get the options widget_control, ev.TOP, get_uvalue=valPtr CASE widget_info(ev.ID, /uname) OF ;; The ok button 'okbut': BEGIN (*valPtr).ok = 1 widget_control, ev.TOP, /destroy END ;; The cancel button 'cancelbut': BEGIN (*valPtr).ok = 0 widget_control, ev.TOP, /destroy END ;; DN enable 'outdn': BEGIN (*valPtr).opts.dnEna = ev.select widget_control, widget_info(ev.ID,/sibling),sensitive=ev.select END ;; DN filename 'outdnfn': (*valPtr).opts.dnFn = ev.value ;; Reversible RAD enable 'outradrev': BEGIN (*valPtr).opts.radRevEna = ev.select widget_control, widget_info(ev.ID,/sibling),sensitive=ev.select END ;; Reversible RAD filename 'outradrevfn': (*valPtr).opts.radRevFn = ev.value ;; Reversible I/F enable 'outifrev': BEGIN (*valPtr).opts.ifRevEna = ev.select widget_control, widget_info(ev.ID,/sibling),sensitive=ev.select END ;; Reversible I/F filename 'outifrevfn': (*valPtr).opts.ifRevFn = ev.value ;; Unreversible RAD enable 'outrad': BEGIN (*valPtr).opts.radEna = ev.select widget_control, widget_info(ev.ID,/sibling),sensitive=ev.select END ;; Unreversible RAD filename 'outradfn': (*valPtr).opts.radFn = ev.value ;; Unreversible I/F enable 'outif': BEGIN (*valPtr).opts.ifEna = ev.select widget_control, widget_info(ev.ID,/sibling),sensitive=ev.select END ;; Unreversible I/F filename 'outiffn': (*valPtr).opts.ifFn = ev.value ENDCASE END ;;--------------------------- ;; Widget Creation Function ;;--------------------------- FUNCTION gui_OutputDialog, group_leader, OPTIONS=options IF n_elements(options) EQ 0 THEN out = {outputFiles} ELSE out = options ;; Set the values val = {opts:out,ok:0} valPtr = ptr_new(val) ;; Create the window base = widget_base(/modal, group_leader=group_leader, title='Select Outputs', $ uvalue=valPtr, /column) ;; Calibrated DN output outdn = cw_bgroup(base, ['Reversible Calibrated Image in DN'], $ /nonexclusive, uname='outdn', $ set_value=[options.dnEna]) outdnFn = dicw_fnfinder(base, uname='outdnfn', value=options.dnFn, $ sensitive=options.dnEna, filter='*.fit', xsize=20, $ title='Please Select an Output Filename', /write) ;; Reversible RAD output outRadRev = cw_bgroup(base, ['Reversible Calibrated Image in Radiance Units'], $ /nonexclusive, uname='outradrev', $ set_value=[options.radRevEna]) outRadRevFn = dicw_fnfinder(base, uname='outradrevfn', value=options.radRevFn, $ sensitive=options.radRevEna, filter='*.fit', xsize=20, $ title='Please Select an Output Filename', /write) ;; Reversible I/F output outIFRev = cw_bgroup(base, ['Reversible Calibrated Image in I/F Units'], $ /nonexclusive, uname='outifrev', $ set_value=[options.ifRevEna]) outifRevFn = dicw_fnfinder(base, uname='outifrevfn', value=options.ifRevFn, $ sensitive=options.ifRevEna, filter='*.fit', xsize=20, $ title='Please Select an Output Filename', /write) ;; UnReversible RAD output outRad = cw_bgroup(base, ['Unreversible Calibrated Image in Radiance Units'], $ /nonexclusive, uname='outrad', $ set_value=[options.radEna]) outRadFn = dicw_fnfinder(base, uname='outradfn', value=options.radFn, $ sensitive=options.radEna, filter='*.fit', xsize=20, $ title='Please Select an Output Filename', /write) ;; UnReversible I/F output outIF = cw_bgroup(base, ['Unreversible Calibrated Image in I/F Units'], $ /nonexclusive, uname='outif', $ set_value=[options.ifEna]) outifFn = dicw_fnfinder(base, uname='outiffn', value=options.ifFn, $ sensitive=options.ifEna, filter='*.fit', xsize=20, $ title='Please Select an Output Filename', /write) ;; Setup the Buttons butHold = widget_base(base, /row, /align_center) okBut = widget_button(butHold, value="OK", uname="okbut") cancelBut = widget_button(butHold, value="Cancel", uname="cancelbut") widget_control, base, default_button=okBut, cancel_button=cancelBut, /realize ;; Setup the event handler xmanager, 'GUI_OUTPUTDIALOG', base, event_handler='gui_outputdialog_event', $ group_leader=group_leader ;; The modal dialog has been destroyed so recover the options val = *valPtr ptr_free, valPtr RETURN, (val.ok)?val.opts:-1 END