forked from 1b-agent/opencadstudio-upstream
refactor(ui): adopt iced color picker
Remove local Pin/PickList wrappers and the ACI grid.\nBlock viewport input behind the picker and load iced_aw glyphs.
This commit is contained in:
1 parent
3ab8dc3ca5
commit
c9c3d3b1bf
25 files changed
+289
-255
No files matched your search
@@ -235,7 +235,8 @@ pub fn view_window<'a>(
|
||||
.unwrap_or_else(|| val.to_string());
|
||||
row![
|
||||
lbl(label),
|
||||
crate::ui::pick_list(labels, Some(cur), move |chosen| {
|
||||
iced::widget::pick_list(Some(cur), labels, |value| value.to_string())
|
||||
.on_select(move |chosen| {
|
||||
let code = opts
|
||||
.iter()
|
||||
.find(|(_, l)| *l == chosen.as_str())
|
||||
@@ -287,7 +288,10 @@ pub fn view_window<'a>(
|
||||
},
|
||||
move |c| Message::DsEdit(f_sel.clone(), crate::ui::color_select::color_to_aci_string(c)),
|
||||
Message::DsColorMore(fld.clone()),
|
||||
Message::OpenColorWindow(ColorPickTarget::DimStyle(fld.clone())),
|
||||
Message::OpenColorWindow(
|
||||
ColorPickTarget::DimStyle(fld.clone()),
|
||||
cur,
|
||||
),
|
||||
);
|
||||
row![lbl(label), container(selector).width(150)]
|
||||
.spacing(8)
|
||||
@@ -304,9 +308,8 @@ pub fn view_window<'a>(
|
||||
-> Element<'a, Message> {
|
||||
row![
|
||||
lbl(label),
|
||||
crate::ui::pick_list(options, Some(selected), move |value| {
|
||||
Message::DsSetHandle { field, value }
|
||||
})
|
||||
iced::widget::pick_list(Some(selected), options, |value| value.to_string())
|
||||
.on_select(move |value| Message::DsSetHandle { field, value })
|
||||
.text_size(11)
|
||||
.width(150),
|
||||
]
|
||||
|
||||
@@ -126,7 +126,10 @@ fn color_row<'a>(
|
||||
value: crate::ui::color_select::color_to_aci_string(c),
|
||||
},
|
||||
Message::MLeaderColorMore(field),
|
||||
Message::OpenColorWindow(crate::app::ColorPickTarget::MLeader(field)),
|
||||
Message::OpenColorWindow(
|
||||
crate::app::ColorPickTarget::MLeader(field),
|
||||
cur,
|
||||
),
|
||||
);
|
||||
row![text(label).size(11).style(muted_style).width(150), selector]
|
||||
.spacing(8)
|
||||
@@ -142,9 +145,8 @@ fn enum_row<'a>(
|
||||
) -> Element<'a, Message> {
|
||||
row![
|
||||
text(label).size(11).style(muted_style).width(150),
|
||||
crate::ui::pick_list(options, Some(selected), move |value| {
|
||||
Message::MLeaderStyleSetEnum { field, value }
|
||||
})
|
||||
iced::widget::pick_list(Some(selected), options, |value| value.to_string())
|
||||
.on_select(move |value| Message::MLeaderStyleSetEnum { field, value })
|
||||
.text_size(11)
|
||||
.width(190),
|
||||
]
|
||||
@@ -157,11 +159,12 @@ fn lineweight_row<'a>(selected: acadrust::types::LineWeight) -> Element<'a, Mess
|
||||
let selected = crate::ui::properties::LwItem(selected);
|
||||
row![
|
||||
text("Line weight:").size(11).style(muted_style).width(150),
|
||||
crate::ui::pick_list(
|
||||
crate::ui::properties::lw_options(),
|
||||
iced::widget::pick_list(
|
||||
Some(selected),
|
||||
|item| Message::MLeaderStyleLineWeightChanged(item.0)
|
||||
crate::ui::properties::lw_options(),
|
||||
|value| value.to_string(),
|
||||
)
|
||||
.on_select(|item| Message::MLeaderStyleLineWeightChanged(item.0))
|
||||
.text_size(11)
|
||||
.width(190),
|
||||
]
|
||||
@@ -199,9 +202,8 @@ fn handle_row<'a>(
|
||||
) -> Element<'a, Message> {
|
||||
row![
|
||||
text(label).size(11).style(muted_style).width(150),
|
||||
crate::ui::pick_list(options, Some(selected), move |value| {
|
||||
Message::MLeaderStyleSetHandle { field, value }
|
||||
})
|
||||
iced::widget::pick_list(Some(selected), options, |value| value.to_string())
|
||||
.on_select(move |value| Message::MLeaderStyleSetHandle { field, value })
|
||||
.text_size(11)
|
||||
.width(190),
|
||||
]
|
||||
|
||||
+18
-12
@@ -119,7 +119,10 @@ pub fn view_window<'a>(
|
||||
value: crate::ui::color_select::color_to_aci_string(c),
|
||||
},
|
||||
Message::TableColorMore(row, field),
|
||||
Message::OpenColorWindow(crate::app::ColorPickTarget::Table(row, field)),
|
||||
Message::OpenColorWindow(
|
||||
crate::app::ColorPickTarget::Table(row, field),
|
||||
cur,
|
||||
),
|
||||
);
|
||||
row![text(label).size(11).style(muted_style).width(150), selector]
|
||||
.spacing(8)
|
||||
@@ -141,7 +144,8 @@ pub fn view_window<'a>(
|
||||
.push(
|
||||
row![
|
||||
text(" Alignment:").size(11).style(muted_style).width(150),
|
||||
crate::ui::pick_list(
|
||||
iced::widget::pick_list(
|
||||
Some(format!("{:?}", rs.alignment)),
|
||||
[
|
||||
"TopLeft",
|
||||
"TopCenter",
|
||||
@@ -156,9 +160,9 @@ pub fn view_window<'a>(
|
||||
.iter()
|
||||
.map(|s| s.to_string())
|
||||
.collect::<Vec<_>>(),
|
||||
Some(format!("{:?}", rs.alignment)),
|
||||
move |value| Message::TableStyleCellSetAlign { row, value },
|
||||
|value| value.to_string(),
|
||||
)
|
||||
.on_select(move |value| Message::TableStyleCellSetAlign { row, value })
|
||||
.text_size(11)
|
||||
.width(140),
|
||||
]
|
||||
@@ -194,18 +198,19 @@ pub fn view_window<'a>(
|
||||
col = col.push(
|
||||
row![
|
||||
text(format!(" {bname}")).size(11).style(muted_style).width(28),
|
||||
crate::ui::pick_list(
|
||||
iced::widget::pick_list(
|
||||
Some(format!("{:?}", bd.border_type)),
|
||||
["Single", "Double"]
|
||||
.iter()
|
||||
.map(|s| s.to_string())
|
||||
.collect::<Vec<_>>(),
|
||||
Some(format!("{:?}", bd.border_type)),
|
||||
move |value| Message::TableStyleBorderSetType {
|
||||
|value| value.to_string(),
|
||||
)
|
||||
.on_select(move |value| Message::TableStyleBorderSetType {
|
||||
cell: row,
|
||||
border: bu,
|
||||
value
|
||||
},
|
||||
)
|
||||
})
|
||||
.text_size(10)
|
||||
.width(74),
|
||||
text_input("wt", &border_lw[r][b])
|
||||
@@ -274,14 +279,15 @@ pub fn view_window<'a>(
|
||||
.align_y(iced::Center),
|
||||
row![
|
||||
text("Flow direction:").size(11).style(muted_style).width(160),
|
||||
crate::ui::pick_list(
|
||||
iced::widget::pick_list(
|
||||
Some(format!("{:?}", s.flow_direction)),
|
||||
["Down", "Up"]
|
||||
.iter()
|
||||
.map(|s| s.to_string())
|
||||
.collect::<Vec<_>>(),
|
||||
Some(format!("{:?}", s.flow_direction)),
|
||||
Message::TableStyleSetFlow,
|
||||
|value| value.to_string(),
|
||||
)
|
||||
.on_select(Message::TableStyleSetFlow)
|
||||
.text_size(11)
|
||||
.width(100),
|
||||
]
|
||||
|
||||
Reference in new issue
Block a user