(FILECREATED "16-Dec-86 20:24:35" {QV}<NOTECARDS>1.3K>NEXT>RHTPATCH177.;2 13803 changes to: (FNS NC.DeleteNoteCards NC.SeverAllLinks NC.SmartDeleteLinks) (VARS RHTPATCH177COMS) previous date: "16-Dec-86 20:23:30" {QV}<NOTECARDS>1.3K>NEXT>RHTPATCH177.;1) (* Copyright (c) 1986 by Xerox Corporation. All rights reserved.) (PRETTYCOMPRINT RHTPATCH177COMS) (RPAQQ RHTPATCH177COMS ((* * Fixes bug reported by Kirk whereby NC.SmartDeleteLinks was calling NC.CardSaveFn for cards about to be deleted.) (* * Change to NCCARDS) (FNS NC.DeleteNoteCards NC.SeverAllLinks) (* * Change to NCLINKS) (FNS NC.SmartDeleteLinks))) (* * Fixes bug reported by Kirk whereby NC.SmartDeleteLinks was calling NC.CardSaveFn for cards about to be deleted.) (* * Change to NCCARDS) (DEFINEQ (NC.DeleteNoteCards (LAMBDA (CardIdentifiers NoIndividualConfirmFlg DontClearFlg InterestedWindow QuietFlg NoGroupConfirmFlg) (* rht: "16-Dec-86 20:24") (* Delete note cards. If no card specified then get a list of note cards to be deleted. Then delete these cards.) (* * fgh 11/11/85: Updated to handle new Card objects. Also split off main work of deleteing a single note card into NC.DeleteNoteCard function.) (* * kirk 21Feb86 Added InterestedWindow) (* * kirk 29Apr86 Now returns CardIdentifiers) (* * fgh 6/9/86 Added checks to see if other operations are in progress) (* * rht 7/4/86: Now checks that card is not read-only.) (* * kirk 18Aug86 Added main window for windowless cards.) (* * rht 8/29/86: Reorganized and added call to NC.SeverAllLinks to make deleting more efficient. Added QuietFlg, NoGroupConfirmFlg and Don'tPutToBeDeletedCardsFlg args.) (* * rht 9/5/86: Now forces NoGroupConfirmFlg to be non-nil if NoIndividualConfirmFlg is NIL and only one card to delete.) (* * pmi 12/5/86: Modified message to NC.SelectNoteCards to mention SHIFT-selection.) (* * pmi 12/12/86: Removed obsolete ReturnLinksFlg argument in call to NC.SelectNoteCards.) (* * rht 12/16/86: Removed obsolete Don'tPutToBeDeletedCardsFlg arg.) (DECLARE (GLOBALVARS NC.DeleteSelectingMenu)) (OR CardIdentifiers (SETQ CardIdentifiers (NC.SelectNoteCards NIL NIL NC.DeleteSelectingMenu InterestedWindow "Please shift-select the Note Cards to be deleted."))) (* * Kludge in case args are nil, say, when we're called from a card's menu.) (if (AND (NULL NoIndividualConfirmFlg) (NULL NoGroupConfirmFlg) (EQ (LENGTH (MKLIST CardIdentifiers)) 1)) then (SETQ NoGroupConfirmFlg T) (SETQ QuietFlg T)) (* * First collect cards that are deletable.) (LET ((CardsToDelete (for CardIdentifier in (MKLIST CardIdentifiers) bind Card eachtime (BLOCK) when (AND (SETQ Card (NC.CoerceToCard CardIdentifier)) (if (NOT (NC.TopLevelCardP Card)) else (NC.PrintMsg (NC.FetchWindow Card) T "You cannot delete this FileBox." (CHARACTER 13)) (DISMISS 1000) (NC.ClearMsg (NC.FetchWindow Card) T) NIL) (NC.CheckForNotReadOnly Card (NC.FetchWindow Card) "Can't delete cards from a ") (OR NoIndividualConfirmFlg (PROG1 (NC.AskYesOrNo "Are you sure you want to delete this?" " -- " "Yes" (NULL DontClearFlg) (OR (NC.FetchWindow Card) InterestedWindow) NIL NIL) (NC.ClearMsg)))) collect Card)) (NumSpecified (LENGTH (MKLIST CardIdentifiers))) NumToDelete) (SETQ NumToDelete (LENGTH CardsToDelete)) (if (AND (GREATERP NumToDelete 0) (if (EQUAL NumToDelete NumSpecified) then (OR NoGroupConfirmFlg (PROG1 (NC.AskYesOrNo (CONCAT "You've specified " NumToDelete " cards to delete." (CHARACTER 13) "Are you sure you want to delete them? ") NIL "Yes" (NULL DontClearFlg) InterestedWindow) (NC.ClearMsg))) else (PROG1 (NC.AskYesOrNo (CONCAT "Out of " NumSpecified " cards specified, " (DIFFERENCE NumSpecified NumToDelete) " are not deletable." (CHARACTER 13) "Want to delete the remaining " NumToDelete " cards? ") NIL "Yes" (NULL DontClearFlg) InterestedWindow) (NC.ClearMsg)))) then (* * Mark UIDs of cards about to be deleted.) (for Card in CardsToDelete do (NC.UIDPutProp (fetch (Card UID) of Card) (QUOTE AboutToBeDeletedFlg) T)) (* * Sever all links into and out of CardsToDelete) (NC.SeverAllLinks CardsToDelete QuietFlg InterestedWindow) (* * Now delete the cards one at a time.) (OR QuietFlg (NC.PrintMsg InterestedWindow T "Deleting cards: 1 out of " NumToDelete " ...")) (for Card in CardsToDelete as i from 1 eachtime (BLOCK) do (LET ((OperationInProgress (NC.OperationInProgress Card))) (OR QuietFlg (if (ZEROP (REMAINDER i 10)) then (NC.PrintMsg InterestedWindow T "Deleting cards: " i " out of " NumToDelete " ..."))) (if OperationInProgress then (NC.PrintOperationInProgressMsg (NC.FetchWindow Card) "Delete Card(s)" OperationInProgress) else (NC.ProtectedCardOperation Card Delete% Card%(s%) (NC.DeleteNoteCard Card))))) (OR QuietFlg (NC.ClearMsg InterestedWindow T)) CardIdentifiers)))) (NC.SeverAllLinks (LAMBDA (ListOfCards QuietFlg InterestedWindow) (* rht: "16-Dec-86 20:19") (* * Delete all links into and out of any cards in ListOfCards. Furthermore, do it efficiently by caching a card only long enough to delete all the links between it and ListOfCards.) (* * rht 12/16/86: Removed obsolete Don'tPutToBeDeletedCardsFlg arg.) (OR QuietFlg (NC.PrintMsg InterestedWindow T "Gathering links of " (LENGTH ListOfCards) " cards.")) (NC.SmartDeleteLinks (NC.UnionListsOfLinks (for Card in ListOfCards join (APPEND (NC.RetrieveToLinks Card))) (for Card in ListOfCards join (APPEND (NC.RetrieveFromLinks Card))) ) QuietFlg InterestedWindow))) ) (* * Change to NCLINKS) (DEFINEQ (NC.SmartDeleteLinks (LAMBDA (ListOfLinks QuietFlg InterestedWindow) (* rht: "16-Dec-86 20:20") (* * Delete a bunch of links efficiently. Sort so that links with same source bunch together. This way, only read and write each source card once. If a card has the AboutToBeDeletedFlg UID prop set and Don'tPutToBeDeletedCardsFlg is non-nil, then don't put it down to the file even if changes were made. Just throw away its cache.) (* * rht 10/17/86: Now passes non-nil NoOrphanHookFlg to NC.DeleteLink unless destination card is marked as about to be deleted.) (* * rht 11/4/86: Now takes Don'tCreateDeletedImageObjFlg arg.) (* * rht 11/13/86: Undid change of 11/4/86. Now passes non-nil Don'tDelLinkIconFlg to NC.DeleteLink instead like it used to.) (* * rht 11/14/86: Avoids call to NC.GetNoteCard for cards about to be deleted.) (* * rht 12/16/86: Removed obsolete Don'tPutToBeDeletedCardsFlg arg.) (LET (DestCardsw/oLinksCached NumLinksToDelete) (* * For each destination card, make sure its links are cached. At the same time, collect these cards for future uncaching.) (SETQ DestCardsw/oLinksCached (for Link in ListOfLinks bind DestCard when (NOT (NC.LinksCachedP (SETQ DestCard (fetch (Link DestinationCard) of Link)))) collect (NC.GetLinks DestCard) DestCard)) (* * Sort the List of links so that links with same source cards bunch together.) (OR QuietFlg (NC.PrintMsg InterestedWindow T "Sorting " (SETQ NumLinksToDelete (LENGTH ListOfLinks)) " links prior to deletion.")) (SORT ListOfLinks (FUNCTION (LAMBDA (Link1 Link2) (LESSP (fetch (Card IndexLoc) of (fetch (Link SourceCard) of Link1)) (fetch (Card IndexLoc) of (fetch (Link SourceCard) of Link2))))) ) (* * Now bring up source cards one at a time and do the delete of the links.) (OR QuietFlg (NC.PrintMsg InterestedWindow T "Deleting links: 1 out of " NumLinksToDelete " ...")) (for Link in ListOfLinks as i from 1 bind PreviousSourceCard WasNotActiveFlg SavedFromLinks HadLinksCachedFlg eachtime (BLOCK) when (NC.ValidLinkP Link) do (OR QuietFlg (if (ZEROP (REMAINDER i 10)) then (NC.PrintMsg InterestedWindow T "Deleting links: " i " out of " NumLinksToDelete " ..."))) (LET ((SourceCard (fetch (Link SourceCard) of Link))) (if (NOT (NC.SameCardP SourceCard PreviousSourceCard)) then (* Write down changes to previous card's substance.) (if WasNotActiveFlg then (* Have to call NC.CardSaveFn first and then NC.QuitCard with Don'tSaveFlg to avoid insureProperFiling check.) (if (NC.UIDGetProp (fetch (Card UID) of PreviousSourceCard) (QUOTE AboutToBeDeletedFlg)) then (* Throw away cache if card about to be deleted.) (NC.DeactivateCard PreviousSourceCard) else (NC.CardSaveFn PreviousSourceCard T) (NC.QuitCard PreviousSourceCard NIL T NIL NIL NIL NIL T)) (* Recache links for previous card if they were cached before.) (if HadLinksCachedFlg then (NC.GetLinks PreviousSourceCard))) (* Cache card and overwrite from links with previously cached ones.) (if (AND (SETQ WasNotActiveFlg (NOT (NC.ActiveCardP SourceCard))) (NOT (NC.UIDGetProp (fetch (Card UID) of SourceCard) (QUOTE AboutToBeDeletedFlg)))) then (* Save cached from links for this card.) (SETQ SavedFromLinks (if (SETQ HadLinksCachedFlg (NC.LinksCachedP SourceCard)) then (NC.FetchFromLinks SourceCard))) (NC.GetNoteCard SourceCard) (if HadLinksCachedFlg then (NC.SetFromLinks SourceCard SavedFromLinks))) ) (NC.DeleteLink Link (NC.UIDGetProp (fetch (Card UID) of (fetch (Link DestinationCard) of Link)) (QUOTE AboutToBeDeletedFlg)) (NC.UIDGetProp (fetch (Card UID) of (fetch (Link SourceCard) of Link)) (QUOTE AboutToBeDeletedFlg))) (SETQ PreviousSourceCard SourceCard)) finally (if (AND WasNotActiveFlg (NC.ValidCardP PreviousSourceCard)) then (* Have to call NC.CardSaveFn first and then NC.QuitCard with Don'tSaveFlg to avoid insureProperFiling check.) (if (NC.UIDGetProp (fetch (Card UID) of PreviousSourceCard) (QUOTE AboutToBeDeletedFlg)) then (* Throw away cache if card about to be deleted.) (NC.DeactivateCard PreviousSourceCard) else (NC.CardSaveFn PreviousSourceCard T) (NC.QuitCard PreviousSourceCard NIL T NIL NIL NIL NIL T)) (* Recache links for previous card if they were cached before.) (if HadLinksCachedFlg then (NC.GetLinks PreviousSourceCard)))) (* * Finally, write down links for cards whose links have changed and whose links weren't cached when this function was called.) (for DestCard in DestCardsw/oLinksCached eachtime (BLOCK) when ( NC.FetchLinksDirtyFlg DestCard) do (NC.PutLinks DestCard)) (OR QuietFlg (NC.ClearMsg InterestedWindow T))))) ) (PUTPROPS RHTPATCH177 COPYRIGHT ("Xerox Corporation" 1986)) (DECLARE: DONTCOPY (FILEMAP (NIL (833 7253 (NC.DeleteNoteCards 843 . 6411) (NC.SeverAllLinks 6413 . 7251)) (7284 13721 ( NC.SmartDeleteLinks 7294 . 13719))))) STOP