(FILECREATED "31-May-85 17:58:55" {PHYLUM}<NOTECARDS>RELEASE1.2I>FGHPATCH012.;7 13046 changes to: (FNS NC.GetTextSubstance NC.MakeTEditPropsList) previous date: "30-May-85 23:32:30" {PHYLUM}<NOTECARDS>RELEASE1.2I>FGHPATCH012.;6) (* Copyright (c) 1985 by Xerox Corporation. All rights reserved.) (PRETTYCOMPRINT FGHPATCH012COMS) (RPAQQ FGHPATCH012COMS ((FILES INTERMEZZOTEDITFIXES) (* * New FNS for NCTEXTSUBSTANCE) (GLOBALVARS NC.ExternalPutLinkIconImageFns) (FNS NC.IDFromTextStream NC.TEditPutFn NC.TEditPutFnAuxiliary NC.TEditGetFn NC.MakeTEditPropsList) (* * New stuff for NCLINKS) (GLOBALVARS NC.ExternalPutLinkIconImageFns) (VARS (NC.ExternalPutLinkIconImageFns (IMAGEFNSCREATE (FUNCTION NC.ExternalPutLinkIconDisplayFn) (FUNCTION NC.ExternalPutLinkIconImageBoxFn) (FUNCTION NC.ExternalPutLinkIconPutFn) (FUNCTION NC.ExternalPutLinkIconGetFn) NIL (FUNCTION NILL)))) (FNS NC.ExternalPutLinkIconDisplayFn NC.ExternalPutLinkIconImageBoxFn NC.ExternalPutLinkIconPutFn NC.ExternalPutLinkIconGetFn) (* * From NCTEXTSUBSTANCE) (FNS NC.BringUpTEditCard) (* * From NCTEXTCARD) (FNS NC.MakeTEditCard) (* * From NCDATABASE) (FNS NC.GetTextSubstance))) (FILESLOAD INTERMEZZOTEDITFIXES) (* * New FNS for NCTEXTSUBSTANCE) (DECLARE: DOEVAL@COMPILE DONTCOPY (GLOBALVARS NC.ExternalPutLinkIconImageFns) ) (DEFINEQ (NC.IDFromTextStream (LAMBDA (TextStream) (* fgh: "28-May-85 23:12") (* * Return the NoteCards ID for a TextStream) (STREAMPROP TextStream (QUOTE NoteCardID)))) (NC.TEditPutFn (LAMBDA (TextStream FileName When?) (* fgh: "30-May-85 23:06") (* * This function designed to be attached to the PUTFN Tedit property of NC textstreams.) (* * Before actions: Mark the card dirty for NoteCards, if TEdit thinks the card is dirty. Also, change the link icons to be ExternalPut Link Icons so that thety are no longer active in the file being put to. Necessary when a put is done outside the normal NoteCards mechanism.) (SELECTQ When? (BEFORE (PROG ((TextObj (TEXTOBJ TextStream)) LinkIcons) (* * first Mark the card dirty NoteCards style, if necessary) (COND ((TEDIT.STREAMCHANGEDP TextStream) (NC.MarkCardDirty (NC.IDFromTextStream (TEXTSTREAM TextStream))))) (RESETLST (* * Remove this PUTFN from the TEXTOBJ temporarily) (RESETSAVE (TEXTPROP TextObj (QUOTE PUTFN) NIL) (BQUOTE (TEXTPROP , TextObj PUTFN , (TEXTPROP TextObj (QUOTE PUTFN))))) (* * Collect all the link icons in the TextStream) (SETQ LinkIcons (TEDIT.LIST.OF.OBJECTS TextObj (FUNCTION NC.LinkIconImageObjP))) (* * Temporarily set them to be ExternalPut link icons) (RESETSAVE (NC.TEditPutFnAuxiliary LinkIcons NC.ExternalPutLinkIconImageFns) (BQUOTE (NC.TEditPutFnAuxiliary , LinkIcons , NC.LinkIconImageFns))) (* * Fix up the title on the way out) (RESETSAVE NIL (BQUOTE (AND , (WINDOW.FROM.TEDIT.THING TextStream) (WINDOWPROP , ( WINDOW.FROM.TEDIT.THING TextStream) (QUOTE TITLE) , (NC.FetchTitle (NC.IDFromTextStream TextStream)))))) (* * Put the file as usual) (TEDIT.PUT TextStream FileName FORCENEW UNFORMATTED?)) (RETURN (QUOTE DON'T)))) NIL))) (NC.TEditPutFnAuxiliary (LAMBDA (LinkIcons NewImageFns) (* fgh: "30-May-85 17:29") (* * For a list of link icons as returned by TEDIT.LIST.OF.OBJECTS, replace all the IMAGEFNS of the objects with NewImageFns) (for LinkIconPair in LinkIcons do (replace (IMAGEOBJ IMAGEOBJFNS) of (CAR LinkIconPair) with NewImageFns)))) (NC.TEditGetFn (LAMBDA (TextStream FileName When?) (* fgh: "30-May-85 23:26") (* * This function called from the GETFN for all NC TextStreams) (SELECTQ When? (BEFORE (LET ((LinkIcons (TEDIT.LIST.OF.OBJECTS (TEXTOBJ TextStream) (FUNCTION NC.LinkIconImageObjP)))) (* * Delete all the links currentluy in the text stream) (for LinkIconPair in LinkIcons do (TEDIT.DELETE TextStream (CADR LinkIconPair) 1)))) (AFTER (LET ((ID (NC.IDFromTextStream TextStream))) (* * Mark the card dirty ala NoteCards) (NC.MarkCardDirty ID) (* * Reset the NC title) (WINDOWPROP (WINDOW.FROM.TEDIT.THING TextStream) (QUOTE TITLE) (NC.RetrieveTitle ID)))) NIL))) (NC.MakeTEditPropsList (LAMBDA NIL (* fgh: "31-May-85 17:57") (* * Create the props list to hand to all TEdit and OPENTEXTSTREAM calls) (LIST (QUOTE FONT) NC.DefaultFont (QUOTE TITLEMENUFN) (FUNCTION NC.TEditMenuFn) (QUOTE PUTFN) (FUNCTION NC.TEditPutFn) (QUOTE GETFN) (FUNCTION NC.TEditGetFn) (QUOTE QUITFN) (LIST (FUNCTION (LAMBDA (WindowOrTextSTreamOrID) (NC.QuitCard WindowOrTextSTreamOrID))) (FUNCTION (LAMBDA NIL (QUOTE DON'T))))))) ) (* * New stuff for NCLINKS) (DECLARE: DOEVAL@COMPILE DONTCOPY (GLOBALVARS NC.ExternalPutLinkIconImageFns) ) (RPAQ NC.ExternalPutLinkIconImageFns (IMAGEFNSCREATE (FUNCTION NC.ExternalPutLinkIconDisplayFn) (FUNCTION NC.ExternalPutLinkIconImageBoxFn) (FUNCTION NC.ExternalPutLinkIconPutFn) (FUNCTION NC.ExternalPutLinkIconGetFn) NIL (FUNCTION NILL))) (DEFINEQ (NC.ExternalPutLinkIconDisplayFn (LAMBDA (ImageObj ImageStream STREAMTYPE TEXTSTREAM SCALE) (* fgh: "30-May-85 23:09") (* * Display a link icon) (PROG ((Font (FONTCREATE (QUOTE HELVETICA) 10 (QUOTE BOLD)))) (DSPFONT (PROG1 (DSPFONT Font ImageStream) (PRIN1 (IMAGEOBJPROP ImageObj (QUOTE OBJECTDATUM)) ImageStream)) ImageStream)))) (NC.ExternalPutLinkIconImageBoxFn (LAMBDA (ImageObj ImageStream CurrentX RightMargin) (* fgh: "30-May-85 16:52") (PROG ((FONT (FONTCREATE (QUOTE HELVETICA) 10 (QUOTE BOLD))) (Scale (DSPSCALE NIL ImageStream))) (RETURN (create IMAGEBOX XSIZE ←(TIMES Scale (STRINGWIDTH (IMAGEOBJPROP ImageObj (QUOTE OBJECTDATUM)) FONT)) YSIZE ←(TIMES Scale (FONTPROP FONT (QUOTE HEIGHT))) YDESC ←(COND (RightMargin (* This is in a TEdittextstream) (FONTPROP FONT (QUOTE DESCENT))) (T 0)) XKERN ← 0))))) (NC.ExternalPutLinkIconPutFn (LAMBDA (ImageObject Stream) (* fgh: "30-May-85 23:12") (* * Writes the Link information in the link icon specified by ImageObject onto the file specified by Stream) (LET (String Link) (COND ((SETQ String (STRINGP (IMAGEOBJPROP ImageObject (QUOTE OBJECTDATUM)))) (PRIN2 String Stream)) (T (SETQ Link (NC.FetchLinkFromLinkIcon ImageObject)) (PRIN2 (CONCAT "***[[" (fetch (NOTECARDLINK LINKLABEL) of Link) " link to " (NC.RetrieveTitle (fetch (NOTECARDLINK DESTINATIONID) of Link)) "]]***") Stream)))))) (NC.ExternalPutLinkIconGetFn (LAMBDA (Stream) (* fgh: "30-May-85 16:43") (* * Reads the link information from Stream and returns a link icon image object for this link info.) (IMAGEOBJCREATE (READ Stream) NC.ExternalPutLinkIconImageFns))) ) (* * From NCTEXTSUBSTANCE) (DEFINEQ (NC.BringUpTEditCard (LAMBDA (ID TextStream Region/Position) (* fgh: "30-May-85 14:53") (* Bring up a TEdit window for Card ID whose text stream is TextStream in Region specified by Region/Position or by the user.) (PROG (Region TEditWindow TEditProcess Title TextStreamDirtyFlg) (COND ((AND (SETQ TEditWindow (WINDOW.FROM.TEDIT.THING TextStream)) (SETQ TEditProcess (WINDOWPROP TEditWindow (QUOTE PROCESS)))) (TOTOPW TEditWindow) (RPTQ 2 (FLASHW TEditWindow)) (TTY.PROCESS TEditProcess) (RETURN TEditWindow))) (SETQ Region (NC.DetermineDisplayRegion ID Region/Position)) (SETQ Title (NC.FetchTitle ID)) (SETQ TEditWindow (CREATEW Region Title NIL T)) (WINDOWPROP TEditWindow (QUOTE SHRINKFN) (FUNCTION NC.ShrinkFn)) (WINDOWPROP TEditWindow (QUOTE NoteCardsLeftButtonMenu) (NC.MakeTEditLeftMenu (NC.FetchType ID))) (WINDOWPROP TEditWindow (QUOTE NoteCardsMiddleButtonMenu) (NC.MakeTEditMiddleMenu)) (SETQ TextStreamDirtyFlg (NC.CardDirtyP ID)) (TEDIT TextStream TEditWindow NIL (NC.MakeTEditPropsList)) (AND TextStreamDirtyFlg (NC.MarkCardDirty ID)) (RETURN TEditWindow)))) ) (* * From NCTEXTCARD) (DEFINEQ (NC.MakeTEditCard (LAMBDA (ID Title NoDisplayFlg) (* fgh: "30-May-85 16:58") (* Make up a blank text card and display it.) (PROG (TextStream Window) (COND (NoDisplayFlg (SETQ TextStream (OPENTEXTSTREAM "" NIL NIL NIL (NC.MakeTEditPropsList))) (NC.SetSubstance ID TextStream) (STREAMPROP TextStream (QUOTE NoteCardID) ID) (RETURN ID)) (T (SETQ Window (CREATEW (NC.DetermineDisplayRegion ID NIL) (OR Title "Untitled"))) (WINDOWPROP Window (QUOTE NoteCardsLeftButtonMenu) (NC.MakeTEditLeftMenu (NC.FetchType ID))) (WINDOWPROP Window (QUOTE NoteCardsMiddleButtonMenu) (NC.MakeTEditMiddleMenu)) (WINDOWPROP Window (QUOTE SHRINKFN) (FUNCTION NC.ShrinkFn)) (TEDIT NIL Window NIL (NC.MakeTEditPropsList)) (until (WINDOWPROP Window (QUOTE TEXTSTREAM)) do (BLOCK)) (SETQ TextStream (WINDOWPROP Window (QUOTE TEXTSTREAM))) (NC.SetSubstance ID TextStream) (STREAMPROP TextStream (QUOTE NoteCardID) ID) (RETURN Window)))))) ) (* * From NCDATABASE) (DEFINEQ (NC.GetTextSubstance (LAMBDA (DatabaseStream ID Region) (* fgh: "31-May-85 17:06") (* Get a text stream from the database file) (LET ((TempStream (OPENSTREAM (QUOTE {NODIRCORE}) (QUOTE BOTH) (QUOTE NEW))) StartPtr EndPtr StartFormatPtr TempFileEof TextStream) (SETQ StartPtr (NC.GetPtr DatabaseStream)) (SETQ EndPtr (NC.GetPtr DatabaseStream)) (* * Copy text stream to a NODIRCORE file) (COPYBYTES DatabaseStream TempStream StartPtr EndPtr) (* * fix up file absolute pinter to the beginning of the formatting nformation) (COND ((IGREATERP (SETQ TempFileEof (GETEOFPTR TempStream)) 2) (SETFILEPTR TempStream (IDIFFERENCE TempFileEof 2)) (COND ((FMEMB (\WIN TempStream) (QUOTE (31415 31416 31417))) (SETFILEPTR TempStream (IDIFFERENCE TempFileEof 8)) (SETQ StartFormatPtr (\DWIN TempStream)) (SETFILEPTR TempStream (IDIFFERENCE TempFileEof 8)) (\DWOUT TempStream (IDIFFERENCE StartFormatPtr StartPtr)))))) (* * return an open textstream on the temp file) (SETQ TextStream (OPENTEXTSTREAM TempStream NIL NIL NIL (NC.MakeTEditPropsList))) (STREAMPROP TextStream (QUOTE NoteCardID) ID) TextStream))) ) (PUTPROPS FGHPATCH012 COPYRIGHT ("Xerox Corporation" 1985)) (DECLARE: DONTCOPY (FILEMAP (NIL (1515 5897 (NC.IDFromTextStream 1525 . 1762) (NC.TEditPutFn 1764 . 3975) ( NC.TEditPutFnAuxiliary 3977 . 4394) (NC.TEditGetFn 4396 . 5280) (NC.MakeTEditPropsList 5282 . 5895)) ( 6313 8521 (NC.ExternalPutLinkIconDisplayFn 6323 . 6826) (NC.ExternalPutLinkIconImageBoxFn 6828 . 7505) (NC.ExternalPutLinkIconPutFn 7507 . 8192) (NC.ExternalPutLinkIconGetFn 8194 . 8519)) (8555 10087 ( NC.BringUpTEditCard 8565 . 10085)) (10116 11442 (NC.MakeTEditCard 10126 . 11440)) (11471 12964 ( NC.GetTextSubstance 11481 . 12962))))) STOP