Ribbon key tips: Alt shows codes on tabs, buttons and menu items

A lone Alt shows a code on every ribbon tab and quick-access button.
Typing a tab code opens the tab and shows the codes of its buttons,
dropdowns, slide-outs and collapsed panels; a button code runs it, a
dropdown or slide-out code opens it and shows its item codes, Esc goes
back one level. Codes follow the reference ribbon; buttons without a
reference counterpart get none and unnamed menu items are numbered.

Codes are drawn as accent pills over the widgets that reported their
bounds in the current frame, with a hint bar under the ribbon. While
the tips are open keys go to them only. The automation gets a keytips
action and read operation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ramox81andClaude Opus 5.5 committed 2026-10-14 11:18:58 +03:00
1 parent 592289f4fd
commit 86429bf439
34 files changed
+1569 -53

No files matched your search

+23
View File
@@ -114,6 +114,7 @@ pub(super) const NAMES: &[&str] = &[
"pc_section",
"ribbon_tab",
"ribbon_dropdown",
"keytips",
"dialog_ok",
"attdef_dialog",
"field_dialog",
@@ -1884,6 +1885,28 @@ impl OpenCADStudio {
})
}
"ribbon_dropdown" => Message::ToggleRibbonDropdown(string(req, "value")?.into()),
// Ribbon key tips: `show`, `alt` (a lone Alt), `type:<codes>`, `enter`,
// `esc` or `hide`. Read them back with the `keytips` read operation.
"keytips" => {
use crate::ui::ribbon::KeyTipInput as K;
let value = string(req, "value")?;
let inputs: Vec<K> = match value {
"show" => vec![K::Open { refocus: false }],
"alt" => vec![K::AltTap],
"esc" => vec![K::Escape],
"hide" => vec![K::Hide],
"enter" => vec![K::Enter],
_ => match value.strip_prefix("type:") {
Some(codes) if !codes.is_empty() => codes
.chars()
.map(|ch| K::Char(ch.to_uppercase().collect()))
.collect(),
_ => return Err(failure("invalid_value", "Use show, alt, type:<codes>, enter, esc or hide")),
},
};
let tasks: Vec<_> = inputs.into_iter().map(|input| self.on_keytip(input)).collect();
return Ok(Task::batch(tasks));
}
// The -VIEW Background dialog, one field per call: "type=gradient",
// "color|top|middle|bottom=r,g,b", "three=1", "rotation=30",
// "image=<path>", "position=center|stretch|tile", "aspect=1", "offset=x,y" (pixels), "scale=x,y",
+2
View File
@@ -559,6 +559,7 @@ impl OpenCADStudio {
| "audit"
| "text_search"
| "text_audit"
| "keytips"
);
if !query && !self.control.enabled {
return (
@@ -850,6 +851,7 @@ impl OpenCADStudio {
}
}
"grips" => self.control_grips(),
"keytips" => self.ribbon.keytips_json(req["detail"].as_str() == Some("full")),
"xdata_get" => self.xdata_read(&req),
"get_selection" => self.control_get_selection(),
"text_search" => self.control_text_search(&req).unwrap_or_else(|e| e),