(FILECREATED "20-Mar-87 14:35:18" {QV}<NOTECARDS>1.3K>NEXT>RHTPATCH220.;3 32711  

      changes to:  (VARS RHTPATCH220COMS)
		   (FNS NC.MakeLinksLegendMenu NC.BrowserOverviewWinReshapeFn NC.UpdateBrowserCard 
			NC.MakeBrowserCard NC.AttachNoteFileName)
		   (MACROS NC.WithTopWindowsUnattached NC.WithWindowsUnattached)

      previous date: "19-Mar-87 19:10:06" {QV}<NOTECARDS>1.3K>NEXT>RHTPATCH220.;1)


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

(PRETTYCOMPRINT RHTPATCH220COMS)

(RPAQQ RHTPATCH220COMS ((* * Fixes bug whereby RecomputeBrowser was always making new links even 
			     for those that didn't change. Also removed needless call to 
			     NC.ActivateBrowserCard from NC.MakeBrowserCard.)
			  (P (LOAD? (NC.FindFile (QUOTE NCBROWSERCARD))))
			  (* * Changes to NCBROWSERCARD)
			  (FNS NC.UpdateBrowserCard NC.MakeBrowserCard NC.MakeLinksLegendMenu 
			       NC.RedrawBrowserOverviewWin NC.BrowserOverviewWinReshapeFn)
			  (* * New for NCUTILITIES)
			  (MACROS NC.WithTopWindowsUnattached)
			  (* * Change to NCINTERFACE)
			  (FNS NC.AttachNoteFileName)))
(* * Fixes bug whereby RecomputeBrowser was always making new links even for those that didn't
 change. Also removed needless call to NC.ActivateBrowserCard from NC.MakeBrowserCard.)

(LOAD? (NC.FindFile (QUOTE NCBROWSERCARD)))
(* * Changes to NCBROWSERCARD)

