print: Do everything in request-page-setup
Otherwise we are too late to layout the page and the orientation will not be honored by the actual printing. We also have to use the per-page PageSetup because they are already specualized at this point. Closes #348
This commit is contained in:
parent
37ac3de2b8
commit
46a17367bd
2 changed files with 27 additions and 10 deletions
1
NEWS
1
NEWS
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
- Fix fractional scaling beeing blury by setting GDK_DEBUG=gl-no-fractional as default
|
- Fix fractional scaling beeing blury by setting GDK_DEBUG=gl-no-fractional as default
|
||||||
- Fix exposure times above 0.5 seconds not being displayed correctly in properties
|
- Fix exposure times above 0.5 seconds not being displayed correctly in properties
|
||||||
|
- Fix page orientation from print preview dialog is not honored for actual print
|
||||||
|
|
||||||
46.1
|
46.1
|
||||||
====
|
====
|
||||||
|
|
|
||||||
|
|
@ -358,8 +358,17 @@ mod imp {
|
||||||
op.set_n_pages(1);
|
op.set_n_pages(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
self.print_operation.connect_draw_page(glib::clone!(@weak obj =>
|
self.print_operation.connect_request_page_setup(
|
||||||
move |operation, context, _page_nr| {
|
glib::clone!(@weak obj =>move |operation, _context, nr, setup| {
|
||||||
|
if nr != 0 {
|
||||||
|
log::error!("Unexpected page number {nr}");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Since we already have explicit per page setups here, we have to use this to
|
||||||
|
// set values. The modules uses the default page setup everywhere.
|
||||||
|
obj.print_operation().set_default_page_setup(Some(setup));
|
||||||
|
|
||||||
let imp = obj.imp();
|
let imp = obj.imp();
|
||||||
|
|
||||||
let basename = obj
|
let basename = obj
|
||||||
|
|
@ -394,8 +403,7 @@ mod imp {
|
||||||
|
|
||||||
let size_unit = obj.size_unit();
|
let size_unit = obj.size_unit();
|
||||||
imp.width.set_value(
|
imp.width.set_value(
|
||||||
size_unit
|
size_unit.round(obj.original_size().0 as f64 * obj.width_unit_factor()),
|
||||||
.round(obj.original_size().0 as f64 * obj.width_unit_factor()),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
// Default to inch for USA and Liberia
|
// Default to inch for USA and Liberia
|
||||||
|
|
@ -424,13 +432,14 @@ mod imp {
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
match imp.status.get() {
|
match imp.status.get() {
|
||||||
Status::Prepare => {
|
Status::Prepare => {
|
||||||
glib::MainContext::default().iteration(true);
|
glib::MainContext::default().iteration(true);
|
||||||
}
|
}
|
||||||
Status::Print => {
|
Status::Print => {
|
||||||
log::debug!("Layout dialog confirmed");
|
log::debug!("Layout dialog confirmed");
|
||||||
obj.draw_page(context);
|
// Actual printing will happen in draw-page signal
|
||||||
break;}
|
break;
|
||||||
|
}
|
||||||
Status::Abort => {
|
Status::Abort => {
|
||||||
log::debug!("Layout dialog aborted");
|
log::debug!("Layout dialog aborted");
|
||||||
imp.print_operation.cancel();
|
imp.print_operation.cancel();
|
||||||
|
|
@ -438,8 +447,15 @@ mod imp {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}),
|
||||||
));
|
);
|
||||||
|
|
||||||
|
self.print_operation
|
||||||
|
.connect_draw_page(glib::clone!(@weak obj =>
|
||||||
|
move |_operation, context, _page_nr| {
|
||||||
|
obj.draw_page(context);
|
||||||
|
}
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
fn properties() -> &'static [glib::ParamSpec] {
|
fn properties() -> &'static [glib::ParamSpec] {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue