; interactive mode on screen
;
; Permit to interactively inspect the content of the data-set,
; using the mouse on the graphic-screen.  Exit when you click
; the 3rd button of the mouse
; Clicked point are stacked onto the POINT_STACK
;
; that one draws a little cross
;
; see also : point point_dump POINT_PUSH MONOPOINT ZM

refmacro 1
if ($dim ==1 & $disp1d == 0) error "Display must be on"
if ($dim == 2 & ($disp2d == 0 & $cdisp2d == 0 )) error "Display must be on"
if ($dim == 3) error "Not available in 3D"
print "Click on spectrum with left and middle button"
print "Exit by clicking on right button"
if ($dim == 2) print "F1 coord.           F2 coord.        intensity"
if ($dim == 1) print "coord.              intensity"
point_clear
=loop
  monopoint
  if ($button == 3) goto exit
  if ($dim == 1) then
    if ($unit s= 'PPM') then
      print (itop($pointx[1],1,1); "ppm : "; val1d($pointx[1]))
    elsif ($unit s= 'HZ') then
      print (itoh($pointx[1],1,1); "Hz : "; val1d($pointx[1]))
    else
      print ($pointx[1];" : "; val1d($pointx[1]))
    endif
    showline $pointx[1] 1 $pointx[1] 100
  elsif ($dim == 2) then
    if ($unit s= 'PPM') then
      print (itop($pointy[1],2,1);"ppm "; itop($pointx[1],2,2);"ppm : "; val2d($pointy[1],$pointx[1]))
    elsif ($unit s= 'HZ') then
      print (itoh($pointy[1],2,1);"Hz "; itoh($pointx[1],2,2); "Hz : "; val2d($pointy[1],$pointx[1]))
    else
      print ($pointy[1];$pointx[1];" : "; val2d($pointy[1],$pointx[1]))
    endif
    showline ($pointx[1]-1) $pointy[1] ($pointx[1]+1) $pointy[1]
    showline $pointx[1] ($pointy[1]-1) $pointx[1] ($pointy[1]+1)
  endif
  point_push
  goto loop
=exit
point_pop
refmacro 0
exit
