(FILECREATED " 2-Apr-87 11:55:29" {QV}<NOTECARDS>1.3K>NEXT>PMIPATCH018.;13 71057  

      changes to:  (FNS NC.InstallTextTitleBarMiddleMenu NC.AskBrowserSpecs NC.AskLinkIndexSpecs)
		   (VARS PMIPATCH018COMS)

      previous date: " 1-Apr-87 17:15:38" {QV}<NOTECARDS>1.3K>NEXT>PMIPATCH018.;12)


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

(PRETTYCOMPRINT PMIPATCH018COMS)

(RPAQQ PMIPATCH018COMS ((* * pmi 4/2/87: Added NC.MenuFont to all menus. Also centered items in 
			     menus and made each item slightly larger for legibility.)
			  (DECLARE: COPY FIRST (P (LOAD? (QUOTE NCTEXTCARD.DCOM))
						  (LOAD? (QUOTE NCBROWSERCARD.DCOM))
						  (LOAD? (QUOTE NCDOCUMENTCARD.DCOM))
						  (LOAD? (QUOTE NCLINKINDEXCARD.DCOM))))
			  (* * Changes to NCPARAMETERS)
			  (FNS NC.InspectorSelectionFn NC.InspectorTitleCommandFn 
			       NC.DefaultCardTypeSelectionFn NC.ArrowHeadsInBrowserSelectionFn 
			       NC.MakeMainMenu)
			  (* * New Function for NCPARAMETERS)
			  (FNS NC.MenuFontAfterChangeFn)
			  (* * For the patch file ONLY, to establish new property values for MenuFont 
			     and to add a field to the GLOBALPARAMETER record declaration.)
			  (RECORDS GLOBALPARAMETER)
			  (PROPS (NC.NoteCardsParameters MenuFont))
			  (* * Changes to NCINTERFACE)
			  (FNS NC.AskLinkLabel NC.ChooseTopLevelCard NC.InstallTitleBarLeftMenu 
			       NC.FileBrowserMenu NC.ListOfNoteFilesMenu 
			       NC.NoteFileIconMiddleButtonFn NC.PopUpNoteFileName)
			  (* * New Function for NCINTERFACE)
			  (FNS NC.ResetCachedMenus)
			  (* * New Globalvar for NCINTERFACE)
			  (GLOBALVARS NC.CachedMenus)
			  (* * New Vars for NCINTERFACE)
			  (VARS (NC.CachedMenus (QUOTE (NC.NoteCardTypeMenu 
								      NC.LinkIconMiddleButtonMenu 
									    NC.CardOpsMenu 
									    NC.NoteFileOpsMenu 
									    NC.OtherOpsMenu))))
			  (* * Changes to NCDATABASE)
			  (FNS NC.AskUserAboutTruncation)
			  (* * Changes to NCCARDS)
			  (FNS NC.EditPropList NC.InstallTitleBarMiddleMenu)
			  (* * Changes to NCLINKS)
			  (FNS NC.LinkIconMiddleButtonFn)
			  (* * Changes to NCTEXTCARD)
			  (FNS NC.InstallTextTitleBarMiddleMenu)
			  (* * Changes to NCBROWSERCARD)
			  (FNS NC.GetGraphEditMenu NC.BrowserFixGraphEditMenuFn NC.BrowserDeleteLink 
			       NC.BrowserRemoveEdge NC.AskBrowserSpecs)
			  (* * Changes to NCDOCUMENTCARD)
			  (FNS NC.MakeDocInspectorSelectionFn)
			  (* * Changes to NCLINKINDEXCARD)
			  (FNS NC.AskLinkIndexSpecs)))
(* * pmi 4/2/87: Added NC.MenuFont to all menus. Also centered items in menus and made each 
item slightly larger for legibility.)

(DECLARE: COPY FIRST 
(LOAD? (QUOTE NCTEXTCARD.DCOM))
(LOAD? (QUOTE NCBROWSERCARD.DCOM))
(LOAD? (QUOTE NCDOCUMENTCARD.DCOM))
(LOAD? (QUOTE NCLINKINDEXCARD.DCOM))
)
(* * Changes to NCPARAMETERS)

(DEFINEQ

(NC.InspectorSelectionFn
  (LAMBDA (Property ValueFlg InspectWindow)                  (* pmi: " 1-Apr-87 14:18")

          (* * Actions to be taken when the user selects an item in the Inspector. If a value, then ignore.
	  If a property, ask for a new value.)



          (* * KLUDGED to hadle the NC.DefaultcardType property --- should be fixed to be general!!!!!!! fgh 10/23/84)



          (* * rht 10/25/84: Rewritten to access the NC.NoteCardsParameters variable's prop list to get all info including 
	  the name of the relevant globalvar for this parameter and an optional function. The latter returns a list of 
	  possible values. If no such function, then just toggle between Yes and No.)



          (* * rht 3/19/85: Rewritten to use new GLOBALPARAMETER record which contains globalvar's name and selection fn 
	  among other stuff.)



          (* * rht 5/1/86: Now can toggle either by clicking attribute or value.)



          (* * pmi 4/1/87: Added fifth field to GLOBALPARAMETER record: PARAMAFTERCHANGEFN. This function is called after the
	  Global parameter has been changed.)


    (PROG (Answer (ParameterInfo (GETPROP (QUOTE NC.NoteCardsParameters)
					      Property))
		    SelectionFn AfterChangeFn GlobalVar)
	    (if (LISTP ParameterInfo)
		then (SETQ GlobalVar (fetch (GLOBALPARAMETER PARAMGLOBALVAR) of ParameterInfo)
			 )
		       (SETQ SelectionFn (fetch (GLOBALPARAMETER PARAMSELECTIONFN) of 
										    ParameterInfo))
		       (SETQ AfterChangeFn (fetch (GLOBALPARAMETER PARAMAFTERCHANGEFN)
						of ParameterInfo))
	      else (SETQ GlobalVar ParameterInfo))
	    (COND
	      (SelectionFn (if (NEQ (QUOTE NOTCHANGED)
					(SETQ Answer (APPLY* SelectionFn GlobalVar)))
			       then (SET GlobalVar Answer)
				      (APPLY* AfterChangeFn GlobalVar)
				      (INSPECTW.REDISPLAY InspectWindow Property)))
	      (T (COND
		   ((EVAL GlobalVar)
		     (SET GlobalVar NIL))
		   (T (SET GlobalVar T)))
		 (INSPECTW.REDISPLAY InspectWindow Property)))
	    (INSPECTW.SELECTITEM InspectWindow))))

(NC.InspectorTitleCommandFn
  (LAMBDA (InspectWindow Object)                             (* pmi: "25-Mar-87 09:56")

          (* * pmi 3/25/87: Changed to call NC.AskYesOrNo instead of making its own Yes/No menu.)



          (* * (AND (EQ (MENU (create MENU ITEMS ← (QUOTE (Yes No)) TITLE ← "Close?")) (QUOTE Yes)) (CLOSEW InspectWindow)))


    (AND (NC.AskYesOrNo NIL "Close?")
	   (CLOSEW InspectWindow))))

(NC.DefaultCardTypeSelectionFn
  (LAMBDA (GlobalVar)                                        (* pmi: "25-Mar-87 09:51")

          (* * Let user choose from a menu of card types.)



          (* * pmi 3/25/87: Added NC.MenuFont to all menus and cleaned up to use NC.NoteCardTypeMenu)


    (DECLARE (GLOBALVARS NC.NoteCardTypeMenu NC.MenuFont))
    (OR (AND (BOUNDP (QUOTE NC.NoteCardTypeMenu))
		 (type? MENU NC.NoteCardTypeMenu))
	  (MENU (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))))
	  (QUOTE NOTCHANGED))))

(NC.ArrowHeadsInBrowserSelectionFn
  (LAMBDA (GlobalVar)                                        (* pmi: "25-Mar-87 10:03")

          (* * Ask user for new value from a menu of choices.)



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


    (DECLARE (GLOBALVARS NC.MenuFont))
    (OR (MENU (create MENU
			    ITEMS ←(QUOTE ((At% Midpoint (QUOTE AtMidpoint)
							   
					       "Place arrow heads at midpoints of browser links.")
					      (At% Endpoint (QUOTE AtEndpoint)
							    
					       "Place arrow heads at endpoints of browser links.")
					      (None (QUOTE None)
						    "Do not draw arrow heads in browsers.")))
			    TITLE ← " Arrow Head Types "
			    CENTERFLG ← T
			    MENUFONT ← NC.MenuFont
			    ITEMHEIGHT ←(IPLUS (FONTPROP NC.MenuFont (QUOTE HEIGHT))
						 1)))
	  (QUOTE NOTCHANGED))))

(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))))
)
(* * New Function for NCPARAMETERS)

(DEFINEQ

(NC.MenuFontAfterChangeFn
  (LAMBDA (GlobalVar)                                        (* pmi: " 1-Apr-87 14:14")

          (* * pmi 4/1/87: Reset menu global variables to force their recomputation later.)


    (NC.ResetCachedMenus)))
)
(* * For the patch file ONLY, to establish new property values for MenuFont and to add a field
 to the GLOBALPARAMETER record declaration.)

[DECLARE: EVAL@COMPILE 

(RECORD GLOBALPARAMETER (PARAMGLOBALVAR PARAMFETCHFN PARAMSELECTIONFN PARAMCHECKFN 
					  PARAMAFTERCHANGEFN))
]

(PUTPROPS NC.NoteCardsParameters MenuFont (NC.MenuFont NC.DefaultFontFetchFn 
							 NC.DefaultFontSelectionFn FONTP 
							 NC.MenuFontAfterChangeFn))
(* * Changes to NCINTERFACE)

(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.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.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.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: "25-Mar-87 12:13")

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


    (DECLARE (GLOBALVARS NC.MenuFont))
    (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
						   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.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))))))
)
(* * New Function for NCINTERFACE)

(DEFINEQ

(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)))
)
(* * New Globalvar for NCINTERFACE)

(DECLARE: DOEVAL@COMPILE DONTCOPY

(GLOBALVARS NC.CachedMenus)
)
(* * New Vars for NCINTERFACE)


(RPAQQ NC.CachedMenus (NC.NoteCardTypeMenu NC.LinkIconMiddleButtonMenu NC.CardOpsMenu 
					     NC.NoteFileOpsMenu NC.OtherOpsMenu))
(* * Changes to NCDATABASE)

