(FILECREATED " 9-Dec-86 10:10:21" {QV}<NOTECARDS>1.3K>NEXT>PMIPATCH009.;5 73734  

      changes to:  (VARS PMIPATCH009COMS)
		   (FNS NC.DeleteSource NC.DetermineFileBoxes NC.BrowserAddNode NC.MakeBrowserCard 
			NC.SelectNoteCards)

      previous date: " 4-Dec-86 17:10:57" {QV}<NOTECARDS>1.3K>NEXT>PMIPATCH009.;1)


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

(PRETTYCOMPRINT PMIPATCH009COMS)

(RPAQQ PMIPATCH009COMS ((* * Fixes bug #205: Select cards prompt should indicate need for SHIFT. 
			     Changed all msg arguments in calls to NC.SelectNoteCards to also prompt 
			     for Shift-selection.)
			  (* * Changes to NCINTERFACE)
			  (FNS NC.SelectNoteCards NC.CloseNoteCards)
			  (* * Changes to NCLINKS)
			  (FNS NC.AddGlobalLinksToCard NC.AddLinksToCard NC.InsertLinksInText 
			       NC.MakeFilingLinks NC.MakeLink)
			  (* * Changes to NCCARDS)
			  (FNS NC.AddParents NC.DeleteNoteCards NC.DeleteSource NC.DetermineFileBoxes 
			       NC.DetermineSources NC.UnfileNoteCard)
			  (* * Changes to NCBROWSERCARD)
			  (FILES (FROM NOTECARDS)
				 NCBROWSERCARD)
			  (FNS NC.BrowserAddNode NC.MakeBrowserCard NC.UpdateBrowserCard)
			  (* * Change to NCFILEBOXCARD)
			  (FNS NC.FileBoxCollectChildren)
			  (* * Change to NCDOCUMENTCARD)
			  (FILES (FROM NOTECARDS)
				 NCDOCUMENTCARD)
			  (FNS NC.MakeDocument)))
(* * Fixes bug #205: Select cards prompt should indicate need for SHIFT. Changed all msg 
arguments in calls to NC.SelectNoteCards to also prompt for Shift-selection.)

(* * Changes to NCINTERFACE)

