Changeset 294:1973f21c5c6f
- Timestamp:
- 08/22/08 09:15:19
(3 months ago)
- Author:
- Frank Benoit <benoit@tionex.de>
- branch:
- default
- Message:
Fix: mouse selection for TextLayout?
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r288 |
r294 |
|
| 735 | 735 | if (selectionStart <= run.start && run.start <= selectionEnd) extents = true; |
|---|
| 736 | 736 | } else { |
|---|
| 737 | | int endOffset = run.start + run.length - 1; |
|---|
| | 737 | int endOffset = segmentsText.getAbsoluteCodePointOffset( run.start + run.length, -1 ); |
|---|
| 738 | 738 | if (selectionStart <= endOffset && endOffset < selectionEnd && (flags & DWT.FULL_SELECTION) !is 0) { |
|---|
| 739 | 739 | extents = true; |
|---|
| … | … | |
| 800 | 800 | bool partialSelection = hasSelection && !(selectionStart > end || run.start > selectionEnd); |
|---|
| 801 | 801 | if (partialSelection) { |
|---|
| 802 | | int selStart = Math.max(selectionStart, run.start) - run.start; |
|---|
| 803 | | int selEnd = Math.min(selectionEnd, end) - run.start; |
|---|
| | 802 | int selStart = index8to16[ Math.max(selectionStart, run.start) ] - index8to16[run.start]; |
|---|
| | 803 | int selEnd = index8to16[ Math.min(selectionEnd, end) ] - index8to16[ run.start ]; |
|---|
| 804 | 804 | int cChars = index8to16[run.start+run.length] - index8to16[run.start]; // make it wchar |
|---|
| 805 | 805 | int gGlyphs = run.glyphCount; |
|---|
| 806 | 806 | int piX; |
|---|
| 807 | 807 | int* advances = run.justify !is null ? run.justify : run.advances; |
|---|
| 808 | | OS.ScriptCPtoX(index8to16[selStart], false, cChars, gGlyphs, run.clusters, run.visAttrs, advances, &run.analysis, &piX); |
|---|
| | 808 | OS.ScriptCPtoX(selStart, false, cChars, gGlyphs, run.clusters, run.visAttrs, advances, &run.analysis, &piX); |
|---|
| 809 | 809 | int runX = (orientation & DWT.RIGHT_TO_LEFT) !is 0 ? run.width - piX : piX; |
|---|
| 810 | 810 | rect.left = drawX + runX; |
|---|
| 811 | 811 | rect.top = drawY; |
|---|
| 812 | | OS.ScriptCPtoX(index8to16[selEnd], true, cChars, gGlyphs, run.clusters, run.visAttrs, advances, &run.analysis, &piX); |
|---|
| | 812 | OS.ScriptCPtoX(selEnd, true, cChars, gGlyphs, run.clusters, run.visAttrs, advances, &run.analysis, &piX); |
|---|
| 813 | 813 | runX = (orientation & DWT.RIGHT_TO_LEFT) !is 0 ? run.width - piX : piX; |
|---|
| 814 | 814 | rect.right = drawX + runX; |
|---|