(FILECREATED "14-Jul-86 17:43:19" {QV}<NOTECARDS>1.3K>FGHPATCH093.;2)


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

(PRETTYCOMPRINT FGHPATCH093COMS)

(RPAQQ FGHPATCH093COMS ((* * Fix tp big %# 108 FileBox delete link icon leaves DeletedLinkIcon)
			  (FNS NC.LinkIconWhenDeletedFn)))
(* * Fix tp big %# 108 FileBox delete link icon leaves DeletedLinkIcon)

(DEFINEQ

(NC.LinkIconWhenDeletedFn
  (LAMBDA (ImageObject Stream)                               (* fgh: "14-Jul-86 17:38")

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



          (* * rht 7/4/86: Now checks for readonly cards. Also passes checks for deleting from orphan card when calling 
	  NC.DeleteLink.)



          (* * fgh 7/14/86 Now deletes link icon directly, rather than depending on DeleteLink to do it.
	  Sets the Don'tDeleteLinkIconFlg in the call to DeleteLink to do so.)


    (LET ((Link (NC.FetchLinkFromLinkIcon ImageObject))
	  LinkType OldLink StkPtr SourceCard)
         (if (NC.CheckForNotReadOnly (fetch (Link SourceCard) of Link)
					 NIL "Can't delete links in ")
	     then (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)


			 (NC.CheckForOrphanDelete (SETQ SourceCard (fetch (Link SourceCard)
									  of Link))
						    (fetch (Link DestinationCard) of Link))
			 (NC.DeleteLink Link (NC.SameCardP SourceCard (fetch (NoteFile 
										      OrphansCard)
									     of
									      (fetch (Card NoteFile)
										 of SourceCard)))
					  T)
			 (create IMAGEOBJ smashing ImageObject OBJECTDATUM ←(fetch
							 (IMAGEOBJ OBJECTDATUM) of 
									NC.DeletedLinkImageObject)
						       IMAGEOBJPLIST ←(fetch (IMAGEOBJ 
										    IMAGEOBJPLIST)
									 of 
									NC.DeletedLinkImageObject)
						       IMAGEOBJFNS ←(fetch (IMAGEOBJ IMAGEOBJFNS)
								       of NC.DeletedLinkImageObject)
				   )
			 (replace (Link UID) of Link with -1)))
	   else (ERROR!)))))
)
(PUTPROPS FGHPATCH093 COPYRIGHT ("Xerox Corporation" 1986))
STOP