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 <noreply@anthropic.com>
This commit is contained in:
Dylan M. Taylor
2026-11-27 15:14:34 +00:00
co-authored by Claude Opus 5.5
parent d1ebb5a34b
commit 8cdff9ccaf
8 changed files with 16 additions and 16 deletions
+1 -1
View File
@@ -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),
+3 -2
View File
@@ -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 {
@@ -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());
}
}
}
+1 -1
View File
@@ -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 {
+2 -4
View File
@@ -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<Gradient> (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<PatternFill> (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)}));
}
}
@@ -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) {
+3 -2
View File
@@ -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<usize>), 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 {
+3 -3
View File
@@ -40,10 +40,10 @@ fn titles(h: &Harness<'_, SlideApp>) -> Vec<String> {
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"),
}
}