McdeSys gains mcde_sys_print_file(path, printer): it looks for lp(1)
(/usr/bin, /usr/local/bin, /usr/sbin, pkg prefix; MCDE_PRINT_COMMAND
overrides it for tests), passes -d PRINTER when one is named, and runs it
as the existing job (fd into the event loop, finish/cancel). dtpaint links
libMcdeSys, adds File > Print... (Ctrl+P): it picks the default queue from
mcde_sys_printers (or the first), writes the image to /tmp/dtpaint-PID.bmp,
starts the job and removes the file when the job ends; errors and 'no
printer is set up' go to the information dialog. Measured under Xvfb with
MCDE_PRINT_COMMAND=fake lp: argv '-d HP_LaserJet_M110w_CC1016
/tmp/dtpaint-3543226.bmp', the fake copied a valid 640x480 BMP and the
temporary file was gone; no physical page was printed (the real queue is
the user's step).
Image > Attributes... (Ctrl+E) asks width and height (1..4096), builds a
new pixmap filled with the background, copies the overlap and discards the
selection; the resize is a document operation, so undo starts fresh after
it. Colors > Edit Colors... opens three RGB scales initialised from the
current foreground; OK allocates the colour and updates the fg square.
Both dialogs are FormDialogs with OK/Cancel from the catalog; the form size
is set after popup so the shell does not shrink to its children.
Measured under Xvfb: 640x480 -> 300x300 canvas; Red 255 + OK draws a red
line and turns the fg indicator red.
Select drags a box, Free-Form Select traces a lasso; both draw an XOR
marquee (scaled with the zoom), keep the pixels, and can be dragged to move
them: the snapshot is the undo base, the selected pixels float in a pixmap,
and a 1-bit polygon mask clips clear/paste for the lasso. Edit > Clear
Selection (Del) clears the selected pixels and deselects; Edit > Select All
(Ctrl+A) selects the whole image; the Clear Selection item is sensitive only
while a selection exists. A non-selection tool's click deselects, as in the
reference. Measured under Xvfb: box marquee, move of a scribble (outside
pixels stay), Delete clears it, lasso marquee around a dot and Delete clears
just that dot, Ctrl+A marks the image and enables the menu item.
Airbrush sprays random foreground/background dots in a 15-pixel square
while dragging; Text opens a prompt dialog, then fills the text box with
the background colour and draws the string in the foreground colour with
the GC's font (the image stays 1:1 at any zoom). The prompt's OK button
is a gadget whose callback widget is the SelectionBox itself, so the text
field is found there, not under XtParent. Measured under Xvfb: spray dots
on the canvas; 'Hello dtpaint' appears at the clicked point.
The magnifier cycles the factor (left up, right down); View > Normal Size
(Ctrl+PgUp) and Large Size (Ctrl+PgDn) set 1x and 4x. The canvas grows to
image*zoom inside the scrolled window; Expose samples only the exposed
rectangle into an XImage (nearest pixel), and pointer events divide by the
factor, so drawing and the status line stay in image coordinates.
Measured under Xvfb: 1x 640x480 -> 2x 1280x960 -> 4x 2560x1920, a line
drawn at 4x appears at the same image coordinates at 1x.
Review of programs/dtpaint found and this fixes:
- Picker crash: a click in the grey strip below the image reached
XGetImage outside the pixmap (BadMatch, X_GetImage). The canvas is now
a drawing area of exactly the image size inside a scrolled window, and
CanvasInput bounds-checks; large BMPs scroll instead of being clipped.
- Undo: one snapshot taken before every image-changing operation (pencil,
brush, eraser, fill, shapes, invert, flip, clear) and refreshed after a
load; previously only shape tools snapshotted and OpenBMP left snap
uninitialized, so Undo after Open turned the image black.
- Menus: Clear Selection and Edit Colors were wired to Clear Image and
About; they are now insensitive until D3/D4. Help Topics is real.
Accelerator text shown; Clear Image uses 'Ctrl Shift<Key>N' (the old
'Ctrl<Key>Shift<Key>N' never fired).
- Save remembers the path and title, asks before New/Open/Exit when
dirty (Discard/Keep), and reports open/save errors in a dialog instead
of stderr; the per-tool-change stderr debug is gone.
- Colour model: fg/bg are pixels (picker takes any colour, right button
sets background) with a drawn fg/bg indicator; toolbox is radio with
the indicator hidden (one sunken tool); swatches are 16x16.
- Open/Save/Invert no longer do one X round trip per pixel: TrueColor
converts through the visual's masks, other visuals batch the distinct
colours. Measured on a 1024x768 BMP: open 18.3 s -> 0.02 s, invert
14.9 s -> 0.05 s, save 6.3 s -> 0.23 s.
- FloodFill is scanline with a growing seed stack, not 4 neighbours per
pixel; XmString leaks freed; message dialogs destroy their shell.
- Catalog grows to 34 messages; the German copy transliterates umlauts
(core font has no UTF-8 rendition), re-measured under de_DE.UTF-8.
-selftest now also checks the BMP round trip and double invert/flip: PASS.
Builds clean under -Wall -Wextra -Werror; PLIST gate ok (3714 installed).
Left column is a Form so the colour box never overlaps the canvas.
dtpaint builds its menus in code, so its labels are catalogued:
programs/dtpaint/dtpaint.msg (set 1, 23 messages: the six menu titles, the
items of File/Edit/View/Image/Colors/Help, the About title and the status
line), the German copy in programs/localized/de_DE.UTF-8/msg/dtpaint.msg,
built by msg.C.am and listed in the PLIST (C plain, ${PLIST.nls} for
German). catopen/catgets itself, setlocale in main.
dtpaint has no render table (core font): a UTF-8 "ü" in the status line came
out as two latin-1 characters ("Menü"), so the German string says
"Hilfe-Menue" instead (recorded in AGENTS.md).
Measured on Xvfb (1280x800, fresh HOME, ttsession + dtwm), de_DE.UTF-8 via
localedef/LOCPATH: menus "Datei Bearbeiten Ansicht Bild Farben Hilfe",
status "Hilfe: Hilfe-Themen im Hilfe-Menue." (/tmp/opencode/dtpa-de.png);
LANG=C: "File Edit View Image Colors Help" and the English status
(/tmp/opencode/dtpa-c.png). make mcde-linux MCDE_DIRS="install
programs/dtpaint" and "install programs/localized/C/msg" exit=0;
MCDE_DIRS=plist: "3486 installed names under dt/, 8680 in the PLISTs", ok.