View | Details | Raw Unified | Return to bug 96394 | Differences between
and this patch

Collapse All | Expand All

(-)Eclipse SWT PI/cocoa/library/os.c (+545 lines)
Lines 834-839 Link Here
834
}
834
}
835
#endif
835
#endif
836
836
837
#ifndef NO_CFArrayGetCount
838
JNIEXPORT jintLong JNICALL OS_NATIVE(CFArrayGetCount)
839
	(JNIEnv *env, jclass that, jint arg0)
840
{
841
	jintLong rc = 0;
842
	OS_NATIVE_ENTER(env, that, CFArrayGetCount_FUNC);
843
	rc = (jintLong)CFArrayGetCount((CFArrayRef)arg0);
844
	OS_NATIVE_EXIT(env, that, CFArrayGetCount_FUNC);
845
	return rc;
846
}
847
#endif
848
849
#ifndef NO_CFArrayGetValueAtIndex
850
JNIEXPORT jintLong JNICALL OS_NATIVE(CFArrayGetValueAtIndex)
851
	(JNIEnv *env, jclass that, jintLong arg0, jint arg1)
852
{
853
	jintLong rc = 0;
854
	OS_NATIVE_ENTER(env, that, CFArrayGetValueAtIndex_FUNC);
855
	rc = (jintLong)CFArrayGetValueAtIndex((CFArrayRef)arg0, (CFIndex)arg1);
856
	OS_NATIVE_EXIT(env, that, CFArrayGetValueAtIndex_FUNC);
857
	return rc;
858
}
859
#endif
860
837
#ifndef NO_CFAttributedStringCreate
861
#ifndef NO_CFAttributedStringCreate
838
JNIEXPORT jintLong JNICALL OS_NATIVE(CFAttributedStringCreate)
862
JNIEXPORT jintLong JNICALL OS_NATIVE(CFAttributedStringCreate)
839
	(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jintLong arg2)
863
	(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jintLong arg2)
Lines 892-897 Link Here
892
}
916
}
893
#endif
917
#endif
894
918
919
#ifndef NO_CFNumberCreate
920
JNIEXPORT jintLong JNICALL OS_NATIVE(CFNumberCreate)
921
	(JNIEnv *env, jclass that, jintLong arg0, jint arg1, jintArray arg2)
922
{
923
	jint *lparg2=NULL;
924
	jintLong rc = 0;
925
	OS_NATIVE_ENTER(env, that, CFNumberCreate_FUNC);
926
	if (arg2) if ((lparg2 = (*env)->GetIntArrayElements(env, arg2, NULL)) == NULL) goto fail;
927
	rc = (jintLong)CFNumberCreate((CFAllocatorRef)arg0, (CFNumberType)arg1, (const void *)lparg2);
928
fail:
929
	if (arg2 && lparg2) (*env)->ReleaseIntArrayElements(env, arg2, lparg2, 0);
930
	OS_NATIVE_EXIT(env, that, CFNumberCreate_FUNC);
931
	return rc;
932
}
933
#endif
934
935
#ifndef NO_CFNumberGetValue
936
JNIEXPORT jboolean JNICALL OS_NATIVE(CFNumberGetValue)
937
	(JNIEnv *env, jclass that, jintLong arg0, jint arg1, jintArray arg2)
938
{
939
	jint *lparg2=NULL;
940
	jboolean rc = 0;
941
	OS_NATIVE_ENTER(env, that, CFNumberGetValue_FUNC);
942
	if (arg2) if ((lparg2 = (*env)->GetIntArrayElements(env, arg2, NULL)) == NULL) goto fail;
943
	rc = (jboolean)CFNumberGetValue((CFNumberRef)arg0, (CFNumberType)arg1, (void *)lparg2);
944
fail:
945
	if (arg2 && lparg2) (*env)->ReleaseIntArrayElements(env, arg2, lparg2, 0);
946
	OS_NATIVE_EXIT(env, that, CFNumberGetValue_FUNC);
947
	return rc;
948
}
949
#endif
950
895
#ifndef NO_CFRange_1sizeof
951
#ifndef NO_CFRange_1sizeof
896
JNIEXPORT jint JNICALL OS_NATIVE(CFRange_1sizeof)
952
JNIEXPORT jint JNICALL OS_NATIVE(CFRange_1sizeof)
897
	(JNIEnv *env, jclass that)
953
	(JNIEnv *env, jclass that)
Lines 2303-2308 Link Here
2303
}
2359
}
2304
#endif
2360
#endif
2305
2361
2362
#ifndef NO_JSEvaluateScript
2363
JNIEXPORT jintLong JNICALL OS_NATIVE(JSEvaluateScript)
2364
	(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jintLong arg2, jintLong arg3, jint arg4, jintLongArray arg5)
2365
{
2366
	jintLong *lparg5=NULL;
2367
	jintLong rc = 0;
2368
	OS_NATIVE_ENTER(env, that, JSEvaluateScript_FUNC);
2369
	if (arg5) if ((lparg5 = (*env)->GetIntLongArrayElements(env, arg5, NULL)) == NULL) goto fail;
2370
	rc = (jintLong)JSEvaluateScript((JSContextRef)arg0, (JSStringRef)arg1, (JSObjectRef)arg2, (JSStringRef)arg3, arg4, (JSValueRef *)lparg5);
2371
fail:
2372
	if (arg5 && lparg5) (*env)->ReleaseIntLongArrayElements(env, arg5, lparg5, 0);
2373
	OS_NATIVE_EXIT(env, that, JSEvaluateScript_FUNC);
2374
	return rc;
2375
}
2376
#endif
2377
2378
#ifndef NO_JSStringCreateWithUTF8CString
2379
JNIEXPORT jintLong JNICALL OS_NATIVE(JSStringCreateWithUTF8CString)
2380
	(JNIEnv *env, jclass that, jbyteArray arg0)
2381
{
2382
	jbyte *lparg0=NULL;
2383
	jintLong rc = 0;
2384
	OS_NATIVE_ENTER(env, that, JSStringCreateWithUTF8CString_FUNC);
2385
	if (arg0) if ((lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL)) == NULL) goto fail;
2386
	rc = (jintLong)JSStringCreateWithUTF8CString((const char *)lparg0);
2387
fail:
2388
	if (arg0 && lparg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0);
2389
	OS_NATIVE_EXIT(env, that, JSStringCreateWithUTF8CString_FUNC);
2390
	return rc;
2391
}
2392
#endif
2393
2394
#ifndef NO_JSStringRelease
2395
JNIEXPORT void JNICALL OS_NATIVE(JSStringRelease)
2396
	(JNIEnv *env, jclass that, jintLong arg0)
2397
{
2398
	OS_NATIVE_ENTER(env, that, JSStringRelease_FUNC);
2399
	JSStringRelease((JSStringRef)arg0);
2400
	OS_NATIVE_EXIT(env, that, JSStringRelease_FUNC);
2401
}
2402
#endif
2403
2306
#ifndef NO_LMGetKbdType
2404
#ifndef NO_LMGetKbdType
2307
JNIEXPORT jbyte JNICALL OS_NATIVE(LMGetKbdType)
2405
JNIEXPORT jbyte JNICALL OS_NATIVE(LMGetKbdType)
2308
	(JNIEnv *env, jclass that)
2406
	(JNIEnv *env, jclass that)
Lines 3963-3968 Link Here
3963
}
4061
}
3964
#endif
4062
#endif
3965
4063
4064
#ifndef NO_NSOutlineViewColumnDidMoveNotification
4065
JNIEXPORT jintLong JNICALL OS_NATIVE(NSOutlineViewColumnDidMoveNotification)
4066
	(JNIEnv *env, jclass that)
4067
{
4068
	jintLong rc = 0;
4069
	OS_NATIVE_ENTER(env, that, NSOutlineViewColumnDidMoveNotification_FUNC);
4070
	rc = (jintLong)NSOutlineViewColumnDidMoveNotification;
4071
	OS_NATIVE_EXIT(env, that, NSOutlineViewColumnDidMoveNotification_FUNC);
4072
	return rc;
4073
}
4074
#endif
4075
3966
#ifndef NO_NSParagraphStyleAttributeName
4076
#ifndef NO_NSParagraphStyleAttributeName
3967
JNIEXPORT jintLong JNICALL OS_NATIVE(NSParagraphStyleAttributeName)
4077
JNIEXPORT jintLong JNICALL OS_NATIVE(NSParagraphStyleAttributeName)
3968
	(JNIEnv *env, jclass that)
4078
	(JNIEnv *env, jclass that)
Lines 4078-4083 Link Here
4078
}
4188
}
4079
#endif
4189
#endif
4080
4190
4191
#ifndef NO_NSPrintPagesAcross
4192
JNIEXPORT jintLong JNICALL OS_NATIVE(NSPrintPagesAcross)
4193
	(JNIEnv *env, jclass that)
4194
{
4195
	jintLong rc = 0;
4196
	OS_NATIVE_ENTER(env, that, NSPrintPagesAcross_FUNC);
4197
	rc = (jintLong)NSPrintPagesAcross;
4198
	OS_NATIVE_EXIT(env, that, NSPrintPagesAcross_FUNC);
4199
	return rc;
4200
}
4201
#endif
4202
4203
#ifndef NO_NSPrintPagesDown
4204
JNIEXPORT jintLong JNICALL OS_NATIVE(NSPrintPagesDown)
4205
	(JNIEnv *env, jclass that)
4206
{
4207
	jintLong rc = 0;
4208
	OS_NATIVE_ENTER(env, that, NSPrintPagesDown_FUNC);
4209
	rc = (jintLong)NSPrintPagesDown;
4210
	OS_NATIVE_EXIT(env, that, NSPrintPagesDown_FUNC);
4211
	return rc;
4212
}
4213
#endif
4214
4081
#ifndef NO_NSPrintPreviewJob
4215
#ifndef NO_NSPrintPreviewJob
4082
JNIEXPORT jintLong JNICALL OS_NATIVE(NSPrintPreviewJob)
4216
JNIEXPORT jintLong JNICALL OS_NATIVE(NSPrintPreviewJob)
4083
	(JNIEnv *env, jclass that)
4217
	(JNIEnv *env, jclass that)
Lines 4090-4095 Link Here
4090
}
4224
}
4091
#endif
4225
#endif
4092
4226
4227
#ifndef NO_NSPrintPrinterName
4228
JNIEXPORT jintLong JNICALL OS_NATIVE(NSPrintPrinterName)
4229
	(JNIEnv *env, jclass that)
4230
{
4231
	jintLong rc = 0;
4232
	OS_NATIVE_ENTER(env, that, NSPrintPrinterName_FUNC);
4233
	rc = (jintLong)NSPrintPrinterName;
4234
	OS_NATIVE_EXIT(env, that, NSPrintPrinterName_FUNC);
4235
	return rc;
4236
}
4237
#endif
4238
4093
#ifndef NO_NSPrintSaveJob
4239
#ifndef NO_NSPrintSaveJob
4094
JNIEXPORT jintLong JNICALL OS_NATIVE(NSPrintSaveJob)
4240
JNIEXPORT jintLong JNICALL OS_NATIVE(NSPrintSaveJob)
4095
	(JNIEnv *env, jclass that)
4241
	(JNIEnv *env, jclass that)
Lines 4270-4275 Link Here
4270
}
4416
}
4271
#endif
4417
#endif
4272
4418
4419
#ifndef NO_NSTableViewColumnDidMoveNotification
4420
JNIEXPORT jintLong JNICALL OS_NATIVE(NSTableViewColumnDidMoveNotification)
4421
	(JNIEnv *env, jclass that)
