Mercurial > projects > dwt-linux
changeset 158:de2578a843a7
Tango update to rev 3158, TracedException>Exception, fromUtf8z>fromStringz,Fix Bug in MenuItem Thanx to nascent for the report.
line wrap: on
line diff
--- a/README Sat Feb 09 21:22:47 2008 +0100 +++ b/README Sun Feb 10 04:19:19 2008 +0100 @@ -3,6 +3,7 @@ Compiler : DMD 1.025 Runtime : Tango SVN trunk rev. 3071 DSSS : 0.73 +Tango : svn rev 3158 Note: DSSS has by default the feature active to compile one file a time. For DWT this make compilation _very_ slow (> 10 min).
--- a/dsss.conf Sat Feb 09 21:22:47 2008 +0100 +++ b/dsss.conf Sun Feb 10 04:19:19 2008 +0100 @@ -1,3 +1,4 @@ [dwt] type=library +buildflags+=-g -gc -debug
--- a/dwt/DWT.d Sat Feb 09 21:22:47 2008 +0100 +++ b/dwt/DWT.d Sun Feb 10 04:19:19 2008 +0100 @@ -3539,7 +3539,7 @@ * @see DWTException * @see IllegalArgumentException */ -public static void error (int code, TracedException throwable) { +public static void error (int code, Exception throwable) { error (code, throwable, null); } @@ -3571,7 +3571,7 @@ * * @since 3.0 */ -public static void error (int code, TracedException throwable, char[] detail) { +public static void error (int code, Exception throwable, char[] detail) { /* * This code prevents the creation of "chains" of SWTErrors and
--- a/dwt/DWTError.d Sat Feb 09 21:22:47 2008 +0100 +++ b/dwt/DWTError.d Sun Feb 10 04:19:19 2008 +0100 @@ -53,7 +53,7 @@ * The underlying throwable that caused the problem, * or null if this information is not available. */ - public TracedException throwable; + public Exception throwable; //static final long serialVersionUID = 3833467327105808433L; @@ -142,12 +142,12 @@ */ public void printStackTrace () { Stderr.formatln( "stacktrace follows (if feature compiled in)" ); - foreach( msg; this ){ + foreach( msg; info ){ Stderr.formatln( "{}", msg ); } if ( throwable !is null) { Stderr.formatln ("*** Stack trace of contained error ***"); //$NON-NLS-1$ - foreach( msg; throwable ){ + foreach( msg; throwable.info ){ Stderr.formatln( "{}", msg ); } }
--- a/dwt/DWTException.d Sat Feb 09 21:22:47 2008 +0100 +++ b/dwt/DWTException.d Sun Feb 10 04:19:19 2008 +0100 @@ -34,7 +34,7 @@ * @see DWTError */ -public class DWTException : TracedException { +public class DWTException : Exception { /** * The DWT error code, one of DWT.ERROR_*. */ @@ -44,7 +44,7 @@ * The underlying throwable that caused the problem, * or null if this information is not available. */ - public TracedException throwable; + public Exception throwable; //static final long serialVersionUID = 3257282552304842547L; @@ -105,7 +105,7 @@ * * @since 3.1 */ -public TracedException getCause() { +public Exception getCause() { return throwable; } @@ -132,12 +132,12 @@ */ public void printStackTrace () { Stderr.formatln( "stacktrace follows (if feature compiled in)" ); - foreach( msg; this ){ + foreach( msg; info ){ Stderr.formatln( "{}", msg ); } if ( throwable !is null) { Stderr.formatln ("*** Stack trace of contained exception ***"); //$NON-NLS-1$ - foreach( msg; throwable ){ + foreach( msg; throwable.info ){ Stderr.formatln( "{}", msg ); } }
--- a/dwt/accessibility/AccessibleFactory.d Sat Feb 09 21:22:47 2008 +0100 +++ b/dwt/accessibility/AccessibleFactory.d Sun Feb 10 04:19:19 2008 +0100 @@ -96,7 +96,7 @@ private this (int /*long*/ widgetType) { widgetTypeName = OS.g_type_name (widgetType); - char[] factoryName = FACTORY_TYPENAME ~ fromUtf8z( widgetTypeName ) ~ \0; + char[] factoryName = FACTORY_TYPENAME ~ fromStringz( widgetTypeName ) ~ \0; if (OS.g_type_from_name (factoryName.ptr) is 0) { /* register the factory */ auto registry = ATK.atk_get_default_registry (); @@ -138,7 +138,7 @@ if (accessible.accessibleObject !is null) { return accessible.accessibleObject.handle; } - char[] buffer = fromUtf8z( widgetTypeName ).dup; + char[] buffer = fromStringz( widgetTypeName ).dup; auto type = getType (buffer, accessible, objectParentType, ACC.CHILDID_SELF); AccessibleObject object = new AccessibleObject (type, cast(GtkWidget*)widget, accessible, objectParentType, false); accessible.accessibleObject = object;
--- a/dwt/accessibility/AccessibleObject.d Sat Feb 09 21:22:47 2008 +0100 +++ b/dwt/accessibility/AccessibleObject.d Sun Feb 10 04:19:19 2008 +0100 @@ -101,7 +101,7 @@ AccessibleEvent event = new AccessibleEvent (object); event.childID = object.id; if (parentResult !is null) { - char[] res = fromUtf8z( parentResult ); + char[] res = fromStringz( parentResult ); event.result = res.dup; } for (int i = 0; i < listeners.length; i++) { @@ -133,7 +133,7 @@ AccessibleControlEvent event = new AccessibleControlEvent (object); event.childID = object.id; if (parentResult !is null) { - char[] res = fromUtf8z( parentResult ); + char[] res = fromStringz( parentResult ); event.result = res.dup; } for (int i = 0; i < listeners.length; i++) { @@ -359,7 +359,7 @@ AccessibleEvent event = new AccessibleEvent (object); event.childID = object.id; if (parentResult !is null) { - event.result = fromUtf8z( parentResult ).dup; + event.result = fromStringz( parentResult ).dup; } for (int i = 0; i < listeners.length; i++) { listeners [i].getDescription (event); @@ -387,7 +387,7 @@ AccessibleEvent event = new AccessibleEvent (object); event.childID = object.id; if (parentResult !is null) { - event.result = fromUtf8z( parentResult ).dup; + event.result = fromStringz( parentResult ).dup; } for (int i = 0; i < listeners.length; i++) { listeners [i].getName (event); @@ -1204,7 +1204,7 @@ if (characterCount > 0 && textIface.get_text !is null) { parentResult = textIface.get_text( handle, 0, characterCount); if (parentResult !is null) { - parentText = fromUtf8z( parentResult ).dup; + parentText = fromStringz( parentResult ).dup; } } }
--- a/dwt/dnd/Clipboard.d Sat Feb 09 21:22:47 2008 +0100 +++ b/dwt/dnd/Clipboard.d Sun Feb 10 04:19:19 2008 +0100 @@ -563,7 +563,7 @@ if (pName is null) { continue; } - char[] buffer = tango.stdc.stringz.fromUtf8z( pName ).dup; + char[] buffer = tango.stdc.stringz.fromStringz( pName ).dup; OS.g_free (pName); result[count++] = "GTKCLIPBOARD "~buffer; } @@ -572,7 +572,7 @@ if (pName is null) { continue; } - char[] buffer = tango.stdc.stringz.fromUtf8z( pName ).dup; + char[] buffer = tango.stdc.stringz.fromStringz( pName ).dup; OS.g_free (pName); result[count++] = "GTKPRIMARYCLIPBOARD "~buffer; }
--- a/dwt/dnd/FileTransfer.d Sat Feb 09 21:22:47 2008 +0100 +++ b/dwt/dnd/FileTransfer.d Sun Feb 10 04:19:19 2008 +0100 @@ -89,7 +89,7 @@ auto uriPtr = OS.g_filename_to_uri(localePtr, null, &error); OS.g_free(localePtr); if (error !is null || uriPtr is null) continue; - char[] temp = tango.stdc.stringz.fromUtf8z( uriPtr ).dup; + char[] temp = tango.stdc.stringz.fromStringz( uriPtr ).dup; OS.g_free(uriPtr); int newLength = (i > 0) ? buffer.length+separator.length+temp.length : temp.length; char[] newBuffer = new char[newLength]; @@ -162,7 +162,7 @@ auto utf8Ptr = OS.g_locale_to_utf8(localePtr, -1, null, null, &error); OS.g_free(localePtr); if (error !is null || utf8Ptr is null) continue; - char[] buffer = tango.stdc.stringz.fromUtf8z( utf8Ptr ).dup; + char[] buffer = tango.stdc.stringz.fromStringz( utf8Ptr ).dup; OS.g_free(utf8Ptr); char[] name = buffer; char[][] newFileNames = new char[][]( fileNames.length + 1 );
--- a/dwt/dnd/TextTransfer.d Sat Feb 09 21:22:47 2008 +0100 +++ b/dwt/dnd/TextTransfer.d Sun Feb 10 04:19:19 2008 +0100 @@ -130,7 +130,7 @@ char** list; int count = OS.gdk_text_property_to_utf8_list(transferData.type, transferData.format, transferData.pValue, transferData.length, &list); if (count is 0) return null; - char[] utf8 = tango.stdc.stringz.fromUtf8z( list[0] ).dup; + char[] utf8 = tango.stdc.stringz.fromStringz( list[0] ).dup; OS.g_strfreev(list); return new ArrayWrapperString( utf8 ); }
--- a/dwt/dwthelper/Integer.d Sat Feb 09 21:22:47 2008 +0100 +++ b/dwt/dwthelper/Integer.d Sun Feb 10 04:19:19 2008 +0100 @@ -1,4 +1,4 @@ -/** +/** * Authors: Frank Benoit <keinfarbton@googlemail.com> */ @@ -7,7 +7,22 @@ import dwt.dwthelper.utils; static import tango.text.convert.Integer; +private import tango.core.Exception; +public final class Byte { + public static byte parseByte( char[] s ){ + try{ + int res = tango.text.convert.Integer.parse( s ); + if( res < byte.min || res > byte.max ){ + throw new NumberFormatException( "out of range" ); + } + return res; + } + catch( IllegalArgumentException e ){ + throw new NumberFormatException( e ); + } + } +} public final class Integer { public static int MIN_VALUE = 0x80000000; @@ -55,11 +70,21 @@ } public static int parseInt( char[] s, int radix ){ - return tango.text.convert.Integer.parse( s, cast(uint)radix ); + try{ + return tango.text.convert.Integer.parse( s, cast(uint)radix ); + } + catch( IllegalArgumentException e ){ + throw new NumberFormatException( e ); + } } public static int parseInt( char[] s ){ - return tango.text.convert.Integer.parse( s ); + try{ + return tango.text.convert.Integer.parse( s ); + } + catch( IllegalArgumentException e ){ + throw new NumberFormatException( e ); + } } public static Integer valueOf( char[] s, int radix ){
--- a/dwt/dwthelper/System.d Sat Feb 09 21:22:47 2008 +0100 +++ b/dwt/dwthelper/System.d Sun Feb 10 04:19:19 2008 +0100 @@ -5,6 +5,7 @@ import tango.core.Exception; import tango.time.Clock; +import tango.stdc.stdlib : exit; template SimpleType(T) { debug{ @@ -124,5 +125,9 @@ return Clock.now().ticks() / 10000; } + static void exit( int code ){ + .exit(code); + } + }
--- a/dwt/dwthelper/utils.d Sat Feb 09 21:22:47 2008 +0100 +++ b/dwt/dwthelper/utils.d Sun Feb 10 04:19:19 2008 +0100 @@ -4,9 +4,14 @@ module dwt.dwthelper.utils; public import dwt.dwthelper.System; +public import Math = tango.math.Math; import tango.io.Stdout; +import tango.stdc.stringz; +static import tango.text.Util; import tango.text.Unicode; +import tango.text.convert.Utf; +import tango.core.Exception; import tango.stdc.stdlib : exit; void implMissing( char[] file, uint line ){ @@ -17,6 +22,8 @@ abstract class ArrayWrapper{ } +abstract class ValueWrapper{ +} class ArrayWrapperT(T) : ArrayWrapper { public T[] array; @@ -25,6 +32,14 @@ } } +class ValueWrapperT(T) : ValueWrapper { + public T value; + public this( T data ){ + value = data; + } +} + +alias ValueWrapperT!(bool) ValueWrapperBool; alias ArrayWrapperT!(byte) ArrayWrapperByte; alias ArrayWrapperT!(int) ArrayWrapperInt; alias ArrayWrapperT!(Object) ArrayWrapperObject; @@ -44,4 +59,112 @@ dchar[] r = tango.text.Unicode.toUpper( [c] ); return r[0]; } +bool CharacterIsWhitespace( dchar c ){ + return tango.text.Unicode.isWhitespace( c ); +} +bool CharacterIsDigit( dchar c ){ + return tango.text.Unicode.isDigit( c ); +} +public int indexOf( char[] str, char searched ){ + int res = tango.text.Util.locate( str, searched ); + if( res is str.length ) res = -1; + return res; +} + +public int indexOf( char[] str, char searched, int startpos ){ + int res = tango.text.Util.locate( str, searched, startpos ); + if( res is str.length ) res = -1; + return res; +} + +public int indexOf(char[] str, char[] ch){ + return indexOf( str, ch, 0 ); +} + +public int indexOf(char[] str, char[] ch, int start){ + int res = tango.text.Util.locatePattern( str, ch, start ); + if( res is str.length ) res = -1; + return res; +} + +public char[] substring( char[] str, int start ){ + return str[ start .. $ ].dup; +} + +public char[] substring( char[] str, int start, int end ){ + return str[ start .. end ].dup; +} + +public wchar[] substring( wchar[] str, int start ){ + return str[ start .. $ ].dup; +} + +public wchar[] substring( wchar[] str, int start, int end ){ + return str[ start .. end ].dup; +} + +public char charAt( char[] str, int pos ){ + return str[ pos ]; +} + +public void getChars( char[] src, int srcBegin, int srcEnd, char[] dst, int dstBegin){ + dst[ dstBegin .. dstBegin + srcEnd - srcBegin ] = src[ srcBegin .. srcEnd ]; +} + +public wchar[] toCharArray( char[] str ){ + return toString16( str ); +} + +public bool endsWith( char[] src, char[] pattern ){ + if( src.length < pattern.length ){ + return false; + } + return src[ $-pattern.length .. $ ] == pattern; +} + +public bool equals( char[] src, char[] other ){ + return src == other; +} + +public char[] toLowerCase( char[] src ){ + return tango.text.Unicode.toLower( src ); +} + +static char[] toHex(uint value, bool prefix = true, int radix = 8){ + return tango.text.convert.Integer.toString( + value, + radix is 10 ? tango.text.convert.Integer.Style.Signed : + radix is 8 ? tango.text.convert.Integer.Style.Octal : + radix is 16 ? tango.text.convert.Integer.Style.Hex : + tango.text.convert.Integer.Style.Signed, + prefix ? tango.text.convert.Integer.Flags.Prefix : tango.text.convert.Integer.Flags.None + ); +} + +class NumberFormatException : IllegalArgumentException { + this( char[] e ){ + super(e); + } + this( Exception e ){ + super(e.toString); + } +} + +private struct GCStats { + size_t poolsize; // total size of pool + size_t usedsize; // bytes allocated + size_t freeblocks; // number of blocks marked FREE + size_t freelistsize; // total of memory on free lists + size_t pageblocks; // number of blocks marked PAGE +} +private extern(C) GCStats gc_stats(); + +size_t RuntimeTotalMemory(){ + GCStats s;// = gc_stats(); + return s.poolsize; +} + + + +
--- a/dwt/graphics/Device.d Sat Feb 09 21:22:47 2008 +0100 +++ b/dwt/graphics/Device.d Sun Feb 10 04:19:19 2008 +0100 @@ -54,7 +54,7 @@ public static bool DEBUG; bool debugging; bool tracking; - TracedException [] errors; + Exception [] errors; Object [] objects; /* Colormap and reference count */ @@ -168,7 +168,7 @@ tracking = data.tracking; } if (tracking) { - errors = new TracedException [128]; + errors = new Exception [128]; objects = new Object [128]; } create (data); @@ -330,7 +330,7 @@ } int index = 0; data.objects = new Object [count]; - data.errors = new TracedException [count]; + data.errors = new Exception [count]; for (int i=0; i<length; i++) { if (objects [i] !is null) { data.objects [index] = objects [i]; @@ -422,7 +422,7 @@ bool match = true; if (faceName !is null) { auto familyName = OS.pango_font_family_get_name(family); - match = Compatibility.equalsIgnoreCase(faceName, fromUtf8z( familyName )); + match = Compatibility.equalsIgnoreCase(faceName, fromStringz( familyName )); } if (match) { OS.pango_font_family_list_faces(family, &faces, &n_faces); @@ -682,7 +682,7 @@ Device dev = cast(Device)user_data; if (dev.warningLevel is 0) { if (DEBUG || dev.debugging) { - foreach( msg; new TracedException ("") ){ + foreach( msg; (new Exception ("")).info ){ Stderr.formatln( "trc {}", msg ); } } @@ -695,7 +695,7 @@ for (int i=0; i<objects.length; i++) { if (objects [i] is null) { objects [i] = object; - errors [i] = new TracedException (""); + errors [i] = new Exception (""); return; } } @@ -703,9 +703,9 @@ System.arraycopy (objects, 0, newObjects, 0, objects.length); newObjects [objects.length] = object; objects = newObjects; - TracedException [] newErrors = new TracedException [errors.length + 128]; + Exception [] newErrors = new Exception [errors.length + 128]; System.arraycopy (errors, 0, newErrors, 0, errors.length); - newErrors [errors.length] = new TracedException (""); + newErrors [errors.length] = new Exception (""); errors = newErrors; } @@ -824,7 +824,7 @@ if (device !is null) { if (device.warningLevel is 0) { if (DEBUG || device.debugging) { - foreach( msg; new TracedException ("") ){ + foreach( msg; (new Exception ("")).info ){ Stderr.formatln( "trc {}", msg ); } } @@ -843,13 +843,13 @@ Device device = findDevice (xDisplay); if (device !is null) { if (DEBUG || device.debugging) { - foreach( msg; new TracedException ("") ){ + foreach( msg; (new Exception ("")).info ){ Stderr.formatln( "trc {}", msg ); } } } else { if (DEBUG) { - foreach( msg; new TracedException ("") ){ + foreach( msg; (new Exception ("")).info ){ Stderr.formatln( "trc {}", msg ); } }
--- a/dwt/graphics/DeviceData.d Sat Feb 09 21:22:47 2008 +0100 +++ b/dwt/graphics/DeviceData.d Sun Feb 10 04:19:19 2008 +0100 @@ -34,6 +34,6 @@ */ public bool debugging; public bool tracking; - public TracedException [] errors; + public Exception [] errors; public Object [] objects; }
--- a/dwt/graphics/Font.d Sat Feb 09 21:22:47 2008 +0100 +++ b/dwt/graphics/Font.d Sun Feb 10 04:19:19 2008 +0100 @@ -199,7 +199,7 @@ if (isDisposed()) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED); auto family = OS.pango_font_description_get_family(handle); - char[] name = fromUtf8z( family ); + char[] name = fromStringz( family ); float height = cast(float)OS.pango_font_description_get_size(handle) / OS.PANGO_SCALE; int pangoStyle = OS.pango_font_description_get_style(handle); int pangoWeight = OS.pango_font_description_get_weight(handle); @@ -208,7 +208,7 @@ if (pangoStyle is OS.PANGO_STYLE_OBLIQUE) style |= DWT.ROMAN; if (pangoWeight >= OS.PANGO_WEIGHT_BOLD) style |= DWT.BOLD; auto fontString = OS.pango_font_description_to_string (handle); - auto buffer = fromUtf8z( fontString ).dup; + auto buffer = fromStringz( fontString ).dup; FontData data = new FontData( buffer , height, style); OS.g_free (fontString); data.str = buffer;
--- a/dwt/graphics/ImageData.d Sat Feb 09 21:22:47 2008 +0100 +++ b/dwt/graphics/ImageData.d Sun Feb 10 04:19:19 2008 +0100 @@ -228,9 +228,9 @@ ANY_TO_EIGHT = new byte[][](9); for (int b = 0; b < 9; ++b) { byte[] data = ANY_TO_EIGHT[b] = new byte[1 << b]; - if (b == 0) continue; + if (b is 0) continue; int inc = 0; - for (int bit = 0x10000; (bit >>= b) != 0;) inc |= bit; + for (int bit = 0x10000; (bit >>= b) !is 0;) inc |= bit; for (int v = 0, p = 0; v < 0x10000; v+= inc) data[p++] = cast(byte)(v >> 8); } ONE_TO_ONE_MAPPING = ANY_TO_EIGHT[8]; @@ -316,7 +316,7 @@ * <pre> * static ImageData loadImageData (Class clazz, String string) { * InputStream stream = clazz.getResourceAsStream (string); - * if (stream == null) return null; + * if (stream is null) return null; * ImageData imageData = null; * try { * imageData = new ImageData (stream); @@ -431,15 +431,15 @@ byte[] alphaData, int alpha, int transparentPixel, int type, int x, int y, int disposalMethod, int delayTime) { - if (palette == null) DWT.error(DWT.ERROR_NULL_ARGUMENT); - if (!(depth == 1 || depth == 2 || depth == 4 || depth == 8 - || depth == 16 || depth == 24 || depth == 32)) { + if (palette is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); + if (!(depth is 1 || depth is 2 || depth is 4 || depth is 8 + || depth is 16 || depth is 24 || depth is 32)) { DWT.error(DWT.ERROR_INVALID_ARGUMENT); } if (width <= 0 || height <= 0) { DWT.error(DWT.ERROR_INVALID_ARGUMENT); } - if (scanlinePad == 0) DWT.error (DWT.ERROR_CANNOT_BE_ZERO); + if (scanlinePad is 0) DWT.error (DWT.ERROR_CANNOT_BE_ZERO); int bytesPerLine = (((width * depth + 7) / 8) + (scanlinePad - 1)) / scanlinePad * scanlinePad; @@ -449,7 +449,7 @@ depth, scanlinePad, bytesPerLine, - data != null ? data : new byte[bytesPerLine * height], + data !is null ? data : new byte[bytesPerLine * height], palette, transparentPixel, maskData, @@ -529,7 +529,7 @@ for (int y = 0; y < height; y++) { getPixels(0, y, width, row, 0); for (int i = 0; i < width; i++) { - if (pixel != -1 && row[i] == pixel) { + if (pixel !is -1 && row[i] is pixel) { row[i] = 0; } else { row[i] = 1; @@ -541,7 +541,7 @@ } static byte[] checkData(byte [] data) { - if (data == null) DWT.error(DWT.ERROR_NULL_ARGUMENT); + if (data is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); return data; } @@ -557,12 +557,12 @@ byte[] cloneData = new byte[data.length]; System.arraycopy(data, 0, cloneData, 0, data.length); byte[] cloneMaskData = null; - if (maskData != null) { + if (maskData !is null) { cloneMaskData = new byte[maskData.length]; System.arraycopy(maskData, 0, cloneMaskData, 0, maskData.length); } byte[] cloneAlphaData = null; - if (alphaData != null) { + if (alphaData !is null) { cloneAlphaData = new byte[alphaData.length]; System.arraycopy(alphaData, 0, cloneAlphaData, 0, alphaData.length); } @@ -600,7 +600,7 @@ public int getAlpha(int x, int y) { if (x >= width || y >= height || x < 0 || y < 0) DWT.error(DWT.ERROR_INVALID_ARGUMENT); - if (alphaData == null) return 255; + if (alphaData is null) return 255; return alphaData[y * width + x] & 0xFF; } @@ -623,11 +623,11 @@ * </ul> */ public void getAlphas(int x, int y, int getWidth, byte[] alphas, int startIndex) { - if (alphas == null) DWT.error(DWT.ERROR_NULL_ARGUMENT); + if (alphas is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); if (getWidth < 0 || x >= width || y >= height || x < 0 || y < 0) DWT.error(DWT.ERROR_INVALID_ARGUMENT); - if (getWidth == 0) return; + if (getWidth is 0) return; - if (alphaData == null) { + if (alphaData is null) { int endIndex = startIndex + getWidth; for (int i = startIndex; i < endIndex; i++) { alphas[i] = cast(byte)255; @@ -676,7 +676,7 @@ case 4: index = (y * bytesPerLine) + (x >> 1); theByte = data[index] & 0xFF; - if ((x & 0x1) == 0) { + if ((x & 0x1) is 0) { return theByte >> 4; } else { return theByte & 0x0F; @@ -691,7 +691,7 @@ index = (y * bytesPerLine) + (x >> 3); theByte = data[index] & 0xFF; mask = 1 << (7 - (x & 0x7)); - if ((theByte & mask) == 0) { + if ((theByte & mask) is 0) { return 0; } else { return 1; @@ -725,9 +725,9 @@ * </ul> */ public void getPixels(int x, int y, int getWidth, byte[] pixels, int startIndex) { - if (pixels == null) DWT.error(DWT.ERROR_NULL_ARGUMENT); + if (pixels is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); if (getWidth < 0 || x >= width || y >= height || x < 0 || y < 0) DWT.error(DWT.ERROR_INVALID_ARGUMENT); - if (getWidth == 0) return; + if (getWidth is 0) return; int index; int theByte; int mask = 0; @@ -752,7 +752,7 @@ return; case 4: index = (y * bytesPerLine) + (x >> 1); - if ((x & 0x1) == 1) { + if ((x & 0x1) is 1) { theByte = data[index] & 0xFF; pixels[i] = cast(byte)(theByte & 0x0F); i++; @@ -812,7 +812,7 @@ if (n > 0) theByte = data[index] & 0xFF; srcX = 0; } else { - if (offset == 0) { + if (offset is 0) { index++; theByte = data[index] & 0xFF; } @@ -824,7 +824,7 @@ theByte = data[index] & 0xFF; while (n > 0) { mask = 1 << (7 - (srcX & 0x7)); - if ((theByte & mask) == 0) { + if ((theByte & mask) is 0) { pixels[i] = 0; } else { pixels[i] = 1; @@ -838,7 +838,7 @@ if (n > 0) theByte = data[index] & 0xFF; srcX = 0; } else { - if (mask == 1) { + if (mask is 1) { index++; if (n > 0) theByte = data[index] & 0xFF; } @@ -872,9 +872,9 @@ * </ul> */ public void getPixels(int x, int y, int getWidth, int[] pixels, int startIndex) { - if (pixels == null) DWT.error(DWT.ERROR_NULL_ARGUMENT); + if (pixels is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); if (getWidth < 0 || x >= width || y >= height || x < 0 || y < 0) DWT.error(DWT.ERROR_INVALID_ARGUMENT); - if (getWidth == 0) return; + if (getWidth is 0) return; int index; int theByte; int mask; @@ -947,7 +947,7 @@ return; case 4: index = (y * bytesPerLine) + (x >> 1); - if ((x & 0x1) == 1) { + if ((x & 0x1) is 1) { theByte = data[index] & 0xFF; pixels[i] = theByte & 0x0F; i++; @@ -1007,7 +1007,7 @@ if (n > 0) theByte = data[index] & 0xFF; srcX = 0; } else { - if (offset == 0) { + if (offset is 0) { index++; theByte = data[index] & 0xFF; } @@ -1019,7 +1019,7 @@ theByte = data[index] & 0xFF; while (n > 0) { mask = 1 << (7 - (srcX & 0x7)); - if ((theByte & mask) == 0) { + if ((theByte & mask) is 0) { pixels[i] = 0; } else { pixels[i] = 1; @@ -1033,7 +1033,7 @@ if (n > 0) theByte = data[index] & 0xFF; srcX = 0; } else { - if (mask == 1) { + if (mask is 1) { index++; if (n > 0) theByte = data[index] & 0xFF; } @@ -1067,7 +1067,7 @@ * @return the transparency mask */ public ImageData getTransparencyMask() { - if (getTransparencyType() == DWT.TRANSPARENCY_MASK) { + if (getTransparencyType() is DWT.TRANSPARENCY_MASK) { return new ImageData(width, height, 1, bwPalette(), maskPad, maskData); } else { return colorMaskImage(transparentPixel); @@ -1082,9 +1082,9 @@ * @return the receiver's transparency type */ public int getTransparencyType() { - if (maskData != null) return DWT.TRANSPARENCY_MASK; - if (transparentPixel != -1) return DWT.TRANSPARENCY_PIXEL; - if (alphaData != null) return DWT.TRANSPARENCY_ALPHA; + if (maskData !is null) return DWT.TRANSPARENCY_MASK; + if (transparentPixel !is -1) return DWT.TRANSPARENCY_PIXEL; + if (alphaData !is null) return DWT.TRANSPARENCY_ALPHA; return DWT.TRANSPARENCY_NONE; } @@ -1094,7 +1094,7 @@ * @return MSB_FIRST or LSB_FIRST */ int getByteOrder() { - return depth != 16 ? MSB_FIRST : LSB_FIRST; + return depth !is 16 ? MSB_FIRST : LSB_FIRST; } /** @@ -1133,7 +1133,7 @@ flipX, flipY); /* Scale the image mask or alpha */ - if (maskData != null) { + if (maskData !is null) { dest.maskPad = this.maskPad; int destBpl = (dest.width + 7) / 8; destBpl = (destBpl + (dest.maskPad - 1)) / dest.maskPad * dest.maskPad; @@ -1145,9 +1145,9 @@ ALPHA_OPAQUE, null, 0, 0, 0, dest.maskData, 1, destBpl, MSB_FIRST, 0, 0, dest.width, dest.height, null, null, null, flipX, flipY); - } else if (alpha != -1) { + } else if (alpha !is -1) { dest.alpha = this.alpha; - } else if (alphaData != null) { + } else if (alphaData !is null) { dest.alphaData = new byte[dest.width * dest.height]; blit(BLIT_SRC, this.alphaData, 8, this.width, MSB_FIRST, 0, 0, this.width, this.height, null, null, null, @@ -1174,7 +1174,7 @@ if (x >= width || y >= height || x < 0 || y < 0 || alpha < 0 || alpha > 255) DWT.error(DWT.ERROR_INVALID_ARGUMENT); - if (alphaData == null) alphaData = new byte[width * height]; + if (alphaData is null) alphaData = new byte[width * height]; alphaData[y * width + x] = cast(byte)alpha; } @@ -1198,11 +1198,11 @@ * </ul> */ public void setAlphas(int x, int y, int putWidth, byte[] alphas, int startIndex) { - if (alphas == null) DWT.error(DWT.ERROR_NULL_ARGUMENT); + if (alphas is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); if (putWidth < 0 || x >= width || y >= height || x < 0 || y < 0) DWT.error(DWT.ERROR_INVALID_ARGUMENT); - if (putWidth == 0) return; + if (putWidth is 0) return; - if (alphaData == null) alphaData = new byte[width * height]; + if (alphaData is null) alphaData = new byte[width * height]; // may throw an IndexOutOfBoundsException System.arraycopy(alphas, startIndex, alphaData, y * width + x, putWidth); } @@ -1252,7 +1252,7 @@ return; case 4: index = (y * bytesPerLine) + (x >> 1); - if ((x & 0x1) == 0) { + if ((x & 0x1) is 0) { data[index] = cast(byte)((data[index] & 0x0F) | ((pixelValue & 0x0F) << 4)); } else { data[index] = cast(byte)((data[index] & 0xF0) | (pixelValue & 0x0F)); @@ -1269,7 +1269,7 @@ index = (y * bytesPerLine) + (x >> 3); theByte = data[index]; mask = 1 << (7 - (x & 0x7)); - if ((pixelValue & 0x1) == 1) { + if ((pixelValue & 0x1) is 1) { data[index] = cast(byte)(theByte | mask); } else { data[index] = cast(byte)(theByte & (mask ^ -1)); @@ -1304,9 +1304,9 @@ * </ul> */ public void setPixels(int x, int y, int putWidth, byte[] pixels, int startIndex) { - if (pixels == null) DWT.error(DWT.ERROR_NULL_ARGUMENT); + if (pixels is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); if (putWidth < 0 || x >= width || y >= height || x < 0 || y < 0) DWT.error(DWT.ERROR_INVALID_ARGUMENT); - if (putWidth == 0) return; + if (putWidth is 0) return; int index; int theByte; int mask; @@ -1331,7 +1331,7 @@ return; case 4: index = (y * bytesPerLine) + (x >> 1); - bool high = (x & 0x1) == 0; + bool high = (x & 0x1) is 0; while (n > 0) { theByte = pixels[i] & 0x0F; if (high) { @@ -1369,7 +1369,7 @@ offset = 0; srcX = 0; } else { - if (offset == 0) { + if (offset is 0) { index++; offset = 3; } else { @@ -1382,7 +1382,7 @@ index = (y * bytesPerLine) + (x >> 3); while (n > 0) { mask = 1 << (7 - (srcX & 0x7)); - if ((pixels[i] & 0x1) == 1) { + if ((pixels[i] & 0x1) is 1) { data[index] = cast(byte)((data[index] & 0xFF) | mask); } else { data[index] = cast(byte)((data[index] & 0xFF) & (mask ^ -1)); @@ -1395,7 +1395,7 @@ index = srcY * bytesPerLine; srcX = 0; } else { - if (mask == 1) { + if (mask is 1) { index++; } } @@ -1429,9 +1429,9 @@ * </ul> */ public void setPixels(int x, int y, int putWidth, int[] pixels, int startIndex) { - if (pixels == null) DWT.error(DWT.ERROR_NULL_ARGUMENT); + if (pixels is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); if (putWidth < 0 || x >= width || y >= height || x < 0 || y < 0) DWT.error(DWT.ERROR_INVALID_ARGUMENT); - if (putWidth == 0) return; + if (putWidth is 0) return; int index; int theByte; int mask; @@ -1511,7 +1511,7 @@ return; case 4: index = (y * bytesPerLine) + (x >> 1); - bool high = (x & 0x1) == 0; + bool high = (x & 0x1) is 0; while (n > 0) { theByte = pixels[i] & 0x0F; if (high) { @@ -1549,7 +1549,7 @@ offset = 3; srcX = 0; } else { - if (offset == 0) { + if (offset is 0) { index++; offset = 3; } else { @@ -1562,7 +1562,7 @@ index = (y * bytesPerLine) + (x >> 3); while (n > 0) { mask = 1 << (7 - (srcX & 0x7)); - if ((pixels[i] & 0x1) == 1) { + if ((pixels[i] & 0x1) is 1) { data[index] = cast(byte)((data[index] & 0xFF) | mask); } else { data[index] = cast(byte)((data[index] & 0xFF) & (mask ^ -1)); @@ -1575,7 +1575,7 @@ index = srcY * bytesPerLine; srcX = 0; } else { - if (mask == 1) { + if (mask is 1) { index++; } } @@ -1599,7 +1599,7 @@ */ static int getMSBOffset(int mask) { for (int i = 31; i >= 0; i--) { - if (((mask >> i) & 0x1) != 0) return i + 1; + if (((mask >> i) & 0x1) !is 0) return i + 1; } return 0; } @@ -1627,7 +1627,7 @@ int distance = r*r + g*g + b*b; if (distance < minDistance) { nearestPixel = j; - if (distance == 0) break; + if (distance is 0) break; minDistance = distance; } } @@ -1635,15 +1635,15 @@ } static final ImageData convertMask(ImageData mask) { - if (mask.depth == 1) return mask; + if (mask.depth is 1) return mask; PaletteData palette = new PaletteData([new RGB(0, 0, 0), new RGB(255,255,255)]); ImageData newMask = new ImageData(mask.width, mask.height, 1, palette); /* Find index of black in mask palette */ int blackIndex = 0; RGB[] rgbs = mask.getRGBs(); - if (rgbs != null) { + if (rgbs !is null) { while (blackIndex < rgbs.length) { - if (rgbs[blackIndex] == palette.colors[0] ) break; + if (rgbs[blackIndex] is palette.colors[0] ) break; blackIndex++; } } @@ -1651,7 +1651,7 @@ for (int y = 0; y < mask.height; y++) { mask.getPixels(0, y, mask.width, pixels, 0); for (int i = 0; i < pixels.length; i++) { - if (pixels[i] == blackIndex) { + if (pixels[i] is blackIndex) { pixels[i] = 0; } else { pixels[i] = 1; @@ -1663,7 +1663,7 @@ } static final byte[] convertPad(byte[] data, int width, int height, int depth, int pad, int newPad) { - if (pad == newPad) return data; + if (pad is newPad) return data; int stride = (width * depth + 7) / 8; int bpl = (stride + (pad - 1)) / pad * pad; int newBpl = (stride + (newPad - 1)) / newPad * newPad; @@ -1781,16 +1781,16 @@ static_this(); - if ((destWidth <= 0) || (destHeight <= 0) || (alphaMode == ALPHA_TRANSPARENT)) return; + if ((destWidth <= 0) || (destHeight <= 0) || (alphaMode is ALPHA_TRANSPARENT)) return; // these should be supplied as params later const int srcAlphaMask = 0, destAlphaMask = 0; /*** Prepare scaling data ***/ int dwm1 = destWidth - 1; - int sfxi = (dwm1 != 0) ? cast(int)(((cast(long)srcWidth << 16) - 1) / dwm1) : 0; + int sfxi = (dwm1 !is 0) ? cast(int)(((cast(long)srcWidth << 16) - 1) / dwm1) : 0; int dhm1 = destHeight - 1; - int sfyi = (dhm1 != 0) ? cast(int)(((cast(long)srcHeight << 16) - 1) / dhm1) : 0; + int sfyi = (dhm1 !is 0) ? cast(int)(((cast(long)srcHeight << 16) - 1) / dhm1) : 0; /*** Prepare source-related data ***/ int sbpp, stype; @@ -1801,7 +1801,7 @@ break; case 16: sbpp = 2; - stype = (srcOrder == MSB_FIRST) ? TYPE_GENERIC_16_MSB : TYPE_GENERIC_16_LSB; + stype = (srcOrder is MSB_FIRST) ? TYPE_GENERIC_16_MSB : TYPE_GENERIC_16_LSB; break; case 24: sbpp = 3; @@ -1809,7 +1809,7 @@ break; case 32: sbpp = 4; - stype = (srcOrder == MSB_FIRST) ? TYPE_GENERIC_32_MSB : TYPE_GENERIC_32_LSB; + stype = (srcOrder is MSB_FIRST) ? TYPE_GENERIC_32_MSB : TYPE_GENERIC_32_LSB; break; default: //throw new IllegalArgumentException("Invalid source type"); @@ -1826,7 +1826,7 @@ break; case 16: dbpp = 2; - dtype = (destOrder == MSB_FIRST) ? TYPE_GENERIC_16_MSB : TYPE_GENERIC_16_LSB; + dtype = (destOrder is MSB_FIRST) ? TYPE_GENERIC_16_MSB : TYPE_GENERIC_16_LSB; break; case 24: dbpp = 3; @@ -1834,7 +1834,7 @@ break; case 32: dbpp = 4; - dtype = (destOrder == MSB_FIRST) ? TYPE_GENERIC_32_MSB : TYPE_GENERIC_32_LSB; + dtype = (destOrder is MSB_FIRST) ? TYPE_GENERIC_32_MSB : TYPE_GENERIC_32_LSB; break; default: //throw new IllegalArgumentException("Invalid destination type"); @@ -1846,15 +1846,15 @@ /*** Prepare special processing data ***/ int apr; - if ((op & BLIT_ALPHA) != 0) { + if ((op & BLIT_ALPHA) !is 0) { switch (alphaMode) { case ALPHA_MASK_UNPACKED: case ALPHA_CHANNEL_SEPARATE: - if (alphaData == null) alphaMode = 0x10000; + if (alphaData is null) alphaMode = 0x10000; apr = alphaY * alphaStride + alphaX; break; case ALPHA_MASK_PACKED: - if (alphaData == null) alphaMode = 0x10000; + if (alphaData is null) alphaMode = 0x10000; alphaStride <<= 3; apr = alphaY * alphaStride + alphaX; break; @@ -1862,7 +1862,7 @@ //throw new IllegalArgumentException("Invalid alpha type"); return; case ALPHA_MASK_RGB: - if (alphaData == null) alphaMode = 0x10000; + if (alphaData is null) alphaMode = 0x10000; apr = 0; break; default: @@ -1879,9 +1879,9 @@ /*** Blit ***/ int dp = dpr; int sp = spr; - if ((alphaMode == 0x10000) && (stype == dtype) && - (srcRedMask == destRedMask) && (srcGreenMask == destGreenMask) && - (srcBlueMask == destBlueMask) && (srcAlphaMask == destAlphaMask)) { + if ((alphaMode is 0x10000) && (stype is dtype) && + (srcRedMask is destRedMask) && (srcGreenMask is destGreenMask) && + (srcBlueMask is destBlueMask) && (srcAlphaMask is destAlphaMask)) { /*** Fast blit (straight copy) ***/ switch (sbpp) { case 1: @@ -2035,7 +2035,7 @@ alpha = (a << 16) / 255; break; case ALPHA_MASK_UNPACKED: - alpha = (alphaData[ap] != 0) ? 0x10000 : 0; + alpha = (alphaData[ap] !is 0) ? 0x10000 : 0; ap += (sfx >> 16); break; case ALPHA_MASK_PACKED: @@ -2045,7 +2045,7 @@ case ALPHA_MASK_RGB: alpha = 0x10000; for (int i = 0; i < alphaData.length; i += 3) { - if ((r == alphaData[i]) && (g == alphaData[i + 1]) && (b == alphaData[i + 2])) { + if ((r is alphaData[i]) && (g is alphaData[i + 1]) && (b is alphaData[i + 2])) { alpha = 0x0000; break; } @@ -2053,8 +2053,8 @@ break; default: } - if (alpha != 0x10000) { - if (alpha == 0x0000) continue; + if (alpha !is 0x10000) { + if (alpha is 0x0000) continue; switch (dtype) { case TYPE_GENERIC_8: { int data = destData[dp] & 0xff; @@ -2214,13 +2214,13 @@ static_this(); - if ((destWidth <= 0) || (destHeight <= 0) || (alphaMode == ALPHA_TRANSPARENT)) return; + if ((destWidth <= 0) || (destHeight <= 0) || (alphaMode is ALPHA_TRANSPARENT)) return; /*** Prepare scaling data ***/ int dwm1 = destWidth - 1; - int sfxi = (dwm1 != 0) ? cast(int)(((cast(long)srcWidth << 16) - 1) / dwm1) : 0; + int sfxi = (dwm1 !is 0) ? cast(int)(((cast(long)srcWidth << 16) - 1) / dwm1) : 0; int dhm1 = destHeight - 1; - int sfyi = (dhm1 != 0) ? cast(int)(((cast(long)srcHeight << 16) - 1) / dhm1) : 0; + int sfyi = (dhm1 !is 0) ? cast(int)(((cast(long)srcHeight << 16) - 1) / dhm1) : 0; /*** Prepare source-related data ***/ int stype; @@ -2238,7 +2238,7 @@ break; case 1: srcStride <<= 3; - stype = (srcOrder == MSB_FIRST) ? TYPE_INDEX_1_MSB : TYPE_INDEX_1_LSB; + stype = (srcOrder is MSB_FIRST) ? TYPE_INDEX_1_MSB : TYPE_INDEX_1_LSB; break; default: //throw new IllegalArgumentException("Invalid source type"); @@ -2262,7 +2262,7 @@ break; case 1: destStride <<= 3; - dtype = (destOrder == MSB_FIRST) ? TYPE_INDEX_1_MSB : TYPE_INDEX_1_LSB; + dtype = (destOrder is MSB_FIRST) ? TYPE_INDEX_1_MSB : TYPE_INDEX_1_LSB; break; default: //throw new IllegalArgumentException("Invalid source type"); @@ -2274,21 +2274,21 @@ /*** Prepare special processing data ***/ int apr; - if ((op & BLIT_ALPHA) != 0) { + if ((op & BLIT_ALPHA) !is 0) { switch (alphaMode) { case ALPHA_MASK_UNPACKED: case ALPHA_CHANNEL_SEPARATE: - if (alphaData == null) alphaMode = 0x10000; + if (alphaData is null) alphaMode = 0x10000; apr = alphaY * alphaStride + alphaX; break; case ALPHA_MASK_PACKED: - if (alphaData == null) alphaMode = 0x10000; + if (alphaData is null) alphaMode = 0x10000; alphaStride <<= 3; apr = alphaY * alphaStride + alphaX; break; case ALPHA_MASK_INDEX: case ALPHA_MASK_RGB: - if (alphaData == null) alphaMode = 0x10000; + if (alphaData is null) alphaMode = 0x10000; apr = 0; break; default: @@ -2301,25 +2301,25 @@ alphaMode = 0x10000; apr = 0; } - bool ditherEnabled = (op & BLIT_DITHER) != 0; + bool ditherEnabled = (op & BLIT_DITHER) !is 0; /*** Blit ***/ int dp = dpr; int sp = spr; int ap = apr; int destPaletteSize = 1 << destDepth; - if ((destReds != null) && (destReds.length < destPaletteSize)) destPaletteSize = destReds.length; + if ((destReds !is null) && (destReds.length < destPaletteSize)) destPaletteSize = destReds.length; byte[] paletteMapping = null; bool isExactPaletteMapping = true; switch (alphaMode) { case 0x10000: /*** If the palettes and formats are equivalent use a one-to-one mapping ***/ - if ((stype == dtype) && - (srcReds == destReds) && (srcGreens == destGreens) && (srcBlues == destBlues)) { + if ((stype is dtype) && + (srcReds is destReds) && (srcGreens is destGreens) && (srcBlues is destBlues)) { paletteMapping = ONE_TO_ONE_MAPPING; break; /*** If palettes have not been supplied, supply a suitable mapping ***/ - } else if ((srcReds == null) || (destReds == null)) { + } else if ((srcReds is null) || (destReds is null)) { if (srcDepth <= destDepth) { paletteMapping = ONE_TO_ONE_MAPPING; } else { @@ -2336,7 +2336,7 @@ /*** Generate a palette mapping ***/ int srcPaletteSize = 1 << srcDepth; paletteMapping = new byte[srcPaletteSize]; - if ((srcReds != null) && (srcReds.length < srcPaletteSize)) srcPaletteSize = srcReds.length; + if ((srcReds !is null) && (srcReds.length < srcPaletteSize)) srcPaletteSize = srcReds.length; for (int i = 0, r, g, b, index; i < srcPaletteSize; ++i) { r = srcReds[i] & 0xff; g = srcGreens[i] & 0xff; @@ -2350,18 +2350,18 @@ distance = dr * dr + dg * dg + db * db; if (distance < minDistance) { index = j; - if (distance == 0) break; + if (distance is 0) break; minDistance = distance; } } paletteMapping[i] = cast(byte)index; - if (minDistance != 0) isExactPaletteMapping = false; + if (minDistance !is 0) isExactPaletteMapping = false; } break; default: } - if ((paletteMapping != null) && (isExactPaletteMapping || ! ditherEnabled)) { - if ((stype == dtype) && (alphaMode == 0x10000)) { + if ((paletteMapping !is null) && (isExactPaletteMapping || ! ditherEnabled)) { + if ((stype is dtype) && (alphaMode is 0x10000)) { /*** Fast blit (copy w/ mapping) ***/ switch (stype) { case TYPE_INDEX_8: @@ -2376,10 +2376,10 @@ for (int dy = destHeight, sfy = sfyi; dy > 0; --dy, sp = spr += (sfy >>> 16) * srcStride, sfy = (sfy & 0xffff) + sfyi, dp = dpr += dpryi) { for (int dx = destWidth, sfx = sfxi; dx > 0; --dx, dp += dprxi, sfx = (sfx & 0xffff) + sfxi) { int v; - if ((sp & 1) != 0) v = paletteMapping[srcData[sp >> 1] & 0x0f]; + if ((sp & 1) !is 0) v = paletteMapping[srcData[sp >> 1] & 0x0f]; else v = (srcData[sp >> 1] >>> 4) & 0x0f; sp += (sfx >>> 16); - if ((dp & 1) != 0) destData[dp >> 1] = cast(byte)((destData[dp >> 1] & 0xf0) | v); + if ((dp & 1) !is 0) destData[dp >> 1] = cast(byte)((destData[dp >> 1] & 0xf0) | v); else destData[dp >> 1] = cast(byte)((destData[dp >> 1] & 0x0f) | (v << 4)); } } @@ -2433,7 +2433,7 @@ sp += (sfx >>> 16); break; case TYPE_INDEX_4: - if ((sp & 1) != 0) index = srcData[sp >> 1] & 0x0f; + if ((sp & 1) !is 0) index = srcData[sp >> 1] & 0x0f; else index = (srcData[sp >> 1] >>> 4) & 0x0f; sp += (sfx >>> 16); break; @@ -2457,17 +2457,17 @@ case ALPHA_MASK_UNPACKED: { byte mask = alphaData[ap]; ap += (sfx >> 16); - if (mask == 0) continue; + if (mask is 0) continue; } break; case ALPHA_MASK_PACKED: { int mask = alphaData[ap >> 3] & (1 << (ap & 7)); ap += (sfx >> 16); - if (mask == 0) continue; + if (mask is 0) continue; } break; case ALPHA_MASK_INDEX: { int i = 0; while (i < alphaData.length) { - if (index == (alphaData[i] & 0xff)) break; + if (index is (alphaData[i] & 0xff)) break; } if (i < alphaData.length) continue; } break; @@ -2475,7 +2475,7 @@ byte r = srcReds[index], g = srcGreens[index], b = srcBlues[index]; int i = 0; while (i < alphaData.length) { - if ((r == alphaData[i]) && (g == alphaData[i + 1]) && (b == alphaData[i + 2])) break; + if ((r is alphaData[i]) && (g is alphaData[i + 1]) && (b is alphaData[i + 2])) break; i += 3; } if (i < alphaData.length) continue; @@ -2490,7 +2490,7 @@ destData[dp] = cast(byte) index; break; case TYPE_INDEX_4: - if ((dp & 1) != 0) destData[dp >> 1] = cast(byte)((destData[dp >> 1] & 0xf0) | index); + if ((dp & 1) !is 0) destData[dp >> 1] = cast(byte)((destData[dp >> 1] & 0xf0) | index); else destData[dp >> 1] = cast(byte)((destData[dp >> 1] & 0x0f) | (index << 4)); break; case TYPE_INDEX_2: { @@ -2542,7 +2542,7 @@ sp += (sfx >>> 16); break; case TYPE_INDEX_4: - if ((sp & 1) != 0) index = srcData[sp >> 1] & 0x0f; + if ((sp & 1) !is 0) index = srcData[sp >> 1] & 0x0f; else index = (srcData[sp >> 1] >>> 4) & 0x0f; sp += (sfx >>> 16); break; @@ -2569,7 +2569,7 @@ ap += (sfx >> 16); break; case ALPHA_MASK_UNPACKED: - alpha = (alphaData[ap] != 0) ? 0x10000 : 0; + alpha = (alphaData[ap] !is 0) ? 0x10000 : 0; ap += (sfx >> 16); break; case ALPHA_MASK_PACKED: @@ -2579,30 +2579,30 @@ case ALPHA_MASK_INDEX: { // could speed up using binary search if we sorted the indices int i = 0; while (i < alphaData.length) { - if (index == (alphaData[i] & 0xff)) break; + if (index is (alphaData[i] & 0xff)) break; } if (i < alphaData.length) continue; } break; case ALPHA_MASK_RGB: { int i = 0; while (i < alphaData.length) { - if ((r == (alphaData[i] & 0xff)) && - (g == (alphaData[i + 1] & 0xff)) && - (b == (alphaData[i + 2] & 0xff))) break; + if ((r is (alphaData[i] & 0xff)) && + (g is (alphaData[i + 1] & 0xff)) && + (b is (alphaData[i + 2] & 0xff))) break; i += 3; } if (i < alphaData.length) continue; } break; default: } - if (alpha != 0x10000) { - if (alpha == 0x0000) continue; + if (alpha !is 0x10000) { + if (alpha is 0x0000) continue; switch (dtype) { case TYPE_INDEX_8: indexq = destData[dp] & 0xff; break; case TYPE_INDEX_4: - if ((dp & 1) != 0) indexq = destData[dp >> 1] & 0x0f; + if ((dp & 1) !is 0) indexq = destData[dp >> 1] & 0x0f; else indexq = (destData[dp >> 1] >>> 4) & 0x0f; break; case TYPE_INDEX_2: @@ -2638,7 +2638,7 @@ gerr[dx] = lgerr; berr[dx] = lberr; } - if (r != lastr || g != lastg || b != lastb) { + if (r !is lastr || g !is lastg || b !is lastb) { // moving the variable declarations out seems to make the JDK JIT happier... for (int j = 0, dr, dg, db, distance, minDistance = 0x7fffffff; j < destPaletteSize; ++j) { dr = (destReds[j] & 0xff) - r; @@ -2647,7 +2647,7 @@ distance = dr * dr + dg * dg + db * db; if (distance < minDistance) { lastindex = j; - if (distance == 0) break; + if (distance is 0) break; minDistance = distance; } } @@ -2674,7 +2674,7 @@ destData[dp] = cast(byte) lastindex; break; case TYPE_INDEX_4: - if ((dp & 1) != 0) destData[dp >> 1] = cast(byte)((destData[dp >> 1] & 0xf0) | lastindex); + if ((dp & 1) !is 0) destData[dp >> 1] = cast(byte)((destData[dp >> 1] & 0xf0) | lastindex); else destData[dp >> 1] = cast(byte)((destData[dp >> 1] & 0x0f) | (lastindex << 4)); break; case TYPE_INDEX_2: { @@ -2752,16 +2752,16 @@ static_this(); - if ((destWidth <= 0) || (destHeight <= 0) || (alphaMode == ALPHA_TRANSPARENT)) return; + if ((destWidth <= 0) || (destHeight <= 0) || (alphaMode is ALPHA_TRANSPARENT)) return; // these should be supplied as params later int destAlphaMask = 0; /*** Prepare scaling data ***/ int dwm1 = destWidth - 1; - int sfxi = (dwm1 != 0) ? cast(int)(((cast(long)srcWidth << 16) - 1) / dwm1) : 0; + int sfxi = (dwm1 !is 0) ? cast(int)(((cast(long)srcWidth << 16) - 1) / dwm1) : 0; int dhm1 = destHeight - 1; - int sfyi = (dhm1 != 0) ? cast(int)(((cast(long)srcHeight << 16) - 1) / dhm1) : 0; + int sfyi = (dhm1 !is 0) ? cast(int)(((cast(long)srcHeight << 16) - 1) / dhm1) : 0; /*** Prepare source-related data ***/ int stype; @@ -2779,7 +2779,7 @@ break; case 1: srcStride <<= 3; - stype = (srcOrder == MSB_FIRST) ? TYPE_INDEX_1_MSB : TYPE_INDEX_1_LSB; + stype = (srcOrder is MSB_FIRST) ? TYPE_INDEX_1_MSB : TYPE_INDEX_1_LSB; break; default: //throw new IllegalArgumentException("Invalid source type"); @@ -2796,7 +2796,7 @@ break; case 16: dbpp = 2; - dtype = (destOrder == MSB_FIRST) ? TYPE_GENERIC_16_MSB : TYPE_GENERIC_16_LSB; + dtype = (destOrder is MSB_FIRST) ? TYPE_GENERIC_16_MSB : TYPE_GENERIC_16_LSB; break; case 24: dbpp = 3; @@ -2804,7 +2804,7 @@ break; case 32: dbpp = 4; - dtype = (destOrder == MSB_FIRST) ? TYPE_GENERIC_32_MSB : TYPE_GENERIC_32_LSB; + dtype = (destOrder is MSB_FIRST) ? TYPE_GENERIC_32_MSB : TYPE_GENERIC_32_LSB; break; default: //throw new IllegalArgumentException("Invalid destination type"); @@ -2816,21 +2816,21 @@ /*** Prepare special processing data ***/ int apr; - if ((op & BLIT_ALPHA) != 0) { + if ((op & BLIT_ALPHA) !is 0) { switch (alphaMode) { case ALPHA_MASK_UNPACKED: case ALPHA_CHANNEL_SEPARATE: - if (alphaData == null) alphaMode = 0x10000; + if (alphaData is null) alphaMode = 0x10000; apr = alphaY * alphaStride + alphaX; break; case ALPHA_MASK_PACKED: - if (alphaData == null) alphaMode = 0x10000; + if (alphaData is null) alphaMode = 0x10000; alphaStride <<= 3; apr = alphaY * alphaStride + alphaX; break; case ALPHA_MASK_INDEX: case ALPHA_MASK_RGB: - if (alphaData == null) alphaMode = 0x10000; + if (alphaData is null) alphaMode = 0x10000; apr = 0; break; default: @@ -2882,7 +2882,7 @@ sp += (sfx >>> 16); break; case TYPE_INDEX_4: - if ((sp & 1) != 0) index = srcData[sp >> 1] & 0x0f; + if ((sp & 1) !is 0) index = srcData[sp >> 1] & 0x0f; else index = (srcData[sp >> 1] >>> 4) & 0x0f; sp += (sfx >>> 16); break; @@ -2911,7 +2911,7 @@ ap += (sfx >> 16); break; case ALPHA_MASK_UNPACKED: - alpha = (alphaData[ap] != 0) ? 0x10000 : 0; + alpha = (alphaData[ap] !is 0) ? 0x10000 : 0; ap += (sfx >> 16); break; case ALPHA_MASK_PACKED: @@ -2921,24 +2921,24 @@ case ALPHA_MASK_INDEX: { // could speed up using binary search if we sorted the indices int i = 0; while (i < alphaData.length) { - if (index == (alphaData[i] & 0xff)) break; + if (index is (alphaData[i] & 0xff)) break; } if (i < alphaData.length) continue; } break; case ALPHA_MASK_RGB: { int i = 0; while (i < alphaData.length) { - if ((r == (alphaData[i] & 0xff)) && - (g == (alphaData[i + 1] & 0xff)) && - (b == (alphaData[i + 2] & 0xff))) break; + if ((r is (alphaData[i] & 0xff)) && + (g is (alphaData[i + 1] & 0xff)) && + (b is (alphaData[i + 2] & 0xff))) break; i += 3; } if (i < alphaData.length) continue; } break; default: } - if (alpha != 0x10000) { - if (alpha == 0x0000) continue; + if (alpha !is 0x10000) { + if (alpha is 0x0000) continue; switch (dtype) { case TYPE_GENERIC_8: { int data = destData[dp] & 0xff; @@ -3097,16 +3097,16 @@ static_this(); - if ((destWidth <= 0) || (destHeight <= 0) || (alphaMode == ALPHA_TRANSPARENT)) return; + if ((destWidth <= 0) || (destHeight <= 0) || (alphaMode is ALPHA_TRANSPARENT)) return; // these should be supplied as params later int srcAlphaMask = 0; /*** Prepare scaling data ***/ int dwm1 = destWidth - 1; - int sfxi = (dwm1 != 0) ? cast(int)(((cast(long)srcWidth << 16) - 1) / dwm1) : 0; + int sfxi = (dwm1 !is 0) ? cast(int)(((cast(long)srcWidth << 16) - 1) / dwm1) : 0; int dhm1 = destHeight - 1; - int sfyi = (dhm1 != 0) ? cast(int)(((cast(long)srcHeight << 16) - 1) / dhm1) : 0; + int sfyi = (dhm1 !is 0) ? cast(int)(((cast(long)srcHeight << 16) - 1) / dhm1) : 0; /*** Prepare source-related data ***/ int sbpp, stype; @@ -3117,7 +3117,7 @@ break; case 16: sbpp = 2; - stype = (srcOrder == MSB_FIRST) ? TYPE_GENERIC_16_MSB : TYPE_GENERIC_16_LSB; + stype = (srcOrder is MSB_FIRST) ? TYPE_GENERIC_16_MSB : TYPE_GENERIC_16_LSB; break; case 24: sbpp = 3; @@ -3125,7 +3125,7 @@ break; case 32: sbpp = 4; - stype = (srcOrder == MSB_FIRST) ? TYPE_GENERIC_32_MSB : TYPE_GENERIC_32_LSB; + stype = (srcOrder is MSB_FIRST) ? TYPE_GENERIC_32_MSB : TYPE_GENERIC_32_LSB; break; default: //throw new IllegalArgumentException("Invalid source type"); @@ -3149,7 +3149,7 @@ break; case 1: destStride <<= 3; - dtype = (destOrder == MSB_FIRST) ? TYPE_INDEX_1_MSB : TYPE_INDEX_1_LSB; + dtype = (destOrder is MSB_FIRST) ? TYPE_INDEX_1_MSB : TYPE_INDEX_1_LSB; break; default: //throw new IllegalArgumentException("Invalid source type"); @@ -3161,15 +3161,15 @@ /*** Prepare special processing data ***/ int apr; - if ((op & BLIT_ALPHA) != 0) { + if ((op & BLIT_ALPHA) !is 0) { switch (alphaMode) { case ALPHA_MASK_UNPACKED: case ALPHA_CHANNEL_SEPARATE: - if (alphaData == null) alphaMode = 0x10000; + if (alphaData is null) alphaMode = 0x10000; apr = alphaY * alphaStride + alphaX; break; case ALPHA_MASK_PACKED: - if (alphaData == null) alphaMode = 0x10000; + if (alphaData is null) alphaMode = 0x10000; alphaStride <<= 3; apr = alphaY * alphaStride + alphaX; break; @@ -3177,7 +3177,7 @@ //throw new IllegalArgumentException("Invalid alpha type"); return; case ALPHA_MASK_RGB: - if (alphaData == null) alphaMode = 0x10000; + if (alphaData is null) alphaMode = 0x10000; apr = 0; break; default: @@ -3190,7 +3190,7 @@ alphaMode = 0x10000; apr = 0; } - bool ditherEnabled = (op & BLIT_DITHER) != 0; + bool ditherEnabled = (op & BLIT_DITHER) !is 0; /*** Comprehensive blit (apply transformations) ***/ int srcRedShift = getChannelShift(srcRedMask); @@ -3210,7 +3210,7 @@ int lastindex = 0, lastr = -1, lastg = -1, lastb = -1; int[] rerr, gerr, berr; int destPaletteSize = 1 << destDepth; - if ((destReds != null) && (destReds.length < destPaletteSize)) destPaletteSize = destReds.length; + if ((destReds !is null) && (destReds.length < destPaletteSize)) destPaletteSize = destReds.length; if (ditherEnabled) { rerr = new int[destWidth + 2]; gerr = new int[destWidth + 2]; @@ -3298,7 +3298,7 @@ alpha = (a << 16) / 255; break; case ALPHA_MASK_UNPACKED: - alpha = (alphaData[ap] != 0) ? 0x10000 : 0; + alpha = (alphaData[ap] !is 0) ? 0x10000 : 0; ap += (sfx >> 16); break; case ALPHA_MASK_PACKED: @@ -3308,7 +3308,7 @@ case ALPHA_MASK_RGB: alpha = 0x10000; for (int i = 0; i < alphaData.length; i += 3) { - if ((r == alphaData[i]) && (g == alphaData[i + 1]) && (b == alphaData[i + 2])) { + if ((r is alphaData[i]) && (g is alphaData[i + 1]) && (b is alphaData[i + 2])) { alpha = 0x0000; break; } @@ -3316,14 +3316,14 @@ break; default: } - if (alpha != 0x10000) { - if (alpha == 0x0000) continue; + if (alpha !is 0x10000) { + if (alpha is 0x0000) continue; switch (dtype) { case TYPE_INDEX_8: indexq = destData[dp] & 0xff; break; case TYPE_INDEX_4: - if ((dp & 1) != 0) indexq = destData[dp >> 1] & 0x0f; + if ((dp & 1) !is 0) indexq = destData[dp >> 1] & 0x0f; else indexq = (destData[dp >> 1] >>> 4) & 0x0f; break; case TYPE_INDEX_2: @@ -3359,7 +3359,7 @@ gerr[dx] = lgerr; berr[dx] = lberr; } - if (r != lastr || g != lastg || b != lastb) { + if (r !is lastr || g !is lastg || b !is lastb) { // moving the variable declarations out seems to make the JDK JIT happier... for (int j = 0, dr, dg, db, distance, minDistance = 0x7fffffff; j < destPaletteSize; ++j) { dr = (destReds[j] & 0xff) - r; @@ -3368,7 +3368,7 @@ distance = dr * dr + dg * dg + db * db; if (distance < minDistance) { lastindex = j; - if (distance == 0) break; + if (distance is 0) break; minDistance = distance; } } @@ -3395,7 +3395,7 @@ destData[dp] = cast(byte) lastindex; break; case TYPE_INDEX_4: - if ((dp & 1) != 0) destData[dp >> 1] = cast(byte)((destData[dp >> 1] & 0xf0) | lastindex); + if ((dp & 1) !is 0) destData[dp >> 1] = cast(byte)((destData[dp >> 1] & 0xf0) | lastindex); else destData[dp >> 1] = cast(byte)((destData[dp >> 1] & 0x0f) | (lastindex << 4)); break; case TYPE_INDEX_2: { @@ -3420,9 +3420,9 @@ * Computes the required channel shift from a mask. */ static int getChannelShift(int mask) { - if (mask == 0) return 0; + if (mask is 0) return 0; int i; - for (i = 0; ((mask & 1) == 0) && (i < 32); ++i) { + for (i = 0; ((mask & 1) is 0) && (i < 32); ++i) { mask >>>= 1; } return i; @@ -3432,10 +3432,10 @@ * Computes the required channel width (depth) from a mask. */ static int getChannelWidth(int mask, int shift) { - if (mask == 0) return 0; + if (mask is 0) return 0; int i; mask >>>= shift; - for (i = shift; ((mask & 1) != 0) && (i < 32); ++i) { + for (i = shift; ((mask & 1) !is 0) && (i < 32); ++i) { mask >>>= 1; } return i - shift; @@ -3475,7 +3475,7 @@ byte[] bitmapData; PaletteData paletteData; /* Select an algorithm depending on the depth of the screen */ - if (redBits != 0 && greenBits != 0 && blueBits != 0) { + if (redBits !is 0 && greenBits !is 0 && blueBits !is 0) { paletteData = new PaletteData(0x0000ff00, 0x00ff0000, 0xff000000); bitmapDepth = 32; if (redBits >= 8 && greenBits >= 8 && blueBits >= 8) { @@ -3630,7 +3630,7 @@ ImageData band = createGradientBand(width, height, vertical, fromRGB, toRGB, redBits, greenBits, blueBits); Image image = new Image(device, band); - if ((band.width == 1) || (band.height == 1)) { + if ((band.width is 1) || (band.height is 1)) { gc.drawImage(image, 0, 0, band.width, band.height, x, y, width, height); } else { if (vertical) {
--- a/dwt/internal/image/FileFormat.d Sat Feb 09 21:22:47 2008 +0100 +++ b/dwt/internal/image/FileFormat.d Sun Feb 10 04:19:19 2008 +0100 @@ -67,7 +67,7 @@ } catch (IOException e) { DWT.error(DWT.ERROR_IO, e); return null; - } catch (TracedException e) { + } catch (Exception e) { DWT.error(DWT.ERROR_INVALID_IMAGE, e); return null; } @@ -88,7 +88,7 @@ isSupported = true; break; } - } catch (TracedException e) { + } catch (Exception e) { } } if (!isSupported) DWT.error(DWT.ERROR_UNSUPPORTED_FORMAT); @@ -113,7 +113,7 @@ fileFormat = new TFormat(); } } - } catch (TracedException e) { + } catch (Exception e) { DWT.error(DWT.ERROR_UNSUPPORTED_FORMAT); } if (format is DWT.IMAGE_BMP_RLE) { @@ -137,7 +137,7 @@ outputStream = stream; unloadIntoByteStream(loader); outputStream.flush(); - } catch (TracedException e) { + } catch (Exception e) { try {outputStream.flush();} catch (Exception f) {} DWT.error(DWT.ERROR_IO, e); }
--- a/dwt/internal/image/GIFFileFormat.d Sat Feb 09 21:22:47 2008 +0100 +++ b/dwt/internal/image/GIFFileFormat.d Sun Feb 10 04:19:19 2008 +0100 @@ -233,7 +233,7 @@ size = inputStream.read(); } return comment; - } catch (TracedException e) { + } catch (Exception e) { DWT.error(DWT.ERROR_IO, e); return null; } @@ -264,7 +264,7 @@ size = inputStream.read(); } return text; - } catch (TracedException e) { + } catch (Exception e) { DWT.error(DWT.ERROR_IO, e); return null; } @@ -298,7 +298,7 @@ // Read block terminator. inputStream.read(); return controlBlock; - } catch (TracedException e) { + } catch (Exception e) { DWT.error(DWT.ERROR_IO, e); return null; } @@ -339,7 +339,7 @@ loader.repeatCount = repeatCount; } return data; - } catch (TracedException e) { + } catch (Exception e) { DWT.error(DWT.ERROR_IO, e); return null; }
--- a/dwt/internal/image/JPEGDecoder.d Sat Feb 09 21:22:47 2008 +0100 +++ b/dwt/internal/image/JPEGDecoder.d Sun Feb 10 04:19:19 2008 +0100 @@ -6332,7 +6332,7 @@ stream.read(buffer); stream.unread(buffer); return (buffer[0] & 0xFF) is 0xFF && (buffer[1] & 0xFF) is M_SOI; - } catch (TracedException e) { + } catch (Exception e) { return false; } }
--- a/dwt/internal/image/JPEGFileFormat.d Sat Feb 09 21:22:47 2008 +0100 +++ b/dwt/internal/image/JPEGFileFormat.d Sun Feb 10 04:19:19 2008 +0100 @@ -1374,7 +1374,7 @@ JPEGStartOfImage soi = new JPEGStartOfImage(stream); stream.unread(soi.reference); return soi.verify(); // we no longer check for appN - } catch (TracedException e) { + } catch (Exception e) { return false; } } @@ -1747,7 +1747,7 @@ } int delta = jpegSegment.getSegmentLength() - 2; byteStream.skip(delta); - } catch (TracedException e) { + } catch (Exception e) { DWT.error(DWT.ERROR_IO, e); } }
--- a/dwt/internal/image/JPEGFixedSizeSegment.d Sat Feb 09 21:22:47 2008 +0100 +++ b/dwt/internal/image/JPEGFixedSizeSegment.d Sun Feb 10 04:19:19 2008 +0100 @@ -35,7 +35,7 @@ reference = new byte[fixedSize()]; try { byteStream.read(reference); - } catch (TracedException e) { + } catch (Exception e) { DWT.error(DWT.ERROR_IO, e); } }
--- a/dwt/internal/image/JPEGSegment.d Sat Feb 09 21:22:47 2008 +0100 +++ b/dwt/internal/image/JPEGSegment.d Sun Feb 10 04:19:19 2008 +0100 @@ -56,7 +56,7 @@ try { byteStream.write(reference); return true; - } catch (TracedException e) { + } catch (Exception e) { return false; } }
--- a/dwt/internal/image/JPEGVariableSizeSegment.d Sat Feb 09 21:22:47 2008 +0100 +++ b/dwt/internal/image/JPEGVariableSizeSegment.d Sun Feb 10 04:19:19 2008 +0100 @@ -36,7 +36,7 @@ contents[3] = header[3]; byteStream.read(contents, 4, contents.length - 4); reference = contents; - } catch (TracedException e) { + } catch (Exception e) { DWT.error(DWT.ERROR_IO, e); } }
--- a/dwt/internal/image/LZWCodec.d Sat Feb 09 21:22:47 2008 +0100 +++ b/dwt/internal/image/LZWCodec.d Sun Feb 10 04:19:19 2008 +0100 @@ -467,7 +467,7 @@ if (size is -1) { DWT.error(DWT.ERROR_INVALID_IMAGE); } - } catch (TracedException e) { + } catch (Exception e) { DWT.error(DWT.ERROR_IO, e); } return size; @@ -479,7 +479,7 @@ void writeBlock() { try { outputStream.write(block, 0, (block[0] & 0xFF) + 1); - } catch (TracedException e) { + } catch (Exception e) { DWT.error(DWT.ERROR_IO, e); } }
--- a/dwt/internal/image/OS2BMPFileFormat.d Sat Feb 09 21:22:47 2008 +0100 +++ b/dwt/internal/image/OS2BMPFileFormat.d Sun Feb 10 04:19:19 2008 +0100 @@ -35,7 +35,7 @@ stream.unread(header); int infoHeaderSize = (header[14] & 0xFF) | ((header[15] & 0xFF) << 8) | ((header[16] & 0xFF) << 16) | ((header[17] & 0xFF) << 24); return header[0] is 0x42 && header[1] is 0x4D && infoHeaderSize is BMPHeaderFixedSize; - } catch (TracedException e) { + } catch (Exception e) { return false; } } @@ -77,7 +77,7 @@ byte[] infoHeader = new byte[BMPHeaderFixedSize]; try { inputStream.read(infoHeader); - } catch (TracedException e) { + } catch (Exception e) { DWT.error(DWT.ERROR_IO, e); } width = (infoHeader[4] & 0xFF) | ((infoHeader[5] & 0xFF) << 8);
--- a/dwt/internal/image/TIFFFileFormat.d Sat Feb 09 21:22:47 2008 +0100 +++ b/dwt/internal/image/TIFFFileFormat.d Sun Feb 10 04:19:19 2008 +0100 @@ -38,7 +38,7 @@ return false; } return true; - } catch (TracedException e) { + } catch (Exception e) { return false; } }
--- a/dwt/internal/image/WinBMPFileFormat.d Sat Feb 09 21:22:47 2008 +0100 +++ b/dwt/internal/image/WinBMPFileFormat.d Sun Feb 10 04:19:19 2008 +0100 @@ -338,7 +338,7 @@ stream.unread(header); int infoHeaderSize = (header[14] & 0xFF) | ((header[15] & 0xFF) << 8) | ((header[16] & 0xFF) << 16) | ((header[17] & 0xFF) << 24); return header[0] is 0x42 && header[1] is 0x4D && infoHeaderSize >= BMPHeaderFixedSize; - } catch (TracedException e) { + } catch (Exception e) { return false; } } @@ -398,7 +398,7 @@ byte[] infoHeader = new byte[BMPHeaderFixedSize]; try { inputStream.read(infoHeader); - } catch (TracedException e) { + } catch (Exception e) { DWT.error(DWT.ERROR_IO, e); } int width = (infoHeader[4] & 0xFF) | ((infoHeader[5] & 0xFF) << 8) | ((infoHeader[6] & 0xFF) << 16) | ((infoHeader[7] & 0xFF) << 24);
--- a/dwt/printing/PrintDialog.d Sat Feb 09 21:22:47 2008 +0100 +++ b/dwt/printing/PrintDialog.d Sun Feb 10 04:19:19 2008 +0100 @@ -302,7 +302,7 @@ printToFile = ( data.name ==/*eq*/ "Print to File" ); //$NON-NLS-1$ if (printToFile) { auto address = OS.gtk_print_settings_get(settings, OS.GTK_PRINT_SETTINGS_OUTPUT_URI.ptr); - data.fileName = tango.stdc.stringz.fromUtf8z( address).dup; + data.fileName = tango.stdc.stringz.fromStringz( address).dup; } data.scope_ = scope_; @@ -349,7 +349,7 @@ } void GtkPrintSettingsMeth (char* key, char* value) { - store( tango.stdc.stringz.fromUtf8z(key).dup, tango.stdc.stringz.fromUtf8z(value).dup ); + store( tango.stdc.stringz.fromStringz(key).dup, tango.stdc.stringz.fromStringz(value).dup ); } void store(char[] key, int value) { @@ -365,7 +365,7 @@ } void storeBytes(char[] key, char* value) { - store(key, tango.stdc.stringz.fromUtf8z(value).dup ); + store(key, tango.stdc.stringz.fromStringz(value).dup ); } void store(char [] key, char[] value) {
--- a/dwt/printing/Printer.d Sat Feb 09 21:22:47 2008 +0100 +++ b/dwt/printing/Printer.d Sun Feb 10 04:19:19 2008 +0100 @@ -155,10 +155,10 @@ static PrinterData printerDataFromGtkPrinter(GtkPrinter* printer) { auto backend = OS.gtk_printer_get_backend(printer); auto address = OS.G_OBJECT_TYPE_NAME(backend); - char[] backendType =tango.stdc.stringz.fromUtf8z( address ).dup; + char[] backendType =tango.stdc.stringz.fromStringz( address ).dup; address = OS.gtk_printer_get_name (printer); - char[] name =tango.stdc.stringz.fromUtf8z( address ).dup; + char[] name =tango.stdc.stringz.fromStringz( address ).dup; return new PrinterData (backendType, name); }
--- a/dwt/widgets/Combo.d Sat Feb 09 21:22:47 2008 +0100 +++ b/dwt/widgets/Combo.d Sun Feb 10 04:19:19 2008 +0100 @@ -364,7 +364,7 @@ GtkTreeIter iter; OS.gtk_tree_model_iter_nth_child (modelHandle, &iter, null, index); OS.gtk_tree_model_get1 (modelHandle, &iter, 0, cast(void**)&ptr ); - if (fromUtf8z(ptr).length > 0) postEvent (DWT.Modify); + if (fromStringz(ptr).length > 0) postEvent (DWT.Modify); OS.g_free (ptr); } } else { @@ -941,7 +941,7 @@ if (entryHandle !is null) { auto str = OS.gtk_entry_get_text (entryHandle); if (str is null) return ""; - return fromUtf8z(str).dup; + return fromStringz(str).dup; } else { int index = OS.gtk_combo_box_get_active (handle); return index !is -1 ? getItem (index) : ""; @@ -1047,7 +1047,7 @@ } else { if (!ignoreSelect) { auto ptr = OS.gtk_entry_get_text (entryHandle); - char[] text = fromUtf8z(ptr).dup; + char[] text = fromStringz(ptr).dup; for (int i = 0; i < items.length; i++) { if (items [i] ==/*eq*/ text) { postEvent (DWT.Selection); @@ -1086,7 +1086,7 @@ override int gtk_commit (GtkIMContext* imContext, char* text) { if (text is null) return 0; if (!OS.gtk_editable_get_editable (entryHandle)) return 0; - char [] chars = fromUtf8z(text); + char [] chars = fromStringz(text); if (chars.length is 0) return 0; char [] newChars = sendIMKeyEvent (DWT.KeyDown, null, chars); if (newChars is null) return 0; @@ -1160,7 +1160,7 @@ pos = position; if (pos is -1) { auto ptr = OS.gtk_entry_get_text (entryHandle); - pos = fromUtf8z(ptr).length; + pos = fromStringz(ptr).length; } char[] newText = verifyText (oldText, pos, pos); if (newText !is oldText) { @@ -1927,7 +1927,7 @@ char* preeditString; OS.gtk_im_context_get_preedit_string (imContext, &preeditString, null, null); if (preeditString !is null) { - int length = fromUtf8z(preeditString).length; + int length = fromStringz(preeditString).length; OS.g_free (preeditString); if (length !is 0) return false; }
--- a/dwt/widgets/Control.d Sat Feb 09 21:22:47 2008 +0100 +++ b/dwt/widgets/Control.d Sun Feb 10 04:19:19 2008 +0100 @@ -181,10 +181,10 @@ if (control.setFocus ()) return; } shell.setSavedFocus (focusControl); - auto focusHandle = shell.vboxHandle; - OS.GTK_WIDGET_SET_FLAGS (focusHandle, OS.GTK_CAN_FOCUS); - OS.gtk_widget_grab_focus (focusHandle); - OS.GTK_WIDGET_UNSET_FLAGS (focusHandle, OS.GTK_CAN_FOCUS); + auto focusHandle_ = shell.vboxHandle; + OS.GTK_WIDGET_SET_FLAGS (focusHandle_, OS.GTK_CAN_FOCUS); + OS.gtk_widget_grab_focus (focusHandle_); + OS.GTK_WIDGET_UNSET_FLAGS (focusHandle_, OS.GTK_CAN_FOCUS); } public void fixStyle () { @@ -226,16 +226,16 @@ override void hookEvents () { /* Connect the keyboard signals */ - auto focusHandle = focusHandle (); + auto focusHandle_ = focusHandle (); int focusMask = OS.GDK_KEY_PRESS_MASK | OS.GDK_KEY_RELEASE_MASK | OS.GDK_FOCUS_CHANGE_MASK; - OS.gtk_widget_add_events (focusHandle, focusMask); - OS.g_signal_connect_closure_by_id (focusHandle, display.signalIds [POPUP_MENU], 0, display.closures [POPUP_MENU], false); - OS.g_signal_connect_closure_by_id (focusHandle, display.signalIds [SHOW_HELP], 0, display.closures [SHOW_HELP], false); - OS.g_signal_connect_closure_by_id (focusHandle, display.signalIds [KEY_PRESS_EVENT], 0, display.closures [KEY_PRESS_EVENT], false); - OS.g_signal_connect_closure_by_id (focusHandle, display.signalIds [KEY_RELEASE_EVENT], 0, display.closures [KEY_RELEASE_EVENT], false); - OS.g_signal_connect_closure_by_id (focusHandle, display.signalIds [FOCUS], 0, display.closures [FOCUS], false); - OS.g_signal_connect_closure_by_id (focusHandle, display.signalIds [FOCUS_IN_EVENT], 0, display.closures [FOCUS_IN_EVENT], false); - OS.g_signal_connect_closure_by_id (focusHandle, display.signalIds [FOCUS_OUT_EVENT], 0, display.closures [FOCUS_OUT_EVENT], false); + OS.gtk_widget_add_events (focusHandle_, focusMask); + OS.g_signal_connect_closure_by_id (focusHandle_, display.signalIds [POPUP_MENU], 0, display.closures [POPUP_MENU], false); + OS.g_signal_connect_closure_by_id (focusHandle_, display.signalIds [SHOW_HELP], 0, display.closures [SHOW_HELP], false); + OS.g_signal_connect_closure_by_id (focusHandle_, display.signalIds [KEY_PRESS_EVENT], 0, display.closures [KEY_PRESS_EVENT], false); + OS.g_signal_connect_closure_by_id (focusHandle_, display.signalIds [KEY_RELEASE_EVENT], 0, display.closures [KEY_RELEASE_EVENT], false); + OS.g_signal_connect_closure_by_id (focusHandle_, display.signalIds [FOCUS], 0, display.closures [FOCUS], false); + OS.g_signal_connect_closure_by_id (focusHandle_, display.signalIds [FOCUS_IN_EVENT], 0, display.closures [FOCUS_IN_EVENT], false); + OS.g_signal_connect_closure_by_id (focusHandle_, display.signalIds [FOCUS_OUT_EVENT], 0, display.closures [FOCUS_OUT_EVENT], false); /* Connect the mouse signals */ auto eventHandle = eventHandle (); @@ -271,8 +271,8 @@ /* Connect the event_after signal for both key and mouse */ OS.g_signal_connect_closure_by_id (eventHandle, display.signalIds [EVENT_AFTER], 0, display.closures [EVENT_AFTER], false); - if (focusHandle !is eventHandle) { - OS.g_signal_connect_closure_by_id (focusHandle, display.signalIds [EVENT_AFTER], 0, display.closures [EVENT_AFTER], false); + if (focusHandle_ !is eventHandle) { + OS.g_signal_connect_closure_by_id (focusHandle_, display.signalIds [EVENT_AFTER], 0, display.closures [EVENT_AFTER], false); } /* Connect the paint signal */ @@ -1960,15 +1960,15 @@ return forceFocus (focusHandle ()); } -bool forceFocus (GtkWidget* focusHandle) { +bool forceFocus (GtkWidget* focusHandle_) { /* When the control is zero sized it must be realized */ - OS.gtk_widget_realize (focusHandle); - OS.gtk_widget_grab_focus (focusHandle); + OS.gtk_widget_realize (focusHandle_); + OS.gtk_widget_grab_focus (focusHandle_); Shell shell = getShell (); auto shellHandle = shell.shellHandle; auto handle = OS.gtk_window_get_focus (cast(GtkWindow*)shellHandle); while (handle !is null) { - if (handle is focusHandle) return true; + if (handle is focusHandle_) return true; Widget widget = display.getWidget (handle); if (widget !is null && (null !is cast(Control)widget)) { return widget is this; @@ -2019,18 +2019,18 @@ } GdkColor* getBgColor () { - auto fontHandle = fontHandle (); - OS.gtk_widget_realize (fontHandle); + auto fontHandle_ = fontHandle (); + OS.gtk_widget_realize (fontHandle_); GdkColor* color = new GdkColor (); - OS.gtk_style_get_bg (OS.gtk_widget_get_style (fontHandle), OS.GTK_STATE_NORMAL, color); + OS.gtk_style_get_bg (OS.gtk_widget_get_style (fontHandle_), OS.GTK_STATE_NORMAL, color); return color; } GdkColor* getBaseColor () { - auto fontHandle = fontHandle (); - OS.gtk_widget_realize (fontHandle); + auto fontHandle_ = fontHandle (); + OS.gtk_widget_realize (fontHandle_); GdkColor* color = new GdkColor (); - OS.gtk_style_get_base (OS.gtk_widget_get_style (fontHandle), OS.GTK_STATE_NORMAL, color); + OS.gtk_style_get_base (OS.gtk_widget_get_style (fontHandle_), OS.GTK_STATE_NORMAL, color); return color; } @@ -2123,9 +2123,9 @@ } PangoFontDescription* getFontDescription () { - auto fontHandle = fontHandle (); - OS.gtk_widget_realize (fontHandle); - return OS.gtk_style_get_font_desc (OS.gtk_widget_get_style (fontHandle)); + auto fontHandle_ = fontHandle (); + OS.gtk_widget_realize (fontHandle_); + return OS.gtk_style_get_font_desc (OS.gtk_widget_get_style (fontHandle_)); } /** @@ -2148,10 +2148,10 @@ } GdkColor* getFgColor () { - auto fontHandle = fontHandle (); - OS.gtk_widget_realize (fontHandle); + auto fontHandle_ = fontHandle (); + OS.gtk_widget_realize (fontHandle_); GdkColor* color = new GdkColor (); - OS.gtk_style_get_fg (OS.gtk_widget_get_style (fontHandle), OS.GTK_STATE_NORMAL, color); + OS.gtk_style_get_fg (OS.gtk_widget_get_style (fontHandle_), OS.GTK_STATE_NORMAL, color); return color; } @@ -2160,10 +2160,10 @@ } GdkColor* getTextColor () { - auto fontHandle = fontHandle (); - OS.gtk_widget_realize (fontHandle); + auto fontHandle_ = fontHandle (); + OS.gtk_widget_realize (fontHandle_); GdkColor* color = new GdkColor (); - OS.gtk_style_get_text (OS.gtk_widget_get_style (fontHandle), OS.GTK_STATE_NORMAL, color); + OS.gtk_style_get_text (OS.gtk_widget_get_style (fontHandle_), OS.GTK_STATE_NORMAL, color); return color; } @@ -2418,7 +2418,7 @@ } override int /*long*/ gtk_commit (GtkIMContext* imcontext, char* text) { - char [] chars = fromUtf8z( text ); + char [] chars = fromStringz( text ); if (chars.length is 0) return 0; sendIMKeyEvent (DWT.KeyDown, null, chars); return 0; @@ -2593,10 +2593,10 @@ GdkEventKey* keyEvent = cast(GdkEventKey*)eventPtr; if (keyEvent.type is OS.GDK_KEY_PRESS) { Control focusControl = display.getFocusControl (); - auto focusHandle = focusControl !is null ? focusControl.focusHandle () : null; - if (focusHandle !is null) { + auto focusHandle_ = focusControl !is null ? focusControl.focusHandle () : null; + if (focusHandle_ !is null) { display.mnemonicControl = this; - OS.gtk_widget_event (focusHandle, eventPtr); + OS.gtk_widget_event (focusHandle_, eventPtr); display.mnemonicControl = null; } result = 1;
--- a/dwt/widgets/Display.d Sat Feb 09 21:22:47 2008 +0100 +++ b/dwt/widgets/Display.d Sun Feb 10 04:19:19 2008 +0100 @@ -912,7 +912,7 @@ OS.XSetErrorHandler( &Display.XErrorHandler ); char* ptr = OS.gtk_check_version (MAJOR, MINOR, MICRO); if (ptr !is null) { - char [] buffer = fromUtf8z(ptr); + char [] buffer = fromStringz(ptr); Stdout.formatln ("***WARNING: {}", buffer ); Stdout.formatln ("***WARNING: DWT requires GTK {}.{}.{}", MAJOR, MINOR, MICRO ); int major = OS.gtk_major_version (), minor = OS.gtk_minor_version (), micro = OS.gtk_micro_version (); @@ -2491,7 +2491,7 @@ auto screen = OS.gdk_screen_get_default (); if (screen !is null) { auto ptr2 = OS.gdk_x11_screen_get_window_manager_name (screen); - windowManager = fromUtf8z( ptr2 ); + windowManager = fromStringz( ptr2 ); } } }
--- a/dwt/widgets/FileDialog.d Sat Feb 09 21:22:47 2008 +0100 +++ b/dwt/widgets/FileDialog.d Sun Feb 10 04:19:19 2008 +0100 @@ -153,7 +153,7 @@ GtkFileSelection* selection = cast(GtkFileSelection*)handle; auto entry = selection.selection_entry; auto entryText = OS.gtk_entry_get_text (entry); - char[] txt = tango.stdc.stringz.fromUtf8z( entryText ); + char[] txt = tango.stdc.stringz.fromStringz( entryText ); if (txt.length is 0) { auto fileList = selection.file_list; auto listSelection = OS.gtk_tree_view_get_selection (fileList);
--- a/dwt/widgets/Item.d Sat Feb 09 21:22:47 2008 +0100 +++ b/dwt/widgets/Item.d Sun Feb 10 04:19:19 2008 +0100 @@ -181,7 +181,7 @@ public void setText (char[] string) { checkWidget (); if (string is null) error (DWT.ERROR_NULL_ARGUMENT); - text = string; + text = string.dup; } }
--- a/dwt/widgets/List.d Sat Feb 09 21:22:47 2008 +0100 +++ b/dwt/widgets/List.d Sun Feb 10 04:19:19 2008 +0100 @@ -453,7 +453,7 @@ OS.gtk_tree_model_iter_nth_child (cast(GtkTreeStore*)modelHandle, &iter, null, index); OS.gtk_tree_model_get1 (cast(GtkTreeStore*)modelHandle, &iter, 0, cast(void**)&ptr ); if (ptr is null) return null; - char[] res = fromUtf8z( ptr ).dup; + char[] res = fromStringz( ptr ).dup; OS.g_free (ptr); return res; } @@ -528,7 +528,7 @@ OS.gtk_tree_model_iter_nth_child (cast(GtkTreeStore*)modelHandle, &iter, null, index); OS.gtk_tree_model_get1 (cast(GtkTreeStore*)modelHandle, &iter, 0, cast(void**)&ptr); if (ptr !is null) { - char[] res = fromUtf8z( ptr ).dup; + char[] res = fromStringz( ptr ).dup; OS.g_free (ptr); result [index] = res; }
--- a/dwt/widgets/MenuItem.d Sat Feb 09 21:22:47 2008 +0100 +++ b/dwt/widgets/MenuItem.d Sun Feb 10 04:19:19 2008 +0100 @@ -29,8 +29,8 @@ import dwt.widgets.Event; import dwt.widgets.Display; +import dwt.dwthelper.utils; import tango.stdc.stringz; -import tango.text.Util; /** * Instances of this class represent a selectable user interface object @@ -790,10 +790,10 @@ public void setSelection (bool selected) { checkWidget(); if ((style & (DWT.CHECK | DWT.RADIO)) is 0) return; - OS.g_signal_handlers_block_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)ACTIVATE); + OS.g_signal_handlers_block_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udACTIVATE); OS.gtk_check_menu_item_set_active (cast(GtkCheckMenuItem*)handle, selected); if ((style & DWT.RADIO) !is 0) OS.gtk_check_menu_item_set_active (cast(GtkCheckMenuItem*)groupHandle, !selected); - OS.g_signal_handlers_unblock_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)ACTIVATE); + OS.g_signal_handlers_unblock_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udACTIVATE); } /** @@ -837,14 +837,13 @@ checkWidget(); if (string is null) error (DWT.ERROR_NULL_ARGUMENT); if ((style & DWT.SEPARATOR) !is 0) return; - if (text ==/*eq*/ string) return; + if (text.equals(string)) return; super.setText (string); char[] accelString = ""; - int index = locate( string, '\t'); - if( index == string.length ) index = -1; + int index = string.indexOf ('\t'); if (index !is -1) { - accelString = string[ index .. string.length ]; - string = string[ 0 .. index ]; + accelString = string.substring (index, string.length); + string = string.substring (0, index); } char [] chars = fixMnemonic (string); char* buffer = toStringz( chars );
--- a/dwt/widgets/ProgressBar.d Sat Feb 09 21:22:47 2008 +0100 +++ b/dwt/widgets/ProgressBar.d Sun Feb 10 04:19:19 2008 +0100 @@ -23,6 +23,11 @@ import dwt.widgets.Display; import Math = tango.math.Math; +import tango.io.Stdout; + +void trc( int line ){ + Stdout.formatln( "ProgressBar {}", line ).flush; +} /** * Instances of the receiver represent an unselectable @@ -86,6 +91,7 @@ } override void createHandle (int index) { +trc( __LINE__ ); state |= HANDLE; fixedHandle = cast(GtkWidget*)OS.g_object_new (display.gtk_fixed_get_type (), null); if (fixedHandle is null) error (DWT.ERROR_NO_HANDLES); @@ -93,11 +99,12 @@ handle = OS.gtk_progress_bar_new (); if (handle is null) error (DWT.ERROR_NO_HANDLES); OS.gtk_container_add (fixedHandle, handle); - int orientation = (style & DWT.VERTICAL) !is 0 ? OS.GTK_PROGRESS_BOTTOM_TO_TOP : OS.GTK_PROGRESS_LEFT_TO_RIGHT; + int orientation = ((style & DWT.VERTICAL) !is 0 ) ? OS.GTK_PROGRESS_BOTTOM_TO_TOP : OS.GTK_PROGRESS_LEFT_TO_RIGHT; OS.gtk_progress_bar_set_orientation (handle, orientation); if ((style & DWT.INDETERMINATE) !is 0) { timerId = display.doWindowTimerAdd( &callbackData, DELAY, handle ); } +trc( __LINE__ ); } /** @@ -111,6 +118,7 @@ * </ul> */ public int getMaximum () { +trc( __LINE__ ); checkWidget (); return maximum; } @@ -126,7 +134,8 @@ * </ul> */ public int getMinimum () { - checkWidget (); + trc( __LINE__ ); +checkWidget (); return minimum; } @@ -141,11 +150,13 @@ * </ul> */ public int getSelection () { +trc( __LINE__ ); checkWidget (); return selection; } override int gtk_realize (GtkWidget* widget) { +trc( __LINE__ ); int result = super.gtk_realize (widget); if (result !is 0) return result; /* @@ -159,12 +170,14 @@ } override void releaseWidget () { +trc( __LINE__ ); super.releaseWidget (); if (timerId !is 0) OS.gtk_timeout_remove (timerId); timerId = 0; } override void setParentBackground () { +trc( __LINE__ ); /* * Bug in GTK. For some reason, some theme managers will crash * when the progress bar is inheriting the background from a parent. @@ -187,6 +200,7 @@ * </ul> */ public void setMaximum (int value) { +trc( __LINE__ ); checkWidget (); if (value <= minimum) return; maximum = value; @@ -208,6 +222,7 @@ * </ul> */ public void setMinimum (int value) { +trc( __LINE__ ); checkWidget (); if (value < 0 || value >= maximum) return; minimum = value; @@ -228,18 +243,23 @@ * </ul> */ public void setSelection (int value) { +trc( __LINE__ ); checkWidget (); selection = Math.max (minimum, Math.min (maximum, value)); updateBar (selection, minimum, maximum); + trc( __LINE__ ); } override int /*long*/ timerProc (GtkWidget* widget) { +trc( __LINE__ ); if (isVisible ()) OS.gtk_progress_bar_pulse (handle); + trc( __LINE__ ); return 1; } void updateBar (int selection, int minimum, int maximum) { - /* + trc( __LINE__ ); + /* * Bug in GTK. When a progress bar has been unrealized after being * realized at least once, gtk_progress_bar_set_fraction() GP's. The * fix is to update the progress bar state only when realized and restore @@ -259,5 +279,6 @@ auto window = paintWindow (); OS.gdk_window_process_updates (window, false); OS.gdk_flush (); + trc( __LINE__ ); } }
--- a/dwt/widgets/RunnableLock.d Sat Feb 09 21:22:47 2008 +0100 +++ b/dwt/widgets/RunnableLock.d Sun Feb 10 04:19:19 2008 +0100 @@ -28,7 +28,7 @@ class RunnableLock : Mutex { Runnable runnable; Thread thread; - TracedException throwable; + Exception throwable; Condition cond;
--- a/dwt/widgets/Scale.d Sat Feb 09 21:22:47 2008 +0100 +++ b/dwt/widgets/Scale.d Sun Feb 10 04:19:19 2008 +0100 @@ -278,9 +278,9 @@ public void setIncrement (int value) { checkWidget (); if (value < 1) return; - OS.g_signal_handlers_block_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)VALUE_CHANGED); + OS.g_signal_handlers_block_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udVALUE_CHANGED); OS.gtk_range_set_increments (cast(GtkRange*)handle, value, getPageIncrement ()); - OS.g_signal_handlers_unblock_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)VALUE_CHANGED); + OS.g_signal_handlers_unblock_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udVALUE_CHANGED); } /** @@ -300,9 +300,9 @@ checkWidget (); int minimum = getMinimum(); if (value <= minimum) return; - OS.g_signal_handlers_block_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)VALUE_CHANGED); + OS.g_signal_handlers_block_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udVALUE_CHANGED); OS.gtk_range_set_range (cast(GtkRange*)handle, minimum, value); - OS.g_signal_handlers_unblock_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)VALUE_CHANGED); + OS.g_signal_handlers_unblock_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udVALUE_CHANGED); } /** @@ -323,9 +323,9 @@ if (value < 0) return; int maximum = getMaximum (); if (value >= maximum) return; - OS.g_signal_handlers_block_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)VALUE_CHANGED); + OS.g_signal_handlers_block_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udVALUE_CHANGED); OS.gtk_range_set_range (cast(GtkRange*)handle, value, maximum); - OS.g_signal_handlers_unblock_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)VALUE_CHANGED); + OS.g_signal_handlers_unblock_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udVALUE_CHANGED); } /** @@ -344,9 +344,9 @@ public void setPageIncrement (int value) { checkWidget (); if (value < 1) return; - OS.g_signal_handlers_block_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)VALUE_CHANGED); + OS.g_signal_handlers_block_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udVALUE_CHANGED); OS.gtk_range_set_increments (cast(GtkRange*)handle, getIncrement (), value); - OS.g_signal_handlers_unblock_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)VALUE_CHANGED); + OS.g_signal_handlers_unblock_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udVALUE_CHANGED); } /** @@ -362,9 +362,9 @@ */ public void setSelection (int value) { checkWidget (); - OS.g_signal_handlers_block_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)VALUE_CHANGED); + OS.g_signal_handlers_block_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udVALUE_CHANGED); OS.gtk_range_set_value (cast(GtkRange*)handle, value); - OS.g_signal_handlers_unblock_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*) VALUE_CHANGED); + OS.g_signal_handlers_unblock_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udVALUE_CHANGED); } }
--- a/dwt/widgets/ScrollBar.d Sat Feb 09 21:22:47 2008 +0100 +++ b/dwt/widgets/ScrollBar.d Sun Feb 10 04:19:19 2008 +0100 @@ -331,7 +331,7 @@ checkWidget (); auto scrolledHandle = parent.scrolledHandle; int hsp, vsp; - OS.gtk_scrolled_window_get_policy (cast(GtkScrolledWindow*)scrolledHandle, &hsp, &vsp); + OS.gtk_scrolled_window_get_policy (scrolledHandle, &hsp, &vsp); if ((style & DWT.HORIZONTAL) !is 0) { return hsp !is OS.GTK_POLICY_NEVER; } else {
--- a/dwt/widgets/Slider.d Sat Feb 09 21:22:47 2008 +0100 +++ b/dwt/widgets/Slider.d Sun Feb 10 04:19:19 2008 +0100 @@ -157,17 +157,17 @@ state |= HANDLE; fixedHandle = cast(GtkWidget*)OS.g_object_new (display.gtk_fixed_get_type (), null); if (fixedHandle is null) error (DWT.ERROR_NO_HANDLES); - OS.gtk_fixed_set_has_window (cast(GtkFixed*)fixedHandle, true); + OS.gtk_fixed_set_has_window (fixedHandle, true); auto hAdjustment = OS.gtk_adjustment_new (0, 0, 100, 1, 10, 10); if (hAdjustment is null) error (DWT.ERROR_NO_HANDLES); if ((style & DWT.HORIZONTAL) !is 0) { - handle = cast(GtkWidget*)OS.gtk_hscrollbar_new (cast(GtkAdjustment*)hAdjustment); + handle = cast(GtkWidget*)OS.gtk_hscrollbar_new (hAdjustment); } else { - handle = cast(GtkWidget*)OS.gtk_vscrollbar_new (cast(GtkAdjustment*)hAdjustment); + handle = cast(GtkWidget*)OS.gtk_vscrollbar_new (hAdjustment); } if (handle is null) error (DWT.ERROR_NO_HANDLES); OS.GTK_WIDGET_SET_FLAGS (handle, OS.GTK_CAN_FOCUS); - OS.gtk_container_add (cast(GtkContainer*)fixedHandle, handle); + OS.gtk_container_add (fixedHandle, handle); } override int /*long*/ gtk_button_press_event (GtkWidget* widget, GdkEventButton* event) {
--- a/dwt/widgets/Spinner.d Sat Feb 09 21:22:47 2008 +0100 +++ b/dwt/widgets/Spinner.d Sun Feb 10 04:19:19 2008 +0100 @@ -222,7 +222,7 @@ } char [] buffer1 = string; auto ptr = OS.pango_layout_get_text (layout); - char[] buffer2 = fromUtf8z( ptr ).dup; + char[] buffer2 = fromStringz( ptr ).dup; OS.pango_layout_set_text (layout, buffer1.ptr, buffer1.length); OS.pango_layout_get_size (layout, &w, &h); OS.pango_layout_set_text (layout, buffer2.ptr, buffer2.length); @@ -485,7 +485,7 @@ char[] getDecimalSeparator () { auto ptr = OS.localeconv_decimal_point (); - return fromUtf8z( ptr ).dup; + return fromStringz( ptr ).dup; } override int /*long*/ gtk_activate (GtkWidget* widget) { @@ -537,7 +537,7 @@ int /*long*/ gtk_commit (GtkIMContext* imContext, char* text) { if (text is null) return 0; if (!OS.gtk_editable_get_editable (cast(GtkEditable*)handle)) return 0; - char [] chars = fromUtf8z( text ).dup; + char [] chars = fromStringz( text ).dup; if (chars.length is 0) return 0; char [] newChars = sendIMKeyEvent (DWT.KeyDown, null, chars); if (newChars is null) return 0;
--- a/dwt/widgets/Synchronizer.d Sat Feb 09 21:22:47 2008 +0100 +++ b/dwt/widgets/Synchronizer.d Sun Feb 10 04:19:19 2008 +0100 @@ -129,7 +129,7 @@ syncThread = lock.thread; try { lock.run (); - } catch (TracedException t) { + } catch (Exception t) { lock.throwable = t; DWT.error (DWT.ERROR_FAILED_EXEC, t); } finally {
--- a/dwt/widgets/TableItem.d Sat Feb 09 21:22:47 2008 +0100 +++ b/dwt/widgets/TableItem.d Sun Feb 10 04:19:19 2008 +0100 @@ -616,7 +616,7 @@ int modelIndex = parent.columnCount is 0 ? Table.FIRST_COLUMN : parent.columns [index].modelIndex; OS.gtk_tree_model_get1 (parent.modelHandle, handle, modelIndex + Table.CELL_TEXT, cast(void**) &ptr); if (ptr is null) return ""; - char[] res = tango.stdc.stringz.fromUtf8z( ptr ).dup; + char[] res = tango.stdc.stringz.fromStringz( ptr ).dup; OS.g_free (ptr); return res; }
--- a/dwt/widgets/Text.d Sat Feb 09 21:22:47 2008 +0100 +++ b/dwt/widgets/Text.d Sun Feb 10 04:19:19 2008 +0100 @@ -955,7 +955,7 @@ address = OS.gtk_text_buffer_get_text (bufferHandle, &start, &end, true); } if (address is null) return ""; - char[] res = fromUtf8z( address ).dup; + char[] res = fromStringz( address ).dup; if ((style & DWT.MULTI) !is 0) OS.g_free (address); return res; } @@ -995,7 +995,7 @@ address = OS.gtk_text_buffer_get_text (bufferHandle, &startIter, &endIter, true); } if (address is null) error (DWT.ERROR_CANNOT_GET_TEXT); - char[] res = fromUtf8z( address ).dup; + char[] res = fromStringz( address ).dup; OS.g_free (address); return res; } @@ -1131,7 +1131,7 @@ if ((style & DWT.SINGLE) !is 0) { if (!OS.gtk_editable_get_editable (cast(GtkEditable*)handle)) return 0; } - char [] chars = fromUtf8z( text ).dup; + char [] chars = fromStringz( text ).dup; if (chars.length is 0) return 0; char [] newChars = sendIMKeyEvent (DWT.KeyDown, null, chars); if (newChars is null) return 0;
--- a/dwt/widgets/Tracker.d Sat Feb 09 21:22:47 2008 +0100 +++ b/dwt/widgets/Tracker.d Sun Feb 10 04:19:19 2008 +0100 @@ -716,7 +716,7 @@ if (eventPtr !is null) { break; } else { - try { Thread.sleep(0.050); } catch (TracedException ex) {} + try { Thread.sleep(0.050); } catch (Exception ex) {} } } gdkEvent = eventPtr;
--- a/dwt/widgets/TreeItem.d Sat Feb 09 21:22:47 2008 +0100 +++ b/dwt/widgets/TreeItem.d Sun Feb 10 04:19:19 2008 +0100 @@ -878,7 +878,7 @@ int modelIndex = parent.columnCount is 0 ? Tree.FIRST_COLUMN : parent.columns [index].modelIndex; OS.gtk_tree_model_get1 (parent.modelHandle, handle, modelIndex + Tree.CELL_TEXT, &ptr); if (ptr is null) return ""; //$NON-NLS-1$ - char[] res = tango.stdc.stringz.fromUtf8z( cast(char*)ptr ).dup; + char[] res = tango.stdc.stringz.fromStringz( cast(char*)ptr ).dup; OS.g_free (ptr); return res; }
--- a/dwt/widgets/Widget.d Sat Feb 09 21:22:47 2008 +0100 +++ b/dwt/widgets/Widget.d Sun Feb 10 04:19:19 2008 +0100 @@ -1254,7 +1254,7 @@ if (isDisposed ()) return false; return event.doit; } - char [] chars = fromUtf8z( keyEvent.string ); + char [] chars = fromStringz( keyEvent.string ); return sendIMKeyEvent (type, keyEvent, chars) !is null; }