forked from 1b-agent/opencadstudio-upstream
fix(attdef): SVG dialog buttons, upper-case tags from Properties, Cargo.toml blank line
#1574's dialog drew its pick, close, field and editor buttons with glyph text (⌖ × ƒ …) that renders as tofu where the font lacks it; they use the snap and close SVG icons and plain ASCII now. A tag set from Properties is stored upper case like one from the dialogs, and the stray blank line the PR left in Cargo.toml is gone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a1d0cf3873
commit
558b5f6526
3 files changed
+19
-11
No files matched your search
@@ -94,7 +94,6 @@ objc2-foundation = { version = "0.2", features = ["NSArray", "NSURL", "NSString"
|
||||
iced_core = { git = "https://github.com/iced-rs/iced.git", rev = "23604ff22ab0aad9e00b9327cb7b8546ed84db39" }
|
||||
iced_widget = { git = "https://github.com/iced-rs/iced.git", rev = "23604ff22ab0aad9e00b9327cb7b8546ed84db39" }
|
||||
|
||||
|
||||
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
||||
getrandom = "0.3"
|
||||
ocs_plugin_api = { path = "crates/ocs_plugin_api", features = ["host"] }
|
||||
|
||||
@@ -713,7 +713,7 @@ impl PropertyEditable for AttributeDefinition {
|
||||
return;
|
||||
}
|
||||
match field {
|
||||
"att_tag" => self.tag = value.trim().to_string(),
|
||||
"att_tag" => self.tag = value.trim().to_uppercase(),
|
||||
"att_prompt" if !self.flags.constant => self.prompt = value.to_string(),
|
||||
"att_default" => {
|
||||
self.default_value = value.to_string();
|
||||
|
||||
@@ -116,8 +116,12 @@ fn input<'a>(value: &str, enabled: bool, on: fn(String) -> AttdefDialogMsg) -> E
|
||||
}
|
||||
|
||||
/// The small button beside a field that takes the value from the drawing.
|
||||
fn pick<'a>(glyph: &'static str, tip: String, message: Option<AttdefDialogMsg>) -> Element<'a, Message> {
|
||||
let b = button(text(glyph).size(13).align_x(iced::Center).width(Fill))
|
||||
fn pick<'a>(
|
||||
face: Element<'a, Message>,
|
||||
tip: String,
|
||||
message: Option<AttdefDialogMsg>,
|
||||
) -> Element<'a, Message> {
|
||||
let b = button(container(face).center_x(Fill))
|
||||
.style(button_style(false))
|
||||
.padding([4, 0])
|
||||
.width(Length::Fixed(28.0));
|
||||
@@ -146,7 +150,7 @@ fn error_band<'a>(error: &Option<String>) -> Option<Element<'a, Message>> {
|
||||
crate::ui::icons::semantic(ICON_WARN, 14.0),
|
||||
text(error).size(11),
|
||||
Space::new().width(Fill),
|
||||
button(text("×").size(12))
|
||||
button(crate::ui::icons::themed(crate::ui::icons::CLOSE, 10.0))
|
||||
.on_press(msg(AttdefDialogMsg::DismissError))
|
||||
.style(button_style(false))
|
||||
.padding([1, 6]),
|
||||
@@ -165,6 +169,11 @@ fn error_band<'a>(error: &Option<String>) -> Option<Element<'a, Message>> {
|
||||
)
|
||||
}
|
||||
|
||||
/// The face of the buttons that take a value from the drawing.
|
||||
fn screen_pick<'a>() -> Element<'a, Message> {
|
||||
crate::ui::icons::themed(crate::ui::icons::SNAP, 14.0)
|
||||
}
|
||||
|
||||
static ICON_WARN: &[u8] = include_bytes!("../../../assets/icons/ui/warning_triangle.svg");
|
||||
|
||||
fn footer<'a>(action: std::borrow::Cow<'static, str>, ok: AttdefDialogMsg) -> Element<'a, Message> {
|
||||
@@ -234,13 +243,13 @@ pub fn view<'a>(state: &'a AttdefDialogState, sizing: crate::ui::modal::ModalSiz
|
||||
let mut value = row![input(&state.default, true, AttdefDialogMsg::Default)].spacing(6);
|
||||
if multiline {
|
||||
value = value.push(pick(
|
||||
"…",
|
||||
text("...").size(13).into(),
|
||||
t!("Multiline editor").into_owned(),
|
||||
Some(AttdefDialogMsg::EditValue),
|
||||
));
|
||||
}
|
||||
// No field picker in this application yet.
|
||||
value.push(pick("ƒ", t!("Insert field").into_owned(), None))
|
||||
value.push(pick(text("fx").size(12).into(), t!("Insert field").into_owned(), None))
|
||||
}
|
||||
.spacing(6)
|
||||
.into(),
|
||||
@@ -293,7 +302,7 @@ pub fn view<'a>(state: &'a AttdefDialogState, sizing: crate::ui::modal::ModalSiz
|
||||
t!("Text height").into_owned(),
|
||||
row![
|
||||
input(&state.height, size_on, AttdefDialogMsg::Height),
|
||||
pick("⌖", t!("Specify on-screen").into_owned(), size_on.then_some(AttdefDialogMsg::PickHeight)),
|
||||
pick(screen_pick(), t!("Specify on-screen").into_owned(), size_on.then_some(AttdefDialogMsg::PickHeight)),
|
||||
]
|
||||
.spacing(6)
|
||||
.into(),
|
||||
@@ -303,7 +312,7 @@ pub fn view<'a>(state: &'a AttdefDialogState, sizing: crate::ui::modal::ModalSiz
|
||||
t!("Rotation").into_owned(),
|
||||
row![
|
||||
input(&state.rotation, rot_on, AttdefDialogMsg::Rotation),
|
||||
pick("⌖", t!("Specify on-screen").into_owned(), rot_on.then_some(AttdefDialogMsg::PickRotation)),
|
||||
pick(screen_pick(), t!("Specify on-screen").into_owned(), rot_on.then_some(AttdefDialogMsg::PickRotation)),
|
||||
]
|
||||
.spacing(6)
|
||||
.into(),
|
||||
@@ -314,7 +323,7 @@ pub fn view<'a>(state: &'a AttdefDialogState, sizing: crate::ui::modal::ModalSiz
|
||||
row![
|
||||
input(&state.width, text_on && multiline, AttdefDialogMsg::Width),
|
||||
pick(
|
||||
"⌖",
|
||||
screen_pick(),
|
||||
t!("Specify on-screen").into_owned(),
|
||||
(text_on && multiline).then_some(AttdefDialogMsg::PickWidth)
|
||||
),
|
||||
@@ -372,7 +381,7 @@ pub fn view_edit<'a>(state: &'a AttdefEditState, sizing: crate::ui::modal::Modal
|
||||
true,
|
||||
AttdefDialogMsg::EditDefault
|
||||
),
|
||||
pick("ƒ", t!("Insert field").into_owned(), None),
|
||||
pick(text("fx").size(12).into(), t!("Insert field").into_owned(), None),
|
||||
]
|
||||
.spacing(6)
|
||||
.align_y(iced::Center),
|
||||
|
||||
Reference in new issue
Block a user