(FILECREATED "23-Apr-87 19:47:08" {QV}<NOTECARDS>1.3K>NEXT>NCDOCUMENTCARD.;26 32988 changes to: (FNS NC.BuildMakeDocInspector NC.DumpExportableCardToDoc) previous date: "21-Apr-87 19:06:08" {QV}<NOTECARDS>1.3K>NEXT>NCDOCUMENTCARD.;25) (* Copyright (c) 1986, 1987 by Xerox Corporation. All rights reserved.) (PRETTYCOMPRINT NCDOCUMENTCARDCOMS) (RPAQQ NCDOCUMENTCARDCOMS ((* * Stuff for the Document compiler facility.) (FILES NCTEXTCARD) (GLOBALVARS NC.MakeDocParameters NC.DocBackPtrLinkLabel NC.SubBoxLinkLabel NC.FiledCardLinkLabel PSA.Database NC.SelectingCardMenu NC.CRString NC.DocTitleParaLeading) (VARS [NC.MakeDocParameters (QUOTE ((HeadingsFromFileboxes NumberedBold UnnumberedBold NONE) (TitlesFromNoteCards Bold NotBold NONE) (BuildBackLinks ToCardsBoxes ToCards ToBoxes NONE) (CopyEmbeddedLinks ALL NONE Select) (ExpandEmbeddedLinks ALL NONE Select) (--DONE--] (NC.CRString (CONCAT (CHARACTER 13))) (NC.DocTitleParaLeading 20)) (* * MakeDocument stuff) (FNS NC.MakeDocument NC.DumpCardToDoc NC.DumpFileBoxToDoc NC.DumpNoteCardToDoc NC.FetchToLinksInOrder NC.BuildMakeDocInspector NC.MakeDocInspectorSelectionFn NC.AddCRIfNeeded NC.ChangeParaLeading NC.DumpExportableCardToDoc) [P (SETPROPLIST (QUOTE NC.MakeDocParameters) (QUOTE (HeadingsFromFileboxes NumberedBold TitlesFromNoteCards Bold BuildBackLinks NONE CopyEmbeddedLinks ALL ExpandEmbeddedLinks NONE --DONE-- --CANCEL-- VALUE ((HeadingsFromFileboxes NumberedBold UnnumberedBold NONE) (TitlesFromNoteCards Bold NotBold NONE) (BuildBackpointers ToCardsBoxes ToCards ToBoxes NONE) (CopyEmbeddedLinks ALL NONE Select) (ExpandEmbeddedLinks ALL NONE Select) (--DONE--] (FNS NC.AddDocumentCard) (P (NC.AddDocumentCard)) (FNS NCAddStub.DocumentCard))) (* * Stuff for the Document compiler facility.) (FILESLOAD NCTEXTCARD) (DECLARE: DOEVAL@COMPILE DONTCOPY (GLOBALVARS NC.MakeDocParameters NC.DocBackPtrLinkLabel NC.SubBoxLinkLabel NC.FiledCardLinkLabel PSA.Database NC.SelectingCardMenu NC.CRString NC.DocTitleParaLeading) ) (RPAQQ NC.MakeDocParameters ((HeadingsFromFileboxes NumberedBold UnnumberedBold NONE) (TitlesFromNoteCards Bold NotBold NONE) (BuildBackLinks ToCardsBoxes ToCards ToBoxes NONE) (CopyEmbeddedLinks ALL NONE Select) (ExpandEmbeddedLinks ALL NONE Select) (--DONE--))) (RPAQ NC.CRString (CONCAT (CHARACTER 13))) (RPAQQ NC.DocTitleParaLeading 20) (* * MakeDocument stuff) (DEFINEQ (NC.MakeDocument [LAMBDA (Card Title NoDisplayFlg CardIdentifier) (* rht: "17-Apr-87 15:38") (* * 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.) (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] (* * 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.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.DumpCardToDoc [LAMBDA (Card DocCard DocStream CurSection SubSectionNum HeadingsFromFileboxes TitlesFromNoteCards BuildBackLinks CopyEmbeddedLinks ExpandEmbeddedLinks) (* rht: "20-Oct-86 17:00") (* * rht 10/15/86: Integrated markM's changes and fixed box numbering.) (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.DumpFileBoxToDoc [LAMBDA (FileBoxCard DocCard DocStream CurSection SubSectionNum HeadingsFromFileboxes TitlesFromNoteCards BuildBackLinks CopyEmbeddedLinks ExpandEmbeddedLinks) (* rht: "15-Oct-86 17:41") (* * 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.) (LET ((DocObject (TEXTOBJ DocStream)) 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))) (NCP.LocalGlobalLink NC.DocBackPtrLinkLabel DocCard FileBoxCard (QUOTE END) (QUOTE Icon))) (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: "15-Oct-86 17:52") (* * 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.) (LET ((CardStream (NC.FetchSubstance Card)) (DocObj (TEXTOBJ DocStream)) 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))) (NCP.LocalGlobalLink NC.DocBackPtrLinkLabel DocCard Card (QUOTE END) (QUOTE Icon))) (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]) (NC.FetchToLinksInOrder (LAMBDA (Card) (* fgh: "17-Nov-85 18:23") (* * Return the list of To links appearing in the text of ID in the order in which they appear.) (* * fgh 11/17/85 Updated to handle card object.) (for ObjectPair in (TEDIT.LIST.OF.OBJECTS (TEXTOBJ (NC.FetchSubstance Card)) (FUNCTION NC.LinkIconImageObjP)) collect (NC.FetchLinkFromLinkIcon (CAR ObjectPair))))) (NC.BuildMakeDocInspector [LAMBDA (MainWin) (* rht: "22-Apr-87 21:34") (* * Build and dislay an inspector window on the parameters for making documents.) (* * rht 10/3/85: No longer brings up prompt window.) (* * rht 4/22/87: Now tries to put inspect window in the right place so ATTACHWINDOW won't have to move it.) (DECLARE (GLOBALVARS NC.MakeDocParameters)) (LET ((Region (WINDOWREGION MainWin)) InspectWindow) (SETQ InspectWindow (INSPECTW.CREATE (QUOTE NC.MakeDocParameters) (for Item in NC.MakeDocParameters collect (CAR Item)) (FUNCTION GETPROP) NIL "Use left button to change values." NIL (FUNCTION NC.InspectorTitleCommandFn) "MakeDocument Parameters" (FUNCTION NC.MakeDocInspectorSelectionFn) (CREATEPOSITION (fetch (REGION LEFT) of Region) (ADD1 (fetch (REGION TOP) of Region))) NIL)) (ATTACHWINDOW InspectWindow MainWin (QUOTE TOP) (QUOTE LEFT) (QUOTE LOCALCLOSE)) (WINDOWPROP InspectWindow (QUOTE NoteCardsMakeDocInspector) T) InspectWindow]) (NC.MakeDocInspectorSelectionFn [LAMBDA (Property ValueFlg InspectWin) (* pmi: "25-Mar-87 15:05") (* * Called when user buttons in the make document inspector menu on the Property parameter. Put up a menu of choices for new values for this parameter.) (* * rht 11/17/84: Now can select --CANCEL--. Notice strange way of checking for --DONE-- versus --CANCEL--. This is because the Inspector package doesn't send the property name in Property arg if ValueFlg is on. That bug has been reported.) (* * rht 10/11/85: Fixed to have a more correct interface to NC.AskLinkLabel when need to Select.) (* * rht 10/22/85: Now uses ChangedFlg to prevent NIL from showing up as value in inspector.) (* * rht 8/8/86: Changed call from NCP.GetLinkLabels to NC.RetrieveLinkLabels. Also now allows selection of value as well as property.) (* * pmi 3/25/87: Added NC.MenuFont to all menus) (DECLARE (GLOBALVARS NC.MenuFont NC.MakeDocParameters)) (if (FMEMB Property (QUOTE (--DONE-- --CANCEL--))) then (DETACHWINDOW InspectWin) (CLOSEW InspectWin) (if ValueFlg then (PUTPROP (QUOTE NC.MakeDocParameters) (QUOTE --DONE--) (QUOTE QUIT))) NIL else (LET ((OldVal (GETPROP (QUOTE NC.MakeDocParameters) Property)) [Answer (MENU (create MENU ITEMS ← (CDR (FASSOC Property NC.MakeDocParameters)) TITLE ← "Choose New Value" MENUFONT ← NC.MenuFont CENTERFLG ← T ITEMHEIGHT ← (IPLUS (FONTPROP NC.MenuFont (QUOTE HEIGHT)) 1] Links ChangedFlg) [SETQ ChangedFlg (if (EQ Answer (QUOTE Select)) then (LET ((CardWin (MAINWINDOW InspectWin))) (SETQ Links (NC.AskLinkLabel CardWin T T NIL NIL NIL (COND ((LISTP OldVal)) ((EQ OldVal (QUOTE ALL)) (NC.RetrieveLinkLabels (fetch (Card NoteFile) of (NC.CoerceToCard CardWin)) T)) (T NIL)) T))) (if Links then (SETQ Answer (if (CAR Links) else (QUOTE NONE))) (NOT (EQUAL Answer OldVal))) else (AND Answer (NOT (EQUAL Answer OldVal] (if ChangedFlg then (PUTPROP (QUOTE NC.MakeDocParameters) Property Answer) (INSPECTW.REDISPLAY InspectWin Property)) (INSPECTW.SELECTITEM InspectWin) NIL]) (NC.AddCRIfNeeded (LAMBDA (Stream) (* rht: " 2-Oct-85 17:15") (* * Check last character of Stream. If not a CR, then add one.) (LET ((Len (fetch (TEXTOBJ TEXTLEN) of (TEXTOBJ Stream)))) (if (NOT (ZEROP Len)) then (SETFILEPTR Stream (SUB1 Len)) (if (NEQ 13 (BIN Stream)) then (NC.AppendStringToStream Stream NC.CRString)))))) (NC.ChangeParaLeading (LAMBDA (Stream) (* rht: "16-Sep-85 19:34") (* * Change the para leading on the text stream Stream using default value.) (LET ((TextObj (TEXTOBJ Stream))) (TEDIT.PARALOOKS TextObj (LIST (QUOTE PARALEADING) NC.DocTitleParaLeading) (fetch (TEXTOBJ TEXTLEN) of TextObj) 1)))) (NC.DumpExportableCardToDoc [LAMBDA (Card DocCard DocStream CurSection SubSectionNum HeadingsFromFileboxes TitlesFromNoteCards BuildBackLinks CopyEmbeddedLinks ExpandEmbeddedLinks CardType) (* rht: "22-Apr-87 20:52") (* * 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.) (DECLARE (GLOBALVARS NC.DocBackPtrLinkLabel)) (LET ((CardStream (NC.FetchSubstance Card)) (DocObj (TEXTOBJ DocStream)) 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))) (NCP.LocalGlobalLink NC.DocBackPtrLinkLabel DocCard Card (QUOTE END) (create LINKDISPLAYMODE ATTACHBITMAPFLG ← T))) (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.) (NCP.LocalGlobalLink LinkLabel DocCard ToCard (QUOTE END))) (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]) ) [SETPROPLIST (QUOTE NC.MakeDocParameters) (QUOTE (HeadingsFromFileboxes NumberedBold TitlesFromNoteCards Bold BuildBackLinks NONE CopyEmbeddedLinks ALL ExpandEmbeddedLinks NONE --DONE-- --CANCEL-- VALUE ((HeadingsFromFileboxes NumberedBold UnnumberedBold NONE) (TitlesFromNoteCards Bold NotBold NONE) (BuildBackpointers ToCardsBoxes ToCards ToBoxes NONE) (CopyEmbeddedLinks ALL NONE Select) (ExpandEmbeddedLinks ALL NONE Select) (--DONE--] (DEFINEQ (NC.AddDocumentCard (LAMBDA NIL (* fgh: "14-Nov-85 22:11") (* * fgh 11/14/85 removed substance type param.) (NC.AddCardType (QUOTE Document) (QUOTE Text) (BQUOTE ((MakeFn , (FUNCTION NC.MakeDocument)))) (BQUOTE ((LinkDisplayMode Icon) (DefaultHeight 350) (DefaultWidth 350) (DisplayedInMenuFlg , T)))))) ) (NC.AddDocumentCard) (DEFINEQ (NCAddStub.DocumentCard (LAMBDA NIL (* rht: " 8-Nov-86 19:21") (* * kirk 18Jun86 Add the FileBox card stub) (NC.AddCardTypeStub (QUOTE Document) (QUOTE Text) (QUOTE NCDOCUMENTCARD) NIL (QUOTE ((DisplayedInMenuFlg . T))) (QUOTE (LinkIconAttachedBitMap))))) ) (PUTPROPS NCDOCUMENTCARD COPYRIGHT ("Xerox Corporation" 1986 1987)) (DECLARE: DONTCOPY (FILEMAP (NIL (2712 31487 (NC.MakeDocument 2722 . 8902) (NC.DumpCardToDoc 8904 . 10447) ( NC.DumpFileBoxToDoc 10449 . 14190) (NC.DumpNoteCardToDoc 14192 . 19748) (NC.FetchToLinksInOrder 19750 . 20272) (NC.BuildMakeDocInspector 20274 . 21609) (NC.MakeDocInspectorSelectionFn 21611 . 24407) ( NC.AddCRIfNeeded 24409 . 24890) (NC.ChangeParaLeading 24892 . 25319) (NC.DumpExportableCardToDoc 25321 . 31485)) (32026 32482 (NC.AddDocumentCard 32036 . 32480)) (32504 32898 (NCAddStub.DocumentCard 32514 . 32896))))) STOP