forked from 1b-agent/opencadstudio-upstream
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 <[email protected]>
This commit is contained in:
1 parent
592289f4fd
commit
86429bf439
34 files changed
+1569
-53
No files matched your search
+30
-1
@@ -2252,12 +2252,23 @@ bg={bg_ms:.1}ms n={view_count}"
|
||||
iced::widget::Space::new().width(0).height(0).into()
|
||||
};
|
||||
|
||||
// Key tips: the hint bar under the dropdowns, the codes above all.
|
||||
let (keytip_bar, keytip_layer): (Element<'_, Message>, Element<'_, Message>) =
|
||||
self.ribbon.keytip_layers().unwrap_or_else(|| {
|
||||
(
|
||||
iced::widget::Space::new().width(0).height(0).into(),
|
||||
iced::widget::Space::new().width(0).height(0).into(),
|
||||
)
|
||||
});
|
||||
|
||||
let composed = stack![
|
||||
main_ui,
|
||||
keytip_bar,
|
||||
dropdown_layer,
|
||||
qselect_layer,
|
||||
snap_override_layer,
|
||||
open_progress_layer,
|
||||
keytip_layer,
|
||||
];
|
||||
|
||||
// If the Plot Style editor was launched from PLOT, keep the Plot dialog
|
||||
@@ -2547,9 +2558,18 @@ impl OpenCADStudio {
|
||||
event::listen_with(|ev, status, win_id| {
|
||||
use iced::event::Status;
|
||||
match ev {
|
||||
iced::Event::Mouse(iced::mouse::Event::ButtonPressed(_))
|
||||
if crate::ui::ribbon::keytips_active() =>
|
||||
{
|
||||
crate::ui::ribbon::keytip_pointer_pressed();
|
||||
Some(Message::KeyTip(crate::ui::ribbon::KeyTipInput::Hide))
|
||||
}
|
||||
iced::Event::Mouse(iced::mouse::Event::ButtonPressed(
|
||||
iced::mouse::Button::Left,
|
||||
)) => Some(Message::PropPointerPressed),
|
||||
)) => {
|
||||
crate::ui::ribbon::keytip_pointer_pressed();
|
||||
Some(Message::PropPointerPressed)
|
||||
}
|
||||
iced::Event::Window(window::Event::CloseRequested) => {
|
||||
Some(Message::WindowCloseRequested(win_id))
|
||||
}
|
||||
@@ -2562,6 +2582,9 @@ impl OpenCADStudio {
|
||||
iced::Event::Window(window::Event::FileDropped(path)) => {
|
||||
Some(Message::FileDropped(path))
|
||||
}
|
||||
iced::Event::Keyboard(keyboard::Event::KeyReleased { key, .. }) => {
|
||||
crate::ui::ribbon::keytip_key_released(&key)
|
||||
}
|
||||
iced::Event::Keyboard(keyboard::Event::ModifiersChanged(m)) => {
|
||||
// `command()` is Cmd on macOS, Ctrl elsewhere — the
|
||||
// platform multi-select modifier for the layer list.
|
||||
@@ -2575,8 +2598,14 @@ impl OpenCADStudio {
|
||||
physical_key,
|
||||
modifiers,
|
||||
text,
|
||||
repeat,
|
||||
..
|
||||
}) => {
|
||||
if let Some(keytip) =
|
||||
crate::ui::ribbon::keytip_key_pressed(&key, modifiers, repeat)
|
||||
{
|
||||
return keytip;
|
||||
}
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
let accel = modifiers.command();
|
||||
// AltGr reaches Windows apps as Ctrl+Alt, and a macOS
|
||||
|
||||
Reference in new issue
Block a user