(FILECREATED "27-Jun-86 22:55:38" {QV}<NOTECARDS>1.3K>KIRKPATCH011.;1 9347   

      changes to:  (VARS KIRKPATCH011COMS)
		   (FNS NC.NoteFileTitleMIddleButtonFn))


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

(PRETTYCOMPRINT KIRKPATCH011COMS)

(RPAQQ KIRKPATCH011COMS ((* * new FNS for NCINTERFACE)
			   (FNS NC.NoteFileTitleMiddleButtonFn)
			   (* * changed FNS for NCINTERFACE)
			   (FNS NC.NoteFileIconButtonEventFn NC.NoteFileOperations 
				NC.SetUpNoteFileInterface)))
(* * new FNS for NCINTERFACE)

(DEFINEQ

(NC.NoteFileTitleMiddleButtonFn
  (LAMBDA (NoteFile)                                         (* kirk: "27-Jun-86 21:39")

          (* * kirk first created)


    (LET ((NoteFileMenu (fetch (NoteFile Menu) of NoteFile))
	  NoteFileMenuWindow Menu)
         (SPAWN.MOUSE)
         (SETQ NoteFileMenuWindow (WFROMMENU NoteFileMenu))
         (OR (SETQ Menu (WINDOWPROP NoteFileMenuWindow (QUOTE NoteFileFullName)))
	       (WINDOWPROP NoteFileMenuWindow (QUOTE NoteFileFullName)
			     (SETQ Menu (create MENU
						    CENTERFLG ← NIL
						    TITLE ← (fetch (NoteFile FullFileName)
								 of NoteFile)
						    MENUTITLEFONT ← NC.MenuFont))))
         (MENU Menu))))
)
(* * changed FNS for NCINTERFACE)

(DEFINEQ

(NC.NoteFileIconButtonEventFn
  (LAMBDA (Window)                                           (* kirk: "27-Jun-86 21:32")

          (* * Bring up NoteFile Menues)


    (LET (NoteFile)
         (TOTOPW Window)
         (if (LESSP (LASTMOUSEY Window)
			(PLUS 9 (FONTPROP (GETPROP (WINDOWPROP Window (QUOTE MENU))
							 (QUOTE MENUTITLEFONT))
					      (QUOTE SIZE))))
	     then (APPLY* (WINDOWPROP Window (QUOTE CURSORMOVEDFN))
			      Window)
	   else                                            (* title bar)
		  (SETQ NoteFile (WINDOWPROP Window (QUOTE NoteFile)))
		  (COND
		    ((NULL (WINDOWPROP Window (QUOTE BusyOperation)))
		      (RESETLST (RESETSAVE (WINDOWPROP Window (QUOTE BusyOperation)
							     "Operation")
					       (BQUOTE (WINDOWPROP , Window BusyOperation NIL)))
				  (if (MOUSESTATE (ONLY MIDDLE))
				      then (NC.NoteFileTitleMIddleButtonFn NoteFile)
				    else (NC.NoteFileOperations NoteFile))))
		    (T (NC.PrintMsg NIL NIL (CHARACTER 13)
				      (WINDOWPROP Window (QUOTE BusyOperation))
				      " in progress.  Please wait.")))))))

(NC.NoteFileOperations
  (LAMBDA (NoteFile)                                         (* kirk: "27-Jun-86 22:26")
                                                             (* 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)


    (LET ((NoteFileMenu (fetch (NoteFile Menu) of NoteFile))
	  (Font (FONTCREATE (QUOTE HELVETICA)
			      10
			      (QUOTE BOLD)))
	  (FullFileName (fetch (NoteFile FullFileName) of NoteFile))
	  NoteFileMenuWindow Menu)
         (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)
							  "Opens this NoteFile.")
						    (Checkpoint (NC.CheckpointDatabase , NoteFile)
								
						"Checkpoint this NoteFile, saving changed cards.")
						    (Close (NC.CloseDatabaseFile , NoteFile)
							   "Closes this NoteFile.")
						    (Abort (NC.AbortSession , NoteFile)
							   
			"Throws away all changes to this NoteFile since last open or checkpoint.")
						    (Compact (NC.CompactNoteFile , NoteFile)
							     "Compacts a NoteFile to a target file."
							     (SUBITEMS (Compact% To% Target% File
									 (NC.CompactNoteFile , 
											 NoteFile)
									 
						       "Compacts this NoteFile to a target file.")
								       (Compact% In% Place
									 (NC.CompactNoteFile , 
											 NoteFile NIL 
											       T)
									 
							       "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)
							  "Copies this notefile to a target file.")
						    (Rename (NC.RenameNoteFile , NoteFile)
							    "Moves this notefile to a target file.")
						    (Delete (NC.DeleteDatabaseFile
							      (QUOTE , (PACKFILENAME
									 (QUOTE VERSION)
									 NIL
									 (QUOTE BODY)
									 FullFileName))
							      NoteFileMenuWindow)
							    
						   "Deletes the oldest version of this NoteFile.")))
					 CENTERFLG ← NIL
					 MENUFONT ← NC.MenuFont
					 ITEMHEIGHT ← (IPLUS (FONTPROP Font (QUOTE HEIGHT))
								 1)))))
         (MENU Menu))))

