Mercurial > projects > dwt2
comparison org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/CTabFolder.d @ 120:536e43f63c81
Comprehensive update for Win32/Linux32 dmd-2.053/dmd-1.068+Tango-r5661
===D2===
* added [Try]Immutable/Const/Shared templates to work with differenses in D1/D2 instead of version statements
used these templates to work with strict type storage rules of dmd-2.053
* com.ibm.icu now also compilable with D2, but not tested yet
* small fixes
Snippet288 - shared data is in TLS
===Phobos===
* fixed critical bugs in Phobos implemention
completely incorrect segfault prone fromStringz (Linux's port ruthless killer)
terrible, incorrect StringBuffer realization (StyledText killer)
* fixed small bugs as well
Snippet72 - misprint in the snippet
* implemented missed functionality for Phobos
ByteArrayOutputStream implemented (image loading available)
formatting correctly works for all DWT's cases
As a result, folowing snippets now works with Phobos (Snippet### - what is fixed):
Snippet24, 42, 111, 115, 130, 235, 276 - bad string formatting
Snippet48, 282 - crash on image loading
Snippet163, 189, 211, 213, 217, 218, 222 - crash on copy/cut in StyledText
Snippet244 - hang-up
===Tango===
* few changes for the latest Tango trunc-r5661
* few small performance improvments
===General===
* implMissing-s for only one version changed to implMissingInTango/InPhobos
* incorrect calls to Format in toString-s fixed
* fixed loading \uXXXX characters in ResourceBundle
* added good UTF-8 support for StyledText, TextLayout (Win32) and friends
UTF functions revised and tested. It is now in java.nonstandard.*Utf modules
StyledText and TextLayout (Win32) modules revised for UTF-8 support
* removed small diferences in most identical files in *.swt.* folders
*.swt.internal.image, *.swt.events and *.swt.custom are identical in Win32/Linux32
now 179 of 576 (~31%) files in *.swt.* folders are fully identical
* Win32: snippets now have right subsystem, pretty icons and native system style controls
* small fixes in snippets
Snippet44 - it's not Snippet44
Snippet212 - functions work with different images and offsets arrays
Win32: Snippet282 - crash on close if the button has an image
Snippet293 - setGrayed is commented
and others
Win32: As a result, folowing snippets now works
Snippet68 - color doesn't change
Snippet163, 189, 211, 213, 217, 218, 222 - UTF-8 issues (see above)
Snippet193 - no tabel headers
author | Denis Shelomovskij <verylonglogin.reg@gmail.com> |
---|---|
date | Sat, 09 Jul 2011 15:50:20 +0300 |
parents | c01d033c633a |
children |
comparison
equal
deleted
inserted
replaced
119:d00e8db0a568 | 120:536e43f63c81 |
---|---|
46 import org.eclipse.swt.custom.CTabFolderListener; | 46 import org.eclipse.swt.custom.CTabFolderListener; |
47 import org.eclipse.swt.custom.CTabFolderLayout; | 47 import org.eclipse.swt.custom.CTabFolderLayout; |
48 import org.eclipse.swt.custom.CTabFolderEvent; | 48 import org.eclipse.swt.custom.CTabFolderEvent; |
49 | 49 |
50 import java.lang.all; | 50 import java.lang.all; |
51 version(Tango){ | 51 import java.nonstandard.UnsafeUtf; |
52 import tango.util.Convert; | |
53 static import tango.text.convert.Utf; | |
54 } else { // Phobos | |
55 import std.conv; | |
56 } | |
57 | 52 |
58 /** | 53 /** |
59 * | 54 * |
60 * Instances of this class implement the notebook user interface | 55 * Instances of this class implement the notebook user interface |
61 * metaphor. It allows the user to select a notebook page from | 56 * metaphor. It allows the user to select a notebook page from |
888 while (showCount < priority.length && items[priority[showCount]].showing) { | 883 while (showCount < priority.length && items[priority[showCount]].showing) { |
889 showCount++; | 884 showCount++; |
890 } | 885 } |
891 count = items.length - showCount; | 886 count = items.length - showCount; |
892 } | 887 } |
893 String chevronString = count > 99 ? "99+" : to!(String)(count); //$NON-NLS-1$ | 888 String chevronString = count > 99 ? "99+" : String_valueOf(count); //$NON-NLS-1$ |
894 switch (chevronImageState) { | 889 switch (chevronImageState) { |
895 case NORMAL: { | 890 case NORMAL: { |
896 Color chevronBorder = single ? getSelectionForeground() : getForeground(); | 891 Color chevronBorder = single ? getSelectionForeground() : getForeground(); |
897 gc.setForeground(chevronBorder); | 892 gc.setForeground(chevronBorder); |
898 gc.setFont(f); | 893 gc.setFont(f); |
1107 int width = size.x - borderLeft - borderRight + 1; | 1102 int width = size.x - borderLeft - borderRight + 1; |
1108 int height = tabHeight - 1; | 1103 int height = tabHeight - 1; |
1109 | 1104 |
1110 // Draw Tab Header | 1105 // Draw Tab Header |
1111 if (onBottom) { | 1106 if (onBottom) { |
1112 int[] left, right; | 1107 TryConst!(int)[] left, right; |
1113 if ((getStyle() & SWT.BORDER) !is 0) { | 1108 if ((getStyle() & SWT.BORDER) !is 0) { |
1114 left = simple ? SIMPLE_BOTTOM_LEFT_CORNER : BOTTOM_LEFT_CORNER; | 1109 left = simple ? SIMPLE_BOTTOM_LEFT_CORNER : BOTTOM_LEFT_CORNER; |
1115 right = simple ? SIMPLE_BOTTOM_RIGHT_CORNER : BOTTOM_RIGHT_CORNER; | 1110 right = simple ? SIMPLE_BOTTOM_RIGHT_CORNER : BOTTOM_RIGHT_CORNER; |
1116 } else { | 1111 } else { |
1117 left = simple ? SIMPLE_BOTTOM_LEFT_CORNER_BORDERLESS : BOTTOM_LEFT_CORNER_BORDERLESS; | 1112 left = simple ? SIMPLE_BOTTOM_LEFT_CORNER_BORDERLESS : BOTTOM_LEFT_CORNER_BORDERLESS; |
1132 if (borderLeft is 0) shape[index-1] += 1; | 1127 if (borderLeft is 0) shape[index-1] += 1; |
1133 } | 1128 } |
1134 shape[index++] = x+width; | 1129 shape[index++] = x+width; |
1135 shape[index++] = y-highlight_header; | 1130 shape[index++] = y-highlight_header; |
1136 } else { | 1131 } else { |
1137 int[] left, right; | 1132 TryConst!(int)[] left, right; |
1138 if ((getStyle() & SWT.BORDER) !is 0) { | 1133 if ((getStyle() & SWT.BORDER) !is 0) { |
1139 left = simple ? SIMPLE_TOP_LEFT_CORNER : TOP_LEFT_CORNER; | 1134 left = simple ? SIMPLE_TOP_LEFT_CORNER : TOP_LEFT_CORNER; |
1140 right = simple ? SIMPLE_TOP_RIGHT_CORNER : TOP_RIGHT_CORNER; | 1135 right = simple ? SIMPLE_TOP_RIGHT_CORNER : TOP_RIGHT_CORNER; |
1141 } else { | 1136 } else { |
1142 left = simple ? SIMPLE_TOP_LEFT_CORNER_BORDERLESS : TOP_LEFT_CORNER_BORDERLESS; | 1137 left = simple ? SIMPLE_TOP_LEFT_CORNER_BORDERLESS : TOP_LEFT_CORNER_BORDERLESS; |
1312 int index = 0; | 1307 int index = 0; |
1313 int length_ = string.length; | 1308 int length_ = string.length; |
1314 do { | 1309 do { |
1315 while (index < length_ && string[index] !is '&') index++; | 1310 while (index < length_ && string[index] !is '&') index++; |
1316 if (++index >= length_) return '\0'; | 1311 if (++index >= length_) return '\0'; |
1317 if (string[index] !is '&') return CharacterFirstToLower(string[index..$]); | 1312 if (string[index] !is '&') return Character.toLowerCase (string.dcharAt (index)); |
1318 index++; | 1313 index++; |
1319 } while (index < length_); | 1314 } while (index < length_); |
1320 return '\0'; | 1315 return '\0'; |
1321 } | 1316 } |
1322 String stripMnemonic (String string) { | 1317 String stripMnemonic (String string) { |
1685 if (childID >= 0 && childID < items.length) { | 1680 if (childID >= 0 && childID < items.length) { |
1686 String text = items[childID].getText(); | 1681 String text = items[childID].getText(); |
1687 if (text !is null) { | 1682 if (text !is null) { |
1688 dchar mnemonic = _findMnemonic(text); | 1683 dchar mnemonic = _findMnemonic(text); |
1689 if (mnemonic !is '\0') { | 1684 if (mnemonic !is '\0') { |
1690 shortcut = Format("Alt+{}", mnemonic); //$NON-NLS-1$ | 1685 shortcut = "Alt+"~dcharToString(mnemonic); //$NON-NLS-1$ |
1691 } | 1686 } |
1692 } | 1687 } |
1693 } | 1688 } |
1694 e.result = shortcut; | 1689 e.result = shortcut; |
1695 } | 1690 } |