fix(ui): make modal layouts intrinsic

Pin Iced 0.15 so dialogs can measure content before distributing the resolved frame across child panels. Keep the web plugin notice compact and non-resizable.\n\nCloses #582
This commit is contained in:
Hakan Seven committed 2026-07-30 14:47:28 +03:00
1 parent 284d6ef517
commit 3ab8dc3ca5
59 files changed
+2197 -1652

No files matched your search

+33 -32
View File
@@ -2,11 +2,11 @@
use crate::app::Message;
use iced::widget::{button, column, container, row, scrollable, text, text_input, Space};
use iced::{Background, Border, Element, Fill, Theme};
use iced::{Background, Border, Element, Theme};
fn btn_s(accent: bool) -> impl Fn(&Theme, button::Status) -> button::Style {
move |theme: &Theme, st| {
let palette = theme.extended_palette();
let palette = theme.palette();
let pair = match (accent, st) {
(true, button::Status::Hovered | button::Status::Pressed) => palette.primary.strong,
(false, button::Status::Hovered | button::Status::Pressed) => {
@@ -29,7 +29,7 @@ fn btn_s(accent: bool) -> impl Fn(&Theme, button::Status) -> button::Style {
}
fn field_style(theme: &Theme, status: text_input::Status) -> text_input::Style {
let palette = theme.extended_palette();
let palette = theme.palette();
let border = match status {
text_input::Status::Focused { .. } => palette.primary.base.color,
_ => palette.background.neutral.color,
@@ -50,30 +50,30 @@ fn field_style(theme: &Theme, status: text_input::Status) -> text_input::Style {
fn muted_style(theme: &Theme) -> iced::widget::text::Style {
iced::widget::text::Style {
color: Some(theme.extended_palette().background.base.text.scale_alpha(0.68)),
color: Some(theme.palette().background.base.text.scale_alpha(0.68)),
}
}
fn hdivider<'a>() -> Element<'a, Message> {
container(Space::new().width(Fill).height(1))
.width(Fill)
fn hdivider<'a>(width: iced::Length) -> Element<'a, Message> {
container(Space::new().width(width).height(1))
.width(width)
.height(1)
.style(|theme: &Theme| container::Style {
background: Some(Background::Color(
theme.extended_palette().background.neutral.color
theme.palette().background.neutral.color
)),
..Default::default()
})
.into()
}
fn vsep<'a>() -> Element<'a, Message> {
container(Space::new().width(1).height(Fill))
fn vsep<'a>(height: iced::Length) -> Element<'a, Message> {
container(Space::new().width(1).height(height))
.width(1)
.height(Fill)
.height(height)
.style(|theme: &Theme| container::Style {
background: Some(Background::Color(
theme.extended_palette().background.neutral.color
theme.palette().background.neutral.color
)),
..Default::default()
})
@@ -86,6 +86,7 @@ pub fn view_window<'a>(
color_buf: &'a str,
lw_buf: &'a str,
screen_buf: &'a str,
sizing: crate::ui::modal::ModalSizing,
) -> Element<'a, Message> {
let table_name = table
.map(|t| t.name.as_str())
@@ -106,7 +107,7 @@ pub fn view_window<'a>(
.on_press(Message::PlotStyleClear)
.style(btn_s(false))
.padding([4, 10]),
Space::new().width(Fill),
Space::new().width(sizing.width),
text(table_name).size(10).style(muted_style),
]
.spacing(4)
@@ -114,11 +115,11 @@ pub fn view_window<'a>(
)
.style(|theme: &Theme| container::Style {
background: Some(Background::Color(
theme.extended_palette().background.weak.color
theme.palette().background.weak.color
)),
..Default::default()
})
.width(Fill)
.width(sizing.width)
.padding([5, 8]);
// ── Left: ACI list ────────────────────────────────────────────────────
@@ -153,7 +154,7 @@ pub fn view_window<'a>(
button(text(label).size(10).font(iced::Font::MONOSPACE))
.on_press(Message::PlotStylePanelSelectAci(aci))
.style(move |theme: &Theme, st| {
let palette = theme.extended_palette();
let palette = theme.palette();
let pair = match (is_sel, st) {
(true, _) => Some(palette.primary.strong),
(false, button::Status::Hovered | button::Status::Pressed) => {
@@ -170,7 +171,7 @@ pub fn view_window<'a>(
}
})
.padding([2, 8])
.width(Fill)
.width(sizing.width)
.into()
})
.collect();
@@ -178,9 +179,9 @@ pub fn view_window<'a>(
let aci_list = container(
column![
text("ACI Color Index").size(10).style(muted_style),
container(scrollable(column(aci_items).spacing(1)).height(Fill))
container(scrollable(column(aci_items).spacing(1)).height(sizing.height))
.style(|theme: &Theme| {
let palette = theme.extended_palette();
let palette = theme.palette();
container::Style {
background: Some(Background::Color(palette.background.weak.color)),
border: Border {
@@ -191,15 +192,15 @@ pub fn view_window<'a>(
..Default::default()
}
})
.width(Fill)
.height(Fill)
.width(sizing.width)
.height(sizing.height)
.padding(2),
]
.spacing(4)
.height(Fill),
.height(sizing.height),
)
.width(280)
.height(Fill)
.height(sizing.height)
.padding(iced::Padding {
top: 12.0,
right: 8.0,
@@ -261,29 +262,29 @@ pub fn view_window<'a>(
text(format!(" Color: {cur_color}")).size(10),
text(format!(" Lineweight: {cur_lw}")).size(10),
text(format!(" Screening: {cur_scr}")).size(10),
Space::new().height(Fill),
Space::new().height(sizing.height),
button(text("Apply to ACI").size(11))
.on_press(Message::PlotStylePanelApply)
.style(btn_s(true))
.padding([5, 10]),
]
.spacing(8)
.height(Fill),
.height(sizing.height),
)
.width(Fill)
.height(Fill)
.width(sizing.width)
.height(sizing.height)
.padding([12, 12]);
let body = row![aci_list, vsep(), edit_panel].height(Fill);
let body = row![aci_list, vsep(sizing.height), edit_panel].height(sizing.height);
container(column![toolbar, hdivider(), body].spacing(0))
container(column![toolbar, hdivider(sizing.width), body].spacing(0))
.style(|theme: &Theme| container::Style {
background: Some(Background::Color(
theme.extended_palette().background.base.color
theme.palette().background.base.color
)),
..Default::default()
})
.width(Fill)
.height(Fill)
.width(sizing.width)
.height(sizing.height)
.into()
}