Mercurial > projects > dwt-mac
comparison dwt/printing/PrintDialog.d @ 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 |
comparison
equal
deleted
inserted
replaced
118:10760eb00d08 | 119:d9893755f670 |
---|---|
162 data.printToFile = printInfo.jobDisposition().isEqual(OS.NSPrintSaveJob); | 162 data.printToFile = printInfo.jobDisposition().isEqual(OS.NSPrintSaveJob); |
163 if (data.printToFile) { | 163 if (data.printToFile) { |
164 NSString filename = new NSString(dict.objectForKey(OS.NSPrintSavePath)); | 164 NSString filename = new NSString(dict.objectForKey(OS.NSPrintSavePath)); |
165 data.fileName = filename.getString(); | 165 data.fileName = filename.getString(); |
166 } | 166 } |
167 data.scope_ = new NSNumber(dict.objectForKey(OS.NSPrintAllPages)).intValue() !is 0 ? PrinterData.ALL_PAGES : PrinterData.PAGE_RANGE; | 167 data.scope_ = (new NSNumber(dict.objectForKey(OS.NSPrintAllPages))).intValue() !is 0 ? PrinterData.ALL_PAGES : PrinterData.PAGE_RANGE; |
168 if (data.scope_ is PrinterData.PAGE_RANGE) { | 168 if (data.scope_ is PrinterData.PAGE_RANGE) { |
169 data.startPage = new NSNumber(dict.objectForKey(OS.NSPrintFirstPage)).intValue(); | 169 data.startPage = (new NSNumber(dict.objectForKey(OS.NSPrintFirstPage))).intValue(); |
170 data.endPage = new NSNumber(dict.objectForKey(OS.NSPrintLastPage)).intValue(); | 170 data.endPage = (new NSNumber(dict.objectForKey(OS.NSPrintLastPage))).intValue(); |
171 } | 171 } |
172 data.collate = new NSNumber(dict.objectForKey(OS.NSPrintMustCollate)).intValue() !is 0; | 172 data.collate = (new NSNumber(dict.objectForKey(OS.NSPrintMustCollate))).intValue() !is 0; |
173 data.copyCount = new NSNumber(dict.objectForKey(OS.NSPrintCopies)).intValue(); | 173 data.copyCount = (new NSNumber(dict.objectForKey(OS.NSPrintCopies))).intValue(); |
174 NSData nsData = NSKeyedArchiver.archivedDataWithRootObject(printInfo); | 174 NSData nsData = NSKeyedArchiver.archivedDataWithRootObject(printInfo); |
175 data.otherData = new byte[nsData.length()]; | 175 data.otherData = new byte[nsData.length()]; |
176 OS.memmove(data.otherData, nsData.bytes(), data.otherData.length); | 176 OS.memmove(&data.otherData, nsData.bytes(), data.otherData.length); |
177 | 177 |
178 printToFile = data.printToFile; | 178 printToFile = data.printToFile; |
179 scope_ = data.scope_; | 179 scope_ = data.scope_; |
180 startPage = data.startPage; | 180 startPage = data.startPage; |
181 endPage = data.endPage; | 181 endPage = data.endPage; |
198 * </dl> | 198 * </dl> |
199 * | 199 * |
200 * @return the scope setting that the user selected | 200 * @return the scope setting that the user selected |
201 */ | 201 */ |
202 public int getScope() { | 202 public int getScope() { |
203 return scope; | 203 return scope_; |
204 } | 204 } |
205 | 205 |
206 /** | 206 /** |
207 * Sets the scope of the print job. The user will see this | 207 * Sets the scope of the print job. The user will see this |
208 * setting when the dialog is opened. This can have one of | 208 * setting when the dialog is opened. This can have one of |
216 * <dd>Print the current selection</dd> | 216 * <dd>Print the current selection</dd> |
217 * </dl> | 217 * </dl> |
218 * | 218 * |
219 * @param scope the scope setting when the dialog is opened | 219 * @param scope the scope setting when the dialog is opened |
220 */ | 220 */ |
221 public void setScope(int scope) { | 221 public void setScope(int scope_) { |
222 this.scope = scope; | 222 this.scope_ = scope_; |
223 } | 223 } |
224 | 224 |
225 /** | 225 /** |
226 * Returns the start page setting that the user selected | 226 * Returns the start page setting that the user selected |
227 * before pressing OK in the dialog. | 227 * before pressing OK in the dialog. |
297 public void setPrintToFile(bool printToFile) { | 297 public void setPrintToFile(bool printToFile) { |
298 this.printToFile = printToFile; | 298 this.printToFile = printToFile; |
299 } | 299 } |
300 | 300 |
301 protected void checkSubclass() { | 301 protected void checkSubclass() { |
302 String name = getClass().getName(); | 302 String name = this.classinfo.name; |
303 String validName = PrintDialog.class.getName(); | 303 String validName = PrintDialog.classinfo.name; |
304 if (!validName.equals(name)) { | 304 if (!validName.equals(name)) { |
305 DWT.error(DWT.ERROR_INVALID_SUBCLASS); | 305 DWT.error(DWT.ERROR_INVALID_SUBCLASS); |
306 } | 306 } |
307 } | 307 } |
308 } | 308 } |