!******************************************************************************!
! Test the readout options to PLOT
!
! @bug:    944  PLOT: Plot always displays axis labels in scientific notation
!               - want option to display as a real number
! @bug:    1397 Changing readout precision turns off status readout line
! @bug:    2740 PLOT: Axis values wrong when readout=-Scientific
! Author:  John Marsh / J Bauer
!******************************************************************************!
startmacro
switch INTERACTIVE interAct GET DEF=TRUE  SDEF=TRUE
if interAct then
  ! updated in 3.3.3 for Bug 2740
  wave mywave  AMP=1e9
  set testfile "mywave"
  !set testfile "sinewave.prm"
  pipe init

  panel/msgid=MAIN/setup/controls=gc
  plot/id=idplot/readout=+onaxis testfile
  shellgui/id=idshellgui
  gcontrol label macro "MACRO"
  gcontrol menu main "Exit with Status = " "PASS,FAIL" /tleft
  set gc.main.itemColors {PASS=GREEN,FAIL=RED}

  gcontrol line
  gcontrol button myButt "" "Toggle Scientific" ""
  gcontrol line

  gcontrol text idtext "BUG 944" &
      "1. Use the button above to toggle &
          between scientific (exponential) and standard decimal notation on the &
          X-axis, Y-axis and status readout (move the cursor around inside the &
          plot display area and verify the changes in the readout).&
          The axis labels should rotate when scientific is turned off. \n&
       2. Use MMB > MORE > PRECISION to increase or decrease the precision (decimal places) &
          of the numbers displayed on the status readout. Try some zooms." 24 12 /title

  gcontrol text idtext2 "BUG 1397 (run in SHELLGUI)" &
         "Run 'PLOT ^testfile readout=+ExtPrec' (to show 6 decimal places). Make sure that there &
          is a status readout area at the bottom of the display, and that if you point the cursor &
          inside the plot window, you can see X and Y position information below the X axis. &
          Now hit 'Enter' to exit from the plot." 24 12 /title

!  invoke ,, reg.idshellgui.shell.runCommand("PLOT/ID=PLOT_IN_SUBSHELL/READOUT=+ExtPrec/BG/WPOS=(400,580) ^testfile") !TODO
  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"
!    invoke ,, reg.idshellgui.shell.runCommand("SENDTO PLOT EXIT") ! TODO
    pipe stop

  elseif msg.name eqs "MYBUTT" then
    set reg.idplot.readout "~scientific"
    invoke reg.idplot.resize()

else
  say "^reg.main.name: Unhandled message name: ^msg.name from fid: ^msg.fid data: ^msg.data"
endif

return
