forked from 1b-agent/opencadstudio-upstream
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:
commit
be6dbfdd78
34 files changed
+1570
-54
No files matched your search
@@ -116,6 +116,7 @@ pub(super) const NAMES: &[&str] = &[
|
||||
"pc_section",
|
||||
"ribbon_tab",
|
||||
"ribbon_dropdown",
|
||||
"keytips",
|
||||
"dialog_ok",
|
||||
"attdef_dialog",
|
||||
"field_dialog",
|
||||
@@ -1916,6 +1917,28 @@ impl OpenCADStudio {
|
||||
})
|
||||
}
|
||||
}
|
||||
// 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",
|
||||
|
||||
@@ -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),
|
||||
|
||||
Reference in new issue
Block a user