(FILECREATED " 8-Jun-87 17:07:38" {QV}<NOTECARDS>1.3K>NEXT>NCINTERFACE.;106 200409 

      changes to:  (VARS NCINTERFACECOMS)
		   (FNS NC.ResetNoteFileInterface NC.NoteFileTitleLeftWhenSelectedFn 
			NC.ListOfNoteFilesMenu NC.DoNoteFileOp NC.SetUpNoteFileInterface 
			NC.FileBrowserOpen NC.SelectNoteCards NC.CopyStructure NC.MoveStructure 
			NC.SelectNoteCardsCopyInsertFn)

      previous date: "23-Apr-87 19:32:59" {QV}<NOTECARDS>1.3K>NEXT>NCINTERFACE.;104)


(* Copyright (c) 1984, 1985, 1986, 1987 by Xerox Corporation. All rights reserved.)

(PRETTYCOMPRINT NCINTERFACECOMS)

(RPAQQ NCINTERFACECOMS ((* * Internal variables)
	(GLOBALVARS NC.CachedMenus NC.NoteCardsIconPosition NC.SelectionInProgress NC.SelectedCards 
		    NC.SelectingSourcesMenu NC.SelectingContentsMenu NC.SelectingSingleCardMenu 
		    NC.SelectingMultipleCardsMenu NC.DeleteSelectingMenu NC.SelectingParentsMenu 
		    NC.SelectingBrowserSourceMenu NC.SelectingFileBoxChildrenMenu 
		    NC.SelectingCardsMenu NC.SelectingCardMenu NC.TEditMenus NC.NoteCardTypeMenu 
		    NC.DatabaseOperationsMenu NC.LinkLabelMenu NC.WindowRightButtonMenu NC.LogoWindow 
		    LOGOW ExecWindow PROCESS.STATUS.WINDOW QUADTREE.HIGHRES NC.BrowseOrSearchMenu 
		    FONTDIRECTORIES NC.DatabaseFileNameSuggestion NC.UncachingNotCompleted 
		    NC.UnspecifiedLinkLabel NC.UCASESystemLinkLabels NC.MainMenuPosition 
		    NC.NoteCardsIconWindow NC.NewCardsIconBitmap NC.BoxesIconBitmap 
		    NC.NoteFileIndicatorFont NC.NoteFileMenuLingerFlg NC.FileBrowserExpungeMenuItem 
		    NC.FileBrowserRecomputeMenuItem NC.FileBrowserMenuItemsToKeep 
		    NC.DefaultNoteFileIconMiddleButtonItems NC.OpenedNoteFileMenu 
		    NC.ClosedNoteFileMenu NC.NoteFileIconOperationsMenuItems 
		    NC.NoteFileIconOpenOperations NC.NoteFileIconCloseOperations NC.NoteCardTypeMenu 
		    NC.DefaultLeftButtonMenuItems NC.LocalInsertLinkMenuItem 
		    NC.GlobalInsertLinkMenuItem NC.DefaultMiddleButtonMenuItems 
		    NC.PromptWindowMonitorLock)
	(VARS (NC.LinkLabelMenu NIL)
	      (NC.LinkDisplayModesMenu NIL)
	      (NC.DatabaseFileNameSuggestion NIL)
	      (NC.TEditMenus NIL)
	      (NC.OpenedNoteFileMenu NIL)
	      (NC.ClosedNoteFileMenu NIL))
	(INITVARS (NC.NoteCardsIconPosition)
		  (NC.PromptWindowMonitorLock (CREATE.MONITORLOCK "PromptWindowMonitorLock"))
		  (NC.FileNameFont (FONTCREATE (QUOTE HELVETICA)
					       10
					       (QUOTE BOLD)))
		  (NC.FullFileNameFont (FONTCREATE (QUOTE HELVETICA)
						   8
						   (QUOTE STANDARD)))
		  (NC.MaxFileNameChars 18))
	(* * Setup and top level interaction)
	(DECLARE: DONTEVAL@LOAD DONTCOPY EVAL@COMPILE (FILES (FROM NOTECARDS)
							     FILEBROWSER))
	(FNS NoteCards NC.MakeMainMenu NC.LogoutAdvice NC.AttachPromptWindow 
	     NC.AttachPromptWindowOffScreen NC.GETPROMPTWINDOW NC.MaxPromptWindowWidth)
	(* * Menus of all sorts)
	[VARS (NC.CachedMenus (QUOTE (NC.NoteCardTypeMenu NC.LinkIconMiddleButtonMenu NC.CardOpsMenu 
							  NC.NoteFileOpsMenu NC.OtherOpsMenu]
	(FNS NC.AskLinkLabel NC.AskNoteCardType NC.ChooseTopLevelCard NC.RemoveSketchMenuItems 
	     NC.SelectionMenusWhenSelectedFn NC.InstallTitleBarButtonEventFn 
	     NC.InstallTitleBarLeftMenu NC.InstallCopyButtonEventFn 
	     NC.NoteFileTitleLeftWhenSelectedFn NC.MakeNoteFileIconOperationsMenus 
	     NC.ResetCachedMenus NC.CreateMenuBitmaps NC.GetNoteFileMenu NC.SetNoteFileMenu)
	(* * Selection Mechanism)
	(VARS NC.SelectionInProgress)
	(FNS NC.SelectNoteCards NC.SelectNoteCardsCopyInsertFn NC.CopyButtonEventFn NC.CardImageObjP 
	     NC.MakeCardImageObject)
	(GLOBALVARS NC.CardImageObjFns)
	(VARS (NC.CardImageObjFns (IMAGEFNSCREATE)))
	(* * Fix up Lisp)
	(ADVISE LOGOUT)
	(* * Stuff for creating and operating the NoteCards session icon.)
	(GLOBALVARS NC.CardOpsMenu NC.CardOpsItems NC.NoteFileOpsMenu NC.NoteFileOpsItems 
		    NC.OtherOpsMenu NC.OtherOpsItems NC.NoteCardsIconBitmap)
	(VARS NC.NoteCardsIconWindow)
	(BITMAPS NCCURSOR NC.NoteCardsIconBitmap NC.NewCardsIconBitmap NC.BoxesIconBitmap 
		 NC.OldStyleIconBitmap NC.NoteCardsIconMask NC.NoteCardsIconShrunkenBitmap 
		 NC.NoteCardsIconShrunkenMask)
	(FNS NC.NoteCardsWindowP NC.NoteCardsIconWindowP NC.MakeNoteCardsIcon NC.BringUpNoteCardsIcon 
	     NC.NoteCardsIconAfterMoveFn NC.FileBrowserMenu NC.ListOfNoteFilesMenu 
	     NC.CheckpointSession NC.CloseSession)
	(ADDVARS (NC.NoteFileIconOperationsMenuItems (Open NIL "Opens this NoteFile."
							   (SUBITEMS (Read-only% Open NIL 
							     "Opens this NoteFile for read-only.")))
						     (Checkpoint NIL 
						"Checkpoint this NoteFile, saving changed cards.")
						     (Close NIL "Closes this NoteFile."
							    (SUBITEMS (Close% w/o% confirm NIL 
		     "Close this notefile w/o asking for user confirm before closing open cards.")))
						     (Abort NIL 
					      "Close NF, deleting changes since last checkpoint.")
						     (Compact NIL 
							  "Compacts this NoteFile to a new file."
							      (SUBITEMS (Compact% To% New% File
									  NIL 
						      "Compact a NoteFile copying to a new file.")
									(Compact% In% Place NIL 
						  "Compact a NoteFile w/o copying to a new file.")))
						     (Inspect&Repair NIL 
						 "Inspects and optionally repairs this NoteFile."
								     (SUBITEMS (Read% Substances
										 NIL 
"Inspects and optionally repairs a Notefile, but reads every substance.  This slows it WAY down.")))
						     (Copy NIL 
							 "Copies this notefile to a target file.")
						     (Rename NIL "Rename this NoteFile")
						     (Delete NIL "Deletes this NoteFile."))
		 (NC.NoteFileIconOpenOperations Open Checkpoint Close Abort Close% w/o% confirm)
		 (NC.NoteFileIconCloseOperations Open Compact Read-only% Open Inspect&Repair 
						 Read% Substances Copy Rename Delete 
						 Compact% To% New% File Compact% In% Place))
	[INITVARS (NC.DefaultMiddleButtonMenuItems NIL)
		  [NC.LocalInsertLinkMenuItem (QUOTE (Insert% Link
						       (FUNCTION NC.AddLinkToCard)
						       
		     "Insert a link to another card at the currently selected point in the text."
						       (SUBITEMS (Insert% Link
								   (FUNCTION NC.AddLinkToCard)
								   
		     "Insert a link to another card at the currently selected point in the text.")
								 (Insert% Links
								   (FUNCTION NC.AddLinksToCard)
								   
		       "Insert links to other cards at the currently selected point in the text.")
								 (Add% Global% Link
								   (FUNCTION NC.AddGlobalLinkToCard)
								   
						    "Add a global link emanating from this card.")
								 (Add% Global% Links
								   (FUNCTION NC.AddGlobalLinksToCard)
								   
					    "Add multiple global links emanating from this card."]
		  [NC.GlobalInsertLinkMenuItem (QUOTE (Add% Global% Link
							(FUNCTION NC.AddGlobalLinkToCard)
							"Add a global link emanating from this card."
							(SUBITEMS (Add% Global% Link
								    (FUNCTION NC.AddGlobalLinkToCard)
								    
						    "Add a global link emanating from this card.")
								  (Add% Global% Links
								    (FUNCTION NC.AddGlobalLinksToCard)
								    
					    "Add multiple global links emanating from this card."]
		  (NC.DefaultLeftButtonMenuItems
		    (BQUOTE ((Edit% Property% List (FUNCTION NC.EditProperties)
						   
					"Brings up an editor for the property list of this card.")
			     (Show% Links (FUNCTION NC.ShowLinks)
					  "Brings up a list of the links to and from this card.")
			     (Show% Info (FUNCTION NC.ShowInfo)
					 
			     "Brings up a window containing special information about this card."
					 (SUBITEMS (Indicate% NoteFile (FUNCTION 
									    NC.AttachNoteFileName)
								       
							"Shows the name of this card's NoteFile.")))
			     (Designate% FileBoxes (FUNCTION NC.AddParents)
						   "File this note card in one or more file boxes."
						   (SUBITEMS (Unfile% from% FileBoxes
							       (FUNCTION NC.UnfileNoteCard)
							       
					   "Remove this card from one or more of its file boxes.")))
			     (Assign% Title (FUNCTION NC.AssignTitle)
					    "Assigns a (new) title to this note card.")
			     (Title/FileBoxes (FUNCTION [LAMBDA (TextStream)
								(NC.AssignTitle TextStream)
								(NC.AddParents TextStream])
					      "Do both assigning of title and filing in fileboxes.")
			     , NC.LocalInsertLinkMenuItem
			     (Close% and% Save (FUNCTION CLOSEW)
					       
					  "Close this note card after saving it in the NoteFile."
					       (SUBITEMS (Close% and% Save (FUNCTION CLOSEW)
									   
					  "Close this note card after saving it in the NoteFile.")
							 (Close% w/o% Saving (FUNCTION 
									     NC.QuitWithoutSaving)
									     
		      "Close this note card without saving any changes made since the last Save.")
							 (Save% in% NoteFile (FUNCTION NC.CardSaveFn)
									     
				       "Save this card in the NoteFile but don't close the card.")
							 (Delete% Card (FUNCTION NC.DeleteNoteCard)
								       
						"Permanently delete this card from the NoteFile."]
	[ADDVARS [NC.CardOpsItems (% Close%  (NC.CloseNoteCards NIL NC.NoteCardsIconWindow)
					     "Delete several note cards."
					     (SUBITEMS (Close% Structure (NC.CloseStructure NIL NIL 
									   NC.NoteCardsIconWindow)
									 
						     "Close note cards belonging to a structure.")))
				  (% Delete%  (NC.DeleteNoteCards NIL T NIL NC.NoteCardsIconWindow)
					      "Delete several note cards."
					      (SUBITEMS (Delete% Structure (NC.DeleteStructure NIL 
											      NIL 
									   NC.NoteCardsIconWindow)
									   
						    "Delete note cards belonging to a structure.")))
				  (% Copy%  (NC.CopyCards NIL NIL NIL NIL NC.NoteCardsIconWindow)
					    "Copy note cards to a filebox"
					    (SUBITEMS (Copy% Structure (NC.CopyStructure NIL NIL NIL 
									   NC.NoteCardsIconWindow)
								       
						      "Copy note cards belonging to a structure.")))
				  (% Move%  (NC.MoveCards NIL NIL NIL NIL NC.NoteCardsIconWindow)
					    "Move note cards to a filebox"
					    (SUBITEMS (Move% Structure (NC.MoveStructure NIL NIL NIL 
									   NC.NoteCardsIconWindow)
								       
						      "Move note cards belonging to a structure."]
		 (NC.NoteFileOpsItems (% Open%  (NC.DoNoteFileOp (QUOTE Open% NoteFile))
						"Opens a notefile."
						(SUBITEMS (Read-only% Open (NC.DoNoteFileOp
									     (QUOTE Read-only% Open))
									   
								 "Open a notefile for read-only.")))
				      (% Checkpoint%  (NC.DoNoteFileOp (QUOTE Checkpoint% NoteFile))
						      "Checkpoint a NoteFile"
						      (SUBITEMS (Checkpoint% All (NC.CheckpointSession
										   )
										 
							"Checkpoint all currently open NoteFiles")))
				      (% Close%  (NC.DoNoteFileOp (QUOTE Close% NoteFile))
						 "Close a notefile."
						 (SUBITEMS (Close% w/o% confirm (NC.DoNoteFileOp
										  (QUOTE 
									      Close% w/o% confirm))
										
			"Close a notefile w/o asking for user confirm before closing open cards.")
							   (Close% All (NC.CloseSession)
								       
							     "Close all currently open NoteFiles")
							   (Close% All% w/o% confirm (NC.CloseSession
										       NIL T)
										     
		"Close all open notefiles w/o asking for user confirm before closing open cards.")))
				      (% Abort%  (NC.DoNoteFileOp (QUOTE Abort% NoteFile))
						 "Close NF, deleting changes since last checkpoint."
						 (SUBITEMS (Abort% All (NC.CloseSession T)
								       
							     "Abort all currently open NoteFiles")))
				      (% Compact%  (NC.DoNoteFileOp (QUOTE Compact% NoteFile))
						   "Compact a NoteFile."
						   (SUBITEMS (Compact% To% New% File
							       (NC.DoNoteFileOp (QUOTE 
										Compact% NoteFile))
							       
						      "Compact a NoteFile copying to a new file.")
							     (Compact% In% Place (NC.DoNoteFileOp
										   (QUOTE 
									       Compact% In% Place))
										 
						  "Compact a NoteFile w/o copying to a new file.")))
				      (% Inspect&Repair%  (NC.DoNoteFileOp (QUOTE 
									 Inspect&Repair% NoteFile))
							  "Do an Inspect & Repair on a NoteFile."
							  (SUBITEMS (Read% Substances
								      (NC.DoNoteFileOp (QUOTE 
										 Read% Substances))
								      
"Inspects and optionally repairs a Notefile, but reads every substance.  This slows it WAY down.")))
				      (% Copy%  (NC.DoNoteFileOp (QUOTE Copy% NoteFile))
						"Copy a NoteFile.")
				      (% Rename%  (NC.DoNoteFileOp (QUOTE Rename% NoteFile))
						  "Rename a NoteFile")
				      (% Delete%  (NC.DoNoteFileOp (QUOTE Delete% NoteFile))
						  "Delete a NoteFile")
				      (% Create%  (NC.DoNoteFileOp (QUOTE Create% NoteFile))
						  "Create a new NoteFile w/o opening it."
						  (SUBITEMS (% Create% and% Open% 
							      (NC.DoNoteFileOp (QUOTE 
										Create% and% Open))
							      "Create a new NoteFile and open it.")
							    (% Create% and% Read-only% Open% 
							      (NC.DoNoteFileOp (QUOTE 
								     Create% and% Read-only% Open))
							      
					       "Create a new NoteFile and open it for read-only.")))
				      (% --------%  NIL "")
				      (% NC% FileBrowser%  (NC.FileBrowserMenu NC.NoteCardsIconWindow)
							   "Bring up a NoteFile browser."))
		 (NC.OtherOpsItems (% Edit% Parameters%  (NC.BuildInspector)
							 "Adjust NoteCards profile for this session.")
				   (% NF% Indicators% On%  (NC.ShowNoteFiles)
							   
				    "Turn on the NoteFile indicator for all currently open cards"
							   (SUBITEMS (Indicators% Off (
NC.ShowNoteFiles T)
										      
				    "Turn off any NoteFile indicator on each card on the screen.")))
				   (% TEdit% Killer% On% 
				     (START-TEDIT-KILLER)
				     "Start the TEDIT-KILLER process."
				     (SUBITEMS (TEdit% Killer% Off (STOP-TEDIT-KILLER)
								   "Stop the TEDIT-KILLER process.")
					       (New% Process% Limit
						 (SETQ TEDIT-PROCESS-LIMIT
						       (OR (NUMBERP (RNUMBER (CONCAT 
								      "Old TEdit process limit: "
										     
									      TEDIT-PROCESS-LIMIT)
									     NIL NIL NIL T))
							   TEDIT-PROCESS-LIMIT))
						 "Change value of TEdit process limit.")
					       (New% Wait% Time (SETQ
								  TEDIT-KILLER-WAIT-TIME
								  (OR (NUMBERP (RNUMBER (CONCAT
											  
								   "Old TEdit killer wait time: "
											  
									   TEDIT-KILLER-WAIT-TIME)
											NIL NIL NIL T)
									       )
								      TEDIT-KILLER-WAIT-TIME))
								
							"Change value of TEdit killer wait time.")))
				   (% Session% Icon% Style%  NIL 
						"Change the style of the NoteCards session icon."
							     (SUBITEMS (% Old% Style% 
									 (NC.ResetNoteCardsIcon
									   (QUOTE OldStyle))
									 
						      "Change session icon to Roll-through style")
								       (% New% Style% 
									 (NC.ResetNoteCardsIcon
									   (QUOTE NewStyle))
									 
							   "Change session icon to Filebox style"]
	(VARS (NC.CardOpsMenu)
	      (NC.OtherOpsMenu)
	      (NC.NoteFileOpsMenu))
	(GLOBALVARS NC.NoteCardsIconMenuBitMap NC.OldStyleIconMenuBitmap NC.OldStyleIconBitmap 
		    NC.OldStyleIconMenuBitmap NC.NoteCardsIconMask NC.NoteCardsIconShrunkenBitmap 
		    NC.NoteCardsIconShrunkenMask NC.OtherOpsItems NC.OtherOpsMenu)
	(VARS (NC.NoteCardsIconMenuBitMap)
	      (NC.OldStyleIconMenuBitmap))
	(FNS NC.RedisplayNoteCardsIconWindow NC.NoteCardsIconButtonEventFn NC.DoNoteFileOp 
	     NC.NoteCardsIconCursorEventFn NC.NoteCardsIconFn NC.ResetNoteCardsIcon 
	     NC.MakeNewStyleNoteCardsIcon NC.MakeOldStyleNoteCardsIcon)
	(* * Command Menu interface to NC functions)
	(FNS NC.CloseNoteCards NC.CopyStructure NC.CloseStructure NC.DeleteStructure NC.MoveStructure)
	(VARS NC.SystemDate)
	(* * NoteFile interface)
	(FNS NC.NoteFileMenuWindowP NC.SetUpNoteFileInterface NC.ResetNoteFileInterface 
	     NC.NoteFileIconButtonEventFn NC.NoteFileOperations NC.NoteFileIconMiddleButtonFn 
	     NC.PopUpNoteFileName)
	[VARS (NC.DefaultNoteFileIconMiddleButtonItems (QUOTE ((Full% File% Name NC.PopUpNoteFileName 
						       "Display full file name of this notefile."]
	(* * Show NoteFile Indicators)
	(FNS NC.ShowNoteFiles NC.AttachNoteFileName NC.MakeNoteFileNameIndicator 
	     NC.NoteFileIndicatorWinHeight)
	(* * File Browser)
	(GLOBALVARS NC.FileBrowserMenuItemsToRemove NC.FileBrowserMenuItemsToAdd 
		    NC.FileBrowserMenuItems NC.FileBrowserPatterns NC.FileBrowserDefaultPatterns)
	[VARS (NC.FileBrowserMenuItemsToRemove (QUOTE (Hardcopy See Edit Load Compile Copy Rename 
								Expunge)))
	      (NC.FileBrowserMenuItemsToKeep (QUOTE (Delete Undelete Recompute Sort)))
	      [NC.FileBrowserMenuItemsToAdd (QUOTE ((Open NC.FileBrowserOpen 
							  "Open selected Notefiles."
							  (SUBITEMS (Read-only% Open (
NC.FileBrowserOpen INPUT)
										     
							 "Open selected Notefiles for read-only.")))
						    (Checkpoint NC.FileBrowserCheckpoint 
					 "Checkpoint the selected Notefiles, saving dirty cards.")
						    (Close NC.FileBrowserClose 
							   "Close selected Notefiles.")
						    (Abort NC.FileBrowserAbort 
			       "Aborts the selected Notefiles losing work since last checkpoint.")
						    (Compact NC.FileBrowserCompact 
					      "Compacts selected Notefiles copying to new files."
							     (SUBITEMS (Compact% To% New% File 
									    NC.FileBrowserCompact 
					      "Compacts selected Notefiles copying to new files.")
								       (Compact% In% Place
									 (NC.FileBrowserCompact
									   (QUOTE InPlace))
									 
					   "Compacts selected Notefiles w/o copyig to new files.")))
						    (Inspect&Repair
						      NC.FileBrowserInspect&Repair 
					    "Inspects and optionally repairs selected Notefiles."
						      (SUBITEMS (Read% Substances
								  (NC.FileBrowserInspect&Repair
								    (QUOTE ReadSubstances))
								  
"Inspects and optionally repairs selected Notefiles, but reads every substance.  This slows things WAY down."
								  )))
						    (Copy FB.COPYCOMMAND 
					"Copies given notefile(s) to target file (or directory).")
						    (Rename FB.RENAMECOMMAND 
					 "Moves given notefile(s) to target file (or directory)."]
	      (NC.FileBrowserExpungeMenuItem (QUOTE (Expunge NC.FileBrowserExpunge 
			 "Permanently removes from the file system all files marked for deletion")))
	      (NC.FileBrowserRecomputeMenuItem (QUOTE (Recompute FB.UPDATECOMMAND 
				       "Recomputes set of notefiles satisfying selection pattern"
								 (SUBITEMS ("Same Pattern" 
										 FB.UPDATECOMMAND 
					     "Recomputes set of files satisfying current pattern")
									   ("New Pattern" 
							    NC.FileBrowserRecomputeWithNewPattern 
					"Prompts for a new selection pattern and updates browser")
									   ("New Info" 
										FB.NEWINFOCOMMAND 
					   "Change the set of file attributes that are displayed"]
	(* * Build the menu items for notecards file browser.)
	[VARS (NC.FileBrowserMenuItems (APPEND NC.FileBrowserMenuItemsToAdd
					       (for MenuItem in FB.MENU.ITEMS when
						    (FMEMB (CAR MenuItem)
							   NC.FileBrowserMenuItemsToKeep)
						    collect
						    (if (EQ (CAR MenuItem)
							    (QUOTE Recompute))
							then NC.FileBrowserRecomputeMenuItem else 
							MenuItem))
					       (LIST NC.FileBrowserExpungeMenuItem)
					       (for MenuItem in FB.MENU.ITEMS unless
						    (OR (FMEMB (CAR MenuItem)
							       NC.FileBrowserMenuItemsToRemove)
							(FMEMB (CAR MenuItem)
							       NC.FileBrowserMenuItemsToKeep))
						    collect MenuItem]
	[INITVARS (NC.FileBrowserPatterns NIL)
		  (NC.FileBrowserDefaultPatterns (QUOTE ({DSK}*.NOTEFILE;*]
	(* * Functions called from file browser menu.)
	(FNS NC.FileBrowserOpen NC.FileBrowserClose NC.FileBrowserCheckpoint NC.FileBrowserAbort 
	     NC.FileBrowserCompact NC.FileBrowserInspect&Repair NC.FileBrowserExpunge 
	     NC.GetFileBrowserPattern NC.FileBrowserRecomputeWithNewPattern 
	     NC.FindFileBrowserWinForPattern)
	(FNS NC.FlashFileBrowserWin)))
(* * Internal variables)

(DECLARE: DOEVAL@COMPILE DONTCOPY

(GLOBALVARS NC.CachedMenus NC.NoteCardsIconPosition NC.SelectionInProgress NC.SelectedCards 
	    NC.SelectingSourcesMenu NC.SelectingContentsMenu NC.SelectingSingleCardMenu 
	    NC.SelectingMultipleCardsMenu NC.DeleteSelectingMenu NC.SelectingParentsMenu 
	    NC.SelectingBrowserSourceMenu NC.SelectingFileBoxChildrenMenu NC.SelectingCardsMenu 
	    NC.SelectingCardMenu NC.TEditMenus NC.NoteCardTypeMenu NC.DatabaseOperationsMenu 
	    NC.LinkLabelMenu NC.WindowRightButtonMenu NC.LogoWindow LOGOW ExecWindow 
	    PROCESS.STATUS.WINDOW QUADTREE.HIGHRES NC.BrowseOrSearchMenu FONTDIRECTORIES 
	    NC.DatabaseFileNameSuggestion NC.UncachingNotCompleted NC.UnspecifiedLinkLabel 
	    NC.UCASESystemLinkLabels NC.MainMenuPosition NC.NoteCardsIconWindow NC.NewCardsIconBitmap 
	    NC.BoxesIconBitmap NC.NoteFileIndicatorFont NC.NoteFileMenuLingerFlg 
	    NC.FileBrowserExpungeMenuItem NC.FileBrowserRecomputeMenuItem 
	    NC.FileBrowserMenuItemsToKeep NC.DefaultNoteFileIconMiddleButtonItems 
	    NC.OpenedNoteFileMenu NC.ClosedNoteFileMenu NC.NoteFileIconOperationsMenuItems 
	    NC.NoteFileIconOpenOperations NC.NoteFileIconCloseOperations NC.NoteCardTypeMenu 
	    NC.DefaultLeftButtonMenuItems NC.LocalInsertLinkMenuItem NC.GlobalInsertLinkMenuItem 
	    NC.DefaultMiddleButtonMenuItems NC.PromptWindowMonitorLock)
)

(RPAQQ NC.LinkLabelMenu NIL)

(RPAQQ NC.LinkDisplayModesMenu NIL)

(RPAQQ NC.DatabaseFileNameSuggestion NIL)

(RPAQQ NC.TEditMenus NIL)

(RPAQQ NC.OpenedNoteFileMenu NIL)

(RPAQQ NC.ClosedNoteFileMenu NIL)

(RPAQ? NC.NoteCardsIconPosition )

(RPAQ? NC.PromptWindowMonitorLock (CREATE.MONITORLOCK "PromptWindowMonitorLock"))

(RPAQ? NC.FileNameFont (FONTCREATE (QUOTE HELVETICA)
				     10
				     (QUOTE BOLD)))

(RPAQ? NC.FullFileNameFont (FONTCREATE (QUOTE HELVETICA)
					 8
					 (QUOTE STANDARD)))

(RPAQ? NC.MaxFileNameChars 18)
(* * Setup and top level interaction)

(DECLARE: DONTEVAL@LOAD DONTCOPY EVAL@COMPILE 
(FILESLOAD (FROM NOTECARDS)
	   FILEBROWSER)
)
(DEFINEQ

(NoteCards
  (LAMBDA (IconPosition)                                     (* fgh: " 7-Jun-86 16:21")

          (* * Start up NoteCards by bringing up the NoteCards icon at IconPosition)



          (* * fgh 6/7/86 First created.)


    (NC.BringUpNoteCardsIcon (if (POSITIONP IconPosition)
				   then IconPosition))))

(NC.MakeMainMenu
  [LAMBDA (DatabaseTitle)                                    (* pmi: "25-Mar-87 10:28")

          (* * Create the NoteCards menus)



          (* * rht 8/1/84: Added def'n for new menu: NC.SelectingFileBoxChildrenMenu)



          (* * rht 2/4/85: The browser source menu now accepts multiple selections.)



          (* * fkr 10/29/85: Now moves window onto screen.)



          (* * fgh 11/14/85 Eliminated NC Main Menu which was replaced by per NoteFile menus.)



          (* * pmi 12/4/86 Added menus for left button title bar of NoteFile Icons, one for open NoteFile and one for closed 
	  NoteFile)



          (* * pmi 12/19/86 Removed menu items "Compact" and "Inspect&Repair" from NC.OpenedNoteFileMenu.)



          (* * rht 2/11/87: Moved stuff for creating NC.OpenedNoteFileMenu and NC.ClosedNoteFileMenu out of here and into a 
	  separate function.)



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


    (DECLARE (GLOBALVARS NC.MenuFont NC.MainMenuPosition NC.SelectingSourcesMenu 
			     NC.SelectingContentsMenu NC.SelectingSingleCardMenu NC.SelectingCardMenu 
			     NC.SelectingMultipleCardsMenu NC.DeleteSelectingMenu 
			     NC.SelectingParentsMenu NC.SelectingBrowserSourceMenu 
			     NC.SelectingFileBoxChildrenMenu NC.SelectingCardsMenu WHITESHADE 
			     GRAYSHADE))
    (PROG [X (TitleFont (FONTCREATE (QUOTE HELVETICA)
					10
					(QUOTE BOLD)))
	       (Position (OR (POSITIONP NC.MainMenuPosition)
			       (create POSITION
					 XCOORD ← 350
					 YCOORD ← 650]       (* Main Menu)
	    (SETQ X (create MENU
				ITEMS ← (QUOTE ((NoSource NIL 
						   "Indicates that this note card has no source.")
						   (Undo NIL "Backup over last selection.")
						   (Done NIL "Indicates that selection is completed.")
						   ))
				WHENSELECTEDFN ← (FUNCTION NC.SelectionMenusWhenSelectedFn)
				TITLE ← " Selecting Source(s) "
				CENTERFLG ← T
				MENUBORDERSIZE ← 1
				MENUOUTLINESIZE ← 1
				MENUCOLUMNS ← 3
				MENUFONT ← NC.MenuFont
				ITEMHEIGHT ← (IPLUS 10 (FONTPROP NC.MenuFont (QUOTE HEIGHT)))
				MENUPOSITION ← Position
				MENUTITLEFONT ← TitleFont))
	    (SETQ NC.SelectingSourcesMenu X)
	    (SETQ X (create MENU
				ITEMS ← (QUOTE ((Cancel NIL "Cancel card closing.")
						   (Undo NIL "Backup over last selection.")
						   (Done NIL "Indicates that selection is completed.")
						   ))
				WHENSELECTEDFN ← (FUNCTION NC.SelectionMenusWhenSelectedFn)
				TITLE ← " Selecting File Box(es) "
				CENTERFLG ← T
				MENUBORDERSIZE ← 1
				MENUOUTLINESIZE ← 1
				MENUCOLUMNS ← 3
				MENUFONT ← NC.MenuFont
				ITEMHEIGHT ← (IPLUS 10 (FONTPROP NC.MenuFont (QUOTE HEIGHT)))
				MENUPOSITION ← Position
				MENUTITLEFONT ← TitleFont))
	    (SETQ NC.SelectingContentsMenu X)
	    (SETQ X (create MENU
				ITEMS ← (QUOTE ((New% Card NIL "Make a new note card.")
						   (Cancel NIL "Cancel this selection.")))
				WHENSELECTEDFN ← (FUNCTION NC.SelectionMenusWhenSelectedFn)
				TITLE ← " Selecting Note Card "
				CENTERFLG ← T
				MENUBORDERSIZE ← 1
				MENUOUTLINESIZE ← 1
				MENUCOLUMNS ← 2
				MENUFONT ← NC.MenuFont
				ITEMHEIGHT ← (IPLUS 10 (FONTPROP NC.MenuFont (QUOTE HEIGHT)))
				MENUPOSITION ← Position
				MENUTITLEFONT ← TitleFont))
	    (SETQ NC.SelectingSingleCardMenu X)
	    (SETQ X (create MENU
				ITEMS ← (QUOTE ((Cancel NIL "Cancel this selection.")))
				WHENSELECTEDFN ← (FUNCTION NC.SelectionMenusWhenSelectedFn)
				TITLE ← " Selecting Single Card "
				CENTERFLG ← T
				MENUBORDERSIZE ← 1
				MENUOUTLINESIZE ← 1
				MENUCOLUMNS ← 1
				MENUFONT ← NC.MenuFont
				ITEMHEIGHT ← (IPLUS 10 (FONTPROP NC.MenuFont (QUOTE HEIGHT)))
				MENUPOSITION ← Position
				MENUTITLEFONT ← TitleFont))
	    (SETQ NC.SelectingCardMenu X)
	    (SETQ X (create MENU
				ITEMS ← (QUOTE ((Cancel NIL "Cancel this selection.")
						   (Undo NIL "Backup over last selection.")
						   (Done NIL "Indicates that selection is completed.")
						   ))
				WHENSELECTEDFN ← (FUNCTION NC.SelectionMenusWhenSelectedFn)
				TITLE ← " Selecting Note Cards "
				CENTERFLG ← T
				MENUBORDERSIZE ← 1
				MENUOUTLINESIZE ← 1
				MENUCOLUMNS ← 3
				MENUFONT ← NC.MenuFont
				ITEMHEIGHT ← (IPLUS 10 (FONTPROP NC.MenuFont (QUOTE HEIGHT)))
				MENUPOSITION ← Position
				MENUTITLEFONT ← TitleFont))
	    (SETQ NC.SelectingMultipleCardsMenu X)
	    (SETQ X (create MENU
				ITEMS ← (QUOTE ((Cancel NIL "Cancel this selection.")
						   (Undo NIL "Backup over last selection.")
						   (Done NIL "Indicates that selection is completed.")
						   ))
				WHENSELECTEDFN ← (FUNCTION NC.SelectionMenusWhenSelectedFn)
				TITLE ← " Selecting cards to close or delete "
				CENTERFLG ← T
				MENUBORDERSIZE ← 1
				MENUOUTLINESIZE ← 1
				MENUCOLUMNS ← 3
				MENUFONT ← NC.MenuFont
				ITEMHEIGHT ← (IPLUS 10 (FONTPROP NC.MenuFont (QUOTE HEIGHT)))
				MENUPOSITION ← Position
				MENUTITLEFONT ← TitleFont))
	    (SETQ NC.DeleteSelectingMenu X)
	    (SETQ X (create MENU
				ITEMS ← (QUOTE ((Cancel NIL "Cancel this selection.")
						   (Undo NIL "Backup over last selection.")
						   (Done NIL "Indicates that selection is completed.")
						   ))
				WHENSELECTEDFN ← (FUNCTION NC.SelectionMenusWhenSelectedFn)
				TITLE ← " Selecting FileBox(s) "
				CENTERFLG ← T
				MENUBORDERSIZE ← 1
				MENUOUTLINESIZE ← 1
				MENUCOLUMNS ← 3
				MENUFONT ← NC.MenuFont
				ITEMHEIGHT ← (IPLUS 10 (FONTPROP NC.MenuFont (QUOTE HEIGHT)))
				MENUPOSITION ← Position
				MENUTITLEFONT ← TitleFont))
	    (SETQ NC.SelectingParentsMenu X)
	    (SETQ X (create MENU
				ITEMS ← (QUOTE ((Cancel NIL "Cancel this selection.")
						   (Undo NIL "Backup over last selection.")
						   (Done NIL 
						    "Indicates that this operation is completed.")))
				WHENSELECTEDFN ← (FUNCTION NC.SelectionMenusWhenSelectedFn)
				TITLE ← " Selecting Starting Card(s)/Box(s) "
				CENTERFLG ← T
				MENUBORDERSIZE ← 1
				MENUOUTLINESIZE ← 1
				MENUCOLUMNS ← 3
				MENUFONT ← NC.MenuFont
				ITEMHEIGHT ← (IPLUS 10 (FONTPROP NC.MenuFont (QUOTE HEIGHT)))
				MENUPOSITION ← Position
				MENUTITLEFONT ← TitleFont))
	    (SETQ NC.SelectingBrowserSourceMenu X)
	    (SETQ X (create MENU
				ITEMS ← (QUOTE ((Cancel NIL "Cancel this operation.")
						   (Undo NIL "Backup over last selection.")
						   (Done NIL 
						    "Indicates that this operation is completed.")))
				WHENSELECTEDFN ← (FUNCTION NC.SelectionMenusWhenSelectedFn)
				TITLE ← " Selecting cards to file "
				CENTERFLG ← T
				MENUBORDERSIZE ← 1
				MENUOUTLINESIZE ← 1
				MENUCOLUMNS ← 3
				MENUFONT ← NC.MenuFont
				ITEMHEIGHT ← (IPLUS 10 (FONTPROP NC.MenuFont (QUOTE HEIGHT)))
				MENUPOSITION ← Position
				MENUTITLEFONT ← TitleFont))
	    (SETQ NC.SelectingFileBoxChildrenMenu X)
	    (SETQ X (create MENU
				ITEMS ← (QUOTE ((Cancel NIL "Cancel this operation.")
						   (Undo NIL "Backup over last selection.")
						   (Done NIL 
						    "Indicates that this operation is completed.")))
				WHENSELECTEDFN ← (FUNCTION NC.SelectionMenusWhenSelectedFn)
				TITLE ← " Selecting Cards "
				CENTERFLG ← T
				MENUBORDERSIZE ← 1
				MENUOUTLINESIZE ← 1
				MENUCOLUMNS ← 3
				MENUFONT ← NC.MenuFont
				ITEMHEIGHT ← (IPLUS 10 (FONTPROP NC.MenuFont (QUOTE HEIGHT)))
				MENUPOSITION ← Position
				MENUTITLEFONT ← TitleFont))
	    (SETQ NC.SelectingCardsMenu X])

(NC.LogoutAdvice
  (LAMBDA NIL                                                (* fgh: "18-Nov-85 00:39")
                                                             (* Advice attached to logout to prevent logging out 
							     with an open database.)

          (* * fgh 11/14/85 Updated to handle Muiltiple open noteFiles.)



          (* * rht 11/16/85: Modified to call NC.ListOfNoteFiles.)


    (LET ((OpenNoteFiles (for NoteFile in (NC.ListOfNoteFiles)
			    when (AND (STREAMP (fetch (NoteFile Stream) of NoteFile))
					  (OPENP (fetch (NoteFile Stream) of NoteFile)))
			    collect NoteFile)))
         (COND
	   (OpenNoteFiles (NC.PrintMsg NIL T "The following NoteFiles are still open."
					 (CHARACTER 13)
					 "They must be closed before you can logout!!!"
					 (CHARACTER 13))
			  (for NF in OpenNoteFiles do (NC.PrintMsg NIL NIL
									   (fetch (NoteFile 
										     FullFileName)
									      of NF)
									   ",  "))
			  (RPTQ 1 (PROGN (VIDEOCOLOR T)
					     (DISMISS 100)
					     (VIDEOCOLOR NIL)
					     (DISMISS 100)))
			  (RPTQ 3 (FLASHW PROMPTWINDOW))
			  (RETFROM (QUOTE LOGOUT)))))))

(NC.AttachPromptWindow
  [LAMBDA (MainWindow MinWidth Height Font DontCreate)       (* rht: "23-Mar-87 19:46")

          (* * GETPROMPTWINDOW that works for small windows. sizes default to 300 X 60)



          (* * fgh 5/1/86 MainWindowXSize now based on MainWindow's REGION WIDTH not its REGION RIGHT.)



          (* * fgh 6/6/86 To fix many bugs made into a wrapper fot NC.GETPROMPTWINDOW)



          (* * rht 3/21/87: Now keeps MinWidth small enough so that the prompt window will always fit on the screen without 
	  moving MainWindow.)


    (DECLARE (GLOBALVARS NC.PrintMsgFont))
    (if MainWindow
	then (if MinWidth
		   then (SETQ MinWidth (MIN MinWidth (NC.MaxPromptWindowWidth MainWindow)))
		 else (SETQ MinWidth 300))
	       (OR Height (SETQ Height 60))
	       (NC.GETPROMPTWINDOW MainWindow (IQUOTIENT Height (if (FONTP Font)
									then (FONTHEIGHT Font)
								      else 15))
				     (OR Font NC.PrintMsgFont)
				     DontCreate MinWidth])

(NC.AttachPromptWindowOffScreen
  [LAMBDA (MainWindow MinWidth Height Font)                  (* rht: "17-Apr-87 16:06")

          (* * Moves MainWindow off screen, calls NC.AttachPromptWindow, closes resulting promptwindow, and moves window 
	  back.)


    (DECLARE (GLOBALVARS NC.OffScreenPosition))
    (LET ((OldPos (WINDOWPOSITION MainWindow))
	  PromptWin)
         (MOVEW MainWindow NC.OffScreenPosition)
         (SETQ PromptWin (NC.AttachPromptWindow MainWindow MinWidth Height Font))
         (AND (OPENWP PromptWin)
		(CLOSEW PromptWin))
         (MOVEW MainWindow OldPos])

(NC.GETPROMPTWINDOW
  [LAMBDA (MAINWINDOW %#LINES FONT DONTCREATE MINWIDTH)    (* rht: "22-Apr-87 20:13")

          (* makes sure that MAINWINDOW has an attached promptwindow and returns it. If one already exists, it is shaped to 
	  be at least %#LINES high. If FONT is NIL, the font of the main window is used for the promptwindow.)



          (* * fgh 6/6/86 Adapted from system GETPROMPTWINDOW. Added MINWIDTH arg.)



          (* * rht 7/2/86: Now attaches prompt window on right if near right edge of screen.)



          (* * rht 7/4/86: Yanked out PositionOnEdge localvar. Put code in place.)



          (* * rht 3/21/87: AttachWindowPositionOnEdge to attach prompt window is left if possible, then center, then right.
	  Also doesn't let prompt window be wider than screen.)



          (* * rht 3/30/87: More ATTACHEDWINDOWS hacking. This time to get the unstacking and restacking of attachedwindows 
	  right during reshaping of the prompt window.)



          (* * rht&rg&pmi 4/22/87: Added stack of extra prompt windows and checks for whether they have processes equal to 
	  this one.)


    (DECLARE (GLOBALVARS WBorder))
    (AND MINWIDTH (SETQ MINWIDTH (MIN (DIFFERENCE SCREENWIDTH (TIMES WBorder 2))
					    MINWIDTH)))
    (WITH.MONITOR
      NC.PromptWindowMonitorLock
      (PROG ((PWINDOWPROP (WINDOWPROP MAINWINDOW (QUOTE PROMPTWINDOW)))
	       (PWINDOWMINWIDTH (WINDOWPROP MAINWINDOW (QUOTE PROMPTWINDOWMINWIDTH)))
	       (MAINWINDOWREGION (WINDOWPROP MAINWINDOW (QUOTE REGION)))
	       (OtherPWindowProps (WINDOWPROP MAINWINDOW (QUOTE OtherPromptWindows)))
	       PWINDOW PWINDOWREGION WIDTH HEIGHT OBSCUREDHEIGHT PWINDOW.PWINDOW PWinWidth 
	       AttachWindowPositionOnEdge ThisPWindowProp)
	      (SETQ PWinWidth (WIDTHIFWINDOW (OR MINWIDTH PWINDOWMINWIDTH 1)))
	      [SETQ AttachWindowPositionOnEdge (COND
		  ((LEQ (PLUS (fetch (REGION LEFT) of MAINWINDOWREGION)
				  PWinWidth)
			  SCREENWIDTH)
		    (QUOTE LEFT))
		  ((LEQ (PLUS (fetch (REGION LEFT) of MAINWINDOWREGION)
				  (LRSH (PLUS PWinWidth (fetch (REGION WIDTH) of 
										 MAINWINDOWREGION))
					  1))
			  SCREENWIDTH)
		    (QUOTE CENTER))
		  (T (QUOTE RIGHT]                         (* Find a free prompt window.)
	      [for PWindowProp in (CONS PWINDOWPROP OtherPWindowProps)
		 do (LET [(PWindowProcess (WINDOWPROP (CAR PWindowProp)
							  (QUOTE PromptWindowProcess]
		           (if (EQ (THIS.PROCESS)
				       PWindowProcess)
			       then (SETQ ThisPWindowProp PWindowProp)
				      (RETURN PWindowProp))
		           (if (AND (NULL ThisPWindowProp)
					(NOT (PROCESSP PWindowProcess)))
			       then (SETQ ThisPWindowProp PWindowProp]
	      [COND
		(DONTCREATE (RETURN (CAR ThisPWindowProp)))
		[ThisPWindowProp
		  (SETQ PWINDOW (CAR ThisPWindowProp))
		  (WINDOWPROP PWINDOW (QUOTE PromptWindowProcess)
				(THIS.PROCESS))
		  [COND
		    ((NOT (OPENWP PWINDOW))
		      (ATTACHWINDOW PWINDOW MAINWINDOW (QUOTE TOP)
				      AttachWindowPositionOnEdge
				      (QUOTE LOCALCLOSE]
		  (if (SETQ PWINDOW.PWINDOW (WINDOWPROP PWINDOW (QUOTE PROMPTWINDOW)))
		      then                                 (* This prompt window has a prompt window of its own.
							     Close and detach it.)
			     (REMOVEWINDOW (CAR PWINDOW.PWINDOW)))
		  (WINDOWPROP PWINDOW (QUOTE MAXSIZE)
				(CONS 64000 64000))
		  (WINDOWPROP PWINDOW (QUOTE MINSIZE)
				(CONS 1 1))
		  [SETQ HEIGHT (HEIGHTIFWINDOW (TIMES (OR %#LINES (CDR ThisPWindowProp)
								  1)
							    (FONTPROP (DSPFONT NIL PWINDOW)
									(QUOTE HEIGHT]
		  (SETQ WIDTH (MAX PWinWidth (fetch (REGION WIDTH) of MAINWINDOWREGION)))
		  (SETQ PWINDOWREGION (WINDOWPROP PWINDOW (QUOTE REGION)))
		  (COND
		    ([OR (NOT (EQP HEIGHT (fetch (REGION HEIGHT) of PWINDOWREGION)))
			   (NOT (EQP WIDTH (fetch (REGION WIDTH) of PWINDOWREGION]
                                                             (* Window exists, but not right size.
							     Keep windows detached during reshaping in case 
							     AttachWindowPositionOnEdge has changed.)

          (* * Need to distinguish among the windows attached to MAINWINDOW between those attached before PWINDOW and those 
	  attached after. The latter need to be reattached at AttachWindowPositionOnEdge after PWINDOW is reshaped.)


		      [LET [(DescriptionList (for Win in (ATTACHEDWINDOWS MAINWINDOW)
						bind WA when [EQ (QUOTE TOP)
								       (CAR (SETQ WA
										(WINDOWPROP
										  Win
										  (QUOTE 
										    WHEREATTACHED]
						collect    (* Detach attached windows at the top of the main Win 
							     and retuirn a list describing their attachment.)
							  (PROG1 (LIST Win (CDR WA)
									   (WINDOWPROP
									     Win
									     (QUOTE PASSTOMAINCOMS))
									   )
								   (DETACHWINDOW Win]
                                                             (* Have to smash these to let SHAPEW work.)
		           (WINDOWPROP PWINDOW (QUOTE MAXSIZE)
					 NIL)
		           (WINDOWPROP PWINDOW (QUOTE MINSIZE)
					 NIL)
		           (WINDOWPROP PWINDOW (QUOTE PASSTOMAINCOMS)
					 NIL)
		           (RESETLST [RESETSAVE NIL
						    (BQUOTE
						      (PROGN (WINDOWPROP
								 , PWINDOW (QUOTE OPENFN)
								 (QUOTE , (WINDOWPROP
									    PWINDOW
									    (QUOTE OPENFN)
									    NIL]
				       (SHAPEW PWINDOW
						 (create REGION
						    using PWINDOWREGION HEIGHT ← HEIGHT WIDTH ← 
							    WIDTH)))

          (* * Now reattach all the windows in order to their old locations, except that PWINDOW and those after it should be
	  attached at AttachWindowPositionOnEdge.)


		           (for WindowDescription in DescriptionList bind SeenPWINDOW
			      do (LET ((Win (CAR WindowDescription)))
				        (if (EQ Win PWINDOW)
					    then (SETQ SeenPWINDOW T))
				        (ATTACHWINDOW Win MAINWINDOW (QUOTE TOP)
							(if SeenPWINDOW
							    then AttachWindowPositionOnEdge
							  else (CADR WindowDescription)))
				        (WINDOWPROP Win (QUOTE PASSTOMAINCOMS)
						      (CADDR WindowDescription]
		      (RPLACD ThisPWindowProp %#LINES)     (* Fall through to check visibility)
		      ]
		(T (SETQ PWINDOW (CREATEW [create REGION
							LEFT ← 0
							BOTTOM ← 0
							WIDTH ← (MAX PWinWidth (fetch
									 (REGION WIDTH) of 
										 MAINWINDOWREGION))
							HEIGHT ←
							(SETQ HEIGHT
							  (HEIGHTIFWINDOW
							    (TIMES (OR %#LINES (SETQ %#LINES 1))
								     (FONTPROP
								       (OR FONT (SETQ FONT
									       (DSPFONT NIL 
										       MAINWINDOW)))
								       (QUOTE HEIGHT]
					      NIL NIL T))
		   (DSPSCROLL T PWINDOW)
		   (DSPFONT FONT PWINDOW)
		   (WINDOWPROP PWINDOW (QUOTE PAGEFULLFN)
				 (QUOTE NILL))
		   (ATTACHWINDOW PWINDOW MAINWINDOW (QUOTE TOP)
				   AttachWindowPositionOnEdge
				   (QUOTE LOCALCLOSE))
		   (if (NULL PWINDOWPROP)
		       then (WINDOWPROP MAINWINDOW (QUOTE PROMPTWINDOW)
					    (CONS PWINDOW %#LINES))
		     else (WINDOWADDPROP MAINWINDOW (QUOTE OtherPromptWindows)
					     (CONS PWINDOW %#LINES)))
		   (WINDOWPROP PWINDOW (QUOTE PromptWindowProcess)
				 (THIS.PROCESS))
		   (WINDOWPROP PWINDOW (QUOTE OPENFN)
				 (FUNCTION \PROMPTWINDOW.OPENFN]
	      [COND
		((ILESSP [SETQ OBSCUREDHEIGHT (IDIFFERENCE SCREENHEIGHT
								 (fetch (REGION TOP)
								    of (WINDOWPROP PWINDOW
										       (QUOTE
											 REGION]
			   0)                                (* Promptwindow off screen at top, so slip window 
							     group down to make it visible)
		  (RELMOVEW MAINWINDOW (create POSITION
						   XCOORD ← 0
						   YCOORD ← OBSCUREDHEIGHT]
	      (WINDOWPROP PWINDOW (QUOTE MINSIZE)
			    (CONS 1 HEIGHT))
	      (WINDOWPROP PWINDOW (QUOTE MAXSIZE)
			    (CONS 64000 HEIGHT))
	      (WINDOWPROP MAINWINDOW (QUOTE PROMPTWINDOWMINWIDTH)
			    (OR MINWIDTH 1))
	      (OPENW PWINDOW)
	      (RETURN PWINDOW])

(NC.MaxPromptWindowWidth
  [LAMBDA (MainWindow)                                       (* rht: "23-Mar-87 11:26")

          (* * Returns the maximum interior width that a prompt window for MainWindow could have and still be on the screen 
	  and attached, no matter whether it's positioned left, right or center.)


    (DECLARE (GLOBALVARS WBorder))
    (LET ((WindowRegion (WINDOWPROP MainWindow (QUOTE REGION)))
	  Left RightSpace Right Width)
         (SETQ Width (fetch (REGION WIDTH) of WindowRegion))
         (DIFFERENCE (if [LESSP (SETQ Left (fetch (REGION LEFT) of WindowRegion))
				      (SETQ RightSpace (DIFFERENCE SCREENWIDTH
								       (SETQ Right
									 (PLUS Left Width]
			   then (MAX (DIFFERENCE SCREENWIDTH Left)
					 (PLUS (TIMES 2 Left)
						 Width))
			 else (MAX Right (PLUS (TIMES 2 RightSpace)
						     Width)))
		       (TIMES 2 WBorder])
)
(* * Menus of all sorts)


(RPAQQ NC.CachedMenus (NC.NoteCardTypeMenu NC.LinkIconMiddleButtonMenu NC.CardOpsMenu 
					     NC.NoteFileOpsMenu NC.OtherOpsMenu))
(DEFINEQ

(NC.AskLinkLabel
  [LAMBDA (MainWindow MultipleFlg SystemLinksFlg NewLinkFlg CancelOkayFlg ReverseLinksFlg 
		      OldLinkLabels ReturnListOfListFlg)     (* pmi: " 1-Apr-87 12:12")
                                                             (* Asks for label on notecard links)

          (* * rht 8/2/84: Added double columns for when called by the browser, i.e. ReverseLinksFlg=T.
	  Reverse links have prefix "←".)



          (* * rht 11/19/84: Changed strings from "pointer" to "link" and from "label" to "type".)



          (* * rht 2/14/85: Added extra arg OldLinkLabels in the Multiple selection case to display previous choices.)



          (* * rht 10/11/85: Took out printing to prompt window. It's a waste of screen space.)



          (* * rht 10/22/85: Added ReturnListOfListFlg so caller can tell difference between aborting from Stylesheet and 
	  choosing NULL set of links.)



          (* * fgh 11/14/85 Updated to handle NoteFile and card objects.)



          (* * pmi 12/5/86: Modified so that clicking outside of Link type menu is equivalent to choosing **CANCEL** from 
	  menu.)



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


    (DECLARE (GLOBALVARS NC.MenuFont NC.UCASESystemLinkLabels NC.UnspecifiedLinkLabel))
    (PROG (Menu Choice Choices LabelsList LinkLabels Position Card NoteFile)
	    (SETQ Card (NC.CoerceToCard MainWindow))
	    (SETQ NoteFile (fetch (Card NoteFile) of Card))
	    (SETQ LinkLabels (NC.RetrieveLinkLabels NoteFile SystemLinksFlg))
	    [SETQ Position (AND (WINDOWP MainWindow)
				    (create POSITION
					      XCOORD ← (fetch (REGION LEFT)
							  of (WINDOWPROP MainWindow (QUOTE
									       REGION)))
					      YCOORD ← (fetch (REGION TOP) of (WINDOWREGION
										    MainWindow]
	    [COND
	      (MultipleFlg [SETQ Choices
			     (STYLESHEET (CREATE.STYLE
					     (QUOTE ITEMS)
					     [COND
					       [ReverseLinksFlg
						 (LIST (create MENU
								   ITEMS ← LinkLabels)
							 (create MENU
								   ITEMS ←
								   (for Link in LinkLabels
								      collect (PACK*
										  (QUOTE ←)
										  Link]
					       (T (LIST (create MENU
								    ITEMS ← LinkLabels]
					     (QUOTE NEED.NOT.FILL.IN)
					     (QUOTE MULTI)
					     (QUOTE POSITION)
					     Position
					     (QUOTE TITLE)
					     "Link Types?"
					     (QUOTE SELECTIONS)
					     (LIST (for Label in OldLinkLabels
							when (NEQ (NTHCHAR Label 1)
								      (QUOTE ←))
							collect Label)
						     (for Label in OldLinkLabels
							when (EQ (NTHCHAR Label 1)
								     (QUOTE ←))
							collect Label]
			   (RETURN (COND
				       ((NULL Choices)     (* User aborted from stylesheet.)
					 NIL)
				       [(AND ReverseLinksFlg ReturnListOfListFlg)
					 (LIST (NCONC (CAR Choices)
							  (CADR Choices]
				       (ReverseLinksFlg (NCONC (CAR Choices)
								 (CADR Choices)))
				       (ReturnListOfListFlg Choices)
				       (T (CAR Choices]
	    (SETQ Menu (create MENU
				   TITLE ← " Link Type "
				   ITEMS ← [NCONC (COND
						      [ReverseLinksFlg (for Link in LinkLabels
									  join (LIST
										   Link
										   (CONCAT "←" Link]
						      (T (COPY LinkLabels)))
						    (AND NewLinkFlg (LIST (QUOTE 
									      --New% Link% Type--)))
						    (AND CancelOkayFlg (LIST (QUOTE **CANCEL**]
				   CENTERFLG ← T
				   MENUPOSITION ← Position
				   MENUCOLUMNS ← (AND ReverseLinksFlg 2)
				   MENUFONT ← NC.MenuFont
				   ITEMHEIGHT ← (IPLUS (FONTPROP NC.MenuFont (QUOTE HEIGHT))
							 1)))

          (* * Allow user to cancel by selecting outside of Links menu)


	    (SETQ Choice (OR (MKATOM (MENU Menu))
				 (QUOTE **CANCEL**)))
	    [COND
	      ((EQ Choice (QUOTE **CANCEL**))
		(SETQ Choice))
	      ((EQ Choice (QUOTE --New% Link% Type--))
		(NC.ClearMsg MainWindow NIL)
		(until (COND
			   ((NOT (FMEMB [U-CASE (SETQ Choice
							(MKATOM (NC.AskUser 
									  "Enter new link type: "
										NIL NIL NIL 
										MainWindow NIL]
					    NC.UCASESystemLinkLabels))
			     T)
			   (T (NC.PrintMsg MainWindow T Choice " is a system reserved link type."
					     (CHARACTER 13)
					     "Please choose another link type."
					     (CHARACTER 13))
			      NIL)))
		(OR Choice (SETQ Choice NC.UnspecifiedLinkLabel))
		(AND (NOT (FMEMB Choice LinkLabels))
		       (NC.StoreLinkLabels NoteFile (CONS Choice LinkLabels]
	    (RETURN Choice])

(NC.AskNoteCardType
  [LAMBDA (ManinMenuOrRegion)                                (* pmi: "20-Mar-87 11:41")
                                                             (* Ask user to choose a note card type)

          (* * rht 1/12/85: Now takes an optional Region argument dictating where to place the NoteCardTypeMenu.
	  If NIL, then uses MainMenu.)



          (* * fgh 11/16/85 Updated to take a MainMenu arg in place of using the NC.MainMenu globalvar.)



          (* * pmi 3/20/87: Changed fields of NC.NoteCardTypeMenu: CENTERFLG to T, MENUFONT to NC.MenuFont, changed title 
	  from "Type?" to "Card Types")


    (DECLARE (GLOBALVARS NC.NoteCardTypeMenu))
    (PROG (W Z)
	    [OR (AND (BOUNDP (QUOTE NC.NoteCardTypeMenu))
			 (type? MENU NC.NoteCardTypeMenu))
		  (SETQ NC.NoteCardTypeMenu (create MENU
							ITEMS ← (NC.ListOfCardTypes T)
							CENTERFLG ← T
							TITLE ← "Card Types"
							MENUFONT ← NC.MenuFont
							ITEMHEIGHT ← (IPLUS (FONTPROP
										NC.MenuFont
										(QUOTE HEIGHT))
									      1]
	    [replace MENUPOSITION of NC.NoteCardTypeMenu
	       with (COND
			[(REGIONP ManinMenuOrRegion)
			  (CONS (fetch (REGION LEFT) of ManinMenuOrRegion)
				  (IPLUS (fetch (REGION BOTTOM) of ManinMenuOrRegion)
					   (fetch (REGION HEIGHT) of ManinMenuOrRegion)
					   (IMINUS (fetch (MENU IMAGEHEIGHT) of 
									      NC.NoteCardTypeMenu]
			(T (CONS [IPLUS [fetch (REGION LEFT) of (SETQ Z
									  (WINDOWPROP (WFROMMENU
											  
										ManinMenuOrRegion)
											(QUOTE
											  REGION]
					    (fetch (REGION LEFT)
					       of (SETQ W
						      (MENUITEMREGION
							(CAR (NTH (fetch (MENU ITEMS)
									 of ManinMenuOrRegion)
								      1))
							ManinMenuOrRegion]
				   (IPLUS (fetch (REGION BOTTOM) of Z)
					    (fetch (REGION TOP) of W)
					    (IMINUS (fetch (MENU IMAGEHEIGHT) of 
									      NC.NoteCardTypeMenu]
	    (RETURN (MENU NC.NoteCardTypeMenu])

(NC.ChooseTopLevelCard
  [LAMBDA (NoteFile)                                         (* pmi: "25-Mar-87 12:01")

          (* Let the user choose one of the top level cards. Top level cards are specified by globalvar NC.TopLevelCards 
	  which is a list of IDs)



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



          (* * kirk 6May86 Deleted SETQ of undeclared Menu var in the last expression)



          (* * rht 11/20/86: Now looks on "SpecialCards" prop of notefile for other cards to make available from ShowCards 
	  menu.)



          (* * pmi 3/20/87: Changed fields of NC.NoteCardTypeMenu: added 1 to ITEMHEIGHT, added title of "Special Cards")



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


    (DECLARE (GLOBALVARS NC.MenuFont))
    (LET ((NoteFileMenu (fetch (NoteFile Menu) of NoteFile))
	  Menu W Z)
         [SETQ Menu (create MENU
				ITEMS ← (for Card in (APPEND (NC.FetchTopLevelCards NoteFile)
								   (NC.NoteFileProp NoteFile
										      (QUOTE 
										     SpecialCards)))
					   when (NC.ValidCardP Card) collect
									  (LIST (NC.RetrieveTitle
										    Card)
										  Card))
				CENTERFLG ← T
				TITLE ← " Special Cards "
				MENUFONT ← NC.MenuFont
				ITEMHEIGHT ← (IPLUS (FONTPROP NC.MenuFont (QUOTE HEIGHT))
						      1)
				WHENSELECTEDFN ← (FUNCTION (LAMBDA (Item Button Menu)
				    (NC.EditNoteCard (CADR Item]
         (SETQ W (MENUITEMREGION (CAR (NTH (fetch (MENU ITEMS) of NoteFileMenu)
						   2))
				     NoteFileMenu))
         (SETQ Z (WINDOWPROP (WFROMMENU NoteFileMenu)
				 (QUOTE REGION)))
         [replace (MENU MENUPOSITION) of Menu with (create
							     POSITION
							     XCOORD ← (IPLUS (fetch (REGION
											  LEFT)
										  of W)
									       (fetch (REGION
											  LEFT)
										  of Z))
							     YCOORD ←
							     (IPLUS (fetch (REGION TOP)
									 of W)
								      (fetch (REGION BOTTOM)
									 of Z)
								      (IMINUS (fetch
										  (MENU IMAGEHEIGHT)
										   of Menu]
         (MENU Menu])

(NC.RemoveSketchMenuItems
  (LAMBDA (SketchMenu)                                       (* rht: "15-Nov-85 16:05")

          (* * Remove unwanted items from Sketch Card SKetch Menu. Called from ADVISE on CREATE.SKETCHW.COMMANDMENU.
	  NOTE: SKETCHW refers to SK.INSURE.MENU)


    (PROG ((ItemsToBeRemoved (QUOTE (LINK New% View locator inspect))))
	    (AND (NULL NC.AnnoFlg)
		   (SETQ ItemsToBeRemoved (CONS (QUOTE Annotate)
						    ItemsToBeRemoved)))
	    (AND (NC.CoerceToCard SKETCHW)
		   (RETURN (replace (MENU ITEMS) of SketchMenu
				with (for Item in (fetch (MENU ITEMS) of SketchMenu)
					  when (NOT (FMEMB (CAR Item)
								 ItemsToBeRemoved))
					  collect Item)))))))

(NC.SelectionMenusWhenSelectedFn
  [LAMBDA (Item Menu Button)                                 (* Randy.Gobbel " 1-Apr-87 17:40")

          (* * rht 2/15/85: Added handler for Undo.)



          (* * fgh 12/20/85 Updated for use with 1.3 selection mechanism.)



          (* * rht & pmi 12/12/86: Now finds promptwindow using the MAINWINDOW windowprop rather than the MAINWINDOW 
	  function.)



          (* * rht 3/23/87: Now looks for PromptWindow on SelectionPromptWindow instead of looking for main window.)



          (* * rg 4/1/87 changed CANCELLED to DON'T)


    (LET [(PromptWindow (WINDOWPROP (WFROMMENU Menu)
				      (QUOTE SelectionPromptWindow]
         (SELECTQ (CAR Item)
		    [(Done)
		      (WINDOWPROP PromptWindow (QUOTE SelectedCards)
				    (CONS (QUOTE DONE)
					    (WINDOWPROP PromptWindow (QUOTE SelectedCards]
		    ((Abort Cancel)
		      (WINDOWPROP PromptWindow (QUOTE SelectedCards)
				    (QUOTE DON'T)))
		    [New% Card (WINDOWPROP PromptWindow (QUOTE SelectedCards)
					     (CONS (QUOTE *New% Card*)
						     (WINDOWPROP PromptWindow (QUOTE 
										    SelectedCards]
		    [NoSource (WINDOWPROP PromptWindow (QUOTE SelectedCards)
					    (LIST (QUOTE NC00000]
		    [Undo (WINDOWPROP PromptWindow (QUOTE SelectedCards)
					(CONS (QUOTE *Undo% Selection*)
						(WINDOWPROP PromptWindow (QUOTE SelectedCards]
		    NIL)
         (NOTIFY.EVENT (WINDOWPROP PromptWindow (QUOTE CopyInsertEvent])

(NC.InstallTitleBarButtonEventFn
  (LAMBDA (Window TitleBarButtonEventFn)                     (* rht: " 6-May-86 12:05")

          (* * Save the old BUTTONEVENTFN and replace with ours.)


    (OR (EQ (WINDOWPROP Window (QUOTE BUTTONEVENTFN))
		TitleBarButtonEventFn)
	  (WINDOWPROP Window (QUOTE OLDBUTTONEVENTFN)
			(WINDOWPROP Window (QUOTE BUTTONEVENTFN)
				      TitleBarButtonEventFn)))))

(NC.InstallTitleBarLeftMenu
  [LAMBDA (Window CardType)                                  (* pmi: "25-Mar-87 12:04")

          (* * Make a menu from the CardType's LeftButtonMenuItems and install on windowprop.)



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


    (DECLARE (GLOBALVARS NC.MenuFont))
    (WINDOWPROP Window (QUOTE TitleBarLeftButtonMenu)
		  (create MENU
			    ITEMS ← (NC.GetCardTypeField LeftButtonMenuItems CardType)
			    CENTERFLG ← T
			    MENUFONT ← NC.MenuFont
			    ITEMHEIGHT ← (IPLUS (FONTPROP NC.MenuFont (QUOTE HEIGHT))
						  1])

(NC.InstallCopyButtonEventFn
  [LAMBDA (Window)                                           (* rht: "13-May-87 10:52")

          (* * Save the current COPYBUTTONEVENTFN and stash ours.)


    (OR (EQ (WINDOWPROP Window (QUOTE COPYBUTTONEVENTFN))
		(FUNCTION NC.CopyButtonEventFn))
	  (WINDOWPROP Window (QUOTE OldCopyButtonEventFn)
			(WINDOWPROP Window (QUOTE COPYBUTTONEVENTFN)
				      (FUNCTION NC.CopyButtonEventFn])

(NC.NoteFileTitleLeftWhenSelectedFn
  [LAMBDA (Item Menu Button)                                 (* pmi: "27-May-87 12:07")

          (* * WhenSelectedFn for the menus NC.OpenedNoteFileMenu and NC.ClosedNoteFileMenu. These operations used to be 
	  performed by NC.NoteFileOperations. Provides faster Left-button title bar menu on NoteFile icons.)



          (* * rht 2/11/87: Now handles possibly extra unanticipated menu items.)



          (* * rht 2/11/87: Removed useless call to DEFAULTWHENSELECTEDFN.)



          (* * rht 2/16/87: Added Close% cards% w/o% confirm case.)



          (* * pmi 5/14/87: Removed HashArray argument to NC.OpenNoteFile.)



          (* * pmi 5/27/87: Changed "Compact to Target File" to "Compact to New File.")


    (DECLARE (GLOBALVARS NC.NoteFileIconCloseOperations NC.NoteFileIconOpenOperations NC.MsgDelay)
	       )
    (LET ((NoteFile (GETMENUPROP Menu (QUOTE NoteFile)))
	  (Operation (CAR Item))
	  NoteFileMenuWindow)
         (SETQ NoteFileMenuWindow (WFROMMENU (fetch (NoteFile Menu) of NoteFile)))
         (WINDOWPROP NoteFileMenuWindow (QUOTE BusyOperation)
		       Operation)
         (COND
	   ((AND (NC.NoteFileOpenP NoteFile)
		   (NOT (FMEMB Operation NC.NoteFileIconOpenOperations)))
	     (NC.PrintMsg NoteFileMenuWindow T "Can't " Operation " an open notefile."
			    (CHARACTER 13))
	     (DISMISS NC.MsgDelay)
	     (NC.ClearMsg NoteFileMenuWindow T))
	   ((AND (NOT (NC.NoteFileOpenP NoteFile))
		   (NOT (FMEMB (CAR Item)
				   NC.NoteFileIconCloseOperations)))
	     (NC.PrintMsg NoteFileMenuWindow T "Can't " Operation " a closed notefile."
			    (CHARACTER 13))
	     (DISMISS NC.MsgDelay)
	     (NC.ClearMsg NoteFileMenuWindow T))
	   (T (SELECTQ Operation
			 (Open (NC.OpenNoteFile NoteFile NIL NIL NIL NIL NIL NIL NIL 
						  NoteFileMenuWindow))
			 (Read-only% Open (NC.OpenNoteFile NoteFile NIL NIL NIL NIL NIL NIL NIL 
							     NoteFileMenuWindow NIL NIL NIL T))
			 (Checkpoint (NC.CheckpointNoteFile NoteFile NIL NIL NoteFileMenuWindow))
			 (Close (NC.CloseNoteFile NoteFile NoteFileMenuWindow))
			 (Close% w/o% confirm (NC.CloseNoteFile NoteFile NoteFileMenuWindow T))
			 (Abort (NC.AbortSession NoteFile NoteFileMenuWindow))
			 (Compact (NC.CompactNoteFile NoteFile NIL NIL NoteFileMenuWindow))
			 (Compact% To% New% File (NC.CompactNoteFile NoteFile NIL NIL 
								       NoteFileMenuWindow))
			 (Compact% In% Place (NC.CompactNoteFile NoteFile NIL T NoteFileMenuWindow))
			 (Inspect&Repair (NC.InspectAndRepairNoteFile NoteFile NIL 
									NoteFileMenuWindow))
			 (Read% Substances (NC.InspectAndRepairNoteFile NoteFile T 
									  NoteFileMenuWindow))
			 (Copy (NC.CopyNoteFile NoteFile NIL NoteFileMenuWindow))
			 (Rename (NC.RenameNoteFile NoteFile))
			 (Delete (NC.DeleteDatabaseFile NoteFile NoteFileMenuWindow))
			 (APPLY* (CADR Item)
				   NoteFile NoteFileMenuWindow])

(NC.MakeNoteFileIconOperationsMenus
  [LAMBDA NIL                                                (* rht: "11-Feb-87 14:28")

          (* * Rebuild the menus NC.OpenedNoteFileMenu and NC.ClosedNoteFileMenu smashing any current values.)


    (DECLARE (GLOBALVARS NC.OpenedNoteFileMenu NC.ClosedNoteFileMenu 
			     NC.NoteFileIconOperationsMenuItems NC.MenuFont 
			     NC.NoteFileIconOpenOperations NC.NoteFileIconCloseOperations))
                                                             (* First, make two identical menus.)
    (SETQ NC.OpenedNoteFileMenu (create MENU
					    ITEMS ← NC.NoteFileIconOperationsMenuItems
					    CHANGEOFFSETFLG ← (QUOTE Y)
					    MENUOFFSET ← (CONS -1 0)
					    CENTERFLG ← NIL
					    TITLE ← "NoteFile Ops"
					    MENUTITLEFONT ← NC.MenuFont
					    MENUFONT ← NC.MenuFont
					    ITEMHEIGHT ← (IPLUS (FONTPROP NC.MenuFont
									      (QUOTE HEIGHT))
								  1)
					    WHENSELECTEDFN ← (FUNCTION 
					      NC.NoteFileTitleLeftWhenSelectedFn)))
    (SETQ NC.ClosedNoteFileMenu (create MENU
					    ITEMS ← NC.NoteFileIconOperationsMenuItems
					    CHANGEOFFSETFLG ← (QUOTE Y)
					    MENUOFFSET ← (CONS -1 0)
					    CENTERFLG ← NIL
					    TITLE ← "NoteFile Ops"
					    MENUTITLEFONT ← NC.MenuFont
					    MENUFONT ← NC.MenuFont
					    ITEMHEIGHT ← (IPLUS (FONTPROP NC.MenuFont
									      (QUOTE HEIGHT))
								  1)
					    WHENSELECTEDFN ← (FUNCTION 
					      NC.NoteFileTitleLeftWhenSelectedFn)))
                                                             (* Now, shade the appropriate inaccessible items of 
							     each.)
    (for Item in (fetch (MENU ITEMS) of NC.OpenedNoteFileMenu)
       do (SHADEITEM Item NC.OpenedNoteFileMenu (if (MEMB (CAR Item)
								  NC.NoteFileIconOpenOperations)
							then WHITESHADE
						      else GRAYSHADE)))
    (for Item in (fetch (MENU ITEMS) of NC.ClosedNoteFileMenu)
       do (SHADEITEM Item NC.ClosedNoteFileMenu (if (MEMB (CAR Item)
								  NC.NoteFileIconCloseOperations)
							then WHITESHADE
						      else GRAYSHADE)))
    (replace (MENU IMAGE) of NC.OpenedNoteFileMenu with NIL)
    (replace (MENU IMAGE) of NC.ClosedNoteFileMenu with NIL])

(NC.ResetCachedMenus
  [LAMBDA NIL                                                (* pmi: " 1-Apr-87 15:01")

          (* * pmi 4/1/87: New function to reset all cached menus. Currently called when NC.MenuFont is changed.)


    (DECLARE (GLOBALVARS NC.CachedMenus))
    (for Menu in NC.CachedMenus do (SET Menu NIL))
    (NC.MakeMainMenu)
    (NC.MakeNoteFileIconOperationsMenus])

(NC.CreateMenuBitmaps
  [LAMBDA (NoteFileOrFileName)                               (* pmi: "26-May-87 17:09")

          (* * pmi 5/21/87: creates a menu item bitmap for this notefile.)


    (DECLARE (GLOBALVARS NC.FileNameFont NC.FullFileNameFont NC.MaxFileNameChars))
    (PROG (FullFileName FileNameString FullFileNameString NameWidth MaxNameWidth SpaceWidth oWidth 
			  FullNameWidth FullNameMargin FontDescent OpenMenuBitmap MenuBitmap 
			  DisplayStream OpenDisplayStream)
	    (SETQ FullFileName (if (type? NoteFile NoteFileOrFileName)
				     then (fetch (NoteFile FullFileName)
						     NoteFileOrFileName)
				   else (FULLNAME NoteFileOrFileName)))
	    (if (NULL FullFileName)
		then (RETURN))
	    (SETQ FileNameString (MKSTRING (PACKFILENAME (QUOTE HOST)
							       NIL
							       (QUOTE DIRECTORY)
							       NIL
							       (QUOTE EXTENSION)
							       NIL
							       (QUOTE BODY)
							       FullFileName)))
	    (SETQ FullFileNameString (MKSTRING (L-CASE FullFileName)))
	    (SETQ NameWidth (STRINGWIDTH FileNameString NC.FileNameFont))
	    (SETQ FullNameWidth (STRINGWIDTH FullFileNameString NC.FullFileNameFont))
	    (SETQ MaxNameWidth (STRINGWIDTH (ALLOCSTRING NC.MaxFileNameChars "X")
						NC.FileNameFont))
	    (SETQ SpaceWidth (STRINGWIDTH " " NC.FullFileNameFont))
	    (SETQ oWidth (STRINGWIDTH "o" NC.FullFileNameFont))
	    (if (GREATERP NameWidth MaxNameWidth)
		then (SETQ FullNameMargin (PLUS SpaceWidth oWidth SpaceWidth NameWidth 
						      SpaceWidth))
	      else (SETQ FullNameMargin (PLUS SpaceWidth oWidth SpaceWidth MaxNameWidth 
						    SpaceWidth)))
	    (SETQ FontDescent (FONTDESCENT NC.FileNameFont))

          (* * Create the bitmap for the open notefile.)


	    (SETQ OpenMenuBitmap (BITMAPCREATE (PLUS FullNameMargin FullNameWidth SpaceWidth)
						   (FONTHEIGHT NC.FileNameFont)))
	    (SETQ OpenDisplayStream (DSPCREATE OpenMenuBitmap))
	    (MOVETO SpaceWidth FontDescent OpenDisplayStream)
	    (DSPFONT NC.FullFileNameFont OpenDisplayStream)
	    (PRIN1 "o" OpenDisplayStream)
	    (RELMOVETO SpaceWidth 0 OpenDisplayStream)
	    (DSPFONT NC.FileNameFont OpenDisplayStream)
	    (PRIN1 FileNameString OpenDisplayStream)
	    (MOVETO FullNameMargin FontDescent OpenDisplayStream)
	    (DSPFONT NC.FullFileNameFont OpenDisplayStream)
	    (PRIN1 FullFileNameString OpenDisplayStream)
	    (PUTPROP FullFileName (QUOTE OpenMenuBitmap)
		       OpenMenuBitmap)

          (* * Create bitmap for the closed notefile.)


	    (SETQ MenuBitmap (BITMAPCREATE (PLUS FullNameMargin FullNameWidth SpaceWidth)
					       (FONTHEIGHT NC.FileNameFont)))
	    (SETQ DisplayStream (DSPCREATE MenuBitmap))
	    (MOVETO (PLUS SpaceWidth oWidth SpaceWidth)
		      FontDescent DisplayStream)
	    (DSPFONT NC.FileNameFont DisplayStream)
	    (PRIN1 FileNameString DisplayStream)
	    (MOVETO FullNameMargin FontDescent DisplayStream)
	    (DSPFONT NC.FullFileNameFont DisplayStream)
	    (PRIN1 FullFileNameString DisplayStream)
	    (PUTPROP FullFileName (QUOTE MenuBitmap)
		       MenuBitmap)
	    (RETURN FullFileName])

(NC.GetNoteFileMenu
  [LAMBDA (NoteFileOrFileName)                               (* pmi: " 2-Jun-87 12:47")

          (* * pmi 6/2/87: Created to get the NoteFile icon menu for a NoteFile.)


    (LET (FullFileName NoteFile)
         (if (type? NoteFile NoteFileOrFileName)
	     then (OR (fetch (NoteFile Menu) of NoteFileOrFileName)
			  (GETPROP (fetch (NoteFile FullFileName)
					      NoteFileOrFileName)
				     (QUOTE Menu)))
	   elseif (SETQ FullFileName (FULLNAME NoteFileOrFileName))
	     then (OR (GETPROP FullFileName (QUOTE Menu))
			  (if (type? NoteFile (SETQ NoteFile (NC.NoteFileFromFileName 
										     FullFileName)))
			      then (fetch (NoteFile Menu) of NoteFile])

(NC.SetNoteFileMenu
  [LAMBDA (NoteFileOrFileName Menu)                          (* pmi: " 2-Jun-87 12:47")

          (* * pmi 6/2/87: Created to set the NoteFile icon menu for a NoteFile.)


    (LET (FullFileName NoteFile)
         (if NoteFileOrFileName
	     then (if (type? NoteFile NoteFileOrFileName)
			then (replace (NoteFile Menu) of NoteFileOrFileName with Menu)
			       (PUTPROP (fetch (NoteFile FullFileName)
						   NoteFileOrFileName)
					  (QUOTE Menu)
					  Menu)
		      elseif (SETQ FullFileName (FULLNAME NoteFileOrFileName))
			then (PUTPROP FullFileName (QUOTE Menu))
			       (if (type? NoteFile (SETQ NoteFile (NC.NoteFileFromFileName
						  FullFileName)))
				   then (replace (NoteFile Menu) of NoteFile with Menu])
)
(* * Selection Mechanism)


(RPAQQ NC.SelectionInProgress NIL)
(DEFINEQ

(NC.SelectNoteCards
  [LAMBDA (SingleCardFlg SelectionPredicate Menu InstigatingCardOrWindow Msg CheckForCancelFlg 
			 FileLevelLockFlg)                   (* Randy.Gobbel " 8-Jun-87 12:04")

          (* Select a set of note cards or a single note card, depending on SingleCardFlg. Works by interpreting all mouse 
	  presses until a card has been chosen (if SingleCardFlg is T) or until the Done button has been pressed 
	  (if SingleCardFlg is NIL). If the mouse press occus within a Title bar of a notecard, add that note card to the 
	  selected list. Otherwise, if you are pointing into a note card, call the BUTTONEVENTFN for that note card.
	  The Selection in Progress flag has been set, so all note card BUTTONEVENTFNs should know to ignore all presses 
	  except those that occur on link icons. Link icon presses should simply add the desination of that link to the 
	  selected note cards list. This function should always be called from inside of an NC.CardSelectionOperation 
	  wrapper.)



          (* * rht 8/1/84: Changed second RESETSAVE call to give NC.ClearMsg a NIL argument.)



          (* * rht 1/9/85: Fixed so now prints name of selected item even it's a link.)



          (* * rht 2/15/85: Now can backspace over last selection chosen. Added new arg Msg so that when we reprint the list,
	  we can reprint the message as well.)



          (* * rht 3/23/85: Added the CheckForCancelFlg arg, which if non-nil causes Cancel to be handled differently then 
	  Done after no selections. Namely, Cancel will return the atom CANCELLED whereas Done with no selections returns 
	  NIL. If CheckForCancelFlg is NIL then NIL is returned in both cases.)



          (* * fgh 11/14/85 Updated to handle Card and NoteFile objects.)



          (* * rht 11/18/85: Fixed so able to select when InstigatingNoteFile is NIL.)



          (* * fgh 12/20/85 Totally rewritten for 1.3 selection mechanism. Based on COPYINSERT now rather than on takingf 
	  over the mouse process.)



          (* * fgh 1/15/86 Added call to SPAWN.MOUSE in case this is called under the mouse process)



          (* * kirk 25Apr86 Changed to use SessionIcon (NC.NoteCardsIconWindow) rather than PROMPTWINDOW if no Instigating 
	  window is supplied.)



          (* * fgh 7/5/86 Added code to put CRs into printout of selected cards in order to keep prompt window from getting 
	  infinitely wide to accomdate the printout.)



          (* * rht 10/5/86: Now allows choice of cards from remote notefile.)



          (* * rht 10/18/86: Give TTY process to process that originally had it if possible.)



          (* * rht & pmi 11/14/86: Now checks for valid card before testing SelectionPredicate.)



          (* * pmi 12/5/86 Modified prompt messages to mention SHIFT-selection.)



          (* * pmi 12/12/86: Removed obsolete ReturnLinksFlg argument.)



          (* * rg 3/18/87 reworked for NC.CardSelectionOperation: added NAMED-RESETSAVE forms for Card locking.)



          (* * 3/23/87: Changed to call REMOVEWINDOW instead of DETACHWINDOW before deleting the attached menu.
	  Also changed so that menu is attached to InstigatingWindow rather than to PromptWindow. This makes it possible for 
	  windows to "slide down" when selection ends.)



          (* * rht 3/24/87: Now calls NC.CoerceToInterestedWindow)



          (* * RG 4/1/87 changed CANCELLED to DON'T)



          (* * rg 4/22/87 changed some names,)



          (* * rht&rg&pmi 4/22/87: Moved location of ALLOW.BUTTON.EVENTS.)



          (* * rg 6/2/87 added FileLevelLockFlg)


    (DECLARE (USEDFREE CardListResetVar))

          (* * if we are running under the mouse process, start up a new mouse process)


    (ALLOW.BUTTON.EVENTS)
    (LET (Window Card ButtonEventFn InstigatingWindow InstigatingCard InstigatingNoteFile MenuWindow 
		 PromptWindow CopyInsertEvent CardProcessedEvent SelectedCards BinLoopProcess 
		 OldTTYProcess OpInProgress ResetItems TTYResetVar InternalResetVar)
         (NAMED-RESETLST
	   InternalResetVar
	   (OR SelectionPredicate (SETQ SelectionPredicate (FUNCTION TRUE)))
	   (SETQ PromptWindow (OR (NC.AttachPromptWindow (SETQ InstigatingWindow
								 (NC.CoerceToInterestedWindow
								   InstigatingCardOrWindow)))
				      PROMPTWINDOW))
	   (SETQ InstigatingCard (NC.CoerceToCard InstigatingCardOrWindow))
	   (SETQ InstigatingNoteFile (AND InstigatingCard (fetch (Card NoteFile) of 
										  InstigatingCard)))
	   (NC.PrintMsg InstigatingWindow T (COND
			    (Msg (CONCAT Msg (CHARACTER 13)))
			    (T ""))
			  "Items shift-selected:  ")
	   (SETQ OldTTYProcess (TTY.PROCESS))

          (* * Set up the prompt window for proper use by the CopyInsertFn)


	   (NAMED-RESETSAVE InternalResetVar (WINDOWPROP PromptWindow (QUOTE SelectCardsMonitor)
							     (CREATE.MONITORLOCK (QUOTE 
										      SelectCards)))
			      (BQUOTE (WINDOWPROP , PromptWindow SelectCardsMonitor NIL)))
	   [WINDOWPROP PromptWindow (QUOTE CopyInsertEvent)
			 (SETQ CopyInsertEvent (CREATE.EVENT (QUOTE CopyInsertEvent]
	   (WINDOWPROP PromptWindow (QUOTE NewCardsProcessed)
			 T)
	   [WINDOWPROP PromptWindow (QUOTE CardProcessedEvent)
			 (SETQ CardProcessedEvent (CREATE.EVENT (QUOTE CardProcessedEvent]
	   (WINDOWPROP PromptWindow (QUOTE SelectNoteCardsProcess)
			 (THIS.PROCESS))
	   (WINDOWPROP PromptWindow (QUOTE COPYINSERTFN)
			 (FUNCTION NC.SelectNoteCardsCopyInsertFn))
	   (NAMED-RESETSAVE InternalResetVar (WINDOWPROP PromptWindow (QUOTE SelectedCards)
							     NIL)
			      (BQUOTE (WINDOWPROP , PromptWindow (QUOTE SelectedCards)
						      NIL)))
	   (NAMED-RESETSAVE InternalResetVar (WINDOWPROP PromptWindow (QUOTE SelectingCards)
							     T)
			      (BQUOTE (WINDOWPROP , PromptWindow SelectingCards NIL)))

          (* * Make the process behind the prompt window includiong control for a blibnking cursor)


	   [WINDOWPROP PromptWindow (QUOTE PROCESS)
			 (SETQ BinLoopProcess (ADD.PROCESS
			     (QUOTE (PROG NIL (BLOCK)
					      (TTYDISPLAYSTREAM (PROCESSPROP (THIS.PROCESS)
										 (QUOTE WINDOW)))
					      XXXX
					      (BIN)
					      (BLOCK)
					      (GO XXXX)))
			     (QUOTE WINDOW)
			     PromptWindow
			     (QUOTE NAME)
			     (QUOTE BinLoopProcess)
			     (QUOTE TTYENTRYFN)
			     (FUNCTION [LAMBDA (Process)
				 (PROCESSPROP Process (QUOTE OldCaret)
						(CARET CROSSHAIRS))
				 (ECHOMODE])
			     (QUOTE TTYEXITFN)
			     (FUNCTION (LAMBDA (Process)
				 (CARET (PROCESSPROP Process (QUOTE OldCaret)))
				 (ECHOMODE T]
	   (NAMED-RESETSAVE InternalResetVar NIL (BQUOTE (DEL.PROCESS , BinLoopProcess)))

          (* * Insure the prompt window is cleared on the way out)


	   [NAMED-RESETSAVE InternalResetVar NIL
			      (BQUOTE (PROGN (AND (HASTTYWINDOWP , BinLoopProcess)
							(TTY.PROCESS (if (AND (PROCESSP
										      , OldTTYProcess)
										    (HASTTYWINDOWP
										      , OldTTYProcess)
										    )
									   then , OldTTYProcess
									 else T)))
						 (NC.ClearMsg , InstigatingWindow T]

          (* * Set up the menu above the prompt window)

                                                             (* fix in case MENUPOSITION is set incorrectly in menu
							     passed down)
	   (replace (MENU MENUPOSITION) of Menu
	      with (CONSTANT (create POSITION
					   XCOORD ← 0
					   YCOORD ← 0)))
	   [NAMED-RESETSAVE InternalResetVar (PROGN (ATTACHMENU
							  Menu
							  (OR InstigatingWindow PROMPTWINDOW)
							  (if InstigatingWindow
							      then (QUOTE TOP)
							    else (QUOTE BOTTOM))
							  (if (AND (WINDOWP InstigatingWindow)
								       (WINDOWP PromptWindow))
							      then (CDR (WINDOWPROP
									      PromptWindow
									      (QUOTE WHEREATTACHED))
									    )
							    else (QUOTE LEFT)))
							(WINDOWPROP (WFROMMENU Menu)
								      (QUOTE SelectionPromptWindow)
								      PromptWindow))
			      (BQUOTE (PROGN (REMOVEWINDOW (WFROMMENU , Menu]

          (* * If there is an instigating window, make sure it and all its attachments are visible on the screen.)


	   (if InstigatingWindow
	       then (NC.MoveWindowOntoScreen InstigatingWindow))

          (* * Give the prompt window the tty process)


	   (TTY.PROCESS (WINDOWPROP PromptWindow (QUOTE PROCESS)))

          (* * Loop as long as necessary)


	   [WITH.MONITOR
	     (WINDOWPROP PromptWindow (QUOTE SelectCardsMonitor))
	     (until (OR (EQ SelectedCards (QUOTE DON'T))
			    (AND SingleCardFlg SelectedCards)
			    (EQ (CAR SelectedCards)
				  (QUOTE DONE)))
		do
		 (                                           (* Wait for the user to respond by copy inserting 
							     something into the prompt window)
		  (until [OR (NOT (PROCESSP BinLoopProcess))
				 (NOT (EQ SelectedCards (WINDOWPROP PromptWindow (QUOTE
									    SelectedCards]
		     do (MONITOR.AWAIT.EVENT (WINDOWPROP PromptWindow (QUOTE 
									       SelectCardsMonitor))
						 CopyInsertEvent 1000))
                                                             (* Get the latest selection list)
		  (SETQ SelectedCards (WINDOWPROP PromptWindow (QUOTE SelectedCards)))
		  (WINDOWPROP PromptWindow (QUOTE NewCardsProcessed)
				T)
		  (NOTIFY.EVENT CardProcessedEvent T)
		  (OR (PROCESSP BinLoopProcess)
			(SETQ SelectedCards (QUOTE DON'T)))
		  (NAMED-RESETLST
		    TTYResetVar                              (* Turn off the caret)
		    (NAMED-RESETSAVE TTYResetVar (TTY.PROCESS (THIS.PROCESS)))
                                                             (* If the last thing wasn't a done or cancel, process 
							     the new selection)
		    (SETQ Card (CAR SelectedCards))
		    (WITH.MONITOR
		      NC.LockLock
		      (COND
			((AND (NEQ Card (QUOTE DONE))
				(NEQ SelectedCards (QUOTE DON'T))
				(NEQ Card (QUOTE *New% Card*)))
                                                             (* Check to make sure that the selection is valid)
			  [COND
			    ((EQ Card (QUOTE *Undo% Selection*))
                                                             (* Chop off two elements from the list -
							     the indicator and the previous item.)
			      (SETQ Card (CADR SelectedCards))
			      (WINDOWPROP PromptWindow (QUOTE SelectedCards)
					    (SETQ SelectedCards (CDDR SelectedCards)))
                                                             (* now get our hands off of all the locks we've 
							     acquired for this card)
			      (if Card
				  then (NAMED-RESETUNSAVE CardListResetVar (NC.FetchUserDataProp
								Card
								(QUOTE ResetItems)))
					 (NC.SetUserDataProp Card (QUOTE ResetItems)
							       NIL))
			      (NC.ClearMsg InstigatingWindow NIL))
			    [(OR (NOT (NC.ValidCardP Card))
				   (NULL (APPLY* SelectionPredicate Card)))
                                                             (* Does this card match the slection predicate)
			      (NC.PrintMsg InstigatingWindow T "*** Invalid selection. ***"
					     (CHARACTER 13))
			      (WINDOWPROP PromptWindow (QUOTE SelectedCards)
					    (SETQ SelectedCards (CDR SelectedCards]
			    ((AND (SETQ OpInProgress (if FileLevelLockFlg
							     then (NC.NoteFileCheckOpInProgress
								      (fetch (Card NoteFile)
									 of Card))
							   else (NC.CardCheckOpInProgress Card)))
				    (NEQ OpInProgress (QUOTE US)))
			      (NC.PrintOperationInProgressMsg InstigatingWindow "Select Card" 
								OpInProgress)
			      (DISMISS 1000)
			      (WINDOWPROP PromptWindow (QUOTE SelectedCards)
					    (SETQ SelectedCards (CDR SelectedCards)))
			      (NC.ClearMsg InstigatingWindow NIL))
			    (T                               (* A valid selection.)
			       (NC.ClearMsg InstigatingWindow NIL)
			       [if FileLevelLockFlg
				   then [SETQ ResetItems
					    (LIST (NAMED-RESETSAVE
						      CardListResetVar
						      (NC.NoteFileProp (fetch (Card NoteFile)
									    of Card)
									 (QUOTE OperationInProgress)
									 "Select Card")
						      (BQUOTE (NC.NoteFileProp
								  ,
								  (fetch (Card NoteFile)
								     of Card)
								  OperationInProgress NIL)))
						    (NAMED-RESETSAVE
						      CardListResetVar
						      (NC.NoteFileProp (fetch (Card NoteFile)
									    of Card)
									 (QUOTE ProcessInProgress)
									 (THIS.PROCESS))
						      (BQUOTE (NC.NoteFileProp
								  ,
								  (fetch (Card NoteFile)
								     of Card)
								  ProcessInProgress NIL)))
						    (NAMED-RESETSAVE CardListResetVar
								       (SETQ NC.NoteFileBusyList
									 (CONS (THIS.PROCESS)
										 NC.NoteFileBusyList))
								       (QUOTE (SETQ
										  NC.NoteFileBusyList
										  (DREMOVE
										    (THIS.PROCESS)
										    
									      NC.NoteFileBusyList]
				 else (SETQ ResetItems
					  (LIST [NAMED-RESETSAVE CardListResetVar
								     (SETQ NC.CardBusyList
								       (CONS (THIS.PROCESS)
									       NC.CardBusyList))
								     (QUOTE (SETQ
										NC.CardBusyList
										(DREMOVE (
										     THIS.PROCESS)
											   
										  NC.CardBusyList]
						  [NAMED-RESETSAVE
						    CardListResetVar
						    [NC.NoteFileProp
						      (fetch (Card NoteFile) of Card)
						      (QUOTE CardProcessInProgressList)
						      (CONS (THIS.PROCESS)
							      (NC.NoteFileProp (fetch
										   (Card NoteFile)
										    of Card)
										 (QUOTE 
									CardProcessInProgressList]
						    (BQUOTE (NC.ResetCardProcessInProgress
								,
								(fetch (Card NoteFile)
								   of Card]
						  (NAMED-RESETSAVE CardListResetVar
								     (NC.SetUserDataProp
								       Card
								       (QUOTE OperationInProgress)
								       "Select Card")
								     (BQUOTE (NC.SetUserDataProp
										 , Card 
									      OperationInProgress NIL)
									       ))
						  (NAMED-RESETSAVE CardListResetVar
								     (NC.SetUserDataProp
								       Card
								       (QUOTE ProcessInProgress)
								       (THIS.PROCESS))
								     (BQUOTE (NC.SetUserDataProp
										 , Card 
										ProcessInProgress NIL]
			       (NAMED-RESETSAVE InternalResetVar (NC.SetUserDataProp
						    Card
						    (QUOTE ResetItems)
						    ResetItems)
						  (BQUOTE (NC.SetUserDataProp , Card ResetItems 
										  NIL]

          (* * Print the results in the prompt window)


			  (NC.PrintMsg InstigatingWindow NIL (COND
					   (Msg (CONCAT Msg (CHARACTER 13)))
					   (T ""))
					 "Items selected:  ")
			  (for ThisCard in (REVERSE SelectedCards)
			     do (NC.PrintMsg InstigatingWindow NIL (NC.RetrieveTitle ThisCard)
						 ",  ")
				  (if [AND InstigatingWindow (GREATERP
						 (DSPXPOSITION NIL PromptWindow)
						 (TIMES 1.25 (WINDOWPROP InstigatingWindow
									     (QUOTE WIDTH]
				      then (NC.PrintMsg InstigatingWindow NIL (CHARACTER 13]

          (* * Return the result)


	   (PROG1 [COND
		      ((EQ SelectedCards (QUOTE DON'T))
			(COND
			  (CheckForCancelFlg (QUOTE DON'T))
			  (T NIL)))
		      (SingleCardFlg (if (EQ (CAR SelectedCards)
						 (QUOTE DONE))
					 then NIL
				       else (CAR SelectedCards)))
		      (T (if (EQ (CAR SelectedCards)
				     (QUOTE DONE))
			     then (DREVERSE (CDR SelectedCards))
			   else (DREVERSE SelectedCards]
		    (WINDOWPROP PromptWindow (QUOTE SelectedCards)
				  NIL])

(NC.SelectNoteCardsCopyInsertFn
  [LAMBDA (ImageObj Window)                                  (* Randy.Gobbel " 8-Jun-87 12:04")

          (* * Copy insert fn for promptwindow during SelectNoteCards operation)



          (* * rg 6/8/87 added monitor for sync w/ SelectNoteCards)


    (LET [(CardProcessedEvent (WINDOWPROP Window (QUOTE CardProcessedEvent)))
	  (SelectCardsMonitor (WINDOWPROP Window (QUOTE SelectCardsMonitor]
         (WITH.MONITOR SelectCardsMonitor (until (OR [NOT (PROCESSP (WINDOWPROP
									      Window
									      (QUOTE 
									   SelectNoteCardsProcess]
							 (WINDOWPROP Window (QUOTE 
										NewCardsProcessed)))
					     do (MONITOR.AWAIT.EVENT SelectCardsMonitor 
									 CardProcessedEvent 1000))
		       (LET [[Card (COND
				     ((NC.LinkIconImageObjP ImageObj)
				       (fetch (Link DestinationCard) of (
									 NC.FetchLinkFromLinkIcon
									      ImageObj)))
				     ((NC.CardImageObjP ImageObj)
				       (IMAGEOBJPROP ImageObj (QUOTE OBJECTDATUM]
			     (SelectedCards (WINDOWPROP Window (QUOTE SelectedCards)))
			     (CopyInsertEvent (WINDOWPROP Window (QUOTE CopyInsertEvent]

          (* * Add the selected card to the selected cards list)


			    (if (AND Card (for SelectedCard in SelectedCards
						 never (NC.SameCardP Card SelectedCard)))
				then (WINDOWPROP Window (QUOTE SelectedCards)
						     (CONS Card SelectedCards))
				       (WINDOWPROP Window (QUOTE NewCardsProcessed)
						     NIL))

          (* * Wake up the main process)


			    (NOTIFY.EVENT CopyInsertEvent T])

(NC.CopyButtonEventFn
  (LAMBDA (Window)                                           (* kirk: "25-Apr-86 17:02")
    (PROGN                                                 (* kirk: "25-Apr-86 16:59")

          (* * Return NoteCardsObject if button is in title bar, else call the old copy button event fn or just the button 
	  event fn.)



          (* * fgh 1/30/86 Added check to make sure that the OldCopyButtonEventFn is not this function before it is APPLYed.
	  Otherwise you get an infinite recursion.)


	     (LET (CopyButtonEventFn TTYWindow)
	          (if (NOT (INSIDEP (DSPCLIPPINGREGION NIL (WINDOWPROP Window (QUOTE
										   DSP)))
					  (LASTMOUSEX Window)
					  (LASTMOUSEY Window)))
		      then (until (OR (MOUSESTATE UP)
					    (NEQ Window (WHICHW))
					    (INSIDEP (DSPCLIPPINGREGION NIL (WINDOWPROP
									      Window
									      (QUOTE DSP)))
						       (LASTMOUSEX Window)
						       (LASTMOUSEY Window)))
				do (BLOCK))
			     (if (MOUSESTATE UP)
				 then (if (AND (WINDOWP (SETQ TTYWindow
								  (PROCESSPROP (TTY.PROCESS)
										 (QUOTE WINDOW))))
						     (WINDOWPROP TTYWindow (QUOTE SelectingCards))
						     )
					    then (COPYINSERT (NC.MakeCardImageObject
								   (WINDOWPROP Window (QUOTE
										   NoteCardObject)))))
				   )
		    elseif (AND (SETQ CopyButtonEventFn (WINDOWPROP Window (QUOTE 
									     OldCopyButtonEventFn)))
				    (NEQ CopyButtonEventFn (QUOTE NC.CopyButtonEventFn)))
		      then (APPLY* CopyButtonEventFn Window)
		    elseif (SETQ CopyButtonEventFn (WINDOWPROP Window (QUOTE BUTTONEVENTFN)))
		      then (APPLY* CopyButtonEventFn Window))))))

(NC.CardImageObjP
  (LAMBDA (ImageObj)                                         (* fgh: "19-Dec-85 23:34")
    (type? Card (IMAGEOBJPROP ImageObj (QUOTE OBJECTDATUM)))))

(NC.MakeCardImageObject
  [LAMBDA (CardObject)                                       (* Randy.Gobbel " 5-Nov-86 15:49")
    (DECLARE (GLOBALVARS NC.CardImageObjFns))
    (IMAGEOBJCREATE CardObject NC.CardImageObjFns])
)
(DECLARE: DOEVAL@COMPILE DONTCOPY

(GLOBALVARS NC.CardImageObjFns)
)

(RPAQ NC.CardImageObjFns (IMAGEFNSCREATE))
(* * Fix up Lisp)


(PUTPROPS LOGOUT READVICE (NIL (BEFORE NIL (NC.LogoutAdvice))))
(READVISE LOGOUT)
(* * Stuff for creating and operating the NoteCards session icon.)

(DECLARE: DOEVAL@COMPILE DONTCOPY

(GLOBALVARS NC.CardOpsMenu NC.CardOpsItems NC.NoteFileOpsMenu NC.NoteFileOpsItems NC.OtherOpsMenu 
	    NC.OtherOpsItems NC.NoteCardsIconBitmap)
)

(RPAQQ NC.NoteCardsIconWindow {WINDOW}#364,12000)

(RPAQQ NCCURSOR ({BITMAP}#371,33060 4 . 3))

(RPAQ NC.NoteCardsIconBitmap (READBITMAP))
(108 86
"@COOOOOOOOOOOOOOOOOOOOOO@@@@"
"@COOOOOOOOOOOOOOOOOOOOOO@@@@"
"@GHHHHHHHHHHHHHHHHHHHHHGH@@@"
"@FBBBBBBBBBBFBBBBBBBBBBMH@@@"
"@NH@@@@@@@@@N@@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"OOOOOOOOOOOOOOOOOOOON@@@"
"OOOOOOOOOOOOOOOOOOOOL@@@"
"OOOOOOOOOOOOOOOOOOOOH@@@"
"OOOOOOOOOOOOOOOOOOOO@@@@"
"OOOOOOOOOOOOOOOOOOON@@@@"
"OOOOOOOOOOOOOOOOOOOL@@@@"
"OOOOOOOOOOOOOOOOOOOH@@@@"
"OOOOOOOOOOOOOOOOOOO@@@@@"
"OOOOOOOOOOOOOOOOOON@@@@@"
"OOOOOOOOOOOOOOOOOOL@@@@@"
"OOOOOOOOOOOOOOOOOOH@@@@@"
"OOOOOOOOOOOOOOOOOO@@@@@@"
"OOOOOOOOOOOOOOOOON@@@@@@"
"OOOOOOOOOOOOOOOOOL@@@@@@")
(DEFINEQ

(NC.NoteCardsWindowP
  (LAMBDA (Window)                                           (* fgh: "25-Jun-86 19:47")

          (* * Is this some sort of NoteCards window?)


    (OR (NC.CoerceToCard Window)
	  (NC.NoteFileMenuWindowP Window)
	  (NC.NoteCardsIconWindowP Window))))

(NC.NoteCardsIconWindowP
  (LAMBDA (Window)                                           (* fgh: "25-Jun-86 19:43")

          (* * Is this the NC session icon window?)



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


    (EQ Window NC.NoteCardsIconWindow)))

(NC.MakeNoteCardsIcon
  [LAMBDA (Position Style)                                   (* pmi: "18-Mar-87 17:15")

          (* * This creates and returns a window containing the NoteCards icon bitmap.)



          (* * pmi 3/11/87: Revamped for another new session icon.)


    (SELECTQ Style
	       (OldStyle (NC.MakeOldStyleNoteCardsIcon Position))
	       (NewStyle (NC.MakeNewStyleNoteCardsIcon Position))
	       (NC.MakeNewStyleNoteCardsIcon Position])

(NC.BringUpNoteCardsIcon
  [LAMBDA (Position Style)                                   (* pmi: "18-Mar-87 17:18")

          (* * Either flash existing NoteCards icon or make a new one.)



          (* * fgh 6/7/86 Added Position arg to pass to NC.MakeWindow)



          (* * kirk 1Jul86 Changed FLASHW to FLASHWINDOW)



          (* * pmi 3/18/87: Added Style argument to be passed to NC.MakeNoteCardsIcon for selection of session icon style)


    (DECLARE (GLOBALVARS NC.NoteCardsIconWindow))
    (if (WINDOWP NC.NoteCardsIconWindow)
	then (if Position
		   then (MOVEW NC.NoteCardsIconWindow Position))
	       (FLASHWINDOW NC.NoteCardsIconWindow)
      else (SETQ NC.NoteCardsIconWindow (NC.MakeNoteCardsIcon Position Style])

(NC.NoteCardsIconAfterMoveFn
  [LAMBDA (Window)                                           (* pmi: "26-Mar-87 17:14")

          (* * Updates NC.NoteCardsIconPosition when the session icon is moved.)


    (DECLARE (GLOBALVARS NC.NoteCardsIconPosition))
    (SETQ NC.NoteCardsIconPosition (CREATEPOSITION (fetch (REGION LEFT)
							  of (WINDOWPROP Window (QUOTE REGION)))
						       (fetch (REGION BOTTOM)
							  of (WINDOWPROP Window (QUOTE REGION])

(NC.FileBrowserMenu
  [LAMBDA (Window)                                           (* pmi: "25-Mar-87 15:07")

          (* * Bring up a notecards file browser after user selects pattern.)



          (* * rht 7/2/86: Now calls NC.GetFileBrowserPattern. Also only stores file browser wins on the session icon 
	  windowprop rather than both wins and patterns.)



          (* * kef 8/8/86: Added kludge for constructing file browsers on remote Server.)



          (* * pmi 3/25/87: Added NC.MenuFont and cleaned up menu for consistency.)


    (DECLARE (GLOBALVARS NC.MenuFont NC.FileBrowserPatterns NC.FileBrowserDefaultPatterns 
			     NC.FileBrowserMenuItems))
    (LET (Menu Selection)
         (SETQ Menu (create MENU
				ITEMS ← [APPEND (UNION NC.FileBrowserPatterns 
							   NC.FileBrowserDefaultPatterns)
						  (QUOTE ((---% New% Pattern% --- (QUOTE 
										     New% Pattern)
										    
							   "Make a new Notefile browser pattern."]
				TITLE ← " Notefile Browser Pattern "
				MENUFONT ← NC.MenuFont
				CENTERFLG ← T
				ITEMHEIGHT ← (IPLUS (FONTPROP NC.MenuFont (QUOTE HEIGHT))
						      1)))
         (if (EQ (SETQ Selection (MENU Menu))
		     (QUOTE New% Pattern))
	     then                                          (* User wants to give us a new pattern.)
		    (SETQ Selection (NC.GetFileBrowserPattern Window NIL)))
         (if Selection
	     then                                          (* See if browser for that pattern already exists, 
							     else create one and stash on the NC icon's window's 
							     proplist.)
		    (OR (NC.FlashFileBrowserWin Selection Window)
			  (LET ((FileBrowserWins (WINDOWPROP Window (QUOTE FileBrowserWins)))
				(REMOTEHOSTP (NC.RemoteHostP Selection))
				FileBrowserWin)
			       [SETQ FileBrowserWin (COND
				   [REMOTEHOSTP (FILEBROWSER (NCCLIENT.LISTNOTEFILES Selection)
							       (QUOTE NOTHING)
							       (BQUOTE (MENU.ITEMS , 
									  NC.FileBrowserMenuItems]
				   (T (FILEBROWSER Selection NIL (BQUOTE (MENU.ITEMS , 
									  NC.FileBrowserMenuItems]
			       (WINDOWPROP Window (QUOTE FileBrowserWins)
					     (CONS FileBrowserWin FileBrowserWins])

(NC.ListOfNoteFilesMenu
  [LAMBDA (IncludeNewNoteFileFlg ShowOnlyOpenNFsFlg InterestedWindow Operation)
                                                             (* pmi: "14-May-87 12:49")

          (* * Bring up a menu of all notefiles found in the notefiles hash array. Also allow user to open a new notefile.)



          (* * kirk 23Jan86 Added AskYesOrNo and InterestedWindow parameter)



          (* * fgh 6/8/86 Added check to make sure NoteFile is open if it has a menu on the screen. Needed to handle case of 
	  liongering NF menus.)



          (* * fgh 6/24/86 Changed to be a general function rather than one specific for opening. Now just returns the chosen
	  name. Also, added IncludeNewNoteFileFlg and ShowOnlyOpenNFsFlg. Removed InterestedWindow arg.)



          (* * fgh 6/27/86 Added InterestedWindow & Operation args and call to NC.DatabaseFileName.)



          (* * pmi 12/4/86: Added version numbers to rootnames on list of known files. Also cleaned up help string for menu 
	  items. It was giving a bogus message about opening the selected file, even though this function is used for many 
	  operations and not just for Open.)



          (* * pmi 2/18/87: Added GLOBALVARS declaration for NC.MenuFont)



          (* * pmi 5/14/87: Changed symbol for open notefile to o. Now uses NC.NoticedNoteFileNames instead of hash array to 
	  build menu. Returns a NoteFile name instead of a NoteFile object.)


    (DECLARE (GLOBALVARS NC.MenuFont NC.NoticedNoteFileNames))
    (LET (Menu Items Result)
         [SETQ Items (BQUOTE (,@ (for NoteFileName in NC.NoticedNoteFileNames
					bind NoteFile Stream RootName
					when (PROGN (SETQ NoteFile (NC.NoteFileFromFileName
							    NoteFileName))
							(OR (AND (EQ ShowOnlyOpenNFsFlg
									   (QUOTE CLOSED))
								     (NULL (NC.NoteFileOpenP
									       NoteFile)))
							      (NULL ShowOnlyOpenNFsFlg)
							      (NC.NoteFileOpenP NoteFile)))
					collect (LIST [CONCAT
							    (if (NC.NoteFileOpenP NoteFile)
								then 
                                                             (* (if (WINDOWP (WFROMMENU 
							     (fetch (NoteFile Menu) of NoteFile))) then "* " else 
							     "$ "))
								       "o "
							      else "  ")
							    (SUBSTRING
							      [SETQ RootName
								(PACKFILENAME (QUOTE NAME)
										(FILENAMEFIELD
										  NoteFileName
										  (QUOTE NAME))
										(QUOTE VERSION)
										(FILENAMEFIELD
										  NoteFileName
										  (QUOTE VERSION]
							      1
							      (MIN 20 (NCHARS RootName]
							  NoteFileName
							  (CONCAT "Selects NoteFile " NoteFileName))
					    )
				     ,@
				     (if IncludeNewNoteFileFlg
					 then (LIST (QUOTE ("-- Other NoteFile --"
								   (QUOTE NEW)
								   
				  "Select some other notefile - you'll be prompted for the name.")))
				       else NIL]
         [SETQ Result (if (NULL Items)
			    then NIL
			  elseif [AND (EQ (LENGTH Items)
						1)
					  (EQUAL (CADAR Items)
						   (QUOTE (QUOTE NEW]
			    then (QUOTE NEW)
			  else (MENU (create MENU
						   ITEMS ← Items
						   TITLE ← (OR Operation "NoteFiles")
						   MENUFONT ← NC.MenuFont
						   ITEMHEIGHT ← (IPLUS (FONTPROP NC.MenuFont
										     (QUOTE HEIGHT))
									 1]
         (if (EQ Result (QUOTE NEW))
	     then (SETQ Result (NC.DatabaseFileName (CONCAT "Name of NoteFile to "
								    (SUBSTRING Operation 1 -9)
								    (CHARACTER 13))
							  " -- " T T NIL InterestedWindow)))
     Result])

(NC.CheckpointSession
  (LAMBDA NIL                                                (* kirk: "20-Jan-86 00:53")

          (* * Checkpoint all open NoteFiles)


    (MAPHASH NC.NoteFilesHashArray (FUNCTION (LAMBDA (Value Key)
		   (AND (type? NoteFile Value)
			  (if (AND (STREAMP (SETQ Stream (fetch (NoteFile Stream)
								    of Value)))
				       (OPENP Stream))
			      then (NC.CheckpointDatabase Value))))))
    (NC.PrintMsg NIL T "Done checkpointing entire session.")))

(NC.CloseSession
  [LAMBDA (DeleteChangesFlg AutoConfirmFlg)                  (* Randy.Gobbel " 4-Mar-87 16:18")

          (* * Checkpoint all open NoteFiles)



          (* * rht 2/16/87: Now accepts AutoConfirmFlg and passes to NC.AbortSession and NC.CloseNoteFile.)


    [MAPHASH NC.NoteFilesHashArray (FUNCTION (LAMBDA (Value Key)
		   (AND (type? NoteFile Value)
			  (if (AND (STREAMP (SETQ Stream (fetch (NoteFile Stream)
								    of Value)))
				       (OPENP Stream))
			      then (if DeleteChangesFlg
					 then (NC.AbortSession Value NIL AutoConfirmFlg)
				       else (NC.CloseNoteFile Value NIL AutoConfirmFlg]
    (NC.PrintMsg NIL T "Done closing all NoteFiles."])
)

(ADDTOVAR NC.NoteFileIconOperationsMenuItems (Open NIL "Opens this NoteFile."
						     (SUBITEMS (Read-only% Open NIL 
							     "Opens this NoteFile for read-only.")))
					       (Checkpoint NIL 
						"Checkpoint this NoteFile, saving changed cards.")
					       (Close NIL "Closes this NoteFile."
						      (SUBITEMS (Close% w/o% confirm NIL 
		     "Close this notefile w/o asking for user confirm before closing open cards.")))
					       (Abort NIL 
					      "Close NF, deleting changes since last checkpoint.")
					       (Compact NIL "Compacts this NoteFile to a new file."
							(SUBITEMS (Compact% To% New% File NIL 
						      "Compact a NoteFile copying to a new file.")
								  (Compact% In% Place NIL 
						  "Compact a NoteFile w/o copying to a new file.")))
					       (Inspect&Repair NIL 
						 "Inspects and optionally repairs this NoteFile."
							       (SUBITEMS (Read% Substances NIL 
"Inspects and optionally repairs a Notefile, but reads every substance.  This slows it WAY down.")))
					       (Copy NIL "Copies this notefile to a target file.")
					       (Rename NIL "Rename this NoteFile")
					       (Delete NIL "Deletes this NoteFile."))

(ADDTOVAR NC.NoteFileIconOpenOperations Open Checkpoint Close Abort Close% w/o% confirm)

(ADDTOVAR NC.NoteFileIconCloseOperations Open Compact Read-only% Open Inspect&Repair 
						Read% Substances Copy Rename Delete 
						Compact% To% New% File Compact% In% Place)

(RPAQ? NC.DefaultMiddleButtonMenuItems NIL)

(RPAQ? NC.LocalInsertLinkMenuItem [QUOTE (Insert% Link (FUNCTION NC.AddLinkToCard)
							 
		     "Insert a link to another card at the currently selected point in the text."
							 (SUBITEMS (Insert% Link
								     (FUNCTION NC.AddLinkToCard)
								     
		     "Insert a link to another card at the currently selected point in the text.")
								   (Insert% Links
								     (FUNCTION NC.AddLinksToCard)
								     
		       "Insert links to other cards at the currently selected point in the text.")
								   (Add% Global% Link
								     (FUNCTION NC.AddGlobalLinkToCard)
								     
						    "Add a global link emanating from this card.")
								   (Add% Global% Links
								     (FUNCTION 
									  NC.AddGlobalLinksToCard)
								     
					    "Add multiple global links emanating from this card."])

(RPAQ? NC.GlobalInsertLinkMenuItem [QUOTE (Add% Global% Link (FUNCTION NC.AddGlobalLinkToCard)
							       
						    "Add a global link emanating from this card."
							       (SUBITEMS
								 (Add% Global% Link
								   (FUNCTION NC.AddGlobalLinkToCard)
								   
						    "Add a global link emanating from this card.")
								 (Add% Global% Links
								   (FUNCTION NC.AddGlobalLinksToCard)
								   
					    "Add multiple global links emanating from this card."])

(RPAQ? NC.DefaultLeftButtonMenuItems [BQUOTE ((Edit% Property% List (FUNCTION NC.EditProperties)
								      
					"Brings up an editor for the property list of this card.")
						(Show% Links (FUNCTION NC.ShowLinks)
							     
					   "Brings up a list of the links to and from this card.")
						(Show% Info (FUNCTION NC.ShowInfo)
							    
			     "Brings up a window containing special information about this card."
							    (SUBITEMS (Indicate% NoteFile
									(FUNCTION 
									    NC.AttachNoteFileName)
									
							"Shows the name of this card's NoteFile.")))
						(Designate% FileBoxes
						  (FUNCTION NC.AddParents)
						  "File this note card in one or more file boxes."
						  (SUBITEMS (Unfile% from% FileBoxes
							      (FUNCTION NC.UnfileNoteCard)
							      
					   "Remove this card from one or more of its file boxes.")))
						(Assign% Title (FUNCTION NC.AssignTitle)
							       
						       "Assigns a (new) title to this note card.")
						(Title/FileBoxes (FUNCTION [LAMBDA (TextStream)
										   (NC.AssignTitle
										     TextStream)
										   (NC.AddParents
										     TextStream])
								 
					    "Do both assigning of title and filing in fileboxes.")
						, NC.LocalInsertLinkMenuItem
						(Close% and% Save
						  (FUNCTION CLOSEW)
						  
					  "Close this note card after saving it in the NoteFile."
						  (SUBITEMS (Close% and% Save (FUNCTION CLOSEW)
									      
					  "Close this note card after saving it in the NoteFile.")
							    (Close% w/o% Saving
							      (FUNCTION NC.QuitWithoutSaving)
							      
		      "Close this note card without saving any changes made since the last Save.")
							    (Save% in% NoteFile
							      (FUNCTION NC.CardSaveFn)
							      
				       "Save this card in the NoteFile but don't close the card.")
							    (Delete% Card (FUNCTION NC.DeleteNoteCard)
									  
						"Permanently delete this card from the NoteFile."])

(ADDTOVAR NC.CardOpsItems (% Close%  (NC.CloseNoteCards NIL NC.NoteCardsIconWindow)
				       "Delete several note cards."
				       (SUBITEMS (Close% Structure (NC.CloseStructure NIL NIL 
									   NC.NoteCardsIconWindow)
								   
						     "Close note cards belonging to a structure.")))
			    (% Delete%  (NC.DeleteNoteCards NIL T NIL NC.NoteCardsIconWindow)
					"Delete several note cards."
					(SUBITEMS (Delete% Structure (NC.DeleteStructure NIL NIL 
									   NC.NoteCardsIconWindow)
								     
						    "Delete note cards belonging to a structure.")))
			    (% Copy%  (NC.CopyCards NIL NIL NIL NIL NC.NoteCardsIconWindow)
				      "Copy note cards to a filebox"
				      (SUBITEMS (Copy% Structure (NC.CopyStructure NIL NIL NIL 
									   NC.NoteCardsIconWindow)
								 
						      "Copy note cards belonging to a structure.")))
			    (% Move%  (NC.MoveCards NIL NIL NIL NIL NC.NoteCardsIconWindow)
				      "Move note cards to a filebox"
				      (SUBITEMS (Move% Structure (NC.MoveStructure NIL NIL NIL 
									   NC.NoteCardsIconWindow)
								 
						      "Move note cards belonging to a structure."))))

(ADDTOVAR NC.NoteFileOpsItems (% Open%  (NC.DoNoteFileOp (QUOTE Open% NoteFile))
					  "Opens a notefile."
					  (SUBITEMS (Read-only% Open (NC.DoNoteFileOp (QUOTE 
										  Read-only% Open))
								     "Open a notefile for read-only.")
						    ))
				(% Checkpoint%  (NC.DoNoteFileOp (QUOTE Checkpoint% NoteFile))
						"Checkpoint a NoteFile"
						(SUBITEMS (Checkpoint% All (NC.CheckpointSession)
									   
							"Checkpoint all currently open NoteFiles")))
				(% Close%  (NC.DoNoteFileOp (QUOTE Close% NoteFile))
					   "Close a notefile."
					   (SUBITEMS (Close% w/o% confirm (NC.DoNoteFileOp
									    (QUOTE 
									      Close% w/o% confirm))
									  
			"Close a notefile w/o asking for user confirm before closing open cards.")
						     (Close% All (NC.CloseSession)
								 "Close all currently open NoteFiles")
						     (Close% All% w/o% confirm (NC.CloseSession
										 NIL T)
									       
		"Close all open notefiles w/o asking for user confirm before closing open cards.")))
				(% Abort%  (NC.DoNoteFileOp (QUOTE Abort% NoteFile))
					   "Close NF, deleting changes since last checkpoint."
					   (SUBITEMS (Abort% All (NC.CloseSession T)
								 "Abort all currently open NoteFiles")
						     ))
				(% Compact%  (NC.DoNoteFileOp (QUOTE Compact% NoteFile))
					     "Compact a NoteFile."
					     (SUBITEMS (Compact% To% New% File (NC.DoNoteFileOp
										 (QUOTE 
										Compact% NoteFile))
									       
						      "Compact a NoteFile copying to a new file.")
						       (Compact% In% Place (NC.DoNoteFileOp
									     (QUOTE 
									       Compact% In% Place))
									   
						  "Compact a NoteFile w/o copying to a new file.")))
				(% Inspect&Repair%  (NC.DoNoteFileOp (QUOTE Inspect&Repair% NoteFile))
						    "Do an Inspect & Repair on a NoteFile."
						    (SUBITEMS (Read% Substances (NC.DoNoteFileOp
										  (QUOTE 
										 Read% Substances))
										
"Inspects and optionally repairs a Notefile, but reads every substance.  This slows it WAY down.")))
				(% Copy%  (NC.DoNoteFileOp (QUOTE Copy% NoteFile))
					  "Copy a NoteFile.")
				(% Rename%  (NC.DoNoteFileOp (QUOTE Rename% NoteFile))
					    "Rename a NoteFile")
				(% Delete%  (NC.DoNoteFileOp (QUOTE Delete% NoteFile))
					    "Delete a NoteFile")
				(% Create%  (NC.DoNoteFileOp (QUOTE Create% NoteFile))
					    "Create a new NoteFile w/o opening it."
					    (SUBITEMS (% Create% and% Open%  (NC.DoNoteFileOp
									       (QUOTE 
										Create% and% Open))
									     
							     "Create a new NoteFile and open it.")
						      (% Create% and% Read-only% Open% 
							(NC.DoNoteFileOp (QUOTE 
								     Create% and% Read-only% Open))
							
					       "Create a new NoteFile and open it for read-only.")))
				(% --------%  NIL "")
				(% NC% FileBrowser%  (NC.FileBrowserMenu NC.NoteCardsIconWindow)
						     "Bring up a NoteFile browser."))

(ADDTOVAR NC.OtherOpsItems (% Edit% Parameters%  (NC.BuildInspector)
						   "Adjust NoteCards profile for this session.")
			     (% NF% Indicators% On%  (NC.ShowNoteFiles)
						     
				    "Turn on the NoteFile indicator for all currently open cards"
						     (SUBITEMS (Indicators% Off (NC.ShowNoteFiles
										  T)
										
				    "Turn off any NoteFile indicator on each card on the screen.")))
			     (% TEdit% Killer% On% 
			       (START-TEDIT-KILLER)
			       "Start the TEDIT-KILLER process."
			       (SUBITEMS (TEdit% Killer% Off (STOP-TEDIT-KILLER)
							     "Stop the TEDIT-KILLER process.")
					 (New% Process% Limit (SETQ
								TEDIT-PROCESS-LIMIT
								(OR (NUMBERP (RNUMBER (CONCAT 
								      "Old TEdit process limit: "
											      
									      TEDIT-PROCESS-LIMIT)
										      NIL NIL NIL T))
								    TEDIT-PROCESS-LIMIT))
							      "Change value of TEdit process limit.")
					 (New% Wait% Time (SETQ TEDIT-KILLER-WAIT-TIME
								(OR (NUMBERP (RNUMBER (CONCAT 
								   "Old TEdit killer wait time: "
											      
									   TEDIT-KILLER-WAIT-TIME)
										      NIL NIL NIL T))
								    TEDIT-KILLER-WAIT-TIME))
							  "Change value of TEdit killer wait time.")))
			     (% Session% Icon% Style%  NIL 
						"Change the style of the NoteCards session icon."
						       (SUBITEMS (% Old% Style%  (
NC.ResetNoteCardsIcon (QUOTE OldStyle))
										 
						      "Change session icon to Roll-through style")
								 (% New% Style%  (
NC.ResetNoteCardsIcon (QUOTE NewStyle))
										 
							   "Change session icon to Filebox style"))))

(RPAQQ NC.CardOpsMenu NIL)

(RPAQQ NC.OtherOpsMenu NIL)

(RPAQQ NC.NoteFileOpsMenu NIL)
(DECLARE: DOEVAL@COMPILE DONTCOPY

(GLOBALVARS NC.NoteCardsIconMenuBitMap NC.OldStyleIconMenuBitmap NC.OldStyleIconBitmap 
	    NC.OldStyleIconMenuBitmap NC.NoteCardsIconMask NC.NoteCardsIconShrunkenBitmap 
	    NC.NoteCardsIconShrunkenMask NC.OtherOpsItems NC.OtherOpsMenu)
)

(RPAQQ NC.NoteCardsIconMenuBitMap NIL)

(RPAQQ NC.OldStyleIconMenuBitmap NIL)
(DEFINEQ

(NC.RedisplayNoteCardsIconWindow
  [LAMBDA (Window)                                           (* pmi: "18-Mar-87 17:20")

          (* * Redisplay the NC Icon window. Use different displkays whether the cursor is on or out of the window)



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



          (* * pmi 3/18/87: Now used only for the old style session icon. Bitmap names needed to change.)


    (DECLARE (GLOBALVARS NC.OldStyleIconMenuBitmap NC.OldStyleIconBitmap))
    (if (NULL (WINDOWPROP Window (QUOTE NoteCardsOperationInProgress)))
	then (GETMOUSESTATE)
	       (if (INSIDEP (WINDOWPROP Window (QUOTE REGION))
				LASTMOUSEX LASTMOUSEY)
		   then (BITBLT NC.OldStyleIconMenuBitmap 0 0 Window 0 0 NIL NIL (QUOTE INPUT)
				    (QUOTE REPLACE))
		 else (BITBLT NC.OldStyleIconBitmap 0 0 Window 0 0 NIL NIL (QUOTE INPUT)
				  (QUOTE REPLACE])

(NC.NoteCardsIconButtonEventFn
  [LAMBDA (Window)                                           (* pmi: "25-Mar-87 12:17")

          (* * Bring up a menu of all notefiles found in the notefiles hash array. Also allow user to open a new notefile.)



          (* * rht 1/7/86: Now handles middle button differently -
	  brings up menu of patterns and creates notefile browser for that pattern.)



          (* * kirk 18Jan85 Added session commands to left button. Carved out NC.CommandMenu and NC.FileBrowserMenu 
	  functions.)



          (* * fgh 6/24/86 Totally revamped for new 1.3 session icon. Now is a whenselectedfn for the icon.
	  Pops up the menu for the selectedfn, creating one if necessary.)



          (* * pmi 3/11/87: Revamped for another new session icon.)



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


    (DECLARE (GLOBALVARS NC.MenuFont NC.NoteCardsIconWindow))
    (if (MOUSESTATE UP)
      else (TOTOPW Window)
	     (ALLOW.BUTTON.EVENTS)
	     (LET [(Menus (WINDOWPROP Window (QUOTE MENU]

          (* * For the new 1.3 icon, there are three menus in the icon window. Each is a menu of one item.)


	          (for Menu in Menus
		     when (for Item in (fetch (MENU ITEMS) of Menu)
			       when (INSIDEP (MENUITEMREGION Item Menu)
						 (LASTMOUSEX Window)
						 (LASTMOUSEY Window))
			       do (SHADEITEM Item Menu BLACKSHADE) 
                                                             (* RESETSAVE (SHADEITEM Item Menu BLACKSHADE) 
							     (BQUOTE (SHADEITEM , Item , Menu , WHITESHADE)))
				    [MENU (OR (EVAL (CADR Item))
						  (SET (CADR Item)
							 (create MENU
								   ITEMS ← (EVAL (CADDR Item))
								   MENUFONT ← NC.MenuFont
								   CHANGEOFFSETFLG ← (QUOTE Y)
								   MENUOFFSET ← (CONS -1 0)
								   TITLE ← (CONCAT " "
										     (CAR Item)
										     " Ops ")
								   CENTERFLG ← T
								   ITEMHEIGHT ←
								   (IPLUS (FONTPROP NC.MenuFont
											(QUOTE
											  HEIGHT))
									    1]
				    (REDISPLAYW NC.NoteCardsIconWindow)
				    (RETURN T))
		     do (RETURN])

(NC.DoNoteFileOp
  [LAMBDA (Op)                                               (* pmi: "28-May-87 12:08")

          (* * Do a NoteFile op chosen from NC icon menu)



          (* * rht 7/2/86: Now calls NC.AbortSession with NC.NoteCardsIconWindow arg.)



          (* * rht 7/5/86: Added Read-only% Open entry.)



          (* * rht 7/17/86: Now calls NC.InspectAndRepairNoteFile instead of NC.ScavengerPhase1.)



          (* * pmi 12/4/86: Added NC.NoteCardsIconWindow argument to calls to NC.ListOfNoteFilesMenu for "Delete" and 
"Rename" operations)



          (* * rht 2/11/87: Now handles case when Op has unexpected value.)



          (* * rht 2/16/87: Added Close% w/o% confirm case.)



          (* * pmi 5/15/87: overhauled to use NC.NoticedNoteFileNamesMenu instead of NC.ListOfNoteFilesMenu.
	  Added "Create and Open" and "Create and Read-only Open" options.)


    (DECLARE (GLOBALVARS NC.NoteCardsIconWindow NC.MsgDelay))
    (SELECTQ Op
	       [Open% NoteFile (LET [(NoteFileName (NC.NoticedNoteFileNamesMenu T NIL 
									   NC.NoteCardsIconWindow
										  (QUOTE 
										   Open% NoteFile]
				    (if (NULL NoteFileName)
					then NIL
				      else (if (EQ NoteFileName (QUOTE NEW))
						 then (SETQ NoteFileName NIL))
					     (NC.OpenDatabaseFile NoteFileName NIL NIL NIL NIL NIL 
								    NIL NIL NIL NIL 
								    NC.NoteCardsIconWindow]
	       [Read-only% Open (LET [(NoteFileName (NC.NoticedNoteFileNamesMenu T NIL 
									   NC.NoteCardsIconWindow
										   (QUOTE 
										   Open% NoteFile]
				     (if (NULL NoteFileName)
					 then NIL
				       else (if (EQ NoteFileName (QUOTE NEW))
						  then (SETQ NoteFileName NIL))
					      (NC.OpenDatabaseFile NoteFileName (QUOTE INPUT)
								     NIL NIL NIL NIL NIL NIL NIL NIL 
								     NC.NoteCardsIconWindow]
	       [Checkpoint% NoteFile (LET [(NoteFileName (NC.NoticedNoteFileNamesMenu NIL T 
									   NC.NoteCardsIconWindow
											(QUOTE
											  
									     Checkpoint% NoteFile]
				          (if NoteFileName
					      then (NC.CheckpointDatabase (
									  NC.NoteFileFromFileName
										NoteFileName)
									      NIL NIL 
									   NC.NoteCardsIconWindow)
					    else (NC.PrintMsg NC.NoteCardsIconWindow NIL 
								  "Checkpoint cancelled."
								  (CHARACTER 13))
						   (DISMISS NC.MsgDelay)
						   (NC.ClearMsg NC.NoteCardsIconWindow T]
	       [Close% NoteFile (LET [(NoteFileName (NC.NoticedNoteFileNamesMenu NIL T 
									   NC.NoteCardsIconWindow
										   (QUOTE 
										  Close% NoteFile]
				     (if NoteFileName
					 then (NC.CloseNoteFile (NC.NoteFileFromFileName 
										     NoteFileName)
								    NC.NoteCardsIconWindow)
				       else (NC.PrintMsg NC.NoteCardsIconWindow NIL 
							     "Close cancelled."
							     (CHARACTER 13))
					      (DISMISS NC.MsgDelay)
					      (NC.ClearMsg NC.NoteCardsIconWindow T]
	       [Close% w/o% confirm (LET [(NoteFileName (NC.NoticedNoteFileNamesMenu NIL T 
									   NC.NoteCardsIconWindow
										       (QUOTE
											 
										  Close% NoteFile]
				         (if NoteFileName
					     then (NC.CloseNoteFile (NC.NoteFileFromFileName
									  NoteFileName)
									NC.NoteCardsIconWindow NIL T)
					   else (NC.PrintMsg NC.NoteCardsIconWindow NIL 
								 "Close w/o confirm cancelled."
								 (CHARACTER 13))
						  (DISMISS NC.MsgDelay)
						  (NC.ClearMsg NC.NoteCardsIconWindow T]
	       [Abort% NoteFile (LET [(NoteFileName (NC.NoticedNoteFileNamesMenu NIL T 
									   NC.NoteCardsIconWindow
										   (QUOTE 
										  Abort% NoteFile]
				     (if NoteFileName
					 then (NC.AbortSession (NC.NoteFileFromFileName 
										     NoteFileName)
								   NC.NoteCardsIconWindow)
				       else (NC.PrintMsg NC.NoteCardsIconWindow NIL 
							     "Abort cancelled."
							     (CHARACTER 13))
					      (DISMISS NC.MsgDelay)
					      (NC.ClearMsg NC.NoteCardsIconWindow T]
	       [Compact% NoteFile (LET [(NoteFileName (NC.NoticedNoteFileNamesMenu T NIL 
									   NC.NoteCardsIconWindow
										     (QUOTE 
										Compact% NoteFile]
				       (if (NULL NoteFileName)
					   then NIL
					 else (if (EQ NoteFileName (QUOTE NEW))
						    then (SETQ NoteFileName NIL))
						(NC.CompactNoteFile NoteFileName NIL NIL NIL]
	       [Compact% In% Place (LET [(NoteFileName (NC.NoticedNoteFileNamesMenu T NIL 
									   NC.NoteCardsIconWindow
										      (QUOTE 
										Compact% NoteFile]
				        (if (NULL NoteFileName)
					    then NIL
					  else (if (EQ NoteFileName (QUOTE NEW))
						     then (SETQ NoteFileName NIL))
						 (NC.CompactNoteFile NoteFileName NIL T NIL]
	       [Inspect&Repair% NoteFile (LET [(NoteFileName (NC.NoticedNoteFileNamesMenu
							       T NIL NC.NoteCardsIconWindow
							       (QUOTE Inspect&Repair% NoteFile]
					      (if (NULL NoteFileName)
						  then NIL
						else (if (EQ NoteFileName (QUOTE NEW))
							   then (SETQ NoteFileName NIL))
						       (NC.InspectAndRepairNoteFile NoteFileName 
										      NIL 
									   NC.NoteCardsIconWindow]
	       [Read% Substances (LET [(NoteFileName (NC.NoticedNoteFileNamesMenu T NIL 
									   NC.NoteCardsIconWindow
										    (QUOTE 
									 Inspect&Repair% NoteFile]
				      (if (NULL NoteFileName)
					  then NIL
					else (if (EQ NoteFileName (QUOTE NEW))
						   then (SETQ NoteFileName NIL))
					       (NC.InspectAndRepairNoteFile NoteFileName T 
									   NC.NoteCardsIconWindow]
	       [Copy% NoteFile (LET [(NoteFileName (NC.NoticedNoteFileNamesMenu T (QUOTE CLOSED)
										  
									   NC.NoteCardsIconWindow
										  (QUOTE 
										   Copy% NoteFile]
				    (if (NULL NoteFileName)
					then NIL
				      else (if (EQ NoteFileName (QUOTE NEW))
						 then (SETQ NoteFileName NIL))
					     (NC.CopyNoteFile NoteFileName NIL 
								NC.NoteCardsIconWindow]
	       [Rename% NoteFile (LET [(NoteFileName (NC.NoticedNoteFileNamesMenu T (QUOTE CLOSED)
										    
									   NC.NoteCardsIconWindow
										    (QUOTE 
										 Rename% NoteFile]
				      (if (NULL NoteFileName)
					  then NIL
					else (if (EQ NoteFileName (QUOTE NEW))
						   then (SETQ NoteFileName NIL))
					       (NC.RenameNoteFile NoteFileName NIL 
								    NC.NoteCardsIconWindow]
	       [Delete% NoteFile (LET [(NoteFileName (NC.NoticedNoteFileNamesMenu T (QUOTE CLOSED)
										    
									   NC.NoteCardsIconWindow
										    (QUOTE 
										 Delete% NoteFile]
				      (if (NULL NoteFileName)
					  then NIL
					else (if (EQ NoteFileName (QUOTE NEW))
						   then (SETQ NoteFileName NIL))
					       (NC.DeleteDatabaseFile NoteFileName 
									NC.NoteCardsIconWindow]
	       (Create% NoteFile (NC.CreateDatabaseFile NIL NIL NIL NIL NIL NIL 
							  NC.NoteCardsIconWindow NIL NIL NIL NIL NIL 
							  NIL))
	       (Create% and% Open (NC.CreateDatabaseFile NIL NIL NIL NIL NIL NIL 
							   NC.NoteCardsIconWindow NIL NIL T NIL NIL 
							   NIL))
	       (Create% and% Read-only% Open (NC.CreateDatabaseFile NIL NIL NIL NIL NIL NIL 
								      NC.NoteCardsIconWindow NIL NIL 
								      T T NIL NIL))
	       (LET ((NoteFileName (NC.NoticedNoteFileNamesMenu NIL T NC.NoteCardsIconWindow)))
		    (if NoteFileName
			then (APPLY* Op (NC.NoteFileFromFileName NoteFileName)
					 NC.NoteCardsIconWindow])

(NC.NoteCardsIconCursorEventFn
  [LAMBDA (Window)                                           (* pmi: "18-Mar-87 17:22")

          (* * If not in an operation, then redisplay the icon window. The redisplay fn takes care of noticing whether the 
	  cursor is in or out of the icon.)



          (* * pmi 3/18/87: Uses the globalvar NC.NoteCardsIconWindow to solve problem of switching between the two session 
	  icon styles.)


    (DECLARE (GLOBALVARS NC.NoteCardsIconWindow))
    (if (NULL (WINDOWPROP NC.NoteCardsIconWindow (QUOTE NoteCardsOperationInProgress)))
	then (REDISPLAYW NC.NoteCardsIconWindow])

(NC.NoteCardsIconFn
  [LAMBDA (IconWindow Icon)                                  (* pmi: "18-Mar-87 17:22")

          (* * Create the shrunken icon for the NoteCards session icon)


    (DECLARE (GLOBALVARS NC.NoteCardsIconShrunkenBitmap NC.NoteCardsIconShrunkenMask))
    (if Icon
      else (ICONW NC.NoteCardsIconShrunkenBitmap NC.NoteCardsIconShrunkenMask NIL T])

(NC.ResetNoteCardsIcon
  [LAMBDA (Style)                                            (* pmi: "18-Mar-87 17:24")

          (* * Called when switching between the two styles for the NoteCards session icon. If the requested style is already
	  in use, just flashes the icon. Otherwise, closes the window, resets it, and brings up the new icon.)


    (DECLARE (GLOBALVARS NC.NoteCardsIconWindow))
    (if (NULL Style)
      elseif (EQ (WINDOWPROP NC.NoteCardsIconWindow (QUOTE NC.SessionIconStyle))
		     Style)
	then (FLASHWINDOW NC.NoteCardsIconWindow)
      else (CLOSEW NC.NoteCardsIconWindow)
	     (SETQ NC.NoteCardsIconWindow NIL)
	     (NC.BringUpNoteCardsIcon NIL Style])

(NC.MakeNewStyleNoteCardsIcon
  [LAMBDA (Position)                                         (* pmi: "26-Mar-87 15:29")

          (* * Creates a new style NoteCards Session Icon (designed by Peggy Irish))



          (* * pmi 3/26/87: Added AFTERMOVEFNS to keep track of NC.NoteCardsIconPosition.)


    (DECLARE (GLOBALVARS NC.CardOpsMenu NC.NoteFileOpsMenu NC.OtherOpsMenu NC.CardOpsItems 
			     NC.NoteFileOpsItems NC.OtherOpsItems NC.NoteCardsIconBitmap 
			     NC.NoteCardsIconMask NC.NoteCardsIconPosition))
    (LET ((WinWidth 115)
	  (WinHeight 86)
	  (MenuFont (FONTCREATE (QUOTE HELVETICA)
				  10
				  (QUOTE BOLD)))
	  WinPos IconWindow)
         [SETQ NC.NoteCardsIconPosition (SETQ WinPos (OR Position NC.NoteCardsIconPosition
							       (GETBOXPOSITION WinWidth WinHeight 
										 NIL NIL NIL 
								"Please position NoteCards icon."]

          (* * Make the window an icon so that we can use the masking capability available for icons.
	  This is what allows us to see the background around the icon, instead of rectangular white space.)


         (SETQ IconWindow (ICONW NC.NoteCardsIconBitmap NC.NoteCardsIconMask WinPos T))

          (* * Each menu item is actually a separate menu. The item regions needed to be offset horizontally, which is 
	  impossible within a menu.)


         (ADDMENU (create MENU
			      ITEMS ← (QUOTE (("Card" NC.CardOpsMenu NC.CardOpsItems)))
			      CENTERFLG ← T
			      MENUFONT ← MenuFont
			      ITEMWIDTH ← 64
			      MENUOUTLINESIZE ← 1)
		    IconWindow
		    (create POSITION
			      XCOORD ← 12
			      YCOORD ← 33)
		    T)
         (ADDMENU (create MENU
			      ITEMS ← (QUOTE (("NoteFile" NC.NoteFileOpsMenu NC.NoteFileOpsItems)))
			      CENTERFLG ← T
			      MENUFONT ← MenuFont
			      ITEMWIDTH ← 64
			      MENUOUTLINESIZE ← 1)
		    IconWindow
		    (create POSITION
			      XCOORD ← 20
			      YCOORD ← 46)
		    T)
         (ADDMENU (create MENU
			      ITEMS ← (QUOTE (("Other" NC.OtherOpsMenu NC.OtherOpsItems)))
			      CENTERFLG ← T
			      MENUFONT ← MenuFont
			      ITEMWIDTH ← 64
			      MENUOUTLINESIZE ← 1)
		    IconWindow
		    (create POSITION
			      XCOORD ← 28
			      YCOORD ← 59)
		    T)
         (OPENW IconWindow)
         (WINDOWPROP IconWindow (QUOTE ICONFN)
		       (FUNCTION NC.NoteCardsIconFn))
         (WINDOWPROP IconWindow (QUOTE AFTERMOVEFN)
		       (FUNCTION NC.NoteCardsIconAfterMoveFn))
         (WINDOWPROP IconWindow (QUOTE BUTTONEVENTFN)
		       (FUNCTION NC.NoteCardsIconButtonEventFn))
         (WINDOWPROP IconWindow (QUOTE SCROLLFN)
		       NIL)
         (WINDOWPROP IconWindow (QUOTE NOSCROLLBARS)
		       T)

          (* * Need the RedisplayFn for icons)


         (WINDOWPROP IconWindow (QUOTE REPAINTFN)
		       (FUNCTION \ICONW.REPAINTFN))
         (WINDOWPROP IconWindow (QUOTE CURSORINFN)
		       NIL)
         (WINDOWPROP IconWindow (QUOTE CURSORMOVEDFN)
		       NIL)
         (WINDOWPROP IconWindow (QUOTE RESHAPEFN)
		       (QUOTE DON'T))
         (WINDOWPROP IconWindow (QUOTE NC.SessionIconStyle)
		       (QUOTE NewStyle))
     IconWindow])

(NC.MakeOldStyleNoteCardsIcon
  [LAMBDA (Position)                                         (* pmi: "26-Mar-87 15:44")

          (* * Creates an old style NoteCards Session Icon (designed by Frank Halasz))



          (* * fgh 6/7/86 Added Position arg and NC.NoteCardsIconPosition globalvar reference.)



          (* * fgh 6/24/86 Revamped for new 1.3 session icon. Session icon now a positional menu, but one with the 
	  buttoneventfn and cursormovedfns handled by NC and not the standard menu code. Menu shows only when cursor inside 
	  icon, rest of time the icon shows.)



          (* * rht 8/28/86: Now prevents reshaping of session icon.)



          (* * pmi 3/19/87: Separated code for Old style icon from code for New style icon. Most of this function was 
	  formerly NC.MakeNoteCardsIcon, which now calls this function for the Old style icon.)



          (* * pmi 3/26/87: Added AFTERMOVEFNS to keep track of NC.NoteCardsIconPosition.)


    (DECLARE (GLOBALVARS NC.CardOpsMenu NC.NoteFileOpsMenu NC.OtherOpsMenu NC.CardOpsItems 
			     NC.NoteFileOpsItems NC.OtherOpsItems NC.OldStyleIconBitmap 
			     NC.OldStyleIconMenuBitmap NC.NoteCardsIconPosition))
    (LET ((WinWidth (WIDTHIFWINDOW (BITMAPWIDTH NC.OldStyleIconBitmap)
				     0))
	  (WinHeight (HEIGHTIFWINDOW (BITMAPHEIGHT NC.OldStyleIconBitmap)
				       NIL 0))
	  WinPos IconWindow)
         [SETQ NC.NoteCardsIconPosition (SETQ WinPos (OR Position NC.NoteCardsIconPosition
							       (GETBOXPOSITION WinWidth WinHeight 
										 NIL NIL NIL 
								"Please position NoteCards icon."]
         (SETQ IconWindow (ADDMENU (create MENU
						 ITEMS ← (QUOTE (("Card Ops" NC.CardOpsMenu 
									       NC.CardOpsItems)
								    ("NoteFile Ops" 
									       NC.NoteFileOpsMenu 
									      NC.NoteFileOpsItems)
								    ("Other Ops" NC.OtherOpsMenu 
										 NC.OtherOpsItems)))
						 CENTERFLG ← T
						 MENUFONT ← (FONTCREATE (QUOTE HELVETICA)
									  12
									  (QUOTE BOLD))
						 MENUBORDERSIZE ← 1
						 ITEMWIDTH ← (DIFFERENCE (BITMAPWIDTH 
									    NC.OldStyleIconBitmap)
									   2)
						 ITEMHEIGHT ← (FIX (TIMES .333333 (BITMAPHEIGHT
										NC.OldStyleIconBitmap)
									      ))
						 MENUOUTLINESIZE ← 1)
				       (CREATEW (CREATEREGION (fetch (POSITION XCOORD)
								     of WinPos)
								  (fetch (POSITION YCOORD)
								     of WinPos)
								  WinWidth WinHeight)
						  NIL 0 T)
				       NIL T))
         (OPENW IconWindow)
         (BITBLT IconWindow 0 0 (SETQ NC.OldStyleIconMenuBitmap (BITMAPCREATE WinWidth 
										    WinHeight)))
         (WINDOWPROP IconWindow (QUOTE ICONFN)
		       (FUNCTION NC.NoteCardsIconFn))
         (WINDOWPROP IconWindow (QUOTE AFTERMOVEFN)
		       (FUNCTION NC.NoteCardsIconAfterMoveFn))
         (WINDOWPROP IconWindow (QUOTE BUTTONEVENTFN)
		       (FUNCTION NC.NoteCardsIconButtonEventFn))
         (WINDOWPROP IconWindow (QUOTE SCROLLFN)
		       NIL)
         (WINDOWPROP IconWindow (QUOTE NOSCROLLBARS)
		       T)
         (WINDOWPROP IconWindow (QUOTE REPAINTFN)
		       (FUNCTION NC.RedisplayNoteCardsIconWindow))
         (WINDOWPROP IconWindow (QUOTE CURSORINFN)
		       (FUNCTION NC.NoteCardsIconCursorEventFn))
         (WINDOWPROP IconWindow (QUOTE CURSOROUTFN)
		       (FUNCTION NC.NoteCardsIconCursorEventFn))
         (WINDOWPROP IconWindow (QUOTE CURSORMOVEDFN)
		       NIL)
         (WINDOWPROP IconWindow (QUOTE RESHAPEFN)
		       (QUOTE DON'T))
         (WINDOWPROP IconWindow (QUOTE NC.SessionIconStyle)
		       (QUOTE OldStyle))
         (BITBLT NC.OldStyleIconBitmap 0 0 IconWindow 0 0 WinWidth WinHeight (QUOTE INPUT)
		   (QUOTE REPLACE))
     IconWindow])
)
(* * Command Menu interface to NC functions)

(DEFINEQ

(NC.CloseNoteCards
  [LAMBDA (CardIdOrCardList NoCheckFlg DontClearFlg InterestedWindow)
                                                             (* Randy.Gobbel " 2-Apr-87 15:38")

          (* * Close note acrds on the screen)



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



          (* * kirk 21Feb86 Added InterestedWindow)



          (* * fgh 6/27/86 Fixed call to NC.SelectNoteCards to use just InterestedWindow)



          (* * pmi 12/5/86: Modified message to NC.SelectNoteCards to mention SHIFT-selection.)



          (* * pmi 12/12/86: Removed obsolete ReturnLinksFlg argument in call to NC.SelectNoteCards.)



          (* * rht 3/9/87: Changed NC.DeleteSelectingMenu to NC.SelectingCardsMenu.)



          (* * rg 3/9/87 added NC.ProtectedSessionOperation wrapper)



          (* * rg 4/1/87 changes NC.ProtectedSessionOperation to NCP.WithLockedCards ; also added NC.IfAllCardsFree wrapper)


    (DECLARE (GLOBALVARS NC.SelectingCardsMenu))
    (NCP.WithLockedCards (NC.IfAllCardsFree (NC.LockListOfCards (MKLIST CardIdOrCardList)
								  "Close Note Cards")
					    (LET (Cards Window)
					         [SETQ Cards
						   (COND
						     ((LISTP CardIdOrCardList))
						     (CardIdOrCardList (NC.CoerceToCard 
										 CardIdOrCardList))
						     (T (NC.SelectNoteCards NIL NIL 
									    NC.SelectingCardsMenu 
									      InterestedWindow 
						    "Please shift-select the cards to be closed."]
					         (ALLOW.BUTTON.EVENTS)
					         (for Card in (MKLIST Cards)
						    do (COND
							   ((AND (NC.ActiveCardP Card)
								   (SETQ Window (NC.FetchWindow
								       Card)))
							     (COND
							       ((NEQ (NC.QuitCard Card T)
								       (QUOTE DON'T))
								 (while (OPENWP Window)
								    do (BLOCK])

(NC.CopyStructure
  [LAMBDA (RootCards DestinationFileBox TraversalSpecs InterestedWindow QuietFlg)
                                                             (* Randy.Gobbel " 3-Jun-87 10:15")

          (* * Copy a NoteCard structure into a filebox)



          (* * kirk 13/7/86: Placed TraversalSpecs after RootCards selection and changed prompt message)



          (* * rht 9/2/86: Threw away CheckFlg arg. Wasn't being used. Changed to call NCP.CollectCards instead of outdated 
	  NC.CollectCards. Changed arg named ToPosition to DestinationFileBox. Also changed FromCard to RootCard.
	  Passes two link types to NC.AskTraversalSpecs.)



          (* * pmi 12/12/86: Removed obsolete ReturnLinksFlg argument in call to NC.SelectNoteCards.)



          (* * rht 3/9/87: Now accepts multiple root cards.)



          (* * rg 3/9/87 added NC.ProtectedSessionOperation wrapper)



          (* * RG 3/18/87 changed NC.ProtectedSessionOperation to NCP.WithLockedCards ; added NC.IfAllCardsFree wrapper)



          (* * rht&rg&pmi 4/22/87: Removed calls to ERROR!)



          (* * rg 6/2/87 added check for DON'T to selection of dest filebox)


    (DECLARE (GLOBALVARS NC.SelectingCardsMenu NC.SelectingCardMenu))
    (NCP.WithLockedCards (SETQ RootCards (MKLIST RootCards))
			 (NC.IfAllCardsFree
			   (NC.LockListOfCards RootCards "Copy Structure")
			   (if [AND (OR RootCards (SETQ RootCards
						(NC.SelectNoteCards NIL NIL NC.SelectingCardsMenu 
								      NIL 
						   "Shift-select the root cards of the structure")))
					[OR TraversalSpecs (SETQ TraversalSpecs
						(NC.AskTraversalSpecs (fetch (Card NoteFile)
									   of (CAR RootCards))
									(QUOTE (SubBox FiledCard]
					(OR DestinationFileBox
					      (NEQ (SETQ DestinationFileBox
						       (NC.SelectNoteCards T
									     (FUNCTION [LAMBDA (
										   Card)
										 (NC.FileBoxP
										   Card T])
									     NC.SelectingCardMenu NIL 
					     "Shift-select the FileBox to contain the structure."
									     T))
						     (QUOTE DON'T]
			       then (NC.CopyCards (NCP.CollectCards RootCards
									  (fetch (TRAVERSALSPECS
										     LinkTypes)
									     of TraversalSpecs)
									  (fetch (TRAVERSALSPECS
										     Depth)
									     of TraversalSpecs))
						      DestinationFileBox RootCards QuietFlg 
						      InterestedWindow])

(NC.CloseStructure
  [LAMBDA (RootCards TraversalSpecs InterestedWindow QuietFlg)
                                                             (* Randy.Gobbel " 2-Apr-87 15:38")

          (* * rht 9/2/86: Replaced call to outdated NC.CollectCards with NCP.CollectCards. Threw away useless NoCheckFlg and
	  Don'tClearFlg args.)



          (* * pmi 12/12/86: Removed obsolete ReturnLinksFlg argument in call to NC.SelectNoteCards.)



          (* * rht 3/9/87: Now accepts multiple root cards.)



          (* * rg 3/9/87 added NC.ProtectedSessionOperation wrapper)



          (* * rg 4/1/87 changes NC.ProtectedSessionOperation to NCP.WithLockedCards ; added NC.IfAllCardsFree wrapper)


    (NCP.WithLockedCards (SETQ RootCards (MKLIST RootCards))
			 (NC.IfAllCardsFree (NC.LockListOfCards RootCards "Close Structure")
					    (OR RootCards (SETQ RootCards
						    (NC.SelectNoteCards NIL NIL 
									  NC.SelectingCardsMenu NIL 
						   "Shift-select the root cards of the structure"))
						  (ERROR!))
					    [OR TraversalSpecs (SETQ TraversalSpecs
						    (NC.AskTraversalSpecs (fetch (Card NoteFile)
									       of (CAR RootCards))
									    (QUOTE (SubBox 
											FiledCard]
					    (if (AND RootCards TraversalSpecs)
						then (OR QuietFlg (NC.PrintMsg InterestedWindow 
										     T 
								  "Collecting cards to close ..."))
						       (NC.CloseNoteCards
							 (NCP.CollectCards RootCards
									     (fetch (TRAVERSALSPECS
											LinkTypes)
										of TraversalSpecs)
									     (fetch (TRAVERSALSPECS
											Depth)
										of TraversalSpecs))
							 NIL NIL InterestedWindow)
						       (OR QuietFlg (NC.ClearMsg InterestedWindow 
										     T))
						       RootCards])

(NC.DeleteStructure
  [LAMBDA (RootCards TraversalSpecs InterestedWindow QuietFlg Don'tPutToBeDeletedCardsFlg)
                                                             (* Randy.Gobbel " 2-Apr-87 15:38")

          (* * rht 8/29/86: Reorganized and changed to call NCP.CollectCards which is more efficient than the old 
	  NCP.ComputeTransitiveClosure. Also now takes QuietFlg and Don'tPutToBeDeletedCardsFlg args.
	  Threw away Don'tClearFlg.)



          (* * pmi 12/12/86: Removed obsolete ReturnLinksFlg argument in call to NC.SelectNoteCards.)



          (* * rht 3/9/87: Now accepts multiple root cards.)



          (* * rg 3/9/87 added NC.ProtectedSessionOperation wrapper)



          (* * rg 4/2/87 turned NC.ProtectedSessionOperation into NC.CardSelectionOperation)


    (NCP.WithLockedCards (SETQ RootCards (MKLIST RootCards))
			 (NC.IfAllCardsFree (NC.LockListOfCards RootCards "Delete Structure")
					    (OR RootCards (SETQ RootCards
						    (NC.SelectNoteCards NIL NIL 
									  NC.SelectingCardsMenu NIL 
						   "Shift-select the root cards of the structure"))
						  (ERROR!))
					    [OR TraversalSpecs (SETQ TraversalSpecs
						    (NC.AskTraversalSpecs (fetch (Card NoteFile)
									       of (CAR RootCards))
									    (QUOTE (SubBox 
											FiledCard]
					    (if (AND RootCards TraversalSpecs)
						then (OR QuietFlg (NC.PrintMsg InterestedWindow 
										     T 
								 "Collecting cards to delete ..."))
						       (NC.DeleteNoteCards
							 (NCP.CollectCards RootCards
									     (fetch (TRAVERSALSPECS
											LinkTypes)
										of TraversalSpecs)
									     (fetch (TRAVERSALSPECS
											Depth)
										of TraversalSpecs))
							 T NIL InterestedWindow QuietFlg NIL 
							 Don'tPutToBeDeletedCardsFlg)
						       (OR QuietFlg (NC.ClearMsg InterestedWindow 
										     T))
						       RootCards])

(NC.MoveStructure
  [LAMBDA (RootCards DestinationFileBox TraversalSpecs InterestedWindow QuietFlg 
		     Don'tPutToBeDeletedCardsFlg)            (* Randy.Gobbel " 2-Jun-87 19:44")

          (* * Copy a NoteCard structure into a filebox)



          (* * rht 9/2/86: Added QuietFlg and Don'tPutToBeDeletedCardsFlg args. Changed names of a few args and removed 
	  Don'tClearFlg arg. Took out REVERSE to save time and space.)



          (* * rht 3/9/87: Now accepts multiple root cards.)



          (* * rht&rg&pmi 4/22/87: Now checks that NC.CopyStructure returns valid stuff before deleting.)



          (* * rg 6/2/87 added NCP.WithLockedCards wrapper)


    (NCP.WithLockedCards (MKLIST RootCards)
			 (NC.IfAllCardsFree (NC.LockListOfCards RootCards "Move Structure")
					    (LET ((Structure (NC.CopyStructure (MKLIST RootCards)
										 DestinationFileBox 
										 TraversalSpecs 
										 InterestedWindow 
										 QuietFlg)))
					         (AND Structure
							(NC.DeleteNoteCards Structure T NIL 
									      InterestedWindow 
									      QuietFlg NIL 
								      Don'tPutToBeDeletedCardsFlg])
)

(RPAQQ NC.SystemDate " 9-Nov-86 22:08:17")
(* * NoteFile interface)

(DEFINEQ

(NC.NoteFileMenuWindowP
  (LAMBDA (Window)                                           (* fgh: "13-Jun-86 15:01")

          (* * IS Window a NoteFile menu?)



          (* * fgh 6/13/86 First created.)


    (WINDOWPROP Window (QUOTE NoteFile))))

(NC.SetUpNoteFileInterface
  [LAMBDA (NoteFile Position InterestedWindow)               (* pmi: "29-May-87 19:22")

          (* * 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.)



          (* * fgh 6/27/86 Added position argument)



          (* * rht 7/5/86: Now shades NewCards if readonly notefile.)



          (* * fgh 7/6/86 Will now set up menu correctly even if NF is closed.)



          (* * rht 7/13/86: Was ignoring the Position arg. No longer.)



          (* * rht 11/20/86: Changed name from ShowBox to ShowCards.)



          (* * pmi 12/12/86: Added InterestedWindow argument so that we can print a prompt to the user about placing a newly 
	  created NoteFile menu.)



          (* * pmi 3/20/87: Removed WhenSelectedFn when overhauling to have NewCards and ShowCards middlebutton menus appear 
	  when buttoned DOWN, instead of after the button comes back up. Everything is now done in the ButtonEventFn.)



          (* * pmi 5/6/87: Moved prompt for position of icon to better place. Also added MENUOFFSET to NoteFile menu for 
	  Lyric.)



          (* * pmi 5/19/87: Now stores the menu as a property of the fullfilename of the notefile. We might lose our pointer 
	  to the notefile object if another one gets created with the same UID, but we would like to keep a pointer to the 
	  menu.)



          (* * pmi 5/28/87: Now returns the NoteFile Interface window.)


    (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 (OR (NC.GetNoteFileMenu NoteFile)
					  (NC.GetNoteFileMenu FullFileName)))
	     then 

          (* * No longer need WHENSELECTEDFN)



          (* * (replace (MENU WHENSELECTEDFN) of NoteFileMenu with (if (NC.NoteFileOpenP NoteFile) then 
	  (FUNCTION NC.NoteFileMenuWhenSelectedFn) else (FUNCTION NC.ClosedNoteFileMenuWhenSelectedFn))))


		    [replace (MENU TITLE) of NoteFileMenu with (CONCAT (if (
									     NC.ReadOnlyNoteFileP
											 NoteFile)
										     then "RO: "
										   else "")
										 (FILENAMEFIELD
										   FullFileName
										   (QUOTE NAME))
										 ";"
										 (FILENAMEFIELD
										   FullFileName
										   (QUOTE VERSION]
		    (replace (MENU IMAGE) of NoteFileMenu with NIL) 
                                                             (* KLUDGE. Fetching the image height forces the menu 
							     package to recompute the menu image.)
		    (fetch (MENU IMAGEHEIGHT) of NoteFileMenu)
		    (AND (WFROMMENU NoteFileMenu)
			   (REDISPLAYW (WFROMMENU NoteFileMenu)))
	   else 

          (* * Removed this menu field from following menu: (WHENSELECTEDFN ← (if (NC.NoteFileOpenP NoteFile) then 
	  (FUNCTION NC.NoteFileMenuWhenSelectedFn) else (FUNCTION NC.ClosedNoteFileMenuWhenSelectedFn))))


		  (SETQ NoteFileMenu (create MENU
						 ITEMS ← (QUOTE ((NewCards NIL 
		       "Create a new Text card (left button) or other card type (middle button).")
								    (ShowCards NIL 
							     "Bring up one of the special cards.")))
						 WHENSELECTEDFN ← (FUNCTION NILL)
						 CENTERFLG ← T
						 MENUBORDERSIZE ← 1
						 MENUOUTLINESIZE ← 2
						 MENUCOLUMNS ← 2
						 MENUFONT ← Font
						 TITLE ← (CONCAT (if (NC.ReadOnlyNoteFileP
									   NoteFile)
								       then "RO: "
								     else "")
								   (FILENAMEFIELD FullFileName
										    (QUOTE NAME))
								   ";"
								   (FILENAMEFIELD FullFileName
										    (QUOTE VERSION))
								   )
						 ITEMHEIGHT ← (IPLUS 6 (FONTPROP Font
										     (QUOTE HEIGHT))
								       )
						 ITEMWIDTH ← (IPLUS (STRINGWIDTH (QUOTE 
											 NewCards)
										     Font)
								      10)
						 MENUTITLEFONT ← TitleFont
						 MENUOFFSET ← (CONS 0 0]
         (for Item in (fetch (MENU ITEMS) of NoteFileMenu)
	    do (SHADEITEM Item NoteFileMenu (if (NC.NoteFileOpenP NoteFile)
						    then WHITESHADE
						  else GRAYSHADE)))
                                                             (* Shade NewCards if readonly notefile.)
         (if (NC.ReadOnlyNoteFileP NoteFile)
	     then (for Item in (fetch (MENU ITEMS) of NoteFileMenu)
		       when (EQ (CAR Item)
				    (QUOTE NewCards))
		       do (SHADEITEM Item NoteFileMenu GRAYSHADE)))
         [if (WINDOWP (SETQ NoteFileMenuWindow (WFROMMENU NoteFileMenu)))
	     then (FLASHWINDOW NoteFileMenuWindow)
	   else (SETQ NoteFileMenuWindow (ADDMENU NoteFileMenu NIL
							(if Position
							  elseif (GETMENUPROP NoteFileMenu
										  (QUOTE 
										      OldPosition))
							  else 
                                                             (* Prompt the user to place the new notefile menu)
								 (NC.PrintMsg InterestedWindow T 
							    "Please place the menu for notefile "
										FullFileName)
								 [SETQ Position
								   (GETBOXPOSITION
								     (fetch (REGION WIDTH)
									of (MENUREGION 
										     NoteFileMenu))
								     (fetch (REGION HEIGHT)
									of (MENUREGION 
										     NoteFileMenu]
								 (NC.ClearMsg InterestedWindow T)
								 Position]
         (WINDOWPROP NoteFileMenuWindow (QUOTE NoteFile)
		       NoteFile)
         (replace (NoteFile Menu) of NoteFile with NoteFileMenu)
         (PUTPROP FullFileName (QUOTE Menu)
		    NoteFileMenu)
         (WINDOWPROP NoteFileMenuWindow (QUOTE RESHAPEFN)
		       (QUOTE DON'T))
         (WINDOWPROP NoteFileMenuWindow (QUOTE BUTTONEVENTFN)
		       (FUNCTION NC.NoteFileIconButtonEventFn))
         (WINDOWPROP NoteFileMenuWindow (QUOTE SHRINKFN)
		       (QUOTE DON'T))
         (WINDOWPROP NoteFileMenuWindow (QUOTE SCROLLFN)
		       NIL)
         (WINDOWPROP NoteFileMenuWindow (QUOTE NOSCROLLBARS)
		       T)

          (* * Make sure default menu WhenSelectedFn is not called)


         (WINDOWPROP NoteFileMenuWindow (QUOTE CURSORINFN)
		       NIL)
         (WINDOWPROP NoteFileMenuWindow (QUOTE CURSOROUTFN)
		       NIL)
         (WINDOWPROP NoteFileMenuWindow (QUOTE CURSORMOVEDFN)
		       NIL)

          (* *)


         [WINDOWADDPROP NoteFileMenuWindow (QUOTE CLOSEFN)
			  (FUNCTION (LAMBDA (Window)
			      (PUTMENUPROP (CAR (WINDOWPROP Window (QUOTE MENU)))
					     (QUOTE OldPosition)
					     (WINDOWPOSITION Window]
         (NC.MoveWindowOntoScreen NoteFileMenuWindow)
     NoteFileMenuWindow])

(NC.ResetNoteFileInterface
  [LAMBDA (NoteFile)                                         (* pmi: " 1-May-87 16:05")

          (* * Close up the control menu for a NoteFile)



          (* * rht 5/1/86: Now does nothing if NC.NoteFileMenuLingerFlg is non-nil.)



          (* * rht 5/6/86: Now smashes WhenSelectedFn and shades menu items if NC.NoteFileMenuLingerFlg is non-nil.)



          (* * pmi 2/18/87: Now deletes "RO:" in title of NoteFile menu if NoteFile was open Read-only)



          (* * pmi 3/20/87: Removed WhenSelectedFn when overhauling to have NewCards and ShowCards middlebutton menus appear 
	  when buttoned DOWN, instead of after the button comes back up. Everything is now done in the ButtonEventFn.)



          (* * pmi 5/1/87: Inserted call to NC.ClearMsg before the NoteFile's icon is deleted. Added Window arg to DELETEMENU
	  call. Also commented out the code that deletes the NoteFile's menu and removes the NoteFile from its window if 
	  NC.NoteFileMenuLingerFlg is NIL. That way if the NoteFile is reopened, it will remember the position for its icon.)


    (DECLARE (GLOBALVARS NC.NoteFileMenuLingerFlg))
    (LET ((Menu (fetch (NoteFile Menu) of NoteFile))
	  Window FullFileName)
         (if Menu
	     then (SETQ Window (WFROMMENU Menu))
		    (if NC.NoteFileMenuLingerFlg
			then (for Item in (fetch (MENU ITEMS) of Menu)
				  do (SHADEITEM Item Menu GRAYSHADE))

          (* * (replace (MENU WHENSELECTEDFN) of Menu with (FUNCTION NC.ClosedNoteFileMenuWhenSelectedFn)))



          (* * No longer need a WHENSELECTEDFN)


			       (if (NC.ReadOnlyNoteFileP NoteFile)
				   then (SETQ FullFileName (fetch (NoteFile FullFileName)
								  of NoteFile))
					  [replace (MENU TITLE) of Menu
					     with (CONCAT (FILENAMEFIELD FullFileName
									       (QUOTE NAME))
							      ";"
							      (FILENAMEFIELD FullFileName
									       (QUOTE VERSION]
					  (replace (MENU IMAGE) of Menu with NIL) 
                                                             (* KLUDGE. Fetching the image height forces the menu 
							     package to recompute the menu image.)
					  (fetch (MENU IMAGEHEIGHT) of Menu)
					  (AND Window (REDISPLAYW Window)))
		      else (NC.ClearMsg Window T)        (* This code was removed so that if the NoteFile is 
							     reopened it will remember its position:)
                                                             (* (WINDOWPROP Window (QUOTE NoteFile) NIL))
                                                             (* (replace (NoteFile Menu) of NoteFile with NIL))
			     (WINDOWPROP Window (QUOTE CLOSEFN)
					   NIL)
			     (DELETEMENU Menu T Window])

(NC.NoteFileIconButtonEventFn
  [LAMBDA (Window)                                           (* pmi: " 3-Apr-87 16:07")

          (* * Bring up NoteFile Menues)



          (* * kirk 15Jul86 Adjusted title size check for change in font)



          (* * rht 11/23/86: Now calls NC.NoteFileIconMiddleButtonFn to put up a menu of middle button options.)



          (* * pmi 3/20/87: Overhauled to have NewCards and ShowCards middlebutton menus appear when buttoned DOWN, instead 
	  of after the button comes back up.)



          (* * pmi 4/3/87: Now unshades NewCards item during card creation to indicate that multiple cards may be created at 
	  the same time.)


    (LET (NoteFile Menu)
         (if (MOUSESTATE UP)
	   else (TOTOPW Window)
		  (LET [(Menu (CAR (WINDOWPROP Window (QUOTE MENU]
                                                             (* title bar)
		       (SETQ NoteFile (WINDOWPROP Window (QUOTE NoteFile)))
		       (for Item in (fetch (MENU ITEMS) of Menu)
			  when (INSIDEP (MENUITEMREGION Item Menu)
					    (LASTMOUSEX Window)
					    (LASTMOUSEY Window))
			  do (RESETLST
				 (RESETSAVE (SHADEITEM Item Menu GRAYSHADE)
					      (LIST (QUOTE SHADEITEM)
						      Item Menu (if (NULL (NC.NoteFileOpenP
										NoteFile))
								    then GRAYSHADE
								  elseif
								   (AND (EQ (CAR Item)
										(QUOTE NewCards))
									  (NC.ReadOnlyNoteFileP
									    NoteFile))
								    then GRAYSHADE
								  else WHITESHADE)))
				 (if (NULL (NC.NoteFileOpenP NoteFile))
				     then 

          (* * If the NoteFile is not open, just print a message and return)


					    (FLASHW Window)
					    (NC.PrintMsg Window T (fetch (NoteFile FullFileName)
								       of NoteFile)
							   " is not an open notefile.")
					    (DISMISS 1000)
					    (NC.ClearMsg Window T)
				   elseif (PROCESSP (NC.NoteFileProp NoteFile (QUOTE 
										ProcessInProgress)))
				     then 

          (* * This will probably be overhauled with Randy G.'s concurrancy fixes)


					    (NC.PrintOperationInProgressMsg Window (CAR Item)
									      (NC.NoteFileProp
										NoteFile
										(QUOTE 
									      OperationInProgress)))
					    NIL
				   else (SELECTQ (CAR Item)
						     (NewCards (if (NC.ReadOnlyNoteFileP NoteFile)
								   then (FLASHW Window)
									  (NC.PrintMsg Window T 
					       "Can't create a new card in a Read-Only notefile.")
									  (DISMISS 1000)
									  (NC.ClearMsg Window T)
								 elseif (LASTMOUSESTATE LEFT)
								   then 
                                                             (* For the left button, don't do anything until the 
							     button comes back up. Otherwise, things happen too 
							     soon.)
									  (UNTILMOUSESTATE UP)
									  (if (INSIDEP
										  (MENUITEMREGION
										    Item Menu)
										  (LASTMOUSEX
										    Window)
										  (LASTMOUSEY
										    Window))
									      then (SHADEITEM
										       Item Menu 
										       WHITESHADE)
										     (
										  NC.MakeNoteCard
										       
									       NC.DefaultCardType 
										       NoteFile))
								 else (SHADEITEM Item Menu 
										     WHITESHADE)
									(NC.MakeNoteCard NIL 
											 NoteFile)))
						     (ShowCards
						       (if (LASTMOUSESTATE LEFT)
							   then 
                                                             (* For the left button, don't do anything until the 
							     button comes back up. Otherwise, things happen too 
							     soon.)
								  (UNTILMOUSESTATE UP)
								  (if (INSIDEP (MENUITEMREGION
										     Item Menu)
										   (LASTMOUSEX
										     Window)
										   (LASTMOUSEY
										     Window))
								      then
								       (NC.EditNoteCard
									 (fetch (NoteFile 
									      TableOfContentsCard)
									    of NoteFile)))
							 else (NC.ChooseTopLevelCard NoteFile)))
						     NIL)))
			       (RETURN)
			  finally (if (LASTMOUSESTATE MIDDLE)
					then (NC.NoteFileIconMiddleButtonFn Window NoteFile)
				      elseif (NULL (WINDOWPROP Window (QUOTE BusyOperation)))
					then (RESETLST (RESETSAVE (WINDOWPROP Window
										      (QUOTE 
										    BusyOperation)
										      "Operation")
									(BQUOTE (WINDOWPROP
										    , Window 
										    BusyOperation NIL)
										  ))
							   (NC.NoteFileOperations NoteFile))
				      else (NC.PrintMsg NIL NIL (CHARACTER 13)
							    (WINDOWPROP Window (QUOTE 
										    BusyOperation))
							    " in progress.  Please wait."])

(NC.NoteFileOperations
  [LAMBDA (NoteFile)                                         (* Randy.Gobbel "12-Mar-87 17:51")
                                                             (* Ask user 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)



          (* * kef 8/6/86: Added SPAWN.MOUSE towards the end to eliminate the extraneous printing of "NoteFile Busy" which 
	  seemed to be constantly occurring for remote NoteFiles.)



          (* * pmi 12/4/86 Removed menu creation and shading of operations for open or closed NoteFile.
	  Now just uses appropriate pre-defined menu, depending on whether NoteFile is open or closed.)



          (* * rht 2/11/87: Now makes sure NC.OpenedNoteFileMenu and NC.ClosedNoteFileMenu are non-nil.)


    (DECLARE (GLOBALVARS NC.OpenedNoteFileMenu NC.ClosedNoteFileMenu))
    (if (OR (NULL NC.OpenedNoteFileMenu)
		(NULL NC.ClosedNoteFileMenu))
	then (NC.MakeNoteFileIconOperationsMenus))
    (LET (Menu)
         (if (NC.NoteFileOpenP NoteFile)
	     then (SETQ Menu NC.OpenedNoteFileMenu)
	   else (SETQ Menu NC.ClosedNoteFileMenu))
         (PUTMENUPROP Menu (QUOTE NoteFile)
			NoteFile)
         (ALLOW.BUTTON.EVENTS)
         (MENU Menu])

(NC.NoteFileIconMiddleButtonFn
  [LAMBDA (NoteFileIconWindow NoteFile)                      (* pmi: " 1-Apr-87 15:35")

          (* * Bring up the middle button menu for notefile icons.)



          (* * pmi 4/1/87: Disabled storing the middlebutton menu on the NoteFileIconWindow, so that it will always recompute
	  to handle changes in the menu font.)


    (DECLARE (GLOBALVARS NC.MenuFont NC.DefaultNoteFileIconMiddleButtonItems))
    (LET (Menu)

          (* * (OR (SETQ Menu (WINDOWPROP NoteFileIconWindow (QUOTE NoteFileMiddleButtonMenu))) (WINDOWPROP 
	  NoteFileIconWindow (QUOTE NoteFileMiddleButtonMenu) (SETQ Menu (create MENU ITEMS ← (APPEND 
	  NC.DefaultNoteFileIconMiddleButtonItems (NC.NoteFileProp NoteFile (QUOTE NoteFileIconMiddleButtonItems))) 
	  CHANGEOFFSETFLG ← (QUOTE Y) MENUOFFSET ← (CONS -1 0) CENTERFLG ← NIL MENUTITLEFONT ← NC.MenuFont MENUFONT ← 
	  NC.MenuFont ITEMHEIGHT ← (ADD1 (FONTPROP NC.MenuFont (QUOTE HEIGHT))) WHENSELECTEDFN ← (FUNCTION 
	  (LAMBDA (Item Menu Button) (APPLY* (CADR Item) (GETMENUPROP Menu (QUOTE NoteFile)) Item))))))))


         [SETQ Menu (create MENU
				ITEMS ← (APPEND NC.DefaultNoteFileIconMiddleButtonItems
						  (NC.NoteFileProp NoteFile (QUOTE 
								    NoteFileIconMiddleButtonItems)))
				CHANGEOFFSETFLG ← (QUOTE Y)
				MENUOFFSET ← (CONS -1 0)
				CENTERFLG ← NIL
				MENUFONT ← NC.MenuFont
				ITEMHEIGHT ← (ADD1 (FONTPROP NC.MenuFont (QUOTE HEIGHT)))
				WHENSELECTEDFN ← (FUNCTION (LAMBDA (Item Menu Button)
				    (APPLY* (CADR Item)
					      (GETMENUPROP Menu (QUOTE NoteFile))
					      Item]
         (PUTMENUPROP Menu (QUOTE NoteFile)
			NoteFile)
         (SPAWN.MOUSE)
         (MENU Menu])

(NC.PopUpNoteFileName
  [LAMBDA (NoteFile Item)                                    (* pmi: " 1-Apr-87 17:14")

          (* * Popup the notefile's full name. Use menu stashed on NoteFileIconWindow if any.)



          (* * pmi 4/1/87: Added NC.MenuFont to all menus. Also disabled storing the filename menu on the NoteFileIconWindow,
	  so that it will always recompute to handle changes in the menu font.)


    (DECLARE (GLOBALVARS NC.MenuFont))
    (LET [(NoteFileIconWindow (WFROMMENU (fetch (NoteFile Menu) of NoteFile]

          (* * (MENU (OR (WINDOWPROP NoteFileIconWindow (QUOTE NameMenu)) (LET ((Menu (create MENU ITEMS ← 
	  (LIST (LIST (fetch (NoteFile FullFileName) of NoteFile) NIL (fetch (NoteFile FullFileName) of NoteFile))) TITLE ← 
	  NIL MENUFONT ← NC.MenuFont))) (WINDOWPROP NoteFileIconWindow (QUOTE NameMenu) Menu) Menu))))


         (MENU (create MENU
			   ITEMS ← (LIST (LIST (fetch (NoteFile FullFileName) of NoteFile)
						   NIL
						   (fetch (NoteFile FullFileName) of NoteFile)))
			   TITLE ← NIL
			   MENUFONT ← NC.MenuFont
			   ITEMHEIGHT ← (PLUS (FONTPROP NC.MenuFont (QUOTE HEIGHT))
						2])
)

(RPAQQ NC.DefaultNoteFileIconMiddleButtonItems ((Full% File% Name NC.PopUpNoteFileName 
						       "Display full file name of this notefile.")))
(* * Show NoteFile Indicators)

(DEFINEQ

(NC.ShowNoteFiles
  (LAMBDA (OffFlg)                                           (* kirk: "28-May-86 14:41")

          (* * Attach a NoteFile indicator to all Cards on the screen. Detach if OffFlg is true.)


    (for window in (OPENWINDOWS) do (NC.AttachNoteFileName window OffFlg))))

(NC.AttachNoteFileName
  [LAMBDA (CardWindow OffFlg)                                (* rht: "25-Mar-87 14:46")

          (* * Attach an indicator of the NoteFile for this Card to the Card)



          (* * fgh 5/29/86 Changed collection of old attached windows to prevent NILs in collection result.)



          (* * fgh 6/13/86 Put detachment and reattachment of previous attached windows into a RESETLST.
	  Added FREEATTACHEDWINDOW as the CLOSEFN of the indicator window. Added code to reset PASSTOMAINWINDOW COMS of the 
	  previously attachwed windows. Changed MINSIZE of indicator window to allow small fonts. Added a REPAINTFN to the 
	  indicator window.)



          (* * fgh 7/2/86 Replaced the CLEARW call in the indicator window REPAINTFN with a DSPRESET for two reasons: reset 
	  the X coor befre printining and CLEARW is not allowed in REPAINTFNS.)



          (* * fgh&rht 7/5/86: Changed the name "FileName" to "NameToPrint".)



          (* * rht 3/20/87: Moved Frank's hack that temporarily detaches windows into a macro called 
	  NC.WithWindowsUnattached.)



          (* * rht 3/25/87: Now calls NC.NoteFileIndicatorWinHeight.)


    (LET ((Card (NC.CardFromWindow CardWindow))
	  AttachedWindows FileName Window)
         (if (NC.CardP Card)
	     then (SETQ AttachedWindows (ATTACHEDWINDOWS CardWindow))
		    (if OffFlg
			then [CLOSEW (for window in AttachedWindows
					    thereis (WINDOWPROP window (QUOTE NoteFileIndicator]
			       (REPOSITIONATTACHEDWINDOWS CardWindow)
		      else (TOTOPW CardWindow)
			     (if [SETQ Window (for window in AttachedWindows
						     thereis (WINDOWPROP window (QUOTE 
										NoteFileIndicator]
				 then 

          (* * There already is an indicator window, open and redisplay it.)


					(OR (OPENWP Window)
					      (OPENW Window))
					(REDISPLAYW Window)
			       else 

          (* * No existing indicator window, make one.)


				      (NC.WithTopWindowsUnattached
					CardWindow

          (* * Make the indicator window.)


					(LET (NoteFile NameToPrint YSize IndicatorWindow)
					     (SETQ NoteFile (fetch (Card NoteFile) of Card))
					     (SETQ NameToPrint (NC.MakeNoteFileNameIndicator
						 NoteFile))
					     (SETQ YSize (NC.NoteFileIndicatorWinHeight))
					     (SETQ IndicatorWindow
					       (CREATEW (CREATEREGION 0 0 100 YSize)
							  NIL T))
					     (WINDOWPROP IndicatorWindow (QUOTE MAXSIZE)
							   (CONS 1000 YSize))
					     (WINDOWPROP IndicatorWindow (QUOTE MINSIZE)
							   (CONS 20 YSize))
					     (ATTACHWINDOW IndicatorWindow CardWindow (QUOTE
							       TOP)
							     (QUOTE JUSTIFY)
							     (QUOTE LOCALCLOSE))
					     [WINDOWPROP IndicatorWindow (QUOTE BUTTONEVENTFN)
							   (FUNCTION (LAMBDA (window)
							       (INVERTW window)
							       [NC.SetUpNoteFileInterface
								 (fetch (Card NoteFile)
								    of (NC.CardFromWindow
									   (MAINWINDOW window]
							       (INVERTW window]
					     (WINDOWPROP IndicatorWindow (QUOTE NameToPrint)
							   NameToPrint)
					     (WINDOWADDPROP IndicatorWindow (QUOTE CLOSEFN)
							      (FUNCTION FREEATTACHEDWINDOW)
							      T)
					     [WINDOWPROP IndicatorWindow (QUOTE REPAINTFN)
							   (FUNCTION (LAMBDA (Window Region)
							       (DSPRESET Window)
							       (PRIN1 (WINDOWPROP Window
										      (QUOTE 
										      NameToPrint))
									Window]
					     (DSPFONT NC.NoteFileIndicatorFont IndicatorWindow)
					     (PRIN1 NameToPrint IndicatorWindow)
					     (OPENW IndicatorWindow)
					     (WINDOWPROP IndicatorWindow (QUOTE NoteFileIndicator)
							   (QUOTE Showing])

(NC.MakeNoteFileNameIndicator
  (LAMBDA (NoteFile)                                         (* rht: " 5-Jul-86 16:25")

          (* * fgh&rht 7/5/86: Cleaned up and added check for readonly notefile.)


    (LET ((FullFileName (fetch (NoteFile FullFileName) of NoteFile)))
         (CONCAT (if (NC.ReadOnlyNoteFileP NoteFile)
		       then "RO: "
		     else "")
		   (FILENAMEFIELD FullFileName (QUOTE NAME))
		   ";"
		   (FILENAMEFIELD FullFileName (QUOTE VERSION))
		   " " FullFileName))))

(NC.NoteFileIndicatorWinHeight
  [LAMBDA NIL                                                (* rht: "25-Mar-87 15:11")

          (* * Return the height required by the NoteFile indicator attached window.)


    (DECLARE (GLOBALVARS NC.NoteFileIndicatorFont))
    (HEIGHTIFWINDOW (OR (FONTPROP NC.NoteFileIndicatorFont (QUOTE HEIGHT))
			    20])
)
(* * File Browser)

(DECLARE: DOEVAL@COMPILE DONTCOPY

(GLOBALVARS NC.FileBrowserMenuItemsToRemove NC.FileBrowserMenuItemsToAdd NC.FileBrowserMenuItems 
	    NC.FileBrowserPatterns NC.FileBrowserDefaultPatterns)
)

(RPAQQ NC.FileBrowserMenuItemsToRemove (Hardcopy See Edit Load Compile Copy Rename Expunge))

(RPAQQ NC.FileBrowserMenuItemsToKeep (Delete Undelete Recompute Sort))

(RPAQQ NC.FileBrowserMenuItemsToAdd ((Open NC.FileBrowserOpen "Open selected Notefiles."
					     (SUBITEMS (Read-only% Open (NC.FileBrowserOpen INPUT)
									
							 "Open selected Notefiles for read-only.")))
				       (Checkpoint NC.FileBrowserCheckpoint 
					 "Checkpoint the selected Notefiles, saving dirty cards.")
				       (Close NC.FileBrowserClose "Close selected Notefiles.")
				       (Abort NC.FileBrowserAbort 
			       "Aborts the selected Notefiles losing work since last checkpoint.")
				       (Compact NC.FileBrowserCompact 
					      "Compacts selected Notefiles copying to new files."
						(SUBITEMS (Compact% To% New% File 
									    NC.FileBrowserCompact 
					      "Compacts selected Notefiles copying to new files.")
							  (Compact% In% Place (NC.FileBrowserCompact
										(QUOTE InPlace))
									      
					   "Compacts selected Notefiles w/o copyig to new files.")))
				       (Inspect&Repair NC.FileBrowserInspect&Repair 
					    "Inspects and optionally repairs selected Notefiles."
						       (SUBITEMS (Read% Substances
								   (NC.FileBrowserInspect&Repair
								     (QUOTE ReadSubstances))
								   
"Inspects and optionally repairs selected Notefiles, but reads every substance.  This slows things WAY down."
								   )))
				       (Copy FB.COPYCOMMAND 
					"Copies given notefile(s) to target file (or directory).")
				       (Rename FB.RENAMECOMMAND 
					 "Moves given notefile(s) to target file (or directory).")))

(RPAQQ NC.FileBrowserExpungeMenuItem (Expunge NC.FileBrowserExpunge 
			 "Permanently removes from the file system all files marked for deletion"))

(RPAQQ NC.FileBrowserRecomputeMenuItem (Recompute FB.UPDATECOMMAND 
				       "Recomputes set of notefiles satisfying selection pattern"
						    (SUBITEMS ("Same Pattern" FB.UPDATECOMMAND 
					     "Recomputes set of files satisfying current pattern")
							      ("New Pattern" 
							    NC.FileBrowserRecomputeWithNewPattern 
					"Prompts for a new selection pattern and updates browser")
							      ("New Info" FB.NEWINFOCOMMAND 
					   "Change the set of file attributes that are displayed"))))
(* * Build the menu items for notecards file browser.)


(RPAQ NC.FileBrowserMenuItems (APPEND NC.FileBrowserMenuItemsToAdd
					(for MenuItem in FB.MENU.ITEMS when (FMEMB (CAR MenuItem)
										   
								    NC.FileBrowserMenuItemsToKeep)
					     collect
					     (if (EQ (CAR MenuItem)
						     (QUOTE Recompute))
						 then NC.FileBrowserRecomputeMenuItem else MenuItem))
					(LIST NC.FileBrowserExpungeMenuItem)
					(for MenuItem in FB.MENU.ITEMS unless
					     (OR (FMEMB (CAR MenuItem)
							NC.FileBrowserMenuItemsToRemove)
						 (FMEMB (CAR MenuItem)
							NC.FileBrowserMenuItemsToKeep))
					     collect MenuItem)))

(RPAQ? NC.FileBrowserPatterns NIL)

(RPAQ? NC.FileBrowserDefaultPatterns (QUOTE ({DSK}*.NOTEFILE;*)))
(* * Functions called from file browser menu.)

(DEFINEQ

(NC.FileBrowserOpen
  [LAMBDA (Browser Key Item Menu Access)                     (* pmi: "20-May-87 18:22")

          (* * Function called from file browser menu for notefile open.)



          (* * rht 7/4/86: Added Access arg.)



          (* * rht 3/14/87: Changed to call NC.OpenNoteFile.)



          (* * pmi 5/20/87: Removed HashArray argument in calls to NC.OpenNoteFile.)


    (for FileObject in (FB.SELECTEDFILES Browser) bind FileName
       do (NC.OpenNoteFile [SETQ FileName (U-CASE (MKATOM (FB.FETCHFILENAME FileObject]
			       NIL NIL NIL NIL NIL NIL NIL (if (NOT (NC.NoteFileFromFileName
									  FileName))
							       then (fetch (FILEBROWSER 
										     PROMPTWINDOW)
									 of Browser))
			       NIL NIL NIL Access])

(NC.FileBrowserClose
  (LAMBDA (Browser Key Item Menu)                            (* rht: " 2-Jul-86 18:47")

          (* * Function called from file browser menu for notefile close.)



          (* * rht 7/2/86: Now passes proper InterestedWindow to NC.CloseDatabaseFile. Also calls FB.PROMPTWPRINT instead of 
	  NC.PrintMsg.)


    (for FileObject in (FB.SELECTEDFILES Browser)
       do (LET* ((FileName (MKATOM (FB.FETCHFILENAME FileObject)))
		   (NoteFile (NC.NoteFileFromFileName FileName)))
	          (if (type? NoteFile NoteFile)
		      then (NC.CloseDatabaseFile NoteFile (fetch (FILEBROWSER PROMPTWINDOW)
								 of Browser))
		    else (FB.PROMPTWPRINT Browser T FileName " is not an open NoteFile!!!"))))))

(NC.FileBrowserCheckpoint
  [LAMBDA (Browser Key Item Menu)                            (* Randy.Gobbel " 4-Mar-87 16:13")

          (* * Function called from file browser menu for notefile checkpoint.)



          (* * rht 7/2/86: Now passes InterestedWindow arg to NC.CheckpointDatabase.)


    (for FileObject in (FB.SELECTEDFILES Browser)
       do (LET* ((FileName (MKATOM (FB.FETCHFILENAME FileObject)))
		   (NoteFile (NC.NoteFileFromFileName FileName)))
	          (if (type? NoteFile NoteFile)
		      then (NC.CheckpointDatabase NoteFile NIL NIL (fetch (FILEBROWSER 
										     PROMPTWINDOW)
									  of Browser))
		    else (NC.PrintMsg NIL NIL FileName " is not an open NoteFile!!!"
					  (CHARACTER 13])

(NC.FileBrowserAbort
  (LAMBDA (Browser Key Item Menu)                            (* rht: " 2-Jul-86 19:05")

          (* * Function called from file browser menu for notefile abort.)



          (* * rht 7/2/86: Now passes InterestedWindow arg to NC.AbortSession)


    (for FileObject in (FB.SELECTEDFILES Browser)
       do (LET* ((FileName (MKATOM (FB.FETCHFILENAME FileObject)))
		   (NoteFile (NC.NoteFileFromFileName FileName)))
	          (if (type? NoteFile NoteFile)
		      then (NC.AbortSession NoteFile (fetch (FILEBROWSER PROMPTWINDOW)
							    of Browser))
		    else (FB.PROMPTWPRINT Browser T FileName " is not an open NoteFile!!!"))))))

(NC.FileBrowserCompact
  (LAMBDA (Browser Key Item Menu InPlaceFlg)                 (* rht: " 2-Jul-86 18:09")

          (* * Function called from file browser menu for notefile compact.)



          (* * rht 7/2/86: Overhauled. Some code stolen from FB.COPY/RENAME.COMMAND. Much code stolen from 
	  FB.COPY/RENAME.MANY)


    (LET ((FILELIST (FB.SELECTEDFILES Browser)))
         (COND
	   ((NULL FILELIST))
	   ((NULL (CDR FILELIST))                        (* Just one file)
	     (NC.CompactNoteFile (MKATOM (FB.FETCHFILENAME (CAR FILELIST)))
				   NIL InPlaceFlg (fetch (FILEBROWSER PROMPTWINDOW) of Browser))
	     )
	   (T                                                (* Many files to compact. Use code from 
							     FB.COPY/RENAME.MANY with call to FB.COPY/RENAME.ONE 
							     replaced by NC.CompactnoteFile.)
	     (PROG (PREFIX FIELDS SUBDIR RETAIN)
		     (COND
		       ((NULL (SETQ PREFIX (FB.PROMPTFORINPUT (CONCAT "Compact "
									      (LENGTH FILELIST)
									      
								    " files to which directory? ")
								    (OR (fetch (FILEBROWSER
										     DEFAULTDIR)
									     of Browser)
									  (DIRECTORYNAME T))
								    Browser T)))
                                                             (* Aborted)
			 )
		       ((STRPOS "*" PREFIX)
			 (FB.PROMPTWPRINT Browser "Sorry, patterns not supported"))
		       ((AND (OR (LISTGET (SETQ FIELDS (UNPACKFILENAME.STRING PREFIX))
						(QUOTE HOST))
				     (LISTGET FIELDS (QUOTE DIRECTORY))
				     (LISTGET FIELDS (QUOTE DEVICE)))
			       (OR (LISTGET FIELDS (QUOTE NAME))
				     (LISTGET FIELDS (QUOTE EXTENSION))
				     (LISTGET FIELDS (QUOTE VERSION))))
                                                             (* Not a pure directory specification, and not just a 
							     simple directory name)
			 (FB.PROMPTWPRINT Browser "Not a well-formed directory specification."))
		       (T
			 (replace (FILEBROWSER DEFAULTDIR) of Browser
			    with (PACKFILENAME.STRING (QUOTE BODY)
							  FIELDS
							  (QUOTE DIRECTORY)
							  (DIRECTORYNAME T)))
                                                             (* Now make sure the files are sorted by increasing 
							     version, so that multiple versions get copied in the 
							     right order)
			 (SETQ SUBDIR (fetch (FBFILEDATA SUBDIRECTORY)
					   of (fetch TIDATA of (CAR FILELIST))))
			 (COND
			   ((for ITEM in (CDR FILELIST)
			       thereis (NOT (STRING-EQUAL SUBDIR (fetch (FBFILEDATA 
										     SUBDIRECTORY)
									  of (fetch TIDATA
										  of ITEM)))))
			     (FB.PROMPTWPRINT Browser 
						"Selected files are in multiple subdirectories")
			     (SETQ RETAIN
			       (FB.PROMPTFORINPUT
				 (CONCAT "Retain subdirectory names below level of "
					   (for ITEM in (CDR FILELIST)
					      do (SETQ SUBDIR
						     (FB.GREATEST.PREFIX SUBDIR
									 (fetch (FBFILEDATA 
										     SUBDIRECTORY)
									    of (fetch TIDATA
										    of ITEM))))
					      finally (RETURN
							  (OR SUBDIR (SETQ SUBDIR
								  (SUBSTRING (fetch (FILEBROWSER
											  PATTERN)
										  of Browser)
									       1
									       (fetch (FILEBROWSER
											  NAMESTART)
										  of Browser))))))
					   "?")
				 "Yes" Browser T T))
			     (SETQ RETAIN (COND
				 ((NULL RETAIN)            (* Aborted)
				   (RETURN))
				 ((OR (STRING-EQUAL RETAIN "YES")
					(STRING-EQUAL RETAIN "Y"))
				   (SETQ SUBDIR (ADD1 (NCHARS SUBDIR)))
                                                             (* First character that changes)
				   T)
				 ((OR (STRING-EQUAL RETAIN "NO")
					(STRING-EQUAL RETAIN "N"))
				   NIL)
				 (T (FB.PROMPTWPRINT Browser "?? ...Aborted.")
				    (RETURN))))))
			 (SELECTQ (fetch (FILEBROWSER SORTBY) of Browser)
				    (FB.NAMES.INCREASING.VERSION 
                                                             (* Okay))
				    (FB.NAMES.DECREASING.VERSION (SETQ FILELIST
								     (FB.SORT.VERSIONS
								       FILELIST
								       (FUNCTION 
									 FB.INCREASING.VERSION))))
				    (SORT FILELIST (FUNCTION FB.NAMES.INCREASING.VERSION)))
			 (SETQ PREFIX (\ADD.CONNECTED.DIR PREFIX))
			 (for ITEM in FILELIST
			    do
			     (LET ((OLDNAME (FB.FETCHFILENAME ITEM)))
			          (NC.CompactNoteFile
				    (MKATOM OLDNAME)
				    (MKATOM (PACKFILENAME.STRING
						(QUOTE DIRECTORY)
						PREFIX
						(QUOTE DIRECTORY)
						(COND
						  (RETAIN    (* Subdirectory of name between common prefix and 
							     root)
							  (SUBSTRING OLDNAME SUBDIR
								       (SUB1 (fetch (FBFILEDATA
											  STARTOFNAME)
										  of (fetch
											 TIDATA
											  of ITEM)))
								       )))
						(QUOTE VERSION)
						NIL
						(QUOTE BODY)
						OLDNAME))
				    InPlaceFlg
				    (fetch (FILEBROWSER PROMPTWINDOW) of Browser))))))))))))

(NC.FileBrowserInspect&Repair
  (LAMBDA (Browser Key Item Menu ReadSubstancesFlg)          (* rht: "17-Jul-86 11:50")

          (* * Function called from file browser menu for notefile inspect&repair.)



          (* * rht 7/1/86: Now passes InterestedWindow arg to NC.ScavengerPhase1.)



          (* * rht 7/17/86: Now calls NC.InspectAndRepairNoteFile instead of NC.ScavengerPhase1.)


    (for FileObject in (FB.SELECTEDFILES Browser) do (NC.InspectAndRepairNoteFile
							       (MKATOM (FB.FETCHFILENAME 
										       FileObject))
							       ReadSubstancesFlg
							       (fetch (FILEBROWSER PROMPTWINDOW)
								  of Browser)))))

(NC.FileBrowserExpunge
  (LAMBDA (FBROWSER KEY ITEM MENU CMD)                       (* rht: " 2-Jul-86 18:20")

          (* * Code stolen from FB.EXPUNGECOMMAND. Replaced call to DELFILE with call to NC.DeleteDatabaseFile.)


    (PROG ((TBROWSER (fetch (FILEBROWSER TABLEBROWSER) of FBROWSER))
	     (NDELETED 0)
	     FILES FILENAME FAILED FILE)
	    (COND
	      ((SETQ FILES (TB.COLLECT.ITEMS TBROWSER (QUOTE DELETED)))
		(FB.PROMPTWPRINT FBROWSER T "Expunging deleted files...")
		(for ITEM in FILES do (COND
					      ((NC.DeleteDatabaseFile (SETQ FILENAME
									  (FB.FETCHFILENAME ITEM))
									(fetch (FILEBROWSER
										   PROMPTWINDOW)
									   of FBROWSER)
									T)
						(add NDELETED 1)
						(FB.REMOVE.FILE TBROWSER FBROWSER ITEM)
						(FB.UPDATE.COUNTERS FBROWSER (QUOTE BOTH)))
					      (T (FB.PROMPTWPRINT FBROWSER T "Couldn't expunge " 
								    FILENAME)
						 (SETQ FAILED T))))
		(FB.PROMPTWPRINT FBROWSER (COND
				     ((EQ NDELETED 0)
				       "
No")
				     (T (CONCAT (COND
						    (FAILED "
Done, but only ")
						    (T "done, "))
						  NDELETED)))
				   " files expunged.")
		(COND
		  (FAILED (COND
			    (CMD (FB.PROMPTWPRINT FBROWSER "  " CMD " aborted.")))
			  (RETURN))))
	      (T (FB.PROMPTWPRINT FBROWSER T "No files were marked for deletion")))
	    (RETURN T))))

(NC.GetFileBrowserPattern
  (LAMBDA (MainWindow OldPattern)                            (* rht: " 2-Jul-86 22:34")

          (* * Ask user to provide a new file browser pattern. Cancel if user provides an extension. Else, add .notefile 
	  extension.)


    (LET* ((Pattern (NC.AskUser "New pattern? " NIL OldPattern T MainWindow T T))
	   (PatternPlusExtension (AND Pattern (PACKFILENAME (QUOTE BODY)
								Pattern
								(QUOTE EXTENSION)
								(QUOTE NOTEFILE)
								(QUOTE VERSION)
								(QUOTE *)
								(QUOTE NAME)
								(QUOTE *)))))
          (PROG1 (if (EQ (U-CASE (FILENAMEFIELD PatternPlusExtension (QUOTE EXTENSION)))
			       (QUOTE NOTEFILE))
		       then (SETQ NC.FileBrowserPatterns (UNION NC.FileBrowserPatterns
								      (LIST PatternPlusExtension)))
			      PatternPlusExtension
		     else (NC.PrintMsg MainWindow T "Pattern must have either" (CHARACTER
					     13)
					   ".NOTEFILE extension or no extension.")
			    (DISMISS 1000)
			    NIL)
		   (NC.ClearMsg MainWindow T)))))

(NC.FileBrowserRecomputeWithNewPattern
  (LAMBDA (BROWSER)                                          (* rht: " 2-Jul-86 15:04")

          (* * Code basically stolen from FB.NEWPATTERNCOMMAND and FB.GET.NEWPATTERN. Just changed to call 
	  NC.GetFileBrowserPattern.)


    (LET (PATTERN)
         (COND
	   ((AND (FB.MAYBE.EXPUNGE BROWSER "New Pattern")
		   (SETQ PATTERN (LET* ((OLDPATTERN (fetch (FILEBROWSER PATTERN) of BROWSER))
					  (NEWPATTERN (NC.GetFileBrowserPattern
							(fetch (FILEBROWSER PROMPTWINDOW)
							   of BROWSER)
							OLDPATTERN)))
				         (COND
					   (NEWPATTERN (DIRECTORY.FILL.PATTERN NEWPATTERN))))))
	     (FB.SETNEWPATTERN BROWSER PATTERN)
	     (FB.UPDATEBROWSERITEMS BROWSER))))))

(NC.FindFileBrowserWinForPattern
  [LAMBDA (Pattern NoteCardsIconWindow)                      (* Randy.Gobbel " 5-Nov-86 16:14")

          (* * Look for a notefile file browser having given pattern.)


    (bind FileBrowser for Win in (WINDOWPROP NoteCardsIconWindow (QUOTE FileBrowserWins))
       when [AND (WINDOWP Win)
		     [OR (OPENWP Win)
			   (OPENWP (WINDOWPROP Win (QUOTE ICONWINDOW]
		     (SETQ FileBrowser (WINDOWPROP (OR (WINDOWPROP Win (QUOTE ICONFOR))
							     Win)
						       (QUOTE FILEBROWSER)))
		     (EQ (U-CASE Pattern)
			   (U-CASE (MKATOM (fetch (FILEBROWSER PATTERN) of FileBrowser]
       do (RETURN Win])
)
(DEFINEQ

(NC.FlashFileBrowserWin
  (LAMBDA (Pattern NoteCardsIconWindow)                      (* rht: " 2-Jul-86 16:07")

          (* * Return the file browser window if any, corresponding to given pattern. Expand if shrunken and flash.)



          (* * rht 5/2/86: Now will reexpand shrunken notefile browser but won't recover window if it's been closed.
	  Closing window screws up filebrowser.)



          (* * rht 7/2/86: Changed to call NC.FindFileBrowserWinForPattern.)


    (LET ((FileBrowserWin (NC.FindFileBrowserWinForPattern Pattern NoteCardsIconWindow))
	  IconWin)
         (if (AND FileBrowserWin (OPENWP (SETQ IconWin (WINDOWPROP FileBrowserWin
									     (QUOTE ICONWINDOW)))))
	     then (EXPANDW IconWin))
         (if (AND FileBrowserWin (OPENWP FileBrowserWin))
	     then (FLASHW FileBrowserWin)
		    FileBrowserWin
	   else NIL))))
)
(PUTPROPS NCINTERFACE COPYRIGHT ("Xerox Corporation" 1984 1985 1986 1987))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (22100 43072 (NoteCards 22110 . 22460) (NC.MakeMainMenu 22462 . 30175) (NC.LogoutAdvice 
30177 . 31463) (NC.AttachPromptWindow 31465 . 32547) (NC.AttachPromptWindowOffScreen 32549 . 33190) (
NC.GETPROMPTWINDOW 33192 . 42066) (NC.MaxPromptWindowWidth 42068 . 43070)) (43243 67803 (
NC.AskLinkLabel 43253 . 48217) (NC.AskNoteCardType 48219 . 50436) (NC.ChooseTopLevelCard 50438 . 52783
) (NC.RemoveSketchMenuItems 52785 . 53586) (NC.SelectionMenusWhenSelectedFn 53588 . 55200) (
NC.InstallTitleBarButtonEventFn 55202 . 55642) (NC.InstallTitleBarLeftMenu 55644 . 56272) (
NC.InstallCopyButtonEventFn 56274 . 56747) (NC.NoteFileTitleLeftWhenSelectedFn 56749 . 59863) (
NC.MakeNoteFileIconOperationsMenus 59865 . 62280) (NC.ResetCachedMenus 62282 . 62708) (
NC.CreateMenuBitmaps 62710 . 66136) (NC.GetNoteFileMenu 66138 . 66937) (NC.SetNoteFileMenu 66939 . 
67801)) (67876 88933 (NC.SelectNoteCards 67886 . 84857) (NC.SelectNoteCardsCopyInsertFn 84859 . 86610)
 (NC.CopyButtonEventFn 86612 . 88502) (NC.CardImageObjP 88504 . 88692) (NC.MakeCardImageObject 88694
 . 88931)) (104664 114635 (NC.NoteCardsWindowP 104674 . 104975) (NC.NoteCardsIconWindowP 104977 . 
105251) (NC.MakeNoteCardsIcon 105253 . 105742) (NC.BringUpNoteCardsIcon 105744 . 106549) (
NC.NoteCardsIconAfterMoveFn 106551 . 107066) (NC.FileBrowserMenu 107068 . 109421) (
NC.ListOfNoteFilesMenu 109423 . 113306) (NC.CheckpointSession 113308 . 113857) (NC.CloseSession 113859
 . 114633)) (125652 146193 (NC.RedisplayNoteCardsIconWindow 125662 . 126612) (
NC.NoteCardsIconButtonEventFn 126614 . 128933) (NC.DoNoteFileOp 128935 . 137018) (
NC.NoteCardsIconCursorEventFn 137020 . 137684) (NC.NoteCardsIconFn 137686 . 138086) (
NC.ResetNoteCardsIcon 138088 . 138838) (NC.MakeNewStyleNoteCardsIcon 138840 . 142188) (
NC.MakeOldStyleNoteCardsIcon 142190 . 146191)) (146245 155883 (NC.CloseNoteCards 146255 . 148210) (
NC.CopyStructure 148212 . 150767) (NC.CloseStructure 150769 . 152656) (NC.DeleteStructure 152658 . 
154691) (NC.MoveStructure 154693 . 155881)) (155963 176858 (NC.NoteFileMenuWindowP 155973 . 156243) (
NC.SetUpNoteFileInterface 156245 . 163725) (NC.ResetNoteFileInterface 163727 . 166653) (
NC.NoteFileIconButtonEventFn 166655 . 171752) (NC.NoteFileOperations 171754 . 173807) (
NC.NoteFileIconMiddleButtonFn 173809 . 175622) (NC.PopUpNoteFileName 175624 . 176856)) (177048 182325 
(NC.ShowNoteFiles 177058 . 177374) (NC.AttachNoteFileName 177376 . 181387) (
NC.MakeNoteFileNameIndicator 181389 . 181939) (NC.NoteFileIndicatorWinHeight 181941 . 182323)) (185705
 199361 (NC.FileBrowserOpen 185715 . 186562) (NC.FileBrowserClose 186564 . 187373) (
NC.FileBrowserCheckpoint 187375 . 188183) (NC.FileBrowserAbort 188185 . 188923) (NC.FileBrowserCompact
 188925 . 194427) (NC.FileBrowserInspect&Repair 194429 . 195139) (NC.FileBrowserExpunge 195141 . 
196634) (NC.GetFileBrowserPattern 196636 . 197789) (NC.FileBrowserRecomputeWithNewPattern 197791 . 
198592) (NC.FindFileBrowserWinForPattern 198594 . 199359)) (199362 200312 (NC.FlashFileBrowserWin 
199372 . 200310)))))
STOP