(FILECREATED "10-Jun-86 10:46:14" {QV}<NOTECARDS>1.3K>RHTPATCH047.;3 19935 changes to: (VARS RHTPATCH047COMS) (FNS NC.CardFromBrowserNodeID NC.LayoutNewBrowserNodes NC.ShowBrowserGraph NC.ExpandBrowserNode NC.ConnectNodesInBrowser NC.UnconnectNodesInBrowser) previous date: "10-Jun-86 09:53:14" {QV}<NOTECARDS>1.3K>RHTPATCH047.;1) (* Copyright (c) 1986 by Xerox Corporation. All rights reserved.) (PRETTYCOMPRINT RHTPATCH047COMS) (RPAQQ RHTPATCH047COMS ((* * New functions for NCBROWSERCARD) (FNS NC.LayoutNewBrowserNodes NC.ShowBrowserGraph) (* * Changes to NCBROWSERCARD) (FNS NC.ExpandBrowserNode NC.ConnectNodesInBrowser NC.UnconnectNodesInBrowser NC.CardFromBrowserNodeID))) (* * New functions for NCBROWSERCARD) (DEFINEQ (NC.LayoutNewBrowserNodes (LAMBDA (RootNode NewNodes BrowserFormat SpecialBrowserSpecs) (* rht: "10-Jun-86 10:02") (* * 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.) (LET ((OldRootNodePos (fetch (GRAPHNODE NODEPOSITION) of RootNode)) (Lattice (CONS RootNode NewNodes)) NewRootNodePos) (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)) (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 (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)))))))) ) (NC.ShowBrowserGraph (LAMBDA (Graph Window) (* rht: "10-Jun-86 10:08") (* * SHOWGRAPH Graph in Window.) (SHOWGRAPH Graph Window (FUNCTION NC.GraphCardLeftButtonFn) (FUNCTION NC.GraphCardMiddleButtonFn) NIL T) (* * Have to reset windowprops since SHOWGRAPH messes with them.) (* Disable the old-style right button grapher editor menu.) (WINDOWPROP Window (QUOTE RIGHTBUTTONFN) (FUNCTION NC.BrowserRightButtonFn)) (WINDOWADDPROP Window (QUOTE REPAINTFN) (FUNCTION NC.BrowserRepaintFn) T) (WINDOWPROP Window (QUOTE SCROLLFN) (FUNCTION NC.BrowserScrollFn)) (WINDOWPROP Window (QUOTE RESHAPEFN) (FUNCTION NC.BrowserReshapeFn)) (NC.InstallTitleBarButtonEventFn Window (FUNCTION NC.GraphTitleBarButtonEventFn)))) ) (* * Changes to NCBROWSERCARD) (DEFINEQ (NC.ExpandBrowserNode (LAMBDA (Window) (* rht: "10-Jun-86 10:34") (* * Ask user to choose a node in the browser and recompute the part of the lattice under that node to the given depth. And relayout the graph. The code is just a modification of the NC.UpdateBrowserCard code.) (* * rht 2/7/86: Now gets and sets browser format, etc. via fetch/set fns.) (* * rht 6/10/86: No longer does relayout after expand. Uses NC.LayoutNewBrowserNodes to compute proper locations of new nodes. Also calls NC.ShowBrowserGraph.) (PROG (NodeToExpand Card LinkLabels RootCards RootNodes Lattice LinkIcon OldToNodePairs Graph GraphNodes NodeLabel OldNode Link BrowserSpecs BrowserFormat DropVirtualNodesFlg Depth SpecialBrowserSpecs SavedLabelNodes NewNodes) (SETQ Card (NC.CoerceToCard Window)) (SETQ RootCards (NC.FetchBrowserRoots Card)) (SETQ LinkLabels (NC.FetchBrowserLinkLabels Card)) (SETQ BrowserFormat (NC.FetchBrowserFormat Card)) (* 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 (OR (NC.FetchSpecialBrowserSpecs Card) (create SPECIALBROWSERSPECS))) (SETQ GraphNodes (fetch (GRAPH GRAPHNODES) of (SETQ Graph (WINDOWPROP Window (QUOTE GRAPH))))) (* If there aren't any nodes in graph, then get out pronto.) (if (NULL GraphNodes) then (NC.PrintMsg Window T "No nodes to expand.") (DISMISS 1000) (NC.ClearMsg Window T) (RETURN NIL)) (* Create hash array if haven't already.) (NC.GetBrowserHashArray Card Graph) (NC.PrintMsg Window T "Pick node to expand." (CHARACTER 13)) (* Note call to the grapher function READ/NODE to select a graph node.) (SETQ NodeToExpand (READ/NODE GraphNodes Window)) (* Can't expand a label node.) (if (NOT (NC.LinkIconImageObjP (fetch (GRAPHNODE NODELABEL) of NodeToExpand))) then (NC.PrintMsg NIL T "Sorry, can't expand a label node.") (FLASHW PROMPTWINDOW) (NC.ClearMsg Window T) (RETURN)) (SETQ Depth (MKATOM (NC.AskUser "Depth to expand (type integer or INF): " "--" 1 T Window NIL NIL T))) (COND ((EQ Depth (QUOTE INF)) (SETQ Depth MAX.FIXP)) ((NOT (AND (FIXP Depth) (GREATERP Depth 0))) (NC.PrintMsg Window T "Depth must be an integer greater than 0 or INF.") (RETURN))) (NC.PrintMsg Window T (CHARACTER 13) "Augmenting browser graph. Please wait. ...") (* Save the nodes pointed to by the chosen node that are label nodes. GrowLinkLattice will trash those, so we restore afterwards.) (SETQ SavedLabelNodes (for ToNode in (fetch (GRAPHNODE TONODES) of NodeToExpand) eachtime (BLOCK) when (AND (NOT (EQ (CAR ToNode) LINKPARAMS)) (NOT ( NC.LinkIconImageObjP ToNode))) collect ToNode)) (* Increase link lattice from chosen node to given depth.) (SETQ Lattice (NC.GrowLinkLattice (LIST (NC.CardFromBrowserNodeID (fetch (GRAPHNODE NODEID) of NodeToExpand))) (APPEND GraphNodes) LinkLabels Card Depth)) (AND SavedLabelNodes (replace (GRAPHNODE TONODES) of NodeToExpand with (APPEND SavedLabelNodes (fetch (GRAPHNODE TONODES) of NodeToExpand)))) (SETQ RootNodes (for RootCard in RootCards collect (NC.GetBrowserNodeID Card RootCard))) (NC.SetPropListDirtyFlg Card T) (* Create Links for all nodes in the new browser graph but not in the old one.) (for Node in Lattice bind NodeID do (COND ((SETQ OldNode (FASSOC (SETQ NodeID (OR (NC.CoerceToGraphNodeID Node) (fetch (GRAPHNODE NODEID) of Node))) 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))) (* Make a list of all new nodes.) (push NewNodes Node))) (* Throw away virtual node info.) (AND NodeID (replace (GRAPHNODE NODEID) of Node with NodeID)) (* Untouch each graph node so that next Recompute will put fresh values on proplist.) (NC.UIDRemProp NodeID (QUOTE TouchedFlg)) (NC.UIDRemProp NodeID (QUOTE VisitedFlg)) (* Smash all the unnecessary junk off existing nodes, letting LAYOUTGRAPH and NC.MakeLinksLegend recompute.) (replace (GRAPHNODE TONODES) of Node with (for ToNode in (fetch (GRAPHNODE TONODES) of Node) bind ToNodeID eachtime (BLOCK) collect (if (SETQ ToNodeID (NC.CoerceToGraphNodeID ToNode)) then (* Throw away link parameterlist info.) (* Throw away link dashing info.) (NC.UIDPutProp NodeID ToNodeID (for LabelPair in (NC.UIDGetProp NodeID ToNodeID) collect (OR (CAR LabelPair) LabelPair))) (NC.UIDPutProp ToNodeID NodeID (for LabelPair in (NC.UIDGetProp ToNodeID NodeID) collect (OR (CAR LabelPair) LabelPair))) ToNodeID else ToNode)))) (* LAYOUTGRAPH doesn't like duplicate nodes. These get created when virtual nodes are turned into regular nodes.) (SETQ Lattice (NC.RemoveDuplicateNodesFromGraph Lattice)) (NC.RebuildFromNodesInGraph Lattice) (AND NewNodes (NC.LayoutNewBrowserNodes NodeToExpand NewNodes BrowserFormat SpecialBrowserSpecs)) (replace (GRAPH GRAPHNODES) of Graph with Lattice) (* Build links legend and fix up TONODES in the graph.) (NC.SetBrowserLinksLegend Card (NC.MakeLinksLegend Graph Window DropVirtualNodesFlg)) (WINDOWPROP Window (QUOTE GRAPH) Graph) (* Display the graph.) (NC.ShowBrowserGraph Graph Window) (NC.SetSubstance Card Graph) (NC.MarkCardDirty Card) (NC.ClearMsg Window T)))) (NC.ConnectNodesInBrowser (LAMBDA (Window) (* rht: "10-Jun-86 10:11") (* * Draw any links, from the current link set, between any pairs of nodes currently being shown in the browser.) (* * rht 2/7/86: Now gets and sets browser format, etc. via fetch/set fns. Also fixed one last old call to GETPROPLIST on a NodeID.) (* * rht 3/2/86: Added WINDOWPROP for SCROLLFN and RESHAPEFN.) (* * fgh 5/21/86 Updated reinstallation of title bar menus after SHOWGRAPH to use new title bar menu mechanism.) (* * rht 6/10/86: Now calls NC.ShowBrowserGraph.) (PROG (Card LinkLabels Graph GraphNodes BrowserFormat DropVirtualNodesFlg NodeIDs) (SETQ Card (NC.CoerceToCard Window)) (SETQ LinkLabels (NC.FetchBrowserLinkLabels Card)) (SETQ BrowserFormat (NC.FetchBrowserFormat Card)) (* 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 GraphNodes (fetch (GRAPH GRAPHNODES) of (SETQ Graph (WINDOWPROP Window (QUOTE GRAPH))))) (* Create hash array if haven't already.) (NC.GetBrowserHashArray Card Graph) (* check graph node size against image box size.) (NC.GraphLinkIconUpdateCheck Card Window Graph NIL) (* These are the workhorse loops that rebuild the TONODES of each nonvirtual node.) (* First smash all the nodeID's proplists and accumulate nodeIDs.) (SETQ NodeIDs (for Node in GraphNodes bind NodeID eachtime (BLOCK) when (NC.LinkIconImageObjP (fetch (GRAPHNODE NODELABEL) of Node)) collect (NC.SmashGraphNodeIDProps (SETQ NodeID ( NC.CoerceToGraphNodeID Node))) NodeID)) (* Throw away duplicates obtained from virtual nodes.) (SETQ NodeIDs (INTERSECTION NodeIDs NodeIDs)) (* Next accumulate all linktypes on the from node's proplist using the To node's graphnodeID as prop name. We do the analogous thing for backward links, but notice that we ignore backward linktypes that also appear in the list in their forward version.) (for NodeID in NodeIDs bind RealCard do (for Link in (NC.RetrieveToLinks (SETQ RealCard ( NC.CardFromBrowserNodeID NodeID))) bind DestNodeID eachtime (BLOCK) when (NC.LinkLabelP Link LinkLabels) when (FMEMB (SETQ DestNodeID (NC.GetBrowserNodeID Card (fetch (Link DestinationCard) of Link))) NodeIDs) do (NC.UIDAddProp NodeID DestNodeID (fetch (Link Label) of Link) T)) (for Link in (NC.RetrieveFromLinks RealCard) bind SourceNodeID eachtime (BLOCK) when (AND (NC.ReverseLinkLabelP Link LinkLabels) (NOT (NC.LinkLabelP Link LinkLabels))) when (FMEMB (SETQ SourceNodeID (NC.GetBrowserNodeID Card (fetch (Link SourceCard) of Link))) NodeIDs) do (NC.UIDAddProp SourceNodeID NodeID (fetch (Link Label) of Link) T))) (for Node in GraphNodes bind NodeID OldToNodeIDs eachtime (BLOCK) unless (LISTP (SETQ NodeID (fetch (GRAPHNODE NODEID) of Node))) when (NC.LinkIconImageObjP (fetch (GRAPHNODE NODELABEL) of Node)) do (* Accumulate the old NodeIDs, possibly virtual, from the TONODES list.) (SETQ OldToNodeIDs (for ToNode in (fetch (GRAPHNODE TONODES) of Node) collect (if (EQ (CAR ToNode) LINKPARAMS) then (CADR ToNode) else ToNode))) (* The trick here is to use a virtual node for this ToNode if one was used before, otherwise just the ToNodeID. Also throw in the label nodes that were in the TONODES list before.) (replace (GRAPHNODE TONODES) of Node with (NCONC (for ToNodeID on ( NC.ComputeBrowserSavedLinkingInfoForNode NodeID) by (CDDR ToNodeID) eachtime (BLOCK) collect (OR (for OldToNodeID in OldToNodeIDs thereis (AND (LISTP OldToNodeID) (EQ (CAR ToNodeID) (CAR OldToNodeID)) OldToNodeID)) (CAR ToNodeID))) (for ToNodeID in OldToNodeIDs eachtime (BLOCK) unless (NC.SameCardP Card (NC.CardFromBrowserNodeID (NC.CoerceToGraphNodeID ToNodeID))) collect ToNodeID)))) (NC.RebuildFromNodesInGraph GraphNodes) (NC.SetBrowserLinksLegend Card (NC.MakeLinksLegend Graph Window DropVirtualNodesFlg)) (* Display the graph.) (NC.ShowBrowserGraph Graph Window) (NC.SetSubstance Card (WINDOWPROP Window (QUOTE GRAPH))) (NC.MarkCardDirty Card) (NC.ClearMsg Window T)))) (NC.UnconnectNodesInBrowser (LAMBDA (Window) (* rht: "10-Jun-86 10:12") (* * Remove all the links in the browser.) (* * rht 11/17/85: Now handles new card and notefile objects.) (* * rht 2/7/86: Now gets and sets browser format, etc. via fetch/set fns.) (* * fgh 5/21/86 Updated reinstallation of title bar menus after SHOWGRAPH to use new title bar menu mechanism.) (* * rht 6/10/86: Now calls NC.ShowBrowserGraph.) (PROG (Card Graph GraphNodes BrowserFormat DropVirtualNodesFlg) (SETQ Card (NC.CoerceToCard Window)) (SETQ BrowserFormat (NC.FetchBrowserFormat Card)) (* 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 GraphNodes (fetch (GRAPH GRAPHNODES) of (SETQ Graph (WINDOWPROP Window (QUOTE GRAPH))))) (* smash all the nodeID's proplists and TONODES fields.) (for Node in GraphNodes bind NodeID unless (PROGN (BLOCK) (LISTP (SETQ NodeID (fetch (GRAPHNODE NODEID) of Node)))) do (NC.SmashGraphNodeIDProps NodeID) (replace (GRAPHNODE TONODES) of Node with NIL) (replace (GRAPHNODE FROMNODES) of Node with NIL)) (NC.MakeLinksLegend Graph Window DropVirtualNodesFlg) (* Display the graph.) (NC.ShowBrowserGraph Graph Window) (NC.SetSubstance Card (WINDOWPROP Window (QUOTE GRAPH))) (NC.MarkCardDirty Card) (NC.SetBrowserLinksLegend Card NIL) (NC.ClearMsg Window T)))) (NC.CardFromBrowserNodeID (LAMBDA (BrowserNodeID) (* rht: "10-Jun-86 10:46") (* * Extract the card from a browser nodeID.) (* * rht 6/10/86: Now checks first for valid UID.) (AND (type? UID BrowserNodeID) (NC.UIDGetProp BrowserNodeID (QUOTE CardObject))))) ) (PUTPROPS RHTPATCH047 COPYRIGHT ("Xerox Corporation" 1986)) (DECLARE: DONTCOPY (FILEMAP (NIL (790 3479 (NC.LayoutNewBrowserNodes 800 . 2485) (NC.ShowBrowserGraph 2487 . 3477)) (3517 19853 (NC.ExpandBrowserNode 3527 . 11502) (NC.ConnectNodesInBrowser 11504 . 17395) ( NC.UnconnectNodesInBrowser 17397 . 19490) (NC.CardFromBrowserNodeID 19492 . 19851))))) STOP