(FILECREATED " 8-Jun-86 00:53:41" {QV}<NOTECARDS>1.3K>FGHPATCH068.;1 7115   

      changes to:  (VARS FGHPATCH068COMS)
		   (FNS NC.ListOfNoteFilesMenu NC.CommandMenu NC.NoteFileOpenP))


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

(PRETTYCOMPRINT FGHPATCH068COMS)

(RPAQQ FGHPATCH068COMS ((* * Fix to bug %# 99 -- Open from NF list busted wrt lingering NF menus)
			  (FNS NC.ListOfNoteFilesMenu NC.CommandMenu)
			  (* * New FN for NCDATABASE)
			  (FNS NC.NoteFileOpenP)))
(* * Fix to bug %# 99 -- Open from NF list busted wrt lingering NF menus)

(DEFINEQ

(NC.ListOfNoteFilesMenu
  (LAMBDA (InterestedWindow)                                 (* fgh: " 8-Jun-86 00:37")

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


    (LET (Menu Selection NoteFileMenu FileName)
         (SETQ Menu
	   (create
	     MENU
	     ITEMS ←(BQUOTE
	       (,@(for NoteFile in (NC.ListOfNoteFiles) bind Stream FileName
		     collect (LIST (CONCAT (if (AND (STREAMP (SETQ Stream
									   (fetch (NoteFile Stream)
									      of NoteFile)))
							      (OPENP Stream))
						     then (if (WINDOWP
								    (WFROMMENU (fetch
										   (NoteFile Menu)
										    of NoteFile)))
								then "*"
							      else "$")
						   else "  ")
						 (FILENAMEFIELD (SETQ FileName
								    (fetch (NoteFile FullFileName)
								       of NoteFile))
								  (QUOTE NAME)))
				       NoteFile
				       (CONCAT "Open NoteFile " FileName " or bring up its menu.")))
		 ("-- Open new NoteFile --" (QUOTE OPEN)
					    "Open a new notefile - you'll be prompted for the name."
					    (SUBITEMS ("Create but don't open" (QUOTE CREATE)
									       
						      "Create a new notefile, but don't open it.")))))
	     ))
         (SELECTQ (SETQ Selection (MENU Menu))
		    (NIL NIL)
		    (OPEN (NC.OpenDatabaseFile NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL 
						 InterestedWindow))
		    (CREATE (NC.CreateDatabaseFile))
		    (if (type? NoteFile Selection)
			then (COND
				 ((AND (type? MENU (SETQ NoteFileMenu (fetch (NoteFile Menu)
									       of Selection)))
					 (NC.NoteFileOpenP Selection))
				   (NC.SetUpNoteFileInterface Selection))
				 ((NC.AskYesOrNo (CONCAT (SETQ FileName (fetch (NoteFile
											 FullFileName)
										 of Selection))
							     " is not an open NoteFile."
							     (CHARACTER 13)
							     "Want to open it? ")
						   NIL
						   (QUOTE Yes)
						   T
						   (NC.AttachPromptWindow InterestedWindow))
				   (NC.OpenDatabaseFile FileName NIL NIL NIL NIL NIL NIL NIL NIL 
							  NIL InterestedWindow)))
		      else (NC.ReportError "NC.NoteCardsIconButtonEventFn" (CONCAT "Notefile " 
											Selection 
									    " is not a notefile!")))))
    ))

(NC.CommandMenu
  (LAMBDA (Window)                                           (* fgh: " 8-Jun-86 00:49")

          (* * provide Session command menu)



          (* * fgh 6/8/86 Added code to cache the menu since there is no need to create a menu every time.)


    (MENU (if (type? MENU (WINDOWPROP Window (QUOTE CommandsMenu)))
		then (WINDOWPROP Window (QUOTE CommandsMenu))
	      else (WINDOWPROP Window (QUOTE CommandsMenu)
				   (create MENU
					     ITEMS ←(BQUOTE
					       ((Open (NC.OpenDatabaseFile NIL NIL NIL NIL NIL NIL 
									     NIL NIL NIL NIL Window)
						      
					"Opens a new notefile - you'll be prompted for the name."
						      (SUBITEMS (Open (NC.OpenDatabaseFile NIL NIL 
											     NIL NIL 
											     NIL NIL 
											     NIL NIL 
											     NIL NIL 
											   Window)
								      
					"Opens a new notefile - you'll be prompted for the name.")
								(NoteFile% List (
									   NC.ListOfNoteFilesMenu
										  Window)
										
							  "Provides a menu of noticed NoteFiles.")))
						(Parameters (NC.BuildInspector)
							    
						     "Adjust NoteCards profile for this session.")
						(Close (NC.EditEntitiesMenu (QUOTE Close))
						       "Closes what you select.")
						(Copy (NC.EditEntitiesMenu (QUOTE Copy))
						      
				 "Copies a type of thing you select to a destination you select.")
						(Delete (NC.EditEntitiesMenu (QUOTE Delete))
							"Deletes a type of thing you select."
							(IF NIL
							    THEN 
                                                             (* this is a dumb way to comment out code that goes at
							     the same level as the other verbs.)
								   (Replace% something
								     (NC.EditEntitiesMenu
								       (QUOTE Replace))
								     
			       "Replaces a type of thing you select with another one you select.")
								   (Transpose% things
								     (NC.EditEntitiesMenu
								       (QUOTE Transpose))
								     
							       "Transposes two things of a type.")
								   (Close% Cards (NC.CloseNoteCards)
										 
								  "Closes Cards you SHIFT-select")
								   (Delete% Cards (
									       NC.DeleteNoteCards
										    NIL T)
										  
								"Deletes cards you SHIFT-select.")))
						(Copy&Delete (NC.EditEntitiesMenu (QUOTE Move))
							     
				  "Moves a type of thing you select to a destination you select.")
						(Show% NFs (NC.ShowNoteFiles)
							   
						 "Show the NoteFile for all currently open cards"
							   (SUBITEMS (Indicators% Off (
										 NC.ShowNoteFiles
											T)
										      
				    "Turn off any NoteFile indicator on each card on the screen.")))
						(Checkpoint (NC.CheckpointSession)
							    "Checkpoint all currently open NoteFiles")
						(Quit (PROGN (NC.CloseSession))
						      "Close all currently open NoteFiles"
						      (SUBITEMS (DeleteChanges (NC.CloseSession
										 T)
									       
	    "Throw away all changes to all NoteFiles since the last open or checkpoint for each.")))))
					     ))
		     (WINDOWPROP Window (QUOTE CommandsMenu))))))
)
(* * New FN for NCDATABASE)

(DEFINEQ

(NC.NoteFileOpenP
  (LAMBDA (NoteFile)                                         (* fgh: " 8-Jun-86 00:50")

          (* * Is NoteFile an open NoteFile)


    (AND (type? NoteFile NoteFile)
	   (STREAMP (fetch (NoteFile Stream) of NoteFile))
	   (OPENP (fetch (NoteFile Stream) of NoteFile)))))
)
(PUTPROPS FGHPATCH068 COPYRIGHT ("Xerox Corporation" 1986))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (590 6649 (NC.ListOfNoteFilesMenu 600 . 3336) (NC.CommandMenu 3338 . 6647)) (6684 7033 (
NC.NoteFileOpenP 6694 . 7031)))))
STOP