mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-19 17:05:55 +01:00
Shortcuts: a tool or command can have a hold shortcut that runs when its key is held
Edit › Keyboard Shortcuts gets a Hold Shortcuts checkbox, off by default, with a ? button that explains it. While it is off, the dialog has no Hold column and every key runs on its press as before. While it is on, the dialog shows a Hold column and the Hold Shortcut Delay (`keyHoldDelay`, 0.35 s, 0.2 to 1.0 s), and a letter, digit or punctuation key, alone or with Shift, can hold a tool or command. Held for the delay, the key runs its hold shortcut once and its repeats are ignored until it is let go; a quicker press runs what the key runs without one, at the release. Another key, or Cmd, Ctrl or Alt, ends the wait first; focus loss, a dialog, a text field, Presentation Mode or an input method composition ends it without running anything. A hold on a letter alone leaves the letter with Shift as it is, and a key the active tool uses itself (E with the Extend Path tool) does not wait. A tool key with a hold shortcut runs the hold instead of choosing its tool temporarily (`holdToolKeys`). Preferences › General › Options lists both settings too, with the delay dimmed while Hold Shortcuts is off. Hold shortcuts are stored apart from the shortcuts (`shortcut_holds`). `shortcuts.set` takes `hold`, `shortcuts.list` rows have `hold`, `shortcuts.conflicts` lists hold clashes, Export… writes `holds` and Import… reads it, and Export Text… adds a `Hold X` column while the checkbox is on. Reset to Defaults and the presets clear them. The new strings have rows in every catalog.
This commit is contained in:
1 parent
bb218101c9
commit
0cf59a7649
45 files changed
+1849
-63
No files matched your search
@@ -156,6 +156,8 @@ pub const PREF_SPECS: &[PrefSpec] = &[
|
||||
p!("scrubNumericFields", "General", "Options", "Scrub Numeric Fields by Dragging", bool),
|
||||
p!("trackpadRotateView", "General", "Options", "Trackpad Gesture to Rotate View", bool),
|
||||
p!("holdToolKeys", "General", "Options", "Hold a Tool Shortcut to Use the Tool Temporarily", bool),
|
||||
p!("holdShortcuts", "General", "Options", "Hold Shortcuts", bool),
|
||||
p!("keyHoldDelay", "General", "Options", "Hold Shortcut Delay", num(0.2, 1.0, "s")),
|
||||
p!("boundingBoxWhileMovingAndDrawing", "General", "Options", "Show Bounding Box While Moving and Drawing", bool),
|
||||
// Selection & Anchor Display
|
||||
p!("selectionTolerance", "Selection & Anchor Display", "Selection", "Tolerance", num(1.0, 8.0, "px")),
|
||||
|
||||
@@ -408,7 +408,7 @@ use history::history_budget_for;
|
||||
pub use history::{History, HistoryEntry, NamedStep, default_history_budget};
|
||||
pub(crate) use interaction::PreviewCopies;
|
||||
pub use interaction::{Interaction, LastTransform, UndoGroup, UndoScope};
|
||||
pub use prefs::{DrawMode, Prefs};
|
||||
pub use prefs::{DrawMode, KEY_HOLD_DELAY, KEY_HOLD_DELAY_RANGE, Prefs};
|
||||
pub use sanity::TOO_DEEP;
|
||||
pub(crate) use sanity::{deselect_hidden, is_guide_path};
|
||||
#[cfg(test)]
|
||||
|
||||
@@ -71,6 +71,13 @@ pub struct Prefs {
|
||||
/// A single-key tool shortcut held down chooses its tool until the key is let go, and then the
|
||||
/// tool active before comes back; a quick press chooses the tool for good.
|
||||
pub hold_tool_keys: bool,
|
||||
/// Hold shortcuts act (Edit › Keyboard Shortcuts › Hold Shortcuts, off by default): a key with a
|
||||
/// hold shortcut runs it when held for [`Self::key_hold_delay`], and its own shortcut when let go
|
||||
/// sooner. Off, every key runs on its press and the dialog shows no Hold column.
|
||||
pub hold_shortcuts: bool,
|
||||
/// Seconds a key with a hold shortcut must stay down before the hold shortcut runs (Hold
|
||||
/// Shortcut Delay, 0.2 to 1.0). VectorCraft's own default, 0.35.
|
||||
pub key_hold_delay: f64,
|
||||
/// With View › Show Bounding Box on, the bounding box stays visible while a drag moves the
|
||||
/// selection, and the shape tools that show it draw it around the shape being drawn. Off (the
|
||||
/// default), it hides during a move and while a shape is drawn, except that a Selection tool
|
||||
@@ -385,6 +392,21 @@ pub struct Prefs {
|
||||
pub import_matches: Vec<cmd::importmatches::ImportMatch>,
|
||||
}
|
||||
|
||||
/// The default Hold Shortcut Delay, in seconds (VectorCraft's own value).
|
||||
pub const KEY_HOLD_DELAY: f64 = 0.35;
|
||||
/// The range of the Hold Shortcut Delay, in seconds.
|
||||
pub const KEY_HOLD_DELAY_RANGE: (f64, f64) = (0.2, 1.0);
|
||||
|
||||
impl Prefs {
|
||||
/// The Hold Shortcut Delay in seconds, inside its range. A restored settings file is not
|
||||
/// checked against the range, so a value outside it is brought inside, and one that is not a
|
||||
/// number gives the default.
|
||||
pub fn key_hold_delay(&self) -> f64 {
|
||||
let (min, max) = KEY_HOLD_DELAY_RANGE;
|
||||
if self.key_hold_delay.is_finite() { self.key_hold_delay.clamp(min, max) } else { KEY_HOLD_DELAY }
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for Prefs {
|
||||
fn default() -> Self {
|
||||
let s = |v: &str| v.to_string();
|
||||
@@ -415,6 +437,8 @@ impl Default for Prefs {
|
||||
scrub_numeric_fields: true,
|
||||
trackpad_rotate_view: true,
|
||||
hold_tool_keys: true,
|
||||
hold_shortcuts: false,
|
||||
key_hold_delay: KEY_HOLD_DELAY,
|
||||
bounding_box_while_moving_and_drawing: false,
|
||||
paste_offset: 10.0,
|
||||
selection_tolerance: 3.0,
|
||||
|
||||
@@ -176,3 +176,24 @@ fn a_file_over_the_limit_is_refused_before_it_is_parsed() {
|
||||
assert!(s.execute("prefs.import", &json!({"path": missing.to_string_lossy()})).is_err());
|
||||
assert_eq!(s.prefs.to_json().to_string(), before);
|
||||
}
|
||||
|
||||
/// Hold Shortcuts is off by default. The Hold Shortcut Delay takes 0.2 to 1.0 s and refuses other
|
||||
/// values; a value from a settings file outside the range is brought inside it.
|
||||
#[test]
|
||||
fn hold_shortcut_preferences() {
|
||||
let mut s = Session::new();
|
||||
assert!(!s.prefs.hold_shortcuts);
|
||||
assert_eq!(s.prefs.key_hold_delay(), 0.35);
|
||||
for ok in [0.2, 1.0] {
|
||||
s.execute("prefs.set", &json!({"key": "keyHoldDelay", "value": ok})).unwrap();
|
||||
assert_eq!(s.prefs.key_hold_delay(), ok);
|
||||
}
|
||||
for bad in [0.1, 1.5] {
|
||||
assert!(is_bad_params(s.execute("prefs.set", &json!({"key": "keyHoldDelay", "value": bad}))), "{bad}");
|
||||
}
|
||||
s.execute("prefs.set", &json!({"key": "holdShortcuts", "value": true})).unwrap();
|
||||
assert!(s.prefs.hold_shortcuts);
|
||||
let restored: Prefs = serde_json::from_value(json!({"keyHoldDelay": 5.0})).unwrap();
|
||||
assert_eq!(restored.key_hold_delay(), 1.0);
|
||||
assert!(!restored.hold_shortcuts);
|
||||
}
|
||||
@@ -173,8 +173,13 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[
|
||||
"Cmd+I",
|
||||
"{} open the Check Spelling dialog to walk through unrecognized words with suggestions, ignore, change and dictionary options",
|
||||
),
|
||||
("shortcuts.set", "Set Keyboard Shortcut", "", "{id: command id or tool:<id>, shortcut: \"Cmd+Shift+K\" | \"\" (none) | null (default), force?}"),
|
||||
("shortcuts.list", "List Keyboard Shortcuts", "", "{query?} → [{id, label, group, shortcut, default, overridden}]"),
|
||||
(
|
||||
"shortcuts.set",
|
||||
"Set Keyboard Shortcut",
|
||||
"",
|
||||
"{id: command id or tool:<id>, shortcut?: \"Cmd+Shift+K\" | \"\" (none) | null (default), hold?: a character key alone or with Shift (\"X\", \"Shift+X\", \".\") | \"\" | null (none), force?} → {id, shortcut, hold, removedFrom}; `hold` alone leaves the shortcut as it is; a hold shortcut acts while the holdShortcuts preference is on",
|
||||
),
|
||||
("shortcuts.list", "List Keyboard Shortcuts", "", "{query?} → [{id, label, group, shortcut, hold, default, overridden}]"),
|
||||
("shortcuts.conflicts", "Keyboard Shortcut Conflicts", "", "{} → [{shortcut, ids}]"),
|
||||
("shortcuts.reset", "Reset Keyboard Shortcuts", "", "{}"),
|
||||
(
|
||||
@@ -188,7 +193,7 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[
|
||||
"shortcuts.exportText",
|
||||
"Export Keyboard Shortcuts as Text…",
|
||||
"",
|
||||
"{path?} save the current set's tools and menu commands with their shortcuts as a UTF-8 text file (Keyboard Shortcuts › Export Text…): the set's name, then a Tools and a Menu Commands section in the dialog's order, one `name<TAB>shortcut` line per row, empty after the tab when it has none; without `path`, pick a file",
|
||||
"{path?} save the current set's tools and menu commands with their shortcuts as a UTF-8 text file (Keyboard Shortcuts › Export Text…): the set's name, then a Tools and a Menu Commands section in the dialog's order, one `name<TAB>shortcut` line per row, empty after the tab when it has none, and while the holdShortcuts preference is on a third `Hold <key>` column on a row with a hold shortcut; without `path`, pick a file",
|
||||
),
|
||||
("shortcuts.import", "Import Keyboard Shortcuts…", "", "{path? | data?}"),
|
||||
(
|
||||
|
||||
@@ -191,6 +191,7 @@ impl VectorcraftApp {
|
||||
input_frames: vec![],
|
||||
shortcuts_frames: vec![],
|
||||
held_tool: Vec::new(),
|
||||
hold_keys: Default::default(),
|
||||
synthetic_injected: false,
|
||||
injected_events: vec![],
|
||||
injected_generation: InputGeneration::default(),
|
||||
|
||||
@@ -7018,3 +7018,13 @@ breakText Glyphs Глифи
|
||||
Open a document to mark its fold lines. Отворете документ, за да отбележите линиите му на сгъване.
|
||||
Remove Fold Line Role Премахни вида на линията
|
||||
@msg composer must be "singleLine", "everyLine", "standardSingleLine" or "standardEveryLine" composer трябва да е "singleLine", "everyLine", "standardSingleLine" или "standardEveryLine"
|
||||
Tap Кратко натискане
|
||||
Clear Hold Изчистване на задържането
|
||||
Hold Shortcuts Комбинации със задържане
|
||||
Hold Shortcut Delay Забавяне на комбинациите със задържане
|
||||
How hold shortcuts work Как работят комбинациите със задържане
|
||||
Click, then press a key to hold for this (Esc cancels). Holding the key runs this; a quick press runs the key's own shortcut. Щракнете и натиснете клавиш, който да се задържа за това (Esc отменя). Задържането на клавиша изпълнява това; краткото натискане изпълнява собствената комбинация на клавиша.
|
||||
A quick press of a key runs its shortcut. Holding the key for the delay runs the tool or command in its Hold column instead. A hold shortcut is a letter, digit or punctuation key, alone or with Shift. Краткото натискане на клавиш изпълнява неговата комбинация. Задържането на клавиша за времето на забавяне изпълнява вместо това инструмента или командата от колоната му „Задръжте“. Комбинация със задържане е клавиш с буква, цифра или препинателен знак, самостоятелно или с Shift.
|
||||
@msg Hold {_1} is already used by {_2} Задържането на {_1} вече се използва от {_2}
|
||||
@msg a hold shortcut is a key that types a character, alone or with Shift ({shown} has Cmd, Ctrl or Alt) комбинация със задържане е клавиш, който въвежда знак, самостоятелно или с Shift ({shown} съдържа Cmd, Ctrl или Alt)
|
||||
@msg {shown} can't be a hold shortcut: use a letter, a digit or a punctuation key {shown} не може да бъде комбинация със задържане: използвайте буква, цифра или препинателен знак
|
||||
|
Can't render this file because it is too large.
|
@@ -7071,3 +7071,13 @@ shape Open Otvoren
|
||||
Open a document to mark its fold lines. Otvorite dokument da označite njegove linije savijanja.
|
||||
Remove Fold Line Role Ukloni vrstu linije
|
||||
@msg composer must be "singleLine", "everyLine", "standardSingleLine" or "standardEveryLine" composer mora biti "singleLine", "everyLine", "standardSingleLine" ili "standardEveryLine"
|
||||
Tap Kratki pritisak
|
||||
Clear Hold Očisti zadržavanje
|
||||
Hold Shortcuts Prečice zadržavanjem
|
||||
Hold Shortcut Delay Kašnjenje prečica zadržavanjem
|
||||
How hold shortcuts work Kako rade prečice zadržavanjem
|
||||
Click, then press a key to hold for this (Esc cancels). Holding the key runs this; a quick press runs the key's own shortcut. Kliknite, zatim pritisnite tipku koju treba zadržati za ovo (Esc otkazuje). Zadržavanje tipke pokreće ovo; kratki pritisak pokreće vlastitu prečicu tipke.
|
||||
A quick press of a key runs its shortcut. Holding the key for the delay runs the tool or command in its Hold column instead. A hold shortcut is a letter, digit or punctuation key, alone or with Shift. Kratki pritisak tipke pokreće njenu prečicu. Zadržavanje tipke tokom kašnjenja umjesto toga pokreće alat ili naredbu iz njene kolone Zadrži. Prečica zadržavanjem je tipka sa slovom, cifrom ili interpunkcijskim znakom, sama ili sa Shift.
|
||||
@msg Hold {_1} is already used by {_2} Zadržavanje {_1} već koristi {_2}
|
||||
@msg a hold shortcut is a key that types a character, alone or with Shift ({shown} has Cmd, Ctrl or Alt) prečica zadržavanjem je tipka koja upisuje znak, sama ili sa Shift ({shown} ima Cmd, Ctrl ili Alt)
|
||||
@msg {shown} can't be a hold shortcut: use a letter, a digit or a punctuation key {shown} ne može biti prečica zadržavanjem: koristite slovo, cifru ili interpunkcijsku tipku
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -7793,3 +7793,13 @@ breakText Glyphs Glifs
|
||||
Open a document to mark its fold lines. Obre un document per marcar-ne les línies de plegat.
|
||||
Remove Fold Line Role Elimina el tipus de línia
|
||||
@msg composer must be "singleLine", "everyLine", "standardSingleLine" or "standardEveryLine" composer ha de ser "singleLine", "everyLine", "standardSingleLine" o "standardEveryLine"
|
||||
Tap Pulsació breu
|
||||
Clear Hold Esborra la pulsació llarga
|
||||
Hold Shortcuts Dreceres de pulsació llarga
|
||||
Hold Shortcut Delay Retard de les dreceres de pulsació llarga
|
||||
How hold shortcuts work Com funcionen les dreceres de pulsació llarga
|
||||
Click, then press a key to hold for this (Esc cancels). Holding the key runs this; a quick press runs the key's own shortcut. Fes clic i prem una tecla per mantenir premuda per a això (Esc cancel·la). Mantenir premuda la tecla executa això; una pulsació breu executa la drecera pròpia de la tecla.
|
||||
A quick press of a key runs its shortcut. Holding the key for the delay runs the tool or command in its Hold column instead. A hold shortcut is a letter, digit or punctuation key, alone or with Shift. Una pulsació breu d’una tecla executa la seva drecera. Mantenir premuda la tecla durant el retard executa en canvi l’eina o l’ordre de la seva columna Mantén. Una drecera de pulsació llarga és una tecla de lletra, xifra o puntuació, sola o amb Shift.
|
||||
@msg Hold {_1} is already used by {_2} La pulsació llarga de {_1} ja la fa servir {_2}
|
||||
@msg a hold shortcut is a key that types a character, alone or with Shift ({shown} has Cmd, Ctrl or Alt) una drecera de pulsació llarga és una tecla que escriu un caràcter, sola o amb Shift ({shown} té Cmd, Ctrl o Alt)
|
||||
@msg {shown} can't be a hold shortcut: use a letter, a digit or a punctuation key {shown} no pot ser una drecera de pulsació llarga: fes servir una lletra, una xifra o una tecla de puntuació
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -9613,3 +9613,13 @@ breakText Glyphs Glyfy
|
||||
No objects are selected. Nejsou vybrány žádné objekty.
|
||||
Open a document to mark its fold lines. Otevřete dokument, abyste označili jeho linie skladu.
|
||||
Remove Fold Line Role Odstranit typ linie
|
||||
Tap Krátký stisk
|
||||
Clear Hold Vymazat podržení
|
||||
Hold Shortcuts Zkratky podržením
|
||||
Hold Shortcut Delay Prodleva zkratek podržením
|
||||
How hold shortcuts work Jak fungují zkratky podržením
|
||||
Click, then press a key to hold for this (Esc cancels). Holding the key runs this; a quick press runs the key's own shortcut. Klikněte a stiskněte klávesu, kterou pro toto podržíte (Esc zruší). Podržení klávesy spustí toto; krátký stisk spustí vlastní zkratku klávesy.
|
||||
A quick press of a key runs its shortcut. Holding the key for the delay runs the tool or command in its Hold column instead. A hold shortcut is a letter, digit or punctuation key, alone or with Shift. Krátký stisk klávesy spustí její zkratku. Podržení klávesy po dobu prodlevy místo toho spustí nástroj nebo příkaz z jejího sloupce Podržení. Zkratka podržením je klávesa s písmenem, číslicí nebo interpunkcí, samotná nebo se Shiftem.
|
||||
@msg Hold {_1} is already used by {_2} Podržení {_1} už používá {_2}
|
||||
@msg a hold shortcut is a key that types a character, alone or with Shift ({shown} has Cmd, Ctrl or Alt) zkratka podržením je klávesa, která píše znak, samotná nebo se Shiftem ({shown} obsahuje Cmd, Ctrl nebo Alt)
|
||||
@msg {shown} can't be a hold shortcut: use a letter, a digit or a punctuation key {shown} nemůže být zkratkou podržením: použijte písmeno, číslici nebo interpunkční klávesu
|
||||
|
Can't render this file because it is too large.
|
@@ -7703,3 +7703,13 @@ breakText Glyphs Glyffer
|
||||
Open a document to mark its fold lines. Åbn et dokument for at markere dets foldelinjer.
|
||||
Remove Fold Line Role Fjern linjetype
|
||||
@msg composer must be "singleLine", "everyLine", "standardSingleLine" or "standardEveryLine" composer skal være "singleLine", "everyLine", "standardSingleLine" eller "standardEveryLine"
|
||||
Tap Kort tryk
|
||||
Clear Hold Ryd hold
|
||||
Hold Shortcuts Holdegenveje
|
||||
Hold Shortcut Delay Forsinkelse for holdegenveje
|
||||
How hold shortcuts work Sådan virker holdegenveje
|
||||
Click, then press a key to hold for this (Esc cancels). Holding the key runs this; a quick press runs the key's own shortcut. Klik, og tryk derefter på en tast, der skal holdes nede for dette (Esc annullerer). Når tasten holdes nede, køres dette; et kort tryk kører tastens egen genvej.
|
||||
A quick press of a key runs its shortcut. Holding the key for the delay runs the tool or command in its Hold column instead. A hold shortcut is a letter, digit or punctuation key, alone or with Shift. Et kort tryk på en tast kører dens genvej. Når tasten holdes nede i forsinkelsens varighed, køres i stedet værktøjet eller kommandoen i dens Hold-kolonne. En holdegenvej er en bogstav-, ciffer- eller tegnsætningstast, alene eller med Shift.
|
||||
@msg Hold {_1} is already used by {_2} Hold {_1} bruges allerede af {_2}
|
||||
@msg a hold shortcut is a key that types a character, alone or with Shift ({shown} has Cmd, Ctrl or Alt) en holdegenvej er en tast, der skriver et tegn, alene eller med Shift ({shown} har Cmd, Ctrl eller Alt)
|
||||
@msg {shown} can't be a hold shortcut: use a letter, a digit or a punctuation key {shown} kan ikke være en holdegenvej: brug et bogstav, et ciffer eller en tegnsætningstast
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -9211,3 +9211,13 @@ breakText Glyphs Glyphen
|
||||
No objects are selected. Es sind keine Objekte ausgewählt.
|
||||
Open a document to mark its fold lines. Öffnen Sie ein Dokument, um seine Faltlinien festzulegen.
|
||||
Remove Fold Line Role Linienart entfernen
|
||||
Tap Kurz drücken
|
||||
Clear Hold Halten löschen
|
||||
Hold Shortcuts Halte-Tastaturbefehle
|
||||
Hold Shortcut Delay Verzögerung für Halte-Tastaturbefehle
|
||||
How hold shortcuts work So funktionieren Halte-Tastaturbefehle
|
||||
Click, then press a key to hold for this (Esc cancels). Holding the key runs this; a quick press runs the key's own shortcut. Klicken Sie und drücken Sie dann eine Taste, die hierfür gehalten werden soll (Esc bricht ab). Halten der Taste führt dies aus; kurzes Drücken führt den eigenen Tastaturbefehl der Taste aus.
|
||||
A quick press of a key runs its shortcut. Holding the key for the delay runs the tool or command in its Hold column instead. A hold shortcut is a letter, digit or punctuation key, alone or with Shift. Kurzes Drücken einer Taste führt ihren Tastaturbefehl aus. Halten der Taste für die Dauer der Verzögerung führt stattdessen das Werkzeug oder den Befehl in ihrer Spalte „Halten“ aus. Ein Halte-Tastaturbefehl ist eine Buchstaben-, Ziffern- oder Satzzeichentaste, allein oder mit Shift.
|
||||
@msg Hold {_1} is already used by {_2} Halten {_1} wird bereits von {_2} verwendet
|
||||
@msg a hold shortcut is a key that types a character, alone or with Shift ({shown} has Cmd, Ctrl or Alt) Ein Halte-Tastaturbefehl ist eine Taste, die ein Zeichen eingibt, allein oder mit Shift ({shown} enthält Cmd, Ctrl oder Alt)
|
||||
@msg {shown} can't be a hold shortcut: use a letter, a digit or a punctuation key {shown} kann kein Halte-Tastaturbefehl sein: Verwenden Sie einen Buchstaben, eine Ziffer oder eine Satzzeichentaste
|
||||
|
Can't render this file because it is too large.
|
@@ -7767,3 +7767,13 @@ breakText Glyphs Γλύφοι
|
||||
Open a document to mark its fold lines. Ανοίξτε ένα έγγραφο για να σημειώσετε τις γραμμές δίπλωσής του.
|
||||
Remove Fold Line Role Αφαίρεση τύπου γραμμής
|
||||
@msg composer must be "singleLine", "everyLine", "standardSingleLine" or "standardEveryLine" το composer πρέπει να είναι "singleLine", "everyLine", "standardSingleLine" ή "standardEveryLine"
|
||||
Tap Σύντομο πάτημα
|
||||
Clear Hold Εκκαθάριση παρατεταμένου πατήματος
|
||||
Hold Shortcuts Συντομεύσεις παρατεταμένου πατήματος
|
||||
Hold Shortcut Delay Καθυστέρηση συντομεύσεων παρατεταμένου πατήματος
|
||||
How hold shortcuts work Πώς λειτουργούν οι συντομεύσεις παρατεταμένου πατήματος
|
||||
Click, then press a key to hold for this (Esc cancels). Holding the key runs this; a quick press runs the key's own shortcut. Κάντε κλικ και πατήστε ένα πλήκτρο που θα κρατάτε πατημένο για αυτό (Esc για ακύρωση). Το παρατεταμένο πάτημα του πλήκτρου εκτελεί αυτό. Ένα σύντομο πάτημα εκτελεί τη συντόμευση του ίδιου του πλήκτρου.
|
||||
A quick press of a key runs its shortcut. Holding the key for the delay runs the tool or command in its Hold column instead. A hold shortcut is a letter, digit or punctuation key, alone or with Shift. Ένα σύντομο πάτημα πλήκτρου εκτελεί τη συντόμευσή του. Αν κρατήσετε πατημένο το πλήκτρο για τον χρόνο καθυστέρησης, εκτελείται αντί γι’ αυτό το εργαλείο ή η εντολή της στήλης «Κρατήστε πατημένο». Μια συντόμευση παρατεταμένου πατήματος είναι ένα πλήκτρο γράμματος, ψηφίου ή σημείου στίξης, μόνο του ή με Shift.
|
||||
@msg Hold {_1} is already used by {_2} το παρατεταμένο πάτημα του {_1} χρησιμοποιείται ήδη από το {_2}
|
||||
@msg a hold shortcut is a key that types a character, alone or with Shift ({shown} has Cmd, Ctrl or Alt) μια συντόμευση παρατεταμένου πατήματος είναι ένα πλήκτρο που πληκτρολογεί έναν χαρακτήρα, μόνο του ή με Shift (το {shown} έχει Cmd, Ctrl ή Alt)
|
||||
@msg {shown} can't be a hold shortcut: use a letter, a digit or a punctuation key το {shown} δεν μπορεί να είναι συντόμευση παρατεταμένου πατήματος: χρησιμοποιήστε γράμμα, ψηφίο ή πλήκτρο στίξης
|
||||
|
Can't render this file because it is too large.
|
@@ -7754,3 +7754,13 @@ breakText Glyphs Glifos
|
||||
Open a document to mark its fold lines. Abre un documento para marcar sus líneas de plegado.
|
||||
Remove Fold Line Role Quitar tipo de línea
|
||||
@msg composer must be "singleLine", "everyLine", "standardSingleLine" or "standardEveryLine" composer debe ser "singleLine", "everyLine", "standardSingleLine" o "standardEveryLine"
|
||||
Tap Pulsación breve
|
||||
Clear Hold Borrar pulsación larga
|
||||
Hold Shortcuts Métodos abreviados de pulsación larga
|
||||
Hold Shortcut Delay Retardo de pulsación larga
|
||||
How hold shortcuts work Cómo funcionan los métodos abreviados de pulsación larga
|
||||
Click, then press a key to hold for this (Esc cancels). Holding the key runs this; a quick press runs the key's own shortcut. Haz clic y presiona una tecla que mantener pulsada para esto (Esc cancela). Mantener pulsada la tecla ejecuta esto; una pulsación breve ejecuta el método abreviado propio de la tecla.
|
||||
A quick press of a key runs its shortcut. Holding the key for the delay runs the tool or command in its Hold column instead. A hold shortcut is a letter, digit or punctuation key, alone or with Shift. Una pulsación breve de una tecla ejecuta su método abreviado. Mantener pulsada la tecla durante el retardo ejecuta en su lugar la herramienta o el comando de su columna Mantener pulsado. Un método abreviado de pulsación larga es una tecla de letra, dígito o puntuación, sola o con Shift.
|
||||
@msg Hold {_1} is already used by {_2} La pulsación larga de {_1} ya la usa {_2}
|
||||
@msg a hold shortcut is a key that types a character, alone or with Shift ({shown} has Cmd, Ctrl or Alt) un método abreviado de pulsación larga es una tecla que escribe un carácter, sola o con Shift ({shown} tiene Cmd, Ctrl o Alt)
|
||||
@msg {shown} can't be a hold shortcut: use a letter, a digit or a punctuation key {shown} no puede ser un método abreviado de pulsación larga: usa una letra, un dígito o una tecla de puntuación
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -7850,3 +7850,13 @@ breakText Glyphs Merkit
|
||||
Open a document to mark its fold lines. Avaa asiakirja, niin voit merkitä sen taittoviivat.
|
||||
Remove Fold Line Role Poista viivatyyppi
|
||||
@msg composer must be "singleLine", "everyLine", "standardSingleLine" or "standardEveryLine" composer on oltava "singleLine", "everyLine", "standardSingleLine" tai "standardEveryLine"
|
||||
Tap Lyhyt painallus
|
||||
Clear Hold Tyhjennä pitkä painallus
|
||||
Hold Shortcuts Pitkän painalluksen pikanäppäimet
|
||||
Hold Shortcut Delay Pitkän painalluksen viive
|
||||
How hold shortcuts work Näin pitkän painalluksen pikanäppäimet toimivat
|
||||
Click, then press a key to hold for this (Esc cancels). Holding the key runs this; a quick press runs the key's own shortcut. Napsauta ja paina sitten näppäintä, jota pidetään pohjassa tätä varten (Esc peruuttaa). Näppäimen pitäminen pohjassa suorittaa tämän; lyhyt painallus suorittaa näppäimen oman pikanäppäimen.
|
||||
A quick press of a key runs its shortcut. Holding the key for the delay runs the tool or command in its Hold column instead. A hold shortcut is a letter, digit or punctuation key, alone or with Shift. Näppäimen lyhyt painallus suorittaa sen pikanäppäimen. Kun näppäintä pidetään pohjassa viiveen ajan, suoritetaan sen sijaan sen Pidä pohjassa -sarakkeen työkalu tai komento. Pitkän painalluksen pikanäppäin on kirjain-, numero- tai välimerkkinäppäin yksin tai Shiftin kanssa.
|
||||
@msg Hold {_1} is already used by {_2} Pitkä painallus {_1} on jo käytössä kohteella {_2}
|
||||
@msg a hold shortcut is a key that types a character, alone or with Shift ({shown} has Cmd, Ctrl or Alt) pitkän painalluksen pikanäppäin on merkin kirjoittava näppäin yksin tai Shiftin kanssa ({shown} sisältää Cmd-, Ctrl- tai Alt-näppäimen)
|
||||
@msg {shown} can't be a hold shortcut: use a letter, a digit or a punctuation key {shown} ei voi olla pitkän painalluksen pikanäppäin: käytä kirjainta, numeroa tai välimerkkinäppäintä
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -9598,4 +9598,14 @@ breakText Glyphs Glyphes
|
||||
No objects are selected. Aucun objet n’est sélectionné.
|
||||
Open a document to mark its fold lines. Ouvrez un document pour marquer ses lignes de pliage.
|
||||
Remove Fold Line Role Supprimer le type de ligne
|
||||
Tap Appui bref
|
||||
Clear Hold Effacer le maintien
|
||||
Hold Shortcuts Raccourcis de maintien
|
||||
Hold Shortcut Delay Délai des raccourcis de maintien
|
||||
How hold shortcuts work Fonctionnement des raccourcis de maintien
|
||||
Click, then press a key to hold for this (Esc cancels). Holding the key runs this; a quick press runs the key's own shortcut. Cliquez, puis appuyez sur une touche à maintenir pour cet élément (Échap annule). Maintenir la touche exécute cet élément ; un appui bref exécute le raccourci propre à la touche.
|
||||
A quick press of a key runs its shortcut. Holding the key for the delay runs the tool or command in its Hold column instead. A hold shortcut is a letter, digit or punctuation key, alone or with Shift. Un appui bref sur une touche exécute son raccourci. Maintenir la touche pendant le délai exécute à la place l’outil ou la commande de sa colonne Maintenir. Un raccourci de maintien est une touche de lettre, de chiffre ou de ponctuation, seule ou avec Maj.
|
||||
@msg Hold {_1} is already used by {_2} Le maintien de {_1} est déjà utilisé par {_2}
|
||||
@msg a hold shortcut is a key that types a character, alone or with Shift ({shown} has Cmd, Ctrl or Alt) un raccourci de maintien est une touche qui saisit un caractère, seule ou avec Maj ({shown} comporte Cmd, Ctrl ou Alt)
|
||||
@msg {shown} can't be a hold shortcut: use a letter, a digit or a punctuation key {shown} ne peut pas être un raccourci de maintien : utilisez une lettre, un chiffre ou une touche de ponctuation
|
||||
@msg {_1} × {_2} pixels is too large for GIF (at most 65535 pixels a side): lower the resolution {_1} × {_2} pixels, c’est trop grand pour le GIF (65535 pixels par côté au plus) : réduisez la résolution
|
||||
|
Can't render this file because it is too large.
|
@@ -4798,3 +4798,13 @@ swatch [Registration] [રજિસ્ટ્રેશન]
|
||||
Standard Single-line Composer સ્ટાન્ડર્ડ સિંગલ-લાઇન કમ્પોઝર
|
||||
Standard Every-line Composer સ્ટાન્ડર્ડ એવરી-લાઇન કમ્પોઝર
|
||||
@msg composer must be "singleLine", "everyLine", "standardSingleLine" or "standardEveryLine" composer આમાંથી એક હોવું જોઈએ: "singleLine", "everyLine", "standardSingleLine" અથવા "standardEveryLine"
|
||||
Tap ટૂંકું દબાણ
|
||||
Clear Hold હોલ્ડ સાફ કરો
|
||||
Hold Shortcuts હોલ્ડ શોર્ટકટ
|
||||
Hold Shortcut Delay હોલ્ડ શોર્ટકટ વિલંબ
|
||||
How hold shortcuts work હોલ્ડ શોર્ટકટ કેવી રીતે કામ કરે છે
|
||||
Click, then press a key to hold for this (Esc cancels). Holding the key runs this; a quick press runs the key's own shortcut. ક્લિક કરો, પછી આ માટે દબાવી રાખવાની કી દબાવો (Esc રદ કરે છે). કી દબાવી રાખવાથી આ ચાલે છે; ટૂંકું દબાણ કીનો પોતાનો શોર્ટકટ ચલાવે છે.
|
||||
A quick press of a key runs its shortcut. Holding the key for the delay runs the tool or command in its Hold column instead. A hold shortcut is a letter, digit or punctuation key, alone or with Shift. કીને ટૂંકું દબાવવાથી તેનો શોર્ટકટ ચાલે છે. વિલંબ જેટલો સમય કી દબાવી રાખવાથી તેના બદલે તેની હોલ્ડ કૉલમમાંનું ટૂલ અથવા આદેશ ચાલે છે. હોલ્ડ શોર્ટકટ એ અક્ષર, અંક અથવા વિરામચિહ્નની કી છે, એકલી અથવા Shift સાથે.
|
||||
@msg Hold {_1} is already used by {_2} હોલ્ડ {_1} પહેલેથી {_2} વાપરે છે
|
||||
@msg a hold shortcut is a key that types a character, alone or with Shift ({shown} has Cmd, Ctrl or Alt) હોલ્ડ શોર્ટકટ એ અક્ષર લખતી કી છે, એકલી અથવા Shift સાથે ({shown} માં Cmd, Ctrl અથવા Alt છે)
|
||||
@msg {shown} can't be a hold shortcut: use a letter, a digit or a punctuation key {shown} હોલ્ડ શોર્ટકટ ન હોઈ શકે: અક્ષર, અંક અથવા વિરામચિહ્નની કી વાપરો
|
||||
|
Can't render this file because it contains an unexpected character in line 72 and column 5.
|
@@ -9205,3 +9205,13 @@ theme Appearance अपीयरेंस
|
||||
No objects are selected. कोई ऑब्जेक्ट सिलेक्ट नहीं है।
|
||||
Open a document to mark its fold lines. फ़ोल्ड लाइनें मार्क करने के लिए कोई डॉक्यूमेंट ओपन करें।
|
||||
Remove Fold Line Role लाइन प्रकार हटाएँ
|
||||
Tap जल्दी दबाना
|
||||
Clear Hold होल्ड साफ़ करें
|
||||
Hold Shortcuts होल्ड शॉर्टकट
|
||||
Hold Shortcut Delay होल्ड शॉर्टकट विलंब
|
||||
How hold shortcuts work होल्ड शॉर्टकट कैसे काम करते हैं
|
||||
Click, then press a key to hold for this (Esc cancels). Holding the key runs this; a quick press runs the key's own shortcut. क्लिक करें, फिर इसके लिए दबाए रखने वाली कुंजी दबाएँ (Esc रद्द)। कुंजी दबाए रखने पर यह चलता है; जल्दी से दबाने पर कुंजी का अपना शॉर्टकट चलता है।
|
||||
A quick press of a key runs its shortcut. Holding the key for the delay runs the tool or command in its Hold column instead. A hold shortcut is a letter, digit or punctuation key, alone or with Shift. किसी कुंजी को जल्दी से दबाने पर उसका शॉर्टकट चलता है। कुंजी को विलंब जितनी देर दबाए रखने पर इसके बजाय उसके होल्ड कॉलम का टूल या कमांड चलता है। होल्ड शॉर्टकट कोई अक्षर, अंक या विराम चिह्न वाली कुंजी होती है, अकेले या Shift के साथ।
|
||||
@msg Hold {_1} is already used by {_2} होल्ड {_1} का उपयोग पहले से ही {_2} द्वारा किया जाता है
|
||||
@msg a hold shortcut is a key that types a character, alone or with Shift ({shown} has Cmd, Ctrl or Alt) होल्ड शॉर्टकट ऐसी कुंजी होती है जो अकेले या Shift के साथ कोई कैरेक्टर टाइप करती है ({shown} में Cmd, Ctrl या Alt है)
|
||||
@msg {shown} can't be a hold shortcut: use a letter, a digit or a punctuation key {shown} होल्ड शॉर्टकट नहीं हो सकता: कोई अक्षर, अंक या विराम चिह्न वाली कुंजी उपयोग करें
|
||||
|
Can't render this file because it is too large.
|
@@ -9601,3 +9601,13 @@ breakText Glyphs Glifák
|
||||
No objects are selected. Nincs kijelölt objektum.
|
||||
Open a document to mark its fold lines. Nyiss meg egy dokumentumot a hajtásvonalai megjelöléséhez.
|
||||
Remove Fold Line Role Vonaltípus eltávolítása
|
||||
Tap Rövid lenyomás
|
||||
Clear Hold Nyomva tartás törlése
|
||||
Hold Shortcuts Nyomva tartásos billentyűparancsok
|
||||
Hold Shortcut Delay Nyomva tartás késleltetése
|
||||
How hold shortcuts work Így működnek a nyomva tartásos billentyűparancsok
|
||||
Click, then press a key to hold for this (Esc cancels). Holding the key runs this; a quick press runs the key's own shortcut. Kattints, majd nyomd le a billentyűt, amelyet ehhez nyomva kell tartani (Esc: mégse). A billentyű nyomva tartása ezt futtatja; a rövid lenyomás a billentyű saját billentyűparancsát futtatja.
|
||||
A quick press of a key runs its shortcut. Holding the key for the delay runs the tool or command in its Hold column instead. A hold shortcut is a letter, digit or punctuation key, alone or with Shift. Egy billentyű rövid lenyomása a billentyűparancsát futtatja. Ha a késleltetés idejéig nyomva tartod, helyette a Nyomva tartás oszlopában lévő eszköz vagy parancs fut. Nyomva tartásos billentyűparancs lehet egy betű-, szám- vagy írásjelbillentyű, önmagában vagy Shifttel.
|
||||
@msg Hold {_1} is already used by {_2} már foglalt: nyomva tartás {_1} (használja: {_2})
|
||||
@msg a hold shortcut is a key that types a character, alone or with Shift ({shown} has Cmd, Ctrl or Alt) a nyomva tartásos billentyűparancs egy karaktert beíró billentyű, önmagában vagy Shifttel ({shown} Cmd, Ctrl vagy Alt billentyűt tartalmaz)
|
||||
@msg {shown} can't be a hold shortcut: use a letter, a digit or a punctuation key {shown} nem lehet nyomva tartásos billentyűparancs: használj betű-, szám- vagy írásjelbillentyűt
|
||||
|
Can't render this file because it is too large.
|
@@ -7033,3 +7033,13 @@ breakText Glyphs Glif
|
||||
Open a document to mark its fold lines. Buka dokumen untuk menandai garis lipatnya.
|
||||
Remove Fold Line Role Hapus jenis garis
|
||||
@msg composer must be "singleLine", "everyLine", "standardSingleLine" or "standardEveryLine" composer harus "singleLine", "everyLine", "standardSingleLine", atau "standardEveryLine"
|
||||
Tap Tekan singkat
|
||||
Clear Hold Hapus Tahan
|
||||
Hold Shortcuts Pintasan tahan
|
||||
Hold Shortcut Delay Jeda pintasan tahan
|
||||
How hold shortcuts work Cara kerja pintasan tahan
|
||||
Click, then press a key to hold for this (Esc cancels). Holding the key runs this; a quick press runs the key's own shortcut. Klik, lalu tekan tombol yang ditahan untuk ini (Esc membatalkan). Menahan tombol menjalankan ini; tekan singkat menjalankan pintasan milik tombol itu sendiri.
|
||||
A quick press of a key runs its shortcut. Holding the key for the delay runs the tool or command in its Hold column instead. A hold shortcut is a letter, digit or punctuation key, alone or with Shift. Tekan singkat sebuah tombol menjalankan pintasannya. Menahan tombol selama jeda menjalankan alat atau perintah di kolom Tahan sebagai gantinya. Pintasan tahan adalah tombol huruf, angka, atau tanda baca, sendiri atau dengan Shift.
|
||||
@msg Hold {_1} is already used by {_2} Tahan {_1} sudah digunakan oleh {_2}
|
||||
@msg a hold shortcut is a key that types a character, alone or with Shift ({shown} has Cmd, Ctrl or Alt) pintasan tahan adalah tombol yang mengetik karakter, sendiri atau dengan Shift ({shown} memakai Cmd, Ctrl, atau Alt)
|
||||
@msg {shown} can't be a hold shortcut: use a letter, a digit or a punctuation key {shown} tidak bisa menjadi pintasan tahan: gunakan huruf, angka, atau tombol tanda baca
|
||||
|
Can't render this file because it contains an unexpected character in line 2473 and column 5.
|
@@ -9245,3 +9245,13 @@ breakText Glyphs Glifi
|
||||
No objects are selected. Nessun oggetto selezionato.
|
||||
Open a document to mark its fold lines. Apri un documento per segnarne le linee di piega.
|
||||
Remove Fold Line Role Rimuovi tipo di linea
|
||||
Tap Pressione breve
|
||||
Clear Hold Cancella pressione prolungata
|
||||
Hold Shortcuts Scorciatoie a pressione prolungata
|
||||
Hold Shortcut Delay Ritardo delle scorciatoie a pressione prolungata
|
||||
How hold shortcuts work Come funzionano le scorciatoie a pressione prolungata
|
||||
Click, then press a key to hold for this (Esc cancels). Holding the key runs this; a quick press runs the key's own shortcut. Fai clic, poi premi un tasto da tenere premuto per questo (Esc annulla). Tenere premuto il tasto esegue questo; una pressione breve esegue la scorciatoia del tasto stesso.
|
||||
A quick press of a key runs its shortcut. Holding the key for the delay runs the tool or command in its Hold column instead. A hold shortcut is a letter, digit or punctuation key, alone or with Shift. Una pressione breve di un tasto esegue la sua scorciatoia. Tenere premuto il tasto per la durata del ritardo esegue invece lo strumento o il comando della sua colonna Tieni premuto. Una scorciatoia a pressione prolungata è un tasto di lettera, cifra o punteggiatura, da solo o con Shift.
|
||||
@msg Hold {_1} is already used by {_2} La pressione prolungata di {_1} è già usata da {_2}
|
||||
@msg a hold shortcut is a key that types a character, alone or with Shift ({shown} has Cmd, Ctrl or Alt) una scorciatoia a pressione prolungata è un tasto che digita un carattere, da solo o con Shift ({shown} ha Cmd, Ctrl o Alt)
|
||||
@msg {shown} can't be a hold shortcut: use a letter, a digit or a punctuation key {shown} non può essere una scorciatoia a pressione prolungata: usa una lettera, una cifra o un tasto di punteggiatura
|
||||
|
Can't render this file because it is too large.
|
@@ -9312,3 +9312,13 @@ breakText Glyphs 字形
|
||||
No objects are selected. オブジェクトが選択されていません。
|
||||
Open a document to mark its fold lines. ドキュメントを開くと折り線を設定できます。
|
||||
Remove Fold Line Role 線種を解除
|
||||
Tap 短押し
|
||||
Clear Hold 長押しを消去
|
||||
Hold Shortcuts 長押しショートカット
|
||||
Hold Shortcut Delay 長押しショートカットの遅延
|
||||
How hold shortcuts work 長押しショートカットのしくみ
|
||||
Click, then press a key to hold for this (Esc cancels). Holding the key runs this; a quick press runs the key's own shortcut. クリックしてから、これに使う長押しのキーを押します (Esc でキャンセル)。キーを長押しするとこれを実行し、短く押すとキー自体のショートカットを実行します。
|
||||
A quick press of a key runs its shortcut. Holding the key for the delay runs the tool or command in its Hold column instead. A hold shortcut is a letter, digit or punctuation key, alone or with Shift. キーを短く押すと、そのショートカットを実行します。遅延の時間だけキーを押し続けると、代わりに長押し列のツールまたはコマンドを実行します。長押しショートカットには、文字、数字、句読点のキーを単独で、または Shift と組み合わせて使用できます。
|
||||
@msg Hold {_1} is already used by {_2} 長押し {_1} はすでに {_2} で使用されています
|
||||
@msg a hold shortcut is a key that types a character, alone or with Shift ({shown} has Cmd, Ctrl or Alt) 長押しショートカットは、文字を入力するキーを単独で、または Shift と組み合わせたものです ({shown} には Cmd、Ctrl、Alt のいずれかが含まれています)
|
||||
@msg {shown} can't be a hold shortcut: use a letter, a digit or a punctuation key {shown} は長押しショートカットにできません: 文字、数字、句読点のいずれかのキーを使用してください
|
||||
|
Can't render this file because it is too large.
|
@@ -9885,3 +9885,13 @@ font-script Japanese იაპონური
|
||||
Open a document to mark its fold lines. გახსენით დოკუმენტი მისი მოკეცვის ხაზების მოსანიშნად.
|
||||
Remove Fold Line Role ხაზის ტიპის მოხსნა
|
||||
@msg composer must be "singleLine", "everyLine", "standardSingleLine" or "standardEveryLine" composer უნდა იყოს "singleLine", "everyLine", "standardSingleLine" ან "standardEveryLine"
|
||||
Tap მოკლე დაჭერა
|
||||
Clear Hold ხანგრძლივი დაჭერის გასუფთავება
|
||||
Hold Shortcuts ხანგრძლივი დაჭერის მალსახმობები
|
||||
Hold Shortcut Delay ხანგრძლივი დაჭერის დაყოვნება
|
||||
How hold shortcuts work როგორ მუშაობს ხანგრძლივი დაჭერის მალსახმობები
|
||||
Click, then press a key to hold for this (Esc cancels). Holding the key runs this; a quick press runs the key's own shortcut. დაწკაპეთ, შემდეგ დააჭირეთ კლავიშს, რომელიც ამისთვის უნდა დაიჭიროთ (Esc აუქმებს). კლავიშის ხანგრძლივი დაჭერა ამას უშვებს; მოკლე დაჭერა კლავიშის საკუთარ მალსახმობს უშვებს.
|
||||
A quick press of a key runs its shortcut. Holding the key for the delay runs the tool or command in its Hold column instead. A hold shortcut is a letter, digit or punctuation key, alone or with Shift. კლავიშის მოკლე დაჭერა მის მალსახმობს უშვებს. თუ კლავიშს დაყოვნების ხანგრძლივობით დაიჭერთ, ამის ნაცვლად გაეშვება მისი „დაჭერა“ სვეტის ხელსაწყო ან ბრძანება. ხანგრძლივი დაჭერის მალსახმობი არის ასოს, ციფრის ან სასვენი ნიშნის კლავიში, ცალკე ან Shift კლავიშთან ერთად.
|
||||
@msg Hold {_1} is already used by {_2} ხანგრძლივი დაჭერა {_1} უკვე გამოიყენება ამისთვის: {_2}
|
||||
@msg a hold shortcut is a key that types a character, alone or with Shift ({shown} has Cmd, Ctrl or Alt) ხანგრძლივი დაჭერის მალსახმობი არის კლავიში, რომელიც სიმბოლოს წერს, ცალკე ან Shift კლავიშთან ერთად ({shown} შეიცავს Cmd, Ctrl ან Alt კლავიშს)
|
||||
@msg {shown} can't be a hold shortcut: use a letter, a digit or a punctuation key {shown} ვერ იქნება ხანგრძლივი დაჭერის მალსახმობი: გამოიყენეთ ასო, ციფრი ან სასვენი ნიშნის კლავიში
|
||||
|
Can't render this file because it is too large.
|
@@ -9208,3 +9208,13 @@ breakText Glyphs 글리프
|
||||
No objects are selected. 선택한 개체가 없습니다.
|
||||
Open a document to mark its fold lines. 접는 선을 지정하려면 문서를 여세요.
|
||||
Remove Fold Line Role 선 종류 제거
|
||||
Tap 짧게 누르기
|
||||
Clear Hold 길게 누르기 지우기
|
||||
Hold Shortcuts 길게 누르기 단축키
|
||||
Hold Shortcut Delay 길게 누르기 단축키 지연 시간
|
||||
How hold shortcuts work 길게 누르기 단축키 작동 방식
|
||||
Click, then press a key to hold for this (Esc cancels). Holding the key runs this; a quick press runs the key's own shortcut. 클릭한 다음 이 항목에 길게 누를 키를 누르세요 (Esc로 취소). 키를 길게 누르면 이 항목이 실행되고, 짧게 누르면 키 자체의 단축키가 실행됩니다.
|
||||
A quick press of a key runs its shortcut. Holding the key for the delay runs the tool or command in its Hold column instead. A hold shortcut is a letter, digit or punctuation key, alone or with Shift. 키를 짧게 누르면 해당 단축키가 실행됩니다. 지연 시간 동안 키를 누르고 있으면 대신 누르고 있기 열의 도구나 명령이 실행됩니다. 길게 누르기 단축키는 문자, 숫자 또는 문장 부호 키이며, 단독으로 또는 Shift와 함께 사용합니다.
|
||||
@msg Hold {_1} is already used by {_2} 길게 누르기 {_1}은(는) 이미 {_2}에서 사용 중입니다
|
||||
@msg a hold shortcut is a key that types a character, alone or with Shift ({shown} has Cmd, Ctrl or Alt) 길게 누르기 단축키는 문자를 입력하는 키를 단독으로 또는 Shift와 함께 사용해야 합니다 ({shown}에 Cmd, Ctrl 또는 Alt가 있음)
|
||||
@msg {shown} can't be a hold shortcut: use a letter, a digit or a punctuation key {shown}은(는) 길게 누르기 단축키가 될 수 없습니다: 문자, 숫자 또는 문장 부호 키를 사용하세요
|
||||
|
Can't render this file because it is too large.
|
@@ -9646,3 +9646,13 @@ breakText Glyphs Glyphs
|
||||
No objects are selected. Er zijn geen objecten geselecteerd.
|
||||
Open a document to mark its fold lines. Open een document om de vouwlijnen te markeren.
|
||||
Remove Fold Line Role Lijnsoort verwijderen
|
||||
Tap Kort drukken
|
||||
Clear Hold Vasthouden wissen
|
||||
Hold Shortcuts Vasthoudsneltoetsen
|
||||
Hold Shortcut Delay Vertraging vasthoudsneltoetsen
|
||||
How hold shortcuts work Zo werken vasthoudsneltoetsen
|
||||
Click, then press a key to hold for this (Esc cancels). Holding the key runs this; a quick press runs the key's own shortcut. Klik en druk vervolgens een toets in die hiervoor wordt vastgehouden (Esc annuleert). De toets vasthouden voert dit uit; kort drukken voert de eigen sneltoets van de toets uit.
|
||||
A quick press of a key runs its shortcut. Holding the key for the delay runs the tool or command in its Hold column instead. A hold shortcut is a letter, digit or punctuation key, alone or with Shift. Kort drukken op een toets voert de sneltoets ervan uit. De toets vasthouden gedurende de vertraging voert in plaats daarvan het gereedschap of de opdracht in de kolom Houd uit. Een vasthoudsneltoets is een letter-, cijfer- of leestekentoets, alleen of met Shift.
|
||||
@msg Hold {_1} is already used by {_2} Vasthouden {_1} wordt al gebruikt door {_2}
|
||||
@msg a hold shortcut is a key that types a character, alone or with Shift ({shown} has Cmd, Ctrl or Alt) een vasthoudsneltoets is een toets die een teken typt, alleen of met Shift ({shown} bevat Cmd, Ctrl of Alt)
|
||||
@msg {shown} can't be a hold shortcut: use a letter, a digit or a punctuation key {shown} kan geen vasthoudsneltoets zijn: gebruik een letter, een cijfer of een leestekentoets
|
||||
|
Can't render this file because it is too large.
|
@@ -9466,3 +9466,13 @@ breakText Glyphs Glify
|
||||
No objects are selected. Nie zaznaczono żadnych obiektów.
|
||||
Open a document to mark its fold lines. Otwórz dokument, aby oznaczyć jego linie zgięcia.
|
||||
Remove Fold Line Role Usuń rodzaj linii
|
||||
Tap Krótkie naciśnięcie
|
||||
Clear Hold Wyczyść przytrzymanie
|
||||
Hold Shortcuts Skróty przytrzymania
|
||||
Hold Shortcut Delay Opóźnienie skrótów przytrzymania
|
||||
How hold shortcuts work Jak działają skróty przytrzymania
|
||||
Click, then press a key to hold for this (Esc cancels). Holding the key runs this; a quick press runs the key's own shortcut. Kliknij, a następnie naciśnij klawisz, który ma być przytrzymywany dla tego elementu (Esc anuluje). Przytrzymanie klawisza uruchamia ten element; krótkie naciśnięcie uruchamia własny skrót klawisza.
|
||||
A quick press of a key runs its shortcut. Holding the key for the delay runs the tool or command in its Hold column instead. A hold shortcut is a letter, digit or punctuation key, alone or with Shift. Krótkie naciśnięcie klawisza uruchamia jego skrót. Przytrzymanie klawisza przez czas opóźnienia uruchamia zamiast tego narzędzie lub polecenie z jego kolumny Przytrzymaj. Skrót przytrzymania to klawisz litery, cyfry lub znaku interpunkcyjnego, sam lub z Shift.
|
||||
@msg Hold {_1} is already used by {_2} Przytrzymanie {_1} jest już używane przez {_2}
|
||||
@msg a hold shortcut is a key that types a character, alone or with Shift ({shown} has Cmd, Ctrl or Alt) skrót przytrzymania to klawisz wpisujący znak, sam lub z Shift ({shown} zawiera Cmd, Ctrl lub Alt)
|
||||
@msg {shown} can't be a hold shortcut: use a letter, a digit or a punctuation key {shown} nie może być skrótem przytrzymania: użyj litery, cyfry lub klawisza interpunkcyjnego
|
||||
|
Can't render this file because it is too large.
|
@@ -9684,3 +9684,13 @@ swatch Yellow Green Verde-amarelado
|
||||
No objects are selected. Nenhum objeto selecionado.
|
||||
Open a document to mark its fold lines. Abra um documento para marcar suas linhas de dobra.
|
||||
Remove Fold Line Role Remover Tipo de Linha
|
||||
Tap Toque Rápido
|
||||
Clear Hold Limpar Pressionamento Longo
|
||||
Hold Shortcuts Atalhos de Pressionamento Longo
|
||||
Hold Shortcut Delay Atraso dos Atalhos de Pressionamento Longo
|
||||
How hold shortcuts work Como funcionam os atalhos de pressionamento longo
|
||||
Click, then press a key to hold for this (Esc cancels). Holding the key runs this; a quick press runs the key's own shortcut. Clique e depois pressione uma tecla para manter pressionada para isto (Esc cancela). Manter a tecla pressionada executa isto; um toque rápido executa o atalho da própria tecla.
|
||||
A quick press of a key runs its shortcut. Holding the key for the delay runs the tool or command in its Hold column instead. A hold shortcut is a letter, digit or punctuation key, alone or with Shift. Um toque rápido em uma tecla executa o atalho dela. Manter a tecla pressionada pelo tempo do atraso executa, em vez disso, a ferramenta ou o comando da coluna Manter pressionado. Um atalho de pressionamento longo é uma tecla de letra, número ou pontuação, sozinha ou com Shift.
|
||||
@msg Hold {_1} is already used by {_2} O pressionamento longo de {_1} já é usado por {_2}
|
||||
@msg a hold shortcut is a key that types a character, alone or with Shift ({shown} has Cmd, Ctrl or Alt) um atalho de pressionamento longo é uma tecla que digita um caractere, sozinha ou com Shift ({shown} tem Cmd, Ctrl ou Alt)
|
||||
@msg {shown} can't be a hold shortcut: use a letter, a digit or a punctuation key {shown} não pode ser um atalho de pressionamento longo: use uma letra, um número ou uma tecla de pontuação
|
||||
|
Can't render this file because it is too large.
|
@@ -9709,3 +9709,13 @@ shape Open Открытый
|
||||
Remove Fold Line Role Убрать тип линии
|
||||
@msg {w} × {h} pixels is too large for PSD (at most {MAX_SIDE} pixels a side): lower the resolution {w} × {h} пикселей — слишком большой размер для PSD (не более {MAX_SIDE} пикселей по стороне): уменьшите разрешение
|
||||
@msg composer must be "singleLine", "everyLine", "standardSingleLine" or "standardEveryLine" composer должен быть "singleLine", "everyLine", "standardSingleLine" или "standardEveryLine"
|
||||
Tap Короткое нажатие
|
||||
Clear Hold Очистить удержание
|
||||
Hold Shortcuts Клавиши удержания
|
||||
Hold Shortcut Delay Задержка клавиш удержания
|
||||
How hold shortcuts work Как работают клавиши удержания
|
||||
Click, then press a key to hold for this (Esc cancels). Holding the key runs this; a quick press runs the key's own shortcut. Щелкните, затем нажмите клавишу, которую нужно удерживать для этого (Esc отменяет). Удержание клавиши запускает это; короткое нажатие запускает собственное сочетание клавиши.
|
||||
A quick press of a key runs its shortcut. Holding the key for the delay runs the tool or command in its Hold column instead. A hold shortcut is a letter, digit or punctuation key, alone or with Shift. Короткое нажатие клавиши запускает ее сочетание. Удержание клавиши в течение задержки запускает вместо этого инструмент или команду из ее столбца «Удерживать». Клавиша удержания — это клавиша буквы, цифры или знака препинания, отдельно или с Shift.
|
||||
@msg Hold {_1} is already used by {_2} Удержание {_1} уже используется для {_2}
|
||||
@msg a hold shortcut is a key that types a character, alone or with Shift ({shown} has Cmd, Ctrl or Alt) клавиша удержания — это клавиша, которая вводит символ, отдельно или с Shift ({shown} содержит Cmd, Ctrl или Alt)
|
||||
@msg {shown} can't be a hold shortcut: use a letter, a digit or a punctuation key {shown} не может быть клавишей удержания: используйте букву, цифру или клавишу знака препинания
|
||||
|
Can't render this file because it is too large.
|
@@ -9283,3 +9283,13 @@ digits Hindi Hindi
|
||||
Open a document to mark its fold lines. Öppna ett dokument för att markera dess falslinjer.
|
||||
Remove Fold Line Role Ta bort linjetyp
|
||||
@msg {w} × {h} pixels is too large for PSD (at most {MAX_SIDE} pixels a side): lower the resolution {w} × {h} pixlar är för stort för PSD (högst {MAX_SIDE} pixlar per sida): sänk upplösningen
|
||||
Tap Kort tryck
|
||||
Clear Hold Rensa håll
|
||||
Hold Shortcuts Hållkortkommandon
|
||||
Hold Shortcut Delay Fördröjning för hållkortkommandon
|
||||
How hold shortcuts work Så fungerar hållkortkommandon
|
||||
Click, then press a key to hold for this (Esc cancels). Holding the key runs this; a quick press runs the key's own shortcut. Klicka och tryck sedan på en tangent som ska hållas ned för detta (Esc avbryter). Att hålla ned tangenten kör detta; ett kort tryck kör tangentens eget kortkommando.
|
||||
A quick press of a key runs its shortcut. Holding the key for the delay runs the tool or command in its Hold column instead. A hold shortcut is a letter, digit or punctuation key, alone or with Shift. Ett kort tryck på en tangent kör dess kortkommando. Att hålla ned tangenten under fördröjningen kör i stället verktyget eller kommandot i dess Håll-kolumn. Ett hållkortkommando är en bokstavs-, siffer- eller skiljeteckentangent, ensam eller med Shift.
|
||||
@msg Hold {_1} is already used by {_2} Håll {_1} används redan av {_2}
|
||||
@msg a hold shortcut is a key that types a character, alone or with Shift ({shown} has Cmd, Ctrl or Alt) ett hållkortkommando är en tangent som skriver ett tecken, ensam eller med Shift ({shown} har Cmd, Ctrl eller Alt)
|
||||
@msg {shown} can't be a hold shortcut: use a letter, a digit or a punctuation key {shown} kan inte vara ett hållkortkommando: använd en bokstav, en siffra eller en skiljeteckentangent
|
||||
|
Can't render this file because it is too large.
|
@@ -9567,3 +9567,13 @@ breakText Glyphs Glifler
|
||||
No objects are selected. Hiçbir nesne seçili değil.
|
||||
Open a document to mark its fold lines. Katlama çizgilerini işaretlemek için bir belgeyi açın.
|
||||
Remove Fold Line Role Çizgi Türünü Kaldır
|
||||
Tap Kısa Basma
|
||||
Clear Hold Basılı Tutmayı Temizle
|
||||
Hold Shortcuts Basılı Tutma Kısayolları
|
||||
Hold Shortcut Delay Basılı Tutma Kısayolu Gecikmesi
|
||||
How hold shortcuts work Basılı tutma kısayolları nasıl çalışır
|
||||
Click, then press a key to hold for this (Esc cancels). Holding the key runs this; a quick press runs the key's own shortcut. Tıklayın, ardından bunun için basılı tutulacak tuşa basın (Esc iptal edilir). Tuşu basılı tutmak bunu çalıştırır; kısa basmak tuşun kendi kısayolunu çalıştırır.
|
||||
A quick press of a key runs its shortcut. Holding the key for the delay runs the tool or command in its Hold column instead. A hold shortcut is a letter, digit or punctuation key, alone or with Shift. Bir tuşa kısa basmak onun kısayolunu çalıştırır. Tuşu gecikme süresi boyunca basılı tutmak bunun yerine Basılı tutun sütunundaki aracı veya komutu çalıştırır. Basılı tutma kısayolu, tek başına veya Shift ile bir harf, rakam ya da noktalama tuşudur.
|
||||
@msg Hold {_1} is already used by {_2} Basılı tutma {_1} zaten {_2} tarafından kullanılıyor
|
||||
@msg a hold shortcut is a key that types a character, alone or with Shift ({shown} has Cmd, Ctrl or Alt) basılı tutma kısayolu, tek başına veya Shift ile bir karakter yazan tuştur ({shown} Cmd, Ctrl veya Alt içeriyor)
|
||||
@msg {shown} can't be a hold shortcut: use a letter, a digit or a punctuation key {shown} basılı tutma kısayolu olamaz: bir harf, rakam veya noktalama tuşu kullanın
|
||||
|
Can't render this file because it is too large.
|
@@ -9220,3 +9220,13 @@ breakText Glyphs Гліфи
|
||||
No objects are selected. Об’єкти не виділено.
|
||||
Open a document to mark its fold lines. Відкрийте документ, щоб позначити його лінії згину.
|
||||
Remove Fold Line Role Прибрати тип лінії
|
||||
Tap Коротке натискання
|
||||
Clear Hold Очистити утримання
|
||||
Hold Shortcuts Клавіші утримання
|
||||
Hold Shortcut Delay Затримка клавіш утримання
|
||||
How hold shortcuts work Як працюють клавіші утримання
|
||||
Click, then press a key to hold for this (Esc cancels). Holding the key runs this; a quick press runs the key's own shortcut. Клацніть, потім натисніть клавішу, яку слід утримувати для цього (Esc скасовує). Утримання клавіші запускає це; коротке натискання запускає власне сполучення клавіші.
|
||||
A quick press of a key runs its shortcut. Holding the key for the delay runs the tool or command in its Hold column instead. A hold shortcut is a letter, digit or punctuation key, alone or with Shift. Коротке натискання клавіші запускає її сполучення. Утримання клавіші протягом затримки запускає натомість інструмент або команду з її стовпця «Утримувати». Клавіша утримання — це клавіша літери, цифри або розділового знака, окремо або з Shift.
|
||||
@msg Hold {_1} is already used by {_2} Утримання {_1} вже використовується для {_2}
|
||||
@msg a hold shortcut is a key that types a character, alone or with Shift ({shown} has Cmd, Ctrl or Alt) клавіша утримання — це клавіша, що вводить символ, окремо або з Shift ({shown} містить Cmd, Ctrl або Alt)
|
||||
@msg {shown} can't be a hold shortcut: use a letter, a digit or a punctuation key {shown} не може бути клавішею утримання: використайте літеру, цифру або клавішу розділового знака
|
||||
|
Can't render this file because it is too large.
|
@@ -7424,3 +7424,13 @@ breakText Glyphs Glyph
|
||||
@msg {width} × {height} pixels is too large for Targa (at most 65535 pixels a side): lower the resolution {width} × {height} điểm ảnh quá lớn cho Targa (tối đa 65535 điểm ảnh mỗi cạnh): hãy giảm độ phân giải
|
||||
@msg {w} × {h} pixels is too large for PSD (at most {MAX_SIDE} pixels a side): lower the resolution {w} × {h} điểm ảnh quá lớn cho PSD (tối đa {MAX_SIDE} điểm ảnh mỗi cạnh): hãy giảm độ phân giải
|
||||
@msg composer must be "singleLine", "everyLine", "standardSingleLine" or "standardEveryLine" composer phải là "singleLine", "everyLine", "standardSingleLine" hoặc "standardEveryLine"
|
||||
Tap Nhấn nhanh
|
||||
Clear Hold Xóa nhấn giữ
|
||||
Hold Shortcuts Phím tắt nhấn giữ
|
||||
Hold Shortcut Delay Độ trễ phím tắt nhấn giữ
|
||||
How hold shortcuts work Cách phím tắt nhấn giữ hoạt động
|
||||
Click, then press a key to hold for this (Esc cancels). Holding the key runs this; a quick press runs the key's own shortcut. Nhấp, rồi nhấn phím cần giữ cho mục này (Esc để hủy). Giữ phím sẽ chạy mục này; nhấn nhanh sẽ chạy phím tắt riêng của phím đó.
|
||||
A quick press of a key runs its shortcut. Holding the key for the delay runs the tool or command in its Hold column instead. A hold shortcut is a letter, digit or punctuation key, alone or with Shift. Nhấn nhanh một phím sẽ chạy phím tắt của phím đó. Giữ phím trong khoảng độ trễ sẽ chạy công cụ hoặc lệnh trong cột Giữ của phím thay vào đó. Phím tắt nhấn giữ là một phím chữ cái, chữ số hoặc dấu câu, dùng riêng hoặc cùng Shift.
|
||||
@msg Hold {_1} is already used by {_2} Nhấn giữ {_1} đã được {_2} sử dụng
|
||||
@msg a hold shortcut is a key that types a character, alone or with Shift ({shown} has Cmd, Ctrl or Alt) phím tắt nhấn giữ là một phím gõ ra ký tự, dùng riêng hoặc cùng Shift ({shown} có Cmd, Ctrl hoặc Alt)
|
||||
@msg {shown} can't be a hold shortcut: use a letter, a digit or a punctuation key {shown} không thể là phím tắt nhấn giữ: hãy dùng chữ cái, chữ số hoặc phím dấu câu
|
||||
|
Can't render this file because it contains an unexpected character in line 205 and column 5.
|
@@ -9452,3 +9452,13 @@ breakText Glyphs 字形
|
||||
Open a document to mark its fold lines. 打开文档以标记其折线。
|
||||
Remove Fold Line Role 移除线条类型
|
||||
@msg {w} × {h} pixels is too large for PSD (at most {MAX_SIDE} pixels a side): lower the resolution {w} × {h} 像素对 PSD 而言过大 (每边最多 {MAX_SIDE} 像素):请降低分辨率
|
||||
Tap 短按
|
||||
Clear Hold 清除按住
|
||||
Hold Shortcuts 按住快捷键
|
||||
Hold Shortcut Delay 按住快捷键延迟
|
||||
How hold shortcuts work 按住快捷键的工作方式
|
||||
Click, then press a key to hold for this (Esc cancels). Holding the key runs this; a quick press runs the key's own shortcut. 单击后按下要为此按住的键 (Esc 取消)。按住该键会运行此项;短按会运行该键自己的快捷键。
|
||||
A quick press of a key runs its shortcut. Holding the key for the delay runs the tool or command in its Hold column instead. A hold shortcut is a letter, digit or punctuation key, alone or with Shift. 短按一个键会运行它的快捷键。按住该键达到延迟时间,则改为运行其“按住”列中的工具或命令。按住快捷键是字母、数字或标点键,可单独使用或与 Shift 组合。
|
||||
@msg Hold {_1} is already used by {_2} 按住 {_1} 已被 {_2} 使用
|
||||
@msg a hold shortcut is a key that types a character, alone or with Shift ({shown} has Cmd, Ctrl or Alt) 按住快捷键是可输入字符的键,单独使用或与 Shift 组合 ({shown} 含有 Cmd、Ctrl 或 Alt)
|
||||
@msg {shown} can't be a hold shortcut: use a letter, a digit or a punctuation key {shown} 不能作为按住快捷键:请使用字母、数字或标点键
|
||||
|
Can't render this file because it is too large.
|
@@ -9262,3 +9262,13 @@ breakText Glyphs 字符
|
||||
Open a document to mark its fold lines. 開啟文件以標記其摺線。
|
||||
Remove Fold Line Role 移除線條類型
|
||||
@msg {what} would print on more than {MAX_TILES} tiles: scale it down {what} 會列印在超過 {MAX_TILES} 個拼貼上:請縮小
|
||||
Tap 短按
|
||||
Clear Hold 清除按住
|
||||
Hold Shortcuts 按住快速鍵
|
||||
Hold Shortcut Delay 按住快速鍵延遲
|
||||
How hold shortcuts work 按住快速鍵的運作方式
|
||||
Click, then press a key to hold for this (Esc cancels). Holding the key runs this; a quick press runs the key's own shortcut. 按一下後按下要為此按住的按鍵 (Esc 取消)。按住該按鍵會執行此項;短按會執行該按鍵本身的快速鍵。
|
||||
A quick press of a key runs its shortcut. Holding the key for the delay runs the tool or command in its Hold column instead. A hold shortcut is a letter, digit or punctuation key, alone or with Shift. 短按按鍵會執行它的快速鍵。按住按鍵達延遲時間,則改為執行其「按住」欄中的工具或命令。按住快速鍵是字母、數字或標點符號按鍵,可單獨使用或搭配 Shift。
|
||||
@msg Hold {_1} is already used by {_2} 按住 {_1} 已被 {_2} 使用
|
||||
@msg a hold shortcut is a key that types a character, alone or with Shift ({shown} has Cmd, Ctrl or Alt) 按住快速鍵是可輸入字元的按鍵,可單獨使用或搭配 Shift ({shown} 含有 Cmd、Ctrl 或 Alt)
|
||||
@msg {shown} can't be a hold shortcut: use a letter, a digit or a punctuation key {shown} 不能作為按住快速鍵:請使用字母、數字或標點符號按鍵
|
||||
|
Can't render this file because it is too large.
|
@@ -368,6 +368,9 @@ pub struct VectorcraftApp {
|
||||
/// The single-key tool shortcuts held down, the last held last, and the tool each goes back to
|
||||
/// when it is let go ([`shortcuts::HeldTool`]).
|
||||
pub(crate) held_tool: Vec<shortcuts::HeldTool>,
|
||||
/// A key with a hold shortcut that waits for its release, and the keys whose repeats are held
|
||||
/// back until they are let go ([`shortcuts::HoldKeys`]).
|
||||
pub(crate) hold_keys: shortcuts::HoldKeys,
|
||||
/// A synthetic batch is in the host's raw input and no settled UI pass has taken it yet.
|
||||
synthetic_injected: bool,
|
||||
/// The exact events of [`Self::synthetic_injected`], to remove them if the state they belong
|
||||
|
||||
@@ -174,8 +174,13 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[
|
||||
"Cmd+I",
|
||||
"{} open the Check Spelling dialog to walk through unrecognized words with suggestions, ignore, change and dictionary options",
|
||||
),
|
||||
("shortcuts.set", "Set Keyboard Shortcut", "", "{id: command id or tool:<id>, shortcut: \"Cmd+Shift+K\" | \"\" (none) | null (default), force?}"),
|
||||
("shortcuts.list", "List Keyboard Shortcuts", "", "{query?} → [{id, label, group, shortcut, default, overridden}]"),
|
||||
(
|
||||
"shortcuts.set",
|
||||
"Set Keyboard Shortcut",
|
||||
"",
|
||||
"{id: command id or tool:<id>, shortcut?: \"Cmd+Shift+K\" | \"\" (none) | null (default), hold?: a character key alone or with Shift (\"X\", \"Shift+X\", \".\") | \"\" | null (none), force?} → {id, shortcut, hold, removedFrom}; `hold` alone leaves the shortcut as it is; a hold shortcut acts while the holdShortcuts preference is on",
|
||||
),
|
||||
("shortcuts.list", "List Keyboard Shortcuts", "", "{query?} → [{id, label, group, shortcut, hold, default, overridden}]"),
|
||||
("shortcuts.conflicts", "Keyboard Shortcut Conflicts", "", "{} → [{shortcut, ids}]"),
|
||||
("shortcuts.reset", "Reset Keyboard Shortcuts", "", "{}"),
|
||||
(
|
||||
@@ -189,7 +194,7 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[
|
||||
"shortcuts.exportText",
|
||||
"Export Keyboard Shortcuts as Text…",
|
||||
"",
|
||||
"{path?} save the current set's tools and menu commands with their shortcuts as a UTF-8 text file (Keyboard Shortcuts › Export Text…): the set's name, then a Tools and a Menu Commands section in the dialog's order, one `name<TAB>shortcut` line per row, empty after the tab when it has none; without `path`, pick a file",
|
||||
"{path?} save the current set's tools and menu commands with their shortcuts as a UTF-8 text file (Keyboard Shortcuts › Export Text…): the set's name, then a Tools and a Menu Commands section in the dialog's order, one `name<TAB>shortcut` line per row, empty after the tab when it has none, and while the holdShortcuts preference is on a third `Hold <key>` column on a row with a hold shortcut; without `path`, pick a file",
|
||||
),
|
||||
("shortcuts.import", "Import Keyboard Shortcuts…", "", "{path? | data?}"),
|
||||
(
|
||||
|
||||
@@ -580,6 +580,18 @@ fn category_fields(ui: &mut egui::Ui, app: &mut VectorcraftApp, d: &mut Dialog,
|
||||
}
|
||||
}
|
||||
PrefKind::Bool => bool_row(ui, d, sp.key, sp.label),
|
||||
// General › Hold Shortcut Delay acts only while Hold Shortcuts is on: dimmed while it
|
||||
// is off, as in Edit › Keyboard Shortcuts, which shows it only then.
|
||||
PrefKind::Num { min, max, unit } if sp.key == "keyHoldDelay" => {
|
||||
ui.add_enabled_ui(d.bool("holdShortcuts"), |ui| {
|
||||
labeled(ui, sp.label, |ui, _| {
|
||||
let x = v.as_f64().unwrap_or(min);
|
||||
if let Some(x) = widgets::range_field(ui, sp.key, x, min..=max, &format!(" {unit}"), 3, 110.0) {
|
||||
d.fields.insert(sp.key.into(), json!(x));
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
PrefKind::Num { min, max, unit } => {
|
||||
labeled(ui, sp.label, |ui, label_id| {
|
||||
let mut x = v.as_f64().unwrap_or(min);
|
||||
|
||||
@@ -1093,6 +1093,45 @@ fn scroll_sideways_with_cmd_wheel_dims_with_zoom_with_mouse_wheel() {
|
||||
}
|
||||
}
|
||||
|
||||
/// General › Hold Shortcut Delay: its field is dimmed while Hold Shortcuts is unchecked in the
|
||||
/// dialog, and a click on it then does not give it the keyboard.
|
||||
#[test]
|
||||
fn hold_shortcut_delay_dims_without_hold_shortcuts() {
|
||||
fn text(s: &egui::Shape, f: &dyn Fn(&str) -> bool) -> Option<egui::Rect> {
|
||||
match s {
|
||||
egui::Shape::Text(t) if f(t.galley.text()) => Some(t.visual_bounding_rect()),
|
||||
egui::Shape::Vec(v) => v.iter().find_map(|s| text(s, f)),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
for on in [true, false] {
|
||||
let ctx = egui::Context::default();
|
||||
crate::theme::install_fonts(&ctx);
|
||||
let mut a = app();
|
||||
let mut d = Dialog::new("preferences", json!({"holdShortcuts": on, "keyHoldDelay": 0.35}));
|
||||
let mut frame = |d: &mut Dialog, events: Vec<egui::Event>| {
|
||||
let raw = egui::RawInput {
|
||||
screen_rect: Some(egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(600.0, 2400.0))),
|
||||
events,
|
||||
..Default::default()
|
||||
};
|
||||
let mut out = ctx.run_ui(raw, |ui| category_fields(ui, &mut a, d, "General"));
|
||||
out.textures_delta.clear();
|
||||
let label = out.shapes.iter().find_map(|c| text(&c.shape, &|t| t.starts_with("Hold Shortcut Delay")));
|
||||
let field = out.shapes.iter().find_map(|c| text(&c.shape, &|t| t.starts_with("0.35")));
|
||||
(label, field)
|
||||
};
|
||||
let (label, field) = frame(&mut d, vec![]);
|
||||
assert!(label.is_some(), "no label (on {on})");
|
||||
let at = field.unwrap_or_else(|| panic!("no field (on {on})"));
|
||||
let press =
|
||||
|pressed| egui::Event::PointerButton { pos: at.center(), button: egui::PointerButton::Primary, pressed, modifiers: Default::default() };
|
||||
frame(&mut d, vec![egui::Event::PointerMoved(at.center()), press(true)]);
|
||||
frame(&mut d, vec![press(false)]);
|
||||
assert_eq!(ctx.memory(|m| m.focused().is_some()), on, "a click gives the field the keyboard only while Hold Shortcuts is on ({on})");
|
||||
}
|
||||
}
|
||||
|
||||
/// Type › Show samples on white: its checkbox is dimmed while Enable in-menu font previews is
|
||||
/// unchecked in the dialog, and a click on it then leaves the setting as it was.
|
||||
#[test]
|
||||
|
||||
@@ -1141,6 +1141,89 @@ pub fn reset_one(overrides: &mut Overrides, key: &str) {
|
||||
crate::keymap::remove_override(overrides, key);
|
||||
}
|
||||
|
||||
/// Hold shortcuts: entry key → chord text ([`UiState::shortcut_holds`]).
|
||||
pub type Holds = BTreeMap<String, String>;
|
||||
|
||||
/// The chord of hold shortcut text `text`, or why it can't be one. A hold shortcut is a key that
|
||||
/// types a character, alone or with Shift. Space and the backtick key are refused: the canvas reads
|
||||
/// them while they are held.
|
||||
pub fn hold_chord(text: &str) -> Result<craft_keymap::Chord, String> {
|
||||
let chord = vc_chord(text).ok_or_else(|| format!("can't parse shortcut `{text}`"))?;
|
||||
let shown = menus::pretty_shortcut(&vc_format(&chord));
|
||||
if chord.mods.cmd || chord.mods.ctrl || chord.mods.alt {
|
||||
return Err(format!("a hold shortcut is a key that types a character, alone or with Shift ({shown} has Cmd, Ctrl or Alt)"));
|
||||
}
|
||||
if chord.key == craft_keymap::Key::Backtick || !crate::shortcuts::types_text(chord.key) {
|
||||
return Err(format!("{shown} can't be a hold shortcut: use a letter, a digit or a punctuation key"));
|
||||
}
|
||||
Ok(chord)
|
||||
}
|
||||
|
||||
/// The hold shortcut of `key` in `holds`, in VectorCraft's chord spelling, when it is usable.
|
||||
pub fn hold_of(holds: &Holds, key: &str) -> Option<String> {
|
||||
holds.get(key).and_then(|t| hold_chord(t).ok()).map(|c| vc_format(&c))
|
||||
}
|
||||
|
||||
/// The entry whose usable hold shortcut is `chord`: the first in `holds`' order when several are.
|
||||
/// An entry no longer listed (a removed plug-in's) keeps its text but does not hold.
|
||||
pub(crate) fn hold_for<'a>(holds: &'a Holds, chord: &craft_keymap::Chord) -> Option<&'a str> {
|
||||
holds.iter().find(|(k, t)| hold_chord(t).is_ok_and(|c| c == *chord) && entry(k).is_some()).map(|(k, _)| k.as_str())
|
||||
}
|
||||
|
||||
/// Sets (`Some`) or removes (`None` or `""`) the hold shortcut of `key`. Another entry that holds
|
||||
/// the same key loses it when `force`; otherwise that is an error. Returns the entries that lost
|
||||
/// it. Nothing changes on an error.
|
||||
pub fn assign_hold(holds: &mut Holds, key: &str, text: Option<&str>, force: bool) -> Result<Vec<String>, String> {
|
||||
if entry(key).is_none() {
|
||||
return Err(format!("unknown tool or command `{key}`"));
|
||||
}
|
||||
let Some(text) = text.filter(|t| !t.is_empty()) else {
|
||||
holds.remove(key);
|
||||
return Ok(vec![]);
|
||||
};
|
||||
let chord = hold_chord(text)?;
|
||||
let taken: Vec<String> = holds.iter().filter(|(k, t)| *k != key && vc_chord(t) == Some(chord)).map(|(k, _)| k.clone()).collect();
|
||||
if !taken.is_empty() && !force {
|
||||
let names: Vec<String> = taken.iter().map(|k| entry(k).map_or(k.clone(), |e| english_name(&e))).collect();
|
||||
return Err(format!("Hold {} is already used by {}", menus::pretty_shortcut(&vc_format(&chord)), names.join(", ")));
|
||||
}
|
||||
for k in &taken {
|
||||
holds.remove(k);
|
||||
}
|
||||
holds.insert(key.to_string(), vc_format(&chord));
|
||||
Ok(taken)
|
||||
}
|
||||
|
||||
/// Hold shortcuts used by more than one entry: (chord text, entry keys).
|
||||
pub fn hold_conflicts(holds: &Holds) -> Vec<(String, Vec<String>)> {
|
||||
let mut by: BTreeMap<String, Vec<String>> = BTreeMap::new();
|
||||
for (k, t) in holds {
|
||||
if let Ok(c) = hold_chord(t) {
|
||||
by.entry(vc_format(&c)).or_default().push(k.clone());
|
||||
}
|
||||
}
|
||||
by.into_iter().filter(|(_, keys)| keys.len() > 1).collect()
|
||||
}
|
||||
|
||||
/// The hold shortcuts of an exported set's `holds` member: none when it is missing. Every value
|
||||
/// must be a usable hold shortcut; otherwise the error names the first entry that is not.
|
||||
pub fn import_holds(v: &Value) -> Result<Holds, String> {
|
||||
let Some(h) = v.get("holds") else { return Ok(Holds::new()) };
|
||||
let h = h.as_object().ok_or("`holds` must be an object")?;
|
||||
let mut out = Holds::new();
|
||||
for (k, v) in h {
|
||||
let s = v.as_str().ok_or_else(|| format!("hold shortcut for `{k}` must be a string"))?;
|
||||
let c = hold_chord(s).map_err(|e| format!("hold shortcut for `{k}`: {e}"))?;
|
||||
out.insert(k.clone(), vc_format(&c));
|
||||
}
|
||||
Ok(out)
|
||||
}
|
||||
|
||||
/// The hold shortcuts of the Keyboard Shortcuts dialog's working set.
|
||||
fn dialog_holds(d: &Dialog) -> Holds {
|
||||
d.fields.get("holds").and_then(|v| serde_json::from_value(v.clone()).ok()).unwrap_or_default()
|
||||
}
|
||||
|
||||
/// Text shown for all active chords in a dialog row, with the backtick key shown as `typed`
|
||||
/// ([`backtick_text`]).
|
||||
fn dialog_shortcuts_with(km: &Keymap, key: &str, typed: Option<&str>) -> Option<String> {
|
||||
@@ -1161,7 +1244,17 @@ pub fn preset(name: &str) -> Option<Overrides> {
|
||||
|
||||
/// Export format: `{"format": "vectorcraft-shortcuts", "set": name, "overrides": {...}}`.
|
||||
pub fn export_json(set: &str, overrides: &Overrides) -> Value {
|
||||
json!({"format": "vectorcraft-shortcuts", "version": 1, "set": set, "overrides": stored::to_value(overrides)})
|
||||
export_json_with(set, overrides, &Holds::new())
|
||||
}
|
||||
|
||||
/// [`export_json`] with the set's hold shortcuts, written as `holds` when there are any. The
|
||||
/// version stays 1: earlier versions read `overrides` only, so they import the file without them.
|
||||
pub fn export_json_with(set: &str, overrides: &Overrides, holds: &Holds) -> Value {
|
||||
let mut v = json!({"format": "vectorcraft-shortcuts", "version": 1, "set": set, "overrides": stored::to_value(overrides)});
|
||||
if !holds.is_empty() {
|
||||
v["holds"] = json!(holds);
|
||||
}
|
||||
v
|
||||
}
|
||||
|
||||
pub fn import_json(v: &Value) -> Result<(String, Overrides), String> {
|
||||
@@ -1181,6 +1274,11 @@ pub fn import_json(v: &Value) -> Result<(String, Overrides), String> {
|
||||
/// row per line with the name and the shortcuts as the dialog shows them, separated by a tab. A
|
||||
/// row with no shortcut ends after the tab.
|
||||
pub fn export_text(set: &str, overrides: &Overrides) -> String {
|
||||
export_text_with(set, overrides, &Holds::new())
|
||||
}
|
||||
|
||||
/// [`export_text`] with the set's hold shortcuts: a row with one gets a third column, `Hold X`.
|
||||
pub fn export_text_with(set: &str, overrides: &Overrides, holds: &Holds) -> String {
|
||||
let snapshot = snapshot();
|
||||
let km = crate::keymap::keymap_in(&snapshot, overrides);
|
||||
let backtick = backtick_text();
|
||||
@@ -1191,7 +1289,10 @@ pub fn export_text(set: &str, overrides: &Overrides) -> String {
|
||||
for e in snapshot.entries.iter().filter(|e| e.is_tool == tools && listed(km.overrides(), e)) {
|
||||
let name = shown_name(e);
|
||||
let sc = dialog_shortcuts_with(&km, &e.key, backtick.as_deref()).unwrap_or_default();
|
||||
out += &format!("{name}\t{sc}\n");
|
||||
match hold_of(holds, &e.key) {
|
||||
Some(h) => out += &format!("{name}\t{sc}\t{} {}\n", tl!("Hold"), menus::pretty_shortcut(&h)),
|
||||
None => out += &format!("{name}\t{sc}\n"),
|
||||
}
|
||||
}
|
||||
}
|
||||
out
|
||||
@@ -1203,10 +1304,35 @@ pub fn open(app: &mut VectorcraftApp) {
|
||||
let ov = stored::to_value(&app.ui.shortcut_overrides);
|
||||
app.ui.dialog = Some(Dialog::new(
|
||||
"shortcuts",
|
||||
json!({"tab": "tools", "query": "", "set": app.ui.shortcut_set, "overrides": ov, "__recording": "", "__selected": "", "__message": "", "__conflict": ""}),
|
||||
json!({
|
||||
"tab": "tools",
|
||||
"query": "",
|
||||
"set": app.ui.shortcut_set,
|
||||
"overrides": ov,
|
||||
"holds": app.ui.shortcut_holds,
|
||||
"holdShortcuts": app.session.prefs.hold_shortcuts,
|
||||
"keyHoldDelay": app.session.prefs.key_hold_delay(),
|
||||
"__holdInfo": false,
|
||||
"__recording": "",
|
||||
"__recordingHold": false,
|
||||
"__selected": "",
|
||||
"__message": "",
|
||||
"__conflict": ""
|
||||
}),
|
||||
));
|
||||
}
|
||||
|
||||
/// Hold Shortcuts in the Keyboard Shortcuts dialog's working copy.
|
||||
fn dialog_holds_on(d: &Dialog) -> bool {
|
||||
d.bool("holdShortcuts")
|
||||
}
|
||||
|
||||
/// The Hold Shortcut Delay in the Keyboard Shortcuts dialog's working copy, in its range.
|
||||
fn dialog_hold_delay(d: &Dialog) -> f64 {
|
||||
let (min, max) = vectorcraft_engine::KEY_HOLD_DELAY_RANGE;
|
||||
d.fields.get("keyHoldDelay").and_then(Value::as_f64).filter(|x| x.is_finite()).map_or(vectorcraft_engine::KEY_HOLD_DELAY, |x| x.clamp(min, max))
|
||||
}
|
||||
|
||||
fn dialog_overrides(d: &Dialog) -> Overrides {
|
||||
d.fields.get("overrides").map(|v| stored::from_value(v.clone())).unwrap_or_default()
|
||||
}
|
||||
@@ -1214,7 +1340,13 @@ fn dialog_overrides(d: &Dialog) -> Overrides {
|
||||
/// OK: commit the working set.
|
||||
pub fn confirm(app: &mut VectorcraftApp) -> Result<Value, String> {
|
||||
let Some(d) = app.ui.dialog.clone() else { return Err("no dialog open".into()) };
|
||||
let (on, delay) = (dialog_holds_on(&d), dialog_hold_delay(&d));
|
||||
let prefs = &app.session.prefs;
|
||||
if d.kind == "shortcuts" && (on != prefs.hold_shortcuts || delay != prefs.key_hold_delay()) {
|
||||
app.run("prefs.set", json!({"values": {"holdShortcuts": on, "keyHoldDelay": delay}})).map_err(|e| e.to_string())?;
|
||||
}
|
||||
app.ui.shortcut_overrides = dialog_overrides(&d);
|
||||
app.ui.shortcut_holds = dialog_holds(&d);
|
||||
app.ui.shortcut_set = d.str("set");
|
||||
app.ui.dialog = None;
|
||||
sync(&app.ui);
|
||||
@@ -1244,18 +1376,45 @@ pub fn run_command(app: &mut VectorcraftApp, id: &str, p: &Value) -> Option<Resu
|
||||
(Ok(key), Ok(shortcut), Ok(force)) => (key.unwrap_or_default(), shortcut, force.unwrap_or(false)),
|
||||
(Err(e), _, _) | (_, Err(e), _) | (_, _, Err(e)) => return Some(Err(e)),
|
||||
};
|
||||
let hold = match s("hold") {
|
||||
Ok(hold) => hold,
|
||||
Err(e) => return Some(Err(e)),
|
||||
};
|
||||
// Without `hold`, a missing `shortcut` removes the shortcut, as it always has; with
|
||||
// `hold` alone, the shortcut is left as it is. Both are checked before either is kept.
|
||||
let has_hold = p.get("hold").is_some();
|
||||
let has_shortcut = p.get("shortcut").is_some() || !has_hold;
|
||||
let mut ov = app.ui.shortcut_overrides.clone();
|
||||
let r = if p.get("shortcut").is_some_and(Value::is_null) {
|
||||
let mut holds = app.ui.shortcut_holds.clone();
|
||||
let r = if !has_shortcut {
|
||||
Ok(vec![])
|
||||
} else if p.get("shortcut").is_some_and(Value::is_null) {
|
||||
reset_one(&mut ov, &key);
|
||||
Ok(vec![])
|
||||
} else {
|
||||
assign(&mut ov, &key, shortcut.as_deref(), force)
|
||||
};
|
||||
let r = r.and_then(|mut removed| {
|
||||
if has_hold {
|
||||
for k in assign_hold(&mut holds, &key, hold.as_deref(), force)? {
|
||||
if !removed.contains(&k) {
|
||||
removed.push(k);
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(removed)
|
||||
});
|
||||
r.map(|removed| {
|
||||
app.ui.shortcut_overrides = ov;
|
||||
app.ui.shortcut_holds = holds;
|
||||
app.ui.shortcut_set = CUSTOM.into();
|
||||
sync(&app.ui);
|
||||
json!({"id": key, "shortcut": effective_in(&app.ui.shortcut_overrides, &key), "removedFrom": removed})
|
||||
json!({
|
||||
"id": key,
|
||||
"shortcut": effective_in(&app.ui.shortcut_overrides, &key),
|
||||
"hold": hold_of(&app.ui.shortcut_holds, &key),
|
||||
"removedFrom": removed
|
||||
})
|
||||
})
|
||||
}
|
||||
"shortcuts.list" => {
|
||||
@@ -1272,15 +1431,19 @@ pub fn run_command(app: &mut VectorcraftApp, id: &str, p: &Value) -> Option<Resu
|
||||
.iter()
|
||||
.filter(|e| listed(ov, e))
|
||||
.filter(|e| q.is_empty() || e.label.to_lowercase().contains(&q) || e.key.to_lowercase().contains(&q))
|
||||
.map(|e| json!({"id": e.key, "label": e.label, "group": e.group, "shortcut": effective_with(&km, &e.key), "default": default_of(&e.key), "overridden": crate::keymap::has_override(ov, &e.key)}))
|
||||
.map(|e| json!({"id": e.key, "label": e.label, "group": e.group, "shortcut": effective_with(&km, &e.key), "hold": hold_of(&app.ui.shortcut_holds, &e.key), "default": default_of(&e.key), "overridden": crate::keymap::has_override(ov, &e.key)}))
|
||||
.collect(),
|
||||
))
|
||||
}
|
||||
"shortcuts.conflicts" => {
|
||||
Ok(json!(all_conflicts(&app.ui.shortcut_overrides).into_iter().map(|(c, k)| json!({"shortcut": c, "ids": k})).collect::<Vec<_>>()))
|
||||
let holds = hold_conflicts(&app.ui.shortcut_holds).into_iter().map(|(c, k)| (format!("Hold {c}"), k));
|
||||
Ok(json!(
|
||||
all_conflicts(&app.ui.shortcut_overrides).into_iter().chain(holds).map(|(c, k)| json!({"shortcut": c, "ids": k})).collect::<Vec<_>>()
|
||||
))
|
||||
}
|
||||
"shortcuts.reset" => {
|
||||
app.ui.shortcut_overrides.clear();
|
||||
app.ui.shortcut_holds.clear();
|
||||
app.ui.shortcut_set = PRESETS[0].into();
|
||||
sync(&app.ui);
|
||||
Ok(Value::Null)
|
||||
@@ -1288,6 +1451,8 @@ pub fn run_command(app: &mut VectorcraftApp, id: &str, p: &Value) -> Option<Resu
|
||||
"shortcuts.preset" => match s("name").map(|n| n.as_deref().map(set_name).and_then(|n| preset(n).map(|p| (n.to_string(), p)))) {
|
||||
Ok(Some((n, p))) => {
|
||||
app.ui.shortcut_overrides = p;
|
||||
// The presets have no hold shortcuts.
|
||||
app.ui.shortcut_holds.clear();
|
||||
app.ui.shortcut_set = n;
|
||||
sync(&app.ui);
|
||||
Ok(Value::Null)
|
||||
@@ -1300,7 +1465,7 @@ pub fn run_command(app: &mut VectorcraftApp, id: &str, p: &Value) -> Option<Resu
|
||||
Ok(path) => path,
|
||||
Err(e) => return Some(Err(e)),
|
||||
};
|
||||
let v = export_json(&app.ui.shortcut_set, &app.ui.shortcut_overrides);
|
||||
let v = export_json_with(&app.ui.shortcut_set, &app.ui.shortcut_overrides, &app.ui.shortcut_holds);
|
||||
let bytes = serde_json::to_vec_pretty(&v).unwrap_or_default();
|
||||
let pick = crate::FilePick {
|
||||
filters: vec![crate::FilePick::filter("Shortcut sets", &["json"])],
|
||||
@@ -1329,7 +1494,9 @@ pub fn run_command(app: &mut VectorcraftApp, id: &str, p: &Value) -> Option<Resu
|
||||
return Some(Err(format!("`{key}` must be a string")));
|
||||
}
|
||||
};
|
||||
let text = export_text(&app.ui.shortcut_set, &app.ui.shortcut_overrides);
|
||||
// The hold shortcuts are listed while they act.
|
||||
let holds = if app.session.prefs.hold_shortcuts { app.ui.shortcut_holds.clone() } else { Holds::new() };
|
||||
let text = export_text_with(&app.ui.shortcut_set, &app.ui.shortcut_overrides, &holds);
|
||||
let pick =
|
||||
crate::FilePick { filters: vec![crate::FilePick::filter("Text", &["txt"])], ..crate::FilePick::named("VectorCraft Shortcuts.txt") };
|
||||
match path.or_else(|| crate::picks::save(app, &pick)) {
|
||||
@@ -1374,13 +1541,15 @@ pub fn run_command(app: &mut VectorcraftApp, id: &str, p: &Value) -> Option<Resu
|
||||
(_, None) => Err("no file reader".into()),
|
||||
}
|
||||
};
|
||||
data.and_then(|v| import_json(&v)).map(|(set, ov)| {
|
||||
data.and_then(|v| Ok((import_json(&v)?, import_holds(&v)?))).map(|((set, ov), holds)| {
|
||||
let n = ov.len();
|
||||
app.ui.shortcut_overrides = ov;
|
||||
app.ui.shortcut_holds = holds;
|
||||
app.ui.shortcut_set = set;
|
||||
sync(&app.ui);
|
||||
if let Some(d) = app.ui.dialog.as_mut().filter(|d| d.kind == "shortcuts") {
|
||||
d.fields.insert("overrides".into(), stored::to_value(&app.ui.shortcut_overrides));
|
||||
d.fields.insert("holds".into(), json!(app.ui.shortcut_holds));
|
||||
d.fields.insert("set".into(), json!(app.ui.shortcut_set));
|
||||
}
|
||||
json!({"overrides": n})
|
||||
@@ -1466,7 +1635,10 @@ pub fn show(app: &mut VectorcraftApp, ctx: &egui::Context) {
|
||||
let mut cancel = false;
|
||||
drop_hidden(&mut d, km.overrides());
|
||||
let saved = dialog_overrides(&d);
|
||||
let mut holds = dialog_holds(&d);
|
||||
let recording = d.str("__recording");
|
||||
// Which column records: the Hold column, or the Shortcut column.
|
||||
let recording_hold = !recording.is_empty() && d.bool("__recordingHold");
|
||||
// Record a chord (before widgets see the keys). Modifiers held down are part of the next key's
|
||||
// chord, not a chord of their own.
|
||||
if !recording.is_empty() {
|
||||
@@ -1481,7 +1653,11 @@ pub fn show(app: &mut VectorcraftApp, ctx: &egui::Context) {
|
||||
if key == Key::Escape {
|
||||
d.fields.insert("__recording".into(), json!(""));
|
||||
} else if let Some(chord) = chord_from_event(key, m) {
|
||||
record(&mut d, km.to_mut(), &recording, &chord);
|
||||
if recording_hold {
|
||||
record_hold(&mut d, &mut holds, &recording, &chord);
|
||||
} else {
|
||||
record(&mut d, km.to_mut(), &recording, &chord);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1503,6 +1679,8 @@ pub fn show(app: &mut VectorcraftApp, ctx: &egui::Context) {
|
||||
&& let Some(p) = preset(name)
|
||||
{
|
||||
km.to_mut().set_overrides(p);
|
||||
// The presets have no hold shortcuts.
|
||||
holds.clear();
|
||||
d.fields.insert("set".into(), json!(name));
|
||||
d.fields.insert("__message".into(), json!(""));
|
||||
}
|
||||
@@ -1518,10 +1696,13 @@ pub fn show(app: &mut VectorcraftApp, ctx: &egui::Context) {
|
||||
}
|
||||
if ui.button(tl!("Reset to Defaults")).clicked() {
|
||||
km.to_mut().reset_all();
|
||||
holds.clear();
|
||||
d.fields.insert("set".into(), json!(PRESETS[0]));
|
||||
d.fields.insert("__message".into(), json!(tl!("All shortcuts reset to defaults.")));
|
||||
}
|
||||
});
|
||||
ui.add_space(6.0);
|
||||
hold_row(ui, &t, &mut d);
|
||||
ui.add_space(8.0);
|
||||
// Tabs + search.
|
||||
ui.horizontal(|ui| {
|
||||
@@ -1544,14 +1725,25 @@ pub fn show(app: &mut VectorcraftApp, ctx: &egui::Context) {
|
||||
let q = d.str("query").to_lowercase();
|
||||
let selected = d.str("__selected");
|
||||
let rec = d.str("__recording");
|
||||
let rec_hold = d.bool("__recordingHold");
|
||||
let holds_on = dialog_holds_on(&d);
|
||||
let scroll_to = d.fields.remove("__scrollTo").and_then(|v| v.as_str().map(str::to_string));
|
||||
egui::Frame::NONE.fill(t.input).stroke(egui::Stroke::new(1.0, t.input_border)).inner_margin(egui::Margin::same(4)).show(ui, |ui| {
|
||||
ui.horizontal(|ui| {
|
||||
ui.allocate_ui_with_layout(egui::vec2(360.0, 16.0), egui::Layout::left_to_right(egui::Align::Center), |ui| {
|
||||
ui.set_min_width(360.0);
|
||||
let name_width = if holds_on { 340.0 } else { 360.0 };
|
||||
ui.allocate_ui_with_layout(egui::vec2(name_width, 16.0), egui::Layout::left_to_right(egui::Align::Center), |ui| {
|
||||
ui.set_min_width(name_width);
|
||||
ui.label(egui::RichText::new(if tools { tl!("Tool") } else { tl!("Command") }).color(t.text_dim).size(11.0));
|
||||
});
|
||||
ui.label(egui::RichText::new(tl!("Shortcut")).color(t.text_dim).size(11.0));
|
||||
if holds_on {
|
||||
ui.allocate_ui_with_layout(egui::vec2(150.0, 16.0), egui::Layout::left_to_right(egui::Align::Center), |ui| {
|
||||
ui.set_min_width(150.0);
|
||||
ui.label(egui::RichText::new(tl!("Shortcut")).color(t.text_dim).size(11.0));
|
||||
});
|
||||
ui.label(egui::RichText::new(tl!("Hold")).color(t.text_dim).size(11.0));
|
||||
} else {
|
||||
ui.label(egui::RichText::new(tl!("Shortcut")).color(t.text_dim).size(11.0));
|
||||
}
|
||||
});
|
||||
egui::ScrollArea::vertical().max_height(360.0).auto_shrink([false, false]).show(ui, |ui| {
|
||||
for (i, e) in view.entries.iter().enumerate().filter(|(_, e)| e.is_tool == tools && listed(km.overrides(), e)) {
|
||||
@@ -1564,23 +1756,44 @@ pub fn show(app: &mut VectorcraftApp, ctx: &egui::Context) {
|
||||
}
|
||||
let row = ui.horizontal(|ui| {
|
||||
let name = shown_name(e);
|
||||
let name_width = if holds_on { 340.0 } else { 360.0 };
|
||||
let r = ui
|
||||
.allocate_ui_with_layout(egui::vec2(360.0, 20.0), egui::Layout::left_to_right(egui::Align::Center), |ui| {
|
||||
ui.set_min_width(360.0);
|
||||
.allocate_ui_with_layout(egui::vec2(name_width, 20.0), egui::Layout::left_to_right(egui::Align::Center), |ui| {
|
||||
ui.set_min_width(name_width);
|
||||
ui.add(egui::Button::selectable(selected == e.key, egui::RichText::new(name).color(t.text)).truncate())
|
||||
})
|
||||
.inner;
|
||||
if r.clicked() {
|
||||
d.fields.insert("__selected".into(), json!(e.key));
|
||||
}
|
||||
let label = if rec == e.key { tl!("Press keys…").to_string() } else { sc.unwrap_or_else(|| "—".into()) };
|
||||
let recording_here = rec == e.key && !rec_hold;
|
||||
let label = if recording_here { tl!("Press keys…").to_string() } else { sc.unwrap_or_else(|| "—".into()) };
|
||||
let changed = crate::keymap::has_override(&saved, &e.key);
|
||||
let txt = egui::RichText::new(label).color(if changed { t.accent } else { t.text });
|
||||
let b = ui
|
||||
.add_sized([150.0, 20.0], egui::Button::new(txt).selected(rec == e.key))
|
||||
.add_sized([150.0, 20.0], egui::Button::new(txt).selected(recording_here))
|
||||
.on_hover_text(tl!("Click, then press the new shortcut (Esc cancels)"));
|
||||
if b.clicked() {
|
||||
d.fields.insert("__recording".into(), json!(e.key));
|
||||
d.fields.insert("__recordingHold".into(), json!(false));
|
||||
d.fields.insert("__selected".into(), json!(e.key));
|
||||
}
|
||||
if !holds_on {
|
||||
return;
|
||||
}
|
||||
let holding_here = rec == e.key && rec_hold;
|
||||
let hold = hold_of(&holds, &e.key);
|
||||
let label = if holding_here {
|
||||
tl!("Press keys…").to_string()
|
||||
} else {
|
||||
hold.as_deref().map_or_else(|| "—".into(), menus::pretty_shortcut)
|
||||
};
|
||||
let h = ui.add_sized([90.0, 20.0], egui::Button::new(egui::RichText::new(label).color(t.text)).selected(holding_here)).on_hover_text(
|
||||
tl!("Click, then press a key to hold for this (Esc cancels). Holding the key runs this; a quick press runs the key's own shortcut."),
|
||||
);
|
||||
if h.clicked() {
|
||||
d.fields.insert("__recording".into(), json!(e.key));
|
||||
d.fields.insert("__recordingHold".into(), json!(true));
|
||||
d.fields.insert("__selected".into(), json!(e.key));
|
||||
}
|
||||
});
|
||||
@@ -1604,6 +1817,10 @@ pub fn show(app: &mut VectorcraftApp, ctx: &egui::Context) {
|
||||
if ui.button(tl!("Use Default")).clicked() {
|
||||
km.to_mut().reset(&command_of(&sel));
|
||||
}
|
||||
if dialog_holds_on(&d) && ui.add_enabled(holds.contains_key(&sel), egui::Button::new(tl!("Clear Hold"))).clicked() {
|
||||
holds.remove(&sel);
|
||||
d.fields.insert("set".into(), json!(CUSTOM));
|
||||
}
|
||||
});
|
||||
let conflict = d.str("__conflict");
|
||||
if !conflict.is_empty() && ui.button(tl!("Go to Conflict")).clicked() {
|
||||
@@ -1622,7 +1839,7 @@ pub fn show(app: &mut VectorcraftApp, ctx: &egui::Context) {
|
||||
let n = match &km {
|
||||
Cow::Borrowed(_) => view.conflicts,
|
||||
Cow::Owned(km) => conflicts_in(km).len(),
|
||||
};
|
||||
} + if dialog_holds_on(&d) { hold_conflicts(&holds).len() } else { 0 };
|
||||
if n > 0 {
|
||||
ui.label(
|
||||
egui::RichText::new(crate::i18n::tn(
|
||||
@@ -1648,6 +1865,10 @@ pub fn show(app: &mut VectorcraftApp, ctx: &egui::Context) {
|
||||
if let Cow::Owned(km) = &km {
|
||||
d.fields.insert("overrides".into(), stored::to_value(&saved_overrides(km.overrides(), &saved)));
|
||||
}
|
||||
d.fields.insert("holds".into(), json!(holds));
|
||||
if d.str("__recording").is_empty() {
|
||||
d.fields.insert("__recordingHold".into(), json!(false));
|
||||
}
|
||||
let import = d.fields.remove("__import").is_some();
|
||||
let export = d.fields.remove("__export").is_some();
|
||||
let export_text = d.fields.remove("__exportText").is_some();
|
||||
@@ -1682,14 +1903,15 @@ fn import_into_dialog(app: &mut VectorcraftApp) {
|
||||
app.status(crate::picks::dialog_gone());
|
||||
return;
|
||||
}
|
||||
let saved = (app.ui.shortcut_overrides.clone(), app.ui.shortcut_set.clone());
|
||||
let saved = (app.ui.shortcut_overrides.clone(), app.ui.shortcut_holds.clone(), app.ui.shortcut_set.clone());
|
||||
match run_command(app, "shortcuts.import", &json!({})) {
|
||||
Some(Ok(_)) => {
|
||||
let (o, s) = (app.ui.shortcut_overrides.clone(), app.ui.shortcut_set.clone());
|
||||
(app.ui.shortcut_overrides, app.ui.shortcut_set) = saved;
|
||||
let (o, h, s) = (app.ui.shortcut_overrides.clone(), app.ui.shortcut_holds.clone(), app.ui.shortcut_set.clone());
|
||||
(app.ui.shortcut_overrides, app.ui.shortcut_holds, app.ui.shortcut_set) = saved;
|
||||
sync(&app.ui);
|
||||
if let Some(d) = app.ui.dialog.as_mut().filter(|d| d.kind == "shortcuts") {
|
||||
d.fields.insert("overrides".into(), stored::to_value(&o));
|
||||
d.fields.insert("holds".into(), json!(h));
|
||||
d.fields.insert("set".into(), json!(s));
|
||||
d.fields.insert("__message".into(), json!(tl!("Imported. Press OK to keep the imported set.")));
|
||||
}
|
||||
@@ -1715,13 +1937,19 @@ fn export_dialog_set(app: &mut VectorcraftApp, command: &str) {
|
||||
app.status(crate::picks::dialog_gone());
|
||||
return;
|
||||
}
|
||||
let (ov, set) = app.ui.dialog.as_ref().map(|d| (dialog_overrides(d), d.str("set"))).unwrap_or_default();
|
||||
let (ov, holds, set, on) =
|
||||
app.ui.dialog.as_ref().map(|d| (dialog_overrides(d), dialog_holds(d), d.str("set"), dialog_holds_on(d))).unwrap_or_default();
|
||||
let saved = std::mem::replace(&mut app.ui.shortcut_overrides, ov);
|
||||
let saved_holds = std::mem::replace(&mut app.ui.shortcut_holds, holds);
|
||||
let saved_set = std::mem::replace(&mut app.ui.shortcut_set, set);
|
||||
// Export Text… lists the hold shortcuts while the dialog's Hold Shortcuts is on.
|
||||
let saved_on = std::mem::replace(&mut app.session.prefs.hold_shortcuts, on);
|
||||
if let Some(Err(e)) = run_command(app, command, &json!({})) {
|
||||
app.status(e);
|
||||
}
|
||||
app.session.prefs.hold_shortcuts = saved_on;
|
||||
app.ui.shortcut_overrides = saved;
|
||||
app.ui.shortcut_holds = saved_holds;
|
||||
app.ui.shortcut_set = saved_set;
|
||||
}
|
||||
|
||||
@@ -1779,6 +2007,107 @@ fn record(d: &mut Dialog, km: &mut Keymap, key: &str, chord: &str) {
|
||||
}
|
||||
}
|
||||
|
||||
/// The Hold Shortcuts row of the Keyboard Shortcuts dialog: the checkbox that turns hold shortcuts
|
||||
/// on (and shows the Hold column), a button that shows how they work, and, while on, the Hold
|
||||
/// Shortcut Delay.
|
||||
fn hold_row(ui: &mut egui::Ui, t: &Tokens, d: &mut Dialog) {
|
||||
ui.horizontal(|ui| {
|
||||
let mut on = dialog_holds_on(d);
|
||||
if ui.checkbox(&mut on, egui::RichText::new(tl!("Hold Shortcuts")).color(t.text)).changed() {
|
||||
d.fields.insert("holdShortcuts".into(), json!(on));
|
||||
if !on && d.bool("__recordingHold") {
|
||||
d.fields.insert("__recording".into(), json!(""));
|
||||
d.fields.insert("__recordingHold".into(), json!(false));
|
||||
}
|
||||
}
|
||||
let info = d.bool("__holdInfo");
|
||||
if ui
|
||||
.add(egui::Button::new(egui::RichText::new("?").color(t.text_dim)).selected(info).small())
|
||||
.on_hover_text(tl!("How hold shortcuts work"))
|
||||
.clicked()
|
||||
{
|
||||
d.fields.insert("__holdInfo".into(), json!(!info));
|
||||
}
|
||||
if on {
|
||||
ui.add_space(12.0);
|
||||
ui.label(egui::RichText::new(tl!("Hold Shortcut Delay")).color(t.text_dim));
|
||||
let (min, max) = vectorcraft_engine::KEY_HOLD_DELAY_RANGE;
|
||||
let mut delay = dialog_hold_delay(d);
|
||||
if ui.add(egui::DragValue::new(&mut delay).range(min..=max).speed(0.01).fixed_decimals(2).suffix(" s")).changed() {
|
||||
d.fields.insert("keyHoldDelay".into(), json!(delay));
|
||||
}
|
||||
}
|
||||
});
|
||||
if d.bool("__holdInfo") {
|
||||
egui::Frame::NONE.stroke(egui::Stroke::new(1.0, t.input_border)).inner_margin(egui::Margin::same(8)).show(ui, |ui| {
|
||||
ui.horizontal(|ui| {
|
||||
hold_illustration(ui, t);
|
||||
ui.add_space(8.0);
|
||||
ui.add(
|
||||
egui::Label::new(
|
||||
egui::RichText::new(tl!(
|
||||
"A quick press of a key runs its shortcut. Holding the key for the delay runs the tool or command in its Hold column instead. A hold shortcut is a letter, digit or punctuation key, alone or with Shift."
|
||||
))
|
||||
.color(t.text)
|
||||
.size(11.5),
|
||||
)
|
||||
.wrap(),
|
||||
);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// A key and two presses of it drawn in code: a short press (Tap) ends before the delay, and a long
|
||||
/// one (Hold) reaches it.
|
||||
fn hold_illustration(ui: &mut egui::Ui, t: &Tokens) {
|
||||
let (rect, _) = ui.allocate_exact_size(egui::vec2(200.0, 52.0), egui::Sense::hover());
|
||||
let p = ui.painter_at(rect);
|
||||
let key = egui::Rect::from_min_size(rect.min + egui::vec2(2.0, 12.0), egui::vec2(28.0, 28.0));
|
||||
p.rect(key, 4.0, t.input, egui::Stroke::new(1.0, t.input_border), egui::StrokeKind::Inside);
|
||||
p.text(key.center(), egui::Align2::CENTER_CENTER, "X", egui::FontId::proportional(13.0), t.text);
|
||||
let start = key.right() + 10.0;
|
||||
let delay_x = start + 70.0;
|
||||
let rows = [(tl!("Tap"), 40.0, key.top() + 6.0), (tl!("Hold"), 100.0, key.bottom() - 6.0)];
|
||||
for (label, len, y) in rows {
|
||||
let color = if start + len >= delay_x { t.accent } else { t.text_dim };
|
||||
p.line_segment([egui::pos2(start, y), egui::pos2(start + len, y)], egui::Stroke::new(4.0, color));
|
||||
p.text(egui::pos2(start + len + 4.0, y), egui::Align2::LEFT_CENTER, label, egui::FontId::proportional(10.5), t.text);
|
||||
}
|
||||
// The delay.
|
||||
let mut y = rect.top() + 4.0;
|
||||
while y < rect.bottom() - 4.0 {
|
||||
p.line_segment([egui::pos2(delay_x, y), egui::pos2(delay_x, (y + 3.0).min(rect.bottom() - 4.0))], egui::Stroke::new(1.0, t.text_dim));
|
||||
y += 6.0;
|
||||
}
|
||||
}
|
||||
|
||||
/// Apply a recorded key as `key`'s hold shortcut in the working set. Another entry that held the
|
||||
/// key loses it, with the same warning as a shortcut; a key that can't hold says why.
|
||||
fn record_hold(d: &mut Dialog, holds: &mut Holds, key: &str, chord: &str) {
|
||||
d.fields.insert("__recording".into(), json!(""));
|
||||
d.fields.insert("__recordingHold".into(), json!(false));
|
||||
match assign_hold(holds, key, Some(chord), true) {
|
||||
Ok(removed) => {
|
||||
d.fields.insert("set".into(), json!(CUSTOM));
|
||||
let names: Vec<String> = removed.iter().map(|k| entry(k).map(|e| shown_name(&e)).unwrap_or(k.clone())).collect();
|
||||
let message = if names.is_empty() {
|
||||
String::new()
|
||||
} else {
|
||||
crate::i18n::fmt(
|
||||
tl!("⚠ {chord} was already used by {names} — it has been removed there."),
|
||||
&[("chord", &menus::pretty_shortcut(chord)), ("names", &names.join(", "))],
|
||||
)
|
||||
};
|
||||
d.fields.insert("__message".into(), json!(message));
|
||||
d.fields.insert("__conflict".into(), json!(""));
|
||||
}
|
||||
Err(e) => {
|
||||
d.fields.insert("__message".into(), json!(e));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
@@ -2839,4 +3168,168 @@ mod tests {
|
||||
assert_eq!(r["shortcut"], "Cmd+Alt+Shift+F11");
|
||||
assert!(app.run("shortcuts.preset", json!({"name": null})).unwrap_err().starts_with("unknown preset"));
|
||||
}
|
||||
|
||||
/// `shortcuts.set {hold}` gives an entry a hold shortcut and leaves its shortcut, its default
|
||||
/// and its overridden state alone; `shortcuts.list` shows it; Clear (`shortcut: null`) keeps it.
|
||||
#[test]
|
||||
fn a_hold_shortcut_is_kept_apart_from_the_shortcut() {
|
||||
let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default());
|
||||
let before = effective_in(&app.ui.shortcut_overrides, "paint.swap");
|
||||
let r = app.run("shortcuts.set", json!({"id": "paint.swap", "hold": "x"})).unwrap();
|
||||
assert_eq!((r["hold"].as_str(), r["shortcut"].as_str().map(str::to_string)), (Some("X"), before.clone()));
|
||||
assert!(app.ui.shortcut_overrides.is_empty(), "no shortcut changed");
|
||||
assert_eq!(app.ui.shortcut_set, CUSTOM);
|
||||
let rows = with_steady_plugins(|| app.run("shortcuts.list", json!({"query": "paint.swap"})).unwrap());
|
||||
let row = rows.as_array().unwrap().iter().find(|r| r["id"] == "paint.swap").unwrap().clone();
|
||||
assert_eq!((row["hold"].as_str(), row["overridden"].as_bool()), (Some("X"), Some(false)));
|
||||
app.run("shortcuts.set", json!({"id": "paint.swap", "shortcut": null})).unwrap();
|
||||
assert_eq!(hold_of(&app.ui.shortcut_holds, "paint.swap").as_deref(), Some("X"), "Use Default keeps the hold");
|
||||
app.run("shortcuts.set", json!({"id": "paint.swap", "shortcut": "Cmd+Alt+Shift+F9"})).unwrap();
|
||||
assert_eq!(hold_of(&app.ui.shortcut_holds, "paint.swap").as_deref(), Some("X"), "a new shortcut keeps the hold");
|
||||
app.run("shortcuts.set", json!({"id": "paint.swap", "hold": ""})).unwrap();
|
||||
assert!(app.ui.shortcut_holds.is_empty(), "an empty hold removes it");
|
||||
app.run("shortcuts.set", json!({"id": "paint.swap", "hold": "Shift+1"})).unwrap();
|
||||
app.run("shortcuts.set", json!({"id": "paint.swap", "hold": null})).unwrap();
|
||||
assert!(app.ui.shortcut_holds.is_empty(), "a null hold removes it");
|
||||
}
|
||||
|
||||
/// A hold shortcut is a key that types a character, alone or with Shift; other keys, a clash
|
||||
/// without `force` and a hold that is not a string are refused and change nothing.
|
||||
#[test]
|
||||
fn hold_shortcuts_refuse_keys_that_cannot_wait() {
|
||||
let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default());
|
||||
for bad in ["Space", "Shift+Space", "~", "Shift+~", "Cmd+X", "Alt+X", "Ctrl+X", "Left", "F5", "Enter", "Delete"] {
|
||||
let r = app.run("shortcuts.set", json!({"id": "paint.swap", "hold": bad}));
|
||||
assert!(r.is_err(), "{bad}: {r:?}");
|
||||
}
|
||||
assert_eq!(app.run("shortcuts.set", json!({"id": "paint.swap", "hold": 5})), Err("`hold` must be a string".to_string()));
|
||||
assert!(app.ui.shortcut_holds.is_empty());
|
||||
app.run("shortcuts.set", json!({"id": "paint.swap", "hold": "Shift+X"})).unwrap();
|
||||
let clash = app.run("shortcuts.set", json!({"id": "select.none", "hold": "Shift+X"})).unwrap_err();
|
||||
assert!(clash.starts_with("Hold "), "{clash}");
|
||||
// A refused hold leaves the shortcut given with it unchanged too.
|
||||
let r = app.run("shortcuts.set", json!({"id": "select.none", "shortcut": "Cmd+Alt+Shift+F9", "hold": "Shift+X"}));
|
||||
assert!(r.is_err());
|
||||
assert!(app.ui.shortcut_overrides.is_empty());
|
||||
let r = app.run("shortcuts.set", json!({"id": "select.none", "hold": "Shift+X", "force": true})).unwrap();
|
||||
assert_eq!(r["removedFrom"], json!(["paint.swap"]));
|
||||
assert_eq!(app.ui.shortcut_holds.keys().collect::<Vec<_>>(), ["select.none"]);
|
||||
}
|
||||
|
||||
/// Reset All and a preset clear the hold shortcuts; two entries holding one key are a conflict.
|
||||
#[test]
|
||||
fn hold_shortcut_conflicts_reset_and_presets() {
|
||||
let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default());
|
||||
app.ui.shortcut_holds.insert("paint.swap".into(), "X".into());
|
||||
app.ui.shortcut_holds.insert("select.none".into(), "X".into());
|
||||
let c = app.run("shortcuts.conflicts", json!({})).unwrap();
|
||||
assert!(c.as_array().unwrap().iter().any(|c| c["shortcut"] == "Hold X"), "{c}");
|
||||
app.run("shortcuts.reset", json!({})).unwrap();
|
||||
assert!(app.ui.shortcut_holds.is_empty());
|
||||
app.run("shortcuts.set", json!({"id": "paint.swap", "hold": "X"})).unwrap();
|
||||
app.run("shortcuts.preset", json!({"name": PRESETS[0]})).unwrap();
|
||||
assert!(app.ui.shortcut_holds.is_empty());
|
||||
}
|
||||
|
||||
/// Export… writes the hold shortcuts as `holds` (version 1) only when there are any; Import…
|
||||
/// reads them, a file without them has none, and a bad one fails and applies nothing.
|
||||
#[test]
|
||||
fn hold_shortcuts_export_and_import() {
|
||||
let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default());
|
||||
let none = export_json("Studio", &Overrides::new());
|
||||
assert!(none.get("holds").is_none());
|
||||
let holds: Holds = [("paint.swap".to_string(), "X".to_string())].into();
|
||||
let v = export_json_with("Studio", &Overrides::new(), &holds);
|
||||
assert_eq!((v["version"].as_u64(), v["holds"].clone()), (Some(1), json!({"paint.swap": "X"})));
|
||||
app.run("shortcuts.import", json!({"data": v})).unwrap();
|
||||
assert_eq!(app.ui.shortcut_holds, holds);
|
||||
for bad in [json!("X"), json!({"paint.swap": 5}), json!({"paint.swap": "Space"})] {
|
||||
let mut v = export_json("Other", &Overrides::new());
|
||||
v["holds"] = bad.clone();
|
||||
assert!(app.run("shortcuts.import", json!({"data": v})).is_err(), "{bad}");
|
||||
assert_eq!((app.ui.shortcut_holds.clone(), app.ui.shortcut_set.as_str()), (holds.clone(), "Studio"), "{bad}");
|
||||
}
|
||||
app.run("shortcuts.import", json!({"data": none})).unwrap();
|
||||
assert!(app.ui.shortcut_holds.is_empty(), "an import replaces the whole set");
|
||||
}
|
||||
|
||||
/// Export Text… gives a row with a hold shortcut a third column while Hold Shortcuts is on.
|
||||
#[test]
|
||||
fn export_text_lists_hold_shortcuts_while_they_act() {
|
||||
type Files = std::rc::Rc<std::cell::RefCell<Vec<String>>>;
|
||||
let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default());
|
||||
let written: Files = Default::default();
|
||||
let w = written.clone();
|
||||
app.services.write = Some(Box::new(move |_: &str, b: &[u8]| {
|
||||
w.borrow_mut().push(String::from_utf8(b.to_vec()).map_err(|e| e.to_string())?);
|
||||
Ok(())
|
||||
}));
|
||||
app.run("shortcuts.set", json!({"id": "paint.swap", "hold": "X"})).unwrap();
|
||||
let row = |text: &str| text.lines().find(|l| l.starts_with(&english_name(&entry("paint.swap").unwrap()))).map(str::to_string);
|
||||
with_steady_plugins(|| {
|
||||
written.borrow_mut().clear();
|
||||
app.run("shortcuts.exportText", json!({"path": "/a.txt"})).unwrap();
|
||||
app.run("prefs.set", json!({"key": "holdShortcuts", "value": true})).unwrap();
|
||||
app.run("shortcuts.exportText", json!({"path": "/b.txt"})).unwrap();
|
||||
app.run("prefs.set", json!({"key": "holdShortcuts", "value": false})).unwrap();
|
||||
});
|
||||
let files = written.borrow();
|
||||
let (off, on) = (row(&files[0]).unwrap(), row(&files[1]).unwrap());
|
||||
assert_eq!(off.split('\t').count(), 2, "{off}");
|
||||
assert_eq!(on.split('\t').nth(2), Some(format!("Hold {}", menus::pretty_shortcut("X")).as_str()), "{on}");
|
||||
}
|
||||
|
||||
/// The text the Keyboard Shortcuts dialog draws in its second frame.
|
||||
fn dialog_texts(app: &mut VectorcraftApp) -> Vec<String> {
|
||||
let ctx = egui::Context::default();
|
||||
theme::install_fonts(&ctx);
|
||||
// The modal draws nothing in its first frame, which only sizes it.
|
||||
let mut out = ctx.run_ui(egui::RawInput::default(), |ui| show(app, ui.ctx()));
|
||||
out.textures_delta.clear();
|
||||
let mut out = ctx.run_ui(egui::RawInput::default(), |ui| show(app, ui.ctx()));
|
||||
out.textures_delta.clear();
|
||||
out.shapes
|
||||
.iter()
|
||||
.filter_map(|c| match &c.shape {
|
||||
egui::Shape::Text(t) => Some(t.galley.text().to_string()),
|
||||
_ => None,
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// Hold Shortcuts is off by default: the dialog shows its checkbox and no Hold column. Turned
|
||||
/// on, the dialog shows the column and the delay, and OK turns hold shortcuts on; Cancel keeps
|
||||
/// them off.
|
||||
#[test]
|
||||
fn the_hold_shortcuts_checkbox_shows_the_hold_column() {
|
||||
let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default());
|
||||
assert!(!app.session.prefs.hold_shortcuts);
|
||||
open(&mut app);
|
||||
let off = dialog_texts(&mut app);
|
||||
assert!(off.iter().any(|t| t == "Hold Shortcuts"), "{off:?}");
|
||||
assert!(!off.iter().any(|t| t == "Hold" || t == "Hold Shortcut Delay"), "{off:?}");
|
||||
app.ui.dialog.as_mut().unwrap().fields.insert("holdShortcuts".into(), json!(true));
|
||||
let on = dialog_texts(&mut app);
|
||||
assert!(on.iter().any(|t| t == "Hold") && on.iter().any(|t| t == "Hold Shortcut Delay"), "{on:?}");
|
||||
app.ui.dialog = None;
|
||||
assert!(!app.session.prefs.hold_shortcuts, "Cancel keeps them off");
|
||||
open(&mut app);
|
||||
let d = app.ui.dialog.as_mut().unwrap();
|
||||
d.fields.insert("holdShortcuts".into(), json!(true));
|
||||
d.fields.insert("keyHoldDelay".into(), json!(0.5));
|
||||
confirm(&mut app).unwrap();
|
||||
assert!(app.session.prefs.hold_shortcuts);
|
||||
assert_eq!(app.session.prefs.key_hold_delay, 0.5);
|
||||
}
|
||||
|
||||
/// The info button shows how hold shortcuts work.
|
||||
#[test]
|
||||
fn the_info_button_explains_hold_shortcuts() {
|
||||
let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default());
|
||||
open(&mut app);
|
||||
assert!(!dialog_texts(&mut app).iter().any(|t| t.starts_with("A quick press")));
|
||||
app.ui.dialog.as_mut().unwrap().fields.insert("__holdInfo".into(), json!(true));
|
||||
let texts = dialog_texts(&mut app);
|
||||
assert!(texts.iter().any(|t| t.starts_with("A quick press")) && texts.iter().any(|t| t == "Tap"), "{texts:?}");
|
||||
}
|
||||
}
|
||||
@@ -12,11 +12,13 @@ use vectorcraft_tools::{Mods, SurroundingUnit, ToolKey};
|
||||
use crate::VectorcraftApp;
|
||||
|
||||
mod held_tool;
|
||||
mod hold_keys;
|
||||
mod paste;
|
||||
mod presentation;
|
||||
mod typing;
|
||||
|
||||
pub(crate) use held_tool::{HeldTool, note_tool_use};
|
||||
pub(crate) use hold_keys::HoldKeys;
|
||||
use paste::unclip_chords;
|
||||
pub(crate) use paste::{PasteChord, paste_command};
|
||||
pub(crate) use presentation::presentation_step;
|
||||
@@ -196,6 +198,8 @@ pub fn handle(app: &mut VectorcraftApp, ctx: &egui::Context) {
|
||||
note_key_surfaces(app, ctx);
|
||||
forget_opening_key(ctx);
|
||||
let focused = ctx.input(|input| input.focused) || app.forwarded_frame && ctx.viewport_id() == egui::ViewportId::ROOT;
|
||||
// The repeats of a key with a hold shortcut stay out of every frame until it is let go.
|
||||
hold_keys::guard(app, ctx, focused);
|
||||
// A held tool shortcut that is let go returns to the tool active before it.
|
||||
held_tool::follow(app, ctx, focused);
|
||||
if !focused {
|
||||
@@ -243,6 +247,11 @@ pub fn handle(app: &mut VectorcraftApp, ctx: &egui::Context) {
|
||||
presentation_keys(app, ctx);
|
||||
return;
|
||||
}
|
||||
// Keys with a hold shortcut wait before anything else reads the frame's keys, so a key pressed
|
||||
// after one acts after it.
|
||||
if hold_keys::intake(app, ctx) {
|
||||
return;
|
||||
}
|
||||
// Escape that cancels a ruler-origin drag or floating Tools move skips the tool and later Escape actions,
|
||||
// and so do its repeats while it is held.
|
||||
let escape_ended_gesture = escape_ended_gesture(ctx);
|
||||
@@ -580,42 +589,60 @@ fn single_key_shortcuts(app: &mut VectorcraftApp, ctx: &egui::Context) {
|
||||
})
|
||||
.collect()
|
||||
});
|
||||
let keymap = crate::shortcut_editor::current();
|
||||
for (text, m, pressed, repeat) in events {
|
||||
if m.command || m.alt || m.ctrl {
|
||||
continue;
|
||||
}
|
||||
let upper = text.to_uppercase();
|
||||
let key = if m.shift && text.chars().all(|c| c.is_alphabetic()) { format!("Shift+{upper}") } else { upper.clone() };
|
||||
// A shifted punctuation character can also be written with its Shift (the Curvature tool's
|
||||
// Shift+~ arrives as `~`).
|
||||
let shifted = m.shift.then(|| format!("Shift+{text}"));
|
||||
let mut chords: Vec<craft_keymap::Chord> =
|
||||
[Some(key), Some(text), shifted].into_iter().flatten().filter_map(|t| crate::keymap::vc_chord(&t)).collect();
|
||||
// A character no chord names (`"`, which the backtick key types on Turkish Q) is read as
|
||||
// the key that typed it, as the Keyboard Shortcuts editor records that press.
|
||||
if chords.is_empty() {
|
||||
let typed_by = pressed.and_then(|k| crate::shortcut_editor::chord_from_event(k, Modifiers { shift: m.shift, ..Modifiers::NONE }));
|
||||
chords.extend(typed_by.and_then(|t| crate::keymap::vc_chord(&t)));
|
||||
let chords = text_chords(&text, m, pressed);
|
||||
if run_single_key(app, ctx, &chords, pressed, repeat) {
|
||||
break;
|
||||
}
|
||||
let hits: Vec<CommandRef> = chords.iter().filter_map(|c| crate::keymap::lookup(&keymap.keymap, c)).collect();
|
||||
// Single-key command shortcuts (X, Shift+X, D, /, Shift+D, F, Shift+F by default) before
|
||||
// tools.
|
||||
let Some(hit) = hits.iter().find(|c| !c.id.starts_with("tool:")).or(hits.first()) else { continue };
|
||||
// A command runs as it does on a chord ([`run_hit`]): what its menu item runs. Smooth opens
|
||||
// its slider, and Move opens its dialog.
|
||||
match hit.id.strip_prefix("tool:") {
|
||||
Some(tool) => held_tool::choose(app, ctx, tool, pressed, repeat),
|
||||
None => {
|
||||
run_hit(app, ctx, hit);
|
||||
if dialog_or_palette_open(app) {
|
||||
if let Some(key) = pressed {
|
||||
let id = opening_key_id(ctx);
|
||||
ctx.data_mut(|m| m.insert_temp(id, key));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// The chords a single-key shortcut reads for `text`, typed with `m` by the key `pressed`.
|
||||
fn text_chords(text: &str, m: Modifiers, pressed: Option<Key>) -> Vec<craft_keymap::Chord> {
|
||||
let upper = text.to_uppercase();
|
||||
let key = if m.shift && text.chars().all(|c| c.is_alphabetic()) { format!("Shift+{upper}") } else { upper.clone() };
|
||||
// A shifted punctuation character can also be written with its Shift (the Curvature tool's
|
||||
// Shift+~ arrives as `~`).
|
||||
let shifted = m.shift.then(|| format!("Shift+{text}"));
|
||||
let mut chords: Vec<craft_keymap::Chord> =
|
||||
[Some(key), Some(text.to_string()), shifted].into_iter().flatten().filter_map(|t| crate::keymap::vc_chord(&t)).collect();
|
||||
// A character no chord names (`"`, which the backtick key types on Turkish Q) is read as
|
||||
// the key that typed it, as the Keyboard Shortcuts editor records that press.
|
||||
if chords.is_empty() {
|
||||
let typed_by = pressed.and_then(|k| crate::shortcut_editor::chord_from_event(k, Modifiers { shift: m.shift, ..Modifiers::NONE }));
|
||||
chords.extend(typed_by.and_then(|t| crate::keymap::vc_chord(&t)));
|
||||
}
|
||||
chords
|
||||
}
|
||||
|
||||
/// Runs the single-key shortcut of `chords`, typed by the key `pressed`. True when it opened a
|
||||
/// dialog or the palette: the shortcuts after it in the frame do not run.
|
||||
fn run_single_key(app: &mut VectorcraftApp, ctx: &egui::Context, chords: &[craft_keymap::Chord], pressed: Option<Key>, repeat: bool) -> bool {
|
||||
let keymap = crate::shortcut_editor::current();
|
||||
let hits: Vec<CommandRef> = chords.iter().filter_map(|c| crate::keymap::lookup(&keymap.keymap, c)).collect();
|
||||
// Single-key command shortcuts (X, Shift+X, D, /, Shift+D, F, Shift+F by default) before
|
||||
// tools.
|
||||
let Some(hit) = hits.iter().find(|c| !c.id.starts_with("tool:")).or(hits.first()) else { return false };
|
||||
// A command runs as it does on a chord ([`run_hit`]): what its menu item runs. Smooth opens
|
||||
// its slider, and Move opens its dialog.
|
||||
match hit.id.strip_prefix("tool:") {
|
||||
Some(tool) => {
|
||||
held_tool::choose(app, ctx, tool, pressed, repeat);
|
||||
false
|
||||
}
|
||||
None => {
|
||||
run_hit(app, ctx, hit);
|
||||
if !dialog_or_palette_open(app) {
|
||||
return false;
|
||||
}
|
||||
if let Some(key) = pressed {
|
||||
let id = opening_key_id(ctx);
|
||||
ctx.data_mut(|m| m.insert_temp(id, key));
|
||||
}
|
||||
true
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1077,7 +1104,7 @@ fn run_hit(app: &mut VectorcraftApp, ctx: &egui::Context, c: &CommandRef) {
|
||||
}
|
||||
|
||||
/// Keys that type a character: letters, digits and punctuation (not Space).
|
||||
fn types_text(key: craft_keymap::Key) -> bool {
|
||||
pub(crate) fn types_text(key: craft_keymap::Key) -> bool {
|
||||
key.name().chars().count() == 1
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,321 @@
|
||||
//! Hold shortcuts (Edit › Keyboard Shortcuts, Hold Shortcuts on, the Hold column): a character key
|
||||
//! with a hold shortcut waits when it goes down. Held for the Hold Shortcut Delay (`keyHoldDelay`),
|
||||
//! it runs its hold shortcut once, and its repeats are ignored until it is let go. Let go sooner, it
|
||||
//! runs what a press of the key runs without a hold shortcut, at the release. A key without a hold
|
||||
//! shortcut runs on its press, as before, and so does every key while Hold Shortcuts is off.
|
||||
|
||||
use super::{Key, Modifiers, VectorcraftApp};
|
||||
use vectorcraft_tools::ToolKey;
|
||||
|
||||
/// A press of a key with a hold shortcut, waiting for its release or for the delay to pass.
|
||||
pub(crate) struct Pending {
|
||||
/// The entry the hold shortcut runs (`tool:<id>`, a command id or `panel:<id>`).
|
||||
entry: String,
|
||||
/// The chords the press names, first match first, for the tap.
|
||||
chords: Vec<craft_keymap::Chord>,
|
||||
/// The key as egui reported the press, before any rewrite of the dispatcher.
|
||||
key: Key,
|
||||
/// The key's position, when the press gave one.
|
||||
physical: Option<Key>,
|
||||
/// The modifiers held at the press.
|
||||
mods: Modifiers,
|
||||
/// When the key went down (`egui::InputState::time`).
|
||||
since: f64,
|
||||
/// The Hold Shortcut Delay read at the press: a later change does not move this wait.
|
||||
delay: f64,
|
||||
/// The viewport whose frame saw the press. Frames of other viewports leave the wait alone.
|
||||
viewport: egui::ViewportId,
|
||||
}
|
||||
|
||||
/// A key whose repeats, and the text they type, are dropped until it is let go.
|
||||
#[derive(Clone, Copy, PartialEq)]
|
||||
struct Swallowed {
|
||||
key: Key,
|
||||
physical: Option<Key>,
|
||||
viewport: egui::ViewportId,
|
||||
}
|
||||
|
||||
/// The hold shortcut state of the app: at most one waiting press, and the keys held down after
|
||||
/// their wait ended.
|
||||
#[derive(Default)]
|
||||
pub(crate) struct HoldKeys {
|
||||
pending: Option<Pending>,
|
||||
swallowed: Vec<Swallowed>,
|
||||
}
|
||||
|
||||
/// Is `e` the release of the key `key` at `physical`? The position decides when both events give
|
||||
/// one; otherwise the key decides.
|
||||
fn releases(e: &egui::Event, key: Key, physical: Option<Key>) -> bool {
|
||||
matches!(e, egui::Event::Key { key: k, physical_key: p, pressed: false, .. } if same_key(*k, *p, key, physical))
|
||||
}
|
||||
|
||||
fn same_key(k: Key, p: Option<Key>, key: Key, physical: Option<Key>) -> bool {
|
||||
match (p, physical) {
|
||||
(Some(p), Some(q)) => p == q,
|
||||
_ => k == key || Some(k) == physical,
|
||||
}
|
||||
}
|
||||
|
||||
/// Is the key still down? egui keeps the keys down by the key it reported for the press.
|
||||
fn is_down(i: &egui::InputState, key: Key, physical: Option<Key>) -> bool {
|
||||
i.key_down(key) || physical.is_some_and(|p| i.key_down(p))
|
||||
}
|
||||
|
||||
/// What stops a wait: anything that takes the keyboard from the canvas.
|
||||
fn blocked(app: &VectorcraftApp, ctx: &egui::Context) -> bool {
|
||||
crate::scrub::phase(ctx) != crate::scrub::Phase::Idle
|
||||
|| crate::updates_ui::blocks_input(app)
|
||||
|| app.ui.dialog.is_some()
|
||||
|| app.ui.palette_open
|
||||
|| app.ui.screen_mode == 3
|
||||
|| ctx.egui_wants_keyboard_input()
|
||||
|| app.session.tool_wants_text()
|
||||
|| app.session.tool_composing()
|
||||
|| app.session.tool_busy()
|
||||
// An input method composing on the canvas with any tool.
|
||||
|| ctx.input(|i| i.events.iter().any(|e| matches!(e, egui::Event::Ime(egui::ImeEvent::Preedit { text, .. }) if !text.is_empty())))
|
||||
}
|
||||
|
||||
/// Every frame, before anything can return: drops the repeats of the keys held after their wait
|
||||
/// ended or while it waits, and the text they type, also on frames that run no shortcut. Ends the
|
||||
/// wait without running anything when the window lost the keyboard, or when a field, a dialog,
|
||||
/// Presentation Mode, a numeric scrub, an IME composition or a busy tool has it.
|
||||
pub(super) fn guard(app: &mut VectorcraftApp, ctx: &egui::Context, focused: bool) {
|
||||
let viewport = ctx.viewport_id();
|
||||
if !focused {
|
||||
// egui lets go of every key when the window loses the keyboard.
|
||||
if app.hold_keys.pending.as_ref().is_some_and(|p| p.viewport == viewport) {
|
||||
app.hold_keys.pending = None;
|
||||
}
|
||||
app.hold_keys.swallowed.retain(|s| s.viewport != viewport);
|
||||
return;
|
||||
}
|
||||
if app.hold_keys.pending.as_ref().is_some_and(|p| p.viewport == viewport) && (blocked(app, ctx) || !app.session.prefs.hold_shortcuts) {
|
||||
cancel(app, ctx);
|
||||
}
|
||||
let mut held: Vec<(Key, Option<Key>)> = app.hold_keys.swallowed.iter().filter(|s| s.viewport == viewport).map(|s| (s.key, s.physical)).collect();
|
||||
held.extend(app.hold_keys.pending.as_ref().filter(|p| p.viewport == viewport).map(|p| (p.key, p.physical)));
|
||||
if held.is_empty() {
|
||||
return;
|
||||
}
|
||||
drop_repeats(ctx, &held);
|
||||
// A key let go, or pressed anew, is no longer held back after this frame: a repeat that came
|
||||
// in the same frame as its release was dropped above.
|
||||
ctx.input(|i| {
|
||||
app.hold_keys.swallowed.retain(|s| {
|
||||
s.viewport != viewport
|
||||
|| is_down(i, s.key, s.physical)
|
||||
&& !i.events.iter().any(|e| {
|
||||
releases(e, s.key, s.physical)
|
||||
|| matches!(e, egui::Event::Key { key, physical_key, pressed: true, repeat: false, .. } if same_key(*key, *physical_key, s.key, s.physical))
|
||||
})
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/// Removes this frame's repeats of the keys `held`, and the text they type.
|
||||
fn drop_repeats(ctx: &egui::Context, held: &[(Key, Option<Key>)]) {
|
||||
let repeat = |e: Option<&egui::Event>| {
|
||||
matches!(e, Some(egui::Event::Key { key, physical_key, pressed: true, repeat: true, .. })
|
||||
if held.iter().any(|(k, p)| same_key(*key, *physical_key, *k, *p)))
|
||||
};
|
||||
ctx.input_mut(|i| {
|
||||
let typed_by = super::typing_presses(&i.events);
|
||||
let drop: Vec<bool> = i
|
||||
.events
|
||||
.iter()
|
||||
.zip(typed_by)
|
||||
.map(|(e, by)| repeat(Some(e)) || matches!(e, egui::Event::Text(_)) && repeat(by.and_then(|k| i.events.get(k))))
|
||||
.collect();
|
||||
let mut drop = drop.into_iter();
|
||||
i.events.retain(|_| !drop.next().unwrap_or(false));
|
||||
});
|
||||
}
|
||||
|
||||
/// Ends the wait without running anything; the key's repeats stay held back until it is let go.
|
||||
fn cancel(app: &mut VectorcraftApp, ctx: &egui::Context) {
|
||||
let Some(p) = app.hold_keys.pending.take() else { return };
|
||||
if ctx.input(|i| is_down(i, p.key, p.physical)) {
|
||||
app.hold_keys.swallowed.push(Swallowed { key: p.key, physical: p.physical, viewport: p.viewport });
|
||||
}
|
||||
}
|
||||
|
||||
/// Runs the result of the wait: the hold shortcut when `hold`, otherwise the tap. `down`: the key
|
||||
/// is still down, so its repeats are held back until it is let go. True when the result opened a
|
||||
/// dialog or the palette.
|
||||
fn settle(app: &mut VectorcraftApp, ctx: &egui::Context, hold: bool, down: bool) -> bool {
|
||||
let Some(p) = app.hold_keys.pending.take() else { return false };
|
||||
if down {
|
||||
app.hold_keys.swallowed.push(Swallowed { key: p.key, physical: p.physical, viewport: p.viewport });
|
||||
}
|
||||
if hold {
|
||||
super::run_hit(app, ctx, &crate::keymap::command_of(&p.entry));
|
||||
} else {
|
||||
// The key is already up, or another key went down: a tool it chooses is chosen for good.
|
||||
super::run_single_key(app, ctx, &p.chords, None, false);
|
||||
}
|
||||
let opened = super::dialog_or_palette_open(app);
|
||||
if opened && down {
|
||||
// The key's repeats do not reach the dialog.
|
||||
let id = super::opening_key_id(ctx);
|
||||
ctx.data_mut(|m| m.insert_temp(id, p.key));
|
||||
}
|
||||
opened
|
||||
}
|
||||
|
||||
/// The chords a press names for a hold shortcut, first match first: those of the text it typed, as
|
||||
/// a single-key shortcut reads them, then the key itself with its Shift (Shift+1 typing `!`). A
|
||||
/// letter names only the chord with its own Shift state: a hold on X does not catch Shift+X.
|
||||
fn press_chords(text: &str, key: Key, m: Modifiers) -> Vec<craft_keymap::Chord> {
|
||||
let mut chords = super::text_chords(text, m, Some(key));
|
||||
if !text.is_empty() && text.chars().all(char::is_alphabetic) {
|
||||
chords.retain(|c| c.mods.shift == m.shift);
|
||||
}
|
||||
let shift = Modifiers { shift: m.shift, ..Modifiers::NONE };
|
||||
if let Some(c) = crate::shortcut_editor::chord_from_event(key, shift).and_then(|t| crate::keymap::vc_chord(&t))
|
||||
&& !chords.contains(&c)
|
||||
{
|
||||
chords.push(c);
|
||||
}
|
||||
chords
|
||||
}
|
||||
|
||||
/// The chords a quick press runs, as the key runs without a hold shortcut: a shortcut on a shifted
|
||||
/// punctuation key itself (Shift+.), which the shortcuts read from the key press, then those of
|
||||
/// the text it typed.
|
||||
fn tap_chords(text: &str, key: Key, m: Modifiers) -> Vec<craft_keymap::Chord> {
|
||||
let shift = Modifiers { shift: m.shift, ..Modifiers::NONE };
|
||||
let pressed = crate::shortcut_editor::chord_from_event(key, shift)
|
||||
.and_then(|t| crate::keymap::vc_chord(&t))
|
||||
.filter(|c| c.mods.shift && c.key.name().chars().all(|ch| !ch.is_alphanumeric()));
|
||||
let mut chords: Vec<craft_keymap::Chord> = super::text_chords(text, m, Some(key)).into_iter().filter(|c| pressed.as_ref() != Some(c)).collect();
|
||||
if let Some(c) = pressed {
|
||||
chords.insert(0, c);
|
||||
}
|
||||
chords
|
||||
}
|
||||
|
||||
/// Does the active tool take this key itself (a digit with the perspective grid showing, a bracket
|
||||
/// with the Blob Brush, E with the Extend Path tool)? Then the key keeps doing that and does not
|
||||
/// wait.
|
||||
fn tool_takes(app: &mut VectorcraftApp, key: Key, text: &str) -> bool {
|
||||
let view = app.view_info();
|
||||
let tool_key = match text {
|
||||
"[" | "{" => Some(ToolKey::BracketLeft),
|
||||
"]" | "}" => Some(ToolKey::BracketRight),
|
||||
_ => super::digit_of(key).map(ToolKey::Digit).or_else(|| super::letter_of(key).map(ToolKey::Letter)),
|
||||
};
|
||||
tool_key.is_some_and(|k| app.session.tool_claims_key(k, view))
|
||||
}
|
||||
|
||||
/// Before the frame's shortcuts run: goes through the frame's events in order. A release of the
|
||||
/// waiting key ends the wait (the hold when the delay has passed, otherwise the tap); a press of
|
||||
/// another key, or a change of Cmd, Ctrl or Alt, ends it first, so the keys act in the order they
|
||||
/// went down; and a new press of a key with a hold shortcut starts a wait, taking the press and
|
||||
/// its text from the frame. Then a wait whose delay has passed with the key down runs the hold
|
||||
/// shortcut. True when a result opened a dialog or the palette: the rest of the frame's keys are
|
||||
/// dropped and no other shortcut runs.
|
||||
pub(super) fn intake(app: &mut VectorcraftApp, ctx: &egui::Context) -> bool {
|
||||
// Off (Keyboard Shortcuts › Hold Shortcuts), every key runs on its press.
|
||||
if !app.session.prefs.hold_shortcuts || blocked(app, ctx) {
|
||||
return false;
|
||||
}
|
||||
let viewport = ctx.viewport_id();
|
||||
let (events, now) = ctx.input(|i| (i.events.clone(), i.time));
|
||||
let typed_by = super::typing_presses(&events);
|
||||
let text_of = |k: usize| typed_by.iter().position(|by| *by == Some(k)).and_then(|j| events.get(j).map(|e| (j, e)));
|
||||
let mut taken: Vec<usize> = vec![];
|
||||
let mut stop_at = None;
|
||||
for (j, e) in events.iter().enumerate() {
|
||||
if let Some(p) = app.hold_keys.pending.as_ref().filter(|p| p.viewport == viewport) {
|
||||
let overdue = now - p.since >= p.delay;
|
||||
let ended = if releases(e, p.key, p.physical) {
|
||||
Some((overdue, false))
|
||||
} else {
|
||||
match e {
|
||||
egui::Event::Key { key, physical_key, pressed: true, .. }
|
||||
if !super::is_modifier(*key) && !same_key(*key, *physical_key, p.key, p.physical) =>
|
||||
{
|
||||
Some((overdue, true))
|
||||
}
|
||||
// A new press of the waiting key whose release was never seen.
|
||||
egui::Event::Key { key, physical_key, pressed: true, repeat: false, .. } if same_key(*key, *physical_key, p.key, p.physical) => {
|
||||
Some((false, false))
|
||||
}
|
||||
egui::Event::ModifiersChanged(m) if (m.command, m.ctrl, m.alt) != (p.mods.command, p.mods.ctrl, p.mods.alt) => {
|
||||
Some((false, true))
|
||||
}
|
||||
_ => None,
|
||||
}
|
||||
};
|
||||
if let Some((hold, down)) = ended
|
||||
&& settle(app, ctx, hold, down)
|
||||
{
|
||||
stop_at = Some(j);
|
||||
break;
|
||||
}
|
||||
}
|
||||
let egui::Event::Key { key, physical_key, pressed: true, repeat: false, modifiers: m } = e else { continue };
|
||||
if m.command || m.ctrl || m.alt || m.mac_cmd || super::is_modifier(*key) {
|
||||
continue;
|
||||
}
|
||||
// Only a press that typed a text waits: a text alone has no key to let go.
|
||||
let Some((t, egui::Event::Text(text))) = text_of(j) else { continue };
|
||||
let typed = super::latin(text, *physical_key);
|
||||
let Some(entry) =
|
||||
press_chords(&typed, *key, *m).iter().find_map(|c| crate::shortcut_editor::hold_for(&app.ui.shortcut_holds, c)).map(str::to_string)
|
||||
else {
|
||||
continue;
|
||||
};
|
||||
let chords = tap_chords(&typed, *key, *m);
|
||||
if tool_takes(app, *key, text) {
|
||||
continue;
|
||||
}
|
||||
taken.extend([j, t]);
|
||||
// A wait left in another viewport ends without running: that window lost the keyboard to
|
||||
// this one. Its key's repeats stay held back there until it is let go.
|
||||
if let Some(old) = app.hold_keys.pending.take_if(|p| p.viewport != viewport) {
|
||||
app.hold_keys.swallowed.push(Swallowed { key: old.key, physical: old.physical, viewport: old.viewport });
|
||||
}
|
||||
let delay = app.session.prefs.key_hold_delay();
|
||||
app.hold_keys.pending = Some(Pending { entry, chords, key: *key, physical: *physical_key, mods: *m, since: now, delay, viewport });
|
||||
}
|
||||
// Take the waiting presses and their texts, and after a result that opened a dialog, the key
|
||||
// event that ended the wait and every later key event and text of the frame, with the text a
|
||||
// press typed before it (the web build sends a press's text first): none of them reaches the
|
||||
// dialog.
|
||||
ctx.input_mut(|i| {
|
||||
if i.events.len() != events.len() {
|
||||
return;
|
||||
}
|
||||
let mut j = 0;
|
||||
i.events.retain(|e| {
|
||||
let k = j;
|
||||
j += 1;
|
||||
let later = stop_at.is_some_and(|s| {
|
||||
k >= s && matches!(e, egui::Event::Key { .. } | egui::Event::Text(_))
|
||||
|| matches!(e, egui::Event::Text(_)) && typed_by.get(k).copied().flatten().is_some_and(|by| by >= s)
|
||||
});
|
||||
!(taken.contains(&k) || later)
|
||||
});
|
||||
});
|
||||
if stop_at.is_some() {
|
||||
return true;
|
||||
}
|
||||
let Some(p) = app.hold_keys.pending.as_ref().filter(|p| p.viewport == viewport) else { return false };
|
||||
let deadline = p.since + p.delay;
|
||||
let down = ctx.input(|i| is_down(i, p.key, p.physical));
|
||||
if !down {
|
||||
// Let go without a release this frame saw.
|
||||
return settle(app, ctx, now >= deadline, false);
|
||||
}
|
||||
if now >= deadline {
|
||||
return settle(app, ctx, true, true);
|
||||
}
|
||||
// egui draws only on input, and a held key need not repeat: draw again at the deadline.
|
||||
ctx.request_repaint_after_secs((deadline - now) as f32);
|
||||
false
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
@@ -0,0 +1,517 @@
|
||||
use serde_json::json;
|
||||
|
||||
use super::super::handle;
|
||||
use super::*;
|
||||
|
||||
/// A keyboard on one context, so egui keeps the keys held down from frame to frame and marks a
|
||||
/// held key's later presses as repeats, with the frame times the test sets.
|
||||
struct Keyboard {
|
||||
ctx: egui::Context,
|
||||
}
|
||||
|
||||
impl Keyboard {
|
||||
fn new() -> Self {
|
||||
Self { ctx: egui::Context::default() }
|
||||
}
|
||||
|
||||
/// One frame at `time` seconds delivering `events`, with the window having the keyboard
|
||||
/// (`focused`) or not.
|
||||
fn frame_with_focus(&self, app: &mut VectorcraftApp, time: f64, events: Vec<egui::Event>, focused: bool) {
|
||||
let screen_rect = Some(egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(800.0, 600.0)));
|
||||
let mut out = self.ctx.run_ui(egui::RawInput { events, screen_rect, time: Some(time), focused, ..Default::default() }, |ui| {
|
||||
app.logic(ui.ctx());
|
||||
handle(app, ui.ctx());
|
||||
});
|
||||
out.textures_delta.clear();
|
||||
}
|
||||
|
||||
fn frame(&self, app: &mut VectorcraftApp, time: f64, events: Vec<egui::Event>) {
|
||||
self.frame_with_focus(app, time, events, true);
|
||||
}
|
||||
|
||||
/// [`Self::frame`], giving the events the shortcuts left in the first pass for what is drawn
|
||||
/// after them.
|
||||
fn frame_left(&self, app: &mut VectorcraftApp, time: f64, events: Vec<egui::Event>) -> Vec<egui::Event> {
|
||||
let screen_rect = Some(egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(800.0, 600.0)));
|
||||
let mut left = None;
|
||||
let mut out = self.ctx.run_ui(egui::RawInput { events, screen_rect, time: Some(time), focused: true, ..Default::default() }, |ui| {
|
||||
app.logic(ui.ctx());
|
||||
handle(app, ui.ctx());
|
||||
if left.is_none() {
|
||||
left = Some(ui.ctx().input(|i| i.events.clone()));
|
||||
}
|
||||
});
|
||||
out.textures_delta.clear();
|
||||
left.unwrap_or_default()
|
||||
}
|
||||
|
||||
/// `key` pressed (a repeat when it is already down) at `time`, typing `text`.
|
||||
fn press(&self, app: &mut VectorcraftApp, time: f64, key: Key, text: &str) {
|
||||
self.frame(app, time, press(key, text, Modifiers::NONE));
|
||||
}
|
||||
|
||||
fn release(&self, app: &mut VectorcraftApp, time: f64, key: Key) {
|
||||
self.frame(app, time, vec![release(key)]);
|
||||
}
|
||||
}
|
||||
|
||||
fn press(key: Key, text: &str, modifiers: Modifiers) -> Vec<egui::Event> {
|
||||
vec![egui::Event::Key { key, physical_key: Some(key), pressed: true, repeat: false, modifiers }, egui::Event::Text(text.into())]
|
||||
}
|
||||
|
||||
fn release(key: Key) -> egui::Event {
|
||||
egui::Event::Key { key, physical_key: Some(key), pressed: false, repeat: false, modifiers: Modifiers::NONE }
|
||||
}
|
||||
|
||||
/// A document with a selected rectangle filled red with a blue stroke, the Pen tool chosen, and
|
||||
/// Hold Shortcuts `on`.
|
||||
fn app_with(on: bool) -> VectorcraftApp {
|
||||
let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default());
|
||||
crate::shortcut_editor::sync(&app.ui);
|
||||
app.run("file.new", json!({"width": 400, "height": 300})).unwrap();
|
||||
app.run("shape.rectangle", json!({"x": 100, "y": 100, "width": 100, "height": 50})).unwrap();
|
||||
app.run("paint.setFill", json!({"color": "#ff0000"})).unwrap();
|
||||
app.run("paint.setStroke", json!({"color": "#0000ff"})).unwrap();
|
||||
app.run("prefs.set", json!({"key": "holdShortcuts", "value": on})).unwrap();
|
||||
app.select_tool("pen");
|
||||
app
|
||||
}
|
||||
|
||||
/// erolka's X: a quick press chooses the Eyedropper, and holding X swaps fill and stroke.
|
||||
fn erolka_x(on: bool) -> VectorcraftApp {
|
||||
let mut app = app_with(on);
|
||||
app.run("shortcuts.set", json!({"id": "tool:eyedropper", "shortcut": "X", "force": true})).unwrap();
|
||||
app.run("shortcuts.set", json!({"id": "paint.swap", "hold": "X"})).unwrap();
|
||||
app
|
||||
}
|
||||
|
||||
/// The fill of the selected object, as `#rrggbb`.
|
||||
fn fill(app: &VectorcraftApp) -> String {
|
||||
let d = app.session.active().unwrap();
|
||||
let id = *d.selection.objects.first().unwrap();
|
||||
d.doc.node(id).unwrap().appearance.fill_paint().color().unwrap().to_hex()
|
||||
}
|
||||
|
||||
fn selected(app: &VectorcraftApp) -> usize {
|
||||
app.session.active().unwrap().selection.objects.len()
|
||||
}
|
||||
|
||||
/// A quick press of X runs its tap at the release, and holding X runs the hold once at the delay,
|
||||
/// also with no repeats; the repeats until the release run nothing more.
|
||||
#[test]
|
||||
fn a_tap_runs_the_key_and_a_hold_runs_the_hold_shortcut() {
|
||||
let mut app = erolka_x(true);
|
||||
let keys = Keyboard::new();
|
||||
keys.press(&mut app, 0.0, Key::X, "x");
|
||||
assert_eq!(app.session.tool_id(), "pen", "the press waits");
|
||||
keys.release(&mut app, 0.1, Key::X);
|
||||
assert_eq!(app.session.tool_id(), "eyedropper", "the quick press chooses the Eyedropper");
|
||||
assert_eq!(fill(&app), "#ff0000", "and swaps nothing");
|
||||
|
||||
app.select_tool("pen");
|
||||
keys.press(&mut app, 1.0, Key::X, "x");
|
||||
keys.frame(&mut app, 1.2, vec![]);
|
||||
assert_eq!(fill(&app), "#ff0000", "before the delay nothing runs");
|
||||
keys.frame(&mut app, 1.35, vec![]);
|
||||
assert_eq!(fill(&app), "#0000ff", "at the delay the hold swaps fill and stroke");
|
||||
assert_eq!(app.session.tool_id(), "pen", "and chooses no tool");
|
||||
for t in [1.5, 1.6, 1.7] {
|
||||
keys.press(&mut app, t, Key::X, "x");
|
||||
}
|
||||
keys.release(&mut app, 1.8, Key::X);
|
||||
assert_eq!(fill(&app), "#0000ff", "the repeats and the release swap nothing more");
|
||||
assert_eq!(app.session.tool_id(), "pen");
|
||||
}
|
||||
|
||||
/// The delay is the Hold Shortcut Delay read at the press.
|
||||
#[test]
|
||||
fn the_hold_waits_for_the_hold_shortcut_delay() {
|
||||
let mut app = erolka_x(true);
|
||||
app.run("prefs.set", json!({"key": "keyHoldDelay", "value": 0.8})).unwrap();
|
||||
let keys = Keyboard::new();
|
||||
keys.press(&mut app, 0.0, Key::X, "x");
|
||||
app.run("prefs.set", json!({"key": "keyHoldDelay", "value": 0.2})).unwrap();
|
||||
keys.frame(&mut app, 0.5, vec![]);
|
||||
assert_eq!(fill(&app), "#ff0000", "a later change does not move the wait");
|
||||
keys.frame(&mut app, 0.8, vec![]);
|
||||
assert_eq!(fill(&app), "#0000ff");
|
||||
}
|
||||
|
||||
/// erolka's `.`: a quick press keeps the key's own command (Apply Last Gradient) and keeps the
|
||||
/// selection, and holding it deselects.
|
||||
#[test]
|
||||
fn the_period_key_taps_its_own_command_and_holds_to_deselect() {
|
||||
let mut app = app_with(true);
|
||||
app.run("shortcuts.set", json!({"id": "select.none", "hold": "."})).unwrap();
|
||||
let keys = Keyboard::new();
|
||||
keys.press(&mut app, 0.0, Key::Period, ".");
|
||||
keys.release(&mut app, 0.1, Key::Period);
|
||||
assert_eq!(selected(&app), 1, "the quick press keeps the selection");
|
||||
let d = app.session.active().unwrap();
|
||||
let id = *d.selection.objects.first().unwrap();
|
||||
let appearance = &d.doc.node(id).unwrap().appearance;
|
||||
let gradient = |p: vectorcraft_color::Paint| matches!(p, vectorcraft_color::Paint::Gradient(_));
|
||||
assert!(gradient(appearance.fill_paint()) || gradient(appearance.stroke_paint()), "and applies the last gradient");
|
||||
// Solid paint again, so a hold that also ran the tap would show.
|
||||
app.run("paint.setFill", json!({"color": "#ff0000"})).unwrap();
|
||||
app.run("paint.setStroke", json!({"color": "#0000ff"})).unwrap();
|
||||
keys.press(&mut app, 1.0, Key::Period, ".");
|
||||
keys.frame(&mut app, 1.4, vec![]);
|
||||
assert_eq!(selected(&app), 0, "the hold deselects");
|
||||
keys.release(&mut app, 1.5, Key::Period);
|
||||
let appearance = &app.session.active().unwrap().doc.node(id).unwrap().appearance;
|
||||
assert!(!gradient(appearance.fill_paint()) && !gradient(appearance.stroke_paint()), "and applies no gradient");
|
||||
}
|
||||
|
||||
/// A hold on a letter alone does not catch the letter with Shift: Shift+X, held, does with Hold
|
||||
/// Shortcuts on what it does with them off, and does not wait.
|
||||
#[test]
|
||||
fn a_hold_on_a_letter_leaves_the_letter_with_shift_alone() {
|
||||
let mut results = vec![];
|
||||
for on in [false, true] {
|
||||
let mut app = erolka_x(on);
|
||||
let keys = Keyboard::new();
|
||||
keys.frame(&mut app, 0.0, press(Key::X, "X", Modifiers::SHIFT));
|
||||
assert!(app.hold_keys.pending.is_none(), "Shift+X does not wait (on {on})");
|
||||
let pressed = (fill(&app), app.session.tool_id().to_string());
|
||||
keys.frame(&mut app, 1.0, vec![]);
|
||||
keys.frame(&mut app, 1.1, vec![release(Key::X)]);
|
||||
results.push((pressed, fill(&app), app.session.tool_id().to_string()));
|
||||
}
|
||||
assert_eq!(results[0], results[1], "holding Shift+X does not run X's hold");
|
||||
}
|
||||
|
||||
/// A letter the active tool takes itself (E with the Extend Path tool) does not wait, also with a
|
||||
/// hold shortcut on it.
|
||||
#[test]
|
||||
fn a_letter_the_tool_takes_does_not_wait() {
|
||||
let mut app = app_with(true);
|
||||
app.run("shortcuts.set", json!({"id": "paint.swap", "hold": "E"})).unwrap();
|
||||
app.select_tool(vectorcraft_tools::addons::extend_path::ID);
|
||||
assert_eq!(app.session.tool_id(), vectorcraft_tools::addons::extend_path::ID);
|
||||
let keys = Keyboard::new();
|
||||
keys.press(&mut app, 0.0, Key::E, "e");
|
||||
assert!(app.hold_keys.pending.is_none(), "E stays the tool's");
|
||||
keys.frame(&mut app, 1.0, vec![]);
|
||||
keys.release(&mut app, 1.1, Key::E);
|
||||
assert_eq!(fill(&app), "#ff0000", "the hold does not run");
|
||||
assert_eq!(app.session.tool_id(), vectorcraft_tools::addons::extend_path::ID);
|
||||
}
|
||||
|
||||
/// An input method that starts composing while a key waits ends the wait without running anything.
|
||||
#[test]
|
||||
fn an_input_method_composition_ends_the_wait() {
|
||||
let mut app = erolka_x(true);
|
||||
let keys = Keyboard::new();
|
||||
keys.press(&mut app, 0.0, Key::X, "x");
|
||||
assert!(app.hold_keys.pending.is_some());
|
||||
keys.frame(&mut app, 0.1, vec![egui::Event::Ime(egui::ImeEvent::Preedit { text: "か".into(), active_range_chars: Some(1..1) })]);
|
||||
assert!(app.hold_keys.pending.is_none(), "the composition ends the wait");
|
||||
keys.frame(&mut app, 1.0, vec![]);
|
||||
keys.release(&mut app, 1.1, Key::X);
|
||||
assert_eq!(app.session.tool_id(), "pen", "no tap ran");
|
||||
assert_eq!(fill(&app), "#ff0000", "and no hold");
|
||||
}
|
||||
|
||||
/// A dialog opened, or Presentation Mode entered, while a key waits ends the wait without running
|
||||
/// anything.
|
||||
#[test]
|
||||
fn a_dialog_or_presentation_mode_ends_the_wait() {
|
||||
for what in ["dialog", "Presentation Mode"] {
|
||||
let mut app = erolka_x(true);
|
||||
let keys = Keyboard::new();
|
||||
keys.press(&mut app, 0.0, Key::X, "x");
|
||||
assert!(app.hold_keys.pending.is_some(), "{what}");
|
||||
if what == "dialog" {
|
||||
app.ui.dialog = Some(crate::state::Dialog::new("preferences", json!({})));
|
||||
} else {
|
||||
app.ui.screen_mode = 3;
|
||||
}
|
||||
keys.frame(&mut app, 0.1, vec![]);
|
||||
assert!(app.hold_keys.pending.is_none(), "{what} ends the wait");
|
||||
app.ui.dialog = None;
|
||||
app.ui.screen_mode = 0;
|
||||
keys.frame(&mut app, 1.0, vec![]);
|
||||
keys.release(&mut app, 1.1, Key::X);
|
||||
assert_eq!(app.session.tool_id(), "pen", "{what}: no tap ran");
|
||||
assert_eq!(fill(&app), "#ff0000", "{what}: and no hold");
|
||||
}
|
||||
}
|
||||
|
||||
/// A new wait does not drop a wait left in another viewport unseen: that wait ends, and its key's
|
||||
/// repeats stay held back in its viewport.
|
||||
#[test]
|
||||
fn a_wait_in_another_viewport_ends_when_a_new_one_starts() {
|
||||
let mut app = erolka_x(true);
|
||||
let other = egui::ViewportId::from_hash_of("another window");
|
||||
app.hold_keys.pending = Some(Pending {
|
||||
entry: "paint.swap".into(),
|
||||
chords: vec![],
|
||||
key: Key::X,
|
||||
physical: Some(Key::X),
|
||||
mods: Modifiers::NONE,
|
||||
since: 0.0,
|
||||
delay: 0.35,
|
||||
viewport: other,
|
||||
});
|
||||
let keys = Keyboard::new();
|
||||
keys.press(&mut app, 0.1, Key::X, "x");
|
||||
assert!(app.hold_keys.pending.as_ref().is_some_and(|p| p.viewport == egui::ViewportId::ROOT), "the new press waits here");
|
||||
assert!(app.hold_keys.swallowed.iter().any(|s| s.viewport == other && s.key == Key::X), "the other window's key stays held back");
|
||||
assert_eq!(fill(&app), "#ff0000", "the other wait ran nothing");
|
||||
}
|
||||
|
||||
/// With Hold Shortcuts off, a key with a hold shortcut runs on its press, as every key does, and
|
||||
/// holding it runs nothing else.
|
||||
#[test]
|
||||
fn with_hold_shortcuts_off_every_key_runs_on_its_press() {
|
||||
let mut app = erolka_x(false);
|
||||
let keys = Keyboard::new();
|
||||
keys.press(&mut app, 0.0, Key::X, "x");
|
||||
assert_eq!(app.session.tool_id(), "eyedropper", "the press runs at once");
|
||||
keys.frame(&mut app, 1.0, vec![]);
|
||||
keys.release(&mut app, 1.2, Key::X);
|
||||
assert_eq!(fill(&app), "#ff0000", "the hold shortcut does not act");
|
||||
assert!(app.hold_keys.pending.is_none());
|
||||
}
|
||||
|
||||
/// Turning Hold Shortcuts off while a key waits ends the wait without running anything.
|
||||
#[test]
|
||||
fn turning_hold_shortcuts_off_ends_the_wait() {
|
||||
let mut app = erolka_x(true);
|
||||
let keys = Keyboard::new();
|
||||
keys.press(&mut app, 0.0, Key::X, "x");
|
||||
assert!(app.hold_keys.pending.is_some());
|
||||
app.run("prefs.set", json!({"key": "holdShortcuts", "value": false})).unwrap();
|
||||
keys.frame(&mut app, 0.5, vec![]);
|
||||
keys.release(&mut app, 0.6, Key::X);
|
||||
assert!(app.hold_keys.pending.is_none());
|
||||
assert_eq!(fill(&app), "#ff0000", "no hold ran");
|
||||
assert_eq!(app.session.tool_id(), "pen", "and no tap");
|
||||
}
|
||||
|
||||
/// A key without a hold shortcut runs in its press frame, and a waiting key pressed before it acts
|
||||
/// first.
|
||||
#[test]
|
||||
fn another_key_ends_the_wait_and_runs_after_it() {
|
||||
let mut app = erolka_x(true);
|
||||
let keys = Keyboard::new();
|
||||
keys.press(&mut app, 0.0, Key::P, "p");
|
||||
assert_eq!(app.session.tool_id(), "pen", "P runs on its press");
|
||||
keys.release(&mut app, 0.05, Key::P);
|
||||
keys.press(&mut app, 0.1, Key::X, "x");
|
||||
keys.press(&mut app, 0.2, Key::V, "v");
|
||||
assert_eq!(app.session.tool_id(), "selection", "X's tap (Eyedropper) ran, then V (Selection)");
|
||||
assert_eq!(fill(&app), "#ff0000");
|
||||
keys.release(&mut app, 0.3, Key::X);
|
||||
assert_eq!(app.session.tool_id(), "selection", "the release of X runs nothing more");
|
||||
}
|
||||
|
||||
/// Two keys pressed in one frame act in the order they went down.
|
||||
#[test]
|
||||
fn keys_in_one_frame_act_in_order() {
|
||||
let mut app = erolka_x(true);
|
||||
let keys = Keyboard::new();
|
||||
let mut events = press(Key::X, "x", Modifiers::NONE);
|
||||
events.extend(press(Key::V, "v", Modifiers::NONE));
|
||||
keys.frame(&mut app, 0.0, events);
|
||||
assert_eq!(app.session.tool_id(), "selection", "X's tap first, then V");
|
||||
let mut events = press(Key::V, "v", Modifiers::NONE);
|
||||
events.extend(press(Key::X, "x", Modifiers::NONE));
|
||||
app.select_tool("pen");
|
||||
keys.frame(&mut app, 1.0, vec![release(Key::X), release(Key::V)]);
|
||||
keys.frame(&mut app, 2.0, events);
|
||||
keys.frame(&mut app, 2.1, vec![release(Key::X)]);
|
||||
assert_eq!(app.session.tool_id(), "eyedropper", "V first, then X's tap at its release");
|
||||
}
|
||||
|
||||
/// A press and its release in one frame are a tap, run in that frame.
|
||||
#[test]
|
||||
fn a_press_and_release_in_one_frame_is_a_tap() {
|
||||
let mut app = erolka_x(true);
|
||||
let keys = Keyboard::new();
|
||||
let mut events = press(Key::X, "x", Modifiers::NONE);
|
||||
events.push(release(Key::X));
|
||||
keys.frame(&mut app, 0.0, events);
|
||||
assert_eq!(app.session.tool_id(), "eyedropper");
|
||||
assert!(app.hold_keys.pending.is_none());
|
||||
keys.frame(&mut app, 5.0, vec![]);
|
||||
assert_eq!(fill(&app), "#ff0000", "nothing waits after it");
|
||||
}
|
||||
|
||||
/// Another key pressed after the delay has passed, before a frame ran the hold, runs the hold.
|
||||
#[test]
|
||||
fn an_overdue_wait_ended_by_another_key_runs_the_hold() {
|
||||
let mut app = erolka_x(true);
|
||||
let keys = Keyboard::new();
|
||||
keys.press(&mut app, 0.0, Key::X, "x");
|
||||
keys.press(&mut app, 0.5, Key::V, "v");
|
||||
assert_eq!(fill(&app), "#0000ff", "the hold ran");
|
||||
assert_eq!(app.session.tool_id(), "selection", "then V");
|
||||
}
|
||||
|
||||
/// The window losing the keyboard ends the wait without running anything.
|
||||
#[test]
|
||||
fn losing_the_keyboard_ends_the_wait() {
|
||||
let mut app = erolka_x(true);
|
||||
let keys = Keyboard::new();
|
||||
keys.press(&mut app, 0.0, Key::X, "x");
|
||||
keys.frame_with_focus(&mut app, 0.1, vec![], false);
|
||||
keys.frame(&mut app, 1.0, vec![]);
|
||||
assert_eq!(app.session.tool_id(), "pen");
|
||||
assert_eq!(fill(&app), "#ff0000");
|
||||
assert!(app.hold_keys.pending.is_none());
|
||||
}
|
||||
|
||||
/// Cmd, Ctrl or Alt pressed while a key waits ends the wait as a tap, before the chord runs.
|
||||
#[test]
|
||||
fn a_command_modifier_ends_the_wait_as_a_tap() {
|
||||
let mut app = erolka_x(true);
|
||||
let keys = Keyboard::new();
|
||||
keys.press(&mut app, 0.0, Key::X, "x");
|
||||
keys.frame(&mut app, 0.1, vec![egui::Event::ModifiersChanged(Modifiers::COMMAND)]);
|
||||
assert_eq!(app.session.tool_id(), "eyedropper");
|
||||
keys.frame(&mut app, 1.0, vec![]);
|
||||
assert_eq!(fill(&app), "#ff0000", "nothing waits after it");
|
||||
}
|
||||
|
||||
/// A tool key with a hold shortcut runs the hold, and the tool is not chosen for the time the key
|
||||
/// is held (`holdToolKeys`); a quick press chooses the tool for good.
|
||||
#[test]
|
||||
fn a_hold_shortcut_takes_a_tool_key_from_hold_tool_keys() {
|
||||
let mut app = app_with(true);
|
||||
assert!(app.session.prefs.hold_tool_keys);
|
||||
app.run("shortcuts.set", json!({"id": "paint.swap", "hold": "S"})).unwrap();
|
||||
let keys = Keyboard::new();
|
||||
keys.press(&mut app, 0.0, Key::S, "s");
|
||||
keys.frame(&mut app, 0.4, vec![]);
|
||||
assert_eq!(fill(&app), "#0000ff", "the hold runs");
|
||||
assert_eq!(app.session.tool_id(), "pen", "Scale is not chosen while S is held");
|
||||
keys.release(&mut app, 1.0, Key::S);
|
||||
assert_eq!(app.session.tool_id(), "pen");
|
||||
keys.press(&mut app, 2.0, Key::S, "s");
|
||||
keys.release(&mut app, 2.1, Key::S);
|
||||
assert_eq!(app.session.tool_id(), "scale", "a quick press chooses Scale");
|
||||
keys.frame(&mut app, 3.0, vec![]);
|
||||
assert_eq!(app.session.tool_id(), "scale", "for good");
|
||||
assert!(app.held_tool.is_empty());
|
||||
}
|
||||
|
||||
/// A tool key without a hold shortcut still chooses its tool while held when another key has one.
|
||||
#[test]
|
||||
fn other_tool_keys_keep_hold_tool_keys() {
|
||||
let mut app = erolka_x(true);
|
||||
let keys = Keyboard::new();
|
||||
keys.press(&mut app, 0.0, Key::S, "s");
|
||||
assert_eq!(app.session.tool_id(), "scale");
|
||||
keys.frame(&mut app, 1.0, vec![]);
|
||||
keys.release(&mut app, 1.1, Key::S);
|
||||
assert_eq!(app.session.tool_id(), "pen", "the Pen comes back");
|
||||
}
|
||||
|
||||
/// A hold on Shift and a digit recorded in the dialog (Shift+1) holds when the press types `!`.
|
||||
#[test]
|
||||
fn a_shifted_digit_holds_when_it_types_its_symbol() {
|
||||
let mut app = app_with(true);
|
||||
app.run("shortcuts.set", json!({"id": "paint.swap", "hold": "Shift+1"})).unwrap();
|
||||
let keys = Keyboard::new();
|
||||
keys.frame(&mut app, 0.0, press(Key::Num1, "!", Modifiers::SHIFT));
|
||||
keys.frame(&mut app, 0.4, vec![]);
|
||||
assert_eq!(fill(&app), "#0000ff");
|
||||
}
|
||||
|
||||
/// A quick press of a shifted key with a hold shortcut runs what the key runs without one: a
|
||||
/// shortcut on Shift+. (typing `>`) runs, and Shift+1 (typing `!`) runs what `!` runs.
|
||||
#[test]
|
||||
fn a_quick_press_of_a_shifted_key_runs_what_it_runs_without_a_hold() {
|
||||
for (key, text, chord) in [(Key::Period, ">", "Shift+."), (Key::Num1, "!", "Shift+1")] {
|
||||
let mut app = app_with(true);
|
||||
app.run("shortcuts.set", json!({"id": "tool:eyedropper", "shortcut": chord, "force": true})).unwrap();
|
||||
let keys = Keyboard::new();
|
||||
keys.frame(&mut app, 0.0, press(key, text, Modifiers::SHIFT));
|
||||
keys.frame(&mut app, 0.05, vec![release(key)]);
|
||||
let without = app.session.tool_id().to_string();
|
||||
app.select_tool("pen");
|
||||
app.run("shortcuts.set", json!({"id": "paint.swap", "hold": chord})).unwrap();
|
||||
keys.frame(&mut app, 1.0, press(key, text, Modifiers::SHIFT));
|
||||
assert_eq!(app.session.tool_id(), "pen", "{chord} waits");
|
||||
keys.frame(&mut app, 1.05, vec![release(key)]);
|
||||
assert_eq!(app.session.tool_id(), without, "a quick press of {chord}");
|
||||
assert_eq!(fill(&app), "#ff0000");
|
||||
}
|
||||
}
|
||||
|
||||
/// The Shift+. shortcut runs on its press without a hold shortcut, and at the release of a quick
|
||||
/// press with one.
|
||||
#[test]
|
||||
fn a_quick_press_of_shift_period_runs_its_shortcut() {
|
||||
let mut app = app_with(true);
|
||||
app.run("shortcuts.set", json!({"id": "tool:eyedropper", "shortcut": "Shift+.", "force": true})).unwrap();
|
||||
app.run("shortcuts.set", json!({"id": "paint.swap", "hold": "Shift+."})).unwrap();
|
||||
let keys = Keyboard::new();
|
||||
keys.frame(&mut app, 0.0, press(Key::Period, ">", Modifiers::SHIFT));
|
||||
keys.frame(&mut app, 0.05, vec![release(Key::Period)]);
|
||||
assert_eq!(app.session.tool_id(), "eyedropper");
|
||||
}
|
||||
|
||||
/// A text with no key press that typed it does not wait: it has no key to let go.
|
||||
#[test]
|
||||
fn a_text_without_its_key_press_does_not_wait() {
|
||||
let mut app = erolka_x(true);
|
||||
let keys = Keyboard::new();
|
||||
keys.frame(&mut app, 0.0, vec![egui::Event::Text("x".into())]);
|
||||
assert!(app.hold_keys.pending.is_none());
|
||||
assert_eq!(app.session.tool_id(), "eyedropper", "it runs as a single-key shortcut, as before");
|
||||
}
|
||||
|
||||
/// A hold whose command opens a dialog holds back the key's repeats from it.
|
||||
#[test]
|
||||
fn a_hold_that_opens_a_dialog_keeps_the_repeats_from_it() {
|
||||
let mut app = app_with(true);
|
||||
app.run("shortcuts.set", json!({"id": "edit.preferences", "hold": "K"})).unwrap();
|
||||
let keys = Keyboard::new();
|
||||
keys.press(&mut app, 0.0, Key::K, "k");
|
||||
keys.frame(&mut app, 0.4, vec![]);
|
||||
assert!(app.ui.dialog.is_some(), "the hold opened Preferences");
|
||||
let opening = keys.ctx.data(|m| m.get_temp::<Key>(super::super::opening_key_id(&keys.ctx)));
|
||||
assert_eq!(opening, Some(Key::K), "K is the key that opened it");
|
||||
keys.press(&mut app, 0.5, Key::K, "k");
|
||||
assert!(app.hold_keys.swallowed.iter().any(|s| s.key == Key::K), "K's repeats are held back until it is let go");
|
||||
// A repeat in the same frame as the release is held back too.
|
||||
let mut events = press(Key::K, "k", Modifiers::NONE);
|
||||
events.push(release(Key::K));
|
||||
let left = keys.frame_left(&mut app, 0.6, events);
|
||||
assert!(!left.iter().any(|e| matches!(e, egui::Event::Text(_) | egui::Event::Key { pressed: true, .. })), "{left:?}");
|
||||
assert!(app.hold_keys.swallowed.is_empty());
|
||||
}
|
||||
|
||||
/// A key that ends a wait whose tap opens a dialog does not reach the dialog: Enter does not
|
||||
/// confirm it.
|
||||
#[test]
|
||||
fn the_key_that_ends_a_wait_does_not_reach_the_dialog_it_opened() {
|
||||
let mut app = app_with(true);
|
||||
app.run("shortcuts.set", json!({"id": "edit.preferences", "shortcut": "K", "force": true})).unwrap();
|
||||
app.run("shortcuts.set", json!({"id": "paint.swap", "hold": "K"})).unwrap();
|
||||
let keys = Keyboard::new();
|
||||
keys.press(&mut app, 0.0, Key::K, "k");
|
||||
let enter = egui::Event::Key { key: Key::Enter, physical_key: Some(Key::Enter), pressed: true, repeat: false, modifiers: Modifiers::NONE };
|
||||
let left = keys.frame_left(&mut app, 0.1, vec![enter]);
|
||||
assert!(app.ui.dialog.is_some(), "the tap opened Preferences");
|
||||
assert!(!left.iter().any(|e| matches!(e, egui::Event::Key { key: Key::Enter, .. })), "{left:?}");
|
||||
assert_eq!(fill(&app), "#ff0000");
|
||||
}
|
||||
|
||||
/// On the web build a press's text comes before it: the text of the key that ends such a wait
|
||||
/// does not reach the dialog either.
|
||||
#[test]
|
||||
fn the_text_before_the_key_that_ends_a_wait_does_not_reach_the_dialog() {
|
||||
let mut app = app_with(true);
|
||||
app.run("shortcuts.set", json!({"id": "edit.preferences", "shortcut": "K", "force": true})).unwrap();
|
||||
app.run("shortcuts.set", json!({"id": "paint.swap", "hold": "K"})).unwrap();
|
||||
let keys = Keyboard::new();
|
||||
keys.press(&mut app, 0.0, Key::K, "k");
|
||||
let m = egui::Event::Key { key: Key::M, physical_key: Some(Key::M), pressed: true, repeat: false, modifiers: Modifiers::NONE };
|
||||
let left = keys.frame_left(&mut app, 0.1, vec![egui::Event::Text("m".into()), m]);
|
||||
assert!(app.ui.dialog.is_some(), "the tap opened Preferences");
|
||||
assert!(!left.iter().any(|e| matches!(e, egui::Event::Text(_) | egui::Event::Key { pressed: true, .. })), "{left:?}");
|
||||
}
|
||||
@@ -670,6 +670,12 @@ pub struct UiState {
|
||||
/// stored in the form every earlier version reads.
|
||||
#[serde(default, with = "crate::keymap::stored")]
|
||||
pub shortcut_overrides: craft_keymap::Overrides,
|
||||
/// Hold shortcuts: command id, `tool:<id>` or `panel:<id>` → a character key, alone or with
|
||||
/// Shift ("X", "Shift+X", "."). Holding the key for the Hold Shortcut Delay runs the entry; a
|
||||
/// quick press runs the key's own shortcut when it is let go. Kept apart from
|
||||
/// `shortcut_overrides`, so earlier versions read the settings without them.
|
||||
#[serde(default, skip_serializing_if = "std::collections::BTreeMap::is_empty")]
|
||||
pub shortcut_holds: std::collections::BTreeMap<String, String>,
|
||||
/// Name of the shortcut set (preset or "Custom").
|
||||
#[serde(default = "default_shortcut_set", deserialize_with = "crate::shortcut_editor::deserialize_set_name")]
|
||||
pub shortcut_set: String,
|
||||
@@ -1221,6 +1227,7 @@ impl Default for UiState {
|
||||
action_playback: Default::default(),
|
||||
action_playing: None,
|
||||
shortcut_overrides: Default::default(),
|
||||
shortcut_holds: Default::default(),
|
||||
shortcut_set: default_shortcut_set(),
|
||||
workspace: default_workspace(),
|
||||
touch_workspace_restore: None,
|
||||
|
||||
+30
-2
@@ -6330,6 +6330,33 @@ page describes saving the list from the Keyboard Shortcuts dialog as a text file
|
||||
{"name":"run_command","arguments":{"command":"shortcuts.exportText","params":{"path":"/Users/me/Shortcuts.txt"}}}
|
||||
```
|
||||
|
||||
A tool or command can also have a hold shortcut: a key that types a character (a letter, a digit or a punctuation
|
||||
key), alone or with Shift. Space and the backtick key cannot be hold shortcuts, and neither can a key with Cmd, Ctrl or
|
||||
Alt. Hold shortcuts act only while the preference `holdShortcuts` is on; it is off by default, and Edit › Keyboard
|
||||
Shortcuts shows it as the Hold Shortcuts checkbox, with a ? button that explains it. While it is off, the dialog shows
|
||||
no Hold column and every key runs on its press. While it is on, the dialog shows a Hold column and the Hold Shortcut
|
||||
Delay (`keyHoldDelay`, 0.2 to 1.0 s, 0.35 s by default; VectorCraft's own values). Preferences › General › Options
|
||||
lists both settings too, with Hold Shortcut Delay dimmed while Hold Shortcuts is off. A key with a hold shortcut then
|
||||
waits when it goes down: held for the delay, it runs its hold shortcut once and its repeats are ignored until it is let
|
||||
go; let go sooner, it runs what the key runs without a hold shortcut, at the release. Another key pressed while one
|
||||
waits, or Cmd, Ctrl or Alt pressed then, ends the wait first, so keys act in the order they went down. The window losing
|
||||
the keyboard, a dialog, a text field, Presentation Mode or an input method composition ends the wait and runs nothing.
|
||||
Keys without a hold shortcut run on their press as before, and so does a letter with Shift when only the letter alone
|
||||
has a hold shortcut, or a key the active tool uses itself (E with the Extend Path tool).
|
||||
|
||||
`shortcuts.set {id, hold}` sets a hold shortcut, and `hold: ""` or `null` removes it; `hold` alone leaves the entry's
|
||||
shortcut as it is, and a key that another entry already holds is refused unless `force` is true. Hold shortcuts are
|
||||
kept apart from shortcuts: Use Default, Clear and `shortcut: null` leave them, and `overridden` in `shortcuts.list` is
|
||||
about the shortcut only. `shortcuts.list` rows give the hold shortcut as `hold`, `shortcuts.conflicts` lists a key two
|
||||
entries hold as `"Hold X"`, and Reset to Defaults and a preset remove every hold shortcut. `shortcuts.export` writes
|
||||
them as a `holds` object (entry id to key) when there are any, and `shortcuts.import` reads it; a file without `holds`
|
||||
has none, and a `holds` value that is not a usable hold shortcut fails the import, which then changes nothing.
|
||||
`shortcuts.exportText` adds a third `Hold X` column to a row with a hold shortcut while `holdShortcuts` is on.
|
||||
|
||||
```json
|
||||
{"name":"run_command","arguments":{"command":"shortcuts.set","params":{"id":"paint.swap","hold":"X"}}}
|
||||
```
|
||||
|
||||
The desktop app adds its active artboard, the one the Artboards panel highlights, to the `object.align`,
|
||||
`object.distribute`, `object.distributeSpacing` and `select.allOnArtboard` calls it runs without `artboard`, as it does
|
||||
for `edit.pasteInPlace`, `edit.pasteInFront` and `edit.pasteInBack` (while the Artboard tool has several artboards
|
||||
@@ -6556,8 +6583,9 @@ interface and not the art: a zoom shows the art at the same size at every UI Sca
|
||||
preference `holdToolKeys` also needs the desktop app. It is on by default: a single-key tool shortcut held for 0.25 s
|
||||
or more, or held while its tool is used, chooses the tool until the key is let go and then returns to the tool active
|
||||
before, after any drag in progress; a quicker press chooses the tool for good. With it off, every press and every key
|
||||
repeat chooses the tool. The canvas preference `boundingBoxWhileMovingAndDrawing` (off by default) also needs the
|
||||
desktop app: on, with View › Show Bounding Box, the bounding box and its handles stay visible while a drag moves the
|
||||
repeat chooses the tool. While `holdShortcuts` is on, a tool key that also has a hold shortcut runs the hold shortcut
|
||||
when held, and a quick press chooses its tool for good. The canvas preference `boundingBoxWhileMovingAndDrawing` (off
|
||||
by default) also needs the desktop app: on, with View › Show Bounding Box, the bounding box and its handles stay visible while a drag moves the
|
||||
selection, and the Rectangle, Rounded Rectangle, Ellipse, Polygon and Star tools draw the box around the shape being
|
||||
drawn; off, the box hides during both, except that a Selection tool move with `realTimeDrawing` off still moves the
|
||||
box. `highlightAlternateGlyphs` (off by default: on, the canvas paints a pink cell behind glyphs OpenType features
|
||||
|
||||
@@ -1233,6 +1233,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
|
||||
A Space+Shift drag rotates the view whatever the tool, as a Rotate View tool drag does, and Shift does not round the angle to 15°.
|
||||
While the Type tool edits text, Space types a space: held, it does not show the hand, pan or rotate the view, and Cmd+Space still zooms ([the help page](https://web.archive.org/web/20260726060015/https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html) lists the Spacebar as the Hand tool when not in text-edit mode). Test: `canvas::tests::space_types_a_space_while_editing_text_and_does_not_pan`.
|
||||
As VectorCraft's own rule, a zoom marquee that Cmd+Space starts while the Type tool edits text keeps the marquee's Space rules after Cmd is let go: Space held since the press sizes it, Space pressed again moves it ([the help page](https://helpx.adobe.com/illustrator/using/viewing-artwork.html) describes holding the spacebar to move the marquee), and that Space types no space, nor does it during an animated zoom drag. With no zoom drag, Space types a space. Test: `canvas::tests::space_moves_a_text_edit_zoom_marquee_after_cmd_is_let_go`.
|
||||
- **Hold shortcuts:** Edit › Keyboard Shortcuts › Hold Shortcuts (off by default, `holdShortcuts`) shows a Hold column, where a tool or command gets a letter, digit or punctuation key, alone or with Shift. Holding that key for the Hold Shortcut Delay (`keyHoldDelay`, 0.35 s, 0.2 to 1.0 s) runs it once; a quicker press runs what the key runs without one, at the release (`shortcuts.set {id, hold}`). On a tool key, the hold shortcut takes precedence over Hold a Tool Shortcut to Use the Tool Temporarily. This is VectorCraft's own feature and its own delay. Tests `shortcuts::hold_keys::tests` and `shortcut_editor::tests::{a_hold_shortcut_is_kept_apart_from_the_shortcut, hold_shortcuts_refuse_keys_that_cannot_wait, the_hold_shortcuts_checkbox_shows_the_hold_column}`.
|
||||
- **Swatches panel clicks:** Ctrl/Cmd-clicking New Swatch makes a spot color, and Ctrl/Cmd+Shift-clicking it makes a global process color.
|
||||
- **Panel drag and drop:** art dragged off the canvas onto the Symbols panel becomes a symbol, art dragged onto the Swatches panel becomes a pattern swatch, and art dropped on the Brushes panel opens New Brush for that art; a symbol dragged onto the canvas places an instance where it is dropped, and a brush dragged onto a path is applied to it.
|
||||
New Brush asks for the type of brush first, as the [Brushes](https://web.archive.org/web/20241230205225/https://helpx.adobe.com/illustrator/using/brushes.html) page (archived copy) describes. The Brushes panel's New Brush button, its menu's New Brush… and art dropped on the panel open the New Brush dialog, where Scatter Brush, Art Brush and Pattern Brush need selected or dropped art. OK opens that type's Brush Options for the new brush, and their OK makes the brush with the name and options set; Cancel in either dialog adds no brush (`ui.newBrush`). The menu's New Calligraphic Brush, New Bristle Brush and New Art, Scatter and Pattern Brush from Selection items still make a brush at once.
|
||||
|
||||
Reference in new issue
Block a user