1
0
mirror of synced 2026-04-29 13:23:08 +00:00

Rmk36 tedit fifth round (#1857)

* TMAX updates for compatibility with Tedit changes

* DOC-OBJECTS changes for compatibility with Tedit changes

* MODERNIZE update for Tedit split windows

* Core Tedit files

* IMAGEOBJ: Remove dependency on Tedit internals

* WINDOW: Remove dependency on Tedit internal declaration

Still strange that WFROMDS should have to branch on Tedit

* WINDOWOBJ gets window of TTY process before the window of the stream of the TTY process

So insert into Tedit works

* TEDIT-CHAT: try to use TEXTSTREAM vs TEXTOBJ

* Fix tab-initialization problem in SLIDES.TEDIT

as reported by @nbriggs

* TEDIT-CHAT: use TSTREAM rather than TEXTOBJ

* Updates after lots more testing, particularly scrolling

Some other files dragged along to avoid dependence on Tedit internals

* Remove unwanted SAVE.SYSOUT

* Addresses more end-of-file and empty-file display issues

Try it again

* TEDIT-DEBUG tracking other changes

* Odds and ends

* Adjust EOF selection and caret-scrolling on copy

* More cleanup, plus fixing a few more ancient (Venue) glitches

As usual, the problems have to do with the funky behavior of EOL's in the middle and end of the document.  More abstraction and refactoring to get better control of this (I hope).

* TEDIT-WINDOW: Scroll down of big objects

Trying to fix what happens at the transition when scrolling down brings a big-object's top down in the window.   Approach is to bring down the line above, which may make for a little jump. I hope that solves it.
Scrolling up still needs some adjustment.

* Eliminate junk at top of window after up/down scrolling of big objects

BLTSHADE is OK there for scrolling, but not for redisplay after editing.  In the edit case, the top of the pane above the last valid line is preserved.
Scrolling still has the problem that the window can go blank at the first scroll that brings a tall object into the pane--still working on that.

* Scrolling with tall lines should be more continuous

* Another tweak for scrolling

plus interface extension to TEDIT.MOVE and TEDIT.COPY, a little more on field menus

* More robust strategy for field menu buttons

Surround the field with prefix and suffix pieces with image objects that print the pre and post labels and shift the selection forward or backward into the field.  Doesn't depend on inherited quirky logic in the selection line-scanner.

* Field selection ignores right and middle clicks

* A little more menu/selection tweaking

You can't extend through fields and buttons

* Added CUSTOMBUTTONEVENTFN to menu field buttons

Also, menu buttons in general can't be deleted

* A few more glitches, plus a little selection refactoring for buttons

* Reduce flicker in pargraph menu margin bar

* screen update glitch

* DOC-OBJECTS, TEDIT-SCREEN: Fixes the HCFILES DOC-OBJECTS failure

* TEDIT-BUTTONS:  Field values should always be shown in the specified FIELDFONT

* Abstracting the structure of the history lists

cleanup, but mostly as a precursor to maybe doing a ring buffer of a specified length

* TEDIT-FILE, a little font-reading cleanup

* Include the files from rmk-39 that deal with the text/binary renamefile problem

* TEDIT-PAGE addresses #1905

* Fix BUTTONSTART to STARTPC in Put/Get menu buttons

* Use width of M as width of EOL--easy to select

Also put in function call for potential kerning--needs eventual FONT support

* Rename a few internal functions from TEDIT.-- to \TEDIT.--

* Doesn't make sense for a charlooks to not have a font

* TEDIT-BUTTONS - Fix comment

* Take out Tedit internals from \CARET.FLASH?

Should have included this in fifth round long ago

* TEDIT-FILE:  use DEFAULTFONT for .sh files

Easier to follow the layout

* TEDIT-LOOKS: fix loadup order

* tedit-exports.all  Remove line-has-protection field

Useless

* Make sure that charlooks change as expected

* External format for .sh files is UTF-8

* Better display of history information for debugging

* Button changes: show document font families, better fields

* TEDIT-WINDOW, remove extra truncated line with down-scroll

* TEDIT-SELECTION: suppress line/paragraph selection for built-in menus

Line/para selection would be reasonable for multi-line fields, but most menu lines have protected text that would behave inconsistently.  So just suppress

* Better support for potential kerning

* Fix empty field value

* Simplify ASCII translation code

* Make sure headings have a default tab

* Word boundary at character 1

* Remember that you specified a font class instead of a font

For the charlooks menu, but also so that it is saved on a put

* More items on the Family NWAY-button line

* glitch

* TEDIT-LOOKS: Better algorithm for Ascii translation

* Charmenu remembers previous "Other" fonts, even if not installed

* Fix initial piece index

* Fix fontclass changes (again)
This commit is contained in:
rmkaplan
2024-12-23 11:07:54 -08:00
committed by GitHub
parent a26d061843
commit abdb128636
88 changed files with 18046 additions and 13316 deletions

View File

@@ -1,12 +1,12 @@
(DEFINE-FILE-INFO PACKAGE "INTERLISP" READTABLE "INTERLISP" BASE 10)
(FILECREATED "27-Mar-2024 23:42:37" {WMEDLEY}<lispusers>DOC-OBJECTS.;36 52788
(FILECREATED " 9-Dec-2024 21:07:13" {WMEDLEY}<lispusers>DOC-OBJECTS.;58 52672
:EDIT-BY rmk
:CHANGES-TO (FNS DOCOBJ-INCLUDE-EDIT-WINDOWP)
:CHANGES-TO (FNS DOCOBJ-STRING-IMAGEBOX)
:PREVIOUS-DATE "19-Mar-2024 19:36:25" {WMEDLEY}<lispusers>DOC-OBJECTS.;35)
:PREVIOUS-DATE " 8-Dec-2024 15:49:01" {WMEDLEY}<lispusers>DOC-OBJECTS.;57)
(PRETTYCOMPRINT DOC-OBJECTSCOMS)
@@ -17,7 +17,7 @@
(* ;;; "This TEdit subsystem implements an extensible facility originally intended to provide bibliography and citation capabilities. The TEdit function GET.OBJ.FROM.USER, the one triggered by typing ^O, calls the function PROMPTFOREVALED which is redefined by this subsystem to be equivalent to the function DocObj-Acquire-Object. This function inserts IMAGEOBJects into the current TEdit, and is driven by the variables DocObjectsMenu and DocObjectsMenuCommands (analogous to BackgroundMenu and BackgroundMenuCommands). Each menu entry contains a form that, when EVAL'd, creates and returns a particular kind of IMAGEOBJ. Note that this form is EVAL'd under the function DocObj-Acquire-Object, which runs under the function GET.OBJ.FROM.USER, which gets TEXTSTREAM and TEXTOBJ as arguments. They can be (and are) used freely to record state or other desired info. The image objects supplied by this subsystem are 'Eval`d Form' (i.e., the original behavior of ^O), 'Screen Snap' (equivalent to right-buttoning in the background while holding the SHIFT key down), etc.")
(FILES (SYSLOAD)
TEDIT TEDIT IMAGEOBJ)
TEDIT IMAGEOBJ)
(DECLARE%: EVAL@COMPILE DONTCOPY (FILES TEDIT-EXPORTS.ALL))
(VARS (DocObjectsMenu NIL)
(DocObjectsConfirmEditMenu NIL))
@@ -28,7 +28,7 @@
(FNS DOCOBJ-ACQUIRE-OBJECT DOCOBJ-INIT DOCOBJ-TEDIT-MENU-ENTRY DOCOBJ-GET-LOOKS
DOCOBJ-REGISTER-OBJECT DOCOBJ-STRING-IMAGEBOX DOCOBJ-WAIT-MOUSE
DOCOBJ-INVOKE-IMAGEOBJFN DOCOBJ-BEFOREHARDCOPYFN DOCOBJ-AFTERHARDCOPYFN))
DOCOBJ-BEFOREHARDCOPYFN DOCOBJ-AFTERHARDCOPYFN))
[COMS
(* ;; "Eval'd Form")
@@ -108,7 +108,7 @@
(FILESLOAD (SYSLOAD)
TEDIT TEDIT IMAGEOBJ)
TEDIT IMAGEOBJ)
(DECLARE%: EVAL@COMPILE DONTCOPY
(FILESLOAD TEDIT-EXPORTS.ALL)
@@ -167,44 +167,37 @@
(GET.OBJ.FROM.USER TEXTSTREAM (TEXTOBJ TEXTSTREAM])
(DOCOBJ-GET-LOOKS
[LAMBDA (TEXTOBJ CH#ORCHARLOOKS) (* ; "Edited 19-Mar-2024 19:36 by rmk")
[LAMBDA (TEXTOBJ CH#ORCHARLOOKS) (* ; "Edited 5-Apr-2024 12:20 by rmk")
(* ; "Edited 19-Mar-2024 19:36 by rmk")
(* ; "Edited 29-Oct-2022 21:30 by rmk")
(* Koomen " 4-Feb-87 23:37")
(* ;;; "Adapted from {ERIS}<TEDIT>TEDITLOOKS.;30 dated '15-Oct-85 16:51:10' to return looks itself, rather than a proplist.")
(* jds "10-Jul-85 16:02")
(* ; "Return a PLIST of character looks")
(PROG ((TEXTOBJ (TEXTOBJ TEXTOBJ))
LOOKS FONT NLOOKS)
[COND
((type? CHARLOOKS CH#ORCHARLOOKS) (* ;
(LET ((TEXTOBJ (TEXTOBJ TEXTOBJ)))
(if (type? CHARLOOKS CH#ORCHARLOOKS)
then (* ;
 "He handed us a CHARLOOKS. Unparse it for him.")
(SETQ LOOKS CH#ORCHARLOOKS))
((ZEROP (FGETTOBJ TEXTOBJ TEXTLEN)) (* ;
CH#ORCHARLOOKS
elseif (ZEROP (FGETTOBJ TEXTOBJ TEXTLEN))
then (* ;
 "There's no text in the document. Use the extant caret looks.")
(SETQ LOOKS (FGETTOBJ TEXTOBJ CARETLOOKS)))
[(FIXP CH#ORCHARLOOKS) (* ;
(FGETTOBJ TEXTOBJ CARETLOOKS)
else (PLOOKS (\TEDIT.CHTOPC (if (FIXP CH#ORCHARLOOKS)
then (* ;
 "He gave us a CH# to get the looks of. Grab it.")
(SETQ LOOKS (PLOOKS (\TEDIT.CHTOPC (IMIN (FGETTOBJ TEXTOBJ TEXTLEN)
CH#ORCHARLOOKS)
TEXTOBJ]
[(type? SELECTION CH#ORCHARLOOKS) (* ;
CH#ORCHARLOOKS
elseif (type? SELECTION CH#ORCHARLOOKS)
then (* ;
 "Get the looks of the selected text")
(SETQ LOOKS (PLOOKS (\TEDIT.CHTOPC (IMIN (FGETTOBJ TEXTOBJ TEXTLEN)
(GETSEL CH#ORCHARLOOKS CH#))
TEXTOBJ]
((NULL CH#ORCHARLOOKS) (* ;
(GETSEL CH#ORCHARLOOKS CH#)
elseif (NULL CH#ORCHARLOOKS)
then (* ;
 "Get the looks of the selected text")
(SETQ LOOKS (PLOOKS (\TEDIT.CHTOPC (IMIN (FGETTOBJ TEXTOBJ TEXTLEN)
(GETSEL (FGETTOBJ TEXTOBJ SEL)
CH#))
TEXTOBJ]
(RETURN LOOKS)
(* ;;; "Now break the looks apart into a PROPLIST")
(SETQ NLOOKS (\TEDIT.UNPARSE.CHARLOOKS.LIST LOOKS))
(RETURN NLOOKS])
(GETSEL (FGETTOBJ TEXTOBJ SEL)
CH#))
TEXTOBJ])
(DOCOBJ-REGISTER-OBJECT
[LAMBDA (OBJECT) (* ; "Edited 23-Oct-87 14:48 by Koomen")
@@ -218,8 +211,9 @@
OBJECT])
(DOCOBJ-STRING-IMAGEBOX
[LAMBDA (STRING IMAGESTREAM) (* Koomen " 9-Feb-87 17:22")
(DECLARE (SPECVARS CHNO TEXTOBJ))
[LAMBDA (STRING IMAGESTREAM) (* ; "Edited 9-Dec-2024 21:04 by rmk")
(* Koomen " 9-Feb-87 17:22")
(DECLARE (USEDFREE CHNO TEXTOBJ))
(PROG (LOOKS CLOFFSET FONT DEVICE HEIGHT DESCENT)
(SETQ LOOKS (DOCOBJ-GET-LOOKS TEXTOBJ CHNO))
(SETQ CLOFFSET (fetch (CHARLOOKS CLOFFSET) of LOOKS))
@@ -230,10 +224,10 @@
(SETQ HEIGHT (FONTHEIGHT FONT))
(SETQ DESCENT (FONTPROP FONT 'DESCENT))
(RETURN (create IMAGEBOX
XSIZE _ (STRINGWIDTH STRING FONT)
YSIZE _ (IPLUS HEIGHT (IABS CLOFFSET))
YDESC _ (IDIFFERENCE DESCENT CLOFFSET)
XKERN _ 0])
XSIZE _ (STRINGWIDTH STRING FONT)
YSIZE _ (IPLUS HEIGHT (IABS CLOFFSET))
YDESC _ (IDIFFERENCE DESCENT CLOFFSET)
XKERN _ 0])
(DOCOBJ-WAIT-MOUSE
[LAMBDA (STREAM) (* ;
@@ -245,108 +239,104 @@
(LASTMOUSEY STREAM)))
then (RETURN NIL)) finally (RETURN T])
(DOCOBJ-INVOKE-IMAGEOBJFN
[LAMBDA (CH# PIECE IMAGEOBJFNNAME) (* ; "Edited 28-Jun-2023 19:45 by rmk")
(* ; "Edited 9-Sep-2022 16:10 by rmk")
(* ; "Edited 7-Sep-2022 23:11 by rmk")
(* ; "Edited 6-Sep-2022 10:05 by rmk")
(* ; "Edited 15-Oct-87 23:35 by Koomen")
(* ;; "If PIECE is an IMAGEOBJ, invoke the function associated with the ImageObj property IMAGEOBJFNNAME on the IMAGEOBJ and the character position where the IMAGEOBJ is located. ")
(CL:WHEN (AND (type? PIECE PIECE)
(EQ OBJECT.PTYPE (PTYPE PIECE)))
(LET ((IMAGEOBJ (PCONTENTS PIECE))
IMAGEOBJFN)
(SETQ IMAGEOBJFN (IMAGEOBJPROP IMAGEOBJ IMAGEOBJFNNAME))
(CL:WHEN (AND IMAGEOBJFN (DEFINEDP IMAGEOBJFN))
(APPLY* IMAGEOBJFN IMAGEOBJ CH# PIECE))))])
(DOCOBJ-BEFOREHARDCOPYFN
[LAMBDA (TEXTSTREAM TEXTOBJ) (* ; "Edited 16-Mar-2024 10:05 by rmk")
[LAMBDA (TEXTSTREAM) (* ; "Edited 8-Dec-2024 15:48 by rmk")
(* ; "Edited 12-Jul-2024 12:46 by rmk")
(* ; "Edited 7-Jul-2024 00:09 by rmk")
(* ; "Edited 8-May-2024 00:05 by rmk")
(* ; "Edited 6-May-2024 22:50 by rmk")
(* ; "Edited 5-Apr-2024 08:03 by rmk")
(* ; "Edited 16-Mar-2024 10:05 by rmk")
(* ; "Edited 16-Jul-2023 16:53 by rmk")
(* ; "Edited 10-Jul-2023 22:29 by rmk")
(* ;
 "Edited 25-May-93 13:07 by sybalsky:mv:envos")
(* ;; "This is the only BEFOREHARDCOPYFN, provided by DOC-OBJECTS. If the text doesn't contain any such objects, the property is NIL and the piece-scan doesn't happen. This is installed in the TEXTOBJ by the call to DOCOBJ-REGISTER-OBJECT from every DOCOBJ create function.")
(* ;; "This is the only BEFOREHARDCOPYFN provided by DOC-OBJECTS. If the text doesn't contain any such objects, the property is NIL and te piece-scan doesn't happen. This is installed in the TEXTOBJ by the call to DOCOBJ-REGISTER-OBJECT from every DOCOBJ create function.")
(* ;; "This runs through the file applying the BEFOREHARDCOPYFN of every object that has one. For example, an include object will replace the object by its target file.")
(* ;; "This records all of the history events created during the object pass into a single composite even so that the DOCOBJ-AFTERHARDCOPYFN can restore the stream to its original state.")
(RESETLST
(* ;; "We don't want to update the display lines to show the intermediate state while we are updating the pieces. ")
(RESETSAVE (TEXTPROP TEXTOBJ 'DON'TUPDATE T)
`(TEXTPROP ,TEXTOBJ 'DON'TUPDATE OLDVALUE))
(LET ((PREVEVENTS (GETTOBJ TEXTOBJ TXTHISTORY))
(OLDDIRTY (GETTOBJ TEXTOBJ \DIRTY))
(PREVSEL (\TEDIT.COPYSEL (TEXTSEL TEXTOBJ)))
FAILED)
(TEDIT.DEFER.UPDATES TEXTSTREAM)
(LET* ((TEXTOBJ (TEXTOBJ TEXTSTREAM))
(OLDDIRTY (GETTOBJ TEXTOBJ \DIRTY))
(PREVSEL (\TEDIT.COPYSEL (TEXTSEL TEXTOBJ)))
FAILED EVENTS)
(* ;; "This is a little tricky because the imageobj function may screw around with the piece containining the object, delete it or replace it with something else. But presumably it links into the previous saved piece, and we continue from there.")
(* ;; "This is a little tricky because the imageobj function may screw around with the piece containining the object, delete it or replace it with something else. But presumably it links into the previous saved piece, and we continue from there.")
[bind OBJ FN PREVPC (CH# _ 1)
(PC _ (\TEDIT.FIRSTPIECE TEXTOBJ)) while PC
do (SETQ PC (if (AND (EQ OBJECT.PTYPE (PTYPE PC))
(SETQ OBJ (PCONTENTS PC))
(SETQ FN (IMAGEOBJPROP OBJ 'BEFOREHARDCOPYFN))
(DEFINEDP FN))
then (SETQ PREVPC (PREVPIECE PC))
(CL:UNLESS (APPLY* FN TEXTOBJ OBJ PC CH#)
(SETQ FAILED T)
(RETURN))
(if PREVPC
then (NEXTPIECE (if (EQ PC (NEXTPIECE PREVPC))
then
(* ;;
[bind OBJ FN PREVPC (CH# _ 1)
(PC _ (\TEDIT.FIRSTPIECE TEXTOBJ)) while PC
do (SETQ PC (if (AND (EQ OBJECT.PTYPE (PTYPE PC))
(SETQ OBJ (PCONTENTS PC))
(SETQ FN (IMAGEOBJPROP OBJ 'BEFOREHARDCOPYFN))
(DEFINEDP FN))
then (SETQ PREVPC (PREVPIECE PC))
(CL:UNLESS (APPLY* FN TEXTOBJ OBJ PC CH#)
(SETQ FAILED T)
(RETURN))
(push EVENTS (\TEDIT.POPEVENT TEXTOBJ))
(* ; "Accumulate undo events")
(if PREVPC
then (NEXTPIECE (if (EQ PC (NEXTPIECE PREVPC))
then
(* ;;
 "Nothing affected this PC, advance")
(add CH# (PLEN PC))
PC
else
(* ;;
(add CH# (PLEN PC))
PC
else
(* ;;
 "Otherwise investigate its replacement")
PREVPC))
elseif (EQ PC (\TEDIT.FIRSTPIECE TEXTOBJ))
then (add CH# (PLEN PC))
(NEXTPIECE PC)
else
(* ;;
PREVPC))
elseif (EQ PC (\TEDIT.FIRSTPIECE TEXTOBJ))
then (add CH# (PLEN PC))
(NEXTPIECE PC)
else
(* ;;
 "Investigate the replacement of the previous first piece.")
(\TEDIT.FIRSTPIECE TEXTOBJ))
else (add CH# (PLEN PC))
(NEXTPIECE PC] (* ; "Restore previous settings")
(\TEDIT.FIRSTPIECE TEXTOBJ))
else (add CH# (PLEN PC))
(NEXTPIECE PC] (* ; "Restore previous settings")
(* ;
 "The history event may restore SEL, but...")
(SETTOBJ TEXTOBJ \DIRTY OLDDIRTY)
(SETTOBJ TEXTOBJ \DIRTY OLDDIRTY)
(* ;; "Make a single undoing event for the after fn")
(* ;; "Make a single event for the afterfn to undo")
(for ETAIL on (GETTOBJ TEXTOBJ TXTHISTORY) until (EQ ETAIL PREVEVENTS)
collect (CAR ETAIL) finally (SETTOBJ TEXTOBJ TXTHISTORY (CONS $$VAL PREVEVENTS)))
(* ;; "In case something screws up, at least redisplaying will show something correctly (even if we aren't \DIRTY)")
(\TEDIT.MARK.LINES.DIRTY TEXTOBJ 1 (TEXTLEN TEXTOBJ))
(CL:WHEN FAILED
(DOCOBJ-AFTERHARDCOPYFN TEXTSTREAM TEXTOBJ) (* ; "UNDO whatever was saved")
(SETTOBJ TEXTOBJ SEL PREVSEL)
'DON'T)))])
(\TEDIT.HISTORYADD.COMPOSITE TEXTOBJ EVENTS)
(CL:WHEN FAILED
(DOCOBJ-AFTERHARDCOPYFN TEXTSTREAM) (* ; "UNDO whatever was saved")
(SETTOBJ TEXTOBJ SEL PREVSEL)
'DON'T)))])
(DOCOBJ-AFTERHARDCOPYFN
[LAMBDA (TEXTSTREAM TEXTOBJ) (* ; "Edited 15-Mar-2024 14:24 by rmk")
[LAMBDA (TSTREAM) (* ; "Edited 7-Jul-2024 00:07 by rmk")
(* ; "Edited 5-Jul-2024 22:59 by rmk")
(* ; "Edited 3-Jul-2024 09:55 by rmk")
(* ; "Edited 8-May-2024 10:42 by rmk")
(* ; "Edited 7-May-2024 08:20 by rmk")
(* ; "Edited 5-Apr-2024 08:05 by rmk")
(* ; "Edited 15-Mar-2024 14:24 by rmk")
(* ; "Edited 15-Jul-2023 15:57 by rmk")
(* ;
 "Edited 25-May-93 13:08 by sybalsky:mv:envos")
(SETQ TSTREAM (TEXTSTREAM TSTREAM))
(RESETLST
(RESETSAVE (TEXTPROP TEXTOBJ 'DON'TUPDATE T)
`(TEXTPROP ,TEXTOBJ 'DON'TUPDATE OLDVALUE))
(LET ((PREVUNDONE (GETTOBJ TEXTOBJ TXTHISTORYUNDONE)))
(TEDIT.UNDO TEXTOBJ)
(SETTOBJ TEXTOBJ TXTHISTORYUNDONE PREVUNDONE)
(\TEDIT.MARK.LINES.DIRTY TEXTOBJ 1 (TEXTLEN TEXTOBJ))
(\TEDIT.UPDATE.SCREEN TEXTOBJ)))])
[RESETSAVE (TEXTPROP TSTREAM 'DON'TUPDATE T)
`(PROGN (TEXTPROP ,TSTREAM 'DON'TUPDATE OLDVALUE)
(\TEDIT.FILL.PANES ,TSTREAM]
(LET* ((TEXTOBJ (TEXTOBJ TSTREAM))
(PREVUNDONE (GETTOBJ TEXTOBJ TXTHISTORYUNDONE)))
(TEDIT.UNDO TSTREAM T)
(SETTOBJ TEXTOBJ TXTHISTORYUNDONE PREVUNDONE)))])
)
@@ -750,11 +740,10 @@
IMAGEOBJ])
(DOCOBJ-INCLUDE-EDIT
[LAMBDA (INCLOBJ) (* ; "Edited 9-May-2018 11:09 by rmk:")
(* ; "Edited 9-May-2018 10:35 by rmk:")
(* ;
 "Edited 26-Oct-87 19:57 by Koomen")
(DECLARE (SPECVARS TEXTOBJ))
[LAMBDA (INCLOBJ TSTREAM) (* ; "Edited 12-May-2024 09:03 by rmk")
(* ; "Edited 9-May-2018 11:09 by rmk:")
(* ; "Edited 9-May-2018 10:35 by rmk:")
(* ; "Edited 26-Oct-87 19:57 by Koomen")
(SELECTQ [MENU (OR DOCOBJ-INCLUDE-EDITMENU (SETQ DOCOBJ-INCLUDE-EDITMENU
(create MENU
TITLE _ "Edit Include"
@@ -771,41 +760,38 @@
CENTERFLG _ T
MENUOFFSET _ '(-1 . 30)
CHANGEOFFSETFLG _ 'Y]
(NEW.FILE (LET [(NEWNAME (TEDIT.GETINPUT TEXTOBJ "Enter new file name: " (fetch
(INCLOBJ FILENAME)
(NEW.FILE (LET [(NEWNAME (TEDIT.GETINPUT TSTREAM "Enter new file name: " (fetch (INCLOBJ
FILENAME)
of INCLOBJ]
(if [AND NEWNAME (SETQ NEWNAME (MKSTRING NEWNAME))
(NOT (EQUAL NEWNAME (fetch (INCLOBJ FILENAME) of INCLOBJ]
(NOT (EQUAL NEWNAME (fetch (INCLOBJ FILENAME) of INCLOBJ]
then (replace (INCLOBJ FILENAME) of INCLOBJ with NEWNAME)
T)))
T)))
(EDIT.FILE (for W in (OPENWINDOWS)
bind [FULLNAME _ (OR [FINDFILE (fetch (INCLOBJ FILENAME) of INCLOBJ
)
T
(CONS (PACKFILENAME.STRING 'HOST
(FILENAMEFIELD (FETCH TXTFILE
OF TEXTOBJ)
'HOST)
'DIRECTORY
(FILENAMEFIELD (FETCH TXTFILE
OF TEXTOBJ)
'DIRECTORY]
(INFILEP (fetch (INCLOBJ FILENAME) of INCLOBJ]
bind [FULLNAME _ (OR (FINDFILE-WITH-EXTENSIONS
(fetch (INCLOBJ FILENAME) of INCLOBJ)
(CONS (PACKFILENAME.STRING 'HOST (FILENAMEFIELD
TXTFILE
'HOST)
'DIRECTORY
(FILENAMEFIELD TXTFILE 'DIRECTORY))
DIRECTORIES)
*TEDIT-EXTENSIONS*)
(INFILEP (fetch (INCLOBJ FILENAME) of INCLOBJ]
first (if (NULL FULLNAME)
then (TEDIT.PROMPTPRINT TEXTOBJ "Can't find " T)
(TEDIT.PROMPTPRINT TEXTOBJ (fetch (INCLOBJ FILENAME)
of INCLOBJ))
(RETURN)) when (SETQ W (DOCOBJ-INCLUDE-EDIT-WINDOWP
FULLNAME W))
then (TEDIT.PROMPTPRINT TSTREAM "Can't find " T)
(TEDIT.PROMPTPRINT TSTREAM (fetch (INCLOBJ FILENAME)
of INCLOBJ))
(RETURN)) when (SETQ W (DOCOBJ-INCLUDE-EDIT-WINDOWP FULLNAME W))
do (TOTOPW W)
(GIVE.TTY.PROCESS W)
(RETURN) finally (TEDIT (MKATOM FULLNAME))))
(GIVE.TTY.PROCESS W)
(RETURN) finally (TEDIT (MKATOM FULLNAME))))
(ENABLE (if (NOT (fetch (INCLOBJ ENABLEDP) of INCLOBJ))
then (replace (INCLOBJ ENABLEDP) of INCLOBJ with T)
T))
T))
(DISABLE (if (fetch (INCLOBJ ENABLEDP) of INCLOBJ)
then (replace (INCLOBJ ENABLEDP) of INCLOBJ with NIL)
T))
T))
NIL])
(DOCOBJ-INCLUDE-EDIT-WINDOWP
@@ -842,56 +828,51 @@
(DEFINEQ
(DOCOBJ-INCLUDE-BEFOREHARDCOPYFN
[LAMBDA (TEXTOBJ OBJ PC CH#) (* ; "Edited 16-Feb-2024 23:47 by rmk")
[LAMBDA (TEXTOBJ OBJ PC CH#) (* ; "Edited 13-Sep-2024 15:13 by rmk")
(* ; "Edited 12-May-2024 08:48 by rmk")
(* ; "Edited 7-May-2024 23:33 by rmk")
(* ; "Edited 16-Feb-2024 23:47 by rmk")
(* ; "Edited 23-Jul-2023 22:45 by rmk")
(* ; "Edited 16-Jul-2023 11:14 by rmk")
(* ; "Edited 10-Jul-2023 22:18 by rmk")
(* ; "Edited 22-Jun-2023 16:44 by rmk")
(* ;; "This replaces the PC, the piece with an included-file object, with the contents of that file. The undo event will restore the object. Since the piece with the object is deleted, its paragraph looks are ignored and only the lookos of the inserted file are interpreted. E.g., to get a page break before the included file, either the first piece of that file must be a page break, or a blank NEWPAGEBEFORE paragraph must come before the OBJ.'")
(* ;; "This replaces the PC, the piece with an included-file object, with the contents of that file. The undo event will restore the object. Since the piece with the object is deleted, its paragraph looks are ignored and only the looks of the inserted file are interpreted. E.g., to get a page break before the included file, either the first piece of that file must be a page break, or a blank NEWPAGEBEFORE paragraph must come before the OBJ.")
(* ;; "Returns T if the inclusion is succeeds as intended, NIL otherwise.")
(* ;; "Not sure why the INCLUDEDP property. If enabled, it's included.")
(if (fetch (INCLOBJ ENABLEDP) of (IMAGEOBJPROP OBJ 'OBJECTDATUM))
then (LET ([INCLFILE (fetch (INCLOBJ FILENAME) of (IMAGEOBJPROP OBJ 'OBJECTDATUM]
(TXTFILE (GETTOBJ TEXTOBJ TXTFILE))
INCLSTREAM)
[SETQ INCLFILE (FINDFILE INCLFILE T (AND TXTFILE (CONS (PACKFILENAME.STRING
'HOST
(FILENAMEFIELD TXTFILE
'HOST)
'DIRECTORY
(FILENAMEFIELD TXTFILE
'DIRECTORY))
DIRECTORIES]
(if INCLFILE
then
(* ;; "No point in prompting: it just flashes by")
(CL:WHEN (fetch (INCLOBJ ENABLEDP) of (IMAGEOBJPROP OBJ 'OBJECTDATUM))
(LET ([INCLFILE (fetch (INCLOBJ FILENAME) of (IMAGEOBJPROP OBJ 'OBJECTDATUM]
(TXTFILE (GETTOBJ TEXTOBJ TXTFILE)))
(SETQ INCLFILE (FINDFILE-WITH-EXTENSIONS INCLFILE
(AND TXTFILE (CONS (PACKFILENAME.STRING 'HOST (FILENAMEFIELD
TXTFILE
'HOST)
'DIRECTORY
(FILENAMEFIELD TXTFILE 'DIRECTORY))
DIRECTORIES))
*TEDIT-EXTENSIONS*))
(if INCLFILE
then (* ; "Don't update/show until end")
(\TEDIT.UPDATE.SEL (TEXTSEL TEXTOBJ)
CH# 1 'LEFT) (* ; "Deletes this include-object")
(\TEDIT.DELETE TEXTOBJ (TEXTSEL TEXTOBJ))
(TEDIT.INCLUDE TEXTOBJ INCLFILE NIL NIL DOCOBJ-INCLUDE-SAFE)
(TEDIT.PROMPTPRINT TEXTOBJ (CONCAT "Included " INCLFILE))
(AND NIL (TEDIT.PROMPTPRINT TEXTOBJ (CONCAT "Including " INCLFILE "...")
T))
(\TEDIT.UPDATE.SEL (TEXTSEL TEXTOBJ)
CH# 1 'LEFT T) (* ; "Set the destination")
(\TEDIT.DELETE TEXTOBJ (TEXTSEL TEXTOBJ)
T)
(TEDIT.INCLUDE TEXTOBJ INCLFILE NIL NIL DOCOBJ-INCLUDE-SAFE)
(AND NIL (TEDIT.PROMPTPRINT TEXTOBJ (CONCAT "Including " INCLFILE
"...done")))
else
(* ;; "Did not succeed as intended. Caller should restore the stream, maybe selecting and highlighting the bad inclusion.")
(* ;; "Succeeded as intended")
(TEDIT.PROMPTPRINT TEXTOBJ (CONCAT "Included file " (fetch (INCLOBJ FILENAME
)
of OBJ)
" not found")
T T)
NIL))
else
(* ;; "Succeeded as intended")
T
else
(* ;; "Did not succeed as intended. Caller should restore the stream, maybe selecting and highlighting the bad inclusion.")
T])
(TEDIT.PROMPTPRINT TEXTOBJ (CONCAT "Included file " (fetch (INCLOBJ FILENAME)
of OBJ)
" not found")
T T)
NIL)))])
(DOCOBJ-INCLUDE-CLEANUPFN
[LAMBDA (TEXTSTREAM STARTPOS LEN) (* ; "Edited 15-Mar-2024 14:08 by rmk")
@@ -919,12 +900,13 @@
(DOCOBJ-INCLUDE-BUTTONEVENTINFN
[LAMBDA (IMAGEOBJ WINDOWSTREAM SELECTION RELX RELY WINDOW HOSTSTREAM BUTTON)
(* ; "Edited 12-May-2024 09:01 by rmk")
(* ; "Edited 23-Oct-87 00:46 by Koomen")
(if (AND (EQ BUTTON 'MIDDLE)
(DOCOBJ-WAIT-MOUSE WINDOWSTREAM))
then (ALLOW.BUTTON.EVENTS)
(if (DOCOBJ-INCLUDE-EDIT (IMAGEOBJPROP IMAGEOBJ 'OBJECTDATUM))
(if (DOCOBJ-INCLUDE-EDIT (IMAGEOBJPROP IMAGEOBJ 'OBJECTDATUM)
HOSTSTREAM)
then (DOCOBJ-INCLUDE-RESET-OBJ IMAGEOBJ)
'CHANGED])
@@ -1011,30 +993,29 @@
(PUTPROPS DOC-OBJECTS MAKEFILE-ENVIRONMENT (:READTABLE "INTERLISP" :PACKAGE "INTERLISP" :BASE 10))
)
(DECLARE%: DONTCOPY
(FILEMAP (NIL (7682 21029 (DOCOBJ-ACQUIRE-OBJECT 7692 . 8693) (DOCOBJ-INIT 8695 . 9323) (
DOCOBJ-TEDIT-MENU-ENTRY 9325 . 9747) (DOCOBJ-GET-LOOKS 9749 . 12364) (DOCOBJ-REGISTER-OBJECT 12366 .
13020) (DOCOBJ-STRING-IMAGEBOX 13022 . 13970) (DOCOBJ-WAIT-MOUSE 13972 . 14432) (
DOCOBJ-INVOKE-IMAGEOBJFN 14434 . 15557) (DOCOBJ-BEFOREHARDCOPYFN 15559 . 20205) (
DOCOBJ-AFTERHARDCOPYFN 20207 . 21027)) (21059 21326 (DOCOBJ-ACQUIRE-EVALED-OBJECT 21069 . 21324)) (
21526 21668 (DOCOBJ-ACQUIRE-SNAPPED-OBJECT 21536 . 21666)) (22007 26803 (DOCOBJ-EDIT-TIMESTAMP 22017
. 22546) (DOCOBJ-MAKE-TIMESTAMP 22548 . 22959) (DOCOBJ-MAKE-TIMESTAMP-IMAGEFNS 22961 . 24031) (
DOCOBJ-TIMESTAMP-BUTTONEVENTINFN 24033 . 24564) (DOCOBJ-TIMESTAMP-COPYFN 24566 . 24891) (
DOCOBJ-TIMESTAMP-DISPLAYFN 24893 . 25186) (DOCOBJ-TIMESTAMP-GETFN 25188 . 25428) (
DOCOBJ-TIMESTAMP-IMAGEBOXFN 25430 . 25786) (DOCOBJ-TIMESTAMP-PREPRINTFN 25788 . 26019) (
DOCOBJ-TIMESTAMP-PUTFN 26021 . 26390) (DOCOBJ-TIMESTAMP-TO-STRING 26392 . 26801)) (27097 31404 (
DOCOBJ-MAKE-FILESTAMP 27107 . 27448) (DOCOBJ-MAKE-FILESTAMP-IMAGEFNS 27450 . 28492) (
DOCOBJ-FILESTAMP-COPYFN 28494 . 28809) (DOCOBJ-FILESTAMP-DISPLAYFN 28811 . 29099) (
DOCOBJ-FILESTAMP-GETFN 29101 . 29454) (DOCOBJ-FILESTAMP-IMAGEBOXFN 29456 . 29794) (
DOCOBJ-FILESTAMP-GET-FULLNAME 29796 . 30414) (DOCOBJ-FILESTAMP-NEW-FULLNAME 30416 . 30889) (
DOCOBJ-FILESTAMP-PREPRINTFN 30891 . 31100) (DOCOBJ-FILESTAMP-PUTFN 31102 . 31402)) (31727 34224 (
DOCOBJ-MAKE-HRULE 31737 . 32151) (DOCOBJ-EDIT-HRULE 32153 . 32625) (DOCOBJ-HRULE-INIT 32627 . 32959) (
DOCOBJ-HRULE-GET-WIDTH 32961 . 33772) (DOCOBJ-HRULE-BUTTONEVENTINFN 33774 . 34222)) (34643 43315 (
DOCOBJ-MAKE-INCLUDE 34653 . 35054) (DOCOBJ-MAKE-INCLUDE-IMAGEFNS 35056 . 36061) (
DOCOBJ-INCLUDE-CREATE-OBJ 36063 . 36831) (DOCOBJ-INCLUDE-EDIT 36833 . 41432) (
DOCOBJ-INCLUDE-EDIT-WINDOWP 41434 . 42290) (DOCOBJ-INCLUDE-RESET-OBJ 42292 . 43313)) (43316 52247 (
DOCOBJ-INCLUDE-BEFOREHARDCOPYFN 43326 . 47048) (DOCOBJ-INCLUDE-CLEANUPFN 47050 . 48569) (
DOCOBJ-INCLUDE-BUTTONEVENTINFN 48571 . 49105) (DOCOBJ-INCLUDE-COPYFN 49107 . 49325) (
DOCOBJ-INCLUDE-DISPLAYFN 49327 . 50079) (DOCOBJ-INCLUDE-GETFN 50081 . 50804) (
DOCOBJ-INCLUDE-IMAGEBOXFN 50806 . 51815) (DOCOBJ-INCLUDE-PREPRINTFN 51817 . 52036) (
DOCOBJ-INCLUDE-PUTFN 52038 . 52245)))))
(FILEMAP (NIL (7640 21328 (DOCOBJ-ACQUIRE-OBJECT 7650 . 8651) (DOCOBJ-INIT 8653 . 9281) (
DOCOBJ-TEDIT-MENU-ENTRY 9283 . 9705) (DOCOBJ-GET-LOOKS 9707 . 12167) (DOCOBJ-REGISTER-OBJECT 12169 .
12823) (DOCOBJ-STRING-IMAGEBOX 12825 . 13881) (DOCOBJ-WAIT-MOUSE 13883 . 14343) (
DOCOBJ-BEFOREHARDCOPYFN 14345 . 19815) (DOCOBJ-AFTERHARDCOPYFN 19817 . 21326)) (21358 21625 (
DOCOBJ-ACQUIRE-EVALED-OBJECT 21368 . 21623)) (21825 21967 (DOCOBJ-ACQUIRE-SNAPPED-OBJECT 21835 . 21965
)) (22306 27102 (DOCOBJ-EDIT-TIMESTAMP 22316 . 22845) (DOCOBJ-MAKE-TIMESTAMP 22847 . 23258) (
DOCOBJ-MAKE-TIMESTAMP-IMAGEFNS 23260 . 24330) (DOCOBJ-TIMESTAMP-BUTTONEVENTINFN 24332 . 24863) (
DOCOBJ-TIMESTAMP-COPYFN 24865 . 25190) (DOCOBJ-TIMESTAMP-DISPLAYFN 25192 . 25485) (
DOCOBJ-TIMESTAMP-GETFN 25487 . 25727) (DOCOBJ-TIMESTAMP-IMAGEBOXFN 25729 . 26085) (
DOCOBJ-TIMESTAMP-PREPRINTFN 26087 . 26318) (DOCOBJ-TIMESTAMP-PUTFN 26320 . 26689) (
DOCOBJ-TIMESTAMP-TO-STRING 26691 . 27100)) (27396 31703 (DOCOBJ-MAKE-FILESTAMP 27406 . 27747) (
DOCOBJ-MAKE-FILESTAMP-IMAGEFNS 27749 . 28791) (DOCOBJ-FILESTAMP-COPYFN 28793 . 29108) (
DOCOBJ-FILESTAMP-DISPLAYFN 29110 . 29398) (DOCOBJ-FILESTAMP-GETFN 29400 . 29753) (
DOCOBJ-FILESTAMP-IMAGEBOXFN 29755 . 30093) (DOCOBJ-FILESTAMP-GET-FULLNAME 30095 . 30713) (
DOCOBJ-FILESTAMP-NEW-FULLNAME 30715 . 31188) (DOCOBJ-FILESTAMP-PREPRINTFN 31190 . 31399) (
DOCOBJ-FILESTAMP-PUTFN 31401 . 31701)) (32026 34523 (DOCOBJ-MAKE-HRULE 32036 . 32450) (
DOCOBJ-EDIT-HRULE 32452 . 32924) (DOCOBJ-HRULE-INIT 32926 . 33258) (DOCOBJ-HRULE-GET-WIDTH 33260 .
34071) (DOCOBJ-HRULE-BUTTONEVENTINFN 34073 . 34521)) (34942 43284 (DOCOBJ-MAKE-INCLUDE 34952 . 35353)
(DOCOBJ-MAKE-INCLUDE-IMAGEFNS 35355 . 36360) (DOCOBJ-INCLUDE-CREATE-OBJ 36362 . 37130) (
DOCOBJ-INCLUDE-EDIT 37132 . 41401) (DOCOBJ-INCLUDE-EDIT-WINDOWP 41403 . 42259) (
DOCOBJ-INCLUDE-RESET-OBJ 42261 . 43282)) (43285 52131 (DOCOBJ-INCLUDE-BEFOREHARDCOPYFN 43295 . 46789)
(DOCOBJ-INCLUDE-CLEANUPFN 46791 . 48310) (DOCOBJ-INCLUDE-BUTTONEVENTINFN 48312 . 48989) (
DOCOBJ-INCLUDE-COPYFN 48991 . 49209) (DOCOBJ-INCLUDE-DISPLAYFN 49211 . 49963) (DOCOBJ-INCLUDE-GETFN
49965 . 50688) (DOCOBJ-INCLUDE-IMAGEBOXFN 50690 . 51699) (DOCOBJ-INCLUDE-PREPRINTFN 51701 . 51920) (
DOCOBJ-INCLUDE-PUTFN 51922 . 52129)))))
STOP