Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 151889 Details for
Bug 241482
[Bidi] Need to extend BidiSegmentListener
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Patch for win32
241482.patch (text/plain), 6.64 KB, created by
Felipe Heidrich
on 2009-11-10 16:54:37 EST
(
hide
)
Description:
Patch for win32
Filename:
MIME Type:
Creator:
Felipe Heidrich
Created:
2009-11-10 16:54:37 EST
Size:
6.64 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.swt >Index: Eclipse SWT/win32/org/eclipse/swt/graphics/TextLayout.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/TextLayout.java,v >retrieving revision 1.174 >diff -u -r1.174 TextLayout.java >--- Eclipse SWT/win32/org/eclipse/swt/graphics/TextLayout.java 2 Nov 2009 15:33:08 -0000 1.174 >+++ Eclipse SWT/win32/org/eclipse/swt/graphics/TextLayout.java 10 Nov 2009 21:45:30 -0000 >@@ -47,6 +47,7 @@ > boolean justify; > int[] tabs; > int[] segments; >+ char[] segmentsChars; > StyleItem[] styles; > int stylesCount; > >@@ -465,6 +466,8 @@ > lineOffset = null; > lineY = null; > lineWidth = null; >+ segments = null; >+ segmentsChars = null; > if (mLangFontLink2 != 0) { > /* Release() */ > OS.VtblCall(2, mLangFontLink2); >@@ -2292,32 +2295,53 @@ > return segments; > } > >+/** >+ * Returns the segments characters of the receiver. >+ * >+ * @return the segments characters >+ * >+ * @exception SWTException <ul> >+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li> >+ * </ul> >+ * >+ * @since 3.6 >+ */ >+public char[] getSegmentsChars () { >+ checkLayout(); >+ return segmentsChars; >+} >+ > String getSegmentsText() { >- if (segments == null) return text; >- int nSegments = segments.length; >- if (nSegments <= 1) return text; > int length = text.length(); > if (length == 0) return text; >- if (nSegments == 2) { >- if (segments[0] == 0 && segments[1] == length) return text; >+ if (segments == null) return text; >+ int nSegments = segments.length; >+ if (nSegments == 0) return text; >+ if (segmentsChars == null) { >+ if (nSegments == 1) return text; >+ if (nSegments == 2) { >+ if (segments[0] == 0 && segments[1] == length) return text; >+ } > } > char[] oldChars = new char[length]; > text.getChars(0, length, oldChars, 0); > char[] newChars = new char[length + nSegments]; > int charCount = 0, segmentCount = 0; >- char separator = orientation == SWT.RIGHT_TO_LEFT ? RTL_MARK : LTR_MARK; >+ char defaultSeparator = orientation == SWT.RIGHT_TO_LEFT ? RTL_MARK : LTR_MARK; > while (charCount < length) { > if (segmentCount < nSegments && charCount == segments[segmentCount]) { >+ char separator = segmentsChars != null && segmentsChars.length > segmentCount ? segmentsChars[segmentCount] : defaultSeparator; > newChars[charCount + segmentCount++] = separator; > } else { > newChars[charCount + segmentCount] = oldChars[charCount++]; > } > } >- if (segmentCount < nSegments) { >+ while (segmentCount < nSegments) { > segments[segmentCount] = charCount; >+ char separator = segmentsChars != null && segmentsChars.length > segmentCount ? segmentsChars[segmentCount] : defaultSeparator; > newChars[charCount + segmentCount++] = separator; > } >- return new String(newChars, 0, Math.min(charCount + segmentCount, newChars.length)); >+ return new String(newChars, 0, newChars.length); > } > > /** >@@ -2812,12 +2836,18 @@ > * always be zero and the last one should always be equals to length of > * the text. > * </p> >+ * <p> >+ * When segments characters are set, the segments are the offsets where >+ * the characters are inserted in the text. >+ * <p> > * > * @param segments the text segments offset > * > * @exception SWTException <ul> > * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li> > * </ul> >+ * >+ * @see #setSegmentsChars(char[]) > */ > public void setSegments(int[] segments) { > checkLayout(); >@@ -2836,6 +2866,39 @@ > } > > /** >+ * Sets the characters to be used in the segments boundaries. The segments >+ * are set by calling <code>setSegments(int[])</code>. The application can >+ * use this API to insert Unicode Control Characters in the text to control >+ * the display of the text and bidi reordering. The characters are not >+ * accessible by any other API in </code>TextLayout<code>. >+ * >+ * @param segmentsChars the segments characters >+ * >+ * @exception SWTException <ul> >+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li> >+ * </ul> >+ * >+ * @see #setSegments(int[]) >+ * >+ * @since 3.6 >+ */ >+public void setSegmentsChars(char[] segmentsChars) { >+ checkLayout(); >+ if (this.segmentsChars == null && segmentsChars == null) return; >+ if (this.segmentsChars != null && segmentsChars != null) { >+ if (this.segmentsChars.length == segmentsChars.length) { >+ int i; >+ for (i = 0; i <segmentsChars.length; i++) { >+ if (this.segmentsChars[i] != segmentsChars[i]) break; >+ } >+ if (i == segmentsChars.length) return; >+ } >+ } >+ freeRuns(); >+ this.segmentsChars = segmentsChars; >+} >+ >+/** > * Sets the line spacing of the receiver. The line spacing > * is the space left between lines. > * >@@ -3322,16 +3385,8 @@ > } > > int validadeOffset(int offset, int step) { >- offset += step; >- if (segments != null && segments.length > 2) { >- for (int i = 0; i < segments.length; i++) { >- if (translateOffset(segments[i]) - 1 == offset) { >- offset += step; >- break; >- } >- } >- } >- return offset; >+ offset = untranslateOffset(offset); >+ return translateOffset(offset + step); > } > > /** >@@ -3346,13 +3401,16 @@ > } > > int translateOffset(int offset) { >- if (segments == null) return offset; >- int nSegments = segments.length; >- if (nSegments <= 1) return offset; > int length = text.length(); > if (length == 0) return offset; >- if (nSegments == 2) { >- if (segments[0] == 0 && segments[1] == length) return offset; >+ if (segments == null) return offset; >+ int nSegments = segments.length; >+ if (nSegments == 0) return offset; >+ if (segmentsChars == null) { >+ if (nSegments == 1) return offset; >+ if (nSegments == 2) { >+ if (segments[0] == 0 && segments[1] == length) return offset; >+ } > } > for (int i = 0; i < nSegments && offset - i >= segments[i]; i++) { > offset++; >@@ -3361,15 +3419,18 @@ > } > > int untranslateOffset(int offset) { >- if (segments == null) return offset; >- int nSegments = segments.length; >- if (nSegments <= 1) return offset; > int length = text.length(); > if (length == 0) return offset; >- if (nSegments == 2) { >- if (segments[0] == 0 && segments[1] == length) return offset; >+ if (segments == null) return offset; >+ int nSegments = segments.length; >+ if (nSegments == 0) return offset; >+ if (segmentsChars == null) { >+ if (nSegments == 1) return offset; >+ if (nSegments == 2) { >+ if (segments[0] == 0 && segments[1] == length) return offset; >+ } > } >- for (int i = 0; i < nSegments && offset > segments[i]; i++) { >+ for (int i = 0; i < nSegments && offset > 0 && offset >= segments[i]; i++) { > offset--; > } > return offset;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 241482
:
149826
|
149827
|
149828
|
150247
|
150475
|
150476
|
150521
|
150529
|
151170
|
151171
|
151175
|
151416
|
151681
|
151813
|
151856
|
151888
| 151889 |
152092
|
152244
|
152384
|
152386
|
152414
|
152419
|
152617
|
152635