(FILECREATED "13-Apr-86 16:07:23" {QV}<NOTECARDS>1.3K>RHTPATCH038.;9 87104  

      changes to:  (FNS NC.AddCardType NC.MakeCardTypesList NC.SetupTitleBarMenu NC.ShowInfo)
		   (MACROS NC.GetCardTypeField)
		   (VARS RHTPATCH038COMS)
		   (RECORDS NoteCardType)

      previous date: "12-Apr-86 00:51:52" {QV}<NOTECARDS>1.3K>RHTPATCH038.;8)


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

(PRETTYCOMPRINT RHTPATCH038COMS)

(RPAQQ RHTPATCH038COMS ((* * New functions for NCLINKS)
			  (FNS NC.AddLinkToCard NC.AddLinksToCard)
			  (* * Changes to NCLINKS)
			  (FNS NC.AddLinkToGraphCard NC.AddLinkToSketchCard)
			  (* * New function for NCCARDS)
			  (FNS NC.ShowInfo)
			  (* * Changes to NCCARDS)
			  (RECORDS Card)
			  (FNS NC.EditProperties NC.EditPropList NC.AddPropToPropList 
			       NC.DelPropFromList)
			  (* * Changes to NOTECARDS)
			  (FNS NC.Setup)
			  (* * Please remove the following global vars from NOTECARDS: 
			     NC.WindowRightButtonMenu)
			  (* * Changes to NCINTERFACE)
			  (FNS NC.SetupTitleBarMenu)
			  (* * Please remove the following global vars from NCINTERFACE: 
			     NC.BrowserTitleBarMiddleButtonMenu NC.GraphTitleBarMiddleButtonMenu 
			     NC.SketchTitleBarMenu NC.GraphTitleBarMenu NC.BrowserTitleBarMenu 
			     NC.StructEditTitleBarMenu)
			  (* * Changes to NCTEXTCARD)
			  (FNS NC.AddTextCard NC.MakeTEditLeftMenu NC.MakeTEditMiddleMenu 
			       NC.TEditMenuFn NC.BringUpTEditCard NC.MakeTEditCard)
			  (* * Changes to NCFILEBOXCARD)
			  (FNS NC.AddFileBoxCard NC.MakeFileBox)
			  (* * Changes to NCGRAPHCARD)
			  (FNS NC.AddGraphCard)
			  (* * Please remove the following global vars from NCGRAPHCARD: 
			     NC.GraphTitleBarMiddleButtonMenu NC.GraphTitleBarMenu)
			  (* * Changes to NCBROWSERCARD)
			  (FNS NC.AddBrowserCard)
			  (* * Please remove the following global vars from NCBROWSERCARD: 
			     NC.BrowserTitleBarMenu)
			  (* * Changes to NCLINKINDEXCARD)
			  (FNS NC.AddLinkIndexCard NC.BringUpLinkIndexCard NC.MakeLinkIndex)
			  (* * Changes to NCSEARCHCARD)
			  (FNS NC.MakeSearchCard)
			  (* * Please remove the following global vars from NCSKETCHCARD: 
			     NC.SketchTitleBarMenu)
			  (* * Changes to NCTYPESMECH)
			  (RECORDS NoteCardType)
			  (MACROS NC.GetCardTypeField)
			  (FNS NC.MakeCardTypesList)
			  (GLOBALVARS NC.DefaultLeftButtonMenuItems NC.LocalInsertLinkMenuItem 
				      NC.GlobalInsertLinkMenuItem NC.DefaultMiddleButtonMenuItems)
			  (INITVARS (NC.DefaultMiddleButtonMenuItems NIL)
				    (NC.LocalInsertLinkMenuItem
				      (QUOTE (Insert% Link (FUNCTION NC.AddLinkToCard)
							   
		     "Insert a link to another card at the currently selected point in the text."
							   (SUBITEMS (Insert% Link
								       (FUNCTION NC.AddLinkToCard)
								       
		     "Insert a link to another card at the currently selected point in the text.")
								     (Insert% Links
								       (FUNCTION NC.AddLinksToCard)
								       
		       "Insert links to other cards at the currently selected point in the text.")
								     (Add% Global% Link
								       (FUNCTION 
									   NC.AddGlobalLinkToCard)
								       
						    "Add a global link emanating from this card.")
								     (Add% Global% Links
								       (FUNCTION 
									  NC.AddGlobalLinksToCard)
								       
					    "Add multiple global links emanating from this card.")))))
				    (NC.GlobalInsertLinkMenuItem
				      (QUOTE (Add% Global% Link (FUNCTION NC.AddGlobalLinkToCard)
								
						    "Add a global link emanating from this card."
								(SUBITEMS
								  (Add% Global% Link
								    (FUNCTION NC.AddGlobalLinkToCard)
								    
						    "Add a global link emanating from this card.")
								  (Add% Global% Links
								    (FUNCTION NC.AddGlobalLinksToCard)
								    
					    "Add multiple global links emanating from this card.")))))
				    (NC.DefaultLeftButtonMenuItems
				      (BQUOTE ((Edit% Property% List (FUNCTION NC.EditProperties)
								     
					"Brings up an editor for the property list of this card.")
					       (Show% Links (FUNCTION NC.ShowLinks)
							    
					   "Brings up a list of the links to and from this card.")
					       (Show% Info (FUNCTION NC.ShowInfo)
							   
			     "Brings up a window containing special information about this card.")
					       (Designate% Sources
						 (FUNCTION NC.AssignSources)
						 
				       "Designate the source(s) of the information in this card."
						 (SUBITEMS (Delete% Source (FUNCTION NC.DeleteSource)
									   
							"Delete one of the sources of this card.")))
					       (Designate% FileBoxes
						 (FUNCTION NC.AddParents)
						 "File this note card in one or more file boxes."
						 (SUBITEMS (Unfile% from% FileBoxes
							     (FUNCTION NC.UnfileNoteCard)
							     
					   "Remove this card from one or more of its file boxes.")))
					       (Assign% Title (FUNCTION NC.AssignTitle)
							      
						       "Assigns a (new) title to this note card.")
					       (Title/FileBoxes (FUNCTION (LAMBDA (TextStream)
										  (NC.AssignTitle
										    TextStream)
										  (NC.AddParents
										    TextStream)))
								
					    "Do both assigning of title and filing in fileboxes.")
					       , NC.LocalInsertLinkMenuItem
					       (Close% and% Save
						 (FUNCTION CLOSEW)
						 
					  "Close this note card after saving it in the NoteFile."
						 (SUBITEMS (Close% and% Save (FUNCTION CLOSEW)
									     
					  "Close this note card after saving it in the NoteFile.")
							   (Close% w/o% Saving
							     (FUNCTION NC.QuitWithoutSaving)
							     
		      "Close this note card without saving any changes made since the last Save.")
							   (Save% in% NoteFile
							     (FUNCTION NC.CardSaveFn)
							     
				       "Save this card in the NoteFile but don't close the card.")
							   (Delete% Card (FUNCTION NC.DeleteNoteCards)
									 
						"Permenantly delete this card from the NoteFile.")))))
				      ))))
(* * New functions for NCLINKS)

(DEFINEQ

(NC.AddLinkToCard
  (LAMBDA (CardIdentifier LinkOrLinkLabel DestinationCard)   (* rht: "11-Apr-86 20:20")

          (* * Add a link to card designated by CardIdentifier. Rest of args can be NIL. Currently, this dispatches on card 
	  type. Should eventually call something like an InsertLinkFn.)


    (LET ((Card (NC.CoerceToCard CardIdentifier))
	  CardType Window)
         (SETQ CardType (NC.FetchType Card))
         (SETQ Window (NC.FetchWindow Card))
         (OR LinkOrLinkLabel (SETQ LinkOrLinkLabel (NC.AskLinkLabel Window NIL NIL T T)))
         (AND LinkOrLinkLabel (COND
		  ((NC.IsSubTypeOfP CardType (QUOTE Text))
		    (NC.InsertLinkInText (NC.FetchSubstance Card)
					   LinkOrLinkLabel DestinationCard Card))
		  ((NC.IsSubTypeOfP CardType (QUOTE Graph))
		    (NC.AddLinkToGraphCard Window LinkOrLinkLabel DestinationCard))
		  ((NC.IsSubTypeOfP CardType (QUOTE Sketch))
		    (NC.AddLinkToSketchCard Window LinkOrLinkLabel DestinationCard)))))))

(NC.AddLinksToCard
  (LAMBDA (CardIdentifier LinkLabel DestinationCards)        (* rht: " 7-Apr-86 17:36")

          (* * Adds multiple links to card designated by CardIdentifier. Rest of args can be NIL.)


    (LET ((SourceCard (NC.CoerceToCard CardIdentifier))
	  CardType Window)
         (SETQ CardType (NC.FetchType SourceCard))
         (OR LinkLabel (SETQ LinkLabel (NC.AskLinkLabel (SETQ Window (NC.FetchWindow 
										       SourceCard))
							      NIL NIL T T)))
         (if LinkLabel
	     then (OR DestinationCards (SETQ DestinationCards
			    (NC.SelectNoteCards NIL (FUNCTION (LAMBDA (Card)
						      (COND
							((NOT (NC.SameCardP Card SourceCard))
							  T)
							(T (NC.PrintMsg (NC.FetchWindow 
										       SourceCard)
									  T 
							    "A Card/Box cannot point to itself. "
									  (CHARACTER 13)
									  "Selection ignored."
									  (CHARACTER 13))
							   NIL))))
						  NC.SelectingMultipleCardsMenu SourceCard NIL 
					     "Please select the Cards or Boxes to be pointed to.")))
		    (NC.ClearMsg Window T)
		    (for DestinationCard in DestinationCards do (NC.AddLinkToCard 
										   CardIdentifier 
											LinkLabel 
										  DestinationCard)))))
)
)
(* * Changes to NCLINKS)

(DEFINEQ

(NC.AddLinkToGraphCard
  (LAMBDA (Window LinkOrLinkLabel DestinationCard)           (* rht: " 7-Apr-86 17:16")
                                                             (* Add a NOTECARD link to a graph card.
							     Pass the fact that this is a link-add to 
							     NC.GraphAddNodeFn via the NoteCardInsertingLink window
							     property)

          (* * rht 4/7/86: Now can handle insertion of multiple links by accepting label and/or destination card args.
	  Either or both can be nil.)


    (WINDOWPROP Window (QUOTE NoteCardInsertingLink)
		  (if (type? Link LinkOrLinkLabel)
		      then LinkOrLinkLabel
		    else (NC.MakeLink Window LinkOrLinkLabel DestinationCard)))
    (EDITADDNODE Window)))

(NC.AddLinkToSketchCard
  (LAMBDA (SketchWindow LinkOrLinkLabel DestinationCard)     (* rht: " 7-Apr-86 17:24")
                                                             (* Called from a SKETCH window to add a new NoteCard 
							     Link Icon to the sketch)

          (* * rht 11/9/84: Now checks result of NC.MakeLink before building link.)



          (* * rht 4/7/86: Now accepts LinkOrLinkLabel and DestinationCard args. Either or both can be nil.)


    (if (NOT (type? Link LinkOrLinkLabel))
	then (SETQ LinkOrLinkLabel (NC.MakeLink SketchWindow
						      (OR LinkOrLinkLabel
							    (NC.AskLinkLabel SketchWindow NIL NIL T 
									       T))
						      DestinationCard)))
    (NC.InsertLinkInSketch SketchWindow LinkOrLinkLabel)))
)
(* * New function for NCCARDS)

