Commit Graph
2984 Commits
Author SHA1 Message Date
PanosandClaude Opus 5 b8472a00b4 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 <[email protected]>
2026-09-18 18:42:03 +03:00
PanosandClaude Opus 5 c36ae08fd0 fix(print): send Windows plots to the chosen printer, name the default, report failures
On Windows a plot with no printer chosen went to the PDF application's
bare "print" verb — whatever that application considered its default —
and a viewer without a "printto" verb (Edge, store readers) silently
dropped the printer the dialog had chosen. The dialog also never named the
system default, and a failed printer enumeration left only "Default" and
"PDF" with the reason written to a console nobody sees.

- The default printer is looked up by name (GetDefaultPrinterW) both for
  the dialog's "System default printer (…)" entry and before every job.
- A pure route decision (plan_print_route) resolves "Default" to that
  name and uses the PDF application only when it registered a "printto"
  verb for .pdf (AssocQueryStringW); otherwise the job goes straight to
  the spooler through the existing GDI path. The report says which:
  "Sent to printer: NAME (direct print | via the PDF application)".
- list_printers reports the system's own error; the plot dialog shows it
  under the printer row and the command line warns once. A desktop without
  CUPS is an empty list, not an error.
- PRINTERS command: default printer, listed printers (or the error) and,
  on Windows, the print route — a report to paste into an issue.
- Properties… on the Default entry opens that printer's preferences sheet.
- GDI path: the driver's dmSize is kept (its private data lives behind
  it), the print raster is no longer memoised for the session, and a
  spooled temporary PDF is removed.

Tests: route planning (named / blank / no default / printto or not), the
PRINTERS command; the two Windows-only GDI tests pass the resolved name.

Co-Authored-By: Claude Opus 5 <[email protected]>
2026-09-18 15:49:27 +03:00
Karim Jerbi 2b38f798c0 Add GPU backend probe with automatic fallback for older GPUs
Older GPUs without usable DirectX 12 Feature Level 12_0 or working
Vulkan support (e.g. legacy Intel iGPUs and other old parts), and old
GLES drivers whose shader compiler rejects iced's own shaders, crash
at startup or on the first drawing viewport: StagingBelt aborts in
Buffer::get_mapped_range (panic=abort, silent exit) on the DX12 path,
and shader compilation fails inside iced's gradient pipeline on the
GLES path. Selecting a working backend via WGPU_BACKEND before iced
boots avoids both classes.

- Probe each candidate backend (Windows: dx12,vulkan,gl; Linux:
  vulkan,gl) in an isolated --gpu-probe child: device request,
  staging-style mapped upload, render pipeline creation (its fragment
  shader reads a private vec4 array, catching old-Mesa compile
  failures), offscreen render and readback. First fully-passing
  backend wins; explicit --backend / WGPU_BACKEND / --safe-mode
  always win, and Windows keeps preferring DX12/Vulkan (#55).
- Software adapters (WARP/llvmpipe/SwiftShader) are the last resort
  before a best-effort GL attempt: slow but alive.
- The crash sentinel names the attempted backend so only implicated
  backends are skipped next launch.
- Winning probes report adapter limits; GPUs without shader storage
  buffers get the packed compatibility renderer automatically, with
  a startup command-line notice so the switch is never silent.
2026-09-18 11:26:25 +01:00
Panos 472bb9883d Merge pull request #1337 from HakanSeven12/plot/b1-plot-settings-compat
fix(plot): write page setups in the file format's canonical form
2026-09-17 18:14:17 +03:00
PanosandClaude Opus 5 8e09bd8463 fix(plot): follow the fixture's page-setup conventions
A drawing saved by a commercial CAD application (tests/fixtures/plot,
provided by Panos: one 10 m line, three layouts) corrects several
assumptions of the previous commit:

- rotation is relative to the medium's own orientation: an unchanged sheet
  keeps the driver's exact medium (its PDF driver lists landscape media of
  its own, written with rotation 0; a system printer's portrait A3 plotted
  landscape carries 90); only a newly picked sheet is written as the
  catalogue's portrait medium
