(FILECREATED " 5-Nov-86 17:41:46" {QV}<NOTECARDS>1.3K>NEXT>RHTPATCH136.;3 3954   

      changes to:  (FNS NC.LayoutNewBrowserNodes)
		   (VARS RHTPATCH136COMS)

      previous date: " 5-Nov-86 17:36:16" {QV}<NOTECARDS>1.3K>NEXT>RHTPATCH136.;1)


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

(PRETTYCOMPRINT RHTPATCH136COMS)

(RPAQQ RHTPATCH136COMS ((* * Fixes bug in ExpandBrowserNode noted by John Tang.)
			  (FILES (FROM NOTECARDS)
				 NCBROWSERCARD)
			  (* * Change to NCBROWSERCARD)
			  (FNS NC.LayoutNewBrowserNodes)))
(* * Fixes bug in ExpandBrowserNode noted by John Tang.)

(FILESLOAD (FROM NOTECARDS)
	   NCBROWSERCARD)
(* * Change to NCBROWSERCARD)

(DEFINEQ

(NC.LayoutNewBrowserNodes
  (LAMBDA (RootNode NewNodes BrowserFormat SpecialBrowserSpecs)
                                                             (* rht: " 5-Nov-86 17:41")

          (* * Hold onto old location of RootNode. Then layout the subgraph having root RootNode and lattice NewNodes.
	  Finally, translate the locations of NewNodes using old loc of RootNode.)



          (* * rht 8/21/86: LAYOUTGRAPH destroys FROMNODES of root node. Now we save and restore these after LAYOUTGRAPH is 
	  called.)



          (* * rht 11/5/86: Now replaces ToNodes of each node with a subset consisting only of nodes in NewNodes so 
	  LAYOUTGRAPH won't break. Afterwards, puts the original list back.)


    (DECLARE (GLOBALVARS NC.*Graph*BrowserFormat))
    (LET ((OldRootNodePos (fetch (GRAPHNODE NODEPOSITION) of RootNode))
	  (Lattice (CONS RootNode NewNodes))
	  (FromNodes (fetch (GRAPHNODE FROMNODES) of RootNode))
	  NewRootNodePos)                                    (* Stash old ToNodes and replace with intersection of 
							     original ToNodes and NewNodes.)
         (for Node in Lattice do (LET ((NodeID (NC.CoerceToGraphNodeID Node))
					     (ToNodes (fetch (GRAPHNODE TONODES) of Node)))
					    (NC.GraphNodeIDPutProp NodeID (QUOTE OldToNodes)
								     ToNodes)
					    (replace (GRAPHNODE TONODES) of Node
					       with (for Node in ToNodes
							 when (FASSOC Node Lattice) collect
											 Node))))
         (LAYOUTGRAPH Lattice (LIST (fetch (GRAPHNODE NODEID) of RootNode))
			(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))
                                                             (* Restore FROMNODES of RootNode.)
         (replace (GRAPHNODE FROMNODES) of RootNode with FromNodes)
         (SETQ NewRootNodePos (fetch (GRAPHNODE NODEPOSITION) of RootNode))
         (for Node in Lattice
	    bind (XOffset ←(DIFFERENCE (fetch XCOORD of OldRootNodePos)
					   (fetch XCOORD of NewRootNodePos)))
		   (YOffset ←(DIFFERENCE (fetch YCOORD of OldRootNodePos)
					   (fetch YCOORD of NewRootNodePos)))
	    do                                             (* Recover old list of ToNodes.)
		 (replace (GRAPHNODE TONODES) of Node with (NC.GraphNodeIDGetProp
								   (NC.CoerceToGraphNodeID Node)
								   (QUOTE OldToNodes)))
		 (LET ((NodePos (fetch (GRAPHNODE NODEPOSITION) of Node)))
		      (replace (GRAPHNODE NODEPOSITION) of Node
			 with (create POSITION
					  XCOORD ←(PLUS XOffset (fetch XCOORD of NodePos))
					  YCOORD ←(PLUS YOffset (fetch YCOORD of NodePos))))))))
)
)
(PUTPROPS RHTPATCH136 COPYRIGHT ("Xerox Corporation" 1986))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (707 3872 (NC.LayoutNewBrowserNodes 717 . 3870)))))
STOP