From f6e6d5ebc4136ecfa90a1e3b5c53beca1d12f8e8 Mon Sep 17 00:00:00 2001 From: aiongg Date: Mon, 26 Oct 2026 18:53:20 +0000 Subject: [PATCH] refactor(lightcraft-ui-egui): move panels/slide_layout.rs to dialogs/settings/slide_layout.rs --- crates/ui-egui/src/dialogs/settings.rs | 2 ++ .../{panels => dialogs/settings}/slide_layout.rs | 14 +++++++------- crates/ui-egui/src/panels.rs | 2 +- 3 files changed, 10 insertions(+), 8 deletions(-) rename crates/ui-egui/src/{panels => dialogs/settings}/slide_layout.rs (96%) diff --git a/crates/ui-egui/src/dialogs/settings.rs b/crates/ui-egui/src/dialogs/settings.rs index 7cc30acb2..5fcb721eb 100644 --- a/crates/ui-egui/src/dialogs/settings.rs +++ b/crates/ui-egui/src/dialogs/settings.rs @@ -20,6 +20,8 @@ use crate::state::{GridBadges, PREVIEW_LIMITS, StartupView}; use crate::theme::Tokens; use crate::widgets::register; +pub mod slide_layout; + /// (id, label) of the tabs, in order. pub const TABS: &[(&str, &str)] = &[ ("general", "General"), diff --git a/crates/ui-egui/src/panels/slide_layout.rs b/crates/ui-egui/src/dialogs/settings/slide_layout.rs similarity index 96% rename from crates/ui-egui/src/panels/slide_layout.rs rename to crates/ui-egui/src/dialogs/settings/slide_layout.rs index 82387f1e6..2fc55abda 100644 --- a/crates/ui-egui/src/panels/slide_layout.rs +++ b/crates/ui-egui/src/dialogs/settings/slide_layout.rs @@ -14,8 +14,8 @@ use lightcraft_engine::slide_template::SlideLook; use lightcraft_slideshow::{MARGIN_MAX, SHADOW_OFFSET_MAX, SHADOW_RADIUS_MAX, STROKE_MAX}; use serde_json::{Value, json}; -use super::settings::{check, choices, heading, hint, row}; use crate::LightcraftApp; +use crate::panels::settings::{check, choices, heading, hint, row}; use crate::render::Slot; use crate::theme::Tokens; use crate::widgets::register; @@ -169,7 +169,7 @@ fn screen_aspect(ctx: &egui::Context) -> f64 { pub fn preview(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens, max_h: f32) { heading(ui, t, "Preview"); // the template the pointer is over in the Template Browser, else the settings - let template = super::slide_templates::hovered(ui.ctx()).and_then(|id| app.session.slide_template(&id).ok()); + let template = crate::panels::slide_templates::hovered(ui.ctx()).and_then(|id| app.session.slide_template(&id).ok()); let look = template.as_ref().map_or_else(|| SlideLook::of(&app.session), |t| t.look.clone()); let s = look.layout.clone(); let overlays = look.overlays.clone(); @@ -188,7 +188,7 @@ pub fn preview(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens, max_h: f3 register(ui, "slideshow:preview", rect); let p = ui.painter_at(room.expand(1.0)); p.rect_stroke(rect, 0.0, Stroke::new(1.0, t.text_dim.gamma_multiply(0.5)), egui::StrokeKind::Outside); - super::slide_titles::preview_choice(ui); + crate::panels::slide_titles::preview_choice(ui); if let Some(tpl) = &template { // (said over the bottom of the preview and not below it, which would move the page) let name = if tpl.builtin { crate::i18n::tr(&tpl.name).to_string() } else { tpl.name.clone() }; @@ -208,7 +208,7 @@ pub fn preview(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens, max_h: f3 paint.rect_filled(band, 0.0, Color32::from_black_alpha(190)); paint.galley(pos2(band.left() + 4.0, band.top() + 3.0), galley, Color32::WHITE); } - if let Some(title) = super::slide_titles::preview_shows(ui.ctx()) { + if let Some(title) = crate::panels::slide_titles::preview_shows(ui.ctx()) { title_preview(app, ui, t, rect, title, &look); return; } @@ -239,7 +239,7 @@ pub fn preview(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens, max_h: f3 let still = if last == key { now - since } else { 0.0 }; // the first preview (or another photo's) at once, a changing layout once it has settled if current.is_none() || still >= DEBOUNCE { - let side = super::detail::texture_side(ui.ctx()); + let side = crate::panels::detail::texture_side(ui.ctx()); let edge = app.ui.settings.loupe_edge(pw.max(ph) as f32, usize::MAX, side); if let Some(job) = app.session.slide_job_look(&s, &overlays, id, pw, ph, Some(edge), false) { app.renderer.request(Slot::SlidePreview, job, 90); @@ -252,7 +252,7 @@ pub fn preview(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens, max_h: f3 p.text(rect.center(), Align2::CENTER_CENTER, crate::i18n::tr("Rendering…"), t.font(11.5), Color32::from_gray(200)); return; }; - let drawn = super::detail::fit_texture_rect(rect, tex.size); + let drawn = crate::panels::detail::fit_texture_rect(rect, tex.size); p.image(tex.tex.id(), drawn, Rect::from_min_max(pos2(0.0, 0.0), pos2(1.0, 1.0)), Color32::WHITE); if s.show_guides { // the margins, as lines across the slide (where the image cell's edges are) @@ -296,7 +296,7 @@ fn title_preview(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens, rect: R let p = ui.painter_at(rect.expand(1.0)); match app.renderer.textures.get(&Slot::SlidePreview).filter(|tex| tex.photo == lightcraft_catalog::PhotoId(0)) { Some(tex) => { - let drawn = super::detail::fit_texture_rect(rect, tex.size); + let drawn = crate::panels::detail::fit_texture_rect(rect, tex.size); p.image(tex.tex.id(), drawn, Rect::from_min_max(pos2(0.0, 0.0), pos2(1.0, 1.0)), Color32::WHITE); } None => { diff --git a/crates/ui-egui/src/panels.rs b/crates/ui-egui/src/panels.rs index 321414767..6ea225051 100644 --- a/crates/ui-egui/src/panels.rs +++ b/crates/ui-egui/src/panels.rs @@ -26,7 +26,6 @@ pub mod presets; pub mod profiles; pub mod right; pub mod second; -pub mod slide_layout; pub mod slide_overlays; pub mod slide_templates; pub mod slide_titles; @@ -44,6 +43,7 @@ pub use crate::dialogs::keymap; pub use crate::dialogs::rules_editor; pub use crate::dialogs::rules_editor::rules_move; pub use crate::dialogs::settings; +pub use crate::dialogs::settings::slide_layout; use crate::theme::Tokens; /// Show a side panel the user resizes by dragging its inner edge. `width` (in [`crate::UiState`],