(FILECREATED " 4-Dec-86 17:26:30" {QV}<NOTECARDS>1.3K>NEXT>PMIPATCH008.;1 3951   

      changes to:  (VARS PMIPATCH008COMS))


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

(PRETTYCOMPRINT PMIPATCH008COMS)

(RPAQQ PMIPATCH008COMS ((* * Fixes bug #145: Menu of known NoteFiles should include version numbers 
			     of file names.)
			  (* * Change to NCINTERFACE)
			  (FNS NC.ListOfNoteFilesMenu)))
(* * Fixes bug #145: Menu of known NoteFiles should include version numbers of file names.)

(* * Change to NCINTERFACE)

(DEFINEQ

(NC.ListOfNoteFilesMenu
  (LAMBDA (IncludeNewNoteFileFlg ShowOnlyOpenNFsFlg InterestedWindow Operation)
                                                             (* pmi: " 4-Dec-86 15:52")

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


    (LET (Menu NoteFileMenu FileName RootName Items Result)
         (SETQ Items
	   (BQUOTE (,@(for NoteFile in (NC.ListOfNoteFiles) bind Stream FileName
			   when (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 "$ ")
						 else "  ")
					       (SUBSTRING (SETQ RootName
							      (PACKFILENAME
								(QUOTE NAME)
								(FILENAMEFIELD
								  (SETQ FileName
								    (fetch (NoteFile FullFileName)
								       of NoteFile))
								  (QUOTE NAME))
								(QUOTE VERSION)
								(FILENAMEFIELD FileName
										 (QUOTE VERSION))))
							    1
							    (MIN 20 (NCHARS RootName))))
					     NoteFile
					     (CONCAT "Selects NoteFile " FileName)))
		       ,@(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))))
         (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)))
)
(PUTPROPS PMIPATCH008 COPYRIGHT ("Xerox Corporation" 1986))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (565 3869 (NC.ListOfNoteFilesMenu 575 . 3867)))))
STOP