fix(ribbon): highlight toggle buttons by their actual state

The UCS Icon, Properties, File Tabs, and Layout Tabs buttons were highlighted unconditionally because their ids fell through to an active_tool equality check in is_active_tool, which activate_tool sets on every click and never clears. Each id is now mapped to its corresponding visibility flag (show_ucs_icon, show_properties, show_file_tabs, show_layout_tabs), and those flags are kept in sync from their toggle handlers so the highlight reflects live state. The per-toggle booleans previously threaded through the render path are consolidated into a single ToggleState struct read from one place, so introducing a further toggle no longer requires changing every render-function signature and call site.
This commit is contained in:
Karim Jerbi authored and Hakan Seven committed 2026-07-12 19:53:48 +03:00
1 parent 15d1bdbdfe
commit 8ef65f59f8
4 files changed
+88 -54

No files matched your search

+3
View File
@@ -1567,14 +1567,17 @@ impl OpenCADStudio {
}
Message::ToggleProperties => {
self.show_properties ^= true;
self.ribbon.set_properties(self.show_properties);
Task::none()
}
Message::ToggleFileTabs => {
self.show_file_tabs ^= true;
self.ribbon.set_file_tabs(self.show_file_tabs);
Task::none()
}
Message::ToggleLayoutTabs => {
self.show_layout_tabs ^= true;
self.ribbon.set_layout_tabs(self.show_layout_tabs);
Task::none()
}
Message::ToggleOTrack => {