(FILECREATED "10-Jun-86 15:04:58" {QV}<NOTECARDS>1.3K>RHTPATCH048.;1 10118 changes to: (VARS RHTPATCH048COMS) (FNS NC.UpdateBrowserCard)) (* Copyright (c) 1986 by Xerox Corporation. All rights reserved.) (PRETTYCOMPRINT RHTPATCH048COMS) (RPAQQ RHTPATCH048COMS ((* * Changes to NCBROWSERCARD) (FNS NC.UpdateBrowserCard))) (* * Changes to NCBROWSERCARD) (DEFINEQ (NC.UpdateBrowserCard (LAMBDA (Window) (* rht: "10-Jun-86 15:04") (* * rht 10/14/84: Added call to DETACHALLWINDOWS to close any existing links legend window and prompt window. Also added call to NC.MakeLinksLegend to make a new attached legend menu.) (* * rht 1/15/85: Put hooks for AddNode, AddLink, etc. so editing graph edits underlying structure.) (* * rht 2/14/85: Added ability to respecify roots and link labels before recomputing graph.) (* * rht 3/8/85: Modified to use new browser props stored on card's proplist as of release 1.2.) (* * rht 3/17/85: Now takes OnlyLayoutFlg argument. If set, then don't recompute lattice or ask about root nodes.) (* * rht 11/17/85: updated to handle new card and notefile objects.) (* * kirk 23Jan86 Changed to use NC.AskYesOrNo) (* * rht 2/7/86: Now gets and sets browser format, etc. via fetch/set fns.) (* * rht 3/7/86: Now only closes the Links legend menu attached window.) (* * rht 6/10/86: Moved code to delete links legend menu and code to make new browser hash array to after questioning user about respecifying roots.) (PROG (Card LinkLabels RootCards RootNodes Lattice LinkIcon Graph GraphNodes NodeLabel BrowserSpecs BrowserFormat DropVirtualNodesFlg Depth SpecialBrowserSpecs OldLabelNodes OldRootCards) (SETQ Card (NC.CoerceToCard Window)) (SETQ RootCards (NC.FetchBrowserRoots Card)) (SETQ LinkLabels (NC.FetchBrowserLinkLabels Card)) (SETQ BrowserFormat (OR (NC.FetchBrowserFormat Card) (QUOTE (LATTICE)))) (* 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 Depth (OR (NC.FetchBrowserDepth Card) 999999)) (SETQ SpecialBrowserSpecs (OR (NC.FetchSpecialBrowserSpecs Card) (create SPECIALBROWSERSPECS))) (SETQ GraphNodes (fetch (GRAPH GRAPHNODES) of (SETQ Graph (WINDOWPROP Window (QUOTE GRAPH))))) (* Get new roots.) (if (OR (NULL RootCards) (NC.AskYesOrNo "Want to respecify roots? " "--" "No" T Window T NIL)) then (NC.BrowserFlipRoots Window Card GraphNodes (SETQ OldRootCards RootCards)) (SETQ RootCards (NC.SelectNoteCards NIL NIL NC.SelectingBrowserSourceMenu Window NIL (CONCAT "Please select the Cards and/or Boxes the browser should start from." (CHARACTER 13) "(Current roots are highlighted.)") T)) (NC.BrowserFlipRoots Window Card GraphNodes OldRootCards) (COND ((EQ RootCards (QUOTE CANCELLED)) (RETURN)))) (* Get rid of the links legend menu attached window.) (for Win in (ATTACHEDWINDOWS Window) when (WINDOWPROP Win (QUOTE LINKSLEGENDWINP)) do (DETACHWINDOW Win) (CLOSEW Win)) (* Smash the current hash array, putting a fresh one in its place.) (NC.GetBrowserHashArray Card) (NC.PrintMsg Window T (CHARACTER 13) "Computing browser graph. Please wait. ...") (* Compute lattice breadth-first from the roots.) (SETQ Lattice (NC.GrowLinkLattice RootCards NIL LinkLabels Card Depth)) (SETQ RootNodes (for RootCard in RootCards collect (NC.GetBrowserNodeID Card RootCard))) (NC.SetPropListDirtyFlg Card T) (* Remove all links that are in the old browser graph but not in the new one) (for Node in GraphNodes bind NodeID Link eachtime (BLOCK) (SETQ NodeID (fetch (GRAPHNODE NODEID) of Node)) unless (FASSOC (OR (CAR NodeID) NodeID) Lattice) do (if (NC.LinkIconImageObjP (SETQ LinkIcon (fetch (GRAPHNODE NODELABEL) of Node))) then (NC.DeleteLink (NC.FetchLinkFromLinkIcon LinkIcon) T T) else (* Collect the label nodes from the old browser.) (SETQ OldLabelNodes (CONS Node OldLabelNodes)))) (* Create Links for all nodes in the new browser graph but not in the old one.) (for Node in Lattice bind NodeID OldNode eachtime (BLOCK) do (SETQ NodeID (fetch (GRAPHNODE NODEID) of Node)) (COND ((SETQ OldNode (FASSOC NodeID GraphNodes)) (replace (GRAPHNODE NODELABEL) of Node with (fetch (GRAPHNODE NODELABEL) of OldNode))) (T (replace (GRAPHNODE NODELABEL) of Node with (NC.MakeLinkIcon (NC.MakeLink Window NC.BrowserContentsLinkLabel (fetch (GRAPHNODE NODELABEL) of Node) Card))))) (* Untouch each graph node so that next Recompute will put fresh values on proplist.) (NC.UIDRemProp NodeID (QUOTE TouchedFlg)) (NC.UIDRemProp NodeID (QUOTE VisitedFlg))) (* Throw in the label nodes from the old browser.) (SETQ Lattice (NCONC Lattice OldLabelNodes)) (* For each old label node, take away nonexistent fromnodes and save the label nodes that no longer have any from nodes.) (for OldLabelNode in OldLabelNodes eachtime (BLOCK) do (replace (GRAPHNODE FROMNODES) of OldLabelNode with (for FromNodeID in (fetch (GRAPHNODE FROMNODES) of OldLabelNode) bind FromNode eachtime (BLOCK) when (SETQ FromNode (FASSOC FromNodeID Lattice)) collect (* If the From node isn't a label node, then add to its Tonode list.) (if (NC.LinkIconImageObjP (fetch (GRAPHNODE NODELABEL) of FromNode)) then (replace (GRAPHNODE TONODES) of FromNode with (CONS (fetch (GRAPHNODE NODEID) of OldLabelNode) (fetch (GRAPHNODE TONODES) of FromNode)))) FromNodeID)) (* For the old label node's ToNodes, just need to remove any for ToNodes that no longer exist.) (replace (GRAPHNODE TONODES) of OldLabelNode with (for ToNodeID in (fetch (GRAPHNODE TONODES) of OldLabelNode) bind ToNode eachtime (BLOCK) when (SETQ ToNode (FASSOC ToNodeID Lattice)) collect (* If the To node isn't a label node, then add to its FromNode list.) (if (NC.LinkIconImageObjP (fetch (GRAPHNODE NODELABEL) of ToNode)) then (replace (GRAPHNODE FROMNODES) of ToNode with (CONS (fetch (GRAPHNODE NODEID) of OldLabelNode) (fetch (GRAPHNODE FROMNODES) of ToNode)))) ToNodeID))) (* Layout graph, including as roots any non-virtual nodes with no from nodes to avoid disconnected graphs.) (SETQ Graph (if (AND Lattice RootNodes) then (LAYOUTGRAPH Lattice (for Node in Lattice bind NodeID eachtime (BLOCK) (SETQ NodeID (OR (NC.CoerceToGraphNodeID Node) (fetch (GRAPHNODE NODEID) of Node))) when (OR (FMEMB NodeID RootNodes) (NULL (fetch (GRAPHNODE FROMNODES) of Node))) collect NodeID) (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))) (* Build links legend and fix up TONODES in the graph.) (NC.SetBrowserLinksLegend Card (NC.MakeLinksLegend Graph Window DropVirtualNodesFlg)) (NC.SetBrowserRoots Card RootCards) (NC.SetBrowserDepth Card Depth) (WINDOWPROP Window (QUOTE GRAPH) Graph) (NC.RelayoutBrowserCard Window)))) ) (PUTPROPS RHTPATCH048 COPYRIGHT ("Xerox Corporation" 1986)) (DECLARE: DONTCOPY (FILEMAP (NIL (392 10036 (NC.UpdateBrowserCard 402 . 10034))))) STOP