startmacro
!
! @BUG     : 2036 FEATURE: must refresh/resize plot to remove a feature
! @BUG     : 2784 FEATURE: Set feature position by screen location, not RWC
! @Author  : J. Bauer
!
switch INTERACTIVE interAct GET DEF=TRUE  SDEF=TRUE
switch BASELINE    baseline GET DEF=FALSE SDEF=TRUE

set defaultInstructions &
    "Should see a text feature on a map of the world. Press the button below and &
     ensure that the feature is removed from the plot."

  call setDatDir

if interAct then

  
  set feattable {NAME="ASCII1",TYPE=SYMBOL,ANCHOR=pixel,X=50,Y=50,&
             COLOR=RED,LINE={SYMBOL="ASCII-TEXT FEATURE",&
             FONTSIZE=20,FONTSTYLE=BOLD|ITALIC}} 
 

  pipe init

  panel/msgid=MAIN/setup/controls=gc
  plot/id=idplot/READOUT="+OnAxis" ^{datDir}.world.prm
  feature label=fascii1 table=^{feattable} plot=idplot

  gcontrol label mainLabel "Main"
   gcontrol menu main "Exit with Status = " "PASS,FAIL" /tleft
   set gc.main.itemColors {PASS=GREEN,FAIL=RED}
  gcontrol text idtext "Instructions" "^defaultInstructions" 40 7 /title

  gcontrol button toggleFeat "" "Toggle Feature"
  
  ! control below added for Bug 2784
  gcontrol button togglePos "Select Anchor Type" "DATA,PIXEL,SCREEN" "PIXEL"

  pipe off

endif

endmacro

!******************************************************************************!
procedure processMessage m:msg

!say "msg.name ^msg.name, 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 "TOGGLEFEAT" then
    set reg.idplot.features.ascii1.enable "~GLOBAL"
    
  elseif msg.name eqs "TOGGLEPOS" then
    set reg.idplot.features.ascii1.anchor msg.data
    
  else
    ! do nothing
    say "^reg.main.name: Unhandled message name: ^msg.name from fid: ^msg.fid data: ^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

!******************************************************************************
procedure open
  ! Automatically called
return