4422
{
4423
	jintLong rc = 0;
4424
	OS_NATIVE_ENTER(env, that, NSTableViewColumnDidMoveNotification_FUNC);
4425
	rc = (jintLong)NSTableViewColumnDidMoveNotification;
4426
	OS_NATIVE_EXIT(env, that, NSTableViewColumnDidMoveNotification_FUNC);
4427
	return rc;
4428
}
4429
#endif
4430
4273
#ifndef NO_NSTemporaryDirectory
4431
#ifndef NO_NSTemporaryDirectory
4274
JNIEXPORT jintLong JNICALL OS_NATIVE(NSTemporaryDirectory)
4432
JNIEXPORT jintLong JNICALL OS_NATIVE(NSTemporaryDirectory)
4275
	(JNIEnv *env, jclass that)
4433
	(JNIEnv *env, jclass that)
Lines 4506-4511 Link Here
4506
}
4664
}
4507
#endif
4665
#endif
4508
4666
4667
#ifndef NO_PMCopyPageFormat
4668
JNIEXPORT jintLong JNICALL OS_NATIVE(PMCopyPageFormat)
4669
	(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1)
4670
{
4671
	jintLong rc = 0;
4672
	OS_NATIVE_ENTER(env, that, PMCopyPageFormat_FUNC);
4673
	rc = (jintLong)PMCopyPageFormat((PMPageFormat)arg0, (PMPageFormat)arg1);
4674
	OS_NATIVE_EXIT(env, that, PMCopyPageFormat_FUNC);
4675
	return rc;
4676
}
4677
#endif
4678
4679
#ifndef NO_PMCreatePageFormatWithPMPaper
4680
JNIEXPORT jintLong JNICALL OS_NATIVE(PMCreatePageFormatWithPMPaper)
4681
	(JNIEnv *env, jclass that, jintArray arg0, jintLong arg1)
4682
{
4683
	jint *lparg0=NULL;
4684
	jintLong rc = 0;
4685
	OS_NATIVE_ENTER(env, that, PMCreatePageFormatWithPMPaper_FUNC);
4686
	if (arg0) if ((lparg0 = (*env)->GetIntArrayElements(env, arg0, NULL)) == NULL) goto fail;
4687
	rc = (jintLong)PMCreatePageFormatWithPMPaper((PMPageFormat*)lparg0, (PMPaper)arg1);
4688
fail:
4689
	if (arg0 && lparg0) (*env)->ReleaseIntArrayElements(env, arg0, lparg0, 0);
4690
	OS_NATIVE_EXIT(env, that, PMCreatePageFormatWithPMPaper_FUNC);
4691
	return rc;
4692
}
4693
#endif
4694
4695
#ifndef NO_PMCreatePrintSettings
4696
JNIEXPORT jintLong JNICALL OS_NATIVE(PMCreatePrintSettings)
4697
	(JNIEnv *env, jclass that, jintArray arg0)
4698
{
4699
	jint *lparg0=NULL;
4700
	jintLong rc = 0;
4701
	OS_NATIVE_ENTER(env, that, PMCreatePrintSettings_FUNC);
4702
	if (arg0) if ((lparg0 = (*env)->GetIntArrayElements(env, arg0, NULL)) == NULL) goto fail;
4703
	rc = (jintLong)PMCreatePrintSettings((PMPrintSettings*)lparg0);
4704
fail:
4705
	if (arg0 && lparg0) (*env)->ReleaseIntArrayElements(env, arg0, lparg0, 0);
4706
	OS_NATIVE_EXIT(env, that, PMCreatePrintSettings_FUNC);
4707
	return rc;
4708
}
4709
#endif
4710
4711
#ifndef NO_PMCreateSession
4712
JNIEXPORT jint JNICALL OS_NATIVE(PMCreateSession)
4713
	(JNIEnv *env, jclass that, jintArray arg0)
4714
{
4715
	jint *lparg0=NULL;
4716
	jint rc = 0;
4717
	OS_NATIVE_ENTER(env, that, PMCreateSession_FUNC);
4718
	if (arg0) if ((lparg0 = (*env)->GetIntArrayElements(env, arg0, NULL)) == NULL) goto fail;
4719
	rc = (jint)PMCreateSession((PMPrintSession*)lparg0);
4720
fail:
4721
	if (arg0 && lparg0) (*env)->ReleaseIntArrayElements(env, arg0, lparg0, 0);
4722
	OS_NATIVE_EXIT(env, that, PMCreateSession_FUNC);
4723
	return rc;
4724
}
4725
#endif
4726
4727
#ifndef NO_PMGetDuplex
4728
JNIEXPORT void JNICALL OS_NATIVE(PMGetDuplex)
4729
	(JNIEnv *env, jclass that, jintLong arg0, jintArray arg1)
4730
{
4731
	jint *lparg1=NULL;
4732
	OS_NATIVE_ENTER(env, that, PMGetDuplex_FUNC);
4733
	if (arg1) if ((lparg1 = (*env)->GetIntArrayElements(env, arg1, NULL)) == NULL) goto fail;
4734
	PMGetDuplex((PMPrintSettings)arg0, (PMDuplexMode*)lparg1);
4735
fail:
4736
	if (arg1 && lparg1) (*env)->ReleaseIntArrayElements(env, arg1, lparg1, 0);
4737
	OS_NATIVE_EXIT(env, that, PMGetDuplex_FUNC);
4738
}
4739
#endif
4740
4741
#ifndef NO_PMGetPageFormatPaper
4742
JNIEXPORT jintLong JNICALL OS_NATIVE(PMGetPageFormatPaper)
4743
	(JNIEnv *env, jclass that, jint arg0, jintArray arg1)
4744
{
4745
	jint *lparg1=NULL;
4746
	jintLong rc = 0;
4747
	OS_NATIVE_ENTER(env, that, PMGetPageFormatPaper_FUNC);
4748
	if (arg1) if ((lparg1 = (*env)->GetIntArrayElements(env, arg1, NULL)) == NULL) goto fail;
4749
	rc = (jintLong)PMGetPageFormatPaper((PMPageFormat)arg0, (PMPaper*)lparg1);
4750
fail:
4751
	if (arg1 && lparg1) (*env)->ReleaseIntArrayElements(env, arg1, lparg1, 0);
4752
	OS_NATIVE_EXIT(env, that, PMGetPageFormatPaper_FUNC);
4753
	return rc;
4754
}
4755
#endif
4756
4757
#ifndef NO_PMPageFormatGetPrinterID
4758
JNIEXPORT jintLong JNICALL OS_NATIVE(PMPageFormatGetPrinterID)
4759
	(JNIEnv *env, jclass that, jintLong arg0, jintArray arg1)
4760
{
4761
	jint *lparg1=NULL;
4762
	jintLong rc = 0;
4763
	OS_NATIVE_ENTER(env, that, PMPageFormatGetPrinterID_FUNC);
4764
	if (arg1) if ((lparg1 = (*env)->GetIntArrayElements(env, arg1, NULL)) == NULL) goto fail;
4765
	rc = (jintLong)PMPageFormatGetPrinterID((PMPageFormat)arg0, (CFStringRef*)lparg1);
4766
fail:
4767
	if (arg1 && lparg1) (*env)->ReleaseIntArrayElements(env, arg1, lparg1, 0);
4768
	OS_NATIVE_EXIT(env, that, PMPageFormatGetPrinterID_FUNC);
4769
	return rc;
4770
}
4771
#endif
4772
4773
#ifndef NO_PMPaperCreateCustom
4774
JNIEXPORT jintLong JNICALL OS_NATIVE(PMPaperCreateCustom)
4775
	(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jintLong arg2, jdouble arg3, jdouble arg4, jdoubleArray arg5, jintArray arg6)
4776
{
4777
	jdouble *lparg5=NULL;
4778
	jint *lparg6=NULL;
4779
	jintLong rc = 0;
4780
	OS_NATIVE_ENTER(env, that, PMPaperCreateCustom_FUNC);
4781
	if (arg5) if ((lparg5 = (*env)->GetDoubleArrayElements(env, arg5, NULL)) == NULL) goto fail;
4782
	if (arg6) if ((lparg6 = (*env)->GetIntArrayElements(env, arg6, NULL)) == NULL) goto fail;
4783
	rc = (jintLong)PMPaperCreateCustom((PMPrinter)arg0, (CFStringRef)arg1, (CFStringRef)arg2, (double)arg3, (double)arg4, (const PMPaperMargins*)lparg5, (PMPaper*)lparg6);
4784
fail:
4785
	if (arg6 && lparg6) (*env)->ReleaseIntArrayElements(env, arg6, lparg6, 0);
4786
	if (arg5 && lparg5) (*env)->ReleaseDoubleArrayElements(env, arg5, lparg5, 0);
4787
	OS_NATIVE_EXIT(env, that, PMPaperCreateCustom_FUNC);
4788
	return rc;
4789
}
4790
#endif
4791
4792
#ifndef NO_PMPaperCreateLocalizedName
4793
JNIEXPORT jintLong JNICALL OS_NATIVE(PMPaperCreateLocalizedName)
4794
	(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jintArray arg2)
4795
{
4796
	jint *lparg2=NULL;
4797
	jintLong rc = 0;
4798
	OS_NATIVE_ENTER(env, that, PMPaperCreateLocalizedName_FUNC);
4799
	if (arg2) if ((lparg2 = (*env)->GetIntArrayElements(env, arg2, NULL)) == NULL) goto fail;
4800
	rc = (jintLong)PMPaperCreateLocalizedName((PMPaper)arg0, (PMPrinter)arg1, (CFStringRef*)lparg2);
4801
fail:
4802
	if (arg2 && lparg2) (*env)->ReleaseIntArrayElements(env, arg2, lparg2, 0);
4803
	OS_NATIVE_EXIT(env, that, PMPaperCreateLocalizedName_FUNC);
4804
	return rc;
4805
}
4806
#endif
4807
4808
#ifndef NO_PMPaperGetHeight
4809
JNIEXPORT jintLong JNICALL OS_NATIVE(PMPaperGetHeight)
4810
	(JNIEnv *env, jclass that, jintLong arg0, jdoubleArray arg1)
4811
{
4812
	jdouble *lparg1=NULL;
4813
	jintLong rc = 0;
4814
	OS_NATIVE_ENTER(env, that, PMPaperGetHeight_FUNC);
4815
	if (arg1) if ((lparg1 = (*env)->GetDoubleArrayElements(env, arg1, NULL)) == NULL) goto fail;
4816
	rc = (jintLong)PMPaperGetHeight((PMPaper)arg0, (double*)lparg1);
4817
fail:
4818
	if (arg1 && lparg1) (*env)->ReleaseDoubleArrayElements(env, arg1, lparg1, 0);
4819
	OS_NATIVE_EXIT(env, that, PMPaperGetHeight_FUNC);
4820
	return rc;
4821
}
4822
#endif
4823
4824
#ifndef NO_PMPaperGetID
4825
JNIEXPORT jintLong JNICALL OS_NATIVE(PMPaperGetID)
4826
	(JNIEnv *env, jclass that, jintLong arg0, jintArray arg1)
