(FILECREATED "14-Jul-86 10:26:56" {QV}<NOTECARDS>1.3K>RHTPATCH069.;1 5307   

      changes to:  (VARS RHTPATCH069COMS)
		   (FNS NC.QuitCard))


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

(PRETTYCOMPRINT RHTPATCH069COMS)

(RPAQQ RHTPATCH069COMS ((* * Change to NCCARDS)
			  (FNS NC.QuitCard)))
(* * Change to NCCARDS)

(DEFINEQ

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

          (* * 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 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 (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))))))))
)
(PUTPROPS RHTPATCH069 COPYRIGHT ("Xerox Corporation" 1986))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (360 5225 (NC.QuitCard 370 . 5223)))))
STOP