MCDE dtpaint: the review's defects -- crash, undo, menus, save, i18n, speed (t0704)

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.
This commit is contained in:
lotherk committed 2026-11-21 21:42:34 +00:00
1 parent d41ebfa451
commit ae38eccebe
4 files changed
+924 -253

No files matched your search

+12 -3
View File
@@ -69,9 +69,18 @@ narratives and test notes, is `docs/reference/mcde-agents-history-2026-11-13.txt
status lines and the open/save errors) keeps its menus as the reference's
(`dtphoto.menu`, docs/reference/photoshop-ui.csv) -- they are the look of
the program, not its sentences. dtpaint builds its menus in code and its
labels are catalogued (`dtpaint.msg`, 23 messages); the program has no
render table, so its German strings avoid umlauts (a UTF-8 `ü` came out
as two latin-1 characters under the core font, measured 2026-11-16).
labels are catalogued (`dtpaint.msg`, 34 messages: menus, the file/error/
discard dialogs, Help and About); the program has no render table, so its
German strings avoid umlauts (a UTF-8 `ü` came out as two latin-1
characters under the core font, measured 2026-11-16; the German copy
transliterates ae/oe/ue throughout, re-measured 2026-11-21). Its canvas
is a drawing area of exactly the image size inside a scrolled window (a
click outside the image must never reach XGetImage -- the picker crashed
there), undo is one snapshot taken before every image-changing operation
and refreshed after a load, and Open/Save/Invert convert colours through
the visual's masks on TrueColor (or in batches otherwise), never one X
round trip per pixel (measured 2026-11-21: open 18.3 s -> 0.02 s, invert
14.9 s -> 0.05 s, save 6.3 s -> 0.23 s on a 1024x768 BMP).
McdeSys has a catalog too (`lib/McdeSys/mcdesys.msg`, `lib/McdeSys/
text.c`, `mcde_sys_msg`): common.c's tool errors ask it for their sentence
(messages 1-9: not there, cannot start, failed with status, no pipe, no
+884 -245
View File
File diff suppressed because it is too large. Load diff
+11
View File
@@ -25,3 +25,14 @@ $set 1
21 About dtpaint...
22 About dtpaint
23 For Help, click Help Topics on the Help Menu.
24 untitled
25 dtpaint - MCDE
26 Cannot open %s.
27 Cannot save %s.
28 Save changes to "%s"?
29 Discard
30 Keep
31 Open
32 Save As
33 Help Topics
34 Pick a tool on the left and a colour below it, then draw on the canvas. The left button draws with the foreground colour, the right button with the background colour. Ctrl+Z undoes the last step.
+17 -5
View File
@@ -1,4 +1,5 @@
$ MCDE dtpaint message catalog, German.
$ MCDE dtpaint message catalog, German. The core font has no UTF-8 rendition,
$ so umlauts are transliterated (ae/oe/ue), as in the other MCDE catalogs.
$
$set 1
@@ -9,11 +10,11 @@ $set 1
5 Farben
6 Hilfe
7 Neu
8 Öffnen...
8 Oeffnen...
9 Speichern
10 Speichern unter...
11 Beenden
12 Rückgängig
12 Rueckgaengig
13 Auswahl aufheben
14 Werkzeuge
15 Farbpalette
@@ -22,6 +23,17 @@ $set 1
18 Farben umkehren
19 Bild leeren
20 Farben bearbeiten...
21 Über dtpaint...
22 Über dtpaint
21 Ueber dtpaint...
22 Ueber dtpaint
23 Hilfe: Hilfe-Themen im Hilfe-Menue.
24 unbenannt
25 dtpaint - MCDE
26 %s kann nicht geoeffnet werden.
27 %s kann nicht gespeichert werden.
28 Aenderungen an "%s" speichern?
29 Verwerfen
30 Behalten
31 Oeffnen
32 Speichern unter
33 Hilfe-Themen
34 Waehlen Sie links ein Werkzeug und darunter eine Farbe, dann zeichnen Sie auf der Flaeche. Die linke Taste zeichnet mit der Vordergrundfarbe, die rechte mit der Hintergrundfarbe. Strg+Z macht den letzten Schritt rueckgaengig.