!******************************************************************************!
! 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 "There should be a total of 4 Panels displayed:\n\n&
                      (1) Left - List2 of FFT Demo and Penny\n   &
                         a. Click PUSHPOP icon:panes should POP\n   & 
                            out and PUSH back in.\n   &
                         b. Click custom DIAMOND icon: pane should\n   & 
                            autoclose and show a POPUP message\n\n& 
                      (2) Right Top - Lat/Lon World with Cities shown\n   &
                         a. Click PUSHPOP icon: and the Pane should\n   &
                            POP out and you should also get a POPUP\n   & 
                            message.\n   &
                         b. Click custom 'f' icon: should get a POPUP\n\n&
                      (3) Right Middle - Geodetic World\n   &
                         a. Click PUSHPOP icon: should see POPUP message,\n   &
                            but the Pane should NOT POP out.\n   &
                         b. Click custom ARROW icon: pane should autoclose\n\n&
                      (4) Right Bottom - Shell Gui\n   &
                         a. The PUSHPOP icon should be the old shaded X\n   &
                            icon\n   &
                         b. Click custom AERO icon: nothing should happen"

    ! ---- 1st panel (MAIN panel) ----
    panel/setup=1/controls=gc/options=-rotatetabs/exit=none/PUSHPOPICONACTION=PushPop/CUSTOMICONACTION=Close|Message/CUSTOMICONSYMBOL=Diamond
      plot/id=penny ^{datDir}.apenny.prm axis=frame type=contour
      list2/id=fft/EXIT=MESSAGE  ^{datDir}.fftdemo.prm

      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" 40 35 /title

    ! ---- 2nd panel ----
    panel/setup=2/controls=gc2/exit=none/PUSHPOPICONACTION=PushPop|Message/CUSTOMICONACTION=Message/CUSTOMICONSYMBOL="f"
      plot/id=apan ^{datDir}.world.prm|^{datDir}.cities.prm

    ! ---- 3rd panel ----
    panel/setup=3/controls=gc3/exit=none/PUSHPOPICONACTION=Message/CUSTOMICONACTION=Close/CUSTOMICONSYMBOL="ARROW"
      plot/id=world ^{datDir}.world.prm options=+bstore view=geo

    ! ---- 4th panel ----
    panel/setup=4/controls=gc4/exit=none/PUSHPOPICONSYMBOL=ShadedX/PUSHPOPICONACTION=PushPop/CUSTOMICONSYMBOL="Aero"
      shellgui/id=term

  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"

  elseif msg.name EQS "PUSHPOPCLICKED" then  !bug 2895 check for message generated by user clicking PUSHPOP icon
    res panetitle msg.data.PANE.title
    res command msg.data.EMBEDDED_COMMAND_ID
    popup/WPOS=(100,100,600,140)/blocking=none popup OK "You click the PUSHPOP icon for the command ^command !" "INFO"

  elseif msg.name EQS "CUSTOMICONCLICKED" then  !bug 2895 check for message generated by user clicking custom icon
    res panetitle msg.data.PANE.title
    popup/WPOS=(100,300,600,140)/blocking=none popup OK "You selected the custom icon for the ^panetitle pane!" "INFO"
    
  elseif msg.name EQS "POPUP" then !this is expected

  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
