(FILECREATED " 8-Dec-86 17:15:38" {QV}<NOTECARDS>1.3K>NEXT>RHTPATCH167.;2 5413   

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

      previous date: " 8-Dec-86 17:14:27" {QV}<NOTECARDS>1.3K>NEXT>RHTPATCH167.;1)


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

(PRETTYCOMPRINT RHTPATCH167COMS)

(RPAQQ RHTPATCH167COMS ((* * rht&pmi 12/8/86: Now checks whether NC.LinkIconWhenDeletedFn called by 
			     TEDIT.MOVE. If so, don't cause orphan hook under the subsequent call to 
			     NC.DelFromLink.)
			  (* * Changes to NCLINKS)
			  (FNS NC.LinkIconWhenDeletedFn)))
(* * rht&pmi 12/8/86: Now checks whether NC.LinkIconWhenDeletedFn called by TEDIT.MOVE. If so,
 don't cause orphan hook under the subsequent call to NC.DelFromLink.)

(* * Changes to NCLINKS)

(DEFINEQ

(NC.LinkIconWhenDeletedFn
  (LAMBDA (ImageObject Stream)                               (* rht: " 8-Dec-86 17:15")

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



          (* * rht 8/11/86: Now computes InsideShowLinksP and lets that determine value of Don'tDelLinkIcon flg in call to 
	  NC.DeleteLink.)



          (* * rht&pmi 12/8/86: Now checks whether we're called by TEDIT.MOVE. If so, don't cause orphan hook under 
	  NC.DelFromLink.)


    (DECLARE (GLOBALVARS NC.DeletedLinkImageObject))
    (LET ((Link (NC.FetchLinkFromLinkIcon ImageObject))
	  LinkType OldLink StkPtr SourceCard InsideShowLinksP)
         (COND
	   ((NC.CheckForNotReadOnly (fetch (Link SourceCard) of Link)
				      NIL "Can't delete links in ")
	     (COND
	       ((IMAGEOBJPROP ImageObject (QUOTE LinkBeingMovedWithinCard))
                                                             (* TEdit is trying to delete the old link imageobj 
							     after moving within a card.)
		 (IMAGEOBJPROP ImageObject (QUOTE LinkBeingMovedWithinCard)
				 NIL))
	       ((SETQ OldLink (IMAGEOBJPROP ImageObject (QUOTE LinkBeingMoved)))
                                                             (* Pass non-nil NoOrphanHookFlg arg to NC.DelFromLink 
							     if we are under a TEDIT.MOVE call.)
		 (NC.DelFromLink OldLink (RELSTK (STKPOS (QUOTE TEDIT.MOVE))))
		 (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)


		  (COND
		    ((AND (SETQ InsideShowLinksP (IMAGEOBJPROP ImageObject (QUOTE 
									     InsidePropListEditor)))
			    (LISTGET (fetch (Link UserData) of Link)
				       (QUOTE Reversed)))
		      (SETQ Link (create Link using Link (SETQ 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)))
				   (NOT InsideShowLinksP))
		  (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))))
	   (T (ERROR!))))))
)
(PUTPROPS RHTPATCH167 COPYRIGHT ("Xerox Corporation" 1986))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (836 5331 (NC.LinkIconWhenDeletedFn 846 . 5329)))))
STOP