git.lucas.co / cce-designer
graphic design tool
git clone https://git.lucas.co/cce-designer.git

commit50d0ac6d93c8ad15430e85681dbfc87cd24755cf
parentbc55fe9877
authorLucas Galante <[email protected]>
date2026-07-17 15:40
feat: Main node shows "New" and drops "Show" from toggle labels

Shorten a few Main-node param display labels without touching their
`name` (the dispatch identity used by execute_menu_action and the live
toggle refresh): "New Project" -> "New", and every "Show ..." toggle
loses its "Show " prefix. The params pane keys off `label` when set, so
sync_parameters_to_project now resolves a click back to its param by
that display key rather than by name alone.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

 src/app.rs     |  8 +++++++-
 src/main.rs    |  4 ++--
 src/project.rs | 14 ++++++++++++++
 3 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/src/app.rs b/src/app.rs
index 548fb2e..085be78 100644
--- a/src/app.rs
+++ b/src/app.rs
@@ -1448,7 +1448,13 @@ impl State {
                     let mut triggered_buttons = Vec::new();
                     let mut pane_actions = Vec::new();
                     for (u_name, u_val, _) in &updated_params {
-                        if let Some(p) = child.params.iter_mut().find(|p| p.name == *u_name) {
+                        // The params pane reports its display key (label when
+                        // set, else name), so resolve back to the param by that
+                        // key rather than by name alone.
+                        if let Some(p) = child.params.iter_mut().find(|p| {
+                            let key = if p.label.is_empty() { &p.name } else { &p.label };
+                            key == u_name
+                        }) {
                             if p.default != *u_val {
                                 p.default = u_val.clone();
                                 param_changed = true;
diff --git a/src/main.rs b/src/main.rs
index c42afbb..b9e455d 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -773,9 +773,9 @@ mod tests {
                 matches!(&item.prim, cce_ui::scene::paint::Prim::Text { text, .. } if text == needle)
             })
         };
-        // "New Project" is a button label sitting under the open dropdown;
+        // "New" is a button label sitting under the open dropdown;
         // "Other" only exists inside the popover's option list.
-        let label_idx = text_pos("New Project").expect("button label in display list");
+        let label_idx = text_pos("New").expect("button label in display list");
         let option_idx = text_pos("Other").expect("popover option text in display list");
         assert!(option_idx > label_idx, "popover text must draw after widget labels");
         let has_bg_between = list.items[label_idx..option_idx]
diff --git a/src/project.rs b/src/project.rs
index f7582a1..4cb8760 100644
--- a/src/project.rs
+++ b/src/project.rs
@@ -423,6 +423,20 @@ impl State {
                 _ => {}
             }
         }
+
+        // Display labels only — the `name` stays the dispatch identity used by
+        // execute_menu_action and the live-toggle refresh. The params pane keys
+        // off `label` when set (param_display), and sync_parameters_to_project
+        // resolves a click back to its param by that same display key.
+        for p in main_node.params.iter_mut() {
+            if p.name == "New Project" {
+                p.label = "New".to_string();
+            } else if p.param_type == "toggle" {
+                if let Some(rest) = p.name.strip_prefix("Show ") {
+                    p.label = rest.to_string();
+                }
+            }
+        }
     }
 
     pub(crate) fn apply_settings_from_menubar_subnets(&mut self) {