(DEFINEQ

(NC.AskUserAboutTruncation
  (LAMBDA (NoteFile PromptWindow)                            (* pmi: "25-Mar-87 12:24")

          (* * Ask the user what to do since NoteFile truncation is needed.)



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



          (* * rht 10/29/86: Change name from Abort to Cancel.)



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


    (DECLARE (GLOBALVARS NC.MenuFont))
    (LET (Items Menu PromptWinPos)

          (* * List user's options. Include Inspect&Repair only if this NoteFIle device has a RepairFn.)


         (SETQ Items (BQUOTE ((Cancel (QUOTE Cancel)
					  "Cancel the Open.")
				  (Truncate% File (QUOTE Truncate% File)
						  
				 "Truncate the file throwing away changes since last checkpoint.")
				  ,@(if (fetch (NoteFile RepairNoteFileFn) of NoteFile)
					then (LIST (QUOTE (Inspect% &% Repair (QUOTE 
									       Inspect% &% Repair)
										    
							   "Run Inspect&Repair on this NoteFile.")))))
				 ))

          (* * Bring up the menu with the options.)


         (MENU (SETQ Menu
		   (create MENU
			     ITEMS ← Items
			     MENUOUTLINESIZE ← 2
			     MENUFONT ← NC.MenuFont
			     CENTERFLG ← T
			     ITEMHEIGHT ←(IPLUS (FONTPROP NC.MenuFont (QUOTE HEIGHT))
						  1)))
		 (if (WINDOWP PROMPTWINDOW)
		     then (create POSITION
				      XCOORD ←(fetch (POSITION XCOORD) of (SETQ PromptWinPos
										  (WINDOWPOSITION
										    PromptWindow)))
				      YCOORD ←(DIFFERENCE (fetch (POSITION YCOORD)
							       of PromptWinPos)
							    (fetch (MENU IMAGEHEIGHT)
							       of Menu)))
		   else NIL)))))
)
(* * Changes to NCCARDS)

(DEFINEQ

(NC.EditPropList
  (LAMBDA (propList window showOnlyFlg)                      (* pmi: "25-Mar-87 12:30")

          (* * propList is a list of RECORDS of type PropListItem)



          (* * Edit a property list using the TEDIT menu-based editor. The var window is the window to use.
	  If none supplied, get one from user.)



          (* * rht 4/11/86: Now stashes length of propList on WINDOWPROP.)



          (* * rht 8/12/86: Moved code to add NC.ClosePropListEditor on CLOSEFN from NC.OpenPropListEditor to here so that it
	  can before TEDIT.DEACTIVATE.WINDOW on the CLOSEFN list.)



          (* * rht 1/16/87: Now stashes prop names on windowprop rather than number of props.)



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


    (DECLARE (GLOBALVARS NC.MenuFont))
    (PROG (menuStream textObj editW button (font (FONTCREATE (QUOTE HELVETICA)
								 8))
			(CH# 1)
			(ENDCH# 1))                          (* Init the editList and the propFnsList)
                                                             (* Create a TEDITMenu that reflects the structure of 
							     the proplist)
	    (SETQ menuStream
	      (\TEXTMENU.DOC.CREATE
		(for X in propList
		   join (NCONC (LIST (LIST (QUOTE MB.BUTTON)
						   (MKSTRING (fetch (PropListItem PropertyName)
								  of X))
						   (OR (fetch (PropListItem ButtonFn)
							    of X)
							 (FUNCTION NC.EditPropButtonFN))))
				   (COND
				     ((NOT (IMAGEOBJP (fetch (PropListItem Value) of X)))
				       (COND
					 ((fetch (PropListItem AllowEditFlg) of X)
					   (LIST (LIST (QUOTE MB.TEXT)
							   (CONCAT (CHARACTER 9)
								     "  ["
								     (MKSTRING (fetch
										   (PropListItem
										     Value)
										    of X))
								     "]"
								     (CHARACTER 13))
							   font)))
					 (T (LIST (LIST (QUOTE MB.TEXT)
							    (CHARACTER 9)
							    font)
						    (LIST (QUOTE MB.INSERT)
							    (MKSTRING (fetch (PropListItem Value)
									   of X)))
						    (LIST (QUOTE MB.TEXT)
							    (CHARACTER 13)
							    font)))))
				     (T (LIST (LIST (QUOTE MB.TEXT)
							(CHARACTER 9)
							font)
						(LIST (QUOTE MB.INSERT))
						(LIST (QUOTE MB.TEXT)
							(CHARACTER 13)
							font))))))))
	    (SETQ textObj (TEXTOBJ menuStream))          (* Go back and insert the ImageObjects into their 
							     value fields.)
	    (SETQ CH# 0)
	    (for prop in propList when (OR (IMAGEOBJP (fetch (PropListItem Value)
								   of prop))
						   (NULL (fetch (PropListItem AllowEditFlg)
							      of prop)))
	       do (MBUTTON.FIND.NEXT.FIELD textObj (SETQ CH# (ADD1 CH#)))
		    (SETQ CH# (fetch CH# of (fetch SCRATCHSEL of textObj)))
		    (COND
		      ((IMAGEOBJP (CADR prop))
			(TEDIT.INSERT.OBJECT (fetch (PropListItem Value) of prop)
					       menuStream CH#))))
	    (SETQ CH# 0)
	    (for prop in propList
	       do (SETQ button (MBUTTON.FIND.NEXT.BUTTON textObj (ADD1 CH#)))
		    (SETQ CH# (CDR button))              (* If the buttonProtect flag is on, protect the 
							     button)
		    (AND (fetch (PropListItem AllowSelectFlg) of prop)
			   (IMAGEOBJPROP (CAR button)
					   (QUOTE EditPropListNoDelete)
					   T)))              (* Set up window and window title)
	    (SETQ editW (COND
		(window window)
		(T (CREATEW (GETREGION)
			      "Edit Property List"))))       (* Point to the proplist being edited so we can update
							     it when this menu is closed.
							     (See NC.CloseEditPropListWindow))
	    (WINDOWPROP editW (QUOTE PROPERTYLIST.BEING.EDITED)
			  propList)
	    (WINDOWPROP editW (QUOTE PROPERTYLIST.PROPNAMES)
			  (for Item in propList collect (CAR Item)))
                                                             (* Set the right margin to very-far-away.
							     Prevents stuff from wrapping around)
	    (TEDIT.PARALOOKS textObj (QUOTE (RIGHTMARGIN 1000 TABS (50 (80 . LEFT))))
			       1
			       (GETFILEINFO menuStream (QUOTE LENGTH)))
                                                             (* Set the first tab so the fields will line up 
							     correctly)
                                                             (* Set selection to the top -- make it look pretty)
	    (replace (SELECTION SET) of (fetch (TEXTOBJ SEL) of textObj) with NIL)
	    (TEDIT menuStream editW NIL (LIST
		       (QUOTE MENU)
		       (create MENU
				 ITEMS ←(COND
				   (showOnlyFlg (QUOTE (("Quit" (NC.ClosePropListEditor
								    W
								    (QUOTE NoSave))
								  "Quit from pointer list display.")))
						)
				   (T (QUOTE (("Add New Property" (NC.AddPropToPropList W)
								    
					       "Add a new property to this card's property list.")
						 ("Delete Selected Property" (NC.DelPropFromList
									       W)
									     
				       "Delete selected property from this card's property list.")
						 ("Quit w/o Saving Changes" (NC.ClosePropListEditor
									      W
									      (QUOTE NoSave))
									    
					   "Quit from property list edit. Changes are not saved.")
						 ("Quit - Saving Changes" (NC.ClosePropListEditor
									    W
									    (QUOTE Save))
									  
						  "Quit from property list editor. Save changes.")))))
				 MENUFONT ← NC.MenuFont
				 CENTERFLG ← T
				 ITEMHEIGHT ←(IPLUS (FONTPROP NC.MenuFont (QUOTE HEIGHT))
						      1))))
	    (WINDOWADDPROP editW (QUOTE CLOSEFN)
			     (FUNCTION NC.ClosePropListEditor)
			     T))))

(NC.InstallTitleBarMiddleMenu
  (LAMBDA (Window CardType)                                  (* pmi: " 1-Apr-87 16:47")

          (* * Make a middle button title bar menu and install.)



          (* * pmi 4/1/87: Added NC.MenuFont to all menus)


    (DECLARE (GLOBALVARS NC.MenuFont))
    (WINDOWPROP Window (QUOTE TitleBarMiddleButtonMenu)
		  (create MENU
			    ITEMS ←(NC.GetCardTypeField MiddleButtonMenuItems CardType)
			    CENTERFLG ← T
			    MENUFONT ← NC.MenuFont
			    ITEMHEIGHT ←(IPLUS (FONTPROP NC.MenuFont (QUOTE HEIGHT))
						 1)))))
)
(* * Changes to NCLINKS)

(DEFINEQ

(NC.LinkIconMiddleButtonFn
  (LAMBDA (LinkIcon Window)                                  (* pmi: "25-Mar-87 12:43")
                                                             (* Middle button has been pressed in the Notecard 
							     pointer. Bring up menu of choices for manipulating 
							     this pointer.)

          (* * rht 11/18/86: Now calls NC.TraverseLink rather than NC.EditNoteCard.)



          (* * rht 2/4/87: Now checks the ExtraLinkIconMenuItems property of the destination's card type atom.
	  If non-nil, then include those items in link icon menu.)



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


    (DECLARE (GLOBALVARS NC.LinkIconMiddleButtonMenu NC.MenuFont))
    (LET ((Card (fetch (Link DestinationCard) of (NC.FetchLinkFromLinkIcon LinkIcon)))
	  ExtraItems Selection Menu)
         (SETQ ExtraItems (GETPROP (NC.RetrieveType Card)
				       (QUOTE ExtraLinkIconMenuItems)))
         (SETQ Menu (COND
	     ((AND (BOUNDP (QUOTE NC.LinkIconMiddleButtonMenu))
		     (type? MENU NC.LinkIconMiddleButtonMenu)
		     (NULL ExtraItems))
	       NC.LinkIconMiddleButtonMenu)
	     (T (create MENU
			  ITEMS ←(APPEND (QUOTE ((Bring% Up% Card/Box (QUOTE Edit)
									  
					     "Bring up the note card pointed to by this pointer.")
						      (Change% Link% Type (QUOTE Relabel)
									  
							      "Change the label of this pointer.")
						      (Change% Card% Title (QUOTE Retitle)
									   
							   "Change the destination card's title.")
						      (Change% Display% Mode (QUOTE Display)
									     
				      "Change the type of information displayed in this pointer.")))
					   ExtraItems)
			  CENTERFLG ← T
			  TITLE ← "Link Ops"
			  MENUFONT ← NC.MenuFont
			  ITEMHEIGHT ←(IPLUS (FONTPROP NC.MenuFont (QUOTE HEIGHT))
					       1)))))
         (if (NULL ExtraItems)
	     then (SETQ NC.LinkIconMiddleButtonMenu Menu))
         (if (NC.CardP (NC.CoerceToCard Window))
	     then (SELECTQ (SETQ Selection (MENU Menu))
			       (Edit (NC.TraverseLink LinkIcon Window))
			       (Display (NC.ChangeLinkDisplayMode LinkIcon Window))
			       (Relabel (NC.RelabelLink LinkIcon Window))
			       (Retitle (NC.ChangeCardTitleFromLinkIcon LinkIcon Window))
			       (NIL NIL)
			       (APPLY* Selection Card))
	   else NIL))))
)
(* * Changes to NCTEXTCARD)

(DEFINEQ

(NC.InstallTextTitleBarMiddleMenu
  (LAMBDA (Window CardType)                                  (* pmi: " 2-Apr-87 10:23")

          (* * Make a text card middle button title bar menu and install.)



          (* * pmi 4/1/87: Changed to replace MENUFONT with NC.MenuFont)


    (DECLARE (GLOBALVARS NC.MenuFont))
    (LET (Menu)
         (WINDOWPROP Window (QUOTE TitleBarMiddleButtonMenu)
		       (SETQ Menu (\TEDIT.CREATEMENU (NC.GetCardTypeField MiddleButtonMenuItems 
									      CardType))))
         (replace (MENU MENUFONT) of Menu with NC.MenuFont)
         (replace (MENU ITEMHEIGHT) of Menu with (IPLUS (FONTPROP NC.MenuFont
									      (QUOTE HEIGHT))
								  1))
         (replace (MENU IMAGE) of Menu with NIL))))
)
(* * Changes to NCBROWSERCARD)

(DEFINEQ

(NC.GetGraphEditMenu
  (LAMBDA (Window)                                           (* pmi: "25-Mar-87 12:51")

          (* * Create, if necessary, and bring up the graph editor menu.)



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


    (DECLARE (GLOBALVARS NC.MenuFont NC.GraphEditMenuItems NC.GraphEditUnfixedMenuItems))
    (PROG ((GraphEditUnfixableMenu (WINDOWPROP Window (QUOTE GRAPHEDITUNFIXABLEMENU)))
	     (GraphEditFixableMenu (WINDOWPROP Window (QUOTE GRAPHEDITFIXABLEMENU)))
	     GraphEditMenuWin)                               (* If menu is already up, then put up a menu without 
							     the FIXMENU option, otherwise, allow user to fix 
							     menu.)
	    (if (for Win in (ATTACHEDWINDOWS Window) thereis (AND (OPENWP Win)
									      (WINDOWPROP
										Win
										(QUOTE 
										 GRAPHEDITMENUFLG))))
		then (OR GraphEditUnfixableMenu
			     (WINDOWPROP Window (QUOTE GRAPHEDITUNFIXABLEMENU)
					   (SETQ GraphEditUnfixableMenu
					     (create MENU
						       ITEMS ← NC.GraphEditMenuItems
						       TITLE ← " Graph Editor Menu "
						       WHENSELECTEDFN ←(FUNCTION 
							 NC.GraphEditMenuWhenSelectedFn)
						       CHANGEOFFSETFLG ← T
						       CENTERFLG ← T
						       MENUOFFSET ←(CONS -1 0)
						       MENUFONT ← NC.MenuFont
						       ITEMHEIGHT ←(IPLUS (FONTPROP NC.MenuFont
											(QUOTE
											  HEIGHT))
									    1)))))
		       (PUTMENUPROP GraphEditUnfixableMenu (QUOTE MAINWINDOW)
				      Window)
		       (MENU GraphEditUnfixableMenu)
	      else (OR GraphEditFixableMenu
			   (WINDOWPROP Window (QUOTE GRAPHEDITFIXABLEMENU)
					 (SETQ GraphEditFixableMenu
					   (create MENU
						     ITEMS ← NC.GraphEditUnfixedMenuItems
						     TITLE ← " Graph Editor Menu "
						     WHENSELECTEDFN ←(FUNCTION 
						       NC.GraphEditMenuWhenSelectedFn)
						     CHANGEOFFSETFLG ← T
						     CENTERFLG ← T
						     MENUOFFSET ←(CONS -1 0)
						     MENUFONT ← NC.MenuFont
						     ITEMHEIGHT ←(IPLUS (FONTPROP NC.MenuFont
										      (QUOTE HEIGHT)
										      )
									  1)))))
		     (PUTMENUPROP GraphEditFixableMenu (QUOTE MAINWINDOW)
				    Window)
		     (MENU GraphEditFixableMenu)))))

(NC.BrowserFixGraphEditMenuFn
  (LAMBDA (Window)                                           (* pmi: "25-Mar-87 12:55")

          (* * Attach the Graph edit menu to the side of the browser window. Put it below the links legend.)



          (* * rht 9/20/85: Now uses ADDMENU offscreen so it doesn't flash in lower left corner before coming up.)



          (* * rht 3/3/86: Now does some "random" WINDOWPROPS to make reshaping browser not screw up the attached menu.)



          (* * rht 3/7/86: Uses ATTACHMENU to attach the menu.)



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


    (DECLARE (GLOBALVARS NC.MenuFont))
    (LET (GraphEditMenu GraphEditMenuWin)
         (SETQ GraphEditMenu (create MENU
					 ITEMS ← NC.GraphEditMenuItems
					 TITLE ← " Editor Menu "
					 WHENSELECTEDFN ←(FUNCTION NC.GraphEditMenuWhenSelectedFn)
					 CHANGEOFFSETFLG ← T
					 CENTERFLG ← T
					 MENUOFFSET ←(CONS -1 0)
					 MENUFONT ← NC.MenuFont
					 ITEMHEIGHT ←(IPLUS (FONTPROP NC.MenuFont (QUOTE HEIGHT)
									  )
							      1)))
         (PUTMENUPROP GraphEditMenu (QUOTE MAINWINDOW)
			Window)
         (SETQ GraphEditMenuWin (ATTACHMENU GraphEditMenu Window (QUOTE RIGHT)
						(QUOTE BOTTOM)))
                                                             (* Rig so that close of menu won't close browser.)
         (WINDOWDELPROP GraphEditMenuWin (QUOTE PASSTOMAINCOMS)
			  (QUOTE CLOSEW))
         (WINDOWPROP GraphEditMenuWin (QUOTE GRAPHEDITMENUFLG)
		       T)
         (WINDOWADDPROP GraphEditMenuWin (QUOTE CLOSEFN)
			  (FUNCTION (LAMBDA (W)
			      (DETACHWINDOW W)))
			  T))))

(NC.BrowserDeleteLink
  (LAMBDA (FromNode ToNode Window Graph)                     (* pmi: "25-Mar-87 14:41")

          (* * Called by grapher when user deletes a link.)



          (* * rht 11/17/85: updated to handle new card and notefile formats.)



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


    (DECLARE (GLOBALVARS NC.MenuFont))
    (PROG ((GraphCard (NC.CoerceToCard Window))
	     SourceCard SourceType DestinationCard LinkLabel Link Links FromNodeID ToNodeID 
	     LabelPairs MenuItems ExistingLabels LinkAndLabelPair LinkParams ReverseLinkParams)
                                                             (* Be sure this is a link between non-label nodes.)
	    (if (NOT (AND (NC.LinkIconImageObjP (fetch (GRAPHNODE NODELABEL) of FromNode))
				(NC.LinkIconImageObjP (fetch (GRAPHNODE NODELABEL) of ToNode))))
		then (NC.PrintMsg Window T 
			 "Can't delete link from or to a label node.  Try 'Remove Edge' instead.")
		       (RETURN NIL))
	    (SETQ SourceCard (NC.CardFromBrowserNodeID (SETQ FromNodeID (
							       NC.CoerceToGraphNodeID FromNode))))
	    (SETQ DestinationCard (NC.CardFromBrowserNodeID (SETQ ToNodeID (
								    NC.CoerceToGraphNodeID ToNode)))
	      )
	    (SETQ Links (NCP.GetLinks SourceCard DestinationCard))
	    (SETQ LabelPairs (NC.GraphNodeIDGetProp FromNodeID ToNodeID))
	    (SETQ ExistingLabels (for Link in Links collect (fetch (Link Label)
								       of Link)))
	    (NC.MarkCardDirty GraphCard)

          (* Let user choose among those edges having links that exist in the real world, and those edges whose corresponding
	  real-life links have been deleted.)


	    (SETQ MenuItems (NCONC (for Link in Links bind LinkLabel LabelPair
					  when (SETQ LabelPair (FASSOC (SETQ LinkLabel
									       (fetch (Link Label)
										  of Link))
									     LabelPairs))
					  collect (LIST LinkLabel
							    (BQUOTE (QUOTE (, Link , LabelPair))))
					      )
				       (for LabelPair in LabelPairs unless (FMEMB
										   (CAR LabelPair)
										   ExistingLabels)
					  collect (LIST (CAR LabelPair)
							    (BQUOTE (QUOTE (, NIL , LabelPair)))))
				       ))
	    (SETQ LinkAndLabelPair
	      (COND
		((CDR MenuItems)
		  (MENU (create MENU
				    ITEMS ← MenuItems
				    TITLE ← "Which link to delete?"
				    MENUFONT ← NC.MenuFont
				    CENTERFLG ← T
				    ITEMHEIGHT ←(IPLUS (FONTPROP NC.MenuFont (QUOTE HEIGHT))
							 1))))
		(T (EVAL (CADAR MenuItems)))))
	    (COND
	      ((NOT LinkAndLabelPair)
		(FLASHW PROMPTWINDOW)
		(NC.PrintMsg NIL T "No link to delete.")
		(RETURN NIL))
	      ((SETQ Link (CAR LinkAndLabelPair))
		(if (NC.AskYesOrNo (CONCAT "Want to delete the " (fetch (Link Label)
									  of Link)
						 " link between "
						 (NC.RetrieveTitle SourceCard)
						 " and "
						 (NC.RetrieveTitle DestinationCard)
						 "? ")
				       "--"
				       (QUOTE Yes)
				       T Window NIL NIL)
		    then (NCP.DeleteLinks Link)
		  else (RETURN NIL)))
	      ((NOT (NC.YesP (NC.AskUser (CONCAT "Link for that label already deleted."
							 (CHARACTER 13)
							 "Want to delete its edge? ")
					       "- -"
					       (QUOTE Yes)
					       T Window NIL NIL T)))
		(RETURN NIL)))                             (* Undisplay the links between the nodes.)
	    (COND
	      ((SETQ LinkParams (LINKPARAMETERS FromNode ToNode))
		(DISPLAYLINK FromNode ToNode (CONSTANT (create POSITION
								     XCOORD ← 0
								     YCOORD ← 0))
			       Window Graph 1 LinkParams))
	      ((SETQ ReverseLinkParams (LINKPARAMETERS ToNode FromNode))
		(DISPLAYLINK ToNode FromNode (CONSTANT (create POSITION
								     XCOORD ← 0
								     YCOORD ← 0))
			       Window Graph 1 ReverseLinkParams)))
                                                             (* Remove the first occurrence of the label pair from 
							     the proper prop list.)
	    (NC.GraphNodeIDPutProp FromNodeID ToNodeID (for RestOfLabelPairs on LabelPairs
							    bind (LabelPair ←(CADR 
										 LinkAndLabelPair))
							    first (if (EQ LabelPair
										(CAR LabelPairs))
									then (RETURN
										 (CDR LabelPairs)))
							    do (if (EQ LabelPair (CADR 
										 RestOfLabelPairs))
								     then (RPLACD 
										 RestOfLabelPairs
										      (CDDR 
										 RestOfLabelPairs))
									    (RETURN LabelPairs))))
                                                             (* If that was the last edge between the two nodes, 
							     then remove the edge from the graph.)
	    (if (AND (NULL (NC.GraphNodeIDGetProp FromNodeID ToNodeID))
			 (NULL (NC.GraphNodeIDGetProp ToNodeID FromNodeID)))
		then (SETQ FromNodeID (fetch (GRAPHNODE NODEID) of FromNode))
		       (SETQ ToNodeID (fetch (GRAPHNODE NODEID) of ToNode))
		       (if LinkParams
			   then (replace (GRAPHNODE TONODES) of FromNode
				     with (for Node in (fetch (GRAPHNODE TONODES)
								of FromNode)
					       unless (EQ (CADR Node)
							      ToNodeID)
					       collect Node))
				  (replace (GRAPHNODE FROMNODES) of ToNode
				     with (DREMOVE FromNodeID (fetch (GRAPHNODE FROMNODES)
								     of ToNode)))
			 else (replace (GRAPHNODE TONODES) of ToNode
				   with (for Node in (fetch (GRAPHNODE TONODES) of ToNode)
					     unless (EQ (CADR Node)
							    FromNodeID)
					     collect Node))
				(replace (GRAPHNODE FROMNODES) of FromNode
				   with (DREMOVE ToNodeID (fetch (GRAPHNODE FROMNODES)
								 of FromNode))))
	      else                                         (* Redisplay links between the two nodes.)
		     (if LinkParams
			 then (DISPLAYLINK FromNode ToNode
					       (CONSTANT (create POSITION
								     XCOORD ← 0
								     YCOORD ← 0))
					       Window Graph 1 LinkParams)
		       else (DISPLAYLINK ToNode FromNode
					     (CONSTANT (create POSITION
								   XCOORD ← 0
								   YCOORD ← 0))
					     Window Graph 1 ReverseLinkParams))))))

(NC.BrowserRemoveEdge
  (LAMBDA (FromNode ToNode Window Graph)                     (* pmi: "25-Mar-87 14:41")

          (* * Called by grapher when user deletes an edge. This code is just like NC.BrowserDeleteLink except we don't 
	  affect any notecards links.)



          (* * rht 11/17/85: upadted to handle new card and notefile formats.)



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


    (DECLARE (GLOBALVARS NC.MenuFont))
    (PROG ((GraphCard (NC.CoerceToCard Window))
	     FromNodeID ToNodeID LabelPairs MenuItems LinkParams ReverseLinkParams LabelPairToRemove)

          (* If this is a link between nodes one of which is non-label, then it must be a non-link edge, so let grapher 
	  handle it.)


	    (if (NOT (AND (NC.LinkIconImageObjP (fetch (GRAPHNODE NODELABEL) of FromNode))
				(NC.LinkIconImageObjP (fetch (GRAPHNODE NODELABEL) of ToNode))))
		then (RETURN (DELETE/AND/DISPLAY/LINK FromNode ToNode Window Graph)))
	    (SETQ FromNodeID (NC.CoerceToGraphNodeID FromNode))
	    (SETQ ToNodeID (NC.CoerceToGraphNodeID ToNode))
	    (SETQ LabelPairs (NC.GraphNodeIDGetProp FromNodeID ToNodeID))
	    (if (AND (NULL LabelPairs)
			 (NULL (NC.GraphNodeIDGetProp ToNodeID FromNodeID)))
		then                                       (* No link edges so let grapher try to delete a 
							     non-link edge between these nodes if any.)
		       (RETURN (DELETE/AND/DISPLAY/LINK FromNode ToNode Window Graph)))
	    (NC.MarkCardDirty GraphCard)                   (* Let user choose among all edges from FromNode to 
							     ToNode.)
	    (SETQ MenuItems (for LabelPair in LabelPairs collect (LIST (CAR LabelPair)
										 (BQUOTE
										   (QUOTE , 
											LabelPair)))))
	    (SETQ LabelPairToRemove
	      (if (CDR MenuItems)
		  then (MENU (create MENU
					   ITEMS ← MenuItems
					   TITLE ← "Which edge to delete?"
					   MENUFONT ← NC.MenuFont
					   CENTERFLG ← T
					   ITEMHEIGHT ←(IPLUS (FONTPROP NC.MenuFont (QUOTE
									      HEIGHT))
								1)))
		else (EVAL (CADAR MenuItems))))
	    (if (NOT LabelPairToRemove)
		then (FLASHW PROMPTWINDOW)
		       (NC.PrintMsg NIL T "No edge to delete.")
		       (RETURN NIL))
	    (SETQ LinkParams (LINKPARAMETERS FromNode ToNode))
	    (SETQ ReverseLinkParams (LINKPARAMETERS ToNode FromNode))
                                                             (* Undisplay the links between the nodes.)
	    (NC.DisplayGraphLinksBetween FromNode ToNode Window Graph)
                                                             (* Remove the first occurrence of the label pair from 
							     the proper prop list.)
	    (NC.GraphNodeIDPutProp FromNodeID ToNodeID (DFIRSTREMOVE LabelPairToRemove LabelPairs)
				     )                       (* If that was the last edge between the two nodes, 
							     then remove the edge from the graph.)
	    (if (AND (NULL (NC.GraphNodeIDGetProp FromNodeID ToNodeID))
			 (NULL (NC.GraphNodeIDGetProp ToNodeID FromNodeID)))
		then (SETQ FromNodeID (fetch (GRAPHNODE NODEID) of FromNode))
		       (SETQ ToNodeID (fetch (GRAPHNODE NODEID) of ToNode))
		       (if LinkParams
			   then (replace (GRAPHNODE TONODES) of FromNode
				     with (for Node in (fetch (GRAPHNODE TONODES)
								of FromNode)
					       unless (EQ (CADR Node)
							      ToNodeID)
					       collect Node))
				  (replace (GRAPHNODE FROMNODES) of ToNode
				     with (DFIRSTREMOVE FromNodeID (fetch (GRAPHNODE FROMNODES)
									  of ToNode)))
			 else (replace (GRAPHNODE TONODES) of ToNode
				   with (for Node in (fetch (GRAPHNODE TONODES) of ToNode)
					     unless (EQ (CADR Node)
							    FromNodeID)
					     collect Node))
				(replace (GRAPHNODE FROMNODES) of FromNode
				   with (DFIRSTREMOVE ToNodeID (fetch (GRAPHNODE FROMNODES)
								      of FromNode))))
	      else                                         (* Redisplay links between the two nodes.)
		     (NC.DisplayGraphLinksBetween FromNode ToNode Window Graph)))))

(NC.AskBrowserSpecs
  (LAMBDA (MainWindow BrowserCard OldLinkLabels OldDepth OldFormat CreatingBrowserFlg Don'tAskFlg)
                                                             (* pmi: " 2-Apr-87 10:51")

          (* * Puts up the big stylesheet asking user about link types, depth, browser format, etc. The stylesheet returns a 
	  list of 5 things: forward links, backward links, depth, format, and orientation. The last two are smashed together 
	  to form a browserformat and the first two are nconc'ed together. Thus we return a list of 3 things: links, depth, 
	  and browserformat.)



          (* * rht 4/1/85: Now takes Don'tAskFlg arg for when we don't want to ask the user for browser specs.)



          (* * rht 11/17/85: Updated for new card and notefile objects.)



          (* * pmi 4/2/87: Added NC.MenuFont to all menus.)


    (DECLARE (GLOBALVARS NC.MenuFont))
    (PROG ((LinkLabels (NC.RetrieveLinkLabels (fetch (Card NoteFile) of BrowserCard)
						  T))
	     Position Choices ReverseFlg)
	    (if Don'tAskFlg
		then (RETURN (LIST (OR OldLinkLabels LinkLabels)
					 (OR OldDepth 99999)
					 (OR OldFormat (QUOTE (LATTICE))))))
	    (SETQ Position (AND (WINDOWP MainWindow)
				    (create POSITION
					      XCOORD ←(fetch (REGION LEFT)
							 of (WINDOWPROP MainWindow (QUOTE
									      REGION)))
					      YCOORD ←(fetch (REGION TOP) of (WINDOWREGION
										   MainWindow)))))
	    (if CreatingBrowserFlg
		then (SETQ OldLinkLabels LinkLabels))
	    (SETQ ReverseFlg (EQ (CADDR OldFormat)
				     (QUOTE REVERSE)))     (* The stylesheet is in a global var.
							     We only need to provide its position, items, and 
							     selections.)
	    (STYLE.PROP NC.BrowserSpecsStylesheet (QUOTE POSITION)
			  Position)
	    (STYLE.PROP NC.BrowserSpecsStylesheet (QUOTE ITEMS)
			  (LIST (create MENU
					    ITEMS ← LinkLabels
					    MENUFONT ← NC.MenuFont)
				  (create MENU
					    ITEMS ←(for Link in LinkLabels
						      collect (PACK* (QUOTE ←)
									 Link))
					    MENUFONT ← NC.MenuFont)
				  (create MENU
					    ITEMS ←(QUOTE (0 1 2 3 4 5 6 7 8 9 INF))
					    MENUFONT ← NC.MenuFont)
				  (create MENU
					    ITEMS ← NC.BrowserFormatOptions
					    MENUFONT ← NC.MenuFont)
				  (create MENU
					    ITEMS ←(QUOTE (Horizontal Vertical Reverse/Horizontal 
									Reverse/Vertical))
					    MENUFONT ← NC.MenuFont)))
	    (STYLE.PROP NC.BrowserSpecsStylesheet (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)
				  (if (OR (NOT (FIXP OldDepth))
					      (IGREATERP OldDepth 9)
					      (ILESSP OldDepth 0))
				      then (QUOTE INF)
				    else OldDepth)
				  (OR (CAR (FASSOC (CAR OldFormat)
							 NC.BrowserFormatOptions))
					(QUOTE LATTICE))
				  (if (EQ (CADR OldFormat)
					      (QUOTE VERTICAL))
				      then (if ReverseFlg
						 then (QUOTE Reverse/Vertical)
					       else (QUOTE Vertical))
				    else (if ReverseFlg
					       then (QUOTE Reverse/Horizontal)
					     else (QUOTE Horizontal)))))
	    (SETQ Choices (STYLESHEET NC.BrowserSpecsStylesheet))
	    (RETURN (COND
			(Choices (LIST (APPEND (CAR Choices)
						   (CADR Choices))
					 (OR (FIXP (CADDR Choices))
					       MAX.FIXP)
					 (CONS (CADDDR Choices)
						 (SELECTQ (CADDDR (CDR Choices))
							    (Horizontal (LIST (QUOTE HORIZONTAL)
										(QUOTE 
										REVERSE/DAUGHTERS)))
							    (Vertical (LIST (QUOTE VERTICAL)
									      NIL))
							    (Reverse/Horizontal (LIST (QUOTE
											  HORIZONTAL)
											(QUOTE
											  REVERSE)
											(QUOTE
											  
										REVERSE/DAUGHTERS)))
							    (Reverse/Vertical (LIST (QUOTE 
											 VERTICAL)
										      (QUOTE 
											  REVERSE)))
							    NIL))))
			(CreatingBrowserFlg NIL)
			(T (LIST OldLinkLabels OldDepth OldFormat)))))))
)
(* * Changes to NCDOCUMENTCARD)

(DEFINEQ

(NC.MakeDocInspectorSelectionFn
  (LAMBDA (Property ValueFlg InspectWin)                     (* pmi: "25-Mar-87 15:05")

          (* * Called when user buttons in the make document inspector menu on the Property parameter.
	  Put up a menu of choices for new values for this parameter.)



          (* * rht 11/17/84: Now can select --CANCEL--. Notice strange way of checking for --DONE-- versus --CANCEL--.
	  This is because the Inspector package doesn't send the property name in Property arg if ValueFlg is on.
	  That bug has been reported.)



          (* * rht 10/11/85: Fixed to have a more correct interface to NC.AskLinkLabel when need to Select.)



          (* * rht 10/22/85: Now uses ChangedFlg to prevent NIL from showing up as value in inspector.)



          (* * rht 8/8/86: Changed call from NCP.GetLinkLabels to NC.RetrieveLinkLabels. Also now allows selection of value 
	  as well as property.)



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


    (DECLARE (GLOBALVARS NC.MenuFont NC.MakeDocParameters))
    (if (FMEMB Property (QUOTE (--DONE-- --CANCEL--)))
	then (DETACHWINDOW InspectWin)
	       (CLOSEW InspectWin)
	       (if ValueFlg
		   then (PUTPROP (QUOTE NC.MakeDocParameters)
				     (QUOTE --DONE--)
				     (QUOTE QUIT)))
	       NIL
      else (LET ((OldVal (GETPROP (QUOTE NC.MakeDocParameters)
				      Property))
		   (Answer (MENU (create MENU
					     ITEMS ←(CDR (FASSOC Property NC.MakeDocParameters))
					     TITLE ← "Choose New Value"
					     MENUFONT ← NC.MenuFont
					     CENTERFLG ← T
					     ITEMHEIGHT ←(IPLUS (FONTPROP NC.MenuFont
									      (QUOTE HEIGHT))
								  1))))
		   Links ChangedFlg)
	          (SETQ ChangedFlg (if (EQ Answer (QUOTE Select))
					 then (LET ((CardWin (MAINWINDOW InspectWin)))
						     (SETQ Links
						       (NC.AskLinkLabel
							 CardWin T T NIL NIL NIL
							 (COND
							   ((LISTP OldVal))
							   ((EQ OldVal (QUOTE ALL))
							     (NC.RetrieveLinkLabels
							       (fetch (Card NoteFile)
								  of (NC.CoerceToCard CardWin))
							       T))
							   (T NIL))
							 T)))
						(if Links
						    then (SETQ Answer (if (CAR Links)
									    else (QUOTE NONE)))
							   (NOT (EQUAL Answer OldVal)))
				       else (AND Answer (NOT (EQUAL Answer OldVal)))))
	          (if ChangedFlg
		      then (PUTPROP (QUOTE NC.MakeDocParameters)
					Property Answer)
			     (INSPECTW.REDISPLAY InspectWin Property))
	          (INSPECTW.SELECTITEM InspectWin)
	      NIL))))
)
(* * Changes to NCLINKINDEXCARD)

(DEFINEQ

(NC.AskLinkIndexSpecs
  (LAMBDA (Card OldLinkLabels OldBackLinksFlg CreatingLinkIndexFlg)
                                                             (* pmi: " 2-Apr-87 11:23")

          (* * Puts up the stylesheet asking user about link types, and whether to create back links.
	  This is modeled on NC.AskBrowserSpecs.)



          (* * fgh 11/17/85 Updated to use NoteFile rather than PSA.Database)



          (* * rht 9/19/86: Now takes Card arg rather than MainWindow.)



          (* * pmi 4/2/87: Added NC.MenuFont to all menus.)


    (DECLARE (GLOBALVARS NC.MenuFont))
    (LET ((MainWindow (NC.FetchWindow Card))
	  (NoteFile (fetch (Card NoteFile) of Card))
	  LinkLabels Position Choices ReverseFlg)
         (SETQ LinkLabels (NC.RetrieveLinkLabels NoteFile T))
         (SETQ Position (AND (WINDOWP MainWindow)
				 (create POSITION
					   XCOORD ←(fetch (REGION LEFT) of (WINDOWPROP
										 MainWindow
										 (QUOTE REGION)))
					   YCOORD ←(fetch (REGION TOP) of (WINDOWREGION 
										       MainWindow)))))
                                                             (* The stylesheet is in a global var.
							     We only need to provide its position, items, and 
							     selections.)
         (STYLE.PROP NC.LinkIndexSpecsStylesheet (QUOTE POSITION)
		       Position)
         (STYLE.PROP NC.LinkIndexSpecsStylesheet (QUOTE ITEMS)
		       (LIST (create MENU
					 ITEMS ← LinkLabels
					 MENUFONT ← NC.MenuFont)
			       (create MENU
					 ITEMS ←(for Link in LinkLabels
						   collect (PACK* (QUOTE ←)
								      Link))
					 MENUFONT ← NC.MenuFont)
			       (create MENU
					 ITEMS ←(QUOTE (Yes No))
					 MENUFONT ← NC.MenuFont)))
         (STYLE.PROP NC.LinkIndexSpecsStylesheet (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)
			       (COND
				 (OldBackLinksFlg (QUOTE Yes))
				 (T (QUOTE No)))))
         (SETQ Choices (STYLESHEET NC.LinkIndexSpecsStylesheet))
         (COND
	   (Choices (LIST (APPEND (CAR Choices)
				      (CADR Choices))
			    (COND
			      ((EQ (CADDR Choices)
				     (QUOTE Yes))
				T)
			      (T NIL))))
	   (CreatingLinkIndexFlg NIL)
	   (T (LIST OldLinkLabels OldBackLinksFlg))))))
)
(PUTPROPS PMIPATCH018 COPYRIGHT ("Xerox Corporation" 1987))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (2829 14916 (NC.InspectorSelectionFn 2839 . 5064) (NC.InspectorTitleCommandFn 5066 . 
5506) (NC.DefaultCardTypeSelectionFn 5508 . 6320) (NC.ArrowHeadsInBrowserSelectionFn 6322 . 7259) (
NC.MakeMainMenu 7261 . 14914)) (14959 15223 (NC.MenuFontAfterChangeFn 14969 . 15221)) (15707 32594 (
NC.AskLinkLabel 15717 . 20721) (NC.ChooseTopLevelCard 20723 . 23008) (NC.InstallTitleBarLeftMenu 23010
 . 23638) (NC.FileBrowserMenu 23640 . 26008) (NC.ListOfNoteFilesMenu 26010 . 29534) (
NC.NoteFileIconMiddleButtonFn 29536 . 31349) (NC.PopUpNoteFileName 31351 . 32592)) (32636 33075 (
NC.ResetCachedMenus 32646 . 33073)) (33393 35191 (NC.AskUserAboutTruncation 33403 . 35189)) (35223 
41938 (NC.EditPropList 35233 . 41331) (NC.InstallTitleBarMiddleMenu 41333 . 41936)) (41970 44494 (
NC.LinkIconMiddleButtonFn 41980 . 44492)) (44529 45378 (NC.InstallTextTitleBarMiddleMenu 44539 . 45376
)) (45416 65400 (NC.GetGraphEditMenu 45426 . 47847) (NC.BrowserFixGraphEditMenuFn 47849 . 49592) (
NC.BrowserDeleteLink 49594 . 56330) (NC.BrowserRemoveEdge 56332 . 60837) (NC.AskBrowserSpecs 60839 . 
65398)) (65439 68252 (NC.MakeDocInspectorSelectionFn 65449 . 68250)) (68292 70975 (
NC.AskLinkIndexSpecs 68302 . 70973)))))
STOP