changeset 119:d9893755f670

Ported dwt.printing.PrintDialog
author Jacob Carlborg <doob@me.com>
date Wed, 31 Dec 2008 16:07:41 +0100
parents 10760eb00d08
children 7046ca5a6d77
files dwt/internal/cocoa/OS.d dwt/printing/PrintDialog.d dwt/printing/Printer.d
diffstat 3 files changed, 15 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/dwt/internal/cocoa/OS.d	Wed Dec 31 15:51:54 2008 +0100
+++ b/dwt/internal/cocoa/OS.d	Wed Dec 31 16:07:41 2008 +0100
@@ -60,6 +60,7 @@
 import dwt.internal.cocoa.NSNumberFormatter;
 import dwt.internal.cocoa.NSParagraphStyle;
 import dwt.internal.cocoa.NSPoint;
+import dwt.internal.cocoa.NSPrintPanel;
 import dwt.internal.cocoa.NSRange;
 import dwt.internal.cocoa.NSRect;
 import dwt.internal.cocoa.NSScrollView;
@@ -3284,7 +3285,7 @@
 public static const int NSPrintPanelShowsCopies = 1;
 public static const int NSPrintPanelShowsOrientation = 8;
 public static const int NSPrintPanelShowsPageRange = 2;
-public static const int NSPrintPanelShowsPageSetupAccessory = 256;
+alias NSPrintPanelOptions.NSPrintPanelShowsPageSetupAccessory NSPrintPanelShowsPageSetupAccessory;
 public static const int NSPrintPanelShowsPaperSize = 4;
 public static const int NSPrintPanelShowsPreview = 131072;
 public static const int NSPrintPanelShowsScaling = 16;
--- a/dwt/printing/PrintDialog.d	Wed Dec 31 15:51:54 2008 +0100
+++ b/dwt/printing/PrintDialog.d	Wed Dec 31 16:07:41 2008 +0100
@@ -164,16 +164,16 @@
             NSString filename = new NSString(dict.objectForKey(OS.NSPrintSavePath));
             data.fileName = filename.getString();
         }
-        data.scope_ = new NSNumber(dict.objectForKey(OS.NSPrintAllPages)).intValue() !is 0 ? PrinterData.ALL_PAGES : PrinterData.PAGE_RANGE;
+        data.scope_ = (new NSNumber(dict.objectForKey(OS.NSPrintAllPages))).intValue() !is 0 ? PrinterData.ALL_PAGES : PrinterData.PAGE_RANGE;
         if (data.scope_ is PrinterData.PAGE_RANGE) {
-            data.startPage = new NSNumber(dict.objectForKey(OS.NSPrintFirstPage)).intValue();
-            data.endPage = new NSNumber(dict.objectForKey(OS.NSPrintLastPage)).intValue();
+            data.startPage = (new NSNumber(dict.objectForKey(OS.NSPrintFirstPage))).intValue();
+            data.endPage = (new NSNumber(dict.objectForKey(OS.NSPrintLastPage))).intValue();
         }
-        data.collate = new NSNumber(dict.objectForKey(OS.NSPrintMustCollate)).intValue() !is 0;
-        data.copyCount = new NSNumber(dict.objectForKey(OS.NSPrintCopies)).intValue();
+        data.collate = (new NSNumber(dict.objectForKey(OS.NSPrintMustCollate))).intValue() !is 0;
+        data.copyCount = (new NSNumber(dict.objectForKey(OS.NSPrintCopies))).intValue();
         NSData nsData = NSKeyedArchiver.archivedDataWithRootObject(printInfo);
         data.otherData = new byte[nsData.length()];
-        OS.memmove(data.otherData, nsData.bytes(), data.otherData.length);
+        OS.memmove(&data.otherData, nsData.bytes(), data.otherData.length);
 
         printToFile = data.printToFile;
         scope_ = data.scope_;
@@ -200,7 +200,7 @@
  * @return the scope setting that the user selected
  */
 public int getScope() {
-    return scope;
+    return scope_;
 }
 
 /**
@@ -218,8 +218,8 @@
  *
  * @param scope the scope setting when the dialog is opened
  */
-public void setScope(int scope) {
-    this.scope = scope;
+public void setScope(int scope_) {
+    this.scope_ = scope_;
 }
 
 /**
@@ -299,8 +299,8 @@
 }
 
 protected void checkSubclass() {
-    String name = getClass().getName();
-    String validName = PrintDialog.class.getName();
+    String name = this.classinfo.name;
+    String validName = PrintDialog.classinfo.name;
     if (!validName.equals(name)) {
         DWT.error(DWT.ERROR_INVALID_SUBCLASS);
     }
--- a/dwt/printing/Printer.d	Wed Dec 31 15:51:54 2008 +0100
+++ b/dwt/printing/Printer.d	Wed Dec 31 16:07:41 2008 +0100
@@ -59,7 +59,7 @@
  * @see <a href="http://www.eclipse.org/swt/snippets/#printing">Printing snippets</a>
  * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>
  */
-public final class Printer extends Device {
+public final class Printer : Device {
     PrinterData data;
     NSPrinter printer;
     NSPrintInfo printInfo;
@@ -68,7 +68,7 @@
     NSWindow window;
     bool isGCCreated;
 
-    static final String DRIVER = "Mac";
+    static const String DRIVER = "Mac";
 
 /**
  * Returns an array of <code>PrinterData</code> objects