Merge pull request #1780 from ramox81/codex/ribbon-keytips

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

# Conflicts:
#	locales/ar-SA/opencadstudio.ftl
#	locales/bg-BG/opencadstudio.ftl
#	locales/cs-CZ/opencadstudio.ftl
#	locales/de-DE/opencadstudio.ftl
#	locales/el-GR/opencadstudio.ftl
#	locales/en-US/opencadstudio.ftl
#	locales/es-ES/opencadstudio.ftl
#	locales/fi-FI/opencadstudio.ftl
#	locales/fr-FR/opencadstudio.ftl
#	locales/hi-IN/opencadstudio.ftl
#	locales/hu-HU/opencadstudio.ftl
#	locales/it-IT/opencadstudio.ftl
#	locales/ja-JP/opencadstudio.ftl
#	locales/ko-KR/opencadstudio.ftl
#	locales/lo-LA/opencadstudio.ftl
#	locales/nl-NL/opencadstudio.ftl
#	locales/pl-PL/opencadstudio.ftl
#	locales/pt-BR/opencadstudio.ftl
#	locales/ru-RU/opencadstudio.ftl
#	locales/tr-TR/opencadstudio.ftl
#	locales/zh-CN/opencadstudio.ftl
#	locales/zh-TW/opencadstudio.ftl
#	src/app/control/actions.rs
This commit is contained in:
Hakan Seven committed 2026-10-14 12:14:23 +03:00
commit be6dbfdd78
34 files changed
+1570 -54

No files matched your search

+30 -1
View File
@@ -2261,12 +2261,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
@@ -2556,9 +2567,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))
}
@@ -2571,6 +2591,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.
@@ -2584,8 +2607,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