Skip to content

LightCraft: An open-source non-destructive photo editor written by scratch in pure Rust

KEY-GUIDEDUPRIGHT + KEY-GRID: ⇧G starts Guided Upright, G toggles Photo / Square Grid

Brandon Thomas3b4308040f52
diff --git a/crates/ui-egui/src/menus.rs b/crates/ui-egui/src/menus.rs
index f2a9cb838..a544b8069 100644
--- a/crates/ui-egui/src/menus.rs
+++ b/crates/ui-egui/src/menus.rs
@@ -11,8 +11,11 @@ use crate::state::{BeforeAfter, Dialog, RightPanel, ViewMode, Zoom};
pub type UiCommand = (&'static str, &'static str, Option<&'static str>, &'static str);
pub const UI_COMMANDS: &[UiCommand] = &[
- ("view.photoGrid", "Photo Grid", Some("G"), "View"),
- ("view.squareGrid", "Square Grid", Some("Shift+G"), "View"),
+ ("view.photoGrid", "Photo Grid", None, "View"),
+ ("view.squareGrid", "Square Grid", None, "View"),
+ // G: Photo Grid ↔ Square Grid (from other views: the photo grid)
+ ("view.gridToggle", "Grid", Some("G"), ""),
+ ("tool.guidedUpright", "Guided Upright", Some("Shift+G"), "Window>Tools"),
("view.detail", "Detail", Some("D"), "View"),
("view.compare", "Compare", Some("Shift+C"), "View"),
("view.survey", "Survey", Some("N"), "View"),
@@ -185,6 +188,10 @@ pub fn run_ui_command(app: &mut LightcraftApp, id: &str, p: &Value) -> Option<Re
app.ui.view = ViewMode::SquareGrid;
Ok(Value::Null)
}
+ "view.gridToggle" => {
+ app.ui.view = if app.ui.view == ViewMode::PhotoGrid { ViewMode::SquareGrid } else { ViewMode::PhotoGrid };
+ Ok(Value::Null)
+ }
"view.detail" => {
app.ui.view = ViewMode::Detail;
Ok(Value::Null)
@@ -490,6 +497,20 @@ pub fn run_ui_command(app: &mut LightcraftApp, id: &str, p: &Value) -> Option<Re
let tool = &s["tool.".len()..];
match tool {
"none" => app.ui.tool.clear(),
+ "guidedUpright" => {
+ // Crop & Geometry with Guided Upright on, ready to draw guides
+ app.ui.right = RightPanel::Crop;
+ app.ui.view = ViewMode::Detail;
+ let guided = app
+ .session
+ .active()
+ .and_then(|id| app.session.develop_of(id))
+ .is_some_and(|d| d.geometry.upright == lightcraft_develop::Upright::Guided);
+ if !guided && let Err(e) = app.run("geometry.upright", json!({"mode": "guided"})) {
+ return Some(Err(e));
+ }
+ app.ui.tool = "guidedUpright".into();
+ }
"brush" => {
app.ui.right = RightPanel::Masking;
app.ui.view = ViewMode::Detail;
diff --git a/crates/ui-egui/src/panels/bottombar.rs b/crates/ui-egui/src/panels/bottombar.rs
index 6e3a1b02b..a08f520a0 100644
--- a/crates/ui-egui/src/panels/bottombar.rs
+++ b/crates/ui-egui/src/panels/bottombar.rs
@@ -21,7 +21,7 @@ pub fn show(app: &mut LightcraftApp, ui: &mut egui::Ui) {
ui.spacing_mut().item_spacing.x = 2.0;
for (id, icon, mode, tip) in [
("photoGrid", Icon::GridPhoto, ViewMode::PhotoGrid, "Photo Grid (G)"),
- ("squareGrid", Icon::GridSquare, ViewMode::SquareGrid, "Square Grid (Shift+G)"),
+ ("squareGrid", Icon::GridSquare, ViewMode::SquareGrid, "Square Grid (G toggles)"),
("detail", Icon::Single, ViewMode::Detail, "Detail (D)"),
("compare", Icon::Compare, ViewMode::Compare, "Compare (Shift+C)"),
("survey", Icon::Survey, ViewMode::Survey, "Survey (N)"),
diff --git a/crates/ui-egui/src/tests_masking.rs b/crates/ui-egui/src/tests_masking.rs
index 1956785bf..d3d5b7720 100644
--- a/crates/ui-egui/src/tests_masking.rs
+++ b/crates/ui-egui/src/tests_masking.rs
@@ -280,3 +280,22 @@ fn smart_album_rule_editor_creates_and_edits() {
assert_eq!(h.app.session.catalog.album_count(a.id), n3);
h.settle(SETTLE);
}
+
+#[test]
+fn g_toggles_grids_and_shift_g_starts_guided_upright() {
+ let mut h = detail("panel.edit");
+ let key = |h: &mut Headless, shift: bool| {
+ let r = h.request("ui.key", json!({"key": "g", "shift": shift}), T);
+ assert_eq!(r["ok"], true, "{r}");
+ };
+ key(&mut h, false);
+ assert_eq!(h.app.ui.view, crate::state::ViewMode::PhotoGrid);
+ key(&mut h, false);
+ assert_eq!(h.app.ui.view, crate::state::ViewMode::SquareGrid);
+ key(&mut h, false);
+ assert_eq!(h.app.ui.view, crate::state::ViewMode::PhotoGrid);
+ key(&mut h, true);
+ assert_eq!((h.app.ui.view, h.app.ui.right, h.app.ui.tool.as_str()), (crate::state::ViewMode::Detail, RightPanel::Crop, "guidedUpright"));
+ assert_eq!(develop(&h).geometry.upright, lightcraft_develop::Upright::Guided);
+ h.settle(SETTLE);
+}
diff --git a/docs/parity.md b/docs/parity.md
index d7ccbd50e..5c8772e88 100644
--- a/docs/parity.md
+++ b/docs/parity.md
@@ -46,11 +46,11 @@ and prints the summary; `cargo xtask parity --write` refreshes the summary table
| W. Cloud & AI infrastructure (CLOUD / AI) | 0 | 1 | 1 | 2 | — | — |
| X. Cross-cutting behaviours (BEHAV) | 13 | 0 | 4 | 1 | 8/8 (100%) | 5/5 (100%) |
| Y. Menus | 70 | 7 | 8 | 8 | 46/47 (98%) | 19/23 (83%) |
-| Z. Keyboard shortcuts (desktop) | 68 | 8 | 4 | 1 | 49/52 (94%) | 17/23 (74%) |
+| Z. Keyboard shortcuts (desktop) | 69 | 7 | 4 | 1 | 49/52 (94%) | 18/23 (78%) |
| Lightroom Classic extras | 18 | 12 | 49 | 9 | — | 17/21 (81%) |
-| **Total** | 333 | 43 | 124 | 37 | 193/198 (97%) | 120/144 (83%) |
+| **Total** | 334 | 42 | 124 | 37 | 193/198 (97%) | 121/144 (84%) |
-Weighted completion (✅ = 1, 🟡 = ½, 🚫 left out): **70.9%** of 500 in-scope rows — P0 98.7% of 198 · P1 90.3% of 144 · P2 18.4% of 158.
+Weighted completion (✅ = 1, 🟡 = ½, 🚫 left out): **71.0%** of 500 in-scope rows — P0 98.7% of 198 · P1 90.6% of 144 · P2 18.4% of 158.
<!-- /parity:summary -->
## Top gaps
@@ -601,7 +601,7 @@ From `06-shortcuts.md` part 1. Evidence is our binding; conflicts are explained
| KEY-DETAIL | Detail — D | P0 | ✅ | `cmd:view.detail` | |
| KEY-EDIT | Edit — E | P0 | ✅ | `cmd:panel.edit` | |
| KEY-FULLSCREEN | Full-screen preview — F | P1 | ✅ | `cmd:view.fullScreenPreview` | |
-| KEY-GRID | Grid — G | P0 | ✅ | `cmd:view.photoGrid` | |
+| KEY-GRID | Grid — G | P0 | ✅ | `cmd:view.gridToggle`, `cmd:view.photoGrid` | G toggles Photo Grid ↔ Square Grid |
| KEY-INFO | Info — I | P0 | ✅ | `cmd:panel.info` | |
| KEY-KEYWORDS | Keywords — K | P0 | ✅ | `cmd:panel.keywords` | |
| KEY-CLIPBOARD | Copy / paste edit settings — ⌘C / ⌘V | P0 | ✅ | `cmd:develop.copy`, `cmd:develop.paste` | ⌘X has nothing to cut outside text fields |
@@ -631,7 +631,7 @@ From `06-shortcuts.md` part 1. Evidence is our binding; conflicts are explained
| KEY-EXPORTDIALOG | Export dialog — ⇧E | P0 | ✅ | `cmd:dialog.export` | secondary binding (primary ⌘⇧E) |
| KEY-ENTERFULLSCREEN | Window full screen — ⇧⌘F | P1 | ✅ | `cmd:view.enterFullScreen` | |
| KEY-STACK | Group / ungroup stack — ⌘G / ⇧⌘G | P1 | ✅ | `cmd:stack.group`, `cmd:stack.ungroup` | also S expand/collapse, ⇧S top of stack |
-| KEY-GUIDEDUPRIGHT | Guided Upright — ⇧G | P1 | 🟡 | `cmd:geometry.upright` | button in the crop panel; ⇧G = Square Grid |
+| KEY-GUIDEDUPRIGHT | Guided Upright — ⇧G | P1 | ✅ | `cmd:tool.guidedUpright`, `cmd:geometry.upright` | opens Crop & Geometry with Guided Upright on and the guide tool active; G toggles Photo Grid ↔ Square Grid (`cmd:view.gridToggle`) as observed |
| KEY-HIDE | Hide / hide others — ⌘H / ⌥⌘H | P1 | 🟡 | | platform default (unverified) |
| KEY-QUIT | Quit — ⌘Q | P0 | ✅ | `cmd:app.quit` | ⌘Q (Ctrl+Q off macOS) |
| KEY-CREATEVERSION | Create version — ⇧M | P1 | ✅ | `cmd:version.create` | secondary binding (primary ⌘⇧S) |