(FILECREATED "14-Jul-86 01:10:27" {QV}<NOTECARDS>1.3K>RHTPATCH068.;1 11478  

      changes to:  (VARS RHTPATCH068COMS)
		   (FNS NC.SketchCardCloseFn NC.AddListCard NC.AddHashCard))


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

(PRETTYCOMPRINT RHTPATCH068COMS)

(RPAQQ RHTPATCH068COMS ((* * Changes to allow undisplay of cards without uncaching.)
			  (* * Changes to NCCARDS)
			  (FNS NC.QuitCard)
			  (* * Changes to NCTEXTCARD)
			  (FNS NC.TEditQuitFn)
			  (* * Changes to NCGRAPHCARD)
			  (FNS NC.GraphCardCloseFn)
			  (* * Changes to NCSKETCHCARD)
			  (FNS NC.SketchCardCloseFn)
			  (* * Changes to NCLISTCARD:)
			  (* * REMOVE the function NC.ListCardQuitFn from NCLISTCARD.)
			  (FNS NC.AddListCard)
			  (* * Changes to NCHASHCARD)
			  (* * REMOVE the function NC.HashCardQuitFn from NCHASHCARD)
			  (FNS NC.AddHashCard)))
(* * Changes to allow undisplay of cards without uncaching.)

(* * Changes to NCCARDS)

