(FILECREATED "21-May-86 10:28:45" {QV}<NOTECARDS>1.3K>FGHPATCH042.;1 9789
changes to: (VARS FGHPATCH042COMS))
(* Copyright (c) 1986 by Xerox Corporation. All rights reserved.)
(PRETTYCOMPRINT FGHPATCH042COMS)
(RPAQQ FGHPATCH042COMS ((* * Fix to unreported bugs whereby which Unconnect and reconnect nodes in
browsers would destroy the title bar menus. From NCBROWSERCARD)
(FNS NC.UnconnectNodesInBrowser NC.ConnectNodesInBrowser)))
(* * Fix to unreported bugs whereby which Unconnect and reconnect nodes in browsers would
destroy the title bar menus. From NCBROWSERCARD)
(DEFINEQ
(NC.UnconnectNodesInBrowser
(LAMBDA (Window) (* fgh: "21-May-86 10:02")
(* * 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.)
(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)
(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)
(NC.InstallTitleBarButtonEventFn Window (FUNCTION NC.GraphTitleBarButtonEventFn))
(NC.SetSubstance Card (WINDOWPROP Window (QUOTE GRAPH)))
(NC.MarkCardDirty Card)
(NC.SetBrowserLinksLegend Card NIL)
(NC.ClearMsg Window T))))
(NC.ConnectNodesInBrowser
(LAMBDA (Window) (* fgh: "21-May-86 10:02")
(* * 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.)
(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))
(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))
(NC.SetSubstance Card (WINDOWPROP Window (QUOTE GRAPH)))
(NC.MarkCardDirty Card)
(NC.ClearMsg Window T))))
)
(PUTPROPS FGHPATCH042 COPYRIGHT ("Xerox Corporation" 1986))
(DECLARE: DONTCOPY
(FILEMAP (NIL (617 9707 (NC.UnconnectNodesInBrowser 627 . 3176) (NC.ConnectNodesInBrowser 3178 . 9705)
))))
STOP