comparison dwt/printing/Printer.d @ 361:4bffbf81e2d6

redirect direct prints to DwtLogger
author Frank Benoit <benoit@tionex.de>
date Fri, 20 Mar 2009 21:00:06 +0100
parents c0d810de7093
children
comparison
equal deleted inserted replaced
360:ee1dd551f5b1 361:4bffbf81e2d6
26 import dwt.internal.cairo.Cairo; 26 import dwt.internal.cairo.Cairo;
27 import dwt.internal.gtk.OS; 27 import dwt.internal.gtk.OS;
28 import dwt.printing.PrinterData; 28 import dwt.printing.PrinterData;
29 import dwt.dwthelper.utils; 29 import dwt.dwthelper.utils;
30 30
31 import tango.io.Stdout;
32 import tango.util.Convert; 31 import tango.util.Convert;
33 32
34 33
35 /** 34 /**
36 * Instances of this class are used to print to a printer. 35 * Instances of this class are used to print to a printer.
203 while (end < settingsData.length && settingsData[end] !is 0) end++; 202 while (end < settingsData.length && settingsData[end] !is 0) end++;
204 end++; 203 end++;
205 char [] valueBuffer = new char [end - start]; 204 char [] valueBuffer = new char [end - start];
206 System.arraycopy (settingsData, start, valueBuffer, 0, valueBuffer.length); 205 System.arraycopy (settingsData, start, valueBuffer, 0, valueBuffer.length);
207 OS.gtk_print_settings_set(settings, keyBuffer.ptr, valueBuffer.ptr); 206 OS.gtk_print_settings_set(settings, keyBuffer.ptr, valueBuffer.ptr);
208 if (DEBUG) Stdout.formatln("{}: {}", keyBuffer, valueBuffer ); 207 if (DEBUG) getDwtLogger().info("{}: {}", keyBuffer, valueBuffer );
209 } 208 }
210 end++; // skip extra null terminator 209 end++; // skip extra null terminator
211 210
212 /* Retrieve stored page_setup data. 211 /* Retrieve stored page_setup data.
213 * Note that page_setup properties must be stored (in PrintDialog) and restored (here) in the same order. 212 * Note that page_setup properties must be stored (in PrintDialog) and restored (here) in the same order.
336 end++; 335 end++;
337 if (nullTerminate) length_++; 336 if (nullTerminate) length_++;
338 char [] valueBuffer = new char [length_]; 337 char [] valueBuffer = new char [length_];
339 System.arraycopy (settingsData, start, valueBuffer, 0, length_); 338 System.arraycopy (settingsData, start, valueBuffer, 0, length_);
340 339
341 if (DEBUG) tango.io.Stdout.Stdout.formatln( "{}: {}", keyBuffer, valueBuffer ); 340 if (DEBUG) getDwtLogger().info( "{}: {}", keyBuffer, valueBuffer );
342 341
343 return valueBuffer; 342 return valueBuffer;
344 } 343 }
345 344
346 /** 345 /**
602 * </ul> 601 * </ul>
603 */ 602 */
604 public override Point getDPI() { 603 public override Point getDPI() {
605 checkDevice(); 604 checkDevice();
606 int resolution = OS.gtk_print_settings_get_resolution(settings); 605 int resolution = OS.gtk_print_settings_get_resolution(settings);
607 if (DEBUG) tango.io.Stdout.Stdout.formatln("print_settings.resolution={}", resolution); 606 if (DEBUG) getDwtLogger().info("print_settings.resolution={}", resolution);
608 //TODO: Return 72 (1/72 inch = 1 point) until gtk bug 346245 is fixed 607 //TODO: Return 72 (1/72 inch = 1 point) until gtk bug 346245 is fixed
609 //TODO: Fix this: gtk_print_settings_get_resolution returns 0? (see gtk bug 346252) 608 //TODO: Fix this: gtk_print_settings_get_resolution returns 0? (see gtk bug 346252)
610 if (true || resolution is 0) return new Point(72, 72); 609 if (true || resolution is 0) return new Point(72, 72);
611 return new Point(resolution, resolution); 610 return new Point(resolution, resolution);
612 } 611 }