- the stored scale factor (DXF 147) is the ratio × 25.4 on millimetre page
  setups and the plain ratio on inch ones; the "use standard scale" bit
  stays clear for standard and custom scales and is set for fit-to-paper;
  a standard code is kept across a paper-unit conversion ("1:1" on an
  inch page setup over a millimetre paper space is 1 in = 25.4 units)
- layout plots take the same scale path as every other area, so a foreign
  layout's paper-space unit survives
- "plot with plot styles" / "display plot styles" round-trip as the
  dialog's checkboxes, independent of a style table being named
- layout limits place the sheet at minus its displayed margins, the way the
  source application does (the printable corner is the paper-space origin);
  the margin ↔ rotation mapping shared by the printable-area guide now
  turns the medium's top margin into the layout's left one at 90°

The fixture round-trips through the dialog with every stored field
unchanged; picking a new sheet on it writes the canonical form.

Co-Authored-By: Claude Opus 5 <[email protected]>
2026-09-17 18:04:38 +03:00
PanosandClaude Opus 5 276e7c7bf1 fix(plot): write page setups in the file format's canonical form
One writer (plot_settings_from_dialog) now serves both the layout's embedded
settings and named page setups, so the two can no longer drift apart:

- media are stored as the portrait sheet with the orientation in the
  rotation code (0/90/180/270; upside-down adds a half turn) instead of
  swapped width/height with rotation limited to 0/180
- standard scales are written by their code (1:1 … 100:1) with matching
  numerator/denominator; other scales as a readable custom ratio in the
  layout's own paper unit, converting from the drawing's scale-family unit
  (a metre drawing plotting "1:100" stores 10 mm = 1 unit, an inch layout
  stores 1 in = 2540 units); reading converts back and keeps a ratio the
  scale list has no name for instead of snapping to 1:1
- the layout's paper unit and every flag the dialog does not edit survive a
  round trip untouched; layout limits follow the paper-space unit
- new drawings, new layouts, CLEAR and the automation "new" op share one
  default page setup (canonical A4 name, rotation 90, none_device, 1:1
  layout plot) through Scene::reset_to_new_drawing

Scene gains scale_family_unit_mm, scale_ratio and a scale-name ratio parser
(ratios and architectural names). Round-trip tests cover orientation,
standard/custom/fit scales, unit conversion, named-setup parity, preserved
flags and the default layout.

Co-Authored-By: Claude Opus 5 <[email protected]>
2026-09-17 18:04:38 +03:00
Hakan Seven 8429ad50ec fix: harden dimension and constraint bar changes 2026-09-17 18:04:06 +03:00
Hakan Seven c8e34e47ef Merge pull request #1336 from ramox81/codex/constraintbar-command
# Conflicts:
#	src/modules/parametric/mod.rs
2026-09-17 17:58:34 +03:00
Hakan Seven a785cda92a Merge pull request #1335 from CiberNin/fix/dimension-layout-parity 2026-09-17 17:58:10 +03:00
Hakan Seven a5e8187c0f Merge remote-tracking branch 'origin/main' 2026-09-17 17:56:12 +03:00
Hakan Seven f0a3336302 fix: retain horizontal constraint axes 2026-09-17 17:55:56 +03:00
ramox81 fc4eeb3296 Add constraint bar visibility command 2026-09-17 17:41:28 +03:00
Karim Jerbi ef0c6bf403 feat: Reference Manager help window with web shortcomings
The toolbar Help button was a disabled tip that could never be clicked. It now opens a modal window explaining the manager on the web build: read-only reference list, disabled Attach/Refresh/Change Path (no filesystem access or native file pickers, so no add/reload/repath and no previews), nested read-only rows, and saved-drawing requirement for relative paths.

