Commit Graph
2474 Commits
Author SHA1 Message Date
ramox81 27f648d2bb Align BOX properties and history controls 2026-08-28 16:36:46 +03:00
ramox81 e7eb487cd8 Complete BOX construction workflows 2026-08-28 16:32:35 +03:00
Karim Jerbi cc430cdbe9 perf(ui): cache svg::Handle in themed* icon functions
The 9 themed* functions that take &'static [u8] artwork each built a
fresh svg::Handle::from_memory(bytes) on every call, with 113
icons::themed call sites per frame across ribbon/statusbar/popups.
Add a thread_local THEMED_CACHE keyed by the bytes' (address, length)
and a single themed_handle(bytes) helper; the 9 themed* functions all
go through it. The 13 wrapper functions (themed_arrow_*, themed_home,
themed_undo, themed_redo, themed_check_cell, ...) delegate to those 9
and pick up the cache transparently, so all 22 themed* functions (and
the 113 call sites) are deduped.

The cache key is (address, length) -- not pointer alone -- to match the
existing SEMANTIC_CACHE belt-and-braces pattern and guard against any
future call site that passes a sub-slice of a static (e.g. &BYTES[1..]),
which would otherwise alias the wrong handle. Every include_bytes!
produces a unique static slice today, so the length is defensive.

Construction is amortised to once per artwork per process. No semantic
change; visual output is byte-identical.

Measured performance gains (integrated
themed_cache_speedup_over_uncached_handle_creation bench, 20_000
iterations each, same machine):

  |                | dev profile   | release profile |
  |----------------|---------------|-----------------|
  | Before         | 235 ns/iter   | 26 ns/iter      |
  | After (cached) |  78 ns/iter   |  9 ns/iter      |
  | Cold miss      | 900 ns        | 100 ns          |
  | Speedup        | 3.0x          | 2.9x            |

Release-mode warm path: 9 ns/iter. At 60 fps with up to 113 themed*
calls per frame, that is ~1 us/frame of handle work -- a rounding
error against a 16.6 ms frame budget. The cold-miss cost (one parse
+ one insert, 100 ns release) is the one-time price per new artwork
and is amortised to negligible per-frame overhead (it happens at
most once per artwork per process). The speedup is stable at ~3x
across dev and release because the ratio of work is the same:
hashmap-get + Handle clone vs. a full SVG parse + allocation.

test ui::icons::themed_cache_tests::themed_cache_returns_same_handle_for_same_bytes
test ui::icons::themed_cache_tests::themed_cache_caches_distinct_bytes_separately
test ui::icons::themed_cache_tests::themed_cache_speedup_over_uncached_handle_creation
2026-08-28 06:05:31 +01:00
Karim Jerbi 4f2cf5f516 test(app): add chprop integration tests for handler dispatch and undo
Add a new #[cfg(test)] mod chprop_integration_tests to src/app/properties.rs
with four end-to-end tests that exercise the converted CHPROP / MATCHPROP
handlers through the real Message dispatcher and the CLI command driver:

- prop_color_change_multiple_entities_undo_redo: a colour change on two
  selected lines flows through Message::PropColorChanged -> the property-op
  handler -> apply_property_op, and is reversible via undo / redo. Seeds
  the panel's source_handles (selected_handles() is empty in this test
  setup) so the converted non-empty branch runs.

- prop_change_on_locked_layer_is_ignored: when a selected entity's layer
  is locked, property_target_handles filters it out and the handler's
  empty-handles branch leaves the entity itself untouched. Asserts the
  entity-level invariant only; the empty branch updates the document
  header (CECOLOR) and sets dirty as a separate, pre-existing behaviour.

- ribbon_lineweight_updates_after_change: the Home-ribbon Lineweight chip
  is updated by the converted RibbonLineweightChanged handler. Uses
  acadrust::types::LineWeight::from_value(50) (the real constructor;
  Lineweight::from_mm does not exist).

- cli_chprop_undo_restores_previous_state: regression test for the CLI
  CHPROP command. Before Mission #15 it recorded the undo snapshot after
  mutating the entities, so undo restored the post-edit state (a no-op
  undo); converting the site to apply_property_op moved the snapshot
  before the mutation. #[ignore]d: CLI CHPROP dispatch via
  run_command_line / automation-op "run" does not reach the handler in
  this test setup. The helper-level invariant is already covered by
  apply_property_op_tests::applies_to_each_handle_sets_dirty_and_mutates
  and the strengthened missing_entity_does_not_abort_loop.

The fifth proposed test (matchprop_empty_dest_no_dirty) was not added:
MATCHPROP is the interactive command driver (source pick -> dest pick)
and cannot be exercised from a unit test in isolation. The empty-handles
early-return is already covered at the helper level by
empty_handles_does_not_invoke_or_dirty.

