(FILECREATED " 6-May-86 20:45:42" {QV}<NOTECARDS>1.3K>RHTPATCH042.;1 6840   

      changes to:  (VARS RHTPATCH042COMS)
		   (FNS NC.ClosedNoteFileMenuWhenSelectedFn NC.ResetNoteFileInterface 
			NC.SetUpNoteFileInterface))


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

(PRETTYCOMPRINT RHTPATCH042COMS)

(RPAQQ RHTPATCH042COMS ((* * New function for NCINTERFACE)
			  (FNS NC.ClosedNoteFileMenuWhenSelectedFn)
			  (* * Changed functions from NCINTERFACE)
			  (FNS NC.ResetNoteFileInterface NC.SetUpNoteFileInterface)
			  (* * Changed functions from NCDATABASE)
			  (FNS NC.NoteFileFromFileName)))
(* * New function for NCINTERFACE)

(DEFINEQ

(NC.ClosedNoteFileMenuWhenSelectedFn
  (LAMBDA (Item Menu Button)                                 (* rht: " 6-May-86 20:31")

          (* * This WhenSelectedFn called for menu of a closed notefile. Just prints a message.)


    (LET ((NoteFile (WINDOWPROP (WFROMMENU Menu)
				  (QUOTE NoteFile))))
         (AND (type? NoteFile NoteFile)
		(NC.PrintMsg NIL T (fetch (NoteFile FullFileName) of NoteFile)
			       " is not an open notefile.")))))
)
(* * Changed functions from NCINTERFACE)

(DEFINEQ

(NC.ResetNoteFileInterface
  (LAMBDA (NoteFile)                                         (* rht: " 6-May-86 20:36")

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


    (LET ((Menu (fetch (NoteFile Menu) of NoteFile))
	  Window)
         (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))
		      else (WINDOWPROP Window (QUOTE NoteFile)
					   NIL)
			     (replace (NoteFile Menu) of NoteFile with NIL)
			     (WINDOWPROP Window (QUOTE CLOSEFN)
					   NIL)
			     (DELETEMENU Menu T))))))

(NC.SetUpNoteFileInterface
  (LAMBDA (NoteFile)                                         (* rht: " 6-May-86 20:44")

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



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



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



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


    (LET ((Font (FONTCREATE (QUOTE HELVETICA)
			      10
			      (QUOTE BOLD)))
	  (TitleFont (FONTCREATE (QUOTE HELVETICA)
				   12
				   (QUOTE BOLD)))
	  NoteFileMenuWindow NoteFileMenu FullFileName)      (* Main Menu)
         (SETQ FullFileName (fetch (NoteFile FullFileName) of NoteFile))
         (if (SETQ NoteFileMenu (fetch (NoteFile Menu) of NoteFile))
	     then (for Item in (fetch (MENU ITEMS) of NoteFileMenu)
		       do (SHADEITEM Item NoteFileMenu WHITESHADE))
		    (replace (MENU WHENSELECTEDFN) of NoteFileMenu
		       with (FUNCTION NC.NoteFileMenuWhenSelectedFn))
	   else (PROGN (SETQ NoteFileMenu (create MENU
							  ITEMS ←(QUOTE ((NewCards NIL 
		       "Create a new Text card (left button) or other card type (middle button).")
									    (TopBoxes NIL 
							"Bring up one of the standard FileBoxes.")))
							  WHENSELECTEDFN ←(FUNCTION 
							    NC.NoteFileMenuWhenSelectedFn)
							  CENTERFLG ← T
							  MENUBORDERSIZE ← 1
							  MENUOUTLINESIZE ← 2
							  MENUCOLUMNS ← 2
							  MENUFONT ← Font
							  TITLE ←(FILENAMEFIELD FullFileName
										  (QUOTE NAME))
							  ITEMHEIGHT ←(IPLUS 6 (FONTPROP
										 Font
										 (QUOTE HEIGHT)))
							  ITEMWIDTH ←(IPLUS (STRINGWIDTH
										(QUOTE NewCards)
										Font)
									      10)
							  MENUTITLEFONT ← TitleFont))
			   (replace (MENU MENUPOSITION) of NoteFileMenu
			      with (GETBOXPOSITION (fetch (MENU IMAGEWIDTH) of NoteFileMenu)
						       (fetch (MENU IMAGEHEIGHT) of 
										     NoteFileMenu)
						       NIL NIL NIL 
					    "Please indicate location for NoteFile control menu."))))
         (if (WINDOWP (SETQ NoteFileMenuWindow (WFROMMENU NoteFileMenu)))
	     then (FLASHW NoteFileMenuWindow)
	   else (SETQ NoteFileMenuWindow (ADDMENU NoteFileMenu NIL (GETMENUPROP NoteFileMenu
											(QUOTE
											  OldPosition)
											))))
         (WINDOWPROP NoteFileMenuWindow (QUOTE NoteFile)
		       NoteFile)
         (replace (NoteFile Menu) of NoteFile with NoteFileMenu)
         (WINDOWPROP NoteFileMenuWindow (QUOTE RESHAPEFN)
		       (QUOTE DON'T))
         (WINDOWPROP NoteFileMenuWindow (QUOTE BUTTONEVENTFN)
		       (FUNCTION NC.NoteFileIconButtonEventFn))
         (WINDOWPROP NoteFileMenuWindow (QUOTE SHRINKFN)
		       (QUOTE DON'T))
         (WINDOWADDPROP NoteFileMenuWindow (QUOTE CLOSEFN)
			  (FUNCTION (LAMBDA (Window)
			      (PUTMENUPROP (CAR (WINDOWPROP Window (QUOTE MENU)))
					     (QUOTE OldPosition)
					     (WINDOWPOSITION Window)))))
         (NC.MoveWindowOntoScreen NoteFileMenuWindow))))
)
(* * Changed functions from NCDATABASE)

(DEFINEQ

(NC.NoteFileFromFileName
  (LAMBDA (FileName)                                         (* rht: " 6-May-86 20:00")

          (* * Return the notefile object for the given file name or NIL if none. Done by checking notefiles hash array.)



          (* * rht 5/6/86: Now doesn't just return the first notefile object having the desired name.
	  Tries to return one that's open if there are any.)


    (LET* ((FullFileName (FULLNAME FileName))
	   (NoteFiles (for NoteFile in (NC.ListOfNoteFiles) when (EQ FullFileName
									       (fetch (NoteFile
											  
										     FullFileName)
										  of NoteFile))
			 collect NoteFile)))
          (OR (for NoteFile in NoteFiles when (LET ((Stream (fetch (NoteFile Stream)
								       of NoteFile)))
						           (AND (STREAMP Stream)
								  (OPENP Stream)))
		   do (RETURN NoteFile))
		(CAR NoteFiles)))))
)
(PUTPROPS RHTPATCH042 COPYRIGHT ("Xerox Corporation" 1986))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (675 1178 (NC.ClosedNoteFileMenuWhenSelectedFn 685 . 1176)) (1226 5722 (
NC.ResetNoteFileInterface 1236 . 2319) (NC.SetUpNoteFileInterface 2321 . 5720)) (5769 6758 (
NC.NoteFileFromFileName 5779 . 6756)))))
STOP