From 8cdff9ccafe1a9d6e0609ce58de88dddbb613ed8 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Fri, 27 Nov 2026 15:14:34 +0000 Subject: [PATCH] Update callers to current signatures: color_row key, editors without key, scroll_position(app), craft Reply, moved closure in master list Co-Authored-By: Claude Opus 5.5 --- crates/ui-egui/src/app/input.rs | 2 +- crates/ui-egui/src/panels/background.rs | 5 +++-- crates/ui-egui/src/panels/effect_presets_tests.rs | 2 +- crates/ui-egui/src/panels/fillui.rs | 2 +- crates/ui-egui/src/panels/format_shape.rs | 6 ++---- crates/ui-egui/src/panels/format_shape/effects.rs | 4 ++-- crates/ui-egui/src/panels/thumbs.rs | 5 +++-- crates/ui-egui/src/reuse_picker_tests.rs | 6 +++--- 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/crates/ui-egui/src/app/input.rs b/crates/ui-egui/src/app/input.rs index ecaef09dc..af6b14f2c 100644 --- a/crates/ui-egui/src/app/input.rs +++ b/crates/ui-egui/src/app/input.rs @@ -6,7 +6,7 @@ impl SlideApp { /// Reads the owners and layout that give a queued window coordinate its meaning. pub(crate) fn input_target(&self, ctx: &egui::Context) -> InputTarget { let bits = |value: f32| if value.is_finite() { value.to_bits() } else { 0 }; - let scroll = crate::ribbon::scroll_position(ctx).x; + let scroll = crate::ribbon::scroll_position(self, ctx).x; InputTarget { documents: self.session.documents().len(), active: self.session.active().map(|document| document.uid), diff --git a/crates/ui-egui/src/panels/background.rs b/crates/ui-egui/src/panels/background.rs index b8957c013..c652cd130 100644 --- a/crates/ui-egui/src/panels/background.rs +++ b/crates/ui-egui/src/panels/background.rs @@ -10,10 +10,11 @@ use craft::ui::pickers::Select; use craft::ui::runtime::env::UnitKind; use craft::ui::sections::Section; use craft::ui::text::{NumberField, StepArrows}; +use deckcraft_model::Fill; use deckcraft_model::style::{PictureFill, PictureMode}; use super::color_row::color_row; -use super::{Fill, SlideApp, Ui, Value, cref_param, json, run}; +use super::{SlideApp, Ui, Value, cref_param, json, run}; /// Edits the current slide's background and its master-graphics visibility. pub(super) fn background(app: &mut SlideApp, ui: &mut Ui) { @@ -61,7 +62,7 @@ pub(super) fn background(app: &mut SlideApp, ui: &mut Ui) { match &fill { Some(Fill::Solid { color }) => { let mut picked = None; - color_row(app, ui, "Color", None, |_, color| { + color_row(app, ui, "background", "Color", None, |_, color| { picked = color; }); if let Some(color) = picked { diff --git a/crates/ui-egui/src/panels/effect_presets_tests.rs b/crates/ui-egui/src/panels/effect_presets_tests.rs index 9cc0cc91e..5f823500c 100644 --- a/crates/ui-egui/src/panels/effect_presets_tests.rs +++ b/crates/ui-egui/src/panels/effect_presets_tests.rs @@ -58,7 +58,7 @@ fn the_current_preset_tile_is_marked_selected() { for candidate in &radii { let label: Label = if *candidate == 0.0 { words.no_glow.clone() } else { words.glow_radius.fill(&[("radius", &candidate.to_string())]).into() }; - assert_eq!(h.get_by_label(label.as_str()).accesskit_node().is_selected(), Some(candidate == radius), "{radius}: {label}"); + assert_eq!(h.get_by_label(label.as_str()).accesskit_node().is_selected(), Some(candidate == radius), "{radius}: {}", label.as_str()); } } } diff --git a/crates/ui-egui/src/panels/fillui.rs b/crates/ui-egui/src/panels/fillui.rs index 7a8dc8011..3ea2fbfa6 100644 --- a/crates/ui-egui/src/panels/fillui.rs +++ b/crates/ui-egui/src/panels/fillui.rs @@ -453,7 +453,7 @@ pub(crate) fn pattern_editor(app: &mut crate::SlideApp, ui: &mut Ui, p: &Pattern out = Some(PatternFill { preset, ..pt.clone() }); } for (label, foreground) in [("Foreground", true), ("Background", false)] { - color_row(app, ui, label, None, |_, picked| { + color_row(app, ui, if foreground { "pattern-foreground" } else { "pattern-background" }, label, None, |_, picked| { if let Some(color) = picked { let pattern = out.get_or_insert_with(|| pt.clone()); if foreground { diff --git a/crates/ui-egui/src/panels/format_shape.rs b/crates/ui-egui/src/panels/format_shape.rs index 06f6b3e31..9e50aa7b8 100644 --- a/crates/ui-egui/src/panels/format_shape.rs +++ b/crates/ui-egui/src/panels/format_shape.rs @@ -244,8 +244,7 @@ fn fill_options(app: &mut SlideApp, ui: &mut Ui, sh: &Shape) { match sh.fill.as_ref().filter(|_| !members_background) { Some(Fill::Picture(picture)) => picture_fill_options(app, ui, picture), Some(Fill::Gradient(gradient)) => { - // PLAN: assumed gradient_editor(app: &mut SlideApp, ui: &mut Ui, key: &str, label: &str, g: &Gradient) -> Option (panels-w10) - if let Some(changed) = crate::fillui::gradient_editor(app, ui, &format!("shape:{}:fill", sh.id.0), "Gradient", gradient) { + if let Some(changed) = crate::fillui::gradient_editor(app, ui, "Gradient", gradient) { run(app, "shape.fill", json!({"gradient": crate::fillui::gradient_json(&changed)})); } if let Some(rotate) = checkbox(ui, "Rotate with shape", gradient.rotate_with_shape) { @@ -254,8 +253,7 @@ fn fill_options(app: &mut SlideApp, ui: &mut Ui, sh: &Shape) { } } Some(Fill::Pattern(pattern)) => { - // PLAN: assumed pattern_editor(app: &mut SlideApp, ui: &mut Ui, key: &str, p: &PatternFill) -> Option (panels-w10) - if let Some(changed) = crate::fillui::pattern_editor(app, ui, &format!("shape:{}:fill", sh.id.0), pattern) { + if let Some(changed) = crate::fillui::pattern_editor(app, ui, pattern) { run(app, "shape.fill", json!({"pattern": crate::fillui::pattern_json(&changed)})); } } diff --git a/crates/ui-egui/src/panels/format_shape/effects.rs b/crates/ui-egui/src/panels/format_shape/effects.rs index 16fe98dcc..2f61177ed 100644 --- a/crates/ui-egui/src/panels/format_shape/effects.rs +++ b/crates/ui-egui/src/panels/format_shape/effects.rs @@ -25,7 +25,7 @@ pub(super) fn tab(app: &mut SlideApp, ui: &mut Ui, sh: &deckcraft_model::Shape) run(app, "shape.effects", json!({"shadow": value})); } if let Some(shadow) = fx.inner_shadow.as_ref().or(fx.outer_shadow.as_ref()) { - color_row(app, ui, "Color", None, |app, color| { + color_row(app, ui, &format!("shape:{}:shadow", sh.id.0), "Color", None, |app, color| { run(app, "shape.effects", json!({"shadowProps": {"color": color.as_ref().map(cref_param)}})); }); for (label, value, range, unit, key, scale) in [ @@ -80,7 +80,7 @@ pub(super) fn tab(app: &mut SlideApp, ui: &mut Ui, sh: &deckcraft_model::Shape) run(app, "shape.effects", json!({"glowProps": {"radius": value}})); } if let Some(glow) = &fx.glow { - color_row(app, ui, "Color", None, |app, color| { + color_row(app, ui, &format!("shape:{}:glow", sh.id.0), "Color", None, |app, color| { run(app, "shape.effects", json!({"glowProps": {"color": color.as_ref().map(cref_param)}})); }); if let Some(value) = slider(ui, "Transparency", (1.0 - glow.color.alpha()) * 100.0, 0.0..=100.0, UnitKind::Percent) { diff --git a/crates/ui-egui/src/panels/thumbs.rs b/crates/ui-egui/src/panels/thumbs.rs index 605303f4a..04a5caa33 100644 --- a/crates/ui-egui/src/panels/thumbs.rs +++ b/crates/ui-egui/src/panels/thumbs.rs @@ -279,6 +279,7 @@ fn master_list(app: &mut SlideApp, ui: &mut Ui, cx: &mut BodyCx<'_>) { }; let mut selection = current.map(Selection::single).unwrap_or_default(); let source = keyed(&rows, |row: &((usize, Option), String)| row.0); + let (store, pictures) = (&store, &pictures); // PLAN: plan error: List::new takes its source through show_items, not a second argument. let out = List::new(words.masters.clone()) .id_salt(("masters", uid)) @@ -291,8 +292,8 @@ fn master_list(app: &mut SlideApp, ui: &mut Ui, cx: &mut BodyCx<'_>) { } else { words.master.fill(&[("name", &doc.masters[master].name)]) }; - ListRow::new(name.clone()).tooltip(name).depth(usize::from(layout.is_some())).thumb_aspect(ThumbSize::Large, aspect, |cx, rect| { - thumb_source::paint(cx, rect, ThumbKey::Layout { master, layout }, &store, &pictures) + ListRow::new(name.clone()).tooltip(name).depth(usize::from(layout.is_some())).thumb_aspect(ThumbSize::Large, aspect, move |cx, rect| { + thumb_source::paint(cx, rect, ThumbKey::Layout { master, layout }, store, pictures) }) }); for event in out.events { diff --git a/crates/ui-egui/src/reuse_picker_tests.rs b/crates/ui-egui/src/reuse_picker_tests.rs index 5f825ac2b..b8c718a6a 100644 --- a/crates/ui-egui/src/reuse_picker_tests.rs +++ b/crates/ui-egui/src/reuse_picker_tests.rs @@ -40,10 +40,10 @@ fn titles(h: &Harness<'_, SlideApp>) -> Vec { fn control(h: &mut Harness<'_, SlideApp>, method: &str, params: Value) { let ctx = h.ctx.clone(); - let (request, _) = crate::control::ControlRequest::new(method, params); + let (request, _) = craft::automation::control::ControlRequest::new(method, params); match crate::control::handle(h.state_mut(), &ctx, &request) { - crate::control::Outcome::Done(answer) => assert!(answer["ok"].as_bool().unwrap_or(false), "{answer}"), - crate::control::Outcome::Screenshot { .. } => panic!("a dialog request must answer directly"), + craft::automation::control::Reply::Done(answer) => assert!(answer["ok"].as_bool().unwrap_or(false), "{answer}"), + _ => panic!("a dialog request must answer directly"), } }