Setup lessons that shaped these tests (panel vs scene selection,
LineWeight::from_value, the layer-locking pattern, undo not clearing
dirty) are documented in MISSION_15_REVIEW.md section 6.2.

Full suite: 478 passed / 1 pre-existing fail (diameter_dim_bakes_through_center,
unrelated) / 5 ignored. No regression. No production code changed -- the
new module is #[cfg(test)]-only.

test app::properties::chprop_integration_tests::prop_color_change_multiple_entities_undo_redo
test app::properties::chprop_integration_tests::cli_chprop_undo_restores_previous_state
test app::properties::chprop_integration_tests::prop_change_on_locked_layer_is_ignored
test app::properties::chprop_integration_tests::ribbon_lineweight_updates_after_change
2026-08-27 23:24:32 +01:00
Karim Jerbi 7beb729d85 refactor(app): single-source CHPROP/MATCHPROP 4-step recipe via apply_property_op
Extract the push-undo → per-handle → invalidate → dirty → refresh
contract into one helper on OpenCADStudio. The helper is the single
source of truth for property-op side effects, so future property
handlers can't forget the cache invalidation or the panel refresh.

Note: MATCHPROP now no-ops when the destination selection is empty
(previously it marked the tab dirty and refreshed the panel). This is
a minor correctness improvement; restore the old behaviour with a
2-line guard at the MATCHPROP call site if desired.

test app::properties::apply_property_op_tests::empty_handles_does_not_invoke_or_dirty
test app::properties::apply_property_op_tests::applies_to_each_handle_sets_dirty_and_mutates
test app::properties::apply_property_op_tests::missing_entity_does_not_abort_loop
2026-08-27 23:24:32 +01:00
Hakan Seven dffae3f16d Merge pull request #890 from ramox81/codex/fix-jogged-radius-properties
Fix jogged radius properties and layout
2026-08-28 00:35:06 +03:00
Hakan Seven 43d4403a47 fix(dimension): sync jogged radius geometry 2026-08-28 00:33:37 +03:00
gianlucafiore 1516694c72 Merge pull request #899 from gianlucafiore/fix/887-dash-lines
fix(render): improve dashed linetype rendering
v0.9.8
2026-08-27 13:56:24 -03:00
gianlucafiore a2d4caf2f0 fix(render): improve dashed linetype rendering 2026-08-27 13:51:05 -03:00
Hakan Seven 400ad404b9 chore(release): prepare v0.9.8 2026-08-27 18:01:49 +03:00
ramox81 d37c8cbd84 Align jogged radius unit and tolerance properties 2026-08-27 10:47:08 +03:00
ramox81 50c811e998 Order jogged radius fit properties 2026-08-27 10:43:20 +03:00
ramox81 dc26edbbfc Align jogged radius text properties 2026-08-27 10:43:04 +03:00
ramox81 ac81f3b045 Simplify jogged radius misc properties 2026-08-27 10:42:49 +03:00
ramox81 706645b6d8 Order general dimension properties 2026-08-27 10:42:10 +03:00
ramox81 efde152e17 Correct radial dimension rendering overrides 2026-08-27 10:31:32 +03:00
ramox81 b529c9332f Align jogged radius property controls 2026-08-27 10:31:27 +03:00
ramox81 7b58de2578 Fix jogged radius properties and layout 2026-08-27 09:36:41 +03:00
Hakan Seven ba91095bcf Merge pull request #886 from ramox81/codex/complete-jogged-radius-dimension
Complete jogged radius dimension workflow
2026-08-27 08:12:28 +03:00
Hakan Seven bc750c6d76 fix(dimension): harden jogged radius workflow 2026-08-27 08:09:02 +03:00
Karim Jerbi 513ab958a8 perf(grid): cache overlay geometry behind a params-keyed key
Introduce a cache for the grid overlay to prevent redundant geometry
reconstruction on every UI redraw. Extract the pure projection logic
from draw_grid into a renderer-free grid_segments function, and add
GridKey and GridCanvasState to memoize the resulting Geometry.

The cache key includes all per-pane GridParams and the overlay bounds,
preventing stale geometry when camera changes within the same canvas
size. On a params-key miss, the iced cache is cleared before redrawing
to bypass its bounds-only reuse.

Tests: 8 new unit tests cover key invalidation and state handling.
Benchmarks: uncached geometry ~32 us/frame vs cached decision ~90 ns,
a >99% reduction. Verified: 472 passed / 1 pre-existing failure / 4
ignored.

