changeset 132:e22f9b443521

Working on ControlExample, png loading makes problems
author Frank Benoit <benoit@tionex.de>
date Mon, 21 Jan 2008 15:39:59 +0100
parents ee2998e3cfaa
children 14bc18df0c25
files dsss.conf dwt/dwthelper/ByteArrayInputStream.d dwt/dwthelper/InflaterInputStream.d dwt/dwthelper/InputStream.d dwt/dwthelper/ResourceBundle.d dwtexamples/addressbook/AddressBook.d dwtexamples/controlexample/ControlExample.d dwtexamples/controlexample/ShellTab.d dwtexamples/controlexample/Tab.d
diffstat 9 files changed, 300 insertions(+), 80 deletions(-) [+]
line wrap: on
line diff
--- a/dsss.conf	Mon Jan 21 15:39:26 2008 +0100
+++ b/dsss.conf	Mon Jan 21 15:39:59 2008 +0100
@@ -35,9 +35,67 @@
 [dwtexamples/helloworld/HelloWorld3.d]
 [dwtexamples/helloworld/HelloWorld4.d]
 [dwtexamples/helloworld/HelloWorld5.d]
+
+
+# seem like it is not possible to have additional buildflags to [*],
+# so all flags must be repeated. TODO: Ask Gregor
+
 [dwtexamples/addressbook/AddressBook.d]
+buildflags+=-L-lgtk-x11-2.0
+buildflags+=-L-lgdk-x11-2.0
+buildflags+=-L-latk-1.0
+buildflags+=-L-lgdk_pixbuf-2.0
+buildflags+=-L-lgthread-2.0
+buildflags+=-L-lm
+buildflags+=-L-lpangocairo-1.0
+buildflags+=-L-lfontconfig
+buildflags+=-L-lXtst
+buildflags+=-L-lXext
+buildflags+=-L-lXrender
+buildflags+=-L-lXinerama
+buildflags+=-L-lXi
+buildflags+=-L-lXrandr
+buildflags+=-L-lXcursor
+buildflags+=-L-lXcomposite
+buildflags+=-L-lXdamage
+buildflags+=-L-lX11
+buildflags+=-L-lXfixes
+buildflags+=-L-lpango-1.0
+buildflags+=-L-lgobject-2.0
+buildflags+=-L-lgmodule-2.0
+buildflags+=-L-ldl
+buildflags+=-L-lglib-2.0
+buildflags+=-L-lcairo
+buildflags+=-g -gc
+buildflags+=-Jdwtexamples/addressbook
 
 [dwtexamples/controlexample/ControlExample.d]
+buildflags+=-L-lgtk-x11-2.0
+buildflags+=-L-lgdk-x11-2.0
+buildflags+=-L-latk-1.0
+buildflags+=-L-lgdk_pixbuf-2.0
+buildflags+=-L-lgthread-2.0
+buildflags+=-L-lm
+buildflags+=-L-lpangocairo-1.0
+buildflags+=-L-lfontconfig
+buildflags+=-L-lXtst
+buildflags+=-L-lXext
+buildflags+=-L-lXrender
+buildflags+=-L-lXinerama
+buildflags+=-L-lXi
+buildflags+=-L-lXrandr
+buildflags+=-L-lXcursor
+buildflags+=-L-lXcomposite
+buildflags+=-L-lXdamage
+buildflags+=-L-lX11
+buildflags+=-L-lXfixes
+buildflags+=-L-lpango-1.0
+buildflags+=-L-lgobject-2.0
+buildflags+=-L-lgmodule-2.0
+buildflags+=-L-ldl
+buildflags+=-L-lglib-2.0
+buildflags+=-L-lcairo
+buildflags+=-g -gc
 buildflags+=-Jdwtexamples/controlexample
 
 
--- a/dwt/dwthelper/ByteArrayInputStream.d	Mon Jan 21 15:39:26 2008 +0100
+++ b/dwt/dwthelper/ByteArrayInputStream.d	Mon Jan 21 15:39:59 2008 +0100
@@ -22,14 +22,14 @@
     }
 
     public this ( byte[] aBuf, int offset, int length_ESCAPE ){
-        this.buf = new JArrayByte( aBuf[ offset .. offset+length_ESCAPE ] );
+        this.buf = aBuf[ offset .. offset+length_ESCAPE ];
     }
 
     public synchronized int read(){
         if( pos >= this.buf.length ){
             return -1;
         }
-        int result = this.buf.index(pos);
+        int result = this.buf[pos];
         pos++;
         return result & 0xFF;
     }
