(FILECREATED " 6-May-86 12:35:21" {QV}<NOTECARDS>1.3K>RHTPATCH041.;4 29762  

      changes to:  (VARS RHTPATCH041COMS)
		   (FNS NC.MakeSketchCard NC.BringUpSketchCard NC.InstallTitleBarButtonEventFn 
			NC.GraphTitleBarButtonEventFn NC.MakeGraphCard NC.BringUpGraphCard 
			NC.SketchTitleBarButtonEventFn NC.AddSketchCard NC.MakeBrowserCard 
			NC.MakeTEditCard NC.BringUpBrowserCard)

      previous date: " 5-May-86 21:11:06" {QV}<NOTECARDS>1.3K>RHTPATCH041.;1)


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

(PRETTYCOMPRINT RHTPATCH041COMS)

(RPAQQ RHTPATCH041COMS ((* * More patches to make title bar menus work correctly.)
			  (* * New functions for NCINTERFACE)
			  (FNS NC.InstallTitleBarButtonEventFn NC.InstallTitleBarLeftMenu)
			  (* * Please remove NC.SetupTitleBarMenu and NC.TitleBarButtonEventFn 
			     function from NCINTERFACE)
			  (* * New functions for NCTEXTCARD)
			  (FNS NC.InstallTextTitleBarMiddleMenu)
			  (* * Changed functions from NCTEXTCARD)
			  (FNS NC.MakeTEditCard NC.BringUpTEditCard)
			  (* * Please remove the NC.MakeTEditLeftMenu and NC.MakeTEditMiddleMenu 
			     functions from NCTEXTCARD)
			  (* * New functions for NCGRAPHCARD)
			  (FNS NC.InstallGraphTitleBarMiddleMenu NC.GraphTitleBarButtonEventFn)
			  (* * Changed functions from NCGRAPHCARD)
			  (FNS NC.MakeGraphCard NC.BringUpGraphCard)
			  (* * Changed functions from NCCBROWSERCARD)
			  (FNS NC.MakeBrowserCard NC.BringUpBrowserCard)
			  (* * New functions for NCSKETCHCARD)
			  (FNS NC.SketchTitleBarButtonEventFn)
			  (* * Changed functions from NCSKETCHCARD)
			  (FNS NC.MakeSketchCard NC.BringUpSketchCard NC.AddSketchCard)))
(* * More patches to make title bar menus work correctly.)

(* * New functions for NCINTERFACE)

(DEFINEQ

(NC.InstallTitleBarButtonEventFn
  (LAMBDA (Window TitleBarButtonEventFn)                     (* rht: " 6-May-86 12:05")

          (* * Save the old BUTTONEVENTFN and replace with ours.)


    (OR (EQ (WINDOWPROP Window (QUOTE BUTTONEVENTFN))
		TitleBarButtonEventFn)
	  (WINDOWPROP Window (QUOTE OLDBUTTONEVENTFN)
			(WINDOWPROP Window (QUOTE BUTTONEVENTFN)
				      TitleBarButtonEventFn)))))

(NC.InstallTitleBarLeftMenu
  (LAMBDA (Window CardType)                                  (* rht: " 5-May-86 20:49")

          (* * Make a menu from the CardType's LeftButtonMenuItems and install on windowprop.)


    (WINDOWPROP Window (QUOTE TitleBarLeftButtonMenu)
		  (create MENU
			    ITEMS ←(NC.GetCardTypeField LeftButtonMenuItems CardType)
			    CENTERFLG ← T
			    MENUFONT ←(FONTCREATE (QUOTE HELVETICA)
						    10
						    (QUOTE BOLD))))))
)
(* * Please remove NC.SetupTitleBarMenu and NC.TitleBarButtonEventFn function from NCINTERFACE
)

(* * New functions for NCTEXTCARD)

(DEFINEQ

(NC.InstallTextTitleBarMiddleMenu
  (LAMBDA (Window CardType)                                  (* rht: " 5-May-86 20:51")

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


    (WINDOWPROP Window (QUOTE TitleBarMiddleButtonMenu)
		  (\TEDIT.CREATEMENU (NC.GetCardTypeField MiddleButtonMenuItems CardType)))))
)
(* * Changed functions from NCTEXTCARD)

(DEFINEQ

(NC.MakeTEditCard
  (LAMBDA (Card Title NoDisplayFlg)                          (* rht: " 6-May-86 12:21")
                                                             (* 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.)



          (* * rht 5/6/86: Now calls NC.InstallTitleBarLeftMenu and NC.InstallTextTitleBarMiddleMenu.)


    (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.InstallTitleBarLeftMenu Window Type)
	      (NC.InstallTextTitleBarMiddleMenu 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)))))

