!******************************************************************************!
! Tests the panel icon switches
! Since 3.5.4 for bugs 2895 and 2896
! @author  Jeanette McCall
!******************************************************************************!
startmacro/msgid=main/theme=gear4
  switch INTERACTIVE interAct GET DEF=TRUE  SDEF=TRUE  ! for normal interactive test(s)
  switch BASELINE    baseline GET DEF=FALSE SDEF=TRUE  ! for defects or more obscure test case(s)

  call setDatDir

  pipe on
    set instructions "PANEL auto-close and resize PANEs test:\n\nPress the 'X' in the title bar &
                      of the panes/tabs to exit the command and close the pane. &
                      Test cases where an adjacent pane will expand &
                      \n (1) down, \n (2) up, \n (3) to the left, and \n (4) to the right \n\n&
                      Note: Check that the following preference order is followed with respect to the Pane being closed:\n  &
                      1st - Expand Pane below\n  &
                      2nd - Expand Pane above\n  &
                      3rd - Expand Pane that is on right\n  &
                      4th - Expand Pane that is on left"
    panel/setup/controls=gc/exit=none/CUSTOMICONSYMBOL=ShadedX

    ! Put these in tabs
    plot/id=worldTab ^{datDir}.world.prm  options=+bstore view=mercator
    plot/id=pennyTab ^{datDir}.apenny.prm axis=frame

    ! Put these in regular panes
    plot/id=world ^{datDir}.world.prm  options=+bstore view=geo 
    plot/id=worldll ^{datDir}.world.prm  options=+bstore view=LatLon
    plot/id=apan ^{datDir}.world.prm|^{datDir}.cities.prm
    plot/id=penny ^{datDir}.apenny.prm axis=frame     type=cont
    list2/id=fft/EXIT=MESSAGE  ^{datDir}.fftdemo.prm
    shellgui/id=term

    gcontrol label macro "MACRO"
    gcontrol menu main "Exit with Status = " "PASS,FAIL" /tleft
    set gc.main.itemColors {PASS=GREEN,FAIL=RED}

    gcontrol text idtext  "INSTRUCTIONS" "^instructions" 24 25 /title


  pipe off

endmacro

!******************************************************************************!
procedure processMessage m:msg
  if msg.name EQS "MAIN" then
    assert/text="^reg.main.name: User indicated tests" msg.data eqss "PASS"
    pipe stop

  elseif msg.name EQS "WINDOW" and msg.data eqs "CLOSING" then
    popup/blocking=none popup OK "You clicked the close button!" "INFO"

  else
     say "Unhandled message ^msg.name from ^msg.fid"
  endif
return

!******************************************************************************!
! Set the dat directory
!******************************************************************************!
procedure setDatDir
  invoke nxmMajor env.nmversion.subString(0,1)
  invoke major java.lang.Integer.valueOf(nxmMajor)
  if major GE 4 then
    invoke s:datDir           nxm.sys.test.DatLocator.getDatDirLocation()
    invoke s:datDirSlash      nxm.sys.test.DatLocator.getDatDirSlashLocation()
    invoke z:sysDatFull       nxm.sys.test.DatLocator.sysDatFull()
    invoke z:sysTestDatExists nxm.sys.test.DatLocator.sysTestDatExists()
  else
    set s:datDir           "nxm.sys.dat"
    set s:datDirSlash      "nxm/sys/dat"
    set z:sysDatFull       true
    set z:sysTestDatExists false
  endif
return
