Note: This website is archived. For up-to-date information about D projects and development, please visit wiki.dlang.org.

Changeset 204:8ab2f71515ba

Show
Ignore:
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
  • dwt/custom/CTabFolder.d

    r182 r204  
    527527 * @see #removeSelectionListener 
    528528 * @see SelectionEvent 
    529529 */ 
    530530public void addSelectionListener(SelectionListener listener) { 
    531531    checkWidget(); 
    532532    if (listener is null) { 
    533533        DWT.error(DWT.ERROR_NULL_ARGUMENT); 
    534534    } 
    535535    TypedListener typedListener = new TypedListener(listener); 
    536536    addListener(DWT.Selection, typedListener); 
    537537    addListener(DWT.DefaultSelection, typedListener); 
    538538} 
    539539void antialias (int[] shape, RGB lineRGB, RGB innerRGB, RGB outerRGB, GC gc){ 
    540540    // Don't perform anti-aliasing on Mac and WPF because the platform 
    541541    // 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$ 
    543543    // Don't perform anti-aliasing on low resolution displays 
    544544    if (getDisplay().getDepth() < 15) return; 
    545545    if (outerRGB !is null) { 
    546546        int index = 0; 
    547547        bool left = true; 
    548548        int oldY = onBottom ? 0 : getSize().y; 
    549549        int[] outer = new int[shape.length]; 
    550550        for (int i = 0; i < shape.length/2; i++) { 
    551551            if (left && (index + 3 < shape.length)) { 
    552552                left = onBottom ? oldY <= shape[index+3] : oldY >= shape[index+3]; 
    553553                oldY = shape[index+1]; 
    554554            } 
    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++; 
    557559        } 
    558560        RGB from = lineRGB; 
    559561        RGB to = outerRGB; 
    560562        int red = from.red + 2*(to.red - from.red)/3; 
    561563        int green = from.green + 2*(to.green - from.green)/3; 
    562564        int blue = from.blue + 2*(to.blue - from.blue)/3; 
    563565        Color color = new Color(getDisplay(), red, green, blue); 
    564566        gc.setForeground(color); 
    565567        gc.drawPolyline(outer); 
    566568        color.dispose(); 
    567569    } 
    568570    if (innerRGB !is null) { 
    569571        int[] inner = new int[shape.length]; 
    570572        int index = 0; 
    571573        bool left = true; 
    572574        int oldY = onBottom ? 0 : getSize().y; 
    573575        for (int i = 0; i < shape.length/2; i++) { 
    574576            if (left && (index + 3 < shape.length)) { 
    575577                left = onBottom ? oldY <= shape[index+3] : oldY >= shape[index+3]; 
    576578                oldY = shape[index+1]; 
    577579            } 
    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++; 
    580584        } 
    581585        RGB from = lineRGB; 
    582586        RGB to = innerRGB; 
    583587        int red = from.red + 2*(to.red - from.red)/3; 
    584588        int green = from.green + 2*(to.green - from.green)/3; 
    585589        int blue = from.blue + 2*(to.blue - from.blue)/3; 
    586590        Color color = new Color(getDisplay(), red, green, blue); 
    587591        gc.setForeground(color); 
    588592        gc.drawPolyline(inner); 
    589593        color.dispose(); 
    590594    } 
    591595} 
    592596public override Rectangle computeTrim (int x, int y, int width, int height) { 
    593597    checkWidget(); 
    594598    int trimX = x - marginWidth - highlight_margin - borderLeft; 
     
    13041308    do { 
    13051309        while (index < length_ && string[index] !is '&') index++; 
    13061310        if (++index >= length_) return '\0'; 
    13071311        if (string[index] !is '&') return CharacterFirstToLower(string[index..$]); 
    13081312        index++; 
    13091313    } while (index < length_); 
    13101314    return '\0'; 
    13111315} 
    13121316char[] stripMnemonic (char[] string) { 
    13131317    int index = 0; 
    13141318    int length_ = string.length; 
    13151319    do { 
    13161320        while ((index < length_) && (string[index] !is '&')) index++; 
    13171321        if (++index >= length_) return string; 
    13181322        if (string[index] !is '&') { 
    1319             return string[0 .. index-1] ~ string[index .. length_]
     1323            return string.substring(0, index-1) ~ string.substring(index, length_)
    13201324        } 
    13211325        index++; 
    13221326    } while (index < length_); 
    13231327    return string; 
    13241328} 
    13251329/** 
    13261330 * Returns <code>true</code> if the receiver is minimized. 
    13271331 * 
    13281332 * @return the receiver's minimized state 
    13291333 * 
    13301334 * @exception DWTException <ul> 
    13311335 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> 
    13321336 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> 
    13331337 * </ul> 
    13341338 *