(FILECREATED "10-Nov-86 22:41:30" {QV}<NOTECARDS>1.3K>NEXT>RHTPATCH141.;1 9998 changes to: (VARS RHTPATCH141COMS)) (* Copyright (c) 1986 by Xerox Corporation. All rights reserved.) (PRETTYCOMPRINT RHTPATCH141COMS) (RPAQQ RHTPATCH141COMS ((* * Fix for InsertLink and CrossFileLinks.) (* * Change to NCCROSSFILELINKS) (FNS NC.GetCrossFileLinkDestCard) (* * Change to NCLINKS) (FNS NC.MakeLink))) (* * Fix for InsertLink and CrossFileLinks.) (* * Change to NCCROSSFILELINKS) (DEFINEQ (NC.GetCrossFileLinkDestCard (LAMBDA (CrossFileLinkCard) (* rht: "10-Nov-86 22:35") (* * Find the notefile corresponding to this crossfilelink and try to open it if not already open. Then look for the card in there having the given UID. Return NIL if failed for any reason.) (* * rht 11/10/86: Make sure CrossFileLinkCard is cached before fetching substance.) (LET ((Title (NC.FetchTitle CrossFileLinkCard)) (SourceNoteFile (fetch (Card NoteFile) of CrossFileLinkCard)) Substance DestNoteFileUID DestFileHint DestCardUID DestNoteFile DestFileName InterestedWindow WasOpenFlg) (if (NOT (NC.ActiveCardP CrossFileLinkCard)) then (NC.GetNoteCard CrossFileLinkCard)) (SETQ Substance (NC.FetchSubstance CrossFileLinkCard)) (SETQ DestCardUID (fetch (CrossFileLinkSubstance CrossFileLinkDestCardUID) of Substance)) (SETQ DestNoteFileUID (fetch (CrossFileLinkSubstance CrossFileLinkDestNoteFileUID) of Substance)) (SETQ DestFileHint (fetch (CrossFileLinkSubstance CrossFileLinkDestFileHint) of Substance)) (SETQ InterestedWindow (WFROMMENU (fetch (NoteFile Menu) of SourceNoteFile))) (SETQ DestNoteFile (NC.NoteFileFromNoteFileUID DestNoteFileUID)) (SETQ DestFileName (OR (AND (type? NoteFile DestNoteFile) (fetch (NoteFile FullFileName) of DestNoteFile)) DestFileHint)) (if (OR (SETQ WasOpenFlg (NCP.OpenNoteFileP DestNoteFile)) (NC.AskYesOrNo (CONCAT "Trying to follow cross-file link to " Title "." (CHARACTER 13) "Okay to try opening " DestFileName "? ") NIL "Yes" T InterestedWindow NIL NIL)) then (for while DestFileName bind Card NewFileName do (if (OR (NCP.OpenNoteFileP DestNoteFile) (NCP.OpenNoteFileP (SETQ DestNoteFile (NC.OpenNoteFile (OR DestNoteFile DestFileName) NIL NIL NIL NIL NIL NIL NIL NIL InterestedWindow)))) then (if (SETQ Card (NC.CardFromUID DestCardUID DestNoteFile)) then (if (NOT (EQUAL (SETQ NewFileName (fetch (NoteFile FullFileName) of DestNoteFile)) (fetch ( CrossFileLinkSubstance CrossFileLinkDestFileHint) of Substance))) then (replace (CrossFileLinkSubstance CrossFileLinkDestFileHint) of Substance with NewFileName) (NC.MarkCardDirty CrossFileLinkCard)) (RETURN Card) else (NC.PrintMsg InterestedWindow T "Couldn't find destination card in " DestFileName "." (CHARACTER 13)) (OR WasOpenFlg (NC.AbortSession DestNoteFile InterestedWindow T))) else (NC.PrintMsg InterestedWindow T "Couldn't open " DestFileName "." (CHARACTER 13))) (SETQ DestFileName (SETQ DestNoteFile NIL)) (AND (NC.AskYesOrNo "Want to try opening a different notefile? " T "Yes" NIL InterestedWindow) (SETQ DestFileName (NC.AskUser "File name to try opening: " NIL NIL T InterestedWindow)))))) )) ) (* * Change to NCLINKS) (DEFINEQ (NC.MakeLink (LAMBDA (Window LinkLabel DestinationCard SourceCard DisplayMode AnchorMode Message NoDisplayFlg LinkToInsertAfter CrossFileLinksMode) (* rht: "10-Nov-86 22:38") (* * 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.) (DECLARE (GLOBALVARS NC.SelectingSingleCardMenu NC.NewCrossFileLinksTwoWayFlg)) (OR SourceCard (SETQ SourceCard (NC.CoerceToCard Window))) (AND (NC.CheckForNotReadOnly SourceCard Window "Can't make links in ") (LET (Link Type) (OR Window (SETQ Window (NC.FetchWindow SourceCard))) (OR Message (SETQ Message "Please 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 NIL 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 (NC.CrossFileLinkCardP DestinationCard) (if (NC.FetchUserDataProp DestinationCard (QUOTE JustCreatedFlg)) then (NC.SetUserDataProp DestinationCard (QUOTE JustCreatedFlg) NIL) else (SETQ DestinationCard (NC.GetCrossFileLinkDestCard DestinationCard)))) (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) NC.NewCrossFileLinksTwoWayFlg)))) (if CrossFileLinksTwoWayFlg then (NC.MakeGlobalLink Window LinkLabel DestinationCard ( NC.CreateCrossFileLinkCard DestinationCard SourceCard T) DisplayMode)) (SETQ DestinationCard (NC.CreateCrossFileLinkCard SourceCard DestinationCard CrossFileLinksTwoWayFlg)))) (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) Link)) else NIL))))) ) (PUTPROPS RHTPATCH141 COPYRIGHT ("Xerox Corporation" 1986)) (DECLARE: DONTCOPY (FILEMAP (NIL (529 4061 (NC.GetCrossFileLinkDestCard 539 . 4059)) (4092 9916 (NC.MakeLink 4102 . 9914) )))) STOP