(NC.SetUpNoteFileInterface
  (LAMBDA (NoteFile)                                         (* kirk: "27-Jun-86 21:44")

          (* * Create the NoteCards control menu for a NoteFile)



          (* * kirk 13Jan85 Decreased the size of the NoteFile Menu)



          (* * fgh 1/22/86 Fixed the ghost box size when position menu.)



          (* * rht 5/6/86: Now restores the menu's WhenSelectedFn and ungrays its items if already existed.)


    (LET ((Font (FONTCREATE (QUOTE HELVETICA)
			      10
			      (QUOTE BOLD)))
	  (TitleFont (FONTCREATE (QUOTE HELVETICA)
				   12
				   (QUOTE BOLD)))
	  NoteFileMenuWindow NoteFileMenu FullFileName)      (* Main Menu)
         (SETQ FullFileName (fetch (NoteFile FullFileName) of NoteFile))
         (if (SETQ NoteFileMenu (fetch (NoteFile Menu) of NoteFile))
	     then (for Item in (fetch (MENU ITEMS) of NoteFileMenu)
		       do (SHADEITEM Item NoteFileMenu WHITESHADE))
		    (replace (MENU WHENSELECTEDFN) of NoteFileMenu
		       with (FUNCTION NC.NoteFileMenuWhenSelectedFn))
	   else (PROGN (SETQ NoteFileMenu (create MENU
							  ITEMS ← (QUOTE ((NewCards NIL 
		       "Create a new Text card (left button) or other card type (middle button).")
									       (Show% Box NIL 
							"Bring up one of the standard FileBoxes.")))
							  WHENSELECTEDFN ← (FUNCTION 
							    NC.NoteFileMenuWhenSelectedFn)
							  CENTERFLG ← T
							  MENUBORDERSIZE ← 1
							  MENUOUTLINESIZE ← 2
							  MENUCOLUMNS ← 2
							  MENUFONT ← Font
							  TITLE ← (CONCAT (FILENAMEFIELD
										FullFileName
										(QUOTE NAME))
									      (QUOTE ;)
									      (FILENAMEFIELD
										FullFileName
										(QUOTE VERSION)))
							  ITEMHEIGHT ← (IPLUS
							    6
							    (FONTPROP Font (QUOTE HEIGHT)))
							  ITEMWIDTH ← (IPLUS (STRINGWIDTH
										   (QUOTE NewCards)
										   Font)
										 10)
							  MENUTITLEFONT ← TitleFont))
			   (replace (MENU MENUPOSITION) of NoteFileMenu
			      with (GETBOXPOSITION (fetch (MENU IMAGEWIDTH) of NoteFileMenu)
						       (fetch (MENU IMAGEHEIGHT) of 
										     NoteFileMenu)
						       NIL NIL NIL 
					    "Please indicate location for NoteFile control menu."))))
         (if (WINDOWP (SETQ NoteFileMenuWindow (WFROMMENU NoteFileMenu)))
	     then (FLASHWINDOW NoteFileMenuWindow)
	   else (SETQ NoteFileMenuWindow (ADDMENU NoteFileMenu NIL (GETMENUPROP NoteFileMenu
											(QUOTE
											  OldPosition)
											))))
         (WINDOWPROP NoteFileMenuWindow (QUOTE NoteFile)
		       NoteFile)
         (replace (NoteFile Menu) of NoteFile with NoteFileMenu)
         (WINDOWPROP NoteFileMenuWindow (QUOTE RESHAPEFN)
		       (QUOTE DON'T))
         (WINDOWPROP NoteFileMenuWindow (QUOTE BUTTONEVENTFN)
		       (FUNCTION NC.NoteFileIconButtonEventFn))
         (WINDOWPROP NoteFileMenuWindow (QUOTE SHRINKFN)
		       (QUOTE DON'T))
         (WINDOWADDPROP NoteFileMenuWindow (QUOTE CLOSEFN)
			  (FUNCTION (LAMBDA (Window)
			      (PUTMENUPROP (CAR (WINDOWPROP Window (QUOTE MENU)))
					     (QUOTE OldPosition)
					     (WINDOWPOSITION Window)))))
         (NC.MoveWindowOntoScreen NoteFileMenuWindow))))
)
(PUTPROPS KIRKPATCH011 COPYRIGHT ("Xerox Corporation" 1986))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (549 1320 (NC.NoteFileTitleMiddleButtonFn 559 . 1318)) (1361 9264 (
NC.NoteFileIconButtonEventFn 1371 . 2618) (NC.NoteFileOperations 2620 . 5662) (
NC.SetUpNoteFileInterface 5664 . 9262)))))
STOP