mirror of
https://github.com/storytold/photocraft.git
synced 2026-12-02 06:20:48 +01:00
Preferences on Cmd+K, Search on Cmd+F (Photoshop's defaults) (#1900)
Edit › Preferences › General takes ⌘K and Edit › Search moves to ⌘F, as in Photoshop. Nothing else was bound to ⌘F (Filter › Last Filter stays ⌘⌥F); the shortcut-capture tests follow. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
9b69ba89aa
commit
e8b992a6f0
7 files changed
+21
-16
No files matched your search
@@ -203,7 +203,7 @@ Every screenshot here is the real app at work on public-domain art, rendered off
|
||||
</td>
|
||||
<td width="33%" valign="top">
|
||||
<h4>🪄 The everyday essentials</h4>
|
||||
Auto Tone, Contrast and Color · Equalize · Image and Canvas Size · Crop and Trim · Reveal All · Edit › Fill and Stroke · Copy Merged · Paste in Place · guides, rulers, grid and snapping · Actions record and replay · a command palette (⌘K).
|
||||
Auto Tone, Contrast and Color · Equalize · Image and Canvas Size · Crop and Trim · Reveal All · Edit › Fill and Stroke · Copy Merged · Paste in Place · guides, rulers, grid and snapping · Actions record and replay · a command palette (⌘F).
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@@ -1588,7 +1588,10 @@ macro_rules! spec {
|
||||
|
||||
macro_rules! section {
|
||||
($id:literal, $label:literal) => {
|
||||
CommandSpec { id: $id, label: $label, menu: &["Edit", "Preferences"], shortcut: None, params: r##"{}"##, enabled: always, run: |s, _| preferences_section(s, &json!({"__section": section_of($id)})), journal: false }
|
||||
section!($id, $label, None)
|
||||
};
|
||||
($id:literal, $label:literal, $shortcut:expr) => {
|
||||
CommandSpec { id: $id, label: $label, menu: &["Edit", "Preferences"], shortcut: $shortcut, params: r##"{}"##, enabled: always, run: |s, _| preferences_section(s, &json!({"__section": section_of($id)})), journal: false }
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1618,7 +1621,8 @@ pub fn specs() -> Vec<CommandSpec> {
|
||||
false
|
||||
),
|
||||
spec!("prefs.reset", "Reset Preferences", [], None, r##"{"path":"section|section.key"?=everything}"##, prefs_reset, false),
|
||||
section!("edit.preferences.general", "General…"),
|
||||
// Photoshop: ⌘K opens Preferences › General (⌘, is Layer › Hide Layers).
|
||||
section!("edit.preferences.general", "General…", Some("Cmd+K")),
|
||||
section!("edit.preferences.interface", "Interface…"),
|
||||
section!("edit.preferences.workspace", "Workspace…"),
|
||||
section!("edit.preferences.tools", "Tools…"),
|
||||
|
||||
@@ -87,7 +87,7 @@ pub static CATALOG: &[(&[&str], &str, Option<&str>, &str)] = &[
|
||||
(&["Edit", "Paste Special"], "Paste Outside", None, "edit.pasteSpecial.pasteOutside"),
|
||||
(&["Edit"], "Clear", None, "edit.clear"),
|
||||
(&["Edit"], "---", None, "---"),
|
||||
(&["Edit"], "Search…", Some("Cmd+K"), "edit.search"),
|
||||
(&["Edit"], "Search…", Some("Cmd+F"), "edit.search"),
|
||||
(&["Edit"], "---", None, "---"),
|
||||
(&["Edit"], "Check Spelling…", None, "edit.checkSpelling"),
|
||||
(&["Edit"], "Find and Replace Text…", None, "edit.findAndReplaceText"),
|
||||
@@ -147,7 +147,7 @@ pub static CATALOG: &[(&[&str], &str, Option<&str>, &str)] = &[
|
||||
(&["Edit"], "Menus…", Some("Cmd+Alt+Shift+M"), "edit.menus"),
|
||||
(&["Edit"], "Toolbar…", None, "edit.toolbar"),
|
||||
(&["Edit"], "---", None, "---"),
|
||||
(&["Edit", "Preferences"], "Settings…", None, "edit.preferences.general"),
|
||||
(&["Edit", "Preferences"], "Settings…", Some("Cmd+K"), "edit.preferences.general"),
|
||||
(&["Edit", "Preferences"], "AI Integrations…", None, "edit.preferences.integrations"),
|
||||
(&["Edit", "Preferences"], "Interface…", None, "edit.preferences.interface"),
|
||||
(&["Edit", "Preferences"], "Workspace…", None, "edit.preferences.workspace"),
|
||||
|
||||
@@ -67,7 +67,7 @@ pub const UI_COMMANDS: &[(&str, &str, &[&str], Option<&str>)] = &[
|
||||
("window.theme.studio", "Studio Theme", &["Window", "Theme"], None),
|
||||
("window.theme.studioLight", "Studio Light Theme", &["Window", "Theme"], None),
|
||||
("window.theme.classic", "Classic Theme", &["Window", "Theme"], None),
|
||||
("edit.search", "Search…", &["Edit"], Some("Cmd+K")),
|
||||
("edit.search", "Search…", &["Edit"], Some("Cmd+F")),
|
||||
("help.discord", "Join the ArtCraft Discord…", &["Help"], None),
|
||||
("help.website", "PhotoCraft Website", &["Help"], None),
|
||||
("help.artcraftWebsite", "ArtCraft Website", &["Help"], None),
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//! ⌘K command palette: fuzzy search over every menu command and tool.
|
||||
//! ⌘F command palette: fuzzy search over every menu command and tool.
|
||||
|
||||
use egui::{Align2, Color32, CornerRadius, RichText, Sense, Stroke, vec2};
|
||||
|
||||
|
||||
@@ -47,18 +47,19 @@ fn capture(h: &mut Harness<'_, PhotocraftApp>, button: &str, modifier: Key, held
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn ctrl_f_is_recorded_as_ctrl_f_not_the_control_key() {
|
||||
fn ctrl_k_is_recorded_as_ctrl_k_not_the_control_key() {
|
||||
for ppp in [1.0, 2.0] {
|
||||
let (mut h, id) = dialog(ppp, "edit.search", "search…");
|
||||
let current = crate::shortcuts::pretty("Cmd+K");
|
||||
// Search's default is ⌘F (Photoshop); ⌘K is Preferences, so this also reports a conflict.
|
||||
let current = crate::shortcuts::pretty("Cmd+F");
|
||||
// On Windows and Linux the Ctrl key is the command modifier.
|
||||
capture(&mut h, ¤t, Key::ControlLeft, Modifiers::COMMAND, Key::F);
|
||||
assert_eq!(field(&h, id, "overrides")["edit.search"], json!("Cmd+F"), "@{ppp}x");
|
||||
capture(&mut h, ¤t, Key::ControlLeft, Modifiers::COMMAND, Key::K);
|
||||
assert_eq!(field(&h, id, "overrides")["edit.search"], json!("Cmd+K"), "@{ppp}x");
|
||||
assert_eq!(field(&h, id, "capture"), json!(false));
|
||||
let message = field(&h, id, "message");
|
||||
assert!(!message.as_str().unwrap().contains("ontrol"), "@{ppp}x: {message}");
|
||||
// The row shows the new shortcut.
|
||||
h.get_by_label(&crate::shortcuts::pretty("Cmd+F"));
|
||||
h.get_by_label(&crate::shortcuts::pretty("Cmd+K"));
|
||||
h.render().ok();
|
||||
}
|
||||
}
|
||||
@@ -73,7 +74,7 @@ fn every_modifier_key_waits_for_the_real_key() {
|
||||
(Key::ShiftRight, Modifiers::COMMAND | Modifiers::SHIFT),
|
||||
] {
|
||||
let (mut h, id) = dialog(1.0, "edit.search", "search…");
|
||||
h.get_by_label(&crate::shortcuts::pretty("Cmd+K")).click();
|
||||
h.get_by_label(&crate::shortcuts::pretty("Cmd+F")).click();
|
||||
h.run_steps(2);
|
||||
key(&mut h, modifier, true, held);
|
||||
h.run_steps(2);
|
||||
@@ -93,13 +94,13 @@ fn every_modifier_key_waits_for_the_real_key() {
|
||||
fn a_shortcut_in_use_is_reported_and_moved_on_ok() {
|
||||
// ⌘J is Layer › New › Layer via Copy: giving it to Search warns, and OK moves it.
|
||||
let (mut h, id) = dialog(1.0, "edit.search", "search…");
|
||||
capture(&mut h, &crate::shortcuts::pretty("Cmd+K"), Key::ControlLeft, Modifiers::COMMAND, Key::J);
|
||||
capture(&mut h, &crate::shortcuts::pretty("Cmd+F"), Key::ControlLeft, Modifiers::COMMAND, Key::J);
|
||||
let message = field(&h, id, "message");
|
||||
assert!(message.as_str().unwrap().contains("already in use"), "{message}");
|
||||
crate::dialogs::confirm(h.state_mut(), id).unwrap();
|
||||
h.run_steps(2);
|
||||
let app = h.state();
|
||||
assert_eq!(app.session.prefs().shortcut("edit.search", Some("Cmd+K")), Some("Cmd+J"));
|
||||
assert_eq!(app.session.prefs().shortcut("edit.search", Some("Cmd+F")), Some("Cmd+J"));
|
||||
let bound: Vec<String> =
|
||||
crate::shortcut_dispatch::bindings(app).into_iter().filter(|(_, sc)| *sc == crate::shortcuts::parse("Cmd+J").unwrap()).map(|(id, _)| id).collect();
|
||||
assert_eq!(bound, ["edit.search"], "one owner for ⌘J");
|
||||
|
||||
@@ -189,7 +189,7 @@ Each command registers the following:
|
||||
- `kind`: Instant / Dialog / Interactive (hands control to a tool, e.g. Free Transform).
|
||||
|
||||
**Consumers:**
|
||||
- The GUI builds the menu bar, the ⌘K palette and the shortcut editor from it.
|
||||
- The GUI builds the menu bar, the ⌘F palette and the shortcut editor from it.
|
||||
- `automation` exposes the registry as MCP tools.
|
||||
- `photocraft-cli` exposes `photocraft-cli run in.psd --cmd filter.blur.gaussianBlur --params '{"radius":4}' --out out.png`.
|
||||
- Action recording is simply `Vec<CommandInvocation>`.
|
||||
|
||||
Reference in new issue
Block a user