(FILECREATED "13-Jul-86 17:27:40" {QV}<NOTECARDS>1.3K>RHTPATCH066.;1 5618   

      changes to:  (VARS RHTPATCH066COMS)
		   (FNS NC.SetUpNoteFileInterface))


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

(PRETTYCOMPRINT RHTPATCH066COMS)

(RPAQQ RHTPATCH066COMS ((* * Change to NCINTERFACE)
			  (FNS NC.SetUpNoteFileInterface)))
(* * Change to NCINTERFACE)

(DEFINEQ

(NC.SetUpNoteFileInterface
  (LAMBDA (NoteFile Position)                                (* rht: "13-Jul-86 17:24")

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


    (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 (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 (SETQ NoteFileMenu (create MENU
						 ITEMS ←(QUOTE ((NewCards NIL 
		       "Create a new Text card (left button) or other card type (middle button).")
								   (Show% Box NIL 
							"Bring up one of the standard FileBoxes.")))
						 WHENSELECTEDFN ←(if (NC.NoteFileOpenP NoteFile)
								     then (FUNCTION 
								    NC.NoteFileMenuWhenSelectedFn)
								   else (FUNCTION 
							      NC.ClosedNoteFileMenuWhenSelectedFn))
						 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)))
         (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 (OR Position
									       (GETMENUPROP
										 NoteFileMenu
										 (QUOTE OldPosition)
										 )))))
         (WINDOWPROP NoteFileMenuWindow (QUOTE NoteFile)
		       NoteFile)
         (replace (NoteFile Menu) of NoteFile with NoteFileMenu)
         (WINDOWPROP NoteFileMenuWindow (QUOTE RESHAPEFN)
		       (QUOTE DON'T))
         (WINDOWPROP NoteFileMenuWindow (QUOTE BUTTONEVENTFN)
		       (FUNCTION NC.NoteFileIconButtonEventFn))
         (WINDOWPROP NoteFileMenuWindow (QUOTE SHRINKFN)
		       (QUOTE DON'T))
         (WINDOWADDPROP NoteFileMenuWindow (QUOTE CLOSEFN)
			  (FUNCTION (LAMBDA (Window)
			      (PUTMENUPROP (CAR (WINDOWPROP Window (QUOTE MENU)))
					     (QUOTE OldPosition)
					     (WINDOWPOSITION Window)))))
         (NC.MoveWindowOntoScreen NoteFileMenuWindow))))
)
(PUTPROPS RHTPATCH066 COPYRIGHT ("Xerox Corporation" 1986))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (396 5536 (NC.SetUpNoteFileInterface 406 . 5534)))))
STOP