!******************************************************************************!
! Tests type 2000 plot with scale=MAXZSCALE.
!
! Arguments: None
!
! NOTE: This test has been modified to NOT use RAM since headermod
!       currently does not work with RAM.
!
! Issue:   NXM-2099 PLOT: scale=maxrange leaves top part blank
! Since:   NeXtMidas 2.9.0
! Author:  J. Hallam / J Bauer
!******************************************************************************!
startmacro/lpb=64
  switch INTERACTIVE interAct GET DEF=TRUE  SDEF=TRUE
  switch BASELINE    baseline GET DEF=FALSE SDEF=TRUE

  if interAct then
    set testFile "test_plot_maxscale.tmp"

    set inst "LEFT plot:\n&
              - fills lower portion of the window.\n\n&
              RIGHT plot:\n&
              - fills up the whole window\n&
              - mostly purple in color\n\n&
              ****************************\n&
              Note: In right plot, data is being filtered."

    wave testFile elem=967113 shape=white
    headermod testFile type=2000 xs=-14765.625 xd=234.375 ys=0.002133333333333 &
                 yd=0.0010666666666666 fs=128 timecode="2009:03:14::03:44:27.999260" &
                 yu="TIME_S" xu="FREQ"

    pipe on
      panel/msgid=MAIN/setup/controls=gc

      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" "^inst" 24 20 /title

      gcontrol dval zrange "Max Z Range:" 2 -1 2 .1 /msg=yes

      plot/all/id=plot1/wtitle="W/O DATARANGE"         testFile scale="MAXRANGE"  MAXRANGE=20 readout="+Z|+onAxis"
      plot/all/id=plot2/msg=main/wtitle="W/ DATARANGE" testFile scale="MAXZRANGE" MAXRANGE=2  readout="+Z|+onAxis"
    pipe off

    erase testFile
  endif

endmacro

!*****************************************************************************
procedure processMessage
  if msg.name EQS "MAIN" then
    assert/text="Tests for QUERY" msg.data eqss "PASS"
    pipe stop
  elseif msg.name eqs "ZRANGE" then
    set reg.plot2.maxRange ^{gc.zrange.value}
    invoke ,, reg.plot2.useRange()
    invoke ,, reg.plot2.refresh()
  endif
return
