forked from 1b-agent/opencadstudio-upstream
feat(plot): Windows printer media and printable areas
The plot dialog asks CUPS printers for their sheets and margins; on Windows the query was a stub, so every printer showed the paper catalogue with unverified margins. The driver is now asked the way the plot dialog expects: - windows_media (compiled and tested everywhere): the three parallel DeviceCapabilities tables (ids, sizes in tenths of a millimetre, 64-WCHAR names) become one PrinterMedia per distinct size — a rotated or borderless twin folds onto its sheet, catalogue sheets keep their name, unknown sizes carry the driver's — with the device's margins on every entry and the driver's default sheet found by id or by user size. - print_to_printer (Windows): DeviceCapabilitiesW for the tables, the default DEVMODE for the default sheet, one portrait printer DC for the unprintable margins (physical offsets and extents, per device — a documented approximation). The DEVMODE fetch is shared with the print path (with_printer_devmode). - A direct print now asks the driver for the plot's own sheet (by id, or as a user-defined size), so an A3 plot prints on A3 rather than shrunk into the driver's default; a driver that refuses the sheet is asked for the orientation alone. - The capability cache remembers printers that could not be asked, so a slow failing query runs once per session, not on every dialog open. - PRINTERS <name> reports a printer's sheets, margins and default sheet. Tests: names (NUL trim, full slot, lossy), media folding and dropping, default by id / user size / none, DC margins, paper id lookup. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c36ae08fd0
commit
b8472a00b4
27 files changed
+721
-40
No files matched your search
@@ -3144,6 +3144,10 @@ pub(super) fn message_attribute(source: &str) -> Option<(&'static str, &'static
|
||||
"World" => Some(("common", "world")),
|
||||
"Write Block" => Some(("insert", "write-block")),
|
||||
"X (mm)" => Some(("plot", "x-mm")),
|
||||
"{printer}: the printer reports no sheets; the paper catalogue is used." => Some(("plot", "printer-the-printer-reports-no-sheets-the-paper-catalogue-is-used")),
|
||||
"{printer}: {count} sheet(s) reported" => Some(("plot", "printer-count-sheet-s-reported")),
|
||||
"Default sheet: {sheet}" => Some(("plot", "default-sheet-sheet")),
|
||||
"Default sheet: not reported" => Some(("plot", "default-sheet-not-reported")),
|
||||
"Default printer: {name}" => Some(("plot", "default-printer-name")),
|
||||
"Default printer: none reported by the system" => Some(("plot", "default-printer-none-reported-by-the-system")),
|
||||
"Printers: none listed by the system" => Some(("plot", "printers-none-listed-by-the-system")),
|
||||
|
||||
Reference in new issue
Block a user