From 068ca572107355a490a5b5896dad64580efbe7e2 Mon Sep 17 00:00:00 2001 From: ash Date: Sun, 18 Oct 2026 13:03:45 +0530 Subject: [PATCH] Document tab says "Quick Mask" in Quick Mask mode, as in Photoshop (#6660) * Document tab says "Quick Mask" in Quick Mask mode, as in Photoshop In Quick Mask mode, painting and Free Transform target the mask, not the layer. The tab still read "(Layer 1, RGB/8)", so a user who pressed Q by accident and then rotated saw the red overlay turn with the box and the layer stay put, with nothing on screen saying why. The tab now reads "(Quick Mask/8)", the same condition `paint_target` routes on. Co-Authored-By: Claude Opus 5.5 * Credit arnav-hiwarkar in the About window Co-Authored-By: Claude Opus 5.5 * Keep contributors/people.toml as on main The branch removed another contributor's entry; the added entry only repeated the username. Co-Authored-By: Claude Opus 5.5 --------- Co-authored-by: Claude Opus 5.5 Co-authored-by: Brandon Thomas --- crates/ui-egui/src/canvas.rs | 16 +++++++++++++--- crates/ui-egui/src/canvas/tabs_tests.rs | 11 +++++++++++ 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/crates/ui-egui/src/canvas.rs b/crates/ui-egui/src/canvas.rs index 9ca0bac7c2..69ed5ebcdc 100644 --- a/crates/ui-egui/src/canvas.rs +++ b/crates/ui-egui/src/canvas.rs @@ -2496,13 +2496,23 @@ const STUDIO_TAB_PAD: f32 = 48.0; const STUDIO_TAB_GAP: f32 = 4.0; /// Photoshop's tab title: "name @ 50% (Layer 1, RGB/8)", "(Layer 1, Layer Mask/8)" when the mask -/// is targeted; the Background layer's name is omitted. +/// is targeted, "(Quick Mask/8)" in Quick Mask mode; the Background layer's name is omitted. fn pro_tab_title(app: &PhotocraftApp, i: usize) -> String { + use photocraft_engine::channel_cmds::ChannelTarget; let Some(st) = app.session.documents().get(i) else { return String::new() }; let zoom = app.ui.views.get(i).map_or(100.0, |v| v.zoom * 100.0); - let active_layer = st.active_layer.and_then(|id| st.doc.layer(id)).filter(|l| !st.doc.is_background(l.id)); + // Quick Mask mode targets the mask, not the layer (see `paint_target`): painting and Free + // Transform change the red overlay, so the tab says so, as Photoshop's does. + let quick_mask = st.doc.quick_mask.is_some() && st.channel_view.target == ChannelTarget::Composite; + let active_layer = st.active_layer.and_then(|id| st.doc.layer(id)).filter(|l| !quick_mask && !st.doc.is_background(l.id)); let mask = app.session.active_index() == Some(i) && app.ui.mask_target && active_layer.is_some_and(|l| l.mask.is_some()); - let model = if mask { tl!("Layer Mask").to_string() } else { mode_label(&st.doc).to_string() }; + let model = if quick_mask { + tl!("Quick Mask").to_string() + } else if mask { + tl!("Layer Mask").to_string() + } else { + mode_label(&st.doc).to_string() + }; let layer = active_layer.map(|l| format!("{}, ", l.name)).unwrap_or_default(); // A save in progress: "name @ 100% (Layer 1, RGB/16) - Saving 45%", as Photoshop does (#3389). let saving = crate::jobs_ui::save_progress(app, st.doc.id).map(|s| format!(" - {s}")).unwrap_or_default(); diff --git a/crates/ui-egui/src/canvas/tabs_tests.rs b/crates/ui-egui/src/canvas/tabs_tests.rs index 4cc2bca0f0..642ea413f4 100644 --- a/crates/ui-egui/src/canvas/tabs_tests.rs +++ b/crates/ui-egui/src/canvas/tabs_tests.rs @@ -166,3 +166,14 @@ fn ctrl_tab_with_one_document_or_a_focused_field() { } assert!(!Focus::Widget.allows(&crate::shortcuts::parse("Tab").unwrap()), "a focused widget keeps plain Tab"); } + +#[test] +fn quick_mask_mode_names_the_quick_mask_in_the_tab() { + let mut h = harness(1, ThemeKind::Pro); + h.state_mut().run("layer.new.layer", json!({})).unwrap(); + assert_eq!(pro_tab_title(h.state(), 0), "ch1-p01.png @ 100% (Layer 1, RGB/8)*"); + h.state_mut().run("select.editInQuickMaskMode", json!({"on": true})).unwrap(); + assert_eq!(pro_tab_title(h.state(), 0), "ch1-p01.png @ 100% (Quick Mask/8)*"); + h.state_mut().run("select.editInQuickMaskMode", json!({"on": false})).unwrap(); + assert_eq!(pro_tab_title(h.state(), 0), "ch1-p01.png @ 100% (Layer 1, RGB/8)*"); +}