forked from 1b-agent/opencadstudio-upstream
feat(input): expand shortcut support
This commit is contained in:
1 parent
4be8d9735c
commit
fb0f409bfd
3 files changed
+77
No files matched your search
@@ -1935,6 +1935,12 @@ impl OpenCADStudio {
|
||||
{
|
||||
Some(Message::MTextCaretMove(1))
|
||||
}
|
||||
keyboard::Key::Named(keyboard::key::Named::F1) => {
|
||||
Some(Message::Command("HELP".to_string()))
|
||||
}
|
||||
keyboard::Key::Named(keyboard::key::Named::F2) => {
|
||||
Some(Message::CommandHistoryToggle)
|
||||
}
|
||||
keyboard::Key::Named(keyboard::key::Named::F3) => {
|
||||
Some(Message::ToggleSnapEnabled)
|
||||
}
|
||||
@@ -1957,8 +1963,12 @@ impl OpenCADStudio {
|
||||
Some(Message::ToggleDynInput)
|
||||
}
|
||||
keyboard::Key::Character(c) if accel => match c.as_str() {
|
||||
"0" => Some(Message::ToggleCleanScreen),
|
||||
"1" => Some(Message::ToggleProperties),
|
||||
"n" => Some(Message::TabNew),
|
||||
"o" => Some(Message::OpenFile),
|
||||
"p" => Some(Message::Command("PLOT".to_string())),
|
||||
"q" => Some(Message::Command("QUIT".to_string())),
|
||||
"s" if !shift => Some(Message::SaveFile),
|
||||
"s" if shift => Some(Message::SaveAs),
|
||||
"z" if !shift => Some(Message::Undo),
|
||||
@@ -1979,12 +1989,18 @@ impl OpenCADStudio {
|
||||
// fire the drawing's COPYCLIP/CUTCLIP/paste.
|
||||
// Only when nothing captured (the drawing has
|
||||
// focus, status Ignored) do these run. (#232)
|
||||
"c" if shift && status == Status::Ignored => {
|
||||
Some(Message::Command("COPYBASE".to_string()))
|
||||
}
|
||||
"c" if status == Status::Ignored => {
|
||||
Some(Message::Command("COPYCLIP".to_string()))
|
||||
}
|
||||
"x" if status == Status::Ignored => {
|
||||
Some(Message::Command("CUTCLIP".to_string()))
|
||||
}
|
||||
"v" if shift && status == Status::Ignored => {
|
||||
Some(Message::Command("PASTEBLOCK".to_string()))
|
||||
}
|
||||
"v" if status == Status::Ignored => Some(Message::PasteShortcut),
|
||||
// Web: a focused text field captured Ctrl+C/V,
|
||||
// but iced's clipboard is a no-op there — route
|
||||
|
||||
@@ -94,6 +94,8 @@ pub fn view_window<'a>(
|
||||
// ── Shortcut entries ──────────────────────────────────────────────────
|
||||
let mut rows: Vec<Element<'_, Message>> = vec![
|
||||
section(t!("── Function Keys ──────────────────────────────────────")),
|
||||
shortcut_row("F1", t!("Help")),
|
||||
shortcut_row("F2", t!("Toggle Command History")),
|
||||
shortcut_row("F3", t!("Toggle Object Snap")),
|
||||
shortcut_row("F7", t!("Toggle Grid")),
|
||||
shortcut_row("F8", t!("Toggle Ortho")),
|
||||
@@ -105,16 +107,22 @@ pub fn view_window<'a>(
|
||||
"── %{MOD} Shortcuts ──────────────────────────────────────",
|
||||
MOD = MOD
|
||||
)),
|
||||
shortcut_row(format!("{MOD}+0"), t!("Clean Screen")),
|
||||
shortcut_row(format!("{MOD}+1"), t!("Properties")),
|
||||
shortcut_row(format!("{MOD}+N"), t!("New Drawing")),
|
||||
shortcut_row(format!("{MOD}+O"), t!("Open File")),
|
||||
shortcut_row(format!("{MOD}+P"), t!("Plot")),
|
||||
shortcut_row(format!("{MOD}+Q"), t!("Close")),
|
||||
shortcut_row(format!("{MOD}+S"), t!("Save")),
|
||||
shortcut_row(format!("{MOD}+Shift+S"), t!("Save As")),
|
||||
shortcut_row(format!("{MOD}+Z"), t!("Undo")),
|
||||
shortcut_row(format!("{MOD}+Shift+Z / {MOD}+Y"), t!("Redo")),
|
||||
shortcut_row(format!("{MOD}+F / {MOD}+H"), t!("Find and Replace")),
|
||||
shortcut_row(format!("{MOD}+C"), t!("Copy to Clipboard")),
|
||||
shortcut_row(format!("{MOD}+Shift+C"), t!("Copy with Base Point")),
|
||||
shortcut_row(format!("{MOD}+X"), t!("Cut to Clipboard")),
|
||||
shortcut_row(format!("{MOD}+V"), t!("Paste from Clipboard")),
|
||||
shortcut_row(format!("{MOD}+Shift+V"), t!("Paste as Block")),
|
||||
section(t!("── Other Keys ──────────────────────────────────────────")),
|
||||
shortcut_row("Enter / Space", t!("Finalize command / Repeat last")),
|
||||
shortcut_row("Escape", t!("Cancel active command")),
|
||||
|
||||
Reference in new issue
Block a user