--- a/dwt/dwthelper/InflaterInputStream.d	Mon Jan 21 15:39:26 2008 +0100
+++ b/dwt/dwthelper/InflaterInputStream.d	Mon Jan 21 15:39:59 2008 +0100
@@ -5,6 +5,34 @@
 
 public import dwt.dwthelper.InputStream;
 import dwt.dwthelper.utils;
+import tango.io.Stdout;
+
+class InputStreamWrapper : tango.io.model.IConduit.InputStream {
+
+    dwt.dwthelper.InputStream.InputStream istr;
+
+    this( dwt.dwthelper.InputStream.InputStream istr ){
+        this.istr = istr;
+    }
+
+    uint read (void[] dst){
+        int res = istr.read( cast(byte[])dst, 0, dst.length );
+        //Stdout.formatln( "read {}/{}", dst.length, res );
+        return res;
+    }
+
+    tango.io.model.IConduit.InputStream clear (){
+        return this;
+    }
+
+    tango.io.model.IConduit.IConduit conduit (){
+        return null;
+    }
+
+    void close (){
+        istr.close();
+    }
+}
 
 public class InflaterInputStream : dwt.dwthelper.InputStream.InputStream {
 
@@ -20,12 +48,19 @@
     protected int len;
     package bool usesDefaultInflater = false;
 
+    InputStreamWrapper tangoIstr;
+
     public this ( dwt.dwthelper.InputStream.InputStream istr ){
+        tangoIstr = new InputStreamWrapper(istr );
     }
 
     public int read(){
-        implMissing( __FILE__, __LINE__ );
-        return 0;
+        ubyte[1] data;
+        uint res = tangoIstr.read( data );
+        if( res !is tango.io.model.IConduit.IOStream.Eof ){
+            return data[0] & 0xFF;
+        }
+        return -1;
     }
 
     public int read( byte[] b, int off, int len ){
--- a/dwt/dwthelper/InputStream.d	Mon Jan 21 15:39:26 2008 +0100
+++ b/dwt/dwthelper/InputStream.d	Mon Jan 21 15:39:59 2008 +0100
@@ -18,7 +18,7 @@
         foreach( uint idx, inout byte val; b ){
             int c = read();
             if( c == -1 ){
-                return idx;
+                return ( idx == 0 ) ? -1 : idx;
             }
             b[ idx] = cast(byte)( c & 0xFF );
         }
--- a/dwt/dwthelper/ResourceBundle.d	Mon Jan 21 15:39:26 2008 +0100
+++ b/dwt/dwthelper/ResourceBundle.d	Mon Jan 21 15:39:59 2008 +0100
@@ -1,21 +1,119 @@
-/**
+/**
  * Authors: Frank Benoit <keinfarbton@googlemail.com>
  */
 module dwt.dwthelper.ResourceBundle;
 
+import tango.text.Util;
+import tango.io.Stdout;
+
+
 class ResourceBundle {
 
-    public this( char[] name ){
+    char[][ char[] ] map;
+
+    public this( char[] data ){
+        char[] line;
+        int dataIndex;
+
+        //tango.io.Stdout.Stdout.formatln( "properties put ..." );
+        void readLine(){
+            line.length = 0;
+            char i = data[ dataIndex++ ];
+            while( dataIndex < data.length && i !is '\n' && i !is '\r' ){
+                line ~= i;
+                i = data[ dataIndex++ ];
+            }
+        }
+
+        //tango.io.Stdout.Stdout.formatln( "properties put {}", __LINE__ );
+        bool linecontinue = false;
+        bool iskeypart = true;
+        char[] key;
+        char[] value;
+nextline:
+        while( dataIndex < data.length ){
+            //tango.io.Stdout.Stdout.formatln( "properties put {} startline", __LINE__ );
+            readLine();
+            line = tango.text.Util.trim( line );
+            if( line.length is 0 ){
+                //tango.io.Stdout.Stdout.formatln( "properties put {} was 0 length", __LINE__ );
+                continue;
+            }
+            if( line[0] == '#' ){
+                //tango.io.Stdout.Stdout.formatln( "properties put {} was comment", __LINE__ );
+                continue;
+            }
+            int pos = 0;
+            bool esc = false;
+            if( !linecontinue ){
+                iskeypart = true;
+                key = null;
+                value = null;
+            }
+            else{
+                linecontinue = false;
+            }
+            while( pos < line.length ){
+                char c = line[pos];
+                if( esc ){
+                    esc = false;
+                    switch( c ){
+                    case 't': c = '\t'; break;
+                    case 'n': c = '\n'; break;
+                    case '\\': c = '\\'; break;
+                    default:  c = '?'; break;
+                    }
+                }
+                else{
+                    if( c == '\\' ){
+                        if( pos == line.length -1 ){
+                            linecontinue = true;
+                            goto nextline;
+                        }
+                        esc = true;
+                        pos++;
+                        continue;
+                    }
+                    else if( iskeypart && c == '=' ){
+                        pos++;
+                        iskeypart = false;
+                        continue;
+                    }
+                }
+                pos++;
+                if( iskeypart ){
+                    key ~= c;
+                }
+                else{
+                    value ~= c;
+                }
+            }
+            if( iskeypart ){
+                tango.io.Stdout.Stdout.formatln( "dwt.dwthelper.ResourceBundle ctor cannot find '='." );
+                continue;
+            }
+            key = tango.text.Util.trim( key );
+            value = tango.text.Util.trim(value);
+            //tango.io.Stdout.Stdout.formatln( "properties put {}=>{}", key, value );
+
+            map[ key.dup ] = value.dup;
+            //tango.io.Stdout.Stdout.formatln( "properties put {}", __LINE__ );
+        }
     }
 
     public char[] getString( char[] key ){
+        if( auto v = key in map ){
+            return (*v).dup;
+        }
         return key;
     }
 
     public static ResourceBundle getBundle( char[] name ){
-        return new ResourceBundle( name );
+        return new ResourceBundle( null );
     }
-
+    public static ResourceBundle getBundleFromData( char[] data ){
+        return new ResourceBundle( data );
+    }
 }
 
 
--- a/dwtexamples/addressbook/AddressBook.d	Mon Jan 21 15:39:26 2008 +0100
+++ b/dwtexamples/addressbook/AddressBook.d	Mon Jan 21 15:39:59 2008 +0100
@@ -72,6 +72,7 @@
 public class AddressBook {
 
     private static ResourceBundle resAddressBook;
+    private static const char[] resAddressBookData = cast(char[]) import( "addressbook.properties" );
     private Shell shell;
 
     private Table table;
@@ -89,7 +90,7 @@
 
 public this(){
     if( resAddressBook is null ){
-        resAddressBook = ResourceBundle.getBundle("examples_addressbook");
+        resAddressBook = ResourceBundle.getBundleFromData(resAddressBookData);
         columnNames = [
             resAddressBook.getString("Last_name"),
             resAddressBook.getString("First_name"),
--- a/dwtexamples/controlexample/ControlExample.d	Mon Jan 21 15:39:26 2008 +0100
+++ b/dwtexamples/controlexample/ControlExample.d	Mon Jan 21 15:39:59 2008 +0100
@@ -21,10 +21,6 @@
 import java.util.ResourceBundle;
 +/
 
-class MessageFormat {
-    char[] format( char[], ... );
-}
-
 import dwt.DWT;
 import dwt.graphics.Image;
 import dwt.graphics.ImageData;
@@ -71,28 +67,40 @@
 
 
 import tango.core.Exception;
+import tango.text.convert.Format;
+import tango.io.Stdout;
+import Math = tango.math.Math;
+
+
+/*** Linker workaround start ***/
+import tango.io.Stdout;
+import tango.math.Math;
+import tango.text.convert.Format;
+import tango.util.Convert;
+import tango.util.PathUtil;
+/*** Linker workaround end ***/
+
+void main(){
+    ControlExample.main( null );
+}
 
 public class ControlExample {
     private static ResourceBundle resourceBundle;
+    private static const char[] resourceData = import( "controlexample.properties" );
+
     private ShellTab shellTab;
     private TabFolder tabFolder;
     private Tab [] tabs;
     Image images[];
 
     static const int ciClosedFolder = 0, ciOpenFolder = 1, ciTarget = 2, ciBackground = 3, ciParentBackground = 4;
-    static const char[][] imageLocations = [ cast(char[])
-        "closedFolder.gif",             //$NON-NLS-1$
-        "openFolder.gif",               //$NON-NLS-1$
-        "target.gif",                   //$NON-NLS-1$
-        "backgroundImage.png",          //$NON-NLS-1$
-        "parentBackgroundImage.png"];   //$NON-NLS-1$
 
-    static const ubyte[][] imageData = [
-        cast(ubyte[]) import( "closedFolder.gif" ),
-        cast(ubyte[]) import( "openFolder.gif" ),
-        cast(ubyte[]) import( "target.gif" ),
-        cast(ubyte[]) import( "backgroundImage.png" ),
-        cast(ubyte[]) import( "parentBackgroundImage.png" )
+    static const byte[][] imageData = [
+        cast(byte[]) import( "closedFolder.gif" ),
+        cast(byte[]) import( "openFolder.gif" ),
+        cast(byte[]) import( "target.gif" ),
+        cast(byte[]) import( "backgroundImage.png" ),
+        cast(byte[]) import( "parentBackgroundImage.png" )
     ];
     static const int[] imageTypes = [
         DWT.ICON,
@@ -104,7 +112,7 @@
     bool startup = true;
 
     static this(){
-        resourceBundle = ResourceBundle.getBundle("examples_control"); //$NON-NLS-1$
+        resourceBundle = ResourceBundle.getBundleFromData( resourceData ); //$NON-NLS-1$
     }
 
     /**
@@ -220,7 +228,7 @@
     static char[] getResourceString(char[] key, Object[] args) {
         char[] res;
         try {
-            res = MessageFormat.format(getResourceString(key), args);
+            res = Format(getResourceString(key), args);
         } catch (NoSuchElementException e) {
             return key;
         }
@@ -238,9 +246,10 @@
         if (resourceBundle !is null) {
             try {
                 if (images is null) {
-                    images = new Image[imageLocations.length];
+                    images = new Image[imageData.length];
 
-                    for (int i = 0; i < imageLocations.length; ++i) {
+                    for (int i = 0; i < imageData.length; ++i) {
+                        Stdout.formatln( "try {}", i );
                         InputStream sourceStream = new ByteArrayInputStream( imageData[i] );
                         ImageData source = new ImageData(sourceStream);
                         if (imageTypes[i] is DWT.ICON) {
@@ -252,19 +261,20 @@
                         try {
                             sourceStream.close();
                         } catch (IOException e) {
-                            e.printStackTrace();
+                            Stderr.formatln( "Stacktrace: {}", e.toString );
                         }
                     }
                 }
                 return;
-            } catch (Throwable t) {
+            } catch (TracedException t) {
+                Stdout.formatln( "ups {}", t );
             }
         }
         char[] error = (resourceBundle !is null) ?
             getResourceString("error.CouldNotLoadResources") :
             "Unable to load resources"; //$NON-NLS-1$
         freeResources();
-        throw new RuntimeException(error);
+        throw new TracedException(error);
     }
 
     /**
@@ -303,7 +313,7 @@
         /* Workaround: if the tab folder is wider than the screen,
          * carbon clips instead of somehow scrolling the tab items.
          * We try to recover some width by using shorter tab names. */
-        if (size.x > monitorArea.width && DWT.getPlatform().equals("carbon")) {
+        if (size.x > monitorArea.width && DWT.getPlatform()=="carbon") {
             TabItem [] tabItems = instance.tabFolder.getItems();
             for (int i=0; i<tabItems.length; i++) {
                 tabItems[i].setText (instance.tabs [i].getShortTabText ());
--- a/dwtexamples/controlexample/ShellTab.d	Mon Jan 21 15:39:26 2008 +0100
+++ b/dwtexamples/controlexample/ShellTab.d	Mon Jan 21 15:39:59 2008 +0100
@@ -26,7 +26,7 @@
 
 import dwtexamples.controlexample.Tab;
 import dwtexamples.controlexample.ControlExample;
-
+import tango.util.Convert;
 
 class ShellTab : Tab {
     /* Style widgets added to the "Style" groups, and "Other" group */
@@ -39,7 +39,7 @@
 
     /* Variables used to track the open shells */
     int shellCount = 0;
-    Shell [] shells = new Shell [4];
+    Shell [] shells;
 
     /**
      * Creates the Tab within a given instance of ControlExample.
@@ -113,7 +113,7 @@
 
         /* Set the size, title, and image, and open the shell */
         currentShell.setSize (300, 100);
-        currentShell.setText (ControlExample.getResourceString("Title") + shellCount);
+        currentShell.setText (ControlExample.getResourceString("Title") ~ to!(char[])(shellCount));
         if (imageButton.getSelection()) currentShell.setImage(instance.images[ControlExample.ciTarget]);
         if (backgroundImageButton.getSelection()) currentShell.setBackgroundImage(instance.images[ControlExample.ciBackground]);
         hookListeners (currentShell);
--- a/dwtexamples/controlexample/Tab.d	Mon Jan 21 15:39:26 2008 +0100
+++ b/dwtexamples/controlexample/Tab.d	Mon Jan 21 15:39:59 2008 +0100
@@ -65,6 +65,7 @@
 import dwt.widgets.Widget;
 
 import dwtexamples.controlexample.ControlExample;
+import tango.text.convert.Format;
 
 /**
  * <code>Tab</code> is the abstract superclass of every page
@@ -101,23 +102,23 @@
     Group exampleGroup, controlGroup, listenersGroup, otherGroup, sizeGroup, styleGroup, colorGroup, backgroundModeGroup;
 
     /* Controlling instance */
-    final ControlExample instance;
+    const ControlExample instance;
 
     /* Sizing constants for the "Size" group */
-    static final int TOO_SMALL_SIZE = 10;
-    static final int SMALL_SIZE     = 50;
-    static final int LARGE_SIZE     = 100;
+    static const int TOO_SMALL_SIZE = 10;
+    static const int SMALL_SIZE     = 50;
+    static const int LARGE_SIZE     = 100;
 
     /* Right-to-left support */
-    static final bool RTL_SUPPORT_ENABLE = false;
+    static const bool RTL_SUPPORT_ENABLE = false;
     Group orientationGroup;
     Button rtlButton, ltrButton, defaultOrietationButton;
 
     /* Controls and resources for the "Colors & Fonts" group */
-    static final int IMAGE_SIZE = 12;
-    static final int FOREGROUND_COLOR = 0;
-    static final int BACKGROUND_COLOR = 1;
-    static final int FONT = 2;
+    static const int IMAGE_SIZE = 12;
+    static const int FOREGROUND_COLOR = 0;
+    static const int BACKGROUND_COLOR = 1;
+    static const int FONT = 2;
     Table colorAndFontTable;
     ColorDialog colorDialog;
     FontDialog fontDialog;
@@ -572,7 +573,7 @@
         table.setLayoutData(data);
         for (int i = 0; i < EVENT_NAMES.length; i++) {
             TableItem item = new TableItem (table, DWT.NONE);
-            item.setText (cast(char[])EVENT_NAMES[i][0]);
+            item.setText( EVENT_NAMES[i].name );
             item.setChecked (eventsFilter[i]);
         }
         final char[] [] customNames = getCustomEventNames ();
@@ -714,7 +715,7 @@
     void createSetGetDialog(int x, int y, char[][] methodNames) {
         final Shell dialog = new Shell(shell, DWT.DIALOG_TRIM | DWT.RESIZE | DWT.MODELESS);
         dialog.setLayout(new GridLayout(2, false));
-        dialog.setText(getTabText() + " " + ControlExample.getResourceString ("Set_Get"));
+        dialog.setText(getTabText() ~ " " ~ ControlExample.getResourceString ("Set_Get"));
         nameCombo = new Combo(dialog, DWT.READ_ONLY);
         nameCombo.setItems(methodNames);
         nameCombo.setText(methodNames[0]);
@@ -761,7 +762,7 @@
         char[] methodRoot = nameCombo.getText();
         returnTypeLabel.setText(parameterInfo(methodRoot));
         setButton.setText(setMethodName(methodRoot));
-        getButton.setText("get" + methodRoot);
+        getButton.setText("get" ~ methodRoot);
         setText.setText("");
         getText.setText("");
         getValue();
@@ -769,12 +770,14 @@
     }
 
     char[] setMethodName(char[] methodRoot) {
-        return "set" + methodRoot;
+        return "set" ~ methodRoot;
     }
 
     char[] parameterInfo(char[] methodRoot) {
+//PORTING_LEFT
+/+
         char[] typeName = null;
-        Class returnType = getReturnType(methodRoot);
+        ClassInfo returnType = getReturnType(methodRoot);
         bool isArray = returnType.isArray();
         if (isArray) {
             typeName = returnType.getComponentType().getName();
@@ -789,9 +792,13 @@
             typeNameString += "[]";
         }
         return ControlExample.getResourceString("Parameter_Info", [typeNameString, info]);
++/
+return null;
     }
 
     void getValue() {
+//PORTING_LEFT
+/+
         char[] methodName = "get" + nameCombo.getText();
         getText.setText("");
         Widget[] widgets = getExampleWidgets();
@@ -819,9 +826,12 @@
                 getText.append("\n\n");
             }
         }
++/
     }
 
     ClassInfo getReturnType(char[] methodRoot) {
+//PORTING_LEFT
+/+
         ClassInfo returnType = null;
         char[] methodName = "get" + methodRoot;
         Widget[] widgets = getExampleWidgets();
@@ -831,9 +841,13 @@
         } catch (Exception e) {
         }
         return returnType;
++/
+return null;
     }
 
     void setValue() {
+//PORTING_LEFT
+/+
         /* The parameter type must be the same as the get method's return type */
         char[] methodRoot = nameCombo.getText();
         Class returnType = getReturnType(methodRoot);
@@ -875,10 +889,14 @@
                 getText.setText(e.toString());
             }
         }
++/
+return null;
     }
 
     Object[] parameterForType(char[] typeName, char[] value, Widget widget) {
-        return [value];
+//PORTING_LEFT
+return null;
+        //return [value];
     }
 
     void createOrientationGroup () {
@@ -919,11 +937,11 @@
         preferredButton = new Button (sizeGroup, DWT.RADIO);
         preferredButton.setText (ControlExample.getResourceString("Preferred"));
         tooSmallButton = new Button (sizeGroup, DWT.RADIO);
-        tooSmallButton.setText (TOO_SMALL_SIZE + " X " + TOO_SMALL_SIZE);
+        tooSmallButton.setText ( Format( "{} X {}", TOO_SMALL_SIZE, TOO_SMALL_SIZE));
         smallButton = new Button(sizeGroup, DWT.RADIO);
-        smallButton.setText (SMALL_SIZE + " X " + SMALL_SIZE);
+        smallButton.setText (Format( "{} X {}", SMALL_SIZE, SMALL_SIZE));
         largeButton = new Button (sizeGroup, DWT.RADIO);
-        largeButton.setText (LARGE_SIZE + " X " + LARGE_SIZE);
+        largeButton.setText (Format( "{} X {}", LARGE_SIZE, LARGE_SIZE));
         fillHButton = new Button (sizeGroup, DWT.CHECK);
         fillHButton.setText (ControlExample.getResourceString("Fill_X"));
         fillVButton = new Button (sizeGroup, DWT.CHECK);
@@ -1204,7 +1222,7 @@
                 }
             };
             for (int i = 0; i < EVENT_NAMES.length; i++) {
-                if (eventsFilter [i]) widget.addListener ((cast(Integer)EVENT_NAMES[i][1]).intValue(), listener);
+                if (eventsFilter [i]) widget.addListener ( EVENT_NAMES[i].id, listener);
             }
         }
     }
@@ -1215,10 +1233,10 @@
     void log(Event event) {
         int i = 0;
         while (i < EVENT_NAMES.length) {
-            if ((cast(Integer)EVENT_NAMES[i][1]).intValue() is event.type) break;
+            if (EVENT_NAMES[i].id is event.type) break;
             i++;
         }
-        char[] toString = cast(char[])EVENT_NAMES[i][0] + " ["+event.type+"]: ";
+        char[] toString = Format( "{} [{}]: ", EVENT_NAMES[i].name, event.type );
         switch (event.type) {
             case DWT.KeyDown:
             case DWT.KeyUp: toString ~= (new KeyEvent (event)).toString (); break;
@@ -1229,35 +1247,35 @@
             case DWT.MouseExit:
             case DWT.MouseDoubleClick:
             case DWT.MouseWheel:
-            case DWT.MouseHover: toString += (new MouseEvent (event)).toString (); break;
-            case DWT.Paint: toString += (new PaintEvent (event)).toString (); break;
+            case DWT.MouseHover: toString ~= (new MouseEvent (event)).toString (); break;
+            case DWT.Paint: toString ~= (new PaintEvent (event)).toString (); break;
             case DWT.Move:
-            case DWT.Resize: toString += (new ControlEvent (event)).toString (); break;
-            case DWT.Dispose: toString += (new DisposeEvent (event)).toString (); break;
+            case DWT.Resize: toString ~= (new ControlEvent (event)).toString (); break;
+            case DWT.Dispose: toString ~= (new DisposeEvent (event)).toString (); break;
             case DWT.Selection:
-            case DWT.DefaultSelection: toString += (new SelectionEvent (event)).toString (); break;
+            case DWT.DefaultSelection: toString ~= (new SelectionEvent (event)).toString (); break;
             case DWT.FocusIn:
-            case DWT.FocusOut: toString += (new FocusEvent (event)).toString (); break;
+            case DWT.FocusOut: toString ~= (new FocusEvent (event)).toString (); break;
             case DWT.Expand:
-            case DWT.Collapse: toString += (new TreeEvent (event)).toString (); break;
+            case DWT.Collapse: toString ~= (new TreeEvent (event)).toString (); break;
             case DWT.Iconify:
             case DWT.Deiconify:
             case DWT.Close:
             case DWT.Activate:
-            case DWT.Deactivate: toString +=( new ShellEvent (event)).toString (); break;
+            case DWT.Deactivate: toString ~=( new ShellEvent (event)).toString (); break;
             case DWT.Show:
-            case DWT.Hide: toString += ( null !is cast(Menu)event.widget) ? (new MenuEvent (event)).toString () : event.toString(); break;
-            case DWT.Modify: toString += (new ModifyEvent (event)).toString (); break;
-            case DWT.Verify: toString += (new VerifyEvent (event)).toString (); break;
-            case DWT.Help: toString += (new HelpEvent (event)).toString (); break;
-            case DWT.Arm: toString += (new ArmEvent (event)).toString (); break;
-            case DWT.Traverse: toString += (new TraverseEvent (event)).toString (); break;
+            case DWT.Hide: toString ~= ( null !is cast(Menu)event.widget) ? (new MenuEvent (event)).toString () : event.toString(); break;
+            case DWT.Modify: toString ~= (new ModifyEvent (event)).toString (); break;
+            case DWT.Verify: toString ~= (new VerifyEvent (event)).toString (); break;
+            case DWT.Help: toString ~= (new HelpEvent (event)).toString (); break;
+            case DWT.Arm: toString ~= (new ArmEvent (event)).toString (); break;
+            case DWT.Traverse: toString ~= (new TraverseEvent (event)).toString (); break;
             case DWT.HardKeyDown:
             case DWT.HardKeyUp:
             case DWT.DragDetect:
             case DWT.MenuDetect:
             case DWT.SetData:
-            default: toString += event.toString ();
+            default: toString ~= event.toString ();
         }
         eventConsole.append (toString);
         eventConsole.append ("\n");
@@ -1275,7 +1293,7 @@
      * Logs a typed event to the event console.
      */
     void log (char[] eventName, TypedEvent event) {
-        eventConsole.append (eventName + ": ");
+        eventConsole.append (eventName ~ ": ");
         eventConsole.append (event.toString ());
         eventConsole.append ("\n");
     }
@@ -1334,8 +1352,8 @@
         if (backgroundModeGroup is null) return;
         char[] modeString = backgroundModeCombo.getText ();
         int mode = DWT.INHERIT_NONE;
-        if (modeString.equals("DWT.INHERIT_DEFAULT")) mode = DWT.INHERIT_DEFAULT;
-        if (modeString.equals("DWT.INHERIT_FORCE")) mode = DWT.INHERIT_FORCE;
+        if (modeString=="DWT.INHERIT_DEFAULT") mode = DWT.INHERIT_DEFAULT;
+        if (modeString=="DWT.INHERIT_FORCE") mode = DWT.INHERIT_FORCE;
         exampleGroup.setBackgroundMode (mode);
     }
 
@@ -1491,11 +1509,11 @@
     char[] [] split (char[] string, char ch) {
         char[] [] result = new char[][0];
         int start = 0;
-        int length = string.length();
+        int length = string.length;
         while (start < length) {
-            int end = string.indexOf(ch, start);
-            if (end is -1) end = length;
-            char[] substr = string.substring(start, end);
+            int end = tango.text.Util.locate( string, ch, start);
+            if (end is string.length ) end = length;
+            char[] substr = string[start .. end];
             char[] [] newResult = new char[][result.length + 1];
             System.arraycopy(result, 0, newResult, 0, result.length);
             newResult [result.length] = substr;