(FILECREATED " 2-Jun-87 11:00:07" {QV}<NOTECARDS>1.3K>NEXT>PMIPATCH042.;1 5871   

      changes to:  (VARS PMIPATCH042COMS)
		   (FNS NC.ProcessNoteFileNeedsTruncationError))


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

(PRETTYCOMPRINT PMIPATCH042COMS)

(RPAQQ PMIPATCH042COMS ((FNS NC.AskUserAboutTruncation NC.ProcessNoteFileNeedsTruncationError)))
(DEFINEQ

(NC.AskUserAboutTruncation
  (LAMBDA (NoteFile PromptWindow)                            (* pmi: " 2-Jun-87 10:43")

          (* * Ask the user what to do since NoteFile truncation is needed.)



          (* * fgh 5/25/86 First created.)



          (* * rht 10/29/86: Change name from Abort to Cancel.)



          (* * pmi 3/25/87: Added NC.MenuFont to all menus)



          (* * pmi 6/2/87: Changed position of menu to top of prompt window instead of bottom.)


    (DECLARE (GLOBALVARS NC.MenuFont))
    (LET (Items Menu PromptWinPos)

          (* * List user's options. Include Inspect&Repair only if this NoteFIle device has a RepairFn.)


         (SETQ Items (BQUOTE ((Cancel (QUOTE Cancel)
					  "Cancel the Open.")
				  (Truncate% File (QUOTE Truncate% File)
						  
				 "Truncate the file throwing away changes since last checkpoint.")
				  ,@(if (fetch (NoteFile RepairNoteFileFn) of NoteFile)
					then (LIST (QUOTE (Inspect% &% Repair (QUOTE 
									       Inspect% &% Repair)
										    
							   "Run Inspect&Repair on this NoteFile.")))))
				 ))

          (* * Bring up the menu with the options.)


         (SETQ ReturnValue
	   (MENU (SETQ Menu
		     (create MENU
			       ITEMS ← Items
			       MENUOUTLINESIZE ← 2
			       MENUFONT ← NC.MenuFont
			       CENTERFLG ← T
			       ITEMHEIGHT ←(IPLUS (FONTPROP NC.MenuFont (QUOTE HEIGHT))
						    1)))
		   (if (WINDOWP PromptWindow)
		       then (create POSITION
					XCOORD ←(fetch (POSITION XCOORD) of (SETQ 
										    PromptWinPos
										    (WINDOWPOSITION
										      PromptWindow)))
					YCOORD ←(PLUS (fetch (POSITION YCOORD) of 
										     PromptWinPos)
							(WINDOWPROP PromptWindow (QUOTE HEIGHT))))
		     else NIL))))))

(NC.ProcessNoteFileNeedsTruncationError
  (LAMBDA (NoteFile Don'tCacheTypesAndTitlesFlg Don'tCreateFlg Convertw/oConfirmFlg 
		    Don'tCreateArrayFlg Can'tTruncateFlg Don'tCreateInterfaceFlg 
		    Don'tGetSpecialCardsFlg PromptWindow PublicOrPrivate MenuPosition QuietFlg 
		    ReadOnlyFlg Don'tCheckForTruncationFlg)
                                                             (* pmi: " 2-Jun-87 10:42")

          (* * Discovered NoteFile needs version truncation when attempted to open it. Process that error.)



          (* * fgh 5/23/86 First created.)



          (* * fgh 9/1/86 Updated args to match NC.OpenNoteFile.)



          (* * rht 10/29/86: Changed name from Abort to Cancel.)



          (* * rht 10/31/86: Added Don'tCheckForTruncationFlg arg.)



          (* * pmi 5/14/87: Removed NoteFilesHashArray argument.)



          (* * pmi 6/2/87: Added NIL as legal response from truncation menu (allows selecting outside of the menu to cancel.)
)


    (PROG (TruncationFn)

          (* * If appropriate, notify the user.)


	    (if (WINDOWP PromptWindow)
		then (NC.PrintMsg PromptWindow T "NoteFile " (fetch (NoteFile FullFileName)
								    of NoteFile)
				      
			    " has information written since last successful close or checkpoint."
				      (CHARACTER 13)))

          (* * If the device has a TruncationFn then apply it and try to Open the NoteFile.)


	    (if (AND (NULL Can'tTruncateFlg)
			 (SETQ TruncationFn (fetch (NoteFile TruncateNoteFileFn) of NoteFile)))
		then 

          (* * ASk the user if they want to truncate, or abort, or repair the notefile.)


		       (SELECTQ (NC.AskUserAboutTruncation NoteFile PromptWindow)
				  (Cancel (RETURN (QUOTE CancelOpen)))
				  (Inspect% &% Repair (RETURN (NC.ProcessInspectAndRepairRequest
								  NoteFile 
								  Don'tCacheTypesAndTitlesFlg 
								  Don'tCreateFlg Convertw/oConfirmFlg 
								  Don'tCreateArrayFlg 
								  Can'tTruncateFlg 
								  Don'tCreateInterfaceFlg 
								  Don'tGetSpecialCardsFlg 
								  PromptWindow PublicOrPrivate 
								  MenuPosition QuietFlg ReadOnlyFlg 
								  Don'tCheckForTruncationFlg)))
				  (Truncate% File (RETURN (NC.ProcessTruncationRequest NoteFile 
								      Don'tCacheTypesAndTitlesFlg 
										   Don'tCreateFlg 
									     Convertw/oConfirmFlg 
									      Don'tCreateArrayFlg 
										 Can'tTruncateFlg 
									  Don'tCreateInterfaceFlg 
									  Don'tGetSpecialCardsFlg 
										     PromptWindow 
										  PublicOrPrivate 
										     MenuPosition 
											 QuietFlg 
										      ReadOnlyFlg 
								       Don'tCheckForTruncationFlg)))
				  (NIL (NC.PrintMsg PromptWindow NIL "Truncation cancelled"
						      (CHARACTER 13))
				       (RETURN (QUOTE NoteFileNeedsTruncation)))
				  (SHOULDNT 
				     "Illegal menu option selected in NC.AskUserAboutTruncation."))
	      else 

          (* * No TruncationFn. Tell the user if appropriate and return an error msg.)


		     (if (WINDOWP PromptWindow)
			 then (NC.PrintMsg PromptWindow NIL 
					       "No file truncation possible for this NoteFile."
					       (CHARACTER 13)
					       "See a NoteCards wizard."
					       (CHARACTER 13)))
		     (RETURN (QUOTE NoteFileNeedsTruncation))))))
)
(PUTPROPS PMIPATCH042 COPYRIGHT ("Xerox Corporation" 1987))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (386 5789 (NC.AskUserAboutTruncation 396 . 2321) (NC.ProcessNoteFileNeedsTruncationError
 2323 . 5787)))))
STOP