(FILECREATED "17-Apr-87 16:32:34" {QV}<NOTECARDS>1.3K>NEXT>RHTPATCH239.;3 8826   

      changes to:  (VARS RHTPATCH239COMS)
		   (FNS NC.AttachPromptWindowOffScreen NC.BringUpTEditCard NC.MakeTEditCard 
			TEDIT.GETINPUT)

      previous date: "17-Apr-87 15:42:02" {QV}<NOTECARDS>1.3K>NEXT>RHTPATCH239.;1)


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

(PRETTYCOMPRINT RHTPATCH239COMS)

(RPAQQ RHTPATCH239COMS ((* * Fixes bug #522: Document cards bring up strange TTY windows when doing 
			     Put for example. Also text cards were printing to main prompt window.)
			  (* * New function for KOTOTEDITPATCHES)
			  (FNS TEDIT.GETINPUT)
			  (* * Change for NCTEXTCARD)
			  (FNS NC.BringUpTEditCard NC.MakeTEditCard)
			  (* * New function for NCINTERFACE)
			  (FNS NC.AttachPromptWindowOffScreen)))
(* * Fixes bug #522: Document cards bring up strange TTY windows when doing Put for example. 
Also text cards were printing to main prompt window.)

(* * New function for KOTOTEDITPATCHES)

