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

+22 -7
View File
@@ -31,6 +31,12 @@ use widgets::{StyleContext, *};
pub(crate) use widgets::{REDO_HISTORY_ID, UNDO_HISTORY_ID};
mod collapse;
mod locate;
mod keytips;
pub use keytips::{
active as keytips_active, key_pressed as keytip_key_pressed,
key_released as keytip_key_released, pointer_pressed as keytip_pointer_pressed, KeyTipInput,
KeyTipStep,
};
use crate::t;
use crate::ui::wrap_bar::{PosReport, WrapBar, WrapFlow};
pub use collapse::CollapseMode;
@@ -122,6 +128,8 @@ pub struct Ribbon {
block_editing: Option<usize>,
/// XDWGFADECTL as the Reference slide-out shows it (negative = off).
pub xref_fade: i32,
/// Open key tips (Alt).
keytips: Option<keytips::State>,
}
/// Per-layer display data shown in the ribbon layer dropdown.
@@ -224,6 +232,7 @@ impl Ribbon {
point_cloud_ctx: None,
block_editing: None,
xref_fade: 50,
keytips: None,
}
}
@@ -662,7 +671,7 @@ impl Ribbon {
},
..Default::default()
});
acc.push(btn.into());
acc.push(keytips::anchor_with(|| format!("tab:{}", module.id()), btn));
acc
},
);
@@ -800,7 +809,7 @@ impl Ribbon {
tool_bar
};
column![tab_bar, tool_bar].into()
keytips::ribbon_area(column![tab_bar, tool_bar])
}
// ── Dropdown overlay ──────────────────────────────────────────────────
@@ -971,7 +980,7 @@ impl Ribbon {
.then_some(theme.palette().background.base.text.scale_alpha(0.72)),
});
button(
let item = button(
row![checkmark, icon_el, label_el]
.spacing(4)
.align_y(iced::Center),
@@ -982,8 +991,8 @@ impl Ribbon {
}))
.style(popup_row_style)
.width(Fill)
.padding([4, 10])
.into()
.padding([4, 10]);
keytips::anchor_with(|| keytips::item_anchor(dd_id, cmd), item)
})
.collect();
@@ -1571,7 +1580,10 @@ fn collapse_button<'a>(
.style(opener_style(holds))
.width(Fill)
.padding([3, 5]);
return automatic_large_button(localized_title, content.into());
return keytips::anchor_with(
|| keytips::collapsed_anchor(title),
automatic_large_button(localized_title, content.into()),
);
}
// Collapsed (not yet tight): a large representative-tool face — a live button
@@ -1636,7 +1648,10 @@ fn collapse_button<'a>(
.style(opener_style(holds && !face_lit))
.width(Fill)
.padding([1, 4]);
let opener = automatic_large_button(localized_title, opener.into());
let opener = keytips::anchor_with(
|| keytips::collapsed_anchor(title),
automatic_large_button(localized_title, opener.into()),
);
// The large face fills a fixed slot so a collapsed panel is shorter than a full
// 3-row panel, letting `CollapsePanels` shrink the ribbon row.