forked from 1b-agent/opencadstudio-upstream
feat(ribbon): highlight the running command's button
A command started from the command line, an alias, a shortcut or Repeat now lights the same ribbon button a click on it would, so users learn where the tools they type live. A button inside a dropdown lights the dropdown, a slide-out tool lights its group title, a tool hidden in a collapsed panel lights the panel's opener, and a button on another tab lights that tab's header. Always on, in the existing active-button blue. Buttons are matched by the command they dispatch, so ids that differ from their command still resolve; the tab on show wins when a command appears twice, and a clicked button keeps its highlight. Transparent commands leave the running command lit. The #355 rule that a highlight lasts only while something runs moves from the ribbon click handler into dispatch_command, so typed commands are cleared the same way. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
3f54f2f494
commit
1093900a49
11 files changed
+425
-33
No files matched your search
@@ -120,25 +120,9 @@ pub(super) fn on_ribbon_tool_click(&mut self, tool_id: String, event: ModuleEven
|
||||
self.ribbon.note_panel_tool(&tool_id);
|
||||
self.ribbon.activate_tool(&tool_id);
|
||||
match event {
|
||||
ModuleEvent::Command(cmd) => {
|
||||
let task = self.dispatch_command(&cmd);
|
||||
// One-shot tools (view changes, clipboard, toggles,
|
||||
// audits…) leave nothing running: no interactive
|
||||
// command and no dialog. Their highlight would stick
|
||||
// forever — turn it off now. Interactive commands and
|
||||
// dialog owners keep theirs; the command end / modal
|
||||
// close clears those. (#355)
|
||||
let i = self.active_tab;
|
||||
if self.tabs[i].active_cmd.is_none()
|
||||
&& self.active_modal.is_none()
|
||||
&& !self.tabs[i].pan_mode
|
||||
&& !self.tabs[i].orbit_mode
|
||||
&& !self.tabs[i].zoom_dynamic_mode
|
||||
{
|
||||
self.ribbon.deactivate_tool();
|
||||
}
|
||||
return task;
|
||||
}
|
||||
// `dispatch_command` turns a one-shot tool's highlight off
|
||||
// again once nothing is left running (#355).
|
||||
ModuleEvent::Command(cmd) => return self.dispatch_command(&cmd),
|
||||
ModuleEvent::OpenFileDialog => {
|
||||
self.command_line
|
||||
.push_info(crate::t!("Open DWG/DXF: not yet implemented.").as_ref());
|
||||
|
||||
Reference in new issue
Block a user