(DEFINEQ

(TEDIT.GETINPUT
  (LAMBDA (STREAM PROMPTSTRING DEFAULTSTRING DELIMITER.LIST)
                                                             (* rht: "17-Apr-87 15:33")
                                                             (* Ask for input (file names, &c) for TEdit, perhaps 
							     with a default.)
    (PROG ((TEXTOBJ (TEXTOBJ STREAM))
	     (TPROMPT (OR (fetch PROMPTWINDOW of (TEXTOBJ STREAM))
			    (GETPROMPTWINDOW (\TEDIT.MAINW STREAM)
					       NIL NIL T))))
	    (COND
	      (TPROMPT                                       (* If it's our own promptwindow, just clear it.)
		       (CLEARW TPROMPT))
	      (T                                             (* If it's the system's window, just move to a new 
							     line.)
		 (FRESHLINE PROMPTWINDOW)))
	    (RETURN (PROG1 (PROMPTFORWORD PROMPTSTRING DEFAULTSTRING NIL (OR TPROMPT 
										     PROMPTWINDOW)
						NIL
						(QUOTE TTY)
						(OR DELIMITER.LIST (CHARCODE (EOL LF TAB ESCAPE)))
						NIL)         (* Get what the guy wants to tell us)
			       (WINDOWPROP (OR TPROMPT PROMPTWINDOW)
					     (QUOTE PROCESS)
					     NIL)            (* Now detach the prompt window from its process, to 
							     avoid a circularity.)
			       )))))
)
(* * Change for NCTEXTCARD)

(DEFINEQ

(NC.BringUpTEditCard
  (LAMBDA (Card TextStream RegionOrPosition)                 (* rht: "17-Apr-87 16:11")
                                                             (* Bring up a TEdit window for Card ID whose text 
							     stream is TextStream in Region specified by 
							     RegionOrPosition or by the user.)

          (* * rht 9/10/85: Fixed call to NC.MakeTEditPropsList so prompt window gets fixed up before card is brought up.)



          (* * fgh 11/13/85 Updated to handle Card objects.)



          (* * kirk 2Dec85 Removed illegal RETURN)



          (* * rht 4/11/86: Added Type arg to call to NC.MakeTEditMiddleMenu and changed names of menu windowprops.)



          (* * rht 5/5/86: Now calls NC.InstallTitleBarLeftMenu and NC.InstallTextTitleBarMiddleMenu.)



          (* * rht 8/2/86: Now doesn't throw in any extra tedit props if card is a filebox.)



          (* * rht 11/16/86: Now moves window to RegionOrPosition if already up.)



          (* * rht&pmi 11/19/86: Now passes NoteFile arg to NC.MakeTEditPropsList.)



          (* * rht & pmi 12/16/86: Changed the way we get TEditWindow.)



          (* * rht 1/30/87: Now calls RESTART-PROCESS-OF-TEDIT-WINDOW from Bagley's TEDIT-PROCESS-KILLER package.)



          (* * rht 4/17/87: Now makes a prompt window before opening the window.)


    (LET (Region TEditWindow TEditProcess Title TextStreamDirtyFlg Type)
         (if (SETQ TEditWindow (NC.FetchWindow Card))
	     then (TOTOPW TEditWindow)
		    (if RegionOrPosition
			then (SHAPEW TEditWindow (NC.DetermineDisplayRegion Card 
										 RegionOrPosition)))
		    (RPTQ 2 (FLASHW TEditWindow))
		    (if (SETQ TEditProcess (WINDOWPROP TEditWindow (QUOTE PROCESS)))
			then (TTY.PROCESS TEditProcess)
		      else                                 (* Process may have been turned off.
							     Try to restart.)
			     (SETQ TEditProcess (RESTART-PROCESS-OF-TEDIT-WINDOW TEditWindow)))
		    TEditWindow
	   else (SETQ Region (NC.DetermineDisplayRegion Card RegionOrPosition))
		  (SETQ Title (NC.RetrieveTitle Card))
		  (SETQ Type (NC.RetrieveType Card))
		  (SETQ TEditWindow (CREATEW Region Title NIL T)) 
                                                             (* Make a prompt window "invisibly" so it gets hooked 
							     in.)
		  (NC.AttachPromptWindowOffScreen TEditWindow)
		  (WINDOWADDPROP TEditWindow (QUOTE SHRINKFN)
				   (FUNCTION NC.TextCardShrinkFn))
		  (NC.InstallTitleBarLeftMenu TEditWindow Type)
		  (NC.InstallTextTitleBarMiddleMenu TEditWindow Type)
		  (SETQ TextStreamDirtyFlg (NC.CardDirtyP Card))
		  (TEDIT TextStream TEditWindow NIL (NC.MakeTEditPropsList TEditWindow
									       (NC.FileBoxP Card T)
									       (fetch (Card 
											 NoteFile)
										  of Card)))
		  (AND TextStreamDirtyFlg (NC.MarkCardDirty Card)))
     TEditWindow)))

(NC.MakeTEditCard
  (LAMBDA (Card Title NoDisplayFlg ParamList)                (* rht: "17-Apr-87 16:18")
                                                             (* Make up a blank text card and display it.)

          (* * rht 9/10/85: Fixed call to NC.MakeTEditPropsList so prompt window gets fixed up before card is brought up.)



          (* * fgh 11/13/85 Updated to handle Card object.)



          (* * rht 4/11/86: Now passes type to NC.MakeTEditMiddleMenu.)



          (* * rht 5/6/86: Now calls NC.InstallTitleBarLeftMenu and NC.InstallTextTitleBarMiddleMenu.)



          (* * rht 9/8/86: No longer hangs Card off NoteCardObject windowprop. THis is done in NC.MakeNoteCard.)



          (* * rht 9/19/86: Mod to above fix. Now calls NC.MakeNewCardWindow a new fn that creates window and hangs Card off 
	  windowprop. Also takes ParamList arg.)



          (* * rht&pmi 11/19/86: Now passes NoteFile arg to NC.MakeTEditPropsList.)



          (* * rht 4/17/87: Now makes a prompt window before opening the window.)


    (LET (TextStream Window Type)
         (COND
	   (NoDisplayFlg (SETQ TextStream (OPENTEXTSTREAM "" NIL NIL NIL
							      (NC.MakeTEditPropsList
								NIL
								(LISTGET ParamList (QUOTE 
								 Don'tAttachUserSpecifiedPropsFlg)))))
			 (NC.SetSubstance Card TextStream)
			 (STREAMPROP TextStream (QUOTE NoteCardObject)
				       Card)
			 Card)
	   (T (SETQ Window (NC.MakeNewCardWindow Card (OR Title "Untitled")
						     NIL T))
                                                             (* Make a prompt window "invisibly" so it gets hooked 
							     in.)
	      (NC.AttachPromptWindowOffScreen Window)
	      (SETQ Type (NC.RetrieveType Card))
	      (NC.InstallTitleBarLeftMenu Window Type)
	      (NC.InstallTextTitleBarMiddleMenu Window Type)
	      (WINDOWADDPROP Window (QUOTE SHRINKFN)
			       (FUNCTION NC.TextCardShrinkFn))
	      (TEDIT NIL Window NIL (NC.MakeTEditPropsList Window (NC.FileBoxP Card T)
							       (fetch (Card NoteFile) of Card)))
	      (until (WINDOWPROP Window (QUOTE TEXTSTREAM)) do (BLOCK))
	      (SETQ TextStream (WINDOWPROP Window (QUOTE TEXTSTREAM)))
	      (NC.SetSubstance Card TextStream)
	      (STREAMPROP TextStream (QUOTE NoteCardObject)
			    Card)
	      Window)))))
)
(* * New function for NCINTERFACE)

(DEFINEQ

(NC.AttachPromptWindowOffScreen
  (LAMBDA (MainWindow MinWidth Height Font)                  (* rht: "17-Apr-87 16:06")

          (* * Moves MainWindow off screen, calls NC.AttachPromptWindow, closes resulting promptwindow, and moves window 
	  back.)


    (DECLARE (GLOBALVARS NC.OffScreenPosition))
    (LET ((OldPos (WINDOWPOSITION MainWindow))
	  PromptWin)
         (MOVEW MainWindow NC.OffScreenPosition)
         (SETQ PromptWin (NC.AttachPromptWindow MainWindow MinWidth Height Font))
         (AND (OPENWP PromptWin)
		(CLOSEW PromptWin))
         (MOVEW MainWindow OldPos))))
)
(PUTPROPS RHTPATCH239 COPYRIGHT ("Xerox Corporation" 1987))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (1036 2404 (TEDIT.GETINPUT 1046 . 2402)) (2439 8047 (NC.BringUpTEditCard 2449 . 5559) (
NC.MakeTEditCard 5561 . 8045)) (8089 8744 (NC.AttachPromptWindowOffScreen 8099 . 8742)))))
STOP