(FILECREATED "19-Aug-87 11:31:36" {QV}<NOTECARDS>1.3KNEXT>PMIPATCH057.;3 9309 changes to: (VARS PMIPATCH057COMS) previous date: " 7-Aug-87 18:09:28" {QV}<NOTECARDS>1.3KNEXT>PMIPATCH057.;2) (* Copyright (c) 1987 by Xerox Corporation. All rights reserved.) (PRETTYCOMPRINT PMIPATCH057COMS) (RPAQQ PMIPATCH057COMS ((DECLARE: FIRST (P (NC.LoadFileFromDirectories (QUOTE NCBROWSERCARD)))) (* * pmi 8/7/87: Fixes bug reported by Cathy where deleting a card from a browser caused it to go first to Orphans before being deleted for good.) (* * Changed in NCBROWSERCARD) (FNS NC.BrowserRemoveNode NC.DelBrowserContentsLink))) (DECLARE: FIRST (NC.LoadFileFromDirectories (QUOTE NCBROWSERCARD)) ) (* * pmi 8/7/87: Fixes bug reported by Cathy where deleting a card from a browser caused it to go first to Orphans before being deleted for good.) (* * Changed in NCBROWSERCARD) (DEFINEQ (NC.BrowserRemoveNode (LAMBDA (Graph Window DeleteCardFlg NodeToRemove QuietFlg) (* pmi: " 7-Aug-87 18:07") (* * Called by grapher when user removes a node.) (* * rht 11/17/85: Updated to handle new card and notefile formats.) (* * rht 2/7/86: Changed to use NC.SetBrowserRoots instead of NC.PutProp) (* * rht 4/30/86: Now takes optional NodeToRemove and QuietFlg argument.) (* * rg 3/16/87 NC.DeleteNoteCards -> NC.DeleteNoteCard) (* * pmi 8/7/87: Now passes DeleteCardFlg arg to NC.DelBrowserContentsLink. Also turned off confirmation in NC.DeleteNoteCard.) (PROG ((GraphCard (NC.CoerceToCard Window)) Card NodeToRemoveID RootCards NodesToRemove NumVirtuals) (OR NodeToRemove (SETQ NodeToRemove (NC.SelectGraphNode Window Graph (if DeleteCardFlg then "Choose node of card to delete." else "Choose node to remove.")))) (SETQ NodeToRemoveID (NC.CoerceToGraphNodeIDOrLabel NodeToRemove)) (SETQ Card (NC.CardFromBrowserNodeID NodeToRemoveID)) (* If we're supposed to be deleting a card, then check that node represents a card and that user confirms.) (if DeleteCardFlg then (if (NC.ValidCardP Card) then (if (NOT (NC.AskYesOrNo (CONCAT "Are you sure you want to delete the " (NC.RetrieveTitle Card) " card? ") "--" (QUOTE Yes) T Window NIL NIL)) then (FLIPNODE NodeToRemove Window) (RETURN (NC.PrintMsg NIL T "Card & Node delete aborted."))) else (NC.PrintMsg NIL T "No card for that node.") (FLASHW PROMPTWINDOW) (FLIPNODE NodeToRemove Window) (RETURN NIL))) (AND (NC.ValidCardP GraphCard) (NC.MarkCardDirty GraphCard)) (* We require that all virtual nodes for this node must be removed at once if this one has any link edges to or from it.) (SETQ NodesToRemove (for Node in (fetch (GRAPH GRAPHNODES) of Graph) when (EQ NodeToRemoveID (NC.CoerceToGraphNodeIDOrLabel Node)) collect Node)) (* If there are no edges into or out of this node, then just delete from graph.) (if (AND (NOT DeleteCardFlg) (NULL (fetch (GRAPHNODE FROMNODES) of NodeToRemove)) (NULL (fetch (GRAPHNODE TONODES) of NodeToRemove))) then (FLIPNODE NodeToRemove Window) (* Delete the browsercontents link from the browser.) (if (AND (NC.ValidCardP Card) (NC.ValidCardP GraphCard)) then (NC.DelBrowserContentsLink GraphCard Card) (* Remove entry for this node from browser hash array.) (NC.RemoveBrowserNodeHashArrayEntry GraphCard Card)) (RETURN (NC.GraphRemoveNode NodeToRemove Graph Window))) (* If there are companion virtual nodes, ask for user confirmation.) (if (AND (NOT DeleteCardFlg) (GREATERP (SETQ NumVirtuals (LENGTH NodesToRemove)) 1) (NOT (PROGN (NC.PrintMsg Window T NumVirtuals " virtual companion nodes will be removed." (CHARACTER 13)) (NC.YesP (NC.AskUser "Still want to remove? " "--" (QUOTE Yes) NIL Window NIL NIL T))))) then (FLIPNODE NodeToRemove Window) (RETURN NIL)) (* Delete the browsercontents link from the browser.) (AND (NC.ValidCardP Card) (NC.ValidCardP GraphCard) (NC.DelBrowserContentsLink GraphCard Card DeleteCardFlg)) (* Delete all record of links to and from this node on prop lists.) (NC.SmashGraphNodeIDProps NodeToRemoveID) (for Node in (fetch (GRAPH GRAPHNODES) of Graph) eachtime (BLOCK) bind UID when (type? UID (SETQ UID (NC.CoerceToGraphNodeID Node))) do (NC.GraphNodeIDRemProp UID NodeToRemoveID)) (if (AND (NC.ValidCardP Card) (NC.ValidCardP GraphCard)) then (* Remove from the root ids list.) (SETQ RootCards (NC.FetchBrowserRoots GraphCard)) (if (for RootCard in RootCards eachtime (BLOCK) thereis (NC.SameCardP Card RootCard)) then (NC.SetBrowserRoots GraphCard (for RootCard in RootCards eachtime (BLOCK) unless (NC.SameCardP Card RootCard) collect RootCard))) (* Remove entry for this node from browser hash array.) (NC.RemoveBrowserNodeHashArrayEntry GraphCard Card)) (* Get rid of node and its virtual buddies from graph.) (AND Window (FLIPNODE NodeToRemove Window)) (for Node in NodesToRemove do (NC.GraphRemoveNode Node Graph Window)) (* Delete card if we're supposed to.) (if DeleteCardFlg then (NC.PrintMsg NIL T "Deleting " Card " ... ") (NC.DeleteNoteCard Card NIL T) (NC.PrintMsg NIL T "Done." (CHARACTER 13))) (AND Window (REDISPLAYW Window)) (OR QuietFlg (NC.PrintMsg NIL T "Nodes: " (CONCATLIST (for Node in NodesToRemove collect (PACK* (fetch (GRAPHNODE NODEID) of Node) (QUOTE % )))) "removed."))))) (NC.DelBrowserContentsLink (LAMBDA (GraphCard DestCard DeleteCardFlg) (* pmi: " 7-Aug-87 18:09") (* * Delete the browsercontents link connecting GraphCard and DestID.) (* * rht 11/17/85: updated to handle new card and notefile formats.) (* * rht 4/30/86: Now checks to make sure there's a link to delete.) (* * rht 5/26/87: Now handles cross-file browsercontents links.) (* * pmi 8/7/87: Added DeleteCardFlg arg so we won't create orphans if DestCard is about to be deleted.) (DECLARE (GLOBALVARS NC.BrowserContentsLinkLabel)) (LET ((Links (NCP.GetLinks GraphCard DestCard NC.BrowserContentsLinkLabel))) (if (CDR Links) then (NC.ReportError "NC.DelBrowserContentsLink" (CONCAT "Multiple browser contents links between " (NC.FetchTitle GraphCard) " and " (NC.FetchTitle DestCard) )) NIL) (if Links then (* Don't create an orphan if this card is about to be deleted.) (NC.DeleteLink (CAR Links) DeleteCardFlg T) else (* Could be that it's a cross file browsercontents link.) (for Link in (NCP.GetLinks GraphCard NIL NC.BrowserContentsLinkLabel) bind CrossFileLinkCard (DestCardUID ←(fetch (Card UID) of DestCard)) when (AND (NC.CrossFileLinkCardP (SETQ CrossFileLinkCard (fetch (Link DestinationCard) of Link))) (NC.SameUIDP DestCardUID (fetch (CrossFileLinkSubstance CrossFileLinkDestCardUID) of (NCP.CardSubstance CrossFileLinkCard)))) do (RETURN (NC.DeleteLink Link T T))))))) ) (PUTPROPS PMIPATCH057 COPYRIGHT ("Xerox Corporation" 1987)) (DECLARE: DONTCOPY (FILEMAP (NIL (934 9227 (NC.BrowserRemoveNode 944 . 7247) (NC.DelBrowserContentsLink 7249 . 9225))))) STOP