! Test some of the special features of Layer2D for selecting time boxes in
! a raster plot and handling restarts.
!
! Author:  Neon Ngo / J Bauer
!
startmacro
  switch INTERACTIVE interAct GET DEF=TRUE  SDEF=TRUE
  switch BASELINE    baseline GET DEF=FALSE SDEF=TRUE

  if interAct then
    set instructions "1) Bring up Middle Mouse Button plot menu\n&
                      2) Click 'Options'\n&
                      3) Uncheck 'BStore' to turn OFF Backing Store\n&
                      4) Use MMB, 'Options' to turn BStore back on\n&
                      5) You should see a warning in the &
                      terminal."

    set format sf
    set sr 1e4
    set over 0
    set sfreq sr/10
    set amp 1e4

    pipe init
      panel/msgid=MAIN/setup/controls=gc
      shellgui/attach/id=shellid1/msgid=main
      waveform/id=wave/throttle=real _wave format 10e10 cos freq=sfreq amp=amp delta=1/sr
      fft/dbf _wave _waveb{form=sf} nfft=1k over=over

      plot/id=idplot1/msgid=MAIN/READOUT=Show|OnAxis|T|dT _waveb{LAYER={ENABLE=+BSTORE}} options=+BSTORE view=iXY /lpb=16


      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 15 /title

    pipe off

  endif

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
  endif

return