Mercurial > projects > dwt2
comparison org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/graphics/GC.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 | 0ecb2b338560 |
children |
comparison
equal
deleted
inserted
replaced
119:d00e8db0a568 | 120:536e43f63c81 |
---|---|
242 state |= LINE_STYLE; | 242 state |= LINE_STYLE; |
243 default: | 243 default: |
244 } | 244 } |
245 } | 245 } |
246 if ((state & LINE_STYLE) !is 0) { | 246 if ((state & LINE_STYLE) !is 0) { |
247 float[] dashes = null; | 247 TryConst!(float)[] dashes = null; |
248 float dashOffset = 0; | 248 float dashOffset = 0; |
249 int dashStyle = Gdip.DashStyleSolid; | 249 int dashStyle = Gdip.DashStyleSolid; |
250 switch (data.lineStyle) { | 250 switch (data.lineStyle) { |
251 case SWT.LINE_SOLID: break; | 251 case SWT.LINE_SOLID: break; |
252 case SWT.LINE_DOT: dashStyle = Gdip.DashStyleDot; if (width is 0) dashes = LINE_DOT_ZERO; break; | 252 case SWT.LINE_DOT: dashStyle = Gdip.DashStyleDot; if (width is 0) dashes = LINE_DOT_ZERO; break; |
254 case SWT.LINE_DASHDOT: dashStyle = Gdip.DashStyleDashDot; if (width is 0) dashes = LINE_DASHDOT_ZERO; break; | 254 case SWT.LINE_DASHDOT: dashStyle = Gdip.DashStyleDashDot; if (width is 0) dashes = LINE_DASHDOT_ZERO; break; |
255 case SWT.LINE_DASHDOTDOT: dashStyle = Gdip.DashStyleDashDotDot; if (width is 0) dashes = LINE_DASHDOTDOT_ZERO; break; | 255 case SWT.LINE_DASHDOTDOT: dashStyle = Gdip.DashStyleDashDotDot; if (width is 0) dashes = LINE_DASHDOTDOT_ZERO; break; |
256 case SWT.LINE_CUSTOM: { | 256 case SWT.LINE_CUSTOM: { |
257 if (data.lineDashes !is null) { | 257 if (data.lineDashes !is null) { |
258 dashOffset = data.lineDashesOffset / Math.max (1.0f, width); | 258 dashOffset = data.lineDashesOffset / Math.max (1.0f, width); |
259 dashes = new float[data.lineDashes.length * 2]; | 259 float[] dashes_ = new float[data.lineDashes.length * 2]; |
260 for (int i = 0; i < data.lineDashes.length; i++) { | 260 for (int i = 0; i < data.lineDashes.length; i++) { |
261 float dash = data.lineDashes[i] / Math.max (1.0f, width); | 261 float dash = data.lineDashes[i] / Math.max (1.0f, width); |
262 dashes[i] = dash; | 262 dashes_[i] = dash; |
263 dashes[i + data.lineDashes.length] = dash; | 263 dashes_[i + data.lineDashes.length] = dash; |
264 } | 264 } |
265 dashes = dashes_; | |
265 } | 266 } |
266 } | 267 } |
267 default: | 268 default: |
268 } | 269 } |
269 if (dashes !is null) { | 270 if (dashes !is null) { |
2441 * @param object the object to compare with this object | 2442 * @param object the object to compare with this object |
2442 * @return <code>true</code> if the object is the same as this object and <code>false</code> otherwise | 2443 * @return <code>true</code> if the object is the same as this object and <code>false</code> otherwise |
2443 * | 2444 * |
2444 * @see #hashCode | 2445 * @see #hashCode |
2445 */ | 2446 */ |
2446 public bool equals (Object object) { | 2447 public override equals_t opEquals (Object object) { |
2447 return (object is this) || (null !is (cast(GC)object) && (handle is (cast(GC)object).handle)); | 2448 return (object is this) || (null !is (cast(GC)object) && (handle is (cast(GC)object).handle)); |
2448 } | 2449 } |
2449 | 2450 |
2450 /** | 2451 /** |
2451 * Fills the interior of a circular or elliptical arc within | 2452 * Fills the interior of a circular or elliptical arc within |
2964 OS.GetTextExtentPoint32W(handle, [ch], 1, &size); | 2965 OS.GetTextExtentPoint32W(handle, [ch], 1, &size); |
2965 return size.cx; | 2966 return size.cx; |
2966 } | 2967 } |
2967 int tch = ch; | 2968 int tch = ch; |
2968 if (ch > 0x7F) { | 2969 if (ch > 0x7F) { |
2969 char[1] str; | 2970 TryImmutable!(char)[1] str = ch; |
2970 str[0] = ch; | |
2971 StringT buffer = StrToTCHARs( str ); | 2971 StringT buffer = StrToTCHARs( str ); |
2972 tch = buffer[0]; | 2972 tch = buffer[0]; |
2973 } | 2973 } |
2974 int width; | 2974 int width; |
2975 OS.GetCharWidth(handle, tch, tch, &width); | 2975 OS.GetCharWidth(handle, tch, tch, &width); |
3110 | 3110 |
3111 /* GetCharABCWidths only succeeds on truetype fonts */ | 3111 /* GetCharABCWidths only succeeds on truetype fonts */ |
3112 static if (!OS.IsWinCE) { | 3112 static if (!OS.IsWinCE) { |
3113 int tch = ch; | 3113 int tch = ch; |
3114 if (ch > 0x7F) { | 3114 if (ch > 0x7F) { |
3115 char[1] str; | 3115 TryImmutable!(char)[1] str = ch; |
3116 str[0] = ch; | |
3117 StringT buffer = StrToTCHARs( str ); | 3116 StringT buffer = StrToTCHARs( str ); |
3118 tch = buffer[0]; | 3117 tch = buffer[0]; |
3119 } | 3118 } |
3120 ABC abc; | 3119 ABC abc; |
3121 if (OS.GetCharABCWidths(handle, tch, tch, &abc)) { | 3120 if (OS.GetCharABCWidths(handle, tch, tch, &abc)) { |
3125 | 3124 |
3126 /* It wasn't a truetype font */ | 3125 /* It wasn't a truetype font */ |
3127 TEXTMETRIC lptm; | 3126 TEXTMETRIC lptm; |
3128 OS.GetTextMetrics(handle, &lptm); | 3127 OS.GetTextMetrics(handle, &lptm); |
3129 SIZE size; | 3128 SIZE size; |
3130 char[1] str; | 3129 TryImmutable!(char)[1] str = ch; |
3131 str[0] = ch; | |
3132 OS.GetTextExtentPoint32W(handle, StrToWCHARz( str ), 1, &size); | 3130 OS.GetTextExtentPoint32W(handle, StrToWCHARz( str ), 1, &size); |
3133 return size.cx - lptm.tmOverhang; | 3131 return size.cx - lptm.tmOverhang; |
3134 } | 3132 } |
3135 | 3133 |
3136 /** | 3134 /** |