diff options
author | Felipe Heidrich | 2009-08-27 17:33:04 +0000 |
---|---|---|
committer | Felipe Heidrich | 2009-08-27 17:33:04 +0000 |
commit | e1577f2d298a248d695320b02e69dd3add2b0ae3 (patch) | |
tree | 81d44e8a87671b7323773955fd8ad074d690d90b /bundles/org.eclipse.swt | |
parent | 8870de0d40c37d598f90dd32fe1912ceac4b8f40 (diff) | |
download | eclipse.platform.swt-e1577f2d298a248d695320b02e69dd3add2b0ae3.tar.gz eclipse.platform.swt-e1577f2d298a248d695320b02e69dd3add2b0ae3.tar.xz eclipse.platform.swt-e1577f2d298a248d695320b02e69dd3add2b0ae3.zip |
Bug 261270: No support for right-to-left Styled Text on Mac OS X
Diffstat (limited to 'bundles/org.eclipse.swt')
17 files changed, 313 insertions, 22 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os.c b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os.c index 1da1fc4b4a..6637135730 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os.c +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os.c @@ -1875,6 +1875,30 @@ fail: } #endif +#ifndef NO_CTParagraphStyleCreate +JNIEXPORT jintLong JNICALL OS_NATIVE(CTParagraphStyleCreate) + (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1) +{ + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, CTParagraphStyleCreate_FUNC); + rc = (jintLong)CTParagraphStyleCreate((CTParagraphStyleSetting*)arg0, (CFIndex)arg1); + OS_NATIVE_EXIT(env, that, CTParagraphStyleCreate_FUNC); + return rc; +} +#endif + +#ifndef NO_CTParagraphStyleSetting_1sizeof +JNIEXPORT jint JNICALL OS_NATIVE(CTParagraphStyleSetting_1sizeof) + (JNIEnv *env, jclass that) +{ + jint rc = 0; + OS_NATIVE_ENTER(env, that, CTParagraphStyleSetting_1sizeof_FUNC); + rc = (jint)CTParagraphStyleSetting_sizeof(); + OS_NATIVE_EXIT(env, that, CTParagraphStyleSetting_1sizeof_FUNC); + return rc; +} +#endif + #ifndef NO_CTTypesetterCreateLine JNIEXPORT jintLong JNICALL OS_NATIVE(CTTypesetterCreateLine) (JNIEnv *env, jclass that, jintLong arg0, jobject arg1) @@ -4916,6 +4940,18 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(kCTForegroundColorAttributeName) } #endif +#ifndef NO_kCTParagraphStyleAttributeName +JNIEXPORT jintLong JNICALL OS_NATIVE(kCTParagraphStyleAttributeName) + (JNIEnv *env, jclass that) +{ + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, kCTParagraphStyleAttributeName_FUNC); + rc = (jintLong)kCTParagraphStyleAttributeName; + OS_NATIVE_EXIT(env, that, kCTParagraphStyleAttributeName_FUNC); + return rc; +} +#endif + #if (!defined(NO_memmove__ILorg_eclipse_swt_internal_cocoa_CFRange_2I) && !defined(JNI64)) || (!defined(NO_memmove__JLorg_eclipse_swt_internal_cocoa_CFRange_2J) && defined(JNI64)) #ifndef JNI64 JNIEXPORT void JNICALL OS_NATIVE(memmove__ILorg_eclipse_swt_internal_cocoa_CFRange_2I)(JNIEnv *env, jclass that, jintLong arg0, jobject arg1, jintLong arg2) @@ -5066,6 +5102,31 @@ fail: } #endif +#if (!defined(NO_memmove__ILorg_eclipse_swt_internal_cocoa_CTParagraphStyleSetting_2I) && !defined(JNI64)) || (!defined(NO_memmove__JLorg_eclipse_swt_internal_cocoa_CTParagraphStyleSetting_2J) && defined(JNI64)) +#ifndef JNI64 +JNIEXPORT void JNICALL OS_NATIVE(memmove__ILorg_eclipse_swt_internal_cocoa_CTParagraphStyleSetting_2I)(JNIEnv *env, jclass that, jintLong arg0, jobject arg1, jintLong arg2) +#else +JNIEXPORT void JNICALL OS_NATIVE(memmove__JLorg_eclipse_swt_internal_cocoa_CTParagraphStyleSetting_2J)(JNIEnv *env, jclass that, jintLong arg0, jobject arg1, jintLong arg2) +#endif +{ + CTParagraphStyleSetting _arg1, *lparg1=NULL; +#ifndef JNI64 + OS_NATIVE_ENTER(env, that, memmove__ILorg_eclipse_swt_internal_cocoa_CTParagraphStyleSetting_2I_FUNC); +#else + OS_NATIVE_ENTER(env, that, memmove__JLorg_eclipse_swt_internal_cocoa_CTParagraphStyleSetting_2J_FUNC); +#endif + if (arg1) if ((lparg1 = getCTParagraphStyleSettingFields(env, arg1, &_arg1)) == NULL) goto fail; + memmove((void *)arg0, (void *)lparg1, arg2); +fail: + if (arg1 && lparg1) setCTParagraphStyleSettingFields(env, arg1, lparg1); +#ifndef JNI64 + OS_NATIVE_EXIT(env, that, memmove__ILorg_eclipse_swt_internal_cocoa_CTParagraphStyleSetting_2I_FUNC); +#else + OS_NATIVE_EXIT(env, that, memmove__JLorg_eclipse_swt_internal_cocoa_CTParagraphStyleSetting_2J_FUNC); +#endif +} +#endif + #if (!defined(NO_memmove__ILorg_eclipse_swt_internal_cocoa_NSAffineTransformStruct_2I) && !defined(JNI64)) || (!defined(NO_memmove__JLorg_eclipse_swt_internal_cocoa_NSAffineTransformStruct_2J) && defined(JNI64)) #ifndef JNI64 JNIEXPORT void JNICALL OS_NATIVE(memmove__ILorg_eclipse_swt_internal_cocoa_NSAffineTransformStruct_2I)(JNIEnv *env, jclass that, jintLong arg0, jobject arg1, jintLong arg2) @@ -5341,6 +5402,31 @@ fail: } #endif +#if (!defined(NO_memmove__Lorg_eclipse_swt_internal_cocoa_CTParagraphStyleSetting_2II) && !defined(JNI64)) || (!defined(NO_memmove__Lorg_eclipse_swt_internal_cocoa_CTParagraphStyleSetting_2JJ) && defined(JNI64)) +#ifndef JNI64 +JNIEXPORT void JNICALL OS_NATIVE(memmove__Lorg_eclipse_swt_internal_cocoa_CTParagraphStyleSetting_2II)(JNIEnv *env, jclass that, jobject arg0, jintLong arg1, jintLong arg2) +#else +JNIEXPORT void JNICALL OS_NATIVE(memmove__Lorg_eclipse_swt_internal_cocoa_CTParagraphStyleSetting_2JJ)(JNIEnv *env, jclass that, jobject arg0, jintLong arg1, jintLong arg2) +#endif +{ + CTParagraphStyleSetting _arg0, *lparg0=NULL; +#ifndef JNI64 + OS_NATIVE_ENTER(env, that, memmove__Lorg_eclipse_swt_internal_cocoa_CTParagraphStyleSetting_2II_FUNC); +#else + OS_NATIVE_ENTER(env, that, memmove__Lorg_eclipse_swt_internal_cocoa_CTParagraphStyleSetting_2JJ_FUNC); +#endif + if (arg0) if ((lparg0 = &_arg0) == NULL) goto fail; + memmove((void *)lparg0, (void *)arg1, arg2); +fail: + if (arg0 && lparg0) setCTParagraphStyleSettingFields(env, arg0, lparg0); +#ifndef JNI64 + OS_NATIVE_EXIT(env, that, memmove__Lorg_eclipse_swt_internal_cocoa_CTParagraphStyleSetting_2II_FUNC); +#else + OS_NATIVE_EXIT(env, that, memmove__Lorg_eclipse_swt_internal_cocoa_CTParagraphStyleSetting_2JJ_FUNC); +#endif +} +#endif + #if (!defined(NO_memmove__Lorg_eclipse_swt_internal_cocoa_NSAffineTransformStruct_2II) && !defined(JNI64)) || (!defined(NO_memmove__Lorg_eclipse_swt_internal_cocoa_NSAffineTransformStruct_2JJ) && defined(JNI64)) #ifndef JNI64 JNIEXPORT void JNICALL OS_NATIVE(memmove__Lorg_eclipse_swt_internal_cocoa_NSAffineTransformStruct_2II)(JNIEnv *env, jclass that, jobject arg0, jintLong arg1, jintLong arg2) diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.c b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.c index c2bab420f3..bba6aa0eb6 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.c +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.c @@ -14,8 +14,8 @@ #ifdef NATIVE_STATS -int OS_nativeFunctionCount = 520; -int OS_nativeFunctionCallCount[520]; +int OS_nativeFunctionCount = 525; +int OS_nativeFunctionCallCount[525]; char * OS_nativeFunctionNames[] = { "ATSFontActivateFromFileReference", "AcquireRootMenu", @@ -142,6 +142,8 @@ char * OS_nativeFunctionNames[] = { "CTLineCreateWithAttributedString", "CTLineDraw", "CTLineGetTypographicBounds", + "CTParagraphStyleCreate", + "CTParagraphStyleSetting_1sizeof", "CTTypesetterCreateLine", "CTTypesetterCreateWithAttributedString", "CTTypesetterSuggestLineBreak", @@ -372,6 +374,7 @@ char * OS_nativeFunctionNames[] = { "kCFTypeDictionaryValueCallBacks", "kCTFontAttributeName", "kCTForegroundColorAttributeName", + "kCTParagraphStyleAttributeName", "kTISPropertyUnicodeKeyLayoutData", #ifndef JNI64 "memmove__ILorg_eclipse_swt_internal_cocoa_CFRange_2I", @@ -404,6 +407,11 @@ char * OS_nativeFunctionNames[] = { "memmove__JLorg_eclipse_swt_internal_cocoa_CGSize_2J", #endif #ifndef JNI64 + "memmove__ILorg_eclipse_swt_internal_cocoa_CTParagraphStyleSetting_2I", +#else + "memmove__JLorg_eclipse_swt_internal_cocoa_CTParagraphStyleSetting_2J", +#endif +#ifndef JNI64 "memmove__ILorg_eclipse_swt_internal_cocoa_NSAffineTransformStruct_2I", #else "memmove__JLorg_eclipse_swt_internal_cocoa_NSAffineTransformStruct_2J", @@ -459,6 +467,11 @@ char * OS_nativeFunctionNames[] = { "memmove__Lorg_eclipse_swt_internal_cocoa_CGSize_2JJ", #endif #ifndef JNI64 + "memmove__Lorg_eclipse_swt_internal_cocoa_CTParagraphStyleSetting_2II", +#else + "memmove__Lorg_eclipse_swt_internal_cocoa_CTParagraphStyleSetting_2JJ", +#endif +#ifndef JNI64 "memmove__Lorg_eclipse_swt_internal_cocoa_NSAffineTransformStruct_2II", #else "memmove__Lorg_eclipse_swt_internal_cocoa_NSAffineTransformStruct_2JJ", diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.h index 43096daa18..20d7d525ec 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.h +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.h @@ -150,6 +150,8 @@ typedef enum { CTLineCreateWithAttributedString_FUNC, CTLineDraw_FUNC, CTLineGetTypographicBounds_FUNC, + CTParagraphStyleCreate_FUNC, + CTParagraphStyleSetting_1sizeof_FUNC, CTTypesetterCreateLine_FUNC, CTTypesetterCreateWithAttributedString_FUNC, CTTypesetterSuggestLineBreak_FUNC, @@ -380,6 +382,7 @@ typedef enum { kCFTypeDictionaryValueCallBacks_FUNC, kCTFontAttributeName_FUNC, kCTForegroundColorAttributeName_FUNC, + kCTParagraphStyleAttributeName_FUNC, kTISPropertyUnicodeKeyLayoutData_FUNC, #ifndef JNI64 memmove__ILorg_eclipse_swt_internal_cocoa_CFRange_2I_FUNC, @@ -412,6 +415,11 @@ typedef enum { memmove__JLorg_eclipse_swt_internal_cocoa_CGSize_2J_FUNC, #endif #ifndef JNI64 + memmove__ILorg_eclipse_swt_internal_cocoa_CTParagraphStyleSetting_2I_FUNC, +#else + memmove__JLorg_eclipse_swt_internal_cocoa_CTParagraphStyleSetting_2J_FUNC, +#endif +#ifndef JNI64 memmove__ILorg_eclipse_swt_internal_cocoa_NSAffineTransformStruct_2I_FUNC, #else memmove__JLorg_eclipse_swt_internal_cocoa_NSAffineTransformStruct_2J_FUNC, @@ -467,6 +475,11 @@ typedef enum { memmove__Lorg_eclipse_swt_internal_cocoa_CGSize_2JJ_FUNC, #endif #ifndef JNI64 + memmove__Lorg_eclipse_swt_internal_cocoa_CTParagraphStyleSetting_2II_FUNC, +#else + memmove__Lorg_eclipse_swt_internal_cocoa_CTParagraphStyleSetting_2JJ_FUNC, +#endif +#ifndef JNI64 memmove__Lorg_eclipse_swt_internal_cocoa_NSAffineTransformStruct_2II_FUNC, #else memmove__Lorg_eclipse_swt_internal_cocoa_NSAffineTransformStruct_2JJ_FUNC, diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_structs.c b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_structs.c index 66ba9da232..4013ae7de2 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_structs.c +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_structs.c @@ -240,6 +240,43 @@ void setCGSizeFields(JNIEnv *env, jobject lpObject, CGSize *lpStruct) } #endif +#ifndef NO_CTParagraphStyleSetting +typedef struct CTParagraphStyleSetting_FID_CACHE { + int cached; + jclass clazz; + jfieldID spec, valueSize, value; +} CTParagraphStyleSetting_FID_CACHE; + +CTParagraphStyleSetting_FID_CACHE CTParagraphStyleSettingFc; + +void cacheCTParagraphStyleSettingFields(JNIEnv *env, jobject lpObject) +{ + if (CTParagraphStyleSettingFc.cached) return; + CTParagraphStyleSettingFc.clazz = (*env)->GetObjectClass(env, lpObject); + CTParagraphStyleSettingFc.spec = (*env)->GetFieldID(env, CTParagraphStyleSettingFc.clazz, "spec", "I"); + CTParagraphStyleSettingFc.valueSize = (*env)->GetFieldID(env, CTParagraphStyleSettingFc.clazz, "valueSize", I_J); + CTParagraphStyleSettingFc.value = (*env)->GetFieldID(env, CTParagraphStyleSettingFc.clazz, "value", I_J); + CTParagraphStyleSettingFc.cached = 1; +} + +CTParagraphStyleSetting *getCTParagraphStyleSettingFields(JNIEnv *env, jobject lpObject, CTParagraphStyleSetting *lpStruct) +{ + if (!CTParagraphStyleSettingFc.cached) cacheCTParagraphStyleSettingFields(env, lpObject); + lpStruct->spec = (CTParagraphStyleSpecifier)(*env)->GetIntField(env, lpObject, CTParagraphStyleSettingFc.spec); + lpStruct->valueSize = (*env)->GetIntLongField(env, lpObject, CTParagraphStyleSettingFc.valueSize); + lpStruct->value = (void *)(*env)->GetIntLongField(env, lpObject, CTParagraphStyleSettingFc.value); + return lpStruct; +} + +void setCTParagraphStyleSettingFields(JNIEnv *env, jobject lpObject, CTParagraphStyleSetting *lpStruct) +{ + if (!CTParagraphStyleSettingFc.cached) cacheCTParagraphStyleSettingFields(env, lpObject); + (*env)->SetIntField(env, lpObject, CTParagraphStyleSettingFc.spec, (jint)lpStruct->spec); + (*env)->SetIntLongField(env, lpObject, CTParagraphStyleSettingFc.valueSize, (jintLong)lpStruct->valueSize); + (*env)->SetIntLongField(env, lpObject, CTParagraphStyleSettingFc.value, (jintLong)lpStruct->value); +} +#endif + #ifndef NO_NSAffineTransformStruct typedef struct NSAffineTransformStruct_FID_CACHE { int cached; diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_structs.h b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_structs.h index a8a0d00ba0..009ded29f2 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_structs.h +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_structs.h @@ -83,6 +83,18 @@ void setCGSizeFields(JNIEnv *env, jobject lpObject, CGSize *lpStruct); #define CGSize_sizeof() 0 #endif +#ifndef NO_CTParagraphStyleSetting +void cacheCTParagraphStyleSettingFields(JNIEnv *env, jobject lpObject); +CTParagraphStyleSetting *getCTParagraphStyleSettingFields(JNIEnv *env, jobject lpObject, CTParagraphStyleSetting *lpStruct); +void setCTParagraphStyleSettingFields(JNIEnv *env, jobject lpObject, CTParagraphStyleSetting *lpStruct); +#define CTParagraphStyleSetting_sizeof() sizeof(CTParagraphStyleSetting) +#else +#define cacheCTParagraphStyleSettingFields(a,b) +#define getCTParagraphStyleSettingFields(a,b,c) NULL +#define setCTParagraphStyleSettingFields(a,b,c) +#define CTParagraphStyleSetting_sizeof() 0 +#endif + #ifndef NO_NSAffineTransformStruct void cacheNSAffineTransformStructFields(JNIEnv *env, jobject lpObject); NSAffineTransformStruct *getNSAffineTransformStructFields(JNIEnv *env, jobject lpObject, NSAffineTransformStruct *lpStruct); diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/AppKitFull.bridgesupport.extras b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/AppKitFull.bridgesupport.extras index bdd56d69bf..9b520e5bf4 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/AppKitFull.bridgesupport.extras +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/AppKitFull.bridgesupport.extras @@ -299,6 +299,9 @@ <enum name="NSWindowCollectionBehaviorCanJoinAllSpaces" swt_gen="true"></enum> <enum name="NSWindowCollectionBehaviorDefault" swt_gen="true"></enum> <enum name="NSWindowCollectionBehaviorMoveToActiveSpace" swt_gen="true"></enum> + <enum name="NSWritingDirectionLeftToRight" swt_gen="true"></enum> + <enum name="NSWritingDirectionNatural" swt_gen="true"></enum> + <enum name="NSWritingDirectionRightToLeft" swt_gen="true"></enum> <enum name="NSYearMonthDatePickerElementFlag" swt_gen="true"></enum> <enum name="NSYearMonthDayDatePickerElementFlag" swt_gen="true"></enum> <function name="NSAccessibilityActionDescription" swt_gen="true"> @@ -1054,6 +1057,10 @@ <arg name="obj" swt_gen="true"></arg> <retval swt_gen="true"></retval> </method> + <method selector="setBaseWritingDirection:" swt_gen="true"> + <arg name="writingDirection" swt_gen="true"></arg> + <retval swt_gen="true"></retval> + </method> <method selector="setControlSize:" swt_gen="true"> <arg name="size" swt_gen="true"></arg> <retval swt_gen="true"></retval> @@ -1352,6 +1359,10 @@ <arg name="mode" swt_gen="true"></arg> <retval swt_gen="true"></retval> </method> + <method selector="setBaseWritingDirection:" swt_gen="true"> + <arg name="writingDirection" swt_gen="true"></arg> + <retval swt_gen="true"></retval> + </method> <method selector="setCell:" swt_gen="true"> <arg name="aCell" swt_gen="true"></arg> <retval swt_gen="true"></retval> @@ -2155,6 +2166,11 @@ <arg name="str" swt_gen="true"></arg> <retval swt_gen="true"></retval> </method> + <method selector="setBaseWritingDirection:range:" swt_gen="true"> + <arg name="writingDirection" swt_gen="true"></arg> + <arg name="range" swt_gen="true"></arg> + <retval swt_gen="true"></retval> + </method> </class> <class name="NSMutableParagraphStyle" swt_gen="mixed" swt_superclass="NSParagraphStyle"> <method selector="addTabStop:" swt_gen="true"> @@ -2165,6 +2181,10 @@ <arg name="alignment" swt_gen="true"></arg> <retval swt_gen="true"></retval> </method> + <method selector="setBaseWritingDirection:" swt_gen="true"> + <arg name="writingDirection" swt_gen="true"></arg> + <retval swt_gen="true"></retval> + </method> <method selector="setDefaultTabInterval:" swt_gen="true"> <arg name="aFloat" swt_gen="true"></arg> <retval swt_gen="true"></retval> @@ -3495,6 +3515,10 @@ <arg name="color" swt_gen="true"></arg> <retval swt_gen="true"></retval> </method> + <method selector="setBaseWritingDirection:" swt_gen="true"> + <arg name="writingDirection" swt_gen="true"></arg> + <retval swt_gen="true"></retval> + </method> <method selector="setDelegate:" swt_gen="true"> <arg name="anObject" swt_gen="true"></arg> <retval swt_gen="true"></retval> @@ -3673,6 +3697,11 @@ <method selector="markedTextAttributes" swt_gen="true"> <retval swt_gen="true"></retval> </method> + <method selector="setBaseWritingDirection:range:" swt_gen="true"> + <arg name="writingDirection" swt_gen="true"></arg> + <arg name="range" swt_gen="true"></arg> + <retval swt_gen="true"></retval> + </method> <method selector="setDefaultParagraphStyle:" swt_gen="true"> <arg name="paragraphStyle" swt_gen="true"></arg> <retval swt_gen="true"></retval> @@ -4765,26 +4794,26 @@ </informal_protocol> <class name="NSSecureTextField" swt_gen="true" swt_superclass="NSTextField"></class> <informal_protocol name="NSTextInput" swt_gen="true"> - <method selector="markedRange" swt_gen="true" swt_gen_custom_callback="true"></method> + <method selector="hasMarkedText" swt_gen="true"></method> <method selector="insertText:" swt_gen="true"> <arg name="aString" swt_gen="true"></arg> </method> <method selector="unmarkText" swt_gen="true"></method> - <method selector="hasMarkedText" swt_gen="true"></method> - <method selector="validAttributesForMarkedText" swt_gen="true"></method> + <method selector="selectedRange" swt_gen="true" swt_gen_custom_callback="true"></method> <method selector="characterIndexForPoint:" swt_gen="true" swt_gen_custom_callback="true"> <arg name="thePoint" swt_gen="true"></arg> </method> + <method selector="firstRectForCharacterRange:" swt_gen="true" swt_gen_custom_callback="true"> + <arg name="theRange" swt_gen="true"></arg> + </method> + <method selector="validAttributesForMarkedText" swt_gen="true"></method> <method selector="attributedSubstringFromRange:" swt_gen="true" swt_gen_custom_callback="true"> <arg name="theRange" swt_gen="true"></arg> </method> - <method selector="selectedRange" swt_gen="true" swt_gen_custom_callback="true"></method> <method selector="setMarkedText:selectedRange:" swt_gen="true" swt_gen_custom_callback="true"> <arg name="selRange" swt_gen="true"></arg> <arg name="aString" swt_gen="true"></arg> </method> - <method selector="firstRectForCharacterRange:" swt_gen="true" swt_gen_custom_callback="true"> - <arg name="theRange" swt_gen="true"></arg> - </method> + <method selector="markedRange" swt_gen="true" swt_gen_custom_callback="true"></method> </informal_protocol> </signatures> diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/CTParagraphStyleSetting.java b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/CTParagraphStyleSetting.java new file mode 100644 index 0000000000..fafe146fac --- /dev/null +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/CTParagraphStyleSetting.java @@ -0,0 +1,21 @@ +/******************************************************************************* + * Copyright (c) 2009 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.swt.internal.cocoa; + +public class CTParagraphStyleSetting { + /** @field cast=(CTParagraphStyleSpecifier) */ + public int spec; + public int /*long*/ valueSize; + /** @field cast=(void *) */ + public int /*long*/ value; + public static final int sizeof = OS.CTParagraphStyleSetting_sizeof(); +}
\ No newline at end of file diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/CoreTextFull.bridgesupport.extras b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/CoreTextFull.bridgesupport.extras index e1280b68f1..4722f6a712 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/CoreTextFull.bridgesupport.extras +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/CoreTextFull.bridgesupport.extras @@ -1,7 +1,17 @@ <?xml version="1.0" encoding="UTF8"?> <signatures swt_gen="mixed"> + <struct name="CTParagraphStyleSetting" swt_gen="true"> + <field name="spec" swt_gen="true"></field> + <field name="valueSize" swt_gen="true"></field> + <field name="value" swt_gen="true"></field> + </struct> <constant name="kCTFontAttributeName" swt_gen="true"></constant> <constant name="kCTForegroundColorAttributeName" swt_gen="true"></constant> + <constant name="kCTParagraphStyleAttributeName" swt_gen="true"></constant> + <enum name="kCTParagraphStyleSpecifierBaseWritingDirection" swt_gen="true"></enum> + <enum name="kCTWritingDirectionLeftToRight" swt_gen="true"></enum> + <enum name="kCTWritingDirectionNatural" swt_gen="true"></enum> + <enum name="kCTWritingDirectionRightToLeft" swt_gen="true"></enum> <function name="CTFontGetAscent" swt_gen="true"> <arg name="font" swt_gen="true"></arg> <retval swt_gen="true"></retval> @@ -29,6 +39,11 @@ <arg name="leading" swt_gen="true" swt_java_type="float[]" swt_java_type64="double[]"></arg> <retval swt_gen="true"></retval> </function> + <function name="CTParagraphStyleCreate" swt_gen="true"> + <arg name="settings" swt_gen="true"></arg> + <arg name="settingCount" swt_gen="true"></arg> + <retval swt_gen="true"></retval> + </function> <function name="CTTypesetterCreateLine" swt_gen="true"> <arg name="typesetter" swt_gen="true"></arg> <arg name="stringRange" swt_gen="true"></arg> diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSCell.java b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSCell.java index 231448a14f..e7449ba969 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSCell.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSCell.java @@ -110,6 +110,10 @@ public void setAttributedStringValue(NSAttributedString obj) { OS.objc_msgSend(this.id, OS.sel_setAttributedStringValue_, obj != null ? obj.id : 0); } +public void setBaseWritingDirection(int /*long*/ writingDirection) { + OS.objc_msgSend(this.id, OS.sel_setBaseWritingDirection_, writingDirection); +} + public void setControlSize(int /*long*/ size) { OS.objc_msgSend(this.id, OS.sel_setControlSize_, size); } diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSControl.java b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSControl.java index 5807b0858f..50bf2f05cb 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSControl.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSControl.java @@ -71,6 +71,10 @@ public void setAlignment(int /*long*/ mode) { OS.objc_msgSend(this.id, OS.sel_setAlignment_, mode); } +public void setBaseWritingDirection(int /*long*/ writingDirection) { + OS.objc_msgSend(this.id, OS.sel_setBaseWritingDirection_, writingDirection); +} + public void setCell(NSCell aCell) { OS.objc_msgSend(this.id, OS.sel_setCell_, aCell != null ? aCell.id : 0); } diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSMutableAttributedString.java b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSMutableAttributedString.java index cc2d342816..c0d66961da 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSMutableAttributedString.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSMutableAttributedString.java @@ -37,6 +37,10 @@ public void replaceCharactersInRange(NSRange range, NSString str) { OS.objc_msgSend(this.id, OS.sel_replaceCharactersInRange_withString_, range, str != null ? str.id : 0); } +public void setBaseWritingDirection(int /*long*/ writingDirection, NSRange range) { + OS.objc_msgSend(this.id, OS.sel_setBaseWritingDirection_range_, writingDirection, range); +} + public void addAttribute(NSString name, id value, NSRange range) { OS.objc_msgSend(this.id, OS.sel_addAttribute_value_range_, name != null ? name.id : 0, value != null ? value.id : 0, range); } diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSMutableParagraphStyle.java b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSMutableParagraphStyle.java index 8cd4eec71e..cbb73e5a5b 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSMutableParagraphStyle.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSMutableParagraphStyle.java @@ -32,6 +32,10 @@ public void setAlignment(int /*long*/ alignment) { OS.objc_msgSend(this.id, OS.sel_setAlignment_, alignment); } +public void setBaseWritingDirection(int /*long*/ writingDirection) { + OS.objc_msgSend(this.id, OS.sel_setBaseWritingDirection_, writingDirection); +} + public void setDefaultTabInterval(float /*double*/ aFloat) { OS.objc_msgSend(this.id, OS.sel_setDefaultTabInterval_, aFloat); } diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSText.java b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSText.java index d995f8fbf2..3fdec3ceff 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSText.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSText.java @@ -72,6 +72,10 @@ public void setBackgroundColor(NSColor color) { OS.objc_msgSend(this.id, OS.sel_setBackgroundColor_, color != null ? color.id : 0); } +public void setBaseWritingDirection(int /*long*/ writingDirection) { + OS.objc_msgSend(this.id, OS.sel_setBaseWritingDirection_, writingDirection); +} + public void setDelegate(id anObject) { OS.objc_msgSend(this.id, OS.sel_setDelegate_, anObject != null ? anObject.id : 0); } diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSTextView.java b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSTextView.java index 5d51efde4e..a27b0d4453 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSTextView.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSTextView.java @@ -56,6 +56,10 @@ public NSDictionary markedTextAttributes() { return result != 0 ? new NSDictionary(result) : null; } +public void setBaseWritingDirection(int /*long*/ writingDirection, NSRange range) { + OS.objc_msgSend(this.id, OS.sel_setBaseWritingDirection_range_, writingDirection, range); +} + public void setDefaultParagraphStyle(NSParagraphStyle paragraphStyle) { OS.objc_msgSend(this.id, OS.sel_setDefaultParagraphStyle_, paragraphStyle != null ? paragraphStyle.id : 0); } diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java index ab4f143c72..e964b10be5 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java @@ -1433,6 +1433,8 @@ public static final int /*long*/ sel_setAutoresizingMask_ = sel_registerName("se public static final int /*long*/ sel_setAutosaveExpandedItems_ = sel_registerName("setAutosaveExpandedItems:"); public static final int /*long*/ sel_setBackgroundColor_ = sel_registerName("setBackgroundColor:"); public static final int /*long*/ sel_setBackgroundLayoutEnabled_ = sel_registerName("setBackgroundLayoutEnabled:"); +public static final int /*long*/ sel_setBaseWritingDirection_ = sel_registerName("setBaseWritingDirection:"); +public static final int /*long*/ sel_setBaseWritingDirection_range_ = sel_registerName("setBaseWritingDirection:range:"); public static final int /*long*/ sel_setBezelStyle_ = sel_registerName("setBezelStyle:"); public static final int /*long*/ sel_setBorderType_ = sel_registerName("setBorderType:"); public static final int /*long*/ sel_setBorderWidth_ = sel_registerName("setBorderWidth:"); @@ -1995,6 +1997,9 @@ public static final int NSWindowBelow = -1; public static final int NSWindowCollectionBehaviorCanJoinAllSpaces = 1; public static final int NSWindowCollectionBehaviorDefault = 0; public static final int NSWindowCollectionBehaviorMoveToActiveSpace = 2; +public static final int NSWritingDirectionLeftToRight = 0; +public static final int NSWritingDirectionNatural = -1; +public static final int NSWritingDirectionRightToLeft = 1; public static final int NSYearMonthDatePickerElementFlag = 192; public static final int NSYearMonthDayDatePickerElementFlag = 224; public static final int kCFRunLoopBeforeWaiting = 32; @@ -2025,6 +2030,10 @@ public static final int kCGPathElementMoveToPoint = 0; public static final int kCGPathStroke = 2; public static final int kCGSessionEventTap = 1; public static final int kCGTextFillStroke = 2; +public static final int kCTParagraphStyleSpecifierBaseWritingDirection = 13; +public static final int kCTWritingDirectionLeftToRight = 0; +public static final int kCTWritingDirectionNatural = -1; +public static final int kCTWritingDirectionRightToLeft = 1; public static final int NSAllApplicationsDirectory = 100; public static final int NSAllDomainsMask = 65535; public static final int NSNotFound = 2147483647; @@ -2471,6 +2480,8 @@ public static final native int /*long*/ kCTFontAttributeName(); /** @method flags=const */ public static final native int /*long*/ kCTForegroundColorAttributeName(); /** @method flags=const */ +public static final native int /*long*/ kCTParagraphStyleAttributeName(); +/** @method flags=const */ public static final native int /*long*/ NSDefaultRunLoopMode(); public static final NSString NSDefaultRunLoopMode = new NSString(NSDefaultRunLoopMode()); /** @method flags=const */ @@ -2942,6 +2953,11 @@ public static final native void CTLineDraw(int /*long*/ line, int /*long*/ conte */ public static final native double CTLineGetTypographicBounds(int /*long*/ line, float[] /*double[]*/ ascent, float[] /*double[]*/ descent, float[] /*double[]*/ leading); /** + * @param settings cast=(CTParagraphStyleSetting*) + * @param settingCount cast=(CFIndex) + */ +public static final native int /*long*/ CTParagraphStyleCreate(int /*long*/ settings, int /*long*/ settingCount); +/** * @param typesetter cast=(CTTypesetterRef) * @param stringRange flags=struct */ @@ -3454,6 +3470,7 @@ public static final native int CGPathElement_sizeof(); public static final native int CGPoint_sizeof(); public static final native int CGRect_sizeof(); public static final native int CGSize_sizeof(); +public static final native int CTParagraphStyleSetting_sizeof(); public static final native int NSAffineTransformStruct_sizeof(); public static final native int NSPoint_sizeof(); public static final native int NSRange_sizeof(); @@ -3526,6 +3543,16 @@ public static final native void memmove(CGSize dest, int /*long*/ src, int /*lon * @param dest cast=(void *),flags=no_in critical * @param src cast=(void *),flags=critical */ +public static final native void memmove(int /*long*/ dest, CTParagraphStyleSetting src, int /*long*/ size); +/** + * @param dest cast=(void *),flags=no_in critical + * @param src cast=(void *),flags=critical + */ +public static final native void memmove(CTParagraphStyleSetting dest, int /*long*/ src, int /*long*/ size); +/** + * @param dest cast=(void *),flags=no_in critical + * @param src cast=(void *),flags=critical + */ public static final native void memmove(int /*long*/ dest, NSAffineTransformStruct src, int /*long*/ size); /** * @param dest cast=(void *),flags=no_in critical diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/WebKitFull.bridgesupport.extras b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/WebKitFull.bridgesupport.extras index 2d1617c9b9..4dee3064e8 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/WebKitFull.bridgesupport.extras +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/WebKitFull.bridgesupport.extras @@ -394,17 +394,17 @@ <arg name="sender" swt_gen="true"></arg> </method> </informal_protocol> + <informal_protocol name="WebDocumentRepresentation" swt_gen="true"> + <method selector="documentSource" swt_gen="true"></method> + </informal_protocol> <informal_protocol name="WebOpenPanelResultListener" swt_gen="true"> <method selector="chooseFilename:" swt_gen="true"> <arg name="theRange" swt_gen="true"></arg> </method> </informal_protocol> - <informal_protocol name="WebDocumentRepresentation" swt_gen="true"> - <method selector="documentSource" swt_gen="true"></method> - </informal_protocol> <informal_protocol name="WebPolicyDecisionListener" swt_gen="true"> + <method selector="ignore" swt_gen="true"></method> <method selector="use" swt_gen="true"></method> <method selector="download" swt_gen="true"></method> - <method selector="ignore" swt_gen="true"></method> </informal_protocol> </signatures> diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/Device.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/Device.java index 888477cd7e..26f584655c 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/Device.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/Device.java @@ -42,7 +42,7 @@ public abstract class Device implements Drawable { /* System Font */ Font systemFont; - NSMutableParagraphStyle paragraphStyle; + int /*long*/ paragraphStyleLTR, paragraphStyleRTL; /* Device DPI */ Point dpi; @@ -519,12 +519,24 @@ protected void init () { COLOR_CYAN = new Color (this, 0,0xFF,0xFF); COLOR_WHITE = new Color (this, 0xFF,0xFF,0xFF); - paragraphStyle = (NSMutableParagraphStyle)new NSMutableParagraphStyle().alloc().init(); - paragraphStyle.setAlignment(OS.NSLeftTextAlignment); - paragraphStyle.setLineBreakMode(OS.NSLineBreakByClipping); - NSArray tabs = new NSArray(new NSArray().alloc().init()); - paragraphStyle.setTabStops(tabs); - tabs.release(); + /* Initialize LTR and RTL CTParagraphStyleRef */ + CTParagraphStyleSetting setting = new CTParagraphStyleSetting(); + setting.spec = OS.kCTParagraphStyleSpecifierBaseWritingDirection; + setting.valueSize = 1; + setting.value = OS.malloc(setting.valueSize); + OS.memmove(setting.value, new byte[] {OS.kCTWritingDirectionLeftToRight}, setting.valueSize); + int /*long*/ settingsPtr = OS.malloc(CTParagraphStyleSetting.sizeof); + OS.memmove(settingsPtr, setting, CTParagraphStyleSetting.sizeof); + paragraphStyleLTR = OS.CTParagraphStyleCreate(settingsPtr, 1); + OS.free(setting.value); + OS.free(settingsPtr); + setting.value = OS.malloc(setting.valueSize); + OS.memmove(setting.value, new byte[] {OS.kCTWritingDirectionRightToLeft}, setting.valueSize); + settingsPtr = OS.malloc(CTParagraphStyleSetting.sizeof); + OS.memmove(settingsPtr, setting, CTParagraphStyleSetting.sizeof); + paragraphStyleRTL = OS.CTParagraphStyleCreate(settingsPtr, 1); + OS.free(setting.value); + OS.free(settingsPtr); /* Initialize the system font slot */ boolean smallFonts = System.getProperty("org.eclipse.swt.internal.carbon.smallFonts") != null; @@ -707,8 +719,10 @@ void printErrors () { * @see #destroy */ protected void release () { - if (paragraphStyle != null) paragraphStyle.release(); - paragraphStyle = null; + if (paragraphStyleLTR != 0) OS.CFRelease(paragraphStyleLTR); + paragraphStyleLTR = 0; + if (paragraphStyleRTL != 0) OS.CFRelease(paragraphStyleRTL); + paragraphStyleRTL = 0; if (systemFont != null) systemFont.dispose(); systemFont = null; |