Merge pull request #4578 from storytold/fix/color-settings-shows-panel

Fix #4542: Edit › Color Settings… and Assign Profile… show the Separations Preview panel
This commit is contained in:
BFlat
2026-10-29 20:20:19 +07:00
committed by GitHub
3 changed files with 28 additions and 4 deletions
+4 -4
View File
@@ -175,11 +175,11 @@ fn run_ui_part2(app: &mut VectorcraftApp, id: &str, p: &Value) -> Option<Result<
crate::prefs_dialog::open(app, s("category").as_deref());
Ok(Value::Null)
}
// Edit → Color Settings… / Assign Profile… (no params): show the colour-management panel.
// Edit → Color Settings… / Assign Profile… (no params): show the colour-management panel
// wherever it is, as Window › Separations Preview does (it isn't in an icon column, so a
// flyout for it never opened: #4542).
"edit.colorSettings" | "edit.assignProfile" if p.as_object().is_none_or(|o| o.is_empty()) => {
app.ui.open_panel = Some("separations".into());
app.ui.dock = true;
app.session.execute(id, p).map_err(|e| e.to_string())
crate::panel_docking::reveal_panel(app, "separations").and_then(|_| app.session.execute(id, p).map_err(|e| e.to_string()))
}
"view.outline" => flag(&mut app.ui.view.outline),
_ => return None,
+14
View File
@@ -283,6 +283,20 @@ fn panel_ids_are_case_insensitive_and_labels_work() {
app.ui.dock_collapsed = false;
}
/// #4542: Edit › Color Settings… and Assign Profile… show the Separations Preview panel, which
/// isn't in an icon column, and leave it showing when it already does.
#[test]
fn color_settings_and_assign_profile_show_the_separations_panel() {
let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), crate::Services::default());
app.run("file.new", json!({})).unwrap();
let shown = |app: &VectorcraftApp| checked(app, "window.panel", &json!({"panel": "separations"})).unwrap();
assert!(!shown(&app));
for id in ["edit.colorSettings", "edit.colorSettings", "edit.assignProfile"] {
app.run(id, json!({})).unwrap();
assert!(shown(&app), "{id} shows the panel");
}
}
#[test]
fn saved_views_store_and_restore_the_view() {
let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), crate::Services::default());
+10
View File
@@ -345,6 +345,16 @@ fn show_panel(app: &mut VectorcraftApp, params: &Value) -> Result<Value, String>
})
}
/// Show `panel` as `window.panel` does, but leave it be when it already shows ([`showing`]): a
/// command that opens a panel to work in (Edit › Color Settings…) never puts it away.
pub(crate) fn reveal_panel(app: &mut VectorcraftApp, panel: &str) -> Result<Value, String> {
if showing(&app.ui, panel) {
app.ui.dock = true;
return Ok(json!({"open": panel}));
}
show_panel(app, &json!({ "panel": panel }))
}
/// `window.collapseDock {collapsed?}`: collapse every dock column to icons, or expand the outer
/// one; without `collapsed` it toggles the outer column.
pub(crate) fn collapse_dock(app: &mut VectorcraftApp, collapsed: Option<bool>) -> Result<Value, String> {