!******************************************************************************!
! Test the plotting of files for ALL layers
! @version $Id: test_dr503641-1.mm,v 1.3 2011/06/01 14:52:46 ntn Exp $
!******************************************************************************!
startmacro
  switch INTERACTIVE interAct GET DEF=TRUE  SDEF=TRUE  ! for normal interactive test(s)

if interAct then
  pipe init

  panel/msgid=MAIN/setup
  plot/id=idplot/legend world

  gcontrol label macro "MACRO"
  gcontrol choice "STEPS" "STEPS" "ONE,TWO,THREE" 0
  gcontrol text idtext "Instructions" "This test shows that the legend switch can be used with plot &
  to generate a legend upon macro startup. It also demonstrates that the legend will be dynamically &
  updated whenever a layer is added or removed from the plot. Follow instructions in each step &
  in STEPS Menu..." 24 10 /title
  gcontrol menu main "Exit with Status = " "PASS,FAIL" /tleft

  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 "STEPS" then
  if msg.data EQS "ONE"
    set reg.panel.controls.idtext.value "Add several layers to the plot. To do this, &
    use the middle mouse button in the plot to bring up the plot menu. &
        Select Files-->AddNew, and enter the filename to add. (You can use &
        the following: cities, site, capital_cities. Legend is updated accordingly."
  elseif msg.data EQS "TWO"
    set reg.panel.controls.idtext.value "Remove a layer by bringing up the plot menu &
        again, and select Layers-->LayerName-->Delete. Legend is updated accordingly."

  elseif msg.data EQS "THREE"
    set reg.panel.controls.idtext.value "Toggle layers on and off and try adding and &
        removing layers. This should demonstrate that the mask that tracks the toggle state &
        of each menu item is updated accordingly."

  endif
else
  ! say "Unhandled message name: ^msg.name from fid: ^msg.fid dats: ^msg.data"
endif

return
