!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! Definitions and defaults
!
begin procedure 30m-setup-definitions
  tickspace 0 0 0 0
  !
  ! This structure reflects the current status of the setup
  if .not.exist(setup30m) then
     define structure setup30m /global
     !
     ! Number of setups and current setup name
     define integer setup30m%n /global
     define character setup30m%name*16 /global
     !
     ! Internal usage
     define structure setup30m%dir /global
     define character setup30m%dir%pro*128 setup30m%dir%log*128 /global
     define character setup30m%dir%hard*128 /global
     !
     define structure setup30m%file /global
     define character setup30m%file%proj*128 /global
     define character setup30m%file%front*128 /global
     define character setup30m%file%back*128 /global
     define character setup30m%file%spec*128 /global
     define character setup30m%file%line*128 /global
     define character setup30m%file%point*128 /global
     define character setup30m%file%psw*128 /global
     define character setup30m%file%wsw*128 /global
     define character setup30m%file%fsw*128 /global
     define character setup30m%file%otf*128 /global
     define character setup30m%file%otfgeo*128 /global
     define character setup30m%file%sour*128 /global
     define character setup30m%file%log*128 /global
     define character setup30m%file%vis*128 /global
     !
     ! *** JP Is there a way to know that a language is already defined?
     define language 30MSETUP
     define command 30MSETUP\DEFAULTS "@ 30m-setup-defaults"
  endif
  @ 30m-setup-proj-definitions
  @ 30m-setup-new-definitions
  @ 30m-setup-source-definitions
  @ 30m-setup-switch-definitions
  @ 30m-setup-simple-mode-definitions
  @ 30m-setup-otf-definitions
end procedure 30m-setup-definitions
!
begin procedure 30m-setup-defaults
  @ 30m-setup-proj-defaults
  @ 30m-setup-new-defaults
  @ 30m-setup-source-defaults
  @ 30m-setup-switch-defaults
  @ 30m-setup-simple-mode-defaults
  @ 30m-setup-otf-defaults
end procedure 30m-setup-defaults
!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! Widget
!
begin procedure 30m-setup-widget-step
  if (setup30m%dir%pro.eq." ") then
     @ 30m-setup-proj-init
  endif
  if (setup30m%n.eq.0) then
     @ 30m-setup-new
  endif
  define integer buttons[5]
  if (pro%arg[1].eq."proj") then
     let buttons 1 2 3 4 5
  else if (pro%arg[1].eq."source") then
     let buttons 2 3 4 5 1
  else if (pro%arg[1].eq."simple") then
     let buttons 3 4 5 2 1
  else if (pro%arg[1].eq."otf") then
     let buttons 4 5 2 3 1
  else if (pro%arg[1].eq."new") then
     let buttons 5 2 3 4 1
  else
     message e step-widget "Unknown action: "'pro%arg[1]'
     return base
  endif
  define character actions*32[2,5]
  let actions[1] "@ 30m-setup-proj-widget"         "1. Project"
  let actions[2] "@ 30m-setup-source-widget"       "2. Source catalog"         
  let actions[3] "@ 30m-setup-simple-mode-widget"  "3. Simple observing modes"     
  let actions[4] "@ 30m-setup-otf-widget PSW"      "4. OTF PSW"
  let actions[5] "@ 30m-setup-new-widget"          "5. New setup"         
!  let actions[6] "@ 30m-setup-otf-widget FSW"      "6. OTF FSW"
  gui\menu "STEPS" /choices
     for ibutton /in buttons
        gui\button 'actions[1,ibutton]' 'actions[2,ibutton]' 
     next ibutton
  gui\menu /close
end procedure 30m-setup-widget-step
!
begin procedure 30m-setup-widget-image
  say ""
  say "Visualization"
  let name 'name' /prompt "Basename  of your image file"
  let type 'type' /prompt "Extension of your image file"
  let scale  'scale[1]' 'scale[2]'   /prompt "Intensity scale [image unit]"
  let center 'center[1]' 'center[2]' /prompt "Center of Plotted Region [arcsec]"
  let size   'size[1]' 'size[2]'     /prompt "Size of Plotted Region [arcsec]"
end procedure 30m-setup-widget-image
!
begin procedure 30m-setup-widget-status
  say ""
  say "Project files are stored in the "'setup30m%proj%inp%nick'"/ directory"
  say ""
  say "Setup #"'setup30m%n'". File prefix: "'setup30m%name'
end procedure 30m-setup-widget-status
!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
@ 30m-setup-proj-tools.astro
@ 30m-setup-new-tools.astro
@ 30m-setup-source-tools.astro
@ 30m-setup-switch-tools.astro
@ 30m-setup-simple-mode-tools.astro
@ 30m-setup-otf-tools.astro
!
@ 30m-setup-definitions
@ 30m-setup-defaults
!
if ("&1none".ne."nowidgetnone") then
   @ 30m-setup-proj-widget
endif
!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
