PRO Display_1D

;+
; PROGECT:
;       Phoenix 2 solar radio spectrometer
;
; NAME:
;	Display_1D
;
; PURPOSE:
;	User interface to handle with a set of plots
;	stored in the selection 
;	It assumes the selectioner is active.
;
; CATEGORY
;	Radio (/ssw/radio)
;
; CALLING SEQUENCE:
;	Display_1D
;
; SIDE EFFECTS:
;	Uses a lot of windows. Uses the selection data type.
;
; RESTRICTION:
;	Use only in interactive mode.
;       Tested only on Unix
;
; SEE ALSO:
;       MDisp, RagView, Display_2D
;
; MODIFICATION HISTORY:
;	Created in April 1991 by A.Csillaghy
;           Inst. of Astronomy ETH Zurich
;       Replaced General_Menu by XChoice for IDL 5.1 version
;           csillag@ssl.berkeley.edu, October 1998
;-

  IF N_Selected() LE 0 THEN RETURN

  mainMenuLength = 11
  mainMenu = StrArr(mainMenuLength)

  mainMenu(0) = 'Reset Zooms'
  mainMenu(1) = 'X Zoom ... '
  mainMenu(2) = 'Y Zoom ... '
  mainMenu(3) = 'Integration ...'
  mainMenu(4) = 'Read Values ... '
  mainMenu(5) = 'X Static Zoom  ... '
  mainMenu(6) = 'Y Static Zoom  ... '
  mainMenu(7) = 'Static Integration  ... '
  mainMenu(8) = 'Histogram of y-Values ... '
  mainMenu(9) = 'Make PostScript File / Print ... '
  mainMenu(10) = 'Return to Main Menu'

  choice = 0

  GetTitles, title, xTitle, yTitle, subTitle
  !p.title = title & !x.title = xTitle & !y.title = yTitle 
  !p.subtitle = subTitle
  reset = 0

  REPEAT BEGIN 
  
    IF (choice LE 4)  OR  ((choice GE 6) AND (choice LE 8)) THEN $
	 Data_Display, RESET = reset, /MDISP

    reset = 0

;    IF !d.name EQ 'X' THEN BEGIN
        choice = XChoice( 'Display: Choose Operation', mainMenu )
;    ENDIF ELSE BEGIN
;       choice = Keyboard_Select('<R>eset, <X> , <Y> Zoom, '+  $
;	'<I>ntegrate, Read <V>alues,  <P>rint, <E>xit', $
;	'Display:' )
;      IF choice EQ 6 THEN choice = 10 $
;      ELSE IF choice EQ 7 THEN choice = mainMenuLength-1
;      IF (choice GE 2) AND (choice LE 4) THEN BEGIN
;        newChoice = Keyboard_Select('<Y>es, <N>o', $
;	'Dynamic Operation ? ')
;        IF newChoice EQ 2 THEN choice = choice + 4 
;      ENDIF
;      IF choice EQ mainMenuLength-1 THEN $
;        IF !d.name EQ 'TEK' THEN  EraseVT 
;    ENDELSE
	

    CASE choice OF
      0: reset = 1
      1: Zoom_1D, 'X'
      2: Zoom_1D, 'Y'
      3: Integration, /MDISP
      4: Read_Values
      5: Zoom_1D, 'X',/STATIC
      6: Zoom_1D, 'Y',/STATIC
      7: Integration, /MDISP,  /STATIC
      8: HistoFacility
      9: BEGIN
          PrintInterface, status
          PS_Create_1D, /MDISP
          PrintInterface, status, /PRINT
      END
      ELSE:
  ENDCASE
  
END UNTIL choice EQ mainMenuLength-1

END