4827
{
4828
	jint *lparg1=NULL;
4829
	jintLong rc = 0;
4830
	OS_NATIVE_ENTER(env, that, PMPaperGetID_FUNC);
4831
	if (arg1) if ((lparg1 = (*env)->GetIntArrayElements(env, arg1, NULL)) == NULL) goto fail;
4832
	rc = (jintLong)PMPaperGetID((PMPrinter)arg0, (CFStringRef*)lparg1);
4833
fail:
4834
	if (arg1 && lparg1) (*env)->ReleaseIntArrayElements(env, arg1, lparg1, 0);
4835
	OS_NATIVE_EXIT(env, that, PMPaperGetID_FUNC);
4836
	return rc;
4837
}
4838
#endif
4839
4840
#ifndef NO_PMPaperGetName
4841
JNIEXPORT jintLong JNICALL OS_NATIVE(PMPaperGetName)
4842
	(JNIEnv *env, jclass that, jintLong arg0, jintArray arg1)
4843
{
4844
	jint *lparg1=NULL;
4845
	jintLong rc = 0;
4846
	OS_NATIVE_ENTER(env, that, PMPaperGetName_FUNC);
4847
	if (arg1) if ((lparg1 = (*env)->GetIntArrayElements(env, arg1, NULL)) == NULL) goto fail;
4848
	rc = (jintLong)PMPaperGetName((PMPaper)arg0, (CFStringRef*)lparg1);
4849
fail:
4850
	if (arg1 && lparg1) (*env)->ReleaseIntArrayElements(env, arg1, lparg1, 0);
4851
	OS_NATIVE_EXIT(env, that, PMPaperGetName_FUNC);
4852
	return rc;
4853
}
4854
#endif
4855
4856
#ifndef NO_PMPaperGetWidth
4857
JNIEXPORT jintLong JNICALL OS_NATIVE(PMPaperGetWidth)
4858
	(JNIEnv *env, jclass that, jintLong arg0, jdoubleArray arg1)
4859
{
4860
	jdouble *lparg1=NULL;
4861
	jintLong rc = 0;
4862
	OS_NATIVE_ENTER(env, that, PMPaperGetWidth_FUNC);
4863
	if (arg1) if ((lparg1 = (*env)->GetDoubleArrayElements(env, arg1, NULL)) == NULL) goto fail;
4864
	rc = (jintLong)PMPaperGetWidth((PMPaper)arg0, (double*)lparg1);
4865
fail:
4866
	if (arg1 && lparg1) (*env)->ReleaseDoubleArrayElements(env, arg1, lparg1, 0);
4867
	OS_NATIVE_EXIT(env, that, PMPaperGetWidth_FUNC);
4868
	return rc;
4869
}
4870
#endif
4871
4872
#ifndef NO_PMPaperIsCustom
4873
JNIEXPORT jboolean JNICALL OS_NATIVE(PMPaperIsCustom)
4874
	(JNIEnv *env, jclass that, jintLong arg0)
4875
{
4876
	jboolean rc = 0;
4877
	OS_NATIVE_ENTER(env, that, PMPaperIsCustom_FUNC);
4878
	rc = (jboolean)PMPaperIsCustom((PMPaper)arg0);
4879
	OS_NATIVE_EXIT(env, that, PMPaperIsCustom_FUNC);
4880
	return rc;
4881
}
4882
#endif
4883
4884
#ifndef NO_PMPrintSettingsCopyKeys
4885
JNIEXPORT jint JNICALL OS_NATIVE(PMPrintSettingsCopyKeys)
4886
	(JNIEnv *env, jclass that, jintLong arg0, jintArray arg1)
4887
{
4888
	jint *lparg1=NULL;
4889
	jint rc = 0;
4890
	OS_NATIVE_ENTER(env, that, PMPrintSettingsCopyKeys_FUNC);
4891
	if (arg1) if ((lparg1 = (*env)->GetIntArrayElements(env, arg1, NULL)) == NULL) goto fail;
4892
	rc = (jint)PMPrintSettingsCopyKeys((PMPrintSettings)arg0, (CFArrayRef*)lparg1);
4893
fail:
4894
	if (arg1 && lparg1) (*env)->ReleaseIntArrayElements(env, arg1, lparg1, 0);
4895
	OS_NATIVE_EXIT(env, that, PMPrintSettingsCopyKeys_FUNC);
4896
	return rc;
4897
}
4898
#endif
4899
4900
#ifndef NO_PMPrintSettingsGetValue
4901
JNIEXPORT jint JNICALL OS_NATIVE(PMPrintSettingsGetValue)
4902
	(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jintArray arg2)
4903
{
4904
	jint *lparg2=NULL;
4905
	jint rc = 0;
4906
	OS_NATIVE_ENTER(env, that, PMPrintSettingsGetValue_FUNC);
4907
	if (arg2) if ((lparg2 = (*env)->GetIntArrayElements(env, arg2, NULL)) == NULL) goto fail;
4908
	rc = (jint)PMPrintSettingsGetValue((PMPrintSettings)arg0, (CFStringRef)arg1, (CFTypeRef*)lparg2);
4909
fail:
4910
	if (arg2 && lparg2) (*env)->ReleaseIntArrayElements(env, arg2, lparg2, 0);
4911
	OS_NATIVE_EXIT(env, that, PMPrintSettingsGetValue_FUNC);
4912
	return rc;
4913
}
4914
#endif
4915
4916
#ifndef NO_PMPrintSettingsSetValue
4917
JNIEXPORT jint JNICALL OS_NATIVE(PMPrintSettingsSetValue)
4918
	(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jint arg2, jboolean arg3)
4919
{
4920
	jint rc = 0;
4921
	OS_NATIVE_ENTER(env, that, PMPrintSettingsSetValue_FUNC);
4922
	rc = (jint)PMPrintSettingsSetValue((PMPrintSettings)arg0, (CFStringRef)arg1, (CFTypeRef)arg2, (Boolean)arg3);
4923
	OS_NATIVE_EXIT(env, that, PMPrintSettingsSetValue_FUNC);
4924
	return rc;
4925
}
4926
#endif
4927
4928
#ifndef NO_PMPrinterCreateFromPrinterID
4929
JNIEXPORT jintLong JNICALL OS_NATIVE(PMPrinterCreateFromPrinterID)
4930
	(JNIEnv *env, jclass that, jintLong arg0)
4931
{
4932
	jintLong rc = 0;
4933
	OS_NATIVE_ENTER(env, that, PMPrinterCreateFromPrinterID_FUNC);
4934
	rc = (jintLong)PMPrinterCreateFromPrinterID((CFStringRef)arg0);
4935
	OS_NATIVE_EXIT(env, that, PMPrinterCreateFromPrinterID_FUNC);
4936
	return rc;
4937
}
4938
#endif
4939
4940
#ifndef NO_PMPrinterGetMimeTypes
4941
JNIEXPORT jintLong JNICALL OS_NATIVE(PMPrinterGetMimeTypes)
4942
	(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jintArray arg2)
4943
{
4944
	jint *lparg2=NULL;
4945
	jintLong rc = 0;
4946
	OS_NATIVE_ENTER(env, that, PMPrinterGetMimeTypes_FUNC);
4947
	if (arg2) if ((lparg2 = (*env)->GetIntArrayElements(env, arg2, NULL)) == NULL) goto fail;
4948
	rc = (jintLong)PMPrinterGetMimeTypes((PMPrinter)arg0, (PMPrintSettings)arg1, (CFArrayRef*)lparg2);
4949
fail:
4950
	if (arg2 && lparg2) (*env)->ReleaseIntArrayElements(env, arg2, lparg2, 0);
4951
	OS_NATIVE_EXIT(env, that, PMPrinterGetMimeTypes_FUNC);
4952
	return rc;
4953
}
4954
#endif
4955
4956
#ifndef NO_PMPrinterGetName
4957
JNIEXPORT jintLong JNICALL OS_NATIVE(PMPrinterGetName)
4958
	(JNIEnv *env, jclass that, jintLong arg0)
4959
{
4960
	jintLong rc = 0;
4961
	OS_NATIVE_ENTER(env, that, PMPrinterGetName_FUNC);
4962
	rc = (jintLong)PMPrinterGetName((PMPrinter)arg0);
4963
	OS_NATIVE_EXIT(env, that, PMPrinterGetName_FUNC);
4964
	return rc;
4965
}
4966
#endif
4967
4968
#ifndef NO_PMPrinterGetOutputResolution
4969
JNIEXPORT jintLong JNICALL OS_NATIVE(PMPrinterGetOutputResolution)
4970
	(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jdoubleArray arg2)
4971
{
4972
	jdouble *lparg2=NULL;
4973
	jintLong rc = 0;
4974
	OS_NATIVE_ENTER(env, that, PMPrinterGetOutputResolution_FUNC);
4975
	if (arg2) if ((lparg2 = (*env)->GetDoubleArrayElements(env, arg2, NULL)) == NULL) goto fail;
4976
	rc = (jintLong)PMPrinterGetOutputResolution((PMPrinter)arg0, (PMPrintSettings)arg1, lparg2);
4977
fail:
4978
	if (arg2 && lparg2) (*env)->ReleaseDoubleArrayElements(env, arg2, lparg2, 0);
4979
	OS_NATIVE_EXIT(env, that, PMPrinterGetOutputResolution_FUNC);
4980
	return rc;
4981
}
4982
#endif
4983
4984
#ifndef NO_PMPrinterGetPaperList
4985
JNIEXPORT jintLong JNICALL OS_NATIVE(PMPrinterGetPaperList)
4986
	(JNIEnv *env, jclass that, jintLong arg0, jintArray arg1)
4987
{
4988
	jint *lparg1=NULL;
4989
	jintLong rc = 0;
4990
	OS_NATIVE_ENTER(env, that, PMPrinterGetPaperList_FUNC);
4991
	if (arg1) if ((lparg1 = (*env)->GetIntArrayElements(env, arg1, NULL)) == NULL) goto fail;
4992
	rc = (jintLong)PMPrinterGetPaperList((PMPrinter)arg0, (CFArrayRef*)lparg1);
4993
fail:
4994
	if (arg1 && lparg1) (*env)->ReleaseIntArrayElements(env, arg1, lparg1, 0);
4995
	OS_NATIVE_EXIT(env, that, PMPrinterGetPaperList_FUNC);
4996
	return rc;
4997
}
4998
#endif
4999
5000
#ifndef NO_PMPrinterSetOutputResolution
5001
JNIEXPORT jintLong JNICALL OS_NATIVE(PMPrinterSetOutputResolution)
5002
	(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jdoubleArray arg2)
5003
{
5004
	jdouble *lparg2=NULL;
5005
	jintLong rc = 0;
5006
	OS_NATIVE_ENTER(env, that, PMPrinterSetOutputResolution_FUNC);
5007
	if (arg2) if ((lparg2 = (*env)->GetDoubleArrayElements(env, arg2, NULL)) == NULL) goto fail;
5008
	rc = (jintLong)PMPrinterSetOutputResolution((PMPrinter)arg0, (PMPrintSettings)arg1, lparg2);
5009
fail:
5010
	if (arg2 && lparg2) (*env)->ReleaseDoubleArrayElements(env, arg2, lparg2, 0);
5011
	OS_NATIVE_EXIT(env, that, PMPrinterSetOutputResolution_FUNC);
5012
	return rc;
5013
}
5014
#endif
5015
5016
#ifndef NO_PMRelease
5017
JNIEXPORT jint JNICALL OS_NATIVE(PMRelease)
5018
	(JNIEnv *env, jclass that, jintLong arg0)
