Skip to content

EffectCraft: An open-source motion graphics and compositing tool written by scratch in pure Rust

Merge main into #1226; route main's translated Lock Aspect Ratio label and Casts Shadows automation id through labelled_checkbox, keep main's Rescan Fonts row beside the DragCheckbox filter, register both new it modules

bflatastic582d2c4cf38f
diff --cc crates/ui-egui/src/panels/comp_settings.rs
index 6cc99574b,01fbc5995..7e49d8a7d
--- a/crates/ui-egui/src/panels/comp_settings.rs
+++ b/crates/ui-egui/src/panels/comp_settings.rs
@@@ -327,8 -309,8 +309,8 @@@ fn tab_body
let (ow, oh) = (d.width, d.height);
let r = ui.add(crate::widgets::drag_value(egui::DragValue::new(&mut d.width).range(4..=30000).suffix(" px")));
auto.add("dialog.comp.width", r.rect, "Width");
- let lbl = format!("Lock Aspect Ratio to {}", aspect_label(ow as f64, oh as f64));
+ let lbl = tr_args("Lock Aspect Ratio to {}", &[&(aspect_label(ow as f64, oh as f64))]);
- let r = ui.checkbox(&mut d.lock_aspect, lbl);
+ let r = crate::widgets::labelled_checkbox(ui, &mut d.lock_aspect, lbl);
auto.add("dialog.comp.lockAspect", r.rect, "Lock Aspect Ratio");
if d.lock_aspect && ow != d.width && ow > 0 {
d.height = ((d.width as f64) * oh as f64 / ow as f64).round().max(4.0) as u32;
diff --cc crates/ui-egui/src/panels/dialogs_3d.rs
index 5adde956a,9b3535288..16137b599
--- a/crates/ui-egui/src/panels/dialogs_3d.rs
+++ b/crates/ui-egui/src/panels/dialogs_3d.rs
@@@ -306,8 -351,11 +351,11 @@@ pub fn light(app: &mut EffectcraftApp,
ui.add(crate::widgets::drag_value(egui::DragValue::new(&mut d.falloff_distance).range(0.0..=100000.0).suffix(" px")));
ui.end_row();
}
+ }
+ if casts_shadows(d.kind) {
ui.label(tr("Shadows"));
- crate::widgets::labelled_checkbox(ui, &mut d.casts_shadows, tr("Casts Shadows"));
- let cb = ui.checkbox(&mut d.casts_shadows, tr("Casts Shadows"));
++ let cb = crate::widgets::labelled_checkbox(ui, &mut d.casts_shadows, tr("Casts Shadows"));
+ app.auto.add_response("dialog.light.casts", &cb, "Casts Shadows");
ui.end_row();
ui.label(tr("Shadow Darkness"));
ui.add_enabled(d.casts_shadows, crate::widgets::drag_value(egui::DragValue::new(&mut d.shadow_darkness).range(0.0..=100.0).suffix(" %")));
diff --cc crates/ui-egui/src/panels/text_panels.rs
index fed0a6206,4a2a8b6cd..caded11fd
--- a/crates/ui-egui/src/panels/text_panels.rs
+++ b/crates/ui-egui/src/panels/text_panels.rs
@@@ -694,15 -777,26 +777,24 @@@ pub(super) fn font_picker(app: &mut Eff
ui.set_width(rect.width().max(180.0));
// Filter row: a checkbox that keeps only the variable fonts.
let filter_h = 22.0;
- let row = ui.add_sized([ui.available_width(), filter_h], egui::Button::selectable(false, ""));
- let box_rect = Rect::from_min_size(row.rect.min, vec2(18.0, filter_h));
- let label_rect = Rect::from_min_max(pos2(box_rect.max.x + 2.0, row.rect.min.y), row.rect.max);
- let boxed = widgets::checkbox(ui, box_rect, only_variable, &t, id.with("variable-check"));
- ui.painter().text(label_rect.left_center(), Align2::LEFT_CENTER, tr("Variable fonts only"), Tokens::ui(11.5), t.text);
+ let row = ui.add_sized([ui.available_width(), filter_h], widgets::DragCheckbox::new(&mut only_variable, tr("Variable fonts only")));
app_ref.auto.add(&format!("{auto}.variable"), row.rect, "Variable fonts only");
+ // #1089: fonts installed after launch appear without restarting. The button is its own
+ // row: the popup is only 180 px wide, so a control pinned to the filter row covers
+ // "Variable fonts only". The scan itself runs off the UI thread (`poll_font_rescan`).
+ let rescan_h = 22.0;
+ let (resc, _) = ui.allocate_exact_size(vec2(ui.available_width(), rescan_h), egui::Sense::hover());
+ if widgets::text_button(ui, resc, tr("Rescan Fonts"), false, &t, id.with("rescan")).clicked() && effectcraft_engine::text::fonts::start_rescan() {
+ app_ref.ui.status = format!("{}…", tr("Rescan Fonts"));
+ }
+ app_ref.auto.add(&format!("{auto}.rescan"), resc, "Rescan Fonts");
- let toggled = row.clicked() || boxed.clicked();
+ let toggled = row.changed();
if toggled {
- only_variable = !only_variable;
ui.data_mut(|d| d.insert_temp(variable_id, only_variable));
- // Typing goes on into the search field.
+ }
+ // The native checkbox can take focus on release after changing on press.
+ // Typing goes on into the search field after either event.
+ if toggled || row.clicked() {
ui.memory_mut(|m| m.request_focus(search_id));
}
let query = state.query.trim().to_lowercase();
diff --cc crates/ui-egui/tests/it/main.rs
index 00d852ee2,29456b2a1..0539b56ac
--- a/crates/ui-egui/tests/it/main.rs
+++ b/crates/ui-egui/tests/it/main.rs
@@@ -12,7 -14,7 +14,8 @@@ mod ui_batch_switches
mod ui_blank_context_menus;
mod ui_camera_tracker;
mod ui_character_eyedropper;
+ mod ui_character_stroke_order;
+mod ui_checkbox_drag;
mod ui_color_hex;
mod ui_comp_presets;
mod ui_control_modifiers;