(NC.BringUpTEditCard
  (LAMBDA (Card TextStream Region/Position)                  (* rht: " 5-May-86 20:56")
                                                             (* 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.)



          (* * rht 5/5/86: Now calls NC.InstallTitleBarLeftMenu and NC.InstallTextTitleBarMiddleMenu.)


    (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.InstallTitleBarLeftMenu TEditWindow Type)
	      (NC.InstallTextTitleBarMiddleMenu TEditWindow Type)
	      (SETQ TextStreamDirtyFlg (NC.CardDirtyP Card))
	      (TEDIT TextStream TEditWindow NIL (NC.MakeTEditPropsList TEditWindow))
	      (AND TextStreamDirtyFlg (NC.MarkCardDirty Card))))
     TEditWindow)))
)
(* * Please remove the NC.MakeTEditLeftMenu and NC.MakeTEditMiddleMenu functions from 
NCTEXTCARD)

(* * New functions for NCGRAPHCARD)

(DEFINEQ

(NC.InstallGraphTitleBarMiddleMenu
  (LAMBDA (Window CardType)                                  (* rht: " 5-May-86 20:53")

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


    (WINDOWPROP Window (QUOTE TitleBarMiddleButtonMenu)
		  (create MENU
			    ITEMS ←(NC.GetCardTypeField MiddleButtonMenuItems CardType)
			    CENTERFLG ← T
			    MENUFONT ←(FONTCREATE (QUOTE HELVETICA)
						    10
						    (QUOTE BOLD))))))

(NC.GraphTitleBarButtonEventFn
  (LAMBDA (Window)                                           (* rht: " 6-May-86 12:10")

          (* * if inside title region, bringup left or middle menu, otherwise just call the oldbuttoneventfn)


    (LET (MiddleButtonMenu LeftButtonMenu)
         (COND
	   ((INSIDEP (DSPCLIPPINGREGION NIL Window)
		       (LASTMOUSEX Window)
		       (LASTMOUSEY Window))
	     (APPLY* (WINDOWPROP Window (QUOTE OLDBUTTONEVENTFN))
		       Window))
	   ((AND (LASTMOUSESTATE MIDDLE)
		   (type? MENU (SETQ MiddleButtonMenu (WINDOWPROP Window (QUOTE 
									 TitleBarMiddleButtonMenu)))))
	     (APPLY* (OR (MENU MiddleButtonMenu)
			     (FUNCTION NILL))
		       Window))
	   ((AND (LASTMOUSESTATE LEFT)
		   (type? MENU (SETQ LeftButtonMenu (WINDOWPROP Window (QUOTE 
									   TitleBarLeftButtonMenu)))))
	     (APPLY* (OR (MENU LeftButtonMenu)
			     (FUNCTION NILL))
		       Window))))))
)
(* * Changed functions from NCGRAPHCARD)