(DEFINEQ

(NC.ShowInfo
  (LAMBDA (Window)                                           (* rht: "13-Apr-86 16:03")

          (* * Bring up an inspector on certain attribute/value pairs of this card. The default ones are card part dates and 
	  Updates.)



          (* * Need a hook so that users can provide other attribute/value pairs for given card types.)


    (LET ((Region (WINDOWREGION Window))
	  (Card (NC.CoerceToCard Window))
	  (Attributes (QUOTE (CardUID ItemDate TitleDate LinksDate PropsDate Updates)))
	  AttributesAndValues InfoWindow)
         (SETQ AttributesAndValues (LIST (QUOTE CardUID)
					     (fetch (Card UID) of Card)
					     (QUOTE ItemDate)
					     (NC.FetchItemDate Card)
					     (QUOTE TitleDate)
					     (NC.FetchTitleDate Card)
					     (QUOTE LinksDate)
					     (NC.FetchLinksDate Card)
					     (QUOTE PropsDate)
					     (NC.FetchPropListDate Card)
					     (QUOTE Updates)
					     (LISTGET (NC.FetchPropList Card)
							(QUOTE Updates))))
         (SETQ InfoWindow (INSPECTW.CREATE AttributesAndValues Attributes (FUNCTION LISTGET)
					       NIL "Can't set values of these attributes." NIL NIL 
					       "Card attributes"
					       NIL
					       (create POSITION
							 XCOORD ←(fetch (REGION LEFT) of Region)
							 YCOORD ←(PLUS (fetch (REGION BOTTOM)
									    of Region)
									 (fetch (REGION HEIGHT)
									    of Region)))))
         (ATTACHWINDOW InfoWindow Window (QUOTE TOP)
			 (QUOTE JUSTIFY)
			 (QUOTE LOCALCLOSE))
         (NC.MoveWindowOntoScreen Window))))
)
(* * Changes to NCCARDS)

