(FILECREATED "16-Jul-86 14:58:34" {QV}<NOTECARDS>1.3K>KIRKPATCH020.;1 6246   

      changes to:  (VARS KIRKPATCH020COMS))


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

(PRETTYCOMPRINT KIRKPATCH020COMS)

(RPAQQ KIRKPATCH020COMS ((* File created by KELLEY)
			   (* * adds shading to unavailable items)
			   (FNS NC.NoteFileOperations)))



(* File created by KELLEY)

(* * adds shading to unavailable items)

(DEFINEQ

(NC.NoteFileOperations
  (LAMBDA (NoteFile)                                         (* kirk: "16-Jul-86 14:24")
                                                             (* Ask usere to choose which database operation.
							     Called from main menu whenselected fn.)

          (* * fgh 11/14/85 Updated to handle NoteFile object and per NoteFile menus.)



          (* * kirk 14Jan86 Added Close/Delete cards and changed the format)



          (* * fgh 6/13/86 Now sets BusyOperation of NF menu to something interesting.)



          (* * kirk 3Jul86 passed NoteFileMenuWindow to NC.CompactNoteFile)



          (* * fgh 7/5/86 Fixed above fix and put NoteFileMenuWindow is all calls.)



          (* * rht 7/5/86: Added read-only open to notefileops menu.)



          (* * kirk 7/14/86 Took comma out of FullFileName in NC.DeleteDatabaseFile call)



          (* * kirk 15Jul86 Added Grey shade to non-functional items when file is open/closed)


    (LET ((NoteFileMenu (fetch (NoteFile Menu) of NoteFile))
	  (Font NC.MenuFont)
	  (FullFileName (fetch (NoteFile FullFileName) of NoteFile))
	  NoteFileMenuWindow Menu (OpenItems (QUOTE (Open Checkpoint Close Abort Compact Create)))
	  (CloseItems (QUOTE (Open Compact Inspect&Repair Copy Rename Delete Create))))
         (SPAWN.MOUSE)
         (SETQ NoteFileMenuWindow (WFROMMENU NoteFileMenu))
         (OR (SETQ Menu (WINDOWPROP NoteFileMenuWindow (QUOTE DatabaseOperationsMenu)))
	       (WINDOWPROP NoteFileMenuWindow (QUOTE DatabaseOperationsMenu)
			     (SETQ Menu
			       (create MENU
					 ITEMS ←
					 (BQUOTE ((Open (NC.OpenDatabaseFile , NoteFile NIL NIL 
										 NIL NIL NIL NIL NIL 
										 NIL NIL , 
									       NoteFileMenuWindow)
							  "Opens this NoteFile."
							  (SUBITEMS (Read-only% Open
								      (NC.OpenDatabaseFile
									, NoteFile (QUOTE INPUT)
									NIL NIL NIL NIL NIL NIL NIL 
									NIL , NoteFileMenuWindow)
								      
							     "Opens this NoteFile for read-only.")))
						    (Checkpoint (NC.CheckpointDatabase , NoteFile 
											 NIL NIL NIL 
											 NIL , 
									       NoteFileMenuWindow)
								
						"Checkpoint this NoteFile, saving changed cards.")
						    (Close (NC.CloseDatabaseFile , NoteFile , 
									       NoteFileMenuWindow)
							   "Closes this NoteFile.")
						    (Abort (NC.AbortSession , NoteFile)
							   
					     "Close NF, deleteing changes since last checkpoint.")
						    (Compact (NC.CompactNoteFile , NoteFile NIL NIL 
										   , 
									       NoteFileMenuWindow)
							     "Compacts a NoteFile to a target file."
							     (SUBITEMS (Compact% To% Target% File
									 (NC.CompactNoteFile , 
											 NoteFile NIL 
											      NIL , 
									       NoteFileMenuWindow)
									 
						       "Compacts this NoteFile to a target file.")
								       (Compact% In% Place
									 (NC.CompactNoteFile , 
											 NoteFile NIL 
											       T , 
									       NoteFileMenuWindow)
									 
							       "Compacts this NoteFile in place.")))
						    (Inspect&Repair (NC.InspectAndRepairNoteFile
								      , NoteFile)
								    
						 "Inspects and optionally repairs this NoteFile."
								    (SUBITEMS (Read% Substances
										(
								      NC.InspectAndRepairNoteFile
										  , NoteFile T)
										
"Inspects and optionally repairs a Notefile, but reads every substance.  This slows it WAY down.")))
						    (Copy (NC.CopyNoteFile , NoteFile NIL , 
									     NoteFileMenuWindow)
							  "Copies this notefile to a target file.")
						    (Rename (NC.RenameNoteFile , NoteFile)
							    "Rename this NoteFile")
						    (Delete (NC.DeleteDatabaseFile FullFileName , 
									       NoteFileMenuWindow)
							    "Deletes this NoteFile.")))
					 CHANGEOFFSETFLG ← (QUOTE Y)
					 MENUOFFSET ← (CONS -1 0)
					 CENTERFLG ← NIL
					 TITLE ← "NoteFile Ops"
					 MENUTITLEFONT ← Font
					 MENUFONT ← Font
					 ITEMHEIGHT ← (IPLUS (FONTPROP Font (QUOTE HEIGHT))
								 1)
					 WHENSELECTEDFN ←
					 (FUNCTION (LAMBDA (Item Menu Button)
					     (WINDOWPROP (WFROMMENU (fetch (NoteFile Menu)
									   of (GETMENUPROP
										  Menu
										  (QUOTE NoteFile)))
									)
							   (QUOTE BusyOperation)
							   (CAR Item))
					     (DEFAULTWHENSELECTEDFN Item Menu Button)))))))
         (PUTMENUPROP Menu (QUOTE NoteFile)
			NoteFile)

          (* * grey shade non functional items)


         (if (NC.NoteFileOpenP NoteFile)
	     then (if (NOT (GETMENUPROP Menu (QUOTE OpenFlg)))
			then (PUTMENUPROP Menu (QUOTE OpenFlg)
					      T)
			       (for Item in (fetch (MENU ITEMS) of Menu)
				  do (SHADEITEM Item Menu (if (MEMB (CAR Item)
									    OpenItems)
								  then WHITESHADE
								else GRAYSHADE)))
			       (replace (MENU IMAGE) of Menu with NIL))
	   else (if (GETMENUPROP Menu (QUOTE OpenFlg))
		      then (PUTMENUPROP Menu (QUOTE OpenFlg)
					    NIL)
			     (for Item in (fetch (MENU ITEMS) of Menu)
				do (SHADEITEM Item Menu (if (MEMB (CAR Item)
									  CloseItems)
								then WHITESHADE
							      else GRAYSHADE))
				     (replace (MENU IMAGE) of Menu with NIL))))
         (MENU Menu))))
)
(PUTPROPS KIRKPATCH020 COPYRIGHT ("Xerox Corporation" 1986))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (452 6163 (NC.NoteFileOperations 462 . 6161)))))
STOP