diff --git a/crates/mcp/src/ui_catalog.rs b/crates/mcp/src/ui_catalog.rs index 2388e9d10d..ce61c395cb 100644 --- a/crates/mcp/src/ui_catalog.rs +++ b/crates/mcp/src/ui_catalog.rs @@ -1465,7 +1465,7 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "ui.action.new", "New Action", "", - "{set: index, name, key?: 0-15, cmd?, shift?, color?: red|yellow|green|blue|violet} add an action named name (spaces trimmed from both ends) after the last action of the Actions panel's set at set (0 is the top set) and start recording into it; Stop Playing/Recording (ui.action.stop) ends the recording. key 1 to 15 is the function key F1 to F15 that plays the action (0 or null: none), with cmd (Ctrl, Command on macOS) and shift; color is its Button Mode color (null or \"\": none), which the panel does not show. Action function keys take priority over command shortcuts and preserve the command's binding. On Windows F1, Ctrl+F4 and Ctrl+F6 cannot be used. The set becomes current and the new action is selected. The panel's Create New Action button and menu's New Action… (dialog `actionNew` with set, name, key, cmd, shift and color) run this on Record. While an action is recording, and for an index past the last set, an empty name, a key or color that is not one of these, or an action that would give the set more than 1,000 actions or an action set file larger than 8 MiB, it is an error, nothing is added and no recording starts → {set, action}", + "{set: index, name, key?: 0-15, cmd?, shift?, color?: red|yellow|green|blue|violet} add an action named name (spaces trimmed from both ends) after the last action of the Actions panel's set at set (0 is the top set) and start recording into it; Stop Playing/Recording (ui.action.stop) ends the recording. key 1 to 15 is the function key F1 to F15 that plays the action (0 or null: none), with cmd (Ctrl, Command on macOS) and shift; color is its Button Mode color (null or \"\": none), the color of its button in Button Mode (ui.action.buttonMode). Action function keys take priority over command shortcuts and preserve the command's binding. On Windows F1, Ctrl+F4 and Ctrl+F6 cannot be used. The set becomes current and the new action is selected. The panel's Create New Action button and menu's New Action… (dialog `actionNew` with set, name, key, cmd, shift and color) run this on Record. While an action is recording, and for an index past the last set, an empty name, a key or color that is not one of these, or an action that would give the set more than 1,000 actions or an action set file larger than 8 MiB, it is an error, nothing is added and no recording starts → {set, action}", ), ( "ui.action.options", @@ -1479,6 +1479,18 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "", "{action: name, set?: name} play the Actions panel's action named action at the speed ui.action.playbackOptions sets; set names the set to look in (default: every set). Accelerated plays it as one undoable batch → what command.batch returns. Step by Step and Pause For play its first step now and the others one at a time, each its own undo step, until the last, ui.action.stop, or a step that comes due while a different document is active than after the step before → {results: [the first step's result], pending: the steps left}. An action with a stop, at any speed, plays up to the stop and waits until ui.action.continue or ui.action.stop; at Accelerated the steps between stops are one undoable batch each → {results, pending, atStop?: true when it already waits}. A name no action has, or one that more than one action in the sets looked in has, or an action played while another is still playing step by step or with pauses, is an error and nothing plays", ), + ( + "ui.action.playAt", + "Play Action", + "", + "{set: index, action: index} play the Actions panel's action at action in set (0 is the top set) as ui.action.play plays it, and return what ui.action.play returns. A click on an action's button in Button Mode runs this. A missing index, or one that is not a whole number or is past the last set or action, is an error and nothing plays", + ), + ( + "ui.action.buttonMode", + "Button Mode", + "", + "{enabled?: bool} with true, the Actions panel shows every action of every set, in set order and then action order, as a button with its name in its Action Options color (no color: an ordinary button), without set names, steps or checkmarks, and a click on a button plays its action (ui.action.playAt); with false, it shows its list again; left out or null, it switches to the other view. The panel menu's Button Mode runs this and shows a check mark while it is on. The view is kept with the UI preferences. Turning it on while an action records, or an enabled that is not true, false or null, is an error and the view stays → {enabled}", + ), ( "ui.action.playbackOptions", "Playback Options", diff --git a/crates/ui-egui/src/i18n/bg.tsv b/crates/ui-egui/src/i18n/bg.tsv index 899f177897..e55ae3ba4b 100644 --- a/crates/ui-egui/src/i18n/bg.tsv +++ b/crates/ui-egui/src/i18n/bg.tsv @@ -6056,6 +6056,8 @@ axis Y Axis Y ос Action Options… Опции на действието… Action Options Опции на действието Playback Options… Опции за възпроизвеждане… + Button Mode Режим с бутони + No actions. Няма действия. Insert Stop… Вмъкване на спиране… Insert Stop Вмъкване на спиране Record Stop Записване на спиране diff --git a/crates/ui-egui/src/i18n/bs.tsv b/crates/ui-egui/src/i18n/bs.tsv index 3667c25b1c..2cabc842d7 100644 --- a/crates/ui-egui/src/i18n/bs.tsv +++ b/crates/ui-egui/src/i18n/bs.tsv @@ -6098,6 +6098,8 @@ axis Y Axis Y osa Action Options… Opcije akcije… Action Options Opcije akcije Playback Options… Opcije reprodukcije… + Button Mode Način dugmadi + No actions. Nema akcija. Insert Stop… Umetni zaustavljanje… Insert Stop Umetni zaustavljanje Record Stop Snimi zaustavljanje diff --git a/crates/ui-egui/src/i18n/ca.tsv b/crates/ui-egui/src/i18n/ca.tsv index 24db0fa430..9b5450beb2 100644 --- a/crates/ui-egui/src/i18n/ca.tsv +++ b/crates/ui-egui/src/i18n/ca.tsv @@ -4095,6 +4095,8 @@ digits Malayalam Malaiàlam Action Options… Opcions de l’acció… Action Options Opcions de l’acció Playback Options… Opcions de reproducció… + Button Mode Mode de botons + No actions. No hi ha accions. Insert Stop… Insereix una aturada… Insert Stop Insereix una aturada Record Stop Enregistra una aturada diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv index dc435f1d7e..a07ff7891b 100644 --- a/crates/ui-egui/src/i18n/cs.tsv +++ b/crates/ui-egui/src/i18n/cs.tsv @@ -6599,6 +6599,8 @@ axis Y Axis osa Y Action Options… Možnosti akce… Action Options Možnosti akce Playback Options… Možnosti přehrávání… + Button Mode Režim tlačítek + No actions. Žádné akce. Insert Stop… Vložit zastavení… Insert Stop Vložit zastavení Record Stop Zaznamenat zastavení diff --git a/crates/ui-egui/src/i18n/da.tsv b/crates/ui-egui/src/i18n/da.tsv index fa9365b849..ce0e2ab289 100644 --- a/crates/ui-egui/src/i18n/da.tsv +++ b/crates/ui-egui/src/i18n/da.tsv @@ -6072,6 +6072,8 @@ axis Y Axis Y-akse Action Options… Indstillinger for handling… Action Options Indstillinger for handling Playback Options… Afspilningsindstillinger… + Button Mode Knaptilstand + No actions. Ingen handlinger. Insert Stop… Indsæt stop… Insert Stop Indsæt stop Record Stop Optag stop diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv index 5016bbd953..c201b09eca 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -6191,6 +6191,8 @@ axis Y Axis Y-Achse Action Options… Aktionsoptionen… Action Options Aktionsoptionen Playback Options… Wiedergabeoptionen… + Button Mode Schaltflächenmodus + No actions. Keine Aktionen. Insert Stop… Stopp einfügen… Insert Stop Stopp einfügen Record Stop Stopp aufzeichnen diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv index d316f7d704..172c7a42e8 100644 --- a/crates/ui-egui/src/i18n/el.tsv +++ b/crates/ui-egui/src/i18n/el.tsv @@ -6551,6 +6551,8 @@ axis Y Axis Άξονας Y Action Options… Επιλογές ενέργειας… Action Options Επιλογές ενέργειας Playback Options… Επιλογές αναπαραγωγής… + Button Mode Λειτουργία κουμπιών + No actions. Δεν υπάρχουν ενέργειες. Insert Stop… Εισαγωγή διακοπής… Insert Stop Εισαγωγή διακοπής Record Stop Καταγραφή διακοπής diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv index 4cfeea4854..7731bfb4c1 100644 --- a/crates/ui-egui/src/i18n/es.tsv +++ b/crates/ui-egui/src/i18n/es.tsv @@ -6542,6 +6542,8 @@ axis Y Axis Eje Y Action Options… Opciones de acción… Action Options Opciones de acción Playback Options… Opciones de reproducción… + Button Mode Modo de botones + No actions. No hay acciones. Insert Stop… Insertar parada… Insert Stop Insertar parada Record Stop Grabar parada diff --git a/crates/ui-egui/src/i18n/fi.tsv b/crates/ui-egui/src/i18n/fi.tsv index a1ddf6101f..30bf6eca9b 100644 --- a/crates/ui-egui/src/i18n/fi.tsv +++ b/crates/ui-egui/src/i18n/fi.tsv @@ -6629,6 +6629,8 @@ axis Y Axis Y-akseli Action Options… Toiminnon asetukset… Action Options Toiminnon asetukset Playback Options… Toistoasetukset… + Button Mode Painiketila + No actions. Ei toimintoja. Insert Stop… Lisää pysäytys… Insert Stop Lisää pysäytys Record Stop Nauhoita pysäytys diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index 706c83909e..27d2096499 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -6594,6 +6594,8 @@ axis Y Axis Axe Y Action Options… Options de script… Action Options Options de script Playback Options… Options d’exécution… + Button Mode Mode Bouton + No actions. Aucun script. Insert Stop… Insérer un arrêt… Insert Stop Insérer un arrêt Record Stop Enregistrer un arrêt diff --git a/crates/ui-egui/src/i18n/hi.tsv b/crates/ui-egui/src/i18n/hi.tsv index dc28724be2..41ca3b4a61 100644 --- a/crates/ui-egui/src/i18n/hi.tsv +++ b/crates/ui-egui/src/i18n/hi.tsv @@ -3560,6 +3560,8 @@ antiAlias Sharp शार्प @msg the action set would be larger than 8 MiB एक्शन सेट 8 MiB से बड़ा हो जाएगा Playback Options प्लेबैक ऑप्शन्स Playback Options… प्लेबैक ऑप्शन्स… + Button Mode बटन मोड + No actions. कोई कार्रवाई नहीं। Plug-in Info प्लगइन जानकारी Plug-in… प्लग-इन… Plug-ins प्लग-इन्स diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv index ab06863782..aec8e0d2e9 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -6582,6 +6582,8 @@ axis Y Axis Y tengely Action Options… Művelet beállításai… Action Options Művelet beállításai Playback Options… Lejátszási beállítások… + Button Mode Gomb mód + No actions. Nincs művelet. Insert Stop… Megállás beszúrása… Insert Stop Megállás beszúrása Record Stop Megállás rögzítése diff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsv index 4900aa3cbf..d9ad8e32ee 100644 --- a/crates/ui-egui/src/i18n/id.tsv +++ b/crates/ui-egui/src/i18n/id.tsv @@ -6072,6 +6072,8 @@ axis Y Axis Sumbu Y Action Options… Opsi tindakan… Action Options Opsi tindakan Playback Options… Opsi pemutaran… + Button Mode Mode tombol + No actions. Tidak ada aksi. Insert Stop… Sisipkan henti… Insert Stop Sisipkan henti Record Stop Rekam henti diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv index 5ef768e629..f7deb77591 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -6225,6 +6225,8 @@ axis Y Axis Asse Y Action Options… Opzioni azione… Action Options Opzioni azione Playback Options… Opzioni di riproduzione… + Button Mode Modalità pulsante + No actions. Nessuna azione. Insert Stop… Inserisci interruzione… Insert Stop Inserisci interruzione Record Stop Registra interruzione diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv index f2a1ffc1e1..d23fcabb2b 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -6291,6 +6291,8 @@ axis Y Axis Y 軸 Action Options… アクションオプション… Action Options アクションオプション Playback Options… 再生オプション… + Button Mode ボタンモード + No actions. アクションがありません。 Insert Stop… 停止を挿入… Insert Stop 停止を挿入 Record Stop 停止を記録 diff --git a/crates/ui-egui/src/i18n/ka.tsv b/crates/ui-egui/src/i18n/ka.tsv index 0a0f488707..6cb2f0ac46 100644 --- a/crates/ui-egui/src/i18n/ka.tsv +++ b/crates/ui-egui/src/i18n/ka.tsv @@ -6550,6 +6550,8 @@ axis Y Axis Y ღერძი Action Options… მოქმედების პარამეტრები… Action Options მოქმედების პარამეტრები Playback Options… შესრულების პარამეტრები… + Button Mode ღილაკების რეჟიმი + No actions. მოქმედებები არ არის. Insert Stop… გაჩერების ჩასმა… Insert Stop გაჩერების ჩასმა Record Stop გაჩერების ჩაწერა diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv index 5344b0124b..7bcee02835 100644 --- a/crates/ui-egui/src/i18n/ko.tsv +++ b/crates/ui-egui/src/i18n/ko.tsv @@ -6186,6 +6186,8 @@ axis Y Axis Y축 Action Options… 액션 옵션… Action Options 액션 옵션 Playback Options… 재생 옵션… + Button Mode 버튼 모드 + No actions. 동작이 없습니다. Insert Stop… 중지 삽입… Insert Stop 중지 삽입 Record Stop 중지 기록 diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv index 7ce152334e..513d0815d7 100644 --- a/crates/ui-egui/src/i18n/nl.tsv +++ b/crates/ui-egui/src/i18n/nl.tsv @@ -6694,6 +6694,8 @@ axis Y Axis Y-as Action Options… Actieopties… Action Options Actieopties Playback Options… Afspeelopties… + Button Mode Knopmodus + No actions. Geen acties. Insert Stop… Stop invoegen… Insert Stop Stop invoegen Record Stop Stop opnemen diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv index ab70dfa4db..5682b148e4 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -6454,6 +6454,8 @@ axis Y Axis Oś Y Action Options… Opcje operacji… Action Options Opcje operacji Playback Options… Opcje odtwarzania… + Button Mode Tryb przycisków + No actions. Brak operacji. Insert Stop… Wstaw zatrzymanie… Insert Stop Wstaw zatrzymanie Record Stop Nagraj zatrzymanie diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv index 67bd16ba24..76811c836d 100644 --- a/crates/ui-egui/src/i18n/pt-br.tsv +++ b/crates/ui-egui/src/i18n/pt-br.tsv @@ -6514,6 +6514,8 @@ axis Y Axis Eixo Y Action Options… Opções da Ação… Action Options Opções da Ação Playback Options… Opções de Reprodução… + Button Mode Modo de Botão + No actions. Nenhuma ação. Insert Stop… Inserir Parada… Insert Stop Inserir Parada Record Stop Gravar Parada diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv index 2302b75e01..7b0c31f2fb 100644 --- a/crates/ui-egui/src/i18n/ru.tsv +++ b/crates/ui-egui/src/i18n/ru.tsv @@ -6210,6 +6210,8 @@ axis Y Axis Ось Y Action Options… Параметры действия… Action Options Параметры действия Playback Options… Параметры воспроизведения… + Button Mode Режим кнопок + No actions. Нет действий. Insert Stop… Вставить остановку… Insert Stop Вставить остановку Record Stop Записать остановку diff --git a/crates/ui-egui/src/i18n/sv.tsv b/crates/ui-egui/src/i18n/sv.tsv index ef2265d001..06b75c5a70 100644 --- a/crates/ui-egui/src/i18n/sv.tsv +++ b/crates/ui-egui/src/i18n/sv.tsv @@ -6579,6 +6579,8 @@ axis Y Axis Y-axel Action Options… Alternativ för åtgärd… Action Options Alternativ för åtgärd Playback Options… Uppspelningsalternativ… + Button Mode Knappläge + No actions. Inga åtgärder. Insert Stop… Infoga stopp… Insert Stop Infoga stopp Record Stop Spela in stopp diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv index d22c3b961f..278fde3e26 100644 --- a/crates/ui-egui/src/i18n/tr.tsv +++ b/crates/ui-egui/src/i18n/tr.tsv @@ -6555,6 +6555,8 @@ axis Y Axis Y ekseni Action Options… Eylem Seçenekleri… Action Options Eylem Seçenekleri Playback Options… Oynatma Seçenekleri… + Button Mode Düğme Modu + No actions. Eylem yok. Insert Stop… Durak Ekle… Insert Stop Durak Ekle Record Stop Durak Kaydet diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv index 8df23cab71..856f9cd8fe 100644 --- a/crates/ui-egui/src/i18n/uk.tsv +++ b/crates/ui-egui/src/i18n/uk.tsv @@ -6205,6 +6205,8 @@ axis Y Axis Вісь Y Action Options… Параметри дії… Action Options Параметри дії Playback Options… Параметри відтворення… + Button Mode Режим кнопок + No actions. Нема дій. Insert Stop… Вставити зупинку… Insert Stop Вставити зупинку Record Stop Записати зупинку diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv index 0ac99661db..17bf2763ab 100644 --- a/crates/ui-egui/src/i18n/vi.tsv +++ b/crates/ui-egui/src/i18n/vi.tsv @@ -6206,6 +6206,8 @@ axis Y Axis Trục Y Action Options… Tùy chọn hành động… Action Options Tùy chọn hành động Playback Options… Tùy chọn phát lại… + Button Mode Chế độ nút + No actions. Không có hành động. Insert Stop… Chèn điểm dừng… Insert Stop Chèn điểm dừng Record Stop Ghi điểm dừng diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv index 3658ca1241..086f923de2 100644 --- a/crates/ui-egui/src/i18n/zh-hans.tsv +++ b/crates/ui-egui/src/i18n/zh-hans.tsv @@ -6438,6 +6438,8 @@ axis Y Axis Y 轴 Action Options… 动作选项… Action Options 动作选项 Playback Options… 播放选项… + Button Mode 按钮模式 + No actions. 没有动作。 Insert Stop… 插入停止… Insert Stop 插入停止 Record Stop 记录停止 diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv index 9306fdaf21..90c9b1803b 100644 --- a/crates/ui-egui/src/i18n/zh-hant.tsv +++ b/crates/ui-egui/src/i18n/zh-hant.tsv @@ -6244,6 +6244,8 @@ axis Y Axis Y 軸 Action Options… 動作選項… Action Options 動作選項 Playback Options… 播放選項… + Button Mode 按鈕模式 + No actions. 沒有動作。 Insert Stop… 插入停止… Insert Stop 插入停止 Record Stop 記錄停止 diff --git a/crates/ui-egui/src/menus/run.rs b/crates/ui-egui/src/menus/run.rs index 14e5d053ef..5e05732b62 100644 --- a/crates/ui-egui/src/menus/run.rs +++ b/crates/ui-egui/src/menus/run.rs @@ -985,6 +985,8 @@ fn run_ui_part11(app: &mut VectorcraftApp, id: &str, p: &Value) -> Option crate::panels::actions::new_action(app, p), crate::panels::actions::ACTION_OPTIONS => crate::panels::actions::action_options(app, p), crate::panels::actions::PLAY_ACTION => crate::panels::actions::play_action(app, p), + crate::panels::actions::PLAY_AT => crate::panels::actions::play_at(app, p), + crate::panels::actions::BUTTON_MODE => crate::panels::actions::button_mode(app, p), crate::panels::actions::PLAYBACK_OPTIONS => crate::panels::actions::playback_options(app, p), crate::panels::actions::START_RECORDING => crate::panels::actions::record(app, p), crate::panels::actions::STOP_RECORDING => crate::panels::actions::stop(app, p), diff --git a/crates/ui-egui/src/menus/ui_commands.rs b/crates/ui-egui/src/menus/ui_commands.rs index 093a395841..851eac4a5d 100644 --- a/crates/ui-egui/src/menus/ui_commands.rs +++ b/crates/ui-egui/src/menus/ui_commands.rs @@ -1466,7 +1466,7 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ crate::panels::actions::NEW_ACTION, "New Action", "", - "{set: index, name, key?: 0-15, cmd?, shift?, color?: red|yellow|green|blue|violet} add an action named name (spaces trimmed from both ends) after the last action of the Actions panel's set at set (0 is the top set) and start recording into it; Stop Playing/Recording (ui.action.stop) ends the recording. key 1 to 15 is the function key F1 to F15 that plays the action (0 or null: none), with cmd (Ctrl, Command on macOS) and shift; color is its Button Mode color (null or \"\": none), which the panel does not show. Action function keys take priority over command shortcuts and preserve the command's binding. On Windows F1, Ctrl+F4 and Ctrl+F6 cannot be used. The set becomes current and the new action is selected. The panel's Create New Action button and menu's New Action… (dialog `actionNew` with set, name, key, cmd, shift and color) run this on Record. While an action is recording, and for an index past the last set, an empty name, a key or color that is not one of these, or an action that would give the set more than 1,000 actions or an action set file larger than 8 MiB, it is an error, nothing is added and no recording starts → {set, action}", + "{set: index, name, key?: 0-15, cmd?, shift?, color?: red|yellow|green|blue|violet} add an action named name (spaces trimmed from both ends) after the last action of the Actions panel's set at set (0 is the top set) and start recording into it; Stop Playing/Recording (ui.action.stop) ends the recording. key 1 to 15 is the function key F1 to F15 that plays the action (0 or null: none), with cmd (Ctrl, Command on macOS) and shift; color is its Button Mode color (null or \"\": none), the color of its button in Button Mode (ui.action.buttonMode). Action function keys take priority over command shortcuts and preserve the command's binding. On Windows F1, Ctrl+F4 and Ctrl+F6 cannot be used. The set becomes current and the new action is selected. The panel's Create New Action button and menu's New Action… (dialog `actionNew` with set, name, key, cmd, shift and color) run this on Record. While an action is recording, and for an index past the last set, an empty name, a key or color that is not one of these, or an action that would give the set more than 1,000 actions or an action set file larger than 8 MiB, it is an error, nothing is added and no recording starts → {set, action}", ), ( crate::panels::actions::ACTION_OPTIONS, @@ -1480,6 +1480,18 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "", "{action: name, set?: name} play the Actions panel's action named action at the speed ui.action.playbackOptions sets; set names the set to look in (default: every set). Accelerated plays it as one undoable batch → what command.batch returns. Step by Step and Pause For play its first step now and the others one at a time, each its own undo step, until the last, ui.action.stop, or a step that comes due while a different document is active than after the step before → {results: [the first step's result], pending: the steps left}. An action with a stop, at any speed, plays up to the stop and waits until ui.action.continue or ui.action.stop; at Accelerated the steps between stops are one undoable batch each → {results, pending, atStop?: true when it already waits}. A name no action has, or one that more than one action in the sets looked in has, or an action played while another is still playing step by step or with pauses, is an error and nothing plays", ), + ( + crate::panels::actions::PLAY_AT, + "Play Action", + "", + "{set: index, action: index} play the Actions panel's action at action in set (0 is the top set) as ui.action.play plays it, and return what ui.action.play returns. A click on an action's button in Button Mode runs this. A missing index, or one that is not a whole number or is past the last set or action, is an error and nothing plays", + ), + ( + crate::panels::actions::BUTTON_MODE, + "Button Mode", + "", + "{enabled?: bool} with true, the Actions panel shows every action of every set, in set order and then action order, as a button with its name in its Action Options color (no color: an ordinary button), without set names, steps or checkmarks, and a click on a button plays its action (ui.action.playAt); with false, it shows its list again; left out or null, it switches to the other view. The panel menu's Button Mode runs this and shows a check mark while it is on. The view is kept with the UI preferences. Turning it on while an action records, or an enabled that is not true, false or null, is an error and the view stays → {enabled}", + ), ( crate::panels::actions::PLAYBACK_OPTIONS, "Playback Options", diff --git a/crates/ui-egui/src/panels/actions.rs b/crates/ui-egui/src/panels/actions.rs index 1971834a07..39e2912357 100644 --- a/crates/ui-egui/src/panels/actions.rs +++ b/crates/ui-egui/src/panels/actions.rs @@ -32,8 +32,9 @@ pub struct Action { /// saved value that is not a function key loads as none. #[serde(default, skip_serializing_if = "Option::is_none", deserialize_with = "deserialize_key")] pub key: Option, - /// The action's Button Mode color, one of [`COLORS`], if one is assigned. The panel does not - /// show it. A saved value that is not one of them loads as none. + /// The action's Button Mode color, one of [`COLORS`], if one is assigned: the color of its + /// button while the panel is in Button Mode ([`button_colors`]). A saved value that is not one + /// of them loads as none. #[serde(default, skip_serializing_if = "Option::is_none", deserialize_with = "deserialize_color")] pub color: Option, } @@ -144,6 +145,40 @@ impl FunctionKey { /// The Button Mode colors an action can have, as (value, label). pub const COLORS: [(&str, &str); 5] = [("red", "Red"), ("yellow", "Yellow"), ("green", "Green"), ("blue", "Blue"), ("violet", "Violet")]; +/// The fill of a Button Mode button in color `color`, one of [`COLORS`]: VectorCraft's own shades. +fn button_fill(color: &str) -> Option { + let rgb = egui::Color32::from_rgb; + Some(match color { + "red" => rgb(0xd4, 0x3f, 0x3f), + "yellow" => rgb(0xf0, 0xc8, 0x3c), + "green" => rgb(0x3f, 0xa8, 0x5a), + "blue" => rgb(0x3d, 0x7b, 0xd6), + "violet" => rgb(0x8e, 0x5a, 0xd0), + _ => return None, + }) +} + +/// The relative luminance of `c`, as WCAG 2 defines it. +fn luminance(c: egui::Color32) -> f32 { + let channel = |v: u8| { + let v = f32::from(v) / 255.0; + if v <= 0.040_45 { v / 12.92 } else { ((v + 0.055) / 1.055).powf(2.4) } + }; + 0.2126 * channel(c.r()) + 0.7152 * channel(c.g()) + 0.0722 * channel(c.b()) +} + +/// The (fill, text) colors of the Button Mode button of an action with color `color`: a colored +/// fill with black or white text, whichever contrasts more with it, or the theme's ordinary button +/// for an action without a color. +fn button_colors(color: Option<&str>, t: &Tokens) -> (egui::Color32, egui::Color32) { + match color.and_then(button_fill) { + // Black text contrasts more than white above this luminance. + Some(fill) if luminance(fill) > 0.179 => (fill, egui::Color32::BLACK), + Some(fill) => (fill, egui::Color32::WHITE), + None => (t.button, t.text_strong), + } +} + /// Serde reader for [`Action::key`]: a value that is not a function key is none. fn deserialize_key<'de, D: serde::Deserializer<'de>>(d: D) -> Result, D::Error> { let v = ::deserialize(d)?; @@ -888,6 +923,37 @@ pub fn play_action(app: &mut VectorcraftApp, p: &Value) -> Result } } +/// The command that plays an action by its place in the panel ([`play_at`]). +pub const PLAY_AT: &str = "ui.action.playAt"; + +/// `ui.action.playAt {set, action}`: plays the action at index `action` of set `set` (0 is the top +/// set) at the Playback Options speed, as [`play`] does; a click on an action's button in Button +/// Mode runs this. A missing index, or one that is not a whole number or is past the last set or +/// action, is an error, and then nothing plays. → what [`play`] returns +pub fn play_at(app: &mut VectorcraftApp, p: &Value) -> Result { + let index = |k: &str| p.get(k).and_then(Value::as_u64).and_then(|i| usize::try_from(i).ok()); + let (set, at) = index("set").zip(index("action")).ok_or("no such action")?; + play(app, set, at) +} + +/// The command behind the panel menu's Button Mode ([`button_mode`]). +pub const BUTTON_MODE: &str = "ui.action.buttonMode"; + +/// `ui.action.buttonMode {enabled?}`: with `enabled: true` the Actions panel shows every action of +/// every set as a button in its color ([`Action::color`]) that plays the action when clicked, and +/// with `false` it shows its list of sets, actions and steps again; left out or null, it switches +/// to the other view. The view is kept with the UI preferences. Turning Button Mode on while an +/// action records is an error, and so is an `enabled` that is not true, false or null; then the +/// view does not change. → {enabled} +pub fn button_mode(app: &mut VectorcraftApp, p: &Value) -> Result { + let enabled = crate::menus::opt_bool(p, "enabled")?.unwrap_or(!app.ui.action_button_mode); + if enabled && !app.ui.action_button_mode && app.ui.recording.is_some() { + return Err("an action is already recording".into()); + } + app.ui.action_button_mode = enabled; + Ok(json!({ "enabled": enabled })) +} + /// The command that ends a recording ([`stop`]). pub const STOP_RECORDING: &str = "ui.action.stop"; @@ -2007,9 +2073,18 @@ pub fn duplicate(app: &mut VectorcraftApp, p: &Value) -> Result { /// The panel's (≡) menu. pub fn menu(app: &mut VectorcraftApp, ui: &mut egui::Ui) { + // Button Mode is off while an action records, so the Stop button the list shows stays in reach. + let buttons = app.ui.action_button_mode; + if widgets::menu_item(ui, tl!("Button Mode"), buttons || app.ui.recording.is_none(), buttons) + && let Err(e) = app.run(BUTTON_MODE, json!({})) + { + app.status(e); + } + ui.separator(); // A selected action counts only while its set is the current one, as the panel shows it: a set - // deleted since leaves the stored pair pointing at another set's action. - let selected = pstate::>(ui.ctx(), "actions-selected").filter(|&(s, _)| app.ui.action_set == Some(s)); + // deleted since leaves the stored pair pointing at another set's action. Button Mode shows no + // selected action and no current set, so the items that act on them are off there. + let selected = pstate::>(ui.ctx(), "actions-selected").filter(|&(s, _)| !buttons && app.ui.action_set == Some(s)); let has = selected.and_then(|(s, a)| app.ui.action_sets.get(s).and_then(|set| set.actions.get(a))).is_some(); if widgets::menu_item(ui, tl!("New Action…"), crate::dialogs::action_new::can_open(app), false) && let Err(e) = crate::dialogs::action_new::open(app) @@ -2019,11 +2094,11 @@ pub fn menu(app: &mut VectorcraftApp, ui: &mut egui::Ui) { if widgets::menu_item(ui, tl!("New Set…"), true, false) { crate::dialogs::action_set_options::open_new(app); } - let current = app.ui.action_set.filter(|&s| s < app.ui.action_sets.len()); + let current = app.ui.action_set.filter(|&s| !buttons && s < app.ui.action_sets.len()); if widgets::menu_item(ui, tl!("Duplicate"), current.is_some(), false) { duplicate_selection(app, ui.ctx()); } - if widgets::menu_item(ui, tl!("Delete"), has || !selected_sets(app).is_empty(), false) { + if widgets::menu_item(ui, tl!("Delete"), has || (!buttons && !selected_sets(app).is_empty()), false) { delete_selection(app, ui.ctx()); } if widgets::menu_item(ui, tl!("Set Options…"), current.is_some(), false) @@ -2156,8 +2231,78 @@ enum InclusionChange { Step(usize, usize, usize, bool), } -/// Draw action sets, steps and playback controls, keeping the list above a pinned footer. +/// Button Mode ([`button_mode`]): every action of every set, in set order and then action order, +/// as a button with its name in its color ([`button_colors`]), with no set names, steps or +/// checkmarks. A click on a button, or Enter or Space on the focused one, plays the action +/// ([`PLAY_AT`]). The footer shows only while an action plays or records: Stop Playing/Recording, +/// and Play Current Selection while a playback waits at a stop. +fn show_buttons(app: &mut VectorcraftApp, ui: &mut egui::Ui) { + let t = Tokens::get(ui.ctx()); + let mut play_req = None; + let list_height = widgets::panel_list_height(ui, 260.0, 0.0).min(260.0); + egui::ScrollArea::vertical().id_salt("actions-buttons").max_height(list_height).min_scrolled_height(list_height.min(64.0)).show(ui, |ui| { + for (si, set) in app.ui.action_sets.iter().enumerate() { + for (ai, a) in set.actions.iter().enumerate() { + let (r, resp) = ui.allocate_exact_size(egui::vec2(ui.available_width(), 24.0), egui::Sense::click()); + resp.widget_info(|| egui::WidgetInfo::labeled(egui::Role::Button, true, &a.name)); + let (fill, text) = button_colors(a.color.as_deref(), &t); + let button = r.shrink2(egui::vec2(2.0, 1.0)); + ui.painter().rect_filled(button, 3.0, fill); + // The pointer over a button, or the keyboard focus on it, rings it in its text color. + let (width, ring) = if resp.hovered() || resp.has_focus() { (2.0, text) } else { (1.0, t.button_border) }; + ui.painter().rect_stroke(button, 3.0, egui::Stroke::new(width, ring), egui::StrokeKind::Inside); + ui.painter().with_clip_rect(button.shrink2(egui::vec2(6.0, 0.0))).text( + button.left_center() + egui::vec2(8.0, 0.0), + egui::Align2::LEFT_CENTER, + &a.name, + egui::FontId::proportional(12.5), + text, + ); + if resp.on_hover_text(&a.name).clicked() { + play_req = Some((si, ai)); + } + } + } + }); + if app.ui.action_sets.iter().all(|s| s.actions.is_empty()) { + dim_label(ui, tl!("No actions.")); + } + let waiting = waiting_at_stop(app); + if waiting { + dim_label(ui, tl!("Press Play Current Selection in the Actions panel to go on.")); + } + let recording = app.ui.recording.is_some(); + if recording || app.ui.action_playing.is_some() { + widgets::bottom_bar(ui, |ui| { + if widgets::icon_button(ui, "square", tl!("Stop Playing/Recording"), false, 24.0).clicked() + && let Err(e) = app.run(STOP_RECORDING, json!({})) + { + app.status(e); + } + if waiting + && widgets::icon_button(ui, "dc-actions", tl!("Play Current Selection"), false, 24.0).clicked() + && let Err(e) = app.run(CONTINUE_PLAYBACK, json!({})) + { + app.status(e); + } + if recording { + ui.label(egui::RichText::new(tl!("● Recording")).color(egui::Color32::from_rgb(0xe0, 0x30, 0x30))); + } + }); + } + if let Some((si, ai)) = play_req + && let Err(e) = app.run(PLAY_AT, json!({"set": si, "action": ai})) + { + app.status(e); + } +} + +/// Draw action sets, steps and playback controls, keeping the list above a pinned footer, or in +/// Button Mode the actions as buttons ([`show_buttons`]). pub fn show(app: &mut VectorcraftApp, ui: &mut egui::Ui) { + if app.ui.action_button_mode { + return show_buttons(app, ui); + } let t = Tokens::get(ui.ctx()); // The selected action as (set, action). Read as the type it is stored as: egui keeps a // value per type, so reading the bare pair never found it and no action stayed selected (#1629). @@ -2672,6 +2817,186 @@ mod tests { assert_eq!(names(&app), before[1..], "nothing selected after a delete: nothing more goes"); } + /// The fills of the rectangles drawn in one headless frame of the panel. + fn drawn_fills(ctx: &egui::Context, app: &mut VectorcraftApp) -> Vec { + fn collect(s: &egui::Shape, out: &mut Vec) { + match s { + egui::Shape::Rect(r) => out.push(r.fill), + egui::Shape::Vec(v) => v.iter().for_each(|s| collect(s, out)), + _ => {} + } + } + let mut output = ctx.run_ui(egui::RawInput::default(), |ui| show(app, ui)); + output.textures_delta.clear(); + let mut fills = vec![]; + output.shapes.iter().for_each(|c| collect(&c.shape, &mut fills)); + fills + } + + /// The panel menu's Button Mode switches the panel to buttons and back, with a check mark while + /// it is on; `ui.action.buttonMode` does the same, and the view is kept with the UI preferences. + /// Turning it on while an action records is refused, so Stop stays in reach. + #[test] + fn button_mode_switches_the_view_and_is_kept_with_the_preferences() { + use super::super::tests_appearance::{click, frame_events}; + let mut app = app_with_sets(); + assert!(!app.ui.action_button_mode, "the list is the default"); + let ctx = egui::Context::default(); + let item = |ctx: &egui::Context, app: &mut VectorcraftApp| { + let texts = frame_events(ctx, app, vec![], menu); + texts.into_iter().find(|(s, _)| s.trim_start_matches('✓').trim() == "Button Mode").expect("Button Mode in the menu") + }; + let (label, at) = item(&ctx, &mut app); + assert_eq!(label, " Button Mode", "no check mark while off"); + click(&ctx, &mut app, at.center(), menu); + assert!(app.ui.action_button_mode, "the menu item turns it on"); + assert_eq!(item(&ctx, &mut app).0, "✓ Button Mode", "a check mark while on"); + let at = item(&ctx, &mut app).1; + click(&ctx, &mut app, at.center(), menu); + assert!(!app.ui.action_button_mode, "choosing it again returns to the list"); + + assert_eq!(app.run(BUTTON_MODE, json!({})).unwrap(), json!({"enabled": true}), "left out: the other view"); + assert_eq!(app.run(BUTTON_MODE, json!({"enabled": true})).unwrap(), json!({"enabled": true})); + assert_eq!(app.run(BUTTON_MODE, json!({"enabled": "no"})).unwrap_err(), "`enabled` must be true or false"); + assert!(app.ui.action_button_mode, "a bad value keeps the view"); + let saved = serde_json::to_value(&app.ui).unwrap(); + assert_eq!(saved["action_button_mode"], json!(true)); + assert!(serde_json::from_value::(saved.clone()).unwrap().action_button_mode, "kept after a restart"); + let mut older = saved; + older.as_object_mut().unwrap().remove("action_button_mode"); + assert!(!serde_json::from_value::(older).unwrap().action_button_mode, "older preferences show the list"); + + assert_eq!(app.run(BUTTON_MODE, json!({"enabled": null})).unwrap(), json!({"enabled": false})); + app.run("file.new", json!({"width": 200, "height": 100})).unwrap(); + app.run(START_RECORDING, json!({})).unwrap(); + assert_eq!(app.run(BUTTON_MODE, json!({})).unwrap_err(), "an action is already recording"); + let at = item(&ctx, &mut app).1; + click(&ctx, &mut app, at.center(), menu); + assert!(!app.ui.action_button_mode, "the menu item is off while an action records"); + assert_eq!(app.run(BUTTON_MODE, json!({"enabled": false})).unwrap(), json!({"enabled": false}), "turning it off is never refused"); + app.run(STOP_RECORDING, json!({})).unwrap(); + } + + /// Button Mode shows every action of every set by its name, in set order and then action order, + /// without set names, step counts or steps, each in its Action Options color; an action without + /// a color is an ordinary button. The menu items for a selected action or the current set are + /// off, since the view shows neither. + #[test] + fn button_mode_shows_every_action_as_a_button_in_its_color() { + use super::super::tests_appearance::{click, frame_events, text_rect}; + let mut app = app_with_sets(); + app.run(ACTION_OPTIONS, json!({"set": 1, "action": 0, "color": "red"})).unwrap(); + app.run(ACTION_OPTIONS, json!({"set": 1, "action": 1, "color": "yellow"})).unwrap(); + let ctx = egui::Context::default(); + let texts = frame_events(&ctx, &mut app, vec![], show); + click(&ctx, &mut app, text_rect(&texts, "Nudge").center(), show); + assert_eq!(pstate::>(&ctx, "actions-selected"), Some((1, 0)), "selected in the list"); + app.run(BUTTON_MODE, json!({"enabled": true})).unwrap(); + let texts = frame_events(&ctx, &mut app, vec![], show); + let names: Vec<&str> = texts.iter().map(|(s, _)| s.as_str()).collect(); + assert_eq!( + names, + [ + "Duplicate and Offset 10 pt", + "Unite and Simplify", + "Center on Artboard", + "Outline Text", + "Rotate 90° CW", + "Reflect Horizontal", + "Nudge", + "Nudge Again" + ], + "only the actions' names, in set and action order" + ); + let tops: Vec = texts.iter().map(|(_, r)| r.top()).collect(); + assert!(tops.windows(2).all(|w| w[0] < w[1]), "one button under the other: {tops:?}"); + let t = Tokens::get(&ctx); + let fills = drawn_fills(&ctx, &mut app); + for color in ["red", "yellow"] { + let fill = button_fill(color).unwrap(); + assert_eq!(fills.iter().filter(|f| **f == fill).count(), 1, "{color}: {fills:?}"); + } + assert_eq!(fills.iter().filter(|f| **f == t.button).count(), 6, "the six actions without a color: {fills:?}"); + for (color, _) in COLORS { + let (fill, text) = button_colors(Some(color), &t); + let (hi, lo) = (luminance(fill).max(luminance(text)), luminance(fill).min(luminance(text))); + assert!((hi + 0.05) / (lo + 0.05) >= 4.5, "{color}: its name is legible"); + } + assert_eq!(button_colors(None, &t), (t.button, t.text_strong)); + let menu_texts = frame_events(&ctx, &mut app, vec![], menu); + click(&ctx, &mut app, text_rect(&menu_texts, " Delete").center(), menu); + click(&ctx, &mut app, text_rect(&menu_texts, " Action Options…").center(), menu); + assert!(app.ui.dialog.is_none(), "Delete and Action Options… are off in Button Mode"); + assert_eq!(set_names(&app), ["Default Actions", "Mine", "Other"]); + assert_eq!(action_names(&app, 1), ["Nudge", "Nudge Again"], "the action selected in the list stays"); + } + + /// A click on a button plays that action at once, as one undo step at Accelerated, without its + /// excluded steps, which stay excluded; `ui.action.playAt` refuses an index that names no action. + #[test] + fn a_click_on_a_button_plays_its_action_without_its_excluded_steps() { + use super::super::tests_appearance::{click, frame_events, text_rect}; + let (mut app, x) = app_with_three_moves(); + app.run(INCLUDE_STEPS, json!({"set": 0, "action": 0, "step": 1, "included": false})).unwrap(); + app.run(BUTTON_MODE, json!({"enabled": true})).unwrap(); + let ctx = egui::Context::default(); + let texts = frame_events(&ctx, &mut app, vec![], show); + let undo = undo_steps(&app); + click(&ctx, &mut app, text_rect(&texts, "Three Moves").center(), show); + assert_eq!((x(&app), undo_steps(&app)), (5.0, undo + 1), "1 and 4 pt as one undo step; the 2 pt step is skipped"); + assert_eq!(app.ui.action_sets[0].actions[0].excluded_steps, BTreeSet::from([1]), "the exclusion stays"); + for (p, want) in [ + (json!({"set": 0, "action": 1}), "no such action"), + (json!({"set": 1, "action": 0}), "no such action"), + (json!({"set": "0", "action": 0}), "no such action"), + (json!({"set": 0}), "no such action"), + ] { + assert_eq!(app.run(PLAY_AT, p.clone()).unwrap_err(), want, "{p}"); + } + assert_eq!(x(&app), 5.0, "nothing more played"); + app.run(PLAY_AT, json!({"set": 0, "action": 0})).unwrap(); + assert_eq!(x(&app), 10.0); + } + + /// Button Mode shows no bottom bar while nothing plays or records. While an action plays step by + /// step its Stop Playing/Recording button ends the playback, and while one waits at a stop its + /// Play Current Selection button plays on. + #[test] + fn button_mode_shows_stop_and_continue_only_while_an_action_plays() { + use super::super::tests_appearance::{click, frame_events, text_rect}; + let bar = |ctx: &egui::Context, app: &mut VectorcraftApp| { + frame_events(ctx, app, vec![], show); + let mut bar = crate::toolbar::tests::widget_rects(ctx, egui::vec2(24.0, 24.0)); + bar.sort_by(|a, b| a.left().total_cmp(&b.left())); + // A button can be listed more than once in a pass. + bar.dedup(); + bar + }; + let (mut app, x) = app_with_three_moves(); + app.run(BUTTON_MODE, json!({"enabled": true})).unwrap(); + app.run(PLAYBACK_OPTIONS, json!({"speed": "step"})).unwrap(); + let ctx = egui::Context::default(); + assert_eq!(bar(&ctx, &mut app), [], "no bottom bar while idle"); + let texts = frame_events(&ctx, &mut app, vec![], show); + click(&ctx, &mut app, text_rect(&texts, "Three Moves").center(), show); + assert_eq!(x(&app), 1.0, "the first step played"); + let [stop] = bar(&ctx, &mut app)[..] else { panic!("only Stop while it plays") }; + click(&ctx, &mut app, stop.center(), show); + assert!(app.ui.action_playing.is_none(), "Stop ends the playback"); + assert_eq!(x(&app), 1.0); + + let (mut app, x) = app_with_a_stop(true); + app.run(BUTTON_MODE, json!({"enabled": true})).unwrap(); + let texts = frame_events(&ctx, &mut app, vec![], show); + click(&ctx, &mut app, text_rect(&texts, "Three Moves").center(), show); + assert!(waiting_at_stop(&app)); + assert_eq!(x(&app), 1.0, "played up to the stop"); + let [_, play] = bar(&ctx, &mut app)[..] else { panic!("Stop and Play Current Selection at a stop") }; + click(&ctx, &mut app, play.center(), show); + assert!(app.ui.action_playing.is_none()); + assert_eq!(x(&app), 7.0, "Play Current Selection plays on"); + } + /// #3712: Create New Set asks for a name (Set 1 when free), the new set is the current one, so a /// recording goes into it, and a click on another set's name makes that one current. The sets /// are saved with the UI preferences. diff --git a/crates/ui-egui/src/state.rs b/crates/ui-egui/src/state.rs index a06dc2f1df..a29ca50e41 100644 --- a/crates/ui-egui/src/state.rs +++ b/crates/ui-egui/src/state.rs @@ -618,6 +618,11 @@ pub struct UiState { /// Shift-click on a set's name added. Delete Selection deletes them. Not saved. #[serde(skip)] pub action_sets_selected: Vec, + /// The Actions panel shows its actions as buttons (panel menu › Button Mode, + /// [`crate::panels::actions::button_mode`]) instead of its list; kept with the UI preferences, + /// and off in preferences saved without it. + #[serde(default)] + pub action_button_mode: bool, /// Recording in progress: (set index, action name, journal length when recording started). #[serde(skip)] pub recording: Option<(usize, String, usize)>, @@ -1171,6 +1176,7 @@ impl Default for UiState { action_sets: crate::panels::actions::default_sets(), action_set: None, action_sets_selected: vec![], + action_button_mode: false, recording: None, recording_into: None, recording_at: None, diff --git a/docs/mcp.md b/docs/mcp.md index ef3ff788a5..4f2ce9831d 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -3263,7 +3263,8 @@ already walks Image Trace. Short agent entry points: trimmed) after the last action of set `set` (0 is the top set), starts recording into it and returns `{set, action}`; Stop Playing/Recording (`ui.action.stop`) ends the recording. `key` 1 to 15 is the function key F1 to F15 that plays the action (0 or null for none), with `cmd` (Ctrl, Command on macOS) and `shift`. `color` is its Button Mode color - (`red`, `yellow`, `green`, `blue` or `violet`; null or `""` for none), which the panel does not show. Action function + (`red`, `yellow`, `green`, `blue` or `violet`; null or `""` for none), the color of its button in Button Mode + (`ui.action.buttonMode`). Action function keys take priority over command shortcuts and preserve the command's binding. On Windows F1, Ctrl+F4 and Ctrl+F6 cannot be used. While an action is recording, and for an index past the last set, an empty name, or a key or color that is not one of these, it is an error and nothing is added. So is an action that @@ -3319,6 +3320,21 @@ already walks Image Trace. Short agent entry points: result is `{results}` with every step's result in order. A step that fails ends the playback with its error: the batch it is in changes nothing, and the steps before that batch stay done. While another action records, the View menu step is recorded too. Batch… refuses an action with an included View menu step. +- Actions: `ui.action.playAt {set, action}` plays the action at `action` in set `set` (0 is the top set) as + `ui.action.play` plays it and returns what `ui.action.play` returns. A click on an action's button in Button Mode + runs this. A missing index, or one that is not a whole number or is past the last set or action, is an error, and + then nothing plays. +- Actions: `ui.action.buttonMode {enabled?}` with `enabled: true` shows the Actions panel's actions as buttons, each + with the action's name in its Action Options color (`ui.action.options`), without set names, steps or checkmarks, as + [the help page](https://web.archive.org/web/20220911143322/https://helpx.adobe.com/pdf/cs6/illustrator_reference.pdf#page=467) + describes; a click on a button plays its action (`ui.action.playAt`) without its excluded steps. With `false` the + panel shows its list again, and with `enabled` left out or null the command switches to the other view. It returns + `{enabled}`. The panel menu's Button Mode runs this. VectorCraft's own rules: the menu item shows a check mark while + Button Mode is on; the actions of every set show, in set order and then action order; an action without a color is + an ordinary button; the bottom bar shows only Stop Playing/Recording while an action plays or records, and Play + Current Selection while one waits at a stop; the panel menu's items for a selected action or the current set are + off; and the mode is kept with the UI preferences. Turning Button Mode on while an action records, or an `enabled` + that is not true, false or null, is an error, and then the view does not change. - Actions: `ui.action.insertStop {set?, action?, step?, message?, allowContinue?}` inserts a stop. With `set` and `action`, the stop goes into that action, after step `step`, else after its last step, and the command returns `{set, action, step}`. Without them it goes into the recording in progress, after the steps recorded so far, and diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index f3707717e6..ec43f4539f 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -760,7 +760,8 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - Actions panel menu: Save Actions… writes the current action set with all its actions to a file, and Load Actions… adds the set from such a file to the panel ([Manage a set of actions](https://helpx.adobe.com/illustrator/desktop/automate-visualize-data/automate-actions/manage-a-set-of-actions.html); `ui.actionSet.save`, `ui.actionSet.load`). The file is VectorCraft's own action set file (`.vcactions`); a loaded set named like one in the panel gets the next free number. - Actions panel menu: Load Actions… also reads action sets saved as `.aia` files ([Actions panel overview](https://helpx.adobe.com/illustrator/desktop/automate-visualize-data/automate-actions/actions-panel-overview.html); `actionSet.read`, `ui.actionSet.load`). VectorCraft's own rules: the set comes in with all its actions. A step with a label and no recorded values comes in as the one menu command with the step's label, when that command is directly in a top menu, is what its menu bar item runs with no values and opens no dialog. A step that is off in the file stays excluded from playback. The other steps, recorded menu items included, are left out, and the status bar says how many. - Actions panel: the panel menu's Action Options… renames the selected action and keeps its steps ([Actions panel overview](https://helpx.adobe.com/illustrator/desktop/automate-visualize-data/automate-actions/actions-panel-overview.html): the menu item opens a dialog that renames the action or gives it a function key and color; `ui.action.options`). It also sets the action's function key and color. - - Actions panel: Create New Action (bottom bar) and the panel menu's New Action… ask for the new action's name, set, function key and color, and Record adds the action and starts recording into it ([Create new actions](https://helpx.adobe.com/illustrator/desktop/automate-visualize-data/automate-actions/record-actions.html): the New Action dialog takes the action's name and the set it goes in; `ui.action.new`, `ui.action.play`). The function key (F1 to F15, with Ctrl or Command and Shift) plays the action. An action's function key plays the action even when a command has the same shortcut, and the command keeps it. VectorCraft's own rules, which the page does not cover: when several actions have the same key the first in panel order plays; a copied action has no key; New Action does not open while an action is recording. The color is kept with the action for Button Mode, which VectorCraft does not have yet. + - Actions panel: Create New Action (bottom bar) and the panel menu's New Action… ask for the new action's name, set, function key and color, and Record adds the action and starts recording into it ([Create new actions](https://helpx.adobe.com/illustrator/desktop/automate-visualize-data/automate-actions/record-actions.html): the New Action dialog takes the action's name and the set it goes in; `ui.action.new`, `ui.action.play`). The function key (F1 to F15, with Ctrl or Command and Shift) plays the action. An action's function key plays the action even when a command has the same shortcut, and the command keeps it. VectorCraft's own rules, which the page does not cover: when several actions have the same key the first in panel order plays; a copied action has no key; New Action does not open while an action is recording. The color is the color of the action's button in Button Mode. + - Actions panel: the panel menu's Button Mode shows the actions as buttons with their names in their Action Options colors, without sets or individual commands; a click on a button plays its action without its excluded steps, and choosing Button Mode again returns to the list ([the help page](https://web.archive.org/web/20220911143322/https://helpx.adobe.com/pdf/cs6/illustrator_reference.pdf#page=467) and [the next page](https://web.archive.org/web/20220911143322/https://helpx.adobe.com/pdf/cs6/illustrator_reference.pdf#page=468); [the help page](https://helpx.adobe.com/illustrator/desktop/automate-visualize-data/automate-actions/exclude-commands-from-actions.html) says commands cannot be excluded in Button Mode; `ui.action.buttonMode`, `ui.action.playAt`). VectorCraft's own rules, which the pages do not cover: the menu item shows a check mark while Button Mode is on; every set's actions show, in set order and then action order; an action without a color is an ordinary button; function keys still play their actions; the bottom bar shows only Stop Playing/Recording while an action plays or records, and Play Current Selection while one waits at a stop; Button Mode cannot be turned on while an action records; and the mode is kept with the UI preferences. - Actions panel: with an action selected, Begin Recording adds the commands recorded to that action, after its selected step or at its end, and a step dragged within its action or to another action goes where a highlighted line shows when the button is released ([the help page](https://helpx.adobe.com/illustrator/desktop/automate-visualize-data/automate-actions/add-commands-to-actions.html); `ui.action.record`, `ui.action.moveStep`). VectorCraft's own rules, which the page does not cover: with no action selected Begin Recording adds a new action; a step can go into an empty action or an action in another set; a release off the actions' rows leaves the step where it was; a moved step keeps whether it is excluded; Undo does not move it back. - Actions panel (record/playback, persisted), generic parameter dialogs for every "…" command. - Actions panel: the current set is kept with the UI preferences, so after a restart a recording goes into the set that was current, not into the first set. With no set current, Begin Recording records into the first set and makes it current. diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 62a99726a2..6bffa0595b 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -408,11 +408,12 @@ next unit in the order a right-click on a ruler lists them, from Feet back to Po | Toolbar without group labels by default, one or two columns; All Tools drawer by flyout group with shortcuts, its menu (Reset, Basic, Advanced) and Show section | done | #1751; a preference brings the labels back; `toolbar.show` sets the Fill/Stroke, Coloring, Draw Mode and Screen Mode controls | | Actions panel: ≡ › Save Actions… saves the current set with all its actions to a file and ≡ › Load Actions… adds a saved set ([Manage a set of actions](https://helpx.adobe.com/illustrator/desktop/automate-visualize-data/automate-actions/manage-a-set-of-actions.html)) | partial | `ui.actionSet.save`, `ui.actionSet.load`; `panels/actions.rs` tests. The file is VectorCraft's own `.vcactions` JSON; Reset, Clear and Replace Actions remain | | Actions panel: ≡ › Load Actions… also reads action sets saved as `.aia` files ([Actions panel overview](https://helpx.adobe.com/illustrator/desktop/automate-visualize-data/automate-actions/actions-panel-overview.html)) | partial | `actionSet.read`, `ui.actionSet.load`; `tests/actionset.rs`, `panels/actions.rs` tests, `import_fuzz`. Only steps with a label and no recorded values come in, as menu commands that run with no values and open no dialog, matched by label; the other steps, recorded menu items included, are left out and counted | -| Actions panel: ≡ › Action Options… renames the selected action and sets its function key and color ([Actions panel overview](https://helpx.adobe.com/illustrator/desktop/automate-visualize-data/automate-actions/actions-panel-overview.html)) | partial | `ui.action.options`; `panels/actions.rs` tests (part of #1629). The color shows nowhere until Button Mode exists | +| Actions panel: ≡ › Action Options… renames the selected action and sets its function key and color ([Actions panel overview](https://helpx.adobe.com/illustrator/desktop/automate-visualize-data/automate-actions/actions-panel-overview.html)) | partial | `ui.action.options`; `panels/actions.rs` tests (part of #1629). Button Mode shows the color | +| Actions panel: ≡ › Button Mode shows each action by name as a button in its Action Options color, without sets or steps; a click on a button plays the action, and choosing Button Mode again shows the list ([the help page](https://helpx.adobe.com/illustrator/desktop/automate-visualize-data/automate-actions/actions-panel-overview.html)) | done | `ui.action.buttonMode`, `ui.action.playAt`; `panels/actions.rs` tests. VectorCraft's own rules: every set's actions show in set order, an action without a color is an ordinary button, the mode is kept with the UI preferences, and it cannot be turned on while an action records | | Actions panel: ≡ › Playback Options… plays actions Accelerated, Step by Step or with a pause between steps ([Specify playback speed](https://helpx.adobe.com/illustrator/desktop/automate-visualize-data/automate-actions/specify-playback-speed.html)) | done | `ui.action.playbackOptions`; `panels/actions.rs` tests. The pause is a whole number of seconds from 1 to 60 (VectorCraft's own range); Batch… plays at full speed | | Actions panel: a clicked action stays selected for Play Current Selection and Delete Selection | partial | #1853 (part of #1629); editing actions and action shortcuts remain | | Actions panel: Create New Set (bottom bar, ≡ › New Set…) names a new set and Set Options… renames the current one; a click on a set's name makes it current and a recording goes into the current set ([helpx: Automation with actions](https://helpx.adobe.com/illustrator/using/automation-actions.html)); the current set is kept with the UI preferences, and with no set current a recording goes into the first set, which becomes current | partial | #3712; dragging actions between sets remains | -| Actions panel: Create New Action (bottom bar, ≡ › New Action…) asks for the name, set, function key and color, and Record adds the action and records into it ([Create new actions](https://helpx.adobe.com/illustrator/desktop/automate-visualize-data/automate-actions/record-actions.html)) | partial | `ui.action.new`, `ui.action.play`; `panels/actions.rs` tests. A function key plays its action, even when a command has the same shortcut, and the command keeps it. Button Mode, which shows the color, remains | +| Actions panel: Create New Action (bottom bar, ≡ › New Action…) asks for the name, set, function key and color, and Record adds the action and records into it ([Create new actions](https://helpx.adobe.com/illustrator/desktop/automate-visualize-data/automate-actions/record-actions.html)) | partial | `ui.action.new`, `ui.action.play`; `panels/actions.rs` tests. A function key plays its action, even when a command has the same shortcut, and the command keeps it. Button Mode shows the color | | Actions panel: Delete Selection (bottom bar) deletes the selected set with its actions and keeps the other sets ([Actions panel overview](https://helpx.adobe.com/illustrator/desktop/automate-visualize-data/automate-actions/actions-panel-overview.html)) | partial | `ui.actionSet.delete`; `panels/actions.rs` tests. VectorCraft's own rules, which the overview does not cover: deleting a set asks first (a selected action is still deleted at once), Shift-click on a set's name selects a range of sets, ≡ › Delete does the same as the button, and Default Actions and the last set can be deleted. Undo does not restore a deleted set, and recorded commands cannot be selected or deleted | | Actions panel: ≡ › Duplicate copies the selected action or set ([Actions panel overview](https://helpx.adobe.com/illustrator/desktop/automate-visualize-data/automate-actions/actions-panel-overview.html)) | partial | `ui.actionSet.duplicate`; `panels/actions.rs` tests. VectorCraft's own rules, which the overview does not cover: the copy goes right after the original, is named after it with " copy" added and is selected, and a copied set holds copies of all its actions. Undo does not remove the copy, and recorded commands cannot be duplicated | | Properties panel per context (every selection type's Quick Actions) | partial | one clip group: Edit Clipping Path and Edit Contents, at the top of the panel rather than in Quick Actions (G1); the overview's additional controls ([Properties panel overview](https://helpx.adobe.com/illustrator/desktop/get-started/learn-the-basics/properties-panel-overview.html)): Blend Options (one blend selected, with any tool, #4817), Repeat Options (one radial, grid or mirror repeat selected: Object › Repeat › Options, #5181; the overview does not list it) and Merge Live Paint (a Live Paint group with more) in Quick Actions, the Width Profile list (Width tool or a variable-width stroke) and an applied effect's Delete icon in Appearance, Corner and Corner Radius for corners selected with Direct Selection; Variable Font was already there; Edit Artboards: a Transform section (reference point, X, Y, W, H, preset, orientation) above the Artboards section (#5219) |