Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "printing/print_settings_initializer_gtk.h" | 5 #include "printing/print_settings_initializer_gtk.h" |
| 6 | 6 |
| 7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
| 8 #include <gtk/gtkprinter.h> | 8 #include <gtk/gtkprinter.h> |
| 9 | 9 |
| 10 #include "base/string_piece.h" | 10 #include "base/string_piece.h" |
| 11 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
| 12 #include "printing/native_metafile.h" | 12 #include "printing/pdf_ps_metafile_cairo.h" |
| 13 #include "printing/print_settings.h" | 13 #include "printing/print_settings.h" |
| 14 #include "printing/units.h" | 14 #include "printing/units.h" |
| 15 | 15 |
| 16 namespace printing { | 16 namespace printing { |
| 17 | 17 |
| 18 // static | 18 // static |
| 19 void PrintSettingsInitializerGtk::InitPrintSettings( | 19 void PrintSettingsInitializerGtk::InitPrintSettings( |
| 20 GtkPrintSettings* settings, | 20 GtkPrintSettings* settings, |
| 21 GtkPageSetup* page_setup, | 21 GtkPageSetup* page_setup, |
| 22 const PageRanges& new_ranges, | 22 const PageRanges& new_ranges, |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 55 // TODO(jhawkins) Remove this hack when the Linux printing refactoring | 55 // TODO(jhawkins) Remove this hack when the Linux printing refactoring |
| 56 // finishes. | 56 // finishes. |
| 57 dpi = kPixelsPerInch; | 57 dpi = kPixelsPerInch; |
| 58 double page_width_in_pixel = 8.5 * dpi; | 58 double page_width_in_pixel = 8.5 * dpi; |
| 59 double page_height_in_pixel = 11.0 * dpi; | 59 double page_height_in_pixel = 11.0 * dpi; |
| 60 physical_size_device_units.SetSize( | 60 physical_size_device_units.SetSize( |
| 61 static_cast<int>(page_width_in_pixel), | 61 static_cast<int>(page_width_in_pixel), |
| 62 static_cast<int>(page_height_in_pixel)); | 62 static_cast<int>(page_height_in_pixel)); |
| 63 printable_area_device_units.SetRect( | 63 printable_area_device_units.SetRect( |
| 64 static_cast<int>( | 64 static_cast<int>( |
| 65 NativeMetafile::kLeftMarginInInch * dpi), | 65 PdfPsMetafile::kLeftMarginInInch * dpi), |
| 66 static_cast<int>( | 66 static_cast<int>( |
| 67 NativeMetafile::kTopMarginInInch * dpi), | 67 PdfPsMetafile::kTopMarginInInch * dpi), |
| 68 page_width_in_pixel - | 68 page_width_in_pixel - |
| 69 (NativeMetafile::kLeftMarginInInch + | 69 (PdfPsMetafile::kLeftMarginInInch + |
|
vandebo (ex-Chrome)
2011/02/23 02:01:41
indention.
dpapad
2011/02/24 20:56:59
Done.
| |
| 70 NativeMetafile::kRightMarginInInch) * dpi, | 70 PdfPsMetafile::kRightMarginInInch) * dpi, |
| 71 page_height_in_pixel - | 71 page_height_in_pixel - |
| 72 (NativeMetafile::kTopMarginInInch + | 72 (PdfPsMetafile::kTopMarginInInch + |
|
vandebo (ex-Chrome)
2011/02/23 02:01:41
indention.
dpapad
2011/02/24 20:56:59
Done.
| |
| 73 NativeMetafile::kBottomMarginInInch) * dpi); | 73 PdfPsMetafile::kBottomMarginInInch) * dpi); |
| 74 } | 74 } |
| 75 | 75 |
| 76 print_settings->set_dpi(dpi); | 76 print_settings->set_dpi(dpi); |
| 77 print_settings->SetPrinterPrintableArea(physical_size_device_units, | 77 print_settings->SetPrinterPrintableArea(physical_size_device_units, |
| 78 printable_area_device_units, | 78 printable_area_device_units, |
| 79 dpi); | 79 dpi); |
| 80 } | 80 } |
| 81 | 81 |
| 82 } // namespace printing | 82 } // namespace printing |
| OLD | NEW |