(FILECREATED " 7-Jun-86 00:40:55" {QV}<NOTECARDS>1.3K>FGHPATCH062.;3 5449   

      changes to:  (VARS FGHPATCH062COMS)
		   (FNS NC.GETPROMPTWINDOW)

      previous date: " 7-Jun-86 00:40:00" {QV}<NOTECARDS>1.3K>FGHPATCH062.;2)


(* Copyright (c) 1986 by Xerox Corporation. All rights reserved.)

(PRETTYCOMPRINT FGHPATCH062COMS)

(RPAQQ FGHPATCH062COMS ((* * Fixes to NC.AttachPromptWIndow to fix bug %# 81)
			  (FILES (FROM VALUEOF NOTECARDSDIRECTORIES)
				 KOTOSYSTEMPATCHES)
			  (* * From NCINTERFACE ??)
			  (FNS NC.AttachPromptWindow)
			  (* * NEW FOR NCINTERFACE)
			  (FNS NC.GETPROMPTWINDOW)))
(* * Fixes to NC.AttachPromptWIndow to fix bug %# 81)

(FILESLOAD (FROM VALUEOF NOTECARDSDIRECTORIES)
	   KOTOSYSTEMPATCHES)
(* * From NCINTERFACE ??)

(DEFINEQ

(NC.AttachPromptWindow
  (LAMBDA (MainWindow MinWidth Height Font DontCreate)       (* fgh: " 6-Jun-86 18:42")

          (* * GETPROMPTWINDOW that works for small windows. sizes default to 300 X 60)



          (* * fgh 5/1/86 MainWindowXSize now based on MainWindow's REGION WIDTH not its REGION RIGHT.)



          (* * fgh 6/6/86 To fix many bugs made into a wrapper fot NC.GETPROMPTWINDOW)


    (if MainWindow
	then (OR MinWidth (SETQ MinWidth 300))
	       (OR Height (SETQ Height 60))
	       (NC.GETPROMPTWINDOW MainWindow (IQUOTIENT Height (if (FONTP Font)
									then (FONTHEIGHT Font)
								      else 15))
				     Font DontCreate MinWidth))))
)
(* * NEW FOR NCINTERFACE)

(DEFINEQ

(NC.GETPROMPTWINDOW
  (LAMBDA (MAINWINDOW %#LINES FONT DONTCREATE MINWIDTH)    (* fgh: " 6-Jun-86 19:20")

          (* makes sure that MAINWINDOW has an attached promptwindow and returns it. If one already exists, it is shaped to 
	  be at least %#LINES high. If FONT is NIL, the font of the main window is used for the promptwindow.)



          (* * fgh 6/6/86 Adapted from system GETPROMPTWINDOW. Added MINWIDTH arg.)


    (PROG ((PWINDOWPROP (WINDOWPROP MAINWINDOW (QUOTE PROMPTWINDOW)))
	     (PWINDOWMINWIDTH (WINDOWPROP MAINWINDOW (QUOTE PROMPTWINDOWMINWIDTH)))
	     PWINDOW WIDTH HEIGHT OBSCUREDHEIGHT)
	    (COND
	      (DONTCREATE (RETURN (CAR PWINDOWPROP)))
	      (PWINDOWPROP (SETQ PWINDOW (CAR PWINDOWPROP))
			   (COND
			     ((NOT (OPENWP PWINDOW))
			       (ATTACHWINDOW PWINDOW MAINWINDOW (QUOTE TOP)
					       (QUOTE LEFT)
					       (QUOTE LOCALCLOSE))))
			   (COND
			     ((OR (AND %#LINES (IGREATERP %#LINES (CDR PWINDOWPROP)))
				    (AND MINWIDTH (NOT (EQP MINWIDTH PWINDOWMINWIDTH))))
                                                             (* Window exists, but not right size.)
			       (SHAPEW PWINDOW (create REGION
						    using (WINDOWPROP PWINDOW (QUOTE REGION))
							    HEIGHT ←(SETQ HEIGHT
							      (HEIGHTIFWINDOW
								(TIMES %#LINES
									 (FONTPROP (DSPFONT
										       NIL PWINDOW)
										     (QUOTE HEIGHT))
									 )))
							    WIDTH ←(MAX (OR MINWIDTH 
										PWINDOWMINWIDTH 0)
									  (fetch (REGION WIDTH)
									     of
									      (WINDOWPROP
										MAINWINDOW
										(QUOTE REGION))))))
			       (RPLACD PWINDOWPROP %#LINES)
                                                             (* Fall through to check visibility)
			       )
			     (T (RETURN PWINDOW))))
	      (T (SETQ PWINDOW (CREATEW (create REGION
						      LEFT ← 0
						      BOTTOM ← 0
						      WIDTH ←(MAX (OR MINWIDTH 0)
								    (fetch (REGION WIDTH)
								       of (WINDOWPROP
									      MAINWINDOW
									      (QUOTE REGION))))
						      HEIGHT ←(SETQ HEIGHT
							(HEIGHTIFWINDOW
							  (TIMES (OR %#LINES (SETQ %#LINES 1))
								   (FONTPROP (OR FONT
										     (SETQ FONT
										       (DSPFONT
											 NIL 
										       MAINWINDOW)))
									       (QUOTE HEIGHT))))))
					    NIL NIL T))
		 (DSPSCROLL T PWINDOW)
		 (DSPFONT FONT PWINDOW)
		 (WINDOWPROP PWINDOW (QUOTE PAGEFULLFN)
			       (QUOTE NILL))
		 (ATTACHWINDOW PWINDOW MAINWINDOW (QUOTE TOP)
				 (QUOTE LEFT)
				 (QUOTE LOCALCLOSE))
		 (WINDOWPROP MAINWINDOW (QUOTE PROMPTWINDOW)
			       (CONS PWINDOW %#LINES))
		 (WINDOWPROP PWINDOW (QUOTE OPENFN)
			       (FUNCTION \PROMPTWINDOW.OPENFN))))
	    (COND
	      ((ILESSP (SETQ OBSCUREDHEIGHT (IDIFFERENCE SCREENHEIGHT
							       (fetch (REGION TOP)
								  of (WINDOWPROP PWINDOW
										     (QUOTE REGION))
									)))
			 0)                                  (* Promptwindow off screen at top, so slip window 
							     group down to make it visible)
		(RELMOVEW MAINWINDOW (create POSITION
						 XCOORD ← 0
						 YCOORD ← OBSCUREDHEIGHT))))
	    (WINDOWPROP PWINDOW (QUOTE MINSIZE)
			  (CONS 0 HEIGHT))
	    (WINDOWPROP PWINDOW (QUOTE MAXSIZE)
			  (CONS 64000 HEIGHT))
	    (WINDOWPROP MAINWINDOW (QUOTE PROMPTWINDOWMINWIDTH)
			  (OR MINWIDTH 0))
	    (OPENW PWINDOW)
	    (RETURN PWINDOW))))
)
(PUTPROPS FGHPATCH062 COPYRIGHT ("Xerox Corporation" 1986))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (781 1527 (NC.AttachPromptWindow 791 . 1525)) (1560 5367 (NC.GETPROMPTWINDOW 1570 . 5365
)))))
STOP