!******************************************************************************!
! Test a drawing canvas on top of plots
!
! Arguments: None
!
! Note1: The standard Window (X,Y) position should be set to (25,25) in the .mmp
!        configuration file.
!
! @bug      2388
! @author:  J Bauer
! @version: $Id: test_plot_layer2d_flicker.mm,v 1.1 2011/05/10 19:03:54 jwb Exp $
!******************************************************************************!
startmacro

  set sr 1e5
  set instructions "You should see a raster plot (which has two piped inputs). &
                    Click the button to disable the drawing of one of the input pipes. &
                    The plot should not flicker."
  
  pipe init
    ! create two identical type 2000 piped datafiles
    waveform/rt _wave{ps=32k} shape=sin form=cf elem=inf amp=32e3 freq=sr/10 delta=1/sr
    fft/psd/log _wave _waveb nfft=1k 
    noop/rt _waveb _wavec
    
    panel/setup/controls=gc/msgid=main
      gcontrol label macro "Test MACRO"
        gcontrol menu  main "Exit with Status =" "PASS,FAIL" TABLE={ItemColors={PASS="GREEN",FAIL="RED"}} /tleft
      gcontrol text  idtext "Instructions" instructions 24 8 /title
      plot/id=plot1 _waveb|_wavec cnt=motion 
      gcontrol button myButt "Toggle enabling of _wavec" "ON,OFF" "ON"
    

  pipe off

endmacro

!******************************************************************************!
! Main process message for this macro. Should be right after the 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 "MYBUTT" then
    invoke ,, reg.plot1.layers._wavec.toggle()

  endif

return