feat(plot): printer driver properties and a roomier plot dialog

Properties… next to the printer used to open the CUPS web interface in a
browser. It now edits the driver options of the *selected* printer the
way LibreOffice's Properties… does, without leaving the plot dialog:

- CUPS platforms (Linux, any desktop; macOS): an in-line editor lists the
  printer's PPD options as `lpoptions -l` reports them — media type,
  colour mode, quality, duplex, trays, scaling — with readable choice
  labels, Reset / Cancel / Apply. Apply keeps only the choices that differ
  from the driver defaults, per printer, in the plot config, and every job
  for that printer passes them as `lp -o key=value`. Where CUPS cannot
  answer, the desktop's printer settings panel opens instead of a browser.
- Windows: the driver's document-properties sheet (`DocumentPropertiesW`
  with prompt, owned by the main window) and, on OK, the result stored as
  the user's printing preferences for that printer (`SetPrinter` level 9),
  which the job honours. `printui /e` (printing preferences) replaces the
  device-properties sheet as the fallback.

The desktop print portal was tried first and dropped: GTK 4's print
dialog loses the preselected printer when the default queue is listed
before it, so the dialog always opened on the wrong printer.

Dialog layout: the modal grows to 940×620; Printer / plotter and Paper
size share a line with their pickers (long queue and media names now fit);
Copies + Properties… and Custom… sit beneath; the custom-sheet editor
labels each margin (Left / Right, Top / Bottom) and shows the unit.

Also recognises `none_device`, AutoCAD's stored spelling for "no plotter",
and writes it back unchanged.

Tests: `lpoptions` parsing and keyword humanising, the editor flow (load,
stale answer ignored, set, apply, remember, reset, error, cancel), device
name round-trips including `none_device`.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
PanosandClaude Opus 5 committed 2026-09-16 16:05:47 +03:00
1 parent 5e271e2dbb
commit 737666b894
29 files changed
+1000 -103

No files matched your search

+9
View File
@@ -1460,6 +1460,15 @@ pub(super) fn message_attribute(source: &str) -> Option<(&'static str, &'static
"Custom paper size" => Some(("plot", "custom-paper-size")),
"Printable margins" => Some(("plot", "printable-margins")),
"Enter a positive width and height." => Some(("plot", "enter-a-positive-width-and-height")),
"Paper size" => Some(("plot", "paper-size")),
"{count} driver option(s) set for this printer." => Some(("plot", "count-driver-option-s-set-for-this-printer")),
"Printer properties — {printer}" => Some(("plot", "printer-properties-printer")),
"This printer reports no driver options." => Some(("plot", "this-printer-reports-no-driver-options")),
"Could not read the printer's options: {error}" => Some(("plot", "could-not-read-the-printer-s-options-error")),
"Reading the printer's options…" => Some(("plot", "reading-the-printer-s-options")),
"Printing preferences saved for {printer}." => Some(("plot", "printing-preferences-saved-for-printer")),
"Printing preferences unchanged." => Some(("plot", "printing-preferences-unchanged")),
"Printer properties" => Some(("plot", "printer-properties")),
"Layout renamed: '{old_name}' → '{new_name}'" => Some(("common", "layout-renamed-old-name-new-name")),
"Layouts" => Some(("layout", "layouts")),
"Leader" => Some(("common", "leader")),