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 "chrome/browser/printing/print_dialog_gtk.h" | 5 #include "chrome/browser/printing/print_dialog_gtk.h" |
6 | 6 |
7 #include <fcntl.h> | 7 #include <fcntl.h> |
8 #include <gtk/gtkpagesetupunixdialog.h> | 8 #include <gtk/gtkpagesetupunixdialog.h> |
9 #include <gtk/gtkprintjob.h> | 9 #include <gtk/gtkprintjob.h> |
10 #include <sys/stat.h> | 10 #include <sys/stat.h> |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 break; | 193 break; |
194 case printing::CMYK: | 194 case printing::CMYK: |
195 color_mode = kCMYK; | 195 color_mode = kCMYK; |
196 break; | 196 break; |
197 default: | 197 default: |
198 color_mode = kGrayscale; | 198 color_mode = kGrayscale; |
199 break; | 199 break; |
200 } | 200 } |
201 gtk_print_settings_set(gtk_settings_, kCUPSColorModel, color_mode); | 201 gtk_print_settings_set(gtk_settings_, kCUPSColorModel, color_mode); |
202 | 202 |
203 if (duplex_mode != printing::UNKNOWN_DUPLEX_MODE) { | 203 const char* cups_duplex_mode; |
204 const char* cups_duplex_mode; | 204 switch (duplex_mode) { |
205 switch (duplex_mode) { | 205 case printing::LONG_EDGE: |
206 case printing::LONG_EDGE: | 206 cups_duplex_mode = kDuplexNoTumble; |
207 cups_duplex_mode = kDuplexNoTumble; | 207 break; |
208 break; | 208 case printing::SHORT_EDGE: |
209 case printing::SHORT_EDGE: | 209 cups_duplex_mode = kDuplexTumble; |
210 cups_duplex_mode = kDuplexTumble; | 210 break; |
211 break; | 211 default: |
212 case printing::SIMPLEX: | 212 cups_duplex_mode = kDuplexNone; |
213 cups_duplex_mode = kDuplexNone; | 213 break; |
214 break; | |
215 default: // UNKNOWN_DUPLEX_MODE | |
216 NOTREACHED(); | |
217 break; | |
218 } | |
219 gtk_print_settings_set(gtk_settings_, kCUPSDuplex, cups_duplex_mode); | |
220 } | 214 } |
| 215 gtk_print_settings_set(gtk_settings_, kCUPSDuplex, cups_duplex_mode); |
221 } | 216 } |
222 | 217 |
223 gtk_print_settings_set_orientation( | 218 gtk_print_settings_set_orientation( |
224 gtk_settings_, | 219 gtk_settings_, |
225 landscape ? GTK_PAGE_ORIENTATION_LANDSCAPE : | 220 landscape ? GTK_PAGE_ORIENTATION_LANDSCAPE : |
226 GTK_PAGE_ORIENTATION_PORTRAIT); | 221 GTK_PAGE_ORIENTATION_PORTRAIT); |
227 | 222 |
228 InitPrintSettings(ranges); | 223 InitPrintSettings(ranges); |
229 return true; | 224 return true; |
230 } | 225 } |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 // Printing finished. Matches AddRef() in PrintDocument(); | 394 // Printing finished. Matches AddRef() in PrintDocument(); |
400 Release(); | 395 Release(); |
401 } | 396 } |
402 | 397 |
403 void PrintDialogGtk::InitPrintSettings(const PageRanges& page_ranges) { | 398 void PrintDialogGtk::InitPrintSettings(const PageRanges& page_ranges) { |
404 PrintSettings settings; | 399 PrintSettings settings; |
405 printing::PrintSettingsInitializerGtk::InitPrintSettings( | 400 printing::PrintSettingsInitializerGtk::InitPrintSettings( |
406 gtk_settings_, page_setup_, page_ranges, false, &settings); | 401 gtk_settings_, page_setup_, page_ranges, false, &settings); |
407 context_->InitWithSettings(settings); | 402 context_->InitWithSettings(settings); |
408 } | 403 } |
OLD | NEW |