!******************************************************************************!
! Test updating Axis when plot type changes
!
! @bug      2494 PLOT: Axis titles wrong when changing type
! @author:  J Bauer
! @version: $Id: test_plot_axis.mm,v 1.2 2012/03/22 13:46:37 jwb Exp $
!******************************************************************************!
startmacro
  switch INTERACTIVE interAct GET DEF=TRUE  SDEF=TRUE  ! for normal interactive test(s)
  switch BASELINE    baseline GET DEF=FALSE SDEF=TRUE  ! for defects or more obscure test case(s)

  if interAct then
    set instructions "You should see two plots.\n\nPush the button to change the &
                      plots.\n\nThe Y axis for line plots should NOT be time, while the Y axis for &
                      raster plots SHOULD show 'Time (sec)'."

    waveform/id=wave1 ram:wave1 "SF" elem=50k sin freq=1000 amp=1e4 delta=1e-4
    fft/psd ram:wave1 ram:waveb{form=sb} nfft=1k over=0
    
    pipe on
      panel/msgid=MAIN/setup/controls=gc
      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 15 /title

      gcontrol button myButt "" "Toggle plot types"
      
      plot/id=rasterplot ram:waveb
      plot/id=lineplot ram:waveb type=line
      
    pipe off

  endif
endmacro

!******************************************************************************!
! Main process message for this macro. 
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 curType1 reg.rasterplot.getPlotType()
    invoke curType2 reg.lineplot.getPlotType()
    
    if curType1 eqs "LINE" then
      invoke ,, reg.rasterplot.setPlotType("RASTER")
    else
      invoke ,, reg.rasterplot.setPlotType("LINE")
    endif
    
    if curType2 eqs "LINE" then
      invoke ,, reg.lineplot.setPlotType("RASTER")
    else
      invoke ,, reg.lineplot.setPlotType("LINE")
    endif
    
  else
    say "Unhandled message name: ^msg.name from fid: ^msg.fid data: ^msg.data"
  endif
return