(DEFINEQ

(NC.MakeGraphCard
  (LAMBDA (Card Title NoDisplayFlg)                          (* rht: " 6-May-86 12:15")

          (* * Creates a StructEdit card. Alot like a graph card except that it allows editing of underlying NC structure, 
	  and doesn't allow an "insertlink" operation in title bar menu.)



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



          (* * rht 5/5/86: Replaced call to NC.SetupTitleBarMenu with Install calls.)


    (LET (Window Graph CardType)
         (SETQ Graph (create GRAPH
				 GRAPH.ADDNODEFN ←(FUNCTION NC.GraphAddNodeFn)
				 GRAPH.DELETENODEFN ←(FUNCTION NC.GraphDeleteNodeFn)
				 GRAPH.ADDLINKFN ←(FUNCTION NC.GraphAddLinkFn)
				 GRAPH.DELETELINKFN ←(FUNCTION NC.GraphDeleteLinkFn)
				 GRAPH.MOVENODEFN ←(FUNCTION NC.GraphMoveNodeFn)
				 GRAPH.FONTCHANGEFN ←(FUNCTION NC.GraphFontChangeFn)))
         (NC.SetSubstance Card Graph)
         (COND
	   ((NOT NoDisplayFlg)
	     (SETQ Window (CREATEW (NC.DetermineDisplayRegion Card NIL)
				       (OR Title "Untitled")))
	     (SETQ CardType (NC.RetrieveType Card))
	     (SHOWGRAPH Graph Window (FUNCTION NC.GraphCardLeftButtonFn)
			  (FUNCTION NC.GraphCardMiddleButtonFn)
			  T T)
	     (WINDOWADDPROP Window (QUOTE SHRINKFN)
			      (FUNCTION NC.GraphCardShrinkFn))
	     (NC.InstallTitleBarButtonEventFn Window (FUNCTION NC.GraphTitleBarButtonEventFn))
	     (NC.InstallTitleBarLeftMenu Window CardType)
	     (NC.InstallGraphTitleBarMiddleMenu Window CardType)))
         (OR Window Card))))

(NC.BringUpGraphCard
  (LAMBDA (Card Substance Region/Position)                   (* rht: " 6-May-86 12:12")

          (* * Given a graph (or browser) Substance, open a grapher (browser) window and set it up to be a NoteCard with ID.)



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



          (* * rht 5/5/86: Now calls NC.InstallTitleBarButtonEventFn, NC.InstallTitleBarLeftMenu, and 
	  NC.InstallGraphTitleBarMiddleMenu instead of NC.SetupTitleBarMenu.)


    (LET (Region Title GraphWindow IconWindow CardType)
         (COND
	   ((SETQ GraphWindow (NC.FetchWindow Card))
	     (AND (WINDOWP (WINDOWPROP GraphWindow (QUOTE ICONFOR)))
		    (SETQ GraphWindow (EXPANDW GraphWindow)))
	     (TOTOPW GraphWindow)
	     (RPTQ 2 (FLASHW GraphWindow)))
	   (T (SETQ GraphWindow (SHOWGRAPH Substance (CREATEW (NC.DetermineDisplayRegion
								      Card Region/Position)
								    (NC.RetrieveTitle Card))
					       (FUNCTION NC.GraphCardLeftButtonFn)
					       (FUNCTION NC.GraphCardMiddleButtonFn)
					       NIL T))
	      (SETQ CardType (NC.RetrieveType Card))
	      (WINDOWADDPROP GraphWindow (QUOTE SHRINKFN)
			       (FUNCTION NC.GraphCardShrinkFn))
	      (NC.InstallTitleBarButtonEventFn GraphWindow (FUNCTION 
						   NC.GraphTitleBarButtonEventFn))
	      (NC.InstallTitleBarLeftMenu GraphWindow CardType)
	      (NC.InstallGraphTitleBarMiddleMenu GraphWindow CardType)))
     GraphWindow)))
)
(* * Changed functions from NCCBROWSERCARD)

(DEFINEQ

(NC.MakeBrowserCard
  (LAMBDA (Card Title NoDisplayFlg ParamList)                (* rht: " 6-May-86 12:19")

          (* Make a browser card with id Card using root at RootID and the link following predictae specified by Predicate.
	  IF Root and/or ListOfLinkLabels not specified, ask the user.)



          (* * rht 8/3/84: Changed to call NC.AskLinkLabel with its ReverseLinkLabel parameter set to T.)



          (* * fgh 10/2/84 Changed Link Icons to be image objects in NodeLabel of Graph Npodes rather than annotations on 
	  graph nodes.)



          (* * rht 10/19/84: Fixed setting up of browser card's prop list in case NoDisplayFlg is T so we have no Window.
	  Now NC.MakeLinksLegend returns the label pairs.)



          (* * rht 11/27/84: Removed the WINDOWADDPROP call to put NC.GraphCardCloseFn on the CLOSEFN of the window.
	  This causes trouble. NC.QuitCard will get put on by NC.MakeNoteCard and that's enough.)



          (* * rht 1/3/85: Now puts a dummy region of the right size if the NoDisplayFlg is on.)



          (* * rht 1/15/85: Put hooks for AddNode, AddLink, etc. so editing graph edits underlying structure.)



          (* * rht 2/14/85: Added VerticalFlg and made BrowserSpecs get put on browser's proplist in all cases.)



          (* * rht 4/1/85: Now calls NC.AskBrowserSpecs with additional Don'tAskFlg in case of call from Programmer's 
	  interface.)



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



          (* * rht 2/7/86: Now gets browser format, etc. via fetch/set fns.)



          (* * rht 5/6/86: Took out call to NC.SetupTitleBarMenu.)


    (PROG ((RootCards (MKLIST (LISTGET ParamList (QUOTE ROOTCARDS))))
	     (ListOfLinkLabels (LISTGET ParamList (QUOTE LINKTYPES)))
	     (BrowserFormat (LISTGET ParamList (QUOTE FORMAT)))
	     (Depth (LISTGET ParamList (QUOTE DEPTH)))
	     Lattice RootNodes Window Graph SpecialBrowserSpecs BrowserSpecs DropVirtualNodesFlg)
	    (NC.ActivateCard Card)
	    (COND
	      ((NULL NoDisplayFlg)
		(SETQ Window (CREATEW (NC.DetermineDisplayRegion Card NIL)
					  (NC.RetrieveTitle Card)
					  NIL))
		(WINDOWADDPROP Window (QUOTE SHRINKFN)
				 (FUNCTION NC.GraphCardShrinkFn))
		(WINDOWPROP Window (QUOTE NoteCardObject)
			      Card)))
	    (if (NULL RootCards)
		then (SETQ RootCards (if NoDisplayFlg
					     then (LIST NIL)
					   else (NC.SelectNoteCards NIL NIL 
								    NC.SelectingBrowserSourceMenu 
									Window NIL 
			    "Please select the Cards and/or Boxes the browser should start from."
									T))))
	    (COND
	      ((EQ RootCards (QUOTE CANCELLED))
		(NC.DeactivateCard Card)
		(CLOSEW Window)
		(RETURN)))
	    (NC.HoldTTYProcess)
	    (SETQ BrowserSpecs (NC.AskBrowserSpecs Window Card NIL Depth BrowserFormat T
						       (if (OR ParamList NoDisplayFlg)
							   then (QUOTE DONTASK))))
	    (COND
	      ((NULL BrowserSpecs)
		(NC.DeactivateCard Card)
		(CLOSEW Window)
		(RETURN)))
	    (SETQ ListOfLinkLabels (CAR BrowserSpecs))
	    (SETQ Depth (CADR BrowserSpecs))
	    (SETQ BrowserFormat (CADDR BrowserSpecs))    (* If user wants *GRAPH* format, i.e. virtual nodes 
							     eliminated, then set the flag)
	    (if (FMEMB NC.*Graph*BrowserFormat BrowserFormat)
		then (SETQ DropVirtualNodesFlg T))
	    (SETQ SpecialBrowserSpecs (COND
		(NC.SpecialBrowserSpecsFlg (NC.AskSpecialBrowserSpecs Window))
		(T (create SPECIALBROWSERSPECS))))
	    (OR NoDisplayFlg (NC.PrintMsg Window T (CHARACTER 13)
					      "Computing browser graph. Please wait. ..."))
                                                             (* Create new browser hash array)
	    (NC.GetBrowserHashArray Card)                  (* Compute lattice breakdth-first starting from 
							     roots.)
	    (SETQ Lattice (NC.GrowLinkLattice RootCards NIL ListOfLinkLabels Card Depth))
	    (SETQ RootNodes (for RootCard in RootCards collect (NC.GetBrowserNodeID Card 
											 RootCard)))
	    (OR NoDisplayFlg (WINDOWPROP Window (QUOTE NoteCardObject)
					     Card))

          (* * Link destination id information stored in NodeLabel field into a LinkIcon for display)


	    (for Node in Lattice bind NodeID eachtime (BLOCK)
	       do (replace (GRAPHNODE NODELABEL) of Node
		       with (NC.MakeLinkIcon (NC.MakeLink Window NC.BrowserContentsLinkLabel
								(fetch (GRAPHNODE NODELABEL)
								   of Node)
								Card NIL)))
                                                             (* Untouch each graph node so that next Recompute will
							     put fresh values on proplist.)
		    (SETQ NodeID (fetch (GRAPHNODE NODEID) of Node))
		    (NC.UIDRemProp (NC.CoerceToGraphNodeID NodeID)
				     (QUOTE TouchedFlg))
		    (NC.UIDRemProp (NC.CoerceToGraphNodeID NodeID)
				     (QUOTE VisitedFlg)))
	    (SETQ Graph (if (AND Lattice RootNodes)
			      then (LAYOUTGRAPH Lattice RootNodes (SUBST (QUOTE LATTICE)
									       
									  NC.*Graph*BrowserFormat 
									       BrowserFormat)
						    (fetch (SPECIALBROWSERSPECS Font) of 
									      SpecialBrowserSpecs)
						    (fetch (SPECIALBROWSERSPECS MotherD)
						       of SpecialBrowserSpecs)
						    (fetch (SPECIALBROWSERSPECS PersonalD)
						       of SpecialBrowserSpecs)
						    (fetch (SPECIALBROWSERSPECS FamilyD)
						       of SpecialBrowserSpecs))
			    else (create GRAPH)))
	    (NC.SetBrowserLinksLegend Card (NC.MakeLinksLegend Graph Window DropVirtualNodesFlg))
	    (OR NoDisplayFlg (NC.PrintMsg Window NIL "Done!"))
	    (NC.SetSubstance Card Graph)
	    (NC.SetBrowserLinkLabels Card (OR ListOfLinkLabels (LIST NC.SubBoxLinkLabel)))
	    (NC.SetBrowserRoots Card RootCards)
	    (NC.SetBrowserFormat Card BrowserFormat)
	    (NC.SetBrowserDepth Card Depth)
	    (NC.SetSpecialBrowserSpecs Card SpecialBrowserSpecs)
	    (COND
	      (NoDisplayFlg (RETURN Card)))
	    (WINDOWPROP Window (QUOTE GRAPH)
			  Graph)
	    (NC.RelayoutBrowserCard Window)
	    (RETURN Window))))

(NC.BringUpBrowserCard
  (LAMBDA (Card Substance Region/Position)                   (* rht: " 6-May-86 12:19")

          (* * Given a browser Substance, open a browser window and set it up to be a NoteCard with ID.)



          (* * rht 11/17/84: Now returns window.)



          (* * rht 9/11/85: Now checks for changed link icon display global params.)



          (* * rht 11/17/85: Now handles new card and Notefile objects.)



          (* * rht 2/1/86: Now restores any saved UID user data info stashed on card's prop list.)



          (* * fgh 2/5/86 Added call to NC.ApplySupersFn)



          (* * rht 2/14/86: Now rebuilds browser hash array.)



          (* * rht 2/28/86: Added WINDOWPROP for SCROLLFN and RESHAPEFN.)



          (* * rht 3/2/86: Took out call to NC.FetchBrowserHashArray.)



          (* * rht 4/5/86: Now only replaces graphnodes' TONODES' NODEID and DESTNODEID if they're non-nil.)



          (* * rht 5/5/86: Took out call to NC.SetupTitleBarMenu.)


    (LET ((GraphNodes (fetch (GRAPH GRAPHNODES) of Substance))
	  Window OldUIDToNewUIDHashArray BrowserSavedLinkingInfo)

          (* * Restore any saved UID user data info stashed on card UID's prop list.)


         (if (SETQ BrowserSavedLinkingInfo (NC.FetchBrowserSavedLinkingInfo Card))
	     then (SETQ OldUIDToNewUIDHashArray (HASHARRAY 100 NIL (FUNCTION NC.MakeHashKey)
								 (FUNCTION NC.SameUIDP)))
		    (for BrowserSavedLinkingInfoForNode in BrowserSavedLinkingInfo
		       eachtime (BLOCK) bind SourceUID when (SETQ SourceUID
								      (
								   NC.NewBrowserNodeUIDFromOldUID
									(CAR 
								   BrowserSavedLinkingInfoForNode)
									GraphNodes 
									OldUIDToNewUIDHashArray))
		       do (for SavedLinkingInfo on (CDR BrowserSavedLinkingInfoForNode)
			       by (CDDR SavedLinkingInfo) eachtime (BLOCK)
			       do (NC.UIDPutProp SourceUID (NC.NewBrowserNodeUIDFromOldUID
						       (CAR SavedLinkingInfo)
						       GraphNodes OldUIDToNewUIDHashArray)
						     (CADR SavedLinkingInfo)))))
         (NC.SetBrowserSavedLinkingInfo Card NIL)

          (* * For each graph node corresponding to a notecard, hang the card object off the node id's prop list.)


         (for GraphNode in GraphNodes bind LinkIcon DestCard eachtime (BLOCK)
	    when (NC.LinkIconImageObjP (SETQ LinkIcon (fetch (GRAPHNODE NODELABEL)
							       of GraphNode)))
	    do (NC.UIDPutProp (NC.CoerceToGraphNodeID GraphNode)
				  (QUOTE CardObject)
				  (SETQ DestCard (fetch (Link DestinationCard)
						      of (NC.FetchLinkFromLinkIcon LinkIcon)))))

          (* * Make a new browser hash array with the new graph node UIDs.)


         (NC.SetUserDataProp Card (QUOTE BrowserHashArray)
			       NIL)
         (NC.GetBrowserHashArray Card Substance)

          (* * For each graph node, fix the NODEID and DESTNODEID fields of each of its TONODES LinkParameters.)


         (for GraphNode in GraphNodes eachtime (BLOCK)
	    do (for ToNode in (fetch (GRAPHNODE TONODES) of GraphNode)
		    bind (ThisNodeID ←(NC.CoerceToGraphNodeID GraphNode)) eachtime (BLOCK)
		    when (EQ (CAR ToNode)
				 LINKPARAMS)
		    do (AND (LISTGET ToNode (QUOTE NODEID))
				(LISTPUT ToNode (QUOTE NODEID)
					   ThisNodeID))
			 (AND (LISTGET ToNode (QUOTE DESTNODEID))
				(LISTPUT ToNode (QUOTE DESTNODEID)
					   (NC.CoerceToGraphNodeID (CADR ToNode))))))

          (* * Bring up card and mess with its window.)


         (SETQ Window (NC.ApplySupersFn EditFn Card Substance Region/Position))
         (NC.MakeLinksLegendMenu Window (NC.FetchBrowserLinksLegend Card))
                                                             (* Disable the old-style right button grapher editor 
							     menu.)
         (WINDOWPROP Window (QUOTE RIGHTBUTTONFN)
		       (FUNCTION NC.BrowserRightButtonFn))
         (WINDOWADDPROP Window (QUOTE SHRINKFN)
			  (FUNCTION NC.GraphCardShrinkFn))
         (WINDOWADDPROP Window (QUOTE REPAINTFN)
			  (FUNCTION NC.BrowserRepaintFn)
			  T)
         (WINDOWPROP Window (QUOTE SCROLLFN)
		       (FUNCTION NC.BrowserScrollFn))
         (WINDOWPROP Window (QUOTE RESHAPEFN)
		       (FUNCTION NC.BrowserReshapeFn))

          (* * I have to hang notecard's Card on window now in case REDISPLAYW runs and tries to get Card from window.)


         (WINDOWPROP Window (QUOTE NoteCardObject)
		       Card)                                 (* Check if link icon display global params have 
							     changed since last time card was up.
							     If so, fix graph nodes and redisplay.)
         (if (NC.GraphLinkIconUpdateCheck Card Window Substance T)
	     then (REDISPLAYW Window))
     Window)))
)
(* * New functions for NCSKETCHCARD)

(DEFINEQ

(NC.SketchTitleBarButtonEventFn
  (LAMBDA (Window)                                           (* rht: " 6-May-86 12:12")

          (* * if inside title region and left button down, bringup left button title menu, otherwise just call the 
	  oldbuttoneventfn)


    (LET (LeftButtonMenu)
         (if (OR (INSIDEP (DSPCLIPPINGREGION NIL Window)
				(LASTMOUSEX Window)
				(LASTMOUSEY Window))
		     (LASTMOUSESTATE MIDDLE))
	     then (APPLY* (WINDOWPROP Window (QUOTE OLDBUTTONEVENTFN))
			      Window)
	   elseif (type? MENU (SETQ LeftButtonMenu (WINDOWPROP Window (QUOTE 
									   TitleBarLeftButtonMenu))))
	     then (APPLY* (OR (MENU LeftButtonMenu)
				    (FUNCTION NILL))
			      Window)))))
)
(* * Changed functions from NCSKETCHCARD)

(DEFINEQ

(NC.MakeSketchCard
  (LAMBDA (Card Title NoDisplayFlg)                          (* rht: " 6-May-86 12:32")

          (* * rht 2/1/85: Added windowprop to prevent sketch asking about saving changes.)



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



          (* * rht 5/6/86 Replaced call to NC.SetupTitleBarMenu with calls to NC.InstallTitleBarButtonEventFn and 
	  NC.InstallTitleBarLeftMenu and NC.InstallSketchTitleBarMiddleMenu.)


    (if NoDisplayFlg
	then (NC.SetSubstance Card NIL)
	       Card
      else (LET (Window CardType)
	          (SETQ CardType (NC.RetrieveType Card))
	          (SETQ Window (SKETCHW.CREATE NIL NIL (NC.DetermineDisplayRegion Card NIL)
						   (OR Title "Untitled")
						   NIL
						   (SKETCH.COMMANDMENU (NC.GetCardTypeField 
									    MiddleButtonMenuItems 
											 CardType))))
	          (WINDOWPROP Window (QUOTE DONTQUERYCHANGES)
				T)
	          (WINDOWPROP Window (QUOTE SHRINKFN)
				(FUNCTION NC.SketchCardShrinkFn))
	          (NC.InstallTitleBarButtonEventFn Window (FUNCTION 
						       NC.SketchTitleBarButtonEventFn))
	          (NC.InstallTitleBarLeftMenu Window CardType)
	          (NC.SetSubstance Card (INSURE.SKETCH Window))
	      Window))))

(NC.BringUpSketchCard
  (LAMBDA (Card Substance Region/Position)                   (* rht: " 6-May-86 12:32")
                                                             (* Bring up a sketch card containing substance in 
							     specified region)

          (* * rht 2/1/85: Added windowprop to prevent sketch asking about saving changes.)



          (* * rht 10/10/85: Now sets substance if was nil.)



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



          (* * rht 5/5/86: Replaced call to NC.SetupTitleBarMenu with calls to NC.InstallTitleBarButtonEventFn and 
	  NC.InstallTitleBarLeftMenu and NC.InstallSketchTitleBarMiddleMenu.)


    (LET ((SketchName (AND (NULL Substance)
			     (MKATOM (fetch (Card UID) of Card))))
	  Region Title SketchViewer CardType)
         (COND
	   ((SETQ SketchViewer (NC.FetchWindow Card))
	     (RPTQ 2 (FLASHW SketchViewer))
	     (TOTOPW SketchViewer)
	     (TTY.PROCESS (WINDOWPROP SketchViewer (QUOTE PROCESS))))
	   (T (SETQ CardType (NC.RetrieveType Card))
	      (SETQ SketchViewer (SKETCHW.CREATE (OR Substance SketchName)
						     (NC.FetchRegionViewed Card)
						     (NC.DetermineDisplayRegion Card 
										  Region/Position)
						     (NC.RetrieveTitle Card)
						     (NC.FetchScale Card)
						     (SKETCH.COMMANDMENU (NC.GetCardTypeField
									     MiddleButtonMenuItems 
									     CardType))))
	      (WINDOWPROP SketchViewer (QUOTE DONTQUERYCHANGES)
			    T)
	      (WINDOWPROP SketchViewer (QUOTE SHRINKFN)
			    (FUNCTION NC.SketchCardShrinkFn))
	      (NC.InstallTitleBarButtonEventFn SketchViewer (FUNCTION 
						   NC.SketchTitleBarButtonEventFn))
	      (NC.InstallTitleBarLeftMenu SketchViewer CardType)
	      (OR Substance (NC.SetSubstance Card (GETPROP SketchName (QUOTE SKETCH))))))
     SketchViewer)))

(NC.AddSketchCard
  (LAMBDA NIL                                                (* rht: " 6-May-86 11:58")

          (* * fgh 11/14/85: Updated to conform to merging of cardTypes and SubstanceTypes.)



          (* * Added LinkIconAttachedBitMap field.)


    (NC.AddCardType (QUOTE Sketch)
		      (QUOTE NoteCard)
		      (BQUOTE ((MakeFn , (FUNCTION NC.MakeSketchCard))
				 (EditFn , (FUNCTION NC.BringUpSketchCard))
				 (QuitFn , (FUNCTION NC.SketchCardCloseFn))
				 (GetFn , (FUNCTION (LAMBDA (Card Length Stream Version)
					    (LET ((Value (NC.GetSketchSubstance Card Length Stream 
										  Version)))
					         (NC.SetScale Card (CADR Value))
					         (NC.SetRegionViewed Card (CADDR Value))
					         (CAR Value)))))
				 (PutFn , (FUNCTION NC.PutSketchSubstance))
				 (CopyFn , (FUNCTION NC.SketchCopySubstance))
				 (MarkDirtyFn , (FUNCTION NC.MarkSketchDirty))
				 (DirtyPFn , (FUNCTION NC.SketchDirtyP))
				 (CollectLinksFn , (FUNCTION NC.CollectReferencesInSketch))
				 (DeleteLinksFn , (FUNCTION NC.DelReferencesToCardFromSketch))
				 (UpdateLinkIconsFn , (FUNCTION NC.UpdateLinkImagesInSketch))
				 (InsertLinkFn , (FUNCTION NC.InsertLinkInSketch))
				 (TranslateWindowPositionFn , (FUNCTION 
						       NC.TranslateWindowPositionToSketchPosition))
				 (MiddleButtonMenuItems , (SKETCH.COMMANDMENU.ITEMS T T))))
		      (BQUOTE ((DefaultWidth 400)
				 (DefaultHeight 350)
				 (LinkAnchorModesSupported T)
				 (LinkDisplayMode Title)
				 (DisplayedInMenuFlg T)
				 (LinkIconAttachedBitMap , NC.SketchCardIcon))))))
)
(PUTPROPS RHTPATCH041 COPYRIGHT ("Xerox Corporation" 1986))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (1790 2738 (NC.InstallTitleBarButtonEventFn 1800 . 2240) (NC.InstallTitleBarLeftMenu 
2242 . 2736)) (2883 3254 (NC.InstallTextTitleBarMiddleMenu 2893 . 3252)) (3301 6957 (NC.MakeTEditCard 
3311 . 5039) (NC.BringUpTEditCard 5041 . 6955)) (7105 8641 (NC.InstallGraphTitleBarMiddleMenu 7115 . 
7601) (NC.GraphTitleBarButtonEventFn 7603 . 8639)) (8689 11906 (NC.MakeGraphCard 8699 . 10338) (
NC.BringUpGraphCard 10340 . 11904)) (11957 23738 (NC.MakeBrowserCard 11967 . 18555) (
NC.BringUpBrowserCard 18557 . 23736)) (23782 24596 (NC.SketchTitleBarButtonEventFn 23792 . 24594)) (
24645 29680 (NC.MakeSketchCard 24655 . 25994) (NC.BringUpSketchCard 25996 . 27992) (NC.AddSketchCard 
27994 . 29678)))))
STOP