diff options
author | Carolyn MacLeod <carolyn> | 2010-12-06 20:21:34 +0000 |
---|---|---|
committer | Carolyn MacLeod <carolyn> | 2010-12-06 20:21:34 +0000 |
commit | b2b34fbc2579012e9628a9fa709c082791d6ec37 (patch) | |
tree | 004d31e15e91444f6238a73b851c760ca1b9601a /bundles | |
parent | 3654966d37611f4d9d2c9f01b9ca8fa3554b426a (diff) | |
download | eclipse.platform.swt-b2b34fbc2579012e9628a9fa709c082791d6ec37.tar.gz eclipse.platform.swt-b2b34fbc2579012e9628a9fa709c082791d6ec37.tar.xz eclipse.platform.swt-b2b34fbc2579012e9628a9fa709c082791d6ec37.zip |
Adding duplex API
Diffstat (limited to 'bundles')
20 files changed, 330 insertions, 27 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os.c b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os.c index 69e427ef82..88b466a4c4 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os.c +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os.c @@ -4837,6 +4837,18 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(NSPrintMustCollate) } #endif +#ifndef NO_NSPrintOrientation +JNIEXPORT jintLong JNICALL OS_NATIVE(NSPrintOrientation) + (JNIEnv *env, jclass that) +{ + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, NSPrintOrientation_FUNC); + rc = (jintLong)NSPrintOrientation; + OS_NATIVE_EXIT(env, that, NSPrintOrientation_FUNC); + return rc; +} +#endif + #ifndef NO_NSPrintPreviewJob JNIEXPORT jintLong JNICALL OS_NATIVE(NSPrintPreviewJob) (JNIEnv *env, jclass that) @@ -5401,6 +5413,30 @@ JNIEXPORT void JNICALL OS_NATIVE(OpenRgn) } #endif +#ifndef NO_PMGetDuplex +JNIEXPORT jintLong JNICALL OS_NATIVE(PMGetDuplex) + (JNIEnv *env, jclass that, jintLong arg0, jintArray arg1) +{ + jint *lparg1=NULL; + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, PMGetDuplex_FUNC); + if (arg1) if ((lparg1 = (*env)->GetIntArrayElements(env, arg1, NULL)) == NULL) goto fail; +/* + rc = (jintLong)PMGetDuplex((PMPrintSettings)arg0, (PMDuplexMode *)lparg1); +*/ + { + LOAD_FUNCTION(fp, PMGetDuplex) + if (fp) { + rc = (jintLong)((jintLong (CALLING_CONVENTION*)(PMPrintSettings, PMDuplexMode *))fp)((PMPrintSettings)arg0, (PMDuplexMode *)lparg1); + } + } +fail: + if (arg1 && lparg1) (*env)->ReleaseIntArrayElements(env, arg1, lparg1, 0); + OS_NATIVE_EXIT(env, that, PMGetDuplex_FUNC); + return rc; +} +#endif + #ifndef NO_PMPrinterGetIndexedPrinterResolution JNIEXPORT jintLong JNICALL OS_NATIVE(PMPrinterGetIndexedPrinterResolution) (JNIEnv *env, jclass that, jintLong arg0, jint arg1, jobject arg2) @@ -5506,12 +5542,12 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(PMSessionGetDestinationType) OS_NATIVE_ENTER(env, that, PMSessionGetDestinationType_FUNC); if (arg2) if ((lparg2 = (*env)->GetShortArrayElements(env, arg2, NULL)) == NULL) goto fail; /* - rc = (jintLong)PMSessionGetDestinationType((PMPrintSession)arg0, arg1, lparg2); + rc = (jintLong)PMSessionGetDestinationType((PMPrintSession)arg0, (PMPrintSettings)arg1, lparg2); */ { LOAD_FUNCTION(fp, PMSessionGetDestinationType) if (fp) { - rc = (jintLong)((jintLong (CALLING_CONVENTION*)(PMPrintSession, jintLong, jshort *))fp)((PMPrintSession)arg0, arg1, lparg2); + rc = (jintLong)((jintLong (CALLING_CONVENTION*)(PMPrintSession, PMPrintSettings, jshort *))fp)((PMPrintSession)arg0, (PMPrintSettings)arg1, lparg2); } } fail: @@ -5521,6 +5557,26 @@ fail: } #endif +#ifndef NO_PMSetDuplex +JNIEXPORT jintLong JNICALL OS_NATIVE(PMSetDuplex) + (JNIEnv *env, jclass that, jintLong arg0, jint arg1) +{ + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, PMSetDuplex_FUNC); +/* + rc = (jintLong)PMSetDuplex((PMPrintSettings)arg0, (PMDuplexMode)arg1); +*/ + { + LOAD_FUNCTION(fp, PMSetDuplex) + if (fp) { + rc = (jintLong)((jintLong (CALLING_CONVENTION*)(PMPrintSettings, PMDuplexMode))fp)((PMPrintSettings)arg0, (PMDuplexMode)arg1); + } + } + OS_NATIVE_EXIT(env, that, PMSetDuplex_FUNC); + return rc; +} +#endif + #ifndef NO_PtInRgn JNIEXPORT jboolean JNICALL OS_NATIVE(PtInRgn) (JNIEnv *env, jclass that, jshortArray arg0, jintLong arg1) diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_custom.h b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_custom.h index 645537369b..7f8dadb11c 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_custom.h +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_custom.h @@ -60,3 +60,5 @@ #define PMPrinterGetPrinterResolutionCount_LIB "com.apple.ApplicationServices" #define PMPrinterGetOutputResolution_LIB "com.apple.ApplicationServices" #define PMPrinterGetIndexedPrinterResolution_LIB "com.apple.ApplicationServices" +#define PMGetDuplex_LIB "com.apple.ApplicationServices" +#define PMSetDuplex_LIB "com.apple.ApplicationServices" diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.c b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.c index 9cbb60e852..a905d7254c 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.c +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.c @@ -14,8 +14,8 @@ #ifdef NATIVE_STATS -int OS_nativeFunctionCount = 619; -int OS_nativeFunctionCallCount[619]; +int OS_nativeFunctionCount = 622; +int OS_nativeFunctionCallCount[622]; char * OS_nativeFunctionNames[] = { "ATSFontActivateFromFileReference", "AcquireRootMenu", @@ -369,6 +369,7 @@ char * OS_nativeFunctionNames[] = { "NSPrintJobDisposition", "NSPrintLastPage", "NSPrintMustCollate", + "NSPrintOrientation", "NSPrintPreviewJob", "NSPrintSaveJob", "NSPrintSavePath", @@ -414,11 +415,13 @@ char * OS_nativeFunctionNames[] = { "NewRgn", "OffsetRgn", "OpenRgn", + "PMGetDuplex", "PMPrinterGetIndexedPrinterResolution", "PMPrinterGetOutputResolution", "PMPrinterGetPrinterResolutionCount", "PMSessionGetCurrentPrinter", "PMSessionGetDestinationType", + "PMSetDuplex", "PtInRgn", "QDRegionToRects", "RectInRgn", diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.h index 3bf2e82b36..e881afada5 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.h +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.h @@ -377,6 +377,7 @@ typedef enum { NSPrintJobDisposition_FUNC, NSPrintLastPage_FUNC, NSPrintMustCollate_FUNC, + NSPrintOrientation_FUNC, NSPrintPreviewJob_FUNC, NSPrintSaveJob_FUNC, NSPrintSavePath_FUNC, @@ -422,11 +423,13 @@ typedef enum { NewRgn_FUNC, OffsetRgn_FUNC, OpenRgn_FUNC, + PMGetDuplex_FUNC, PMPrinterGetIndexedPrinterResolution_FUNC, PMPrinterGetOutputResolution_FUNC, PMPrinterGetPrinterResolutionCount_FUNC, PMSessionGetCurrentPrinter_FUNC, PMSessionGetDestinationType_FUNC, + PMSetDuplex_FUNC, PtInRgn_FUNC, QDRegionToRects_FUNC, RectInRgn_FUNC, diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/AppKitFull.bridgesupport.extras b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/AppKitFull.bridgesupport.extras index 4c6a50a2d1..961ab3245f 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/AppKitFull.bridgesupport.extras +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/AppKitFull.bridgesupport.extras @@ -2350,10 +2350,10 @@ <method selector="jobDisposition" swt_gen="true"> <retval swt_gen="true"></retval> </method> - <method selector="orientation" swt_gen="true"> + <method selector="paperSize" swt_gen="true"> <retval swt_gen="true"></retval> </method> - <method selector="paperSize" swt_gen="true"> + <method selector="printSettings" swt_gen="true"> <retval swt_gen="true"></retval> </method> <method selector="printer" swt_gen="true"> @@ -2363,10 +2363,6 @@ <arg swt_gen="true"></arg> <retval swt_gen="true"></retval> </method> - <method selector="setOrientation:" swt_gen="true"> - <arg swt_gen="true"></arg> - <retval swt_gen="true"></retval> - </method> <method selector="setPrinter:" swt_gen="true"> <arg swt_gen="true"></arg> <retval swt_gen="true"></retval> @@ -2377,6 +2373,9 @@ <method class_method="true" selector="sharedPrintInfo" swt_gen="true"> <retval swt_gen="true"></retval> </method> + <method selector="updateFromPMPrintSettings" swt_gen="true"> + <retval swt_gen="true"></retval> + </method> </class> <class name="NSPrintOperation" swt_gen="mixed"> <method selector="cleanUpOperation" swt_gen="true"> @@ -4525,6 +4524,7 @@ <constant name="NSPrintJobDisposition" swt_gen="true"></constant> <constant name="NSPrintLastPage" swt_gen="true"></constant> <constant name="NSPrintMustCollate" swt_gen="true"></constant> + <constant name="NSPrintOrientation" swt_gen="true"></constant> <constant name="NSPrintPreviewJob" swt_gen="true"></constant> <constant name="NSPrintSaveJob" swt_gen="true"></constant> <constant name="NSPrintSavePath" swt_gen="true"></constant> @@ -4677,6 +4677,9 @@ <enum name="NSPageDownFunctionKey" swt_gen="true"></enum> <enum name="NSPageUpFunctionKey" swt_gen="true"></enum> <enum name="NSPortraitOrientation" swt_gen="true"></enum> + <enum name="NSPrintPanelShowsCopies" swt_gen="true"></enum> + <enum name="NSPrintPanelShowsOrientation" swt_gen="true"></enum> + <enum name="NSPrintPanelShowsPageRange" swt_gen="true"></enum> <enum name="NSPrintPanelShowsPageSetupAccessory" swt_gen="true"></enum> <enum name="NSProgressIndicatorPreferredThickness" swt_gen="true"></enum> <enum name="NSPushOnPushOffButton" swt_gen="true"></enum> diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSPrintInfo.java b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSPrintInfo.java index 147e5af22c..fc2fa09351 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSPrintInfo.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSPrintInfo.java @@ -58,16 +58,17 @@ public NSString jobDisposition() { return result != 0 ? new NSString(result) : null; } -public int /*long*/ orientation() { - return OS.objc_msgSend(this.id, OS.sel_orientation); -} - public NSSize paperSize() { NSSize result = new NSSize(); OS.objc_msgSend_stret(result, this.id, OS.sel_paperSize); return result; } +public NSMutableDictionary printSettings() { + int /*long*/ result = OS.objc_msgSend(this.id, OS.sel_printSettings); + return result != 0 ? new NSMutableDictionary(result) : null; +} + public NSPrinter printer() { int /*long*/ result = OS.objc_msgSend(this.id, OS.sel_printer); return result != 0 ? new NSPrinter(result) : null; @@ -77,10 +78,6 @@ public void setJobDisposition(NSString disposition) { OS.objc_msgSend(this.id, OS.sel_setJobDisposition_, disposition != null ? disposition.id : 0); } -public void setOrientation(int /*long*/ orientation) { - OS.objc_msgSend(this.id, OS.sel_setOrientation_, orientation); -} - public void setPrinter(NSPrinter printer) { OS.objc_msgSend(this.id, OS.sel_setPrinter_, printer != null ? printer.id : 0); } @@ -94,4 +91,8 @@ public static NSPrintInfo sharedPrintInfo() { return result != 0 ? new NSPrintInfo(result) : null; } +public void updateFromPMPrintSettings() { + OS.objc_msgSend(this.id, OS.sel_updateFromPMPrintSettings); +} + } diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java index 1475aa51be..cbfefb307e 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java @@ -63,6 +63,9 @@ public class OS extends C { public static final int kAXUnderlineStyleThick = 0x2; public static final int kAXUnderlineStyleDouble = 0x9; public static final int kPMDestinationPrinter = 1; + public static final int kPMDuplexNone = 0x0001; + public static final int kPMDuplexNoTumble = 0x0002; + public static final int kPMDuplexTumble = 0x0003; public static final int /*long*/ sel_sendSearchSelection = sel_registerName("sendSearchSelection"); @@ -298,10 +301,20 @@ public static final native void DeleteMenuItem(int /*long*/ mHandle, short index public static final native int /*long*/ PMSessionGetCurrentPrinter(int /*long*/ pmSessionInfo, int /*long*/[] outPMPrinter); /** @method flags=dynamic * @param pmSessionInfo cast=(PMPrintSession) - * @param outPMPrinter cast=(PMPrintSettings) + * @param pmPrintSettings cast=(PMPrintSettings) */ public static final native int /*long*/ PMSessionGetDestinationType(int /*long*/ pmSessionInfo, int /*long*/ pmPrintSettings, short[] outDestinationType); /** @method flags=dynamic + * @param printSettings cast=(PMPrintSettings) + * @param outDuplexSetting cast=(PMDuplexMode *) + */ +public static final native int /*long*/ PMGetDuplex(int /*long*/ printSettings, int[] outDuplexSetting); +/** @method flags=dynamic + * @param printSettings cast=(PMPrintSettings) + * @param duplexSetting cast=(PMDuplexMode) + */ +public static final native int /*long*/ PMSetDuplex(int /*long*/ printSettings, int duplexSetting); +/** @method flags=dynamic * @param pmPrinter cast=(PMPrinter) * @param pmPrintSettings cast=(PMPrintSettings) */ @@ -1471,7 +1484,6 @@ public static final int /*long*/ sel_orderFrontStandardAboutPanel_ = sel_registe public static final int /*long*/ sel_orderOut_ = sel_registerName("orderOut:"); public static final int /*long*/ sel_orderWindow_relativeTo_ = sel_registerName("orderWindow:relativeTo:"); public static final int /*long*/ sel_orderedWindows = sel_registerName("orderedWindows"); -public static final int /*long*/ sel_orientation = sel_registerName("orientation"); public static final int /*long*/ sel_otherEventWithType_location_modifierFlags_timestamp_windowNumber_context_subtype_data1_data2_ = sel_registerName("otherEventWithType:location:modifierFlags:timestamp:windowNumber:context:subtype:data1:data2:"); public static final int /*long*/ sel_otherMouseDown_ = sel_registerName("otherMouseDown:"); public static final int /*long*/ sel_otherMouseDragged_ = sel_registerName("otherMouseDragged:"); @@ -1536,6 +1548,7 @@ public static final int /*long*/ sel_printDocumentView = sel_registerName("print public static final int /*long*/ sel_printOperationWithPrintInfo_ = sel_registerName("printOperationWithPrintInfo:"); public static final int /*long*/ sel_printOperationWithView_printInfo_ = sel_registerName("printOperationWithView:printInfo:"); public static final int /*long*/ sel_printPanel = sel_registerName("printPanel"); +public static final int /*long*/ sel_printSettings = sel_registerName("printSettings"); public static final int /*long*/ sel_printer = sel_registerName("printer"); public static final int /*long*/ sel_printerNames = sel_registerName("printerNames"); public static final int /*long*/ sel_printerWithName_ = sel_registerName("printerWithName:"); @@ -1843,7 +1856,6 @@ public static final int /*long*/ sel_setObjectValue_ = sel_registerName("setObje public static final int /*long*/ sel_setOnMouseEntered_ = sel_registerName("setOnMouseEntered:"); public static final int /*long*/ sel_setOpaque_ = sel_registerName("setOpaque:"); public static final int /*long*/ sel_setOptions_ = sel_registerName("setOptions:"); -public static final int /*long*/ sel_setOrientation_ = sel_registerName("setOrientation:"); public static final int /*long*/ sel_setOutlineTableColumn_ = sel_registerName("setOutlineTableColumn:"); public static final int /*long*/ sel_setPaletteLabel_ = sel_registerName("setPaletteLabel:"); public static final int /*long*/ sel_setPanelFont_isMultiple_ = sel_registerName("setPanelFont:isMultiple:"); @@ -2048,6 +2060,7 @@ public static final int /*long*/ sel_unlockFocus = sel_registerName("unlockFocus public static final int /*long*/ sel_unmarkText = sel_registerName("unmarkText"); public static final int /*long*/ sel_unregisterDraggedTypes = sel_registerName("unregisterDraggedTypes"); public static final int /*long*/ sel_update = sel_registerName("update"); +public static final int /*long*/ sel_updateFromPMPrintSettings = sel_registerName("updateFromPMPrintSettings"); public static final int /*long*/ sel_updateTrackingAreas = sel_registerName("updateTrackingAreas"); public static final int /*long*/ sel_use = sel_registerName("use"); public static final int /*long*/ sel_useCredential_forAuthenticationChallenge_ = sel_registerName("useCredential:forAuthenticationChallenge:"); @@ -2254,6 +2267,9 @@ public static final int NSOutlineViewDropOnItemIndex = -1; public static final int NSPageDownFunctionKey = 63277; public static final int NSPageUpFunctionKey = 63276; public static final int NSPortraitOrientation = 0; +public static final int NSPrintPanelShowsCopies = 1; +public static final int NSPrintPanelShowsOrientation = 8; +public static final int NSPrintPanelShowsPageRange = 2; public static final int NSPrintPanelShowsPageSetupAccessory = 256; public static final int NSProgressIndicatorPreferredThickness = 14; public static final int NSPushOnPushOffButton = 1; @@ -2846,6 +2862,9 @@ public static final NSString NSPrintLastPage = new NSString(NSPrintLastPage()); public static final native int /*long*/ NSPrintMustCollate(); public static final NSString NSPrintMustCollate = new NSString(NSPrintMustCollate()); /** @method flags=const */ +public static final native int /*long*/ NSPrintOrientation(); +public static final NSString NSPrintOrientation = new NSString(NSPrintOrientation()); +/** @method flags=const */ public static final native int /*long*/ NSPrintPreviewJob(); public static final NSString NSPrintPreviewJob = new NSString(NSPrintPreviewJob()); /** @method flags=const */ diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c index 77ae3d9ba1..6f353fa448 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c @@ -11890,6 +11890,26 @@ JNIEXPORT jboolean JNICALL OS_NATIVE(_1gtk_1print_1settings_1get_1collate) } #endif +#ifndef NO__1gtk_1print_1settings_1get_1duplex +JNIEXPORT jint JNICALL OS_NATIVE(_1gtk_1print_1settings_1get_1duplex) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jint rc = 0; + OS_NATIVE_ENTER(env, that, _1gtk_1print_1settings_1get_1duplex_FUNC); +/* + rc = (jint)gtk_print_settings_get_duplex(arg0); +*/ + { + LOAD_FUNCTION(fp, gtk_print_settings_get_duplex) + if (fp) { + rc = (jint)((jint (CALLING_CONVENTION*)(jintLong))fp)(arg0); + } + } + OS_NATIVE_EXIT(env, that, _1gtk_1print_1settings_1get_1duplex_FUNC); + return rc; +} +#endif + #ifndef NO__1gtk_1print_1settings_1get_1n_1copies JNIEXPORT jint JNICALL OS_NATIVE(_1gtk_1print_1settings_1get_1n_1copies) (JNIEnv *env, jclass that, jintLong arg0) @@ -12117,6 +12137,24 @@ JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1print_1settings_1set_1collate) } #endif +#ifndef NO__1gtk_1print_1settings_1set_1duplex +JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1print_1settings_1set_1duplex) + (JNIEnv *env, jclass that, jintLong arg0, jint arg1) +{ + OS_NATIVE_ENTER(env, that, _1gtk_1print_1settings_1set_1duplex_FUNC); +/* + gtk_print_settings_set_duplex(arg0, arg1); +*/ + { + LOAD_FUNCTION(fp, gtk_print_settings_set_duplex) + if (fp) { + ((void (CALLING_CONVENTION*)(jintLong, jint))fp)(arg0, arg1); + } + } + OS_NATIVE_EXIT(env, that, _1gtk_1print_1settings_1set_1duplex_FUNC); +} +#endif + #ifndef NO__1gtk_1print_1settings_1set_1n_1copies JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1print_1settings_1set_1n_1copies) (JNIEnv *env, jclass that, jintLong arg0, jint arg1) diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h index 7c78e97a3f..45fd9b7e02 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h @@ -218,6 +218,7 @@ #define gtk_print_settings_foreach_LIB LIB_GTK #define gtk_print_settings_get_LIB LIB_GTK #define gtk_print_settings_get_collate_LIB LIB_GTK +#define gtk_print_settings_get_duplex_LIB LIB_GTK #define gtk_print_settings_get_n_copies_LIB LIB_GTK #define gtk_print_settings_get_orientation_LIB LIB_GTK #define gtk_print_settings_get_page_ranges_LIB LIB_GTK @@ -229,6 +230,7 @@ #define gtk_print_settings_new_LIB LIB_GTK #define gtk_print_settings_set_LIB LIB_GTK #define gtk_print_settings_set_collate_LIB LIB_GTK +#define gtk_print_settings_set_duplex_LIB LIB_GTK #define gtk_print_settings_set_n_copies_LIB LIB_GTK #define gtk_print_settings_set_orientation_LIB LIB_GTK #define gtk_print_settings_set_page_ranges_LIB LIB_GTK diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c index a10c1ead2c..b9732fb6f0 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c @@ -18,8 +18,8 @@ #ifdef NATIVE_STATS -int OS_nativeFunctionCount = 1375; -int OS_nativeFunctionCallCount[1375]; +int OS_nativeFunctionCount = 1377; +int OS_nativeFunctionCallCount[1377]; char * OS_nativeFunctionNames[] = { #ifndef JNI64 "Call__IIII", @@ -941,6 +941,7 @@ char * OS_nativeFunctionNames[] = { "_1gtk_1print_1settings_1foreach", "_1gtk_1print_1settings_1get", "_1gtk_1print_1settings_1get_1collate", + "_1gtk_1print_1settings_1get_1duplex", "_1gtk_1print_1settings_1get_1n_1copies", "_1gtk_1print_1settings_1get_1orientation", "_1gtk_1print_1settings_1get_1page_1ranges", @@ -952,6 +953,7 @@ char * OS_nativeFunctionNames[] = { "_1gtk_1print_1settings_1new", "_1gtk_1print_1settings_1set", "_1gtk_1print_1settings_1set_1collate", + "_1gtk_1print_1settings_1set_1duplex", "_1gtk_1print_1settings_1set_1n_1copies", "_1gtk_1print_1settings_1set_1orientation", "_1gtk_1print_1settings_1set_1page_1ranges", diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h index b691f56d3c..5934f9d556 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h @@ -949,6 +949,7 @@ typedef enum { _1gtk_1print_1settings_1foreach_FUNC, _1gtk_1print_1settings_1get_FUNC, _1gtk_1print_1settings_1get_1collate_FUNC, + _1gtk_1print_1settings_1get_1duplex_FUNC, _1gtk_1print_1settings_1get_1n_1copies_FUNC, _1gtk_1print_1settings_1get_1orientation_FUNC, _1gtk_1print_1settings_1get_1page_1ranges_FUNC, @@ -960,6 +961,7 @@ typedef enum { _1gtk_1print_1settings_1new_FUNC, _1gtk_1print_1settings_1set_FUNC, _1gtk_1print_1settings_1set_1collate_FUNC, + _1gtk_1print_1settings_1set_1duplex_FUNC, _1gtk_1print_1settings_1set_1n_1copies_FUNC, _1gtk_1print_1settings_1set_1orientation_FUNC, _1gtk_1print_1settings_1set_1page_1ranges_FUNC, diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java index e877751398..f88dcb4f8a 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java @@ -311,6 +311,9 @@ public class OS extends C { public static final int GTK_PRINT_PAGES_ALL = 0; public static final int GTK_PRINT_PAGES_CURRENT = 1; public static final int GTK_PRINT_PAGES_RANGES = 2; + public static final int GTK_PRINT_DUPLEX_SIMPLEX = 0; + public static final int GTK_PRINT_DUPLEX_HORIZONTAL = 1; + public static final int GTK_PRINT_DUPLEX_VERTICAL = 2; public static final int GTK_PROGRESS_CONTINUOUS = 0x0; public static final int GTK_PROGRESS_DISCRETE = 0x1; public static final int GTK_PROGRESS_LEFT_TO_RIGHT = 0x0; @@ -9365,6 +9368,26 @@ public static final void gtk_print_settings_set_collate(int /*long*/ settings, b } } /** @method flags=dynamic */ +public static final native int _gtk_print_settings_get_duplex(int /*long*/ settings); +public static final int gtk_print_settings_get_duplex(int /*long*/ settings) { + lock.lock(); + try { + return _gtk_print_settings_get_duplex(settings); + } finally { + lock.unlock(); + } +} +/** @method flags=dynamic */ +public static final native void _gtk_print_settings_set_duplex(int /*long*/ settings, int duplex); +public static final void gtk_print_settings_set_duplex(int /*long*/ settings, int duplex) { + lock.lock(); + try { + _gtk_print_settings_set_duplex(settings, duplex); + } finally { + lock.unlock(); + } +} +/** @method flags=dynamic */ public static final native int _gtk_print_settings_get_n_copies(int /*long*/ settings); public static final int gtk_print_settings_get_n_copies(int /*long*/ settings) { lock.lock(); diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java index b7f29ea04c..048a9aa3d8 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java @@ -548,9 +548,13 @@ public class OS extends C { public static final int DM_SETDEFID = 0x401; public static final int DM_COLLATE = 0x00008000; public static final int DM_COPIES = 0x00000100; + public static final int DM_DUPLEX = 0x00001000; public static final int DM_ORIENTATION = 0x00000001; public static final short DMORIENT_PORTRAIT = 1; public static final short DMORIENT_LANDSCAPE = 2; + public static final short DMDUP_SIMPLEX = 1; + public static final short DMDUP_VERTICAL = 2; + public static final short DMDUP_HORIZONTAL = 3; public static final int DSS_DISABLED = 0x20; public static final int DSTINVERT = 0x550009; public static final int DST_BITMAP = 0x4; diff --git a/bundles/org.eclipse.swt/Eclipse SWT Printing/cocoa/org/eclipse/swt/printing/PrintDialog.java b/bundles/org.eclipse.swt/Eclipse SWT Printing/cocoa/org/eclipse/swt/printing/PrintDialog.java index a7da03662f..2332e621c9 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT Printing/cocoa/org/eclipse/swt/printing/PrintDialog.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Printing/cocoa/org/eclipse/swt/printing/PrintDialog.java @@ -155,10 +155,19 @@ public PrinterData open() { PrinterData data = null; NSPrintPanel panel = NSPrintPanel.printPanel(); NSPrintInfo printInfo = new NSPrintInfo(NSPrintInfo.sharedPrintInfo().copy()); - printInfo.setOrientation(printerData.orientation == PrinterData.LANDSCAPE ? OS.NSLandscapeOrientation : OS.NSPortraitOrientation); - NSMutableDictionary dict = printInfo.dictionary(); + if (printerData.duplex != SWT.DEFAULT) { + int /*long*/ settings = printInfo.PMPrintSettings(); + int duplex = printerData.duplex == PrinterData.DUPLEX_SHORT_EDGE ? OS.kPMDuplexTumble + : printerData.duplex == PrinterData.DUPLEX_LONG_EDGE ? OS.kPMDuplexNoTumble + : OS.kPMDuplexNone; + OS.PMSetDuplex(settings, duplex); + } + /* Updating printInfo from PMPrintSettings overrides values in the printInfo dictionary. */ + printInfo.updateFromPMPrintSettings(); + NSMutableDictionary dict = printInfo.dictionary(); dict.setValue(NSNumber.numberWithBool(printerData.collate), OS.NSPrintMustCollate); dict.setValue(NSNumber.numberWithInt(printerData.copyCount), OS.NSPrintCopies); + dict.setValue(NSNumber.numberWithInt(printerData.orientation == PrinterData.LANDSCAPE ? OS.NSLandscapeOrientation : OS.NSPortraitOrientation), OS.NSPrintOrientation); if (printerData.printToFile) { dict.setValue(OS.NSPrintSaveJob, OS.NSPrintJobDisposition); } @@ -211,7 +220,13 @@ public PrinterData open() { data.collate = false; //TODO: Only set to false if the printer does the collate internally (most printers do) data.copyCount = new NSNumber(dict.objectForKey(OS.NSPrintCopies)).intValue(); data.copyCount = 1; //TODO: Only set to 1 if the printer does the copy internally (most printers do) - data.orientation = printInfo.orientation() == OS.NSLandscapeOrientation ? PrinterData.LANDSCAPE : PrinterData.PORTRAIT; + data.orientation = new NSNumber(dict.objectForKey(OS.NSPrintOrientation)).intValue() == OS.NSLandscapeOrientation ? PrinterData.LANDSCAPE : PrinterData.PORTRAIT; + int /*long*/ settings = printInfo.PMPrintSettings(); + int outDuplexSetting[] = new int[1]; + OS.PMGetDuplex(settings, outDuplexSetting); + data.duplex = outDuplexSetting[0] == OS.kPMDuplexTumble ? PrinterData.DUPLEX_SHORT_EDGE + : outDuplexSetting[0] == OS.kPMDuplexNoTumble ? PrinterData.DUPLEX_LONG_EDGE + : PrinterData.DUPLEX_NONE; NSData nsData = NSKeyedArchiver.archivedDataWithRootObject(printInfo); data.otherData = new byte[(int)/*64*/nsData.length()]; OS.memmove(data.otherData, nsData.bytes(), data.otherData.length); diff --git a/bundles/org.eclipse.swt/Eclipse SWT Printing/cocoa/org/eclipse/swt/printing/Printer.java b/bundles/org.eclipse.swt/Eclipse SWT Printing/cocoa/org/eclipse/swt/printing/Printer.java index f47295d667..c5a4310e98 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT Printing/cocoa/org/eclipse/swt/printing/Printer.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Printing/cocoa/org/eclipse/swt/printing/Printer.java @@ -211,10 +211,19 @@ protected void create(DeviceData deviceData) { printer.retain(); printInfo.setPrinter(printer); } - printInfo.setOrientation(data.orientation == PrinterData.LANDSCAPE ? OS.NSLandscapeOrientation : OS.NSPortraitOrientation); + if (data.duplex != SWT.DEFAULT) { + int /*long*/ settings = printInfo.PMPrintSettings(); + int duplex = data.duplex == PrinterData.DUPLEX_SHORT_EDGE ? OS.kPMDuplexTumble + : data.duplex == PrinterData.DUPLEX_LONG_EDGE ? OS.kPMDuplexNoTumble + : OS.kPMDuplexNone; + OS.PMSetDuplex(settings, duplex); + } + /* Updating printInfo from PMPrintSettings overrides values in the printInfo dictionary. */ + printInfo.updateFromPMPrintSettings(); NSMutableDictionary dict = printInfo.dictionary(); if (data.collate != false) dict.setValue(NSNumber.numberWithBool(data.collate), OS.NSPrintMustCollate); if (data.copyCount != 1) dict.setValue(NSNumber.numberWithInt(data.copyCount), OS.NSPrintCopies); + dict.setValue(NSNumber.numberWithInt(data.orientation == PrinterData.LANDSCAPE ? OS.NSLandscapeOrientation : OS.NSPortraitOrientation), OS.NSPrintOrientation); if (data.printToFile) { dict.setValue(OS.NSPrintSaveJob, OS.NSPrintJobDisposition); if (data.fileName != null) dict.setValue(NSString.stringWith(data.fileName), OS.NSPrintSavePath); diff --git a/bundles/org.eclipse.swt/Eclipse SWT Printing/common/org/eclipse/swt/printing/PrinterData.java b/bundles/org.eclipse.swt/Eclipse SWT Printing/common/org/eclipse/swt/printing/PrinterData.java index 98fc552acf..0b9a9df4a0 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT Printing/common/org/eclipse/swt/printing/PrinterData.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Printing/common/org/eclipse/swt/printing/PrinterData.java @@ -11,6 +11,7 @@ package org.eclipse.swt.printing; +import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.*; /** @@ -113,6 +114,30 @@ public final class PrinterData extends DeviceData { public int orientation = PORTRAIT; /** + * Single-sided or double-sided printing, expressed as one of the + * following values: + * <dl> + * <dt><code>SWT.DEFAULT</code></dt> + * <dd>the default duplex value for the printer</dd> + * <dt><code>DUPLEX_NONE</code></dt> + * <dd>single-sided printing</dd> + * <dt><code>DUPLEX_LONG_EDGE</code></dt> + * <dd>double-sided printing as if bound on the long edge</dd> + * <dt><code>DUPLEX_SHORT_EDGE</code></dt> + * <dd>double-sided printing as if bound on the short edge</dd> + * </dl> + * <p> + * The default value is SWT.DEFAULT, meaning do not set a value; + * use the printer's default duplex setting. + * A printer's default value is typically single-sided, + * however it can default to double-sided in order to save paper. + * </p> + * + * @since 3.7 + */ + public int duplex = SWT.DEFAULT; + + /** * <code>scope</code> field value indicating that * all pages should be printed */ @@ -147,6 +172,45 @@ public final class PrinterData extends DeviceData { */ public static final int LANDSCAPE = 2; + /** + * <code>duplex</code> field value indicating + * single-sided printing. + * <p> + * This is also known as simplex printing. + * </p> + * + * @since 3.7 + */ + public static final int DUPLEX_NONE = 0; + + /** + * <code>duplex</code> field value indicating + * double-sided printing for binding on the long edge. + * <p> + * For portrait orientation, the long edge is vertical. + * For landscape orientation, the long edge is horizontal. + * </p><p> + * This is also known as duplex printing. + * </p> + * + * @since 3.7 + */ + public static final int DUPLEX_LONG_EDGE = 1; + + /** + * <code>duplex</code> field value indicating + * double-sided printing for binding on the short edge. + * <p> + * For portrait orientation, the short edge is horizontal. + * For landscape orientation, the short edge is vertical. + * </p><p> + * This is also known as duplex tumble printing. + * </p> + * + * @since 3.7 + */ + public static final int DUPLEX_SHORT_EDGE = 2; + /** * private, platform-specific data * On Windows, this contains a copy of the DEVMODE struct diff --git a/bundles/org.eclipse.swt/Eclipse SWT Printing/gtk/org/eclipse/swt/printing/PrintDialog.java b/bundles/org.eclipse.swt/Eclipse SWT Printing/gtk/org/eclipse/swt/printing/PrintDialog.java index 03cbb142cd..0333c17c1b 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Printing/gtk/org/eclipse/swt/printing/PrintDialog.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Printing/gtk/org/eclipse/swt/printing/PrintDialog.java @@ -348,6 +348,19 @@ public PrinterData open() { } OS.gtk_print_settings_set_n_copies(settings, printerData.copyCount); OS.gtk_print_settings_set_collate(settings, printerData.collate); + /* + * Bug in GTK. The unix dialog gives priority to the value of the non-API + * field cups-Duplex in the print_settings (which we preserve in otherData). + * The fix is to manually clear cups-Duplex before setting the duplex field. + */ + byte [] keyBuffer = Converter.wcsToMbcs (null, "cups-Duplex", true); + OS.gtk_print_settings_set(settings, keyBuffer, (byte[]) null); + if (printerData.duplex != SWT.DEFAULT) { + int duplex = printerData.duplex == PrinterData.DUPLEX_LONG_EDGE ? OS.GTK_PRINT_DUPLEX_HORIZONTAL + : printerData.duplex == PrinterData.DUPLEX_SHORT_EDGE ? OS.GTK_PRINT_DUPLEX_VERTICAL + : OS.GTK_PRINT_DUPLEX_SIMPLEX; + OS.gtk_print_settings_set_duplex (settings, duplex); + } int orientation = printerData.orientation == PrinterData.LANDSCAPE ? OS.GTK_PAGE_ORIENTATION_LANDSCAPE : OS.GTK_PAGE_ORIENTATION_PORTRAIT; OS.gtk_print_settings_set_orientation(settings, orientation); OS.gtk_page_setup_set_orientation(page_setup, orientation); @@ -430,6 +443,10 @@ public PrinterData open() { data.copyCount = OS.gtk_print_settings_get_n_copies(settings); data.collate = OS.gtk_print_settings_get_collate(settings); + int duplex = OS.gtk_print_settings_get_duplex(settings); + data.duplex = duplex == OS.GTK_PRINT_DUPLEX_HORIZONTAL ? PrinterData.DUPLEX_LONG_EDGE + : duplex == OS.GTK_PRINT_DUPLEX_VERTICAL ? PrinterData.DUPLEX_SHORT_EDGE + : PrinterData.DUPLEX_NONE; data.orientation = OS.gtk_page_setup_get_orientation(page_setup) == OS.GTK_PAGE_ORIENTATION_LANDSCAPE ? PrinterData.LANDSCAPE : PrinterData.PORTRAIT; /* Save other print_settings data as key/value pairs in otherData. */ diff --git a/bundles/org.eclipse.swt/Eclipse SWT Printing/gtk/org/eclipse/swt/printing/Printer.java b/bundles/org.eclipse.swt/Eclipse SWT Printing/gtk/org/eclipse/swt/printing/Printer.java index e38bfe6253..a42fab4bdf 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Printing/gtk/org/eclipse/swt/printing/Printer.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Printing/gtk/org/eclipse/swt/printing/Printer.java @@ -749,6 +749,25 @@ protected void init() { } OS.gtk_print_settings_set_n_copies(settings, data.copyCount); OS.gtk_print_settings_set_collate(settings, data.collate); + if (data.duplex != SWT.DEFAULT) { + int duplex = data.duplex == PrinterData.DUPLEX_LONG_EDGE ? OS.GTK_PRINT_DUPLEX_HORIZONTAL + : data.duplex == PrinterData.DUPLEX_SHORT_EDGE ? OS.GTK_PRINT_DUPLEX_VERTICAL + : OS.GTK_PRINT_DUPLEX_SIMPLEX; + OS.gtk_print_settings_set_duplex (settings, duplex); + /* + * Bug in GTK. The cups backend only looks at the value + * of the non-API field cups-Duplex in the print_settings. + * The fix is to manually set cups-Duplex to Tumble or NoTumble. + */ + String cupsDuplexType = null; + if (duplex == OS.GTK_PRINT_DUPLEX_HORIZONTAL) cupsDuplexType = "DuplexNoTumble"; + else if (duplex == OS.GTK_PRINT_DUPLEX_VERTICAL) cupsDuplexType = "DuplexTumble"; + if (cupsDuplexType != null) { + byte [] keyBuffer = Converter.wcsToMbcs (null, "cups-Duplex", true); + byte [] valueBuffer = Converter.wcsToMbcs (null, cupsDuplexType, true); + OS.gtk_print_settings_set(settings, keyBuffer, valueBuffer); + } + } int orientation = data.orientation == PrinterData.LANDSCAPE ? OS.GTK_PAGE_ORIENTATION_LANDSCAPE : OS.GTK_PAGE_ORIENTATION_PORTRAIT; OS.gtk_page_setup_set_orientation(pageSetup, orientation); OS.gtk_print_settings_set_orientation(settings, orientation); diff --git a/bundles/org.eclipse.swt/Eclipse SWT Printing/win32/org/eclipse/swt/printing/PrintDialog.java b/bundles/org.eclipse.swt/Eclipse SWT Printing/win32/org/eclipse/swt/printing/PrintDialog.java index 1fd65f7501..218d35addc 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT Printing/win32/org/eclipse/swt/printing/PrintDialog.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Printing/win32/org/eclipse/swt/printing/PrintDialog.java @@ -359,6 +359,14 @@ public PrinterData open() { devmode.dmFields |= OS.DM_COLLATE; devmode.dmCollate = OS.DMCOLLATE_TRUE; } + if (printerData.duplex != SWT.DEFAULT) { + devmode.dmFields |= OS.DM_DUPLEX; + switch (printerData.duplex) { + case PrinterData.DUPLEX_SHORT_EDGE: devmode.dmDuplex = OS.DMDUP_HORIZONTAL; break; + case PrinterData.DUPLEX_LONG_EDGE: devmode.dmDuplex = OS.DMDUP_VERTICAL; break; + default: devmode.dmDuplex = OS.DMDUP_SIMPLEX; + } + } OS.MoveMemory(ptr, devmode, OS.IsUnicode ? OS.DEVMODEW_sizeof() : OS.DEVMODEA_sizeof()); OS.GlobalUnlock(hMem); @@ -460,6 +468,11 @@ public PrinterData open() { int dmOrientation = devmode.dmOrientation; data.orientation = dmOrientation == OS.DMORIENT_LANDSCAPE ? PrinterData.LANDSCAPE : PrinterData.PORTRAIT; } + if ((devmode.dmFields & OS.DM_DUPLEX) != 0) { + short dmDuplex = devmode.dmDuplex; + data.duplex = dmDuplex == OS.DMDUP_SIMPLEX ? PrinterData.DUPLEX_NONE : dmDuplex == OS.DMDUP_HORIZONTAL ? PrinterData.DUPLEX_SHORT_EDGE : PrinterData.DUPLEX_LONG_EDGE; + } + OS.GlobalUnlock(hMem); printerData = data; } diff --git a/bundles/org.eclipse.swt/Eclipse SWT Printing/win32/org/eclipse/swt/printing/Printer.java b/bundles/org.eclipse.swt/Eclipse SWT Printing/win32/org/eclipse/swt/printing/Printer.java index cf02a0e55a..9cbc5485e6 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT Printing/win32/org/eclipse/swt/printing/Printer.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Printing/win32/org/eclipse/swt/printing/Printer.java @@ -251,6 +251,14 @@ protected void create(DeviceData deviceData) { devmode.dmFields |= OS.DM_COLLATE; devmode.dmCollate = OS.DMCOLLATE_TRUE; } + if (data.duplex != SWT.DEFAULT) { + devmode.dmFields |= OS.DM_DUPLEX; + switch (data.duplex) { + case PrinterData.DUPLEX_SHORT_EDGE: devmode.dmDuplex = OS.DMDUP_HORIZONTAL; break; + case PrinterData.DUPLEX_LONG_EDGE: devmode.dmDuplex = OS.DMDUP_VERTICAL; break; + default: devmode.dmDuplex = OS.DMDUP_SIMPLEX; + } + } OS.MoveMemory(lpInitData, devmode, DEVMODE.sizeof); handle = OS.CreateDC(driver, device, 0, lpInitData); |