Tests:
  ui::overlay::grid_key_tests::grid_key_matches_identical_params
  ui::overlay::grid_key_tests::grid_key_invalidates_on_changed_fields
  ui::overlay::grid_key_tests::grid_key_invalidates_when_any_pane_changes
  ui::overlay::grid_key_tests::should_reuse_empty
  ui::overlay::grid_key_tests::should_reuse_equal
  ui::overlay::grid_key_tests::should_reuse_changed
  ui::overlay::grid_canvas_state_tests::default_state_has_no_cached_key
  ui::overlay::grid_canvas_state_tests::stored_key_is_recognized_by_should_reuse
2026-08-26 23:53:31 +01:00
Hakan Seven ae2886d5fb Merge pull request #885 from ramox81/codex/complete-arc-length-dimension
Complete arc length dimension workflow
2026-08-27 01:00:50 +03:00
Hakan Seven 6ef2d75e84 fix(dimarc): complete merge integration
Preserve source-plane geometry and associative arc parameters while combining the latest properties and tolerance workflows.
2026-08-27 01:00:23 +03:00
Hakan Seven 752e066501 fix(tolerance): merge workflow integration
Merge PR #884 with current main and pin the merged companion codec revision.
2026-08-27 00:18:39 +03:00
Hakan Seven 81e7add1dd fix(tolerance): complete workflow integration
Sync current main and companion codec changes before preserving unsupported frame rows, rendering in the entity plane, and sharing final layout metrics with placement preview.
2026-08-27 00:14:08 +03:00
Hakan Seven 24b0fdd8e5 build(deps): update cadcodec revision 2026-08-26 23:35:01 +03:00
Hakan Seven e4364b4f1d feat(branding): update application logo 2026-08-26 22:57:22 +03:00
Hakan Seven 5b302fbd7b Merge pull request #883 from ramox81/codex/complete-mtext
Complete multiline text creation, editing, properties, and layout
2026-08-26 22:52:47 +03:00
Hakan Seven 522a3f0ff5 fix(mtext): harden editor and column layout
Merge current main while preserving text property behavior. Bound column allocations and correct boundary, UCS, caret, and column-flow calculations.
2026-08-26 22:51:32 +03:00
Hakan Seven 0e98c4857b Merge pull request #882 from ramox81/codex/fix-single-line-text
Complete single-line text behavior and properties
2026-08-26 22:24:14 +03:00
Hakan Seven 0603aae286 fix(text): correct scaled text placement
Derive two-point layout and continuation spacing from the effective annotation scale. Keep style flags out of per-entity mirror overrides.
2026-08-26 22:21:40 +03:00
gianlucafiore 3a817cb379 Merge pull request #889 from gianlucafiore/feat/offset-reference-distance
Improve OFFSET distance input
2026-08-26 15:59:34 -03:00
gianlucafiore 79f045ce68 feat(offset): add reference distance input 2026-08-26 15:58:36 -03:00
Hakan Seven f157b4a9ff Merge pull request #881 from schoeller/v4-selection-broadcast
feat(plugin): emit SelectionChangedV4 to V4 plugins and add ocs_plugi…
2026-08-26 21:48:35 +03:00
Hakan Seven 4053f2c381 docs(plugin): fix runner connection flow 2026-08-26 21:48:02 +03:00
Hakan Seven cfe1ad0006 perf(selection): cache plugin fingerprint 2026-08-26 21:48:02 +03:00
gianlucafiore 0c68fe1084 Merge pull request #888 from gianlucafiore/fix/align-ux
Improve ALIGN command UX
2026-08-26 15:20:06 -03:00
gianlucafiore 0754c928ce improve ALIGN command interaction and preview 2026-08-26 15:15:03 -03:00
ramox81 5a9894fd3e Complete jogged radius dimension workflow 2026-08-26 17:17:55 +03:00
ramox81 83d41b0f7d Remove handle from general properties 2026-08-26 15:56:03 +03:00
ramox81 8aca9a0aef Complete arc length dimension workflow 2026-08-26 15:32:37 +03:00
Hakan Seven bbd58eb9f2 fix(layout): identify sheet viewports reliably 2026-08-26 14:23:08 +03:00
ramox81 66bf4b1d5f Honor fixed tolerance text styles 2026-08-26 14:19:24 +03:00
ramox81 d039bcd4f9 Expose tolerance annotation properties 2026-08-26 14:19:01 +03:00
ramox81 aa552d48e4 Align tolerance property rows 2026-08-26 14:18:43 +03:00
ramox81 de294447a9 Complete geometric tolerance workflow and properties 2026-08-26 13:54:20 +03:00
ramox81 1922492a95 Make MText defined width read-only 2026-08-26 12:06:51 +03:00
ramox81 b1df6dddd8 Use MText column persistence revision 2026-08-26 11:48:25 +03:00
ramox81 8b6724700e Render MText column masks independently 2026-08-26 11:48:24 +03:00
ramox81 af4401ce67 Complete MText editor controls and persistence 2026-08-26 11:48:23 +03:00