Includes a Report-an-issue button opening the GitHub issues page and a Close button; wired as ModalKind::XrefHelp through the shared modal frame so dismissal works on native and web.
2026-09-17 15:40:39 +01:00
Hakan Seven f9c59503f0 Merge pull request #1334 from ramox81/codex/horizontal-constraint-parity 2026-09-17 17:39:44 +03:00
Hakan Seven 80f2d5fd72 fix: solve concentric geometry in kernel 2026-09-17 17:39:01 +03:00
Hakan Seven 16c417f81d Merge pull request #1332 from ramox81/codex/concentric-constraint-parity
# Conflicts:
#	src/entities/arc.rs
#	src/entities/ellipse.rs
#	src/modules/parametric/mod.rs
#	src/scene/parametric_solve.rs
#	src/ui/overlay.rs
2026-09-17 17:24:14 +03:00
Hakan Seven e8125c8702 fix: preserve selected smooth curve geometry 2026-09-17 17:19:09 +03:00
ramox81 059906f347 Fix horizontal geometric constraint behavior 2026-09-17 17:18:59 +03:00
Hakan Seven 76451f7298 Merge pull request #1331 from ramox81/codex/smooth-constraint-parity
# Conflicts:
#	src/app/commands/styleprops.rs
2026-09-17 17:10:49 +03:00
Hakan Seven b6478b3b89 fix: solve perpendicular placement in kernel 2026-09-17 17:08:49 +03:00
Christopher Overbeck 0fdbc80e16 fix(dimension): measured cell width, DIMTMOVE 1 hook start, diameter sign, #1323 offset kept
- The per-character width estimate is 0.66 text heights, measured by
  rendering the text of 106 saved dimension pictures with the bundled
  fonts; the old 0.60 left every fit and hook estimate ten percent narrow.
  With it, the "text plus DIMGAP must clear the arrowheads" rule reproduces
  AutoCAD's arrow placement for 1047 of 1078 pictured linear dimensions
  whose text sits between the extension lines.
- DIMTMOVE 1 stores where the leader's hook starts, not where it ends: on 39
  such radial dimensions the stored point sits DIMASZ plus DIMGAP before the
  text. The hook now runs from the stored point one arrow toward the text.
- The diameter prefix is U+2205, matching the %%c expansion and the pictures.
- A diameter whose text the user dragged keeps the DIMTAD lift from #1323;
  the four AutoCAD-authored diameters with DIMTAD above in the sample all
  store the lifted point directly, so this applies only to dragged text.
2026-09-17 09:06:54 -05:00
Christopher Overbeck 8463c830f7 fix(text): resolve %%c to U+2205, the diameter sign AutoCAD writes
Saved dimension pictures across 1311 diameter dimensions carry U+2205 (806) or a
literal %%c (168); U+2300 never appears. The bundled romans and simplex fonts
have U+2205 and lack Latin O-stroke, so one character now serves the %%c
expansion and, in the dimension formatter, the diameter prefix.
2026-09-17 09:06:54 -05:00
Hakan Seven b546f9b161 Merge pull request #1327 from ramox81/codex/perpendicular-parity-followup 2026-09-17 16:56:56 +03:00
Hakan Seven c5eec2a507 fix: preserve exact mixed polyline intersections 2026-09-17 16:56:52 +03:00
Hakan Seven fa6bf5e7e4 Merge pull request #1326 from yztink/fix-polyline-intersection-snap 2026-09-17 16:52:27 +03:00
Christopher Overbeck 9e18f855cc fix(dimension): size a limits stack from the MText stack layout
The fit and break estimates used two halves at STACK_HALF_SCALE; the stack
is laid out from the lower half's baseline to the upper half's cap, which is
STACK_RAISE + STACK_HALF_SCALE of the run height. The taller estimate flips
arrows outside for a few more stacked texts that AutoCAD drew that way.
2026-09-17 08:41:14 -05:00
Christopher Overbeck 533365dc91 fix(dimension): apply a negative DIMLFAC only where AutoCAD applied it
A negative DIMLFAC scales a paper-space dimension only when it measures
model space through a viewport. AutoCAD records the factor it used as
ACAD_DIMASSOC_CALC_DIMLFAC; a zero there marks a dimension of paper-space
geometry, which reads its sheet distance unscaled. Regenerating such a
dimension multiplied it by the factor anyway, turning 4.457 into 18.110.
2026-09-17 08:41:14 -05:00
Christopher Overbeck 2cf0fc2c42 fix(dimension): run the dimension line out to outside text, straight radial leaders near horizontal
Text placed past an extension line along the dimension's own axis pulls the
dimension line out to its near edge rather than stopping at the two-arrow
stub. A radial leader already within 15 degrees of horizontal runs straight to
the text instead of turning a hook, and a diameter with outside text draws its
single leader for every DIMTMOVE except 2, which keeps only the arrowhead.