5019
{
5020
	jint rc = 0;
5021
	OS_NATIVE_ENTER(env, that, PMRelease_FUNC);
5022
	rc = (jint)PMRelease((PMObject)arg0);
5023
	OS_NATIVE_EXIT(env, that, PMRelease_FUNC);
5024
	return rc;
5025
}
5026
#endif
5027
5028
#ifndef NO_PMSessionGetCurrentPrinter
5029
JNIEXPORT jint JNICALL OS_NATIVE(PMSessionGetCurrentPrinter)
5030
	(JNIEnv *env, jclass that, jintLong arg0, jintArray arg1)
5031
{
5032
	jint *lparg1=NULL;
5033
	jint rc = 0;
5034
	OS_NATIVE_ENTER(env, that, PMSessionGetCurrentPrinter_FUNC);
5035
	if (arg1) if ((lparg1 = (*env)->GetIntArrayElements(env, arg1, NULL)) == NULL) goto fail;
5036
	rc = (jint)PMSessionGetCurrentPrinter((PMPrintSession)arg0, (PMPrinter*)lparg1);
5037
fail:
5038
	if (arg1 && lparg1) (*env)->ReleaseIntArrayElements(env, arg1, lparg1, 0);
5039
	OS_NATIVE_EXIT(env, that, PMSessionGetCurrentPrinter_FUNC);
5040
	return rc;
5041
}
5042
#endif
5043
5044
#ifndef NO_PMSetDuplex
5045
JNIEXPORT void JNICALL OS_NATIVE(PMSetDuplex)
5046
	(JNIEnv *env, jclass that, jintLong arg0, jint arg1)
5047
{
5048
	OS_NATIVE_ENTER(env, that, PMSetDuplex_FUNC);
5049
	PMSetDuplex((PMPrintSettings)arg0, (PMDuplexMode)arg1);
5050
	OS_NATIVE_EXIT(env, that, PMSetDuplex_FUNC);
5051
}
5052
#endif
5053
4509
#ifndef NO_PtInRgn
5054
#ifndef NO_PtInRgn
4510
JNIEXPORT jboolean JNICALL OS_NATIVE(PtInRgn)
5055
JNIEXPORT jboolean JNICALL OS_NATIVE(PtInRgn)
4511
	(JNIEnv *env, jclass that, jshortArray arg0, jintLong arg1)
5056
	(JNIEnv *env, jclass that, jshortArray arg0, jintLong arg1)