(DEFINEQ

(NC.QuitCard
  (LAMBDA (CardIdentifier CallCloseWFlg DontSaveFlg DontRecacheFlg DontCheckOpInProgressFlg 
			  InterestedWindow OperationMsg QuietFlg Don'tDeactivateFlg)
                                                             (* rht: "14-Jul-86 00:32")

          (* * Force note card specified by ID to quit or stop)



          (* * rht 2/9/85: New arg DontSaveFlg prevents NC.CardSaveFn from being called. Used when aborting a card.
	  This is NOT equivalent to NC.QuitWithoutSaving.)



          (* * rht 6/25/85: Now moves card off screen before saving if NC.CloseCardsOffScreenFlg is non-nil.)



          (* * rht 6/25/85: Brought the insure proper filing check back here from NC.CardSaveFn. Bails out if user cancelled 
	  operation inside of NC.InsureProperFiling)



          (* * fgh 11/11/85: Updated to handle CardID and CardInfo objects.)



          (* * fgh 1/16/86 Put in code to insure that if one of the TopLevelCards is quit then it is reactivated immedialtely
	  to make sure it stays cached for fast access.)



          (* * fgh 2/5/86 Added call to NC.ApplyFn)



          (* * fgh 5/2/86 Added DontRecacheFlg arg)



          (* * fgh 6/9/86 Added code to check to make sure other operations are not in progress. And DontCheckOpInProgressFlg
	  arg to match)



          (* * fgh 6/26/86 Added InterestedWindow & OperationMsg arg.)



          (* * rht 7/2/86: Now bails out if notefile is readonly, user confirms, but we're supposed to write down changes.)



          (* * rht 7/13/86: Now takes QuietFlg arg.)



          (* * rht 7/14/86: Call NC.DeactivateCard from here instead of in card type QuitFn. Take a Don'tDeactivateFlg as 
	  well.)


    (PROG ((Card (NC.CoerceToCard CardIdentifier))
	     Window OperationInProgress ReadOnlyCardFlg)
	    (SETQ Window (NC.FetchWindow Card))
	    (OR InterestedWindow (SETQ InterestedWindow Window))
	    (SETQ ReadOnlyCardFlg (NC.ReadOnlyCardP Card))
                                                             (* The window not being open should mean that it's 
							     shrunken. If so, expand it.)
	    (COND
	      ((AND Window (NOT (OPENWP Window)))
		(EXPANDW Window)))

          (* * if in the middle of some other operation, get out of here.)


	    (if (AND (NULL DontCheckOpInProgressFlg)
			 (SETQ OperationInProgress (NC.OperationInProgress Card)))
		then (NC.PrintOperationInProgressMsg Window "Close Card" OperationInProgress)
		       (RETURN NIL))

          (* * if proper filing says don't quit then get out)


	    (OR DontSaveFlg Don'tDeactivateFlg ReadOnlyCardFlg (COND
		    ((EQ (NC.InsureProperFiling Card)
			   (QUOTE CANCELLED))
		      (RETURN (QUOTE DON'T)))))

          (* * If card is readonly but we've made changes that we're supposed to save, then get user confirmation and bail 
	  out.)


	    (if (AND (NOT DontSaveFlg)
			 (NOT Don'tDeactivateFlg)
			 ReadOnlyCardFlg
			 (NC.CardSomehowDirtyP Card)
			 (NULL QuietFlg)
			 (NOT (PROGN (NC.PrintMsg InterestedWindow T 
					       "Card has been changed, but notefile is readonly."
							(CHARACTER 13))
					 (NC.AskYesOrNo "Want to quit anyway, flushing changes? " 
							  NIL (QUOTE Yes)
							  NIL InterestedWindow))))
		then (RETURN (QUOTE DON'T)))

          (* * Otherwise go ahead and quit)


	    (RETURN (NC.ProtectedCardOperation Card Close% Card (COND
						   ((AND Window NC.CloseCardsOffScreenFlg)
						     (COND
						       ((NOT (NC.FetchSavedRegion Card))
							 (NC.SetSavedRegion Card
									      (WINDOWPROP
										Window
										(QUOTE REGION)))))
						     (MOVEW Window 1500 1500)))
						 (OR DontSaveFlg Don'tDeactivateFlg
						       (if ReadOnlyCardFlg
							   then (NC.TurnOffDirtyFlgs Card)
							 else (NC.CardSaveFn Card
										 (OR 
									NC.CloseCardsOffScreenFlg 
										       QuietFlg)
										 NIL InterestedWindow 
										 OperationMsg)))
						 (AND Window (WINDOWDELPROP
							  Window
							  (QUOTE CLOSEFN)
							  (FUNCTION NC.QuitCard)))
						 (PROG1 (NC.ApplyFn QuitFn Card)
							  (AND CallCloseWFlg Window (CLOSEW
								   Window))
							  (OR Don'tDeactivateFlg (
								  NC.DeactivateCard Card))

          (* * if this is one of the top level cards, then make sure it stays cached)


							  (if (AND (NC.TopLevelCardP Card)
								       (NULL DontRecacheFlg)
								       (NULL Don'tDeactivateFlg))
							      then (NCP.ActivateCards Card))))))))
)
(* * Changes to NCTEXTCARD)

(DEFINEQ

(NC.TEditQuitFn
  (LAMBDA (CardIdentifier)                                   (* rht: "14-Jul-86 00:09")
                                                             (* Called by TEdit when quitting out of a TEdit-based 
							     note card. Close up attached windows,)

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



          (* * fgh 5/2/86 Removed assumption that there is a window when looking for the prompt window)



          (* * rht 7/14/86: No longer calls NC.DeactivateCard.)


    (LET ((Card (NC.CoerceToCard CardIdentifier))
	  PromptWindow Window)
         (SETQ Window (NC.FetchWindow Card))
         (SETQ PromptWindow (GETPROMPTWINDOW Window NIL NIL T))
         (AND Window (for AttachedWindow in (ALLATTACHEDWINDOWS Window)
			  unless (EQ AttachedWindow PromptWindow)
			  do (DETACHWINDOW AttachedWindow)
			       (CLOSEW AttachedWindow)
			       (until (NULL (OPENWP AttachedWindow)) do (BLOCK))))

          (* * Obsolete (* MAke sure TEdit won't close the database file) (replace (TEXTOBJ TXTFILE) of 
	  (TEXTOBJ TextStream) with NIL) (TEDIT.MAPPIECES (TEXTOBJ TextStream) (FUNCTION (LAMBDA (CH# PC PC# OBL) 
	  (replace (PIECE PFILE) of PC with NIL)))))



          (* * Setting the PromptWindow PROCESS to NIL is to break a circularity caused by TEXTOBJ -> PROMPTWINDOW -> PROCESS
	  -> TEXTSTREAM -> TEXTOBJ)


         (AND Window PromptWindow (WINDOWPROP PromptWindow (QUOTE PROCESS)
						  NIL)
		(REMOVEPROMPTWINDOW Window))
     T)))
)
(* * Changes to NCGRAPHCARD)

(DEFINEQ

(NC.GraphCardCloseFn
  (LAMBDA (CardIdentifier)                                   (* rht: "14-Jul-86 00:49")
                                                             (* Called when a grapher-based note card is being 
							     closed. Writes graph to database and does other clean 
							     up functions)

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



          (* * rht 7/14/86: Removed call to NC.DeactivateCard.)


    (LET (Window (Card (NC.CoerceToCard CardIdentifier)))
         (SETQ Window (NC.FetchWindow Card))
         (AND Window (for AttachedWindow in (ALLATTACHEDWINDOWS Window)
			  do (DETACHWINDOW AttachedWindow)
			       (CLOSEW AttachedWindow)))
         (AND Window (REMOVEPROMPTWINDOW Window)))))
)
(* * Changes to NCSKETCHCARD)

(DEFINEQ

(NC.SketchCardCloseFn
  (LAMBDA (CardIdentifier)                                   (* rht: "14-Jul-86 01:09")
                                                             (* Quit from a sketch card, saving information on the 
							     database)

          (* * rht 12/20/84: Added ugly kludge, setting SKETCHCHANGED to nil, to keep sketch from asking whether to save 
	  changes or not.)



          (* * rht 2/1/85: Removed above mentioned ugly kludge. It's now taken care of by a windowprop.
	  Now closes all sketch viewers for this sketch.)



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



          (* * rht 7/14/86: Removed call to NC.DeactivateCard.)


    (LET (Card Window OldRegion NewRegion)
         (SETQ Card (NC.CoerceToCard CardIdentifier))
         (SETQ Window (NC.FetchWindow Card))
         (COND
	   (Window (for Viewer in (ALL.SKETCH.VIEWERS (NC.FetchSubstance Card))
		      do (SKETCHW.CLOSEFN Viewer))
		   (SKED.CLEAR.SELECTION Window)
		   (for AttachedWindow in (ATTACHEDWINDOWS Window)
		      do (DETACHWINDOW AttachedWindow)
			   (CLOSEW AttachedWindow))))
         (COND
	   (Window (REMOVEPROMPTWINDOW Window)
		   (WINDOWPROP Window (QUOTE SKETCHOPMENU)
				 NIL)))
         (TTY.PROCESS T))))
)
(* * Changes to NCLISTCARD:)

(* * REMOVE the function NC.ListCardQuitFn from NCLISTCARD.)

(DEFINEQ

(NC.AddListCard
  (LAMBDA NIL                                                (* rht: "14-Jul-86 00:53")

          (* * rht 7/14/86: No longer has a QuitFn.)


    (NC.AddCardType (QUOTE List)
		      (QUOTE NoteCard)
		      (BQUOTE ((MakeFn , (FUNCTION NC.ListCardCreateFn))
				 (EditFn , (FUNCTION NC.ListCardEditFn))
				 (GetFn , (FUNCTION NC.ListCardGetFn))
				 (PutFn , (FUNCTION NC.ListCardPutFn))
				 (CopyFn , (FUNCTION NC.ListCardCopyFn))
				 (MarkDirtyFn , (FUNCTION NILL))
				 (DirtyPFn , (FUNCTION NILL))
				 (QuitFn , (FUNCTION NILL))))
		      (QUOTE ((LinkAnchorModesSupported NIL))))))
)
(* * Changes to NCHASHCARD)

(* * REMOVE the function NC.HashCardQuitFn from NCHASHCARD)

(DEFINEQ

(NC.AddHashCard
  (LAMBDA NIL                                                (* rht: "14-Jul-86 01:07")

          (* * rht 7/14/86: No longer has a QuitFn.)


    (NC.AddCardType (QUOTE Hash)
		      (QUOTE NoteCard)
		      (BQUOTE ((MakeFn , (FUNCTION NC.HashCardMakeFn))
				 (EditFn , (FUNCTION NC.HashCardEditFn))
				 (GetFn , (FUNCTION NC.HashCardGetFn))
				 (PutFn , (FUNCTION NC.HashCardPutFn))
				 (CopyFn , (FUNCTION NC.HashCardCopyFn))
				 (MarkDirtyFn , (FUNCTION NILL))
				 (DirtyPFn , (FUNCTION NILL))
				 (QuitFn , (FUNCTION NILL))))
		      (QUOTE ((LinkAnchorModesSupported NIL))))))
)
(PUTPROPS RHTPATCH068 COPYRIGHT ("Xerox Corporation" 1986))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (975 5847 (NC.QuitCard 985 . 5845)) (5882 7525 (NC.TEditQuitFn 5892 . 7523)) (7561 8394 
(NC.GraphCardCloseFn 7571 . 8392)) (8431 9824 (NC.SketchCardCloseFn 8441 . 9822)) (9927 10612 (
NC.AddListCard 9937 . 10610)) (10713 11396 (NC.AddHashCard 10723 . 11394)))))
STOP