Subset parity: 870 of 1076 pictured dimensions now regenerate as drawn.
2026-09-17 08:41:14 -05:00
Christopher Overbeck 85619f49d6 fix(dimension): lay out regenerated dimensions the way their pictures were drawn
Comparing the saved picture block of every dimension in a set of production
drawings with the geometry regenerated after a refresh showed half of them
differing. The differences trace to a few layout rules:

- The stored text middle point (group 11) is where the text was drawn, for
  automatic and hand-placed text alike; a regenerated dimension keeps it and
  only a cleared point is placed from the style.
- Arrows move outside when the text, where it is drawn, would run into an
  arrowhead. The text is measured along the dimension line, so horizontal
  text on a vertical dimension counts its height, a limits stack its two
  lines and `\P` continuation lines their number.
- Text pushed outside starts past the two-arrow stub and a gap; arrow
  length is DIMASZ, not the text height.
- Horizontal text outside a non-horizontal dimension gets a leg to its
  height and a hook one arrow long that it sits against, both when drawn
  and when auto-placed.
- A radius with outside text draws no line to the centre unless DIMTOFL,
  a leader to a hook the text sits against, and an arrowhead whose body
  points toward the text. A diameter with outside text and no DIMTOFL is a
  single leader with one arrowhead, no line across the circle.
- DIMTMOVE 1 stores the hook end; the leader is drawn to it exactly.
- Width estimates measure the widest `\P` line and skip MText format codes.

On a 30-drawing subset with 1076 pictured dimensions the regenerated
drawing now matches the picture for 838 of them, up from 584.
2026-09-17 08:41:14 -05:00
ramox81 d9f3d71342 Fix Concentric build integration 2026-09-17 16:21:39 +03:00
Panos 8e05ed552c Merge pull request #1330 from mechpanos/feat/right-click-menus
feat(ui): right-click context menus with command keywords, PLINE/ARC keyword parity, grip menu
2026-09-17 16:05:31 +03:00
Karim Jerbi 4aa699e08d feat: editable grid spacing and major grid lines in Drafting Settings
The Snap and Grid tab showed static grid values with dead checkboxes, and every grid line stroked identically.

Grid X/Y spacing and Major-line-every are now editable inputs (validated 2-100 for majors, dirty-tracked, applied with an error message on bad input); Adaptive-grid and Display-beyond-Limits checkboxes are wired to live state. Every Nth line partitions into major_segments and strokes subtly brighter (1.5x alpha, 0.75px) for the reference hierarchy. GRIDMAJOR state persists to UserSettings. Covers partition, invalidation, and parse tests.
2026-09-17 13:52:37 +01:00
Karim Jerbi 05f462f294 fix: honor GRIDUNIT X/Y spacing and LIMITS option in grid display
The viewport grid ignored the configured spacing and forced square grids: compute_grid_step hardcoded a 1.0 base, a single shared step drove both line families (including the tangent derivative used for gap measurement), and the display always clipped to LIMITS despite the beyond-Limits option.

