OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/printing_context_cairo.h" | 5 #include "printing/printing_context_cairo.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "printing/units.h" | 8 #include "printing/units.h" |
9 | 9 |
10 #if defined(OS_CHROMEOS) | 10 #if defined(OS_CHROMEOS) |
11 #include <unicode/ulocdata.h> | 11 #include <unicode/ulocdata.h> |
12 #include <printing/native_metafile.h> | 12 #include <printing/native_metafile.h> |
13 #include "printing/pdf_ps_metafile_cairo.h" | |
13 #else | 14 #else |
14 #include <gtk/gtk.h> | 15 #include <gtk/gtk.h> |
15 #include <gtk/gtkprintunixdialog.h> | 16 #include <gtk/gtkprintunixdialog.h> |
16 | |
vandebo (ex-Chrome)
2011/02/24 22:42:50
This space is actually useful, it separates system
| |
17 #include "printing/print_settings_initializer_gtk.h" | 17 #include "printing/print_settings_initializer_gtk.h" |
18 #endif // defined(OS_CHROMEOS) | 18 #endif // defined(OS_CHROMEOS) |
19 | 19 |
20 #if !defined(OS_CHROMEOS) | 20 #if !defined(OS_CHROMEOS) |
21 namespace { | 21 namespace { |
22 // Function pointer for creating print dialogs. | 22 // Function pointer for creating print dialogs. |
23 static void* (*create_dialog_func_)( | 23 static void* (*create_dialog_func_)( |
24 printing::PrintingContext::PrintSettingsCallback* callback, | 24 printing::PrintingContext::PrintSettingsCallback* callback, |
25 printing::PrintingContextCairo* context) = NULL; | 25 printing::PrintingContextCairo* context) = NULL; |
26 // Function pointer for printing documents. | 26 // Function pointer for printing documents. |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
112 height = static_cast<int>(11 * dpi); | 112 height = static_cast<int>(11 * dpi); |
113 } else { | 113 } else { |
114 // ulocdata_getPaperSize returns the width and height in mm. | 114 // ulocdata_getPaperSize returns the width and height in mm. |
115 // Convert this to pixels based on the dpi. | 115 // Convert this to pixels based on the dpi. |
116 width = static_cast<int>(ConvertUnitDouble(width, 25.4, 1.0) * dpi); | 116 width = static_cast<int>(ConvertUnitDouble(width, 25.4, 1.0) * dpi); |
117 height = static_cast<int>(ConvertUnitDouble(height, 25.4, 1.0) * dpi); | 117 height = static_cast<int>(ConvertUnitDouble(height, 25.4, 1.0) * dpi); |
118 } | 118 } |
119 | 119 |
120 physical_size_device_units.SetSize(width, height); | 120 physical_size_device_units.SetSize(width, height); |
121 printable_area_device_units.SetRect( | 121 printable_area_device_units.SetRect( |
122 static_cast<int>(NativeMetafile::kLeftMarginInInch * dpi), | 122 static_cast<int>(PdfPsMetafile::kLeftMarginInInch * dpi), |
123 static_cast<int>(NativeMetafile::kTopMarginInInch * dpi), | 123 static_cast<int>(PdfPsMetafile::kTopMarginInInch * dpi), |
124 width - (NativeMetafile::kLeftMarginInInch + | 124 width - (PdfPsMetafile::kLeftMarginInInch + |
125 NativeMetafile::kRightMarginInInch) * dpi, | 125 PdfPsMetafile::kRightMarginInInch) * dpi, |
126 height - (NativeMetafile::kTopMarginInInch + | 126 height - (PdfPsMetafile::kTopMarginInInch + |
127 NativeMetafile::kBottomMarginInInch) * dpi); | 127 PdfPsMetafile::kBottomMarginInInch) * dpi); |
128 | 128 |
129 settings_.set_dpi(dpi); | 129 settings_.set_dpi(dpi); |
130 settings_.SetPrinterPrintableArea(physical_size_device_units, | 130 settings_.SetPrinterPrintableArea(physical_size_device_units, |
131 printable_area_device_units, | 131 printable_area_device_units, |
132 dpi); | 132 dpi); |
133 #else // defined(OS_CHROMEOS) | 133 #else // defined(OS_CHROMEOS) |
134 GtkWidget* dialog = gtk_print_unix_dialog_new(NULL, NULL); | 134 GtkWidget* dialog = gtk_print_unix_dialog_new(NULL, NULL); |
135 GtkPrintSettings* settings = | 135 GtkPrintSettings* settings = |
136 gtk_print_unix_dialog_get_settings(GTK_PRINT_UNIX_DIALOG(dialog)); | 136 gtk_print_unix_dialog_get_settings(GTK_PRINT_UNIX_DIALOG(dialog)); |
137 GtkPageSetup* page_setup = | 137 GtkPageSetup* page_setup = |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
207 void PrintingContextCairo::ReleaseContext() { | 207 void PrintingContextCairo::ReleaseContext() { |
208 // Intentional No-op. | 208 // Intentional No-op. |
209 } | 209 } |
210 | 210 |
211 gfx::NativeDrawingContext PrintingContextCairo::context() const { | 211 gfx::NativeDrawingContext PrintingContextCairo::context() const { |
212 // Intentional No-op. | 212 // Intentional No-op. |
213 return NULL; | 213 return NULL; |
214 } | 214 } |
215 | 215 |
216 } // namespace printing | 216 } // namespace printing |
OLD | NEW |