diff options
author | Knut Radloff <kradloff> | 2003-07-16 18:33:31 +0000 |
---|---|---|
committer | Knut Radloff <kradloff> | 2003-07-16 18:33:31 +0000 |
commit | 8862e9074b4e4a9560de676a5074c8c48df6bb4d (patch) | |
tree | 65fd87f42fd024dce79b1d2f83f5fe7855708be7 | |
parent | 93a133496c4c6f4903f52273654fc42d66092cb1 (diff) | |
download | eclipse.platform.swt-8862e9074b4e4a9560de676a5074c8c48df6bb4d.tar.gz eclipse.platform.swt-8862e9074b4e4a9560de676a5074c8c48df6bb4d.tar.xz eclipse.platform.swt-8862e9074b4e4a9560de676a5074c8c48df6bb4d.zip |
Fixes bug 40216
4 files changed, 20 insertions, 103 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledText.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledText.java index d7c9a82a59..e942f41075 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledText.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledText.java @@ -1647,18 +1647,6 @@ public StyledText(Composite parent, int style) { String platform= SWT.getPlatform(); isCarbon = "carbon".equals(platform); - StyledTextBidi.addOrientationListener(this, - new Runnable() { - public void run() { - setOrientation(SWT.LEFT_TO_RIGHT); - } - }, - new Runnable() { - public void run() { - setOrientation(SWT.RIGHT_TO_LEFT); - } - } - ); // set the caret width, the height of the caret will default to the line height calculateScrollBars(); createKeyBindings(); @@ -5136,7 +5124,6 @@ void handleDispose() { if (isBidi()) { StyledTextBidi.removeLanguageListener(this); } - StyledTextBidi.removeOrientationListener(this); } /** * Scrolls the widget horizontally. @@ -7479,18 +7466,16 @@ void setOrientation(int orientation) { if ((orientation & SWT.RIGHT_TO_LEFT) != 0 && (orientation & SWT.LEFT_TO_RIGHT) != 0) { return; } - if ((orientation & SWT.RIGHT_TO_LEFT) != 0) { - if (isMirrored()) { - return; - } - isMirrored = true; - } else { - if (isMirrored() == false) { - return; - } - isMirrored = false; - } - StyledTextBidi.setOrientation(this, orientation); + if ((orientation & SWT.RIGHT_TO_LEFT) != 0 && isMirrored()) { + return; + } + if ((orientation & SWT.LEFT_TO_RIGHT) != 0 && isMirrored() == false) { + return; + } + if (StyledTextBidi.setOrientation(this, orientation) == false) { + return; + } + isMirrored = (orientation & SWT.RIGHT_TO_LEFT) != 0; isBidi = StyledTextBidi.isBidiPlatform() || isMirrored(); initializeRenderer(); if (isBidi()) { diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledTextBidi.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledTextBidi.java index 04d9f83d80..63d8d9b865 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledTextBidi.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledTextBidi.java @@ -183,20 +183,6 @@ static void addLanguageListener(Control control, Runnable runnable) { BidiUtil.addLanguageListener(control.handle, runnable); } /** - * Adds a listener that is called when the widget orientation (writing order) - * is changed by the user. - * <p> - * - * @param control Control to add the keyboard language listener for. - * @param LTRRunnable the listener that is called when writing order is - * switched to "left to right" (left oriented text). - * @param RTLRunnable the listener that is called when writing order is - * switched to "right to left" (right oriented text). - */ -static void addOrientationListener(Control control, Runnable LTRRunnable, Runnable RTLRunnable) { - BidiUtil.addOrientationListener(control.handle, LTRRunnable, RTLRunnable); -} -/** * Answers the direction of the active keyboard language - either * L2R or R2L. The active keyboard language determines the direction * of the caret and can be changed by the user (e.g., via Alt-Shift on @@ -263,15 +249,6 @@ static void removeLanguageListener(Control control) { BidiUtil.removeLanguageListener(control.handle); } /** - * Removes the orientation listener for the specified window. - * <p> - * - * @param control window to remove the listener from. - */ -static void removeOrientationListener(Control control) { - BidiUtil.removeOrientationListener(control.handle); -} -/** * Calculates render positions using the glyph distance values in the dx array. */ private void calculateRenderPositions() { @@ -1077,9 +1054,11 @@ void setKeyboardLanguage(int logicalIndex) { * <p> * * @param orientation one of SWT.RIGHT_TO_LEFT or SWT.LEFT_TO_RIGHT + * @return true if the orientation was changed, false if the orientation + * could not be changed */ -static void setOrientation(Control control, int orientation) { - BidiUtil.setOrientation(control.handle, orientation); +static boolean setOrientation(Control control, int orientation) { + return BidiUtil.setOrientation(control.handle, orientation); } /** * Returns a string representation of the receiver. diff --git a/bundles/org.eclipse.swt/Eclipse SWT/emulated/bidi/org/eclipse/swt/internal/BidiUtil.java b/bundles/org.eclipse.swt/Eclipse SWT/emulated/bidi/org/eclipse/swt/internal/BidiUtil.java index fa1e01366f..bb7cce3f30 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/emulated/bidi/org/eclipse/swt/internal/BidiUtil.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/emulated/bidi/org/eclipse/swt/internal/BidiUtil.java @@ -45,11 +45,6 @@ public static void addLanguageListener(int hwnd, Runnable runnable) { } /* * Not implemented. - */ -public static void addOrientationListener(int hwnd, Runnable LTRRunnable, Runnable RTLRunnable) { -} -/* - * Not implemented. * */ public static void drawGlyphs(GC gc, char[] renderBuffer, int[] renderDx, int x, int y) { @@ -100,16 +95,11 @@ public static void removeLanguageListener(int hwnd) { /* * Not implemented. */ -public static void removeOrientationListener(int hwnd) { -} -/* - * Not implemented. - */ public static void setKeyboardLanguage(int language) { } /* * Not implemented. */ -public static void setOrientation(int hwnd, int orientation) { +public static boolean setOrientation(int hwnd, int orientation) { } } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/BidiUtil.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/BidiUtil.java index 38385df8eb..3de536dd9a 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/BidiUtil.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/BidiUtil.java @@ -109,22 +109,6 @@ public static void addLanguageListener(int hwnd, Runnable runnable) { subclass(hwnd); } /** - * Adds a widget orientation (writing order) listener. The listener will get notified - * when the user switches the writing order using Ctrl-Shift. - * <p> - * - * @param hwnd the handle of the Control that is listening for widget orientation - * changes - * @param LTRRunnable the listener that is called when writing order is - * switched to "left to right" (left oriented text). - * @param RTLRunnable the listener that is called when writing order is - * switched to "right to left" (right oriented text). - */ -public static void addOrientationListener(int hwnd, Runnable LTRRunnable, Runnable RTLRunnable) { - keyMap.put(new Integer(hwnd), new Runnable[] {LTRRunnable, RTLRunnable}); - subclass(hwnd); -} -/** * Proc used for OS.EnumSystemLanguageGroups call during isBidiPlatform test. */ static int EnumSystemLanguageGroupsProc(int lpLangGrpId, int lpLangGrpIdString, int lpLangGrpName, int options, int lParam) { @@ -499,18 +483,6 @@ public static void removeLanguageListener(int hwnd) { unsubclass(hwnd); } /** - * Removes the widget orientation (writing order) listener for the specified - * control. - * <p> - * - * @param hwnd the handle of the Control that is listening for widget - * orientation changes - */ -public static void removeOrientationListener(int hwnd) { - keyMap.remove(new Integer(hwnd)); - unsubclass(hwnd); -} -/** * Switch the keyboard language to the specified language type. We do * not distinguish between mulitple bidi or multiple non-bidi languages, so * set the keyboard to the first language of the given type. @@ -555,8 +527,11 @@ public static void setKeyboardLanguage(int language) { * * @param hwnd the handle of the Control to change the orientation of * @param orientation one of SWT.RIGHT_TO_LEFT or SWT.LEFT_TO_RIGHT + * @return true if the orientation was changed, false if the orientation + * could not be changed */ -public static void setOrientation (int hwnd, int orientation) { +public static boolean setOrientation (int hwnd, int orientation) { + if ((OS.WIN32_MAJOR << 16 | OS.WIN32_MINOR) < (4 << 16 | 10)) return false; int bits = OS.GetWindowLong (hwnd, OS.GWL_EXSTYLE); if ((orientation & SWT.RIGHT_TO_LEFT) != 0) { bits |= OS.WS_EX_LAYOUTRTL; @@ -564,6 +539,7 @@ public static void setOrientation (int hwnd, int orientation) { bits &= ~OS.WS_EX_LAYOUTRTL; } OS.SetWindowLong (hwnd, OS.GWL_EXSTYLE, bits); + return true; } /** * Override the window proc. @@ -654,19 +630,6 @@ static int windowProc (int hwnd, int msg, int wParam, int lParam) { Runnable runnable = (Runnable) languageMap.get (key); if (runnable != null) runnable.run (); break; - case OS.WM_KEYDOWN: - if (wParam == OS.VK_SHIFT) { - if (OS.GetKeyState (OS.VK_CONTROL) < 0) { - Runnable[] runnables = (Runnable[]) keyMap.get (key); - if (runnables == null) break; - if (OS.GetKeyState (0xA0 /* VK_LSHIFT */) < 0) { - if (runnables[0] != null) runnables[0].run (); - } else { - if (runnables[1] != null) runnables[1].run (); - } - } - } - break; } Integer oldProc = (Integer)oldProcMap.get(key); return OS.CallWindowProc (oldProc.intValue(), hwnd, msg, wParam, lParam); |