Skip to content

Refactor clear_all resets and file-local helper layout - #245

Merged
trailcode merged 6 commits into
mainfrom
Trailcode/refactor
Aug 4, 2026
Merged

Refactor clear_all resets and file-local helper layout#245
trailcode merged 6 commits into
mainfrom
Trailcode/refactor

Conversation

@trailcode

@trailcode trailcode commented Aug 4, 2026

Copy link
Copy Markdown
Owner

Summary

  • Extend clear_all for enums and aggregates; convert multi-field reset sites across shape, sketch, and GUI.
  • Align anonymous-namespace helpers with trailing _ names, top forward decls, and bottom definitions (GUI, shape/sketch, utl_*, main).
  • Document the convention in docs/ezycad_code_style.md and clear_all coverage in src/doc/utility.md.
  • DRY ImGui add-primitive numeric rows via table_row_input_double_.

Closes #244

Test plan

  • Release build of EzyCad / EzyCad_tests
  • Full CTest Release (127/127)
  • Spot-check add-primitive dialogs and a few tools that use clear_all resets (move/rotate/extrude/cyl-align)

Notes

  • Script-console bindings (scr_*.cpp) left alone on purpose.
  • Explicit AIS Remove/Erase-then-Nullify sequences unchanged where order matters.

Note

Low Risk
Refactor and style alignment with no intentional behavior change; clear_all on enums/aggregates is the main semantic extension and is covered by existing tests per the PR test plan.

Overview
clear_all now value-initializes enums and aggregates (in addition to handles via Nullify, optionals, containers, etc.), with docs updated in utility.md and utl.h/utl.inl. Many multi-field reset sites in GUI, OCCT view, and shape/sketch tools (move, rotate, extrude, cyl_align, cross-section, dims, underlay, …) are consolidated to clear_all(...) instead of hand-written Nullify() / per-field clears. Shp_cyl_align::reset() delegates to begin(); Shp_rotate gains clear_rotation_vis_() for AIS cleanup.

Code organization follows the documented reader-first / helpers-at-bottom pattern: anonymous-namespace helpers get trailing _ names, forward declarations at the top, definitions at the bottom (gui.cpp log helpers, gui_settings.cpp ImGui JSON/UI, gui_occt_view.cpp STEP import and grid helpers, utl_cad_file_info.cpp, main.cpp CLI parse, and similar across shp_* / skt_* / utl_*). docs/ezycad_code_style.md spells out that convention for private methods and file-local helpers.

gui_add.cpp replaces repeated ImGui table rows with table_row_input_double_ for all add-primitive dialogs. Minor formatting-only tweaks elsewhere (gui.h alignment, planar-face brace cleanup).

Reviewed by Cursor Bugbot for commit 4260889. Bugbot is set up for automated code reviews on this repo. Configure here.

@trailcode
trailcode merged commit ac45e04 into main Aug 4, 2026
4 checks passed
@trailcode
trailcode deleted the Trailcode/refactor branch August 4, 2026 23:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor clear_all resets and file-local helper layout

1 participant