(FILECREATED "11-Sep-87 21:47:35" {QV}<NOTECARDS>1.3KNEXT>PMIPATCH064.;1 6517   

      changes to:  (VARS PMIPATCH064COMS)
		   (FNS NC.RelabelLink))


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

(PRETTYCOMPRINT PMIPATCH064COMS)

(RPAQQ PMIPATCH064COMS ((* * pmi 9/11/87: Fixes bug 692 - can no longer change link label when 
			     notefile is open read-only.)
			  (* * Changed in NCLINKS)
			  (FNS NC.RelabelLink)))
(* * pmi 9/11/87: Fixes bug 692 - can no longer change link label when notefile is open 
read-only.)

(* * Changed in NCLINKS)

(DEFINEQ

(NC.RelabelLink
  (LAMBDA (LinkOrLinkIcon Window NewLinkLabel ForceRedisplayFlg)
                                                             (* pmi: "11-Sep-87 21:39" pp pp)
                                                             (* Relabel a NoteCard link.
							     Ask user for new label. Update all the proper 
							     references to this link.)

          (* * rht 11/19/84: Fixed so that Card is defined before first use.)



          (* * kirk 14Nov85: deleted use of and LinkID)



          (* * kef 8/8/86: Added obtaining write lock and NC.PutFromLinks.)



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



          (* * rht 9/29/86: Changed Ken's call to NC.CardBeingEditedP to NC.ActiveCardP and other minor mod's.)



          (* * rg 5/15/87 now calls NC.LinksCachedP instead of NC.ActiveCardP)



          (* * rht 5/27/87: Now passes new label through cross file link if its dest notefile is open.)



          (* * pmi 9/11/87: Fixes bug 692 -
	  can no longer change link label when notefile is open read-only.)


    (LET (Link LinkIcon Card DestinationCard OldLabel NoteCardType GlobalLinkFlg)
         (if (NC.LinkIconImageObjP LinkOrLinkIcon)
	     then (SETQ Link (NC.FetchLinkFromLinkIcon LinkOrLinkIcon))
		    (SETQ LinkIcon LinkOrLinkIcon)
	   else (SETQ Link LinkOrLinkIcon)
		  (OR (SETQ GlobalLinkFlg (NC.GlobalLinkP Link))
			(SETQ LinkIcon (NC.FetchLinkIconForLink Link))))
         (SETQ Card (fetch (Link SourceCard) of Link))
         (if (NC.CheckForNotReadOnly Card Window "Can't change link type of links in ")
	     then (COND
		      ((WINDOWP Window))
		      ((NC.ActiveCardP Card)
			(SETQ Window (NC.FetchWindow Card))))
		    (SETQ DestinationCard (fetch (Link DestinationCard) of Link))
		    (NC.IfCardPartNotBusy DestinationCard (QUOTE FROMLINKS)
					  (COND
					    ((NC.SystemLinkLabelP (fetch (Link Label)
								       of Link))
					      (NC.PrintMsg Window T 
							   "This is a system maintained pointer."
							     (CHARACTER 13)
							     "You cannot change its label."
							     (CHARACTER 13))
					      (SPAWN.MOUSE)
					      (DISMISS 1500)
					      (NC.ClearMsg Window T))
					    ((SETQ NewLinkLabel
						(OR NewLinkLabel (NC.AskLinkLabel Window NIL NIL 
										      T T)))
					      (SETQ NoteCardType (NC.RetrieveType Card))

          (* * Put new label in Link Icon or global links list)


					      (if GlobalLinkFlg
						  then (for GlobalLink in (NC.FetchGlobalLinks
										  Card)
							    when (NC.SameLinkP GlobalLink Link)
							    do (replace (Link Label)
								    of GlobalLink with 
										     NewLinkLabel)
								 (NC.SetLinksDirtyFlg Card T)
								 (RETURN))
						else (replace (Link Label) of (
									 NC.FetchLinkFromLinkIcon
										      LinkIcon)
							  with NewLinkLabel)
						       (NC.MarkCardDirty Card))

          (* * Update ToLink list of the SourceCard card)


					      (for ToLink in (NC.FetchToLinks Card)
						 when (NC.SameLinkP ToLink Link)
						 do (replace (Link Label) of ToLink
							 with NewLinkLabel)
						      (NC.SetLinksDirtyFlg Card T)
						      (RETURN))

          (* * Update FromLink list of DestinationCard card)


					      (if (NC.LinksCachedP DestinationCard)
						  then (for FromLink in (NC.FetchFromLinks
										DestinationCard)
							    when (NC.SameLinkP FromLink Link)
							    do (replace (Link Label)
								    of FromLink with NewLinkLabel)
								 (NC.SetLinksDirtyFlg 
										  DestinationCard T)
								 (RETURN))
						else (WITH.MONITOR (NC.FetchMonitor
								       (fetch (Card NoteFile)
									  of DestinationCard))
								     (NC.GetLinks DestinationCard)
								     (for FromLink
									in (NC.FetchFromLinks
									       DestinationCard)
									when (NC.SameLinkP 
											 FromLink 
											     Link)
									do (replace (Link Label)
										of FromLink
										with NewLinkLabel)
									     (NC.SetLinksDirtyFlg
									       DestinationCard T)
									     (RETURN))
								     (NC.PutFromLinks 
										  DestinationCard)
								     (NC.UncacheLinks 
										  DestinationCard)))

          (* * Pass change through cross-file link to other notefile if open.)


					      (if (NC.CrossFileLinkCardP Card)
						  then (LET ((RemoteCrossFileLinkCard (
								  NC.FetchRemoteCrossFileLinkCard
											  Card)))
							      (AND RemoteCrossFileLinkCard
								     (NC.CheckCrossFileLinkType
								       RemoteCrossFileLinkCard Card 
								       Link))))
					      (if (NC.CrossFileLinkCardP DestinationCard)
						  then (LET ((RemoteCrossFileLinkCard (
								  NC.FetchRemoteCrossFileLinkCard
											  
										  DestinationCard)))
							      (AND RemoteCrossFileLinkCard
								     (NC.CheckCrossFileLinkType
								       RemoteCrossFileLinkCard 
								       DestinationCard Link))))

          (* * Update images in SourceCard window)


					      (COND
						((AND (NULL ForceRedisplayFlg)
							(NC.TEditBasedP NoteCardType))
						  (QUOTE CHANGED))
						((WINDOWP Window)
						  (NC.UpdateLinkImages Window (fetch
									   (Link DestinationCard)
										   of Link))
						  NIL)
						(T NIL)))))))))
)
(PUTPROPS PMIPATCH064 COPYRIGHT ("Xerox Corporation" 1987))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (593 6435 (NC.RelabelLink 603 . 6433)))))
STOP