Grid spacing now scales per-axis from GRIDUNIT via compute_grid_steps (adaptive 5x growth, fixed passthrough), GridParams carries step_x/step_y, snap tolerances follow the visible steps, and the LIMITS clip is skipped when beyond-Limits is set. Also fixes a per-axis overflow fallback that returned the X base for Y. Spacing state (X/Y, adaptive, beyond-Limits) is stored on the app and persisted to UserSettings at defaults; dialog wiring follows separately.
2026-09-17 13:52:37 +01:00
ramox81 a6a70420c4 fix: align concentric constraint behavior 2026-09-17 15:31:26 +03:00
ramox81 025398bbb1 Preserve spline grip display mode after smooth solve 2026-09-17 14:54:33 +03:00
Hakan Seven bb29b987c2 fix: compact repeated nested block geometry 2026-09-17 14:34:10 +03:00
ramox81 5497f455ef Complete spline fit and control grip modes 2026-09-17 14:29:26 +03:00
Karim Jerbi 84e85ae693 Merge pull request #1329 from ramox81/codex/windows-printer-handle
Update Windows printer handle type
2026-09-17 12:09:12 +01:00
ramox81 6260723937 Revert "Match Smooth connected-endpoint workflow"
This reverts commit dfa75f45b5.
2026-09-17 13:50:15 +03:00
ramox81 dfa75f45b5 Match Smooth connected-endpoint workflow 2026-09-17 13:37:25 +03:00
ramox81 7c6665153c Complete Smooth G2 constraint workflow 2026-09-17 12:39:23 +03:00
PanosandClaude Opus 5 0fbb5bcb4f ui: neutral wording in code and help text; keywords first in the command menu
Comments and the Options help text describe the behaviour of commercial
solutions without naming any product. The command menu puts the command's
keywords directly under Enter / Cancel, with Recent Input and Snap
Overrides below them, so the choices that change from step to step are the
closest to the pointer.