(-)Eclipse SWT PI/cocoa/library/os_stats.c (-2 / +40 lines)
Lines 14-21 Link Here
14
14
15
#ifdef NATIVE_STATS
15
#ifdef NATIVE_STATS
16
16
17
int OS_nativeFunctionCount = 533;
17
int OS_nativeFunctionCount = 571;
18
int OS_nativeFunctionCallCount[533];
18
int OS_nativeFunctionCallCount[571];
19
char * OS_nativeFunctionNames[] = {
19
char * OS_nativeFunctionNames[] = {
20
	"ATSFontActivateFromFileReference",
20
	"ATSFontActivateFromFileReference",
21
	"AcquireRootMenu",
21
	"AcquireRootMenu",
Lines 54-64 Link Here
54
	"CALLBACK_1titleRectForBounds_1",
54
	"CALLBACK_1titleRectForBounds_1",
55
	"CALLBACK_1view_1stringForToolTip_1point_1userData_1",
55
	"CALLBACK_1view_1stringForToolTip_1point_1userData_1",
56
	"CALLBACK_1webView_1setFrame_1",
56
	"CALLBACK_1webView_1setFrame_1",
57
	"CFArrayGetCount",
58
	"CFArrayGetValueAtIndex",
57
	"CFAttributedStringCreate",
59
	"CFAttributedStringCreate",
58
	"CFDataGetBytePtr",
60
	"CFDataGetBytePtr",
59
	"CFDataGetLength",
61
	"CFDataGetLength",
60
	"CFDictionaryAddValue",
62
	"CFDictionaryAddValue",
61
	"CFDictionaryCreateMutable",
63
	"CFDictionaryCreateMutable",
64
	"CFNumberCreate",
65
	"CFNumberGetValue",
62
	"CFRange_1sizeof",
66
	"CFRange_1sizeof",
63
	"CFRelease",
67
	"CFRelease",
64
	"CFRunLoopAddObserver",
68
	"CFRunLoopAddObserver",
Lines 167-172 Link Here
167
	"GetThemeMetric",
171
	"GetThemeMetric",
168
	"HIThemeDrawFocusRect",
172
	"HIThemeDrawFocusRect",
169
	"JNIGetObject",
173
	"JNIGetObject",
174
	"JSEvaluateScript",
175
	"JSStringCreateWithUTF8CString",
176
	"JSStringRelease",
170
	"LMGetKbdType",
177
	"LMGetKbdType",
171
	"LSGetApplicationForInfo",
178
	"LSGetApplicationForInfo",
172
	"LineTo",
179
	"LineTo",
Lines 303-308 Link Here
303
	"NSLinkAttributeName",
310
	"NSLinkAttributeName",
304
	"NSNumberOfColorComponents",
311
	"NSNumberOfColorComponents",
305
	"NSObliquenessAttributeName",
312
	"NSObliquenessAttributeName",
313
	"NSOutlineViewColumnDidMoveNotification",
306
	"NSParagraphStyleAttributeName",
314
	"NSParagraphStyleAttributeName",
307
	"NSPointInRect",
315
	"NSPointInRect",
308
	"NSPoint_1sizeof",
316
	"NSPoint_1sizeof",
Lines 312-318 Link Here
312
	"NSPrintJobDisposition",
320
	"NSPrintJobDisposition",
313
	"NSPrintLastPage",
321
	"NSPrintLastPage",
314
	"NSPrintMustCollate",
322
	"NSPrintMustCollate",
323
	"NSPrintPagesAcross",
324
	"NSPrintPagesDown",
315
	"NSPrintPreviewJob",
325
	"NSPrintPreviewJob",
326
	"NSPrintPrinterName",
316
	"NSPrintSaveJob",
327
	"NSPrintSaveJob",
317
	"NSPrintSavePath",
328
	"NSPrintSavePath",
318
	"NSPrintScalingFactor",
329
	"NSPrintScalingFactor",
Lines 328-333 Link Here
328
	"NSStrokeWidthAttributeName",
339
	"NSStrokeWidthAttributeName",
329
	"NSSystemColorsDidChangeNotification",
340
	"NSSystemColorsDidChangeNotification",
330
	"NSTIFFPboardType",
341
	"NSTIFFPboardType",
342
	"NSTableViewColumnDidMoveNotification",
331
	"NSTemporaryDirectory",
343
	"NSTemporaryDirectory",
332
	"NSToolbarCustomizeToolbarItemIdentifier",
344
	"NSToolbarCustomizeToolbarItemIdentifier",
333
	"NSToolbarDidRemoveItemNotification",
345
	"NSToolbarDidRemoveItemNotification",
Lines 346-351 Link Here
346
	"NewRgn",
358
	"NewRgn",
347
	"OffsetRgn",
359
	"OffsetRgn",
348
	"OpenRgn",
360
	"OpenRgn",
361
	"PMCopyPageFormat",
362
	"PMCreatePageFormatWithPMPaper",
363
	"PMCreatePrintSettings",
364
	"PMCreateSession",
365
	"PMGetDuplex",
366
	"PMGetPageFormatPaper",
367
	"PMPageFormatGetPrinterID",
368
	"PMPaperCreateCustom",
369
	"PMPaperCreateLocalizedName",
370
	"PMPaperGetHeight",
371
	"PMPaperGetID",
372
	"PMPaperGetName",
373
	"PMPaperGetWidth",
374
	"PMPaperIsCustom",
375
	"PMPrintSettingsCopyKeys",
376
	"PMPrintSettingsGetValue",
377
	"PMPrintSettingsSetValue",
378
	"PMPrinterCreateFromPrinterID",
379
	"PMPrinterGetMimeTypes",
380
	"PMPrinterGetName",
381
	"PMPrinterGetOutputResolution",
382
	"PMPrinterGetPaperList",
383
	"PMPrinterSetOutputResolution",
384
	"PMRelease",
385
	"PMSessionGetCurrentPrinter",
386
	"PMSetDuplex",
349
	"PtInRgn",
387
	"PtInRgn",
350
	"QDRegionToRects",
388
	"QDRegionToRects",
351
	"RectInRgn",
389
	"RectInRgn",
(-)Eclipse SWT PI/cocoa/library/os_stats.h (+38 lines)
Lines 62-72 Link Here
62
	CALLBACK_1titleRectForBounds_1_FUNC,
62
	CALLBACK_1titleRectForBounds_1_FUNC,
63
	CALLBACK_1view_1stringForToolTip_1point_1userData_1_FUNC,
63
	CALLBACK_1view_1stringForToolTip_1point_1userData_1_FUNC,
64
	CALLBACK_1webView_1setFrame_1_FUNC,
64
	CALLBACK_1webView_1setFrame_1_FUNC,
65
	CFArrayGetCount_FUNC,
66
	CFArrayGetValueAtIndex_FUNC,
65
	CFAttributedStringCreate_FUNC,
67
	CFAttributedStringCreate_FUNC,
66
	CFDataGetBytePtr_FUNC,
68
	CFDataGetBytePtr_FUNC,
67
	CFDataGetLength_FUNC,
69
	CFDataGetLength_FUNC,
68
	CFDictionaryAddValue_FUNC,
70
	CFDictionaryAddValue_FUNC,
69
	CFDictionaryCreateMutable_FUNC,
71
	CFDictionaryCreateMutable_FUNC,
72
	CFNumberCreate_FUNC,
73
	CFNumberGetValue_FUNC,
70
	CFRange_1sizeof_FUNC,
74
	CFRange_1sizeof_FUNC,
71
	CFRelease_FUNC,
75
	CFRelease_FUNC,
72
	CFRunLoopAddObserver_FUNC,
76
	CFRunLoopAddObserver_FUNC,
Lines 175-180 Link Here
175
	GetThemeMetric_FUNC,
179
	GetThemeMetric_FUNC,
176
	HIThemeDrawFocusRect_FUNC,
180
	HIThemeDrawFocusRect_FUNC,
177
	JNIGetObject_FUNC,
181
	JNIGetObject_FUNC,
182
	JSEvaluateScript_FUNC,
183
	JSStringCreateWithUTF8CString_FUNC,
184
	JSStringRelease_FUNC,
178
	LMGetKbdType_FUNC,
185
	LMGetKbdType_FUNC,
179
	LSGetApplicationForInfo_FUNC,
186
	LSGetApplicationForInfo_FUNC,
180
	LineTo_FUNC,
187
	LineTo_FUNC,
Lines 311-316 Link Here
311
	NSLinkAttributeName_FUNC,
318
	NSLinkAttributeName_FUNC,
312
	NSNumberOfColorComponents_FUNC,
319
	NSNumberOfColorComponents_FUNC,
313
	NSObliquenessAttributeName_FUNC,
320
	NSObliquenessAttributeName_FUNC,
321
	NSOutlineViewColumnDidMoveNotification_FUNC,
314
	NSParagraphStyleAttributeName_FUNC,
322
	NSParagraphStyleAttributeName_FUNC,
315
	NSPointInRect_FUNC,
323
	NSPointInRect_FUNC,
316
	NSPoint_1sizeof_FUNC,
324
	NSPoint_1sizeof_FUNC,
Lines 320-326 Link Here
320
	NSPrintJobDisposition_FUNC,
328
	NSPrintJobDisposition_FUNC,
321
	NSPrintLastPage_FUNC,
329
	NSPrintLastPage_FUNC,
322
	NSPrintMustCollate_FUNC,
330
	NSPrintMustCollate_FUNC,
331
	NSPrintPagesAcross_FUNC,
332
	NSPrintPagesDown_FUNC,
323
	NSPrintPreviewJob_FUNC,
333
	NSPrintPreviewJob_FUNC,
334
	NSPrintPrinterName_FUNC,
324
	NSPrintSaveJob_FUNC,
335
	NSPrintSaveJob_FUNC,
325
	NSPrintSavePath_FUNC,
336
	NSPrintSavePath_FUNC,
326
	NSPrintScalingFactor_FUNC,
337
	NSPrintScalingFactor_FUNC,
Lines 336-341 Link Here
336
	NSStrokeWidthAttributeName_FUNC,
347
	NSStrokeWidthAttributeName_FUNC,
337
	NSSystemColorsDidChangeNotification_FUNC,
348
	NSSystemColorsDidChangeNotification_FUNC,
338
	NSTIFFPboardType_FUNC,
349
	NSTIFFPboardType_FUNC,
350
	NSTableViewColumnDidMoveNotification_FUNC,
339
	NSTemporaryDirectory_FUNC,
351
	NSTemporaryDirectory_FUNC,
340
	NSToolbarCustomizeToolbarItemIdentifier_FUNC,
352
	NSToolbarCustomizeToolbarItemIdentifier_FUNC,
341
	NSToolbarDidRemoveItemNotification_FUNC,
353
	NSToolbarDidRemoveItemNotification_FUNC,
Lines 354-359 Link Here
354
	NewRgn_FUNC,
366
	NewRgn_FUNC,
355
	OffsetRgn_FUNC,
367
	OffsetRgn_FUNC,
356
	OpenRgn_FUNC,
368
	OpenRgn_FUNC,
369
	PMCopyPageFormat_FUNC,
370
	PMCreatePageFormatWithPMPaper_FUNC,
371
	PMCreatePrintSettings_FUNC,
372
	PMCreateSession_FUNC,
373
	PMGetDuplex_FUNC,
374
	PMGetPageFormatPaper_FUNC,
375
	PMPageFormatGetPrinterID_FUNC,
376
	PMPaperCreateCustom_FUNC,
377
	PMPaperCreateLocalizedName_FUNC,
378
	PMPaperGetHeight_FUNC,
379
	PMPaperGetID_FUNC,
380
	PMPaperGetName_FUNC,
381
	PMPaperGetWidth_FUNC,
382
	PMPaperIsCustom_FUNC,
383
	PMPrintSettingsCopyKeys_FUNC,
384
	PMPrintSettingsGetValue_FUNC,
385
	PMPrintSettingsSetValue_FUNC,
386
	PMPrinterCreateFromPrinterID_FUNC,
387
	PMPrinterGetMimeTypes_FUNC,
388
	PMPrinterGetName_FUNC,
389
	PMPrinterGetOutputResolution_FUNC,
390
	PMPrinterGetPaperList_FUNC,
391
	PMPrinterSetOutputResolution_FUNC,
392
	PMRelease_FUNC,
393
	PMSessionGetCurrentPrinter_FUNC,
394
	PMSetDuplex_FUNC,
357
	PtInRgn_FUNC,
395
	PtInRgn_FUNC,
358
	QDRegionToRects_FUNC,
396
	QDRegionToRects_FUNC,
359
	RectInRgn_FUNC,
397
	RectInRgn_FUNC,
(-)Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSPrintInfo.java (-1 / +49 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 24-29 Link Here
24
	super(id);
24
	super(id);
25
}
25
}
26
26
27
public int /*long*/ PMPrintSession() {
28
	return OS.objc_msgSend(this.id, OS.sel_PMPrintSession);
29
}
30
31
public int /*long*/ PMPrintSettings() {
32
	return OS.objc_msgSend(this.id, OS.sel_PMPrintSettings);
33
}
34
27
public static NSPrinter defaultPrinter() {
35
public static NSPrinter defaultPrinter() {
28
	int /*long*/ result = OS.objc_msgSend(OS.class_NSPrintInfo, OS.sel_defaultPrinter);
36
	int /*long*/ result = OS.objc_msgSend(OS.class_NSPrintInfo, OS.sel_defaultPrinter);
29
	return result != 0 ? new NSPrinter(result) : null;
37
	return result != 0 ? new NSPrinter(result) : null;
Lines 45-50 Link Here
45
	return result == this.id ? this : (result != 0 ? new NSPrintInfo(result) : null);
53
	return result == this.id ? this : (result != 0 ? new NSPrintInfo(result) : null);
46
}
54
}
47
55
56
public void setPaperName (NSString paperName) {
57
	OS.objc_msgSend(this.id, OS.sel_setPaperName, paperName != null ? paperName.id : 0);
58
}
59
60
public void setPaperSize (NSSize paperSize) {
61
	OS.objc_msgSend(this.id, OS.sel_setPaperSize, paperSize != null ? paperSize : null);
62
}
63
48
public NSString jobDisposition() {
64
public NSString jobDisposition() {
49
	int /*long*/ result = OS.objc_msgSend(this.id, OS.sel_jobDisposition);
65
	int /*long*/ result = OS.objc_msgSend(this.id, OS.sel_jobDisposition);
50
	return result != 0 ? new NSString(result) : null;
66
	return result != 0 ? new NSString(result) : null;
Lines 60-65 Link Here
60
	return result;
76
	return result;
61
}
77
}
62
78
79
public NSString paperName() {
80
	int /*long*/ result = OS.objc_msgSend(this.id, OS.sel_paperName);
81
	return result != 0 ? new NSString(result) : null;
82
}
83
84
public int /*long*/ pmPageFormat() {
85
	return OS.objc_msgSend(this.id, OS.sel_pmPageFormat);
86
}
87
88
public float bottomMargin () {
89
	return OS.objc_msgSend(this.id, OS.sel_bottomMargin);
90
}
91
92
public float topMargin () {
93
	return OS.objc_msgSend(this.id, OS.sel_topMargin);
94
}
95
96
public float leftMargin () {
97
	return OS.objc_msgSend(this.id, OS.sel_leftMargin);
98
}
99
100
public float rightMargin () {
101
	return OS.objc_msgSend(this.id, OS.sel_rightMargin);
102
}
103
104
public void updateFromPMPageFormat() {
105
	OS.objc_msgSend(this.id, OS.sel_updateFromPMPageFormat);
106
}
63
public NSPrinter printer() {
107
public NSPrinter printer() {
64
	int /*long*/ result = OS.objc_msgSend(this.id, OS.sel_printer);
108
	int /*long*/ result = OS.objc_msgSend(this.id, OS.sel_printer);
65
	return result != 0 ? new NSPrinter(result) : null;
109
	return result != 0 ? new NSPrinter(result) : null;
Lines 86-89 Link Here
86
	return result != 0 ? new NSPrintInfo(result) : null;
130
	return result != 0 ? new NSPrintInfo(result) : null;
87
}
131
}
88
132
133
public void updateFromPMPrintSettings() {
134
	OS.objc_msgSend(this.id, OS.sel_updateFromPMPrintSettings);
135
}
136
89
}
137
}
(-)Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java (+163 lines)
Lines 659-664 Link Here
659
public static final int /*long*/ sel_CGEvent = sel_registerName("CGEvent");
659
public static final int /*long*/ sel_CGEvent = sel_registerName("CGEvent");
660
public static final int /*long*/ sel_DOMDocument = sel_registerName("DOMDocument");
660
public static final int /*long*/ sel_DOMDocument = sel_registerName("DOMDocument");
661
public static final int /*long*/ sel_IBeamCursor = sel_registerName("IBeamCursor");
661
public static final int /*long*/ sel_IBeamCursor = sel_registerName("IBeamCursor");
662
public static final int /*long*/ sel_PMPrintSettings = sel_registerName("PMPrintSettings");
663
public static final int /*long*/ sel_PMPrintSession = sel_registerName("PMPrintSession");
662
public static final int /*long*/ sel_TIFFRepresentation = sel_registerName("TIFFRepresentation");
664
public static final int /*long*/ sel_TIFFRepresentation = sel_registerName("TIFFRepresentation");
663
public static final int /*long*/ sel_URL = sel_registerName("URL");
665
public static final int /*long*/ sel_URL = sel_registerName("URL");
664
public static final int /*long*/ sel_URLFromPasteboard_ = sel_registerName("URLFromPasteboard:");
666
public static final int /*long*/ sel_URLFromPasteboard_ = sel_registerName("URLFromPasteboard:");
Lines 1184-1189 Link Here
1184
public static final int /*long*/ sel_itemObjectValueAtIndex_ = sel_registerName("itemObjectValueAtIndex:");
1186
public static final int /*long*/ sel_itemObjectValueAtIndex_ = sel_registerName("itemObjectValueAtIndex:");
1185
public static final int /*long*/ sel_itemTitleAtIndex_ = sel_registerName("itemTitleAtIndex:");
1187
public static final int /*long*/ sel_itemTitleAtIndex_ = sel_registerName("itemTitleAtIndex:");
1186
public static final int /*long*/ sel_jobDisposition = sel_registerName("jobDisposition");
1188
public static final int /*long*/ sel_jobDisposition = sel_registerName("jobDisposition");
1189
public static final int /*long*/ sel_setPaperName = sel_registerName("setPaperName:");
1190
public static final int /*long*/ sel_setPaperSize = sel_registerName("setPaperSize:");
1191
public static final int /*long*/ sel_paperName = sel_registerName("PaperName");
1192
public static final int /*long*/ sel_pmPageFormat = sel_registerName("PMPageFormat");
1193
public static final int /*long*/ sel_bottomMargin = sel_registerName("bottomMargin");
1194
public static final int /*long*/ sel_topMargin = sel_registerName("topMargin");
1195
public static final int /*long*/ sel_leftMargin = sel_registerName("leftMargin");
1196
public static final int /*long*/ sel_rightMargin = sel_registerName("rightMargin");
1197
public static final int /*long*/ sel_updateFromPMPageFormat = sel_registerName("updateFromPMPageFormat");
1187
public static final int /*long*/ sel_keyCode = sel_registerName("keyCode");
1198
public static final int /*long*/ sel_keyCode = sel_registerName("keyCode");
1188
public static final int /*long*/ sel_keyDown_ = sel_registerName("keyDown:");
1199
public static final int /*long*/ sel_keyDown_ = sel_registerName("keyDown:");
1189
public static final int /*long*/ sel_keyEquivalent = sel_registerName("keyEquivalent");
1200
public static final int /*long*/ sel_keyEquivalent = sel_registerName("keyEquivalent");
Lines 1837-1842 Link Here
1837
public static final int /*long*/ sel_unmarkText = sel_registerName("unmarkText");
1848
public static final int /*long*/ sel_unmarkText = sel_registerName("unmarkText");
1838
public static final int /*long*/ sel_unregisterDraggedTypes = sel_registerName("unregisterDraggedTypes");
1849
public static final int /*long*/ sel_unregisterDraggedTypes = sel_registerName("unregisterDraggedTypes");
1839
public static final int /*long*/ sel_update = sel_registerName("update");
1850
public static final int /*long*/ sel_update = sel_registerName("update");
1851
public static final int /*long*/ sel_updateFromPMPrintSettings = sel_registerName("updateFromPMPrintSettings");
1840
public static final int /*long*/ sel_updateTrackingAreas = sel_registerName("updateTrackingAreas");
1852
public static final int /*long*/ sel_updateTrackingAreas = sel_registerName("updateTrackingAreas");
1841
public static final int /*long*/ sel_use = sel_registerName("use");
1853
public static final int /*long*/ sel_use = sel_registerName("use");
1842
public static final int /*long*/ sel_useCredential_forAuthenticationChallenge_ = sel_registerName("useCredential:forAuthenticationChallenge:");
1854
public static final int /*long*/ sel_useCredential_forAuthenticationChallenge_ = sel_registerName("useCredential:forAuthenticationChallenge:");
Lines 1920-1925 Link Here
1920
public static final int /*long*/ sel_yearOfCommonEra = sel_registerName("yearOfCommonEra");
1932
public static final int /*long*/ sel_yearOfCommonEra = sel_registerName("yearOfCommonEra");
1921
public static final int /*long*/ sel_zoom_ = sel_registerName("zoom:");
1933
public static final int /*long*/ sel_zoom_ = sel_registerName("zoom:");
1922
1934
1935
/**
1936
 * @param settings cast=(PMPrintSettings)
1937
 * @param duplexMode cast=(PMDuplexMode)
1938
 * */
