(FILECREATED " 4-Jun-86 18:57:06" {QV}<NOTECARDS>1.3K>FGHPATCH052.;1 3092   

      changes to:  (VARS FGHPATCH052COMS)
		   (FNS NC.LinkIconWhenDeletedFn))


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

(PRETTYCOMPRINT FGHPATCH052COMS)

(RPAQQ FGHPATCH052COMS ((* * Fixes to bugs %#38/67 Unnecessary orphan delete filing after UNDO)
			  (FNS NC.LinkIconWhenDeletedFn)))
(* * Fixes to bugs %#38/67 Unnecessary orphan delete filing after UNDO)

(DEFINEQ

(NC.LinkIconWhenDeletedFn
  (LAMBDA (ImageObject Stream)                               (* fgh: " 4-Jun-86 18:52")

          (* * When deleting a link icon image object from a card, make sure the link information on the source and 
	  destinmation cards get updated. When deleting a link image object from a prop list editor, just inform the user 
	  that this is a useless operation.)



          (* * rht 11/19/84: Now handles the case when a move is in progress. True if the old link is cached on the ImageObj.
	  Also changed so that SourceID is computed from ImageObject rather than from Stream. Similarly for the window.)



          (* * kirk 14Nov85: deleted use of PSA.Database)



          (* * fgh 5/2/86 Added code to handle deleting of links from ShowLinks editors.)



          (* * fgh 6/4/86 Added KLUDGE to take care of case when this is called under TEDIT.UNDO.MOVE)


    (LET (Link SourceCard DestinationCard LinkType Window OldLink StkPtr)
         (SETQ Link (NC.FetchLinkFromLinkIcon ImageObject))
         (COND
	   ((SETQ OldLink (IMAGEOBJPROP ImageObject (QUOTE LinkBeingMoved)))
	     (NC.DelFromLink OldLink)
	     (NC.DelToLink OldLink)
	     (replace (Link UID) of OldLink with -1)
	     (IMAGEOBJPROP ImageObject (QUOTE LinkBeingMoved)
			     NIL))
	   ((SETQ StkPtr (STKPOS (QUOTE TEDIT.UNDO.MOVE)))

          (* * Called from TEDIT.UNDO.MOVE, don't relly want to delete the links. KLUDGE because TEDIT will not call the 
	  LinkIconInsertFn later on.)


	     (RELSTK StkPtr)
	     NIL)
	   (T 

          (* * if this is reversed source/dest {i.e., a From link} inside the show links editor, then return it to its 
	  original direction)


	      (if (AND (IMAGEOBJPROP ImageObject (QUOTE InsidePropListEditor))
			   (LISTGET (fetch (Link UserData) of Link)
				      (QUOTE Reversed)))
		  then (SETQ Link (create Link using Link SourceCard ←(fetch (Link 
										  DestinationCard)
										 of Link)
							     DestinationCard ←(fetch (Link 
										       SourceCard)
										 of Link))))

          (* * Then just delete the link)


	      (SETQ DestinationCard (fetch (Link DestinationCard) of Link))
	      (NC.CheckForOrphanDelete SourceCard DestinationCard)
	      (NC.DeleteLink Link)
	      (replace (Link UID) of Link with -1))))))
)
(PUTPROPS FGHPATCH052 COPYRIGHT ("Xerox Corporation" 1986))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (482 3010 (NC.LinkIconWhenDeletedFn 492 . 3008)))))
STOP