diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index 8cd4f5a995..f123bdbd03 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -3286,7 +3286,7 @@ digits Malayalam Malayalam @plural {shown} of {n} result. Keep typing to narrow them.|{shown} of {n} results. Keep typing to narrow them. {shown} sur {n} résultat. Continuez à taper pour les affiner.|{shown} sur {n} résultats. Continuez à taper pour les affiner. Recent Commands Commandes récentes No recent commands Aucune commande récente - Type to search commands, tools, panels and effects Tapez pour chercher commandes, outils, panneaux et effets + Type to search commands, tools, panels and effects Tapez pour rechercher des commandes, des outils, des panneaux et des effets Search Commands… Rechercher des commandes… Secondary Secondaire Section Symbol Symbole de section diff --git a/crates/ui-egui/src/palette.rs b/crates/ui-egui/src/palette.rs index ed80d067fc..205aa7c08f 100644 --- a/crates/ui-egui/src/palette.rs +++ b/crates/ui-egui/src/palette.rs @@ -404,19 +404,26 @@ fn build_in(lang: crate::i18n::Lang, native: bool) -> Vec { /// item runs ([`crate::keymap::command_of`]). Returns what the pick did. pub(crate) fn run_pick(app: &mut VectorcraftApp, id: &str) -> Picked { let had_dialog = app.ui.dialog.is_some(); - if let Some(tool) = id.strip_prefix("tool:") { - app.select_tool(tool); + let ran = if let Some(tool) = id.strip_prefix("tool:") { + match app.try_select_tool(tool) { + Ok(()) => true, + Err(e) => { + app.status(e); + false + } + } } else if let Some(panel) = id.strip_prefix("panel:") { // A panel that can be seen stays as it is, where `window.panel` would put an open flyout or // a floating panel away. In Presentation Mode the pick fails and changes nothing, as // `window.panel` does. if app.ui.screen_mode >= 3 { app.status("panels can't be shown in Presentation Mode"); - return Picked::Refused; - } - if let Err(e) = crate::panel_docking::reveal_panel(app, panel) { + false + } else if let Err(e) = crate::panel_docking::reveal_panel(app, panel) { app.status(e); - return Picked::Refused; + false + } else { + true } } else if id.starts_with("plugin:") || id.starts_with("effect:") { let command = crate::keymap::command_of(id); @@ -427,31 +434,37 @@ pub(crate) fn run_pick(app: &mut VectorcraftApp, id: &str) -> Picked { if let Err(why) = crate::shortcut_editor::dimmed(app, &command.id) { app.status(why); } - return Picked::Refused; - } - menus::invoke(app, &command.id, command.params); - if !on { - return Picked::Refused; + } else { + menus::invoke(app, &command.id, command.params); } + on } else { match crate::shortcut_editor::menu_target_now(app, id) { - Some(Ok((id, p))) => menus::invoke(app, &id, p), + Some(Ok((id, p))) => { + menus::invoke(app, &id, p); + true + } Some(Err(why)) => { app.status(why); - return Picked::Refused; + false } None => { // The command is invoked while its menu item is dimmed too, and its own check - // reports why it can't run; the pick counts as refused. + // reports why it can't run. let on = menus::enabled(app, id); menus::invoke(app, id, json!({})); - if !on { - return Picked::Refused; - } + on } } + }; + // A dimmed command that still opens its dialog counts as opening it. + if !had_dialog && app.ui.dialog.is_some() { + Picked::OpenedDialog + } else if ran { + Picked::Ran + } else { + Picked::Refused } - if !had_dialog && app.ui.dialog.is_some() { Picked::OpenedDialog } else { Picked::Ran } } /// What a pick of a palette result did ([`run_pick`]). @@ -461,7 +474,8 @@ pub(crate) enum Picked { Ran, /// The pick opened a dialog, which may still be canceled. OpenedDialog, - /// The pick's menu item is dimmed now, or its panel can't be shown: the status line says why. + /// The pick's menu item is dimmed now, its tool can't be chosen or its panel can't be shown: + /// the status line says why. Refused, } @@ -899,11 +913,18 @@ pub fn show(app: &mut VectorcraftApp, ctx: &egui::Context) { }); if let Some(id) = run { app.ui.palette_open = false; - // A pick that ran or opened a dialog goes first in Recent Commands, even when the dialog - // is then canceled. A refused pick is not recorded. - if run_pick(app, &id) != Picked::Refused && id != PALETTE_TOGGLE { + // A pick goes first in Recent Commands before it runs, and stays there when it ran or + // opened a dialog, even when the dialog is then canceled. A refused pick puts the list + // back as it was. + let before = (id != PALETTE_TOGGLE).then(|| app.ui.recent_commands.clone()); + if before.is_some() { remember(&mut app.ui.recent_commands, &id, |c| entries.list.iter().any(|e| e.id == c)); } + if run_pick(app, &id) == Picked::Refused + && let Some(before) = before + { + app.ui.recent_commands = before; + } } else if outside { app.ui.palette_open = false; } @@ -1627,6 +1648,17 @@ mod tests { let mut presenting = app(Fixture::Multi.session()); presenting.ui.screen_mode = 3; assert_eq!(run_pick(&mut presenting, "panel:swatches"), Picked::Refused); + assert_eq!(run_pick(&mut app(Fixture::Multi.session()), "panel:no-such-panel"), Picked::Refused); + let mut stuck = app(Fixture::Multi.session()); + stuck.fail_next_tool_choice = Some("no switch".into()); + assert_eq!(run_pick(&mut stuck, "tool:knife"), Picked::Refused); + assert_eq!(stuck.ui.status, "no switch"); + // With nothing selected, the Effect menu dims every effect, and a plug-in's filter is dimmed. + let effect = crate::shortcut_editor::effect_items().first().map(|e| format!("effect:{}", e.effect)).expect("an effect"); + let mut empty = app(vectorcraft_engine::Session::new()); + assert_eq!(run_pick(&mut empty, &effect), Picked::Refused, "{effect}"); + assert!(empty.ui.dialog.is_none(), "{effect}"); + assert_eq!(run_pick(&mut app(vectorcraft_engine::Session::new()), "plugin:test.UI.palette_missing"), Picked::Refused); } /// A pick that is refused while its menu item is dimmed is not recorded in Recent Commands, @@ -1654,6 +1686,16 @@ mod tests { open.press(egui::Key::Enter, 1); assert!(!open.app.ui.palette_open, "the palette closes"); assert_eq!(open.app.ui.recent_commands, ["paint.swap", "object.group"]); + // A tool that can't be chosen now is not recorded either. + let mut open = Open::new("knife", WINDOW); + open.app.ui.recent_commands = vec!["paint.swap".into()]; + let k = open.listed().iter().position(|c| c == "tool:knife").expect("the search finds the Knife"); + open.frame(vec![]); + open.press(egui::Key::ArrowDown, k); + open.app.fail_next_tool_choice = Some("no switch".into()); + open.press(egui::Key::Enter, 1); + assert_eq!(open.app.ui.status, "no switch"); + assert_eq!(open.app.ui.recent_commands, ["paint.swap"]); } /// A pick that opens a dialog is recorded in Recent Commands when the dialog opens, so it stays diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 8de60ad58a..1a21849f02 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1026,8 +1026,8 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - Perspective Distort and Free Distort (`object.distort`) turn each warped object's bounding box as the warp turns the object at its own center, the objects inside groups, compound paths and clip groups and the art of linked opacity masks included, so the next Selection or Free Transform drag uses the tilted box; Object › Transform › Reset Bounding Box squares it again, and corners left where they are add no undo step (VectorCraft's own rule; `bboxrotate::distort_turns_an_upright_box_with_the_warp_at_its_center`, `distort_turns_each_member_and_linked_mask_by_its_own_warp`, `mirrored_and_collapsing_distorts_keep_valid_angles`, `distort_angles_undo_redo_and_reopen_together`, `xform::unchanged_distort_records_no_history`). - The Free Transform widget's Constrain works in Free Distort as well as in Free Transform ([the help page](https://helpx.adobe.com/illustrator/using/tool-techniques/free-transform-tool.html)). With Constrain on, or Shift held, a corner dragged in Free Distort moves only along the line through the opposite corner, in the box's own proportions, and the other three corners stay in place; on a turned box the line runs through the box's own corners. The line is VectorCraft's own rule. Cmd/Ctrl+Alt+Shift on a corner still drags in Perspective Distort, where Constrain stays unavailable (tools `xform::free::tests::free_distort_corner_keeps_to_its_diagonal_with_shift_or_constrain`, `shift_pressed_during_a_free_distort_drag_constrains_it`, `a_turned_box_is_constrained_along_its_own_diagonal`, `along_diagonal_of_a_degenerate_box`; engine `xform::free_transform_constrained_distort_keeps_the_corner_on_its_diagonal`; ui-egui `free_transform::tests::the_widget_sets_the_mode_and_a_corner_drag_then_distorts`). - Native macOS menu bar, vector tool cursors, a command palette (Help › Search Commands…), middle-button panning with any tool. Native menus explicitly end tracking on command selection, outside window presses and Escape; menu updates wait until tracking ends, and a dismissing press never starts a canvas gesture (M14.8). - - A Recent Commands button beside the Help › Search Commands field lists the last eight commands and tools picked from the palette, most recent first, with a command picked again moved to the top. A pick is recorded when it runs or opens a dialog, even if the dialog is then canceled; a pick that is refused because its menu item is dimmed, or because its panel can't be shown, is not recorded. Choosing a row closes the palette and runs it as a pick of the same result does; with no picks yet the list shows a dimmed No recent commands row, and a command that is not available now, such as a filter of a plug-in that is not loaded, is left out until it comes back. The ids are saved with the UI state. While the list is open, Up and Down move through its rows, wrapping at the ends, and Escape closes the list before the palette. This is VectorCraft's own addition and does not raise a score (#6376; `palette` tests `recent_commands_*`, `a_recent_command_runs_what_its_pick_runs`, `the_keys_wrap_within_recent_commands`, `escape_closes_recent_commands_before_the_palette`). - - With an empty search, or one of spaces only, the Help › Search Commands field lists the picks of the Recent Commands list (at most eight, leaving out a filter of a plug-in that is not loaded) under a Recent heading, most recent first, with the first highlighted and no result count, so opening the palette and pressing Enter picks the last pick again; a pick that is dimmed now shows why in the status line, as from a search, and keeps its place in the list. With no picks yet it lists no results and shows a dimmed line, "Type to search commands, tools, panels and effects". A pick of Search Commands… itself is not recorded. The palette opens with its first result highlighted and its list scrolled to the top. This is VectorCraft's own behavior (`palette` tests `an_empty_search_lists_the_recent_picks_most_recent_first`, `an_empty_search_without_picks_says_what_to_type`, `enter_on_an_empty_search_runs_the_last_pick_again`, `the_palette_opens_again_with_its_first_row_highlighted`, `the_palette_toggle_is_not_a_recent_pick`, `a_click_on_a_recent_pick_runs_it_and_moves_it_first`, `a_pick_says_whether_it_ran_opened_a_dialog_or_was_refused`, `a_refused_pick_is_not_recorded`, `a_pick_that_opens_a_dialog_is_recorded_even_when_canceled`). + - A Recent Commands button beside the Help › Search Commands field lists the last eight commands and tools picked from the palette, most recent first, with a command picked again moved to the top. A pick is recorded when it runs or opens a dialog, even if the dialog is then canceled; a pick that is refused because its menu item is dimmed, its tool can't be chosen or its panel can't be shown is not recorded, unless it opened a dialog. Choosing a row closes the palette and runs it as a pick of the same result does; with no picks yet the list shows a dimmed No recent commands row, and a command that is not available now, such as a filter of a plug-in that is not loaded, is left out until it comes back. The ids are saved with the UI state. While the list is open, Up and Down move through its rows, wrapping at the ends, and Escape closes the list before the palette. This is VectorCraft's own addition and does not raise a score (#6376; `palette` tests `recent_commands_*`, `a_recent_command_runs_what_its_pick_runs`, `the_keys_wrap_within_recent_commands`, `escape_closes_recent_commands_before_the_palette`). + - With an empty search, or one of spaces only, the Help › Search Commands field lists the picks of the Recent Commands list (at most eight, leaving out a filter of a plug-in that is not loaded) under a Recent heading, most recent first, with the first highlighted and no result count, so opening the palette and pressing Enter picks the last pick again; a pick that is dimmed now shows why in the status line, as from a search, and keeps its place in the list. With no picks yet it lists no results and shows a dimmed Type to search commands, tools, panels and effects line. A pick of Search Commands… itself is not recorded. The palette opens with its first result highlighted and its list scrolled to the top. This is VectorCraft's own behavior (`palette` tests `an_empty_search_lists_the_recent_picks_most_recent_first`, `an_empty_search_without_picks_says_what_to_type`, `enter_on_an_empty_search_runs_the_last_pick_again`, `the_palette_opens_again_with_its_first_row_highlighted`, `the_palette_toggle_is_not_a_recent_pick`, `a_click_on_a_recent_pick_runs_it_and_moves_it_first`, `a_pick_says_whether_it_ran_opened_a_dialog_or_was_refused`, `a_refused_pick_is_not_recorded`, `a_pick_that_opens_a_dialog_is_recorded_even_when_canceled`). - The Learn panel (Window › Learn, or Explore tutorials beside the search icon on the app bar) has a For you tab with a Get started section and a Quick skill guide card, and a Skills tab that lists VectorCraft's own skills with their progress rings and counts of tutorials finished; a skill lists its tutorials, a tutorial shows its numbered steps, and Back goes up a level; `learn.list`, `learn.tab {tab}`, `learn.skill {skill}`, `learn.show {tutorial}` and `learn.back` script it, and the tab buttons, the rows and Back run them ([the help page](https://helpx.adobe.com/illustrator/desktop/get-started/learn-the-basics/learn-skills-quick-skill-guide.html); `panels::learn::tests`). - A tool's name in a Learn tutorial step is a blue link that shows where the tool is without choosing it (`learn.locateTool {tool}`): its toolbar button is marked, a collapsed group's flyout opens with the tool's row marked, a torn-off strip comes to the front, and a tool no shown toolbar holds is marked in the All Tools drawer. The mark, its 3 seconds and the hidden-toolbar cases are VectorCraft's own rules ([the help page](https://helpx.adobe.com/illustrator/desktop/get-started/learn-the-basics/learn-skills-quick-skill-guide.html); `panels::learn::tests`, the `a_learn_link_*` tests in `toolbar::tests`). - Under a tutorial's steps, View more opens the tutorial's own practice sample as a new untitled document, and once the tutorial is finished, Next Up moves to the next tutorial in the same skill, as the help page describes ([the help page](https://helpx.adobe.com/illustrator/desktop/get-started/learn-the-basics/learn-skills-quick-skill-guide.html)). The samples are VectorCraft's own drawings. A Finish tutorial button that shows once the sample is open, the untitled copy, Back to skills in place of Next Up after a skill's last tutorial, and Next Up showing the next tutorial without opening its sample are VectorCraft's own rules. `learn.openSample`, `learn.finish`, `learn.next` and `learn.skills` (Back to skills) script them. Not done: the help page's short video. Regression tests: `view_more_opens_the_tutorial_s_sample_as_a_new_untitled_document`, `finishing_a_tutorial_offers_next_up_in_its_skill`, `the_practice_controls_work_from_the_keyboard`, `the_last_tutorial_of_a_skill_offers_back_to_skills`, `learn_finish_and_learn_next_follow_the_practice`, `learn_skills_shows_the_list_of_skills`, `the_practice_commands_reject_a_missing_or_unknown_tutorial`, `every_tutorial_has_its_own_readable_sample` and `the_next_tutorial_is_the_next_one_in_the_same_skill` in `crates/ui-egui/src/panels/learn/tests.rs`.