(DEFINEQ

(NC.SelectNoteCards
  (LAMBDA (SingleCardFlg SelectionPredicate Menu InstigatingCardOrWindow ReturnLinksFlg Msg 
			 CheckForCancelFlg)                  (* pmi: " 5-Dec-86 09:45")

          (* Select a set of note cards or a single note card, depending on SingleCardFlg. Works by interpreting all mouse 
	  presses until a card has been chosen (if SingleCardFlg is T) or until the Done button has been pressed 
	  (if SingleCardFlg is NIL). If the mouse press occus within a Title bar of a notecard, add that note card to the 
	  selected list. Otherwise, if you are pointing into a note card, call the BUTTONEVENTFN for that note card.
	  The Selection in Progress flag has been set, so all note card BUTTONEVENTFNs should know to ignore all presses 
	  except those that occur on link icons. Link icon presses should simply add the desination of that link to the 
	  selected note cards list.)



          (* * rht 8/1/84: Changed second RESETSAVE call to give NC.ClearMsg a NIL argument.)



          (* * rht 1/9/85: Fixed so now prints name of selected item even it's a link.)



          (* * rht 2/15/85: Now can backspace over last selection chosen. Added new arg Msg so that when we reprint the list,
	  we can reprint the message as well.)



          (* * rht 3/23/85: Added the CheckForCancelFlg arg, which if non-nil causes Cancel to be handled differently then 
	  Done after no selections. Namely, Cancel will return the atom CANCELLED whereas Done with no selections returns 
	  NIL. If CheckForCancelFlg is NIL then NIL is returned in both cases.)



          (* * fgh 11/14/85 Updated to handle Card and NoteFile objects.)



          (* * rht 11/18/85: Fixed so able to select when InstigatingNoteFile is NIL.)



          (* * fgh 12/20/85 Totally rewritten for 1.3 selection mechanism. Based on COPYINSERT now rather than on takingf 
	  over the mouse process.)



          (* * fgh 1/15/86 Added call to SPAWN.MOUSE in case this is called under the mouse process)



          (* * kirk 25Apr86 Changed to use SessionIcon (NC.NoteCardsIconWindow) rather than PROMPTWINDOW if no Instigating 
	  window is supplied.)



          (* * fgh 7/5/86 Added code to put CRs into printout of selected cards in order to keep prompt window from getting 
	  infinitely wide to accomdate the printout.)



          (* * rht 10/5/86: Now allows choice of cards from remote notefile.)



          (* * rht 10/18/86: Give TTY process to process that originally had it if possible.)



          (* * rht & pmi 11/14/86: Now checks for valid card before testing SelectionPredicate.)



          (* * pmi 12/5/86 Modified prompt messages to mention SHIFT-selection.)


    (RESETLST (LET (Window Card ButtonEventFn InstigatingWindow InstigatingCard InstigatingNoteFile 
			     MenuWindow PromptWindow CopyInsertEvent SelectedCards 
			     PromptWindowProcess OldTTYProcess)
		     (OR SelectionPredicate (SETQ SelectionPredicate (FUNCTION TRUE)))
		     (COND
		       ((NC.CardP InstigatingCardOrWindow)
			 (SETQ InstigatingWindow (NC.FetchWindow InstigatingCardOrWindow))
			 (SETQ PromptWindow (NC.AttachPromptWindow InstigatingWindow)))
		       ((WINDOWP InstigatingCardOrWindow)
			 (SETQ InstigatingWindow InstigatingCardOrWindow)
			 (SETQ PromptWindow (NC.AttachPromptWindow InstigatingWindow)))
		       (T (SETQ InstigatingWindow (SETQ PromptWindow (NC.AttachPromptWindow
				NC.NoteCardsIconWindow)))))
		     (SETQ InstigatingCard (NC.CoerceToCard InstigatingCardOrWindow))
		     (SETQ InstigatingNoteFile (AND InstigatingCard (fetch (Card NoteFile)
									   of InstigatingCard)))
		     (NC.PrintMsg InstigatingWindow T (COND
				      (Msg (CONCAT Msg (CHARACTER 13)))
				      (T ""))
				    "Items shift-selected:  ")
		     (SETQ OldTTYProcess (TTY.PROCESS))

          (* * if we are running under the mouse process, start up a new mouse process)


		     (AND (EQ (QUOTE MOUSE)
				  (PROCESSPROP (THIS.PROCESS)
						 (QUOTE NAME)))
			    (SPAWN.MOUSE))

          (* * Set up the prompt window for proper use by the CopyInsertFn)


		     (WINDOWPROP PromptWindow (QUOTE COPYINSERTFN)
				   (FUNCTION NC.SelectNoteCardsCopyInsertFn))
		     (WINDOWPROP PromptWindow (QUOTE CopyInsertEvent)
				   (SETQ CopyInsertEvent (CREATE.EVENT (QUOTE CopyInsertEvent)))
				   )
		     (RESETSAVE (WINDOWPROP PromptWindow (QUOTE SelectedCards)
						NIL)
				  (BQUOTE (WINDOWPROP , PromptWindow (QUOTE SelectedCards)
							  NIL)))
		     (RESETSAVE (WINDOWPROP PromptWindow (QUOTE SelectingCards)
						T)
				  (BQUOTE (WINDOWPROP , PromptWindow SelectingCards NIL)))

          (* * Make the process behind the prompt window includiong control for a blibnking cursor)


		     (WINDOWPROP PromptWindow (QUOTE PROCESS)
				   (SETQ PromptWindowProcess
				     (ADD.PROCESS (QUOTE (PROG NIL (BLOCK)
								     (TTYDISPLAYSTREAM
								       (PROCESSPROP (THIS.PROCESS)
										      (QUOTE WINDOW)
										      ))
								     XXXX
								     (BIN)
								     (BLOCK)
								     (GO XXXX)))
						    (QUOTE WINDOW)
						    PromptWindow
						    (QUOTE NAME)
						    (QUOTE SelectNoteCardsProc)
						    (QUOTE TTYENTRYFN)
						    (FUNCTION (LAMBDA (Process)
							(PROCESSPROP Process (QUOTE OldCaret)
								       (CARET CROSSHAIRS))
							(ECHOMODE)))
						    (QUOTE TTYEXITFN)
						    (FUNCTION (LAMBDA (Process)
							(CARET (PROCESSPROP Process (QUOTE
										  OldCaret)))
							(ECHOMODE T))))))
		     (RESETSAVE NIL (BQUOTE (DEL.PROCESS , PromptWindowProcess)))

          (* * Insure the prompt window is cleared on the way out)


		     (RESETSAVE NIL (BQUOTE (PROGN (AND (HASTTYWINDOWP , 
									      PromptWindowProcess)
								(TTY.PROCESS
								  (if (AND (PROCESSP , 
										    OldTTYProcess)
									       (HASTTYWINDOWP
										 , OldTTYProcess))
								      then , OldTTYProcess
								    else T)))
							 (NC.ClearMsg , InstigatingWindow T))))

          (* * Set up the menu above the prompt window)

                                                             (* fix in case MENUPOSITION is set incorrectly in menu
							     passed down)
		     (replace (MENU MENUPOSITION) of Menu
			with (CONSTANT (create POSITION
						     XCOORD ← 0
						     YCOORD ← 0)))
		     (RESETSAVE (ATTACHMENU Menu PromptWindow (if InstigatingWindow
								      then (QUOTE TOP)
								    else (QUOTE BOTTOM))
						(QUOTE LEFT))
				  (BQUOTE (PROGN (DETACHWINDOW (WFROMMENU , Menu))
						     (DELETEMENU , Menu T))))

          (* * If there is an instigating window, make sure it and all its attachments are visible on the screen.)


		     (if InstigatingWindow
			 then (NC.MoveWindowOntoScreen InstigatingWindow))

          (* * Give the prompt window the tty process)


		     (TTY.PROCESS (WINDOWPROP PromptWindow (QUOTE PROCESS)))

          (* * Loop as long as necessary)


		     (until (OR (EQ SelectedCards (QUOTE CANCELLED))
				    (AND SingleCardFlg SelectedCards)
				    (EQ (CAR SelectedCards)
					  (QUOTE DONE)))
			do (

          (* * Wait for the user to respond by copy inserting something into the prompt window)


			      (until (EQ CopyInsertEvent (AWAIT.EVENT CopyInsertEvent))
				 do NIL)

          (* * Get the latest selection list)


			      (SETQ SelectedCards (WINDOWPROP PromptWindow (QUOTE SelectedCards)
								  ))
			      (RESETLST 

          (* * Turn off the caret)


					  (RESETSAVE (TTY.PROCESS (THIS.PROCESS)))

          (* * If the last thing wasn't a done or cancel, process the new selection)


					  (COND
					    ((AND (NEQ (CAR SelectedCards)
							   (QUOTE DONE))
						    (NEQ SelectedCards (QUOTE CANCELLED))
						    (NEQ (CAR SelectedCards)
							   (QUOTE *New% Card*)))

          (* * Check to make sure that the selection is valid)


					      (COND
						((EQ (CAR SelectedCards)
						       (QUOTE *Undo% Selection*))
                                                             (* Chop off two elements from the list -
							     the indicator and the previous item.)
						  (WINDOWPROP PromptWindow (QUOTE SelectedCards)
								(SETQ SelectedCards (CDDR 
										    SelectedCards)))
						  (NC.ClearMsg InstigatingWindow NIL))
						((OR (NOT (NC.ValidCardP (CAR SelectedCards)))
						       (NULL (APPLY* SelectionPredicate
									 (CAR SelectedCards))))
                                                             (* Does this card match the slection predicate)
						  (NC.PrintMsg InstigatingWindow T 
								 "*** Invalid selection. ***"
								 (CHARACTER 13))
						  (WINDOWPROP PromptWindow (QUOTE SelectedCards)
								(SETQ SelectedCards (CDR 
										    SelectedCards))))
						(T           (* A valid selection.)
						   (NC.ClearMsg InstigatingWindow NIL)))

          (* * Print the results in the prompt window)


					      (NC.PrintMsg InstigatingWindow NIL
							     (COND
							       (Msg (CONCAT Msg (CHARACTER 13)))
							       (T ""))
							     "Items selected:  ")
					      (for Card in (REVERSE SelectedCards)
						 do
						  (NC.PrintMsg InstigatingWindow NIL (
								   NC.RetrieveTitle Card)
								 ",  ")
						  (if (AND InstigatingWindow
							       (GREATERP
								 (DSPXPOSITION NIL PromptWindow)
								 (TIMES 1.25 (WINDOWPROP
									    InstigatingWindow
									    (QUOTE WIDTH)))))
						      then (NC.PrintMsg InstigatingWindow NIL
									    (CHARACTER 13)))))))))

          (* * Return the result)


		     (PROG1 (COND
				((EQ SelectedCards (QUOTE CANCELLED))
				  (COND
				    (CheckForCancelFlg (QUOTE CANCELLED))
				    (T NIL)))
				(SingleCardFlg (if (EQ (CAR SelectedCards)
							   (QUOTE DONE))
						   then NIL
						 else (CAR SelectedCards)))
				(T (if (EQ (CAR SelectedCards)
					       (QUOTE DONE))
				       then (DREVERSE (CDR SelectedCards))
				     else (DREVERSE SelectedCards))))
			      (WINDOWPROP PromptWindow (QUOTE SelectedCards)
					    NIL))))))

(NC.CloseNoteCards
  (LAMBDA (CardIdOrCardList NoCheckFlg DontClearFlg InterestedWindow)
                                                             (* pmi: " 5-Dec-86 10:01")

          (* * Close note acrds on the screen)



          (* * fgh 11/14/85 Updated to handle Card object.)



          (* * kirk 21Feb86 Added InterestedWindow)



          (* * fgh 6/27/86 Fixed call to NC.SelectNoteCards to use just InterestedWindow)



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


    (LET (Cards Window)
         (SETQ Cards (COND
	     ((LISTP CardIdOrCardList))
	     (CardIdOrCardList (NC.CoerceToCard CardIdOrCardList))
	     (T (NC.SelectNoteCards NIL NIL NC.DeleteSelectingMenu InterestedWindow NIL 
				      "Please shift-select the cards to be closed."))))
         (SPAWN.MOUSE)
         (for Card in (MKLIST Cards) do (COND
						  ((AND (NC.ActiveCardP Card)
							  (SETQ Window (NC.FetchWindow Card)))
						    (COND
						      ((NEQ (NC.QuitCard Card T)
							      (QUOTE DON'T))
							(while (OPENWP Window) do (BLOCK))))))
		))))
)
(* * Changes to NCLINKS)

(DEFINEQ

(NC.AddGlobalLinksToCard
  (LAMBDA (CardIdentifier SingleLinkFlg)                     (* pmi: " 5-Dec-86 09:57")

          (* * Called from card's menu to add some global links.)



          (* * rht 11/24/85: Fixed bugs. It was calling NC.CoerceToID.)



          (* * fgh 6/9/86 Added chack for other interaction operations already in progress.)



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


    (LET (Window SourceCard DestinationCards Label OperationInProgress)
         (SETQ SourceCard (NC.CoerceToCard CardIdentifier))
         (SETQ Window (NC.FetchWindow SourceCard))
         (if (SETQ OperationInProgress (NC.OperationInProgress SourceCard))
	     then 

          (* * Another interaction operation is in progress on this card and we have to interact with the user.
	  Can't do.)


		    (NC.PrintOperationInProgressMsg Window "Add Global Link(s)" OperationInProgress)
	   else (NC.ProtectedCardOperation SourceCard Add% Global% Link%(s%)
					     (SETQ Label (NC.AskLinkLabel Window NIL NIL T T))
					     (AND Label
						    (if SingleLinkFlg
							then (NC.MakeGlobalLink Window Label NIL 
										    SourceCard)
							       (NC.ClearMsg Window T)
						      else
						       (SETQ DestinationCards
							 (NC.SelectNoteCards
							   NIL
							   (FUNCTION (LAMBDA (Card)
							       (COND
								 ((NEQ Card SourceCard)
								   T)
								 (T (NC.PrintMsg Window T 
							    "A Card/Box cannot point to itself. "
										   (CHARACTER
										     13)
										   
									     "Selection ignored."
										   (CHARACTER
										     13))
								    NIL))))
							   NC.SelectingMultipleCardsMenu SourceCard 
							   NIL 
				       "Please shift-select the Cards or Boxes to be pointed to."))
						       (NC.ClearMsg Window T)
						       (for DestinationCard in DestinationCards
							  do (NC.MakeGlobalLink Window Label 
										  DestinationCard 
										    SourceCard))))))))
)

(NC.AddLinksToCard
  (LAMBDA (CardIdentifier LinkLabel DestinationCards)        (* pmi: " 5-Dec-86 10:34")

          (* * Adds multiple links to card designated by CardIdentifier. Rest of args can be NIL.)



          (* * fgh 6/9/86 Added Checks to make sure other interaction operation not in porgress.)



          (* * rht 9/23/86: Fixed bug in function passed to NC.SelectNoteCards.)



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


    (LET ((SourceCard (NC.CoerceToCard CardIdentifier))
	  CardType Window OperationInProgress)
         (SETQ Window (NC.FetchWindow SourceCard))
         (if (AND (NULL LinkLabel)
		      (NULL DestinationCards)
		      (SETQ OperationInProgress (NC.OperationInProgress SourceCard)))
	     then 

          (* * Another interaction operation is in progress on this card and we have to interact with the user.
	  Can't do.)


		    (NC.PrintOperationInProgressMsg Window "Insert Links" OperationInProgress)
	   else (NC.ProtectedCardOperation SourceCard InsertLinks (SETQ CardType (NC.FetchType
						 SourceCard))
					     (OR LinkLabel (SETQ LinkLabel
						     (NC.AskLinkLabel Window NIL NIL T T)))
					     (if LinkLabel
						 then
						  (OR DestinationCards
							(SETQ DestinationCards
							  (NC.SelectNoteCards
							    NIL
							    (FUNCTION (LAMBDA (SelectedCard)
								(COND
								  ((NOT (NC.SameCardP 
										     SelectedCard 
										       SourceCard))
								    T)
								  (T (NC.PrintMsg (NC.FetchWindow
										      SourceCard)
										    T 
							    "A Card/Box cannot point to itself. "
										    (CHARACTER
										      13)
										    
									     "Selection ignored."
										    (CHARACTER
										      13))
								     NIL))))
							    NC.SelectingMultipleCardsMenu SourceCard 
							    NIL 
				       "Please shift-select the Cards or Boxes to be pointed to.")))
						  (NC.ClearMsg Window T)
						  (for DestinationCard in DestinationCards
						     do (NC.AddLinkToCard CardIdentifier 
									      LinkLabel 
									      DestinationCard))))))))

(NC.InsertLinksInText
  (LAMBDA (TextStream LinkLabel)                             (* pmi: " 5-Dec-86 10:13")

          (* * Add several links to the text all with the same link label.)



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


    (PROG (Window SourceCard DestinationCards)
	    (SETQ SourceCard (NC.CoerceToCard (SETQ Window (WINDOW.FROM.TEDIT.THING 
										       TextStream))))
	    (SETQ DestinationCards (NC.SelectNoteCards NIL (FUNCTION (LAMBDA (Card)
							       (COND
								 ((NOT (NC.SameCardP Card 
										       SourceCard))
								   T)
								 (T (NC.PrintMsg (NC.FetchWindow
										     SourceCard)
										   T 
							    "A Card/Box cannot point to itself. "
										   (CHARACTER
										     13)
										   
									     "Selection ignored."
										   (CHARACTER
										     13))
								    NIL))))
							   NC.SelectingMultipleCardsMenu SourceCard 
							   NIL 
				       "Please shift-select the Cards or Boxes to be pointed to."))
	    (NC.ClearMsg Window T)
	    (for DestinationCard in DestinationCards do (NC.InsertLinkInText TextStream 
										     LinkLabel 
										  DestinationCard 
										     SourceCard NIL)))
    ))

(NC.MakeFilingLinks
  (LAMBDA (Card Msg)                                         (* pmi: " 5-Dec-86 10:18")
                                                             (* Hooks card specified by Card to all of the current 
							     contents cards by a Contents link)

          (* * rht 8/1/84: Changed the NC.PrintMsg2 call for "No FileBox has been specified." to use NIL as second arg rather
	  than T. This prevents erasure of previous error messages.)



          (* * rht 12/8/84: Massive rewrite. Now calls NC.MakeChildLink. And always orphanizes if no parent specified.
	  This is because it's currently called only by NC.InsureProperFiling.)



          (* * rht 6/25/85: Now returns NewParents and checks if CANCELLED comes back from NC.SelectNoteCards so can abort 
	  the calling operation.)



          (* * Fgh 11/15/85 Adapted from and intended to replace NC.MakeContentsHooks)



          (* * fgh 8/6/86 Updated to use NC.AttachPromptWindow and added Msg arg)



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


    (PROG (OneHook (Window (NC.FetchWindow Card))
		     NewParents)
	    (SETQ NewParents (NC.SelectNoteCards NIL (FUNCTION NC.FileBoxP)
						     NC.SelectingContentsMenu Card NIL
						     (CONCAT (OR Msg "")
							       
					    "Please shift-select the Boxes to file this card in."
							       (CHARACTER 13)
							       
				       "'Done' with no selections files it in the ToBeFiled box.")
						     T))
	    (COND
	      ((NOT (OR (EQ NewParents (QUOTE CANCELLED))
			    (AND NewParents (for ParentCard in NewParents bind OneHook
						 when (NC.MakeChildLink Card ParentCard Window)
						 do (SETQ OneHook T) finally (RETURN OneHook))
				   )))
		(NC.PrintMsg Window NIL "No FileBox has been specified." (CHARACTER 13)
			       "This card will be filed in the ToBeFiled Box."
			       (CHARACTER 13))
		(NC.HookToOrphanCard Card (fetch (NoteFile ToBeFiledCard)
					       of (fetch (Card NoteFile) of Card)))
		(COND
		  ((NC.AttachPromptWindow Window NIL NIL NIL T)
		    (SPAWN.MOUSE)
		    (DISMISS 2000)
		    (NC.ClearMsg Window T)))))
	    (RETURN NewParents))))

(NC.MakeLink
  (LAMBDA (Window LinkLabel DestinationCard SourceCard DisplayMode AnchorMode Message NoDisplayFlg 
		  LinkToInsertAfter CrossFileLinksMode)      (* pmi: " 5-Dec-86 10:20")

          (* * Make a link from (OR Window SourceCard) to DestinationCard with linklabel of LinkLabel)



          (* * rht 1/12/85: If need to create a new card, then now shows card type menu near window of SourceID.)



          (* * rht 1/13/85: Added extra args Message and NoDisplayFlg.)



          (* * rht 3/26/85: Added LinkToInsertAfter arg which should be NIL or a link to insert the new To link after.
	  If NIL, then insert at front of ToLinks.)



          (* * kirk 9/23/85: took out GETPROMPTWINDOW call for asknotecardtype)



          (* * kirk: 14Nov85: changed NC.CoerceToID to to NC.CoerceToCard)



          (* * fgh 11/16/85 Changed from PROG to LET and used COND to contyrol returnmed value.)



          (* * fgh 2/5/86 Changed call DefaultLinkDisplayMode to FetchLinkDisplayMode)



          (* * fgh 6/5/86 Now calls AskLinkLabel if LinkLabel arg is NIL)



          (* * rht 7/4/86: Added check for readonly card.)



          (* * kef 7/17/86: Added calls to grab the write permission on the appropriate card parts.)



          (* * kef 7/22/86: Saves the links on the Destination Card now right away, while still holding onto the FROMLINKS 
	  write lock.)



          (* * fgh 8/30/86 Adpated to use NC.IfCardPartNotBusy.)



          (* * rht 9/29/86: Tossed Ken's call to NC.PutFromLinks; It was the cause of too many nasty breaks.
	  Also made syntactic fixes.)



          (* * rht 10/4/86: Now handles cross file links. New arg CrossFileLinksMode determines whether cross-file link will 
	  be two-way, i.e. will destination card know it's being linked to.)



          (* * rht 11/10/86: Now creates new crossfile link if Destination card is a CrossFileLink card that we didn't just 
	  create.)



          (* * rht 11/14/86: Now checks if non-nil DestinationCard before trying to do cross-filelink stuff.)



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


    (DECLARE (GLOBALVARS NC.SelectingSingleCardMenu NC.NewCrossFileLinksTwoWayFlg))
    (OR SourceCard (SETQ SourceCard (NC.CoerceToCard Window)))
    (AND (NC.CheckForNotReadOnly SourceCard Window "Can't make links in ")
	   (LET (Link Type)
	        (OR Window (SETQ Window (NC.FetchWindow SourceCard)))
	        (OR Message (SETQ Message "Please shift-select the Card or Box to be linked to."))
	        (OR LinkLabel (SETQ LinkLabel (NC.AskLinkLabel Window NIL NIL T NIL)))
	        (OR DestinationCard (SETQ DestinationCard
			(NC.SelectNoteCards T (FUNCTION (LAMBDA (Card)
						  (COND
						    ((NOT (NC.SameCardP Card SourceCard))
						      T)
						    (T (NC.PrintMsg Window T 
							     "A Card/Box cannot link to itself. "
								      (CHARACTER 13)
								      "Selection ignored."
								      (CHARACTER 13))
						       NIL))))
					      NC.SelectingSingleCardMenu SourceCard NIL Message)))
	        (if (EQ DestinationCard (QUOTE *New% Card*))
		    then (SETQ DestinationCard (AND (SETQ Type (NC.AskNoteCardType
							      (WINDOWREGION Window)))
							  (NC.CoerceToCard
							    (NC.MakeNoteCard Type
									       (fetch (Card 
											 NoteFile)
										  of SourceCard)
									       NIL NoDisplayFlg)))))

          (* * If we're trying to link to a CrossFileLink card, then check whether card was just created.
	  If so, then it's the first link, otherwise we make a new CrossFileLink.)


	        (if DestinationCard
		    then (AND (NC.CrossFileLinkCardP DestinationCard)
				  (if (NC.FetchUserDataProp DestinationCard (QUOTE 
										   JustCreatedFlg))
				      then (NC.SetUserDataProp DestinationCard (QUOTE 
										   JustCreatedFlg)
								   NIL)
				    else (SETQ DestinationCard (NC.GetCrossFileLinkDestCard
					       DestinationCard)))))
	        (if DestinationCard
		    then (NC.IfCardPartNotBusy
			     DestinationCard
			     (QUOTE FROMLINKS)
			     (NC.IfCardPartNotBusy SourceCard (QUOTE TOLINKS)

          (* * If have cross-file link, then make two new crossfilelink cards, one per notefile. Make global link over there 
	  from crossfilelink card to DestinationCard and local link here from SourceCard to crossfilelink card.)


						   (if (NOT (NC.SameNoteFileP
								  (fetch (Card NoteFile)
								     of SourceCard)
								  (fetch (Card NoteFile)
								     of DestinationCard)))
						       then
							(LET ((CrossFileLinksTwoWayFlg
								(OR (EQ CrossFileLinksMode
									    (QUOTE TWOWAY))
								      (AND (NULL 
									       CrossFileLinksMode)
									     
								    NC.NewCrossFileLinksTwoWayFlg))))
							     (if CrossFileLinksTwoWayFlg
								 then (NC.MakeGlobalLink
									  Window LinkLabel 
									  DestinationCard
									  (
								       NC.CreateCrossFileLinkCard
									    DestinationCard 
									    SourceCard T)
									  DisplayMode))
							     (SETQ DestinationCard
							       (NC.CreateCrossFileLinkCard 
										       SourceCard 
										  DestinationCard 
									  CrossFileLinksTwoWayFlg))))
						   (SETQ Link (create Link
									  UID ←(NC.MakeUID)
									  SourceCard ← SourceCard
									  DestinationCard ← 
									  DestinationCard
									  AnchorMode ← AnchorMode
									  Label ← LinkLabel
									  DisplayMode ←(OR
									    DisplayMode
									    (NC.FetchLinkDisplayMode
									      SourceCard))))
						   (NC.AddToLink Link LinkToInsertAfter)
						   (NC.AddFromLink Link)
						   Link))
		  else NIL)))))
)
(* * Changes to NCCARDS)

(DEFINEQ

(NC.AddParents
  (LAMBDA (WindowOrTextStream)                               (* pmi: " 5-Dec-86 09:59")

          (* Add a subtopic link from a contents card specified by the user to the contents card specified by 
	  WindowOrTextStream. But first check to make sure that this would not introduce any circularities in the contents 
	  lattice.)



          (* * rht 12/8/84: Massive shaving. Now calls NC.MakeChildLink to do the tough work.)



          (* * rht 10/3/85: No longer prints final, annoying, slow-to-disappear message in prompt window if nothing 
	  selected.)



          (* * fgh 11/13/85 Updated to handle Card object.)



          (* * fgh 6/9/86 Added code to check to make sure that another operation is not in progress on this card when this 
	  fn is called.)



          (* * rht 7/5/86: Now checks for readonly cards.)



          (* * rht&pmi 11/24/86: Surrounded call to NC.MakeChildLink with NC.ActivateCardAndDo so that ParentCard will be 
	  active for duration of the call.)



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


    (LET (Card NewParents (Window (WINDOW.FROM.TEDIT.THING WindowOrTextStream))
	       OperationInProgress)
         (SETQ Card (NC.CoerceToCard Window))
         (if (NC.CheckForNotReadOnly Card Window "Can't do filing in ")
	     then (if (SETQ OperationInProgress (NC.OperationInProgress Card))
			then 

          (* * Another interaction operation is in progress on this card and we have to interact with the user.
	  Can't do.)


			       (NC.PrintOperationInProgressMsg Window "Designate FileBoxes" 
								 OperationInProgress)
		      else (NC.ProtectedCardOperation Card Designate% FileBoxes
							(SETQ NewParents
							  (NC.SelectNoteCards
							    NIL
							    (FUNCTION NC.FileBoxP)
							    NC.SelectingParentsMenu Card NIL 
					       " Please shift-select the new parent FileBox(es)."))
							(AND NewParents Card
							       (for ParentCard in NewParents
								  bind OneHook
								  when (NC.ActivateCardAndDo
									   ParentCard
									   (NC.MakeChildLink Card 
										       ParentCard 
											   Window))
								  do (SETQ OneHook T)
								  finally (RETURN OneHook)))))))))

(NC.DeleteNoteCards
  (LAMBDA (CardIdentifiers NoIndividualConfirmFlg DontClearFlg InterestedWindow QuietFlg 
			   NoGroupConfirmFlg Don'tPutToBeDeletedCardsFlg)
                                                             (* pmi: " 5-Dec-86 10:05")
                                                             (* Delete note cards. If no card specified then get a 
							     list of note cards to be deleted.
							     Then delete these cards.)

          (* * fgh 11/11/85: Updated to handle new Card objects. Also split off main work of deleteing a single note card 
	  into NC.DeleteNoteCard function.)



          (* * kirk 21Feb86 Added InterestedWindow)



          (* * kirk 29Apr86 Now returns CardIdentifiers)



          (* * fgh 6/9/86 Added checks to see if other operations are in progress)



          (* * rht 7/4/86: Now checks that card is not read-only.)



          (* * kirk 18Aug86 Added main window for windowless cards.)



          (* * rht 8/29/86: Reorganized and added call to NC.SeverAllLinks to make deleting more efficient.
	  Added QuietFlg, NoGroupConfirmFlg and Don'tPutToBeDeletedCardsFlg args.)



          (* * rht 9/5/86: Now forces NoGroupConfirmFlg to be non-nil if NoIndividualConfirmFlg is NIL and only one card to 
	  delete.)



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


    (OR CardIdentifiers (SETQ CardIdentifiers (NC.SelectNoteCards NIL NIL 
									NC.DeleteSelectingMenu 
									InterestedWindow NIL 
					      "Please shift-select the Note Cards to be deleted.")))

          (* * Kludge in case args are nil, say, when we're called from a card's menu.)


    (if (AND (NULL NoIndividualConfirmFlg)
		 (NULL NoGroupConfirmFlg)
		 (EQ (LENGTH (MKLIST CardIdentifiers))
		       1))
	then (SETQ NoGroupConfirmFlg T)
	       (SETQ QuietFlg T))

          (* * First collect cards that are deletable.)


    (LET ((CardsToDelete (for CardIdentifier in (MKLIST CardIdentifiers) bind Card
			    eachtime (BLOCK)
			    when (AND (SETQ Card (NC.CoerceToCard CardIdentifier))
					  (if (NOT (NC.TopLevelCardP Card))
					    else (NC.PrintMsg (NC.FetchWindow Card)
								  T "You cannot delete this FileBox."
								  (CHARACTER 13))
						   (DISMISS 1000)
						   (NC.ClearMsg (NC.FetchWindow Card)
								  T)
						   NIL)
					  (NC.CheckForNotReadOnly Card (NC.FetchWindow Card)
								    "Can't delete cards from a ")
					  (OR NoIndividualConfirmFlg
						(PROG1 (NC.AskYesOrNo 
							  "Are you sure you want to delete this?"
									  " -- " "Yes" (NULL 
										     DontClearFlg)
									  (OR (NC.FetchWindow
										  Card)
										InterestedWindow)
									  NIL NIL)
							 (NC.ClearMsg))))
			    collect Card))
	  (NumSpecified (LENGTH (MKLIST CardIdentifiers)))
	  NumToDelete)
         (SETQ NumToDelete (LENGTH CardsToDelete))
         (if (AND (GREATERP NumToDelete 0)
		      (if (EQUAL NumToDelete NumSpecified)
			  then (OR NoGroupConfirmFlg (PROG1 (NC.AskYesOrNo
								    (CONCAT "You've specified " 
									      NumToDelete 
									      " cards to delete."
									      (CHARACTER 13)
									      
							 "Are you sure you want to delete them? ")
								    NIL "Yes" (NULL DontClearFlg)
								    InterestedWindow)
								  (NC.ClearMsg)))
			else (PROG1 (NC.AskYesOrNo (CONCAT "Out of " NumSpecified 
								   " cards specified, "
								   (DIFFERENCE NumSpecified 
										 NumToDelete)
								   " are not deletable."
								   (CHARACTER 13)
								   "Want to delete the remaining " 
								   NumToDelete " cards? ")
							 NIL "Yes" (NULL DontClearFlg)
							 InterestedWindow)
					(NC.ClearMsg))))
	     then 

          (* * Mark UIDs of cards about to be deleted.)


		    (for Card in CardsToDelete do (NC.UIDPutProp (fetch (Card UID)
									    of Card)
									 (QUOTE AboutToBeDeletedFlg)
									 T))

          (* * Sever all links into and out of CardsToDelete)


		    (NC.SeverAllLinks CardsToDelete QuietFlg InterestedWindow 
					Don'tPutToBeDeletedCardsFlg)

          (* * Now delete the cards one at a time.)


		    (OR QuietFlg (NC.PrintMsg InterestedWindow T "Deleting cards: 1 out of " 
						  NumToDelete " ..."))
		    (for Card in CardsToDelete as i from 1 eachtime (BLOCK)
		       do (LET ((OperationInProgress (NC.OperationInProgress Card)))
			         (OR QuietFlg (if (ZEROP (REMAINDER i 10))
						    then (NC.PrintMsg InterestedWindow T 
									  "Deleting cards: "
									  i " out of " NumToDelete 
									  " ...")))
			         (if OperationInProgress
				     then (NC.PrintOperationInProgressMsg (NC.FetchWindow
										Card)
									      "Delete Card(s)" 
									      OperationInProgress)
				   else (NC.ProtectedCardOperation Card Delete% Card%(s%)
								     (NC.DeleteNoteCard Card)))))
		    (OR QuietFlg (NC.ClearMsg InterestedWindow T))
		    CardIdentifiers))))

(NC.DeleteSource
  (LAMBDA (WindowOrTextStream)                               (* pmi: " 5-Dec-86 11:26")
                                                             (* Called from title bar menus.
							     Deletes source/s/ for the card specified by 
							     WindowOrTextStream)

          (* * fgh 11/12/85: Updated to handle Card objects.)



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


    (DECLARE (GLOBALVARS NC.DeleteSelectingMenu NC.SourceLinkLabel))
    (LET ((Window (WINDOW.FROM.TEDIT.THING WindowOrTextStream))
	  Card Sources EditWindow)
         (SETQ Card (NC.CoerceToCard Window))
         (SETQ Sources (for Link in (NC.FetchGlobalLinks Card)
			    when (EQUAL NC.SourceLinkLabel (fetch (Link Label) of Link))
			    collect Link))
         (COND
	   ((NULL Sources)
	     (NC.PrintMsg Window T "This card has no sources." (CHARACTER 13))
	     (SPAWN.MOUSE)
	     (DISMISS 2000)
	     (NC.ClearMsg Window T))
	   (T (SETQ EditWindow (NC.OpenPropListEditor Window (LIST (QUOTE Source% TO)
									 Sources)
							  "Sources" T T))
	      (until (WINDOWPROP EditWindow (QUOTE TEXTOBJ)) do (BLOCK))
	      (SETQ Sources (NC.SelectNoteCards NIL NIL NC.DeleteSelectingMenu Card NIL 
						    "Shift-select source(s) to be deleted."))
	      (NC.ClearMsg Window T)
	      (NC.ClosePropListEditor EditWindow (QUOTE NoSave))
	      (for ToBeDeletedLink in (NC.FetchGlobalLinks Card)
		 when (AND (EQ NC.SourceLinkLabel (fetch (Link Label) of ToBeDeletedLink))
			       (for SourceCard in Sources thereis (NC.SameCardP
									  (fetch (Link 
										  DestinationCard)
									     of ToBeDeletedLink)
									  SourceCard)))
		 do (NC.DelToLink ToBeDeletedLink)
		      (NC.DelFromLink ToBeDeletedLink)
		      (NC.SetGlobalLinks Card (for Link in (NC.FetchGlobalLinks Card)
						   when (for SourceCard in Sources
							     never (NC.SameCardP
								       (fetch (Link DestinationCard)
									  of ToBeDeletedLink)
								       SourceCard))
						   collect Link))))))))

(NC.DetermineFileBoxes
  (LAMBDA (Card OptionalFilingFlg)                           (* pmi: " 5-Dec-86 11:25")

          (* Returns a list of contents cards for filing a card. The rule used for the choice is: First ask the user.
	  If the user returns NIL, then use the Orphan Note Card)



          (* * rht 8/1/84: Changed so that user can't file a card twice in the same box.)



          (* * fgh 11/13/85 Updated to handle Card object. Got rid of DatabaseStream.)



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


    (DECLARE (GLOBALVARS NC.FiledCardLinkLabel))
    (LET (NewParents (ParentCards (for Link in (NC.FetchFromLinks Card)
				     when (EQ (fetch (Link Label) of Link)
						  NC.FiledCardLinkLabel)
				     collect (fetch (Link SourceCard) of Link)))
		     (Window (NC.FetchWindow Card)))
         (COND
	   ((PROGN (SETQ NewParents (NC.SelectNoteCards NIL NIL (COND
								(ParentCards NC.SelectingParentsMenu)
								(T NC.SelectingContentsMenu))
							      Card NIL
							      (CONCAT 
					    "Please shift-select the Boxes to file this card in."
									(COND
									  (ParentCards "")
									  (T (CONCAT (CHARACTER
											 13)
										       
							   "NoBox files it in the ToBeFiled box.")))))
		       )
		     (for NewParentCard in NewParents unless (AND (FMEMB NewParentCard 
										   ParentCards)
									  (NC.PrintMsg
									    Window T (
									      NC.RetrieveTitle
									      Card)
									    " already filed in "
									    (NC.RetrieveTitle
									      NewParentCard)
									    (CHARACTER 13)))
			collect NewParentCard)))
	   ((AND (NOT OptionalFilingFlg)
		   (NOT ParentCards))
	     (NC.PrintMsg Window T "No Box has been specified." (CHARACTER 13)
			    "Filing this card in the ToBeFiled Box."
			    (CHARACTER 13))
	     (LIST (NC.ToBeFiledBox (fetch (Card NoteFile) of Card))))))))

(NC.DetermineSources
  (LAMBDA (Card NoSourceOptionFlg)                           (* pmi: " 5-Dec-86 10:10")
                                                             (* Returns a list of source cards according to the 
							     following rule: Ask the user.)

          (* * fgh 11/11/85: Updated to handle Card and NoteFile objects.)



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


    (LET (Selections (Window (NC.FetchWindow Card)))
         (NC.PrintMsg Window NIL "Shift-select source(s) for this card." (CHARACTER 13)
			"NoSource" " to indicate no source." (CHARACTER 13))
         (SETQ Selections (NC.SelectNoteCards NIL NIL NC.SelectingSourcesMenu Card NIL
						  (CONCAT "Shift-select source(s) for this card."
							    (CHARACTER 13)
							    " NoSource to indicate no source.")))
         (NC.ClearMsg Window)
     Selections)))

(NC.UnfileNoteCard
  (LAMBDA (WindowOrTextStream)                               (* pmi: " 5-Dec-86 10:21")
                                                             (* Take a notecard out of a file box.
							     Called fom title bar menu.)

          (* * fgh 11/12/85 Updated to handle Card objects.)



          (* * fgh 6/9/86 Added code to check to make sure that another operation is not in progress on this card when this 
	  fn is called.)



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


    (LET (Links Card Window EditWindow FileBoxes OperationInProgress)
         (SETQ Window (WINDOW.FROM.TEDIT.THING WindowOrTextStream))
         (SETQ Card (NC.CoerceToCard Window))
         (if (SETQ OperationInProgress (NC.OperationInProgress Card))
	     then 

          (* * Another interaction operation is in progress on this card and we have to interact with the user.
	  Can't do.)


		    (NC.PrintOperationInProgressMsg Window "Unfile" OperationInProgress)
	   else (NC.ProtectedCardOperation Card Unfile (SETQ Links
					       (bind SourceCard for Link in (NC.FetchFromLinks
										    Card)
						  when (EQ (fetch (Link Label) of Link)
							       NC.FiledCardLinkLabel)
						  collect (create Link
							       copying Link DisplayMode ←(create
									   LINKDISPLAYMODE
											      
											  copying
											       (
											    fetch
												 (Link
												   
										      DisplayMode)
												  of
												   
											     Link)
											       
										     SHOWTITLEFLG ←(
											    QUOTE
												 
											   SOURCE)))))
					     (SETQ EditWindow (NC.OpenPropListEditor
						 WindowOrTextStream
						 (LIST (QUOTE FileBoxes)
							 Links)
						 "List of File Boxes" T T))
					     (BLOCK)
					     (SETQ FileBoxes
					       (NC.SelectNoteCards
						 NIL
						 (FUNCTION (LAMBDA (LinkOrCard)
						     (COND
						       ((LISTP LinkOrCard)
							 (NC.FileBoxP (fetch (Link SourceCard)
									   of LinkOrCard)))
						       (T (NC.FileBoxP LinkOrCard)))))
						 NC.SelectingParentsMenu Card T 
			  "Please shift-select the file box(es) from which to remove this card. "))
					     (NC.ClosePropListEditor EditWindow (QUOTE NoSave))
					     (DISMISS)
					     (NC.ClearMsg Window T)
					     (for Box in FileBoxes
						do (NC.DelReferencesToCard
						       (COND
							 ((type? Link Box)
							   (fetch (Link SourceCard) of Box))
							 (T Box))
						       Card))
					     (for Link in Links
						when (OR (for Card in FileBoxes
								thereis (NC.SameCardP
									    (fetch (Link SourceCard)
									       of Link)
									    Card))
							     (for OtherLink in FileBoxes
								thereis (NC.SameLinkP Link 
											OtherLink)))
						do (NC.DelToLink Link)
						     (NC.DelFromLink Link)))))))
)
(* * Changes to NCBROWSERCARD)

(FILESLOAD (FROM NOTECARDS)
	   NCBROWSERCARD)
(DEFINEQ

(NC.BrowserAddNode
  (LAMBDA (Graph Window)                                     (* pmi: " 5-Dec-86 11:24")

          (* * Called by grapher when user creates a new node. Returns new node or nil.)



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



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


    (DECLARE (GLOBALVARS NC.BrowserContentsLinkLabel))
    (PROG ((GraphCard (NC.CoerceToCard Window))
	     Link GraphNodeID Card)                          (* Get user to select an existing card.
							     Not allowed to create a new one.)
	    (SETQ Card (NC.SelectNoteCards T (FUNCTION (LAMBDA (SelectedCard)
						   (COND
						     ((NOT (NC.SameCardP SelectedCard GraphCard))
						       T)
						     (T (NC.PrintMsg Window T 
							      "The browser can't link to itself."
								       (CHARACTER 13)
								       "Selection ignored."
								       (CHARACTER 13))
							NIL))))
					       NC.SelectingCardMenu GraphCard NIL 
					      "Shift-select a card or box to include in browser."))
	    (if (NULL Card)
		then (RETURN NIL))                       (* Make link from browser to new card.)
	    (SETQ Link (NC.MakeLink Window NC.BrowserContentsLinkLabel Card GraphCard NIL NIL NIL 
					T))                  (* Check that it doesn't already exist.
							     If not, create a browser node.)
	    (COND
	      (Link                                          (* Create hash array if haven't already.)
		    (NC.GetBrowserHashArray GraphCard Graph)
		    (SETQ GraphNodeID (NC.GetBrowserNodeID GraphCard (SETQ Card
								 (fetch (Link DestinationCard)
								    of Link))))
		    (COND
		      ((for Node in (fetch (GRAPH GRAPHNODES) of Graph)
			  thereis (EQ GraphNodeID (NC.CoerceToGraphNodeID Node)))
			(NC.PrintMsg Window T "Node for card '" (NC.RetrieveTitle Card)
				       "' already in graph.")
			(NCP.DeleteLinks Link)
			(RETURN NIL)))
		    (NC.MarkCardDirty GraphCard)
		    (RETURN (NODECREATE GraphNodeID (NC.MakeLinkIcon Link)
					    (CURSORPOSITION NIL Window))))))))

(NC.MakeBrowserCard
  (LAMBDA (Card Title NoDisplayFlg ParamList)                (* pmi: " 5-Dec-86 11:23")

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


    (DECLARE (GLOBALVARS NC.SubBoxLinkLabel NC.BrowserContentsLinkLabel NC.SpecialBrowserSpecsFlg 
			     NC.*Graph*BrowserFormat))
    (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)
	    (NC.ActivateCard Card)
	    (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 NIL 
		      "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 (NC.MakeLinkIcon (NC.MakeLink Window NC.BrowserContentsLinkLabel
								(fetch (GRAPHNODE NODELABEL)
								   of Node)
								Card NIL)))
                                                             (* 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.InstallGraphTitleBarMiddleMenu Window CardType)
	    (NC.RelayoutBrowserCard Window)
	    (RETURN Window))))

(NC.UpdateBrowserCard
  (LAMBDA (Window DontCheckOpInProgressFlg)                  (* pmi: " 5-Dec-86 10:23")

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


    (LET ((Card (NC.CoerceToCard Window))
	  OperationInProgress)

          (* * if in the middle of some other operation, get out of here.)


         (if (AND (NULL DontCheckOpInProgressFlg)
		      (SETQ OperationInProgress (NC.OperationInProgress Card)))
	     then (NC.PrintOperationInProgressMsg Window (QUOTE Recompute% Browser% Card)
						      OperationInProgress)
		    NIL
	   else (NC.ProtectedCardOperation
		    Card Recompute% Browser% Card
		    (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 NIL
									       (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 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.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 T)))))))
)
(* * Change to NCFILEBOXCARD)

(DEFINEQ

(NC.FileBoxCollectChildren
  (LAMBDA (WindowOrTextStream Card NewChildren NoDisplayFlg)
                                                             (* pmi: " 5-Dec-86 10:12")

          (* * Ask user for new children (either cards or fileboxes) for this filebox. Check to make sure that no 
	  circularities are introduced. This code is sort of the inverse of the NC.AddParents code and thus looks quite 
	  similar.)



          (* * rht 10/29/84: Added NoDisplayFlg to prevent error message when no appropriate elements exist.
	  Also now returns ID if at least one child was added, NIL otherwise.)



          (* * fgh 11/13/85 Updated to handle Card object.)



          (* * rht 7/5/86: Now checks for readonly cards.)



          (* * rht 8/11/86: Added code to check to make sure that another operation is not in progress on this card when this
	  fn is called.)



          (* * rht 10/17/86: Made successful filing operations NOT do dismiss.)



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


    (OR Card (SETQ Card (NC.CoerceToCard WindowOrTextStream)))
    (LET ((Window (NC.FetchWindow Card))
	  OperationInProgress)
         (if (NC.CheckForNotReadOnly Card Window "Can't do filing in ")
	     then (if (SETQ OperationInProgress (NC.OperationInProgress Card))
			then 

          (* * Another interaction operation is in progress on this card and we have to interact with the user.
	  Can't do.)


			       (NC.PrintOperationInProgressMsg Window "Put Cards Here" 
								 OperationInProgress)
		      else (NC.ProtectedCardOperation Card Put% Cards% Here
							(OR NewChildren
							      (SETQ NewChildren
								(NC.SelectNoteCards NIL NIL 
								  NC.SelectingFileBoxChildrenMenu 
										      Card NIL 
							     " Please shift-select new children.")))
							(COND
							  ((AND NewChildren Card
								  (for NewChild in NewChildren
								     bind OneHook
								     when (NC.MakeChildLink
									      NewChild Card Window)
								     do (SETQ OneHook T)
								     finally (RETURN OneHook)))
							    Card)
							  ((NULL NoDisplayFlg)
							    (NC.PrintMsg Window NIL 
						  "No appropriate NoteCards or FileBoxes chosen."
									   (CHARACTER 13)
									   "Hence no children added."
									   (CHARACTER 13))
							    (DISMISS 1000)
							    (NC.ClearMsg Window T)
							    NIL)
							  (T NIL))))))))
)
(* * Change to NCDOCUMENTCARD)

(FILESLOAD (FROM NOTECARDS)
	   NCDOCUMENTCARD)
(DEFINEQ

(NC.MakeDocument
  (LAMBDA (Card Title NoDisplayFlg CardIdentifier)           (* pmi: " 5-Dec-86 10:17")

          (* * Called from a filebox's title bar. Makes a document by smashing all the descendant cards's text together.
	  Ask user if wants numbered section headings and titles. The former are made from FileBox titles, the latter from 
	  notecard titles. Delete embedded links at the end if the user desires.)



          (* * rht 10/22/84: Hacked to be callable from Programmer's interface.)



          (* * rht 11/17/84: Checks for cancel when choosing rootID and also when setting parameters.)



          (* * rht 8/25/85: Now dumps sketch and graph cards as well as text cards.)



          (* * rht 9/16/85: Now handles cr's around titles using para leading.)



          (* * fgh 11/178/85 Updated to handle Card and NoteFile objects.)



          (* * kirk 27Jun86 Moved NC.RetrieveTitle call so does not break when user Cancels)



          (* * rht 7/31/86: Now checks for card types having ExportSubstanceFn prop.)



          (* * kirk 8/22/86 Fix of free use of NoteFile var)



          (* * rht 10/15/86: Integrated markM's changes and fixed box numbering.)



          (* * rht 11/17/86: Now calls NC.ApplySupersFn rather than NC.MakeNoteCard.)



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


    (PROG (RootCard RootTitle DocWindow DocCard DocWindowOrCard DocStream HeadingsFromFileboxes 
		      TitlesFromNoteCards BuildBackLinks CopyEmbeddedLinks ExpandEmbeddedLinks 
		      InspectWin RootSubstanceType)
	    (OR NoDisplayFlg (SPAWN.MOUSE))
	    (SETQ DocWindowOrCard (NC.ApplySupersFn MakeFn Card "Document" NoDisplayFlg))
	    (if NoDisplayFlg
		then (SETQ DocWindow NIL)
		       (SETQ DocCard DocWindowOrCard)
	      else (SETQ DocWindow DocWindowOrCard)
		     (SETQ DocCard (NC.CoerceToCard DocWindow)))
                                                             (* NC.MakeNoteCard either returned an Card or a window
							     depending on NoDisplayFlg.)
	    (SETQ RootCard (OR (NC.CoerceToCard CardIdentifier)
				   (NC.SelectNoteCards T NIL NC.SelectingCardMenu DocWindow NIL 
		  "Please shift-select the Note Card or File Box the document should start from.")))
	    (if (NOT RootCard)
		then (NC.DeleteNoteCards Card T NIL NIL T T)
		       (RETURN NIL))
	    (SETQ RootTitle (NC.RetrieveTitle RootCard))
	    (NC.SetTitle DocCard (CONCAT "Document from %"" RootTitle "%""))
	    (AND DocWindow (WINDOWPROP DocWindow (QUOTE TITLE)
					   (NC.RetrieveTitle DocCard)))
	    (SETQ DocStream (NC.FetchSubstance DocCard))

          (* * Get MakeDocument parameters from user via inspector window.)


	    (if (NOT NoDisplayFlg)
		then (SETQ InspectWin (NC.BuildMakeDocInspector DocWindow))
		       (TOTOPW InspectWin)
		       (for while (OPENWP InspectWin) do (BLOCK)))
	    (if (EQ (GETPROP (QUOTE NC.MakeDocParameters)
				   (QUOTE --DONE--))
			(QUOTE QUIT))
		then (PUTPROP (QUOTE NC.MakeDocParameters)
				  (QUOTE --DONE--)
				  (QUOTE --CANCEL--))
		       (NC.DeleteNoteCards Card T NIL NIL T T)
		       (RETURN NIL))
	    (SETQ HeadingsFromFileboxes (GETPROP (QUOTE NC.MakeDocParameters)
						     (QUOTE HeadingsFromFileboxes)))
	    (SETQ TitlesFromNoteCards (GETPROP (QUOTE NC.MakeDocParameters)
						   (QUOTE TitlesFromNoteCards)))
	    (SETQ BuildBackLinks (GETPROP (QUOTE NC.MakeDocParameters)
					      (QUOTE BuildBackLinks)))
	    (SETQ CopyEmbeddedLinks (GETPROP (QUOTE NC.MakeDocParameters)
						 (QUOTE CopyEmbeddedLinks)))
	    (SETQ ExpandEmbeddedLinks (GETPROP (QUOTE NC.MakeDocParameters)
						   (QUOTE ExpandEmbeddedLinks)))

          (* * Call recursive routine to dump filebox.)


	    (RESETLST (RESETSAVE (CURSOR WAITINGCURSOR))
			(NC.PrintMsg DocWindow NIL "Collecting text from descendant cards ... ")

          (* * Clean up the SeenBefore markers placed on the cards and boxes just copied.)


			(RESETSAVE NIL (QUOTE (PROGN (for Card in (NC.FetchUserDataProp
									      DocCard
									      (QUOTE SeenCards))
							      do (NC.SetUserDataProp
								     Card
								     (QUOTE SeenBefore)
								     NIL))
							   (NC.SetUserDataProp DocCard
										 (QUOTE SeenCards)
										 NIL))))

          (* * Unbelievably kludgy hack to get around Intermezzo TEdit bug. Just insert and delete a CR.)


			(TEDIT.INSERT DocStream NC.CRString 1)
			(TEDIT.DELETE DocStream 1 1)
			(NC.DumpCardToDoc RootCard DocCard DocStream 0 0 HeadingsFromFileboxes 
					  TitlesFromNoteCards BuildBackLinks CopyEmbeddedLinks 
					  ExpandEmbeddedLinks)
			(NC.PrintMsg DocWindow NIL "Done!"))
	    (COND
	      ((NOT NoDisplayFlg)
		(BLOCK 250)
		(NC.ClearMsg DocWindow T)))
	    (RETURN DocWindowOrCard))))
)
(PUTPROPS PMIPATCH009 COPYRIGHT ("Xerox Corporation" 1986))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (1579 13885 (NC.SelectNoteCards 1589 . 12652) (NC.CloseNoteCards 12654 . 13883)) (13917 
28243 (NC.AddGlobalLinksToCard 13927 . 16086) (NC.AddLinksToCard 16088 . 18393) (NC.InsertLinksInText 
18395 . 19744) (NC.MakeFilingLinks 19746 . 22125) (NC.MakeLink 22127 . 28241)) (28275 44892 (
NC.AddParents 28285 . 30697) (NC.DeleteNoteCards 30699 . 36124) (NC.DeleteSource 36126 . 38536) (
NC.DetermineFileBoxes 38538 . 40705) (NC.DetermineSources 40707 . 41672) (NC.UnfileNoteCard 41674 . 
44890)) (44977 65637 (NC.BrowserAddNode 44987 . 47340) (NC.MakeBrowserCard 47342 . 54633) (
NC.UpdateBrowserCard 54635 . 65635)) (65674 68306 (NC.FileBoxCollectChildren 65684 . 68304)) (68392 
73652 (NC.MakeDocument 68402 . 73650)))))
STOP