summaryrefslogtreecommitdiffstats
path: root/printing/print_settings_initializer_gtk.cc
diff options
context:
space:
mode:
authorthestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-19 20:57:03 +0000
committerthestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-19 20:57:03 +0000
commit2ed86fdf0eb70c6799027792e726ccdf3908e2d7 (patch)
tree7aa8fda1e506a875bce1cde12ac3141ab21acb2b /printing/print_settings_initializer_gtk.cc
parent1730395f996faaa2097b7afa2b23c1def9f94e18 (diff)
downloadchromium_src-2ed86fdf0eb70c6799027792e726ccdf3908e2d7.zip
chromium_src-2ed86fdf0eb70c6799027792e726ccdf3908e2d7.tar.gz
chromium_src-2ed86fdf0eb70c6799027792e726ccdf3908e2d7.tar.bz2
Print Preview: Implement dialog-less printing on Linux.
BUG=76124 TEST=Printed boarding pass using this code + print preview. Review URL: http://codereview.chromium.org/6835008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@82153 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'printing/print_settings_initializer_gtk.cc')
-rw-r--r--printing/print_settings_initializer_gtk.cc13
1 files changed, 10 insertions, 3 deletions
diff --git a/printing/print_settings_initializer_gtk.cc b/printing/print_settings_initializer_gtk.cc
index a42561ba..9b8915c 100644
--- a/printing/print_settings_initializer_gtk.cc
+++ b/printing/print_settings_initializer_gtk.cc
@@ -33,9 +33,6 @@ void PrintSettingsInitializerGtk::InitPrintSettings(
print_settings->ranges = new_ranges;
print_settings->selection_only = print_selection_only;
- GtkPageOrientation orientation = gtk_print_settings_get_orientation(settings);
- print_settings->set_landscape(orientation == GTK_PAGE_ORIENTATION_LANDSCAPE);
-
gfx::Size physical_size_device_units;
gfx::Rect printable_area_device_units;
int dpi = gtk_print_settings_get_resolution(settings);
@@ -68,6 +65,16 @@ void PrintSettingsInitializerGtk::InitPrintSettings(
print_settings->SetPrinterPrintableArea(physical_size_device_units,
printable_area_device_units,
dpi);
+
+ // Note: With the normal GTK print dialog, when the user selects the landscape
+ // orientation, all that does is change the paper size. Which seems to be
+ // enough to render the right output and send it to the printer.
+ // The orientation value stays as portrait and does not actually affect
+ // printing.
+ // Thus this is only useful in print preview mode, where we manually set the
+ // orientation and change the paper size ourselves.
+ GtkPageOrientation orientation = gtk_print_settings_get_orientation(settings);
+ print_settings->SetOrientation(orientation == GTK_PAGE_ORIENTATION_LANDSCAPE);
}
const double PrintSettingsInitializerGtk::kTopMarginInInch = 0.25;