(DEFINEQ

(NC.UpdateBrowserCard
  (LAMBDA (Window)                                           (* rht: "20-Mar-87 10:51")

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



          (* * rht 11/1/86: Added NC.ProtectedCardOperation wrapper and check for ops in progress.)



          (* * pmi 12/5/86: Modified message to NC.SelectNoteCards to mention SHIFT-selection.)



          (* * pmi 12/12/86: Removed obsolete ReturnLinksFlg argument in call to NC.SelectNoteCards.)



          (* * rht 12/16/86: Now checks that NC.MakeLink succeeded before creating a real link icon. If not, then make a 
	  standin for a cross file link icon.)



          (* * rg 3/4/87 rewritten for new version of NC.ProtectedCardOperation, removed DontCheckOpInProgressFlg)



          (* * rg 3/18/87 added NC.CardSelectionOperation wrapper)



          (* * rht 3/19/87: Fixed the part that calls NC.MakeLink so it really only rebuilds links if they've changed.)


    (LET ((Card (NC.CoerceToCard Window)))
         (NC.ProtectedCardOperation
	   Card "Recompute Browser Card" NIL
	   (NC.CardSelectionOperation
	     (PROG (LinkLabels RootCards RootNodes Lattice LinkIcon Graph GraphNodes NodeLabel 
				 BrowserSpecs BrowserFormat DropVirtualNodesFlg Depth 
				 SpecialBrowserSpecs OldLabelNodes OldRootCards)
		     (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 (CONCAT
									  
		      "Please shift-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 eachtime (BLOCK)
			unless (for LatticeNode in Lattice bind (CardForNode
									  ←(NC.CardFromBrowserNodeID
									    (NC.CoerceToGraphNodeID
									      Node)))
				    thereis (NC.SameCardP CardForNode (NC.CardFromBrowserNodeID
								(NC.CoerceToGraphNodeID LatticeNode)
								)))
			do (LET ((NodeLabel (fetch (GRAPHNODE NODELABEL) of Node)))
			          (COND
				    ((NC.LinkIconImageObjP NodeLabel)
				      (NC.DeleteLink (NC.FetchLinkFromLinkIcon NodeLabel)
						       T T))
				    ((STRINGP NodeLabel)   (* 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 eachtime (BLOCK)
			do (LET ((NodeID (fetch (GRAPHNODE NODEID) of Node))
				   (OldNode (for GraphNode in GraphNodes
					       bind (CardForNode ←(NC.CardFromBrowserNodeID
								     (NC.CoerceToGraphNodeID Node)))
					       when (NC.SameCardP CardForNode
								      (NC.CardFromBrowserNodeID
									(NC.CoerceToGraphNodeID
									  GraphNode)))
					       do (RETURN GraphNode))))
			          (if OldNode
				      then (replace (GRAPHNODE NODELABEL) of Node
						with (fetch (GRAPHNODE NODELABEL) of OldNode))
				    else (replace (GRAPHNODE NODELABEL) of Node
					      with (LET ((NewLink (NC.MakeLink
								      Window 
								      NC.BrowserContentsLinkLabel
								      (fetch (GRAPHNODE NODELABEL)
									 of Node)
								      Card NIL)))
						          (if NewLink
							      then (NC.MakeLinkIcon NewLink)
							    else (NC.MakeCrossFileLinkIconStandIn
								     (NCP.CardTitle
								       (fetch (GRAPHNODE NODELABEL)
									  of Node)))))))
                                                             (* Untouch each graph node so that next Recompute will
							     put fresh values on proplist.)
			          (NC.GraphNodeIDRemProp NodeID (QUOTE TouchedFlg))
			          (NC.GraphNodeIDRemProp 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)))))))

(NC.MakeBrowserCard
  (LAMBDA (Card Title NoDisplayFlg ParamList)                (* rht: "20-Mar-87 11:07")

          (* Make a browser card with id Card using root at RootID and the link following predictae specified by Predicate.
	  IF Root and/or ListOfLinkLabels not specified, ask the user.)



          (* * rht 8/3/84: Changed to call NC.AskLinkLabel with its ReverseLinkLabel parameter set to T.)



          (* * fgh 10/2/84 Changed Link Icons to be image objects in NodeLabel of Graph Npodes rather than annotations on 
	  graph nodes.)



          (* * rht 10/19/84: Fixed setting up of browser card's prop list in case NoDisplayFlg is T so we have no Window.
	  Now NC.MakeLinksLegend returns the label pairs.)



          (* * rht 11/27/84: Removed the WINDOWADDPROP call to put NC.GraphCardCloseFn on the CLOSEFN of the window.
	  This causes trouble. NC.QuitCard will get put on by NC.MakeNoteCard and that's enough.)



          (* * rht 1/3/85: Now puts a dummy region of the right size if the NoDisplayFlg is on.)



          (* * rht 1/15/85: Put hooks for AddNode, AddLink, etc. so editing graph edits underlying structure.)



          (* * rht 2/14/85: Added VerticalFlg and made BrowserSpecs get put on browser's proplist in all cases.)



          (* * rht 4/1/85: Now calls NC.AskBrowserSpecs with additional Don'tAskFlg in case of call from Programmer's 
	  interface.)



          (* * rht 11/17/85: Updated to handle new card and notefile objects.)



          (* * rht 2/7/86: Now gets browser format, etc. via fetch/set fns.)



          (* * rht 5/6/86: Took out call to NC.SetupTitleBarMenu.)



          (* * rht 5/8/86: Added calls to rig title bar properly.)



          (* * rht 7/10/86: Now passes ListOfLinkLabels to NC.AskBrowserSpecs.)



          (* * rht 9/19/86: Mod to above fix. Now calls NC.MakeNewCardWindow a new fn that creates window and hangs Card off 
	  windowprop.)



          (* * pmi 12/5/86: Modified message to NC.SelectNoteCards to mention SHIFT-selection. Also added GLOBALVARS 
	  statement.)



          (* * pmi 12/12/86: Removed obsolete ReturnLinksFlg argument in call to NC.SelectNoteCards.)



          (* * rht 12/16/86: Now checks that NC.MakeLink succeeded before creating a real link icon. If not, then make a 
	  standin for a cross file link icon.)



          (* * rg 3/18/87 added NC.CardSelectionOperation wrapper)



          (* * rht 3/20/87: Removed needless call to NC.ActivateCard.)


    (DECLARE (GLOBALVARS NC.SubBoxLinkLabel NC.BrowserContentsLinkLabel NC.SpecialBrowserSpecsFlg 
			     NC.*Graph*BrowserFormat NC.SelectingBrowserSourceMenu))
    (NC.CardSelectionOperation (PROG ((RootCards (MKLIST (LISTGET ParamList (QUOTE ROOTCARDS))
							     ))
					(ListOfLinkLabels (LISTGET ParamList (QUOTE LINKTYPES)))
					(BrowserFormat (LISTGET ParamList (QUOTE FORMAT)))
					(Depth (LISTGET ParamList (QUOTE DEPTH)))
					(CardType (NC.RetrieveType Card))
					Lattice RootNodes Window Graph SpecialBrowserSpecs 
					BrowserSpecs DropVirtualNodesFlg)
				       (COND
					 ((NULL NoDisplayFlg)
					   (SETQ Window (NC.MakeNewCardWindow Card
										  (OR Title 
										       "Untitled")))
					   (WINDOWADDPROP Window (QUOTE SHRINKFN)
							    (FUNCTION NC.GraphCardShrinkFn))))
				       (if (NULL RootCards)
					   then (SETQ RootCards
						    (if NoDisplayFlg
							then (LIST NIL)
						      else (NC.SelectNoteCards NIL NIL 
								    NC.SelectingBrowserSourceMenu 
										   Window 
		      "Please shift-select the Cards and/or Boxes the browser should start from."
										   T))))
				       (COND
					 ((EQ RootCards (QUOTE CANCELLED))
					   (NC.DeactivateCard Card)
					   (CLOSEW Window)
					   (RETURN)))
				       (NC.HoldTTYProcess)
				       (SETQ BrowserSpecs (NC.AskBrowserSpecs
					   Window Card ListOfLinkLabels Depth BrowserFormat T
					   (if (OR ParamList NoDisplayFlg)
					       then (QUOTE DONTASK))))
				       (COND
					 ((NULL BrowserSpecs)
					   (NC.DeactivateCard Card)
					   (CLOSEW Window)
					   (RETURN)))
				       (SETQ ListOfLinkLabels (CAR BrowserSpecs))
				       (SETQ Depth (CADR BrowserSpecs))
				       (SETQ BrowserFormat (CADDR BrowserSpecs))
                                                             (* 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 (COND
					   (NC.SpecialBrowserSpecsFlg (NC.AskSpecialBrowserSpecs
									Window))
					   (T (create SPECIALBROWSERSPECS))))
				       (OR NoDisplayFlg (NC.PrintMsg Window T (CHARACTER 13)
									 
						      "Computing browser graph. Please wait. ..."))
                                                             (* Create new browser hash array)
				       (NC.GetBrowserHashArray Card)
                                                             (* Compute lattice breakdth-first starting from 
							     roots.)
				       (SETQ Lattice (NC.GrowLinkLattice RootCards NIL 
									     ListOfLinkLabels Card 
									     Depth))
				       (SETQ RootNodes (for RootCard in RootCards
							    collect (NC.GetBrowserNodeID Card 
											 RootCard)))
				       (OR NoDisplayFlg (WINDOWPROP Window (QUOTE 
										   NoteCardObject)
									Card))

          (* * Link destination id information stored in NodeLabel field into a LinkIcon for display)


				       (for Node in Lattice bind NodeID eachtime (BLOCK)
					  do
					   (replace (GRAPHNODE NODELABEL) of Node
					      with (LET ((NewLink (NC.MakeLink
								      Window 
								      NC.BrowserContentsLinkLabel
								      (fetch (GRAPHNODE NODELABEL)
									 of Node)
								      Card NIL)))
						          (if NewLink
							      then (NC.MakeLinkIcon NewLink)
							    else (NC.MakeCrossFileLinkIconStandIn
								     (NCP.CardTitle
								       (fetch (GRAPHNODE NODELABEL)
									  of Node))))))
                                                             (* Untouch each graph node so that next Recompute will
							     put fresh values on proplist.)
					   (SETQ NodeID (fetch (GRAPHNODE NODEID) of Node))
					   (NC.GraphNodeIDRemProp (NC.CoerceToGraphNodeID NodeID)
								    (QUOTE TouchedFlg))
					   (NC.GraphNodeIDRemProp (NC.CoerceToGraphNodeID NodeID)
								    (QUOTE VisitedFlg)))
				       (SETQ Graph (if (AND Lattice RootNodes)
							 then (LAYOUTGRAPH Lattice RootNodes
									       (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)))
				       (NC.SetBrowserLinksLegend Card (NC.MakeLinksLegend Graph 
											   Window 
									      DropVirtualNodesFlg))
				       (OR NoDisplayFlg (NC.PrintMsg Window NIL "Done!"))
				       (NC.SetSubstance Card Graph)
				       (NC.SetBrowserLinkLabels Card (OR ListOfLinkLabels
									     (LIST 
									       NC.SubBoxLinkLabel)))
				       (NC.SetBrowserRoots Card RootCards)
				       (NC.SetBrowserFormat Card BrowserFormat)
				       (NC.SetBrowserDepth Card Depth)
				       (NC.SetSpecialBrowserSpecs Card SpecialBrowserSpecs)
				       (COND
					 (NoDisplayFlg (RETURN Card)))
				       (WINDOWPROP Window (QUOTE GRAPH)
						     Graph)
				       (NC.InstallTitleBarLeftMenu Window CardType)
				       (NC.InstallTitleBarMiddleMenu Window CardType)
				       (NC.RelayoutBrowserCard Window)
				       (RETURN Window)))))

(NC.MakeLinksLegendMenu
  (LAMBDA (Win LabelPairs)                                   (* rht: "20-Mar-87 12:37")

          (* * Build a links legend menu and attach to Win)



          (* * rht 1/10/85: Before starting, kill any old links legend menus for Win.)



          (* * rht 1/13/86: Now holds onto value of PASSTOMAINCOMS windowprop of prompt win and restores after reattaching.)



          (* * rht 1/15/86: Added windowprops MINSIZE and MAXSIZE to fix the bug where reshaping browser screws up links 
	  legend menu.)



          (* * rht 3/7/86: Now closes prompt window before attaching menu. Uses ATTACHMENU to attach the menu.)



          (* * rht 4/5/86: Took out call to NC.MoveWindowOntoScreen. For big browsers it causes redraw of window which is too
	  high a price to pay.)



          (* * rht 3/20/87: Changed so that ATTACHMENU call is inside of NC.WithWindowsUnattached macro.
	  Also took out closing of prompt window, as it's no longer necessary.)


    (LET (Menu MenuWin PromptWin MainWinPromptInfo PromptWinPASSTOMAINCOMS)
         (for AttachedWin in (ATTACHEDWINDOWS Win) when (WINDOWPROP AttachedWin
									      (QUOTE 
										  LINKSLEGENDWINP))
	    do (REMOVEWINDOW AttachedWin))
         (SETQ Menu (COND
	     (NC.LinkDashingInBrowser (create MENU
						ITEMS ←(for Pair in LabelPairs
							  join (LIST (CAR Pair)
									 (LIST (QUOTE "  "))))
						TITLE ←(QUOTE Links)
						MENUCOLUMNS ← 2))
	     (T (create MENU
			  ITEMS ←(for Pair in LabelPairs collect (CAR Pair))
			  TITLE ←(QUOTE Links)
			  MENUCOLUMNS ← 1))))                (* Stick the links legend window at upper right 
							     corner.)
         (NC.WithTopWindowsUnattached Win (SETQ MenuWin (ATTACHMENU Menu Win (QUOTE RIGHT)
									(QUOTE TOP))))
                                                             (* Rig so that close of menu won't close browser.)
         (WINDOWDELPROP MenuWin (QUOTE PASSTOMAINCOMS)
			  (QUOTE CLOSEW))
         (WINDOWADDPROP MenuWin (QUOTE CLOSEFN)
			  (FUNCTION (LAMBDA (W)
			      (DETACHWINDOW W)))
			  T)
         (WINDOWADDPROP MenuWin (QUOTE REPAINTFN)
			  (QUOTE NC.LinksLegendRepaintFn))
         (WINDOWADDPROP MenuWin (QUOTE RESHAPEFN)
			  (QUOTE NC.LinksLegendReshapeFn))
         (WINDOWADDPROP MenuWin (QUOTE LINKSLEGENDWINP)
			  T)
         (WINDOWPROP Win (QUOTE NCLABELPAIRS)
		       LabelPairs)
         (if NC.LinkDashingInBrowser
	     then (NC.LinksLegendRepaintFn MenuWin NIL)))))

(NC.RedrawBrowserOverviewWin
  (LAMBDA (OverviewWin BrowserWin)                           (* rht: " 8-May-86 11:29")

          (* * The contents of the browser window have changed. Redraw the overview win.)



          (* * rht 3/20/86: Now compresses to fit overview if necessary.)



          (* * rht 5/8/86: Now smashes SCROLLFN)


    (NC.ShrinkGraphToWindow (WINDOWPROP BrowserWin (QUOTE GRAPH))
			      OverviewWin)
    (if (EQ (WINDOWPROP BrowserWin (QUOTE OVERVIEWWINMODE))
		NC.OverviewWinMode.Compress)
	then (WINDOWPROP OverviewWin (QUOTE RESHAPEFN)
			     NIL)
	       (NC.CompressOverviewWin OverviewWin BrowserWin))
    (WINDOWPROP OverviewWin (QUOTE REPAINTFN)
		  (FUNCTION NC.BrowserOverviewWinRepaintFn))
    (WINDOWPROP OverviewWin (QUOTE RESHAPEFN)
		  (FUNCTION NC.BrowserOverviewWinReshapeFn))
    (WINDOWPROP OverviewWin (QUOTE BUTTONEVENTFN)
		  (FUNCTION NC.BrowserOverviewWinButtonEventFn))
    (WINDOWPROP OverviewWin (QUOTE SCROLLFN)
		  NIL)
    (NC.DrawWireFrameInOverviewWin OverviewWin BrowserWin)))

(NC.BrowserOverviewWinReshapeFn
  (LAMBDA (OverviewWin OldWinBitmap OldWinRegion)            (* rht: "20-Mar-87 14:33")

          (* * When overview win is reshaped, we need to recompute its contents from scratch. We detach and reattach in case 
	  user pulled it away from browser edge.)



          (* * rht 3/20/87: Now instead of deleting SHAPEW from PASSTOMAINCOMS, it replaces whole list.
	  This is because Shrager's WDWHACKS package adds screwy SHAPEW.mumble things to PASSTOMAINCOMS.)


    (LET ((BrowserWin (MAINWINDOW OverviewWin))
	  (WhereAttached (WINDOWPROP OverviewWin (QUOTE WHEREATTACHED))))
         (DETACHWINDOW OverviewWin)
         (ATTACHWINDOW OverviewWin BrowserWin (OR (CAR WhereAttached)
						      (QUOTE LEFT))
			 (OR (CDR WhereAttached)
			       (QUOTE TOP))
			 (QUOTE LOCALCLOSE))
         (WINDOWPROP OverviewWin (QUOTE PASSTOMAINCOMS)
		       (QUOTE (MOVEW SHRINKW BURYW)))
         (WINDOWPROP BrowserWin (QUOTE OverviewWinWidth)
		       (fetch (REGION WIDTH) of (WINDOWREGION OverviewWin)))
         (WINDOWPROP BrowserWin (QUOTE OverviewWinHeight)
		       (fetch (REGION HEIGHT) of (WINDOWREGION OverviewWin)))
         (WINDOWPROP OverviewWin (QUOTE MAXSIZE)
		       (CONS (fetch (REGION WIDTH) of (WINDOWREGION OverviewWin))
			       (fetch (REGION HEIGHT) of (WINDOWREGION OverviewWin))))
         (NC.RedrawBrowserOverviewWin OverviewWin BrowserWin))))
)
(* * New for NCUTILITIES)

(DECLARE: EVAL@COMPILE 
(DEFMACRO NC.WithTopWindowsUnattached (MainWindow &BODY Forms)
	  (* * Run Forms after temporarily detaching windows attached to top of MainWindow. This code 
	     was originally in Frank's NC.AttachNoteFileName function, but found to be more generally 
	     useful.)
	  (BQUOTE (RESETLST (RESETSAVE NIL (BQUOTE (, (FUNCTION (LAMBDA (DescriptionList)
									(* Reattach windows according 
									   to information in a 
									   description list.)
									(for windowDescription in 
									     DescriptionList do
									     (ATTACHWINDOW
									       (CAR windowDescription)
									       , MainWindow
									       (CAADR 
										windowDescription)
									       (CDADR 
										windowDescription))
									     (WINDOWPROP
									       (CAR windowDescription)
									       (QUOTE PASSTOMAINCOMS)
									       (CADDR 
										windowDescription)))))
						      ,
						      (bind WA for window in (ATTACHEDWINDOWS , 
										       MainWindow)
							    when
							    (EQ (QUOTE TOP)
								(CAR (SETQ WA (WINDOWPROP
									     window
									     (QUOTE WHEREATTACHED)))))
							    collect
							    (* Detach attached windows at the top of 
							       the main window and retuirn a list 
							       describing their attachment.)
							    (PROG1 (LIST window WA
									 (WINDOWPROP window
										     (QUOTE 
										   PASSTOMAINCOMS)))
								   (DETACHWINDOW window))))))
			    ,@ Forms)))
)
(* * Change to NCINTERFACE)

(DEFINEQ

(NC.AttachNoteFileName
  (LAMBDA (CardWindow OffFlg)                                (* rht: "20-Mar-87 12:38")

          (* * Attach an indicator of the NoteFile for this Card to the Card)



          (* * fgh 5/29/86 Changed collection of old attached windows to prevent NILs in collection result.)



          (* * fgh 6/13/86 Put detachment and reattachment of previous attached windows into a RESETLST.
	  Added FREEATTACHEDWINDOW as the CLOSEFN of the indicator window. Added code to reset PASSTOMAINWINDOW COMS of the 
	  previously attachwed windows. Changed MINSIZE of indicator window to allow small fonts. Added a REPAINTFN to the 
	  indicator window.)



          (* * fgh 7/2/86 Replaced the CLEARW call in the indicator window REPAINTFN with a DSPRESET for two reasons: reset 
	  the X coor befre printining and CLEARW is not allowed in REPAINTFNS.)



          (* * fgh&rht 7/5/86: Changed the name "FileName" to "NameToPrint".)



          (* * rht 3/20/87: Moved Frank's hack that temporarily detaches windows into a macro called 
	  NC.WithWindowsUnattached.)


    (LET ((Card (NC.CardFromWindow CardWindow))
	  AttachedWindows FileName Window)
         (if (NC.CardP Card)
	     then (SETQ AttachedWindows (ATTACHEDWINDOWS CardWindow))
		    (if OffFlg
			then (CLOSEW (for window in AttachedWindows
					    thereis (WINDOWPROP window (QUOTE NoteFileIndicator)
								    )))
			       (REPOSITIONATTACHEDWINDOWS CardWindow)
		      else (TOTOPW CardWindow)
			     (if (SETQ Window (for window in AttachedWindows
						     thereis (WINDOWPROP window (QUOTE 
										NoteFileIndicator))))
				 then 

          (* * There already is an indicator window, open and redisplay it.)


					(OR (OPENWP Window)
					      (OPENW Window))
					(REDISPLAYW Window)
			       else 

          (* * No existing indicator window, make one.)


				      (NC.WithTopWindowsUnattached
					CardWindow

          (* * Make the indicator window.)


					(LET (NoteFile NameToPrint YSize IndicatorWindow)
					     (SETQ NoteFile (fetch (Card NoteFile) of Card))
					     (SETQ NameToPrint (NC.MakeNoteFileNameIndicator
						 NoteFile))
					     (SETQ YSize (HEIGHTIFWINDOW
						 (OR (FONTPROP NC.NoteFileIndicatorFont
								   (QUOTE HEIGHT))
						       20)))
					     (SETQ IndicatorWindow
					       (CREATEW (CREATEREGION 0 0 100 YSize)
							  NIL T))
					     (WINDOWPROP IndicatorWindow (QUOTE MAXSIZE)
							   (CONS 1000 YSize))
					     (WINDOWPROP IndicatorWindow (QUOTE MINSIZE)
							   (CONS 20 YSize))
					     (ATTACHWINDOW IndicatorWindow CardWindow (QUOTE
							       TOP)
							     (QUOTE JUSTIFY)
							     (QUOTE LOCALCLOSE))
					     (WINDOWPROP IndicatorWindow (QUOTE BUTTONEVENTFN)
							   (FUNCTION (LAMBDA (window)
							       (INVERTW window)
							       (NC.SetUpNoteFileInterface
								 (fetch (Card NoteFile)
								    of (NC.CardFromWindow
									   (MAINWINDOW window))))
							       (INVERTW window))))
					     (WINDOWPROP IndicatorWindow (QUOTE NameToPrint)
							   NameToPrint)
					     (WINDOWADDPROP IndicatorWindow (QUOTE CLOSEFN)
							      (FUNCTION FREEATTACHEDWINDOW)
							      T)
					     (WINDOWPROP IndicatorWindow (QUOTE REPAINTFN)
							   (FUNCTION (LAMBDA (Window Region)
							       (DSPRESET Window)
							       (PRIN1 (WINDOWPROP Window
										      (QUOTE 
										      NameToPrint))
									Window))))
					     (DSPFONT NC.NoteFileIndicatorFont IndicatorWindow)
					     (PRIN1 NameToPrint IndicatorWindow)
					     (OPENW IndicatorWindow)
					     (WINDOWPROP IndicatorWindow (QUOTE NoteFileIndicator)
							   (QUOTE Showing))))))))))
)
(PUTPROPS RHTPATCH220 COPYRIGHT ("Xerox Corporation" 1987))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (1388 26999 (NC.UpdateBrowserCard 1398 . 12933) (NC.MakeBrowserCard 12935 . 21538) (
NC.MakeLinksLegendMenu 21540 . 24271) (NC.RedrawBrowserOverviewWin 24273 . 25422) (
NC.BrowserOverviewWinReshapeFn 25424 . 26997)) (28560 32629 (NC.AttachNoteFileName 28570 . 32627)))))
STOP