;+
; Project     : SOHO - CDS     
;                   
; Name        : SEL_PLOT_MENU
;               
; Purpose     : Selects engineering parameter to be plotted.
;               
; Explanation : Creates the widgets which form the window within which
;               the engineering parameters can be selected.
;               
; Use         : Only within EMON package.
;    
; Inputs      : None
;               
; Opt. Inputs : None
;               
; Outputs     : None
;               
; Opt. Outputs: None
;               
; Keywords    : None
;
; Calls       : None
;               
; Restrictions: For use in engineering data monitor programs only.
;               
; Side effects: None
;               
; Category    : Telemetry
;               
; Prev. Hist. : None
;
; Written     : C D Pike, RAL, 29-Sep-94
;               
; Modified    : Add CANCEL button.  CDP, 18-Jan-95
;               Add non-time plot choice.  CDP, 22-Nov-95
;               Add plot-zoom feature.  CDP, 05-Dec-95
;
; Version     : Version 4, 05-Dec-95
;-            

PRO sel_plot_menu

;
;  commons for communication
;
@emon.com


;
;  guard against trigger happy users
;           
if xregistered('sel_plot') then begin
   widget_control,msg_widg,set_val='One click will do thanks!',/append
   return
endif

;
;  create main base
;
sel_plot_base = WIDGET_BASE(title='Plotting parameter selection',$
                           /FRAME, /COLUMN, xsize=450,xoffset=575,$
                           group_leader = main_base)

;
;  and subsidiary ones
;
pmenu_base  = WIDGET_BASE(sel_plot_base, /COLUMN)
mode_widg   = WIDGET_BASE(pmenu_base, /ROW)
m1_widg     = WIDGET_BASE(pmenu_base, /ROW)


;
;  form the widgets
;
;
;  set up font
;
font = "-adobe-helvetica-bold-r-normal--14-100-100-100-p-82-iso8859-1"

;
;  first the 'Done' button to exit and plot
;
doneid = widget_button(m1_widg, value='Exit', uvalue='Done', font=font)

;
;  then the 'Plot' button to plot
;
doplotid = widget_button(m1_widg, value='Plot', uvalue='Plot', font=font)


;
;  then the clear 
;
clearid = widget_button(m1_widg, value='Reset parameter choice', $
                        uvalue='Reset', font=font)

;
;  then the zoom
;
zoom_id = widget_button(m1_widg, value='Zoom', uvalue='Zoom', font=font)
widget_control, zoom_id, sens=0

;
;  then the reset zoom
;
rzoom_id = widget_button(m1_widg, value='Reset Zoom', uvalue='RZOOM', font=font)
widget_control, rzoom_id, sens=0

;
;  decide on whether time or datum plot
;
m_base = widget_base(mode_widg,/row,space=50)
m_list = ['Time','Datum']
emon_pids = lonarr(2)
xmenu,m_list,m_base,/row,/excl,title='Plot against:',buttons=emon_pids,$
      uvalue=['EPLOT_T','EPLOT_D'],/no_rel

if emon_plottd then begin
   widget_control,emon_pids(0),set_b=1
   widget_control,emon_pids(1),set_b=0
endif else begin
   widget_control,emon_pids(0),set_b=0
   widget_control,emon_pids(1),set_b=1
endelse

;
;  Hardcopy button
;
   
hardonoff = widget_button(m_base,value='Hard copy OFF',uval='HARD',$
                      /no_rel,font=font)
hard = 0
 

;
;  and the list widget to display the list
;
plot_list_id = widget_list(pmenu_base, value=wanted_parms,$
                           ysize=n_elements(wanted_parms)+2)
plot_parms = strarr(n_elements(wanted_parms))



;
;  plot limits
;
eplot_tmin = {CDS_INT_TIME,mjd:-1L,time:0L}
eplot_tmax = {CDS_INT_TIME,mjd:-1L,time:0L}
eplot_dmin = -1
eplot_dmax = -1


;
;  make it all appear
;
WIDGET_CONTROL, sel_plot_base, /realize

end
