(FILECREATED "13-May-87 23:40:31" {QV}<NOTECARDS>1.3K>NEXT>RHTPATCH261.;4 6458   

      changes to:  (FNS NC.ConvertVersion2BrowserCard)
		   (VARS RHTPATCH261COMS)

      previous date: "13-May-87 19:00:29" {QV}<NOTECARDS>1.3K>NEXT>RHTPATCH261.;1)


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

(PRETTYCOMPRINT RHTPATCH261COMS)

(RPAQQ RHTPATCH261COMS ((DECLARE: FIRST (P (NC.LoadFileFromDirectories (QUOTE NCCONVERTVERSION2TO3))
					     ))
			  (* * Fixes bug %#432: Browser expand node on newly converted notefile 
			     destroys links.)
			  (* * Change to NCCONVERTVERSION2TO3)
			  (FNS NC.ConvertVersion2BrowserCard)))
(DECLARE: FIRST 
(NC.LoadFileFromDirectories (QUOTE NCCONVERTVERSION2TO3))
)
(* * Fixes bug %#432: Browser expand node on newly converted notefile destroys links.)

(* * Change to NCCONVERTVERSION2TO3)

(DEFINEQ

(NC.ConvertVersion2BrowserCard
  (LAMBDA (Card Version2HashArray)                           (* rht: "13-May-87 23:40")

          (* * Fix the browser roots and graphnode IDs to be version 3 -
	  this is just modified version of the code in NCMERGEFILES that processes browser cards.)



          (* * rht 4/5/86: Now removes NODEID and DESTNODEID fields from LinkParams of TOLINKS of graphnodes.
	  This effectively converts multiple links between pairs of nodes into single links. Thus, users will have to 
	  ReconnectNodesInBrowser in order to recover the multiple links they had in 1.2.)



          (* * fgh 5/28/86 Changed the way the TONODES and FROMNODES lists are converted. Now uses an ASSOC list to map from 
	  old to new NodeIds when convreting the NODEID field. This is then used to convert each NodeID in the TO and FTOM 
	  lists. This way virtual nodes we can be sure for virtual nodes that all references are EQ not just EQUAL as 
	  required by grapher.)



          (* * rht 5/13/87: Now puts the information regarding link dashing onto the individual graph node id props.
	  This gets saved when the browser is "put" to the 1.3 notefile.)


    (DECLARE (GLOBALVARS NC.DashingStyles))              (* Get various stuff off browser's prop list.)
    (LET (MappingList LinksLegend)
         (NC.SetBrowserLinkLabels Card (CAR (NC.GetProp Card (QUOTE BrowserLinkLabels))))
         (NC.RemProp Card (QUOTE BrowserLinkLabels))
         (NC.SetBrowserLinksLegend Card (SETQ LinksLegend (CAR (NC.GetProp Card (QUOTE
										     
									       BrowserLinksLegend)))))
         (NC.RemProp Card (QUOTE BrowserLinksLegend))
         (NC.SetBrowserDepth Card (NC.GetProp Card (QUOTE BrowserDepth)))
         (NC.RemProp Card (QUOTE BrowserDepth))
         (NC.SetBrowserFormat Card (CAR (NC.GetProp Card (QUOTE BrowserFormat))))
         (NC.RemProp Card (QUOTE BrowserFormat))
         (NC.SetSpecialBrowserSpecs Card (CAR (NC.GetProp Card (QUOTE SpecialBrowserSpecs))))
         (NC.RemProp Card (QUOTE SpecialBrowserSpecs))   (* Fix up browser roots)
         (NC.SetBrowserRoots Card (for BrowserRootID in (CAR (NC.GetProp Card (QUOTE
										     BrowserRoots)))
				       collect (NC.Version3CardFromVersion2ID BrowserRootID 
										Version2HashArray)))
                                                             (* Throw away old browser roots.)
         (NC.RemProp Card (QUOTE BrowserRoots))

          (* * Fix up graph nodeids and store a mapping between old and new IDs on MappingList)


         (bind OldNodeID NewNodeID for GraphNode in (fetch (GRAPH GRAPHNODES)
							     of (NC.FetchSubstance Card))
	    do (replace (GRAPHNODE NODEID) of GraphNode with (SETQ NewNodeID
								       (
								    NC.ConvertVersion2GraphNodeID
									 (SETQ OldNodeID
									   (fetch (GRAPHNODE NODEID)
									      of GraphNode))
									 Card Version2HashArray)))
		 (push MappingList (CONS OldNodeID NewNodeID)))

          (* * Fix up the TONODES and FROMNODES for each GRAPHNODE using the new IDs created above and stored in 
	  MappingList.)


         (for GraphNode in (fetch (GRAPH GRAPHNODES) of (NC.FetchSubstance Card))
	    do (LET ((GraphNodeID (NC.CoerceToGraphNodeID GraphNode)))
		      (replace (GRAPHNODE TONODES) of GraphNode
			 with (for ToNode in (fetch (GRAPHNODE TONODES) of GraphNode)
				   collect (LET ((ToNodeDashingStyle (if (EQ (CAR ToNode)
										   LINKPARAMS)
									   then
									    (LISTGET ToNode
										       (QUOTE
											 DASHING))
									 else NIL))
						   ToNodeID)
					          (SETQ ToNodeID
						    (CDR (ASSOC (if (EQ (CAR ToNode)
										LINKPARAMS)
									then (CADR ToNode)
								      else ToNode)
								    MappingList)))
					          (NC.GraphNodeIDPutProp
						    GraphNodeID ToNodeID
						    (for DashingStyle in NC.DashingStyles
						       as DashingPair in LinksLegend
						       when (EQUAL DashingStyle 
								       ToNodeDashingStyle)
						       do (RETURN DashingPair)
						       finally (RETURN (CAR LinksLegend))))
					          (if (EQ (CAR ToNode)
							      LINKPARAMS)
						      then (RPLACA (CDR ToNode)
								       ToNodeID)
							     (AND (LISTGET ToNode (QUOTE NODEID)
									       )
								    (LISTPUT ToNode (QUOTE NODEID)
									       NIL))
							     (AND (LISTGET ToNode (QUOTE 
										       DESTNODEID))
								    (LISTPUT ToNode (QUOTE 
										       DESTNODEID)
									       NIL))
							     ToNode
						    else ToNodeID)))))
		 (replace (GRAPHNODE FROMNODES) of GraphNode
		    with (for NodeID in (fetch (GRAPHNODE FROMNODES) of GraphNode)
			      collect (COND
					  ((EQ (CAR NodeID)
						 LINKPARAMS)
					    (RPLACA (CDR NodeID)
						      (CDR (ASSOC (CADR NodeID)
								      MappingList))))
					  (T (CDR (ASSOC NodeID MappingList))))))))))
)
(PUTPROPS RHTPATCH261 COPYRIGHT ("Xerox Corporation" 1987))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (876 6376 (NC.ConvertVersion2BrowserCard 886 . 6374)))))
STOP