[DECLARE: EVAL@COMPILE 

(ACCESSFNS Card (

          (* * Instance variables of the card object)


		   (UID (fetch (CardObject UID) of DATUM)
			(replace (CardObject UID) of DATUM with NEWVALUE))
		   (NoteFile (LET ((\NF (fetch (CardObject NoteFile) of DATUM)))
			          (COND
				    ((type? NoteFile \NF)
				      \NF)
				    (\NF (replace (CardObject NoteFile) of DATUM
					    with (NC.NoteFileFromNoteFileUID \NF)))))
			     (replace (CardObject NoteFile) of DATUM with NEWVALUE))
		   (Monitor (fetch (CardObject Monitor) of DATUM)
			    (replace (CardObject Monitor) of DATUM with NEWVALUE))
		   (Status (fetch (CardObject Status) of DATUM)
			   (replace (CardObject Status) of DATUM with NEWVALUE))
		   (IndexDirtyFlg (fetch (CardObject IndexDirtyFlg) of DATUM)
				  (replace (CardObject IndexDirtyFlg) of DATUM with NEWVALUE))
		   (IndexLoc (fetch (CardObject IndexLoc) of DATUM)
			     (replace (CardObject IndexLoc) of DATUM with NEWVALUE))
		   (MainLoc (fetch (CardObject MainLoc) of DATUM)
			    (replace (CardObject MainLoc) of DATUM with NEWVALUE))
		   (LinksLoc (fetch (CardObject LinksLoc) of DATUM)
			     (replace (CardObject LinksLoc) of DATUM with NEWVALUE))
		   (PropListLoc (fetch (CardObject PropListLoc) of DATUM)
				(replace (CardObject PropListLoc) of DATUM with NEWVALUE))
		   (TitleLoc (fetch (CardObject TitleLoc) of DATUM)
			     (replace (CardObject TitleLoc) of DATUM with NEWVALUE))
		   (Title (fetch (CardObject Title) of DATUM)
			  (replace (CardObject Title) of DATUM with NEWVALUE))
		   (TitleDirtyFlg (fetch (CardObject TitleDirtyFlg) of DATUM)
				  (replace (CardObject TitleDirtyFlg) of DATUM with NEWVALUE))
		   (Type (fetch (CardObject Type) of DATUM)
			 (replace (CardObject Type) of DATUM with NEWVALUE))
		   (ActiveFlg (fetch (CardObject ActiveFlg) of DATUM)
			      (replace (CardObject ActiveFlg) of DATUM with NEWVALUE))
		   (ActiveCardFlg (fetch (CardObject ActiveFlg) of DATUM)
				  (replace (CardObject ActiveFlg) of DATUM with NEWVALUE))
		   (CardCache (fetch (CardObject CardCache) of DATUM)
			      (replace (CardObject CardCache) of DATUM with NEWVALUE))
		   (UserData (fetch (CardObject UserData) of DATUM)
			     (replace (CardObject UserData) of DATUM with NEWVALUE))
		   (Substance (LET ((\Cache (fetch (CardObject CardCache) of DATUM)))
			           (AND \Cache (fetch (CardCache Substance) of \Cache)))
			      (LET ((\Cache (fetch (CardObject CardCache) of DATUM)))
			           (COND
				     (\Cache (replace (CardCache Substance) of \Cache
						with NEWVALUE))
				     (T (replace (CardObject CardCache) of DATUM
					   with (create CardCache
							    Substance ← NEWVALUE))
					NEWVALUE))))
		   (Links (LET ((\Cache (fetch (CardObject CardCache) of DATUM)))
			       (AND \Cache (fetch (CardCache Links) of \Cache)))
			  (LET ((\Cache (fetch (CardObject CardCache) of DATUM)))
			       (COND
				 (\Cache (replace (CardCache Links) of \Cache with NEWVALUE))
				 (T (replace (CardObject CardCache) of DATUM
				       with (create CardCache
							Links ← NEWVALUE))
				    NEWVALUE))))
		   (FromLinks (LET ((\Cache (fetch (CardObject CardCache) of DATUM))
				    \Links)
			           (AND \Cache (SETQ \Links (fetch (CardCache Links)
								   of \Cache))
					  (fetch (LinksCache FromLinks) of \Links)))
			      (LET ((\Cache (OR (fetch (CardObject CardCache) of DATUM)
						  (replace (CardObject CardCache) of DATUM
						     with (create CardCache))))
				    \Links)
			           (SETQ \Links (fetch (CardCache Links) of \Cache))
			           (COND
				     (\Links (replace (LinksCache FromLinks) of \Links
						with NEWVALUE))
				     (T (replace (CardCache Links) of \Cache
					   with (create LinksCache
							    FromLinks ← NEWVALUE))
					NEWVALUE))))
		   (ToLinks (LET ((\Cache (fetch (CardObject CardCache) of DATUM))
				  \Links)
			         (AND \Cache (SETQ \Links (fetch (CardCache Links)
								 of \Cache))
					(fetch (LinksCache ToLinks) of \Links)))
			    (LET ((\Cache (OR (fetch (CardObject CardCache) of DATUM)
						(replace (CardObject CardCache) of DATUM
						   with (create CardCache))))
				  \Links)
			         (SETQ \Links (fetch (CardCache Links) of \Cache))
			         (COND
				   (\Links (replace (LinksCache ToLinks) of \Links with 
											 NEWVALUE))
				   (T (replace (CardCache Links) of \Cache
					 with (create LinksCache
							  ToLinks ← NEWVALUE))
				      NEWVALUE))))
		   (GlobalLinks (LET ((\Cache (fetch (CardObject CardCache) of DATUM))
				      \Links)
				     (AND \Cache (SETQ \Links (fetch (CardCache Links)
								     of \Cache))
					    (fetch (LinksCache GlobalLinks) of \Links)))
				(LET ((\Cache (OR (fetch (CardObject CardCache) of DATUM)
						    (replace (CardObject CardCache) of DATUM
						       with (create CardCache))))
				      \Links)
				     (SETQ \Links (fetch (CardCache Links) of \Cache))
				     (COND
				       (\Links (replace (LinksCache GlobalLinks) of \Links
						  with NEWVALUE))
				       (T (replace (CardCache Links) of \Cache
					     with (create LinksCache
							      GlobalLinks ← NEWVALUE))
					  NEWVALUE))))
		   (PropList (LET ((\Cache (fetch (CardObject CardCache) of DATUM)))
			          (AND \Cache (fetch (CardCache PropList) of \Cache)))
			     (LET ((\Cache (fetch (CardObject CardCache) of DATUM)))
			          (COND
				    (\Cache (replace (CardCache PropList) of \Cache with 
											 NEWVALUE))
				    (T (replace (CardObject CardCache) of DATUM
					  with (create CardCache
							   PropList ← NEWVALUE))
				       NEWVALUE))))
		   (Region (LET ((\Cache (fetch (CardObject CardCache) of DATUM)))
			        (AND \Cache (fetch (CardCache Region) of \Cache)))
			   (LET ((\Cache (fetch (CardObject CardCache) of DATUM)))
			        (COND
				  (\Cache (replace (CardCache Region) of \Cache with NEWVALUE))
				  (T (replace (CardObject CardCache) of DATUM
					with (create CardCache
							 Region ← NEWVALUE))
				     NEWVALUE))))
		   (SavedRegion (LET ((\Cache (fetch (CardObject CardCache) of DATUM)))
				     (AND \Cache (fetch (CardCache SavedRegion) of \Cache)))
				(LET ((\Cache (fetch (CardObject CardCache) of DATUM)))
				     (COND
				       (\Cache (replace (CardCache SavedRegion) of \Cache
						  with NEWVALUE))
				       (T (replace (CardObject CardCache) of DATUM
					     with (create CardCache
							      SavedRegion ← NEWVALUE))
					  NEWVALUE))))
		   (ItemDate (LET ((\Cache (fetch (CardObject CardCache) of DATUM)))
			          (AND \Cache (fetch (CardCache ItemDate) of \Cache)))
			     (LET ((\Cache (fetch (CardObject CardCache) of DATUM)))
			          (COND
				    (\Cache (replace (CardCache ItemDate) of \Cache with 
											 NEWVALUE))
				    (T (replace (CardObject CardCache) of DATUM
					  with (create CardCache
							   ItemDate ← NEWVALUE))
				       NEWVALUE))))
		   (LinksDate (LET ((\Cache (fetch (CardObject CardCache) of DATUM)))
			           (AND \Cache (fetch (CardCache LinksDate) of \Cache)))
			      (LET ((\Cache (fetch (CardObject CardCache) of DATUM)))
			           (COND
				     (\Cache (replace (CardCache LinksDate) of \Cache
						with NEWVALUE))
				     (T (replace (CardObject CardCache) of DATUM
					   with (create CardCache
							    LinksDate ← NEWVALUE))
					NEWVALUE))))
		   (TitleDate (LET ((\Cache (fetch (CardObject CardCache) of DATUM)))
			           (AND \Cache (fetch (CardCache TitleDate) of \Cache)))
			      (LET ((\Cache (fetch (CardObject CardCache) of DATUM)))
			           (COND
				     (\Cache (replace (CardCache TitleDate) of \Cache
						with NEWVALUE))
				     (T (replace (CardObject CardCache) of DATUM
					   with (create CardCache
							    TitleDate ← NEWVALUE))
					NEWVALUE))))
		   (PropListDate (LET ((\Cache (fetch (CardObject CardCache) of DATUM)))
				      (AND \Cache (fetch (CardCache PropListDate) of \Cache)))
				 (LET ((\Cache (fetch (CardObject CardCache) of DATUM)))
				      (COND
					(\Cache (replace (CardCache PropListDate) of \Cache
						   with NEWVALUE))
					(T (replace (CardObject CardCache) of DATUM
					      with (create CardCache
							       PropListDate ← NEWVALUE))
					   NEWVALUE))))
		   (LinksDirtyFlg (LET ((\Cache (fetch (CardObject CardCache) of DATUM)))
				       (AND \Cache (fetch (CardCache LinksDirtyFlg) of \Cache)))
				  (LET ((\Cache (fetch (CardObject CardCache) of DATUM)))
				       (COND
					 (\Cache (replace (CardCache LinksDirtyFlg) of \Cache
						    with NEWVALUE))
					 (T (replace (CardObject CardCache) of DATUM
					       with (create CardCache
								LinksDirtyFlg ← NEWVALUE))
					    NEWVALUE))))
		   (PropListDirtyFlg (LET ((\Cache (fetch (CardObject CardCache) of DATUM)))
				          (AND \Cache (fetch (CardCache PropListDirtyFlg)
							   of \Cache)))
				     (LET ((\Cache (fetch (CardObject CardCache) of DATUM)))
				          (COND
					    (\Cache (replace (CardCache PropListDirtyFlg)
						       of \Cache with NEWVALUE))
					    (T (replace (CardObject CardCache) of DATUM
						  with (create CardCache
								   PropListDirtyFlg ← NEWVALUE))
					       NEWVALUE))))
		   (SubstanceDirtyFlg (LET ((\Cache (fetch (CardObject CardCache) of DATUM)))
				           (AND \Cache (fetch (CardCache SubstanceDirtyFlg)
							    of \Cache)))
				      (LET ((\Cache (fetch (CardObject CardCache) of DATUM)))
				           (COND
					     (\Cache (replace (CardCache SubstanceDirtyFlg)
							of \Cache with NEWVALUE))
					     (T (replace (CardObject CardCache) of DATUM
						   with (create CardCache
								    SubstanceDirtyFlg ← NEWVALUE))
						NEWVALUE))))
		   (NewCardFlg (LET ((\Cache (fetch (CardObject CardCache) of DATUM)))
				    (AND \Cache (fetch (CardCache NewCardFlg) of \Cache)))
			       (LET ((\Cache (fetch (CardObject CardCache) of DATUM)))
				    (COND
				      (\Cache (replace (CardCache NewCardFlg) of \Cache
						 with NEWVALUE))
				      (T (replace (CardObject CardCache) of DATUM
					    with (create CardCache
							     NewCardFlg ← NEWVALUE))
					 NEWVALUE))))
		   (BeingDeletedFlg (LET ((\Cache (fetch (CardObject CardCache) of DATUM)))
				         (AND \Cache (fetch (CardCache BeingDeletedFlg)
							  of \Cache)))
				    (LET ((\Cache (fetch (CardObject CardCache) of DATUM)))
				         (COND
					   (\Cache (replace (CardCache BeingDeletedFlg)
						      of \Cache with NEWVALUE))
					   (T (replace (CardObject CardCache) of DATUM
						 with (create CardCache
								  BeingDeletedFlg ← NEWVALUE))
					      NEWVALUE))))

          (* * Class variables of the card object {class == card type})


		   (SuperType (LET ((NoteCardType (fetch (Card Type) of DATUM)))
			           (NC.GetCardTypeField SuperType NoteCardType)))
		   (LinkDisplayMode (LET ((NoteCardType (fetch (Card Type) of DATUM)))
				         (NC.GetCardTypeField LinkDisplayMode NoteCardType)))
		   (DefaultWidth (LET ((NoteCardType (fetch (Card Type) of DATUM)))
				      (NC.GetCardTypeField DefaultWidth NoteCardType)))
		   (DefaultHeight (LET ((NoteCardType (fetch (Card Type) of DATUM)))
				       (NC.GetCardTypeField DefaultHeight NoteCardType)))
		   (LinkAnchorModesSupported (LET ((NoteCardType (fetch (Card Type) of DATUM)))
					          (NC.GetCardTypeField LinkAnchorModesSupported 
								       NoteCardType)))
		   (LinkIconAttachedBitMap (LET ((NoteCardType (fetch (Card Type) of DATUM)))
					        (NC.GetCardTypeField LinkIconAttachedBitMap 
								     NoteCardType)))
		   (LeftButtonMenuItems (LET ((NoteCardType (fetch (Card Type) of DATUM)))
					     (NC.GetCardTypeField LeftButtonMenuItems NoteCardType)))
		   (MiddleButtonMenuItems (LET ((NoteCardType (fetch (Card Type) of DATUM)))
					       (NC.GetCardTypeField MiddleButtonMenuItems 
								    NoteCardType)))

          (* * Methods of the card object {class == card type})


		   (MakeFn (LET ((NoteCardType (fetch (Card Type) of DATUM)))
			        (NC.GetCardTypeField MakeFn NoteCardType)))
		   (EditFn (LET ((NoteCardType (fetch (Card Type) of DATUM)))
			        (NC.GetCardTypeField EditFn NoteCardType)))
		   (QuitFn (LET ((NoteCardType (fetch (Card Type) of DATUM)))
			        (NC.GetCardTypeField QuitFn NoteCardType)))
		   (GetFn (LET ((NoteCardType (fetch (Card Type) of DATUM)))
			       (NC.GetCardTypeField GetFn NoteCardType)))
		   (PutFn (LET ((NoteCardType (fetch (Card Type) of DATUM)))
			       (NC.GetCardTypeField PutFn NoteCardType)))
		   (CopyFn (LET ((NoteCardType (fetch (Card Type) of DATUM)))
			        (NC.GetCardTypeField CopyFn NoteCardType)))
		   (MarkDirtyFn (LET ((NoteCardType (fetch (Card Type) of DATUM)))
				     (NC.GetCardTypeField MarkDirtyFn NoteCardType)))
		   (DirtyPFn (LET ((NoteCardType (fetch (Card Type) of DATUM)))
			          (NC.GetCardTypeField DirtyPFn NoteCardType)))
		   (CollectLinksFn (LET ((NoteCardType (fetch (Card Type) of DATUM)))
				        (NC.GetCardTypeField CollectLinksFn NoteCardType)))
		   (DeleteLinksFn (LET ((NoteCardType (fetch (Card Type) of DATUM)))
				       (NC.GetCardTypeField DeleteLinksFn NoteCardType)))
		   (UpdateLinkIconsFn (LET ((NoteCardType (fetch (Card Type) of DATUM)))
				           (NC.GetCardTypeField UpdateLinkIconsFn NoteCardType)))
		   (InsertLinkFn (LET ((NoteCardType (fetch (Card Type) of DATUM)))
				      (NC.GetCardTypeField InsertLinkFn NoteCardType)))
		   (TranslateWindowPositionFn (LET ((NoteCardType (fetch (Card Type) of DATUM)))
					           (NC.GetCardTypeField TranslateWindowPositionFn 
									NoteCardType))))
		  (CREATE (create CardObject))
		  (TYPE? (TYPE? CardObject DATUM)))
]
(DEFINEQ

(NC.EditProperties
  (LAMBDA (TextStream)                                       (* rht: "12-Apr-86 00:01")
                                                             (* Open a property list editor for the card 
							     corresponding to TextStream.
							     Called from Title bar menus.)

          (* * fgh 11/13/85 Updated to handle Card object.)



          (* * rht 4/11/86: No longer sticks dates and Updates in property list. Only user-defined stuff.)


    (LET ((Card (NC.CoerceToCard (WINDOW.FROM.TEDIT.THING TextStream)))
	  PropList)
         (SETQ PropList (NC.FetchPropList Card))
         (NC.OpenPropListEditor TextStream (for SubList on PropList by (CDDR SubList)
						when (NEQ (CAR SubList)
							      (QUOTE Updates))
						join (LIST (CAR SubList)
							       (CADR SubList)))
				  "Edit Property List"))))

(NC.EditPropList
  (LAMBDA (propList window showOnlyFlg)                      (* rht: "12-Apr-86 00:36")

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


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

(NC.AddPropToPropList
  (LAMBDA (editW)                                            (* rht: "12-Apr-86 00:38")
                                                             (* Add a new prop to the propList being edited in 
							     editW)

          (* * fgh 2/10/86 Fix problem with ClearMsg deleting editing window.)



          (* * rht 4/11/86: Fixed bug whereby it couldn't add property when none exist.)


    (PROG ((promptWindow (GETPROMPTWINDOW editW 5 NIL NIL))
	     selectedObject propName propValue insertPtr insertChars beginPtr
	     (stream (WINDOWPROP editW (QUOTE TEXTSTREAM)))
	     (tobj (WINDOWPROP editW (QUOTE TEXTOBJ)))
	     (propListLength (WINDOWPROP editW (QUOTE PROPERTYLIST.LENGTH))))
	    (SETQ propName (MKATOM (NC.AskUser "New Property Name is = " NIL NIL T promptWindow)
				       ))
	    (NC.PrintMsg promptWindow NIL (CHARACTER 13))
	    (SETQ propValue (NC.AskUser (CONCAT "Value for " propName " property = ")
					    NIL NIL T promptWindow))
                                                             (* Insert these values into the editW)
	    (if (GREATERP propListLength 0)
		then                                       (* Position just before selected button)
		       (NC.PrintMsg promptWindow T 
			     "Please select a property before which to insert this new property."
				      (CHARACTER 13))
		       (SETQ selectedObject (NC.SelectProperty editW))
		       (NC.ClearMsg promptWindow T)
		       (AND (NULL selectedObject)
			      (RETURN NIL))
		       (SETQ insertPtr (TEDIT.FIND.OBJECT tobj selectedObject))
	      else                                         (* No properties to insert before.)
		     (SETQ insertPtr 1))
	    (SETQ beginPtr insertPtr)                      (* Insert a button with this property name)
	    (TEDIT.INSERT.OBJECT (MBUTTON.CREATE propName (FUNCTION NC.EditPropButtonFN)
						     (FONTCREATE (QUOTE HELVETICA)
								   10
								   (QUOTE BOLD)))
				   stream insertPtr)         (* Spacer between Prop and Value)
	    (add insertPtr 1)
	    (TEDIT.INSERT stream (CHARACTER 9)
			    insertPtr)
	    (TEDIT.LOOKS (TEXTOBJ stream)
			   (QUOTE (PROTECTED ON))
			   insertPtr 1)
	    (add insertPtr 1)                              (* Create a new field (Copied from JBS's 
							     \TEXTMENU.DOC.CREATE))
	    (TEDIT.INSERT stream (CONCAT "  {}" (CHARACTER 13))
			    insertPtr)
	    (TEDIT.LOOKS (TEXTOBJ stream)
			   (QUOTE (PROTECTED ON))
			   insertPtr 5)
	    (TEDIT.LOOKS (TEXTOBJ stream)
			   (QUOTE (PROTECTED ON SELECTPOINT ON))
			   (IPLUS insertPtr 2)
			   1)
	    (TEDIT.INSERT stream (MKSTRING propValue)
			    (IPLUS insertPtr 3))
	    (TEDIT.LOOKS (TEXTOBJ stream)
			   (QUOTE (PROTECTED OFF SELECTPOINT OFF))
			   (IPLUS insertPtr 3)
			   (NCHARS (MKSTRING propValue)))
	    (add insertPtr (NCHARS (MKSTRING propValue)))
	    (add insertPtr 5)
	    (WINDOWPROP editW (QUOTE PROPERTYLIST.LENGTH)
			  (ADD1 propListLength)))))

(NC.DelPropFromList
  (LAMBDA (editW)                                            (* rht: "12-Apr-86 00:42")

          (* * rht 4/11/86: Now decrements PROPERTYLIST.LENGTH windowprop.)


    (PROG ((promptWindow (GETPROMPTWINDOW editW 5 NIL NIL))
	     (tobj (WINDOWPROP editW (QUOTE TEXTOBJ)))
	     (stream (WINDOWPROP editW (QUOTE TEXTSTREAM)))
	     (propListLength (WINDOWPROP editW (QUOTE PROPERTYLIST.LENGTH)))
	     selectedObject CH#)
	    (if (ZEROP propListLength)
		then (NC.PrintMsg promptWindow T "No properties to delete.")
		       (RETURN))
	    (NC.PrintMsg promptWindow T "Please select property to be deleted.")
	    (SETQ selectedObject (NC.SelectProperty editW))
	    (NC.ClearMsg promptWindow T)
	    (COND
	      ((COND
		  ((NOT (IMAGEOBJPROP selectedObject (QUOTE EditPropListNoDelete)))
		    (SETQ CH# (TEDIT.FIND.OBJECT tobj selectedObject))
		    (MBUTTON.FIND.NEXT.FIELD tobj CH#)     (* Delete everything between the imageobj and the 
							     end-of-line.)
		    (TEDIT.LOOKS tobj (QUOTE (PROTECTED OFF))
				   CH#
				   (IPLUS 2 (IDIFFERENCE (fetch CHLIM
								of (fetch SCRATCHSEL
									of tobj))
							     CH#)))
		    (TEDIT.DELETE stream CH# (IPLUS 2 (IDIFFERENCE (fetch CHLIM
									    of (fetch SCRATCHSEL
										    of tobj))
									 CH#)))
		    (TEDIT.SETSEL stream (GETEOFPTR stream)
				    0
				    (QUOTE RIGHT))
		    (WINDOWPROP editW (QUOTE PROPERTYLIST.LENGTH)
				  (SUB1 propListLength)))
		  (T (NC.PrintMsg promptWindow T "Selected property:value pair cannot be deleted."
				    (CHARACTER 13)))))))))
)
(* * Changes to NOTECARDS)

(DEFINEQ

(NC.Setup
  (LAMBDA NIL                                                (* rht: "11-Apr-86 22:47")

          (* * rht 11/17/84: Added definition of NC.InvisibleLinkImageObj.)



          (* * rht 4/11/86: Deleted short window menu stuff. Also dumped INTERCALC stuff and prompt window stuff.)


    (NC.InitializeUID)
    (SETQ AFTERLOGOUTFORMS (CONS (QUOTE (NC.InitializeUID))
				     AFTERLOGOUTFORMS))
    (SETQ UseMapWithPoliticalBoundaries T)
    (SETQ TEDIT.INPUT.FORMATS NIL)
    (NC.MakeMainMenu)
    (SETQ NC.LinkIconImageFns (IMAGEFNSCREATE (FUNCTION NC.LinkIconDisplayFn)
						  (FUNCTION NC.LinkIconImageBoxFn)
						  (FUNCTION NC.LinkIconPutFn)
						  (FUNCTION NC.LinkIconGetFn)
						  (FUNCTION NC.LinkIconCopyFn)
						  (FUNCTION NC.LinkIconButtonEventInFn)
						  (FUNCTION NILL)
						  (FUNCTION NC.LinkIconWhenMovedFn)
						  (FUNCTION NC.LinkIconWhenInsertedFn)
						  (FUNCTION NC.LinkIconWhenDeletedFn)
						  (FUNCTION NC.LinkIconWhenCopiedFn)
						  (FUNCTION NILL)
						  (FUNCTION NILL)))
    (SETQ NC.NoDeleteImageFns (PROG ((ImageObj (NC.MakeLinkIcon NIL)))
				        (replace (IMAGEOBJ IMAGEOBJFNS) of ImageObj
					   with (create IMAGEFNS using (fetch (IMAGEOBJ
											IMAGEOBJFNS)
										of ImageObj)))
				        (IMAGEOBJPROP ImageObj (QUOTE WHENDELETEDFN)
							(FUNCTION NILL))
				        (RETURN (fetch (IMAGEOBJ IMAGEOBJFNS) of ImageObj))))
    (SETQ NC.DeletedLinkImageFns (IMAGEFNSCREATE (FUNCTION NC.DeletedLinkDisplayFn)
						     (FUNCTION NC.DeletedLinkImageBoxFn)
						     (FUNCTION NC.DeletedLinkPutFn)
						     (FUNCTION NC.DeletedLinkGetFn)
						     (FUNCTION NILL)
						     (FUNCTION NILL)
						     (FUNCTION NILL)
						     (FUNCTION NILL)
						     (FUNCTION NILL)
						     (FUNCTION NILL)
						     (FUNCTION NILL)
						     (FUNCTION NILL)
						     (FUNCTION NILL)))
    (SETQ NC.DeletedLinkImageObject (IMAGEOBJCREATE "DeletedLink" NC.DeletedLinkImageFns))
    (SETQ NC.InvisibleLinkImageFns (IMAGEFNSCREATE (FUNCTION NILL)
						       (FUNCTION NC.InvisibleLinkImageBoxFn)
						       (FUNCTION NC.InvisibleLinkPutFn)
						       (FUNCTION NC.InvisibleLinkGetFn)
						       (FUNCTION NILL)
						       (FUNCTION NILL)
						       (FUNCTION NILL)
						       (FUNCTION NILL)
						       (FUNCTION NILL)
						       (FUNCTION NILL)
						       (FUNCTION NILL)
						       (FUNCTION NILL)
						       (FUNCTION NILL)))
    (SETQ NC.InvisibleLinkImageObject (IMAGEOBJCREATE "InvisibleLink" NC.InvisibleLinkImageFns))))
)
(* * Please remove the following global vars from NOTECARDS: NC.WindowRightButtonMenu)

(* * Changes to NCINTERFACE)

(DEFINEQ

(NC.SetupTitleBarMenu
  (LAMBDA (Window Card NoteCardType)                         (* rht: "26-Mar-86 15:10")
                                                             (* Setup the title bar menu for the window Window 
							     pertaining to Card specified by ID)

          (* * rht 1/3/85: Now takes optional NoteCardType arg in case need to override the ID's type.
	  Like when ID is of type that inherits from Browser. Also changed "pointer" to "link" everywhere.)



          (* * rht 1/12/85: Added menu for StructEdit type. Just the same except has no InsertLink operation.
	  This needs to be cleaned up and interfaced to Types mechanism.)



          (* * rht 1/15/85: Added "Relayout" item to the browser title bar middle button menu, and made graph and structedit 
	  cards contain only that item on their middle button menus.)



          (* * rht 5/22/85: Took out structedit and structeditbrowser junk.)



          (* * fgh 11/14/85 Updated to handle Card object.)


    (OR NoteCardType (SETQ NoteCardType (NC.RetrieveType Card)))
    (OR (EQ (WINDOWPROP Window (QUOTE BUTTONEVENTFN))
		(FUNCTION NC.TitleBarButtonEventFn))
	  (WINDOWPROP Window (QUOTE OLDBUTTONEVENTFN)
			(WINDOWPROP Window (QUOTE BUTTONEVENTFN)
				      (FUNCTION NC.TitleBarButtonEventFn))))
    (WINDOWPROP Window (QUOTE TitleBarLeftButtonMenu)
		  (SELECTQ
		    NoteCardType
		    (Graph (OR (AND (BOUNDP (QUOTE NC.GraphTitleBarMenu))
					(type? MENU NC.GraphTitleBarMenu))
				 (SETQ NC.GraphTitleBarMenu
				   (create MENU
					     ITEMS ←(QUOTE
					       ((Edit% Property% List (FUNCTION NC.EditProperties)
								      
					"Brings up an editor for the property list of this card.")
						 (Show% Links (FUNCTION NC.ShowLinks)
							      
					   "Brings up a list of the links to and from this card.")
						 (Title/Sources/FileBoxes
						   (FUNCTION (LAMBDA (TextStream)
						       (NC.AssignTitle TextStream)
						       (NC.AssignSources TextStream)
						       (NC.AddParents TextStream)))
						   
		       "Do all of the operations necessary to file this note card in a file box."
						   (SUBITEMS (Assign% Title (FUNCTION 
									      NC.AssignTitle)
									    
						       "Assigns a (new) title to this note card.")
							     (Designate% Sources
							       (FUNCTION NC.AssignSources)
							       
				       "Designate the source(s) of the information in this card.")
							     (File% in% FileBoxes
							       (FUNCTION NC.AddParents)
							       
						 "File this note card in one or more file boxes.")
							     (Unfile% from% FileBoxes
							       (FUNCTION NC.UnfileNoteCard)
							       
					   "Remove this card from one or more of its file boxes.")
							     (Delete% Source (FUNCTION 
									       NC.DeleteSource)
									     
							"Delete one of the sources of this card.")))
						 (Insert% Link (FUNCTION NC.AddLinkToGraphCard)
							       
						   "Add a node that points to another note card."
							       (SUBITEMS
								 (Insert% Link
								   (FUNCTION NC.AddLinkToGraphCard)
								   
						   "Add a node that points to another note card.")
								 (Add% Global% Link
								   (FUNCTION NC.AddGlobalLinkToCard)
								   
						    "Add a global link emanating from this card.")
								 (Add% Global% Links
								   (FUNCTION 
								     NC.AddGlobalLinksToCard)
								   
						     "Add global links emanating from this card.")))
						 (Close% and% Save
						   (FUNCTION CLOSEW)
						   
					  "Close this note card after saving it in the NoteFile."
						   (SUBITEMS (Close% and% Save
							       (FUNCTION CLOSEW)
							       
					  "Close this note card after saving it in the NoteFile.")
							     (Close% w/o% Saving
							       (FUNCTION NC.QuitWithoutSaving)
							       
		      "Close this note card without saving any changes made since the last Save.")
							     (Save% in% NoteFile
							       (FUNCTION NC.CardSaveFn)
							       
				       "Save this card in the NoteFile but don't close the card.")
							     (Delete% Card (FUNCTION 
									     NC.DeleteNoteCards)
									   
						"Permenantly delete this card from the NoteFile.")))))
					     CENTERFLG ← T
					     MENUFONT ←(FONTCREATE (QUOTE HELVETICA)
								     10
								     (QUOTE BOLD)))))
			   NC.GraphTitleBarMenu)
		    (Browser (OR (AND (BOUNDP (QUOTE NC.BrowserTitleBarMenu))
					  (type? MENU NC.BrowserTitleBarMenu))
				   (SETQ NC.BrowserTitleBarMenu
				     (create MENU
					       ITEMS ←(QUOTE
						 ((Edit% Property% List (FUNCTION NC.EditProperties)
									
					"Brings up an editor for the property list of this card.")
						   (Show% Links (FUNCTION NC.ShowLinks)
								
					   "Brings up a list of the links to and from this card.")
						   (Title/Sources/FileBoxes
						     (FUNCTION (LAMBDA (TextStream)
							 (NC.AssignTitle TextStream)
							 (NC.AssignSources TextStream)
							 (NC.AddParents TextStream)))
						     
		       "Do all of the operations necessary to file this note card in a file box."
						     (SUBITEMS (Assign% Title (FUNCTION 
										NC.AssignTitle)
									      
						       "Assigns a (new) title to this note card.")
							       (Designate% Sources
								 (FUNCTION NC.AssignSources)
								 
				       "Designate the source(s) of the information in this card.")
							       (File% in% FileBoxes
								 (FUNCTION NC.AddParents)
								 
						 "File this note card in one or more file boxes.")
							       (Unfile% from% FileBoxes
								 (FUNCTION NC.UnfileNoteCard)
								 
					   "Remove this card from one or more of its file boxes.")
							       (Delete% Source
								 (FUNCTION NC.DeleteSource)
								 
							"Delete one of the sources of this card.")))
						   (Add% Global% Link
						     (FUNCTION NC.AddGlobalLinkToCard)
						     "Add a global link emanating from this card."
						     (SUBITEMS (Add% Global% Link
								 (FUNCTION NC.AddGlobalLinkToCard)
								 
						    "Add a global link emanating from this card.")
							       (Add% Global% Links
								 (FUNCTION NC.AddGlobalLinksToCard)
								 
						     "Add global links emanating from this card.")))
						   (Close% and% Save
						     (FUNCTION CLOSEW)
						     
					  "Close this note card after saving it in the NoteFile."
						     (SUBITEMS (Close% and% Save
								 (FUNCTION CLOSEW)
								 
					  "Close this note card after saving it in the NoteFile.")
							       (Close% w/o% Saving
								 (FUNCTION NC.QuitWithoutSaving)
								 
		      "Close this note card without saving any changes made since the last Save.")
							       (Save% in% NoteFile
								 (FUNCTION NC.CardSaveFn)
								 
				       "Save this card in the NoteFile but don't close the card.")
							       (Delete% Card (FUNCTION 
									       NC.DeleteNoteCards)
									     
						"Permenantly delete this card from the NoteFile.")))))
					       CENTERFLG ← T
					       MENUFONT ←(FONTCREATE (QUOTE HELVETICA)
								       10
								       (QUOTE BOLD)))))
			     NC.BrowserTitleBarMenu)
		    (Sketch (OR (AND (BOUNDP (QUOTE NC.SketchTitleBarMenu))
					 (type? MENU NC.SketchTitleBarMenu))
				  (SETQ NC.SketchTitleBarMenu
				    (create MENU
					      ITEMS ←(QUOTE
						((Edit% Property% List (FUNCTION NC.EditProperties)
								       
					"Brings up an editor for the property list of this card.")
						  (Show% Links (FUNCTION NC.ShowLinks)
							       
					   "Brings up a list of the links to and from this card.")
						  (Title/Sources/FileBoxes
						    (FUNCTION (LAMBDA (TextStream)
							(NC.AssignTitle TextStream)
							(NC.AssignSources TextStream)
							(NC.AddParents TextStream)))
						    
		       "Do all of the operations necessary to file this note card in a file box."
						    (SUBITEMS (Assign% Title (FUNCTION 
									       NC.AssignTitle)
									     
						       "Assigns a (new) title to this note card.")
							      (Designate% Sources
								(FUNCTION NC.AssignSources)
								
				       "Designate the source(s) of the information in this card.")
							      (File% in% FileBoxes
								(FUNCTION NC.AddParents)
								
						 "File this note card in one or more file boxes.")
							      (Unfile% from% FileBoxes
								(FUNCTION NC.UnfileNoteCard)
								
					   "Remove this card from one or more of its file boxes.")
							      (Delete% Source (FUNCTION 
										NC.DeleteSource)
									      
							"Delete one of the sources of this card.")))
						  (Insert% Link (FUNCTION NC.AddLinkToSketchCard)
								
						 "Add a link to another card to this sketch/map."
								(SUBITEMS
								  (Insert% Link
								    (FUNCTION 
								      NC.AddLinkToSketchCard)
								    
						 "Add a link to another card to this sketch/map.")
								  (Add% Global% Link
								    (FUNCTION 
								      NC.AddGlobalLinkToCard)
								    
						    "Add a global link emanating from this card.")
								  (Add% Global% Links
								    (FUNCTION 
								      NC.AddGlobalLinksToCard)
								    
						     "Add global links emanating from this card.")))
						  (Close% and% Save
						    (FUNCTION CLOSEW)
						    
					  "Close this note card after saving it in the NoteFile."
						    (SUBITEMS (Close% and% Save
								(FUNCTION CLOSEW)
								
					  "Close this note card after saving it in the NoteFile.")
							      (Close% w/o% Saving
								(FUNCTION NC.QuitWithoutSaving)
								
		      "Close this note card without saving any changes made since the last Save.")
							      (Save% in% NoteFile
								(FUNCTION NC.CardSaveFn)
								
				       "Save this card in the NoteFile but don't close the card.")
							      (Delete% Card (FUNCTION 
									      NC.DeleteNoteCards)
									    
						"Permenantly delete this card from the NoteFile.")))))
					      CENTERFLG ← T
					      MENUFONT ←(FONTCREATE (QUOTE HELVETICA)
								      10
								      (QUOTE BOLD)))))
			    NC.SketchTitleBarMenu)
		    NIL))
    (COND
      ((EQ NoteCardType (QUOTE Browser))
	(WINDOWPROP Window (QUOTE TitleBarMiddleButtonMenu)
		      (OR (AND (BOUNDP (QUOTE NC.BrowserTitleBarMiddleButtonMenu))
				   (type? MENU NC.BrowserTitleBarMiddleButtonMenu)
				   NC.BrowserTitleBarMiddleButtonMenu)
			    (SETQ NC.BrowserTitleBarMiddleButtonMenu
			      (create MENU
					ITEMS ←(QUOTE ((Recompute% Browser (FUNCTION 
									     NC.UpdateBrowserCard)
									     
			     "Recomputes this browser to show the current state of the NoteFile.")
							  (Relayout% Graph (FUNCTION 
									   NC.RelayoutBrowserCard)
									   
						    "Re-layout the browser, but keep same nodes.")
							  (Reconnect% Nodes (FUNCTION 
									 NC.ConnectNodesInBrowser)
									    
	   "Draw all possible links, from currently selected link types, between pairs of nodes.")
							  (Unconnect% Nodes (FUNCTION 
								       NC.UnconnectNodesInBrowser)
									    
							       "Undraw all links in the browser.")
							  (Expand% Browser% Node
							    (FUNCTION NC.ExpandBrowserNode)
							    
					      "Expand the graph under one node to a given depth.")
							  (Graph% Edit% Menu (FUNCTION 
									      NC.GetGraphEditMenu)
									     
								"Bring up the graph editor menu.")
							  (Change% Browser% Specs
							    (FUNCTION NC.ChangeBrowserSpecs)
							    
		 "Make changes to some or all of the browser specs, e.g. link types, depth, etc.")
							  (Browser% Overview% Win
							    (FUNCTION NC.MakeBrowserOverviewWin)
							    "Attach the browser overview window.")
							  (Change% Overview% Specs
							    (FUNCTION NC.AskBrowserOverviewSpecs)
							    
			      "Change the browser overview specs: where to attach and what mode.")))
					CENTERFLG ← T
					MENUFONT ←(FONTCREATE (QUOTE HELVETICA)
								10
								(QUOTE BOLD)))))))
      ((EQ NoteCardType (QUOTE Graph))
	(WINDOWPROP Window (QUOTE TitleBarMiddleButtonMenu)
		      (OR (AND (BOUNDP (QUOTE NC.GraphTitleBarMiddleButtonMenu))
				   (type? MENU NC.GraphTitleBarMiddleButtonMenu)
				   NC.GraphTitleBarMiddleButtonMenu)
			    (SETQ NC.GraphTitleBarMiddleButtonMenu
			      (create MENU
					ITEMS ←(QUOTE ((Relayout% Graph (FUNCTION 
									    NC.RelayoutGraphCard)
									  
						      "Re-layout the graph, but keep same nodes.")))
					CENTERFLG ← T
					MENUFONT ←(FONTCREATE (QUOTE HELVETICA)
								10
								(QUOTE BOLD))))))))))
)
(* * Please remove the following global vars from NCINTERFACE: 
NC.BrowserTitleBarMiddleButtonMenu NC.GraphTitleBarMiddleButtonMenu NC.SketchTitleBarMenu 
NC.GraphTitleBarMenu NC.BrowserTitleBarMenu NC.StructEditTitleBarMenu)

(* * Changes to NCTEXTCARD)

(DEFINEQ

(NC.AddTextCard
  (LAMBDA NIL                                                (* rht: "11-Apr-86 21:38")

          (* * fgh 2/17/86 Added attached bit map field.)



          (* * rht 4/7/86: Now you get all TEdit menu items on middle button as well as Restart% Editor.)


    (NC.AddCardType (QUOTE Text)
		      (QUOTE NoteCard)
		      (BQUOTE ((MakeFn , (FUNCTION NC.MakeTEditCard))
				 (EditFn , (FUNCTION NC.BringUpTEditCard))
				 (QuitFn , (FUNCTION NC.TEditCloseFn))
				 (GetFn , (FUNCTION NC.GetTextSubstance))
				 (PutFn , (FUNCTION NC.PutTextSubstance))
				 (CopyFn , (FUNCTION NC.TextCopySubstance))
				 (MarkDirtyFn , (FUNCTION NC.MarkTextDirty))
				 (DirtyPFn , (FUNCTION NC.TextDirtyP))
				 (CollectLinksFn , (FUNCTION NC.CollectReferencesInText))
				 (DeleteLinksFn , (FUNCTION NC.DelReferencesToCardFromText))
				 (UpdateLinkIconsFn , (FUNCTION NC.UpdateLinkImagesInText))
				 (InsertLinkFn , (FUNCTION NC.InsertLinkInTextWindow))
				 (TranslateWindowPositionFn , (FUNCTION 
							NC.TranslateWindowPositionToTEditPosition))))
		      (BQUOTE ((LinkDisplayMode Title)
				 (DisplayedInMenuFlg T)
				 (DefaultWidth 300)
				 (DefaultHeight 200)
				 (LinkAnchorModesSupported T)
				 (LinkIconAttachedBitMap , NC.TextCardIcon)
				 (MiddleButtonMenuItems
				   ,
				   (APPEND (for Item in (fetch (MENU ITEMS) of 
									       TEDIT.DEFAULT.MENU)
						collect
						 (if (EQ Item (QUOTE Quit))
						     then (QUOTE (Quit (FUNCTION NC.QuitCard)
									   
					  "Close this note card after saving it in the NoteFile."))
						   else Item))
					     (QUOTE ((Restart% Editor (FUNCTION NC.ResetTEdit)
									
					      "Resets and restarts the editor for this Card/Box.")))))
				 )))))

(NC.MakeTEditLeftMenu
  (LAMBDA (Window NoteCardType)                              (* rht: "11-Apr-86 21:27")

          (* * Make the LeftButton TEdit menu appropriate for this type of text card. If menu doesn't exist, then make it.)



          (* * rht 8/1/84: Added a new menu item for the CONTENTS menu called Collect Children)



          (* * rht 9/17/84: (actually redoing earlier changes which got trashed) Added menu item for the CONTENTS menu called
	  Make Document.)



          (* * rht 9/20/84: New menu item for TEXT menu called "Insert Spreadsheet".)



          (* * rht 9/25/84: Made MakeDocument also present in TEXT menu.)



          (* * rht 12/8/84: Now both fileboxes and notecards do filing via NC.AddParents. Also took out all the strange uses 
	  of NC.TEditMenus.)



          (* * rht 4/7/86: Now finds menu on card type's LeftButtonMenuItems slot.)


    (WINDOWPROP Window (QUOTE TitleBarLeftButtonMenu)
		  (create MENU
			    ITEMS ←(NC.GetCardTypeField LeftButtonMenuItems NoteCardType)
			    CENTERFLG ← T
			    MENUFONT ←(FONTCREATE (QUOTE HELVETICA)
						    10
						    (QUOTE BOLD))))))

(NC.MakeTEditMiddleMenu
  (LAMBDA (Window NoteCardType)                              (* rht: "11-Apr-86 21:27")

          (* * Make the Middle Button Menu fort a Tedit card.)



          (* * rht 4/7/86: Now finds menu items on Text card type slot.)


    (WINDOWPROP Window (QUOTE TitleBarMiddleButtonMenu)
		  (\TEDIT.CREATEMENU (NC.GetCardTypeField MiddleButtonMenuItems NoteCardType)))))

(NC.TEditMenuFn
  (LAMBDA (Window)                                           (* rht: "11-Apr-86 21:23")

          (* * Gets called from LEFT or MIDDLE button press in title bar of TEdit window. If LEFT press bring up the 
	  Notecards Manipulation Window. IF MIDDLE press bring up the TEdit specific NoteCard operations menu.
	  Bring up menus using TEDIT.DEFAULT.MENUFN)



          (* * rht 4/11/86: No only calls TEDIT.DEFAULT.MENUFN for middle button press. On left button press, works like 
	  graph and sketch cards.)


    (if (LASTMOUSESTATE LEFT)
	then (APPLY* (OR (MENU (WINDOWPROP Window (QUOTE TitleBarLeftButtonMenu)))
			       (FUNCTION NILL))
			 Window)
      else (WINDOWPROP Window (QUOTE TEDIT.MENU)
			   (WINDOWPROP Window (QUOTE TitleBarMiddleButtonMenu)))
	     (TEDIT.DEFAULT.MENUFN Window))))

(NC.BringUpTEditCard
  (LAMBDA (Card TextStream Region/Position)                  (* rht: "11-Apr-86 21:26")
                                                             (* Bring up a TEdit window for Card ID whose text 
							     stream is TextStream in Region specified by 
							     Region/Position or by the user.)

          (* * rht 9/10/85: Fixed call to NC.MakeTEditPropsList so prompt window gets fixed up before card is brought up.)



          (* * fgh 11/13/85 Updated to handle Card objects.)



          (* * kirk 2Dec85 Removed illegal RETURN)



          (* * rht 4/11/86: Added Type arg to call to NC.MakeTEditMiddleMenu and changed names of menu windowprops.)


    (LET (Region TEditWindow TEditProcess Title TextStreamDirtyFlg Type)
         (COND
	   ((AND (SETQ TEditWindow (WINDOW.FROM.TEDIT.THING TextStream))
		   (SETQ TEditProcess (WINDOWPROP TEditWindow (QUOTE PROCESS))))
	     (TOTOPW TEditWindow)
	     (RPTQ 2 (FLASHW TEditWindow))
	     (TTY.PROCESS TEditProcess)
	     TEditWindow)
	   (T (SETQ Region (NC.DetermineDisplayRegion Card Region/Position))
	      (SETQ Title (NC.RetrieveTitle Card))
	      (SETQ Type (NC.RetrieveType Card))
	      (SETQ TEditWindow (CREATEW Region Title NIL T))
	      (WINDOWADDPROP TEditWindow (QUOTE SHRINKFN)
			       (FUNCTION NC.TextCardShrinkFn))
	      (NC.MakeTEditLeftMenu TEditWindow Type)
	      (NC.MakeTEditMiddleMenu TEditWindow Type)
	      (SETQ TextStreamDirtyFlg (NC.CardDirtyP Card))
	      (TEDIT TextStream TEditWindow NIL (NC.MakeTEditPropsList TEditWindow))
	      (AND TextStreamDirtyFlg (NC.MarkCardDirty Card))))
     TEditWindow)))

(NC.MakeTEditCard
  (LAMBDA (Card Title NoDisplayFlg)                          (* rht: "11-Apr-86 22:02")
                                                             (* Make up a blank text card and display it.)

          (* * rht 9/10/85: Fixed call to NC.MakeTEditPropsList so prompt window gets fixed up before card is brought up.)



          (* * fgh 11/13/85 Updated to handle Card object.)



          (* * rht 4/11/86: Now passes type to NC.MakeTEditMiddleMenu.)


    (LET (TextStream Window Type)
         (COND
	   (NoDisplayFlg (SETQ TextStream (OPENTEXTSTREAM "" NIL NIL NIL (NC.MakeTEditPropsList)
							      ))
			 (NC.SetSubstance Card TextStream)
			 (STREAMPROP TextStream (QUOTE NoteCardObject)
				       Card)
			 Card)
	   (T (SETQ Window (CREATEW (NC.DetermineDisplayRegion Card NIL)
					(OR Title "Untitled")
					NIL T))
	      (SETQ Type (NC.RetrieveType Card))
	      (WINDOWPROP Window (QUOTE NoteCardObject)
			    Card)
	      (NC.MakeTEditLeftMenu Window Type)
	      (NC.MakeTEditMiddleMenu Window Type)
	      (WINDOWADDPROP Window (QUOTE SHRINKFN)
			       (FUNCTION NC.TextCardShrinkFn))
	      (TEDIT NIL Window NIL (NC.MakeTEditPropsList Window))
	      (until (WINDOWPROP Window (QUOTE TEXTSTREAM)) do (BLOCK))
	      (SETQ TextStream (WINDOWPROP Window (QUOTE TEXTSTREAM)))
	      (NC.SetSubstance Card TextStream)
	      (STREAMPROP TextStream (QUOTE NoteCardObject)
			    Card)
	      Window)))))
)
(* * Changes to NCFILEBOXCARD)

(DEFINEQ

(NC.AddFileBoxCard
  (LAMBDA NIL                                                (* rht: " 7-Apr-86 18:21")

          (* * fgh 2/17/86 Added attached bitmap field.)


    (NC.AddCardType (QUOTE FileBox)
		      (QUOTE Text)
		      (BQUOTE ((MakeFn , (FUNCTION NC.MakeFileBox))))
		      (BQUOTE ((LinkDisplayMode Title)
				 (DefaultHeight 200)
				 (DefaultWidth 335)
				 (DisplayedInMenuFlg , T)
				 (LinkIconAttachedBitMap , NC.FileBoxIcon)
				 (LeftButtonMenuItems
				   ,
				   (for Item in (NC.GetCardTypeField LeftButtonMenuItems
									 (QUOTE Text))
				      join (if (EQ (CAR Item)
							 (QUOTE Insert% Link))
						 then (LIST NC.GlobalInsertLinkMenuItem
								(QUOTE
								  (Put% Cards% Here
								    (FUNCTION 
								      NC.FileBoxCollectChildren)
								    
					    "Collect new cards and file boxes into this FileBox.")))
					       else (LIST Item)))))))))

(NC.MakeFileBox
  (LAMBDA (Card Title DontDisplay)                           (* rht: "11-Apr-86 22:16")
                                                             (* Make up a blank contents card, hook it to the user 
							     specified parent contents cards, and display it.)

          (* * rht 12/2/84: In DontDisplay case, changed to return ID rather than TextStream.)



          (* * rht 12/8/84: Massive shaving. Took out code to force filing now (at creation time))



          (* * rht 9/11/85: Took out insertion of spacer when no markers.)



          (* * fgh 11/13/85 Updated to handle Card object.)



          (* * fgh 2/6/86 Chaged calls to NC.FetchDefaultHeight & NC.FetchDefaultWidth)



          (* * fgh 2/6/86 Removed bug where NC.ClearMsg was deleteing card immediately.)



          (* * rht 4/11/86: Now passes Type and Window to NC.MakeTEditLeftMenu.)


    (LET ((Spacer (CONCAT (CHARACTER 13)
			    (CHARACTER 13)))
	  Window TextStream Type)
         (SETQ TextStream (OPENTEXTSTREAM ""))
         (COND
	   (NC.MarkersInFileBoxesFlg (TEDIT.INSERT.OBJECT (NC.MakePlaceMarker 
									     NC.SubBoxMarkerLabel)
							    TextStream 1)
				     (TEDIT.INSERT TextStream Spacer 2)
				     (TEDIT.INSERT.OBJECT (NC.MakePlaceMarker 
									  NC.FiledCardMarkerLabel)
							    TextStream 4)
				     (TEDIT.INSERT TextStream Spacer 5)))
         (NC.SetSubstance Card TextStream)
         (NC.SetRegion Card (CREATEREGION 0 0 (NC.FetchDefaultWidth Card)
					      (NC.FetchDefaultHeight Card)))
         (COND
	   (DontDisplay Card)
	   (T (SETQ Window (CREATEW (NC.DetermineDisplayRegion Card NIL)
					(NC.SetTitle Card (OR Title "Untitled"))))
	      (SETQ Type (NC.RetrieveType Card))
	      (NC.MakeTEditLeftMenu Window Type)
	      (NC.MakeTEditMiddleMenu Window Type)         (* Display the card)
	      (WINDOWADDPROP Window (QUOTE SHRINKFN)
			       (FUNCTION NC.TextCardShrinkFn))
	      (TEDIT TextStream Window NIL (LIST (QUOTE FONT)
						     NC.DefaultFont
						     (QUOTE TITLEMENUFN)
						     (FUNCTION NC.TEditMenuFn)))
	      (until (WINDOWPROP Window (QUOTE TEXTSTREAM)) do (BLOCK))
	      (NC.ActivateCard Card)
	      (COND
		(NC.AlphabetizedFileBoxChildrenFlg (NCP.CardProp Card (QUOTE OrderingFn)
								   (FUNCTION NC.IDAlphOrder))))
	      (COND
		((GETPROMPTWINDOW Window NIL NIL T)
		  (PROG1 (DISMISS 1000)
			   (NC.ClearMsg (GETPROMPTWINDOW Window NIL NIL T)
					  T))))
	      Window)))))
)
(* * Changes to NCGRAPHCARD)

(DEFINEQ

(NC.AddGraphCard
  (LAMBDA NIL                                                (* rht: " 7-Apr-86 18:43")

          (* * fgh 11/14/85: Updated to conform to merge of substance and card types.)



          (* * fgh 2/17/86 Added attached bitmap field.)



          (* * rht 4/7/86: Added middle button menu items.)


    (NC.AddCardType (QUOTE Graph)
		      (QUOTE NoteCard)
		      (BQUOTE ((MakeFn , (FUNCTION NC.MakeGraphCard))
				 (EditFn , (FUNCTION NC.BringUpGraphCard))
				 (QuitFn , (FUNCTION NC.GraphCardCloseFn))
				 (GetFn , (FUNCTION NC.GetGraphSubstance))
				 (PutFn , (FUNCTION NC.PutGraphSubstance))
				 (CopyFn , (FUNCTION NC.GraphCopySubstance))
				 (MarkDirtyFn , (FUNCTION NC.MarkGraphDirty))
				 (DirtyPFn , (FUNCTION NC.GraphDirtyP))
				 (CollectLinksFn , (FUNCTION NC.CollectReferencesInGraph))
				 (DeleteLinksFn , (FUNCTION NC.DelReferencesToCardFromGraph))
				 (UpdateLinkIconsFn , (FUNCTION NC.UpdateLinkImagesInGraph))
				 (InsertLinkFn , (FUNCTION NC.InsertLinkInGraph))
				 (TranslateWindowPositionFn , (FUNCTION 
							NC.TranslateWindowPositionToGraphPosition))))
		      (BQUOTE ((LinkDisplayMode Title)
				 (DisplayedInMenuFlg , T)
				 (DefaultWidth 300)
				 (DefaultHeight 200)
				 (LinkAnchorModesSupported T)
				 (LinkIconAttachedBitMap , NC.GraphCardIcon)
				 (MiddleButtonMenuItems , (QUOTE ((Relayout% Graph
								       (FUNCTION 
									 NC.RelayoutGraphCard)
								       
						      "Re-layout the graph, but keep same nodes.")))))
				))))
)
(* * Please remove the following global vars from NCGRAPHCARD: 
NC.GraphTitleBarMiddleButtonMenu NC.GraphTitleBarMenu)

(* * Changes to NCBROWSERCARD)

(DEFINEQ

(NC.AddBrowserCard
  (LAMBDA NIL                                                (* rht: "11-Apr-86 19:40")

          (* * fgh 11/14/85 Updated to handle merge of card and substance types.)



          (* * rht 4/7/86: Added middle button menu items.)


    (NC.AddCardType (QUOTE Browser)
		      (QUOTE Graph)
		      (BQUOTE ((MakeFn , (FUNCTION NC.MakeBrowserCard))
				 (EditFn , (FUNCTION NC.BringUpBrowserCard))
				 (PutFn , (FUNCTION NC.PutBrowserSubstance))
				 (GetFn , (FUNCTION NC.GetBrowserSubstance))
				 (DeleteLinksFn , (FUNCTION NC.DelReferencesToCardFromBrowser))))
		      (BQUOTE ((LinkDisplayMode Title)
				 (DefaultHeight 350)
				 (DefaultWidth 500)
				 (DisplayedInMenuFlg , T)
				 (LeftButtonMenuItems , (for Item in (NC.GetCardTypeField
									   LeftButtonMenuItems
									   (QUOTE Graph))
							   collect (if (EQ (CAR Item)
										 (QUOTE 
										     Insert% Link))
									 then 
								      NC.GlobalInsertLinkMenuItem
								       else Item)))
				 (MiddleButtonMenuItems , (QUOTE ((Recompute% Browser
								       (FUNCTION 
									 NC.UpdateBrowserCard)
								       
			     "Recomputes this browser to show the current state of the NoteFile.")
								     (Relayout% Graph
								       (FUNCTION 
									 NC.RelayoutBrowserCard)
								       
						    "Re-layout the browser, but keep same nodes.")
								     (Reconnect% Nodes
								       (FUNCTION 
									 NC.ConnectNodesInBrowser)
								       
	   "Draw all possible links, from currently selected link types, between pairs of nodes.")
								     (Unconnect% Nodes
								       (FUNCTION 
								       NC.UnconnectNodesInBrowser)
								       
							       "Undraw all links in the browser.")
								     (Expand% Browser% Node
								       (FUNCTION 
									 NC.ExpandBrowserNode)
								       
					      "Expand the graph under one node to a given depth.")
								     (Graph% Edit% Menu
								       (FUNCTION 
									 NC.GetGraphEditMenu)
								       
								"Bring up the graph editor menu.")
								     (Change% Browser% Specs
								       (FUNCTION 
									 NC.ChangeBrowserSpecs)
								       
		 "Make changes to some or all of the browser specs, e.g. link types, depth, etc.")
								     (Browser% Overview% Win
								       (FUNCTION 
									NC.MakeBrowserOverviewWin)
								       
							    "Attach the browser overview window.")
								     (Change% Overview% Specs
								       (FUNCTION 
								       NC.AskBrowserOverviewSpecs)
								       
			      "Change the browser overview specs: where to attach and what mode.")))))
				))))
)
(* * Please remove the following global vars from NCBROWSERCARD: NC.BrowserTitleBarMenu)

(* * Changes to NCLINKINDEXCARD)

(DEFINEQ

(NC.AddLinkIndexCard
  (LAMBDA NIL                                                (* rht: "11-Apr-86 21:58")

          (* * fgh 11/14/85 Updated toremove substance type param to add card type.)


    (NC.AddCardType (QUOTE LinkIndex)
		      (QUOTE Text)
		      (BQUOTE ((MakeFn , (FUNCTION NC.MakeLinkIndex))
				 (EditFn , (FUNCTION NC.BringUpLinkIndexCard))))
		      (BQUOTE ((LinkDisplayMode Title)
				 (DefaultHeight 350)
				 (DefaultWidth 350)
				 (DisplayedInMenuFlg , T)
				 (LeftButtonMenuItems , (APPEND (NC.GetCardTypeField 
									      LeftButtonMenuItems
										       (QUOTE
											 Text))
								  NC.LinkIndexExtraMenuItems)))))))

(NC.BringUpLinkIndexCard
  (LAMBDA (Card Substance Region/Position)                   (* rht: "11-Apr-86 21:58")

          (* * Given a link index substance, open a link index window set up properly.)



          (* * rht 4/11/86: Removed stuff that adds items to title bar left menu. Now done at card type defn time.)


    (NC.BringUpTEditCard Card Substance Region/Position)))

(NC.MakeLinkIndex
  (LAMBDA (Card Title NoDisplayFlg SpecialArgsList)          (* rht: "11-Apr-86 22:22")

          (* * Gather all instances of a given set of linktypes, printing the titles of cards at the from and to ends of the 
	  link.)



          (* * rht 10/24/84: Now callable from Programmer's interface. If NoDisplayFlg it non-nil, then will build LinkIndex 
	  invisibly. If SpecialArgsList is non-nil, then should be list of (<linklabels> <backpointersP>))



          (* * rht 9/21/85: Now uses stylesheet for LinkIndexSpecs. Broke out workhorse code into the function 
	  NC.ComputeLinkIndex)



          (* * fgh 11/17/85 Updated to handle Card objects.)



          (* * rht 4/11/86: Took out call to NCP.AddTitleBarMenuItems. Now done in NC.AddLinkIndexCard.
	  Also changed to call NC.ApplySuper.)


    (LET (IndexCard Window WindowOrCard (LinkLabels (CAR SpecialArgsList))
		    (BackLinksFlg (CADR SpecialArgsList))
		    LinkIndexSpecs)
         (SPAWN.MOUSE)
         (SETQ WindowOrCard (NC.ApplySupersFn MakeFn Card (CONCAT "Link Index: " (DATE))
						NoDisplayFlg))
         (if NoDisplayFlg
	     then (SETQ Window NIL)
		    (SETQ IndexCard WindowOrCard)
	   else (SETQ Window WindowOrCard)
		  (SETQ IndexCard (NC.CoerceToCard WindowOrCard)))
         (if (NOT NoDisplayFlg)
	     then (SETQ LinkIndexSpecs (NC.AskLinkIndexSpecs Window LinkLabels BackLinksFlg T))
		    (COND
		      ((NULL LinkIndexSpecs)
			(NC.DeleteNoteCards IndexCard T)
			(RETURN NIL)))
		    (SETQ LinkLabels (CAR LinkIndexSpecs))
		    (SETQ BackLinksFlg (CADR LinkIndexSpecs)))
         (NC.ComputeLinkIndex IndexCard LinkLabels BackLinksFlg)
         (if NoDisplayFlg
	     then IndexCard
	   else (NC.ClearMsg Window T)
		  Window))))
)
(* * Changes to NCSEARCHCARD)

(DEFINEQ

(NC.MakeSearchCard
  (LAMBDA (Card Title NoDisplayFlg)                          (* rht: "11-Apr-86 22:22")

          (* Search for cards with specified characteristics and create a list card containing pointers to these cards.
	  For now search is limited to cards whose title contains a specified string.)



          (* * rht 11/8/84: Fixed some confusion between ListCardID and ID variables.)



          (* * fgh 11/17/85 Updated to handle multiple notefiles and crad objects.)



          (* * rht 4/11/86: changed to call NC.ApplySuper.)


    (LET ((NoteFile (fetch (Card NoteFile) of Card))
	  SearchString HitCards WindowOrCard Window)
         (SPAWN.MOUSE)
         (SETQ WindowOrCard (NC.ApplySupersFn MakeFn Card (OR Title "SearchCard")
						NoDisplayFlg))
         (NC.ActivateCard Card)
         (SETQ Window (AND (WINDOWP WindowOrCard)
			       WindowOrCard))
         (SETQ SearchString (NC.AskUser "Please enter the search string: " NIL NIL T Window))
         (COND
	   ((OR (EQUAL SearchString "")
		  (NOT SearchString)))
	   (T (NC.SetTitle Card (SETQ Title (OR Title (CONCAT "Cards with %"" SearchString 
								      "%" in title"))))
	      (AND Window (WINDOWPROP Window (QUOTE TITLE)
					  Title))
	      (RESETLST (RESETSAVE (CURSOR WAITINGCURSOR))
			  (NC.PrintMsg Window T "Searching for cards ...")
			  (SETQ HitCards (NC.TitleSearch NoteFile SearchString))
			  (TEDIT.INSERT (NC.FetchSubstance Card)
					  (CONCAT " List compiled on: " (DATE)
						    (CHARACTER 13)
						    (CHARACTER 13))
					  1)
			  (for HitCard in HitCards unless (EQ HitCard Card)
			     do (NC.InsertLinkBeforeMarker Card HitCard NC.ListContentsLinkLabel 
							       NIL NIL))
			  (NC.PrintMsg Window NIL "Done!" (CHARACTER 13)))
	      (BLOCK 250)
	      (NC.ClearMsg Window T)))
     WindowOrCard)))
)
(* * Please remove the following global vars from NCSKETCHCARD: NC.SketchTitleBarMenu)

(* * Changes to NCTYPESMECH)

[DECLARE: EVAL@COMPILE 

(DATATYPE NoteCardType (TypeName SuperType StubFlg FullDefinitionFile MakeFn (MakeFnInheritedFlg
				     FLAG)
				   EditFn
				   (EditFnInheritedFlg FLAG)
				   QuitFn
				   (QuitFnInheritedFlg FLAG)
				   GetFn
				   (GetFnInheritedFlg FLAG)
				   PutFn
				   (PutFnInheritedFlg FLAG)
				   CopyFn
				   (CopyFnInheritedFlg FLAG)
				   MarkDirtyFn
				   (MarkDirtyFnInheritedFlg FLAG)
				   DirtyPFn
				   (DirtyPFnInheritedFlg FLAG)
				   CollectLinksFn
				   (CollectLinksFnInheritedFlg FLAG)
				   DeleteLinksFn
				   (DeleteLinksFnInheritedFlg FLAG)
				   UpdateLinkIconsFn
				   (UpdateLinkIconsFnInheritedFlg FLAG)
				   InsertLinkFn
				   (InsertLinkFnInheritedFlg FLAG)
				   TranslateWindowPositionFn
				   (TranslateWindowPositionFnInheritedFlg FLAG)
				   LinkDisplayMode
				   (LinkDisplayModeInheritedFlg FLAG)
				   DefaultWidth
				   (DefaultWidthInheritedFlg FLAG)
				   DefaultHeight
				   (DefaultHeightInheritedFlg FLAG)
				   LinkAnchorModesSupported
				   (LinkAnchorModesSupportedInheritedFlg FLAG)
				   DisplayedInMenuFlg
				   (DisplayedInMenuFlgInheritedFlg FLAG)
				   LinkIconAttachedBitMap
				   (LinkIconAttachedBitMapInheritedFlg FLAG)
				   LeftButtonMenuItems
				   (LeftButtonMenuItemsInheritedFlg FLAG)
				   MiddleButtonMenuItems
				   (MiddleButtonMenuItemsInheritedFlg FLAG))
	  MakeFnInheritedFlg ← T EditFnInheritedFlg ← T QuitFnInheritedFlg ← T GetFnInheritedFlg ← T 
	  PutFnInheritedFlg ← T CopyFnInheritedFlg ← T MarkDirtyFnInheritedFlg ← T 
	  DirtyPFnInheritedFlg ← T CollectLinksFnInheritedFlg ← T DeleteLinksFnInheritedFlg ← T 
	  UpdateLinkIconsFnInheritedFlg ← T InsertLinkFnInheritedFlg ← T 
	  TranslateWindowPositionFnInheritedFlg ← T DefaultWidthInheritedFlg ← T 
	  DefaultWidthInheritedFlg ← T DefaultHeightInheritedFlg ← T 
	  LinkAnchorModesSupportedInheritedFlg ← T LinkIconAttachedBitMapInheritedFlg ← T 
	  LeftButtonMenuItemsInheritedFlg ← T MiddleButtonMenuItemsInheritedFlg ← T)
]
(/DECLAREDATATYPE (QUOTE NoteCardType)
		  (QUOTE (POINTER POINTER POINTER POINTER POINTER FLAG POINTER FLAG POINTER FLAG 
				  POINTER FLAG POINTER FLAG POINTER FLAG POINTER FLAG POINTER FLAG 
				  POINTER FLAG POINTER FLAG POINTER FLAG POINTER FLAG POINTER FLAG 
				  POINTER FLAG POINTER FLAG POINTER FLAG POINTER FLAG POINTER FLAG 
				  POINTER FLAG POINTER FLAG POINTER FLAG))
		  (QUOTE ((NoteCardType 0 POINTER)
			  (NoteCardType 2 POINTER)
			  (NoteCardType 4 POINTER)
			  (NoteCardType 6 POINTER)
			  (NoteCardType 8 POINTER)
			  (NoteCardType 8 (FLAGBITS . 0))
			  (NoteCardType 10 POINTER)
			  (NoteCardType 10 (FLAGBITS . 0))
			  (NoteCardType 12 POINTER)
			  (NoteCardType 12 (FLAGBITS . 0))
			  (NoteCardType 14 POINTER)
			  (NoteCardType 14 (FLAGBITS . 0))
			  (NoteCardType 16 POINTER)
			  (NoteCardType 16 (FLAGBITS . 0))
			  (NoteCardType 18 POINTER)
			  (NoteCardType 18 (FLAGBITS . 0))
			  (NoteCardType 20 POINTER)
			  (NoteCardType 20 (FLAGBITS . 0))
			  (NoteCardType 22 POINTER)
			  (NoteCardType 22 (FLAGBITS . 0))
			  (NoteCardType 24 POINTER)
			  (NoteCardType 24 (FLAGBITS . 0))
			  (NoteCardType 26 POINTER)
			  (NoteCardType 26 (FLAGBITS . 0))
			  (NoteCardType 28 POINTER)
			  (NoteCardType 28 (FLAGBITS . 0))
			  (NoteCardType 30 POINTER)
			  (NoteCardType 30 (FLAGBITS . 0))
			  (NoteCardType 32 POINTER)
			  (NoteCardType 32 (FLAGBITS . 0))
			  (NoteCardType 34 POINTER)
			  (NoteCardType 34 (FLAGBITS . 0))
			  (NoteCardType 36 POINTER)
			  (NoteCardType 36 (FLAGBITS . 0))
			  (NoteCardType 38 POINTER)
			  (NoteCardType 38 (FLAGBITS . 0))
			  (NoteCardType 40 POINTER)
			  (NoteCardType 40 (FLAGBITS . 0))
			  (NoteCardType 42 POINTER)
			  (NoteCardType 42 (FLAGBITS . 0))
			  (NoteCardType 44 POINTER)
			  (NoteCardType 44 (FLAGBITS . 0))
			  (NoteCardType 46 POINTER)
			  (NoteCardType 46 (FLAGBITS . 0))
			  (NoteCardType 48 POINTER)
			  (NoteCardType 48 (FLAGBITS . 0))))
		  (QUOTE 50))
(DECLARE: EVAL@COMPILE 
(PUTPROPS NC.GetCardTypeField MACRO ((FieldName TypeVariableName)
	   (* * Fetch the card type datatype field specified by FieldName for the card type datatype 
	      named by the variable TypeVariableName.)
	   (* * rht 4/11/86: Was trying to autoload if field of card type was nil. Now only tries to 
	      autoload if CardTypeRecord is nil or if StubFlg is non-nil.)
	   (LET ((CardTypeRecord (NC.CardTypeRecord TypeVariableName)))
		(COND ((AND CardTypeRecord (NULL (fetch (NoteCardType StubFlg)
							of CardTypeRecord)))
		       (fetch (NoteCardType FieldName)
			      of CardTypeRecord))
		      ((AND (fetch (NoteCardType StubFlg)
				   of CardTypeRecord)
			    (fetch (NoteCardType FieldName)
				   of CardTypeRecord)))
		      ((NC.AutoLoadCardType TypeVariableName (QUOTE FieldName)
					    (AND CardTypeRecord (fetch (NoteCardType 
									       FullDefinitionFile)
								       of CardTypeRecord)))
		       (fetch (NoteCardType FieldName)
			      of
			      (NC.CardTypeRecord TypeVariableName)))
		      (T (NC.ReportError NIL (CONCAT "Unknown note card type:  " TypeVariableName 
						     "   or card type field name: "
						     (QUOTE FieldName))))))))
)
(DEFINEQ

(NC.MakeCardTypesList
  (LAMBDA NIL                                                (* rht: " 7-Apr-86 12:09")

          (* * Make initial set of card types.)



          (* * fgh 1/31/86 Updated to handle hash table for card types.)



          (* * fgh 2/17/86 Added typless attached bit map to NoteCards card type.)



          (* * rht 4/7/86: Now sets up default left and middle button menu items.)


    (SETQ NC.CardTypes (OR (HARRAYP NC.CardTypes)
			       (HASHARRAY 50)))
    (PUTHASH (QUOTE NoteCard)
	       (create NoteCardType
			 TypeName ←(QUOTE NoteCard)
			 SuperType ← NIL
			 CopyFn ←(FUNCTION (LAMBDA (Card ToStream FromStream Length)
                                                             (* Copy a card's substance using copybytes.)
			     (LET* ((FromStartPtr (GETFILEPTR FromStream))
				    (FromEndPtr (PLUS Length FromStartPtr)))
			           (COPYBYTES FromStream ToStream FromStartPtr FromEndPtr)
			       T)))
			 CollectLinksFn ←(FUNCTION NILL)
			 LinkDisplayMode ←(create LINKDISPLAYMODE
						    ATTACHBITMAPFLG ← T)
			 DefaultWidth ← 100
			 DefaultHeight ← 100
			 LinkIconAttachedBitMap ← NC.TypelessIcon
			 LeftButtonMenuItems ← NC.DefaultLeftButtonMenuItems
			 MiddleButtonMenuItems ← NC.DefaultMiddleButtonMenuItems)
	       NC.CardTypes)
    (SETQ NC.NoteCardTypeMenu)))
)
(DECLARE: DOEVAL@COMPILE DONTCOPY

(GLOBALVARS NC.DefaultLeftButtonMenuItems NC.LocalInsertLinkMenuItem NC.GlobalInsertLinkMenuItem 
	    NC.DefaultMiddleButtonMenuItems)
)

(RPAQ? NC.DefaultMiddleButtonMenuItems NIL)

(RPAQ? NC.LocalInsertLinkMenuItem (QUOTE (Insert% Link (FUNCTION NC.AddLinkToCard)
							 
		     "Insert a link to another card at the currently selected point in the text."
							 (SUBITEMS (Insert% Link
								     (FUNCTION NC.AddLinkToCard)
								     
		     "Insert a link to another card at the currently selected point in the text.")
								   (Insert% Links
								     (FUNCTION NC.AddLinksToCard)
								     
		       "Insert links to other cards at the currently selected point in the text.")
								   (Add% Global% Link
								     (FUNCTION NC.AddGlobalLinkToCard)
								     
						    "Add a global link emanating from this card.")
								   (Add% Global% Links
								     (FUNCTION 
									  NC.AddGlobalLinksToCard)
								     
					    "Add multiple global links emanating from this card.")))))

(RPAQ? NC.GlobalInsertLinkMenuItem (QUOTE (Add% Global% Link (FUNCTION NC.AddGlobalLinkToCard)
							       
						    "Add a global link emanating from this card."
							       (SUBITEMS
								 (Add% Global% Link
								   (FUNCTION NC.AddGlobalLinkToCard)
								   
						    "Add a global link emanating from this card.")
								 (Add% Global% Links
								   (FUNCTION NC.AddGlobalLinksToCard)
								   
					    "Add multiple global links emanating from this card.")))))

(RPAQ? NC.DefaultLeftButtonMenuItems (BQUOTE ((Edit% Property% List (FUNCTION NC.EditProperties)
								      
					"Brings up an editor for the property list of this card.")
						(Show% Links (FUNCTION NC.ShowLinks)
							     
					   "Brings up a list of the links to and from this card.")
						(Show% Info (FUNCTION NC.ShowInfo)
							    
			     "Brings up a window containing special information about this card.")
						(Designate% Sources
						  (FUNCTION NC.AssignSources)
						  
				       "Designate the source(s) of the information in this card."
						  (SUBITEMS (Delete% Source (FUNCTION NC.DeleteSource)
									    
							"Delete one of the sources of this card.")))
						(Designate% FileBoxes
						  (FUNCTION NC.AddParents)
						  "File this note card in one or more file boxes."
						  (SUBITEMS (Unfile% from% FileBoxes
							      (FUNCTION NC.UnfileNoteCard)
							      
					   "Remove this card from one or more of its file boxes.")))
						(Assign% Title (FUNCTION NC.AssignTitle)
							       
						       "Assigns a (new) title to this note card.")
						(Title/FileBoxes (FUNCTION (LAMBDA (TextStream)
										   (NC.AssignTitle
										     TextStream)
										   (NC.AddParents
										     TextStream)))
								 
					    "Do both assigning of title and filing in fileboxes.")
						, NC.LocalInsertLinkMenuItem
						(Close% and% Save
						  (FUNCTION CLOSEW)
						  
					  "Close this note card after saving it in the NoteFile."
						  (SUBITEMS (Close% and% Save (FUNCTION CLOSEW)
									      
					  "Close this note card after saving it in the NoteFile.")
							    (Close% w/o% Saving
							      (FUNCTION NC.QuitWithoutSaving)
							      
		      "Close this note card without saving any changes made since the last Save.")
							    (Save% in% NoteFile
							      (FUNCTION NC.CardSaveFn)
							      
				       "Save this card in the NoteFile but don't close the card.")
							    (Delete% Card (FUNCTION 
									       NC.DeleteNoteCards)
									  
						"Permenantly delete this card from the NoteFile.")))))
)
(PUTPROPS RHTPATCH038 COPYRIGHT ("Xerox Corporation" 1986))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (6080 8500 (NC.AddLinkToCard 6090 . 7153) (NC.AddLinksToCard 7155 . 8498)) (8532 10142 (
NC.AddLinkToGraphCard 8542 . 9325) (NC.AddLinkToSketchCard 9327 . 10140)) (10180 11892 (NC.ShowInfo 
10190 . 11890)) (27305 38698 (NC.EditProperties 27315 . 28252) (NC.EditPropList 28254 . 33616) (
NC.AddPropToPropList 33618 . 36904) (NC.DelPropFromList 36906 . 38696)) (38732 41578 (NC.Setup 38742
 . 41576)) (41707 54859 (NC.SetupTitleBarMenu 41717 . 54857)) (55126 62949 (NC.AddTextCard 55136 . 
57018) (NC.MakeTEditLeftMenu 57020 . 58224) (NC.MakeTEditMiddleMenu 58226 . 58647) (NC.TEditMenuFn 
58649 . 59553) (NC.BringUpTEditCard 59555 . 61343) (NC.MakeTEditCard 61345 . 62947)) (62987 66715 (
NC.AddFileBoxCard 62997 . 63988) (NC.MakeFileBox 63990 . 66713)) (66751 68374 (NC.AddGraphCard 66761
 . 68372)) (68537 71323 (NC.AddBrowserCard 68547 . 71321)) (71458 74507 (NC.AddLinkIndexCard 71468 . 
72180) (NC.BringUpLinkIndexCard 72182 . 72583) (NC.MakeLinkIndex 72585 . 74505)) (74544 76589 (
NC.MakeSearchCard 74554 . 76587)) (81928 83357 (NC.MakeCardTypesList 81938 . 83355)))))
STOP