!******************************************************************************!
! Test the expanded MARK message.
!
! Note1: This test case (and the DR) is currently on hold, and possibly OBE,
!        since a different resolution was found for the DRs associated with this
!        one.
!
! @bug:     2239
! @author:  J. Bauer
! @version: $Id: test_plot_mark.mm,v 1.3 2013/04/09 14:25:28 jwb Exp $
!******************************************************************************!
startmacro

  set filename "temp_test_feature_time.tmp"
  set elements 1.2M   ! Note: The number of elements is IMPORTANT

  WAVEFORM,OUT=^filename,FORM=SF,ELEM=elements
  headermod filename fs=100 tc=2008:02:28::16:57:09.657
  status filename YD=ydelta

  set deltaT ^ydelta ! 0.013312

  set tlTable {TIMELINEHANDLER={USEINTERPOLATION=true}}
  set instructions "The purpose of this Test is to check the function of the MARKPLUS message. &
                    Click on the plot with the LEFT mouse button and observe the &
                    fields. Zoom in on the plot TWICE and click on it again with the &
                    RIGHT mouse button and observe the fields. Use the button to &
                    toggle the MARK message status and RIGHT click on the plot again. &
                    There should not be a message in the fields."

  pipe on

    panel/msgid=main/setup/controls=gc

    plot/id=psd2/lpb=32/msgid=main filename axis=frame options=+contrast|+markplus cmap=RAMP readout=SHOW|ONAXIS|T

    gcontrol label macro "MACRO"

    gcontrol Menu  MAIN "Exit with Status = " "PASS,FAIL" "Pass" /tleft
    set gc.main.itemcolors {PASS=GREEN,FAIL=RED}

    gcontrol TEXT idtext "Instructions" "^instructions" 20 8 /title

    gcontrol Button toggleMsg "" "Toggle MARK Msg"
    gcontrol button clearPrompts "" "Clear Data Fields Below"
    gcontrol prompt msgType "Message Name: " ""
    gcontrol prompt pixPos "Pixel Coords: " ""
    gcontrol prompt rwcPos "RWC Pos: " ""
    gcontrol prompt dispTime "Time: " ""
    gcontrol prompt dispZoom "Zoom Level:" ""

  pipe off

  !BUG 1744
  erase/quiet/warn=n ^filename
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 "TOGGLEMSG" then
    call clearPrompts
    set reg.psd2.options "~markplus"
  elseif msg.name eqs "CLEARPROMPTS" then
    call clearPrompts
  elseif msg.name eqs "MARK" then
    call clearPrompts
    set gc.msgType.value ^msg.name
  elseif msg.name eqs "MARKPLUS" then
    call clearPrompts
    set gc.msgType.value ^msg.name
    set gc.pixPos.value "^msg.data.px,^msg.data.py"
    set gc.rwcPos.value "^msg.data.x,^msg.data.y"
    timex ^msg.data.t mytime
    set gc.dispTime.value "^mytime"
    set gc.dispZoom.value msg.data.zoomlevel

  else
  !  warn "^reg.main.name: unrecognized msg ^msg.name from msg.fid"
  endif

return

!***********************************************************************************************************************!
procedure clearPrompts
  set gc.msgType.value ""
  set gc.pixPos.value ""
  set gc.rwcPos.value ""
  set gc.dispTime.value ""
  set gc.dispZoom.value ""

return
