Changeset 204:8ab2f71515ba
- Timestamp:
- 03/08/08 15:33:54
(17 years ago)
- Author:
- Frank Benoit <benoit@tionex.de>
- branch:
- default
- Message:
Fix: strange lines in CTabFolder, index bug because of evaluation order
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r182 |
r204 |
|
| 527 | 527 | * @see #removeSelectionListener |
|---|
| 528 | 528 | * @see SelectionEvent |
|---|
| 529 | 529 | */ |
|---|
| 530 | 530 | public void addSelectionListener(SelectionListener listener) { |
|---|
| 531 | 531 | checkWidget(); |
|---|
| 532 | 532 | if (listener is null) { |
|---|
| 533 | 533 | DWT.error(DWT.ERROR_NULL_ARGUMENT); |
|---|
| 534 | 534 | } |
|---|
| 535 | 535 | TypedListener typedListener = new TypedListener(listener); |
|---|
| 536 | 536 | addListener(DWT.Selection, typedListener); |
|---|
| 537 | 537 | addListener(DWT.DefaultSelection, typedListener); |
|---|
| 538 | 538 | } |
|---|
| 539 | 539 | void antialias (int[] shape, RGB lineRGB, RGB innerRGB, RGB outerRGB, GC gc){ |
|---|
| 540 | 540 | // Don't perform anti-aliasing on Mac and WPF because the platform |
|---|
| 541 | 541 | // already does it. The simple style also does not require anti-aliasing. |
|---|
| 542 | | if (simple || "carbon"==DWT.getPlatform() || "wpf"==DWT.getPlatform()) return; //$NON-NLS-1$ |
|---|
| | 542 | if (simple || "carbon".equals(DWT.getPlatform()) || "wpf".equals(DWT.getPlatform())) return; //$NON-NLS-1$ |
|---|
| 543 | 543 | // Don't perform anti-aliasing on low resolution displays |
|---|
| 544 | 544 | if (getDisplay().getDepth() < 15) return; |
|---|
| 545 | 545 | if (outerRGB !is null) { |
|---|
| 546 | 546 | int index = 0; |
|---|
| 547 | 547 | bool left = true; |
|---|
| 548 | 548 | int oldY = onBottom ? 0 : getSize().y; |
|---|
| 549 | 549 | int[] outer = new int[shape.length]; |
|---|
| 550 | 550 | for (int i = 0; i < shape.length/2; i++) { |
|---|
| 551 | 551 | if (left && (index + 3 < shape.length)) { |
|---|
| 552 | 552 | left = onBottom ? oldY <= shape[index+3] : oldY >= shape[index+3]; |
|---|
| 553 | 553 | oldY = shape[index+1]; |
|---|
| 554 | 554 | } |
|---|
| 555 | | outer[index] = shape[index++] + (left ? -1 : +1); |
|---|
| 556 | | outer[index] = shape[index++]; |
|---|
| | 555 | outer[index] = shape[index] + (left ? -1 : +1); |
|---|
| | 556 | index++; |
|---|
| | 557 | outer[index] = shape[index]; |
|---|
| | 558 | index++; |
|---|
| 557 | 559 | } |
|---|
| 558 | 560 | RGB from = lineRGB; |
|---|
| 559 | 561 | RGB to = outerRGB; |
|---|
| 560 | 562 | int red = from.red + 2*(to.red - from.red)/3; |
|---|
| 561 | 563 | int green = from.green + 2*(to.green - from.green)/3; |
|---|
| 562 | 564 | int blue = from.blue + 2*(to.blue - from.blue)/3; |
|---|
| 563 | 565 | Color color = new Color(getDisplay(), red, green, blue); |
|---|
| 564 | 566 | gc.setForeground(color); |
|---|
| 565 | 567 | gc.drawPolyline(outer); |
|---|
| 566 | 568 | color.dispose(); |
|---|
| 567 | 569 | } |
|---|
| 568 | 570 | if (innerRGB !is null) { |
|---|
| 569 | 571 | int[] inner = new int[shape.length]; |
|---|
| 570 | 572 | int index = 0; |
|---|
| 571 | 573 | bool left = true; |
|---|
| 572 | 574 | int oldY = onBottom ? 0 : getSize().y; |
|---|
| 573 | 575 | for (int i = 0; i < shape.length/2; i++) { |
|---|
| 574 | 576 | if (left && (index + 3 < shape.length)) { |
|---|
| 575 | 577 | left = onBottom ? oldY <= shape[index+3] : oldY >= shape[index+3]; |
|---|
| 576 | 578 | oldY = shape[index+1]; |
|---|
| 577 | 579 | } |
|---|
| 578 | | inner[index] = shape[index++] + (left ? +1 : -1); |
|---|
| 579 | | inner[index] = shape[index++]; |
|---|
| | 580 | inner[index] = shape[index] + (left ? +1 : -1); |
|---|
| | 581 | index++; |
|---|
| | 582 | inner[index] = shape[index]; |
|---|
| | 583 | index++; |
|---|
| 580 | 584 | } |
|---|
| 581 | 585 | RGB from = lineRGB; |
|---|
| 582 | 586 | RGB to = innerRGB; |
|---|
| 583 | 587 | int red = from.red + 2*(to.red - from.red)/3; |
|---|
| 584 | 588 | int green = from.green + 2*(to.green - from.green)/3; |
|---|
| 585 | 589 | int blue = from.blue + 2*(to.blue - from.blue)/3; |
|---|
| 586 | 590 | Color color = new Color(getDisplay(), red, green, blue); |
|---|
| 587 | 591 | gc.setForeground(color); |
|---|
| 588 | 592 | gc.drawPolyline(inner); |
|---|
| 589 | 593 | color.dispose(); |
|---|
| 590 | 594 | } |
|---|
| 591 | 595 | } |
|---|
| 592 | 596 | public override Rectangle computeTrim (int x, int y, int width, int height) { |
|---|
| 593 | 597 | checkWidget(); |
|---|
| 594 | 598 | int trimX = x - marginWidth - highlight_margin - borderLeft; |
|---|
| … | … | |
| 1304 | 1308 | do { |
|---|
| 1305 | 1309 | while (index < length_ && string[index] !is '&') index++; |
|---|
| 1306 | 1310 | if (++index >= length_) return '\0'; |
|---|
| 1307 | 1311 | if (string[index] !is '&') return CharacterFirstToLower(string[index..$]); |
|---|
| 1308 | 1312 | index++; |
|---|
| 1309 | 1313 | } while (index < length_); |
|---|
| 1310 | 1314 | return '\0'; |
|---|
| 1311 | 1315 | } |
|---|
| 1312 | 1316 | char[] stripMnemonic (char[] string) { |
|---|
| 1313 | 1317 | int index = 0; |
|---|
| 1314 | 1318 | int length_ = string.length; |
|---|
| 1315 | 1319 | do { |
|---|
| 1316 | 1320 | while ((index < length_) && (string[index] !is '&')) index++; |
|---|
| 1317 | 1321 | if (++index >= length_) return string; |
|---|
| 1318 | 1322 | if (string[index] !is '&') { |
|---|
| 1319 | | return string[0 .. index-1] ~ string[index .. length_]; |
|---|
| | 1323 | return string.substring(0, index-1) ~ string.substring(index, length_); |
|---|
| 1320 | 1324 | } |
|---|
| 1321 | 1325 | index++; |
|---|
| 1322 | 1326 | } while (index < length_); |
|---|
| 1323 | 1327 | return string; |
|---|
| 1324 | 1328 | } |
|---|
| 1325 | 1329 | /** |
|---|
| 1326 | 1330 | * Returns <code>true</code> if the receiver is minimized. |
|---|
| 1327 | 1331 | * |
|---|
| 1328 | 1332 | * @return the receiver's minimized state |
|---|
| 1329 | 1333 | * |
|---|
| 1330 | 1334 | * @exception DWTException <ul> |
|---|
| 1331 | 1335 | * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> |
|---|
| 1332 | 1336 | * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> |
|---|
| 1333 | 1337 | * </ul> |
|---|
| 1334 | 1338 | * |
|---|