Summary
This work adds a bundled default .ezy that loads on startup, an optional user-specific startup project (Blender-style), correct persistence and restoration of UI mode in project files, startup diagnostics in the log panel, a selectable / copyable log (read-only multiline ImGui input), and CMake/copy/preload wiring for native and Emscripten builds. Documentation in usage.md describes the startup-project flow.
What changed
Build & resources (CMakeLists.txt)
- Preload
res/default.ezy into the Emscripten virtual FS (Release and Debug linker flags).
- Post-build copy of
res/default.ezy next to the executable for native and Emscripten output (alongside existing res/ezycad_settings.json copy).
Bundled template (res/default.ezy)
- New committed default project (includes sample geometry, sketch, view block,
mode).
Startup & user override (src/gui.cpp, src/gui.h, src/settings.cpp, src/settings.h)
load_default_project_() after init: tries saved startup first, then res/default.ezy, with JSON validation and fallback messaging.
- User startup:
startup.ezy under OS config dir (Windows %APPDATA%\EzyCad\, macOS ~/Library/Application Support/EzyCad/, Linux $XDG_CONFIG_HOME/EzyCad or ~/.config/EzyCad/); Emscripten: localStorage key ezycad_startup_ezy.
- Settings window: Startup project section — “Save current as startup project” / “Clear saved startup”.
- After loading a startup template,
m_last_saved_path is cleared so Save does not target the startup file by default.
on_file(..., announce_load) — startup loads use announce_load = false (no “Opened” toast).
serialized_project_json_() — shared serialization for Save and save-startup (includes mode).
- Startup logging to the log panel (ASCII-only punctuation so the bundled font does not show
? for Unicode ellipsis/arrows).
Mode after open (src/occt_view.cpp, src/gui.cpp)
- Removed
gui().set_mode(Mode::Normal) at end of Occt_view::load(), which previously overwrote mode restored from the file.
on_file applies mode from JSON after m_view->load(); missing/invalid mode → Normal.
Log panel (src/gui.cpp, src/gui.h)
- Replaced per-line
TextWrapped with a single InputTextMultiline buffer (read-only) for text selection and copy (Ctrl+C when focused).
ImGuiInputTextFlags_CallbackAlways + small callback to scroll caret to end when new lines are appended.
Docs (usage.md)
- New “Startup project (defaults)” section (Settings-based workflow, paths, web storage).
Suggested testing
- Clean profile: No
startup.ezy / no localStorage entry — app loads res/default.ezy, log shows bundled path; mode matches file.
- Save startup: Settings → save startup — restart — saved project loads; Save still prompts or uses last path only after a normal Open/Save-as.
- Clear startup — next run uses bundled default again.
.ezy round-trip: Save with a non-Normal mode, reopen — mode restored.
- Log: Select log text, copy with Ctrl+C.
- Wasm: Preload present; startup from localStorage if set.
- Native: POST_BUILD copy places
res/default.ezy beside the binary; run CWD as build output (existing VS debug layout).
Optional follow-ups
- Add trailing newline to
res/default.ezy if tooling complains (\ No newline at end of file in diff).
- Consider factory reset that reloads bundled default in-session without restart.
- localStorage size limits for very large startup projects on web.
Summary
This work adds a bundled default
.ezythat loads on startup, an optional user-specific startup project (Blender-style), correct persistence and restoration of UI mode in project files, startup diagnostics in the log panel, a selectable / copyable log (read-only multiline ImGui input), and CMake/copy/preload wiring for native and Emscripten builds. Documentation inusage.mddescribes the startup-project flow.What changed
Build & resources (
CMakeLists.txt)res/default.ezyinto the Emscripten virtual FS (Release and Debug linker flags).res/default.ezynext to the executable for native and Emscripten output (alongside existingres/ezycad_settings.jsoncopy).Bundled template (
res/default.ezy)mode).Startup & user override (
src/gui.cpp,src/gui.h,src/settings.cpp,src/settings.h)load_default_project_()after init: tries saved startup first, thenres/default.ezy, with JSON validation and fallback messaging.startup.ezyunder OS config dir (Windows%APPDATA%\EzyCad\, macOS~/Library/Application Support/EzyCad/, Linux$XDG_CONFIG_HOME/EzyCador~/.config/EzyCad/); Emscripten:localStoragekeyezycad_startup_ezy.m_last_saved_pathis cleared so Save does not target the startup file by default.on_file(..., announce_load)— startup loads useannounce_load = false(no “Opened” toast).serialized_project_json_()— shared serialization for Save and save-startup (includes mode).?for Unicode ellipsis/arrows).Mode after open (
src/occt_view.cpp,src/gui.cpp)gui().set_mode(Mode::Normal)at end ofOcct_view::load(), which previously overwrote mode restored from the file.on_fileappliesmodefrom JSON afterm_view->load(); missing/invalidmode→ Normal.Log panel (
src/gui.cpp,src/gui.h)TextWrappedwith a singleInputTextMultilinebuffer (read-only) for text selection and copy (Ctrl+Cwhen focused).ImGuiInputTextFlags_CallbackAlways+ small callback to scroll caret to end when new lines are appended.Docs (
usage.md)Suggested testing
startup.ezy/ no localStorage entry — app loadsres/default.ezy, log shows bundled path; mode matches file..ezyround-trip: Save with a non-Normal mode, reopen — mode restored.res/default.ezybeside the binary; run CWD as build output (existing VS debug layout).Optional follow-ups
res/default.ezyif tooling complains (\ No newline at end of filein diff).