Preferences window (File › Preferences): theme, units of new designs, recovery copies every N minutes (to a Recovery folder beside the preferences), mouse presets (Fusion, SolidWorks, Inventor), reverse zoom, orbit around the point under the cursor, grid, perspective, visual style, display precision, anti-aliasing (on restart), sketch and selection options; all kept between runs; ui.prefs control method

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AS5Tn3xieewUSg3uxrMVdL
This commit is contained in:
bherbruckandClaude Opus 5.5 committed 2026-10-08 12:09:31 +00:00
1 parent bfa70f005b
commit c99e7e41ec
7 files changed
+420 -9

No files matched your search

+13
View File
@@ -32,6 +32,7 @@ pub mod keymap;
mod menu_tests;
pub mod palette;
pub mod params_dialog;
pub mod prefs;
#[cfg(test)]
mod preselect_tests;
pub mod preview;
@@ -129,6 +130,8 @@ impl Default for UiState {
pub struct Services {
pub pick_open: Option<Box<dyn Fn() -> Option<String>>>,
pub pick_save: Option<Box<dyn Fn(&str, &[&str]) -> Option<String>>>,
/// Where the host reads the anti-aliasing preference at start (a small JSON file).
pub graphics_path: Option<String>,
}
pub struct SolveApp {
@@ -161,6 +164,9 @@ pub struct SolveApp {
pub keymap: keymap::Keymap,
/// The Help menu and the About window.
pub help: help::HelpState,
/// Preferences kept between runs, and their window.
pub preferences: prefs::Prefs,
pub prefs_window: prefs::PrefsWindow,
pub preview: preview::PreviewState,
/// The last command started interactively (id, label), for Repeat.
pub last_command: Option<(String, String)>,
@@ -215,6 +221,8 @@ impl SolveApp {
sbox: shortcut_box::ShortcutBox::default(),
keymap: keymap::Keymap::default(),
help: help::HelpState::default(),
preferences: prefs::Prefs::default(),
prefs_window: prefs::PrefsWindow::default(),
preview: preview::PreviewState::default(),
last_command: None,
esc_handled: false,
@@ -262,6 +270,7 @@ impl SolveApp {
"shortcut_box": self.sbox.prefs(),
"shortcuts": self.keymap.prefs(),
"autosave_minutes": self.autosave_minutes,
"preferences": self.preferences,
})
.to_string()
}
@@ -311,6 +320,9 @@ impl SolveApp {
if let Some(s) = v.get("shortcuts") {
self.keymap.load(s);
}
if let Some(p) = v.get("preferences").and_then(|p| serde_json::from_value::<prefs::Prefs>(p.clone()).ok()) {
self.preferences = p;
}
}
pub fn with_control(mut self, rx: Receiver<ControlRequest>) -> Self {
@@ -698,6 +710,7 @@ impl SolveApp {
}
shortcut_box::show(self, ui.ctx());
keymap::show(self, ui.ctx());
prefs::show(self, ui.ctx());
self.frame_ms = now_ms() - t0;
}