1939
public static final native void PMSetDuplex(int /*long*/ settings, int duplexMode);
1940
/**
1941
 * @param settings cast=(PMPrintSettings)
1942
 * @param duplexMode cast=(PMDuplexMode*)
1943
 * */
1944
public static final native void PMGetDuplex(int /*long*/ settings, int[] duplexMode);
1945
/**
1946
 * @param settings cast=(PMPrintSettings)
1947
 * @param key cast=(CFStringRef)
1948
 * @param value cast=(CFTypeRef)
1949
 * @param lock cast=(Boolean)
1950
 * */
1951
public static final native int PMPrintSettingsSetValue(int /*long*/ settings, int /*long*/ key, int value, boolean lock);
1952
/**
1953
 * @param settings cast=(PMPrintSettings)
1954
 * @param key cast=(CFStringRef)
1955
 * @param value cast=(CFTypeRef*)
1956
 * */
1957
public static final native int PMPrintSettingsGetValue(int /*long*/ settings, int /*long*/ key, int[] value);
1958
/**
1959
 * @param settings cast=(PMPrintSettings)
1960
 * @param settingKeys cast=(CFArrayRef*)
1961
 */
1962
public static final native int PMPrintSettingsCopyKeys(int /*long*/ settings, int[] settingKeys);
1963
/**
1964
 * @param numberRef cast=(CFNumberRef)
1965
 * @param type cast=(CFNumberType)
1966
 * @param value cast=(void *)
1967
 */
1968
public static final native boolean CFNumberGetValue(int /*long*/ numberRef, int type, int[] value);
1969
/** @param session cast=(PMPrintSession*) */
1970
public static final native int PMCreateSession(int[] session);
1971
/**
1972
 * @param printSession cast=(PMPrintSession)
1973
 * @param printer cast=(PMPrinter*)
1974
 */
1975
public static final native int PMSessionGetCurrentPrinter(int /*long*/ printSession, int[] printer);
1976
/**
1977
 * @param printer cast=(PMPrinter)
1978
 * @param paperList cast=(CFArrayRef*)
1979
 */
1980
public static final native int /*long*/ PMPrinterGetPaperList (int /*long*/ printer, int[] paperList);
1981
/** @param object cast =(PMObject) */
1982
public static final native int PMRelease (int /*long*/ object);
1983
/** @param array cast=(CFArrayRef) */
1984
public static final native int /*long*/ CFArrayGetCount (int array);
1985
/**
1986
 * @param array cast=(CFArrayRef)
1987
 * @param index cast=(CFIndex)
1988
 */
1989
public static final native int /*long*/ CFArrayGetValueAtIndex (int /*long*/ array, int index);
1990
/**
1991
 * @param pmPageFormat cast=(PMPageFormat)
1992
 * @param printerId cast=(CFStringRef*)
1993
 */
1994
public static final native int /*long*/ PMPageFormatGetPrinterID (int /*long*/ pmPageFormat, int[] printerId);
1995
/**
1996
 * @param pmPageFormat cast=(PMPageFormat*)
1997
 * @param pmPaper cast=(PMPaper)
1998
 */
1999
public static final native int /*long*/ PMCreatePageFormatWithPMPaper (int[] pmPageFormat, int /*long*/ pmPaper);
2000
/**
2001
 * @param pmPageFormat cast=(PMPageFormat)
2002
 * @param pmPaper cast=(PMPaper*)
2003
 */
2004
public static final native int /*long*/ PMGetPageFormatPaper (int/*long*/ pmPageFormat, int[] /*long*/ pmPaper);
2005
/** @param pmPaper cast=(PMPaper) 
2006
 * @param width cast=(double*)
2007
 */
2008
public static final native int /*long*/ PMPaperGetWidth (int /*long*/ pmPaper, double[] width);
2009
/** @param pmPaper cast=(PMPaper) 
2010
 * @param height cast=(double*)
2011
 */
2012
public static final native int /*long*/ PMPaperGetHeight (int /*long*/ pmPaper, double[] height);
2013
/**
2014
 * @param formatSrc cast=(PMPageFormat)
2015
 * @param formatDest cast=(PMPageFormat)
2016
 */
2017
public static final native int /*long*/ PMCopyPageFormat (int /*long*/ formatSrc, int /*long*/ formatDest);
2018
/**
2019
 * @param paper cast=(PMPaper)
2020
 * @param stringRef cast=(CFStringRef*)
2021
 */
2022
public static final native int /*long*/ PMPaperGetName (int /*long*/ paper, int[] stringRef);
2023
/**
2024
 * @param printer cast=(PMPrinter)
2025
 * @param id cast=(CFStringRef)
2026
 * @param name cast=(CFStringRef)
2027
 * @param width cast=(double)
2028
 * @param height cast=(double)
2029
 * @param margins cast=(const PMPaperMargins*)
2030
 * @param paper cast=(PMPaper*)
2031
 */
2032
public static final native int /*long*/ PMPaperCreateCustom (int /*long*/ printer, int /*long*/ id, int /*long*/ name, double width, double height, double[] margins, int[] paper);
2033
/**
2034
 * @param pmPaper cast=(PMPaper)
2035
 * @param pmPrinter cast=(PMPrinter)
2036
 * @param paperName cast=(CFStringRef*)
2037
 */
2038
public static final native int /*long*/ PMPaperCreateLocalizedName (int /*long*/ pmPaper, int /*long*/ pmPrinter, int[] /*long*/ paperName);
2039
/** @param pmPaper cast=(PMPaper) */
2040
public static final native boolean PMPaperIsCustom (int /*long*/ pmPaper);
2041
/** @param pmPrinter cast=(PMPrinter)*/
2042
public static final native int /*long*/ PMPrinterGetName (int /*long*/ pmPrinter);
2043
/** 
2044
 * @param pmPrinter cast=(PMPrinter)
2045
 * @param paperID cast=(CFStringRef*)
2046
 */
2047
public static final native int /*long*/ PMPaperGetID (int /*long*/ pmPrinter, int[] paperID);
2048
/**
2049
 * @param printer cast=(PMPrinter)
2050
 * @param settings cast=(PMPrintSettings)
2051
 * @param mime_types cast=(CFArrayRef*)
2052
 */
2053
public static final native int /*long*/ PMPrinterGetMimeTypes(int /*long*/ printer, int /*long*/ settings, int[] mime_types);
2054
/**
2055
 * @param printer cast=(PMPrinter)
2056
 * @param settings cast=(PMPrintSettings)
2057
 * @param mime_types cast=(PMResolution*)
2058
 */
2059
public static final native int /*long*/ PMPrinterGetOutputResolution(int /*long*/ printer, int /*long*/ settings, double[] resolution);
2060
/**
2061
 * @param printer cast=(PMPrinter)
2062
 * @param settings cast=(PMPrintSettings)
2063
 * @param mime_types cast=(PMResolution*)
2064
 */
2065
public static final native int /*long*/ PMPrinterSetOutputResolution(int /*long*/ printer, int /*long*/ settings, double[] resolution);
2066
/** @param printerId cast=(CFStringRef) */
2067
public static final native int /*long*/ PMPrinterCreateFromPrinterID(int /*long*/ printerId);
2068
/** @param settings cast=(PMPrintSettings*) */
2069
public static final native int /*long*/ PMCreatePrintSettings (int[] settings);
2070
/**
2071
 * @param allocator cast=(CFAllocatorRef)
2072
 * @param theType cast=(CFNumberType)
2073
 * @param valuePtr cast=(const void *)
2074
 */
2075
public static final native int /*long*/ CFNumberCreate (int /*long*/ allocator,int theType, int[] valuePtr);
2076
1923
/** Constants */
2077
/** Constants */
1924
public static final int NSAlertFirstButtonReturn = 1000;
2078
public static final int NSAlertFirstButtonReturn = 1000;
1925
public static final int NSAlertSecondButtonReturn = 1001;
2079
public static final int NSAlertSecondButtonReturn = 1001;
Lines 2503-2511 Link Here
2503
public static final native int /*long*/ NSPrintSavePath();
2657
public static final native int /*long*/ NSPrintSavePath();
2504
public static final NSString NSPrintSavePath = new NSString(NSPrintSavePath());
2658
public static final NSString NSPrintSavePath = new NSString(NSPrintSavePath());
2505
/** @method flags=const */
2659
/** @method flags=const */
2660
public static final native int /*long*/ NSPrintPrinterName();
2661
public static final NSString NSPrintPrinterName = new NSString(NSPrintPrinterName());
2662
/** @method flags=const */
2506
public static final native int /*long*/ NSPrintScalingFactor();
2663
public static final native int /*long*/ NSPrintScalingFactor();
2507
public static final NSString NSPrintScalingFactor = new NSString(NSPrintScalingFactor());
2664
public static final NSString NSPrintScalingFactor = new NSString(NSPrintScalingFactor());
2508
/** @method flags=const */
2665
/** @method flags=const */
2666
public static final native int /*long*/ NSPrintPagesAcross();
2667
public static final NSString NSPrintPagesAcross = new NSString(NSPrintPagesAcross());
2668
/** @method flags=const */
2669
public static final native int /*long*/ NSPrintPagesDown();
2670
public static final NSString NSPrintPagesDown = new NSString(NSPrintPagesDown());
2671
/** @method flags=const */
2509
public static final native int /*long*/ NSPrintSpoolJob();
2672
public static final native int /*long*/ NSPrintSpoolJob();
2510
public static final NSString NSPrintSpoolJob = new NSString(NSPrintSpoolJob());
2673
public static final NSString NSPrintSpoolJob = new NSString(NSPrintSpoolJob());
2511
/** @method flags=const */
2674
/** @method flags=const */
(-)Eclipse SWT Printing/cocoa/org/eclipse/swt/printing/PrintDialog.java (-8 / +131 lines)
Lines 154-174 Link Here
154
	PrinterData data = null;
154
	PrinterData data = null;
155
	NSPrintPanel panel = NSPrintPanel.printPanel();
155
	NSPrintPanel panel = NSPrintPanel.printPanel();
156
	NSPrintInfo printInfo = new NSPrintInfo(NSPrintInfo.sharedPrintInfo().copy());
156
	NSPrintInfo printInfo = new NSPrintInfo(NSPrintInfo.sharedPrintInfo().copy());
157
	printInfo.setOrientation(printerData.orientation == PrinterData.LANDSCAPE ? OS.NSLandscapeOrientation : OS.NSPortraitOrientation);
