(FILECREATED " 8-Jun-87 18:22:52" {QV}<NOTECARDS>1.3K>NEXT>NCCROSSFILELINKS.;21 13891 changes to: (FNS NC.OpenCrossFileLinkDestNoteFile) previous date: " 5-Apr-87 19:51:29" {QV}<NOTECARDS>1.3K>NEXT>NCCROSSFILELINKS.;20) (* Copyright (c) 1986, 1987 by Xerox Corporation. All rights reserved.) (PRETTYCOMPRINT NCCROSSFILELINKSCOMS) (RPAQQ NCCROSSFILELINKSCOMS ((* * This file defines a card type called CrossFileLink that is a stand-in for really being able to link across notefiles.) (GLOBALVARS NC.NewCrossFileLinksTwoWayFlg NC.CopyCrossFileLinksMode NC.CrossFileLinkIcon NC.MakeCrossFileLinkIconStandIn) (BITMAPS NC.CrossFileLinkIcon) (VARS (NC.NewCrossFileLinksTwoWayFlg T) (NC.CopyCrossFileLinksMode NIL)) (FNS NC.GetCrossFileLinkDestCard NC.CreateCrossFileLinkCard NC.CrossFileLinkCardP NC.OpenCrossFileLinkDestNoteFile) (FNS NC.AddCrossFileLink NC.CrossFileLinkCopyFn NC.CrossFileLinkMakeFn NC.CrossFileLinkEditFn NC.CrossFileLinkGetFn NC.CrossFileLinkPutFn) (RECORDS CrossFileLinkSubstance) (P (NC.AddCrossFileLink) (PUTPROP (QUOTE CrossFileLink) (QUOTE Don'tForceFilingFlg) T)) (FNS NCAddStub.CrossFileLink))) (* * This file defines a card type called CrossFileLink that is a stand-in for really being able to link across notefiles.) (DECLARE: DOEVAL@COMPILE DONTCOPY (GLOBALVARS NC.NewCrossFileLinksTwoWayFlg NC.CopyCrossFileLinksMode NC.CrossFileLinkIcon NC.MakeCrossFileLinkIconStandIn) ) (RPAQ NC.CrossFileLinkIcon (READBITMAP)) (21 18 "OOOOOH@@" "H@@@@H@@" "H@@@@H@@" "H@CH@H@@" "H@AL@H@@" "H@@N@H@@" "H@@G@H@@" "IOOOHH@@" "IOOOLH@@" "IOOOHH@@" "H@@G@H@@" "H@@N@H@@" "H@AL@H@@" "H@CH@H@@" "H@@@@H@@" "H@@@@H@@" "H@@@@H@@" "OOOOOH@@") (RPAQQ NC.NewCrossFileLinksTwoWayFlg T) (RPAQQ NC.CopyCrossFileLinksMode NIL) (DEFINEQ (NC.GetCrossFileLinkDestCard [LAMBDA (CrossFileLinkCard InterestedWindow) (* rht: "27-Mar-87 17:40") (* * 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.) (* * rht 11/19/86: Now rips off version number from destination notefile hint.) (* * rht 12/11/86: Now checks that destination card is not deleted.) (* * rht 12/16/86: Now takes InterestedWindow argument.) (* * rht 3/25/87: Now calls NC.CoerceToInterestedWindow.) (* * rht 3/27/87: Now calls NC.OpenCrossFileLinkDestNoteFile.) (LET ((Title (NC.FetchTitle CrossFileLinkCard)) (SourceNoteFile (fetch (Card NoteFile) of CrossFileLinkCard)) Substance DestNoteFileUID DestFileHint DestCardUID DestNoteFile DestFileName) (OR (OPENWP InterestedWindow) (SETQ InterestedWindow (NC.CoerceToInterestedWindow SourceNoteFile))) (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 DestNoteFile (NC.NoteFileFromNoteFileUID DestNoteFileUID)) (SETQ DestFileName (OR (AND (type? NoteFile DestNoteFile) (fetch (NoteFile FullFileName) of DestNoteFile)) DestFileHint)) (for while (SETQ DestNoteFile (NC.OpenCrossFileLinkDestNoteFile DestNoteFile DestFileName InterestedWindow)) bind Card NewFileName do (if (NC.ValidCardP (SETQ Card (NC.CardFromUID DestCardUID DestNoteFile))) then (if [NOT (EQUAL (SETQ NewFileName (fetch (NoteFile FullFileName) of DestNoteFile)) (FULLNAME (fetch ( CrossFileLinkSubstance CrossFileLinkDestFileHint) of Substance] then (replace (CrossFileLinkSubstance CrossFileLinkDestFileHint) of Substance with (PACKFILENAME (QUOTE VERSION) NIL (QUOTE BODY) NewFileName)) (NC.MarkCardDirty CrossFileLinkCard)) (RETURN Card) else (NC.PrintMsg InterestedWindow T "Couldn't find destination card in " DestFileName "." (CHARACTER 13)) (if (NOT (NC.AskYesOrNo "Want to try opening a different notefile? " NIL "Yes" NIL InterestedWindow)) then (RETURN NIL) else (SETQ DestNoteFile (SETQ DestFileName NIL]) (NC.CreateCrossFileLinkCard [LAMBDA (SourceCard DestCard TwoWayFlg) (* rht: " 9-Dec-86 14:50") (* * Create a cross file link card in SourceCard's notefile.) (* * rht 11/19/86: Now rips off version number from destination notefile hint.) (* * rht 12/9/86: No longer records fact that card was "just created.") (LET ((DestNoteFile (fetch (Card NoteFile) of DestCard)) CrossFileLinkCard) (SETQ CrossFileLinkCard (NC.MakeNoteCard (QUOTE CrossFileLink) (fetch (Card NoteFile) of SourceCard) (NC.FetchTitle DestCard) T (create CrossFileLinkSubstance CrossFileLinkDestCardUID ← (fetch (Card UID) of DestCard) CrossFileLinkDestNoteFileUID ← (fetch (NoteFile UID) of DestNoteFile) CrossFileLinkDestFileHint ← (PACKFILENAME (QUOTE VERSION) NIL (QUOTE BODY) (fetch (NoteFile FullFileName) of DestNoteFile)) CrossFileLinkTwoWayFlg ← TwoWayFlg))) (* Indicate that card was just created.) CrossFileLinkCard]) (NC.CrossFileLinkCardP (LAMBDA (Card) (* rht: " 6-Oct-86 10:49") (* * Return non-nil if card is a crossfilelink card.) (EQ (NC.FetchType Card) (QUOTE CrossFileLink)))) (NC.OpenCrossFileLinkDestNoteFile [LAMBDA (DestNoteFile DestFileName InterestedWindow) (* pmi: "20-May-87 18:26") (* * If DestNoteFile is an open notefile, then fine. Otherwise get file names from user and keep trying to open until she gives up.) (* * pmi 5/20/87: Removed HashArray argument in calls to NC.OpenNoteFile.) (LET ([Menu (create MENU ITEMS ← (QUOTE (Open% Read/Write Open% Read-Only Cancel)) MENUFONT ← (FONTCREATE (QUOTE HELVETICA) 12 (QUOTE BOLD)) MENUROWS ← 1 MENUBORDERSIZE ← 1 ITEMHEIGHT ← 20 MENUTITLEFONT ← (FONTCREATE (QUOTE HELVETICA) 12 (QUOTE BOLD] ReadOnlyOpenFlg) (if (NCP.OpenNoteFileP DestNoteFile) then DestNoteFile else (for while (OR DestFileName (SETQ DestFileName (NC.AskUser "File name to try opening: " NIL NIL T InterestedWindow))) do (replace (MENU TITLE) of Menu with (CONCAT "OPEN " DestFileName "?")) (if [AND (SELECTQ (MENU Menu) (Open% Read/Write (SETQ ReadOnlyOpenFlg NIL) T) (Open% Read-Only (SETQ ReadOnlyOpenFlg T)) (Cancel (RETURN NIL)) (RETURN NIL)) (NCP.OpenNoteFileP (SETQ DestNoteFile (NC.OpenNoteFile (OR DestNoteFile DestFileName) NIL NIL NIL NIL NIL NIL NIL InterestedWindow NIL NIL NIL ReadOnlyOpenFlg] then (RETURN DestNoteFile) else (NC.PrintMsg InterestedWindow T "Couldn't open " DestFileName "." (CHARACTER 13)) (SETQ DestFileName (SETQ DestNoteFile NIL)) (if (NOT (NC.AskYesOrNo "Want to try opening a different notefile? " NIL "Yes" NIL InterestedWindow)) then (RETURN NIL]) ) (DEFINEQ (NC.AddCrossFileLink [LAMBDA NIL (* rht: "20-Nov-86 00:04") (* * rht 11/19/86: Added LinkIconAttachedBitMap field.) (DECLARE (GLOBALVARS NC.CrossFileLinkIcon)) (NC.AddCardType (QUOTE CrossFileLink) (QUOTE NoteCard) [BQUOTE ((MakeFn , (FUNCTION NC.CrossFileLinkMakeFn)) (EditFn , (FUNCTION NC.CrossFileLinkEditFn)) (GetFn , (FUNCTION NC.CrossFileLinkGetFn)) (PutFn , (FUNCTION NC.CrossFileLinkPutFn)) (CopyFn , (FUNCTION NC.CrossFileLinkCopyFn)) (MarkDirtyFn , (FUNCTION NILL)) (DirtyPFn , (FUNCTION NILL)) (QuitFn , (FUNCTION NILL)) (DeleteLinksFn , (FUNCTION NILL)) (InsertLinkFn , (FUNCTION NILL)) (CollectLinksFn , (FUNCTION NILL)) (UpdateLinkIconsFn , (FUNCTION NILL)) (TranslateWindowPositionFn , (FUNCTION NILL] (BQUOTE ((LinkAnchorModesSupported NIL) (LinkDisplayMode , (NC.InsureLinkDisplayMode (QUOTE Title))) (LinkIconAttachedBitMap , NC.CrossFileLinkIcon]) (NC.CrossFileLinkCopyFn (LAMBDA (Card FromStream ToStream Length) (* rht: " 3-Oct-86 20:20") (* * Copy a CrossFileLink substance from FromStream to ToStream.) (LET* ((FromStartPtr (GETFILEPTR FromStream)) (FromEndPtr (PLUS Length FromStartPtr))) (COPYBYTES FromStream ToStream FromStartPtr FromEndPtr)) T)) (NC.CrossFileLinkMakeFn (LAMBDA (Card Title NoDisplayFlg CrossFileLinkSubstance) (* rht: " 3-Oct-86 20:42") (* * Make a CrossFileLink substance.) (NC.SetSubstance Card CrossFileLinkSubstance) Card)) (NC.CrossFileLinkEditFn [LAMBDA (Card Substance RegionOrPosition TypeSpecificArgs) (* rht: "17-Nov-86 17:55") (* * Given a CrossFileLink Substance, try to find the corresponding destination card in the destination notefile and bring it up.) (* * rht 11/13/86: Now updates title of crossfile link card to be the same as destination card if necessary.) (LET ((DestinationCard (NC.GetCrossFileLinkDestCard Card)) DestinationCardTitle) (if DestinationCard then (if (NOT (STREQUAL (SETQ DestinationCardTitle (NC.RetrieveTitle DestinationCard)) (NC.FetchTitle Card))) then (NC.AssignTitle Card NIL DestinationCardTitle)) (NC.EditNoteCard DestinationCard RegionOrPosition TypeSpecificArgs]) (NC.CrossFileLinkGetFn [LAMBDA (Card Length Stream) (* rht: " 1-Nov-86 16:04") (* * Get the crossfilelink substance from the disk) (* * rht 11/1/86: Now uses our readtable when reading.) (DECLARE (GLOBALVARS NC.OrigReadTable)) (create CrossFileLinkSubstance CrossFileLinkDestCardUID ← (NC.ReadUID Stream) CrossFileLinkDestNoteFileUID ← (NC.ReadUID Stream) CrossFileLinkDestFileHint ← (READ Stream NC.OrigReadTable]) (NC.CrossFileLinkPutFn [LAMBDA (Card Stream) (* rht: " 1-Nov-86 16:03") (* * Put crossfilelink substance) (* * rht 11/1/86: Now uses our readtable when printing.) (DECLARE (GLOBALVARS NC.OrigReadTable)) (LET ((Substance (NC.FetchSubstance Card))) (NC.WriteUID Stream (fetch (CrossFileLinkSubstance CrossFileLinkDestCardUID) of Substance)) (NC.WriteUID Stream (fetch (CrossFileLinkSubstance CrossFileLinkDestNoteFileUID) of Substance)) (PRINT (fetch (CrossFileLinkSubstance CrossFileLinkDestFileHint) of Substance) Stream NC.OrigReadTable)) 0]) ) [DECLARE: EVAL@COMPILE (DATATYPE CrossFileLinkSubstance (CrossFileLinkDestCardUID CrossFileLinkDestNoteFileUID CrossFileLinkDestFileHint ( CrossFileLinkTwoWayFlg FLAG))) ] (/DECLAREDATATYPE (QUOTE CrossFileLinkSubstance) (QUOTE (POINTER POINTER POINTER FLAG)) [QUOTE ((CrossFileLinkSubstance 0 POINTER) (CrossFileLinkSubstance 2 POINTER) (CrossFileLinkSubstance 4 POINTER) (CrossFileLinkSubstance 4 (FLAGBITS . 0] (QUOTE 6)) (NC.AddCrossFileLink) (PUTPROP (QUOTE CrossFileLink) (QUOTE Don'tForceFilingFlg) T) (DEFINEQ (NCAddStub.CrossFileLink (LAMBDA NIL (* rht: " 4-Oct-86 00:36") (* * kirk 18Jun86 Add the CrossFileLink card stub) (NC.AddCardTypeStub (QUOTE CrossFileLink) (QUOTE NoteCard) (QUOTE NCCROSSFILELINKS)))) ) (PUTPROPS NCCROSSFILELINKS COPYRIGHT ("Xerox Corporation" 1986 1987)) (DECLARE: DONTCOPY (FILEMAP (NIL (1934 8964 (NC.GetCrossFileLinkDestCard 1944 . 5335) (NC.CreateCrossFileLinkCard 5337 . 6660) (NC.CrossFileLinkCardP 6662 . 6919) (NC.OpenCrossFileLinkDestNoteFile 6921 . 8962)) (8965 12908 (NC.AddCrossFileLink 8975 . 10106) (NC.CrossFileLinkCopyFn 10108 . 10492) (NC.CrossFileLinkMakeFn 10494 . 10733) (NC.CrossFileLinkEditFn 10735 . 11633) (NC.CrossFileLinkGetFn 11635 . 12177) ( NC.CrossFileLinkPutFn 12179 . 12906)) (13482 13799 (NCAddStub.CrossFileLink 13492 . 13797))))) STOP