summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelipe Heidrich <fheidric>2007-05-14 18:11:54 +0000
committerFelipe Heidrich <fheidric>2007-05-14 18:11:54 +0000
commit8b238898c4ed9883f63ad8ceb09b6424ca913173 (patch)
treeb914c3c299000732380615a809aa69afb3db4b77
parentfe4a7ef9ad4e37f535a4fba660bd4483507d1a8c (diff)
downloadeclipse.platform.swt-8b238898c4ed9883f63ad8ceb09b6424ca913173.tar.gz
eclipse.platform.swt-8b238898c4ed9883f63ad8ceb09b6424ca913173.tar.xz
eclipse.platform.swt-8b238898c4ed9883f63ad8ceb09b6424ca913173.zip
Bug 158122 BIDI: StyledText does not paint selection well when mirrored
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/TextLayout.java9
1 files changed, 5 insertions, 4 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/TextLayout.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/TextLayout.java
index 535e1834b5..84a3183291 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/TextLayout.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/TextLayout.java
@@ -614,9 +614,10 @@ public void draw (GC gc, int x, int y, int selectionStart, int selectionEnd, Col
Gdip.Color_delete(color);
} else {
selBrush = OS.CreateSolidBrush(selectionBackground.handle);
- selPen = OS.CreatePen(OS.BS_SOLID, 1, selectionForeground.handle);
+ selPen = OS.CreatePen(OS.PS_SOLID, 1, selectionForeground.handle);
}
}
+ int offset = (orientation & SWT.RIGHT_TO_LEFT) != 0 ? -1 : 0;
OS.SetBkMode(hdc, OS.TRANSPARENT);
for (int line=0; line<runs.length; line++) {
int drawX = x + getLineIndent(line);
@@ -860,9 +861,9 @@ public void draw (GC gc, int x, int y, int selectionStart, int selectionEnd, Col
if (run.style != null && run.style.foreground != null) fg = run.style.foreground.handle;
}
OS.SetTextColor(hdc, fg);
- OS.ScriptTextOut(hdc, run.psc, drawX, drawRunY, 0, null, run.analysis , 0, 0, run.glyphs, run.glyphCount, run.advances, run.justify, run.goffsets);
+ OS.ScriptTextOut(hdc, run.psc, drawX + offset, drawRunY, 0, null, run.analysis , 0, 0, run.glyphs, run.glyphCount, run.advances, run.justify, run.goffsets);
if (run.style != null && (run.style.underline || run.style.strikeout)) {
- int newPen = hasSelection && fg == selectionForeground.handle ? selPen : OS.CreatePen(OS.BS_SOLID, 1, fg);
+ int newPen = hasSelection && fg == selectionForeground.handle ? selPen : OS.CreatePen(OS.PS_SOLID, 1, fg);
int oldPen = OS.SelectObject(hdc, newPen);
if (run.style.underline) {
int underlineY = drawY + baseline + 1 - run.style.rise;
@@ -879,7 +880,7 @@ public void draw (GC gc, int x, int y, int selectionStart, int selectionEnd, Col
}
if (partialSelection && fg != selectionForeground.handle) {
OS.SetTextColor(hdc, selectionForeground.handle);
- OS.ScriptTextOut(hdc, run.psc, drawX, drawRunY, OS.ETO_CLIPPED, rect, run.analysis , 0, 0, run.glyphs, run.glyphCount, run.advances, run.justify, run.goffsets);
+ OS.ScriptTextOut(hdc, run.psc, drawX + offset, drawRunY, OS.ETO_CLIPPED, rect, run.analysis , 0, 0, run.glyphs, run.glyphCount, run.advances, run.justify, run.goffsets);
if (run.style != null && (run.style.underline || run.style.strikeout)) {
int oldPen = OS.SelectObject(hdc, selPen);
if (run.style.underline) {