Changeset 194:b6bee07cfc0b

Show
Ignore:
Timestamp:
03/06/08 03:59:42 (6 months ago)
Author:
Frank Benoit <benoit@tionex.de>
branch:
default
Message:

Fix ==/!= to is/!is

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • dwt/graphics/Color.d

    r150 r194  
    125125    if (device.colorRefCount !is null) { 
    126126        /* If this was the last reference, remove the color from the list */ 
    127         if (--device.colorRefCount[pixel] == 0) { 
     127        if (--device.colorRefCount[pixel] is 0) { 
    128128            device.gdkColors[pixel] = null; 
    129129        } 
     
    150150    if ( auto color = cast(Color)object ){ 
    151151        GdkColor* gdkColor = color.handle; 
    152         if (handle == gdkColor) return true; 
    153         return device == color.device && handle.red == gdkColor.red && 
    154             handle.green == gdkColor.green && handle.blue == gdkColor.blue; 
     152        if (handle is gdkColor) return true; 
     153        return device is color.device && handle.red is gdkColor.red && 
     154            handle.green is gdkColor.green && handle.blue is gdkColor.blue; 
    155155    } 
    156156    return false; 
     
    269269    } 
    270270    handle = gdkColor; 
    271     if (device.colorRefCount != null) { 
     271    if (device.colorRefCount !is null) { 
    272272        /* Make a copy of the color to put in the colors array */ 
    273273        GdkColor* colorCopy = new GdkColor(); 
  • dwt/graphics/Cursor.d

    r150 r194  
    134134 */ 
    135135public this(Device device, int style) { 
    136     if (device == null) device = Device.getDevice(); 
    137     if (device == null) DWT.error(DWT.ERROR_NULL_ARGUMENT); 
     136    if (device is null) device = Device.getDevice(); 
     137    if (device is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); 
    138138    this.device = device; 
    139139    int shape = 0; 
     
    164164            DWT.error(DWT.ERROR_INVALID_ARGUMENT); 
    165165    } 
    166     if (shape == 0 && style == DWT.CURSOR_APPSTARTING) { 
     166    if (shape is 0 && style is DWT.CURSOR_APPSTARTING) { 
    167167        handle = createCursor(APPSTARTING_SRC, APPSTARTING_MASK, 32, 32, 2, 2, true); 
    168168    } else { 
     
    205205 */ 
    206206public this(Device device, ImageData source, ImageData mask, int hotspotX, int hotspotY) { 
    207     if (device == null) device = Device.getDevice(); 
    208     if (device == null) DWT.error(DWT.ERROR_NULL_ARGUMENT); 
     207    if (device is null) device = Device.getDevice(); 
     208    if (device is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); 
    209209    this.device = device; 
    210     if (source == null) DWT.error(DWT.ERROR_NULL_ARGUMENT); 
    211     if (mask == null) { 
    212         if (!(source.getTransparencyType() == DWT.TRANSPARENCY_MASK)) DWT.error(DWT.ERROR_NULL_ARGUMENT); 
     210    if (source is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); 
     211    if (mask is null) { 
     212        if (!(source.getTransparencyType() is DWT.TRANSPARENCY_MASK)) DWT.error(DWT.ERROR_NULL_ARGUMENT); 
    213213        mask = source.getTransparencyMask(); 
    214214    } 
    215215    /* Check the bounds. Mask must be the same size as source */ 
    216     if (mask.width != source.width || mask.height != source.height) { 
     216    if (mask.width !is source.width || mask.height !is source.height) { 
    217217        DWT.error(DWT.ERROR_INVALID_ARGUMENT); 
    218218    } 
     
    290290 */ 
    291291public this(Device device, ImageData source, int hotspotX, int hotspotY) { 
    292     if (device == null) device = Device.getDevice(); 
    293     if (device == null) DWT.error(DWT.ERROR_NULL_ARGUMENT); 
     292    if (device is null) device = Device.getDevice(); 
     293    if (device is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); 
    294294    this.device = device; 
    295     if (source == null) DWT.error(DWT.ERROR_NULL_ARGUMENT); 
     295    if (source is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); 
    296296    if (hotspotX >= source.width || hotspotX < 0 || 
    297297        hotspotY >= source.height || hotspotY < 0) { 
     
    308308        auto data = OS.gdk_pixbuf_get_pixels(pixbuf); 
    309309        byte[] buffer = source.data; 
    310         if (!palette.isDirect || source.depth != 24 || stride != source.bytesPerLine || palette.redMask != 0xFF000000 || palette.greenMask != 0xFF0000 || palette.blueMask != 0xFF00) { 
     310        if (!palette.isDirect || source.depth !is 24 || stride !is source.bytesPerLine || palette.redMask !is 0xFF000000 || palette.greenMask !is 0xFF0000 || palette.blueMask !is 0xFF00) { 
    311311            buffer = new byte[source.width * source.height * 4]; 
    312312            if (palette.isDirect) { 
     
    324324                for (int i = 0; i < rgbs.length; i++) { 
    325325                    RGB rgb = rgbs[i]; 
    326                     if (rgb == null) continue; 
     326                    if (rgb is null) continue; 
    327327                    srcReds[i] = cast(byte)rgb.red; 
    328328                    srcGreens[i] = cast(byte)rgb.green; 
     
    335335                    false, false); 
    336336            } 
    337             if (source.maskData != null || source.transparentPixel != -1) { 
     337            if (source.maskData !is null || source.transparentPixel !is -1) { 
    338338                ImageData mask = source.getTransparencyMask(); 
    339339                byte[] maskData = mask.data; 
     
    342342                for (int y = 0; y<source.height; y++) { 
    343343                    for (int x = 0; x<source.width; x++) { 
    344                         buffer[offset] = ((maskData[maskOffset + (x >> 3)]) & (1 << (7 - (x & 0x7)))) != 0 ? cast(byte)0xff : 0; 
     344                        buffer[offset] = ((maskData[maskOffset + (x >> 3)]) & (1 << (7 - (x & 0x7)))) !is 0 ? cast(byte)0xff : 0; 
    345345                        offset += 4; 
    346346                    } 
    347347                    maskOffset += maskBpl; 
    348348                } 
    349             } else if (source.alpha != -1) { 
     349            } else if (source.alpha !is -1) { 
    350350                byte alpha = cast(byte)source.alpha; 
    351351                for (int i=3; i<buffer.length; i+=4) { 
    352352                    buffer[i] = alpha; 
    353353                } 
    354             } else if (source.alphaData != null) { 
     354            } else if (source.alphaData !is null) { 
    355355                byte[] alphaData = source.alphaData; 
    356356                for (int i=3; i<buffer.length; i+=4) { 
     
    391391                for (int i = 0; i < rgbs.length; i++) { 
    392392                    RGB rgb = rgbs[i]; 
    393                     if (rgb == null) continue; 
     393                    if (rgb is null) continue; 
    394394                    srcReds[i] = cast(byte)rgb.red; 
    395395                    srcGreens[i] = cast(byte)rgb.green; 
     
    504504 */ 
    505505public static Cursor gtk_new(Device device, GdkCursor* handle) { 
    506     if (device == null) device = Device.getDevice(); 
     506    if (device is null) device = Device.getDevice(); 
    507507    Cursor cursor = new Cursor(); 
    508508    cursor.handle = handle; 
  • dwt/graphics/FontData.d

    r150 r194  
    128128    int start = 0; 
    129129    int end = locate( str, '|' ); 
    130     if (end == str.length ) DWT.error(DWT.ERROR_INVALID_ARGUMENT); 
     130    if (end is str.length ) DWT.error(DWT.ERROR_INVALID_ARGUMENT); 
    131131    char[] version1 = str[ start .. end ]; 
    132132    try { 
    133         if (to!(int)(version1) != 1) DWT.error(DWT.ERROR_INVALID_ARGUMENT); 
     133        if (to!(int)(version1) !is 1) DWT.error(DWT.ERROR_INVALID_ARGUMENT); 
    134134    } catch (ConversionException e) { 
    135135        DWT.error(DWT.ERROR_INVALID_ARGUMENT); 
     
    138138    start = end + 1; 
    139139    end = locate( str, '|', start ); 
    140     if (end == str.length ) DWT.error(DWT.ERROR_INVALID_ARGUMENT); 
     140    if (end is str.length ) DWT.error(DWT.ERROR_INVALID_ARGUMENT); 
    141141    char[] name = str[start .. end ]; 
    142142 
    143143    start = end + 1; 
    144144    end = locate( str, '|', start ); 
    145     if (end == str.length ) DWT.error(DWT.ERROR_INVALID_ARGUMENT); 
     145    if (end is str.length ) DWT.error(DWT.ERROR_INVALID_ARGUMENT); 
    146146    float height = 0; 
    147147    try { 
     
    153153    start = end + 1; 
    154154    end = locate( str, '|', start ); 
    155     if (end == str.length ) DWT.error(DWT.ERROR_INVALID_ARGUMENT); 
     155    if (end is str.length ) DWT.error(DWT.ERROR_INVALID_ARGUMENT); 
    156156    int style = 0; 
    157157    try { 
     
    166166    setHeight(height); 
    167167    setStyle(style); 
    168     if (end == str.length) return; 
     168    if (end is str.length) return; 
    169169    char[] platform = str[ start .. end ]; 
    170170 
    171171    start = end + 1; 
    172172    end = locate( str, '|', start ); 
    173     if (end == str.length) return; 
     173    if (end is str.length) return; 
    174174    char[] version2 = str[ start .. end ]; 
    175175 
    176     if (platform == "GTK" && version2 == "1" ) { 
     176    if (platform.equals("GTK") && version2.equals("1")) { 
    177177        return; 
    178178    } 
     
    218218    if (object is this) return true; 
    219219    if( auto data = cast(FontData)object ){ 
    220         return name == data.name && height == data.height && style == data.style; 
     220        return name.equals(data.name) && height is data.height && style is data.style; 
    221221    } 
    222222    return false; 
     
    258258    char[] result; 
    259259    const char sep = '_'; 
    260     if (lang != null) { 
     260    if (lang !is null) { 
    261261        result ~= lang; 
    262262        result ~= sep; 
    263263    } 
    264     if (country != null) { 
     264    if (country !is null) { 
    265265        result ~= country; 
    266266        result ~= sep; 
    267267    } 
    268     if (variant != null) { 
     268    if (variant !is null) { 
    269269        result ~= variant; 
    270270    } 
    271271 
    272272    if (result) { 
    273         if (result[$-1] == sep) { 
     273        if (result[$-1] is sep) { 
    274274            result = result[0 .. $ - 1]; 
    275275        } 
     
    368368 
    369369        firstSep = locate( locale, sep ); 
    370         if (firstSep == locale.length) { 
     370        if (firstSep is locale.length) { 
    371371            firstSep = secondSep = length; 
    372372        } else { 
    373373            secondSep = locate( locale, sep, firstSep + 1); 
    374             if (secondSep == locale.length) secondSep = length; 
     374            if (secondSep is locale.length) secondSep = length; 
    375375        } 
    376376        if (firstSep > 0) lang = locale[0 .. firstSep]; 
  • dwt/graphics/FontMetrics.d

    r150 r194  
    4242    if (object is this) return true; 
    4343    if( auto metrics = cast(FontMetrics)object ){ 
    44         return ascent == metrics.ascent && descent == metrics.descent && 
    45             averageCharWidth == metrics.averageCharWidth && leading == metrics.leading && 
    46             height == metrics.height; 
     44        return ascent is metrics.ascent && descent is metrics.descent && 
     45            averageCharWidth is metrics.averageCharWidth && leading is metrics.leading && 
     46            height is metrics.height; 
    4747    } 
    4848    return false; 
  • dwt/graphics/GC.d

    r150 r194  
    18191819        toRGB   = foregroundRGB; 
    18201820    } 
    1821     if (fromRGB ==/*eq*/ toRGB ) { 
     1821    if (fromRGB.opEquals(toRGB)) { 
    18221822        fillRectangle(x, y, width, height); 
    18231823        return; 
  • dwt/graphics/GlyphMetrics.d

    r72 r194  
    8181    if (object is this) return true; 
    8282    if (auto metrics = cast(GlyphMetrics)object ){ 
    83        return metrics.ascent == ascent && metrics.descent == descent && metrics.width == width; 
     83       return metrics.ascent is ascent && metrics.descent is descent && metrics.width is width; 
    8484    } 
    8585    return false; 
  • dwt/graphics/Path.d

    r150 r194  
    126126    if (isDisposed()) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED); 
    127127    moved = true; 
    128     if (width == height) { 
     128    if (width is height) { 
    129129        float angle = -startAngle * cast(float)Compatibility.PI / 180; 
    130130        if (closed) Cairo.cairo_move_to(handle, (x + width / 2f) + width / 2f * Math.cos(angle), (y + height / 2f) + height / 2f * Math.sin(angle)); 
     
    214214public void addString(char[] str, float x, float y, Font font) { 
    215215    if (isDisposed()) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED); 
    216     if (font == null) DWT.error(DWT.ERROR_NULL_ARGUMENT); 
     216    if (font is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); 
    217217    if (font.isDisposed()) DWT.error(DWT.ERROR_INVALID_ARGUMENT); 
    218218    moved = false; 
     
    262262public bool contains(float x, float y, GC gc, bool outline) { 
    263263    if (isDisposed()) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED); 
    264     if (gc == null) DWT.error(DWT.ERROR_NULL_ARGUMENT); 
     264    if (gc is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); 
    265265    if (gc.isDisposed()) DWT.error(DWT.ERROR_INVALID_ARGUMENT); 
    266266    //TODO - see Windows 
     
    274274    Cairo.cairo_path_destroy(copy); 
    275275    if (outline) { 
    276         result = Cairo.cairo_in_stroke(cairo, x, y) != 0; 
     276        result = Cairo.cairo_in_stroke(cairo, x, y) !is 0; 
    277277    } else { 
    278         result = Cairo.cairo_in_fill(cairo, x, y) != 0; 
     278        result = Cairo.cairo_in_fill(cairo, x, y) !is 0; 
    279279    } 
    280280    Cairo.cairo_new_path(cairo); 
     
    325325public void getBounds(float[] bounds) { 
    326326    if (isDisposed()) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED); 
    327     if (bounds == null) DWT.error(DWT.ERROR_NULL_ARGUMENT); 
     327    if (bounds is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); 
    328328    if (bounds.length < 4) DWT.error(DWT.ERROR_INVALID_ARGUMENT); 
    329329    auto copy = Cairo.cairo_copy_path(handle); 
     
    395395public void getCurrentPoint(float[] point) { 
    396396    if (isDisposed()) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED); 
    397     if (point == null) DWT.error(DWT.ERROR_NULL_ARGUMENT); 
     397    if (point is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); 
    398398    if (point.length < 2) DWT.error(DWT.ERROR_INVALID_ARGUMENT); 
    399399    double x, y; 
     
    456456        } 
    457457    } 
    458     if (typeIndex != types.length) { 
     458    if (typeIndex !is types.length) { 
    459459        byte[] newTypes = new byte[typeIndex]; 
    460460        System.arraycopy(types, 0, newTypes, 0, typeIndex); 
    461461        types = newTypes; 
    462462    } 
    463     if (ptsIndex != pts.length) { 
     463    if (ptsIndex !is pts.length) { 
    464464        float[] newPts = new float[ptsIndex]; 
    465465        System.arraycopy(pts, 0, newPts, 0, ptsIndex); 
  • dwt/graphics/Transform.d

    r150 r194  
    145145 
    146146static float[] checkTransform(float[] elements) { 
    147     if (elements == null) DWT.error(DWT.ERROR_NULL_ARGUMENT); 
     147    if (elements is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); 
    148148    if (elements.length < 6) DWT.error(DWT.ERROR_INVALID_ARGUMENT); 
    149149    return elements; 
     
    200200public void invert() { 
    201201    if (isDisposed()) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED); 
    202     if (Cairo.cairo_matrix_invert(cast(cairo_matrix_t*)handle.ptr) != 0) { 
     202    if (Cairo.cairo_matrix_invert(cast(cairo_matrix_t*)handle.ptr) !is 0) { 
    203203        DWT.error(DWT.ERROR_CANNOT_INVERT_MATRIX); 
    204204    } 
     
    229229    float[] m  = new float[6]; 
    230230    getElements(m); 
    231     return m[0] == 1 && m[1] == 0 && m[2] == 0 && m[3] == 1 && m[4] == 0 && m[5] == 0; 
     231    return m[0] is 1 && m[1] is 0 && m[2] is 0 && m[3] is 1 && m[4] is 0 && m[5] is 0; 
    232232} 
    233233 
     
    249249public void multiply(Transform matrix) { 
    250250    if (isDisposed()) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED); 
    251     if (matrix == null) DWT.error(DWT.ERROR_NULL_ARGUMENT); 
     251    if (matrix is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); 
    252252    if (matrix.isDisposed()) DWT.error(DWT.ERROR_INVALID_ARGUMENT); 
    253253    Cairo.cairo_matrix_multiply(cast(cairo_matrix_t*)handle.ptr,cast(cairo_matrix_t*)matrix.handle.ptr, cast(cairo_matrix_t*)handle.ptr); 
     
    324324public void transform(float[] pointArray) { 
    325325    if (isDisposed()) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED); 
    326     if (pointArray == null) DWT.error(DWT.ERROR_NULL_ARGUMENT); 
     326    if (pointArray is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); 
    327327    double dx, dy; 
    328328    int length = pointArray.length / 2;