!
! Test for cursor changes in PLOT.
!
! See BUGs 1230 and 2249
!
! Author:  J. Bauer
!
startmacro

  invoke s:cursorList nxm.sys.libg.MWindow.cursorList
  call setDatDir

  set defInstr "For the cursor types / buttons below:\n\n&
                1) Click on the button\n\n&
                2) Move the cursor over the plot.\n\n&
                3) Zoom in on the plot.\n   &
                   The cursor should remain as you set it.\n   &
                   (zoom can be done on just a few types)\n\n\n&
                Note: 'Custom' will give a WARNing"

  pipe init

    panel/msgid=main/setup/controls=gc

      gcontrol label macro "MACRO"
        gcontrol/tleft menu main "Exit with Status = " "PASS,FAIL" table={ITEMCOLORS={PASS=GREEN,FAIL=RED}}
        gcontrol text idtext "Instructions" "^defInstr" 24 14 /title

      gcontrol/nc=3 button setCursor "Set Cursor" "^cursorList"

    plot/msgid=main ^{datDir}.apenny.prm


  pipe run
  pipe wait
  pipe off

endmacro

procedure processMessage m:msg
  if /debug then say "Got message ^msg data=^msg.data"

  if msg.name eqs "MAIN" then
    assert/text="^reg.main.name: User indicated tests" msg.data eqss "PASS"
    pipe stop

  elseif msg.name eqs "SETCURSOR" then
    set reg.plot.cursor ^msg.data

  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
