mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-19 12:38:18 +00:00
Merge pull request #8318 from dotCooCoo/feat/discover-help-panel
ui: enable Help search for tools, commands, and tutorials
This commit is contained in:
@@ -900,6 +900,25 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[
|
||||
("help.about", "About VectorCraft", "", "{}"),
|
||||
("help.checkForUpdates", "Check for Updates…", "", "{}"),
|
||||
("help.commandPalette", "Search Commands…", "Cmd+Shift+/", "{}"),
|
||||
(
|
||||
"help.discover",
|
||||
"VectorCraft Help…",
|
||||
"F1",
|
||||
"{query?: string (at most 1024 characters, VectorCraft's limit)} show the Help panel without toggling it closed; a supplied query searches tools, menu commands, and built-in tutorials; omission keeps the current search. Returns {query, results: [{kind: tool|command|tutorial, id, label, path, shortcut}], selected: index|null}",
|
||||
),
|
||||
(
|
||||
"help.discover.search",
|
||||
"Search",
|
||||
"",
|
||||
"{query: string (at most 1024 characters, VectorCraft's limit)} search tools, menu commands, and built-in tutorials and show the Help panel; empty or whitespace-only text clears the results. Returns the help.discover result",
|
||||
),
|
||||
(
|
||||
"help.discover.choose",
|
||||
"Select",
|
||||
"",
|
||||
"{index: zero-based result index} show a tool's location, a tutorial's steps in Help, or a command's menu path and shortcut without running it; an invalid index is an error. Returns {result: chosen result, location: tool location, tutorial id, or command path}",
|
||||
),
|
||||
("help.discover.back", "Back", "", "{} return from a Help result to its search results without changing the query"),
|
||||
(
|
||||
"help.safeMode",
|
||||
"Safe Mode…",
|
||||
|
||||
@@ -7067,6 +7067,8 @@ variable-list-end {0}, {1} {0} i {1}
|
||||
@msg {path}: {e} {path}: {e}
|
||||
@msg {status} ({e}) {status} ({e})
|
||||
@msg {tool} isn't in a toolbar group of several tools {tool} no forma part d’un grup de diverses eines a la barra d’eines
|
||||
@msg Presentation Mode hides the toolbars: change the screen mode to show them el Mode de presentació amaga les barres d’eines: canvieu el mode de pantalla per mostrar-les
|
||||
@msg Tab has hidden the toolbars: press Tab to show them Tab ha amagat les barres d’eines: premeu Tab per mostrar-les
|
||||
@msg “{_1}” asks for a heavy budget (each run up to {minutes} minutes and {times} times the usual instructions): a person has to approve it in the desktop app, or pass `allowHeavy: true` in a session started with --allow-plugin-grants «{_1}» demana un pressupost elevat (cada execució fins a {minutes} minuts i {times} vegades les instruccions habituals): una persona l’ha d’aprovar a l’aplicació d’escriptori, o passa `allowHeavy: true` en una sessió iniciada amb --allow-plugin-grants
|
||||
# Plug-in host messages: manifests, modules, runs and plug-in output
|
||||
@msg `name` must be 1-64 printable characters `name` ha de tenir 1-64 caràcters imprimibles
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -5923,6 +5923,8 @@ variable-list-end {0}, {1} {0} a {1}
|
||||
@msg Reload the page to go on (changes not saved yet may be lost). Pokračujte obnovením stránky (dosud neuložené změny se mohou ztratit).
|
||||
@msg tool (a tool id) is required tool (ID nástroje) je povinný
|
||||
@msg {tool} isn't in a toolbar group of several tools {tool} není ve skupině panelu nástrojů s více nástroji
|
||||
@msg Presentation Mode hides the toolbars: change the screen mode to show them Režim prezentace skrývá panely nástrojů: zobrazíte je změnou režimu obrazovky
|
||||
@msg Tab has hidden the toolbars: press Tab to show them Klávesa Tab skryla panely nástrojů: zobrazíte je stisknutím klávesy Tab
|
||||
@msg onto must name a panel floating in another group onto musí určovat panel plovoucí v jiné skupině
|
||||
@msg below and above must name a panel floating in another group below a above musí určovat panel plovoucí v jiné skupině
|
||||
@msg give only one of onto, below and above zadejte jen jedno z onto, below a above
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -8032,6 +8032,8 @@ imageTrace Outline Kontur
|
||||
@msg Reload the page to go on (changes not saved yet may be lost). Genindlæs siden for at fortsætte (ændringer, der endnu ikke er gemt, kan gå tabt).
|
||||
@msg tool (a tool id) is required tool (et værktøj-id) er påkrævet
|
||||
@msg {tool} isn't in a toolbar group of several tools {tool} er ikke i en værktøjsgruppe med flere værktøjer
|
||||
@msg Presentation Mode hides the toolbars: change the screen mode to show them Præsentationstilstand skjuler værktøjslinjerne: skift skærmtilstand for at vise dem
|
||||
@msg Tab has hidden the toolbars: press Tab to show them Tab har skjult værktøjslinjerne: tryk på Tab for at vise dem
|
||||
@msg onto must name a panel floating in another group onto skal angive et panel, der flyder i en anden gruppe
|
||||
@msg below and above must name a panel floating in another group below og above skal angive et panel, der flyder i en anden gruppe
|
||||
@msg give only one of onto, below and above angiv kun én af onto, below og above
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -5519,6 +5519,8 @@ variable-list-end {0}, {1} {0} und {1}
|
||||
@msg Reload the page to go on (changes not saved yet may be lost). Laden Sie die Seite neu, um fortzufahren (noch nicht gespeicherte Änderungen können verloren gehen).
|
||||
@msg tool (a tool id) is required tool (eine Werkzeug-ID) ist erforderlich
|
||||
@msg {tool} isn't in a toolbar group of several tools {tool} gehört zu keiner Werkzeuggruppe mit mehreren Werkzeugen
|
||||
@msg Presentation Mode hides the toolbars: change the screen mode to show them der Präsentationsmodus blendet die Werkzeugleisten aus: Ändern Sie den Bildschirmmodus, um sie anzuzeigen
|
||||
@msg Tab has hidden the toolbars: press Tab to show them die Tabulatortaste hat die Werkzeugleisten ausgeblendet: Drücken Sie die Tabulatortaste, um sie anzuzeigen
|
||||
@msg onto must name a panel floating in another group onto muss ein Bedienfeld nennen, das in einer anderen Gruppe schwebt
|
||||
@msg below and above must name a panel floating in another group below und above müssen ein Bedienfeld nennen, das in einer anderen Gruppe schwebt
|
||||
@msg give only one of onto, below and above nur eines von onto, below und above angeben
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -5578,6 +5578,8 @@ variable-list-end {0}, {1} {0} και {1}
|
||||
@msg Reload the page to go on (changes not saved yet may be lost). Ανανεώστε τη σελίδα για να συνεχίσετε (οι μη αποθηκευμένες αλλαγές ενδέχεται να χαθούν).
|
||||
@msg tool (a tool id) is required απαιτείται tool (αναγνωριστικό εργαλείου)
|
||||
@msg {tool} isn't in a toolbar group of several tools το {tool} δεν ανήκει σε ομάδα πολλών εργαλείων της γραμμής εργαλείων
|
||||
@msg Presentation Mode hides the toolbars: change the screen mode to show them η Λειτουργία παρουσίασης κρύβει τις γραμμές εργαλείων: αλλάξτε τη λειτουργία οθόνης για να εμφανιστούν
|
||||
@msg Tab has hidden the toolbars: press Tab to show them το Tab έκρυψε τις γραμμές εργαλείων: πατήστε Tab για να εμφανιστούν
|
||||
@msg onto must name a panel floating in another group το onto πρέπει να ορίζει πίνακα που αιωρείται σε άλλη ομάδα
|
||||
@msg below and above must name a panel floating in another group τα below και above πρέπει να ορίζουν πίνακα που αιωρείται σε άλλη ομάδα
|
||||
@msg give only one of onto, below and above δώστε μόνο ένα από τα onto, below και above
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -5635,6 +5635,8 @@ variable-list-end {0}, {1} {0} y {1}
|
||||
@msg Reload the page to go on (changes not saved yet may be lost). Vuelve a cargar la página para continuar (los cambios que aún no se guardaron podrían perderse).
|
||||
@msg tool (a tool id) is required se requiere tool (un id de herramienta)
|
||||
@msg {tool} isn't in a toolbar group of several tools {tool} no está en un grupo de la barra de herramientas con varias herramientas
|
||||
@msg Presentation Mode hides the toolbars: change the screen mode to show them el Modo de presentación oculta las barras de herramientas: cambie el modo de pantalla para mostrarlas
|
||||
@msg Tab has hidden the toolbars: press Tab to show them Tab ha ocultado las barras de herramientas: pulse Tab para mostrarlas
|
||||
@msg onto must name a panel floating in another group onto debe nombrar un panel que flote en otro grupo
|
||||
@msg below and above must name a panel floating in another group below y above deben nombrar un panel que flote en otro grupo
|
||||
@msg give only one of onto, below and above indica solo uno de onto, below y above
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -5843,6 +5843,8 @@ variable-list-end {0}, {1} {0} ja {1}
|
||||
@msg Reload the page to go on (changes not saved yet may be lost). Lataa sivu uudelleen jatkaaksesi (tallentamattomat muutokset voivat kadota).
|
||||
@msg tool (a tool id) is required tool (työkalun tunnus) vaaditaan
|
||||
@msg {tool} isn't in a toolbar group of several tools {tool} ei ole usean työkalun työkaluriviryhmässä
|
||||
@msg Presentation Mode hides the toolbars: change the screen mode to show them Esitystila piilottaa työkalurivit: tuo ne näkyviin vaihtamalla näyttötilaa
|
||||
@msg Tab has hidden the toolbars: press Tab to show them Tab on piilottanut työkalurivit: tuo ne näkyviin painamalla Tab-näppäintä
|
||||
@msg onto must name a panel floating in another group onto-arvon on nimettävä toisessa ryhmässä kelluva paneeli
|
||||
@msg below and above must name a panel floating in another group below- ja above-arvojen on nimettävä toisessa ryhmässä kelluva paneeli
|
||||
@msg give only one of onto, below and above anna vain yksi arvoista onto, below ja above
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -5588,6 +5588,8 @@ variable-list-end {0}, {1} {0} et {1}
|
||||
@msg Reload the page to go on (changes not saved yet may be lost). Rechargez la page pour continuer (les modifications non encore enregistrées risquent d’être perdues).
|
||||
@msg tool (a tool id) is required tool (un identifiant d’outil) est obligatoire
|
||||
@msg {tool} isn't in a toolbar group of several tools {tool} ne fait pas partie d’un groupe de plusieurs outils dans la barre d’outils
|
||||
@msg Presentation Mode hides the toolbars: change the screen mode to show them pour afficher les barres d’outils masquées par le Mode Présentation, changez de mode d’affichage
|
||||
@msg Tab has hidden the toolbars: press Tab to show them pour afficher les barres d’outils masquées par Tab, appuyez sur Tab
|
||||
@msg onto must name a panel floating in another group onto doit désigner un panneau flottant dans un autre groupe
|
||||
@msg below and above must name a panel floating in another group below et above doivent désigner un panneau flottant dans un autre groupe
|
||||
@msg give only one of onto, below and above indiquez un seul de onto, below et above
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -6289,6 +6289,8 @@ antiAlias Sharp शार्प
|
||||
@msg {std} files embed their fonts, and the file would have one that isn't {std} फ़ाइलें अपने फ़ॉन्ट एम्बेड करती हैं, और इस फ़ाइल में एक ऐसा फ़ॉन्ट होता जो एम्बेड नहीं है
|
||||
@msg {target} is the file this document was read from, and reading it left things out ({what}): writing over it would lose them for good. Write another file instead, or pass acknowledgeLoss: true to replace it anyway यह डॉक्यूमेंट {target} से पढ़ा गया था और पढ़ते समय कुछ चीज़ें छूट गईं ({what}): उसी फ़ाइल पर लिखने से वे स्थायी रूप से खो जाएँगी। दूसरी फ़ाइल लिखें या फिर भी बदलने के लिए acknowledgeLoss: true दें
|
||||
@msg {tool} isn't in a toolbar group of several tools {tool} कई टूल्स के टूलबार समूह में नहीं है
|
||||
@msg Presentation Mode hides the toolbars: change the screen mode to show them प्रस्तुति मोड टूलबार्स छिपाता है: उन्हें दिखाने के लिए स्क्रीन मोड बदलें
|
||||
@msg Tab has hidden the toolbars: press Tab to show them Tab ने टूलबार्स छिपा दिए हैं: उन्हें दिखाने के लिए Tab दबाएँ
|
||||
@msg {ty} brushes need selected art (or params.{k}) {ty} ब्रश के लिए सिलेक्टेड आर्टवर्क (या params.{k}) चाहिए
|
||||
@msg {v} is not an asset id {v} एक परिसंपत्ति आईडी नहीं है
|
||||
@msg {what} can't be intertwined {what} अंतर नहीं किया जा सकता है
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -6406,6 +6406,8 @@ variable-list-end {0}, {1} {0} és {1}
|
||||
@msg {path}: {e} {path}: {e}
|
||||
@msg {status} ({e}) {status} ({e})
|
||||
@msg {tool} isn't in a toolbar group of several tools az eszköz nincs többeszközös eszköztár-csoportban: {tool}
|
||||
@msg Presentation Mode hides the toolbars: change the screen mode to show them a Bemutató mód elrejti az eszköztárakat: a megjelenítésükhöz váltson képernyőmódot
|
||||
@msg Tab has hidden the toolbars: press Tab to show them a Tab elrejtette az eszköztárakat: a megjelenítésükhöz nyomja meg a Tab billentyűt
|
||||
@msg the compressed file unpacks to more than VectorCraft reads ({_1} MB of document, {_2} MB per image) a tömörített fájl kicsomagolva nagyobb lenne, mint amennyit a VectorCraft beolvas ({_1} MB dokumentum, képenként {_2} MB)
|
||||
@msg the document is too large to save compressed ({0}): save it with Use Compression off a dokumentum túl nagy a tömörített mentéshez ({0}): mentsd a Tömörítés használata beállítás kikapcsolásával
|
||||
@msg the file stopped being read (please report this bug) a fájl beolvasása megszakadt (kérjük, jelentsd ezt a hibát)
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -5655,6 +5655,8 @@ variable-list-end {0}, {1} {0} e {1}
|
||||
@msg Reload the page to go on (changes not saved yet may be lost). Ricarica la pagina per continuare (le modifiche non ancora salvate potrebbero andare perse).
|
||||
@msg tool (a tool id) is required tool (un id di strumento) è obbligatorio
|
||||
@msg {tool} isn't in a toolbar group of several tools {tool} non fa parte di un gruppo di più strumenti nella barra degli strumenti
|
||||
@msg Presentation Mode hides the toolbars: change the screen mode to show them la Modalità presentazione nasconde le barre degli strumenti: cambia la modalità schermo per mostrarle
|
||||
@msg Tab has hidden the toolbars: press Tab to show them Tab ha nascosto le barre degli strumenti: premi Tab per mostrarle
|
||||
@msg onto must name a panel floating in another group onto deve indicare un pannello mobile in un altro gruppo
|
||||
@msg below and above must name a panel floating in another group below e above devono indicare un pannello mobile in un altro gruppo
|
||||
@msg give only one of onto, below and above indica solo uno tra onto, below e above
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -5770,6 +5770,8 @@ liquify-list-end {0}, {1} {0}、{1}
|
||||
@msg the {tool} tool has no options {tool} ツールにはオプションがありません
|
||||
@msg unknown tool `{tool}` `{tool}` は不明なツールです
|
||||
@msg {tool} isn't in a toolbar group of several tools {tool} は複数のツールからなるツールグループに含まれていません
|
||||
@msg Presentation Mode hides the toolbars: change the screen mode to show them プレゼンテーションモードではツールバーが表示されません: 表示するにはスクリーンモードを変更してください
|
||||
@msg Tab has hidden the toolbars: press Tab to show them Tab でツールバーが非表示になっています: 表示するには Tab キーを押してください
|
||||
@msg no such document 指定されたドキュメントが見つかりません
|
||||
@msg {_1}: not saved, so not closed {_1}: 保存されていないため、閉じませんでした
|
||||
@msg `{name}` is a built-in workspace; choose another name `{name}` は組み込みのワークスペースなので、別の名前を指定してください
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -7345,6 +7345,8 @@ font-technology Variable ცვლადი
|
||||
@msg Reload the page to go on (changes not saved yet may be lost). გასაგრძელებლად გადატვირთეთ გვერდი (ჯერ შეუნახავი ცვლილებები შეიძლება დაიკარგოს).
|
||||
@msg tool (a tool id) is required tool (ხელსაწყოს id) აუცილებელია
|
||||
@msg {tool} isn't in a toolbar group of several tools {tool} რამდენიმე ხელსაწყოს მქონე ხელსაწყოთა ჯგუფში არ არის
|
||||
@msg Presentation Mode hides the toolbars: change the screen mode to show them პრეზენტაციის რეჟიმი მალავს ხელსაწყოთა ზოლებს: მათ საჩვენებლად შეცვალეთ ეკრანის რეჟიმი
|
||||
@msg Tab has hidden the toolbars: press Tab to show them Tab-მა დამალა ხელსაწყოთა ზოლები: მათ საჩვენებლად დააჭირეთ Tab-ს
|
||||
@msg onto must name a panel floating in another group onto უნდა ასახელებდეს სხვა ჯგუფში მცურავ პანელს
|
||||
@msg below and above must name a panel floating in another group below და above უნდა ასახელებდეს სხვა ჯგუფში მცურავ პანელს
|
||||
@msg give only one of onto, below and above მიუთითეთ მხოლოდ ერთი: onto, below ან above
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -5697,6 +5697,8 @@ liquify-list-end {0}, {1} {0} 및 {1}
|
||||
@msg the {tool} tool has no options {tool} 도구에는 옵션이 없습니다
|
||||
@msg unknown tool `{tool}` 알 수 없는 도구 `{tool}`
|
||||
@msg {tool} isn't in a toolbar group of several tools {tool}은(는) 여러 도구가 있는 도구 모음 그룹에 속하지 않습니다
|
||||
@msg Presentation Mode hides the toolbars: change the screen mode to show them 프레젠테이션 모드에서는 도구 모음이 숨겨집니다: 표시하려면 화면 모드를 변경하세요
|
||||
@msg Tab has hidden the toolbars: press Tab to show them Tab으로 도구 모음이 숨겨졌습니다: 표시하려면 Tab을 누르세요
|
||||
@msg no such document 해당 문서가 없습니다
|
||||
@msg {_1}: not saved, so not closed {_1}: 저장되지 않아 닫지 않았습니다
|
||||
@msg `{name}` is a built-in workspace; choose another name `{name}`은(는) 기본 제공 작업 영역입니다: 다른 이름을 선택하세요
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -5912,6 +5912,8 @@ imageTrace Outline Contour
|
||||
@msg Reload the page to go on (changes not saved yet may be lost). Laad de pagina opnieuw om door te gaan (nog niet opgeslagen wijzigingen kunnen verloren gaan).
|
||||
@msg tool (a tool id) is required tool (een gereedschaps-id) is vereist
|
||||
@msg {tool} isn't in a toolbar group of several tools {tool} zit niet in een werkbalkgroep met meerdere gereedschappen
|
||||
@msg Presentation Mode hides the toolbars: change the screen mode to show them Presentatiemodus verbergt de werkbalken: wijzig de schermmodus om ze te tonen
|
||||
@msg Tab has hidden the toolbars: press Tab to show them Tab heeft de werkbalken verborgen: druk op Tab om ze te tonen
|
||||
@msg onto must name a panel floating in another group onto moet een zwevend paneel in een andere groep benoemen
|
||||
@msg below and above must name a panel floating in another group below en above moeten een zwevend paneel in een andere groep benoemen
|
||||
@msg give only one of onto, below and above geef slechts één van onto, below en above
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -5743,6 +5743,8 @@ variable-list-end {0}, {1} {0} i {1}
|
||||
@msg Reload the page to go on (changes not saved yet may be lost). Odśwież stronę, aby kontynuować (niezapisane zmiany mogą zostać utracone).
|
||||
@msg tool (a tool id) is required wymagane jest tool (identyfikator narzędzia)
|
||||
@msg {tool} isn't in a toolbar group of several tools {tool} nie należy do grupy kilku narzędzi na pasku narzędzi
|
||||
@msg Presentation Mode hides the toolbars: change the screen mode to show them Tryb prezentacji ukrywa paski narzędzi: zmień tryb ekranu, aby je pokazać
|
||||
@msg Tab has hidden the toolbars: press Tab to show them klawisz Tab ukrył paski narzędzi: naciśnij Tab, aby je pokazać
|
||||
@msg onto must name a panel floating in another group onto musi wskazywać panel pływający w innej grupie
|
||||
@msg below and above must name a panel floating in another group below i above muszą wskazywać panel pływający w innej grupie
|
||||
@msg give only one of onto, below and above podaj tylko jedno z: onto, below, above
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -4884,6 +4884,8 @@ variable-list-end {0}, {1} {0} e {1}
|
||||
@msg Reload the page to go on (changes not saved yet may be lost). Recarregue a página para continuar (alterações ainda não salvas podem ser perdidas).
|
||||
@msg tool (a tool id) is required tool (um id de ferramenta) é obrigatório
|
||||
@msg {tool} isn't in a toolbar group of several tools {tool} não está em um grupo de barra de ferramentas com várias ferramentas
|
||||
@msg Presentation Mode hides the toolbars: change the screen mode to show them o Modo de Apresentação oculta as barras de ferramentas: altere o modo de tela para mostrá-las
|
||||
@msg Tab has hidden the toolbars: press Tab to show them Tab ocultou as barras de ferramentas: pressione Tab para mostrá-las
|
||||
@msg onto must name a panel floating in another group onto deve nomear um painel flutuante em outro grupo
|
||||
@msg below and above must name a panel floating in another group below e above devem nomear um painel flutuante em outro grupo
|
||||
@msg give only one of onto, below and above informe apenas um entre onto, below e above
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -5654,6 +5654,8 @@ variable-list-end {0}, {1} {0} и {1}
|
||||
@msg Reload the page to go on (changes not saved yet may be lost). Перезагрузите страницу, чтобы продолжить (ещё не сохранённые изменения могут быть потеряны).
|
||||
@msg tool (a tool id) is required требуется tool (идентификатор инструмента)
|
||||
@msg {tool} isn't in a toolbar group of several tools {tool} не входит в группу панели инструментов из нескольких инструментов
|
||||
@msg Presentation Mode hides the toolbars: change the screen mode to show them Режим презентации скрывает панели инструментов: чтобы показать их, смените режим экрана
|
||||
@msg Tab has hidden the toolbars: press Tab to show them клавиша Tab скрыла панели инструментов: чтобы показать их, нажмите Tab
|
||||
@msg onto must name a panel floating in another group onto должен называть панель, плавающую в другой группе
|
||||
@msg below and above must name a panel floating in another group below и above должны называть панель, плавающую в другой группе
|
||||
@msg give only one of onto, below and above укажите только один из onto, below и above
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -5514,6 +5514,8 @@ variable-list-end {0}, {1} {0} och {1}
|
||||
@msg Reload the page to go on (changes not saved yet may be lost). Läs in sidan igen för att fortsätta (ändringar som inte sparats än kan gå förlorade).
|
||||
@msg tool (a tool id) is required tool (ett verktygs-id) krävs
|
||||
@msg {tool} isn't in a toolbar group of several tools {tool} ingår inte i en verktygsgrupp med flera verktyg
|
||||
@msg Presentation Mode hides the toolbars: change the screen mode to show them Presentationsläge döljer verktygsfälten: byt skärmläge för att visa dem
|
||||
@msg Tab has hidden the toolbars: press Tab to show them Tab har dolt verktygsfälten: tryck på Tab för att visa dem
|
||||
@msg onto must name a panel floating in another group onto måste ange en panel som flyter i en annan grupp
|
||||
@msg below and above must name a panel floating in another group below och above måste ange en panel som flyter i en annan grupp
|
||||
@msg give only one of onto, below and above ange bara en av onto, below och above
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -6312,7 +6312,8 @@ const MESSAGE_MARKERS: &[&str] = &[".status(", "ui.status = ", "status = ", "Oth
|
||||
/// a plug-in returned), and the script interpreter's methods that throw an error at a script:
|
||||
/// `.type_error(msg)`, `.throw(kind, msg)` and the XPath evaluator's `.error(msg)`, with the reasons
|
||||
/// it gives for a property it cannot define or assign (`.reject_bool(throw, key, why)` and
|
||||
/// `.reject(throw, key, why)`). A helper that starts with `.` is a method of any receiver; any other
|
||||
/// `.reject(throw, key, why)`), and the interface's `unavailable(tool, reason)` (a tool's place that
|
||||
/// no toolbar can show, which Help puts in the status bar). A helper that starts with `.` is a method of any receiver; any other
|
||||
/// is a function, not a type's own function of the same name (`Grays::param(C, p)`).
|
||||
const ERROR_HELPERS: &[(&str, &str, usize)] = &[
|
||||
("engine", "bad(", 1),
|
||||
@@ -6335,6 +6336,7 @@ const ERROR_HELPERS: &[(&str, &str, usize)] = &[
|
||||
("js", ".error(", 0),
|
||||
("js", ".reject_bool(", 2),
|
||||
("js", ".reject(", 2),
|
||||
("ui-egui", "unavailable(", 1),
|
||||
];
|
||||
|
||||
/// Error variants whose first argument is a name, not a message: a command id
|
||||
|
||||
@@ -5340,6 +5340,8 @@ liquify-list-end {0}, {1} {0} ve {1}
|
||||
@msg Reload the page to go on (changes not saved yet may be lost). Devam etmek için sayfayı yeniden yükleyin (henüz kaydedilmemiş değişiklikler kaybolabilir).
|
||||
@msg tool (a tool id) is required tool (bir araç kimliği) gerekli
|
||||
@msg {tool} isn't in a toolbar group of several tools {tool} çeşitli araçlardan oluşan bir araç çubuğu grubunda değil
|
||||
@msg Presentation Mode hides the toolbars: change the screen mode to show them Sunum Modu araç çubuklarını gizler: göstermek için ekran modunu değiştirin
|
||||
@msg Tab has hidden the toolbars: press Tab to show them Tab araç çubuklarını gizledi: göstermek için Tab tuşuna basın
|
||||
@msg onto must name a panel floating in another group onto başka bir grupta yüzen bir paneli adlandırmalıdır
|
||||
@msg below and above must name a panel floating in another group below ve above başka bir grupta yüzen bir paneli adlandırmalıdır
|
||||
@msg give only one of onto, below and above onto, below ve above değerlerinden yalnızca birini verin
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -5639,6 +5639,8 @@ variable-list-end {0}, {1} {0} і {1}
|
||||
@msg Reload the page to go on (changes not saved yet may be lost). Перезавантажте сторінку, щоб продовжити (незбережені зміни можуть бути втрачені).
|
||||
@msg tool (a tool id) is required потрібно tool (ідентифікатор інструменту)
|
||||
@msg {tool} isn't in a toolbar group of several tools {tool} не входить до групи панелі інструментів з кількох інструментів
|
||||
@msg Presentation Mode hides the toolbars: change the screen mode to show them Режим презентації приховує панелі інструментів: щоб показати їх, змініть режим екрану
|
||||
@msg Tab has hidden the toolbars: press Tab to show them клавіша Tab приховала панелі інструментів: щоб показати їх, натисніть Tab
|
||||
@msg onto must name a panel floating in another group onto має називати панель, що плаває в іншій групі
|
||||
@msg below and above must name a panel floating in another group below і above мають називати панель, що плаває в іншій групі
|
||||
@msg give only one of onto, below and above вкажіть лише один із onto, below і above
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -6217,6 +6217,8 @@ variable-list-end {0}, {1} {0} và {1}
|
||||
@msg {path}: {e} {path}: {e}
|
||||
@msg {status} ({e}) {status} ({e})
|
||||
@msg {tool} isn't in a toolbar group of several tools {tool} không nằm trong nhóm thanh công cụ có nhiều công cụ
|
||||
@msg Presentation Mode hides the toolbars: change the screen mode to show them Chế độ trình bày ẩn các thanh công cụ: hãy đổi chế độ màn hình để hiện chúng
|
||||
@msg Tab has hidden the toolbars: press Tab to show them phím Tab đã ẩn các thanh công cụ: nhấn Tab để hiện chúng
|
||||
Load EPS into Clipboard Tải EPS vào bảng tạm
|
||||
@msg an image of {w} × {h} pixels is too large to draw ảnh {w} × {h} điểm ảnh quá lớn nên không thể vẽ
|
||||
@msg {path}: not a PNG, JPEG, WebP, TIFF or BMP image {path}: không phải ảnh PNG, JPEG, WebP, TIFF hay BMP
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -5435,6 +5435,8 @@ liquify-list-end {0}, {1} {0}和{1}
|
||||
@msg the {tool} tool has no options {tool} 工具没有选项
|
||||
@msg unknown tool `{tool}` 未知工具 `{tool}`
|
||||
@msg {tool} isn't in a toolbar group of several tools {tool} 不在包含多个工具的工具栏组中
|
||||
@msg Presentation Mode hides the toolbars: change the screen mode to show them 演示模式会隐藏工具栏:请更改屏幕模式以显示工具栏
|
||||
@msg Tab has hidden the toolbars: press Tab to show them Tab 已隐藏工具栏:请按 Tab 以显示工具栏
|
||||
@msg no such document 没有此文档
|
||||
@msg {_1}: not saved, so not closed {_1}:未保存,因此未关闭
|
||||
@msg `{name}` is a built-in workspace; choose another name `{name}` 是内置工作区;请选择其他名称
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -2917,6 +2917,8 @@ liquify-list-end {0}, {1} {0}和{1}
|
||||
@msg the {tool} tool has no options {tool} 工具沒有選項
|
||||
@msg unknown tool `{tool}` 未知的工具 `{tool}`
|
||||
@msg {tool} isn't in a toolbar group of several tools {tool} 不在包含多個工具的工具列群組中
|
||||
@msg Presentation Mode hides the toolbars: change the screen mode to show them 簡報模式會隱藏工具列:請變更螢幕模式以顯示工具列
|
||||
@msg Tab has hidden the toolbars: press Tab to show them Tab 已隱藏工具列:請按 Tab 以顯示工具列
|
||||
@msg no such document 沒有這個文件
|
||||
@msg {_1}: not saved, so not closed {_1}:未儲存,因此未關閉
|
||||
@msg `{name}` is a built-in workspace; choose another name `{name}` 是內建工作區;請選擇其他名稱
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -37,9 +37,6 @@ fn cp(label: &'static str, id: &'static str, p: Value) -> Item {
|
||||
fn todo(label: &'static str) -> Item {
|
||||
Item::Todo(label, "")
|
||||
}
|
||||
fn todos(label: &'static str, sc: &'static str) -> Item {
|
||||
Item::Todo(label, sc)
|
||||
}
|
||||
fn sub(label: &'static str, items: Vec<Item>) -> Item {
|
||||
Item::Sub(label, items)
|
||||
}
|
||||
@@ -64,8 +61,11 @@ pub(crate) use bar::{home_key, home_showing};
|
||||
#[cfg(test)]
|
||||
use bar::{menu_body, pointer_reaches_title};
|
||||
pub use context::{context_items, context_menu_body, ruler_menu_body, ruler_unit_items};
|
||||
#[cfg(test)]
|
||||
use entries::flatten;
|
||||
pub use entries::{
|
||||
InsertableItem, MenuEntry, Row, context_entries, entry, insertable, insertable_items, menu_entries, plays_in_app, pretty_shortcut, shown_shortcut,
|
||||
InsertableItem, MenuEntry, Row, context_entries, entry, insertable, insertable_items, menu_entries, plays_in_app, pretty_shortcut, shown_label,
|
||||
shown_shortcut,
|
||||
};
|
||||
pub(crate) use invoke::graph_dialog;
|
||||
#[cfg(test)]
|
||||
|
||||
@@ -53,11 +53,7 @@ pub fn entry<'a>(app: &VectorcraftApp, it: &'a Item) -> Option<Entry<'a>> {
|
||||
Entry::Item(Row {
|
||||
command: Some((id, p)),
|
||||
source: label,
|
||||
label: effect_item_label(id, p)
|
||||
.or_else(|| unlock_item_label(app, id, p, crate::i18n::current()))
|
||||
.or_else(|| spelling_item_label(id, p))
|
||||
.unwrap_or_else(|| display_label(app, id, label))
|
||||
.into(),
|
||||
label: shown_label(app, id, p, label).into(),
|
||||
shortcut: item_shortcut(id, p),
|
||||
enabled,
|
||||
checked,
|
||||
@@ -66,6 +62,16 @@ pub fn entry<'a>(app: &VectorcraftApp, it: &'a Item) -> Option<Entry<'a>> {
|
||||
})
|
||||
}
|
||||
|
||||
/// The label of the menu item that runs `id` with `p` and reads `label` in English, as the menus
|
||||
/// draw it in the UI language: an effect's own name (Pathfinder › Add), an object's name, a
|
||||
/// spelling suggestion, or [`display_label`].
|
||||
pub fn shown_label(app: &VectorcraftApp, id: &str, p: &Value, label: &str) -> String {
|
||||
effect_item_label(id, p)
|
||||
.or_else(|| unlock_item_label(app, id, p, crate::i18n::current()))
|
||||
.or_else(|| spelling_item_label(id, p))
|
||||
.unwrap_or_else(|| display_label(app, id, label))
|
||||
}
|
||||
|
||||
/// `Cmd+Shift+]` → `⇧⌘]` on macOS, `Ctrl+Shift+]` elsewhere.
|
||||
pub fn pretty_shortcut(s: &str) -> String {
|
||||
if s.is_empty() {
|
||||
@@ -109,13 +115,17 @@ pub struct MenuEntry {
|
||||
pub params: Value,
|
||||
pub enabled: bool,
|
||||
pub shortcut: String,
|
||||
/// `path` as the menus draw it in the UI language: a plug-in's submenu and a Scripts folder
|
||||
/// keep their names.
|
||||
#[serde(skip)]
|
||||
pub shown_path: Vec<String>,
|
||||
}
|
||||
|
||||
/// Flattened menu for `ui.menu.list`.
|
||||
pub fn menu_entries(app: &VectorcraftApp) -> Vec<MenuEntry> {
|
||||
let mut out = vec![];
|
||||
for (title, items) in menu_tree_named(app.session.prefs.font_names_in_english) {
|
||||
flatten(app, vec![title.to_string()], &items, &mut out);
|
||||
flatten(app, vec![title.to_string()], vec![crate::i18n::t(title).to_string()], &items, &mut out);
|
||||
}
|
||||
out
|
||||
}
|
||||
@@ -123,7 +133,7 @@ pub fn menu_entries(app: &VectorcraftApp) -> Vec<MenuEntry> {
|
||||
/// Flattened canvas context menu for `ui.contextMenu.list` (paths are its submenus).
|
||||
pub fn context_entries(app: &VectorcraftApp) -> Vec<MenuEntry> {
|
||||
let mut out = vec![];
|
||||
flatten(app, vec![], &context_items(app), &mut out);
|
||||
flatten(app, vec![], vec![], &context_items(app), &mut out);
|
||||
out
|
||||
}
|
||||
|
||||
@@ -245,7 +255,7 @@ pub fn insertable_items(english_names: bool) -> Vec<InsertableItem> {
|
||||
out
|
||||
}
|
||||
|
||||
fn flatten(app: &VectorcraftApp, path: Vec<String>, items: &[Item], out: &mut Vec<MenuEntry>) {
|
||||
pub(super) fn flatten(app: &VectorcraftApp, path: Vec<String>, shown: Vec<String>, items: &[Item], out: &mut Vec<MenuEntry>) {
|
||||
for it in items {
|
||||
match it {
|
||||
Item::Cmd(l, id, p) => {
|
||||
@@ -266,6 +276,7 @@ fn flatten(app: &VectorcraftApp, path: Vec<String>, items: &[Item], out: &mut Ve
|
||||
params: p.clone(),
|
||||
enabled,
|
||||
shortcut: item_shortcut(id, p).or_else(|| shortcut_of(id)).unwrap_or("").to_string(),
|
||||
shown_path: shown.clone(),
|
||||
})
|
||||
}
|
||||
Item::Todo(l, sc) => out.push(MenuEntry {
|
||||
@@ -275,11 +286,16 @@ fn flatten(app: &VectorcraftApp, path: Vec<String>, items: &[Item], out: &mut Ve
|
||||
params: Value::Null,
|
||||
enabled: false,
|
||||
shortcut: sc.to_string(),
|
||||
shown_path: shown.clone(),
|
||||
}),
|
||||
Item::Sub(l, ch) => {
|
||||
let mut p = path.clone();
|
||||
p.push(l.to_string());
|
||||
flatten(app, p, ch, out);
|
||||
// The menus draw a plug-in's submenu and a Scripts folder by their own names ([`entry`]).
|
||||
let mut s = shown.clone();
|
||||
let own = super::labels::holds_plugin_commands(ch) || crate::scripts_menu::is_folder(ch);
|
||||
s.push(if own { l.to_string() } else { crate::i18n::t(l).to_string() });
|
||||
flatten(app, p, s, ch, out);
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
||||
@@ -115,6 +115,7 @@ pub fn run_ui_command(app: &mut VectorcraftApp, id: &str, p: &Value) -> Option<R
|
||||
.or_else(|| crate::edit_toolbar::command(app, id, p))
|
||||
.or_else(|| crate::custom_toolbars::command(app, id, p))
|
||||
.or_else(|| crate::panels::learn::command(app, id, p))
|
||||
.or_else(|| crate::panels::discover::command(app, id, p))
|
||||
{
|
||||
return Some(r);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,290 @@
|
||||
use super::*;
|
||||
use crate::theme;
|
||||
|
||||
#[test]
|
||||
fn help_f1_opens_discover_without_a_document() {
|
||||
let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), crate::Services::default());
|
||||
let (_, help) = menu_tree().into_iter().find(|(title, _)| *title == "Help").unwrap();
|
||||
assert!(help.iter().any(|item| matches!(item, Item::Cmd("VectorCraft Help…", "help.discover", _))));
|
||||
assert_eq!(shortcut_of("help.discover"), Some("F1"));
|
||||
assert!(enabled(&app, "help.discover"));
|
||||
let ctx = egui::Context::default();
|
||||
theme::install_fonts(&ctx);
|
||||
let key = |key| egui::Event::Key { key, physical_key: None, pressed: true, repeat: false, modifiers: egui::Modifiers::NONE };
|
||||
ctx.run_ui(egui::RawInput { events: vec![key(egui::Key::F1)], ..Default::default() }, |ui| {
|
||||
crate::shortcuts::handle(&mut app, ui.ctx());
|
||||
})
|
||||
.textures_delta
|
||||
.clear();
|
||||
assert!(crate::panel_docking::showing(&app.ui, "discover"));
|
||||
assert!(app.session.active().is_none());
|
||||
app.run("help.discover", json!({})).unwrap();
|
||||
assert!(crate::panel_docking::showing(&app.ui, "discover"));
|
||||
|
||||
let tools = app.run("help.discover.search", json!({"query": "rectangle"})).unwrap();
|
||||
let tool = tools["results"].as_array().unwrap().iter().position(|hit| hit["kind"] == "tool" && hit["id"] == "rectangle").unwrap();
|
||||
let active_tool = app.session.tool_id();
|
||||
let picked = app.run("help.discover.choose", json!({"index": tool})).unwrap();
|
||||
assert_eq!(picked["result"]["id"], "rectangle");
|
||||
assert!(app.ui.learn_locate.is_some());
|
||||
assert_eq!(app.session.tool_id(), active_tool);
|
||||
for _ in 0..2 {
|
||||
ctx.run_ui(egui::RawInput::default(), |ui| crate::panels::discover::show(&mut app, ui)).textures_delta.clear();
|
||||
}
|
||||
ctx.run_ui(egui::RawInput { events: vec![key(egui::Key::Escape)], ..Default::default() }, |ui| {
|
||||
crate::shortcuts::handle(&mut app, ui.ctx());
|
||||
crate::panels::discover::show(&mut app, ui);
|
||||
})
|
||||
.textures_delta
|
||||
.clear();
|
||||
assert!(!crate::panel_docking::showing(&app.ui, "discover"));
|
||||
app.run("help.discover", json!({})).unwrap();
|
||||
app.run("help.discover.back", json!({})).unwrap();
|
||||
assert_eq!(app.ui.discover.query, "rectangle");
|
||||
assert!(app.ui.discover.selected.is_none());
|
||||
crate::keymap::set_override(&mut app.ui.shortcut_overrides, "tool:rectangle", "Shift+9");
|
||||
crate::shortcut_editor::sync(&app.ui);
|
||||
let tools = app.run("help.discover.search", json!({"query": "rectangle"})).unwrap();
|
||||
assert!(tools["results"].as_array().unwrap().iter().any(|hit| hit["kind"] == "tool" && hit["id"] == "rectangle" && hit["shortcut"] == "Shift+9"));
|
||||
crate::shortcut_editor::sync(&crate::state::UiState::default());
|
||||
|
||||
let commands = app.run("help.discover.search", json!({"query": "file.newDialog"})).unwrap();
|
||||
let command = commands["results"].as_array().unwrap().iter().position(|hit| hit["id"] == "file.newDialog").unwrap();
|
||||
app.run("help.discover.choose", json!({"index": command})).unwrap();
|
||||
assert!(app.ui.dialog.is_none());
|
||||
assert!(app.session.active().is_none());
|
||||
|
||||
let tutorial = crate::panels::learn::catalog::SKILLS[0].tutorials.first().unwrap();
|
||||
let found = app.run("help.discover.search", json!({"query": tutorial.title})).unwrap();
|
||||
let index = found["results"].as_array().unwrap().iter().position(|hit| hit["kind"] == "tutorial" && hit["id"] == tutorial.id).unwrap();
|
||||
app.run("help.discover.choose", json!({"index": index})).unwrap();
|
||||
assert!(app.session.active().is_none());
|
||||
let text = crate::tests_labels::painted_text(&mut app, crate::panels::discover::show);
|
||||
assert!(text.contains(tutorial.title), "{text}");
|
||||
app.ui.discover.focus = true;
|
||||
ctx.run_ui(egui::RawInput::default(), |ui| crate::panels::discover::show(&mut app, ui)).textures_delta.clear();
|
||||
ctx.run_ui(egui::RawInput { events: vec![key(egui::Key::Escape)], ..Default::default() }, |ui| {
|
||||
crate::shortcuts::handle(&mut app, ui.ctx());
|
||||
crate::panels::discover::show(&mut app, ui);
|
||||
})
|
||||
.textures_delta
|
||||
.clear();
|
||||
assert!(!crate::panel_docking::showing(&app.ui, "discover"));
|
||||
|
||||
app.run("file.new", json!({})).unwrap();
|
||||
app.run("help.discover", json!({})).unwrap();
|
||||
app.select_tool(vectorcraft_tools::addons::polygonal_lasso::ID);
|
||||
let view = app.view_info();
|
||||
for (x, y) in [(40.0, 40.0), (80.0, 40.0)] {
|
||||
let down = vectorcraft_tools::PointerEvent::new(vectorcraft_tools::PointerKind::Down, x, y);
|
||||
let up = vectorcraft_tools::PointerEvent::new(vectorcraft_tools::PointerKind::Up, x, y);
|
||||
app.session.pointer(&down, view).unwrap();
|
||||
app.session.pointer(&up, view).unwrap();
|
||||
}
|
||||
assert!(app.session.tool_ends_on_escape(view));
|
||||
let canvas_ctx = egui::Context::default();
|
||||
canvas_ctx
|
||||
.run_ui(egui::RawInput { events: vec![key(egui::Key::Escape)], ..Default::default() }, |ui| {
|
||||
crate::shortcuts::handle(&mut app, ui.ctx());
|
||||
})
|
||||
.textures_delta
|
||||
.clear();
|
||||
assert!(!app.session.tool_ends_on_escape(view));
|
||||
assert!(crate::panel_docking::showing(&app.ui, "discover"));
|
||||
}
|
||||
|
||||
/// With the toolbars hidden by Tab, choosing a tool in Help, or a tool's link in a tutorial Help
|
||||
/// shows, marks nothing and the status bar says why.
|
||||
#[test]
|
||||
fn discover_says_why_a_tool_cannot_be_marked() {
|
||||
fn texts(ctx: &egui::Context, app: &mut VectorcraftApp, events: Vec<egui::Event>) -> Vec<(String, egui::Rect)> {
|
||||
let mut out = ctx.run_ui(egui::RawInput { events, ..Default::default() }, |ui| crate::panels::discover::show(app, ui));
|
||||
out.textures_delta.clear();
|
||||
fn collect(s: &egui::Shape, out: &mut Vec<(String, egui::Rect)>) {
|
||||
match s {
|
||||
egui::Shape::Text(t) => out.push((t.galley.text().to_string(), t.visual_bounding_rect())),
|
||||
egui::Shape::Vec(v) => v.iter().for_each(|s| collect(s, out)),
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
let mut texts = vec![];
|
||||
for c in &out.shapes {
|
||||
collect(&c.shape, &mut texts);
|
||||
}
|
||||
texts
|
||||
}
|
||||
fn click(ctx: &egui::Context, app: &mut VectorcraftApp, label: &str) {
|
||||
texts(ctx, app, vec![]);
|
||||
let drawn = texts(ctx, app, vec![]);
|
||||
let pos = drawn.iter().find(|(t, _)| t == label).unwrap_or_else(|| panic!("`{label}` not drawn: {drawn:?}")).1.center();
|
||||
let button = |pressed| egui::Event::PointerButton { pos, button: egui::PointerButton::Primary, pressed, modifiers: Default::default() };
|
||||
for e in [egui::Event::PointerMoved(pos), button(true), button(false)] {
|
||||
texts(ctx, app, vec![e]);
|
||||
}
|
||||
}
|
||||
crate::i18n::set_current(crate::i18n::Lang::EN);
|
||||
let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), crate::Services::default());
|
||||
app.run("window.dock", json!({})).unwrap();
|
||||
assert!(app.ui.tab_hid.is_some() && !app.ui.toolbar);
|
||||
let reason = app.run("learn.locateTool", json!({"tool": "rectangle"})).unwrap()["reason"].as_str().unwrap().to_string();
|
||||
let ctx = egui::Context::default();
|
||||
theme::install_fonts(&ctx);
|
||||
|
||||
let found = app.run("help.discover.search", json!({"query": "rectangle"})).unwrap();
|
||||
let hit = found["results"].as_array().unwrap().iter().find(|hit| hit["kind"] == "tool" && hit["id"] == "rectangle").unwrap().clone();
|
||||
app.status("");
|
||||
click(&ctx, &mut app, hit["label"].as_str().unwrap());
|
||||
assert_eq!(app.ui.discover.selected.map(|i| app.ui.discover.results[i].id.as_str()), Some("rectangle"));
|
||||
assert!(app.ui.learn_locate.is_none());
|
||||
assert_eq!(app.ui.status, reason);
|
||||
|
||||
let (tutorial, tool) = crate::panels::learn::catalog::SKILLS
|
||||
.iter()
|
||||
.flat_map(|skill| skill.tutorials.iter())
|
||||
.find_map(|t| t.steps.iter().find_map(|s| s.tool).map(|tool| (t, tool)))
|
||||
.unwrap();
|
||||
let found = app.run("help.discover.search", json!({"query": tutorial.title})).unwrap();
|
||||
let index = found["results"].as_array().unwrap().iter().position(|hit| hit["kind"] == "tutorial" && hit["id"] == tutorial.id).unwrap();
|
||||
app.run("help.discover.choose", json!({"index": index})).unwrap();
|
||||
app.status("");
|
||||
click(&ctx, &mut app, vectorcraft_tools::tool_info(tool).unwrap().label);
|
||||
assert!(app.ui.learn_locate.is_none());
|
||||
assert_eq!(app.ui.status, reason);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn discover_rejects_invalid_search_and_selection_parameters() {
|
||||
let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), crate::Services::default());
|
||||
app.run("help.discover.search", json!({"query": "rectangle"})).unwrap();
|
||||
let before = app.ui.discover.query.clone();
|
||||
for params in
|
||||
[json!({}), json!({"query": null}), json!({"query": false}), json!({"query": "rectangle", "unknown": 1}), json!({"query": "a".repeat(1025)})]
|
||||
{
|
||||
assert!(app.run("help.discover.search", params).is_err());
|
||||
assert_eq!(app.ui.discover.query, before);
|
||||
}
|
||||
for index in [json!(-1), json!(1.5), json!(1000000), json!("0"), Value::Null] {
|
||||
assert!(app.run("help.discover.choose", json!({"index": index})).is_err());
|
||||
}
|
||||
for params in [json!(5), json!("rectangle"), json!([1]), json!(true)] {
|
||||
for id in ["help.discover", "help.discover.search", "help.discover.choose", "help.discover.back"] {
|
||||
assert!(app.run(id, params.clone()).is_err(), "{id} {params}");
|
||||
}
|
||||
assert_eq!(app.ui.discover.query, before);
|
||||
}
|
||||
app.run("help.discover.search", json!({"query": " "})).unwrap();
|
||||
assert!(app.ui.discover.results.is_empty());
|
||||
assert!(app.run("help.discover.choose", json!({"index": 0})).is_err());
|
||||
}
|
||||
|
||||
/// A kept command result follows its menu item: Show Grid reads Hide Grid once the grid shows.
|
||||
#[test]
|
||||
fn discover_command_results_follow_their_menu_label() {
|
||||
crate::i18n::set_current(crate::i18n::Lang::EN);
|
||||
let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), crate::Services::default());
|
||||
app.run("file.new", json!({})).unwrap();
|
||||
let found = app.run("help.discover.search", json!({"query": "view.grid"})).unwrap();
|
||||
let index = found["results"].as_array().unwrap().iter().position(|hit| hit["id"] == "view.grid" && hit["path"][0] == "View").unwrap();
|
||||
assert_eq!(found["results"][index]["label"], "Show Grid");
|
||||
app.run("help.discover.choose", json!({"index": index})).unwrap();
|
||||
app.run("view.grid", json!({})).unwrap();
|
||||
let back = app.run("help.discover", json!({})).unwrap();
|
||||
assert_eq!(back["selected"], index);
|
||||
assert_eq!(back["results"][index]["label"], "Hide Grid");
|
||||
}
|
||||
|
||||
/// A menu entry's shown path translates the menus' own names and keeps a Scripts folder's name, as
|
||||
/// the menus draw it; Help shows that path.
|
||||
#[test]
|
||||
fn menu_entry_shown_paths_keep_script_folder_names() {
|
||||
let app = VectorcraftApp::new(vectorcraft_engine::Session::new(), crate::Services::default());
|
||||
let de = crate::i18n::Lang::from_code("de").unwrap();
|
||||
assert_ne!(crate::i18n::tr(de, "File"), "File");
|
||||
let script = json!({"path": "File/a.jsx"});
|
||||
let folder = vec![Item::Cmd("a", crate::scripts_menu::COMMAND, script)];
|
||||
let items = vec![Item::Sub("Scripts", vec![Item::Sub("File", folder), Item::Cmd("Other Script…", "ui.runScript", Value::Null)])];
|
||||
let mut out = vec![];
|
||||
crate::i18n::set_current(de);
|
||||
flatten(&app, vec!["File".into()], vec![crate::i18n::t("File").into()], &items, &mut out);
|
||||
crate::i18n::set_current(crate::i18n::Lang::EN);
|
||||
let script = out.iter().find(|e| e.command.as_deref() == Some(crate::scripts_menu::COMMAND)).unwrap();
|
||||
assert_eq!(script.path, ["File", "Scripts", "File"]);
|
||||
assert_eq!(script.shown_path, [crate::i18n::tr(de, "File"), crate::i18n::tr(de, "Scripts"), "File"]);
|
||||
}
|
||||
|
||||
/// Outside macOS the window's menu bar has no VectorCraft menu, so Help lists no command under it.
|
||||
#[test]
|
||||
fn discover_leaves_out_menus_the_window_does_not_show() {
|
||||
crate::i18n::set_current(crate::i18n::Lang::EN);
|
||||
let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), crate::Services::default());
|
||||
let app_menu: Vec<String> =
|
||||
menu_entries(&app).into_iter().filter(|e| e.path.first().is_some_and(|t| t == "VectorCraft")).filter_map(|e| e.command).collect();
|
||||
assert!(!app_menu.is_empty());
|
||||
for id in app_menu {
|
||||
let found = app.run("help.discover.search", json!({"query": id})).unwrap();
|
||||
let listed = found["results"].as_array().unwrap().iter().any(|hit| hit["path"][0] == "VectorCraft");
|
||||
assert_eq!(listed, cfg!(target_os = "macos"), "{id}: {found}");
|
||||
}
|
||||
}
|
||||
|
||||
/// Help finds a command by the label its menu shows in the UI language, also where the menu names
|
||||
/// an effect by its own id (Effect › Pathfinder › Add reads Réunion in French).
|
||||
#[test]
|
||||
fn discover_finds_commands_by_their_shown_menu_label() {
|
||||
let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), crate::Services::default());
|
||||
let fr = crate::i18n::Lang::from_code("fr").unwrap();
|
||||
let shown = crate::i18n::tr_id(fr, "pathfinder.add", "Add");
|
||||
assert_ne!(shown, crate::i18n::tr(fr, "Add"));
|
||||
crate::i18n::set_current(fr);
|
||||
let found = app.run("help.discover.search", json!({"query": shown}));
|
||||
let effect = crate::i18n::tr(fr, "Effect").to_string();
|
||||
crate::i18n::set_current(crate::i18n::Lang::EN);
|
||||
let found = found.unwrap();
|
||||
let hits = found["results"].as_array().unwrap();
|
||||
assert!(
|
||||
hits.iter().any(|hit| hit["kind"] == "command"
|
||||
&& hit["id"].as_str().is_some_and(|id| id.starts_with("effect."))
|
||||
&& hit["label"] == shown
|
||||
&& hit["path"][0] == effect),
|
||||
"{found}"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn discover_results_show_the_current_shortcut_and_language_after_a_change() {
|
||||
let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), crate::Services::default());
|
||||
let found = app.run("help.discover.search", json!({"query": "file.newDialog"})).unwrap();
|
||||
let index = found["results"].as_array().unwrap().iter().position(|hit| hit["id"] == "file.newDialog").unwrap();
|
||||
assert_eq!(found["results"][index]["shortcut"], "Cmd+N");
|
||||
app.run("help.discover.choose", json!({"index": index})).unwrap();
|
||||
app.run("window.panel.close", json!({"panel": "discover"})).unwrap();
|
||||
app.run("shortcuts.set", json!({"id": "file.newDialog", "shortcut": "Cmd+Alt+Shift+F9"})).unwrap();
|
||||
|
||||
let reopened = app.run("help.discover", json!({})).unwrap();
|
||||
assert_eq!(reopened["query"], "file.newDialog");
|
||||
assert_eq!(reopened["selected"], index);
|
||||
assert_eq!(reopened["results"][index]["id"], "file.newDialog");
|
||||
assert_eq!(reopened["results"][index]["shortcut"], "Cmd+Alt+Shift+F9");
|
||||
let picked = app.run("help.discover.choose", json!({"index": index})).unwrap();
|
||||
assert_eq!(picked["result"]["shortcut"], "Cmd+Alt+Shift+F9");
|
||||
assert_eq!(picked["location"]["shortcut"], "Cmd+Alt+Shift+F9");
|
||||
|
||||
app.run("shortcuts.set", json!({"id": "file.newDialog", "shortcut": "Cmd+Alt+Shift+F8"})).unwrap();
|
||||
let text = crate::tests_labels::painted_text(&mut app, crate::panels::discover::show);
|
||||
assert!(text.contains(&pretty_shortcut("Cmd+Alt+Shift+F8")), "{text}");
|
||||
assert!(!text.contains(&pretty_shortcut("Cmd+Alt+Shift+F9")), "{text}");
|
||||
|
||||
let de = crate::i18n::Lang::from_code("de").unwrap();
|
||||
assert_ne!(crate::i18n::tr(de, "New…"), "New…");
|
||||
crate::i18n::set_current(de);
|
||||
let back = app.run("help.discover.back", json!({})).unwrap();
|
||||
crate::i18n::set_current(crate::i18n::Lang::EN);
|
||||
assert_eq!(back["query"], "file.newDialog");
|
||||
assert_eq!(back["results"][index]["label"], crate::i18n::tr(de, "New…"));
|
||||
assert_eq!(back["results"][index]["path"][0], crate::i18n::tr(de, "File"));
|
||||
crate::shortcut_editor::sync(&crate::state::UiState::default());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn help_bar_toggle_is_independent_and_saved_in_workspaces() {
|
||||
let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), crate::Services::default());
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use super::slots::{PERSPECTIVE_SLOTS, RECENT_FONT_IDS, RECENT_IDS, SAVED_SELECTION_IDS, SAVED_VIEW_IDS};
|
||||
use super::submenus::{INSERT_BREAK, INSERT_SPECIAL, INSERT_WHITESPACE, PATH_EFFECTS, TYPE_SIZES, effect_menu, font_items, insert_items};
|
||||
use super::{Item, Sep, c, cp, json, sub, todos};
|
||||
use super::{Item, Sep, c, cp, json, sub};
|
||||
|
||||
/// The in-window and native menu tree. The in-window bar skips the VectorCraft menu (see
|
||||
/// `menu_bar`); the native Mac bar is composed from the whole tree (see `native_menu`).
|
||||
@@ -753,7 +753,7 @@ pub fn menu_tree_named(english_names: bool) -> Vec<(&'static str, Vec<Item>)> {
|
||||
c("VectorCraft on getartcraft.com", "help.appPage"),
|
||||
c("VectorCraft on GitHub", "help.github"),
|
||||
Sep,
|
||||
todos("VectorCraft Help…", "F1"),
|
||||
c("VectorCraft Help…", "help.discover"),
|
||||
c("Safe Mode…", "help.safeMode"),
|
||||
c("Copy Troubleshooting Info", "help.copyTroubleshootingInfo"),
|
||||
Sep,
|
||||
|
||||
@@ -901,6 +901,25 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[
|
||||
("help.about", "About VectorCraft", "", "{}"),
|
||||
("help.checkForUpdates", "Check for Updates…", "", "{}"),
|
||||
("help.commandPalette", "Search Commands…", "Cmd+Shift+/", "{}"),
|
||||
(
|
||||
"help.discover",
|
||||
"VectorCraft Help…",
|
||||
"F1",
|
||||
"{query?: string (at most 1024 characters, VectorCraft's limit)} show the Help panel without toggling it closed; a supplied query searches tools, menu commands, and built-in tutorials; omission keeps the current search. Returns {query, results: [{kind: tool|command|tutorial, id, label, path, shortcut}], selected: index|null}",
|
||||
),
|
||||
(
|
||||
"help.discover.search",
|
||||
"Search",
|
||||
"",
|
||||
"{query: string (at most 1024 characters, VectorCraft's limit)} search tools, menu commands, and built-in tutorials and show the Help panel; empty or whitespace-only text clears the results. Returns the help.discover result",
|
||||
),
|
||||
(
|
||||
"help.discover.choose",
|
||||
"Select",
|
||||
"",
|
||||
"{index: zero-based result index} show a tool's location, a tutorial's steps in Help, or a command's menu path and shortcut without running it; an invalid index is an error. Returns {result: chosen result, location: tool location, tutorial id, or command path}",
|
||||
),
|
||||
("help.discover.back", "Back", "", "{} return from a Help result to its search results without changing the query"),
|
||||
(
|
||||
"help.safeMode",
|
||||
"Safe Mode…",
|
||||
|
||||
@@ -610,7 +610,7 @@ pub fn sync(app: &mut VectorcraftApp, ctx: &egui::Context) {
|
||||
/// interaction is open (for example a move, scale or shape drag, a dialog's or the font menu's
|
||||
/// preview, or a typing session), the revision, which each of its previews changes, is left out:
|
||||
/// the hash changes as the interaction begins and as it ends.
|
||||
fn state_hash(app: &VectorcraftApp, input: Option<u64>) -> u64 {
|
||||
pub(crate) fn state_hash(app: &VectorcraftApp, input: Option<u64>) -> u64 {
|
||||
let mut h = DefaultHasher::new();
|
||||
input.hash(&mut h);
|
||||
app.run_count.hash(&mut h);
|
||||
|
||||
@@ -17,6 +17,7 @@ pub mod color_guide;
|
||||
pub mod color_themes;
|
||||
pub mod color_wheel;
|
||||
pub mod css_properties;
|
||||
pub mod discover;
|
||||
pub mod doc_info;
|
||||
pub mod flattener_preview;
|
||||
pub mod glyphs;
|
||||
@@ -192,6 +193,7 @@ pub fn show_icon_panel(app: &mut VectorcraftApp, ui: &mut Ui, id: &str) {
|
||||
three_d::ID => three_d::show(app, ui),
|
||||
script_console::ID => script_console::show(app, ui),
|
||||
learn::ID => learn::show(app, ui),
|
||||
discover::ID => discover::show(app, ui),
|
||||
crate::addons::cleanup::ID => crate::addons::cleanup::show(app, ui),
|
||||
crate::addons::color::ID => crate::addons::color::show(app, ui),
|
||||
crate::addons::packaging::ID => crate::addons::packaging::show(app, ui),
|
||||
|
||||
@@ -0,0 +1,336 @@
|
||||
//! Help searches the tools, menu commands, and built-in tutorials.
|
||||
|
||||
use egui::Ui;
|
||||
use serde::Serialize;
|
||||
use serde_json::{Value, json};
|
||||
|
||||
use crate::{VectorcraftApp, menus};
|
||||
|
||||
pub const ID: &str = "discover";
|
||||
const MAX_QUERY: usize = 1024;
|
||||
|
||||
#[derive(Clone, Debug, Serialize)]
|
||||
pub struct Hit {
|
||||
pub kind: &'static str,
|
||||
pub id: String,
|
||||
pub label: String,
|
||||
pub path: Vec<String>,
|
||||
pub shortcut: String,
|
||||
/// The English label and menu path that `label` and `path` translate, and a command's menu
|
||||
/// params, kept to bring a retained result up to date ([`refresh`]).
|
||||
#[serde(skip)]
|
||||
english_label: String,
|
||||
#[serde(skip)]
|
||||
english_path: Vec<String>,
|
||||
#[serde(skip)]
|
||||
params: Value,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct View {
|
||||
pub query: String,
|
||||
pub results: Vec<Hit>,
|
||||
pub selected: Option<usize>,
|
||||
pub focus: bool,
|
||||
/// The menu state ([`crate::native_menu::state_hash`]: commands run, shortcuts, the language,
|
||||
/// recent files and more) the results were last brought up to date for.
|
||||
current_for: Option<u64>,
|
||||
}
|
||||
|
||||
fn matches(query: &str, text: &str) -> bool {
|
||||
let text = text.to_lowercase();
|
||||
query.split_whitespace().all(|word| text.contains(word))
|
||||
}
|
||||
|
||||
fn now(app: &VectorcraftApp) -> u64 {
|
||||
crate::native_menu::state_hash(app, None)
|
||||
}
|
||||
|
||||
/// Updates the retained results' labels, menu paths and shortcuts after the menu state changes (a
|
||||
/// command, a shortcut or the UI language), keeping the query, the results' order and the selected
|
||||
/// result. A command result takes its menu item's current label and place (Show Grid becomes Hide
|
||||
/// Grid), and leaves the results when no menu lists it any more, such as a recent file that was
|
||||
/// removed.
|
||||
fn refresh(app: &mut VectorcraftApp) {
|
||||
let stamp = now(app);
|
||||
if app.ui.discover.current_for == Some(stamp) {
|
||||
return;
|
||||
}
|
||||
let lang = crate::i18n::current();
|
||||
let entries = if app.ui.discover.results.iter().any(|hit| hit.kind == "command") { menus::menu_entries(app) } else { Vec::new() };
|
||||
let mut by_command: std::collections::HashMap<(&str, String), Vec<&menus::MenuEntry>> = std::collections::HashMap::new();
|
||||
for entry in &entries {
|
||||
if let Some(id) = entry.command.as_deref() {
|
||||
by_command.entry((id, entry.params.to_string())).or_default().push(entry);
|
||||
}
|
||||
}
|
||||
let selected = app.ui.discover.selected.take();
|
||||
let mut kept = Vec::with_capacity(app.ui.discover.results.len());
|
||||
for (index, mut hit) in std::mem::take(&mut app.ui.discover.results).into_iter().enumerate() {
|
||||
match hit.kind {
|
||||
"tool" => {
|
||||
hit.label = crate::i18n::tr(lang, &hit.english_label).into();
|
||||
hit.shortcut = crate::shortcut_editor::tool_shortcut(&hit.id).unwrap_or_default().into();
|
||||
}
|
||||
"command" => {
|
||||
let same = by_command.get(&(hit.id.as_str(), hit.params.to_string())).map_or(&[][..], Vec::as_slice);
|
||||
let Some(entry) = same.iter().find(|e| e.path == hit.english_path).or_else(|| same.first()) else {
|
||||
continue;
|
||||
};
|
||||
hit.english_label = entry.label.clone();
|
||||
hit.english_path = entry.path.clone();
|
||||
hit.label = menus::shown_label(app, &hit.id, &hit.params, &hit.english_label);
|
||||
hit.path = entry.shown_path.clone();
|
||||
hit.shortcut = menus::item_shortcut(&hit.id, &hit.params).or_else(|| menus::shortcut_of(&hit.id)).unwrap_or_default().into();
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
if selected == Some(index) {
|
||||
app.ui.discover.selected = Some(kept.len());
|
||||
}
|
||||
kept.push(hit);
|
||||
}
|
||||
app.ui.discover.results = kept;
|
||||
app.ui.discover.current_for = Some(stamp);
|
||||
}
|
||||
|
||||
fn search(app: &VectorcraftApp, query: &str) -> Vec<Hit> {
|
||||
let query = query.trim().to_lowercase();
|
||||
if query.is_empty() {
|
||||
return Vec::new();
|
||||
}
|
||||
let mut hits = Vec::new();
|
||||
let lang = crate::i18n::current();
|
||||
for tool in vectorcraft_tools::catalog::all_tools() {
|
||||
let label = crate::i18n::tr(lang, tool.label);
|
||||
if matches(&query, &format!("{} {label} {}", tool.label, tool.id)) {
|
||||
hits.push(Hit {
|
||||
kind: "tool",
|
||||
id: tool.id.into(),
|
||||
label: label.into(),
|
||||
path: vec![],
|
||||
shortcut: crate::shortcut_editor::tool_shortcut(tool.id).unwrap_or_default().into(),
|
||||
english_label: tool.label.into(),
|
||||
english_path: vec![],
|
||||
params: Value::Null,
|
||||
});
|
||||
}
|
||||
}
|
||||
for entry in menus::menu_entries(app) {
|
||||
let Some(id) = entry.command else { continue };
|
||||
// The menu bar in the window has no VectorCraft menu; only the native macOS bar shows it.
|
||||
if !cfg!(target_os = "macos") && entry.path.first().is_some_and(|title| title == "VectorCraft") {
|
||||
continue;
|
||||
}
|
||||
let label = menus::shown_label(app, &id, &entry.params, &entry.label);
|
||||
let path = entry.shown_path;
|
||||
if matches(&query, &format!("{} {label} {} {} {id}", entry.label, entry.path.join(" "), path.join(" "))) {
|
||||
hits.push(Hit {
|
||||
kind: "command",
|
||||
id,
|
||||
label,
|
||||
path,
|
||||
shortcut: entry.shortcut,
|
||||
english_label: entry.label,
|
||||
english_path: entry.path,
|
||||
params: entry.params,
|
||||
});
|
||||
}
|
||||
}
|
||||
for skill in super::learn::catalog::SKILLS {
|
||||
for tutorial in skill.tutorials {
|
||||
if matches(&query, &format!("{} {} {}", skill.title, tutorial.title, tutorial.id)) {
|
||||
hits.push(Hit {
|
||||
kind: "tutorial",
|
||||
id: tutorial.id.into(),
|
||||
label: tutorial.title.into(),
|
||||
path: vec![skill.title.into()],
|
||||
shortcut: String::new(),
|
||||
english_label: tutorial.title.into(),
|
||||
english_path: vec![skill.title.into()],
|
||||
params: Value::Null,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
hits
|
||||
}
|
||||
|
||||
fn results(app: &VectorcraftApp) -> Value {
|
||||
json!({"query": app.ui.discover.query, "results": app.ui.discover.results, "selected": app.ui.discover.selected})
|
||||
}
|
||||
|
||||
fn set_query(app: &mut VectorcraftApp, query: &str) {
|
||||
app.ui.discover.current_for = Some(now(app));
|
||||
app.ui.discover.results = search(app, query);
|
||||
app.ui.discover.query = query.into();
|
||||
app.ui.discover.selected = None;
|
||||
}
|
||||
|
||||
pub(crate) fn command(app: &mut VectorcraftApp, id: &str, p: &Value) -> Option<Result<Value, String>> {
|
||||
let spec = menus::UI_COMMANDS.iter().find(|spec| spec.0 == id && id.starts_with("help.discover"))?;
|
||||
if !(p.is_object() || p.is_null()) {
|
||||
return Some(Err("`params` must be an object".into()));
|
||||
}
|
||||
if let Err(e) = vectorcraft_engine::cmd::params::check_keys(id, spec.3, p) {
|
||||
return Some(Err(e.to_string()));
|
||||
}
|
||||
refresh(app);
|
||||
Some(match id {
|
||||
"help.discover" | "help.discover.search" => {
|
||||
let query = match p.get("query") {
|
||||
Some(Value::String(query)) => Some(query.as_str()),
|
||||
None if id == "help.discover" => None,
|
||||
_ => {
|
||||
let key = "query";
|
||||
return Some(Err(format!("`{key}` must be a string")));
|
||||
}
|
||||
};
|
||||
if let Some(query) = query {
|
||||
if query.chars().take(MAX_QUERY + 1).count() > MAX_QUERY {
|
||||
let label = "query";
|
||||
let max = MAX_QUERY;
|
||||
return Some(Err(format!("{label} must be at most {max} characters")));
|
||||
}
|
||||
set_query(app, query);
|
||||
}
|
||||
app.ui.discover.focus = true;
|
||||
crate::panel_docking::reveal_panel(app, ID).map(|_| results(app))
|
||||
}
|
||||
"help.discover.choose" => {
|
||||
let hit = p
|
||||
.get("index")
|
||||
.and_then(Value::as_u64)
|
||||
.and_then(|i| usize::try_from(i).ok())
|
||||
.and_then(|i| app.ui.discover.results.get(i).cloned().map(|hit| (i, hit)));
|
||||
let Some((index, hit)) = hit else {
|
||||
return Some(Err("index out of range".into()));
|
||||
};
|
||||
let outcome = match hit.kind {
|
||||
"tool" => app.run("learn.locateTool", json!({"tool": hit.id})),
|
||||
"tutorial" => Ok(json!({"tutorial": hit.id})),
|
||||
_ => Ok(json!({"command": hit.id, "path": hit.path, "shortcut": hit.shortcut})),
|
||||
};
|
||||
outcome.and_then(|outcome| {
|
||||
crate::panel_docking::reveal_panel(app, ID)?;
|
||||
app.ui.discover.selected = Some(index);
|
||||
app.ui.discover.focus = true;
|
||||
Ok(json!({"result": hit, "location": outcome}))
|
||||
})
|
||||
}
|
||||
"help.discover.back" => {
|
||||
app.ui.discover.selected = None;
|
||||
app.ui.discover.focus = true;
|
||||
Ok(results(app))
|
||||
}
|
||||
_ => return None,
|
||||
})
|
||||
}
|
||||
|
||||
pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) {
|
||||
refresh(app);
|
||||
let mut query = app.ui.discover.query.clone();
|
||||
let field = ui.add(egui::TextEdit::singleline(&mut query).char_limit(MAX_QUERY).hint_text(tl!("Search")).desired_width(f32::INFINITY));
|
||||
if std::mem::take(&mut app.ui.discover.focus) {
|
||||
field.request_focus();
|
||||
}
|
||||
if field.changed()
|
||||
&& let Err(e) = app.run("help.discover.search", json!({"query": query}))
|
||||
{
|
||||
app.status(e);
|
||||
}
|
||||
if (field.has_focus() || field.lost_focus())
|
||||
&& !app.session.tool_busy()
|
||||
&& !app.session.tool_composing()
|
||||
&& ui.input_mut(|i| i.consume_key(egui::Modifiers::NONE, egui::Key::Escape))
|
||||
{
|
||||
if let Err(e) = app.run("window.panel.close", json!({"panel": ID})) {
|
||||
app.status(e);
|
||||
}
|
||||
return;
|
||||
}
|
||||
let mut chosen = None;
|
||||
let mut home = false;
|
||||
let mut back = false;
|
||||
let mut locate = None;
|
||||
ui.horizontal(|ui| {
|
||||
home = ui.button(tl!("Home")).clicked();
|
||||
if app.ui.discover.selected.is_some() {
|
||||
back = ui.button(tl!("Back")).clicked();
|
||||
}
|
||||
});
|
||||
crate::widgets::divider(ui);
|
||||
if let Some(hit) = app.ui.discover.selected.and_then(|i| app.ui.discover.results.get(i)) {
|
||||
ui.heading(&hit.label);
|
||||
if !hit.path.is_empty() {
|
||||
ui.label(hit.path.join(" › "));
|
||||
}
|
||||
if !hit.shortcut.is_empty() {
|
||||
ui.label(menus::pretty_shortcut(&hit.shortcut));
|
||||
}
|
||||
if hit.kind == "tutorial"
|
||||
&& let Some((_, tutorial)) = super::learn::catalog::tutorial(&hit.id)
|
||||
{
|
||||
for (index, step) in tutorial.steps.iter().enumerate() {
|
||||
ui.label(format!("{}. {}", index + 1, step.plain()));
|
||||
if let Some(tool) = step.tool
|
||||
&& let Some(info) = vectorcraft_tools::tool_info(tool)
|
||||
&& ui.link(crate::i18n::tr(crate::i18n::current(), info.label)).clicked()
|
||||
{
|
||||
locate = Some(tool);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
egui::ScrollArea::vertical().id_salt("discover-results").show(ui, |ui| {
|
||||
if app.ui.discover.results.is_empty() && !query.trim().is_empty() {
|
||||
ui.label(tl!("No results"));
|
||||
}
|
||||
for kind in ["tool", "command", "tutorial"] {
|
||||
let label = match kind {
|
||||
"tool" => tl!("Tools"),
|
||||
"command" => tl!("Search Commands…"),
|
||||
_ => tl!("Learn"),
|
||||
};
|
||||
let mut heading = false;
|
||||
for (index, hit) in app.ui.discover.results.iter().enumerate().filter(|(_, h)| h.kind == kind) {
|
||||
if !heading {
|
||||
crate::widgets::subheader(ui, label);
|
||||
heading = true;
|
||||
}
|
||||
if ui.selectable_label(false, &hit.label).on_hover_text(hit.path.join(" › ")).clicked() {
|
||||
chosen = Some(index);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
if home {
|
||||
if let Err(e) = app.run("help.discover.search", json!({"query": ""})) {
|
||||
app.status(e);
|
||||
}
|
||||
} else if back {
|
||||
if let Err(e) = app.run("help.discover.back", json!({})) {
|
||||
app.status(e);
|
||||
}
|
||||
} else if let Some(index) = chosen {
|
||||
match app.run("help.discover.choose", json!({"index": index})) {
|
||||
Ok(picked) => status_reason(app, &picked["location"]),
|
||||
Err(e) => app.status(e),
|
||||
}
|
||||
}
|
||||
if let Some(tool) = locate {
|
||||
match app.run("learn.locateTool", json!({"tool": tool})) {
|
||||
Ok(located) => status_reason(app, &located),
|
||||
Err(e) => app.status(e),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A `learn.locateTool` reply that could not mark its tool (`location: "unavailable"`) shows its
|
||||
/// `reason` in the status bar.
|
||||
fn status_reason(app: &mut VectorcraftApp, located: &Value) {
|
||||
if let Some(reason) = located.get("reason").and_then(Value::as_str) {
|
||||
app.status(reason);
|
||||
}
|
||||
}
|
||||
@@ -225,6 +225,7 @@ pub const ICON_PANELS: &[(&str, &str, &str)] = &[
|
||||
(crate::panels::variables::ID, "Variables", "chart-column"),
|
||||
(crate::panels::script_console::ID, "Script Console", "message-circle"),
|
||||
(crate::panels::learn::ID, "Learn", "graduation-cap"),
|
||||
(crate::panels::discover::ID, "VectorCraft Help…", "search"),
|
||||
(crate::addons::cleanup::ID, "Artwork Cleanup", "sparkles"),
|
||||
(crate::addons::color::ID, "Color Effects", "sun"),
|
||||
(crate::addons::packaging::ID, "Fold Lines", "scissors"),
|
||||
@@ -428,6 +429,8 @@ pub struct UiState {
|
||||
/// The Learn panel's tab, skill and tutorial, kept while the app runs.
|
||||
#[serde(skip)]
|
||||
pub learn: crate::panels::learn::View,
|
||||
#[serde(skip)]
|
||||
pub discover: crate::panels::discover::View,
|
||||
/// The tool whose place a Learn tutorial step's link shows (`learn.locateTool`), while its mark
|
||||
/// is on screen. Not saved.
|
||||
#[serde(skip)]
|
||||
@@ -1182,6 +1185,7 @@ impl Default for UiState {
|
||||
find_font_in: String::new(),
|
||||
constrain_pie_angle: false,
|
||||
learn: Default::default(),
|
||||
discover: Default::default(),
|
||||
learn_locate: None,
|
||||
learn_practice: Default::default(),
|
||||
learn_progress: Default::default(),
|
||||
|
||||
+33
@@ -3446,6 +3446,39 @@ own layout rules.
|
||||
{"name":"invoke_menu","arguments":{"command":"window.toolbar.dock","params":{"name":"Toolbar 1","side":"left","order":0}}}
|
||||
```
|
||||
|
||||
## Help search
|
||||
|
||||
Help › VectorCraft Help… and F1 show the Help panel. `help.discover {query?}` opens it without
|
||||
toggling it closed. A supplied string searches tools, menu commands, and VectorCraft's built-in
|
||||
tutorials. Omitting `query` preserves the current search. Empty or whitespace-only text clears
|
||||
the results. VectorCraft limits a query to 1024 characters and rejects a longer supplied string.
|
||||
|
||||
`help.discover.search {query}` runs the same search and shows the panel. Both commands return
|
||||
`{query, results: [{kind, id, label, path, shortcut}], selected}`. `kind` is `tool`, `command`, or
|
||||
`tutorial`; `selected` is a zero-based result index or `null`. Search matches all the query's
|
||||
words without regard to case, using translated tool labels, command labels as their menus show
|
||||
them, and the English labels, ids, and menu paths. A result's `path` names the menus as they are
|
||||
drawn, with plug-in submenus and Scripts folders under their own names. Outside macOS, items of
|
||||
the VectorCraft application menu, which only the macOS menu bar shows, are left out. Tutorial text remains in English. After a shortcut or the interface
|
||||
language changes, the kept results show the current shortcuts, labels, and menu paths, with the
|
||||
query and the selected result unchanged. A command result also shows its menu item's current
|
||||
label (Show Grid becomes Hide Grid), and a command that no menu lists any more, such as a removed
|
||||
recent file, drops out of the results. Parameters other than an object are an error.
|
||||
|
||||
`help.discover.choose {index}` shows that result. A tool result marks its toolbar location without
|
||||
choosing the tool. A command result shows its menu path and current shortcut without running it.
|
||||
A tutorial result shows its numbered steps; a tool link in a step marks that tool's location.
|
||||
The reply is `{result, location}`, with the chosen result and the tool-location reply, tutorial
|
||||
id, or command path. An invalid index returns an error and preserves the selected result. When a
|
||||
tool cannot be marked because Tab or Presentation Mode hides the toolbars, the panel shows the
|
||||
tool-location reply's `reason` in the status bar.
|
||||
|
||||
Home clears the search. Back and `help.discover.back {}` return to its results with the query
|
||||
preserved. Escape in the search field closes the panel. Escape on the canvas still cancels an
|
||||
active tool operation. The panel uses the existing tool-location marks; command guidance is a
|
||||
menu path. Articles, Quick Actions, personalized recommendations, and Discover preferences are
|
||||
not included.
|
||||
|
||||
## Learn panel
|
||||
|
||||
Window › Learn and the Explore tutorials button beside the search field at the right end of the app bar show and hide
|
||||
|
||||
@@ -408,6 +408,7 @@ next unit in the order a right-click on a ruler lists them, from Feet back to Po
|
||||
|---|---|---|
|
||||
| Effect > Warp Options: style previews, orientation choices and percent controls | done | #1760; focused input, mixed-style and history checks passed; original captures reviewed. No geometry or optional Properties changes. |
|
||||
| Command search: Up and Down move through the results, Enter runs the highlighted one | done | #1798 (#1757) |
|
||||
| Help › VectorCraft Help… and F1 show in-app search for tools, menu commands, and built-in tutorials. Tool results mark their toolbar location; command results show their menu path and shortcut without running them; tutorial results show their steps. Home clears the search, Back returns to the results, and Escape in the search field closes the panel. | partial | [Public source](https://helpx.adobe.com/illustrator/desktop/get-started/learn-the-basics/learn-with-discover-panel.html); `help.discover`, `help.discover.search`, `help.discover.choose`, `help.discover.back`; `menus::tests::help_f1_opens_discover_without_a_document`. Articles, Quick Actions, and Discover preferences are not implemented. Menu-path text instead of a menu location marker is VectorCraft's current guidance. |
|
||||
| Learn panel: Window › Learn and Explore tutorials on the app bar open it; For you holds a Quick skill guide card, Skills lists VectorCraft's own skills with progress rings that fill and counts of tutorials finished, a tutorial shows its numbered steps with a check box each that marks the step done once its sample is open, a finished tutorial has a check mark, Back goes up a level; a tool's name in a step is a link that marks the tool where the toolbars show it (its button, its group's flyout, a torn-off strip, a toolbar made with New Toolbar or the All Tools drawer) without choosing it; View more opens the tutorial's practice sample as a new untitled document, Finish tutorial then marks it finished with all its steps, and Next Up shows the next tutorial in the same skill; Reset progress clears the progress (no video) | done | [the help page](https://helpx.adobe.com/illustrator/desktop/get-started/learn-the-basics/learn-skills-quick-skill-guide.html); `learn.list`, `learn.tab`, `learn.skills`, `learn.skill`, `learn.show`, `learn.back`, `learn.locateTool`, `learn.openSample`, `learn.markStep`, `learn.finish`, `learn.next`, `learn.resetProgress`; the mark's look and 3-second lifetime, marking steps by hand, keeping the progress in the preferences and Reset progress are VectorCraft's own rules; `panels::learn::tests`, `toolbar::tests` |
|
||||
| Pathfinder panel: a group selected alone counts its nested shapes, so an expanded stroked object keeps the Shape Modes enabled | done | #1642 (#1635) |
|
||||
| Selected Grid Repeat shows row, column and corner handles and spacing sliders; bounding-box handles take priority where they meet | done | #2691, `tools/src/repeat_grid.rs`; [public behavior reference](https://helpx.adobe.com/illustrator/desktop/paint-and-fill/create-and-edit-patterns/set-grid-repeat-options.html); drags preview and commit `object.repeat.options` as one undo step, Escape cancels; a selected Radial Repeat shows an instances handle below it (16 px of drag per instance, 1 to 1,000) and a radius handle on its circle the same way (`tools/src/repeat_radial.rs`; [public behavior reference](https://helpx.adobe.com/illustrator/desktop/paint-and-fill/create-and-edit-patterns/create-radial-repeats.html)), and a splitter on its circle that hides the instances it is dragged back past while the others keep their places, and shows them again when dragged forward (its place half a step past the last instance shown and its limit of one instance shown are VectorCraft's own rules) |
|
||||
|
||||
Reference in New Issue
Block a user