157
	NSMutableDictionary dict = printInfo.dictionary();
158
	NSMutableDictionary dict = printInfo.dictionary();	
158
	/* Settings */
159
	dict.setValue(NSNumber.numberWithBool(printerData.collate), OS.NSPrintMustCollate);
159
	int /*long*/ pmSettings = printInfo.PMPrintSettings();// Do not release unless retain it
160
	dict.setValue(NSNumber.numberWithInt(printerData.copyCount), OS.NSPrintCopies);
160
	/* Duplex setting */
161
	OS.PMSetDuplex(pmSettings, printerData.duplex);
162
	/* Updating the pmPrintSettings to printInfo overrides all the setting
163
	 * values contained in the printInfo dictionary. So, any changes to pmPrintSettings
164
	 * should be updated initially itself to avoid any accidental overriding.
165
	 * Similar cast applies to pmPageFormat as well.
166
	 */
167
	printInfo.updateFromPMPrintSettings();
168
	/* Print to File */
161
	if (printerData.printToFile) {
169
	if (printerData.printToFile) {
162
		dict.setValue(OS.NSPrintSaveJob, OS.NSPrintJobDisposition);
170
		dict.setValue(OS.NSPrintSaveJob, OS.NSPrintJobDisposition);
171
		if (printerData.fileName != null && printerData.fileName.length() > 0) {
172
			dict.setValue(NSString.stringWith(printerData.fileName), OS.NSPrintSavePath);
173
		}
174
	} else if (printerData.name != null){
175
		dict.setValue(NSString.stringWith(printerData.name), OS.NSPrintPrinterName);
163
	}
176
	}
164
	if (printerData.fileName != null && printerData.fileName.length() > 0) {
177
	int /*long*/ session = printInfo.PMPrintSession();// Do not release unless retain it
165
		dict.setValue(NSString.stringWith(printerData.fileName), OS.NSPrintSavePath);
178
	int[] pmPrinter = new int[1];
179
	int res = OS.PMSessionGetCurrentPrinter (session, pmPrinter);
180
	/* Paper Size Name */
181
	if (printerData.paperSizeName.intern() == PrinterData.PAPER_CUSTOM) {
182
		int[] pmPaper = new int[1];
183
		double[] margins = {printInfo.topMargin(), printInfo.leftMargin(), printInfo.bottomMargin(), printInfo.rightMargin()};
184
		String customNameStr = (printerData.customPaperDisplayName != null) ? printerData.customPaperDisplayName : "CustomPaper";
185
		char[] customNameChars = new char[customNameStr.length()];
186
		customNameStr.getChars(0, customNameChars.length, customNameChars, 0);
187
		int /*long*/ customNameCFStr = OS.CFStringCreateWithCharacters (0,customNameChars,customNameChars.length);
188
		String customIdStr = (printerData.customPaperName != null) ? printerData.customPaperName : "CustomPaper";
189
		char[] customIdChars = new char[customIdStr.length()];
190
		customIdStr.getChars(0, customIdChars.length, customIdChars, 0);
191
		int /*long*/ customIdCFStr = OS.CFStringCreateWithCharacters (0,customIdChars,customIdChars.length);
192
		
193
		int /*long*/ pmPageFormat = printInfo.pmPageFormat();// Do not release unless retain it
194
		res = OS.PMPaperCreateCustom (pmPrinter[0], customIdCFStr, customNameCFStr, printerData.customPaperWidth * 72, printerData.customPaperHeight * 72, margins, pmPaper);
195
		if (res == OS.noErr) {
196
			int[] /*long*/ newPageFormat = new int[1];
197
			OS.PMCreatePageFormatWithPMPaper (newPageFormat, pmPaper[0]);
198
			OS.PMCopyPageFormat (newPageFormat[0],pmPageFormat);
199
			printInfo.updateFromPMPageFormat();
200
			OS.PMRelease(newPageFormat[0]);
201
		}
202
		int[] pmPaperName = new int[1];
203
		OS.PMPaperGetName (pmPaper[0], pmPaperName);
204
		NSString paperNameStr = new NSString(pmPaperName[0]);
205
		printInfo.setPaperName (paperNameStr);
206
		
207
		OS.CFRelease (customNameCFStr);
208
		OS.CFRelease (customIdCFStr);
209
		OS.PMRelease (pmPaperName[0]);
210
	} else {
211
		String[] keys = {PrinterData.PAPER_LEGAL, PrinterData.PAPER_LETTER, PrinterData.PAPER_A2, PrinterData.PAPER_A4, 
212
				PrinterData.PAPER_A5, PrinterData.PAPER_A6, PrinterData.PAPER_B5, PrinterData.PAPER_JB5, PrinterData.PAPER_EXECUTIVE};
213
		String[] values = {"Legal", "Letter", "iso-a2-envelope", "A4", 
214
				"A5", "A6", "ISOB5", "JISB5", "Executive"};
215
		int index;
216
		for (index = 0; index < keys.length; index++) {
217
			if (printerData.paperSizeName.intern() == keys[index].intern()) break;
218
		}
219
		NSString paperNameStr = (NSString) new NSString().alloc();
220
		if (index < keys.length) {
221
			paperNameStr = paperNameStr.initWithString (values[index]);
222
		} else {
223
			paperNameStr = paperNameStr.initWithString (printerData.paperSizeName);
224
		}
225
		printInfo.setPaperName (paperNameStr);
166
	}
226
	}
227
	/* Orientation */
228
	printInfo.setOrientation(printerData.orientation == PrinterData.LANDSCAPE ? OS.NSLandscapeOrientation : OS.NSPortraitOrientation);
229
	/* Collate */
230
	dict.setValue(NSNumber.numberWithBool(printerData.collate), OS.NSPrintMustCollate);
231
	/* Copy count */
232
	dict.setValue(NSNumber.numberWithInt(printerData.copyCount), OS.NSPrintCopies);
233
	/* Page Scope */
167
	dict.setValue(NSNumber.numberWithBool(printerData.scope == PrinterData.ALL_PAGES), OS.NSPrintAllPages);
234
	dict.setValue(NSNumber.numberWithBool(printerData.scope == PrinterData.ALL_PAGES), OS.NSPrintAllPages);
235
	/* Page Range */
168
	if (printerData.scope == PrinterData.PAGE_RANGE) {
236
	if (printerData.scope == PrinterData.PAGE_RANGE) {
169
		dict.setValue(NSNumber.numberWithInt(printerData.startPage), OS.NSPrintFirstPage);
237
		dict.setValue(NSNumber.numberWithInt(printerData.startPage), OS.NSPrintFirstPage);
170
		dict.setValue(NSNumber.numberWithInt(printerData.endPage), OS.NSPrintLastPage);
238
		dict.setValue(NSNumber.numberWithInt(printerData.endPage), OS.NSPrintLastPage);
171
	}
239
	}
240
	/* Scaling factor value */
241
	dict.setValue(NSNumber.numberWithDouble(printerData.scale/100.0),OS.NSPrintScalingFactor);
242
	/* Pages per sheet */
243
	int columns = (int) Math.sqrt(printerData.pagesPerSide);
244
	dict.setValue(NSNumber.numberWithInt(columns), OS.NSPrintPagesAcross);
245
	dict.setValue(NSNumber.numberWithInt(printerData.pagesPerSide / columns), OS.NSPrintPagesDown);
246
	/* Output Resolution */
247
	if (printerData.resolutionX != 0 && printerData.resolutionY != 0) {
248
		double[] resolution = {printerData.resolutionX, printerData.resolutionY};
249
		OS.PMPrinterSetOutputResolution(pmPrinter[0], pmSettings, resolution);
250
	}
251
172
	panel.setOptions(OS.NSPrintPanelShowsPageSetupAccessory | panel.options());
252
	panel.setOptions(OS.NSPrintPanelShowsPageSetupAccessory | panel.options());
173
	Shell parent = getParent();
253
	Shell parent = getParent();
174
	Display display = parent != null ? parent.getDisplay() : Display.getCurrent();
254
	Display display = parent != null ? parent.getDisplay() : Display.getCurrent();
Lines 207-216 Link Here
207
			data.endPage = new NSNumber(dict.objectForKey(OS.NSPrintLastPage)).intValue();
287
			data.endPage = new NSNumber(dict.objectForKey(OS.NSPrintLastPage)).intValue();
208
		}
288
		}
209
		data.collate = new NSNumber(dict.objectForKey(OS.NSPrintMustCollate)).intValue() != 0;
289
		data.collate = new NSNumber(dict.objectForKey(OS.NSPrintMustCollate)).intValue() != 0;
210
		data.collate = false; //TODO: Only set to false if the printer does the collate internally (most printers do)
211
		data.copyCount = new NSNumber(dict.objectForKey(OS.NSPrintCopies)).intValue();
290
		data.copyCount = new NSNumber(dict.objectForKey(OS.NSPrintCopies)).intValue();
212
		data.copyCount = 1; //TODO: Only set to 1 if the printer does the copy internally (most printers do)
213
		data.orientation = printInfo.orientation() == OS.NSLandscapeOrientation ? PrinterData.LANDSCAPE : PrinterData.PORTRAIT;
291
		data.orientation = printInfo.orientation() == OS.NSLandscapeOrientation ? PrinterData.LANDSCAPE : PrinterData.PORTRAIT;
292
		data.scale = new NSNumber(dict.objectForKey(OS.NSPrintScalingFactor)).doubleValue() * 100;
293
		/* Pages per Side */
294
		int pagesAcross = new NSNumber(dict.objectForKey(OS.NSPrintPagesAcross)).intValue();
295
		int pagesDown = new NSNumber(dict.objectForKey(OS.NSPrintPagesDown)).intValue();
296
		data.pagesPerSide = pagesAcross * pagesDown;
297
		/* Duplex */
298
		int /*long*/ pmPrintSettings = printInfo.PMPrintSettings();
299
		int[] duplexMode = new int[1];
300
		OS.PMGetDuplex (pmPrintSettings, duplexMode);
301
		data.duplex = (int) duplexMode[0];
302
		/* Paper Size TODO:// 
303
		 * It appears to be a bug in Mac that at instances,
304
		 * PaperName might not be recognized as Custom 
305
		 * though it is Custom.
306
		 */
307
		int /*long*/ pageFormat = printInfo.pmPageFormat();
308
		int[] pmPaper = new int[1];
309
		OS.PMGetPageFormatPaper (pageFormat, pmPaper);
310
		if (OS.PMPaperIsCustom (pmPaper[0])) {
311
			data.paperSizeName = PrinterData.PAPER_CUSTOM;
312
			double[] height = new double[1];
313
			double[] width = new double[1];
314
			OS.PMPaperGetHeight (pmPaper[0], height);
315
			OS.PMPaperGetWidth (pmPaper[0], width);
316
			data.customPaperHeight = height[0] / 72;
317
			data.customPaperWidth = width[0] / 72;
318
			int[] pmPaperName = new int[1];
319
			OS.PMPaperGetName (pmPaper[0], pmPaperName);
320
			data.customPaperDisplayName = new NSString (pmPaperName[0]).getString();
321
			int[] pmPaperId = new int[1];
322
			OS.PMPaperGetID (pmPaper[0], pmPaperId);
323
			data.customPaperName = new NSString (pmPaperId[0]).getString();
324
		} else {
325
			int[] /*long*/ pmPaperName = new int[1];
326
			OS.PMPaperGetName (pmPaper[0], pmPaperName);
327
			data.paperSizeName = new NSString (pmPaperName[0]).getString();			
328
		}
