(FILECREATED " 9-Jun-87 00:04:12" {QV}<NOTECARDS>1.3K>NEXT>RHTPATCH272.;7 39541 changes to: (FNS NC.OpenNoteFile NC.OpenCrossFileLinkDestNoteFile NC.GetCrossFileLinkDestCard) (VARS RHTPATCH272COMS) previous date: " 4-Jun-87 16:16:04" {QV}<NOTECARDS>1.3K>NEXT>RHTPATCH272.;5) (* Copyright (c) 1987 by Xerox Corporation. All rights reserved.) (PRETTYCOMPRINT RHTPATCH272COMS) (RPAQQ RHTPATCH272COMS ((DECLARE: FIRST (P (NC.LoadFileFromDirectories (QUOTE NCDOCUMENTCARD)))) (* * Contains more cross-file link hacking. Includes ability for document cards to follow cross-file links and global parameter governing cross-file link mode. Also includes the new NC.AskUserWithMenu function which may be handy elsewhere.) (* * New function for NCUTILITIES) (FNS NC.AskUserWithMenu) (* * Changes to NCCROSSFILELINKS) (FNS NC.OpenCrossFileLinkDestNoteFile NC.AskCrossFileLinkMode NC.GetCrossFileLinkDestCard) (* * New stuff for NCPARAMETERS) (PROPS (NC.NoteCardsParameters NewCrossFileLinksMode)) (FNS NC.NewCrossFileLinksModeSelectionFn NC.NewCrossFileLinksModeCheckFn) (* * Following just for people loading this patchfile. Ignore at integration time.) (VARS (NC.NoteCardsParameters (PROPNAMES (QUOTE NC.NoteCardsParameters)))) (* * Changes to NCDOCUMENTCARD) (FNS NC.DumpCardToDoc NC.MakeDocument NC.DumpExportableCardToDoc NC.DumpFileBoxToDoc NC.DumpNoteCardToDoc))) (DECLARE: FIRST (NC.LoadFileFromDirectories (QUOTE NCDOCUMENTCARD)) ) (* * Contains more cross-file link hacking. Includes ability for document cards to follow cross-file links and global parameter governing cross-file link mode. Also includes the new NC.AskUserWithMenu function which may be handy elsewhere.) (* * New function for NCUTILITIES) (DEFINEQ (NC.AskUserWithMenu (LAMBDA (MenuItems Message InterestedWindow DontCloseAtEndFlg FlashFlg) (* rht: " 4-Jun-87 14:34") (* * Puts up a prompt window containing Message with an attached menu containing MenuItems and returns the selected menu item.) (LET ((Event (CREATE.EVENT (QUOTE AskUserWithMenu))) Menu MenuWindow PromptWin) (SETQ PromptWin (NC.PrintMsg InterestedWindow T Message)) (if FlashFlg then (FLASHWINDOW PromptWin)) (WINDOWPROP PromptWin (QUOTE AskUserWithMenu-Event) Event) (SETQ MenuWindow (ATTACHMENU (SETQ Menu (create MENU ITEMS ← MenuItems WHENSELECTEDFN ←(FUNCTION (LAMBDA (Item Menu Button) (LET ((Win (MAINWINDOW (WFROMMENU Menu)))) (WINDOWPROP Win (QUOTE AskUserWithMenu-SelectedItem) Item) (NOTIFY.EVENT (WINDOWPROP Win (QUOTE AskUserWithMenu-Event))))) ) MENUFONT ←(FONTCREATE (QUOTE HELVETICA) 14 (QUOTE BOLD)) MENUBORDERSIZE ← 1 ITEMHEIGHT ← 20)) PromptWin (COND ((EQ PromptWin PROMPTWINDOW) (QUOTE BOTTOM)) (T (QUOTE TOP))) (QUOTE LEFT))) (ALLOW.BUTTON.EVENTS) (AWAIT.EVENT Event) (DELETEMENU Menu T) (DETACHWINDOW MenuWindow) (OR DontCloseAtEndFlg (NC.ClearMsg InterestedWindow T)) (* Return the selected menu item and trash that WINDOWPROP at the same time just to be safe.) (WINDOWPROP PromptWin (QUOTE AskUserWithMenu-SelectedItem) NIL)))) ) (* * Changes to NCCROSSFILELINKS) (DEFINEQ (NC.OpenCrossFileLinkDestNoteFile (LAMBDA (DestNoteFile DestFileName InterestedWindow CrossFileLinkCard) (* rht: " 8-Jun-87 11:39") (* * If DestNoteFile is an open notefile, then fine. Otherwise get file names from user and keep trying to open until she gives up.) (* * rht 5/25/87: Minor change: no longer passes InterestedWindow to NC.OpenNoteFile.) (* * rht 6/3/87: Now calls new function NC.AskUserWithMenu. Added CrossFileLinkCard argument whose title is used to construct Message.) (* * rht 6/8/87: Now computes WasOpenPromptWindowFlg) (OR InterestedWindow (NC.CoerceToInterestedWindow CrossFileLinkCard)) (LET ((WasOpenPromptWindowFlg (NC.PromptWindowOpenP InterestedWindow))) (if (NCP.OpenNoteFileP DestNoteFile) then DestNoteFile else (LET ((MenuItems (QUOTE (Read/Write Read-Only Don't% Open)))) (for while (OR DestFileName (SETQ DestFileName (NC.AskUser "File name to try opening: " NIL NIL T InterestedWindow WasOpenPromptWindowFlg))) do (LET ((Message (if (NC.ValidCardP CrossFileLinkCard) then (CONCAT "Open " DestFileName " to look for '" (NC.RetrieveTitle CrossFileLinkCard) "'?") else (CONCAT "OPEN " DestFileName "?"))) ReadOnlyOpenFlg) (if (AND (SELECTQ (NC.AskUserWithMenu MenuItems Message InterestedWindow WasOpenPromptWindowFlg T) (Read/Write (SETQ ReadOnlyOpenFlg NIL) T) (Read-Only (SETQ ReadOnlyOpenFlg T)) (Don't% Open (RETURN NIL)) (RETURN NIL)) (NCP.OpenNoteFileP (SETQ DestNoteFile (NC.OpenNoteFile (OR DestNoteFile DestFileName) NIL NIL NIL NIL NIL NIL NIL NIL 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? " " -- " "Yes" NIL InterestedWindow WasOpenPromptWindowFlg)) then (RETURN NIL)))))))))) (NC.AskCrossFileLinkMode (LAMBDA (DestCard InterestedWindow) (* rht: " 4-Jun-87 14:58") (* * Ask the user whether to make the link be twoway or oneway. Return T if user says two-way. If dest notefile is open read-only, then only choice is one-way so don't ask.) (LET* ((NoteFile (fetch (Card NoteFile) of DestCard)) (FullFileName (fetch (NoteFile FullFileName) of NoteFile))) (if (NC.ReadOnlyNoteFileP NoteFile) then NIL else (NC.AskYesOrNo (CONCAT "Okay to make cross-file link to '" (NC.RetrieveTitle DestCard) "' in '" (FILENAMEFIELD FullFileName (QUOTE NAME)) ";" (FILENAMEFIELD FullFileName (QUOTE VERSION)) "' be TWOWAY?" (CHARACTER 13) "(otherwise leaves no record of link in destination notefile) ") " -- " "Yes" T InterestedWindow))))) (NC.GetCrossFileLinkDestCard (LAMBDA (CrossFileLinkCard InterestedWindow Don'tOpenDestNoteFileFlg) (* rht: " 8-Jun-87 11:39") (* * 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.) (* * rht 5/27/87: New arg Don'tOpenDestNoteFileFlg. If non-nil, then destination notefile has to be already open.) (* * rht 6/4/87: Now passes CrossFileLinkCard to NC.OpenCrossFileLinkDestNoteFile.) (* * rht 6/8/87: Now computes WasOpenPromptWindowFlg) (LET ((Title (NC.FetchTitle CrossFileLinkCard)) (SourceNoteFile (fetch (Card NoteFile) of CrossFileLinkCard)) Substance DestNoteFileUID DestFileHint DestCardUID DestNoteFile DestFileName Card WasOpenPromptWindowFlg) (OR InterestedWindow (SETQ InterestedWindow (NC.CoerceToInterestedWindow SourceNoteFile))) (SETQ WasOpenPromptWindowFlg (NC.PromptWindowOpenP InterestedWindow)) (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 (if Don'tOpenDestNoteFileFlg then (NCP.OpenNoteFileP DestNoteFile) else (SETQ DestNoteFile (NC.OpenCrossFileLinkDestNoteFile DestNoteFile DestFileName InterestedWindow CrossFileLinkCard))) bind 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 (if Don'tOpenDestNoteFileFlg then (RETURN NIL) 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? " " -- " "Yes" NIL InterestedWindow WasOpenPromptWindowFlg)) then (RETURN NIL) else (SETQ DestNoteFile (SETQ DestFileName NIL))))))))) ) (* * New stuff for NCPARAMETERS) (PUTPROPS NC.NoteCardsParameters NewCrossFileLinksMode (NC.NewCrossFileLinksMode EVAL NC.NewCrossFileLinksModeSelectionFn NC.NewCrossFileLinksModeCheckFn)) (DEFINEQ (NC.NewCrossFileLinksModeSelectionFn (LAMBDA (GlobalVar) (* rht: " 3-Jun-87 18:13") (* * Ask user for new value from a menu of choices.) (DECLARE (GLOBALVARS NC.MenuFont)) (OR (MENU (create MENU ITEMS ←(QUOTE ((Two-way (QUOTE TWOWAY) "Make new cross-file links be two-way, i.e. back link is created in destination notefile.") (One-way (QUOTE ONEWAY) "Make new cross-file links be one-way, i.e. no record of link is made in destination notefile.") (Ask% User (QUOTE ASK) "Ask user to find out whether cross-file link should be one-way or two-way."))) TITLE ← "New cross-file links mode" CENTERFLG ← T MENUFONT ← NC.MenuFont ITEMHEIGHT ←(IPLUS (FONTPROP NC.MenuFont (QUOTE HEIGHT)) 1))) (QUOTE NOTCHANGED)))) (NC.NewCrossFileLinksModeCheckFn (LAMBDA (CandidateVar) (* rht: " 3-Jun-87 18:07") (* * Check candidate against list of possible values.) (FMEMB CandidateVar (QUOTE (TWOWAY ONEWAY ASK))))) ) (* * Following just for people loading this patchfile. Ignore at integration time.) (RPAQ NC.NoteCardsParameters (PROPNAMES (QUOTE NC.NoteCardsParameters))) (* * Changes to NCDOCUMENTCARD) (DEFINEQ (NC.DumpCardToDoc (LAMBDA (Card DocCard DocStream CurSection SubSectionNum HeadingsFromFileboxes TitlesFromNoteCards BuildBackLinks CopyEmbeddedLinks ExpandEmbeddedLinks) (* rht: " 4-Jun-87 11:31") (* * rht 10/15/86: Integrated markM's changes and fixed box numbering.) (* * rht 6/4/87: Now handles cross file links.) (LET ((Title (NC.RetrieveTitle Card))) (if (AND (NC.CrossFileLinkCardP Card) (NOT (SETQ Card (NC.GetCrossFileLinkDestCard Card ( NC.CoerceToInterestedWindow DocCard))))) then (NC.PrintMsg NIL NIL "Couldn't follow cross-file link to " Title (CHARACTER 13)) else (LET ((Type (NC.RetrieveType Card))) (COND ((OR (NCP.SketchBasedP Card) (NCP.GraphBasedP Card) (GETPROP Type (QUOTE ExportSubstanceFn))) (NC.ActivateCardAndDo Card (NC.DumpExportableCardToDoc Card DocCard DocStream CurSection SubSectionNum HeadingsFromFileboxes TitlesFromNoteCards BuildBackLinks CopyEmbeddedLinks ExpandEmbeddedLinks Type))) ((NCP.FileBoxP Card) (NC.ActivateCardAndDo Card (NC.DumpFileBoxToDoc Card DocCard DocStream CurSection SubSectionNum HeadingsFromFileboxes TitlesFromNoteCards BuildBackLinks CopyEmbeddedLinks ExpandEmbeddedLinks))) ((NCP.TextBasedP Card) (NC.ActivateCardAndDo Card (NC.DumpNoteCardToDoc Card DocCard DocStream CurSection SubSectionNum HeadingsFromFileboxes TitlesFromNoteCards BuildBackLinks CopyEmbeddedLinks ExpandEmbeddedLinks))) (T (NC.PrintMsg NIL NIL "Can't make document from non-exportable card " (NC.RetrieveTitle Card) (CHARACTER 13)) SubSectionNum))))))) (NC.MakeDocument (LAMBDA (Card Title NoDisplayFlg CardIdentifier) (* rht: " 4-Jun-87 12:14") (* * Called from a filebox's title bar. Makes a document by smashing all the descendant cards's text together. Ask user if wants numbered section headings and titles. The former are made from FileBox titles, the latter from notecard titles. Delete embedded links at the end if the user desires.) (* * rht 10/22/84: Hacked to be callable from Programmer's interface.) (* * rht 11/17/84: Checks for cancel when choosing rootID and also when setting parameters.) (* * rht 8/25/85: Now dumps sketch and graph cards as well as text cards.) (* * rht 9/16/85: Now handles cr's around titles using para leading.) (* * fgh 11/178/85 Updated to handle Card and NoteFile objects.) (* * kirk 27Jun86 Moved NC.RetrieveTitle call so does not break when user Cancels) (* * rht 7/31/86: Now checks for card types having ExportSubstanceFn prop.) (* * kirk 8/22/86 Fix of free use of NoteFile var) (* * rht 10/15/86: Integrated markM's changes and fixed box numbering.) (* * rht 11/17/86: Now calls NC.ApplySupersFn rather than NC.MakeNoteCard.) (* * 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.) (* * rg 3/16/87 NC.DeleteNoteCards -> NC.DeleteNoteCard) (* * rg 3/18/87 added NC.CardSelectionOperation wrapper. Still needs ProtectedCardOperation wrapper!) (* * rg 4/2/87 changed NC.CardSelectionOperation to NCP.WithLockedCards) (* * rht 4/17/87: No longer bugs user for confirm of delete when cancel'ing.) (* * rht 6/4/87: Now stashes on doc card a prop list of destination notefiles of cross-file links encountered during creation of contents.) (NCP.WithLockedCards (PROG (RootCard RootTitle DocWindow DocCard DocWindowOrCard DocStream HeadingsFromFileboxes TitlesFromNoteCards BuildBackLinks CopyEmbeddedLinks ExpandEmbeddedLinks InspectWin RootSubstanceType) (OR NoDisplayFlg (SPAWN.MOUSE)) (SETQ DocWindowOrCard (NC.ApplySupersFn MakeFn Card "Document" NoDisplayFlg)) (if NoDisplayFlg then (SETQ DocWindow NIL) (SETQ DocCard DocWindowOrCard) else (SETQ DocWindow DocWindowOrCard) (SETQ DocCard (NC.CoerceToCard DocWindow))) (* NC.MakeNoteCard either returned an Card or a window depending on NoDisplayFlg.) (SETQ RootCard (OR (NC.CoerceToCard CardIdentifier) (NC.SelectNoteCards T NIL NC.SelectingCardMenu DocWindow "Please shift-select the Note Card or File Box the document should start from."))) (if (NOT RootCard) then (NC.DeleteNoteCard Card NIL T) (RETURN NIL)) (SETQ RootTitle (NC.RetrieveTitle RootCard)) (NC.SetTitle DocCard (CONCAT "Document from %"" RootTitle "%"")) (AND DocWindow (WINDOWPROP DocWindow (QUOTE TITLE) (NC.RetrieveTitle DocCard))) (SETQ DocStream (NC.FetchSubstance DocCard)) (* * Get MakeDocument parameters from user via inspector window.) (if (NOT NoDisplayFlg) then (SETQ InspectWin (NC.BuildMakeDocInspector DocWindow)) (TOTOPW InspectWin) (for while (OPENWP InspectWin) do (BLOCK))) (if (EQ (GETPROP (QUOTE NC.MakeDocParameters) (QUOTE --DONE--)) (QUOTE QUIT)) then (PUTPROP (QUOTE NC.MakeDocParameters) (QUOTE --DONE--) (QUOTE --CANCEL--)) (NC.DeleteNoteCard Card NIL T) (RETURN NIL)) (SETQ HeadingsFromFileboxes (GETPROP (QUOTE NC.MakeDocParameters) (QUOTE HeadingsFromFileboxes))) (SETQ TitlesFromNoteCards (GETPROP (QUOTE NC.MakeDocParameters) (QUOTE TitlesFromNoteCards)) ) (SETQ BuildBackLinks (GETPROP (QUOTE NC.MakeDocParameters) (QUOTE BuildBackLinks))) (SETQ CopyEmbeddedLinks (GETPROP (QUOTE NC.MakeDocParameters) (QUOTE CopyEmbeddedLinks))) (SETQ ExpandEmbeddedLinks (GETPROP (QUOTE NC.MakeDocParameters) (QUOTE ExpandEmbeddedLinks)) ) (* * Call recursive routine to dump filebox.) (RESETLST (RESETSAVE (CURSOR WAITINGCURSOR)) (NC.PrintMsg DocWindow NIL "Collecting text from descendant cards ... ") (* * Clean up the SeenBefore markers placed on the cards and boxes just copied.) (RESETSAVE NIL (QUOTE (PROGN (for Card in (NC.FetchUserDataProp DocCard (QUOTE SeenCards)) do (NC.SetUserDataProp Card (QUOTE SeenBefore) NIL)) (NC.SetUserDataProp DocCard (QUOTE SeenCards) NIL)))) (* Clean up the CrossFileLinkModePropList hung off the Doccard.) (RESETSAVE NIL (QUOTE (PROGN (NC.SetUserDataProp DocCard (QUOTE CrossFileLinkModePropList) NIL)))) (* * Unbelievably kludgy hack to get around Intermezzo TEdit bug. Just insert and delete a CR.) (TEDIT.INSERT DocStream NC.CRString 1) (TEDIT.DELETE DocStream 1 1) (NC.SetUserDataProp DocCard (QUOTE CrossFileLinkModePropList) (LIST (fetch (Card NoteFile) of DocCard) NIL)) (NC.DumpCardToDoc RootCard DocCard DocStream 0 0 HeadingsFromFileboxes TitlesFromNoteCards BuildBackLinks CopyEmbeddedLinks ExpandEmbeddedLinks) (NC.PrintMsg DocWindow NIL "Done!")) (COND ((NOT NoDisplayFlg) (BLOCK 250) (NC.ClearMsg DocWindow T))) (RETURN DocWindowOrCard))))) (NC.DumpExportableCardToDoc (LAMBDA (Card DocCard DocStream CurSection SubSectionNum HeadingsFromFileboxes TitlesFromNoteCards BuildBackLinks CopyEmbeddedLinks ExpandEmbeddedLinks CardType) (* rht: " 4-Jun-87 12:29") (* * Dump the CardID sketch or graph card to the document card DocStream.) (* * rht 9/16/85: Now handles cr's around titles using para leading.) (* * fgh 11/17/85 Updated to handle card objects and removal of SubstanceTypes.) (* * rht 7/31/86: Now can handle other card types than Graph or Sketch based ones, but they must have an appropriate fn on the ExportSubstanceFn property of the atom. That fn should return either an imageobj or a textstream.) (* * rht 8/11/86: Added ShrunkenFlg so that Card is reshrunk afterwards if necessary.) (* * rht 10/15/86: Integrated markM's changes and fixed box numbering.) (* * rht 10/31/86: Now uses TEDIT.COPY rather than TEDIT.INCLUDE because the latter loses formatting info.) (* * rht 3/26/87: Fixed bug whereby links in sketch cards weren't getting smashed to "external" link icons. Now calls NC.MakeExternalSketchCopy.) (* * rht 4/22/87: Now expects NC.MakeExternalSketchCopy to return an imageobj.) (* * rht 6/4/87: Now calls NC.MakeLink rather than NCP.LocalGlobalLink and handles computes proper cross-file links mode.) (DECLARE (GLOBALVARS NC.DocBackPtrLinkLabel)) (LET ((CardStream (NC.FetchSubstance Card)) (DocObj (TEXTOBJ DocStream)) (InterestedWindow (NC.CoerceToInterestedWindow DocCard)) ShrunkenFlg OldLoc ThingToInsert) (NC.AddCRIfNeeded DocStream) (SETQ OldLoc (fetch (TEXTOBJ TEXTLEN) of DocObj)) (AND (NEQ TitlesFromNoteCards (QUOTE NONE)) (NC.AppendStringToStream DocStream (CONCAT (NC.RetrieveTitle Card)) (EQ TitlesFromNoteCards (QUOTE Bold)))) (AND (FMEMB BuildBackLinks (QUOTE (ToCards ToCardsBoxes))) (NC.AddLinkToCard DocCard (NC.MakeLink NIL NC.DocBackPtrLinkLabel Card DocCard (create LINKDISPLAYMODE ATTACHBITMAPFLG ← T) NIL NIL NIL NIL (NC.ComputeCrossFileLinkMode Card (NC.FetchUserDataProp DocCard (QUOTE CrossFileLinkModePropList)) InterestedWindow)) Card)) (if (GREATERP (fetch (TEXTOBJ TEXTLEN) of DocObj) OldLoc) then (NC.AddCRIfNeeded DocStream) (NC.ChangeParaLeading DocStream)) (if (NOT (NC.FetchUserDataProp Card (QUOTE SeenBefore))) then (SETQ ShrunkenFlg (NC.GetShrunkenWin Card)) (NC.SetUserDataProp DocCard (QUOTE SeenCards) (CONS Card (NC.FetchUserDataProp DocCard (QUOTE SeenCards)))) (NC.SetUserDataProp Card (QUOTE SeenBefore) T) (* * Stick an imageobj made from the card into the document. Also might be a textstream computed by the card type's ExportSubstanceFn.) (SETQ ThingToInsert (if (NCP.GraphBasedP CardType) then (GRAPHEROBJ CardStream) elseif (NCP.SketchBasedP CardType) then (NC.MakeExternalSketchCopy (OR ( NC.FetchWindow Card) CardStream)) elseif (LET ((ExportSubstanceFn (GETPROP CardType (QUOTE ExportSubstanceFn)))) (AND ExportSubstanceFn (APPLY* ExportSubstanceFn CardStream))))) (AND CardStream (if (IMAGEOBJP ThingToInsert) then (TEDIT.INSERT.OBJECT ThingToInsert DocStream) elseif (TEXTSTREAMP ThingToInsert) then (TEDIT.COPY (TEDIT.SETSEL ThingToInsert 1 (fetch TEXTLEN of (TEXTOBJ ThingToInsert))) (TEDIT.SETSEL DocStream (fetch TEXTLEN of DocObj) 1 (QUOTE RIGHT))))) (* * Step through list of notecard imageobjs in the card we're working on and either expand or copy or ignore each according to values of ExpandEmbeddedLinks and CopyEmbeddedLinks.) (for Link in (CAR (NC.CollectReferences Card NIL NIL NIL)) bind LinkLabel ToCard ToCardType ActiveFlg ExpandFlg CopyFlg AlreadyExpanded eachtime (BLOCK) do (SETQ LinkLabel (fetch (Link Label) of Link)) (SETQ CopyFlg (OR (EQ CopyEmbeddedLinks (QUOTE ALL)) (AND (LISTP CopyEmbeddedLinks) (FMEMB LinkLabel CopyEmbeddedLinks)))) (SETQ ExpandFlg (OR (EQ ExpandEmbeddedLinks (QUOTE ALL)) (AND (LISTP ExpandEmbeddedLinks) (FMEMB LinkLabel ExpandEmbeddedLinks)))) (if (AND (SETQ AlreadyExpanded (NC.FetchUserDataProp (SETQ ToCard (fetch (Link DestinationCard) of Link)) (QUOTE SeenBefore))) ExpandFlg) then (NC.PrintMsg NIL NIL (NC.RetrieveTitle ToCard) " only expanded once in this cycle." (CHARACTER 13))) (if (OR CopyFlg (AND ExpandFlg AlreadyExpanded)) then (* Copy this link.) (NC.AddLinkToCard DocCard (NC.MakeLink NIL LinkLabel ToCard DocCard NIL NIL NIL NIL NIL ( NC.ComputeCrossFileLinkMode ToCard (NC.FetchUserDataProp DocCard (QUOTE CrossFileLinkModePropList)) InterestedWindow)) ToCard)) (if (AND ExpandFlg (NOT AlreadyExpanded)) then (* Expand this link. Check type and make recursive call.) (SETQ SubSectionNum (NC.DumpCardToDoc ToCard DocCard DocStream CurSection SubSectionNum HeadingsFromFileboxes TitlesFromNoteCards BuildBackLinks CopyEmbeddedLinks ExpandEmbeddedLinks))) finally (TEDIT.SETSEL DocStream (ADD1 (fetch TEXTLEN of DocObj)) 0 (QUOTE RIGHT))) (NC.SetUserDataProp Card (QUOTE SeenBefore) NIL) (AND ShrunkenFlg (SHRINKW (NC.FetchWindow Card))) else (NC.PrintMsg NIL NIL (NC.RetrieveTitle Card) " only expanded once in this cycle." (CHARACTER 13))) SubSectionNum))) (NC.DumpFileBoxToDoc (LAMBDA (FileBoxCard DocCard DocStream CurSection SubSectionNum HeadingsFromFileboxes TitlesFromNoteCards BuildBackLinks CopyEmbeddedLinks ExpandEmbeddedLinks) (* rht: " 4-Jun-87 12:28") (* * Dump the contents of FileboxID to DocStream by recursively dumping all of its children. Keep track of the section numbers in case HeadingsFromFileboxes = Numbered. Insert back pointers to the source cards and/or boxes depending on value of BuildBackpointers. Embedded links (or some subset of them) may be copied or expanded depending on the values of CopyEmbeddedLinks and ExpandEmbeddedLinks.) (* * rht 8/25/85: Fixed to handle sketch and graph cards.) (* * rht 9/16/85: Now handles cr's around titles using para leading.) (* * fgh 11/178/85 Updated to handle Card and NoteFile objects.) (* * rht 7/31/86: Now checks for card types having ExportSubstanceFn prop.) (* * rht 8/11/86: Added ShrunkenFlg so that FileBoxCard is reshrunk afterwards if necessary.) (* * rht 10/15/86: Integrated markM's changes and fixed box numbering.) (* * rht 6/4/87: Now calls NC.MakeLink rather than NCP.LocalGlobalLink and handles computes proper cross-file links mode.) (LET ((DocObject (TEXTOBJ DocStream)) (InterestedWindow (NC.CoerceToInterestedWindow DocCard)) ShrunkenFlg OldLoc) (NC.AddCRIfNeeded DocStream) (SETQ OldLoc (fetch (TEXTOBJ TEXTLEN) of DocObject)) (if (AND (EQ HeadingsFromFileboxes (QUOTE NumberedBold)) (NOT (ZEROP SubSectionNum))) then (SETQ CurSection (if (ZEROP CurSection) then SubSectionNum else (CONCAT CurSection "." SubSectionNum))) (NC.AppendStringToStream DocStream (CONCAT CurSection " ") T)) (AND (NEQ HeadingsFromFileboxes (QUOTE NONE)) (NC.AppendStringToStream DocStream (CONCAT (NC.RetrieveTitle FileBoxCard)) T)) (AND (FMEMB BuildBackLinks (QUOTE (ToBoxes ToCardsBoxes))) (NC.AddLinkToCard DocCard (NC.MakeLink NIL NC.DocBackPtrLinkLabel FileBoxCard DocCard (create LINKDISPLAYMODE ATTACHBITMAPFLG ← T) NIL NIL NIL NIL (NC.ComputeCrossFileLinkMode FileBoxCard (NC.FetchUserDataProp DocCard (QUOTE CrossFileLinkModePropList)) InterestedWindow)) FileBoxCard)) (if (GREATERP (fetch (TEXTOBJ TEXTLEN) of DocObject) OldLoc) then (NC.AddCRIfNeeded DocStream) (NC.ChangeParaLeading DocStream)) (if (NOT (NC.FetchUserDataProp FileBoxCard (QUOTE SeenBefore))) then (SETQ ShrunkenFlg (NC.GetShrunkenWin FileBoxCard)) (NC.SetUserDataProp DocCard (QUOTE SeenCards) (CONS FileBoxCard (NC.FetchUserDataProp DocCard (QUOTE SeenCards)))) (NC.SetUserDataProp FileBoxCard (QUOTE SeenBefore) T) (for Link in (NC.FetchToLinksInOrder FileBoxCard) bind (SubSectionCounter ← 1) eachtime (BLOCK) when (FMEMB (fetch (Link Label) of Link) (LIST NC.FiledCardLinkLabel NC.SubBoxLinkLabel)) do (LET ((ChildCard (fetch (Link DestinationCard) of Link))) (SETQ SubSectionCounter (NC.DumpCardToDoc ChildCard DocCard DocStream CurSection SubSectionCounter HeadingsFromFileboxes TitlesFromNoteCards BuildBackLinks CopyEmbeddedLinks ExpandEmbeddedLinks)))) (NC.SetUserDataProp FileBoxCard (QUOTE SeenBefore) NIL) (AND ShrunkenFlg (SHRINKW (NC.FetchWindow FileBoxCard))) (ADD1 SubSectionNum) else (NC.PrintMsg NIL NIL (NC.RetrieveTitle FileBoxCard) " only expanded once in this cycle.") SubSectionNum)))) (NC.DumpNoteCardToDoc (LAMBDA (Card DocCard DocStream CurSection SubSectionNum HeadingsFromFileboxes TitlesFromNoteCards BuildBackLinks CopyEmbeddedLinks ExpandEmbeddedLinks) (* rht: " 4-Jun-87 12:27") (* * Dump the CardID notecard to the document card DocStream.) (* * rht 8/25/85: Fixed to handle sketch and graph cards.) (* * rht 9/16/85: Now handles cr's around titles using para leading.) (* * fgh 11/178/85 Updated to handle Card and NoteFile objects.) (* * rht 7/31/86: Now checks for card types having ExportSubstanceFn prop.) (* * rht 8/11/86: Added ShrunkenFlg so that Card is reshrunk afterwards if necessary.) (* * rht 10/15/86: Integrated markM's changes and fixed box numbering.) (* * rht 6/4/87: Now calls NC.MakeLink rather than NCP.LocalGlobalLink and handles computes proper cross-file links mode.) (LET ((CardStream (NC.FetchSubstance Card)) (DocObj (TEXTOBJ DocStream)) (InterestedWindow (NC.CoerceToInterestedWindow DocCard)) ShrunkenFlg CardObj OldLoc) (SETQ CardObj (TEXTOBJ CardStream)) (NC.AddCRIfNeeded DocStream) (SETQ OldLoc (fetch (TEXTOBJ TEXTLEN) of DocObj)) (AND (NEQ TitlesFromNoteCards (QUOTE NONE)) (NC.AppendStringToStream DocStream (CONCAT (NC.RetrieveTitle Card)) (EQ TitlesFromNoteCards (QUOTE Bold)))) (AND (FMEMB BuildBackLinks (QUOTE (ToCards ToCardsBoxes))) (NC.AddLinkToCard DocCard (NC.MakeLink NIL NC.DocBackPtrLinkLabel Card DocCard (create LINKDISPLAYMODE ATTACHBITMAPFLG ← T) NIL NIL NIL NIL (NC.ComputeCrossFileLinkMode Card (NC.FetchUserDataProp DocCard (QUOTE CrossFileLinkModePropList)) InterestedWindow)) Card)) (if (GREATERP (fetch (TEXTOBJ TEXTLEN) of DocObj) OldLoc) then (NC.AddCRIfNeeded DocStream) (NC.ChangeParaLeading DocStream)) (if (NOT (NC.FetchUserDataProp Card (QUOTE SeenBefore))) then (SETQ ShrunkenFlg (NC.GetShrunkenWin Card)) (NC.SetUserDataProp DocCard (QUOTE SeenCards) (CONS Card (NC.FetchUserDataProp DocCard (QUOTE SeenCards)))) (NC.SetUserDataProp Card (QUOTE SeenBefore) T) (* * Step through list of notecard imageobjs in the card we're working on and either expand or copy or ignore each according to values of ExpandEmbeddedLinks and CopyEmbeddedLinks.) (for Object in (TEDIT.LIST.OF.OBJECTS CardObj (FUNCTION NC.LinkIconImageObjP)) bind LinkSpec LinkLabel ToCard ToCardType (LastLoc ← 1) (CurLoc ← 0) ActiveP ExpandP CopyP AlreadyExpanded eachtime (BLOCK) do ((SETQ LinkSpec (NC.FetchLinkFromLinkIcon (CAR Object))) (SETQ LinkLabel (fetch (Link Label) of LinkSpec)) (SETQ CurLoc (CADR Object)) (* Copy over any text between this obj and the last.) (if (ILESSP LastLoc CurLoc) then (TEDIT.COPY (TEDIT.SETSEL CardStream LastLoc (IDIFFERENCE CurLoc LastLoc)) (TEDIT.SETSEL DocStream (fetch TEXTLEN of DocObj) 1 (QUOTE RIGHT)))) (SETQ LastLoc (ADD1 CurLoc)) (SETQ CopyP (OR (EQ CopyEmbeddedLinks (QUOTE ALL)) (AND (LISTP CopyEmbeddedLinks) (FMEMB LinkLabel CopyEmbeddedLinks)))) (SETQ ExpandP (OR (EQ ExpandEmbeddedLinks (QUOTE ALL)) (AND (LISTP ExpandEmbeddedLinks) (FMEMB LinkLabel ExpandEmbeddedLinks)))) (if (AND (SETQ AlreadyExpanded (NC.FetchUserDataProp (SETQ ToCard (fetch (Link DestinationCard) of LinkSpec)) (QUOTE SeenBefore))) ExpandP) then (NC.PrintMsg NIL NIL (NC.RetrieveTitle ToCard) " only expanded once in this cycle." (CHARACTER 13))) (if (OR CopyP (AND ExpandP AlreadyExpanded)) then (* Copy this link.) (TEDIT.COPY (TEDIT.SETSEL CardStream CurLoc 1) (TEDIT.SETSEL DocStream (ADD1 (fetch TEXTLEN of DocObj)) 0 (QUOTE RIGHT)))) (if (AND ExpandP (NOT AlreadyExpanded)) then (* Expand this link. Check type and make recursive call.) (SETQ SubSectionNum (NC.DumpCardToDoc ToCard DocCard DocStream CurSection SubSectionNum HeadingsFromFileboxes TitlesFromNoteCards BuildBackLinks CopyEmbeddedLinks ExpandEmbeddedLinks))) ) finally (COND ((ILESSP CurLoc (fetch TEXTLEN of CardObj)) (TEDIT.COPY (TEDIT.SETSEL CardStream LastLoc (IDIFFERENCE (fetch TEXTLEN of CardObj) CurLoc)) (TEDIT.SETSEL DocStream (ADD1 (fetch TEXTLEN of DocObj)) 0 (QUOTE RIGHT))))) (TEDIT.SETSEL DocStream (ADD1 (fetch TEXTLEN of DocObj)) 0 (QUOTE RIGHT))) (NC.SetUserDataProp Card (QUOTE SeenBefore) NIL) (AND ShrunkenFlg (SHRINKW (NC.FetchWindow Card))) else (NC.PrintMsg NIL NIL (NC.RetrieveTitle Card) " only expanded once in this cycle." (CHARACTER 13))) SubSectionNum))) ) (PUTPROPS RHTPATCH272 COPYRIGHT ("Xerox Corporation" 1987)) (DECLARE: DONTCOPY (FILEMAP (NIL (1874 3842 (NC.AskUserWithMenu 1884 . 3840)) (3883 11456 ( NC.OpenCrossFileLinkDestNoteFile 3893 . 6458) (NC.AskCrossFileLinkMode 6460 . 7453) ( NC.GetCrossFileLinkDestCard 7455 . 11454)) (11682 12910 (NC.NewCrossFileLinksModeSelectionFn 11692 . 12643) (NC.NewCrossFileLinksModeCheckFn 12645 . 12908)) (13117 39459 (NC.DumpCardToDoc 13127 . 15252) (NC.MakeDocument 15254 . 22113) (NC.DumpExportableCardToDoc 22115 . 29087) (NC.DumpFileBoxToDoc 29089 . 33359) (NC.DumpNoteCardToDoc 33361 . 39457))))) STOP