From 44f75df965ca5b57561175c7de6390e795042b5c Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sun, 15 Nov 2026 10:22:38 -0800 Subject: [PATCH] Command Palette: lists commands that run from a pick, plus panels and effects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The palette leaves out the engine commands that Edit › Keyboard Shortcuts marks as needing a value (`needs_a_value`): a query with no default key and no menu bar item, whose answer a pick drops (Document JSON, Select All Unused in the Brushes panel), and a command that needs a value no menu item gives (`transparency.set`, Document Setup's units). Of those commands, the ones whose pick does something without params stay listed: Stop Script, Clear Script Console, Clear Plug-in Cache, Reset Preferences, Forget Import Matches, Begin Undo Group and End Undo Group, the six Save … Preset commands, Delete Gradient Preset, Pixel Snapping Options…, the three Asset Export commands that open the Asset Export panel, New Symbol, Gradient Vector, Define Perspective Grid and Select Slice. That leaves out 296 of the 1,006 engine commands it listed. The UI commands it listed stay as they were. Each panel is a result under Window › Show Panel: a pick shows the panel and leaves one already showing as it is. Each Effect menu item is a result, named as the menu names it, whose pick runs what its menu item runs; while the item is dimmed, no dialog opens and the status line says why. Results whose name without its menu path is the whole query come first, so "layers" shows the Layers panel among the 14 results. The search hint and the app bar's search tooltip say "Search commands, tools, panels and effects", in every catalog. --- crates/ui-egui/src/chrome.rs | 4 +- crates/ui-egui/src/i18n/bg.tsv | 4 +- crates/ui-egui/src/i18n/bs.tsv | 4 +- crates/ui-egui/src/i18n/ca.tsv | 4 +- crates/ui-egui/src/i18n/cs.tsv | 4 +- crates/ui-egui/src/i18n/da.tsv | 4 +- crates/ui-egui/src/i18n/de.tsv | 4 +- crates/ui-egui/src/i18n/el.tsv | 4 +- crates/ui-egui/src/i18n/es.tsv | 4 +- crates/ui-egui/src/i18n/fi.tsv | 4 +- crates/ui-egui/src/i18n/fr.tsv | 4 +- crates/ui-egui/src/i18n/gu.tsv | 4 +- crates/ui-egui/src/i18n/hi.tsv | 4 +- crates/ui-egui/src/i18n/hu.tsv | 4 +- crates/ui-egui/src/i18n/id.tsv | 4 +- crates/ui-egui/src/i18n/it.tsv | 4 +- crates/ui-egui/src/i18n/ja.tsv | 4 +- crates/ui-egui/src/i18n/ka.tsv | 4 +- crates/ui-egui/src/i18n/ko.tsv | 4 +- crates/ui-egui/src/i18n/nl.tsv | 4 +- crates/ui-egui/src/i18n/pl.tsv | 4 +- crates/ui-egui/src/i18n/pt-br.tsv | 4 +- crates/ui-egui/src/i18n/ru.tsv | 4 +- crates/ui-egui/src/i18n/sv.tsv | 4 +- crates/ui-egui/src/i18n/tr.tsv | 4 +- crates/ui-egui/src/i18n/uk.tsv | 4 +- crates/ui-egui/src/i18n/vi.tsv | 4 +- crates/ui-egui/src/i18n/zh-hans.tsv | 4 +- crates/ui-egui/src/i18n/zh-hant.tsv | 4 +- crates/ui-egui/src/palette.rs | 384 +++++++++++++++++++++-- crates/ui-egui/src/panels/learn/tests.rs | 2 +- crates/ui-egui/src/shortcut_editor.rs | 16 +- crates/ui-egui/src/tests/save.rs | 6 +- crates/ui-egui/src/titlebar.rs | 2 +- docs/target-app-parity.md | 3 +- 35 files changed, 432 insertions(+), 97 deletions(-) diff --git a/crates/ui-egui/src/chrome.rs b/crates/ui-egui/src/chrome.rs index a6b7b11714..b31228b682 100644 --- a/crates/ui-egui/src/chrome.rs +++ b/crates/ui-egui/src/chrome.rs @@ -133,8 +133,8 @@ pub fn app_bar(app: &mut VectorcraftApp, ui: &mut Ui) { // Search → command palette (its shortcut opens it too). if search { let tip = match menus::shortcut_of("help.commandPalette") { - Some(sc) => format!("{} ({})", tl!("Search commands and tools"), menus::shown_shortcut(sc)), - None => tl!("Search commands and tools").to_string(), + Some(sc) => format!("{} ({})", tl!("Search commands, tools, panels and effects"), menus::shown_shortcut(sc)), + None => tl!("Search commands, tools, panels and effects").to_string(), }; if widgets::icon_button(ui, "search", &tip, app.ui.palette_open, icon).clicked() { app.ui.palette_open = !app.ui.palette_open; diff --git a/crates/ui-egui/src/i18n/bg.tsv b/crates/ui-egui/src/i18n/bg.tsv index 7812216da8..bf6da4e273 100644 --- a/crates/ui-egui/src/i18n/bg.tsv +++ b/crates/ui-egui/src/i18n/bg.tsv @@ -3144,8 +3144,8 @@ digits Malayalam Малаялам Scripts Скриптове Search Търсене Search All Търсене във всички - Search commands and tools Търсене на команди и инструменти - Search commands and tools… Търсене на команди и инструменти… + Search commands, tools, panels and effects Търсене на команди, инструменти, панели и ефекти + Search commands, tools, panels and effects… Търсене на команди, инструменти, панели и ефекти… Search Commands… Търсене на команди… Secondary Вторичен Section Symbol Символ за раздел diff --git a/crates/ui-egui/src/i18n/bs.tsv b/crates/ui-egui/src/i18n/bs.tsv index 2fb70385ff..5759e754c8 100644 --- a/crates/ui-egui/src/i18n/bs.tsv +++ b/crates/ui-egui/src/i18n/bs.tsv @@ -1283,7 +1283,7 @@ lighting Light Svjetlo Name* @ 66.67% (RGB/Preview) Naziv* @ 66,67% (RGB/pregled) No Document Nema dokumenta Press Pritisnite - Search commands and tools Pretraži naredbe i alate + Search commands, tools, panels and effects Pretraži naredbe, alate, panele i efekte Style: Stil: Switch workspace Promijeni radni prostor Show all open documents Prikaži sve otvorene dokumente @@ -4333,7 +4333,7 @@ font-technology Variable Varijabilni Saved {path} Sačuvano: {path} Saving Čuvanje Saving {} Čuvanje {} - Search commands and tools… Pretraži naredbe i alate… + Search commands, tools, panels and effects… Pretraži naredbe, alate, panele i efekte… Dashed Line Isprekidana linija Panel menu Meni panela Unembed… Poništi ugrađivanje… diff --git a/crates/ui-egui/src/i18n/ca.tsv b/crates/ui-egui/src/i18n/ca.tsv index 193ca8a7d1..8a0a0537e5 100644 --- a/crates/ui-egui/src/i18n/ca.tsv +++ b/crates/ui-egui/src/i18n/ca.tsv @@ -4053,8 +4053,8 @@ digits Malayalam Malaiàlam Scrub Numeric Fields by Dragging Canvia els camps numèrics arrossegant Search Cerca Search All Cerca a tot - Search commands and tools Cerca ordres i eines - Search commands and tools… Cerca ordres i eines… + Search commands, tools, panels and effects Cerca ordres, eines, panells i efectes + Search commands, tools, panels and effects… Cerca ordres, eines, panells i efectes… Search Commands… Cerca ordres… Search Fonts Folder Cerca a la carpeta de tipus de lletra Searching… Cercant… diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv index 75f527f782..16219dd4ae 100644 --- a/crates/ui-egui/src/i18n/cs.tsv +++ b/crates/ui-egui/src/i18n/cs.tsv @@ -1307,7 +1307,7 @@ lighting Light Světlo Name* @ 66.67% (RGB/Preview) Název* @ 66,67 % (RGB/náhled) No Document Žádný dokument Press Klávesou - Search commands and tools Hledat příkazy a nástroje + Search commands, tools, panels and effects Hledat příkazy, nástroje, panely a efekty Style: Styl: Switch workspace Přepnout pracovní prostor Show all open documents Zobrazit všechny otevřené dokumenty @@ -4431,7 +4431,7 @@ font-technology Variable Variabilní Saved {path} Uloženo: {path} Saving Ukládání Saving {} Ukládání {} - Search commands and tools… Hledat příkazy a nástroje… + Search commands, tools, panels and effects… Hledat příkazy, nástroje, panely a efekty… Dashed Line Čárkovaná čára Panel menu Nabídka panelu Unembed… Zrušit vložení… diff --git a/crates/ui-egui/src/i18n/da.tsv b/crates/ui-egui/src/i18n/da.tsv index e13c1f9ae7..b585dafc5b 100644 --- a/crates/ui-egui/src/i18n/da.tsv +++ b/crates/ui-egui/src/i18n/da.tsv @@ -1828,7 +1828,7 @@ lighting Light Lys Name* @ 66.67% (RGB/Preview) Navn* @ 66.67% (RGB/forhåndsvisning) No Document Intet dokument Press Tryk på - Search commands and tools Søg i kommandoer og værktøjer + Search commands, tools, panels and effects Søg i kommandoer, værktøjer, paneler og effekter Style: Typografi: Switch workspace Skift arbejdsområde Show all open documents Vis alle åbne dokumenter @@ -4749,7 +4749,7 @@ font-technology Variable Variable Saved {path} Gemte {path} Saving Gemmer Saving {} Gemmer {} - Search commands and tools… Søg i kommandoer og værktøjer… + Search commands, tools, panels and effects… Søg i kommandoer, værktøjer, paneler og effekter… Dashed Line Stiplet linje Panel menu Panelmenu Unembed… Ophæv integrering… diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv index 68da6f84ba..4c854815c5 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -3203,8 +3203,8 @@ digits Malayalam Malayalam Filter Layers Panel Rows Zeilen im Ebenenbedienfeld filtern @msg `Custom` stands for changed settings: save the preset under another name `Custom` steht für geänderte Einstellungen: Speichern Sie die Vorgabe unter einem anderen Namen @msg `{key}` must be an array of these names: {_1} `{key}` muss ein Array mit diesen Namen sein: {_1} - Search commands and tools Befehle und Werkzeuge suchen - Search commands and tools… Befehle und Werkzeuge suchen… + Search commands, tools, panels and effects Befehle, Werkzeuge, Bedienfelder und Effekte suchen + Search commands, tools, panels and effects… Befehle, Werkzeuge, Bedienfelder und Effekte suchen… Search Commands… Befehle suchen… Secondary Sekundär Section Symbol Paragrafenzeichen diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv index 551130c700..84724a9030 100644 --- a/crates/ui-egui/src/i18n/el.tsv +++ b/crates/ui-egui/src/i18n/el.tsv @@ -3827,8 +3827,8 @@ digits Malayalam Μαλαγιάλαμ Scribble… Μουτζούρωμα… Script / Brush Σενάριο / Πινέλο Search All Αναζήτηση όλων - Search commands and tools Αναζήτηση εντολών και εργαλείων - Search commands and tools… Αναζήτηση εντολών και εργαλείων… + Search commands, tools, panels and effects Αναζήτηση εντολών, εργαλείων, πλαισίων και εφέ + Search commands, tools, panels and effects… Αναζήτηση εντολών, εργαλείων, πλαισίων και εφέ… Search Commands… Αναζήτηση εντολών… Secondary Δευτερεύον Section Symbol Σύμβολο ενότητας diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv index ddbbfce02e..50f8986525 100644 --- a/crates/ui-egui/src/i18n/es.tsv +++ b/crates/ui-egui/src/i18n/es.tsv @@ -3235,8 +3235,8 @@ digits Malayalam Malayálam Filter Layers Panel Rows Filtrar filas del panel Capas @msg `Custom` stands for changed settings: save the preset under another name `Custom` representa ajustes modificados: guarda el preajuste con otro nombre @msg `{key}` must be an array of these names: {_1} `{key}` debe ser una lista de estos nombres: {_1} - Search commands and tools Buscar comandos y herramientas - Search commands and tools… Buscar comandos y herramientas… + Search commands, tools, panels and effects Buscar comandos, herramientas, paneles y efectos + Search commands, tools, panels and effects… Buscar comandos, herramientas, paneles y efectos… Search Commands… Buscar comandos… Secondary Secundario Section Symbol Símbolo de sección diff --git a/crates/ui-egui/src/i18n/fi.tsv b/crates/ui-egui/src/i18n/fi.tsv index 5915b6a69e..76fcb80388 100644 --- a/crates/ui-egui/src/i18n/fi.tsv +++ b/crates/ui-egui/src/i18n/fi.tsv @@ -1285,7 +1285,7 @@ lighting Light Valo Name* @ 66.67% (RGB/Preview) Nimi* @ 66.67% (RGB/esikatselu) No Document Ei asiakirjaa Press Paina - Search commands and tools Hae komentoja ja työkaluja + Search commands, tools, panels and effects Hae komentoja, työkaluja, paneeleita ja tehosteita Style: Tyyli: Switch workspace Vaihda työtilaa Show all open documents Näytä kaikki avoimet asiakirjat @@ -4350,7 +4350,7 @@ font-technology Variable Muuttuvat Saved {path} Tallennettu {path} Saving Tallennetaan Saving {} Tallennetaan {} - Search commands and tools… Hae komentoja ja työkaluja… + Search commands, tools, panels and effects… Hae komentoja, työkaluja, paneeleita ja tehosteita… Dashed Line Katkoviiva Panel menu Paneelivalikko Unembed… Poista upotus… diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index 5778a21665..b32d1971d0 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -3227,8 +3227,8 @@ digits Malayalam Malayalam Filter Layers Panel Rows Filtrer les lignes du panneau Calques @msg `Custom` stands for changed settings: save the preset under another name `Custom` désigne des réglages modifiés : enregistrez le paramètre prédéfini sous un autre nom @msg `{key}` must be an array of these names: {_1} `{key}` doit être un tableau de noms parmi {_1} - Search commands and tools Chercher commandes et outils - Search commands and tools… Chercher commandes et outils… + Search commands, tools, panels and effects Chercher commandes, outils, panneaux et effets + Search commands, tools, panels and effects… Chercher commandes, outils, panneaux et effets… Search Commands… Rechercher des commandes… Secondary Secondaire Section Symbol Symbole de section diff --git a/crates/ui-egui/src/i18n/gu.tsv b/crates/ui-egui/src/i18n/gu.tsv index 31548e1933..4ba32d4079 100644 --- a/crates/ui-egui/src/i18n/gu.tsv +++ b/crates/ui-egui/src/i18n/gu.tsv @@ -3330,8 +3330,8 @@ Search Commands… આદેશો શોધો… Search Fonts Folder ફોન્ટ ફોલ્ડર શોધો Search Preferences પસંદગીઓ શોધો - Search commands and tools આદેશો અને ટૂલ્સ શોધો - Search commands and tools… આદેશો અને ટૂલ્સ શોધો… + Search commands, tools, panels and effects આદેશો, ટૂલ્સ, પેનલ્સ અને ઇફેક્ટ્સ શોધો + Search commands, tools, panels and effects… આદેશો, ટૂલ્સ, પેનલ્સ અને ઇફેક્ટ્સ શોધો… Search images છબીઓ શોધો Searching… શોધી રહ્યા છીએ… Secondary ગૌણ diff --git a/crates/ui-egui/src/i18n/hi.tsv b/crates/ui-egui/src/i18n/hi.tsv index bcaa573d47..e7795f6357 100644 --- a/crates/ui-egui/src/i18n/hi.tsv +++ b/crates/ui-egui/src/i18n/hi.tsv @@ -4409,8 +4409,8 @@ antiAlias Sharp शार्प Search खोजें Search All सभी खोजें Search artboards खोज आर्टबोर्ड - Search commands and tools खोज आदेश और टूल - Search commands and tools… आदेश और टूल खोजें… + Search commands, tools, panels and effects आदेश, टूल, पैनल्स और इफ़ेक्ट्स खोजें + Search commands, tools, panels and effects… आदेश, टूल, पैनल्स और इफ़ेक्ट्स खोजें… Search Commands… कमांड खोजें… Search Fonts Folder खोज फ़ॉन्ट फ़ोल्डर Search images इमेज खोजना diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv index 8a2e0b3b9a..a66040d716 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -3847,8 +3847,8 @@ mark-style Japanese Japán Filter Layers Panel Rows Rétegek panel sorainak szűrése @msg `Custom` stands for changed settings: save the preset under another name a `Custom` a módosított beállításokat jelöli: mentsd az előbeállítást más néven @msg `{key}` must be an array of these names: {_1} `{key}`: ezen nevek tömbje kell: {_1} - Search commands and tools Parancsok és eszközök keresése - Search commands and tools… Parancsok és eszközök keresése… + Search commands, tools, panels and effects Parancsok, eszközök, panelek és effektusok keresése + Search commands, tools, panels and effects… Parancsok, eszközök, panelek és effektusok keresése… Search Commands… Parancsok keresése… Search Fonts Folder Keresés betűtípusmappában Searching… Keresés… diff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsv index 712148180d..b645dee4f4 100644 --- a/crates/ui-egui/src/i18n/id.tsv +++ b/crates/ui-egui/src/i18n/id.tsv @@ -1218,7 +1218,7 @@ lighting Light Cahaya Name* @ 66.67% (RGB/Preview) Nama* @ 66.67% (RGB/Pratinjau) No Document Tidak ada dokumen Press Tekan - Search commands and tools Cari perintah dan alat + Search commands, tools, panels and effects Cari perintah, alat, panel, dan efek Style: Gaya: Switch workspace Ganti ruang kerja Show all open documents Tampilkan semua dokumen terbuka @@ -4097,7 +4097,7 @@ font-technology Variable Variabel Saved {path} Berhasil menyimpan {path} Saving Menyimpan Saving {} Menyimpan {} - Search commands and tools… Cari perintah dan alat… + Search commands, tools, panels and effects… Cari perintah, alat, panel, dan efek… Dashed Line Garis putus-putus Panel menu Menu panel Unembed… Lepaskan sematan… diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv index 1d2e05bfb0..a1868a196a 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -3280,8 +3280,8 @@ digits Malayalam Malayalam Filter Layers Panel Rows Filtra righe del pannello Livelli @msg `Custom` stands for changed settings: save the preset under another name `Custom` indica impostazioni modificate: salva il preset con un altro nome @msg `{key}` must be an array of these names: {_1} `{key}` deve essere un array di questi nomi: {_1} - Search commands and tools Cerca comandi e strumenti - Search commands and tools… Cerca comandi e strumenti… + Search commands, tools, panels and effects Cerca comandi, strumenti, pannelli ed effetti + Search commands, tools, panels and effects… Cerca comandi, strumenti, pannelli ed effetti… Search Commands… Cerca comandi… Secondary Secondario Section Symbol Simbolo di sezione diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv index cdf8b04d3c..85236cf789 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -3158,8 +3158,8 @@ mark-style Japanese 日本式 Filter Layers Panel Rows レイヤーパネルの行をフィルター @msg `Custom` stands for changed settings: save the preset under another name `Custom` は変更した設定を表します: プリセットを別の名前で保存してください @msg `{key}` must be an array of these names: {_1} `{key}` には {_1} の中の名前の配列を指定してください - Search commands and tools コマンドとツールを検索 - Search commands and tools… コマンドとツールを検索… + Search commands, tools, panels and effects コマンド、ツール、パネル、効果を検索 + Search commands, tools, panels and effects… コマンド、ツール、パネル、効果を検索… Secondary セカンダリ Select All Art on Layer レイヤー上のすべてのアートを選択 Select All Assets すべてのアセットを選択 diff --git a/crates/ui-egui/src/i18n/ka.tsv b/crates/ui-egui/src/i18n/ka.tsv index a7b771b8b5..c7c8545e6a 100644 --- a/crates/ui-egui/src/i18n/ka.tsv +++ b/crates/ui-egui/src/i18n/ka.tsv @@ -1175,7 +1175,7 @@ lighting Light სინათლე Name* @ 66.67% (RGB/Preview) სახელი* @ 66.67% (RGB/წინასწარი ნახვა) No Document დოკუმენტი არ არის Press დააჭირეთ - Search commands and tools ბრძანებებისა და ხელსაწყოების ძიება + Search commands, tools, panels and effects ბრძანებების, ხელსაწყოების, პანელებისა და ეფექტების ძიება Style: სტილი: Switch workspace სამუშაო სივრცის გადართვა Show all open documents ყველა ღია დოკუმენტის ჩვენება @@ -3957,7 +3957,7 @@ font-technology Variable ცვლადი Saved {path} შენახულია: {path} Saving შენახვა Saving {} ინახება: {} - Search commands and tools… ბრძანებებისა და ხელსაწყოების ძიება… + Search commands, tools, panels and effects… ბრძანებების, ხელსაწყოების, პანელებისა და ეფექტების ძიება… Dashed Line ტირეებიანი ხაზი Panel menu პანელის მენიუ Unembed… ჩაშენების მოხსნა… diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv index 2751e06e14..a988b15a49 100644 --- a/crates/ui-egui/src/i18n/ko.tsv +++ b/crates/ui-egui/src/i18n/ko.tsv @@ -3147,8 +3147,8 @@ mark-style Japanese 일본식 Filter Layers Panel Rows 레이어 패널 행 필터링 @msg `Custom` stands for changed settings: save the preset under another name `Custom`은 변경된 설정을 나타냅니다. 프리셋을 다른 이름으로 저장하세요 @msg `{key}` must be an array of these names: {_1} `{key}`은(는) 다음 이름의 배열이어야 합니다: {_1} - Search commands and tools 명령 및 도구 검색 - Search commands and tools… 명령 및 도구 검색… + Search commands, tools, panels and effects 명령, 도구, 패널 및 효과 검색 + Search commands, tools, panels and effects… 명령, 도구, 패널 및 효과 검색… Secondary 보조 Select All Art on Layer 레이어의 모든 아트웍 선택 Select All Assets 모든 에셋 선택 diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv index 51f87bb262..fe1110957f 100644 --- a/crates/ui-egui/src/i18n/nl.tsv +++ b/crates/ui-egui/src/i18n/nl.tsv @@ -1736,7 +1736,7 @@ lighting Light Licht Name* @ 66.67% (RGB/Preview) Naam* @ 66.67% (RGB/Voorbeeld) No Document Geen document Press Druk op - Search commands and tools Opdrachten en gereedschappen zoeken + Search commands, tools, panels and effects Opdrachten, gereedschappen, panelen en effecten zoeken Style: Stijl: Switch workspace Werkruimte wisselen Show all open documents Alle geopende documenten tonen @@ -4657,7 +4657,7 @@ font-technology Variable Variabel Saved {path} {path} opgeslagen Saving Bezig met opslaan Saving {} {} wordt opgeslagen - Search commands and tools… Opdrachten en gereedschappen zoeken… + Search commands, tools, panels and effects… Opdrachten, gereedschappen, panelen en effecten zoeken… Dashed Line Streepjeslijn Panel menu Paneelmenu Unembed… Insluiten ongedaan maken… diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv index 93969d2bc3..ca1959dcd0 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -1237,7 +1237,7 @@ lighting Light Światło Name* @ 66.67% (RGB/Preview) Nazwa* @ 66,67% (RGB/Podgląd) No Document Brak dokumentu Press Naciśnij - Search commands and tools Szukaj poleceń i narzędzi + Search commands, tools, panels and effects Szukaj poleceń, narzędzi, paneli i efektów Style: Styl: Switch workspace Przełącz obszar roboczy Show all open documents Pokaż wszystkie otwarte dokumenty @@ -4272,7 +4272,7 @@ font-technology Variable Zmienne Saved {path} Zapisano {path} Saving Zapisywanie Saving {} Zapisywanie {} - Search commands and tools… Szukaj poleceń i narzędzi… + Search commands, tools, panels and effects… Szukaj poleceń, narzędzi, paneli i efektów… Dashed Line Linia przerywana Panel menu Menu panelu Unembed… Wyodrębnij… diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv index ad9df40e5a..65257dd8f7 100644 --- a/crates/ui-egui/src/i18n/pt-br.tsv +++ b/crates/ui-egui/src/i18n/pt-br.tsv @@ -2697,8 +2697,8 @@ digits Malayalam Malaiala @msg `Custom` stands for changed settings: save the preset under another name `Custom` representa configurações alteradas: salve a predefinição com outro nome @msg `{key}` must be an array of these names: {_1} `{key}` deve ser uma matriz destes nomes: {_1} Search Commands… Pesquisar Comandos… - Search commands and tools Pesquisar comandos e ferramentas - Search commands and tools… Pesquisar comandos e ferramentas… + Search commands, tools, panels and effects Pesquisar comandos, ferramentas, painéis e efeitos + Search commands, tools, panels and effects… Pesquisar comandos, ferramentas, painéis e efeitos… Secondary Secundária Section Symbol Símbolo de Seção Select Selecionar diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv index 073b662e3f..523b90ce41 100644 --- a/crates/ui-egui/src/i18n/ru.tsv +++ b/crates/ui-egui/src/i18n/ru.tsv @@ -3267,8 +3267,8 @@ digits Malayalam Малаялам Filter Layers Panel Rows Фильтровать строки панели «Слои» @msg `Custom` stands for changed settings: save the preset under another name `Custom` обозначает изменённые параметры: сохраните набор под другим именем @msg `{key}` must be an array of these names: {_1} `{key}` должно быть массивом из этих имён: {_1} - Search commands and tools Поиск команд и инструментов - Search commands and tools… Поиск команд и инструментов… + Search commands, tools, panels and effects Поиск команд, инструментов, панелей и эффектов + Search commands, tools, panels and effects… Поиск команд, инструментов, панелей и эффектов… Search Commands… Поиск команд… Secondary Вторичный Section Symbol Символ параграфа diff --git a/crates/ui-egui/src/i18n/sv.tsv b/crates/ui-egui/src/i18n/sv.tsv index c2a7e589f2..df06cdaded 100644 --- a/crates/ui-egui/src/i18n/sv.tsv +++ b/crates/ui-egui/src/i18n/sv.tsv @@ -3159,8 +3159,8 @@ digits Malayalam Malayalam Scripts Skript Search Sök Search All Sök i alla - Search commands and tools Sök kommandon och verktyg - Search commands and tools… Sök kommandon och verktyg… + Search commands, tools, panels and effects Sök kommandon, verktyg, paneler och effekter + Search commands, tools, panels and effects… Sök kommandon, verktyg, paneler och effekter… Search Commands… Sök kommandon… Secondary Sekundär Section Symbol Paragraftecken diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv index 4ee1ba27c9..ffabf3cbe8 100644 --- a/crates/ui-egui/src/i18n/tr.tsv +++ b/crates/ui-egui/src/i18n/tr.tsv @@ -3036,8 +3036,8 @@ digits Malayalam Malayalam Redefine {name} “{name}” Stilini Yeniden Tanımla @msg `Custom` stands for changed settings: save the preset under another name `Custom` değiştirilmiş ayarları ifade eder: ön ayarı başka bir adla kaydedin @msg `{key}` must be an array of these names: {_1} `{key}` şu adlardan oluşan bir dizi olmalıdır: {_1} - Search commands and tools Komutları ve araçları arayın - Search commands and tools… Komutları ve araçları arayın… + Search commands, tools, panels and effects Komutları, araçları, panelleri ve efektleri arayın + Search commands, tools, panels and effects… Komutları, araçları, panelleri ve efektleri arayın… Search Commands… Arama Komutları… Secondary İkincil Section Symbol Bölüm Sembolü diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv index 95a5066abb..4353c39f14 100644 --- a/crates/ui-egui/src/i18n/uk.tsv +++ b/crates/ui-egui/src/i18n/uk.tsv @@ -3272,8 +3272,8 @@ digits Malayalam Малаялам Filter Layers Panel Rows Фільтрувати рядки панелі «Шари» @msg `Custom` stands for changed settings: save the preset under another name `Custom` позначає змінені параметри: збережіть набір під іншим ім’ям @msg `{key}` must be an array of these names: {_1} `{key}` має бути масивом цих назв: {_1} - Search commands and tools Пошук команд та інструментів - Search commands and tools… Пошук команд та інструментів… + Search commands, tools, panels and effects Пошук команд, інструментів, панелей та ефектів + Search commands, tools, panels and effects… Пошук команд, інструментів, панелей та ефектів… Search Commands… Пошук команд… Secondary Вторинний Section Symbol Символ параграфа diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv index 21d20f0157..3fe9e73c10 100644 --- a/crates/ui-egui/src/i18n/vi.tsv +++ b/crates/ui-egui/src/i18n/vi.tsv @@ -3604,8 +3604,8 @@ mark-style Japanese Kiểu Nhật Filter Layers Panel Rows Lọc hàng bảng Lớp @msg `Custom` stands for changed settings: save the preset under another name `Custom` biểu thị các cài đặt đã thay đổi: hãy lưu thiết lập sẵn với tên khác @msg `{key}` must be an array of these names: {_1} `{key}` phải là một mảng gồm các tên sau: {_1} - Search commands and tools Tìm kiếm lệnh và công cụ - Search commands and tools… Tìm kiếm lệnh và công cụ… + Search commands, tools, panels and effects Tìm kiếm lệnh, công cụ, bảng và hiệu ứng + Search commands, tools, panels and effects… Tìm kiếm lệnh, công cụ, bảng và hiệu ứng… Search Commands… Tìm kiếm lệnh… Search Fonts Folder Tìm kiếm thư mục phông chữ Searching… Đang tìm kiếm… diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv index 5c0570781d..1b7440e3f1 100644 --- a/crates/ui-egui/src/i18n/zh-hans.tsv +++ b/crates/ui-egui/src/i18n/zh-hans.tsv @@ -3099,8 +3099,8 @@ digits Malayalam 马拉雅拉姆数字 Locked 已锁定 Hidden 已隐藏 Filter Layers Panel Rows 筛选图层面板行 - Search commands and tools 搜索命令和工具 - Search commands and tools… 搜索命令和工具… + Search commands, tools, panels and effects 搜索命令、工具、面板和效果 + Search commands, tools, panels and effects… 搜索命令、工具、面板和效果… Search Commands… 搜索命令… Secondary 次要 Section Symbol 章节符号 diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv index 5de2e008bd..9e0659105b 100644 --- a/crates/ui-egui/src/i18n/zh-hant.tsv +++ b/crates/ui-egui/src/i18n/zh-hant.tsv @@ -4355,8 +4355,8 @@ digits Malayalam 馬來亞拉姆數字 Locked 已鎖定 Hidden 已隱藏 Filter Layers Panel Rows 篩選圖層面板列 - Search commands and tools 搜尋指令與工具 - Search commands and tools… 搜尋指令與工具… + Search commands, tools, panels and effects 搜尋指令、工具、面板與效果 + Search commands, tools, panels and effects… 搜尋指令、工具、面板與效果… Search Commands… 搜尋指令… Secondary 次要 Section Symbol 章節符號 diff --git a/crates/ui-egui/src/palette.rs b/crates/ui-egui/src/palette.rs index 0bb8f6f955..7c684a8026 100644 --- a/crates/ui-egui/src/palette.rs +++ b/crates/ui-egui/src/palette.rs @@ -1,4 +1,5 @@ -//! The command palette: fuzzy search over every command and tool. +//! The command palette: fuzzy search over the commands a pick runs, the tools, the panels and the +//! Effect menu's items. use std::sync::Arc; @@ -28,19 +29,54 @@ const WRAPPED: &[(&str, &str)] = &[ ("brush.loadLibrary", "window.brushLibrary.other"), ]; +/// Engine commands that [`crate::shortcut_editor::needs_a_value`] marks and that a pick, which +/// gives no params, still runs: Stop Script stops the running script, Clear Script Console empties +/// the Script Console, Clear Plug-in Cache deletes every plug-in's cache, Reset Preferences resets +/// every preference, Forget Import Matches forgets every saved match, Begin Undo Group and End +/// Undo Group begin and end a group, the six Save … Preset commands save a new preset (Save +/// Gradient Preset the selection's gradient), Delete Gradient Preset deletes the saved preset the +/// selection's gradient matches, Pixel Snapping Options… +/// opens its dialog, the three Asset Export commands open the Asset Export panel (#4864), New +/// Symbol makes a symbol of the selection, Gradient Vector gives the selection the default +/// gradient, Define Perspective Grid makes the document's grid, and Select Slice deselects the +/// slices. +const PICK_RUNS: &[&str] = &[ + "script.stop", + "script.console.clear", + "plugin.clearCache", + "prefs.reset", + "importMatches.reset", + "edit.undoGroup.begin", + "edit.undoGroup.end", + "imageTrace.presets.save", + "flattener.presets.save", + "pdf.preset.save", + "print.presets.save", + "perspective.presets.save", + "gradient.presets.save", + "gradient.presets.delete", + "view.snapToPixel.options", + "assets.export", + "assets.export3D", + "assets.settings.set", + "symbol.new", + "paint.setGradientGeom", + "perspective.grid.set", + "object.slice.select", +]; + +/// The menu path of a panel's result: a pick runs Show Panel (`window.panel`) for the panel. +const PANEL_PATH: &str = "Window › Show Panel"; + /// The menu path ([`context`]) a result takes when another result has its name: (id, English /// path), for commands that no item of the menu bar runs and whose id names no parent command. const CONTEXTS: &[(&str, &str)] = &[ ("addon.pen.close", "Pen"), ("addon.pen.reshape", "Pen"), ("addon.pen.togglePoint", "Pen"), - ("brush.library", "Brushes"), - ("brush.unused", "Brushes"), ("charStyle.setAttrs", "Character Styles"), ("file.exportInBackground", "Export"), ("file.openInBackground", "Open"), - ("graphicStyle.library", "Graphic Styles"), - ("help.links", "Help"), ("imageTrace.hideRuns", "Image Trace"), ("links.reveal", "Links"), ("livePaint.fill", "Live Paint"), @@ -51,9 +87,6 @@ const CONTEXTS: &[(&str, &str)] = &[ ("path.knife", "Path"), ("path.reshapeSegment", "Path"), ("plugin.hideRuns", "Plug-ins"), - ("swatch.library.get", "Swatches"), - ("symbol.library", "Symbols"), - ("symbol.unused", "Symbols"), ("text.editRange", "Text"), ("ui.layersPanelOptions", "Layers"), ("ui.navigatorPanelOptions", "Navigator"), @@ -91,23 +124,35 @@ impl Draft { /// The name in `lang`: the path's segments and the label translate on their own, and the id /// follows in parentheses when the result shows it. fn name(&self, lang: crate::i18n::Lang) -> String { - let label = if self.translates { crate::i18n::tr(lang, &self.label) } else { self.label.as_str() }; + // A built-in effect's label translates by its effect id first, as the Effect menu's does. + let label = match self.id.strip_prefix("effect:") { + _ if !self.translates => self.label.as_str(), + Some(effect) => crate::i18n::tr_id(lang, effect, &self.label), + None => crate::i18n::tr(lang, &self.label), + }; let name = if self.path.is_empty() { label.to_string() } else { format!("{} › {label}", shown_label(lang, &self.path)) }; if self.keyed { format!("{name} ({})", self.id) } else { name } } } /// The palette's results before their names are made distinct: every listed engine command and -/// plug-in command, UI command and tool. +/// plug-in command, UI command, tool, panel and Effect menu item. fn drafts() -> Vec { let mut out = vec![]; // Aliases kept for older scripts run a command that is listed already, a wrapped engine // command is listed as its UI command, and an engine command with a UI command of the same id - // (Place…, Print…) is listed once, as the UI command. + // (Place…, Print…) is listed once, as the UI command. An engine command that needs a value a + // pick doesn't give, or a query whose answer a pick drops ([`crate::shortcut_editor::needs_a_value`]), + // is left out unless it does something besides answering ([`PICK_RUNS`]). let plugin_commands = vectorcraft_engine::cmd::plugin::command_specs(); let ui_ids: std::collections::HashSet<&str> = menus::UI_COMMANDS.iter().map(|c| c.0).collect(); - let listed = |id: &str| !vectorcraft_engine::cmd::is_alias(id) && !WRAPPED.iter().any(|(engine, _)| *engine == id) && !ui_ids.contains(id); - for c in vectorcraft_engine::command_specs().iter().filter(|c| listed(c.id)).chain(plugin_commands) { + let listed = |c: &vectorcraft_engine::CommandSpec| { + !vectorcraft_engine::cmd::is_alias(c.id) + && !WRAPPED.iter().any(|(engine, _)| *engine == c.id) + && !ui_ids.contains(c.id) + && (!crate::shortcut_editor::needs_a_value(c.id) || PICK_RUNS.contains(&c.id)) + }; + for c in vectorcraft_engine::command_specs().iter().filter(|c| listed(c)).chain(plugin_commands) { out.push(Draft::new(&c.menu.join(" › "), c.label, c.id.to_string(), menus::shortcut_of(c.id).unwrap_or(""))); } // `plugin.dialog` runs nothing without an id: [`build`] lists each filter instead. A script of @@ -123,6 +168,18 @@ fn drafts() -> Vec { for tool in vectorcraft_tools::catalog::all_tools() { out.push(Draft::new("", tool.label, format!("tool:{}", tool.id), crate::shortcut_editor::tool_shortcut(tool.id).unwrap_or(""))); } + // A panel's result shows the panel, as `window.panel` does without `toggle`, under Window › + // Show Panel. + for (id, label) in crate::state::all_panels() { + out.push(Draft::new(PANEL_PATH, label, format!("panel:{id}"), crate::shortcut_editor::panel_shortcut(id).unwrap_or(""))); + } + // An Effect menu item runs what its item runs; a live-effect plug-in's name does not translate. + for e in crate::shortcut_editor::effect_items().iter() { + out.push(Draft { + translates: vectorcraft_plugins::effect::plugin_id(&e.effect).is_none(), + ..Draft::new(&e.group, &e.label, format!("effect:{}", e.effect), crate::shortcut_editor::effect_shortcut(&e.effect).unwrap_or("")) + }); + } out } @@ -144,7 +201,8 @@ fn context(id: &str) -> Option { if id.starts_with("tool:") { return Some("Tools".to_string()); } - if id.starts_with("plugin:") { + // A plug-in's, panel's or effect's result already shows its menu path. + if ["plugin:", "panel:", "effect:"].iter().any(|p| id.starts_with(p)) { return None; } if let Some(path) = crate::shortcut_editor::menu_bar_path(id) { @@ -273,13 +331,28 @@ fn build(lang: crate::i18n::Lang) -> Vec { /// stands for. A command whose menu bar item gives params runs what a click on that item runs /// ([`crate::shortcut_editor::menu_target_now`]), so Clean Up… and Find and Replace… open their /// dialogs. While that item is dimmed, no dialog opens and the status line says why the command -/// can't run. +/// can't run. A panel's result shows the panel, and an effect's result runs what its Effect menu +/// item runs ([`crate::keymap::command_of`]). pub(crate) fn run_pick(app: &mut VectorcraftApp, id: &str) { if let Some(tool) = id.strip_prefix("tool:") { app.select_tool(tool); - } else if id.starts_with("plugin:") { + } else if let Some(panel) = id.strip_prefix("panel:") { + // A panel that can be seen stays as it is, where `window.panel` would put an open flyout or + // a floating panel away. + if let Err(e) = crate::panel_docking::reveal_panel(app, panel) { + app.status(e); + } + } else if id.starts_with("plugin:") || id.starts_with("effect:") { let command = crate::keymap::command_of(id); - menus::invoke(app, &command.id, command.params); + // While the Effect menu dims the item (nothing selected), no dialog opens and the status + // line says why. + if id.starts_with("effect:") && !menus::enabled(app, &command.id) { + if let Err(why) = crate::shortcut_editor::dimmed(app, &command.id) { + app.status(why); + } + } else { + menus::invoke(app, &command.id, command.params); + } } else { match crate::shortcut_editor::menu_target_now(app, id) { Some(Ok((id, p))) => menus::invoke(app, &id, p), @@ -289,6 +362,22 @@ pub(crate) fn run_pick(app: &mut VectorcraftApp, id: &str) { } } +/// The results the palette shows for the lowercased query `q`: the first 14 entries that hold every +/// word of it, the ones whose name without its menu path is the query (the Layers panel for +/// "layers") first, each group in catalog order. +fn matching<'a>(entries: &'a [Entry], q: &str) -> Vec<&'a Entry> { + let words: Vec<&str> = q.split_whitespace().collect(); + let whole = words.join(" "); + // The plain, English and shown names are the haystack's first three lines. + let named = |e: &Entry| e.haystack.lines().take(3).any(|l| l.rsplit(" › ").next().is_some_and(|n| n.trim_end_matches('…') == whole)); + let mut found: Vec<&Entry> = entries.iter().filter(|e| words.iter().all(|w| e.haystack.contains(w))).collect(); + if !whole.is_empty() { + found.sort_by_key(|e| !named(e)); + } + found.truncate(14); + found +} + pub fn show(app: &mut VectorcraftApp, ctx: &egui::Context) { if !app.ui.palette_open { return; @@ -297,7 +386,7 @@ pub fn show(app: &mut VectorcraftApp, ctx: &egui::Context) { let t = Tokens::get(ctx); let q = app.ui.palette_query.to_lowercase(); let entries = entries(ctx, crate::i18n::current()); - let matches: Vec<&Entry> = entries.iter().filter(|e| q.split_whitespace().all(|w| e.haystack.contains(w))).take(14).collect(); + let matches = matching(&entries, &q); let mut run: Option = None; // The highlighted result (#1757): Up and Down move it (wrapping), the pointer over a result // takes it, and a new query starts again from the first. @@ -324,7 +413,7 @@ pub fn show(app: &mut VectorcraftApp, ctx: &egui::Context) { let r = ui.add( egui::TextEdit::singleline(&mut app.ui.palette_query) .align(egui::Align2::LEFT_CENTER) - .hint_text(tl!("Search commands and tools…")) + .hint_text(tl!("Search commands, tools, panels and effects…")) .desired_width(500.0), ); r.request_focus(); @@ -396,7 +485,7 @@ mod tests { let ctx = egui::Context::default(); let query = "use precise cursors"; let entries = entries(&ctx, Lang::EN); - let matches: Vec<&Entry> = entries.iter().filter(|e| query.split_whitespace().all(|word| e.haystack.contains(word))).take(14).collect(); + let matches = matching(&entries, query); assert!(matches.iter().any(|e| e.id == "view.preciseCursors"), "preference toggle appears for its name"); assert!(entries.iter().filter(|e| e.id == "view.capsLock").all(|e| e.shown != "Use Precise Cursors")); @@ -726,8 +815,10 @@ mod tests { let entries = build(Lang::EN); let shown = |id: &str| entries.iter().find(|e| e.id == id).map(|e| e.shown.clone()).unwrap_or_else(|| panic!("{id} is a result")); for (id, want) in [ - ("brush.unused", "Brushes › Select All Unused"), - ("symbol.unused", "Symbols › Select All Unused"), + ("file.exportInBackground", "Export › Continue in Background"), + ("file.openInBackground", "Open › Continue in Background"), + ("imageTrace.hideRuns", "Image Trace › Continue in Background"), + ("plugin.hideRuns", "Plug-ins › Continue in Background"), ("ui.layersPanelOptions", "Layers › Panel Options…"), ("ui.navigatorPanelOptions", "Navigator › Panel Options…"), ("ui.charStyleOptions.resetPanel", "Character Style Options › Reset Panel"), @@ -742,8 +833,9 @@ mod tests { ("text.fitHeadline", "Type › Fit Headline (text.fitHeadline)"), ("shape.ellipse", "Ellipse (shape.ellipse)"), ("addon.shapes.ellipse", "Ellipse (addon.shapes.ellipse)"), - ("help.links", "Help › Links"), ("perspective.editText", "Object › Perspective › Edit Text"), + ("ui.action.play", "Play Action (ui.action.play)"), + ("ui.action.playAt", "Play Action (ui.action.playAt)"), ("ui.batchDialog", "Batch…"), ("ui.flattenerPreview", "Flattener Preview"), ] { @@ -757,24 +849,30 @@ mod tests { let found = |entries: &[Entry], query: &str| -> Vec { entries.iter().filter(|e| query.split_whitespace().all(|w| e.haystack.contains(&w.to_lowercase()))).map(|e| e.id.clone()).collect() }; - for query in ["select all unused", "brushes select all unused", "brush.unused"] { - assert!(found(&entries, query).contains(&"brush.unused".to_string()), "{query}"); + let id = "file.exportInBackground".to_string(); + for query in ["continue in background", "export continue in background", "file.exportinbackground"] { + assert!(found(&entries, query).contains(&id), "{query}"); } - assert!(!found(&entries, "symbols select all unused").contains(&"brush.unused".to_string())); + assert!(!found(&entries, "open continue in background").contains(&id)); let zh = Lang::from_code("zh-hant").unwrap(); let zh_entries = build(zh); - let brushes = crate::i18n::tr(zh, "Brushes"); - let unused = zh_entries.iter().find(|e| e.id == "brush.unused").unwrap(); - assert_eq!(unused.shown, format!("{brushes} › {}", crate::i18n::tr(zh, "Select All Unused"))); - assert!(found(&zh_entries, &format!("{brushes} select all unused")).contains(&"brush.unused".to_string())); + let export = crate::i18n::tr(zh, "Export"); + let background = zh_entries.iter().find(|e| e.id == id).unwrap(); + assert_eq!(background.shown, format!("{export} › {}", crate::i18n::tr(zh, "Continue in Background"))); + assert!(found(&zh_entries, &format!("{export} continue in background")).contains(&id)); } - /// Every menu path a result can take when it shares a name has a row in each catalog with - /// complete menus. + /// Every menu path a result can take when it shares a name, and Window › Show Panel, has a row + /// in each catalog with complete menus. Each command [`CONTEXTS`] names is a result. #[test] fn the_paths_of_results_that_share_a_name_translate() { + let ids: Vec = items().into_iter().map(|(_, id, _)| id).collect(); + for (id, _) in CONTEXTS { + assert!(ids.iter().any(|i| i == id), "{id} is a result"); + } let mut paths: Vec = CONTEXTS.iter().map(|(_, path)| path.to_string()).collect(); paths.push("Tools".into()); + paths.push(PANEL_PATH.into()); let mut by_name: std::collections::HashMap> = std::collections::HashMap::new(); for d in drafts() { by_name.entry(d.name(Lang::EN)).or_default().push(d.id); @@ -849,6 +947,228 @@ mod tests { vectorcraft_plugins::registry::remove(two); } + /// Of the engine commands the palette listed before, it leaves out only the ones + /// [`crate::shortcut_editor::needs_a_value`] marks: queries with no default key and no item of + /// the menu bar, and commands that need a value no menu item gives. A pick of each one it leaves + /// out (with no document, one object selected or several) changes neither the document, its + /// selection, history and layer state, nor the interface. Every [`PICK_RUNS`] query is still + /// listed. + #[test] + fn the_palette_leaves_out_the_commands_a_pick_cannot_run() { + use vectorcraft_testkit::fixtures::Fixture; + let ui_ids: std::collections::HashSet<&str> = menus::UI_COMMANDS.iter().map(|c| c.0).collect(); + // The rule before: every engine command but the aliases, the wrapped commands and the ids of + // UI commands. + let before: Vec<&vectorcraft_engine::CommandSpec> = vectorcraft_engine::command_specs() + .iter() + .filter(|c| !vectorcraft_engine::cmd::is_alias(c.id) && !WRAPPED.iter().any(|(e, _)| *e == c.id) && !ui_ids.contains(c.id)) + .collect(); + let listed: std::collections::HashSet = items().into_iter().map(|(_, id, _)| id).collect(); + let dropped: Vec<&vectorcraft_engine::CommandSpec> = before.iter().copied().filter(|c| !listed.contains(c.id)).collect(); + let ids: Vec<&str> = dropped.iter().map(|c| c.id).collect(); + for id in ["document.json", "brush.unused", "symbol.unused", "transparency.set"] { + assert!(ids.contains(&id), "{id} is left out: {ids:?}"); + } + // What a pick can change: the document with its selection, history, revision and layer + // state, the Script Console, and the interface's state (an open dialog or panel, the + // selected tool), the status line aside. + let look = |app: &VectorcraftApp| { + let mut ui = serde_json::to_value(&app.ui).unwrap_or_default(); + if let Some(o) = ui.as_object_mut() { + o.remove("status"); + } + let doc = app.session.active().map(|st| { + (st.doc.clone(), format!("{:?}", st.selection), st.history.undo.len(), st.revision, st.active_layer, st.layer_rows.clone()) + }); + (doc, app.session.script_console().lines().len(), ui) + }; + let acts = |id: &str| { + [vectorcraft_engine::Session::new(), Fixture::Single.session(), Fixture::Multi.session()].into_iter().any(|session| { + let mut app = VectorcraftApp::new(session, crate::Services::default()); + let before = look(&app); + run_pick(&mut app, id); + look(&app) != before + }) + }; + // `layer.setProps {}` records an undo step that changes nothing. + let changed: Vec<&str> = ids.iter().copied().filter(|id| *id != "layer.setProps" && acts(id)).collect(); + assert!(changed.is_empty(), "a pick of these does something: {changed:?}"); + for c in &dropped { + assert!(c.shortcut.is_none() && crate::shortcut_editor::menu_bar_path(c.id).is_none(), "{}", c.id); + } + // The others are still listed, and each of PICK_RUNS, which needs_a_value marks. A pick of + // each one changes what `look` sees, except the commands that act on the session alone: + // [`a_pick_of_a_session_command_runs_it`] covers those, or they need a running script, an + // installed plug-in or saved import matches. + for c in &before { + let marked = crate::shortcut_editor::needs_a_value(c.id); + assert_eq!(listed.contains(c.id), !marked || PICK_RUNS.contains(&c.id), "{}", c.id); + assert!(marked || !PICK_RUNS.contains(&c.id), "{} needs no entry in PICK_RUNS", c.id); + } + let session_only = [ + "script.stop", + "script.console.clear", + "plugin.clearCache", + "prefs.reset", + "importMatches.reset", + "edit.undoGroup.begin", + "edit.undoGroup.end", + "imageTrace.presets.save", + "flattener.presets.save", + "pdf.preset.save", + "print.presets.save", + "perspective.presets.save", + "gradient.presets.save", + "gradient.presets.delete", + ]; + for id in PICK_RUNS.iter().filter(|id| !session_only.contains(id)) { + assert!(acts(id), "a pick of {id} does something"); + } + for id in PICK_RUNS.iter().chain(&["object.group", "select.key", "view.preciseCursors", "path.close"]) { + assert!(listed.contains(*id), "{id} stays"); + } + } + + /// A pick of a query that changes the session runs it: Clear Script Console empties the Script + /// Console, Reset Preferences resets a changed preference, each Save … Preset command adds a + /// preset, Delete Gradient Preset deletes the one saved from the selection, and the edits between Begin Undo Group and End Undo Group are one undo step. + #[test] + fn a_pick_of_a_session_command_runs_it() { + let ids: Vec = items().into_iter().map(|(_, id, _)| id).collect(); + let mut app = VectorcraftApp::new(vectorcraft_testkit::fixtures::Fixture::Single.session(), crate::Services::default()); + let pick = |app: &mut VectorcraftApp, id: &str| { + assert!(ids.iter().any(|i| i == id), "{id} is a result"); + run_pick(app, id); + }; + app.session.script_frames = true; + app.run("script.run", json!({"source": "$.writeln('line')", "name": "c.js"})).unwrap(); + for _ in 0..10_000 { + if !app.session.script_running() { + break; + } + crate::script_runs::poll(&mut app); + } + assert!(!app.session.script_running() && !app.session.script_console().lines().is_empty()); + pick(&mut app, "script.console.clear"); + assert!(app.session.script_console().lines().is_empty(), "{}", app.ui.status); + + let default = app.session.prefs.use_precise_cursors; + app.session.prefs.use_precise_cursors = !default; + pick(&mut app, "prefs.reset"); + assert_eq!(app.session.prefs.use_precise_cursors, default, "{}", app.ui.status); + + for (save, list) in [ + ("imageTrace.presets.save", "imageTrace.presets"), + ("flattener.presets.save", "flattener.presets.list"), + ("pdf.preset.save", "pdf.preset.list"), + ("print.presets.save", "print.presets.list"), + ("perspective.presets.save", "perspective.presets.list"), + ] { + let count = |app: &mut VectorcraftApp| app.run(list, json!({})).unwrap()["presets"].as_array().map_or(0, Vec::len); + let before = count(&mut app); + pick(&mut app, save); + assert_eq!(count(&mut app), before + 1, "{save}: {}", app.ui.status); + } + // Save Gradient Preset saves the selection's gradient, and Delete Gradient Preset deletes + // the saved preset it matches. + let stops = json!([{"offset": 0, "color": "#ff0000"}, {"offset": 1, "color": "#0000ff"}]); + app.run("paint.setFill", json!({"gradient": {"kind": "linear", "stops": stops}})).unwrap(); + pick(&mut app, "gradient.presets.save"); + assert_eq!(app.session.prefs.gradient_presets.len(), 1, "{}", app.ui.status); + pick(&mut app, "gradient.presets.delete"); + assert!(app.session.prefs.gradient_presets.is_empty(), "{}", app.ui.status); + + let undo = |app: &VectorcraftApp| app.session.active().map_or(0, |st| st.history.undo.len()); + let before = undo(&app); + pick(&mut app, "edit.undoGroup.begin"); + for x in [10, 200] { + app.run("shape.rectangle", json!({"x": x, "y": 10, "width": 20, "height": 20})).unwrap(); + } + pick(&mut app, "edit.undoGroup.end"); + assert_eq!(undo(&app), before + 1, "{}", app.ui.status); + } + + /// The UI commands that open an engine command's dialog or ask first are still listed, and the + /// engine commands they wrap are not. + #[test] + fn the_wrapping_ui_commands_stay_listed() { + let ids: std::collections::HashSet = items().into_iter().map(|(_, id, _)| id).collect(); + for (engine, ui) in WRAPPED { + assert!(ids.contains(*ui) && !ids.contains(*engine), "{ui} listed, {engine} not"); + } + assert!(menus::UI_COMMANDS.iter().filter(|c| c.0 != "plugin.dialog" && c.0 != crate::scripts_menu::COMMAND).all(|c| ids.contains(c.0))); + } + + /// Each panel is a result under Window › Show Panel. A pick shows the panel, and a second pick + /// leaves it showing rather than hiding it as the Window menu item does. + #[test] + fn a_panel_is_a_result_whose_pick_shows_it() { + let entries = build(Lang::EN); + let panels: Vec<&Entry> = entries.iter().filter(|e| e.id.starts_with("panel:")).collect(); + assert_eq!(panels.len(), crate::state::all_panels().count()); + // More than 14 results hold "layers" in their menu path; the panel, named Layers, is shown + // first, and "color guide" shows the Color Guide panel first too. + for (query, want) in [("layers", "panel:layers"), ("color guide", "panel:colorGuide"), ("Layers ", "panel:layers")] { + let all = entries.iter().filter(|e| query.to_lowercase().split_whitespace().all(|w| e.haystack.contains(w))).count(); + let shown: Vec<&str> = matching(&entries, &query.to_lowercase()).into_iter().map(|e| e.id.as_str()).collect(); + assert_eq!(shown.first(), Some(&want), "{query}: {shown:?}"); + assert_eq!(shown.len(), all.min(14), "{query}"); + } + let layers = entries.iter().find(|e| e.id == "panel:layers").unwrap(); + assert_eq!(layers.shown, "Window › Show Panel › Layers"); + assert_eq!(layers.shortcut, crate::shortcut_editor::panel_shortcut("layers").unwrap_or("")); + let zh = Lang::from_code("zh-hant").unwrap(); + let shown = build(zh).into_iter().find(|e| e.id == "panel:layers").map(|e| e.shown).unwrap(); + assert_eq!(shown, ["Window", "Show Panel", "Layers"].map(|s| crate::i18n::tr(zh, s)).join(" › ")); + for id in ["swatches", crate::panels::asset_export::ID] { + let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), crate::Services::default()); + assert!(!crate::panel_docking::showing(&app.ui, id), "{id}"); + run_pick(&mut app, &format!("panel:{id}")); + assert!(crate::panel_docking::showing(&app.ui, id), "{id}: {}", app.ui.status); + run_pick(&mut app, &format!("panel:{id}")); + assert!(crate::panel_docking::showing(&app.ui, id), "{id}: picked twice, still showing"); + } + } + + /// Each Effect menu item is a result under its menu path, with its shortcut. With a document + /// open and an object selected, a pick of Drop Shadow… opens its dialog, as the menu item + /// does, and changes nothing until the dialog is confirmed. + #[test] + fn an_effect_is_a_result_whose_pick_runs_its_menu_item() { + let entries = build(Lang::EN); + let effects = crate::shortcut_editor::effect_items(); + for e in effects.iter() { + let key = format!("effect:{}", e.effect); + assert_eq!(entries.iter().filter(|r| r.id == key).count(), 1, "{key}"); + } + let found: Vec<&Entry> = entries.iter().filter(|e| "drop shadow".split_whitespace().all(|w| e.haystack.contains(w))).collect(); + let shadow = + found.iter().find(|e| e.id.starts_with("effect:")).unwrap_or_else(|| panic!("{:?}", found.iter().map(|e| &e.id).collect::>())); + let item = effects.iter().find(|e| format!("effect:{}", e.effect) == shadow.id).unwrap(); + assert_eq!(shadow.shown, format!("{} › {}", item.group, item.label)); + let mut picked = VectorcraftApp::new(vectorcraft_testkit::fixtures::Fixture::Single.session(), crate::Services::default()); + let mut clicked = VectorcraftApp::new(vectorcraft_testkit::fixtures::Fixture::Single.session(), crate::Services::default()); + let before = outcome(&picked); + run_pick(&mut picked, &shadow.id); + menus::invoke(&mut clicked, item.command, json!({ "effect": item.effect })); + let after = outcome(&picked); + assert!(after.0.is_some(), "the dialog opens: {}", after.2); + assert_eq!(after.1, before.1, "nothing changes yet"); + assert_eq!(after, outcome(&clicked), "the pick runs what the menu item runs"); + // With nothing selected the menu item is dimmed: no dialog opens, and the status line says + // why. + let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), crate::Services::default()); + app.run("file.new", json!({"width": 200, "height": 200})).unwrap(); + app.ui.status.clear(); + run_pick(&mut app, &shadow.id); + assert!(app.ui.dialog.is_none() && !app.ui.status.is_empty(), "{}", app.ui.status); + // A built-in effect's name translates by its id, as the Effect menu shows it. + let fr = Lang::from_code("fr").unwrap(); + let add = build(fr).into_iter().find(|e| e.id == "effect:pathfinder.add").map(|e| e.shown).unwrap(); + assert!(add.ends_with(crate::i18n::tr_id(fr, "pathfinder.add", "Add")), "{add}"); + assert_eq!(crate::i18n::tr_id(fr, "pathfinder.add", "Add"), "Réunion"); + } + /// Two filter plug-ins with one name show their ids after it, the name untranslated, and each /// pick runs its own filter. #[test] diff --git a/crates/ui-egui/src/panels/learn/tests.rs b/crates/ui-egui/src/panels/learn/tests.rs index 319ca1decf..bc58612701 100644 --- a/crates/ui-egui/src/panels/learn/tests.rs +++ b/crates/ui-egui/src/panels/learn/tests.rs @@ -104,7 +104,7 @@ fn explore_tutorials_on_the_app_bar_shows_and_hides_the_learn_panel() { let ctx = context(); assert!(!shown(&app)); let nodes = frame(&mut app, &ctx, vec![], app_bar); - let search = center_where(&nodes, |label| label.starts_with("Search commands and tools")); + let search = center_where(&nodes, |label| label.starts_with("Search commands, tools, panels and effects")); let learn = center(&nodes, "Explore tutorials"); let (search, learn) = (search.expect("the search icon shows"), learn.expect("the app bar has Explore tutorials")); assert!(learn.x < search.x && (learn.y - search.y).abs() < 1.0, "beside the search icon: {learn:?}, {search:?}"); diff --git a/crates/ui-egui/src/shortcut_editor.rs b/crates/ui-egui/src/shortcut_editor.rs index 60b382714c..55d71ca3c2 100644 --- a/crates/ui-egui/src/shortcut_editor.rs +++ b/crates/ui-egui/src/shortcut_editor.rs @@ -924,7 +924,7 @@ pub(crate) fn menu_target_now(app: &VectorcraftApp, id: &str) -> Option Result<(String, Value), String> { +pub(crate) fn dimmed(app: &VectorcraftApp, id: &str) -> Result<(String, Value), String> { let Some(why) = vectorcraft_engine::find_command(id).and_then(|c| (c.enabled)(&app.session).err()) else { return Err(format!("command `{id}` is not available right now")); }; @@ -936,7 +936,7 @@ fn dimmed(app: &VectorcraftApp, id: &str) -> Result<(String, Value), String> { /// run without them (as the Variables panel's commands do), and it is a query, whose answer a key /// press drops (Select All Unused), a command of [`NEEDS_A_PARAM`], or a menu command whose params /// doc names a field a call must give (File › Document Setup › Units, `{units}`)? -fn needs_a_value(key: &str) -> bool { +pub(crate) fn needs_a_value(key: &str) -> bool { static KEYS: OnceLock> = OnceLock::new(); KEYS.get_or_init(|| { vectorcraft_engine::command_specs() @@ -2839,4 +2839,16 @@ mod tests { assert_eq!(r["shortcut"], "Cmd+Alt+Shift+F11"); assert!(app.run("shortcuts.preset", json!({"name": null})).unwrap_err().starts_with("unknown preset")); } + + /// A command that needs a value is listed in the editor once the user gives it a key, but the + /// command search still leaves it out: a pick gives it no value. + #[test] + fn a_command_given_a_key_that_needs_a_value_is_no_pick() { + let mut overrides = Overrides::default(); + crate::keymap::set_override(&mut overrides, "document.setUnits", "Cmd+Alt+Shift+F12"); + let entry = entries().iter().find(|e| e.key == "document.setUnits").cloned().expect("the editor has a row for it"); + assert!(!listed(&Overrides::default(), &entry) && listed(&overrides, &entry)); + assert!(needs_a_value("document.setUnits")); + assert!(crate::palette::items().iter().all(|(_, id, _)| id != "document.setUnits")); + } } diff --git a/crates/ui-egui/src/tests/save.rs b/crates/ui-egui/src/tests/save.rs index b9b4111516..95756262b8 100644 --- a/crates/ui-egui/src/tests/save.rs +++ b/crates/ui-egui/src/tests/save.rs @@ -205,11 +205,13 @@ fn show_in_folder_needs_a_saved_document_and_a_file_manager() { assert_eq!(*shown.borrow(), ["/art/a.vectorcraft"]); } +/// The palette lists neither the old alias nor `file.documentColorMode`, which a pick can't run +/// without a mode; the CMYK and RGB menu items run the one command. #[test] -fn the_palette_lists_document_color_mode_once() { +fn document_color_mode_is_one_command() { let items = palette::items(); let ids: Vec<&str> = items.iter().map(|(_, id, _)| id.as_str()).filter(|id| id.to_ascii_lowercase().contains("documentcolormode")).collect(); - assert_eq!(ids, ["file.documentColorMode"]); + assert!(ids.is_empty(), "{ids:?}"); let mut app = app(); app.run("file.new", json!({})).unwrap(); let entries = menus::menu_entries(&app); diff --git a/crates/ui-egui/src/titlebar.rs b/crates/ui-egui/src/titlebar.rs index cbbd216e75..dd4ce4e38e 100644 --- a/crates/ui-egui/src/titlebar.rs +++ b/crates/ui-egui/src/titlebar.rs @@ -327,7 +327,7 @@ mod tests { let has = |s: &str| texts.iter().any(|t| t == s); assert_eq!(has("Discord"), width > 1000.0, "{width}: {texts:?}"); // Search is an icon only (as in PhotoCraft): its label lives in the tooltip. - assert!(!has("Search commands and tools"), "{width}: {texts:?}"); + assert!(!has("Search commands, tools, panels and effects"), "{width}: {texts:?}"); } } diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 310dbb0d62..64b651c4af 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1252,7 +1252,8 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur The panel menu's Save Selection submenu has Save Selection…, Update Selection and Edit Selection…, enabled and run as in the Select menu, and lists the document's saved selections: choosing one selects its objects again (`select.recall`). Deleting rows from the Layers panel (the trash button, rows dragged onto it, the panel menu's Delete Selection, and Delete or Backspace on highlighted rows) asks "Delete this layer and its artwork?" when a layer or sublayer among them holds art, hidden, locked and nested art included, and "Delete the selected items and their artwork?" when several rows are deleted; OK deletes the rows it asked about in one undo step, and Cancel keeps them (`ui.layerDelete`). The help page's shortcut list names the Layers panel as the place where deleting asks for confirmation ([Default keyboard shortcuts](https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html)). An empty layer, a layer with only guides, and groups or objects alone are deleted without a question, and `layer.delete` itself does not ask (`panels::layers` tests `deleting_a_layer_that_holds_art_asks_first`, `delete_selection_asks_only_for_layers_with_art`). The Command Palette lists Window › Layers › Delete Selection once, as the Layers panel's `ui.layerDelete`, so a pick asks the same question; it does not list `layer.delete`, which scripts run without a question. New Brush…, Brush Options…, Symbol Options…, Import SVG Filter… and Convert to Text are also listed once each, as the UI command that opens the dialog or file chooser (`palette` tests `a_wrapped_engine_command_is_listed_once_as_its_ui_command`, `a_pick_of_delete_selection_asks_before_deleting_a_layer_with_art`). - No two Command Palette results for different commands, tools or plug-ins show the same name, in English or in any language with a complete menu catalog. Results that would share a name show the panel, menu or command they belong to (Brushes › Select All Unused and Symbols › Select All Unused, View › Rulers › Show Rulers and View › Perspective Grid › Show Rulers, Layers › Panel Options… and Navigator › Panel Options…, Tools › Knife and Path › Knife); results that still share one show their id after it (Ellipse (shape.ellipse) and Ellipse (addon.shapes.ellipse)), as two filter plug-ins with one name do. A query still finds a result by its name without the added path. Batch…, Flattener Preview and the four Other Library… commands are listed once each as their UI command, and Place… and Print… once each (`palette` tests `different_results_show_different_names`, `results_that_share_a_name_show_where_they_belong`, `filter_plugins_with_one_name_show_their_ids`, `each_id_is_one_result`, `a_pick_of_a_renamed_result_runs_its_own_command`). + No two Command Palette results for different commands, tools or plug-ins show the same name, in English or in any language with a complete menu catalog. Results that would share a name show the panel, menu or command they belong to (Export › Continue in Background and Open › Continue in Background, View › Rulers › Show Rulers and View › Perspective Grid › Show Rulers, Layers › Panel Options… and Navigator › Panel Options…, Tools › Knife and Path › Knife); results that still share one show their id after it (Ellipse (shape.ellipse) and Ellipse (addon.shapes.ellipse)), as two filter plug-ins with one name do. A query still finds a result by its name without the added path. Batch…, Flattener Preview and the four Other Library… commands are listed once each as their UI command, and Place… and Print… once each (`palette` tests `different_results_show_different_names`, `results_that_share_a_name_show_where_they_belong`, `filter_plugins_with_one_name_show_their_ids`, `each_id_is_one_result`, `a_pick_of_a_renamed_result_runs_its_own_command`). + The Command Palette leaves out the engine commands that Edit › Keyboard Shortcuts marks as needing a value: a query with no default key and no menu bar item (Document JSON, Select All Unused in the Brushes panel), and a command that needs a value no menu item gives (Window › Transparency's `transparency.set`, Document Setup's units). Of those, it still lists the ones whose pick does something without params: Stop Script, Clear Script Console, Clear Plug-in Cache, Reset Preferences, Forget Import Matches, Begin Undo Group and End Undo Group, the six Save … Preset commands, Delete Gradient Preset, Pixel Snapping Options…, the Asset Export commands, New Symbol, Gradient Vector, Define Perspective Grid and Select Slice. Each panel is a result under Window › Show Panel, whose pick shows the panel and leaves one already showing as it is, and each Effect menu item is a result, named as the menu names it, whose pick runs what its menu item runs; while the item is dimmed, no dialog opens and the status line says why. Results whose name without its menu path is the whole query come first, so "layers" shows the Layers panel among the 14 results. The search field's hint and the app bar's search tooltip say "Search commands, tools, panels and effects" (`palette` tests `the_palette_leaves_out_the_commands_a_pick_cannot_run`, `a_pick_of_a_session_command_runs_it`, `a_panel_is_a_result_whose_pick_shows_it`, `an_effect_is_a_result_whose_pick_runs_its_menu_item`; `shortcut_editor` test `a_command_given_a_key_that_needs_a_value_is_no_pick`). `object.setProps` with `visible: false` or `locked: true` deselects every selected object that is then hidden or locked, the key object included, as the eye and lock columns do. Ctrl/Cmd+Alt-clicking an eye switches the other layers to Outline and the row's layer to Preview, or switches all layers back to Preview when the others are in Outline (`layer.outlineOthers`, `layer.previewAll`). Ctrl/Cmd+Alt-clicking New Layer adds a layer directly below the current layer, at its level (`layer.new {below: true}`), and Ctrl/Cmd+Alt-clicking New Sublayer adds a sublayer under the contents of the layer it goes into (`layer.newSublayer {bottom: true}`), each in one undo step. The reference app's [Default keyboard shortcuts](https://web.archive.org/web/20260726060015/https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html) page lists these clicks for placing a layer below the selected layer and a new sublayer at the bottom of the layer list.