;+
; NAME:
;	SMEI_MENU
;
;
; PURPOSE:
;	GUI for controlling display of SMEI data
;
;
; CATEGORY:
;	CLI
;
;
; CALLING SEQUENCE:
;	smei_menu[, seqref, files=files]
;
;
; OPTIONAL INPUTS:
;	seqref	objref	Object reference for the SMEI_SEQUENCE
;			object. If it is not a SMEI_SEQUENCE, a new
;			object will be created, otherwise an existing
;			object will be opened. If not given, then a
;			new object will be created and then destroyed
;			on exit.
;
;
; KEYWORD PARAMETERS:
;	files	string	A specification of the fits files to be used
;			in the sequence. Only used for a new object.
;	/no_progress	If set, then disable the progress bars (useful
;			if slow network means the progress bars are
;			slowing operation).
;	/show_display	If set, then start by showing the display tab
;			rather than the sequence setting tab
;	/noverify	If set or absent, then trust the image header lists.		
;
;
; MODIFICATION HISTORY:
;	Original: 18/12/02; SJT
;	Add no_progress keyword: 25/8/05; SJT
;	Add show_display keyword: 31/8/10; SJT
;	Add noverify keyword: 11/12/12; SJT
;-

pro smei_menu, seqref, file = files, no_progress = no_progress, $
               show_display = show_display, noverify = noverify,  $
               help = help

  if keyword_set(help) then begin
     self_help
     return
  endif

  if obj_valid(seqref) then begin
     if not obj_isa(seqref, 'SMEI_SEQUENCE') then begin
        smei_msg, /alert, $
                  ['The reqested object exists, but is not a', $
                   'SMEI image sequence, I cannot use it']
        return
     endif
     seqref -> menu, no_progress = no_progress, show_display = $
                     show_display, noverify = noverify
  endif else begin
     if n_elements(noverify) eq 0 then noverify = 1
     iswid = widget_info(/active) ; are there any widgets around?
     if iswid then begin
        base = widget_base()
        widget_control, /destroy, base
        for group = 0l, base-1 do if widget_info(/valid, group) then break
     endif

     seqref = obj_new('SMEI_SEQUENCE', files, /menu, group = group, $
                      no_progress = no_progress, show_display = $
                      show_display, noverify = noverify)

     if n_params() eq 0 then obj_destroy, seqref
  endelse

end
