PRO Extend_Shrink, x, status, INTERACTIVE = interactive

;+
; NAME
; 	 Extend_Shrink
; PURPOSE
;	Multiplies  the x-range of the plots selected by a factor,
;	given with the keyboard or determined interactively. In
;	the latter case, the user gives the new beginning
;	and endpoints with the mouse. This procedure
;	is a part of the mdisp analyser.
; CATEGORY:
;	1D
; CALLING SEQUENCE:
;	Extend_Shrink
; INPUT PARAMETER:
;	x: the 1D array containing the range to extend or shrink.
; OUTPUT PARAMETERS:
;	x: the extended or shrunken  x-range.
;	status: 'Done' or 'Not Done'
; KEYWORD:
;	/INTERACTIVE If present, the factor is determined
;		from the mouse inputs, otherwise from
;		the keyboard.
; COMMON BLOCK:
;	ExtRetain: for intern use only
; SIDE EFFECTS:
;	The Selectioner from mdisp is used, and a new plot is
;	created.
; RESTRICTION:
;	To use ONLY together with the mdisp selectioner.
; -
; MODIFICATION HISTORY
;	Created: June 91, A.Csillaghy

IF NOT Keyword_Set(INTERACTIVE) THEN BEGIN
    Print, ''
    Print, 'Extend and Shrink operation'
    Print, ''
    Read_Test,'Please enter the x-factor ',1.0, fact 
    Read_Test,'Please enter the origin ', MIN(x), xLow
ENDIF ELSE BEGIN
    ClickLimits, xLow, xHigh, TITLE = 'Extend/Shrink Plots'
    dist = xHigh - xLow
ENDELSE 
  
IF Keyword_Set(INTERACTIVE) THEN $
  fact = dist / ( Max(x) - Min(x) )
IF N_Elements(fact) NE 0 THEN BEGIN
  x = (x - Min(x))*fact + xLow
  status = "Done"
ENDIF ELSE status = "Not Done"

END
