forked from 1b-agent/opencadstudio-upstream
fix(ribbon): highlight follows each tool's mechanism; start-tab dimming (#355)
Tool highlights used to stick: every click set active_tool, but only interactive commands and a hand-maintained per-modal list ever cleared it, so one-shots (Cleanup/AUDIT, view actions) and unlisted dialogs (Customization/ALIASEDIT, CUI, Plugin Manager…) stayed blue forever. Now the rule is mechanical: state toggles light from state only (the click highlight drops immediately), interactive commands stay lit while running, dialog openers stay lit until the modal closes (generic clear replaces the per-modal list), and one-shots never keep it — the dispatch site turns the highlight off when nothing stayed running. On the Start tab, tools whose command the start gate refuses now render dimmed (grey icon + label) across all button styles, dropdowns and the quick-access strip; start_allowed() is the single shared authority. Co-Authored-By: Claude Fable 5 <[email protected]>
This commit is contained in:
1 parent
7a93ba82b3
commit
b7457ba09d
7 files changed
+159
-90
No files matched your search
+8
-28
@@ -81,33 +81,6 @@ impl OpenCADStudio {
|
||||
self.scale_stage_discard();
|
||||
}
|
||||
match self.active_modal {
|
||||
Some(Layers) => self.ribbon.deactivate_tool_if("LAYERS"),
|
||||
Some(Plot) => {
|
||||
self.ribbon.deactivate_tool_if("PLOT");
|
||||
self.ribbon.deactivate_tool_if("PRINT");
|
||||
self.ribbon.deactivate_tool_if("PAGESETUP");
|
||||
}
|
||||
Some(TextStyle) => {
|
||||
self.ribbon.deactivate_tool_if("STYLE");
|
||||
self.ribbon.deactivate_tool_if("TEXTSTYLE");
|
||||
}
|
||||
Some(TableStyle) => self.ribbon.deactivate_tool_if("TABLESTYLE"),
|
||||
Some(MlStyle) => self.ribbon.deactivate_tool_if("MLSTYLE"),
|
||||
Some(MLeaderStyle) => self.ribbon.deactivate_tool_if("MLEADERSTYLE"),
|
||||
Some(LayoutManager) => {
|
||||
self.ribbon.deactivate_tool_if("LAYOUTMANAGER");
|
||||
self.ribbon.deactivate_tool_if("LAYOUTPANEL");
|
||||
}
|
||||
Some(Plotstyle) => {
|
||||
self.ribbon.deactivate_tool_if("PLOTSTYLE");
|
||||
self.ribbon.deactivate_tool_if("STYLESMANAGER");
|
||||
}
|
||||
Some(DimStyle) => self.ribbon.deactivate_tool_if("DIMSTYLE"),
|
||||
Some(Shortcuts) => {
|
||||
self.ribbon.deactivate_tool_if("SHORTCUTS");
|
||||
self.ribbon.deactivate_tool_if("KEYBOARD");
|
||||
}
|
||||
Some(About) => self.ribbon.deactivate_tool_if("ABOUT"),
|
||||
// Dismissing these via ✕ is the cancel/decline path.
|
||||
Some(Unsaved) => self.pending_close = None,
|
||||
Some(AssocPrompt) => self.mark_assoc_prompted(),
|
||||
@@ -125,10 +98,17 @@ impl OpenCADStudio {
|
||||
// style editors. Committing happens only through the Apply button.
|
||||
Some(Aliases) => {
|
||||
self.alias_editor_rows.clear();
|
||||
self.ribbon.deactivate_tool_if("ALIASEDIT");
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
// The tool that opened this dialog is done with it now. Keep the
|
||||
// highlight only while an interactive command still runs (it owns
|
||||
// it). Replaces the old per-modal deactivate_tool_if list, which
|
||||
// missed every newly added dialog (CUI, Plugin Manager, Point
|
||||
// Style, Attribute Editor…). (#355)
|
||||
if self.tabs[self.active_tab].active_cmd.is_none() {
|
||||
self.ribbon.deactivate_tool();
|
||||
}
|
||||
self.active_modal = None;
|
||||
// Recentre / reset the size of the next dialog and drop any drag.
|
||||
self.modal_offset = iced::Vector::ZERO;
|
||||
|
||||
Reference in new issue
Block a user