From d77fd0933ebe489c9b42022eb9c894092dd1d274 Mon Sep 17 00:00:00 2001 From: Silenio Quarti Date: Mon, 29 Jan 2007 20:05:53 +0000 Subject: making MacOS X 10.3 the target platform --- .../org.eclipse.swt.internal.carbon.OS.properties | 42 ++-------- .../Eclipse SWT PI/carbon/library/build.sh | 2 +- .../Eclipse SWT PI/carbon/library/os.c | 98 ++++++---------------- .../Eclipse SWT PI/carbon/library/os_stats.c | 10 +-- .../Eclipse SWT PI/carbon/library/os_stats.h | 6 +- .../Eclipse SWT PI/carbon/library/os_structs.c | 40 --------- .../Eclipse SWT PI/carbon/library/os_structs.h | 12 --- .../carbon/org/eclipse/swt/internal/carbon/OS.java | 8 +- .../eclipse/swt/internal/carbon/TXNLongRect.java | 22 ----- .../carbon/org/eclipse/swt/graphics/Cursor.java | 60 +------------ .../carbon/org/eclipse/swt/graphics/GC.java | 18 ++-- .../org/eclipse/swt/graphics/TextLayout.java | 10 +-- .../carbon/org/eclipse/swt/widgets/Text.java | 70 ++++++---------- 13 files changed, 88 insertions(+), 310 deletions(-) delete mode 100644 bundles/org.eclipse.swt/Eclipse SWT PI/carbon/org/eclipse/swt/internal/carbon/TXNLongRect.java diff --git a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.carbon.OS.properties b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.carbon.OS.properties index 6a8673a55a..51bda0b5fa 100644 --- a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.carbon.OS.properties +++ b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.carbon.OS.properties @@ -4482,12 +4482,6 @@ OS_TXNGetLineMetrics_1=cast=(UInt32) OS_TXNGetLineMetrics_2=cast=(Fixed *) OS_TXNGetLineMetrics_3=cast=(Fixed *) -OS_TXNGetRectBounds= -OS_TXNGetRectBounds_0=cast=(TXNObject) -OS_TXNGetRectBounds_1=cast=(Rect *) -OS_TXNGetRectBounds_2=cast=(TXNLongRect *) -OS_TXNGetRectBounds_3=cast=(TXNLongRect *) - OS_TXNGetSelection= OS_TXNGetSelection_0=cast=(TXNObject) OS_TXNGetSelection_1=cast=(TXNOffset *) @@ -4503,36 +4497,24 @@ OS_TXNGetViewRect= OS_TXNGetViewRect_0=cast=(TXNObject) OS_TXNGetViewRect_1= +OS_TXNHIPointToOffset= +OS_TXNHIPointToOffset_0=cast=(TXNObject) +OS_TXNHIPointToOffset_1=cast=(HIPoint *) +OS_TXNHIPointToOffset_2=cast=(TXNOffset *) + OS_TXNInitTextension= OS_TXNInitTextension_0=cast=(const TXNMacOSPreferredFontDescription *) OS_TXNInitTextension_1=cast=(ItemCount) OS_TXNInitTextension_2=cast=(TXNInitOptions) -OS_TXNNewObject= -OS_TXNNewObject_0=cast=(const FSSpec *) -OS_TXNNewObject_1=cast=(WindowRef) -OS_TXNNewObject_2=cast=(const Rect *) -OS_TXNNewObject_3=cast=(TXNFrameOptions) -OS_TXNNewObject_4=cast=(TXNFrameType) -OS_TXNNewObject_5=cast=(TXNFileType) -OS_TXNNewObject_6=cast=(TXNPermanentTextEncodingType) -OS_TXNNewObject_7=cast=(TXNObject *) -OS_TXNNewObject_8=cast=(TXNFrameID *) -OS_TXNNewObject_9=cast=(TXNObjectRefcon) - -OS_TXNOffsetToPoint= -OS_TXNOffsetToPoint_0=cast=(TXNObject) -OS_TXNOffsetToPoint_1=cast=(TXNOffset) -OS_TXNOffsetToPoint_2=cast=(Point *) +OS_TXNOffsetToHIPoint= +OS_TXNOffsetToHIPoint_0=cast=(TXNObject) +OS_TXNOffsetToHIPoint_1=cast=(TXNOffset) +OS_TXNOffsetToHIPoint_2=cast=(HIPoint *) OS_TXNPaste= OS_TXNPaste_0=cast=(TXNObject) -OS_TXNPointToOffset= -OS_TXNPointToOffset_0=cast=(TXNObject) -OS_TXNPointToOffset_1=flags=struct -OS_TXNPointToOffset_2=cast=(TXNOffset *) - OS_TXNSelectAll= OS_TXNSelectAll_0=cast=(TXNObject) @@ -4879,12 +4861,6 @@ TXNBackground_bg_red=accessor=bg.color.red TXNBackground_bg_green=accessor=bg.color.green TXNBackground_bg_blue=accessor=bg.color.blue -org_eclipse_swt_internal_carbon_TXNLongRect= -TXNLongRect_top= -TXNLongRect_left= -TXNLongRect_bottom= -TXNLongRect_right= - org_eclipse_swt_internal_carbon_TXNTab= TXNTab_value= TXNTab_tabType= diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/build.sh b/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/build.sh index e9547c39c5..4c22a22e8d 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/build.sh +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/build.sh @@ -16,6 +16,6 @@ OUTPUT_DIR=../../../org.eclipse.swt.carbon.macosx export OUTPUT_DIR -export MACOSX_DEPLOYMENT_TARGET=10.2 +export MACOSX_DEPLOYMENT_TARGET=10.3 make -f make_macosx.mak $1 $2 $3 $4 $5 $6 $7 $8 $9 diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os.c b/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os.c index ddf6459c1f..e47cd30d7d 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os.c +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os.c @@ -12003,28 +12003,6 @@ fail: } #endif -#ifndef NO_TXNGetRectBounds -JNIEXPORT jint JNICALL OS_NATIVE(TXNGetRectBounds) - (JNIEnv *env, jclass that, jint arg0, jobject arg1, jobject arg2, jobject arg3) -{ - Rect _arg1, *lparg1=NULL; - TXNLongRect _arg2, *lparg2=NULL; - TXNLongRect _arg3, *lparg3=NULL; - jint rc = 0; - OS_NATIVE_ENTER(env, that, TXNGetRectBounds_FUNC); - if (arg1) if ((lparg1 = getRectFields(env, arg1, &_arg1)) == NULL) goto fail; - if (arg2) if ((lparg2 = getTXNLongRectFields(env, arg2, &_arg2)) == NULL) goto fail; - if (arg3) if ((lparg3 = getTXNLongRectFields(env, arg3, &_arg3)) == NULL) goto fail; - rc = (jint)TXNGetRectBounds((TXNObject)arg0, (Rect *)lparg1, (TXNLongRect *)lparg2, (TXNLongRect *)lparg3); -fail: - if (arg3 && lparg3) setTXNLongRectFields(env, arg3, lparg3); - if (arg2 && lparg2) setTXNLongRectFields(env, arg2, lparg2); - if (arg1 && lparg1) setRectFields(env, arg1, lparg1); - OS_NATIVE_EXIT(env, that, TXNGetRectBounds_FUNC); - return rc; -} -#endif - #ifndef NO_TXNGetSelection JNIEXPORT void JNICALL OS_NATIVE(TXNGetSelection) (JNIEnv *env, jclass that, jint arg0, jintArray arg1, jintArray arg2) @@ -12075,52 +12053,49 @@ fail: } #endif -#ifndef NO_TXNInitTextension -JNIEXPORT jint JNICALL OS_NATIVE(TXNInitTextension) - (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2) +#ifndef NO_TXNHIPointToOffset +JNIEXPORT jint JNICALL OS_NATIVE(TXNHIPointToOffset) + (JNIEnv *env, jclass that, jint arg0, jobject arg1, jintArray arg2) { + CGPoint _arg1, *lparg1=NULL; + jint *lparg2=NULL; jint rc = 0; - OS_NATIVE_ENTER(env, that, TXNInitTextension_FUNC); - rc = (jint)TXNInitTextension((const TXNMacOSPreferredFontDescription *)arg0, (ItemCount)arg1, (TXNInitOptions)arg2); - OS_NATIVE_EXIT(env, that, TXNInitTextension_FUNC); + OS_NATIVE_ENTER(env, that, TXNHIPointToOffset_FUNC); + if (arg1) if ((lparg1 = getCGPointFields(env, arg1, &_arg1)) == NULL) goto fail; + if (arg2) if ((lparg2 = (*env)->GetIntArrayElements(env, arg2, NULL)) == NULL) goto fail; + rc = (jint)TXNHIPointToOffset((TXNObject)arg0, (HIPoint *)lparg1, (TXNOffset *)lparg2); +fail: + if (arg2 && lparg2) (*env)->ReleaseIntArrayElements(env, arg2, lparg2, 0); + if (arg1 && lparg1) setCGPointFields(env, arg1, lparg1); + OS_NATIVE_EXIT(env, that, TXNHIPointToOffset_FUNC); return rc; } #endif -#ifndef NO_TXNNewObject -JNIEXPORT jint JNICALL OS_NATIVE(TXNNewObject) - (JNIEnv *env, jclass that, jint arg0, jint arg1, jobject arg2, jint arg3, jint arg4, jint arg5, jint arg6, jintArray arg7, jintArray arg8, jint arg9) +#ifndef NO_TXNInitTextension +JNIEXPORT jint JNICALL OS_NATIVE(TXNInitTextension) + (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2) { - Rect _arg2, *lparg2=NULL; - jint *lparg7=NULL; - jint *lparg8=NULL; jint rc = 0; - OS_NATIVE_ENTER(env, that, TXNNewObject_FUNC); - if (arg2) if ((lparg2 = getRectFields(env, arg2, &_arg2)) == NULL) goto fail; - if (arg7) if ((lparg7 = (*env)->GetIntArrayElements(env, arg7, NULL)) == NULL) goto fail; - if (arg8) if ((lparg8 = (*env)->GetIntArrayElements(env, arg8, NULL)) == NULL) goto fail; - rc = (jint)TXNNewObject((const FSSpec *)arg0, (WindowRef)arg1, (const Rect *)lparg2, (TXNFrameOptions)arg3, (TXNFrameType)arg4, (TXNFileType)arg5, (TXNPermanentTextEncodingType)arg6, (TXNObject *)lparg7, (TXNFrameID *)lparg8, (TXNObjectRefcon)arg9); -fail: - if (arg8 && lparg8) (*env)->ReleaseIntArrayElements(env, arg8, lparg8, 0); - if (arg7 && lparg7) (*env)->ReleaseIntArrayElements(env, arg7, lparg7, 0); - if (arg2 && lparg2) setRectFields(env, arg2, lparg2); - OS_NATIVE_EXIT(env, that, TXNNewObject_FUNC); + OS_NATIVE_ENTER(env, that, TXNInitTextension_FUNC); + rc = (jint)TXNInitTextension((const TXNMacOSPreferredFontDescription *)arg0, (ItemCount)arg1, (TXNInitOptions)arg2); + OS_NATIVE_EXIT(env, that, TXNInitTextension_FUNC); return rc; } #endif -#ifndef NO_TXNOffsetToPoint -JNIEXPORT jint JNICALL OS_NATIVE(TXNOffsetToPoint) +#ifndef NO_TXNOffsetToHIPoint +JNIEXPORT jint JNICALL OS_NATIVE(TXNOffsetToHIPoint) (JNIEnv *env, jclass that, jint arg0, jint arg1, jobject arg2) { - Point _arg2, *lparg2=NULL; + CGPoint _arg2, *lparg2=NULL; jint rc = 0; - OS_NATIVE_ENTER(env, that, TXNOffsetToPoint_FUNC); - if (arg2) if ((lparg2 = getPointFields(env, arg2, &_arg2)) == NULL) goto fail; - rc = (jint)TXNOffsetToPoint((TXNObject)arg0, (TXNOffset)arg1, (Point *)lparg2); + OS_NATIVE_ENTER(env, that, TXNOffsetToHIPoint_FUNC); + if (arg2) if ((lparg2 = getCGPointFields(env, arg2, &_arg2)) == NULL) goto fail; + rc = (jint)TXNOffsetToHIPoint((TXNObject)arg0, (TXNOffset)arg1, (HIPoint *)lparg2); fail: - if (arg2 && lparg2) setPointFields(env, arg2, lparg2); - OS_NATIVE_EXIT(env, that, TXNOffsetToPoint_FUNC); + if (arg2 && lparg2) setCGPointFields(env, arg2, lparg2); + OS_NATIVE_EXIT(env, that, TXNOffsetToHIPoint_FUNC); return rc; } #endif @@ -12137,25 +12112,6 @@ JNIEXPORT jint JNICALL OS_NATIVE(TXNPaste) } #endif -#ifndef NO_TXNPointToOffset -JNIEXPORT jint JNICALL OS_NATIVE(TXNPointToOffset) - (JNIEnv *env, jclass that, jint arg0, jobject arg1, jintArray arg2) -{ - Point _arg1, *lparg1=NULL; - jint *lparg2=NULL; - jint rc = 0; - OS_NATIVE_ENTER(env, that, TXNPointToOffset_FUNC); - if (arg1) if ((lparg1 = getPointFields(env, arg1, &_arg1)) == NULL) goto fail; - if (arg2) if ((lparg2 = (*env)->GetIntArrayElements(env, arg2, NULL)) == NULL) goto fail; - rc = (jint)TXNPointToOffset((TXNObject)arg0, *lparg1, (TXNOffset *)lparg2); -fail: - if (arg2 && lparg2) (*env)->ReleaseIntArrayElements(env, arg2, lparg2, 0); - if (arg1 && lparg1) setPointFields(env, arg1, lparg1); - OS_NATIVE_EXIT(env, that, TXNPointToOffset_FUNC); - return rc; -} -#endif - #ifndef NO_TXNSelectAll JNIEXPORT void JNICALL OS_NATIVE(TXNSelectAll) (JNIEnv *env, jclass that, jint arg0) diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os_stats.c b/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os_stats.c index e4f0dcb9aa..3e95c4ee02 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os_stats.c +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os_stats.c @@ -14,8 +14,8 @@ #ifdef NATIVE_STATS -int OS_nativeFunctionCount = 912; -int OS_nativeFunctionCallCount[912]; +int OS_nativeFunctionCount = 910; +int OS_nativeFunctionCallCount[910]; char * OS_nativeFunctionNames[] = { "AECountItems", "AEGetNthPtr", @@ -856,15 +856,13 @@ char * OS_nativeFunctionNames[] = { "TXNGetHIRect", "TXNGetLineCount", "TXNGetLineMetrics", - "TXNGetRectBounds", "TXNGetSelection", "TXNGetTXNObjectControls", "TXNGetViewRect", + "TXNHIPointToOffset", "TXNInitTextension", - "TXNNewObject", - "TXNOffsetToPoint", + "TXNOffsetToHIPoint", "TXNPaste", - "TXNPointToOffset", "TXNSelectAll", "TXNSetBackground", "TXNSetData", diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os_stats.h index 74fb2d4d6a..2c2a185938 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os_stats.h +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os_stats.h @@ -864,15 +864,13 @@ typedef enum { TXNGetHIRect_FUNC, TXNGetLineCount_FUNC, TXNGetLineMetrics_FUNC, - TXNGetRectBounds_FUNC, TXNGetSelection_FUNC, TXNGetTXNObjectControls_FUNC, TXNGetViewRect_FUNC, + TXNHIPointToOffset_FUNC, TXNInitTextension_FUNC, - TXNNewObject_FUNC, - TXNOffsetToPoint_FUNC, + TXNOffsetToHIPoint_FUNC, TXNPaste_FUNC, - TXNPointToOffset_FUNC, TXNSelectAll_FUNC, TXNSetBackground_FUNC, TXNSetData_FUNC, diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os_structs.c b/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os_structs.c index 59c9802fec..cbf4f6e491 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os_structs.c +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os_structs.c @@ -3263,46 +3263,6 @@ void setTXNBackgroundFields(JNIEnv *env, jobject lpObject, TXNBackground *lpStru } #endif -#ifndef NO_TXNLongRect -typedef struct TXNLongRect_FID_CACHE { - int cached; - jclass clazz; - jfieldID top, left, bottom, right; -} TXNLongRect_FID_CACHE; - -TXNLongRect_FID_CACHE TXNLongRectFc; - -void cacheTXNLongRectFields(JNIEnv *env, jobject lpObject) -{ - if (TXNLongRectFc.cached) return; - TXNLongRectFc.clazz = (*env)->GetObjectClass(env, lpObject); - TXNLongRectFc.top = (*env)->GetFieldID(env, TXNLongRectFc.clazz, "top", "I"); - TXNLongRectFc.left = (*env)->GetFieldID(env, TXNLongRectFc.clazz, "left", "I"); - TXNLongRectFc.bottom = (*env)->GetFieldID(env, TXNLongRectFc.clazz, "bottom", "I"); - TXNLongRectFc.right = (*env)->GetFieldID(env, TXNLongRectFc.clazz, "right", "I"); - TXNLongRectFc.cached = 1; -} - -TXNLongRect *getTXNLongRectFields(JNIEnv *env, jobject lpObject, TXNLongRect *lpStruct) -{ - if (!TXNLongRectFc.cached) cacheTXNLongRectFields(env, lpObject); - lpStruct->top = (*env)->GetIntField(env, lpObject, TXNLongRectFc.top); - lpStruct->left = (*env)->GetIntField(env, lpObject, TXNLongRectFc.left); - lpStruct->bottom = (*env)->GetIntField(env, lpObject, TXNLongRectFc.bottom); - lpStruct->right = (*env)->GetIntField(env, lpObject, TXNLongRectFc.right); - return lpStruct; -} - -void setTXNLongRectFields(JNIEnv *env, jobject lpObject, TXNLongRect *lpStruct) -{ - if (!TXNLongRectFc.cached) cacheTXNLongRectFields(env, lpObject); - (*env)->SetIntField(env, lpObject, TXNLongRectFc.top, (jint)lpStruct->top); - (*env)->SetIntField(env, lpObject, TXNLongRectFc.left, (jint)lpStruct->left); - (*env)->SetIntField(env, lpObject, TXNLongRectFc.bottom, (jint)lpStruct->bottom); - (*env)->SetIntField(env, lpObject, TXNLongRectFc.right, (jint)lpStruct->right); -} -#endif - #ifndef NO_TXNTab typedef struct TXNTab_FID_CACHE { int cached; diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os_structs.h b/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os_structs.h index 90165219e7..401660a607 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os_structs.h +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os_structs.h @@ -815,18 +815,6 @@ void setTXNBackgroundFields(JNIEnv *env, jobject lpObject, TXNBackground *lpStru #define TXNBackground_sizeof() 0 #endif -#ifndef NO_TXNLongRect -void cacheTXNLongRectFields(JNIEnv *env, jobject lpObject); -TXNLongRect *getTXNLongRectFields(JNIEnv *env, jobject lpObject, TXNLongRect *lpStruct); -void setTXNLongRectFields(JNIEnv *env, jobject lpObject, TXNLongRect *lpStruct); -#define TXNLongRect_sizeof() sizeof(TXNLongRect) -#else -#define cacheTXNLongRectFields(a,b) -#define getTXNLongRectFields(a,b,c) NULL -#define setTXNLongRectFields(a,b,c) -#define TXNLongRect_sizeof() 0 -#endif - #ifndef NO_TXNTab void cacheTXNTabFields(JNIEnv *env, jobject lpObject); TXNTab *getTXNTabFields(JNIEnv *env, jobject lpObject, TXNTab *lpStruct); diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/org/eclipse/swt/internal/carbon/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/org/eclipse/swt/internal/carbon/OS.java index ac1ee739e3..5294abec04 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/org/eclipse/swt/internal/carbon/OS.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/org/eclipse/swt/internal/carbon/OS.java @@ -24,7 +24,7 @@ public class OS extends C { static { int [] response = new int [1]; OS.Gestalt (OS.gestaltSystemVersion, response); - VERSION = response [0] & 0xffff; + VERSION = response [0] & 0xffff; } /** Constants */ @@ -1790,14 +1790,12 @@ public static final native int TXNGetLineCount(int txHandle, int[] lineTotal); public static final native int TXNGetLineMetrics(int iTXNObject, int iLineNumber, int [] oLineWidth, int [] oLineHeight); public static final native int TXNGetTXNObjectControls(int iTXNObject, int iControlCount, int [] iControlTags, int [] oControlData); public static final native int TXNGetHIRect(int iTXNObject, int iTXNRectKey, CGRect oRectangle); -public static final native int TXNGetRectBounds(int iTXNObject, Rect oViewRect, TXNLongRect oDestinationRect, TXNLongRect oTextRect); public static final native void TXNGetSelection(int txHandle, int[] startOffset, int[] endOffset); public static final native void TXNGetViewRect (int iTXNObject, Rect oViewRect); public static final native int TXNInitTextension(int iDefaultFonts, int iCountDefaultFonts, int iUsageFlags); -public static final native int TXNNewObject(int iFileSpec, int iWindw, Rect iFrame, int iFrameOptions, int iFrameType, int iFileType, int iPermanentEncoding, int [] oTXNObject, int[] oTXNFrameID, int iRefCpm); -public static final native int TXNOffsetToPoint(int txHandle, int offset, Point point); +public static final native int TXNOffsetToHIPoint(int txHandle, int offset, CGPoint point); public static final native int TXNPaste(int txHandle); -public static final native int TXNPointToOffset (int iTXNObject, Point iPoint, int [] oOffset); +public static final native int TXNHIPointToOffset (int iTXNObject, CGPoint iPoint, int [] oOffset); public static final native void TXNSelectAll(int txHandle); public static final native int TXNSetBackground(int iTXNObject, TXNBackground iBackgroundInfo); public static final native int TXNSetData(int iTXNObject, int iDataType, char[] iDataPtr, int iDataSize, int iStartOffset, int iEndOffset); diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/org/eclipse/swt/internal/carbon/TXNLongRect.java b/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/org/eclipse/swt/internal/carbon/TXNLongRect.java deleted file mode 100644 index ed9f164d66..0000000000 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/org/eclipse/swt/internal/carbon/TXNLongRect.java +++ /dev/null @@ -1,22 +0,0 @@ -/********************************************************************** - * Copyright (c) 2003-2004 IBM Corp. - * Portions Copyright (c) 1983-2002, Apple Computer, Inc. - * - * 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.carbon; - - -public class TXNLongRect { - public int top; - public int left; - public int bottom; - public int right; - public static final int sizeof = 16; -} diff --git a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/graphics/Cursor.java b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/graphics/Cursor.java index d79759d57f..7686a0a38d 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/graphics/Cursor.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/graphics/Cursor.java @@ -56,46 +56,6 @@ public final class Cursor extends Resource { static boolean initialized; - /** - * data and mask used to create a Resize NS Cursor - */ - static final byte [] SIZENS_SOURCE = new byte[] { - (byte)0x00, (byte)0x00, - (byte)0x01, (byte)0x80, - (byte)0x03, (byte)0xC0, - (byte)0x07, (byte)0xE0, - (byte)0x01, (byte)0x80, - (byte)0x01, (byte)0x80, - (byte)0x01, (byte)0x80, - (byte)0x7F, (byte)0xFE, - (byte)0x7F, (byte)0xFE, - (byte)0x01, (byte)0x80, - (byte)0x01, (byte)0x80, - (byte)0x01, (byte)0x80, - (byte)0x07, (byte)0xE0, - (byte)0x03, (byte)0xC0, - (byte)0x01, (byte)0x80, - (byte)0x00, (byte)0x00, - }; - static final byte [] SIZENS_MASK = new byte[] { - (byte)0x01, (byte)0x80, - (byte)0x03, (byte)0xC0, - (byte)0x07, (byte)0xE0, - (byte)0x0F, (byte)0xF0, - (byte)0x0F, (byte)0xF0, - (byte)0x03, (byte)0xC0, - (byte)0xFF, (byte)0xFF, - (byte)0xFF, (byte)0xFF, - (byte)0xFF, (byte)0xFF, - (byte)0xFF, (byte)0xFF, - (byte)0x03, (byte)0xC0, - (byte)0x0F, (byte)0xF0, - (byte)0x0F, (byte)0xF0, - (byte)0x07, (byte)0xE0, - (byte)0x03, (byte)0xC0, - (byte)0x01, (byte)0x80, - }; - /** * Prevents uninitialized instances from being created outside the package. */ @@ -156,25 +116,11 @@ public Cursor(Device device, int style) { case SWT.CURSOR_HELP: handle = OS.kThemeCrossCursor; break; case SWT.CURSOR_SIZEALL: handle = OS.kThemeCrossCursor; break; case SWT.CURSOR_SIZENESW: handle = OS.kThemeCrossCursor; break; - case SWT.CURSOR_SIZENS: { - if (OS.VERSION >= 0x1030) { - handle = OS.kThemeResizeUpDownCursor; - } else { - org.eclipse.swt.internal.carbon.Cursor cursor = new org.eclipse.swt.internal.carbon.Cursor(); - cursor.data = SIZENS_SOURCE; - cursor.mask = SIZENS_MASK; - cursor.hotSpot_h = 7; - cursor.hotSpot_v = 7; - handle = OS.NewPtr(org.eclipse.swt.internal.carbon.Cursor.sizeof); - if (handle == 0) SWT.error(SWT.ERROR_NO_HANDLES); - OS.memcpy(handle, cursor, org.eclipse.swt.internal.carbon.Cursor.sizeof); - } - break; - } + case SWT.CURSOR_SIZENS: handle = OS.kThemeResizeUpDownCursor; break; case SWT.CURSOR_SIZENWSE: handle = OS.kThemeCrossCursor; break; case SWT.CURSOR_SIZEWE: handle = OS.kThemeResizeLeftRightCursor; break; - case SWT.CURSOR_SIZEN: handle = OS.VERSION >= 0x1030 ? OS.kThemeResizeUpCursor : OS.kThemeCrossCursor; break; - case SWT.CURSOR_SIZES: handle = OS.VERSION >= 0x1030 ? OS.kThemeResizeDownCursor : OS.kThemeCrossCursor; break; + case SWT.CURSOR_SIZEN: handle = OS.kThemeResizeUpCursor; break; + case SWT.CURSOR_SIZES: handle = OS.kThemeResizeDownCursor; break; case SWT.CURSOR_SIZEE: handle = OS.kThemeResizeRightCursor; break; case SWT.CURSOR_SIZEW: handle = OS.kThemeResizeLeftCursor; break; case SWT.CURSOR_SIZENE: handle = OS.kThemeCrossCursor; break; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/graphics/GC.java b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/graphics/GC.java index 20f61362f0..8b06182be9 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/graphics/GC.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/graphics/GC.java @@ -772,16 +772,14 @@ public void drawArc(int x, int y, int width, int height, int startAngle, int arc public void drawFocus(int x, int y, int width, int height) { if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); if (data.updateClip) setCGClipping(); - if (OS.VERSION >= 0x1030) { - int[] metric = new int[1]; - OS.GetThemeMetric(OS.kThemeMetricFocusRectOutset, metric); - CGRect rect = new CGRect (); - rect.x = x + metric[0]; - rect.y = y + metric[0]; - rect.width = width - metric[0] * 2; - rect.height = height - metric[0] * 2; - OS.HIThemeDrawFocusRect(rect, true, handle, OS.kHIThemeOrientationNormal); - } + int[] metric = new int[1]; + OS.GetThemeMetric(OS.kThemeMetricFocusRectOutset, metric); + CGRect rect = new CGRect (); + rect.x = x + metric[0]; + rect.y = y + metric[0]; + rect.width = width - metric[0] * 2; + rect.height = height - metric[0] * 2; + OS.HIThemeDrawFocusRect(rect, true, handle, OS.kHIThemeOrientationNormal); flush(); } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/graphics/TextLayout.java b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/graphics/TextLayout.java index f18ce838c5..9edaf103c7 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/graphics/TextLayout.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/graphics/TextLayout.java @@ -443,12 +443,10 @@ public void draw(GC gc, int x, int y, int selectionStart, int selectionEnd, Colo boolean hasSelection = selectionStart <= selectionEnd && selectionStart != -1 && selectionEnd != -1; boolean restoreColor = false; if (hasSelection && selectionBackground != null) { - if (OS.VERSION >= 0x1030) { - restoreColor = true; - int color = OS.CGColorCreate(device.colorspace, selectionBackground.handle); - setLayoutControl(OS.kATSULineHighlightCGColorTag, color, 4); - OS.CGColorRelease(color); - } + restoreColor = true; + int color = OS.CGColorCreate(device.colorspace, selectionBackground.handle); + setLayoutControl(OS.kATSULineHighlightCGColorTag, color, 4); + OS.CGColorRelease(color); } /* * Feature in ATSU. There is no API to set a background attribute diff --git a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Text.java b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Text.java index 636fa80f82..3ff0204151 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Text.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Text.java @@ -15,7 +15,6 @@ import org.eclipse.swt.internal.carbon.OS; import org.eclipse.swt.internal.carbon.RGBColor; import org.eclipse.swt.internal.carbon.Rect; import org.eclipse.swt.internal.carbon.TXNBackground; -import org.eclipse.swt.internal.carbon.TXNLongRect; import org.eclipse.swt.internal.carbon.ControlEditTextSelectionRec; import org.eclipse.swt.internal.carbon.ControlFontStyleRec; import org.eclipse.swt.internal.carbon.CFRange; @@ -319,29 +318,22 @@ public Point computeSize (int wHint, int hHint, boolean changed) { // if (ptr2 [0] != 0) OS.CFRelease (ptr2 [0]); } } else { - if (OS.VERSION >= 0x1030) { - int [] oDataHandle = new int [1]; - OS.TXNGetData (txnObject, OS.kTXNStartOffset, OS.kTXNEndOffset, oDataHandle); - if (oDataHandle [0] != 0) { - int length = OS.GetHandleSize (oDataHandle [0]), str = 0; - if (length != 0) { - int [] ptr = new int [1]; - OS.HLock (oDataHandle [0]); - OS.memcpy (ptr, oDataHandle [0], 4); - str = OS.CFStringCreateWithCharacters (OS.kCFAllocatorDefault, ptr [0], length / 2); - OS.HUnlock (oDataHandle[0]); - } - OS.DisposeHandle (oDataHandle[0]); - Point size = textExtent (str, wHint == SWT.DEFAULT ? 0 : wHint); - if (str != 0) OS.CFRelease(str); - width = size.x; - height = size.y; + int [] oDataHandle = new int [1]; + OS.TXNGetData (txnObject, OS.kTXNStartOffset, OS.kTXNEndOffset, oDataHandle); + if (oDataHandle [0] != 0) { + int length = OS.GetHandleSize (oDataHandle [0]), str = 0; + if (length != 0) { + int [] ptr = new int [1]; + OS.HLock (oDataHandle [0]); + OS.memcpy (ptr, oDataHandle [0], 4); + str = OS.CFStringCreateWithCharacters (OS.kCFAllocatorDefault, ptr [0], length / 2); + OS.HUnlock (oDataHandle[0]); } - } else { - TXNLongRect oTextRect = new TXNLongRect (); - OS.TXNGetRectBounds (txnObject, null, null, oTextRect); - width = oTextRect.right - oTextRect.left; - height = oTextRect.bottom - oTextRect.top; + OS.DisposeHandle (oDataHandle[0]); + Point size = textExtent (str, wHint == SWT.DEFAULT ? 0 : wHint); + if (str != 0) OS.CFRelease(str); + width = size.x; + height = size.y; } } if (width <= 0) width = DEFAULT_WIDTH; @@ -624,13 +616,13 @@ public Point getCaretLocation () { //TODO - caret location for unicode text return new Point (0, 0); } - org.eclipse.swt.internal.carbon.Point oPoint = new org.eclipse.swt.internal.carbon.Point (); + CGPoint oPoint = new CGPoint (); int [] oStartOffset = new int [1], oEndOffset = new int [1]; OS.TXNGetSelection (txnObject, oStartOffset, oEndOffset); - OS.TXNOffsetToPoint (txnObject, oStartOffset [0], oPoint); + OS.TXNOffsetToHIPoint (txnObject, oStartOffset [0], oPoint); Rect oViewRect = new Rect (); OS.TXNGetViewRect (txnObject, oViewRect); - return new Point (oPoint.h - oViewRect.left, oPoint.v - oViewRect.top); + return new Point ((int) oPoint.x - oViewRect.left, (int) oPoint.y - oViewRect.top); } /** @@ -836,10 +828,10 @@ int getPosition (int x, int y) { int [] oOffset = new int [1]; Rect oViewRect = new Rect (); OS.TXNGetViewRect (txnObject, oViewRect); - org.eclipse.swt.internal.carbon.Point iPoint = new org.eclipse.swt.internal.carbon.Point (); - iPoint.h = (short) (x + oViewRect.left); - iPoint.v = (short) (y + oViewRect.top); - return OS.TXNPointToOffset (txnObject, iPoint, oOffset) == OS.noErr ? oOffset [0] : -1; + CGPoint iPoint = new CGPoint (); + iPoint.x = x + oViewRect.left; + iPoint.y = y + oViewRect.top; + return OS.TXNHIPointToOffset (txnObject, iPoint, oOffset) == OS.noErr ? oOffset [0] : -1; } public int getPosition (Point point) { @@ -1090,19 +1082,11 @@ public int getTopIndex () { public int getTopPixel () { checkWidget(); if ((style & SWT.SINGLE) != 0) return 0; - if (OS.VERSION >= 0x1030) { - CGRect rect = new CGRect (); - OS.TXNGetHIRect (txnObject, OS.kTXNDestinationRectKey, rect); - int destY = (int) rect.y; - OS.TXNGetHIRect (txnObject, OS.kTXNTextRectKey, rect); - return destY - (int) rect.y; - } else { - Rect oViewRect = new Rect (); - TXNLongRect oDestinationRect = new TXNLongRect (); - TXNLongRect oTextRect = new TXNLongRect (); - OS.TXNGetRectBounds (txnObject, oViewRect, oDestinationRect, oTextRect); - return oDestinationRect.top - oTextRect.top; - } + CGRect rect = new CGRect (); + OS.TXNGetHIRect (txnObject, OS.kTXNDestinationRectKey, rect); + int destY = (int) rect.y; + OS.TXNGetHIRect (txnObject, OS.kTXNTextRectKey, rect); + return destY - (int) rect.y; } String getTXNText (int iStartOffset, int iEndOffset) { -- cgit