Co-Authored-By: Claude Opus 5 <[email protected]>
2026-09-17 12:05:15 +03:00
PanosandClaude Opus 5 02cd98e790 feat(ui): feature-parity context menu — Snap Overrides, transparent Pan/Zoom, ARC keyword flow
The command menu now follows the commercial solutions' layout row for row: Enter, Cancel,
Recent Input ▸, the command's keywords, Snap Overrides ▸ (every object snap
with its glyph, Mid Between 2 Points, None, Osnap Settings…), then Pan and
Zoom. Pan / Zoom run transparently while a command is active ('PAN,
'ZOOM …): navigation modes leave the command untouched and an interactive
ZOOM Window parks it and resumes it afterwards. Rows carry an icon gutter
so labels align; the Enter row shows a default value ("<0.5000>") as its
hint instead of a second finish row.

ARC gets the commercial solutions' prompt flow with all keywords: start [Center], second
point [Center/End], end; after Center: end [Angle/chord Length]; after
End: center [Angle/Direction/Radius]; Enter continues tangent. The
previous default (Center/Start/End with method codes) stays as ARC_CSE.

Object snaps gain a one-shot "None" override. New strings in all locales.

Co-Authored-By: Claude Opus 5 <[email protected]>
2026-09-17 12:05:15 +03:00
PanosandClaude Opus 5 96df4928c7 ui: fit the context menu above the command area; right-button control actions
Rows are 22 px (as the grip popup), the edit menu drops Select All and
Zoom Extents (both stay on the idle menu, matching the commercial solutions' edit menu),
and cursor-anchored panels now reserve the overlaid prompt lines
(CLIPROMPTLINES) as well as the input row, so a long menu is never hidden
behind the command area — it scrolls inside the visible canvas instead.

The automation port gains `pointer_right_press` / `pointer_right_release`
actions so scripts and MCP clients can exercise the context menu.

Co-Authored-By: Claude Opus 5 <[email protected]>
2026-09-17 12:05:15 +03:00
PanosandClaude Opus 5 426af2d3a5 i18n: catalogue entries for the context menu, PLINE and modify options
Every new UI string (menu rows, Options → Right-click Customization, the
PLINE sub-prompts and keyword labels, MOVE/COPY/OFFSET prompts) gets its
Fluent attribute in all 21 locales plus the source → attribute rows in
locale_catalog.rs; the SETVAR help line lists SHORTCUTMENU and
SHORTCUTMENUDURATION. Tests that compared prompt text now check command
state so they pass under any UI language.

Co-Authored-By: Claude Opus 5 <[email protected]>
2026-09-17 12:05:15 +03:00
PanosandClaude Opus 5 a5fd040745 feat(grips): compatible grip shortcut menu
A right-click while a grip is hot opens the grip menu: Enter places the
grip, Stretch / Move / Rotate / Scale / Mirror switch how the gripped
objects are edited (the latter four hand the selection to the matching
command with the grip as its base point), Base Point re-bases the gesture
at the next click, Copy leaves the originals in place and adds the moved
shapes as new entities while keeping the grip hot, Undo snaps the shapes
back to where the gesture started, Exit drops the edit.

The grip commit path moves out of the left-release handler into
`commit_active_grip_edit` so the menu, Enter and the placement click share
it; Enter with a hot grip now places it instead of repeating the last
command.

Co-Authored-By: Claude Opus 5 <[email protected]>
2026-09-17 12:05:14 +03:00
PanosandClaude Opus 5 d753874fe4 feat(modify): commercial solutions keyword options for MOVE, COPY, FILLET, CHAMFER, OFFSET
MOVE: Displacement, Enter at the second point uses the base as the vector.
COPY: Displacement, mOde (Single/Multiple), Undo of the last copy.
FILLET: Undo of the last fillet (the command refreshes its entity cache
through the new CadCommand::on_document_undone hook after the host undoes
the document step). CHAMFER: Multiple and Undo. OFFSET: Erase (the offset
replaces its source), Layer (Current/Source), Undo, Exit.
POLY3D, TRACE, MIRROR and MEASUREGEOM expose the keywords they already
accepted as options, so the context menu and option buttons list them.

The pinned prompt now keeps informational bracket groups such as
"[3 objects]" and only drops real option listings when the buttons take over.

Co-Authored-By: Claude Opus 5 <[email protected]>
2026-09-17 12:05:14 +03:00
PanosandClaude Opus 5 c0bc44c4f6 feat(pline): commercial solutions keyword parity — Width/Halfwidth/Length and arc sub-modes
PLINE now offers the commercial solutions' full option set: Arc/Close/Halfwidth/Length/
Undo/Width in line mode and Angle/CEnter/CLose/Direction/Halfwidth/Line/
Radius/Second pt/Undo/Width in arc mode, including the nested prompts
(Angle → CEnter/Radius, CEnter → Angle/Length, Radius → Angle → chord
direction). Widths land in the LwPolyline vertices (start/end per segment,
the end width carrying into the next segment) and PLINEWID persists per
session. Undo / Escape inside a sub-prompt only back out of it; every
sub-step previews its arc at the cursor.

Co-Authored-By: Claude Opus 5 <[email protected]>
2026-09-17 12:05:14 +03:00
PanosandClaude Opus 5 e623c053ab feat(ui): compatible right-click context menu driven by command options
The viewport context menu is now built from a pure model
(ui::popup::context_menu) rendered by the overlay: while a command runs it
offers Enter / Cancel / every keyword of the command's options() with the
keyword shown as a hint, a Recent Input submenu and M2P; when idle it offers
Repeat, Recent Input, Clipboard, Undo/Redo with history labels, the edit
block (Erase/Move/Copy/Scale/Rotate/Mirror/Draw Order), Isolate, Pan/Zoom,
selection tools, Properties and Options. The default row is anchored under
the pointer and the menu is keyboard-navigable (arrows, Enter, mnemonic
letters; any other key closes it and types into the command line).

Right-click behaviour is a user preference (Options → User Preferences,
SHORTCUTMENU / SHORTCUTMENUDURATION): shortcut menu (commercial solutions default),
time-sensitive, or the previous Enter-first cycle.

LINE gains options() (Close/Undo/eXit).

Co-Authored-By: Claude Opus 5 <[email protected]>
2026-09-17 12:05:14 +03:00
ramox81 5bbd61d6a5 Update Windows printer handle type 2026-09-17 10:49:29 +03:00