PRO Modif_PS
;+
; NAME:
;	Modif_PS
; PURPOSE:
;	User Interface to modify the PostScript page format
;	parameters: width, height, origin (in centimeters)
;	encapsulation, landscape mode, reverse mode,
;	display of page titles.
; CATEGORY
;	User Interface
; COMMON BLOCK:
;	PSDriver: contains the parameters cited above.
; SIDE EFFECTS:
;	Modify the values of the common block.
;	Menu windows are opened on x-windows terminals,
;	on the others, the display is erased.
;-
; MODIFICATION HISTORY:
;	Created: May 1991, A.Csillaghy


COMMON PSDriver, originX, originY, width, height, $
		encapsulated, noLandscape, reverse

IF N_Elements(originX) EQ 0 THEN BEGIN
  originX=1 & originY=1 & encapsulated = 0 & noLandscape=0
  width = 24.5 & height = 15 & reverse = 0
ENDIF

menuLength = 8
menuPS = StrArr(menuLength)

menuPS(0) = 'Origin in X: '+ StrTrim(originX) + '[cm]'
menuPS(1) = 'Origin in Y: ' + StrTrim(originY)+ '[cm]'
menuPS(2) = 'Width: '+ StrTrim(width)+ '[cm]'
menuPS(3) = 'Height: ' + StrTrim(height)+ '[cm]'

IF encapsulated EQ 1THEN $
  menuPS(4) = 'Image will be Encapsulated' $
ELSE menuPS(4) = 'Image will be Plotted on a Separate Sheet'
IF noLandscape EQ 1 THEN $
  menuPS(5) = 'Image is in Portrait Mode' $
ELSE menuPS(5) = 'Image is in Landscape Mode'
IF reverse EQ 1THEN $
  menuPS(6) = 'Image is in Reverse Mode' $
ELSE menuPS(6) = 'Image is in Normal Mode'

menuPS(menuLength-1) = 'Return to Preceeding Menu'

REPEAT BEGIN
  Clear_Screen
  choice = General_Menu( menuPS, $
	' Choose Attribute to Change')
  str = ''
  CASE choice OF
    1: BEGIN
          Read,'Please give the new X origin (cm): ', originX
          menuPS(0) = StrMid(menuPS(0),0,13)+StrTrim(originX)
        END
    2: BEGIN
          Read,'Please give the new Y origin (cm): ', originY
          menuPS(1) = StrMid(menuPS(1),0,13)+StrTrim(originY)
        END
    3: BEGIN
          Read,'Please give the new width (cm): ', width
          menuPS(2) = StrMid(menuPS(2),0,13)+StrTrim(width)
        END
    4: BEGIN
          Read,'Please give the new height: ', height
          menuPS(3) = StrMid(menuPS(3),0,13)+StrTrim(height)
        END
    5: IF encapsulated THEN BEGIN
          encapsulated = 0
          menuPS(4) = 'Image will be Plotted on a Separate Sheet'
        ENDIF ELSE BEGIN
          encapsulated = 1
          menuPS(4) = 'Image will be Encapsulated'
        ENDELSE
    7: IF reverse THEN BEGIN
          reverse = 0
          menuPS(6) = 'Image is in Normal Mode'
        ENDIF ELSE BEGIN
          reverse = 1
          menuPS(6) = 'Image is in Reverse Mode'
        ENDELSE
    6: BEGIN
          IF noLandscape EQ 1 THEN BEGIN
            noLandscape = 1
            menuPS(5) = 'Image is in Landscape Mode'
          ENDIF ELSE BEGIN
            noLandscape = 1
            menuPS(5) = 'Image is in Portrait Mode'
          ENDELSE
          temp = width & width = height & heigth = temp
          menuPS(2) = StrMid(menuPS(2),0,13)+StrTrim(width)
          menuPS(3) = StrMid(menuPS(3),0,13)+StrTrim(height)
        END
    ELSE:
    ENDCASE

END UNTIL choice EQ menuLength

END

