(FILECREATED "20-Nov-87 22:35:50" {QV}<NOTECARDS>1.3KNEXT>RHTPATCH296.;3 14637 changes to: (VARS RHTPATCH296COMS) (FNS NC.MakeLink NC.AssignTitle) previous date: "20-Nov-87 16:39:30" {QV}<NOTECARDS>1.3KNEXT>RHTPATCH296.;1) (* Copyright (c) 1987 by Xerox Corporation. All rights reserved.) (PRETTYCOMPRINT RHTPATCH296COMS) (RPAQQ RHTPATCH296COMS ((* * Fixes several cases left out of the ShowLinks fixes in RHTPATCH289, namely when title of card A is changed and there's a link, possibly cross-file, to card B which has a ShowLinks menu. Also now automatically recomputes visible ShowLinks menus when links are first created.) (* * Change to NCCARDS) (FNS NC.AssignTitle) (* * Change to NCLINKS) (FNS NC.MakeLink))) (* * Fixes several cases left out of the ShowLinks fixes in RHTPATCH289, namely when title of card A is changed and there's a link, possibly cross-file, to card B which has a ShowLinks menu. Also now automatically recomputes visible ShowLinks menus when links are first created.) (* * Change to NCCARDS) (DEFINEQ (NC.AssignTitle (LAMBDA (CardIdentifier NoClearMsgFlg NewTitle InterestedWindow) (* rht: "20-Nov-87 22:14") (* * Change the title of the card specified by the WindowOrTextStreamOrID) (* * rht 2/1/85: Changed from NC.PutTitle to NC.SetTitleDirtyFlg, unless card is not active. We shouldn't be writing to the notefile until save time.) (* * fgh 11/11/85: Added support for CardID, CardInfo and noteFile objects. Also entered call to Nc.StoreTitle.) (* * fgh 6/9/86 Added code to check to make sure that another operation is not in progress on this card when this fn is called.) (* * fgh 6/13/86 Now spawns mouse in case called under MOUSE process.) (* * fgh 6/27/86 returns T if completed okay.) (* * rht 7/4/86: Added check for readonly card.) (* * kef 7/16/86: Added obtain write permission.) (* * kef 7/24/86: Doesn't release the write lock if this is a new card.) (* * kef 7/30/86: Modified to check for Client's concept of whether he owns the write lock or not, thus deciding whether or not to setup the release of the write lock afterwards.) (* * fgh 8/30/86 Converted to use NC.IfCardPartNotBusy.) (* * rg 3/3/87 Enlarged scope of NC.ProtectedCardOperation) (* * rht 3/23/87: Now takes InterestedWindow arg.) (* * rht 3/24/87: Now calls NC.CoerceToInterestedWindow) (* * rht 5/27/87: Now passes title through cross-file link card if dest notefile is open.) (* * rht 5/29/87: Now uncaches links if they weren't cached when we came in.) (* * rht 11/20/87: Now updates ShowLinks menus if any for destinations of ToLinks from this card.) (ALLOW.BUTTON.EVENTS) (LET ((Card (NC.CoerceToCard CardIdentifier)) OldTitle Window) (NC.ProtectedCardOperation Card "Assign Title" NIL (NC.IfCardPartNotBusy Card (QUOTE TITLE) (OR InterestedWindow (SETQ InterestedWindow ( NC.CoerceToInterestedWindow Card))) (if (NC.CheckForNotReadOnly Card InterestedWindow "Can't change titles for cards in ") then (COND ((SETQ NewTitle (OR (STRINGP NewTitle) (AND NewTitle (OR (LITATOM NewTitle) (NUMBERP NewTitle)) (MKSTRING NewTitle)) (NC.AskUser (CONCAT "Enter the title for this card" (CHARACTER 13)) "--> " (COND ((AND (STREQUAL (SETQ OldTitle ( NC.RetrieveTitle Card)) "Untitled") (NC.FetchNewCardFlg Card)) NIL) (T OldTitle)) (NULL NoClearMsgFlg) InterestedWindow))) (NC.SetTitle Card NewTitle) (* * Now do a PutTitle so that anyone else coming along will pick up on the new title. The only exception is if this card hasn't been written to the NoteFile yet, which is true when the NewCardFlg is T. In that case, we can't put the title down yet, so just mark it dirty.) (COND ((fetch (Card NewCardFlg) of Card) (NC.SetTitleDirtyFlg Card T)) (T (NC.PutTitle Card) (NC.SetTitleDirtyFlg Card NIL))) (AND (WINDOWP (SETQ Window (NC.FetchWindow Card))) (WINDOWPROP Window (QUOTE TITLE) NewTitle)) (LET ((LinksWereCachedFlg (NC.LinksCachedP Card))) (if (NOT LinksWereCachedFlg) then (NC.GetLinks Card)) (for FromLink in (NC.FetchFromLinks Card) do (LET ((ContainingCard (fetch (Link SourceCard) of FromLink)) RemoteCrossFileLinkCard) (if (AND (NC.CrossFileLinkCardP ContainingCard) (SETQ RemoteCrossFileLinkCard ( NC.FetchRemoteCrossFileLinkCard ContainingCard))) then ( NC.CheckCrossFileLinkCardTitle RemoteCrossFileLinkCard Card) else (AND (NC.ActiveCardP ContainingCard) (WINDOWP ( NC.FetchWindow ContainingCard)) (NC.UpdateLinkImages ContainingCard Card))))) (for ToLink in (NC.FetchToLinks Card) do (LET ((ContainingCard (fetch (Link DestinationCard) of ToLink)) RemoteCrossFileLinkCard) (if (AND (NC.CrossFileLinkCardP ContainingCard) (SETQ RemoteCrossFileLinkCard ( NC.FetchRemoteCrossFileLinkCard ContainingCard))) then ( NC.CheckCrossFileLinkCardTitle RemoteCrossFileLinkCard Card) else (NC.UpdateLinkImagesInShowLinks ContainingCard Card)))) (if (NOT LinksWereCachedFlg) then (NC.UncacheLinks Card))) T)) else NIL)))))) ) (* * Change to NCLINKS) (DEFINEQ (NC.MakeLink (LAMBDA (Window LinkLabel DestinationCard SourceCard DisplayMode AnchorMode Message NoDisplayFlg LinkToInsertAfter CrossFileLinksMode) (* rht: "20-Nov-87 22:27") (* * Make a link from (OR Window SourceCard) to DestinationCard with linklabel of LinkLabel) (* * rht 1/12/85: If need to create a new card, then now shows card type menu near window of SourceID.) (* * rht 1/13/85: Added extra args Message and NoDisplayFlg.) (* * rht 3/26/85: Added LinkToInsertAfter arg which should be NIL or a link to insert the new To link after. If NIL, then insert at front of ToLinks.) (* * kirk 9/23/85: took out GETPROMPTWINDOW call for asknotecardtype) (* * kirk: 14Nov85: changed NC.CoerceToID to to NC.CoerceToCard) (* * fgh 11/16/85 Changed from PROG to LET and used COND to contyrol returnmed value.) (* * fgh 2/5/86 Changed call DefaultLinkDisplayMode to FetchLinkDisplayMode) (* * fgh 6/5/86 Now calls AskLinkLabel if LinkLabel arg is NIL) (* * rht 7/4/86: Added check for readonly card.) (* * kef 7/17/86: Added calls to grab the write permission on the appropriate card parts.) (* * kef 7/22/86: Saves the links on the Destination Card now right away, while still holding onto the FROMLINKS write lock.) (* * fgh 8/30/86 Adpated to use NC.IfCardPartNotBusy.) (* * rht 9/29/86: Tossed Ken's call to NC.PutFromLinks; It was the cause of too many nasty breaks. Also made syntactic fixes.) (* * rht 10/4/86: Now handles cross file links. New arg CrossFileLinksMode determines whether cross-file link will be two-way, i.e. will destination card know it's being linked to.) (* * rht 11/10/86: Now creates new crossfile link if Destination card is a CrossFileLink card that we didn't just create.) (* * rht 11/14/86: Now checks if non-nil DestinationCard before trying to do cross-filelink stuff.) (* * pmi 12/5/86: Modified message to NC.SelectNoteCards to mention SHIFT-selection.) (* * rht 12/9/86: Throws out JustCreatedFlg marker stuff.) (* * pmi 12/12/86: Removed obsolete ReturnLinksFlg argument in call to NC.SelectNoteCards.) (* * rht 12/16/86: Fixed bug whereby electing not to open notefile containing crossfilelink dest card caused break.) (* * rht 12/16/86: Now passes Window down to NC.GetCrossFileLinkDestCard.) (* * rg 3/18/87 added NCP.WithLockedCards wrapper) (* * rht 5/25/87: No longer tries to make two way cross-file links when dest notefile is open read-only. Also assumes that CrossFileLinksMode is one of TWOWAY, ONEWAY or ASK. Now fills in the new RemoteCrossFileLinkCardUID field of cross file link cards.) (* * rht 11/20/87: Now recomputes ShowLinks menus if they're visible.) (DECLARE (GLOBALVARS NC.SelectingSingleCardMenu NC.NewCrossFileLinksMode)) (OR SourceCard (SETQ SourceCard (NC.CoerceToCard Window))) (AND (NC.CheckForNotReadOnly SourceCard Window "Can't make links in ") (NCP.WithLockedCards (LET (Link Type) (OR Window (SETQ Window (NC.FetchWindow SourceCard))) (OR Message (SETQ Message "Please shift-select the Card or Box to be linked to.")) (OR LinkLabel (SETQ LinkLabel (NC.AskLinkLabel Window NIL NIL T NIL))) (OR DestinationCard (SETQ DestinationCard (NC.SelectNoteCards T (FUNCTION (LAMBDA (Card) (COND ((NOT (NC.SameCardP Card SourceCard)) T) (T (NC.PrintMsg Window T "A Card/Box cannot link to itself. " (CHARACTER 13) "Selection ignored." (CHARACTER 13)) NIL)))) NC.SelectingSingleCardMenu SourceCard Message))) (if (EQ DestinationCard (QUOTE *New% Card*)) then (SETQ DestinationCard (AND (SETQ Type (NC.AskNoteCardType (WINDOWREGION Window))) (NC.CoerceToCard (NC.MakeNoteCard Type (fetch (Card NoteFile) of SourceCard) NIL NoDisplayFlg))))) (* * If we're trying to link to a CrossFileLink card, then check whether card was just created. If so, then it's the first link, otherwise we make a new CrossFileLink.) (AND DestinationCard (NC.CrossFileLinkCardP DestinationCard) (SETQ DestinationCard (NC.GetCrossFileLinkDestCard DestinationCard Window)) (NC.SetUserDataProp DestinationCard (QUOTE JustCreatedFlg) NIL)) (if DestinationCard then (NC.IfCardPartNotBusy DestinationCard (QUOTE FROMLINKS) (NC.IfCardPartNotBusy SourceCard (QUOTE TOLINKS) (* * If have cross-file link, then make two new crossfilelink cards, one per notefile. Make global link over there from crossfilelink card to DestinationCard and local link here from SourceCard to crossfilelink card.) (if (NOT (NC.SameNoteFileP (fetch (Card NoteFile) of SourceCard) (fetch (Card NoteFile) of DestinationCard)) ) then (LET ((CrossFileLinksTwoWayFlg (OR (EQ CrossFileLinksMode (QUOTE TWOWAY)) (AND (NULL CrossFileLinksMode) (EQ NC.NewCrossFileLinksMode (QUOTE TWOWAY)) ) (AND (OR (EQ CrossFileLinksMode (QUOTE ASK)) (AND (NULL CrossFileLinksMode) (EQ NC.NewCrossFileLinksMode (QUOTE ASK)))) (NC.AskCrossFileLinkMode DestinationCard Window)))) RemoteSourceCard) (if CrossFileLinksTwoWayFlg then (AND (SETQ RemoteSourceCard (NC.CreateCrossFileLinkCard DestinationCard SourceCard T)) (NC.MakeGlobalLink Window LinkLabel DestinationCard RemoteSourceCard DisplayMode))) (SETQ DestinationCard (NC.CreateCrossFileLinkCard SourceCard DestinationCard CrossFileLinksTwoWayFlg)) (if RemoteSourceCard then (* Make the two crossfile link cards know about each other's UIDs.) (replace (CrossFileLinkSubstance RemoteCrossFileLinkCardUID) of (NC.FetchSubstance RemoteSourceCard) with (fetch (Card UID) of DestinationCard)) (replace (CrossFileLinkSubstance RemoteCrossFileLinkCardUID) of (NC.FetchSubstance DestinationCard) with (fetch (Card UID) of RemoteSourceCard)) ))) (SETQ Link (create Link UID ←(NC.MakeUID) SourceCard ← SourceCard DestinationCard ← DestinationCard AnchorMode ← AnchorMode Label ← LinkLabel DisplayMode ←(OR DisplayMode (NC.FetchLinkDisplayMode SourceCard)))) (NC.AddToLink Link LinkToInsertAfter) (NC.AddFromLink Link) (* Recompute ShowLinks menus if they're up.) (if (NC.FetchShowLinksWindow SourceCard) then (NC.ShowLinks SourceCard)) (if (NC.FetchShowLinksWindow DestinationCard) then (NC.ShowLinks DestinationCard)) Link)) else NIL)))))) ) (PUTPROPS RHTPATCH296 COPYRIGHT ("Xerox Corporation" 1987)) (DECLARE: DONTCOPY (FILEMAP (NIL (1116 6632 (NC.AssignTitle 1126 . 6630)) (6663 14555 (NC.MakeLink 6673 . 14553))))) STOP