diff options
author | Kevin Barnes <krbarnes> | 2008-08-25 19:46:14 +0000 |
---|---|---|
committer | Kevin Barnes <krbarnes> | 2008-08-25 19:46:14 +0000 |
commit | 9d80fa41aebed8140fd6eb7eab6449cb2fe17efe (patch) | |
tree | 6251164124c7b9c11732b405392bc329f6c892c1 /bundles | |
parent | f027e65f362a4197ce516f6998da11767ff4ed6f (diff) | |
download | eclipse.platform.swt-9d80fa41aebed8140fd6eb7eab6449cb2fe17efe.tar.gz eclipse.platform.swt-9d80fa41aebed8140fd6eb7eab6449cb2fe17efe.tar.xz eclipse.platform.swt-9d80fa41aebed8140fd6eb7eab6449cb2fe17efe.zip |
put back DRAW_MNEMONIC and DRAW_DELIMITER code
Diffstat (limited to 'bundles')
-rwxr-xr-x | bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/GC.java | 70 |
1 files changed, 35 insertions, 35 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/GC.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/GC.java index 1a4c570cd5..539aec6c4a 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/GC.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/GC.java @@ -635,41 +635,41 @@ NSAttributedString createString(String string, int flags) { int length = string.length(); char[] chars = new char[length]; string.getChars(0, length, chars, 0); -// int breakCount = 0; -// int[] breaks = null; -// if ((flags & (SWT.DRAW_MNEMONIC | SWT.DRAW_DELIMITER)) != 0) { -// int i=0, j=0; -// while (i < chars.length) { -// char c = chars [j++] = chars [i++]; -// switch (c) { -// case '&': { -// if ((flags & SWT.DRAW_MNEMONIC) != 0) { -// if (i == chars.length) {continue;} -// if (chars [i] == '&') {i++; continue;} -// j--; -// } -// break; -// } -// case '\r': -// case '\n': { -// if ((flags & SWT.DRAW_DELIMITER) != 0) { -// if (c == '\r' && i != chars.length && chars[i] == '\n') i++; -// j--; -// if (breaks == null) { -// breaks = new int[4]; -// } else if (breakCount == breaks.length) { -// int[] newBreaks = new int[breaks.length + 4]; -// System.arraycopy(breaks, 0, newBreaks, 0, breaks.length); -// breaks = newBreaks; -// } -// breaks[breakCount++] = j; -// } -// break; -// } -// } -// } -// length = j; -// } + int breakCount = 0; + int[] breaks = null; + if ((flags & (SWT.DRAW_MNEMONIC | SWT.DRAW_DELIMITER)) != 0) { + int i=0, j=0; + while (i < chars.length) { + char c = chars [j++] = chars [i++]; + switch (c) { + case '&': { + if ((flags & SWT.DRAW_MNEMONIC) != 0) { + if (i == chars.length) {continue;} + if (chars [i] == '&') {i++; continue;} + j--; + } + break; + } + case '\r': + case '\n': { + if ((flags & SWT.DRAW_DELIMITER) != 0) { + if (c == '\r' && i != chars.length && chars[i] == '\n') i++; + j--; + if (breaks == null) { + breaks = new int[4]; + } else if (breakCount == breaks.length) { + int[] newBreaks = new int[breaks.length + 4]; + System.arraycopy(breaks, 0, newBreaks, 0, breaks.length); + breaks = newBreaks; + } + breaks[breakCount++] = j; + } + break; + } + } + } + length = j; + } NSString str = NSString.stringWithCharacters(chars, length); return ((NSAttributedString)new NSAttributedString().alloc()).initWithString(str, dict); } |