(FILECREATED "13-Feb-87 16:38:53" {QV}<NOTECARDS>1.3K>NEXT>PMIPATCH016.;3 8183   

      changes to:  (VARS PMIPATCH016COMS)

      previous date: "10-Feb-87 13:00:28" {QV}<NOTECARDS>1.3K>NEXT>PMIPATCH016.;2)


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

(PRETTYCOMPRINT PMIPATCH016COMS)

(RPAQQ PMIPATCH016COMS ((* * rht&pmi 2/6/87: Fixes problem with browser cards being displayed twice 
			     the first time they are brought up in an open notefile)
			  (FILES (FROM NOTECARDS)
				 NCBROWSERCARD)
			  (* * Change to NCBROWSERCARD)
			  (FNS NC.BringUpBrowserCard)
			  (* * Change to NCGRAPHCARD)
			  (FNS NC.GraphNodeLinkIconUpdate)))
(* * rht&pmi 2/6/87: Fixes problem with browser cards being displayed twice the first time 
they are brought up in an open notefile)

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

(DEFINEQ

(NC.BringUpBrowserCard
  (LAMBDA (Card Substance Region/Position)                   (* rht: " 6-Feb-87 15:57")

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



          (* * rht&pmi 2/6/87: Moved call to NC.GraphLinkIconUpdateCheck in front of call to GraphCard's EditFn so as to 
	  remove "double display" problem.)


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


         (NC.GraphLinkIconUpdateCheck Card NIL Substance T)
         (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)))
)
(* * Change to NCGRAPHCARD)

(DEFINEQ

(NC.GraphNodeLinkIconUpdate
  (LAMBDA (Window GraphNode)                                 (* rht: " 6-Feb-87 15:56")

          (* * Check whether the image box size agrees with graphnode size. If not, update graph node.
	  REDISPLAYW should eventually happen to the graph after calling this.)



          (* * rht&pmi 2/6/87: Now includes BorderSize in calculation of graph node label size. This is important for virtual
	  nodes.)


    (LET ((LinkIcon (fetch (GRAPHNODE NODELABEL) of GraphNode))
	  (BorderSize (TIMES 2 (GRAPHNODE/BORDER/WIDTH (fetch (GRAPHNODE NODEBORDER)
							      of GraphNode))))
	  (GraphNodeWidth (fetch (GRAPHNODE NODEWIDTH) of GraphNode))
	  (GraphNodeHeight (fetch (GRAPHNODE NODEHEIGHT) of GraphNode))
	  ImageBox XSize YSize)
         (if (NC.LinkIconImageObjP LinkIcon)
	     then (SETQ ImageBox (NC.LinkIconImageBoxFn LinkIcon (WINDOWPROP Window
										     (QUOTE DSP))))
		    (SETQ XSize (fetch (IMAGEBOX XSIZE) of ImageBox))
		    (SETQ YSize (fetch (IMAGEBOX YSIZE) of ImageBox))
		    (if (AND GraphNodeWidth (NOT (EQUAL XSize (DIFFERENCE GraphNodeWidth 
										    BorderSize))))
			then (replace (GRAPHNODE NODEWIDTH) of GraphNode
				  with (PLUS XSize BorderSize)))
		    (if (AND GraphNodeHeight (NOT (EQUAL YSize (DIFFERENCE GraphNodeHeight 
										     BorderSize))))
			then (replace (GRAPHNODE NODEHEIGHT) of GraphNode
				  with (PLUS YSize BorderSize)))))))
)
(PUTPROPS PMIPATCH016 COPYRIGHT ("Xerox Corporation" 1987))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (899 6431 (NC.BringUpBrowserCard 909 . 6429)) (6466 8101 (NC.GraphNodeLinkIconUpdate 
6476 . 8099)))))
STOP