(FILECREATED "28-Apr-87 18:13:54" {QV}<NOTECARDS>1.3K>NEXT>RHTPATCH250.;1 2857   

      changes to:  (VARS RHTPATCH250COMS))


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

(PRETTYCOMPRINT RHTPATCH250COMS)

(RPAQQ RHTPATCH250COMS ((* * Fixes bug reported by Wes whereby MoveNodeAndSubtree breaks for nodes 
			     with lots of subnodes.)
			  (DECLARE: FIRST (P (LOAD? (NC.FindFile (QUOTE GRAPHERPATCH)))))
			  (* * Change to GRAPHERPATCH)
			  (FNS NOT.TRACKCURSOR)))
(* * Fixes bug reported by Wes whereby MoveNodeAndSubtree breaks for nodes with lots of 
subnodes.)

(DECLARE: FIRST 
(LOAD? (NC.FindFile (QUOTE GRAPHERPATCH)))
)
(* * Change to GRAPHERPATCH)

(DEFINEQ

(NOT.TRACKCURSOR
  (LAMBDA (Node DisplayStream Graph)                         (* rht: "28-Apr-87 18:06")

          (* * Gets an old, and a new region from the user, and uses these to calculate all the new positions for all the 
	  children of Node.)



          (* * rht 4/28/87: Changed from APPLY of UNIONREGIONS to for loop doing successive UNIONREGIONS calls.)


    (if (NULL Node)
	then (PROMPTPRINT "No node selected.")
      else (PROG* ((Children (RECURSIVE.COLLECTDESCENDENTS Node Graph))
		     (OldRegion (for EachNode in (CONS Node Children)
				   bind (TotalRegion ←(NODEREGION Node))
				   do (FLIPNODE EachNode DisplayStream)
					(SETQ TotalRegion (UNIONREGIONS TotalRegion (NODEREGION
									      EachNode)))
				   finally (RETURN TotalRegion)))
		     (NewRegionPosition (GETBOXPOSITION.FROMINITIALREGION (WFROMDS DisplayStream)
									    OldRegion DisplayStream))
		     (deltaX (DIFFERENCE (fetch (POSITION XCOORD) of NewRegionPosition)
					   (fetch (REGION LEFT) of OldRegion)))
		     (deltaY (DIFFERENCE (fetch (POSITION YCOORD) of NewRegionPosition)
					   (fetch (REGION BOTTOM) of OldRegion)))
		     (OldPos (fetch (GRAPHNODE NODEPOSITION) of Node))
		     (NewPos (CREATE.NEW.NODEPOSITION Node deltaX deltaY)))
		    (if (NOT (EQUAL OldPos NewPos))
			then (MOVENODE Node OldPos NewPos Graph DisplayStream)
			       (EXTENDEXTENT (WFROMDS DisplayStream)
					       (NODEREGION Node))
			       (CALL.MOVENODEFN Node OldPos Graph (WFROMDS DisplayStream)
						  NewPos)
			       (if Children
				   then (PROG ((MovedNodes (LIST (fetch (GRAPHNODE NODEID)
									  of Node))))
					          (MOVEDESCENDENTS Graph Node DisplayStream deltaX 
								     deltaY))))
		    (for EachNode in (CONS Node Children) do (FLIPNODE EachNode 
										 DisplayStream))))))
)
(PUTPROPS RHTPATCH250 COPYRIGHT ("Xerox Corporation" 1987))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (706 2775 (NOT.TRACKCURSOR 716 . 2773)))))
STOP