Mercurial > projects > dwt2
comparison org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/CTabItem.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 | fb3aa8075988 |
children |
comparison
equal
deleted
inserted
replaced
119:d00e8db0a568 | 120:536e43f63c81 |
---|---|
30 import org.eclipse.swt.widgets.Display; | 30 import org.eclipse.swt.widgets.Display; |
31 import org.eclipse.swt.widgets.Item; | 31 import org.eclipse.swt.widgets.Item; |
32 import org.eclipse.swt.widgets.Widget; | 32 import org.eclipse.swt.widgets.Widget; |
33 import org.eclipse.swt.custom.CTabFolder; | 33 import org.eclipse.swt.custom.CTabFolder; |
34 | 34 |
35 | 35 version(Tango){ |
36 version (Tango) | |
37 import tango.text.convert.Utf; | 36 import tango.text.convert.Utf; |
38 | 37 } else { |
39 else | |
40 { | |
41 import std.conv; | 38 import std.conv; |
42 | |
43 alias to!(string) toString; | 39 alias to!(string) toString; |
44 alias to!(dstring) toString32; | 40 alias to!(dstring) toString32; |
45 } | 41 } |
46 | 42 |
47 /** | 43 /** |
225 case CTabFolder.HOT: { | 221 case CTabFolder.HOT: { |
226 int[] shape = [x,y, x+2,y, x+4,y+2, x+5,y+2, x+7,y, x+9,y, | 222 int[] shape = [x,y, x+2,y, x+4,y+2, x+5,y+2, x+7,y, x+9,y, |
227 x+9,y+2, x+7,y+4, x+7,y+5, x+9,y+7, x+9,y+9, | 223 x+9,y+2, x+7,y+4, x+7,y+5, x+9,y+7, x+9,y+9, |
228 x+7,y+9, x+5,y+7, x+4,y+7, x+2,y+9, x,y+9, | 224 x+7,y+9, x+5,y+7, x+4,y+7, x+2,y+9, x,y+9, |
229 x,y+7, x+2,y+5, x+2,y+4, x,y+2]; | 225 x,y+7, x+2,y+5, x+2,y+4, x,y+2]; |
230 Color fill = new Color(display, cast(RGB)CTabFolder.CLOSE_FILL); | 226 Color fill = new Color(display, CTabFolder.CLOSE_FILL); |
231 gc.setBackground(fill); | 227 gc.setBackground(fill); |
232 gc.fillPolygon(shape); | 228 gc.fillPolygon(shape); |
233 fill.dispose(); | 229 fill.dispose(); |
234 gc.setForeground(closeBorder); | 230 gc.setForeground(closeBorder); |
235 gc.drawPolygon(shape); | 231 gc.drawPolygon(shape); |
238 case CTabFolder.SELECTED: { | 234 case CTabFolder.SELECTED: { |
239 int[] shape = [x+1,y+1, x+3,y+1, x+5,y+3, x+6,y+3, x+8,y+1, x+10,y+1, | 235 int[] shape = [x+1,y+1, x+3,y+1, x+5,y+3, x+6,y+3, x+8,y+1, x+10,y+1, |
240 x+10,y+3, x+8,y+5, x+8,y+6, x+10,y+8, x+10,y+10, | 236 x+10,y+3, x+8,y+5, x+8,y+6, x+10,y+8, x+10,y+10, |
241 x+8,y+10, x+6,y+8, x+5,y+8, x+3,y+10, x+1,y+10, | 237 x+8,y+10, x+6,y+8, x+5,y+8, x+3,y+10, x+1,y+10, |
242 x+1,y+8, x+3,y+6, x+3,y+5, x+1,y+3]; | 238 x+1,y+8, x+3,y+6, x+3,y+5, x+1,y+3]; |
243 Color fill = new Color(display, cast(RGB)CTabFolder.CLOSE_FILL); | 239 Color fill = new Color(display, CTabFolder.CLOSE_FILL); |
244 gc.setBackground(fill); | 240 gc.setBackground(fill); |
245 gc.fillPolygon(shape); | 241 gc.fillPolygon(shape); |
246 fill.dispose(); | 242 fill.dispose(); |
247 gc.setForeground(closeBorder); | 243 gc.setForeground(closeBorder); |
248 gc.drawPolygon(shape); | 244 gc.drawPolygon(shape); |
297 } | 293 } |
298 | 294 |
299 // draw selected tab background and outline | 295 // draw selected tab background and outline |
300 shape = null; | 296 shape = null; |
301 if (this.parent.onBottom) { | 297 if (this.parent.onBottom) { |
302 int[] left = parent.simple ? CTabFolder.SIMPLE_BOTTOM_LEFT_CORNER : CTabFolder.BOTTOM_LEFT_CORNER; | 298 TryConst!(int)[] left = parent.simple ? CTabFolder.SIMPLE_BOTTOM_LEFT_CORNER : CTabFolder.BOTTOM_LEFT_CORNER; |
303 int[] right = parent.simple ? cast(int[])CTabFolder.SIMPLE_BOTTOM_RIGHT_CORNER : parent.curve; | 299 TryConst!(int[]) right = parent.simple ? CTabFolder.SIMPLE_BOTTOM_RIGHT_CORNER : parent.curve; |
304 if (parent.borderLeft is 0 && parent.indexOf(this) is parent.firstIndex) { | 300 if (parent.borderLeft is 0 && parent.indexOf(this) is parent.firstIndex) { |
305 left = [x, y+height]; | 301 left = [x, y+height]; |
306 } | 302 } |
307 shape = new int[left.length+right.length+8]; | 303 shape = new int[left.length+right.length+8]; |
308 int index = 0; | 304 int index = 0; |
321 shape[index++] = parent.simple ? rightEdge - 1 : rightEdge + parent.curveWidth - parent.curveIndent; | 317 shape[index++] = parent.simple ? rightEdge - 1 : rightEdge + parent.curveWidth - parent.curveIndent; |
322 shape[index++] = y - 1; | 318 shape[index++] = y - 1; |
323 shape[index++] = parent.simple ? rightEdge - 1 : rightEdge + parent.curveWidth - parent.curveIndent; | 319 shape[index++] = parent.simple ? rightEdge - 1 : rightEdge + parent.curveWidth - parent.curveIndent; |
324 shape[index++] = y - 1; | 320 shape[index++] = y - 1; |
325 } else { | 321 } else { |
326 int[] left = parent.simple ? CTabFolder.SIMPLE_TOP_LEFT_CORNER : CTabFolder.TOP_LEFT_CORNER; | 322 TryConst!(int)[] left = parent.simple ? CTabFolder.SIMPLE_TOP_LEFT_CORNER : CTabFolder.TOP_LEFT_CORNER; |
327 int[] right = parent.simple ? cast(int[])CTabFolder.SIMPLE_TOP_RIGHT_CORNER : parent.curve; | 323 TryConst!(int[]) right = parent.simple ? CTabFolder.SIMPLE_TOP_RIGHT_CORNER : parent.curve; |
328 if (parent.borderLeft is 0 && parent.indexOf(this) is parent.firstIndex) { | 324 if (parent.borderLeft is 0 && parent.indexOf(this) is parent.firstIndex) { |
329 left = [x, y]; | 325 left = [x, y]; |
330 } | 326 } |
331 shape = new int[left.length+right.length+8]; | 327 shape = new int[left.length+right.length+8]; |
332 int index = 0; | 328 int index = 0; |
484 CTabFolder.TOP_LEFT_CORNER_HILITE[0] + x + 1, //rely on fact that first pair is top/right of curve | 480 CTabFolder.TOP_LEFT_CORNER_HILITE[0] + x + 1, //rely on fact that first pair is top/right of curve |
485 1 + y, | 481 1 + y, |
486 rightEdge - parent.curveIndent, | 482 rightEdge - parent.curveIndent, |
487 1 + y); | 483 1 + y); |
488 | 484 |
489 int[] leftHighlightCurve = CTabFolder.TOP_LEFT_CORNER_HILITE; | 485 const int[] leftHighlightCurve = CTabFolder.TOP_LEFT_CORNER_HILITE; |
490 | 486 |
491 int d = parent.tabHeight - parent.topCurveHighlightEnd.length /2; | 487 int d = parent.tabHeight - parent.topCurveHighlightEnd.length /2; |
492 | 488 |
493 int lastX = 0; | 489 int lastX = 0; |
494 int lastY = 0; | 490 int lastY = 0; |
555 | 551 |
556 int[] shape = null; | 552 int[] shape = null; |
557 int startX = x + width - 1; | 553 int startX = x + width - 1; |
558 | 554 |
559 if (this.parent.onBottom) { | 555 if (this.parent.onBottom) { |
560 int[] right = parent.simple | 556 TryConst!(int[]) right = parent.simple |
561 ? CTabFolder.SIMPLE_UNSELECTED_INNER_CORNER | 557 ? CTabFolder.SIMPLE_UNSELECTED_INNER_CORNER |
562 : CTabFolder.BOTTOM_RIGHT_CORNER; | 558 : CTabFolder.BOTTOM_RIGHT_CORNER; |
563 | 559 |
564 shape = new int[right.length + 2]; | 560 shape = new int[right.length + 2]; |
565 int index = 0; | 561 int index = 0; |
569 shape[index++] = y + height + right[2 * i + 1] - 1; | 565 shape[index++] = y + height + right[2 * i + 1] - 1; |
570 } | 566 } |
571 shape[index++] = startX; | 567 shape[index++] = startX; |
572 shape[index++] = y - 1; | 568 shape[index++] = y - 1; |
573 } else { | 569 } else { |
574 int[] right = parent.simple | 570 TryConst!(int[]) right = parent.simple |
575 ? CTabFolder.SIMPLE_UNSELECTED_INNER_CORNER | 571 ? CTabFolder.SIMPLE_UNSELECTED_INNER_CORNER |
576 : CTabFolder.TOP_RIGHT_CORNER; | 572 : CTabFolder.TOP_RIGHT_CORNER; |
577 | 573 |
578 shape = new int[right.length + 2]; | 574 shape = new int[right.length + 2]; |
579 int index = 0; | 575 int index = 0; |
611 */ | 607 */ |
612 void drawLeftUnselectedBorder(GC gc) { | 608 void drawLeftUnselectedBorder(GC gc) { |
613 | 609 |
614 int[] shape = null; | 610 int[] shape = null; |
615 if (this.parent.onBottom) { | 611 if (this.parent.onBottom) { |
616 int[] left = parent.simple | 612 TryConst!(int[]) left = parent.simple |
617 ? CTabFolder.SIMPLE_UNSELECTED_INNER_CORNER | 613 ? CTabFolder.SIMPLE_UNSELECTED_INNER_CORNER |
618 : CTabFolder.BOTTOM_LEFT_CORNER; | 614 : CTabFolder.BOTTOM_LEFT_CORNER; |
619 | 615 |
620 shape = new int[left.length + 2]; | 616 shape = new int[left.length + 2]; |
621 int index = 0; | 617 int index = 0; |
624 for (int i = 0; i < left.length / 2; i++) { | 620 for (int i = 0; i < left.length / 2; i++) { |
625 shape[index++] = x + left[2 * i]; | 621 shape[index++] = x + left[2 * i]; |
626 shape[index++] = y + height + left[2 * i + 1] - 1; | 622 shape[index++] = y + height + left[2 * i + 1] - 1; |
627 } | 623 } |
628 } else { | 624 } else { |
629 int[] left = parent.simple | 625 TryConst!(int[]) left = parent.simple |
630 ? CTabFolder.SIMPLE_UNSELECTED_INNER_CORNER | 626 ? CTabFolder.SIMPLE_UNSELECTED_INNER_CORNER |
631 : CTabFolder.TOP_LEFT_CORNER; | 627 : CTabFolder.TOP_LEFT_CORNER; |
632 | 628 |
633 shape = new int[left.length + 2]; | 629 shape = new int[left.length + 2]; |
634 int index = 0; | 630 int index = 0; |