Mercurial > projects > dwt-mac
diff dwt/printing/PrintDialog.d @ 118:10760eb00d08
Ported dwt.printing.PrinterData
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Wed, 31 Dec 2008 15:51:54 +0100 |
parents | d8635bb48c7c |
children | d9893755f670 |
line wrap: on
line diff
--- a/dwt/printing/PrintDialog.d Wed Dec 31 15:48:20 2008 +0100 +++ b/dwt/printing/PrintDialog.d Wed Dec 31 15:51:54 2008 +0100 @@ -7,6 +7,9 @@ * * Contributors: * IBM Corporation - initial API and implementation + * + * Port to the D programming language: + * Jacob Carlborg <doob@me.com> *******************************************************************************/ module dwt.printing.PrintDialog; @@ -27,6 +30,8 @@ import dwt.widgets.Shell; import dwt.widgets.Widget; +import dwt.printing.PrinterData; + /** * Instances of this class allow the user to select * a printer and various print-related parameters @@ -40,9 +45,9 @@ * @see <a href="http://www.eclipse.org/swt/examples.php">DWT Example: ControlExample, Dialog tab</a> * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> */ -public class PrintDialog extends Dialog { +public class PrintDialog : Dialog { PrinterData printerData; - int scope = PrinterData.ALL_PAGES; + int scope_ = PrinterData.ALL_PAGES; int startPage = 1, endPage = 1; bool printToFile = false; @@ -63,7 +68,7 @@ * @see Widget#checkSubclass * @see Widget#getStyle */ -public PrintDialog (Shell parent) { +public this (Shell parent) { this (parent, DWT.PRIMARY_MODAL); } @@ -95,7 +100,7 @@ * @see Widget#checkSubclass * @see Widget#getStyle */ -public PrintDialog (Shell parent, int style) { +public this (Shell parent, int style) { super (parent, style); checkSubclass (); } @@ -144,8 +149,8 @@ dict.setValue(OS.NSPrintSaveJob, OS.NSPrintJobDisposition); } //TODO - setting range not work. why? - dict.setValue(NSNumber.numberWithBool(scope is PrinterData.ALL_PAGES), OS.NSPrintAllPages); - if (scope is PrinterData.PAGE_RANGE) { + dict.setValue(NSNumber.numberWithBool(scope_ is PrinterData.ALL_PAGES), OS.NSPrintAllPages); + if (scope_ is PrinterData.PAGE_RANGE) { dict.setValue(NSNumber.numberWithInt(startPage), OS.NSPrintFirstPage); dict.setValue(NSNumber.numberWithInt(endPage), OS.NSPrintLastPage); } @@ -159,19 +164,19 @@ 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; - if (data.scope is 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.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[(int)/*64*/nsData.length()]; + data.otherData = new byte[nsData.length()]; OS.memmove(data.otherData, nsData.bytes(), data.otherData.length); printToFile = data.printToFile; - scope = data.scope; + scope_ = data.scope_; startPage = data.startPage; endPage = data.endPage; }