(FILECREATED " 9-Dec-87 16:52:49" {QV}<NOTECARDS>1.3KNEXT>RHTPATCH297.;2 7515 changes to: (FNS NC.CheckForOrphanDelete NC.LinkIconWhenDeletedFn) (VARS RHTPATCH297COMS) previous date: " 9-Dec-87 16:50:54" {QV}<NOTECARDS>1.3KNEXT>RHTPATCH297.;1) (* Copyright (c) 1987 by Xerox Corporation. All rights reserved.) (PRETTYCOMPRINT RHTPATCH297COMS) (RPAQQ RHTPATCH297COMS ((* * Fixes bug whereby deleting last link from orphan card caused half-link.) (* * Changes to NCLINKS) (FNS NC.LinkIconWhenDeletedFn NC.CheckForOrphanDelete))) (* * Fixes bug whereby deleting last link from orphan card caused half-link.) (* * Changes to NCLINKS) (DEFINEQ (NC.LinkIconWhenDeletedFn (LAMBDA (ImageObject Stream) (* rht: " 9-Dec-87 16:48") (* * 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.) (* * rht 3/26/87: Now passes non-nil NoOrphanHookFlg to NC.DeleteLink in case we're deleting a cross-file link.) (* * rht 10/1/87: Fixed case when we're under a move to call NC.DeleteLink rather than NC.DelFromLink and NC.DelToLink individually.) (* * rht 12/9/87: Now checks to make sure links are cached before calling NC.CheckOrphanDelete.) (DECLARE (GLOBALVARS NC.DeletedLinkImageObject)) (LET ((Link (NC.FetchLinkFromLinkIcon ImageObject)) LinkType OldLink StkPtr SourceCard DestinationCard 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))) (NC.DeleteLink 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 SourceCard ←(fetch (Link DestinationCard) of Link) DestinationCard ←(fetch (Link SourceCard) of Link))))) (* * Then just delete the link) (SETQ SourceCard (fetch (Link SourceCard) of Link)) (SETQ DestinationCard (fetch (Link DestinationCard) of Link)) (LET ((WasCachedFlg (NC.LinksCachedP SourceCard))) (if (NOT WasCachedFlg) then (NC.GetLinks SourceCard)) (NC.CheckForOrphanDelete SourceCard DestinationCard) (NC.DeleteLink Link (OR (NC.SameCardP SourceCard (fetch (NoteFile OrphansCard) of (fetch (Card NoteFile) of SourceCard))) (NC.CrossFileLinkCardP DestinationCard) (NC.CrossFileLinkCardP SourceCard)) (NOT InsideShowLinksP)) (if (NOT WasCachedFlg) then (NC.PutLinks SourceCard) (NC.UncacheLinks SourceCard))) (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!)))))) (NC.CheckForOrphanDelete (LAMBDA (SourceCard DestinationCard SourceWindow) (* rht: " 9-Dec-87 16:52") (* Check to make sure we are not deleteing the last reference to a note card from the orphan card. Last references are okay to delete it since they will be put in the orphan card. But deleting last reference from the orphan card is very, very bad. Warn the user.) (* * kirk: 14Nov85: changed EQs to NC.Same*Ps) (* * rht 7/4/86: Brought up to date with 1.3k. E.g. took out mention of NC.OrphansID) (* * rg 5/15/87 now calls NC.LinksCachedP instead of NC.ActiveCardP) (* * rht 12/9/87: No longer checks links caching. Now just assumed that links are cached when this fn is called.) (DECLARE (GLOBALVARS NC.SubBoxLinkLabel NC.FiledCardLinkLabel)) (LET ((FilingLinks (LIST NC.SubBoxLinkLabel NC.FiledCardLinkLabel)) (OrphansCard (fetch (NoteFile OrphansCard) of (fetch (Card NoteFile) of SourceCard)) )) (AND (NC.SameCardP SourceCard OrphansCard) (for Link in (NC.FetchFromLinks DestinationCard) when (FMEMB (fetch (Link Label) of Link) FilingLinks) unless (NC.SameCardP (fetch (Link SourceCard) of Link) OrphansCard) never Link) (NC.PrintMsg (NC.FetchWindow SourceCard) T "You have just deleted the last filing link to " (NC.RetrieveTitle DestinationCard) (CHARACTER 13) "The Search operation can be used to find it."))))) ) (PUTPROPS RHTPATCH297 COPYRIGHT ("Xerox Corporation" 1987)) (DECLARE: DONTCOPY (FILEMAP (NIL (698 7433 (NC.LinkIconWhenDeletedFn 708 . 5790) (NC.CheckForOrphanDelete 5792 . 7431)))) ) STOP