forked from 1b-agent/opencadstudio-upstream
fix(print): complete Windows printer discovery, honor the true default, surface failures; make CTB loading usable (#1261)
Printer enumeration used EnumPrinters level 4 only, which is served from the local registry cache and misses Win11 per-user network printers; an empty result now retries with level 2 (spooler RPC) and merges the resolved default. The dialog's 'System default printer' used to delegate to the shell print verb — the default PDF handler's own printer choice, not the system default; it now resolves GetDefaultPrinterW and dispatches printto naming that printer explicitly. Every dispatch probes OpenPrinterW first, so a printer that vanished between listing and printing produces a clear error instead of ShellExecute's silent nothing, and all SE_ERR_* codes carry readable reasons. Legacy CTB: picking an unparseable table used to swallow the failure (.ok()) — the user saw nothing at all. Load errors now reach the command line, the picker accepts .stb alongside .ctb (the container gains the STBVER1 header; .stb application errors state the actual reason), and a table loaded from anywhere is copied into the user's plot-styles folder so it persists in the dialog, matching AutoCAD. Buffer parsing for both EnumPrinters layouts is unit-tested; the missing-printer path was exercised against the real spooler (existence probe only, no job).
This commit is contained in:
1 parent
02d9273a19
commit
5ea4294d3d
6 files changed
+390
-44
No files matched your search
+2
-1
@@ -3290,7 +3290,8 @@ pub enum Message {
|
||||
/// Open file dialog to load a CTB/STB plot style table.
|
||||
PlotStyleLoad,
|
||||
/// Callback when the user picks (or cancels) a CTB/STB file.
|
||||
PlotStyleLoaded(Option<crate::io::plot_style::PlotStyleTable>),
|
||||
/// `Ok(None)` = cancelled; `Err` = the picked file failed to parse.
|
||||
PlotStyleLoaded(Result<Option<crate::io::plot_style::PlotStyleTable>, String>),
|
||||
/// Clear the active plot style table.
|
||||
PlotStyleClear,
|
||||
/// Open/close the Plot Style panel.
|
||||
|
||||
Reference in new issue
Block a user