mirror of
https://github.com/storytold/wordcraft.git
synced 2026-11-19 08:55:26 +00:00
Get the Missing Fonts: the box with nothing to download is one row tall
Its Close button's far-side layout took the rest of the window's height. The button row is now a row of its own, shared by both forms of the box. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GBVQLv63guWCuWUM3SctPP
This commit is contained in:
3 files changed
+18
-10
No files matched your search
@@ -35,7 +35,7 @@ use bookmarks::bookmark_at_caret;
|
||||
use bookmarks::bookmark_names;
|
||||
pub use chrome::show;
|
||||
pub(crate) use chrome::{
|
||||
block_behind, buttons, cancel_key_pressed, close_button, color_menu, drag_by_title_bar, forget_nudge, ok_cancel_responses, release_keyboard,
|
||||
block_behind, buttons, cancel_key_pressed, color_menu, drag_by_title_bar, forget_nudge, ok_cancel_responses, release_keyboard,
|
||||
};
|
||||
pub(crate) use dispatch::search_results;
|
||||
pub(crate) use find::swallow_shortcut_text;
|
||||
|
||||
@@ -303,7 +303,7 @@ pub(crate) fn buttons(ui: &mut Ui, ok: &str) -> (bool, bool) {
|
||||
}
|
||||
|
||||
/// A dialog's single Close button (Escape too).
|
||||
pub(crate) fn close_button(ui: &mut Ui) -> bool {
|
||||
pub(super) fn close_button(ui: &mut Ui) -> bool {
|
||||
ui.add_space(8.0);
|
||||
let mut close = ui.input(|i| i.key_pressed(egui::Key::Escape));
|
||||
ui.with_layout(crate::rtl::far_side(ui, egui::Align::Center), |ui| {
|
||||
|
||||
@@ -110,12 +110,26 @@ fn system_install_steps() -> &'static str {
|
||||
}
|
||||
}
|
||||
|
||||
/// The box's last row: `start` at the near side, Close (Escape too) at the far side. In a row
|
||||
/// of its own, so the far-side layout takes one row's height and not the rest of the window's.
|
||||
fn close_row(ui: &mut egui::Ui, start: impl FnOnce(&mut egui::Ui)) -> bool {
|
||||
let mut close = ui.input(|i| i.key_pressed(egui::Key::Escape));
|
||||
ui.horizontal(|ui| {
|
||||
start(ui);
|
||||
ui.with_layout(crate::rtl::far_side(ui, egui::Align::Center), |ui| {
|
||||
close |= ui.add(crate::widgets::primary_button(ui, tl!("Close"))).clicked();
|
||||
});
|
||||
});
|
||||
close
|
||||
}
|
||||
|
||||
/// The box's content. Returns true to close.
|
||||
pub(crate) fn body(app: &mut WordApp, ui: &mut egui::Ui, fonts: &[Row], dont_show: &mut bool) -> bool {
|
||||
ui.set_width(520.0);
|
||||
if fonts.is_empty() {
|
||||
ui.label(tl!("None of the fonts this document is missing can be downloaded free of charge from their publisher."));
|
||||
return crate::dialogs::close_button(ui);
|
||||
ui.add_space(8.0);
|
||||
return close_row(ui, |_| {});
|
||||
}
|
||||
ui.label(tl!(
|
||||
"This document uses fonts that aren't installed, so it is shown in other fonts and may not look as it was written. These fonts can be downloaded free of charge:"
|
||||
@@ -152,14 +166,8 @@ pub(crate) fn body(app: &mut WordApp, ui: &mut egui::Ui, fonts: &[Row], dont_sho
|
||||
app.ui.font_download_notice = !*dont_show;
|
||||
}
|
||||
ui.add_space(8.0);
|
||||
let mut close = ui.input(|i| i.key_pressed(egui::Key::Escape));
|
||||
let mut add = false;
|
||||
ui.horizontal(|ui| {
|
||||
add = ui.button(tl!("Add Font…")).clicked();
|
||||
ui.with_layout(crate::rtl::far_side(ui, egui::Align::Center), |ui| {
|
||||
close |= ui.add(crate::widgets::primary_button(ui, tl!("Close"))).clicked();
|
||||
});
|
||||
});
|
||||
let close = close_row(ui, |ui| add = ui.button(tl!("Add Font…")).clicked());
|
||||
if add {
|
||||
// The file picker replaces the box; the added font lays the document out again.
|
||||
let _ = app.run("font.add", serde_json::json!({}));
|
||||
|
||||
Reference in new issue
Block a user