mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-11-29 17:54:59 +01:00
Merge branch 'merge/app-misc' into merge/main
# Conflicts: # crates/ui-egui/src/hotbar.rs
This commit is contained in:
commit
d30169ce01
3 files changed
+33
-21
No files matched your search
@@ -525,25 +525,36 @@ fn boxes_row() -> Param {
|
||||
let companions: Vec<String> = (0..6).map(|k| format!("hf.text.{k}")).chain(["hf.focused".to_string()]).collect();
|
||||
Param::custom("hf.boxes", tl!("Header and footer text"), |ui, fields, _cx| {
|
||||
let mut out: Option<egui::Response> = None;
|
||||
for (k, name) in BOX_NAMES.iter().enumerate() {
|
||||
let key = format!("hf.text.{k}");
|
||||
let before = fields.text(&key).unwrap_or_default().to_owned();
|
||||
let mut text = before.clone();
|
||||
let r = ui
|
||||
.push_id(("hf-box", k), |ui| TextField::new(tl!(name), craft::ui::contract::Bind::bound(&mut text)).lines(2).show(ui).response)
|
||||
.inner;
|
||||
// The field's focus stop is the component: egui's focus sits on its text part.
|
||||
if craft::ui::runtime::focus::is_focused(ui.ctx(), r.id) {
|
||||
fields.set("hf.focused", FieldValue::Int(k as i64));
|
||||
// Two rows of three, the header's boxes over the footer's, as production lays them out: one row of six runs
|
||||
// past the dialog's edge.
|
||||
ui.vertical(|ui| {
|
||||
for (row, names) in BOX_NAMES.chunks(3).enumerate() {
|
||||
ui.horizontal(|ui| {
|
||||
for (col, name) in names.iter().enumerate() {
|
||||
let k = row * 3 + col;
|
||||
let key = format!("hf.text.{k}");
|
||||
let before = fields.text(&key).unwrap_or_default().to_owned();
|
||||
let mut text = before.clone();
|
||||
let r = ui
|
||||
.push_id(("hf-box", k), |ui| {
|
||||
TextField::new(tl!(name), craft::ui::contract::Bind::bound(&mut text)).lines(2).show(ui).response
|
||||
})
|
||||
.inner;
|
||||
// The field's focus stop is the component: egui's focus sits on its text part.
|
||||
if craft::ui::runtime::focus::is_focused(ui.ctx(), r.id) {
|
||||
fields.set("hf.focused", FieldValue::Int(k as i64));
|
||||
}
|
||||
if text != before {
|
||||
fields.set(key, FieldValue::Text(text));
|
||||
}
|
||||
out = Some(match out.take() {
|
||||
Some(o) => o.union(r),
|
||||
None => r,
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
if text != before {
|
||||
fields.set(key, FieldValue::Text(text));
|
||||
}
|
||||
out = Some(match out {
|
||||
Some(o) => o.union(r),
|
||||
None => r,
|
||||
});
|
||||
}
|
||||
});
|
||||
out.unwrap_or_else(|| ui.response())
|
||||
})
|
||||
.companions(companions)
|
||||
|
||||
@@ -271,9 +271,10 @@ pub(crate) fn gated(app: &PdfCraftApp) -> bool {
|
||||
}
|
||||
|
||||
/// Whether a text field has the keyboard: the one signal behind the Edit rows' state and the native
|
||||
/// menu's gate.
|
||||
/// menu's gate. A text field only, as production's `text_edit_focused`: egui's keyboard focus alone is
|
||||
/// also on an open menu's rows or a button, which would hand Edit ▸ Copy and Paste to them.
|
||||
pub(crate) fn text_editing(ctx: &egui::Context) -> bool {
|
||||
ctx.egui_wants_keyboard_input()
|
||||
craft::ui::runtime::windows::WindowHost::of(ctx).typing()
|
||||
}
|
||||
|
||||
impl PdfCraftApp {
|
||||
|
||||
@@ -10438,7 +10438,7 @@ fn format_panel_shows_selection_size_and_updates_after_font_applied() {
|
||||
// Apply Times to the whole block
|
||||
font_node.click();
|
||||
h.run_steps(2);
|
||||
h.get_by_label("Times").click();
|
||||
h.query_all_by_label("Times").next().expect("the Times row").click();
|
||||
h.run_steps(4);
|
||||
|
||||
// Now all text is Times, so font combo box updates to Times
|
||||
|
||||
Reference in new issue
Block a user