mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-11-29 17:54:59 +01:00
prod merge: opt into the post-merge framework items (AppShell title_follows_lights for the macOS RTL title bar, Rename's name row select_on_focus, Format text paragraph spacing presets 0/6/12/18/24 and the 0-72 pt range on the field, the print dialog's printer search)
This commit is contained in:
1 parent
d30169ce01
commit
23e7dac068
4 files changed
+12
-2
No files matched your search
@@ -37,6 +37,9 @@ pub(crate) fn shell(app: &mut PdfCraftApp, ui: &mut egui::Ui) {
|
||||
.screen_mode(Bind::given(app.screen_mode))
|
||||
// A presentation shows the page and nothing else, so no reveal brings the bars back.
|
||||
.allow_reveal(false)
|
||||
// macOS with a right-to-left system language puts the traffic lights at the right: the title bar mirrors
|
||||
// with them, Home beside the lights and the tabs reading from the right (production 4448ee940).
|
||||
.title_follows_lights(true)
|
||||
.title_bar(|ui, _, app: &mut PdfCraftApp| title_bar(app, ui))
|
||||
.top(Slot::new("modes").visible(modes_visible), |ui, _, app: &mut PdfCraftApp| mode_bar::show(app, ui))
|
||||
.start(
|
||||
|
||||
@@ -77,7 +77,7 @@ impl RenameFacts {
|
||||
let unsaved = self.unsaved;
|
||||
let title = crate::i18n::fmt(tl!("Rename “{name}”"), &[("name", &self.current)]);
|
||||
let ok = if unsaved { tl!("Save and Rename") } else { tl!("Rename") };
|
||||
let params = vec![Param::new("name", tl!("File name"), ParamKind::text("")).hint(tl!("File name")).full_width()];
|
||||
let params = vec![Param::new("name", tl!("File name"), ParamKind::text("")).hint(tl!("File name")).full_width().select_on_focus()];
|
||||
let reason = line.clone().filter(|_| refused);
|
||||
let mut dialog =
|
||||
ParamDialog::new(KEY, title, params).values(Bind::bound(fields)).ok_label(ok.into()).ok_enabled(ready).below(move |ui, _| {
|
||||
|
||||
@@ -245,7 +245,9 @@ const CHAR_SPACINGS: [f64; 8] = [-1.0, -0.5, 0.0, 0.5, 1.0, 2.0, 3.0, 5.0];
|
||||
/// What can be typed: horizontal scale in percent, character spacing in points.
|
||||
const SCALE_RANGE: std::ops::RangeInclusive<f64> = 10.0..=400.0;
|
||||
const CHAR_SPACING_RANGE: std::ops::RangeInclusive<f64> = -5.0..=50.0;
|
||||
/// The space between paragraphs the engine takes, in points.
|
||||
/// The paragraph spacings the field's menu offers, in points.
|
||||
const PARAGRAPH_SPACINGS: [f64; 5] = [0.0, 6.0, 12.0, 18.0, 24.0];
|
||||
/// The space between paragraphs the engine takes, in points: the bound the field shows and `apply` enforces.
|
||||
const PARAGRAPH_SPACING_RANGE: std::ops::RangeInclusive<f64> = 0.0..=72.0;
|
||||
/// The sizes the engine takes, in points: the bound the size field shows and `apply` enforces.
|
||||
const SIZE_RANGE: RangeInclusive<f64> = 1.0..=500.0;
|
||||
@@ -462,6 +464,7 @@ fn show(
|
||||
let sizes: Vec<f32> = SIZES.iter().map(|v| *v as f32).collect();
|
||||
let scales: Vec<f32> = SCALES.iter().map(|v| *v as f32).collect();
|
||||
let char_spacings: Vec<f32> = CHAR_SPACINGS.iter().map(|v| *v as f32).collect();
|
||||
let paragraph_spacings: Vec<f32> = PARAGRAPH_SPACINGS.iter().map(|v| *v as f32).collect();
|
||||
let mut line_presets = vec![LineSpacing::Auto];
|
||||
line_presets.extend(LINE_SPACINGS.iter().map(|v| LineSpacing::Multiple(*v as f32)));
|
||||
let range = |r: &RangeInclusive<f64>| *r.start() as f32..=*r.end() as f32;
|
||||
@@ -473,6 +476,8 @@ fn show(
|
||||
.scale_range(range(&SCALE_RANGE))
|
||||
.char_spacing_presets(&char_spacings)
|
||||
.char_spacing_range(range(&CHAR_SPACING_RANGE))
|
||||
.paragraph_spacing_presets(¶graph_spacings)
|
||||
.paragraph_spacing_range(range(&PARAGRAPH_SPACING_RANGE))
|
||||
.unsupported(&unsupported);
|
||||
// With nothing to set it on the row still reads Auto, as production's does, not Mixed.
|
||||
text = text.line_spacing(v.line_spacing.unwrap_or(LineSpacing::Auto));
|
||||
|
||||
@@ -137,6 +137,8 @@ impl PdfCraftApp {
|
||||
let sections = body::build(&self.print_draft, &sizes, self.units, self.print_draft.area.is_some(), no_printers);
|
||||
let mut dialog = HostedPrint::new(state, fields, sections).layout(PrintLayout::Document).held_ok();
|
||||
dialog.set_driver(DriverControls::Properties);
|
||||
// A long fleet: the printer list searches, Save as PDF stays at its end (production 0c39992c9).
|
||||
dialog.set_printer_search(true);
|
||||
// PLAN: assumed `dialogs::host::open<D: StackDialog>(app: &mut PdfCraftApp, dialog: D)` (pdf-dialogs-w4).
|
||||
crate::dialogs::host::open(self, dialog);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user