329
		/* Resolution */
330
		session = printInfo.PMPrintSession();// Do not release unless retain it
331
		OS.PMSessionGetCurrentPrinter(session, pmPrinter);
332
		double[] resolution = new double[2];
333
		OS.PMPrinterGetOutputResolution(pmPrinter[0], pmPrintSettings, resolution);
334
		data.resolutionX = resolution[0];
335
		data.resolutionY = resolution[1];
336
		
214
		NSData nsData = NSKeyedArchiver.archivedDataWithRootObject(printInfo);
337
		NSData nsData = NSKeyedArchiver.archivedDataWithRootObject(printInfo);
215
		data.otherData = new byte[(int)/*64*/nsData.length()];
338
		data.otherData = new byte[(int)/*64*/nsData.length()];
216
		OS.memmove(data.otherData, nsData.bytes(), data.otherData.length);
339
		OS.memmove(data.otherData, nsData.bytes(), data.otherData.length);
(-)Eclipse SWT Printing/cocoa/org/eclipse/swt/printing/Printer.java (+28 lines)
Lines 48-53 Link Here
48
	static final String DRIVER = "Mac";
48
	static final String DRIVER = "Mac";
49
49
50
/**
50
/**
51
 * Returns an array of String objects representing all paper
52
 * size names supported by printers on the platform.
53
 * Note that some platforms return only the paper size names
54
 * supported by the default printer.
55
 * 
56
 * @return a string array containing paper size names
57
 */
58
public static String[] getPaperSizeList () {
59
	int[] session = new int[1];
60
	int res = OS.PMCreateSession(session);
61
	if (res != OS.noErr) return null;
62
	int[] printer = new int[1];
63
	res = OS.PMSessionGetCurrentPrinter(session[0], printer);
64
	if (res != OS.noErr) return null;
65
	int[] paperList = new int[1];
66
	res = OS.PMPrinterGetPaperList(printer[0], paperList);
67
	int count = OS.CFArrayGetCount (paperList[0]);
68
	String[] result = new String[count];
69
	for (int i=0; i<count; i++) {
70
		int /*long*/ paper = OS.CFArrayGetValueAtIndex (paperList[0],i);
71
		int[] paperName = new int[1];
72
		OS.PMPaperGetName (paper, paperName);
73
		result[i] = new NSString(paperName[0]).getString();
74
	}
75
	return result;
76
}
77
78
/**
51
 * Returns an array of <code>PrinterData</code> objects
79
 * Returns an array of <code>PrinterData</code> objects
52
 * representing all available printers.  If there are no
80
 * representing all available printers.  If there are no
53
 * printers, the array will be empty.
81
 * printers, the array will be empty.
(-)Eclipse SWT Printing/common/org/eclipse/swt/printing/PrinterData.java (+222 lines)
Lines 111-118 Link Here
111
	 * @since 3.5
111
	 * @since 3.5
112
	 */
112
	 */
113
	public int orientation = PORTRAIT;
113
	public int orientation = PORTRAIT;
114
	
115
	/**
116
	 * The scaling factor of the page and paper rectangle,
117
	 * expressed as a percentage by which the printed output 
118
	 * to be scaled. Default value is 100 indicating no scale.
119
	 * 
120
	 * @since 3.6
121
	 */
122
	public double scale = 100;
123
124
	/**
125
	 * The number of logical pages to be tiled on a
126
	 * physical sheet of paper, whose value can be 
127
	 * expressed either of 1, 2, 4, 6, 9 or 16.
128
	 * 
129
	 * @since 3.6
130
	 */
131
	public int pagesPerSide = 1;
132
	
133
	/**
134
	 * specifies a print job that can print either single-sided or 
135
	 * double-sided printing, expressed as one of the following values: 
136
	 * <dl>
137
	 * <dt><code>DUPLEX_SIMPLEX</code></dt>
138
	 * <dd>Normal one-sided printing</dd>
139
	 * <dt><code>DUPLEX_HORIZONTAL</code></dt>
140
	 * <dd>Duplex printing with page being horizontal</dd>
141
	 * <dt><code>DUPLEX_VERTICAL</code></dt>
142
	 * <dd>Duplex printing with page being vertical</dd>
143
	 * </dl>
144
	 * 
145
	 * @since 3.6
146
	 */
147
	public int duplex = DUPLEX_SIMPLEX;
148
	
149
	/**
150
	 * Specifies the name for the paper size used in a 
151
	 * print job, expressed as one of the following values:
152
	 * <dl>
153
	 * <dt><code>PAPER_LETTER</code></dt>
154
	 * <dt><code>PAPER_LEGAL</code></dt>
155
	 * <dt><code>PAPER_A2</code></dt>
156
	 * <dt><code>PAPER_A4</code></dt>
157
	 * <dt><code>PAPER_A5</code></dt>
158
	 * <dt><code>PAPER_A6</code></dt>
159
	 * <dt><code>PAPER_B5</code></dt>
160
	 * <dt><code>PAPER_JB5</code></dt>
161
	 * <dt><code>PAPER_EXECUTIVE</code></dt>
162
	 * <dt><code>PAPER_CUSTOM</code></dt>
163
	 * </dl>
164
	 * 
165
	 * Also accepts any paper size from the list of available paper size
166
	 * names returned by method <code>Printer.getPaperSizeList</code>.
167
	 * 
168
	 * @since 3.6
169
	 */
170
	public String paperSizeName = PAPER_A4;
171
	
172
	/**
173
	 * The physical height of the custom paper name in inches. 
174
	 * Note that this field is ignored if <code>paperSize</code>
175
	 * is not specified as <code>PAPER_CUSTOM</code>.
176
	 * 
177
	 * @since 3.6
178
	 */
179
	public double customPaperHeight = 0;
114
180
115
	/**
181
	/**
182
	 * The physical width of the custom paper name in inches. 
183
	 * Note that this field is ignored if <code>paperSize</code>
184
	 * is not specified as <code>PAPER_CUSTOM</code>.
185
	 * 
186
	 * @since 3.6
187
	 */
188
	public double customPaperWidth = 0;
189
190
	/**
191
	 * The name of the custom paper size. 
192
	 * Note that this field is ignored if <code>paperSize</code>
193
	 * is not specified as <code>PAPER_CUSTOM</code>.
194
	 * 
195
	 * @since 3.6
196
	 */
197
	public String customPaperName;
198
199
	/**
200
	 * The human-readable name of the custom paper size to
201
	 * be displayed in print dialog. Note that this field 
202
	 * is ignored if <code>paperSize</code> is not 
203
	 * specified as <code>PAPER_CUSTOM</code>.
204
	 * 
205
	 * @since 3.6
206
	 */
207
	public String customPaperDisplayName;
208
	
209
	/**
210
	 * Specifies the x-resolution, in dots-per-inch of the printer. 
211
	 * This configures the print settings to the closest resolution 
212
	 * setting that can be used for the destination print job.
213
	 * 
214
	 * @since 3.6
215
	 */
216
	public double resolutionX;
217
218
	/**
219
	 * Specifies the y-resolution, in dots-per-inch of the printer.
220
	 * This configures the print settings to the closest resolution 
221
	 * setting that can be used for the destination print job.
222
	 * 
223
	 * @since 3.6
224
	 */
225
	public double resolutionY;
226
	
227
	/**
116
	 * <code>scope</code> field value indicating that
228
	 * <code>scope</code> field value indicating that
117
	 * all pages should be printed
229
	 * all pages should be printed
118
	 */	
230
	 */	
Lines 148-153 Link Here
148
	public static final int LANDSCAPE = 2;
260
	public static final int LANDSCAPE = 2;
149
	
261
	
150
	/**
262
	/**
263
	 * <code>duplex</code> field value indicating
264
	 * one-sided printing
265
	 * 
266
	 * @since 3.6
267
	 */
268
	public static final int DUPLEX_SIMPLEX = 1;
269
	
270
	/**
271
	 * <code>duplex</code> field value indicating
272
	 * double sided printing on short edge
273
	 * 
274
	 * @since 3.6
275
	 */
276
	public static final int DUPLEX_HORIZONTAL = 2;
277
	
278
	/**
279
	 * <code>duplex</code> field value indicating
280
	 * double sided printing on long edge
281
	 * 
282
	 * @since 3.6
283
	 */
284
	public static final int DUPLEX_VERTICAL = 3;
285
	
286
	/**
287
	 * <code>paperSize</code> field value indicating
288
	 * the paper size as LETTER
289
	 * 
290
	 * @since 3.6
291
	 */
292
	public static final String PAPER_LETTER = "LETTER";
293
294
	/**
295
	 * <code>paperSize</code> field value indicating
296
	 * the paper size as LEGAL
297
	 * 
298
	 * @since 3.6
299
	 */
300
	public static final String PAPER_LEGAL = "LEGAL";
301
	
302
	/**
303
	 * <code>paperSize</code> field value indicating
304
	 * the paper size as A4 sheet
305
	 * 
306
	 * @since 3.6
307
	 */
308
	public static final String PAPER_A2 = "A2";
309
310
	/**
311
	 * <code>paperSize</code> field value indicating
312
	 * the paper size as A4 sheet
313
	 * 
314
	 * @since 3.6
315
	 */
316
	public static final String PAPER_A4 = "A4";
317
	
318
	/**
319
	 * <code>paperSize</code> field value indicating
320
	 * the paper size as A4 sheet
321
	 * 
322
	 * @since 3.6
323
	 */
324
	public static final String PAPER_A5 = "A5";
325
326
	/**
327
	 * <code>paperSize</code> field value indicating
328
	 * the paper size as A4 sheet
329
	 * 
330
	 * @since 3.6
331
	 */
332
	public static final String PAPER_A6 = "A6";
333
334
	/**
335
	 * <code>paperSize</code> field value indicating
336
	 * the paper size as B5 sheet
337
	 * 
338
	 * @since 3.6
339
	 */
340
	public static final String PAPER_B5 = "B5";
341
	
342
	/**
343
	 * <code>paperSize</code> field value indicating
344
	 * the paper size as JB5 sheet
345
	 * 
346
	 * @since 3.6
347
	 */
348
	public static final String PAPER_JB5 = "JB5";
349
	
350
	/**
351
	 * <code>paperSize</code> field value indicating
352
	 * the paper size as EXECUTIVE
353
	 * 
354
	 * @since 3.6
355
	 */
356
	public static final String PAPER_EXECUTIVE = "EXECUTIVE";
357
	
358
	/**
359
	 * <code>paperSize</code> field value indicating the paper 
360
	 * size as Custom. When this field is specified, the values 
361
	 * for <code>customPaperHeight</code> and <code>customPaperWidth</code>
362
	 * are required to create a custom paper size and optionally, 
363
	 * <code>customPaperName</code> <code>customPaperDisplayName</code>.
364
	 * 
365
	 * Note that customPaperHeight and customPaperWidth are ignored
366
	 * when the field has not specified this value.
367
	 * 
368
	 * @since 3.6
369
	 */
370
	public static final String PAPER_CUSTOM = "CUSTOM";
371
372
	/**
151
	 * private, platform-specific data
373
	 * private, platform-specific data
152
	 * On Windows, this contains a copy of the DEVMODE struct
374
	 * On Windows, this contains a copy of the DEVMODE struct
153
	 * returned from the <code>PrintDialog</code>.
375
	 * returned from the <code>PrintDialog</code>.

Return to bug 96394