From ef6ff54fdd1f91c2502ca5977d8e061519a8eeaa Mon Sep 17 00:00:00 2001 From: RickiNano <81099017+RickiNano@users.noreply.github.com> Date: Sat, 28 Nov 2026 22:35:25 +0100 Subject: [PATCH] New Document: Don't Color Manage in the Color Profile list (#14032) The hosted New Document dialog passes unmanaged_profile("none"), so Color Profile lists Don't Color Manage second in every colour mode and keeps it across a mode change (storytold/craft-libs#2262). Create sends file.new's profile: "none", an untagged document; the file.new params text names it. The test picks the entry on the installed dialog, switches to CMYK and creates: the document is CMYK and untagged, and the recent settings carry profile: "none". --- .../src/cmd/table/store/file_menu.rs | 2 +- crates/ui-egui/src/dialogs/new_doc_ui.rs | 4 +++ .../ui-egui/src/dialogs/new_doc_ui/tests.rs | 26 +++++++++++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/crates/engine-core/src/cmd/table/store/file_menu.rs b/crates/engine-core/src/cmd/table/store/file_menu.rs index 914d89e6f4..d446f61041 100644 --- a/crates/engine-core/src/cmd/table/store/file_menu.rs +++ b/crates/engine-core/src/cmd/table/store/file_menu.rs @@ -10,7 +10,7 @@ pub fn specs() -> Vec { "New…", ["File"], Some("Cmd+N"), - r##"{"width":1..300000=1920,"height":1..300000=1080 (pixel counts are rounded),"mode":"bitmap|rgb|gray|grayscale|cmyk|lab"="rgb","depth":8|16|32=8 (bitmap: 1, its only depth),"background":"white|black|backgroundColor|transparent|#rrggbb"="white" (bitmap: not transparent),"backgroundColor":[r,g,b]? (0..1; defaults to toolbox colour),"resolution":1..30000=72 (ppi),"name":str,"artboard":bool=false (one artboard over the canvas, its background the chosen one, holding an empty Layer 1; no Background layer),"profile":"working"|built-in id|path to an .icc file="working" (the colour profile it is tagged with; it must suit the mode)}"##, + r##"{"width":1..300000=1920,"height":1..300000=1080 (pixel counts are rounded),"mode":"bitmap|rgb|gray|grayscale|cmyk|lab"="rgb","depth":8|16|32=8 (bitmap: 1, its only depth),"background":"white|black|backgroundColor|transparent|#rrggbb"="white" (bitmap: not transparent),"backgroundColor":[r,g,b]? (0..1; defaults to toolbox colour),"resolution":1..30000=72 (ppi),"name":str,"artboard":bool=false (one artboard over the canvas, its background the chosen one, holding an empty Layer 1; no Background layer),"profile":"working"|"none"|built-in id|path to an .icc file="working" (the colour profile it is tagged with; it must suit the mode; none is Don't Color Manage, an untagged document)}"##, always, |s, p| { use crate::document_preset_cmds::{MAX_DIMENSION, MAX_RESOLUTION, background_color, color_mode, sample_type}; diff --git a/crates/ui-egui/src/dialogs/new_doc_ui.rs b/crates/ui-egui/src/dialogs/new_doc_ui.rs index 307aa92a50..f8a66bc61c 100644 --- a/crates/ui-egui/src/dialogs/new_doc_ui.rs +++ b/crates/ui-egui/src/dialogs/new_doc_ui.rs @@ -25,6 +25,9 @@ pub(crate) const LAST_CREATED: SaveKey = SaveKey::new("photocraft.file.new"); /// The SAVED-tier key of the dialog's place and size. const WINDOW: SaveKey = SaveKey::new("photocraft.file.new.window"); +/// The Color Profile entry Don't Color Manage (#14032): the `profile` that makes `file.new` create an untagged document. +const UNMANAGED: &str = "none"; + /// The colour modes the dialog offers, with the engine's mode of each. const MODES: [(ColorMode, DialogMode); 5] = [ (ColorMode::Bitmap, DialogMode::Bitmap), @@ -51,6 +54,7 @@ pub(crate) fn open(app: &mut PhotocraftApp) -> DialogId { let mut dialog = NewDocumentDialog::new(Bind::bound(options)) .background_color(background) .profiles(profiles.clone()) + .unmanaged_profile(UNMANAGED) .custom_pixel_aspects(custom.clone()) .app_name("PhotoCraft") .remember(WINDOW); diff --git a/crates/ui-egui/src/dialogs/new_doc_ui/tests.rs b/crates/ui-egui/src/dialogs/new_doc_ui/tests.rs index 0f81b1755f..43f9035c8f 100644 --- a/crates/ui-egui/src/dialogs/new_doc_ui/tests.rs +++ b/crates/ui-egui/src/dialogs/new_doc_ui/tests.rs @@ -223,3 +223,29 @@ fn create_gives_the_new_document_the_picked_pixel_aspect() { create_with(&mut h, |o| o.pixel_aspect = "custom:1.25:Cinema".into()); assert_eq!(h.state().ui.view.pixel_aspect, SQUARE_PIXELS); } + +/// #14032: Don't Color Manage, picked under Color Profile, stays picked across a colour mode change, and Create makes +/// an untagged document of that mode with `file.new`'s `profile: "none"`. +#[test] +fn dont_color_manage_survives_a_mode_change_and_creates_an_untagged_document() { + let mut h = harness(app()); + let id = open(&mut h); + h.get_by_label("Color Profile").click(); + h.run_steps(3); + h.get_by_label("Don't Color Manage").click(); + h.run_steps(3); + let shown = |h: &crate::new_doc_remember_tests::AppHarness| crate::new_doc_remember_tests::options(h.state(), id); + assert_eq!(shown(&h).profile.as_deref(), Some(UNMANAGED)); + h.get_by_label("Color Mode").click(); + h.run_steps(3); + h.get_by_label("CMYK Color").click(); + h.run_steps(3); + let after = shown(&h); + assert_eq!((after.color_mode, after.profile.as_deref()), (DialogMode::Cmyk, Some(UNMANAGED)), "the mode changed and the entry stayed"); + assert!(press_create(&mut h, id), "Create is enabled"); + let doc = &h.state().session.active().expect("a document was created").doc; + assert_eq!(doc.mode, ColorMode::Cmyk); + assert!(doc.icc_profile.is_none(), "Don't Color Manage embeds no profile"); + let recent = &h.state().session.presets().recent_documents; + assert_eq!(recent[0].profile.as_deref(), Some(UNMANAGED), "Create sent `profile: \"none\"`"); +}