### Eclipse Workspace Patch 1.0 #P org.eclipse.swt Index: Eclipse SWT PI/cocoa/library/os.c =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os.c,v retrieving revision 1.120 diff -u -r1.120 os.c --- Eclipse SWT PI/cocoa/library/os.c 18 Jan 2010 21:50:07 -0000 1.120 +++ Eclipse SWT PI/cocoa/library/os.c 11 Feb 2010 12:39:24 -0000 @@ -834,6 +834,30 @@ } #endif +#ifndef NO_CFArrayGetCount +JNIEXPORT jintLong JNICALL OS_NATIVE(CFArrayGetCount) + (JNIEnv *env, jclass that, jint arg0) +{ + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, CFArrayGetCount_FUNC); + rc = (jintLong)CFArrayGetCount((CFArrayRef)arg0); + OS_NATIVE_EXIT(env, that, CFArrayGetCount_FUNC); + return rc; +} +#endif + +#ifndef NO_CFArrayGetValueAtIndex +JNIEXPORT jintLong JNICALL OS_NATIVE(CFArrayGetValueAtIndex) + (JNIEnv *env, jclass that, jintLong arg0, jint arg1) +{ + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, CFArrayGetValueAtIndex_FUNC); + rc = (jintLong)CFArrayGetValueAtIndex((CFArrayRef)arg0, (CFIndex)arg1); + OS_NATIVE_EXIT(env, that, CFArrayGetValueAtIndex_FUNC); + return rc; +} +#endif + #ifndef NO_CFAttributedStringCreate JNIEXPORT jintLong JNICALL OS_NATIVE(CFAttributedStringCreate) (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jintLong arg2) @@ -892,6 +916,38 @@ } #endif +#ifndef NO_CFNumberCreate +JNIEXPORT jintLong JNICALL OS_NATIVE(CFNumberCreate) + (JNIEnv *env, jclass that, jintLong arg0, jint arg1, jintArray arg2) +{ + jint *lparg2=NULL; + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, CFNumberCreate_FUNC); + if (arg2) if ((lparg2 = (*env)->GetIntArrayElements(env, arg2, NULL)) == NULL) goto fail; + rc = (jintLong)CFNumberCreate((CFAllocatorRef)arg0, (CFNumberType)arg1, (const void *)lparg2); +fail: + if (arg2 && lparg2) (*env)->ReleaseIntArrayElements(env, arg2, lparg2, 0); + OS_NATIVE_EXIT(env, that, CFNumberCreate_FUNC); + return rc; +} +#endif + +#ifndef NO_CFNumberGetValue +JNIEXPORT jboolean JNICALL OS_NATIVE(CFNumberGetValue) + (JNIEnv *env, jclass that, jintLong arg0, jint arg1, jintArray arg2) +{ + jint *lparg2=NULL; + jboolean rc = 0; + OS_NATIVE_ENTER(env, that, CFNumberGetValue_FUNC); + if (arg2) if ((lparg2 = (*env)->GetIntArrayElements(env, arg2, NULL)) == NULL) goto fail; + rc = (jboolean)CFNumberGetValue((CFNumberRef)arg0, (CFNumberType)arg1, (void *)lparg2); +fail: + if (arg2 && lparg2) (*env)->ReleaseIntArrayElements(env, arg2, lparg2, 0); + OS_NATIVE_EXIT(env, that, CFNumberGetValue_FUNC); + return rc; +} +#endif + #ifndef NO_CFRange_1sizeof JNIEXPORT jint JNICALL OS_NATIVE(CFRange_1sizeof) (JNIEnv *env, jclass that) @@ -2303,6 +2359,48 @@ } #endif +#ifndef NO_JSEvaluateScript +JNIEXPORT jintLong JNICALL OS_NATIVE(JSEvaluateScript) + (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jintLong arg2, jintLong arg3, jint arg4, jintLongArray arg5) +{ + jintLong *lparg5=NULL; + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, JSEvaluateScript_FUNC); + if (arg5) if ((lparg5 = (*env)->GetIntLongArrayElements(env, arg5, NULL)) == NULL) goto fail; + rc = (jintLong)JSEvaluateScript((JSContextRef)arg0, (JSStringRef)arg1, (JSObjectRef)arg2, (JSStringRef)arg3, arg4, (JSValueRef *)lparg5); +fail: + if (arg5 && lparg5) (*env)->ReleaseIntLongArrayElements(env, arg5, lparg5, 0); + OS_NATIVE_EXIT(env, that, JSEvaluateScript_FUNC); + return rc; +} +#endif + +#ifndef NO_JSStringCreateWithUTF8CString +JNIEXPORT jintLong JNICALL OS_NATIVE(JSStringCreateWithUTF8CString) + (JNIEnv *env, jclass that, jbyteArray arg0) +{ + jbyte *lparg0=NULL; + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, JSStringCreateWithUTF8CString_FUNC); + if (arg0) if ((lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL)) == NULL) goto fail; + rc = (jintLong)JSStringCreateWithUTF8CString((const char *)lparg0); +fail: + if (arg0 && lparg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0); + OS_NATIVE_EXIT(env, that, JSStringCreateWithUTF8CString_FUNC); + return rc; +} +#endif + +#ifndef NO_JSStringRelease +JNIEXPORT void JNICALL OS_NATIVE(JSStringRelease) + (JNIEnv *env, jclass that, jintLong arg0) +{ + OS_NATIVE_ENTER(env, that, JSStringRelease_FUNC); + JSStringRelease((JSStringRef)arg0); + OS_NATIVE_EXIT(env, that, JSStringRelease_FUNC); +} +#endif + #ifndef NO_LMGetKbdType JNIEXPORT jbyte JNICALL OS_NATIVE(LMGetKbdType) (JNIEnv *env, jclass that) @@ -3963,6 +4061,18 @@ } #endif +#ifndef NO_NSOutlineViewColumnDidMoveNotification +JNIEXPORT jintLong JNICALL OS_NATIVE(NSOutlineViewColumnDidMoveNotification) + (JNIEnv *env, jclass that) +{ + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, NSOutlineViewColumnDidMoveNotification_FUNC); + rc = (jintLong)NSOutlineViewColumnDidMoveNotification; + OS_NATIVE_EXIT(env, that, NSOutlineViewColumnDidMoveNotification_FUNC); + return rc; +} +#endif + #ifndef NO_NSParagraphStyleAttributeName JNIEXPORT jintLong JNICALL OS_NATIVE(NSParagraphStyleAttributeName) (JNIEnv *env, jclass that) @@ -4078,6 +4188,30 @@ } #endif +#ifndef NO_NSPrintPagesAcross +JNIEXPORT jintLong JNICALL OS_NATIVE(NSPrintPagesAcross) + (JNIEnv *env, jclass that) +{ + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, NSPrintPagesAcross_FUNC); + rc = (jintLong)NSPrintPagesAcross; + OS_NATIVE_EXIT(env, that, NSPrintPagesAcross_FUNC); + return rc; +} +#endif + +#ifndef NO_NSPrintPagesDown +JNIEXPORT jintLong JNICALL OS_NATIVE(NSPrintPagesDown) + (JNIEnv *env, jclass that) +{ + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, NSPrintPagesDown_FUNC); + rc = (jintLong)NSPrintPagesDown; + OS_NATIVE_EXIT(env, that, NSPrintPagesDown_FUNC); + return rc; +} +#endif + #ifndef NO_NSPrintPreviewJob JNIEXPORT jintLong JNICALL OS_NATIVE(NSPrintPreviewJob) (JNIEnv *env, jclass that) @@ -4090,6 +4224,18 @@ } #endif +#ifndef NO_NSPrintPrinterName +JNIEXPORT jintLong JNICALL OS_NATIVE(NSPrintPrinterName) + (JNIEnv *env, jclass that) +{ + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, NSPrintPrinterName_FUNC); + rc = (jintLong)NSPrintPrinterName; + OS_NATIVE_EXIT(env, that, NSPrintPrinterName_FUNC); + return rc; +} +#endif + #ifndef NO_NSPrintSaveJob JNIEXPORT jintLong JNICALL OS_NATIVE(NSPrintSaveJob) (JNIEnv *env, jclass that) @@ -4270,6 +4416,18 @@ } #endif +#ifndef NO_NSTableViewColumnDidMoveNotification +JNIEXPORT jintLong JNICALL OS_NATIVE(NSTableViewColumnDidMoveNotification) + (JNIEnv *env, jclass that) +{ + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, NSTableViewColumnDidMoveNotification_FUNC); + rc = (jintLong)NSTableViewColumnDidMoveNotification; + OS_NATIVE_EXIT(env, that, NSTableViewColumnDidMoveNotification_FUNC); + return rc; +} +#endif + #ifndef NO_NSTemporaryDirectory JNIEXPORT jintLong JNICALL OS_NATIVE(NSTemporaryDirectory) (JNIEnv *env, jclass that) @@ -4506,6 +4664,393 @@ } #endif +#ifndef NO_PMCopyPageFormat +JNIEXPORT jintLong JNICALL OS_NATIVE(PMCopyPageFormat) + (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1) +{ + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, PMCopyPageFormat_FUNC); + rc = (jintLong)PMCopyPageFormat((PMPageFormat)arg0, (PMPageFormat)arg1); + OS_NATIVE_EXIT(env, that, PMCopyPageFormat_FUNC); + return rc; +} +#endif + +#ifndef NO_PMCreatePageFormatWithPMPaper +JNIEXPORT jintLong JNICALL OS_NATIVE(PMCreatePageFormatWithPMPaper) + (JNIEnv *env, jclass that, jintArray arg0, jintLong arg1) +{ + jint *lparg0=NULL; + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, PMCreatePageFormatWithPMPaper_FUNC); + if (arg0) if ((lparg0 = (*env)->GetIntArrayElements(env, arg0, NULL)) == NULL) goto fail; + rc = (jintLong)PMCreatePageFormatWithPMPaper((PMPageFormat*)lparg0, (PMPaper)arg1); +fail: + if (arg0 && lparg0) (*env)->ReleaseIntArrayElements(env, arg0, lparg0, 0); + OS_NATIVE_EXIT(env, that, PMCreatePageFormatWithPMPaper_FUNC); + return rc; +} +#endif + +#ifndef NO_PMCreatePrintSettings +JNIEXPORT jintLong JNICALL OS_NATIVE(PMCreatePrintSettings) + (JNIEnv *env, jclass that, jintArray arg0) +{ + jint *lparg0=NULL; + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, PMCreatePrintSettings_FUNC); + if (arg0) if ((lparg0 = (*env)->GetIntArrayElements(env, arg0, NULL)) == NULL) goto fail; + rc = (jintLong)PMCreatePrintSettings((PMPrintSettings*)lparg0); +fail: + if (arg0 && lparg0) (*env)->ReleaseIntArrayElements(env, arg0, lparg0, 0); + OS_NATIVE_EXIT(env, that, PMCreatePrintSettings_FUNC); + return rc; +} +#endif + +#ifndef NO_PMCreateSession +JNIEXPORT jint JNICALL OS_NATIVE(PMCreateSession) + (JNIEnv *env, jclass that, jintArray arg0) +{ + jint *lparg0=NULL; + jint rc = 0; + OS_NATIVE_ENTER(env, that, PMCreateSession_FUNC); + if (arg0) if ((lparg0 = (*env)->GetIntArrayElements(env, arg0, NULL)) == NULL) goto fail; + rc = (jint)PMCreateSession((PMPrintSession*)lparg0); +fail: + if (arg0 && lparg0) (*env)->ReleaseIntArrayElements(env, arg0, lparg0, 0); + OS_NATIVE_EXIT(env, that, PMCreateSession_FUNC); + return rc; +} +#endif + +#ifndef NO_PMGetDuplex +JNIEXPORT void JNICALL OS_NATIVE(PMGetDuplex) + (JNIEnv *env, jclass that, jintLong arg0, jintArray arg1) +{ + jint *lparg1=NULL; + OS_NATIVE_ENTER(env, that, PMGetDuplex_FUNC); + if (arg1) if ((lparg1 = (*env)->GetIntArrayElements(env, arg1, NULL)) == NULL) goto fail; + PMGetDuplex((PMPrintSettings)arg0, (PMDuplexMode*)lparg1); +fail: + if (arg1 && lparg1) (*env)->ReleaseIntArrayElements(env, arg1, lparg1, 0); + OS_NATIVE_EXIT(env, that, PMGetDuplex_FUNC); +} +#endif + +#ifndef NO_PMGetPageFormatPaper +JNIEXPORT jintLong JNICALL OS_NATIVE(PMGetPageFormatPaper) + (JNIEnv *env, jclass that, jint arg0, jintArray arg1) +{ + jint *lparg1=NULL; + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, PMGetPageFormatPaper_FUNC); + if (arg1) if ((lparg1 = (*env)->GetIntArrayElements(env, arg1, NULL)) == NULL) goto fail; + rc = (jintLong)PMGetPageFormatPaper((PMPageFormat)arg0, (PMPaper*)lparg1); +fail: + if (arg1 && lparg1) (*env)->ReleaseIntArrayElements(env, arg1, lparg1, 0); + OS_NATIVE_EXIT(env, that, PMGetPageFormatPaper_FUNC); + return rc; +} +#endif + +#ifndef NO_PMPageFormatGetPrinterID +JNIEXPORT jintLong JNICALL OS_NATIVE(PMPageFormatGetPrinterID) + (JNIEnv *env, jclass that, jintLong arg0, jintArray arg1) +{ + jint *lparg1=NULL; + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, PMPageFormatGetPrinterID_FUNC); + if (arg1) if ((lparg1 = (*env)->GetIntArrayElements(env, arg1, NULL)) == NULL) goto fail; + rc = (jintLong)PMPageFormatGetPrinterID((PMPageFormat)arg0, (CFStringRef*)lparg1); +fail: + if (arg1 && lparg1) (*env)->ReleaseIntArrayElements(env, arg1, lparg1, 0); + OS_NATIVE_EXIT(env, that, PMPageFormatGetPrinterID_FUNC); + return rc; +} +#endif + +#ifndef NO_PMPaperCreateCustom +JNIEXPORT jintLong JNICALL OS_NATIVE(PMPaperCreateCustom) + (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jintLong arg2, jdouble arg3, jdouble arg4, jdoubleArray arg5, jintArray arg6) +{ + jdouble *lparg5=NULL; + jint *lparg6=NULL; + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, PMPaperCreateCustom_FUNC); + if (arg5) if ((lparg5 = (*env)->GetDoubleArrayElements(env, arg5, NULL)) == NULL) goto fail; + if (arg6) if ((lparg6 = (*env)->GetIntArrayElements(env, arg6, NULL)) == NULL) goto fail; + rc = (jintLong)PMPaperCreateCustom((PMPrinter)arg0, (CFStringRef)arg1, (CFStringRef)arg2, (double)arg3, (double)arg4, (const PMPaperMargins*)lparg5, (PMPaper*)lparg6); +fail: + if (arg6 && lparg6) (*env)->ReleaseIntArrayElements(env, arg6, lparg6, 0); + if (arg5 && lparg5) (*env)->ReleaseDoubleArrayElements(env, arg5, lparg5, 0); + OS_NATIVE_EXIT(env, that, PMPaperCreateCustom_FUNC); + return rc; +} +#endif + +#ifndef NO_PMPaperCreateLocalizedName +JNIEXPORT jintLong JNICALL OS_NATIVE(PMPaperCreateLocalizedName) + (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jintArray arg2) +{ + jint *lparg2=NULL; + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, PMPaperCreateLocalizedName_FUNC); + if (arg2) if ((lparg2 = (*env)->GetIntArrayElements(env, arg2, NULL)) == NULL) goto fail; + rc = (jintLong)PMPaperCreateLocalizedName((PMPaper)arg0, (PMPrinter)arg1, (CFStringRef*)lparg2); +fail: + if (arg2 && lparg2) (*env)->ReleaseIntArrayElements(env, arg2, lparg2, 0); + OS_NATIVE_EXIT(env, that, PMPaperCreateLocalizedName_FUNC); + return rc; +} +#endif + +#ifndef NO_PMPaperGetHeight +JNIEXPORT jintLong JNICALL OS_NATIVE(PMPaperGetHeight) + (JNIEnv *env, jclass that, jintLong arg0, jdoubleArray arg1) +{ + jdouble *lparg1=NULL; + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, PMPaperGetHeight_FUNC); + if (arg1) if ((lparg1 = (*env)->GetDoubleArrayElements(env, arg1, NULL)) == NULL) goto fail; + rc = (jintLong)PMPaperGetHeight((PMPaper)arg0, (double*)lparg1); +fail: + if (arg1 && lparg1) (*env)->ReleaseDoubleArrayElements(env, arg1, lparg1, 0); + OS_NATIVE_EXIT(env, that, PMPaperGetHeight_FUNC); + return rc; +} +#endif + +#ifndef NO_PMPaperGetID +JNIEXPORT jintLong JNICALL OS_NATIVE(PMPaperGetID) + (JNIEnv *env, jclass that, jintLong arg0, jintArray arg1) +{ + jint *lparg1=NULL; + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, PMPaperGetID_FUNC); + if (arg1) if ((lparg1 = (*env)->GetIntArrayElements(env, arg1, NULL)) == NULL) goto fail; + rc = (jintLong)PMPaperGetID((PMPrinter)arg0, (CFStringRef*)lparg1); +fail: + if (arg1 && lparg1) (*env)->ReleaseIntArrayElements(env, arg1, lparg1, 0); + OS_NATIVE_EXIT(env, that, PMPaperGetID_FUNC); + return rc; +} +#endif + +#ifndef NO_PMPaperGetName +JNIEXPORT jintLong JNICALL OS_NATIVE(PMPaperGetName) + (JNIEnv *env, jclass that, jintLong arg0, jintArray arg1) +{ + jint *lparg1=NULL; + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, PMPaperGetName_FUNC); + if (arg1) if ((lparg1 = (*env)->GetIntArrayElements(env, arg1, NULL)) == NULL) goto fail; + rc = (jintLong)PMPaperGetName((PMPaper)arg0, (CFStringRef*)lparg1); +fail: + if (arg1 && lparg1) (*env)->ReleaseIntArrayElements(env, arg1, lparg1, 0); + OS_NATIVE_EXIT(env, that, PMPaperGetName_FUNC); + return rc; +} +#endif + +#ifndef NO_PMPaperGetWidth +JNIEXPORT jintLong JNICALL OS_NATIVE(PMPaperGetWidth) + (JNIEnv *env, jclass that, jintLong arg0, jdoubleArray arg1) +{ + jdouble *lparg1=NULL; + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, PMPaperGetWidth_FUNC); + if (arg1) if ((lparg1 = (*env)->GetDoubleArrayElements(env, arg1, NULL)) == NULL) goto fail; + rc = (jintLong)PMPaperGetWidth((PMPaper)arg0, (double*)lparg1); +fail: + if (arg1 && lparg1) (*env)->ReleaseDoubleArrayElements(env, arg1, lparg1, 0); + OS_NATIVE_EXIT(env, that, PMPaperGetWidth_FUNC); + return rc; +} +#endif + +#ifndef NO_PMPaperIsCustom +JNIEXPORT jboolean JNICALL OS_NATIVE(PMPaperIsCustom) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jboolean rc = 0; + OS_NATIVE_ENTER(env, that, PMPaperIsCustom_FUNC); + rc = (jboolean)PMPaperIsCustom((PMPaper)arg0); + OS_NATIVE_EXIT(env, that, PMPaperIsCustom_FUNC); + return rc; +} +#endif + +#ifndef NO_PMPrintSettingsCopyKeys +JNIEXPORT jint JNICALL OS_NATIVE(PMPrintSettingsCopyKeys) + (JNIEnv *env, jclass that, jintLong arg0, jintArray arg1) +{ + jint *lparg1=NULL; + jint rc = 0; + OS_NATIVE_ENTER(env, that, PMPrintSettingsCopyKeys_FUNC); + if (arg1) if ((lparg1 = (*env)->GetIntArrayElements(env, arg1, NULL)) == NULL) goto fail; + rc = (jint)PMPrintSettingsCopyKeys((PMPrintSettings)arg0, (CFArrayRef*)lparg1); +fail: + if (arg1 && lparg1) (*env)->ReleaseIntArrayElements(env, arg1, lparg1, 0); + OS_NATIVE_EXIT(env, that, PMPrintSettingsCopyKeys_FUNC); + return rc; +} +#endif + +#ifndef NO_PMPrintSettingsGetValue +JNIEXPORT jint JNICALL OS_NATIVE(PMPrintSettingsGetValue) + (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jintArray arg2) +{ + jint *lparg2=NULL; + jint rc = 0; + OS_NATIVE_ENTER(env, that, PMPrintSettingsGetValue_FUNC); + if (arg2) if ((lparg2 = (*env)->GetIntArrayElements(env, arg2, NULL)) == NULL) goto fail; + rc = (jint)PMPrintSettingsGetValue((PMPrintSettings)arg0, (CFStringRef)arg1, (CFTypeRef*)lparg2); +fail: + if (arg2 && lparg2) (*env)->ReleaseIntArrayElements(env, arg2, lparg2, 0); + OS_NATIVE_EXIT(env, that, PMPrintSettingsGetValue_FUNC); + return rc; +} +#endif + +#ifndef NO_PMPrintSettingsSetValue +JNIEXPORT jint JNICALL OS_NATIVE(PMPrintSettingsSetValue) + (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jint arg2, jboolean arg3) +{ + jint rc = 0; + OS_NATIVE_ENTER(env, that, PMPrintSettingsSetValue_FUNC); + rc = (jint)PMPrintSettingsSetValue((PMPrintSettings)arg0, (CFStringRef)arg1, (CFTypeRef)arg2, (Boolean)arg3); + OS_NATIVE_EXIT(env, that, PMPrintSettingsSetValue_FUNC); + return rc; +} +#endif + +#ifndef NO_PMPrinterCreateFromPrinterID +JNIEXPORT jintLong JNICALL OS_NATIVE(PMPrinterCreateFromPrinterID) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, PMPrinterCreateFromPrinterID_FUNC); + rc = (jintLong)PMPrinterCreateFromPrinterID((CFStringRef)arg0); + OS_NATIVE_EXIT(env, that, PMPrinterCreateFromPrinterID_FUNC); + return rc; +} +#endif + +#ifndef NO_PMPrinterGetMimeTypes +JNIEXPORT jintLong JNICALL OS_NATIVE(PMPrinterGetMimeTypes) + (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jintArray arg2) +{ + jint *lparg2=NULL; + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, PMPrinterGetMimeTypes_FUNC); + if (arg2) if ((lparg2 = (*env)->GetIntArrayElements(env, arg2, NULL)) == NULL) goto fail; + rc = (jintLong)PMPrinterGetMimeTypes((PMPrinter)arg0, (PMPrintSettings)arg1, (CFArrayRef*)lparg2); +fail: + if (arg2 && lparg2) (*env)->ReleaseIntArrayElements(env, arg2, lparg2, 0); + OS_NATIVE_EXIT(env, that, PMPrinterGetMimeTypes_FUNC); + return rc; +} +#endif + +#ifndef NO_PMPrinterGetName +JNIEXPORT jintLong JNICALL OS_NATIVE(PMPrinterGetName) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, PMPrinterGetName_FUNC); + rc = (jintLong)PMPrinterGetName((PMPrinter)arg0); + OS_NATIVE_EXIT(env, that, PMPrinterGetName_FUNC); + return rc; +} +#endif + +#ifndef NO_PMPrinterGetOutputResolution +JNIEXPORT jintLong JNICALL OS_NATIVE(PMPrinterGetOutputResolution) + (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jdoubleArray arg2) +{ + jdouble *lparg2=NULL; + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, PMPrinterGetOutputResolution_FUNC); + if (arg2) if ((lparg2 = (*env)->GetDoubleArrayElements(env, arg2, NULL)) == NULL) goto fail; + rc = (jintLong)PMPrinterGetOutputResolution((PMPrinter)arg0, (PMPrintSettings)arg1, lparg2); +fail: + if (arg2 && lparg2) (*env)->ReleaseDoubleArrayElements(env, arg2, lparg2, 0); + OS_NATIVE_EXIT(env, that, PMPrinterGetOutputResolution_FUNC); + return rc; +} +#endif + +#ifndef NO_PMPrinterGetPaperList +JNIEXPORT jintLong JNICALL OS_NATIVE(PMPrinterGetPaperList) + (JNIEnv *env, jclass that, jintLong arg0, jintArray arg1) +{ + jint *lparg1=NULL; + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, PMPrinterGetPaperList_FUNC); + if (arg1) if ((lparg1 = (*env)->GetIntArrayElements(env, arg1, NULL)) == NULL) goto fail; + rc = (jintLong)PMPrinterGetPaperList((PMPrinter)arg0, (CFArrayRef*)lparg1); +fail: + if (arg1 && lparg1) (*env)->ReleaseIntArrayElements(env, arg1, lparg1, 0); + OS_NATIVE_EXIT(env, that, PMPrinterGetPaperList_FUNC); + return rc; +} +#endif + +#ifndef NO_PMPrinterSetOutputResolution +JNIEXPORT jintLong JNICALL OS_NATIVE(PMPrinterSetOutputResolution) + (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jdoubleArray arg2) +{ + jdouble *lparg2=NULL; + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, PMPrinterSetOutputResolution_FUNC); + if (arg2) if ((lparg2 = (*env)->GetDoubleArrayElements(env, arg2, NULL)) == NULL) goto fail; + rc = (jintLong)PMPrinterSetOutputResolution((PMPrinter)arg0, (PMPrintSettings)arg1, lparg2); +fail: + if (arg2 && lparg2) (*env)->ReleaseDoubleArrayElements(env, arg2, lparg2, 0); + OS_NATIVE_EXIT(env, that, PMPrinterSetOutputResolution_FUNC); + return rc; +} +#endif + +#ifndef NO_PMRelease +JNIEXPORT jint JNICALL OS_NATIVE(PMRelease) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jint rc = 0; + OS_NATIVE_ENTER(env, that, PMRelease_FUNC); + rc = (jint)PMRelease((PMObject)arg0); + OS_NATIVE_EXIT(env, that, PMRelease_FUNC); + return rc; +} +#endif + +#ifndef NO_PMSessionGetCurrentPrinter +JNIEXPORT jint JNICALL OS_NATIVE(PMSessionGetCurrentPrinter) + (JNIEnv *env, jclass that, jintLong arg0, jintArray arg1) +{ + jint *lparg1=NULL; + jint rc = 0; + OS_NATIVE_ENTER(env, that, PMSessionGetCurrentPrinter_FUNC); + if (arg1) if ((lparg1 = (*env)->GetIntArrayElements(env, arg1, NULL)) == NULL) goto fail; + rc = (jint)PMSessionGetCurrentPrinter((PMPrintSession)arg0, (PMPrinter*)lparg1); +fail: + if (arg1 && lparg1) (*env)->ReleaseIntArrayElements(env, arg1, lparg1, 0); + OS_NATIVE_EXIT(env, that, PMSessionGetCurrentPrinter_FUNC); + return rc; +} +#endif + +#ifndef NO_PMSetDuplex +JNIEXPORT void JNICALL OS_NATIVE(PMSetDuplex) + (JNIEnv *env, jclass that, jintLong arg0, jint arg1) +{ + OS_NATIVE_ENTER(env, that, PMSetDuplex_FUNC); + PMSetDuplex((PMPrintSettings)arg0, (PMDuplexMode)arg1); + OS_NATIVE_EXIT(env, that, PMSetDuplex_FUNC); +} +#endif + #ifndef NO_PtInRgn JNIEXPORT jboolean JNICALL OS_NATIVE(PtInRgn) (JNIEnv *env, jclass that, jshortArray arg0, jintLong arg1) Index: Eclipse SWT PI/cocoa/library/os_stats.c =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.c,v retrieving revision 1.111 diff -u -r1.111 os_stats.c --- Eclipse SWT PI/cocoa/library/os_stats.c 18 Jan 2010 21:50:07 -0000 1.111 +++ Eclipse SWT PI/cocoa/library/os_stats.c 11 Feb 2010 12:39:24 -0000 @@ -14,8 +14,8 @@ #ifdef NATIVE_STATS -int OS_nativeFunctionCount = 533; -int OS_nativeFunctionCallCount[533]; +int OS_nativeFunctionCount = 571; +int OS_nativeFunctionCallCount[571]; char * OS_nativeFunctionNames[] = { "ATSFontActivateFromFileReference", "AcquireRootMenu", @@ -54,11 +54,15 @@ "CALLBACK_1titleRectForBounds_1", "CALLBACK_1view_1stringForToolTip_1point_1userData_1", "CALLBACK_1webView_1setFrame_1", + "CFArrayGetCount", + "CFArrayGetValueAtIndex", "CFAttributedStringCreate", "CFDataGetBytePtr", "CFDataGetLength", "CFDictionaryAddValue", "CFDictionaryCreateMutable", + "CFNumberCreate", + "CFNumberGetValue", "CFRange_1sizeof", "CFRelease", "CFRunLoopAddObserver", @@ -167,6 +171,9 @@ "GetThemeMetric", "HIThemeDrawFocusRect", "JNIGetObject", + "JSEvaluateScript", + "JSStringCreateWithUTF8CString", + "JSStringRelease", "LMGetKbdType", "LSGetApplicationForInfo", "LineTo", @@ -303,6 +310,7 @@ "NSLinkAttributeName", "NSNumberOfColorComponents", "NSObliquenessAttributeName", + "NSOutlineViewColumnDidMoveNotification", "NSParagraphStyleAttributeName", "NSPointInRect", "NSPoint_1sizeof", @@ -312,7 +320,10 @@ "NSPrintJobDisposition", "NSPrintLastPage", "NSPrintMustCollate", + "NSPrintPagesAcross", + "NSPrintPagesDown", "NSPrintPreviewJob", + "NSPrintPrinterName", "NSPrintSaveJob", "NSPrintSavePath", "NSPrintScalingFactor", @@ -328,6 +339,7 @@ "NSStrokeWidthAttributeName", "NSSystemColorsDidChangeNotification", "NSTIFFPboardType", + "NSTableViewColumnDidMoveNotification", "NSTemporaryDirectory", "NSToolbarCustomizeToolbarItemIdentifier", "NSToolbarDidRemoveItemNotification", @@ -346,6 +358,32 @@ "NewRgn", "OffsetRgn", "OpenRgn", + "PMCopyPageFormat", + "PMCreatePageFormatWithPMPaper", + "PMCreatePrintSettings", + "PMCreateSession", + "PMGetDuplex", + "PMGetPageFormatPaper", + "PMPageFormatGetPrinterID", + "PMPaperCreateCustom", + "PMPaperCreateLocalizedName", + "PMPaperGetHeight", + "PMPaperGetID", + "PMPaperGetName", + "PMPaperGetWidth", + "PMPaperIsCustom", + "PMPrintSettingsCopyKeys", + "PMPrintSettingsGetValue", + "PMPrintSettingsSetValue", + "PMPrinterCreateFromPrinterID", + "PMPrinterGetMimeTypes", + "PMPrinterGetName", + "PMPrinterGetOutputResolution", + "PMPrinterGetPaperList", + "PMPrinterSetOutputResolution", + "PMRelease", + "PMSessionGetCurrentPrinter", + "PMSetDuplex", "PtInRgn", "QDRegionToRects", "RectInRgn", Index: Eclipse SWT PI/cocoa/library/os_stats.h =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.h,v retrieving revision 1.111 diff -u -r1.111 os_stats.h --- Eclipse SWT PI/cocoa/library/os_stats.h 18 Jan 2010 21:50:07 -0000 1.111 +++ Eclipse SWT PI/cocoa/library/os_stats.h 11 Feb 2010 12:39:25 -0000 @@ -62,11 +62,15 @@ CALLBACK_1titleRectForBounds_1_FUNC, CALLBACK_1view_1stringForToolTip_1point_1userData_1_FUNC, CALLBACK_1webView_1setFrame_1_FUNC, + CFArrayGetCount_FUNC, + CFArrayGetValueAtIndex_FUNC, CFAttributedStringCreate_FUNC, CFDataGetBytePtr_FUNC, CFDataGetLength_FUNC, CFDictionaryAddValue_FUNC, CFDictionaryCreateMutable_FUNC, + CFNumberCreate_FUNC, + CFNumberGetValue_FUNC, CFRange_1sizeof_FUNC, CFRelease_FUNC, CFRunLoopAddObserver_FUNC, @@ -175,6 +179,9 @@ GetThemeMetric_FUNC, HIThemeDrawFocusRect_FUNC, JNIGetObject_FUNC, + JSEvaluateScript_FUNC, + JSStringCreateWithUTF8CString_FUNC, + JSStringRelease_FUNC, LMGetKbdType_FUNC, LSGetApplicationForInfo_FUNC, LineTo_FUNC, @@ -311,6 +318,7 @@ NSLinkAttributeName_FUNC, NSNumberOfColorComponents_FUNC, NSObliquenessAttributeName_FUNC, + NSOutlineViewColumnDidMoveNotification_FUNC, NSParagraphStyleAttributeName_FUNC, NSPointInRect_FUNC, NSPoint_1sizeof_FUNC, @@ -320,7 +328,10 @@ NSPrintJobDisposition_FUNC, NSPrintLastPage_FUNC, NSPrintMustCollate_FUNC, + NSPrintPagesAcross_FUNC, + NSPrintPagesDown_FUNC, NSPrintPreviewJob_FUNC, + NSPrintPrinterName_FUNC, NSPrintSaveJob_FUNC, NSPrintSavePath_FUNC, NSPrintScalingFactor_FUNC, @@ -336,6 +347,7 @@ NSStrokeWidthAttributeName_FUNC, NSSystemColorsDidChangeNotification_FUNC, NSTIFFPboardType_FUNC, + NSTableViewColumnDidMoveNotification_FUNC, NSTemporaryDirectory_FUNC, NSToolbarCustomizeToolbarItemIdentifier_FUNC, NSToolbarDidRemoveItemNotification_FUNC, @@ -354,6 +366,32 @@ NewRgn_FUNC, OffsetRgn_FUNC, OpenRgn_FUNC, + PMCopyPageFormat_FUNC, + PMCreatePageFormatWithPMPaper_FUNC, + PMCreatePrintSettings_FUNC, + PMCreateSession_FUNC, + PMGetDuplex_FUNC, + PMGetPageFormatPaper_FUNC, + PMPageFormatGetPrinterID_FUNC, + PMPaperCreateCustom_FUNC, + PMPaperCreateLocalizedName_FUNC, + PMPaperGetHeight_FUNC, + PMPaperGetID_FUNC, + PMPaperGetName_FUNC, + PMPaperGetWidth_FUNC, + PMPaperIsCustom_FUNC, + PMPrintSettingsCopyKeys_FUNC, + PMPrintSettingsGetValue_FUNC, + PMPrintSettingsSetValue_FUNC, + PMPrinterCreateFromPrinterID_FUNC, + PMPrinterGetMimeTypes_FUNC, + PMPrinterGetName_FUNC, + PMPrinterGetOutputResolution_FUNC, + PMPrinterGetPaperList_FUNC, + PMPrinterSetOutputResolution_FUNC, + PMRelease_FUNC, + PMSessionGetCurrentPrinter_FUNC, + PMSetDuplex_FUNC, PtInRgn_FUNC, QDRegionToRects_FUNC, RectInRgn_FUNC, Index: Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSPrintInfo.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSPrintInfo.java,v retrieving revision 1.12 diff -u -r1.12 NSPrintInfo.java --- Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSPrintInfo.java 1 Jul 2009 14:49:14 -0000 1.12 +++ Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSPrintInfo.java 11 Feb 2010 12:39:25 -0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2010 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -24,6 +24,14 @@ super(id); } +public int /*long*/ PMPrintSession() { + return OS.objc_msgSend(this.id, OS.sel_PMPrintSession); +} + +public int /*long*/ PMPrintSettings() { + return OS.objc_msgSend(this.id, OS.sel_PMPrintSettings); +} + public static NSPrinter defaultPrinter() { int /*long*/ result = OS.objc_msgSend(OS.class_NSPrintInfo, OS.sel_defaultPrinter); return result != 0 ? new NSPrinter(result) : null; @@ -45,6 +53,14 @@ return result == this.id ? this : (result != 0 ? new NSPrintInfo(result) : null); } +public void setPaperName (NSString paperName) { + OS.objc_msgSend(this.id, OS.sel_setPaperName, paperName != null ? paperName.id : 0); +} + +public void setPaperSize (NSSize paperSize) { + OS.objc_msgSend(this.id, OS.sel_setPaperSize, paperSize != null ? paperSize : null); +} + public NSString jobDisposition() { int /*long*/ result = OS.objc_msgSend(this.id, OS.sel_jobDisposition); return result != 0 ? new NSString(result) : null; @@ -60,6 +76,34 @@ return result; } +public NSString paperName() { + int /*long*/ result = OS.objc_msgSend(this.id, OS.sel_paperName); + return result != 0 ? new NSString(result) : null; +} + +public int /*long*/ pmPageFormat() { + return OS.objc_msgSend(this.id, OS.sel_pmPageFormat); +} + +public float bottomMargin () { + return OS.objc_msgSend(this.id, OS.sel_bottomMargin); +} + +public float topMargin () { + return OS.objc_msgSend(this.id, OS.sel_topMargin); +} + +public float leftMargin () { + return OS.objc_msgSend(this.id, OS.sel_leftMargin); +} + +public float rightMargin () { + return OS.objc_msgSend(this.id, OS.sel_rightMargin); +} + +public void updateFromPMPageFormat() { + OS.objc_msgSend(this.id, OS.sel_updateFromPMPageFormat); +} public NSPrinter printer() { int /*long*/ result = OS.objc_msgSend(this.id, OS.sel_printer); return result != 0 ? new NSPrinter(result) : null; @@ -86,4 +130,8 @@ return result != 0 ? new NSPrintInfo(result) : null; } +public void updateFromPMPrintSettings() { + OS.objc_msgSend(this.id, OS.sel_updateFromPMPrintSettings); +} + } Index: Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java,v retrieving revision 1.306 diff -u -r1.306 OS.java --- Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java 10 Feb 2010 22:08:00 -0000 1.306 +++ Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java 11 Feb 2010 12:39:27 -0000 @@ -659,6 +659,8 @@ public static final int /*long*/ sel_CGEvent = sel_registerName("CGEvent"); public static final int /*long*/ sel_DOMDocument = sel_registerName("DOMDocument"); public static final int /*long*/ sel_IBeamCursor = sel_registerName("IBeamCursor"); +public static final int /*long*/ sel_PMPrintSettings = sel_registerName("PMPrintSettings"); +public static final int /*long*/ sel_PMPrintSession = sel_registerName("PMPrintSession"); public static final int /*long*/ sel_TIFFRepresentation = sel_registerName("TIFFRepresentation"); public static final int /*long*/ sel_URL = sel_registerName("URL"); public static final int /*long*/ sel_URLFromPasteboard_ = sel_registerName("URLFromPasteboard:"); @@ -1184,6 +1186,15 @@ public static final int /*long*/ sel_itemObjectValueAtIndex_ = sel_registerName("itemObjectValueAtIndex:"); public static final int /*long*/ sel_itemTitleAtIndex_ = sel_registerName("itemTitleAtIndex:"); public static final int /*long*/ sel_jobDisposition = sel_registerName("jobDisposition"); +public static final int /*long*/ sel_setPaperName = sel_registerName("setPaperName:"); +public static final int /*long*/ sel_setPaperSize = sel_registerName("setPaperSize:"); +public static final int /*long*/ sel_paperName = sel_registerName("PaperName"); +public static final int /*long*/ sel_pmPageFormat = sel_registerName("PMPageFormat"); +public static final int /*long*/ sel_bottomMargin = sel_registerName("bottomMargin"); +public static final int /*long*/ sel_topMargin = sel_registerName("topMargin"); +public static final int /*long*/ sel_leftMargin = sel_registerName("leftMargin"); +public static final int /*long*/ sel_rightMargin = sel_registerName("rightMargin"); +public static final int /*long*/ sel_updateFromPMPageFormat = sel_registerName("updateFromPMPageFormat"); public static final int /*long*/ sel_keyCode = sel_registerName("keyCode"); public static final int /*long*/ sel_keyDown_ = sel_registerName("keyDown:"); public static final int /*long*/ sel_keyEquivalent = sel_registerName("keyEquivalent"); @@ -1837,6 +1848,7 @@ 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:"); @@ -1920,6 +1932,148 @@ public static final int /*long*/ sel_yearOfCommonEra = sel_registerName("yearOfCommonEra"); public static final int /*long*/ sel_zoom_ = sel_registerName("zoom:"); +/** + * @param settings cast=(PMPrintSettings) + * @param duplexMode cast=(PMDuplexMode) + * */ +public static final native void PMSetDuplex(int /*long*/ settings, int duplexMode); +/** + * @param settings cast=(PMPrintSettings) + * @param duplexMode cast=(PMDuplexMode*) + * */ +public static final native void PMGetDuplex(int /*long*/ settings, int[] duplexMode); +/** + * @param settings cast=(PMPrintSettings) + * @param key cast=(CFStringRef) + * @param value cast=(CFTypeRef) + * @param lock cast=(Boolean) + * */ +public static final native int PMPrintSettingsSetValue(int /*long*/ settings, int /*long*/ key, int value, boolean lock); +/** + * @param settings cast=(PMPrintSettings) + * @param key cast=(CFStringRef) + * @param value cast=(CFTypeRef*) + * */ +public static final native int PMPrintSettingsGetValue(int /*long*/ settings, int /*long*/ key, int[] value); +/** + * @param settings cast=(PMPrintSettings) + * @param settingKeys cast=(CFArrayRef*) + */ +public static final native int PMPrintSettingsCopyKeys(int /*long*/ settings, int[] settingKeys); +/** + * @param numberRef cast=(CFNumberRef) + * @param type cast=(CFNumberType) + * @param value cast=(void *) + */ +public static final native boolean CFNumberGetValue(int /*long*/ numberRef, int type, int[] value); +/** @param session cast=(PMPrintSession*) */ +public static final native int PMCreateSession(int[] session); +/** + * @param printSession cast=(PMPrintSession) + * @param printer cast=(PMPrinter*) + */ +public static final native int PMSessionGetCurrentPrinter(int /*long*/ printSession, int[] printer); +/** + * @param printer cast=(PMPrinter) + * @param paperList cast=(CFArrayRef*) + */ +public static final native int /*long*/ PMPrinterGetPaperList (int /*long*/ printer, int[] paperList); +/** @param object cast =(PMObject) */ +public static final native int PMRelease (int /*long*/ object); +/** @param array cast=(CFArrayRef) */ +public static final native int /*long*/ CFArrayGetCount (int array); +/** + * @param array cast=(CFArrayRef) + * @param index cast=(CFIndex) + */ +public static final native int /*long*/ CFArrayGetValueAtIndex (int /*long*/ array, int index); +/** + * @param pmPageFormat cast=(PMPageFormat) + * @param printerId cast=(CFStringRef*) + */ +public static final native int /*long*/ PMPageFormatGetPrinterID (int /*long*/ pmPageFormat, int[] printerId); +/** + * @param pmPageFormat cast=(PMPageFormat*) + * @param pmPaper cast=(PMPaper) + */ +public static final native int /*long*/ PMCreatePageFormatWithPMPaper (int[] pmPageFormat, int /*long*/ pmPaper); +/** + * @param pmPageFormat cast=(PMPageFormat) + * @param pmPaper cast=(PMPaper*) + */ +public static final native int /*long*/ PMGetPageFormatPaper (int/*long*/ pmPageFormat, int[] /*long*/ pmPaper); +/** @param pmPaper cast=(PMPaper) + * @param width cast=(double*) + */ +public static final native int /*long*/ PMPaperGetWidth (int /*long*/ pmPaper, double[] width); +/** @param pmPaper cast=(PMPaper) + * @param height cast=(double*) + */ +public static final native int /*long*/ PMPaperGetHeight (int /*long*/ pmPaper, double[] height); +/** + * @param formatSrc cast=(PMPageFormat) + * @param formatDest cast=(PMPageFormat) + */ +public static final native int /*long*/ PMCopyPageFormat (int /*long*/ formatSrc, int /*long*/ formatDest); +/** + * @param paper cast=(PMPaper) + * @param stringRef cast=(CFStringRef*) + */ +public static final native int /*long*/ PMPaperGetName (int /*long*/ paper, int[] stringRef); +/** + * @param printer cast=(PMPrinter) + * @param id cast=(CFStringRef) + * @param name cast=(CFStringRef) + * @param width cast=(double) + * @param height cast=(double) + * @param margins cast=(const PMPaperMargins*) + * @param paper cast=(PMPaper*) + */ +public static final native int /*long*/ PMPaperCreateCustom (int /*long*/ printer, int /*long*/ id, int /*long*/ name, double width, double height, double[] margins, int[] paper); +/** + * @param pmPaper cast=(PMPaper) + * @param pmPrinter cast=(PMPrinter) + * @param paperName cast=(CFStringRef*) + */ +public static final native int /*long*/ PMPaperCreateLocalizedName (int /*long*/ pmPaper, int /*long*/ pmPrinter, int[] /*long*/ paperName); +/** @param pmPaper cast=(PMPaper) */ +public static final native boolean PMPaperIsCustom (int /*long*/ pmPaper); +/** @param pmPrinter cast=(PMPrinter)*/ +public static final native int /*long*/ PMPrinterGetName (int /*long*/ pmPrinter); +/** + * @param pmPrinter cast=(PMPrinter) + * @param paperID cast=(CFStringRef*) + */ +public static final native int /*long*/ PMPaperGetID (int /*long*/ pmPrinter, int[] paperID); +/** + * @param printer cast=(PMPrinter) + * @param settings cast=(PMPrintSettings) + * @param mime_types cast=(CFArrayRef*) + */ +public static final native int /*long*/ PMPrinterGetMimeTypes(int /*long*/ printer, int /*long*/ settings, int[] mime_types); +/** + * @param printer cast=(PMPrinter) + * @param settings cast=(PMPrintSettings) + * @param mime_types cast=(PMResolution*) + */ +public static final native int /*long*/ PMPrinterGetOutputResolution(int /*long*/ printer, int /*long*/ settings, double[] resolution); +/** + * @param printer cast=(PMPrinter) + * @param settings cast=(PMPrintSettings) + * @param mime_types cast=(PMResolution*) + */ +public static final native int /*long*/ PMPrinterSetOutputResolution(int /*long*/ printer, int /*long*/ settings, double[] resolution); +/** @param printerId cast=(CFStringRef) */ +public static final native int /*long*/ PMPrinterCreateFromPrinterID(int /*long*/ printerId); +/** @param settings cast=(PMPrintSettings*) */ +public static final native int /*long*/ PMCreatePrintSettings (int[] settings); +/** + * @param allocator cast=(CFAllocatorRef) + * @param theType cast=(CFNumberType) + * @param valuePtr cast=(const void *) + */ +public static final native int /*long*/ CFNumberCreate (int /*long*/ allocator,int theType, int[] valuePtr); + /** Constants */ public static final int NSAlertFirstButtonReturn = 1000; public static final int NSAlertSecondButtonReturn = 1001; @@ -2503,9 +2657,18 @@ public static final native int /*long*/ NSPrintSavePath(); public static final NSString NSPrintSavePath = new NSString(NSPrintSavePath()); /** @method flags=const */ +public static final native int /*long*/ NSPrintPrinterName(); +public static final NSString NSPrintPrinterName = new NSString(NSPrintPrinterName()); +/** @method flags=const */ public static final native int /*long*/ NSPrintScalingFactor(); public static final NSString NSPrintScalingFactor = new NSString(NSPrintScalingFactor()); /** @method flags=const */ +public static final native int /*long*/ NSPrintPagesAcross(); +public static final NSString NSPrintPagesAcross = new NSString(NSPrintPagesAcross()); +/** @method flags=const */ +public static final native int /*long*/ NSPrintPagesDown(); +public static final NSString NSPrintPagesDown = new NSString(NSPrintPagesDown()); +/** @method flags=const */ public static final native int /*long*/ NSPrintSpoolJob(); public static final NSString NSPrintSpoolJob = new NSString(NSPrintSpoolJob()); /** @method flags=const */ Index: Eclipse SWT Printing/cocoa/org/eclipse/swt/printing/PrintDialog.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT Printing/cocoa/org/eclipse/swt/printing/PrintDialog.java,v retrieving revision 1.22 diff -u -r1.22 PrintDialog.java --- Eclipse SWT Printing/cocoa/org/eclipse/swt/printing/PrintDialog.java 23 Oct 2009 16:17:37 -0000 1.22 +++ Eclipse SWT Printing/cocoa/org/eclipse/swt/printing/PrintDialog.java 11 Feb 2010 12:39:28 -0000 @@ -154,21 +154,101 @@ 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(); - dict.setValue(NSNumber.numberWithBool(printerData.collate), OS.NSPrintMustCollate); - dict.setValue(NSNumber.numberWithInt(printerData.copyCount), OS.NSPrintCopies); + NSMutableDictionary dict = printInfo.dictionary(); + /* Settings */ + int /*long*/ pmSettings = printInfo.PMPrintSettings();// Do not release unless retain it + /* Duplex setting */ + OS.PMSetDuplex(pmSettings, printerData.duplex); + /* Updating the pmPrintSettings to printInfo overrides all the setting + * values contained in the printInfo dictionary. So, any changes to pmPrintSettings + * should be updated initially itself to avoid any accidental overriding. + * Similar cast applies to pmPageFormat as well. + */ + printInfo.updateFromPMPrintSettings(); + /* Print to File */ if (printerData.printToFile) { dict.setValue(OS.NSPrintSaveJob, OS.NSPrintJobDisposition); + if (printerData.fileName != null && printerData.fileName.length() > 0) { + dict.setValue(NSString.stringWith(printerData.fileName), OS.NSPrintSavePath); + } + } else if (printerData.name != null){ + dict.setValue(NSString.stringWith(printerData.name), OS.NSPrintPrinterName); } - if (printerData.fileName != null && printerData.fileName.length() > 0) { - dict.setValue(NSString.stringWith(printerData.fileName), OS.NSPrintSavePath); + int /*long*/ session = printInfo.PMPrintSession();// Do not release unless retain it + int[] pmPrinter = new int[1]; + int res = OS.PMSessionGetCurrentPrinter (session, pmPrinter); + /* Paper Size Name */ + if (printerData.paperSizeName.intern() == PrinterData.PAPER_CUSTOM) { + int[] pmPaper = new int[1]; + double[] margins = {printInfo.topMargin(), printInfo.leftMargin(), printInfo.bottomMargin(), printInfo.rightMargin()}; + String customNameStr = (printerData.customPaperDisplayName != null) ? printerData.customPaperDisplayName : "CustomPaper"; + char[] customNameChars = new char[customNameStr.length()]; + customNameStr.getChars(0, customNameChars.length, customNameChars, 0); + int /*long*/ customNameCFStr = OS.CFStringCreateWithCharacters (0,customNameChars,customNameChars.length); + String customIdStr = (printerData.customPaperName != null) ? printerData.customPaperName : "CustomPaper"; + char[] customIdChars = new char[customIdStr.length()]; + customIdStr.getChars(0, customIdChars.length, customIdChars, 0); + int /*long*/ customIdCFStr = OS.CFStringCreateWithCharacters (0,customIdChars,customIdChars.length); + + int /*long*/ pmPageFormat = printInfo.pmPageFormat();// Do not release unless retain it + res = OS.PMPaperCreateCustom (pmPrinter[0], customIdCFStr, customNameCFStr, printerData.customPaperWidth * 72, printerData.customPaperHeight * 72, margins, pmPaper); + if (res == OS.noErr) { + int[] /*long*/ newPageFormat = new int[1]; + OS.PMCreatePageFormatWithPMPaper (newPageFormat, pmPaper[0]); + OS.PMCopyPageFormat (newPageFormat[0],pmPageFormat); + printInfo.updateFromPMPageFormat(); + OS.PMRelease(newPageFormat[0]); + } + int[] pmPaperName = new int[1]; + OS.PMPaperGetName (pmPaper[0], pmPaperName); + NSString paperNameStr = new NSString(pmPaperName[0]); + printInfo.setPaperName (paperNameStr); + + OS.CFRelease (customNameCFStr); + OS.CFRelease (customIdCFStr); + OS.PMRelease (pmPaperName[0]); + } else { + String[] keys = {PrinterData.PAPER_LEGAL, PrinterData.PAPER_LETTER, PrinterData.PAPER_A2, PrinterData.PAPER_A4, + PrinterData.PAPER_A5, PrinterData.PAPER_A6, PrinterData.PAPER_B5, PrinterData.PAPER_JB5, PrinterData.PAPER_EXECUTIVE}; + String[] values = {"Legal", "Letter", "iso-a2-envelope", "A4", + "A5", "A6", "ISOB5", "JISB5", "Executive"}; + int index; + for (index = 0; index < keys.length; index++) { + if (printerData.paperSizeName.intern() == keys[index].intern()) break; + } + NSString paperNameStr = (NSString) new NSString().alloc(); + if (index < keys.length) { + paperNameStr = paperNameStr.initWithString (values[index]); + } else { + paperNameStr = paperNameStr.initWithString (printerData.paperSizeName); + } + printInfo.setPaperName (paperNameStr); } + /* Orientation */ + printInfo.setOrientation(printerData.orientation == PrinterData.LANDSCAPE ? OS.NSLandscapeOrientation : OS.NSPortraitOrientation); + /* Collate */ + dict.setValue(NSNumber.numberWithBool(printerData.collate), OS.NSPrintMustCollate); + /* Copy count */ + dict.setValue(NSNumber.numberWithInt(printerData.copyCount), OS.NSPrintCopies); + /* Page Scope */ dict.setValue(NSNumber.numberWithBool(printerData.scope == PrinterData.ALL_PAGES), OS.NSPrintAllPages); + /* Page Range */ if (printerData.scope == PrinterData.PAGE_RANGE) { dict.setValue(NSNumber.numberWithInt(printerData.startPage), OS.NSPrintFirstPage); dict.setValue(NSNumber.numberWithInt(printerData.endPage), OS.NSPrintLastPage); } + /* Scaling factor value */ + dict.setValue(NSNumber.numberWithDouble(printerData.scale/100.0),OS.NSPrintScalingFactor); + /* Pages per sheet */ + int columns = (int) Math.sqrt(printerData.pagesPerSide); + dict.setValue(NSNumber.numberWithInt(columns), OS.NSPrintPagesAcross); + dict.setValue(NSNumber.numberWithInt(printerData.pagesPerSide / columns), OS.NSPrintPagesDown); + /* Output Resolution */ + if (printerData.resolutionX != 0 && printerData.resolutionY != 0) { + double[] resolution = {printerData.resolutionX, printerData.resolutionY}; + OS.PMPrinterSetOutputResolution(pmPrinter[0], pmSettings, resolution); + } + panel.setOptions(OS.NSPrintPanelShowsPageSetupAccessory | panel.options()); Shell parent = getParent(); Display display = parent != null ? parent.getDisplay() : Display.getCurrent(); @@ -207,10 +287,53 @@ data.endPage = new NSNumber(dict.objectForKey(OS.NSPrintLastPage)).intValue(); } data.collate = new NSNumber(dict.objectForKey(OS.NSPrintMustCollate)).intValue() != 0; - 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.scale = new NSNumber(dict.objectForKey(OS.NSPrintScalingFactor)).doubleValue() * 100; + /* Pages per Side */ + int pagesAcross = new NSNumber(dict.objectForKey(OS.NSPrintPagesAcross)).intValue(); + int pagesDown = new NSNumber(dict.objectForKey(OS.NSPrintPagesDown)).intValue(); + data.pagesPerSide = pagesAcross * pagesDown; + /* Duplex */ + int /*long*/ pmPrintSettings = printInfo.PMPrintSettings(); + int[] duplexMode = new int[1]; + OS.PMGetDuplex (pmPrintSettings, duplexMode); + data.duplex = (int) duplexMode[0]; + /* Paper Size TODO:// + * It appears to be a bug in Mac that at instances, + * PaperName might not be recognized as Custom + * though it is Custom. + */ + int /*long*/ pageFormat = printInfo.pmPageFormat(); + int[] pmPaper = new int[1]; + OS.PMGetPageFormatPaper (pageFormat, pmPaper); + if (OS.PMPaperIsCustom (pmPaper[0])) { + data.paperSizeName = PrinterData.PAPER_CUSTOM; + double[] height = new double[1]; + double[] width = new double[1]; + OS.PMPaperGetHeight (pmPaper[0], height); + OS.PMPaperGetWidth (pmPaper[0], width); + data.customPaperHeight = height[0] / 72; + data.customPaperWidth = width[0] / 72; + int[] pmPaperName = new int[1]; + OS.PMPaperGetName (pmPaper[0], pmPaperName); + data.customPaperDisplayName = new NSString (pmPaperName[0]).getString(); + int[] pmPaperId = new int[1]; + OS.PMPaperGetID (pmPaper[0], pmPaperId); + data.customPaperName = new NSString (pmPaperId[0]).getString(); + } else { + int[] /*long*/ pmPaperName = new int[1]; + OS.PMPaperGetName (pmPaper[0], pmPaperName); + data.paperSizeName = new NSString (pmPaperName[0]).getString(); + } + /* Resolution */ + session = printInfo.PMPrintSession();// Do not release unless retain it + OS.PMSessionGetCurrentPrinter(session, pmPrinter); + double[] resolution = new double[2]; + OS.PMPrinterGetOutputResolution(pmPrinter[0], pmPrintSettings, resolution); + data.resolutionX = resolution[0]; + data.resolutionY = resolution[1]; + NSData nsData = NSKeyedArchiver.archivedDataWithRootObject(printInfo); data.otherData = new byte[(int)/*64*/nsData.length()]; OS.memmove(data.otherData, nsData.bytes(), data.otherData.length); Index: Eclipse SWT Printing/cocoa/org/eclipse/swt/printing/Printer.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT Printing/cocoa/org/eclipse/swt/printing/Printer.java,v retrieving revision 1.34 diff -u -r1.34 Printer.java --- Eclipse SWT Printing/cocoa/org/eclipse/swt/printing/Printer.java 15 Sep 2009 14:44:48 -0000 1.34 +++ Eclipse SWT Printing/cocoa/org/eclipse/swt/printing/Printer.java 11 Feb 2010 12:39:28 -0000 @@ -48,6 +48,34 @@ static final String DRIVER = "Mac"; /** + * Returns an array of String objects representing all paper + * size names supported by printers on the platform. + * Note that some platforms return only the paper size names + * supported by the default printer. + * + * @return a string array containing paper size names + */ +public static String[] getPaperSizeList () { + int[] session = new int[1]; + int res = OS.PMCreateSession(session); + if (res != OS.noErr) return null; + int[] printer = new int[1]; + res = OS.PMSessionGetCurrentPrinter(session[0], printer); + if (res != OS.noErr) return null; + int[] paperList = new int[1]; + res = OS.PMPrinterGetPaperList(printer[0], paperList); + int count = OS.CFArrayGetCount (paperList[0]); + String[] result = new String[count]; + for (int i=0; iPrinterData objects * representing all available printers. If there are no * printers, the array will be empty. Index: Eclipse SWT Printing/common/org/eclipse/swt/printing/PrinterData.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT Printing/common/org/eclipse/swt/printing/PrinterData.java,v retrieving revision 1.25 diff -u -r1.25 PrinterData.java --- Eclipse SWT Printing/common/org/eclipse/swt/printing/PrinterData.java 20 Jan 2010 13:43:49 -0000 1.25 +++ Eclipse SWT Printing/common/org/eclipse/swt/printing/PrinterData.java 11 Feb 2010 12:39:28 -0000 @@ -111,8 +111,120 @@ * @since 3.5 */ public int orientation = PORTRAIT; + + /** + * The scaling factor of the page and paper rectangle, + * expressed as a percentage by which the printed output + * to be scaled. Default value is 100 indicating no scale. + * + * @since 3.6 + */ + public double scale = 100; + + /** + * The number of logical pages to be tiled on a + * physical sheet of paper, whose value can be + * expressed either of 1, 2, 4, 6, 9 or 16. + * + * @since 3.6 + */ + public int pagesPerSide = 1; + + /** + * specifies a print job that can print either single-sided or + * double-sided printing, expressed as one of the following values: + *
+ *
DUPLEX_SIMPLEX
+ *
Normal one-sided printing
+ *
DUPLEX_HORIZONTAL
+ *
Duplex printing with page being horizontal
+ *
DUPLEX_VERTICAL
+ *
Duplex printing with page being vertical
+ *
+ * + * @since 3.6 + */ + public int duplex = DUPLEX_SIMPLEX; + + /** + * Specifies the name for the paper size used in a + * print job, expressed as one of the following values: + *
+ *
PAPER_LETTER
+ *
PAPER_LEGAL
+ *
PAPER_A2
+ *
PAPER_A4
+ *
PAPER_A5
+ *
PAPER_A6
+ *
PAPER_B5
+ *
PAPER_JB5
+ *
PAPER_EXECUTIVE
+ *
PAPER_CUSTOM
+ *
+ * + * Also accepts any paper size from the list of available paper size + * names returned by method Printer.getPaperSizeList. + * + * @since 3.6 + */ + public String paperSizeName = PAPER_A4; + + /** + * The physical height of the custom paper name in inches. + * Note that this field is ignored if paperSize + * is not specified as PAPER_CUSTOM. + * + * @since 3.6 + */ + public double customPaperHeight = 0; /** + * The physical width of the custom paper name in inches. + * Note that this field is ignored if paperSize + * is not specified as PAPER_CUSTOM. + * + * @since 3.6 + */ + public double customPaperWidth = 0; + + /** + * The name of the custom paper size. + * Note that this field is ignored if paperSize + * is not specified as PAPER_CUSTOM. + * + * @since 3.6 + */ + public String customPaperName; + + /** + * The human-readable name of the custom paper size to + * be displayed in print dialog. Note that this field + * is ignored if paperSize is not + * specified as PAPER_CUSTOM. + * + * @since 3.6 + */ + public String customPaperDisplayName; + + /** + * Specifies the x-resolution, in dots-per-inch of the printer. + * This configures the print settings to the closest resolution + * setting that can be used for the destination print job. + * + * @since 3.6 + */ + public double resolutionX; + + /** + * Specifies the y-resolution, in dots-per-inch of the printer. + * This configures the print settings to the closest resolution + * setting that can be used for the destination print job. + * + * @since 3.6 + */ + public double resolutionY; + + /** * scope field value indicating that * all pages should be printed */ @@ -148,6 +260,116 @@ public static final int LANDSCAPE = 2; /** + * duplex field value indicating + * one-sided printing + * + * @since 3.6 + */ + public static final int DUPLEX_SIMPLEX = 1; + + /** + * duplex field value indicating + * double sided printing on short edge + * + * @since 3.6 + */ + public static final int DUPLEX_HORIZONTAL = 2; + + /** + * duplex field value indicating + * double sided printing on long edge + * + * @since 3.6 + */ + public static final int DUPLEX_VERTICAL = 3; + + /** + * paperSize field value indicating + * the paper size as LETTER + * + * @since 3.6 + */ + public static final String PAPER_LETTER = "LETTER"; + + /** + * paperSize field value indicating + * the paper size as LEGAL + * + * @since 3.6 + */ + public static final String PAPER_LEGAL = "LEGAL"; + + /** + * paperSize field value indicating + * the paper size as A4 sheet + * + * @since 3.6 + */ + public static final String PAPER_A2 = "A2"; + + /** + * paperSize field value indicating + * the paper size as A4 sheet + * + * @since 3.6 + */ + public static final String PAPER_A4 = "A4"; + + /** + * paperSize field value indicating + * the paper size as A4 sheet + * + * @since 3.6 + */ + public static final String PAPER_A5 = "A5"; + + /** + * paperSize field value indicating + * the paper size as A4 sheet + * + * @since 3.6 + */ + public static final String PAPER_A6 = "A6"; + + /** + * paperSize field value indicating + * the paper size as B5 sheet + * + * @since 3.6 + */ + public static final String PAPER_B5 = "B5"; + + /** + * paperSize field value indicating + * the paper size as JB5 sheet + * + * @since 3.6 + */ + public static final String PAPER_JB5 = "JB5"; + + /** + * paperSize field value indicating + * the paper size as EXECUTIVE + * + * @since 3.6 + */ + public static final String PAPER_EXECUTIVE = "EXECUTIVE"; + + /** + * paperSize field value indicating the paper + * size as Custom. When this field is specified, the values + * for customPaperHeight and customPaperWidth + * are required to create a custom paper size and optionally, + * customPaperName customPaperDisplayName. + * + * Note that customPaperHeight and customPaperWidth are ignored + * when the field has not specified this value. + * + * @since 3.6 + */ + public static final String PAPER_CUSTOM = "CUSTOM"; + + /** * private, platform-specific data * On Windows, this contains a copy of the DEVMODE struct * returned from the PrintDialog.