# HG changeset patch # User Jacob Carlborg # Date 1220040262 -7200 # Node ID 5b53d338c709067ecb62644bead7a88d353fcb5f # Parent fb2555104d7063b2fb6c2c208723f590cabd6555# Parent 30a762abda2aa6cf042d79af7e279fd340c03da4 Fixed some errors after latest merge diff -r fb2555104d70 -r 5b53d338c709 .hgignore --- a/.hgignore Fri Aug 29 21:47:55 2008 +0200 +++ b/.hgignore Fri Aug 29 22:04:22 2008 +0200 @@ -3,4 +3,5 @@ *.o dsss_objs dsss.last -*.a \ No newline at end of file +*.a +*.orig \ No newline at end of file diff -r fb2555104d70 -r 5b53d338c709 dwt/browser/AppFileLocProvider.d --- a/dwt/browser/AppFileLocProvider.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/browser/AppFileLocProvider.d Fri Aug 29 22:04:22 2008 +0200 @@ -45,7 +45,7 @@ static final String USER_PLUGINS_DIR = ".mozilla" + SEPARATOR_OS + "plugins"; //$NON-NLS-1$ //$NON-NLS-2$ static final String PREFERENCES_FILE = "prefs.js"; //$NON-NLS-1$ -AppFileLocProvider (String path) { +this (String path) { mozillaPath = path + SEPARATOR_OS; createCOMInterfaces (); } @@ -183,7 +183,7 @@ int segmentsSize = segments.size (); pluginDirs = new String [segmentsSize + 2]; for (index = 0; index < segmentsSize; index++) { - pluginDirs[index] = (String)segments.elementAt (index); + pluginDirs[index] = cast(String)segments.elementAt (index); } } } diff -r fb2555104d70 -r 5b53d338c709 dwt/browser/Download.d --- a/dwt/browser/Download.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/browser/Download.d Fri Aug 29 22:04:22 2008 +0200 @@ -45,7 +45,7 @@ Label status; Button cancel; -Download () { +this () { createCOMInterfaces (); } @@ -100,7 +100,7 @@ public int /*long*/ method15 (int /*long*/[] args) {return SetObserver (args[0]);} public int /*long*/ method16 (int /*long*/[] args) {return Open (args[0]);} public int /*long*/ method17 (int /*long*/[] args) {return GetCancelDownloadOnClose (args[0]);} - public int /*long*/ method18 (int /*long*/[] args) {return SetCancelDownloadOnClose ((int)/*64*/args[0]);} + public int /*long*/ method18 (int /*long*/[] args) {return SetCancelDownloadOnClose (cast(int)/*64*/args[0]);} public int /*long*/ method19 (int /*long*/[] args) {return GetDialog (args[0]);} public int /*long*/ method20 (int /*long*/[] args) {return SetDialog (args[0]);} }; @@ -109,11 +109,11 @@ public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);} public int /*long*/ method1 (int /*long*/[] args) {return AddRef ();} public int /*long*/ method2 (int /*long*/[] args) {return Release ();} - public int /*long*/ method3 (int /*long*/[] args) {return OnStateChange (args[0], args[1], (int)/*64*/args[2], (int)/*64*/args[3]);} - public int /*long*/ method4 (int /*long*/[] args) {return OnProgressChange (args[0], args[1], (int)/*64*/args[2], (int)/*64*/args[3], (int)/*64*/args[4], (int)/*64*/args[5]);} + public int /*long*/ method3 (int /*long*/[] args) {return OnStateChange (args[0], args[1], cast(int)/*64*/args[2], cast(int)/*64*/args[3]);} + public int /*long*/ method4 (int /*long*/[] args) {return OnProgressChange (args[0], args[1], cast(int)/*64*/args[2], cast(int)/*64*/args[3], cast(int)/*64*/args[4], cast(int)/*64*/args[5]);} public int /*long*/ method5 (int /*long*/[] args) {return OnLocationChange (args[0], args[1], args[2]);} - public int /*long*/ method6 (int /*long*/[] args) {return OnStatusChange (args[0], args[1], (int)/*64*/args[2], args[3]);} - public int /*long*/ method7 (int /*long*/[] args) {return OnSecurityChange (args[0], args[1], (int)/*64*/args[2]);} + public int /*long*/ method6 (int /*long*/[] args) {return OnStatusChange (args[0], args[1], cast(int)/*64*/args[2], args[3]);} + public int /*long*/ method7 (int /*long*/[] args) {return OnSecurityChange (args[0], args[1], cast(int)/*64*/args[2]);} }; } diff -r fb2555104d70 -r 5b53d338c709 dwt/browser/DownloadFactory.d --- a/dwt/browser/DownloadFactory.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/browser/DownloadFactory.d Fri Aug 29 22:04:22 2008 +0200 @@ -24,7 +24,7 @@ XPCOMObject factory; int refCount = 0; -DownloadFactory () { +this () { createCOMInterfaces (); } @@ -46,7 +46,7 @@ public int /*long*/ method1 (int /*long*/[] args) {return AddRef ();} public int /*long*/ method2 (int /*long*/[] args) {return Release ();} public int /*long*/ method3 (int /*long*/[] args) {return CreateInstance (args[0], args[1], args[2]);} - public int /*long*/ method4 (int /*long*/[] args) {return LockFactory ((int)/*64*/args[0]);} + public int /*long*/ method4 (int /*long*/[] args) {return LockFactory (cast(int)/*64*/args[0]);} }; } diff -r fb2555104d70 -r 5b53d338c709 dwt/browser/DownloadFactory_1_8.d --- a/dwt/browser/DownloadFactory_1_8.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/browser/DownloadFactory_1_8.d Fri Aug 29 22:04:22 2008 +0200 @@ -24,7 +24,7 @@ XPCOMObject factory; int refCount = 0; -DownloadFactory_1_8 () { +this () { createCOMInterfaces (); } @@ -46,7 +46,7 @@ public int /*long*/ method1 (int /*long*/[] args) {return AddRef ();} public int /*long*/ method2 (int /*long*/[] args) {return Release ();} public int /*long*/ method3 (int /*long*/[] args) {return CreateInstance (args[0], args[1], args[2]);} - public int /*long*/ method4 (int /*long*/[] args) {return LockFactory ((int)/*64*/args[0]);} + public int /*long*/ method4 (int /*long*/[] args) {return LockFactory (cast(int)/*64*/args[0]);} }; } diff -r fb2555104d70 -r 5b53d338c709 dwt/browser/Download_1_8.d --- a/dwt/browser/Download_1_8.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/browser/Download_1_8.d Fri Aug 29 22:04:22 2008 +0200 @@ -46,7 +46,7 @@ static final bool is32 = C.PTR_SIZEOF is 4; -Download_1_8 () { +this () { createCOMInterfaces (); } @@ -67,11 +67,11 @@ public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);} public int /*long*/ method1 (int /*long*/[] args) {return AddRef ();} public int /*long*/ method2 (int /*long*/[] args) {return Release ();} - public int /*long*/ method3 (int /*long*/[] args) {return OnStateChange (args[0], args[1], (int)/*64*/args[2], (int)/*64*/args[3]);} - public int /*long*/ method4 (int /*long*/[] args) {return OnProgressChange (args[0], args[1], (int)/*64*/args[2], (int)/*64*/args[3], (int)/*64*/args[4], (int)/*64*/args[5]);} + public int /*long*/ method3 (int /*long*/[] args) {return OnStateChange (args[0], args[1], cast(int)/*64*/args[2], cast(int)/*64*/args[3]);} + public int /*long*/ method4 (int /*long*/[] args) {return OnProgressChange (args[0], args[1], cast(int)/*64*/args[2], cast(int)/*64*/args[3], cast(int)/*64*/args[4], cast(int)/*64*/args[5]);} public int /*long*/ method5 (int /*long*/[] args) {return OnLocationChange (args[0], args[1], args[2]);} - public int /*long*/ method6 (int /*long*/[] args) {return OnStatusChange (args[0], args[1], (int)/*64*/args[2], args[3]);} - public int /*long*/ method7 (int /*long*/[] args) {return OnSecurityChange (args[0], args[1], (int)/*64*/args[2]);} + public int /*long*/ method6 (int /*long*/[] args) {return OnStatusChange (args[0], args[1], cast(int)/*64*/args[2], args[3]);} + public int /*long*/ method7 (int /*long*/[] args) {return OnSecurityChange (args[0], args[1], cast(int)/*64*/args[2]);} public int /*long*/ method8 (int /*long*/[] args) { if (args.length is 10) { return OnProgressChange64_32 (args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9]); @@ -102,11 +102,11 @@ public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);} public int /*long*/ method1 (int /*long*/[] args) {return AddRef ();} public int /*long*/ method2 (int /*long*/[] args) {return Release ();} - public int /*long*/ method3 (int /*long*/[] args) {return OnStateChange (args[0], args[1], (int)/*64*/args[2], (int)/*64*/args[3]);} - public int /*long*/ method4 (int /*long*/[] args) {return OnProgressChange (args[0], args[1], (int)/*64*/args[2], (int)/*64*/args[3], (int)/*64*/args[4], (int)/*64*/args[5]);} + public int /*long*/ method3 (int /*long*/[] args) {return OnStateChange (args[0], args[1], cast(int)/*64*/args[2], cast(int)/*64*/args[3]);} + public int /*long*/ method4 (int /*long*/[] args) {return OnProgressChange (args[0], args[1], cast(int)/*64*/args[2], cast(int)/*64*/args[3], cast(int)/*64*/args[4], cast(int)/*64*/args[5]);} public int /*long*/ method5 (int /*long*/[] args) {return OnLocationChange (args[0], args[1], args[2]);} - public int /*long*/ method6 (int /*long*/[] args) {return OnStatusChange (args[0], args[1], (int)/*64*/args[2], args[3]);} - public int /*long*/ method7 (int /*long*/[] args) {return OnSecurityChange (args[0], args[1], (int)/*64*/args[2]);} + public int /*long*/ method6 (int /*long*/[] args) {return OnStatusChange (args[0], args[1], cast(int)/*64*/args[2], args[3]);} + public int /*long*/ method7 (int /*long*/[] args) {return OnSecurityChange (args[0], args[1], cast(int)/*64*/args[2]);} public int /*long*/ method8 (int /*long*/[] args) { if (args.length is 10) { return OnProgressChange64_32 (args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9]); @@ -133,7 +133,7 @@ public int /*long*/ method19 (int /*long*/[] args) {return GetMIMEInfo (args[0]);} public int /*long*/ method20 (int /*long*/[] args) {return Open (args[0]);} public int /*long*/ method21 (int /*long*/[] args) {return GetCancelDownloadOnClose (args[0]);} - public int /*long*/ method22 (int /*long*/[] args) {return SetCancelDownloadOnClose ((int)/*64*/args[0]);} + public int /*long*/ method22 (int /*long*/[] args) {return SetCancelDownloadOnClose (cast(int)/*64*/args[0]);} public int /*long*/ method23 (int /*long*/[] args) {return GetObserver (args[0]);} public int /*long*/ method24 (int /*long*/[] args) {return SetObserver (args[0]);} public int /*long*/ method25 (int /*long*/[] args) {return GetDialog (args[0]);} @@ -144,11 +144,11 @@ public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);} public int /*long*/ method1 (int /*long*/[] args) {return AddRef ();} public int /*long*/ method2 (int /*long*/[] args) {return Release ();} - public int /*long*/ method3 (int /*long*/[] args) {return OnStateChange (args[0], args[1], (int)/*64*/args[2], (int)/*64*/args[3]);} - public int /*long*/ method4 (int /*long*/[] args) {return OnProgressChange (args[0], args[1], (int)/*64*/args[2], (int)/*64*/args[3], (int)/*64*/args[4], (int)/*64*/args[5]);} + public int /*long*/ method3 (int /*long*/[] args) {return OnStateChange (args[0], args[1], cast(int)/*64*/args[2], cast(int)/*64*/args[3]);} + public int /*long*/ method4 (int /*long*/[] args) {return OnProgressChange (args[0], args[1], cast(int)/*64*/args[2], cast(int)/*64*/args[3], cast(int)/*64*/args[4], cast(int)/*64*/args[5]);} public int /*long*/ method5 (int /*long*/[] args) {return OnLocationChange (args[0], args[1], args[2]);} - public int /*long*/ method6 (int /*long*/[] args) {return OnStatusChange (args[0], args[1], (int)/*64*/args[2], args[3]);} - public int /*long*/ method7 (int /*long*/[] args) {return OnSecurityChange (args[0], args[1], (int)/*64*/args[2]);} + public int /*long*/ method6 (int /*long*/[] args) {return OnStatusChange (args[0], args[1], cast(int)/*64*/args[2], args[3]);} + public int /*long*/ method7 (int /*long*/[] args) {return OnSecurityChange (args[0], args[1], cast(int)/*64*/args[2]);} }; } diff -r fb2555104d70 -r 5b53d338c709 dwt/browser/FilePicker.d --- a/dwt/browser/FilePicker.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/browser/FilePicker.d Fri Aug 29 22:04:22 2008 +0200 @@ -39,7 +39,7 @@ static final String SEPARATOR = System.getProperty ("file.separator"); //$NON-NLS-1$ -FilePicker () { +this () { createCOMInterfaces (); } @@ -60,15 +60,15 @@ public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);} public int /*long*/ method1 (int /*long*/[] args) {return AddRef ();} public int /*long*/ method2 (int /*long*/[] args) {return Release ();} - public int /*long*/ method3 (int /*long*/[] args) {return Init (args[0], args[1], (short)args[2]);} - public int /*long*/ method4 (int /*long*/[] args) {return AppendFilters ((int)/*64*/args[0]);} + public int /*long*/ method3 (int /*long*/[] args) {return Init (args[0], args[1], cast(short)args[2]);} + public int /*long*/ method4 (int /*long*/[] args) {return AppendFilters (cast(int)/*64*/args[0]);} public int /*long*/ method5 (int /*long*/[] args) {return AppendFilter (args[0], args[1]);} public int /*long*/ method6 (int /*long*/[] args) {return GetDefaultString (args[0]);} public int /*long*/ method7 (int /*long*/[] args) {return SetDefaultString (args[0]);} public int /*long*/ method8 (int /*long*/[] args) {return GetDefaultExtension (args[0]);} public int /*long*/ method9 (int /*long*/[] args) {return SetDefaultExtension (args[0]);} public int /*long*/ method10 (int /*long*/[] args) {return GetFilterIndex (args[0]);} - public int /*long*/ method11 (int /*long*/[] args) {return SetFilterIndex ((int)/*64*/args[0]);} + public int /*long*/ method11 (int /*long*/[] args) {return SetFilterIndex (cast(int)/*64*/args[0]);} public int /*long*/ method12 (int /*long*/[] args) {return GetDisplayDirectory (args[0]);} public int /*long*/ method13 (int /*long*/[] args) {return SetDisplayDirectory (args[0]);} public int /*long*/ method14 (int /*long*/[] args) {return GetFile (args[0]);} @@ -146,7 +146,7 @@ if (mode is nsIFilePicker.modeGetFolder) { /* picking a directory */ int result = showDirectoryPicker (); - XPCOM.memmove (_retval, new short[] {(short)result}, 2); /* PRInt16 */ + XPCOM.memmove (_retval, new short[] {cast(short)result}, 2); /* PRInt16 */ return XPCOM.NS_OK; } @@ -169,7 +169,7 @@ title = defaultFilename = null; masks = null; int result = filename is null ? nsIFilePicker.returnCancel : nsIFilePicker.returnOK; - XPCOM.memmove (_retval, new short[] {(short)result}, 2); /* PRInt16 */ + XPCOM.memmove (_retval, new short[] {cast(short)result}, 2); /* PRInt16 */ return XPCOM.NS_OK; } diff -r fb2555104d70 -r 5b53d338c709 dwt/browser/FilePickerFactory.d --- a/dwt/browser/FilePickerFactory.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/browser/FilePickerFactory.d Fri Aug 29 22:04:22 2008 +0200 @@ -24,7 +24,7 @@ XPCOMObject factory; int refCount = 0; -FilePickerFactory () { +this () { createCOMInterfaces (); } @@ -46,7 +46,7 @@ public int /*long*/ method1 (int /*long*/[] args) {return AddRef ();} public int /*long*/ method2 (int /*long*/[] args) {return Release ();} public int /*long*/ method3 (int /*long*/[] args) {return CreateInstance (args[0], args[1], args[2]);} - public int /*long*/ method4 (int /*long*/[] args) {return LockFactory ((int)/*64*/args[0]);} + public int /*long*/ method4 (int /*long*/[] args) {return LockFactory (cast(int)/*64*/args[0]);} }; } diff -r fb2555104d70 -r 5b53d338c709 dwt/browser/FilePickerFactory_1_8.d --- a/dwt/browser/FilePickerFactory_1_8.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/browser/FilePickerFactory_1_8.d Fri Aug 29 22:04:22 2008 +0200 @@ -16,7 +16,7 @@ import dwt.internal.mozilla.XPCOM; import dwt.internal.mozilla.XPCOMObject; -class FilePickerFactory_1_8 extends FilePickerFactory { +class FilePickerFactory_1_8 : FilePickerFactory { void createCOMInterfaces () { /* Create each of the interfaces that this object implements */ @@ -31,7 +31,7 @@ public int /*long*/ method1 (int /*long*/[] args) {return AddRef ();} public int /*long*/ method2 (int /*long*/[] args) {return Release ();} public int /*long*/ method3 (int /*long*/[] args) {return CreateInstance (args[0], args[1], args[2]);} - public int /*long*/ method4 (int /*long*/[] args) {return LockFactory ((int)/*64*/args[0]);} + public int /*long*/ method4 (int /*long*/[] args) {return LockFactory (cast(int)/*64*/args[0]);} }; } diff -r fb2555104d70 -r 5b53d338c709 dwt/browser/FilePicker_1_8.d --- a/dwt/browser/FilePicker_1_8.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/browser/FilePicker_1_8.d Fri Aug 29 22:04:22 2008 +0200 @@ -15,7 +15,7 @@ import dwt.internal.mozilla.XPCOM; import dwt.internal.mozilla.XPCOMObject; -class FilePicker_1_8 extends FilePicker { +class FilePicker_1_8 : FilePicker { void createCOMInterfaces () { /* Create each of the interfaces that this object implements */ @@ -29,15 +29,15 @@ public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);} public int /*long*/ method1 (int /*long*/[] args) {return AddRef ();} public int /*long*/ method2 (int /*long*/[] args) {return Release ();} - public int /*long*/ method3 (int /*long*/[] args) {return Init (args[0], args[1], (short)args[2]);} - public int /*long*/ method4 (int /*long*/[] args) {return AppendFilters ((int)/*64*/args[0]);} + public int /*long*/ method3 (int /*long*/[] args) {return Init (args[0], args[1], cast(short)args[2]);} + public int /*long*/ method4 (int /*long*/[] args) {return AppendFilters (cast(int)/*64*/args[0]);} public int /*long*/ method5 (int /*long*/[] args) {return AppendFilter (args[0], args[1]);} public int /*long*/ method6 (int /*long*/[] args) {return GetDefaultString (args[0]);} public int /*long*/ method7 (int /*long*/[] args) {return SetDefaultString (args[0]);} public int /*long*/ method8 (int /*long*/[] args) {return GetDefaultExtension (args[0]);} public int /*long*/ method9 (int /*long*/[] args) {return SetDefaultExtension (args[0]);} public int /*long*/ method10 (int /*long*/[] args) {return GetFilterIndex (args[0]);} - public int /*long*/ method11 (int /*long*/[] args) {return SetFilterIndex ((int)/*64*/args[0]);} + public int /*long*/ method11 (int /*long*/[] args) {return SetFilterIndex (cast(int)/*64*/args[0]);} public int /*long*/ method12 (int /*long*/[] args) {return GetDisplayDirectory (args[0]);} public int /*long*/ method13 (int /*long*/[] args) {return SetDisplayDirectory (args[0]);} public int /*long*/ method14 (int /*long*/[] args) {return GetFile (args[0]);} diff -r fb2555104d70 -r 5b53d338c709 dwt/browser/HelperAppLauncherDialog.d --- a/dwt/browser/HelperAppLauncherDialog.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/browser/HelperAppLauncherDialog.d Fri Aug 29 22:04:22 2008 +0200 @@ -31,7 +31,7 @@ XPCOMObject helperAppLauncherDialog; int refCount = 0; -HelperAppLauncherDialog () { +this () { createCOMInterfaces (); } @@ -52,7 +52,7 @@ public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);} public int /*long*/ method1 (int /*long*/[] args) {return AddRef ();} public int /*long*/ method2 (int /*long*/[] args) {return Release ();} - public int /*long*/ method3 (int /*long*/[] args) {return Show (args[0], args[1], (int)/*64*/args[2]);} + public int /*long*/ method3 (int /*long*/[] args) {return Show (args[0], args[1], cast(int)/*64*/args[2]);} public int /*long*/ method4 (int /*long*/[] args) {return PromptForSaveToFile (args[0], args[1], args[2], args[3], args[4]);} }; } diff -r fb2555104d70 -r 5b53d338c709 dwt/browser/HelperAppLauncherDialogFactory.d --- a/dwt/browser/HelperAppLauncherDialogFactory.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/browser/HelperAppLauncherDialogFactory.d Fri Aug 29 22:04:22 2008 +0200 @@ -24,7 +24,7 @@ XPCOMObject factory; int refCount = 0; -HelperAppLauncherDialogFactory () { +this () { createCOMInterfaces (); } @@ -46,7 +46,7 @@ public int /*long*/ method1 (int /*long*/[] args) {return AddRef ();} public int /*long*/ method2 (int /*long*/[] args) {return Release ();} public int /*long*/ method3 (int /*long*/[] args) {return CreateInstance (args[0], args[1], args[2]);} - public int /*long*/ method4 (int /*long*/[] args) {return LockFactory ((int)/*64*/args[0]);} + public int /*long*/ method4 (int /*long*/[] args) {return LockFactory (cast(int)/*64*/args[0]);} }; } diff -r fb2555104d70 -r 5b53d338c709 dwt/browser/InputStream.d --- a/dwt/browser/InputStream.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/browser/InputStream.d Fri Aug 29 22:04:22 2008 +0200 @@ -26,7 +26,7 @@ byte[] buffer; int index = 0; -InputStream (byte[] buffer) { +this (byte[] buffer) { this.buffer = buffer; index = 0; createCOMInterfaces (); @@ -45,8 +45,8 @@ public int /*long*/ method2 (int /*long*/[] args) {return Release ();} public int /*long*/ method3 (int /*long*/[] args) {return Close ();} public int /*long*/ method4 (int /*long*/[] args) {return Available (args[0]);} - public int /*long*/ method5 (int /*long*/[] args) {return Read (args[0], (int)/*64*/args[1], args[2]);} - public int /*long*/ method6 (int /*long*/[] args) {return ReadSegments (args[0], args[1], (int)/*64*/args[2], args[3]);} + public int /*long*/ method5 (int /*long*/[] args) {return Read (args[0], cast(int)/*64*/args[1], args[2]);} + public int /*long*/ method6 (int /*long*/[] args) {return ReadSegments (args[0], args[1], cast(int)/*64*/args[2], args[3]);} public int /*long*/ method7 (int /*long*/[] args) {return IsNonBlocking (args[0]);} }; } diff -r fb2555104d70 -r 5b53d338c709 dwt/browser/Mozilla.d --- a/dwt/browser/Mozilla.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/browser/Mozilla.d Fri Aug 29 22:04:22 2008 +0200 @@ -92,7 +92,7 @@ import dwt.widgets.Menu; import dwt.widgets.Shell; -class Mozilla extends WebBrowser { +class Mozilla : WebBrowser { int /*long*/ embedHandle; nsIWebBrowser webBrowser; Object webBrowserObject; @@ -230,7 +230,7 @@ bool initLoaded = false; bool IsXULRunner = false; - String greInitialized = System.getProperty (GRE_INITIALIZED); + String greInitialized = System.getProperty cast(GRE_INITIALIZED); if ("true".equals (greInitialized)) { //$NON-NLS-1$ /* * Another browser has already initialized xulrunner in this process, @@ -239,7 +239,7 @@ Initialized = true; } - String mozillaPath = System.getProperty (XULRUNNER_PATH); + String mozillaPath = System.getProperty cast(XULRUNNER_PATH); /* * Browser clients that ship XULRunner in a plug-in must have an opportunity * to set the dwt.browser.XULRunnerPath system property to point @@ -253,7 +253,7 @@ if (mozillaPath is null) { try { Class.forName ("dwt.browser.XULRunnerInitializer"); //$NON-NLS-1$ - mozillaPath = System.getProperty (XULRUNNER_PATH); + mozillaPath = System.getProperty cast(XULRUNNER_PATH); } catch (ClassNotFoundException e) { /* no fragment is providing this class, which is the typical case */ } @@ -333,7 +333,7 @@ rc = XPCOMInit.XPCOMGlueStartup (path); if (rc !is XPCOM.NS_OK) { IsXULRunner = false; /* failed */ - mozillaPath = mozillaPath.substring (0, mozillaPath.lastIndexOf (SEPARATOR_OS)); + mozillaPath = mozillaPath.substring (0, mozillaPath.lastIndexOf cast(SEPARATOR_OS)); if (Device.DEBUG) System.out.println ("cannot use detected XULRunner: " + mozillaPath); //$NON-NLS-1$ } else { XPCOMInitWasGlued = true; @@ -362,7 +362,7 @@ * Remove the trailing xpcom lib name from mozillaPath because the * Mozilla.initialize and NS_InitXPCOM2 invocations require a directory name only. */ - mozillaPath = mozillaPath.substring (0, mozillaPath.lastIndexOf (SEPARATOR_OS)); + mozillaPath = mozillaPath.substring (0, mozillaPath.lastIndexOf cast(SEPARATOR_OS)); } else { if ((style & DWT.MOZILLA) !is 0) { browser.dispose (); @@ -718,11 +718,11 @@ String language = locale.getLanguage (); String country = locale.getCountry (); StringBuffer stringBuffer = new StringBuffer (language); - stringBuffer.append (SEPARATOR_LOCALE); + stringBuffer.append cast(SEPARATOR_LOCALE); stringBuffer.append (country.toLowerCase ()); - stringBuffer.append (TOKENIZER_LOCALE); + stringBuffer.append cast(TOKENIZER_LOCALE); stringBuffer.append (language); - stringBuffer.append (TOKENIZER_LOCALE); + stringBuffer.append cast(TOKENIZER_LOCALE); String newLocales = stringBuffer.toString (); int start, end = -1; @@ -836,8 +836,8 @@ * Check for proxy values set as documented java properties and update mozilla's * preferences with these values if needed. */ - String proxyHost = System.getProperty (PROPERTY_PROXYHOST); - String proxyPortString = System.getProperty (PROPERTY_PROXYPORT); + String proxyHost = System.getProperty cast(PROPERTY_PROXYHOST); + String proxyPortString = System.getProperty cast(PROPERTY_PROXYPORT); int port = -1; if (proxyPortString !is null) { @@ -986,7 +986,7 @@ Initialized = true; } - if (display.getData (DISPOSE_LISTENER_HOOKED) is null) { + if (display.getData cast(DISPOSE_LISTENER_HOOKED) is null) { display.setData (DISPOSE_LISTENER_HOOKED, DISPOSE_LISTENER_HOOKED); display.addListener (DWT.Dispose, new Listener () { public void handleEvent (Event event) { @@ -1327,27 +1327,27 @@ public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);} public int /*long*/ method1 (int /*long*/[] args) {return AddRef ();} public int /*long*/ method2 (int /*long*/[] args) {return Release ();} - public int /*long*/ method3 (int /*long*/[] args) {return OnStateChange (args[0], args[1], (int)/*64*/args[2], (int)/*64*/args[3]);} - public int /*long*/ method4 (int /*long*/[] args) {return OnProgressChange (args[0], args[1], (int)/*64*/args[2], (int)/*64*/args[3], (int)/*64*/args[4], (int)/*64*/args[5]);} + public int /*long*/ method3 (int /*long*/[] args) {return OnStateChange (args[0], args[1], cast(int)/*64*/args[2], cast(int)/*64*/args[3]);} + public int /*long*/ method4 (int /*long*/[] args) {return OnProgressChange (args[0], args[1], cast(int)/*64*/args[2], cast(int)/*64*/args[3], cast(int)/*64*/args[4], cast(int)/*64*/args[5]);} public int /*long*/ method5 (int /*long*/[] args) {return OnLocationChange (args[0], args[1], args[2]);} - public int /*long*/ method6 (int /*long*/[] args) {return OnStatusChange (args[0], args[1], (int)/*64*/args[2], args[3]);} - public int /*long*/ method7 (int /*long*/[] args) {return OnSecurityChange (args[0], args[1], (int)/*64*/args[2]);} + public int /*long*/ method6 (int /*long*/[] args) {return OnStatusChange (args[0], args[1], cast(int)/*64*/args[2], args[3]);} + public int /*long*/ method7 (int /*long*/[] args) {return OnSecurityChange (args[0], args[1], cast(int)/*64*/args[2]);} }; webBrowserChrome = new XPCOMObject (new int[] {2, 0, 0, 2, 1, 1, 1, 1, 0, 2, 0, 1, 1}) { public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);} public int /*long*/ method1 (int /*long*/[] args) {return AddRef ();} public int /*long*/ method2 (int /*long*/[] args) {return Release ();} - public int /*long*/ method3 (int /*long*/[] args) {return SetStatus ((int)/*64*/args[0], args[1]);} + public int /*long*/ method3 (int /*long*/[] args) {return SetStatus (cast(int)/*64*/args[0], args[1]);} public int /*long*/ method4 (int /*long*/[] args) {return GetWebBrowser (args[0]);} public int /*long*/ method5 (int /*long*/[] args) {return SetWebBrowser (args[0]);} public int /*long*/ method6 (int /*long*/[] args) {return GetChromeFlags (args[0]);} - public int /*long*/ method7 (int /*long*/[] args) {return SetChromeFlags ((int)/*64*/args[0]);} + public int /*long*/ method7 (int /*long*/[] args) {return SetChromeFlags (cast(int)/*64*/args[0]);} public int /*long*/ method8 (int /*long*/[] args) {return DestroyBrowserWindow ();} - public int /*long*/ method9 (int /*long*/[] args) {return SizeBrowserTo ((int)/*64*/args[0], (int)/*64*/args[1]);} + public int /*long*/ method9 (int /*long*/[] args) {return SizeBrowserTo (cast(int)/*64*/args[0], cast(int)/*64*/args[1]);} public int /*long*/ method10 (int /*long*/[] args) {return ShowAsModal ();} public int /*long*/ method11 (int /*long*/[] args) {return IsWindowModal (args[0]);} - public int /*long*/ method12 (int /*long*/[] args) {return ExitModalEventLoop ((int)/*64*/args[0]);} + public int /*long*/ method12 (int /*long*/[] args) {return ExitModalEventLoop (cast(int)/*64*/args[0]);} }; webBrowserChromeFocus = new XPCOMObject (new int[] {2, 0, 0, 0, 0}) { @@ -1362,11 +1362,11 @@ public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);} public int /*long*/ method1 (int /*long*/[] args) {return AddRef ();} public int /*long*/ method2 (int /*long*/[] args) {return Release ();} - public int /*long*/ method3 (int /*long*/[] args) {return SetDimensions ((int)/*64*/args[0], (int)/*64*/args[1], (int)/*64*/args[2], (int)/*64*/args[3], (int)/*64*/args[4]);} - public int /*long*/ method4 (int /*long*/[] args) {return GetDimensions ((int)/*64*/args[0], args[1], args[2], args[3], args[4]);} + public int /*long*/ method3 (int /*long*/[] args) {return SetDimensions (cast(int)/*64*/args[0], cast(int)/*64*/args[1], cast(int)/*64*/args[2], cast(int)/*64*/args[3], cast(int)/*64*/args[4]);} + public int /*long*/ method4 (int /*long*/[] args) {return GetDimensions (cast(int)/*64*/args[0], args[1], args[2], args[3], args[4]);} public int /*long*/ method5 (int /*long*/[] args) {return SetFocus ();} public int /*long*/ method6 (int /*long*/[] args) {return GetVisibility (args[0]);} - public int /*long*/ method7 (int /*long*/[] args) {return SetVisibility ((int)/*64*/args[0]);} + public int /*long*/ method7 (int /*long*/[] args) {return SetVisibility (cast(int)/*64*/args[0]);} public int /*long*/ method8 (int /*long*/[] args) {return GetTitle (args[0]);} public int /*long*/ method9 (int /*long*/[] args) {return SetTitle (args[0]);} public int /*long*/ method10 (int /*long*/[] args) {return GetSiteWindow (args[0]);} @@ -1390,7 +1390,7 @@ public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);} public int /*long*/ method1 (int /*long*/[] args) {return AddRef ();} public int /*long*/ method2 (int /*long*/[] args) {return Release ();} - public int /*long*/ method3 (int /*long*/[] args) {return OnShowContextMenu ((int)/*64*/args[0], args[1], args[2]);} + public int /*long*/ method3 (int /*long*/[] args) {return OnShowContextMenu (cast(int)/*64*/args[0], args[1], args[2]);} }; uriContentListener = new XPCOMObject (new int[] {2, 0, 0, 2, 5, 3, 4, 1, 1, 1, 1}) { @@ -1398,9 +1398,9 @@ public int /*long*/ method1 (int /*long*/[] args) {return AddRef ();} public int /*long*/ method2 (int /*long*/[] args) {return Release ();} public int /*long*/ method3 (int /*long*/[] args) {return OnStartURIOpen (args[0], args[1]);} - public int /*long*/ method4 (int /*long*/[] args) {return DoContent (args[0], (int)/*64*/args[1], args[2], args[3], args[4]);} + public int /*long*/ method4 (int /*long*/[] args) {return DoContent (args[0], cast(int)/*64*/args[1], args[2], args[3], args[4]);} public int /*long*/ method5 (int /*long*/[] args) {return IsPreferred (args[0], args[1], args[2]);} - public int /*long*/ method6 (int /*long*/[] args) {return CanHandleContent (args[0], (int)/*64*/args[1], args[2], args[3]);} + public int /*long*/ method6 (int /*long*/[] args) {return CanHandleContent (args[0], cast(int)/*64*/args[1], args[2], args[3]);} public int /*long*/ method7 (int /*long*/[] args) {return GetLoadCookie (args[0]);} public int /*long*/ method8 (int /*long*/[] args) {return SetLoadCookie (args[0]);} public int /*long*/ method9 (int /*long*/[] args) {return GetParentContentListener (args[0]);} @@ -1411,7 +1411,7 @@ public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);} public int /*long*/ method1 (int /*long*/[] args) {return AddRef ();} public int /*long*/ method2 (int /*long*/[] args) {return Release ();} - public int /*long*/ method3 (int /*long*/[] args) {return OnShowTooltip ((int)/*64*/args[0], (int)/*64*/args[1], args[2]);} + public int /*long*/ method3 (int /*long*/[] args) {return OnShowTooltip (cast(int)/*64*/args[0], cast(int)/*64*/args[1], args[2]);} public int /*long*/ method4 (int /*long*/[] args) {return OnHideTooltip ();} }; @@ -1606,7 +1606,7 @@ * If the URI indicates that the page is being rendered from memory * (via setText()) then set it to about:blank to be consistent with IE. */ - if (location.equals (URI_FROMMEMORY)) location = ABOUT_BLANK; + if (location.equals cast(URI_FROMMEMORY)) location = ABOUT_BLANK; return location; } @@ -1703,7 +1703,7 @@ if (rc !is XPCOM.NS_OK) error (rc); baseWindow.Release (); - Release (); + this (); webBrowser.Release (); webBrowser = null; webBrowserObject = null; @@ -1714,7 +1714,7 @@ Enumeration elements = unhookedDOMWindows.elements (); while (elements.hasMoreElements ()) { - LONG ptrObject = (LONG)elements.nextElement (); + LONG ptrObject = cast(LONG)elements.nextElement (); new nsISupports (ptrObject.value).Release (); } unhookedDOMWindows = null; @@ -2249,7 +2249,7 @@ domWindow.Release (); /* - * Feature in Mozilla. When a request is redirected (STATE_REDIRECTING), + * Feature in Mozilla. When a request is redirected cast(STATE_REDIRECTING), * it never reaches the state STATE_STOP and it is replaced with a new request. * The new request is received when it is in the state STATE_STOP. * To handle this case, the variable request is set to 0 when the corresponding @@ -2378,7 +2378,7 @@ * to about:blank and fires the corresponding navigation events. Do not send * this event on to the user since it is not expected. */ - if (!IsPre_1_8 && aRequest is 0 && url.startsWith (ABOUT_BLANK)) return XPCOM.NS_OK; + if (!IsPre_1_8 && aRequest is 0 && url.startsWith cast(ABOUT_BLANK)) return XPCOM.NS_OK; LocationEvent event = new LocationEvent (browser); event.display = browser.getDisplay (); @@ -2388,7 +2388,7 @@ * If the URI indicates that the page is being rendered from memory * (via setText()) then set it to about:blank to be consistent with IE. */ - if (event.location.equals (URI_FROMMEMORY)) event.location = ABOUT_BLANK; + if (event.location.equals cast(URI_FROMMEMORY)) event.location = ABOUT_BLANK; event.top = aTop[0] is aDOMWindow[0]; for (int i = 0; i < locationListeners.length; i++) { locationListeners[i].changed (event); @@ -2757,7 +2757,7 @@ * listeners should not be notified of internal transitions like "javascipt:..." * because this is an implementation side-effect, not a true navigate */ - if (!value.startsWith (PREFIX_JAVASCRIPT)) { + if (!value.startsWith cast(PREFIX_JAVASCRIPT)) { LocationEvent event = new LocationEvent (browser); event.display = browser.getDisplay(); event.widget = browser; @@ -2766,7 +2766,7 @@ * If the URI indicates that the page is being rendered from memory * (via setText()) then set it to about:blank to be consistent with IE. */ - if (event.location.equals (URI_FROMMEMORY)) event.location = ABOUT_BLANK; + if (event.location.equals cast(URI_FROMMEMORY)) event.location = ABOUT_BLANK; event.doit = doit; for (int i = 0; i < locationListeners.length; i++) { locationListeners[i].changing (event); @@ -3081,7 +3081,7 @@ keyEvent.widget = browser; keyEvent.type = DWT.KeyDown; keyEvent.keyCode = lastKeyCode; - keyEvent.character = (char)lastCharCode; + keyEvent.character = cast(wchar)lastCharCode; keyEvent.stateMask = (aAltKey[0] !is 0 ? DWT.ALT : 0) | (aCtrlKey[0] !is 0 ? DWT.CTRL : 0) | (aShiftKey[0] !is 0 ? DWT.SHIFT : 0) | (aMetaKey[0] !is 0 ? DWT.COMMAND : 0); browser.notifyListeners (keyEvent.type, keyEvent); if (!keyEvent.doit || browser.isDisposed ()) { @@ -3128,7 +3128,7 @@ keyEvent.widget = browser; keyEvent.type = DWT.KeyUp; keyEvent.keyCode = lastKeyCode; - keyEvent.character = (char)lastCharCode; + keyEvent.character = cast(wchar)lastCharCode; keyEvent.stateMask = (aAltKey[0] !is 0 ? DWT.ALT : 0) | (aCtrlKey[0] !is 0 ? DWT.CTRL : 0) | (aShiftKey[0] !is 0 ? DWT.SHIFT : 0) | (aMetaKey[0] !is 0 ? DWT.COMMAND : 0); switch (lastKeyCode) { case DWT.SHIFT: diff -r fb2555104d70 -r 5b53d338c709 dwt/browser/MozillaDelegate.d --- a/dwt/browser/MozillaDelegate.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/browser/MozillaDelegate.d Fri Aug 29 22:04:22 2008 +0200 @@ -66,10 +66,10 @@ // range.length = chars.length; // int encoding = OS.CFStringGetSystemEncoding (); // int[] size = new int[1]; - // int numChars = OS.CFStringGetBytes (cfString, range, encoding, (byte)'?', true, null, 0, size); + // int numChars = OS.CFStringGetBytes (cfString, range, encoding, cast(byte)'?', true, null, 0, size); // buffer = new byte [size[0] + (terminate ? 1 : 0)]; // if (numChars !is 0) { - // numChars = OS.CFStringGetBytes (cfString, range, encoding, (byte)'?', true, buffer, size[0], size); + // numChars = OS.CFStringGetBytes (cfString, range, encoding, cast(byte)'?', true, buffer, size[0], size); // } // OS.CFRelease (cfString); // } diff -r fb2555104d70 -r 5b53d338c709 dwt/browser/PromptDialog.d --- a/dwt/browser/PromptDialog.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/browser/PromptDialog.d Fri Aug 29 22:04:22 2008 +0200 @@ -27,13 +27,13 @@ import dwt.widgets.Text; import dwt.widgets.Widget; -class PromptDialog extends Dialog { +class PromptDialog : Dialog { - PromptDialog(Shell parent, int style) { + this(Shell parent, int style) { super(parent, style); } - PromptDialog(Shell parent) { + this(Shell parent) { this(parent, 0); } diff -r fb2555104d70 -r 5b53d338c709 dwt/browser/PromptService2.d --- a/dwt/browser/PromptService2.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/browser/PromptService2.d Fri Aug 29 22:04:22 2008 +0200 @@ -40,7 +40,7 @@ XPCOMObject promptService2; int refCount = 0; -PromptService2 () { +this () { createCOMInterfaces (); } @@ -65,11 +65,11 @@ public int /*long*/ method4 (int /*long*/[] args) {return AlertCheck (args[0], args[1], args[2], args[3], args[4]);} public int /*long*/ method5 (int /*long*/[] args) {return Confirm (args[0], args[1], args[2], args[3]);} public int /*long*/ method6 (int /*long*/[] args) {return ConfirmCheck (args[0], args[1], args[2], args[3], args[4], args[5]);} - public int /*long*/ method7 (int /*long*/[] args) {return ConfirmEx (args[0], args[1], args[2], (int)/*64*/args[3], args[4], args[5], args[6], args[7], args[8], args[9]);} + public int /*long*/ method7 (int /*long*/[] args) {return ConfirmEx (args[0], args[1], args[2], cast(int)/*64*/args[3], args[4], args[5], args[6], args[7], args[8], args[9]);} public int /*long*/ method8 (int /*long*/[] args) {return Prompt (args[0], args[1], args[2], args[3], args[4], args[5], args[6]);} public int /*long*/ method9 (int /*long*/[] args) {return PromptUsernameAndPassword (args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7]);} public int /*long*/ method10 (int /*long*/[] args) {return PromptPassword (args[0], args[1], args[2], args[3], args[4], args[5], args[6]);} - public int /*long*/ method11 (int /*long*/[] args) {return Select (args[0], args[1], args[2], (int)/*64*/args[3], args[4], args[5], args[6]);} + public int /*long*/ method11 (int /*long*/[] args) {return Select (args[0], args[1], args[2], cast(int)/*64*/args[3], args[4], args[5], args[6]);} }; promptService2 = new XPCOMObject (new int[] {2, 0, 0, 3, 5, 4, 6, 10, 7, 8, 7, 7, 7, 9}) { @@ -80,13 +80,13 @@ public int /*long*/ method4 (int /*long*/[] args) {return AlertCheck (args[0], args[1], args[2], args[3], args[4]);} public int /*long*/ method5 (int /*long*/[] args) {return Confirm (args[0], args[1], args[2], args[3]);} public int /*long*/ method6 (int /*long*/[] args) {return ConfirmCheck (args[0], args[1], args[2], args[3], args[4], args[5]);} - public int /*long*/ method7 (int /*long*/[] args) {return ConfirmEx (args[0], args[1], args[2], (int)/*64*/args[3], args[4], args[5], args[6], args[7], args[8], args[9]);} + public int /*long*/ method7 (int /*long*/[] args) {return ConfirmEx (args[0], args[1], args[2], cast(int)/*64*/args[3], args[4], args[5], args[6], args[7], args[8], args[9]);} public int /*long*/ method8 (int /*long*/[] args) {return Prompt (args[0], args[1], args[2], args[3], args[4], args[5], args[6]);} public int /*long*/ method9 (int /*long*/[] args) {return PromptUsernameAndPassword (args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7]);} public int /*long*/ method10 (int /*long*/[] args) {return PromptPassword (args[0], args[1], args[2], args[3], args[4], args[5], args[6]);} - public int /*long*/ method11 (int /*long*/[] args) {return Select (args[0], args[1], args[2], (int)/*64*/args[3], args[4], args[5], args[6]);} - public int /*long*/ method12 (int /*long*/[] args) {return PromptAuth (args[0], args[1], (int)/*64*/args[2], args[3], args[4], args[5], args[6]);} - public int /*long*/ method13 (int /*long*/[] args) {return AsyncPromptAuth (args[0], args[1], args[2], args[3], (int)/*64*/args[4], args[5], args[6], args[7], args[8]);} + public int /*long*/ method11 (int /*long*/[] args) {return Select (args[0], args[1], args[2], cast(int)/*64*/args[3], args[4], args[5], args[6]);} + public int /*long*/ method12 (int /*long*/[] args) {return PromptAuth (args[0], args[1], cast(int)/*64*/args[2], args[3], args[4], args[5], args[6]);} + public int /*long*/ method13 (int /*long*/[] args) {return AsyncPromptAuth (args[0], args[1], args[2], args[3], cast(int)/*64*/args[4], args[5], args[6], args[7], args[8]);} }; } diff -r fb2555104d70 -r 5b53d338c709 dwt/browser/PromptService2Factory.d --- a/dwt/browser/PromptService2Factory.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/browser/PromptService2Factory.d Fri Aug 29 22:04:22 2008 +0200 @@ -24,7 +24,7 @@ XPCOMObject factory; int refCount = 0; -PromptService2Factory () { +this () { createCOMInterfaces (); } @@ -46,7 +46,7 @@ public int /*long*/ method1 (int /*long*/[] args) {return AddRef ();} public int /*long*/ method2 (int /*long*/[] args) {return Release ();} public int /*long*/ method3 (int /*long*/[] args) {return CreateInstance (args[0], args[1], args[2]);} - public int /*long*/ method4 (int /*long*/[] args) {return LockFactory ((int)/*64*/args[0]);} + public int /*long*/ method4 (int /*long*/[] args) {return LockFactory (cast(int)/*64*/args[0]);} }; } diff -r fb2555104d70 -r 5b53d338c709 dwt/browser/SimpleEnumerator.d --- a/dwt/browser/SimpleEnumerator.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/browser/SimpleEnumerator.d Fri Aug 29 22:04:22 2008 +0200 @@ -26,7 +26,7 @@ nsISupports[] values; int index = 0; -SimpleEnumerator (nsISupports[] values) { +this (nsISupports[] values) { this.values = values; for (int i = 0; i < values.length; i++) { values[i].AddRef (); diff -r fb2555104d70 -r 5b53d338c709 dwt/browser/WindowCreator2.d --- a/dwt/browser/WindowCreator2.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/browser/WindowCreator2.d Fri Aug 29 22:04:22 2008 +0200 @@ -35,7 +35,7 @@ XPCOMObject windowCreator2; int refCount = 0; -WindowCreator2 () { +this () { createCOMInterfaces (); } @@ -56,15 +56,15 @@ public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);} public int /*long*/ method1 (int /*long*/[] args) {return AddRef ();} public int /*long*/ method2 (int /*long*/[] args) {return Release ();} - public int /*long*/ method3 (int /*long*/[] args) {return CreateChromeWindow (args[0], (int)/*64*/args[1], args[2]);} + public int /*long*/ method3 (int /*long*/[] args) {return CreateChromeWindow (args[0], cast(int)/*64*/args[1], args[2]);} }; windowCreator2 = new XPCOMObject (new int[] {2, 0, 0, 3, 6}) { public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);} public int /*long*/ method1 (int /*long*/[] args) {return AddRef ();} public int /*long*/ method2 (int /*long*/[] args) {return Release ();} - public int /*long*/ method3 (int /*long*/[] args) {return CreateChromeWindow (args[0], (int)/*64*/args[1], args[2]);} - public int /*long*/ method4 (int /*long*/[] args) {return CreateChromeWindow2 (args[0], (int)/*64*/args[1], (int)/*64*/args[2], args[3], args[4], args[5]);} + public int /*long*/ method3 (int /*long*/[] args) {return CreateChromeWindow (args[0], cast(int)/*64*/args[1], args[2]);} + public int /*long*/ method4 (int /*long*/[] args) {return CreateChromeWindow2 (args[0], cast(int)/*64*/args[1], cast(int)/*64*/args[2], args[3], args[4], args[5]);} }; } @@ -221,7 +221,7 @@ } } if (doit) { - Mozilla mozilla = (Mozilla)browser.webBrowser; + Mozilla mozilla = cast(Mozilla)browser.webBrowser; mozilla.isChild = true; int /*long*/ chromePtr = mozilla.webBrowserChrome.getAddress (); nsIWebBrowserChrome webBrowserChrome = new nsIWebBrowserChrome (chromePtr); diff -r fb2555104d70 -r 5b53d338c709 dwt/browser/WindowEvent.d --- a/dwt/browser/WindowEvent.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/browser/WindowEvent.d Fri Aug 29 22:04:22 2008 +0200 @@ -66,12 +66,12 @@ * }); * browser.addVisibilityWindowListener(new VisibilityWindowListener() { * public void hide(WindowEvent event) { - * Browser browser = (Browser)event.widget; + * Browser browser = cast(Browser)event.widget; * Shell shell = browser.getShell(); * shell.setVisible(false); * } * public void show(WindowEvent event) { - * Browser browser = (Browser)event.widget; + * Browser browser = cast(Browser)event.widget; * Shell shell = browser.getShell(); * if (event.location !is null) shell.setLocation(event.location); * if (event.size !is null) { @@ -88,7 +88,7 @@ * }); * browser.addCloseWindowListener(new CloseWindowListener() { * public void close(WindowEvent event) { - * Browser browser = (Browser)event.widget; + * Browser browser = cast(Browser)event.widget; * Shell shell = browser.getShell(); * shell.close(); * } diff -r fb2555104d70 -r 5b53d338c709 dwt/custom/CBanner.d --- a/dwt/custom/CBanner.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/custom/CBanner.d Fri Aug 29 22:04:22 2008 +0200 @@ -42,7 +42,7 @@ *
Styles:
*
NONE
*
Events:
- *
(None)
+ *
cast(None)
* *

* IMPORTANT: This class is not intended to be subclassed. diff -r fb2555104d70 -r 5b53d338c709 dwt/custom/CTabItem.d --- a/dwt/custom/CTabItem.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/custom/CTabItem.d Fri Aug 29 22:04:22 2008 +0200 @@ -1077,7 +1077,7 @@ /** * Sets to true to indicate that the receiver's close button should be shown. - * If the parent (CTabFolder) was created with DWT.CLOSE style, changing this value has + * If the parent cast(CTabFolder) was created with DWT.CLOSE style, changing this value has * no effect. * * @param close the new state of the close button diff -r fb2555104d70 -r 5b53d338c709 dwt/custom/DefaultContent.d --- a/dwt/custom/DefaultContent.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/custom/DefaultContent.d Fri Aug 29 22:04:22 2008 +0200 @@ -35,7 +35,7 @@ * Creates a new DefaultContent and initializes it. A StyledTextContent will always have * at least one empty line. */ -DefaultContent() { +this() { super(); setText(""); } @@ -728,7 +728,7 @@ public void removeTextChangeListener(TextChangeListener listener){ if (listener is null) error(DWT.ERROR_NULL_ARGUMENT); for (int i = 0; i < textListeners.size(); i++) { - TypedListener typedListener = (TypedListener) textListeners.elementAt(i); + TypedListener typedListener = cast(TypedListener) textListeners.elementAt(i); if (typedListener.getEventListener () is listener) { textListeners.removeElementAt(i); break; @@ -791,7 +791,7 @@ */ void sendTextEvent(StyledTextEvent event) { for (int i = 0; i < textListeners.size(); i++) { - ((StyledTextListener)textListeners.elementAt(i)).handleEvent(event); + (cast(StyledTextListener)textListeners.elementAt(i)).handleEvent(event); } } /** diff -r fb2555104d70 -r 5b53d338c709 dwt/custom/ExtendedModifyEvent.d --- a/dwt/custom/ExtendedModifyEvent.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/custom/ExtendedModifyEvent.d Fri Aug 29 22:04:22 2008 +0200 @@ -25,7 +25,7 @@ static final long serialVersionUID = 3258696507027830832L; -public ExtendedModifyEvent(StyledTextEvent e) { +public this(StyledTextEvent e) { super(e); start = e.start; length = e.end - e.start; diff -r fb2555104d70 -r 5b53d338c709 dwt/custom/LineBackgroundEvent.d --- a/dwt/custom/LineBackgroundEvent.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/custom/LineBackgroundEvent.d Fri Aug 29 22:04:22 2008 +0200 @@ -35,7 +35,7 @@ static final long serialVersionUID = 3978711687853324342L; -public LineBackgroundEvent(StyledTextEvent e) { +public this(StyledTextEvent e) { super(e); lineOffset = e.detail; lineText = e.text; diff -r fb2555104d70 -r 5b53d338c709 dwt/custom/LineStyleEvent.d --- a/dwt/custom/LineStyleEvent.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/custom/LineStyleEvent.d Fri Aug 29 22:04:22 2008 +0200 @@ -80,7 +80,7 @@ static final long serialVersionUID = 3906081274027192884L; -public LineStyleEvent(StyledTextEvent e) { +public this(StyledTextEvent e) { super(e); styles = e.styles; ranges = e.ranges; diff -r fb2555104d70 -r 5b53d338c709 dwt/custom/MovementEvent.d --- a/dwt/custom/MovementEvent.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/custom/MovementEvent.d Fri Aug 29 22:04:22 2008 +0200 @@ -53,7 +53,7 @@ static final long serialVersionUID = 3978765487853324342L; -public MovementEvent(StyledTextEvent e) { +public this(StyledTextEvent e) { super(e); lineOffset = e.detail; lineText = e.text; diff -r fb2555104d70 -r 5b53d338c709 dwt/custom/PaintObjectEvent.d --- a/dwt/custom/PaintObjectEvent.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/custom/PaintObjectEvent.d Fri Aug 29 22:04:22 2008 +0200 @@ -62,7 +62,7 @@ static final long serialVersionUID = 3906081274027192855L; -public PaintObjectEvent(StyledTextEvent e) { +public this(StyledTextEvent e) { super(e); gc = e.gc; x = e.x; diff -r fb2555104d70 -r 5b53d338c709 dwt/custom/PopupList.d --- a/dwt/custom/PopupList.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/custom/PopupList.d Fri Aug 29 22:04:22 2008 +0200 @@ -32,7 +32,7 @@ * * @param parent a Shell control which will be the parent of the new instance (cannot be null) */ -public PopupList(Shell parent) { +public this(Shell parent) { this (parent, 0); } /** @@ -43,7 +43,7 @@ * * @since 3.0 */ -public PopupList(Shell parent, int style) { +public this(Shell parent, int style) { shell = new Shell(parent, checkStyle(style)); list = new List(shell, DWT.SINGLE | DWT.V_SCROLL); diff -r fb2555104d70 -r 5b53d338c709 dwt/custom/SashForm.d --- a/dwt/custom/SashForm.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/custom/SashForm.d Fri Aug 29 22:04:22 2008 +0200 @@ -72,7 +72,7 @@ * @see DWT#VERTICAL * @see #getStyle() */ -public SashForm(Composite parent, int style) { +public this(Composite parent, int style) { super(parent, checkStyle(style)); super.setLayout(new SashFormLayout()); sashStyle = ((style & DWT.VERTICAL) !is 0) ? DWT.HORIZONTAL : DWT.VERTICAL; @@ -152,8 +152,8 @@ int[] ratios = new int[cArray.length]; for (int i = 0; i < cArray.length; i++) { Object data = cArray[i].getLayoutData(); - if (data !is null && data instanceof SashFormData) { - ratios[i] = (int)(((SashFormData)data).weight * 1000 >> 16); + if (data !is null && null !is cast(SashFormData)data ) { + ratios[i] = cast(int)((cast(SashFormData)data).weight * 1000 >> 16); } else { ratios[i] = 200; } @@ -175,7 +175,7 @@ return result; } void onDragSash(Event event) { - Sash sash = (Sash)event.widget; + Sash sash = cast(Sash)event.widget; int sashIndex = -1; for (int i= 0; i < sashes.length; i++) { if (sashes[i] is sash) { @@ -215,17 +215,17 @@ event.doit = false; } Object data1 = c1.getLayoutData(); - if (data1 is null || !(data1 instanceof SashFormData)) { + if (data1 is null || !( null !is cast(SashFormData)data1 )) { data1 = new SashFormData(); c1.setLayoutData(data1); } Object data2 = c2.getLayoutData(); - if (data2 is null || !(data2 instanceof SashFormData)) { + if (data2 is null || !( null !is cast(SashFormData)data2 )) { data2 = new SashFormData(); c2.setLayoutData(data2); } - ((SashFormData)data1).weight = (((long)b1.width << 16) + area.width - 1) / area.width; - ((SashFormData)data2).weight = (((long)b2.width << 16) + area.width - 1) / area.width; + (cast(SashFormData)data1).weight = ((cast(long)b1.width << 16) + area.width - 1) / area.width; + (cast(SashFormData)data2).weight = ((cast(long)b2.width << 16) + area.width - 1) / area.width; } else { correction = b1.height < DRAG_MINIMUM || b2.height < DRAG_MINIMUM; int totalHeight = b2.y + b2.height - b1.y; @@ -248,17 +248,17 @@ event.doit = false; } Object data1 = c1.getLayoutData(); - if (data1 is null || !(data1 instanceof SashFormData)) { + if (data1 is null || !( null !is cast(SashFormData)data1 )) { data1 = new SashFormData(); c1.setLayoutData(data1); } Object data2 = c2.getLayoutData(); - if (data2 is null || !(data2 instanceof SashFormData)) { + if (data2 is null || !( null !is cast(SashFormData)data2 )) { data2 = new SashFormData(); c2.setLayoutData(data2); } - ((SashFormData)data1).weight = (((long)b1.height << 16) + area.height - 1) / area.height; - ((SashFormData)data2).weight = (((long)b2.height << 16) + area.height - 1) / area.height; + (cast(SashFormData)data1).weight = ((cast(long)b1.height << 16) + area.height - 1) / area.height; + (cast(SashFormData)data2).weight = ((cast(long)b2.height << 16) + area.height - 1) / area.height; } if (correction || (event.doit && event.detail !is DWT.DRAG)) { c1.setBounds(b1); @@ -416,11 +416,11 @@ } for (int i = 0; i < cArray.length; i++) { Object data = cArray[i].getLayoutData(); - if (data is null || !(data instanceof SashFormData)) { + if (data is null || !( null !is cast(SashFormData)data )) { data = new SashFormData(); cArray[i].setLayoutData(data); } - ((SashFormData)data).weight = (((long)weights[i] << 16) + total - 1) / total; + (cast(SashFormData)data).weight = ((cast(long)weights[i] << 16) + total - 1) / total; } layout(false); diff -r fb2555104d70 -r 5b53d338c709 dwt/custom/SashFormLayout.d --- a/dwt/custom/SashFormLayout.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/custom/SashFormLayout.d Fri Aug 29 22:04:22 2008 +0200 @@ -21,7 +21,7 @@ */ class SashFormLayout : Layout { protected Point computeSize(Composite composite, int wHint, int hHint, bool flushCache) { - SashForm sashForm = (SashForm)composite; + SashForm sashForm = cast(SashForm)composite; Control[] cArray = sashForm.getControls(true); int width = 0; int height = 0; @@ -56,12 +56,12 @@ long total = 0; for (int i = 0; i < cArray.length; i++) { Object data = cArray[i].getLayoutData(); - if (data !is null && data instanceof SashFormData) { - ratios[i] = ((SashFormData)data).weight; + if (data !is null && null !is cast(SashFormData)data ) { + ratios[i] = (cast(SashFormData)data).weight; } else { data = new SashFormData(); cArray[i].setLayoutData(data); - ((SashFormData)data).weight = ratios[i] = ((200 << 16) + 999) / 1000; + (cast(SashFormData)data).weight = ratios[i] = ((200 << 16) + 999) / 1000; } total += ratios[i]; @@ -69,9 +69,9 @@ if (ratios[maxIndex] > 0) { int sashwidth = sashForm.sashes.length > 0 ? sashForm.SASH_WIDTH + sashForm.sashes [0].getBorderWidth() * 2 : sashForm.SASH_WIDTH; if (vertical) { - height += (int)(total * maxValue / ratios[maxIndex]) + (cArray.length - 1) * sashwidth; + height += cast(int)(total * maxValue / ratios[maxIndex]) + (cArray.length - 1) * sashwidth; } else { - width += (int)(total * maxValue / ratios[maxIndex]) + (cArray.length - 1) * sashwidth; + width += cast(int)(total * maxValue / ratios[maxIndex]) + (cArray.length - 1) * sashwidth; } } width += sashForm.getBorderWidth()*2; @@ -86,7 +86,7 @@ } protected void layout(Composite composite, bool flushCache) { - SashForm sashForm = (SashForm)composite; + SashForm sashForm = cast(SashForm)composite; Rectangle area = sashForm.getClientArea(); if (area.width <= 1 || area.height <= 1) return; @@ -141,12 +141,12 @@ long total = 0; for (int i = 0; i < controls.length; i++) { Object data = controls[i].getLayoutData(); - if (data !is null && data instanceof SashFormData) { - ratios[i] = ((SashFormData)data).weight; + if (data !is null && null !is cast(SashFormData)data ) { + ratios[i] = (cast(SashFormData)data).weight; } else { data = new SashFormData(); controls[i].setLayoutData(data); - ((SashFormData)data).weight = ratios[i] = ((200 << 16) + 999) / 1000; + (cast(SashFormData)data).weight = ratios[i] = ((200 << 16) + 999) / 1000; } total += ratios[i]; @@ -154,14 +154,14 @@ int sashwidth = sashes.length > 0 ? sashForm.SASH_WIDTH + sashes [0].getBorderWidth() * 2 : sashForm.SASH_WIDTH; if (sashForm.getOrientation() is DWT.HORIZONTAL) { - int width = (int)(ratios[0] * (area.width - sashes.length * sashwidth) / total); + int width = cast(int)(ratios[0] * (area.width - sashes.length * sashwidth) / total); int x = area.x; controls[0].setBounds(x, area.y, width, area.height); x += width; for (int i = 1; i < controls.length - 1; i++) { sashes[i - 1].setBounds(x, area.y, sashwidth, area.height); x += sashwidth; - width = (int)(ratios[i] * (area.width - sashes.length * sashwidth) / total); + width = cast(int)(ratios[i] * (area.width - sashes.length * sashwidth) / total); controls[i].setBounds(x, area.y, width, area.height); x += width; } @@ -172,14 +172,14 @@ controls[controls.length - 1].setBounds(x, area.y, width, area.height); } } else { - int height = (int)(ratios[0] * (area.height - sashes.length * sashwidth) / total); + int height = cast(int)(ratios[0] * (area.height - sashes.length * sashwidth) / total); int y = area.y; controls[0].setBounds(area.x, y, area.width, height); y += height; for (int i = 1; i < controls.length - 1; i++) { sashes[i - 1].setBounds(area.x, y, area.width, sashwidth); y += sashwidth; - height = (int)(ratios[i] * (area.height - sashes.length * sashwidth) / total); + height = cast(int)(ratios[i] * (area.height - sashes.length * sashwidth) / total); controls[i].setBounds(area.x, y, area.width, height); y += height; } diff -r fb2555104d70 -r 5b53d338c709 dwt/custom/ScrolledComposite.d --- a/dwt/custom/ScrolledComposite.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/custom/ScrolledComposite.d Fri Aug 29 22:04:22 2008 +0200 @@ -138,7 +138,7 @@ * @see DWT#V_SCROLL * @see #getStyle() */ -public ScrolledComposite(Composite parent, int style) { +public this(Composite parent, int style) { super(parent, checkStyle(style)); super.setLayout(new ScrolledCompositeLayout()); ScrollBar hBar = getHorizontalBar (); @@ -170,8 +170,8 @@ filter = new Listener() { public void handleEvent(Event event) { - if (event.widget instanceof Control) { - Control control = (Control) event.widget; + if ( null !is cast(Control)event.widget ) { + Control control = cast(Control) event.widget; if (contains(control)) showControl(control); } } @@ -193,7 +193,7 @@ if (control is null || control.isDisposed()) return false; Composite parent = control.getParent(); - while (parent !is null && !(parent instanceof Shell)) { + while (parent !is null && !( null !is cast(Shell)parent )) { if (this is parent) return true; parent = parent.getParent(); } diff -r fb2555104d70 -r 5b53d338c709 dwt/custom/ScrolledCompositeLayout.d --- a/dwt/custom/ScrolledCompositeLayout.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/custom/ScrolledCompositeLayout.d Fri Aug 29 22:04:22 2008 +0200 @@ -26,7 +26,7 @@ static final int DEFAULT_HEIGHT = 64; protected Point computeSize(Composite composite, int wHint, int hHint, bool flushCache) { - ScrolledComposite sc = (ScrolledComposite)composite; + ScrolledComposite sc = cast(ScrolledComposite)composite; Point size = new Point(DEFAULT_WIDTH, DEFAULT_HEIGHT); if (sc.content !is null) { Point preferredSize = sc.content.computeSize(wHint, hHint, flushCache); @@ -47,7 +47,7 @@ protected void layout(Composite composite, bool flushCache) { if (inLayout) return; - ScrolledComposite sc = (ScrolledComposite)composite; + ScrolledComposite sc = cast(ScrolledComposite)composite; if (sc.content is null) return; ScrollBar hBar = sc.getHorizontalBar(); ScrollBar vBar = sc.getVerticalBar(); diff -r fb2555104d70 -r 5b53d338c709 dwt/custom/StyleRange.d --- a/dwt/custom/StyleRange.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/custom/StyleRange.d Fri Aug 29 22:04:22 2008 +0200 @@ -40,7 +40,7 @@ * * @since 3.2 */ -public StyleRange() { +public this() { } /** @@ -50,7 +50,7 @@ * *@since 3.4 */ -public StyleRange(TextStyle style) { +public this(TextStyle style) { super(style); } @@ -62,7 +62,7 @@ * @param foreground foreground color of the style, null if none * @param background background color of the style, null if none */ -public StyleRange(int start, int length, Color foreground, Color background) { +public this(int start, int length, Color foreground, Color background) { super(null, foreground, background); this.start = start; this.length = length; @@ -77,7 +77,7 @@ * @param background background color of the style, null if none * @param fontStyle font style of the style, may be DWT.NORMAL, DWT.ITALIC or DWT.BOLD */ -public StyleRange(int start, int length, Color foreground, Color background, int fontStyle) { +public this(int start, int length, Color foreground, Color background, int fontStyle) { this(start, length, foreground, background); this.fontStyle = fontStyle; } @@ -94,8 +94,8 @@ */ public bool opEquals(Object object) { if (object is this) return true; - if (object instanceof StyleRange) { - StyleRange style = (StyleRange)object; + if ( null !is cast(StyleRange)object ) { + StyleRange style = cast(StyleRange)object; if (start !is style.start) return false; if (length !is style.length) return false; return similarTo(style); diff -r fb2555104d70 -r 5b53d338c709 dwt/custom/StyledText.d --- a/dwt/custom/StyledText.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/custom/StyledText.d Fri Aug 29 22:04:22 2008 +0200 @@ -205,7 +205,7 @@ * @param printer printer device to print on. * @param printOptions print options */ - Printing(StyledText styledText, Printer printer, StyledTextPrintOptions printOptions) { + this(StyledText styledText, Printer printer, StyledTextPrintOptions printOptions) { this.printer = printer; this.printOptions = printOptions; this.mirrored = (styledText.getStyle() & DWT.MIRRORED) !is 0; @@ -273,7 +273,7 @@ Color color = printerRenderer.getLineBackground(i, null); if (color !is null) { if (printOptions.printLineBackground) { - Color printerColor = (Color)resources.get(color); + Color printerColor = cast(Color)resources.get(color); if (printerColor is null) { printerColor = new Color (printer, color.getRGB()); resources.put(color, printerColor); @@ -293,7 +293,7 @@ StyleRange style = styles[i]; Font font = style.font; if (style.font !is null) { - Font printerFont = (Font)resources.get(font); + Font printerFont = cast(Font)resources.get(font); if (printerFont is null) { printerFont = new Font (printer, font.getFontData()); resources.put(font, printerFont); @@ -302,7 +302,7 @@ } Color color = style.foreground; if (color !is null) { - Color printerColor = (Color)resources.get(color); + Color printerColor = cast(Color)resources.get(color); if (printOptions.printTextForeground) { if (printerColor is null) { printerColor = new Color (printer, color.getRGB()); @@ -315,7 +315,7 @@ } color = style.background; if (color !is null) { - Color printerColor = (Color)resources.get(color); + Color printerColor = cast(Color)resources.get(color); if (printOptions.printTextBackground) { if (printerColor is null) { printerColor = new Color (printer, color.getRGB()); @@ -373,7 +373,7 @@ if (resources !is null) { Enumeration enumeration = resources.elements(); while (enumeration.hasMoreElements()) { - Resource resource = (Resource) enumeration.nextElement(); + Resource resource = cast(Resource) enumeration.nextElement(); resource.dispose(); } resources = null; @@ -505,7 +505,7 @@ int height = paragraphBottom - paintY; gc.setClipping(clientArea.x, paintY, clientArea.width, height); printLine(paintX, paintY, gc, foreground, lineBackground, layout, printLayout, i); - gc.setClipping((Rectangle)null); + gc.setClipping(cast(Rectangle)null); printDecoration(page, false, printLayout); printer.endPage(); page++; @@ -516,7 +516,7 @@ int layoutHeight = layout.getBounds().height; gc.setClipping(clientArea.x, clientArea.y, clientArea.width, layoutHeight - height); printLine(paintX, paintY, gc, foreground, lineBackground, layout, printLayout, i); - gc.setClipping((Rectangle)null); + gc.setClipping(cast(Rectangle)null); paintY += layoutHeight; } } @@ -676,7 +676,7 @@ * beginning of document * @param length length of content to write */ - public RTFWriter(int start, int length) { + public this(int start, int length) { super(start, length); colorTable = new Vector(); fontTable = new Vector(); @@ -779,7 +779,7 @@ write(String.substring(start, index)); } write("\\u"); - write(Integer.toString((short) ch)); + write(Integer.toString(cast(short) ch)); write(' '); // control word delimiter start = index + 1; } else if (ch is '}' || ch is '{' || ch is '\\') { @@ -821,13 +821,13 @@ header.append("\\f"); header.append(i); header.append(" "); - FontData fd = ((Font)fontTable.elementAt(i)).getFontData()[0]; + FontData fd = (cast(Font)fontTable.elementAt(i)).getFontData()[0]; header.append(fd.getName()); header.append(";"); } header.append("}}\n{\\colortbl"); for (int i = 0; i < colorTable.size(); i++) { - Color color = (Color) colorTable.elementAt(i); + Color color = cast(Color) colorTable.elementAt(i); header.append("\\red"); header.append(color.getRed()); header.append("\\green"); @@ -1054,7 +1054,7 @@ * @param start start offset of content to write, 0 based from beginning of document * @param length length of content to write */ - public TextWriter(int start, int length) { + public this(int start, int length) { buffer = new StringBuffer(length); startOffset = start; endOffset = start + length; @@ -1210,7 +1210,7 @@ * @see DWT#WRAP * @see #getStyle */ -public StyledText(Composite parent, int style) { +public this(Composite parent, int style) { super(parent, checkStyle(style)); // set the fg in the OS to ensure that these are the same as StyledText, necessary // for ensuring that the bg/fg the IME box uses is the same as what StyledText uses @@ -3367,7 +3367,7 @@ */ public int getKeyBinding(int key) { checkWidget(); - Integer action = (Integer) keyActionMap.get(new Integer(key)); + Integer action = cast(Integer) keyActionMap.get(new Integer(key)); return action is null ? DWT.NULL : action.intValue(); } /** @@ -4069,8 +4069,8 @@ * @return start and end of the selection, x is the offset of the first * selected character, y is the offset after the last selected character. * The selection values returned are visual (i.e., x will always always be - * <= y). To determine if a selection is right-to-left (RtoL) vs. left-to-right - * (LtoR), compare the caretOffset to the start and end of the selection + * <= y). To determine if a selection is right-to-left cast(RtoL) vs. left-to-right + * cast(LtoR), compare the caretOffset to the start and end of the selection * (e.g., caretOffset is start of selection implies that the selection is RtoL). * @see #getSelectionRange * @exception DWTException

*/ - public DropTargetEffect(Control control) { + public this(Control control) { if (control is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); this.control = control; } @@ -85,11 +85,11 @@ * @return the item at the given x-y coordinate, or null if the coordinate is not in a selectable item */ public Widget getItem(int x, int y) { - if (control instanceof Table) { - return getItem((Table) control, x, y); + if ( null !is cast(Table)control ) { + return getItem(cast(Table) control, x, y); } - if (control instanceof Tree) { - return getItem((Tree) control, x, y); + if ( null !is cast(Tree)control ) { + return getItem(cast(Tree) control, x, y); } return null; } diff -r fb2555104d70 -r 5b53d338c709 dwt/dnd/DropTargetEvent.d --- a/dwt/dnd/DropTargetEvent.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/dnd/DropTargetEvent.d Fri Aug 29 22:04:22 2008 +0200 @@ -87,7 +87,7 @@ * * @param e the untyped event containing the information */ -public DropTargetEvent(DNDEvent e) { +public this(DNDEvent e) { super(e); this.data = e.data; this.x = e.x; diff -r fb2555104d70 -r 5b53d338c709 dwt/dnd/DropTargetListener.d --- a/dwt/dnd/DropTargetListener.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/dnd/DropTargetListener.d Fri Aug 29 22:04:22 2008 +0200 @@ -176,9 +176,9 @@ *

  * public void dragOver(DropTargetEvent event) {
  *       TextTransfer textTransfer = TextTransfer.getInstance();
- *       String data = (String)textTransfer.nativeToJava(event.currentDataType);
+ *       String data = cast(String)textTransfer.nativeToJava(event.currentDataType);
  *       if (data !is null) {
- *           System.out.println("Data to be dropped is (Text)"+data);
+ *           System.out.println("Data to be dropped is cast(Text)"+data);
  *       }
  * };
  * 
diff -r fb2555104d70 -r 5b53d338c709 dwt/dnd/FileTransfer.d --- a/dwt/dnd/FileTransfer.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/dnd/FileTransfer.d Fri Aug 29 22:04:22 2008 +0200 @@ -41,7 +41,7 @@ static final int HFSID = registerType(HFS); static final int FURLID = registerType(FURL); -FileTransfer() {} +this() {} /** * Returns the singleton instance of the FileTransfer class. diff -r fb2555104d70 -r 5b53d338c709 dwt/dnd/HTMLTransfer.d --- a/dwt/dnd/HTMLTransfer.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/dnd/HTMLTransfer.d Fri Aug 29 22:04:22 2008 +0200 @@ -31,7 +31,7 @@ static final String HTML = "HTML"; //$NON-NLS-1$ static final int HTMLID = registerType(HTML); -HTMLTransfer() {} +this() {} /** * Returns the singleton instance of the HTMLTransfer class. @@ -55,7 +55,7 @@ if (!checkHTML(object) || !isSupportedType(transferData)) { DND.error(DND.ERROR_INVALID_DATA); } - String String = (String)object; + String String = cast(String)object; int count = String.length(); char[] chars = new char[count]; String.getChars(0, count, chars, 0); @@ -94,7 +94,7 @@ } bool checkHTML(Object object) { - return (object !is null && object instanceof String && ((String)object).length() > 0); + return (object !is null && null !is cast(String)object && (cast(String)object).length() > 0); } protected bool validate(Object object) { diff -r fb2555104d70 -r 5b53d338c709 dwt/dnd/ImageTransfer.d --- a/dwt/dnd/ImageTransfer.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/dnd/ImageTransfer.d Fri Aug 29 22:04:22 2008 +0200 @@ -41,7 +41,7 @@ static final int PICTID = registerType(PICT); static final int TIFFID = registerType(TIFF); -ImageTransfer() { +this() { } /** @@ -72,7 +72,7 @@ } transferData.result = -1; - ImageData imgData = (ImageData) object; + ImageData imgData = cast(ImageData) object; Image image = new Image(Display.getCurrent(), imgData); int handle = image.handle; int width = OS.CGImageGetWidth(handle); @@ -83,8 +83,8 @@ Rect rect = new Rect(); rect.left = 0; rect.top = 0; - rect.right = (short) width; - rect.bottom = (short) height; + rect.right = cast(short) width; + rect.bottom = cast(short) height; int[] gWorld = new int[1]; int format = OS.k24RGBPixelFormat; @@ -98,7 +98,7 @@ OS.SetGWorld(gWorld[0], curGWorld[0]); int pictHandle = OS.OpenPicture(rect); int portBitMap = OS.GetPortBitMapForCopyBits(gWorld[0]); - OS.CopyBits(portBitMap, portBitMap, rect, rect, (short) OS.srcCopy, 0); + OS.CopyBits(portBitMap, portBitMap, rect, rect, cast(short) OS.srcCopy, 0); OS.ClosePicture(); OS.SetGWorld(curPort[0], curGWorld[0]); OS.DisposeGWorld(gWorld[0]); @@ -142,8 +142,8 @@ // get bounds for the image CGRect rect = new CGRect(); OS.QDPictGetBounds(pictDataRef, rect); - int width = (int) rect.width; - int height = (int) rect.height; + int width = cast(int) rect.width; + int height = cast(int) rect.height; /* Create the image */ int bpr = width * 4; @@ -200,7 +200,7 @@ } bool checkImage(Object object) { - if (object is null || !(object instanceof ImageData)) return false; + if (object is null || !( null !is cast(ImageData)object )) return false; return true; } diff -r fb2555104d70 -r 5b53d338c709 dwt/dnd/RTFTransfer.d --- a/dwt/dnd/RTFTransfer.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/dnd/RTFTransfer.d Fri Aug 29 22:04:22 2008 +0200 @@ -32,7 +32,7 @@ static final String RTF = "RTF "; //$NON-NLS-1$ static final int RTFID = registerType(RTF); -RTFTransfer() {} +this() {} /** * Returns the singleton instance of the RTFTransfer class. @@ -57,7 +57,7 @@ DND.error(DND.ERROR_INVALID_DATA); } transferData.result = -1; - String String = (String)object; + String String = cast(String)object; int count = String.length(); char[] chars = new char[count]; String.getChars(0, count, chars, 0); @@ -68,10 +68,10 @@ range.length = chars.length; int encoding = OS.CFStringGetSystemEncoding(); int[] size = new int[1]; - int numChars = OS.CFStringGetBytes(cfString, range, encoding, (byte)'?', true, null, 0, size); + int numChars = OS.CFStringGetBytes(cfString, range, encoding, cast(byte)'?', true, null, 0, size); if (numChars is 0 || size[0] is 0) return; byte[] buffer = new byte[size[0]]; - numChars = OS.CFStringGetBytes(cfString, range, encoding, (byte)'?', true, buffer, size [0], size); + numChars = OS.CFStringGetBytes(cfString, range, encoding, cast(byte)'?', true, buffer, size [0], size); if (numChars is 0) return; transferData.data = new byte[1][]; transferData.data[0] = buffer; @@ -120,7 +120,7 @@ } bool checkRTF(Object object) { - return (object !is null && object instanceof String && ((String)object).length() > 0); + return (object !is null && null !is cast(String)object && (cast(String)object).length() > 0); } protected bool validate(Object object) { diff -r fb2555104d70 -r 5b53d338c709 dwt/dnd/TableDragSourceEffect.d --- a/dwt/dnd/TableDragSourceEffect.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/dnd/TableDragSourceEffect.d Fri Aug 29 22:04:22 2008 +0200 @@ -36,7 +36,7 @@ * * @param table the Table that the user clicks on to initiate the drag */ - public TableDragSourceEffect(Table table) { + public this(Table table) { super(table); } } diff -r fb2555104d70 -r 5b53d338c709 dwt/dnd/TableDropTargetEffect.d --- a/dwt/dnd/TableDropTargetEffect.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/dnd/TableDropTargetEffect.d Fri Aug 29 22:04:22 2008 +0200 @@ -72,7 +72,7 @@ if (display is null || display.isDisposed()) return null; Widget widget = display.findWidget(theControl); if (widget is null) return null; - return (DropTarget)widget.getData(DND.DROP_TARGET_KEY); + return cast(DropTarget)widget.getData(DND.DROP_TARGET_KEY); } /** @@ -81,7 +81,7 @@ * * @param table the Table over which the user positions the cursor to drop the data */ - public TableDropTargetEffect(Table table) { + public this(Table table) { super(table); } @@ -108,7 +108,7 @@ */ public void dragEnter(DropTargetEvent event) { if (callbacks is null) { - Table table = (Table) control; + Table table = cast(Table) control; DataBrowserCallbacks callbacks = new DataBrowserCallbacks (); OS.GetDataBrowserCallbacks (table.handle, callbacks); callbacks.v1_acceptDragCallback = AcceptDragProc.getAddress(); @@ -155,10 +155,10 @@ * @see DND#FEEDBACK_SCROLL */ public void dragOver(DropTargetEvent event) { - Table table = (Table) control; + Table table = cast(Table) control; int effect = checkEffect(event.feedback); - TableItem item = (TableItem)getItem(table, event.x, event.y); + TableItem item = cast(TableItem)getItem(table, event.x, event.y); if ((effect & DND.FEEDBACK_SCROLL) is 0) { scrollBeginTime = 0; @@ -191,6 +191,6 @@ } // store current effect for selection feedback - ((DropTarget)event.widget).feedback = effect; + (cast(DropTarget)event.widget).feedback = effect; } } diff -r fb2555104d70 -r 5b53d338c709 dwt/dnd/TextTransfer.d --- a/dwt/dnd/TextTransfer.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/dnd/TextTransfer.d Fri Aug 29 22:04:22 2008 +0200 @@ -35,7 +35,7 @@ static final int TEXTID = OS.kScrapFlavorTypeText; static final int UTEXTID = OS.kScrapFlavorTypeUnicode; -TextTransfer() {} +this() {} /** * Returns the singleton instance of the TextTransfer class. @@ -60,7 +60,7 @@ if (!checkText(object) || !isSupportedType(transferData)) { DND.error(DND.ERROR_INVALID_DATA); } - String String = (String)object; + String String = cast(String)object; char[] chars = new char[String.length()]; String.getChars (0, chars.length, chars, 0); transferData.result = -1; @@ -74,10 +74,10 @@ range.length = chars.length; int encoding = OS.CFStringGetSystemEncoding(); int[] size = new int[1]; - int numChars = OS.CFStringGetBytes(cfString, range, encoding, (byte)'?', true, null, 0, size); + int numChars = OS.CFStringGetBytes(cfString, range, encoding, cast(byte)'?', true, null, 0, size); if (numChars is 0) return; buffer = new byte[size[0]]; - numChars = OS.CFStringGetBytes(cfString, range, encoding, (byte)'?', true, buffer, size [0], size); + numChars = OS.CFStringGetBytes(cfString, range, encoding, cast(byte)'?', true, buffer, size [0], size); if (numChars is 0) return; } finally { OS.CFRelease(cfString); @@ -146,7 +146,7 @@ } bool checkText(Object object) { - return (object !is null && object instanceof String && ((String)object).length() > 0); + return (object !is null && null !is cast(String)object && (cast(String)object).length() > 0); } protected bool validate(Object object) { return checkText(object); diff -r fb2555104d70 -r 5b53d338c709 dwt/dnd/TreeDragSourceEffect.d --- a/dwt/dnd/TreeDragSourceEffect.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/dnd/TreeDragSourceEffect.d Fri Aug 29 22:04:22 2008 +0200 @@ -35,7 +35,7 @@ * * @param tree the Tree that the user clicks on to initiate the drag */ - public TreeDragSourceEffect(Tree tree) { + public this(Tree tree) { super(tree); } } diff -r fb2555104d70 -r 5b53d338c709 dwt/dnd/TreeDropTargetEffect.d --- a/dwt/dnd/TreeDropTargetEffect.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/dnd/TreeDropTargetEffect.d Fri Aug 29 22:04:22 2008 +0200 @@ -90,7 +90,7 @@ if (display is null || display.isDisposed()) return null; Widget widget = display.findWidget(theControl); if (widget is null) return null; - return (DropTarget)widget.getData(DND.DROP_TARGET_KEY); + return cast(DropTarget)widget.getData(DND.DROP_TARGET_KEY); } /** @@ -99,7 +99,7 @@ * * @param tree the Tree over which the user positions the cursor to drop the data */ - public TreeDropTargetEffect(Tree tree) { + public this(Tree tree) { super(tree); } @@ -126,7 +126,7 @@ */ public void dragEnter(DropTargetEvent event) { if (callbacks is null) { - Tree table = (Tree) control; + Tree table = cast(Tree) control; DataBrowserCallbacks callbacks = new DataBrowserCallbacks (); OS.GetDataBrowserCallbacks (table.handle, callbacks); callbacks.v1_acceptDragCallback = AcceptDragProc.getAddress(); @@ -154,7 +154,7 @@ * @see DropTargetEvent */ public void dragLeave(DropTargetEvent event) { - Tree tree = (Tree) control; + Tree tree = cast(Tree) control; if (insertItem !is null) { setInsertMark(tree, null, false); insertItem = null; @@ -184,8 +184,8 @@ * @see DND#FEEDBACK_SCROLL */ public void dragOver(DropTargetEvent event) { - Tree tree = (Tree) control; - TreeItem item = (TreeItem)getItem(tree, event.x, event.y); + Tree tree = cast(Tree) control; + TreeItem item = cast(TreeItem)getItem(tree, event.x, event.y); int effect = checkEffect(event.feedback); if ((effect & DND.FEEDBACK_EXPAND) is 0) { expandBeginTime = 0; @@ -198,7 +198,7 @@ e.x = event.x; e.y = event.y; e.item = item; - e.time = (int) System.currentTimeMillis(); + e.time = cast(int) System.currentTimeMillis(); tree.notifyListeners(DWT.Expand, e); if (item.isDisposed()) return; item.setExpanded(true); @@ -253,7 +253,7 @@ setInsertMark(tree, null, false); } // save current effect for selection feedback - ((DropTarget)event.widget).feedback = effect; + (cast(DropTarget)event.widget).feedback = effect; } void setInsertMark(Tree tree, TreeItem item, bool before) { diff -r fb2555104d70 -r 5b53d338c709 dwt/dnd/URLTransfer.d --- a/dwt/dnd/URLTransfer.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/dnd/URLTransfer.d Fri Aug 29 22:04:22 2008 +0200 @@ -1,1 +1,1 @@ -/******************************************************************************* * Copyright (c) 20007 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ module dwt.dnd; import dwt.internal.carbon.*; /** * The class URLTransfer provides a platform specific mechanism * for converting text in URL format represented as a java String * to a platform specific representation of the data and vice versa. See * Transfer for additional information. The String * must contain the fully specified url. * *

An example of a java String[] containing a URL is shown * below:

* *
 *     String url = "http://www.eclipse.org";
 * 
*/ public class URLTransfer : ByteArrayTransfer { static URLTransfer _instance = new URLTransfer(); static final String URL = "url "; //$NON-NLS-1$ static final int URL_ID = registerType(URL); static final String URLN = "urln"; //$NON-NLS-1$ static final int URLN_ID = registerType(URLN); private URLTransfer() {} /** * Returns the singleton instance of the URLTransfer class. * * @return the singleton instance of the URLTransfer class */ public static URLTransfer getInstance () { return _instance; } /** * This implementation of javaToNative converts a URL * represented by a java String to a platform specific representation. * For additional information see Transfer#javaToNative. * * @param object a java String[] containing a URL * @param transferData an empty TransferData object; this * object will be filled in on return with the platform specific format of the data */ public void javaToNative (Object object, TransferData transferData){ if (!checkURL(object) || !isSupportedType(transferData)) { DND.error(DND.ERROR_INVALID_DATA); } transferData.result = -1; String url = (String)object; int count = url.length(); char[] chars = new char[count]; url.getChars(0, count, chars, 0); int cfString = OS.CFStringCreateWithCharacters(OS.kCFAllocatorDefault, chars, count); if (cfString is 0) return; try { CFRange range = new CFRange(); range.length = chars.length; int encoding = OS.CFStringGetSystemEncoding(); int[] size = new int[1]; int numChars = OS.CFStringGetBytes(cfString, range, encoding, (byte)'?', true, null, 0, size); if (numChars is 0 || size[0] is 0) return; byte[] buffer = new byte[size[0]]; numChars = OS.CFStringGetBytes(cfString, range, encoding, (byte)'?', true, buffer, size [0], size); if (numChars is 0) return; transferData.data = new byte[][] {buffer}; transferData.result = 0; } finally { OS.CFRelease(cfString); } } /** * This implementation of nativeToJava converts a platform specific * representation of a URL to a java String. * For additional information see Transfer#nativeToJava. * * @param transferData the platform specific representation of the data to be * converted * @return a java String[] containing a URL if the * conversion was successful; otherwise null */ public Object nativeToJava(TransferData transferData){ if (!isSupportedType(transferData) || transferData.data is null) return null; if (transferData.data.length is 0) return null; byte[] buffer = transferData.data[0]; int encoding = OS.CFStringGetSystemEncoding(); int cfString = OS.CFStringCreateWithBytes(OS.kCFAllocatorDefault, buffer, buffer.length, encoding, true); if (cfString is 0) return null; try { int length = OS.CFStringGetLength(cfString); if (length is 0) return null; char[] chars = new char[length]; CFRange range = new CFRange(); range.length = length; OS.CFStringGetCharacters(cfString, range, chars); return new String(chars); } finally { OS.CFRelease(cfString); } } protected int[] getTypeIds(){ return new int[] {URL_ID, URLN_ID}; } protected String[] getTypeNames(){ return new String[] {URL, URLN}; } bool checkURL(Object object) { return object !is null && (object instanceof String) && ((String)object).length() > 0; } protected bool validate(Object object) { return checkURL(object); } } +/******************************************************************************* * Copyright (c) 20007 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ module dwt.dnd; import dwt.internal.carbon.*; /** * The class URLTransfer provides a platform specific mechanism * for converting text in URL format represented as a java String * to a platform specific representation of the data and vice versa. See * Transfer for additional information. The String * must contain the fully specified url. * *

An example of a java String[] containing a URL is shown * below:

* *
 *     String url = "http://www.eclipse.org";
 * 
*/ public class URLTransfer : ByteArrayTransfer { static URLTransfer _instance = new URLTransfer(); static final String URL = "url "; //$NON-NLS-1$ static final int URL_ID = registerType(URL); static final String URLN = "urln"; //$NON-NLS-1$ static final int URLN_ID = registerType(URLN); private URLTransfer() {} /** * Returns the singleton instance of the URLTransfer class. * * @return the singleton instance of the URLTransfer class */ public static URLTransfer getInstance () { return _instance; } /** * This implementation of javaToNative converts a URL * represented by a java String to a platform specific representation. * For additional information see Transfer#javaToNative. * * @param object a java String[] containing a URL * @param transferData an empty TransferData object; this * object will be filled in on return with the platform specific format of the data */ public void javaToNative (Object object, TransferData transferData){ if (!checkURL(object) || !isSupportedType(transferData)) { DND.error(DND.ERROR_INVALID_DATA); } transferData.result = -1; String url = cast(String)object; int count = url.length(); char[] chars = new char[count]; url.getChars(0, count, chars, 0); int cfString = OS.CFStringCreateWithCharacters(OS.kCFAllocatorDefault, chars, count); if (cfString is 0) return; try { CFRange range = new CFRange(); range.length = chars.length; int encoding = OS.CFStringGetSystemEncoding(); int[] size = new int[1]; int numChars = OS.CFStringGetBytes(cfString, range, encoding, cast(byte)'?', true, null, 0, size); if (numChars is 0 || size[0] is 0) return; byte[] buffer = new byte[size[0]]; numChars = OS.CFStringGetBytes(cfString, range, encoding, cast(byte)'?', true, buffer, size [0], size); if (numChars is 0) return; transferData.data = new byte[][] {buffer}; transferData.result = 0; } finally { OS.CFRelease(cfString); } } /** * This implementation of nativeToJava converts a platform specific * representation of a URL to a java String. * For additional information see Transfer#nativeToJava. * * @param transferData the platform specific representation of the data to be * converted * @return a java String[] containing a URL if the * conversion was successful; otherwise null */ public Object nativeToJava(TransferData transferData){ if (!isSupportedType(transferData) || transferData.data is null) return null; if (transferData.data.length is 0) return null; byte[] buffer = transferData.data[0]; int encoding = OS.CFStringGetSystemEncoding(); int cfString = OS.CFStringCreateWithBytes(OS.kCFAllocatorDefault, buffer, buffer.length, encoding, true); if (cfString is 0) return null; try { int length = OS.CFStringGetLength(cfString); if (length is 0) return null; char[] chars = new char[length]; CFRange range = new CFRange(); range.length = length; OS.CFStringGetCharacters(cfString, range, chars); return new String(chars); } finally { OS.CFRelease(cfString); } } protected int[] getTypeIds(){ return new int[] {URL_ID, URLN_ID}; } protected String[] getTypeNames(){ return new String[] {URL, URLN}; } bool checkURL(Object object) { return object !is null && ( null !is cast(String)object ) && (cast(String)object).length() > 0; } protected bool validate(Object object) { return checkURL(object); } } diff -r fb2555104d70 -r 5b53d338c709 dwt/dwthelper/Runnable.d diff -r fb2555104d70 -r 5b53d338c709 dwt/dwthelper/System.d diff -r fb2555104d70 -r 5b53d338c709 dwt/dwthelper/WeakRef.d diff -r fb2555104d70 -r 5b53d338c709 dwt/dwthelper/utils.d diff -r fb2555104d70 -r 5b53d338c709 dwt/effects/Effect.d --- a/dwt/effects/Effect.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/effects/Effect.d Fri Aug 29 22:04:22 2008 +0200 @@ -18,7 +18,7 @@ public class Effect { public int handle; - public Effect() { + public this() { } public void dispose() { diff -r fb2555104d70 -r 5b53d338c709 dwt/events/ArmEvent.d --- a/dwt/events/ArmEvent.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/events/ArmEvent.d Fri Aug 29 22:04:22 2008 +0200 @@ -30,7 +30,7 @@ * * @param e the untyped event containing the information */ -public ArmEvent(Event e) { +public this(Event e) { super(e); } diff -r fb2555104d70 -r 5b53d338c709 dwt/events/ControlAdapter.d --- a/dwt/events/ControlAdapter.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/events/ControlAdapter.d Fri Aug 29 22:04:22 2008 +0200 @@ -25,7 +25,7 @@ * @see ControlListener * @see ControlEvent */ -public abstract class ControlAdapter implements ControlListener { +public abstract class ControlAdapter : ControlListener { /** * Sent when the location (x, y) of a control changes relative diff -r fb2555104d70 -r 5b53d338c709 dwt/events/ControlEvent.d --- a/dwt/events/ControlEvent.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/events/ControlEvent.d Fri Aug 29 22:04:22 2008 +0200 @@ -32,7 +32,7 @@ * * @param e the untyped event containing the information */ -public ControlEvent(Event e) { +public this(Event e) { super(e); } diff -r fb2555104d70 -r 5b53d338c709 dwt/events/DisposeEvent.d --- a/dwt/events/DisposeEvent.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/events/DisposeEvent.d Fri Aug 29 22:04:22 2008 +0200 @@ -32,7 +32,7 @@ * * @param e the untyped event containing the information */ -public DisposeEvent(Event e) { +public this(Event e) { super(e); } diff -r fb2555104d70 -r 5b53d338c709 dwt/events/DragDetectEvent.d --- a/dwt/events/DragDetectEvent.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/events/DragDetectEvent.d Fri Aug 29 22:04:22 2008 +0200 @@ -23,7 +23,7 @@ * @since 3.3 */ -public final class DragDetectEvent extends MouseEvent { +public final class DragDetectEvent : MouseEvent { private static final long serialVersionUID = -7229172519733647232L; @@ -33,7 +33,7 @@ * * @param e the untyped event containing the information */ -public DragDetectEvent(Event e) { +public this(Event e) { super(e); } } diff -r fb2555104d70 -r 5b53d338c709 dwt/events/DragDetectListener.d --- a/dwt/events/DragDetectListener.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/events/DragDetectListener.d Fri Aug 29 22:04:22 2008 +0200 @@ -30,7 +30,7 @@ * * @since 3.3 */ -public interface DragDetectListener extends DWTEventListener { +public interface DragDetectListener : DWTEventListener { /** * Sent when a drag gesture is detected. diff -r fb2555104d70 -r 5b53d338c709 dwt/events/ExpandAdapter.d --- a/dwt/events/ExpandAdapter.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/events/ExpandAdapter.d Fri Aug 29 22:04:22 2008 +0200 @@ -27,7 +27,7 @@ * * @since 3.2 */ -public abstract class ExpandAdapter implements ExpandListener { +public abstract class ExpandAdapter : ExpandListener { /** * Sent when an item is collapsed. diff -r fb2555104d70 -r 5b53d338c709 dwt/events/ExpandEvent.d --- a/dwt/events/ExpandEvent.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/events/ExpandEvent.d Fri Aug 29 22:04:22 2008 +0200 @@ -24,7 +24,7 @@ * @since 3.2 */ -public class ExpandEvent extends SelectionEvent { +public class ExpandEvent : SelectionEvent { static final long serialVersionUID = 3976735856884987356L; @@ -34,7 +34,7 @@ * * @param e the untyped event containing the information */ -public ExpandEvent(Event e) { +public this(Event e) { super(e); } diff -r fb2555104d70 -r 5b53d338c709 dwt/events/ExpandListener.d --- a/dwt/events/ExpandListener.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/events/ExpandListener.d Fri Aug 29 22:04:22 2008 +0200 @@ -32,7 +32,7 @@ * * @since 3.2 */ -public interface ExpandListener extends DWTEventListener { +public interface ExpandListener : DWTEventListener { /** * Sent when an item is collapsed. diff -r fb2555104d70 -r 5b53d338c709 dwt/events/FocusAdapter.d --- a/dwt/events/FocusAdapter.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/events/FocusAdapter.d Fri Aug 29 22:04:22 2008 +0200 @@ -25,7 +25,7 @@ * @see FocusListener * @see FocusEvent */ -public abstract class FocusAdapter implements FocusListener { +public abstract class FocusAdapter : FocusListener { /** * Sent when a control gets focus. diff -r fb2555104d70 -r 5b53d338c709 dwt/events/FocusEvent.d --- a/dwt/events/FocusEvent.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/events/FocusEvent.d Fri Aug 29 22:04:22 2008 +0200 @@ -22,7 +22,7 @@ * @see FocusListener */ -public final class FocusEvent extends TypedEvent { +public final class FocusEvent : TypedEvent { static final long serialVersionUID = 3258134643684227381L; @@ -32,7 +32,7 @@ * * @param e the untyped event containing the information */ -public FocusEvent(Event e) { +public this(Event e) { super(e); } diff -r fb2555104d70 -r 5b53d338c709 dwt/events/FocusListener.d --- a/dwt/events/FocusListener.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/events/FocusListener.d Fri Aug 29 22:04:22 2008 +0200 @@ -30,7 +30,7 @@ * @see FocusAdapter * @see FocusEvent */ -public interface FocusListener extends DWTEventListener { +public interface FocusListener : DWTEventListener { /** * Sent when a control gets focus. diff -r fb2555104d70 -r 5b53d338c709 dwt/events/HelpEvent.d --- a/dwt/events/HelpEvent.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/events/HelpEvent.d Fri Aug 29 22:04:22 2008 +0200 @@ -22,7 +22,7 @@ * @see HelpListener */ -public final class HelpEvent extends TypedEvent { +public final class HelpEvent : TypedEvent { static final long serialVersionUID = 3257001038606251315L; @@ -32,7 +32,7 @@ * * @param e the untyped event containing the information */ -public HelpEvent(Event e) { +public this(Event e) { super(e); } diff -r fb2555104d70 -r 5b53d338c709 dwt/events/HelpListener.d --- a/dwt/events/HelpListener.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/events/HelpListener.d Fri Aug 29 22:04:22 2008 +0200 @@ -29,7 +29,7 @@ * * @see HelpEvent */ -public interface HelpListener extends DWTEventListener { +public interface HelpListener : DWTEventListener { /** * Sent when help is requested for a control, typically diff -r fb2555104d70 -r 5b53d338c709 dwt/events/KeyAdapter.d --- a/dwt/events/KeyAdapter.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/events/KeyAdapter.d Fri Aug 29 22:04:22 2008 +0200 @@ -25,7 +25,7 @@ * @see KeyListener * @see KeyEvent */ -public abstract class KeyAdapter implements KeyListener { +public abstract class KeyAdapter : KeyListener { /** * Sent when a key is pressed on the system keyboard. diff -r fb2555104d70 -r 5b53d338c709 dwt/events/KeyEvent.d --- a/dwt/events/KeyEvent.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/events/KeyEvent.d Fri Aug 29 22:04:22 2008 +0200 @@ -34,7 +34,7 @@ * @see TraverseListener */ -public class KeyEvent extends TypedEvent { +public class KeyEvent : TypedEvent { /** * the character represented by the key that was typed. @@ -81,7 +81,7 @@ * * @param e the untyped event containing the information */ -public KeyEvent(Event e) { +public this(Event e) { super(e); this.character = e.character; this.keyCode = e.keyCode; diff -r fb2555104d70 -r 5b53d338c709 dwt/events/KeyListener.d --- a/dwt/events/KeyListener.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/events/KeyListener.d Fri Aug 29 22:04:22 2008 +0200 @@ -30,7 +30,7 @@ * @see KeyAdapter * @see KeyEvent */ -public interface KeyListener extends DWTEventListener { +public interface KeyListener : DWTEventListener { /** * Sent when a key is pressed on the system keyboard. diff -r fb2555104d70 -r 5b53d338c709 dwt/events/MenuAdapter.d --- a/dwt/events/MenuAdapter.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/events/MenuAdapter.d Fri Aug 29 22:04:22 2008 +0200 @@ -25,7 +25,7 @@ * @see MenuListener * @see MenuEvent */ -public abstract class MenuAdapter implements MenuListener { +public abstract class MenuAdapter : MenuListener { /** * Sent when a menu is hidden. diff -r fb2555104d70 -r 5b53d338c709 dwt/events/MenuDetectEvent.d --- a/dwt/events/MenuDetectEvent.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/events/MenuDetectEvent.d Fri Aug 29 22:04:22 2008 +0200 @@ -24,7 +24,7 @@ * @since 3.3 */ -public final class MenuDetectEvent extends TypedEvent { +public final class MenuDetectEvent : TypedEvent { /** * the display-relative x coordinate of the pointer @@ -52,7 +52,7 @@ * * @param e the untyped event containing the information */ -public MenuDetectEvent(Event e) { +public this(Event e) { super(e); this.x = e.x; this.y = e.y; diff -r fb2555104d70 -r 5b53d338c709 dwt/events/MenuDetectListener.d --- a/dwt/events/MenuDetectListener.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/events/MenuDetectListener.d Fri Aug 29 22:04:22 2008 +0200 @@ -32,7 +32,7 @@ * * @since 3.3 */ -public interface MenuDetectListener extends DWTEventListener { +public interface MenuDetectListener : DWTEventListener { /** * Sent when the platform-dependent trigger for showing a menu item is detected. diff -r fb2555104d70 -r 5b53d338c709 dwt/events/MenuEvent.d --- a/dwt/events/MenuEvent.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/events/MenuEvent.d Fri Aug 29 22:04:22 2008 +0200 @@ -22,7 +22,7 @@ * @see MenuListener */ -public final class MenuEvent extends TypedEvent { +public final class MenuEvent : TypedEvent { static final long serialVersionUID = 3258132440332383025L; @@ -32,7 +32,7 @@ * * @param e the untyped event containing the information */ -public MenuEvent(Event e) { +public this(Event e) { super(e); } diff -r fb2555104d70 -r 5b53d338c709 dwt/events/MenuListener.d --- a/dwt/events/MenuListener.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/events/MenuListener.d Fri Aug 29 22:04:22 2008 +0200 @@ -29,7 +29,7 @@ * @see MenuAdapter * @see MenuEvent */ -public interface MenuListener extends DWTEventListener { +public interface MenuListener : DWTEventListener { /** * Sent when a menu is hidden. diff -r fb2555104d70 -r 5b53d338c709 dwt/events/ModifyEvent.d --- a/dwt/events/ModifyEvent.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/events/ModifyEvent.d Fri Aug 29 22:04:22 2008 +0200 @@ -22,7 +22,7 @@ * @see ModifyListener */ -public final class ModifyEvent extends TypedEvent { +public final class ModifyEvent : TypedEvent { static final long serialVersionUID = 3258129146227011891L; @@ -32,7 +32,7 @@ * * @param e the untyped event containing the information */ -public ModifyEvent(Event e) { +public this(Event e) { super(e); } diff -r fb2555104d70 -r 5b53d338c709 dwt/events/ModifyListener.d --- a/dwt/events/ModifyListener.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/events/ModifyListener.d Fri Aug 29 22:04:22 2008 +0200 @@ -28,7 +28,7 @@ * * @see ModifyEvent */ -public interface ModifyListener extends DWTEventListener { +public interface ModifyListener : DWTEventListener { /** * Sent when the text is modified. diff -r fb2555104d70 -r 5b53d338c709 dwt/events/MouseAdapter.d --- a/dwt/events/MouseAdapter.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/events/MouseAdapter.d Fri Aug 29 22:04:22 2008 +0200 @@ -26,7 +26,7 @@ * @see MouseListener * @see MouseEvent */ -public abstract class MouseAdapter implements MouseListener { +public abstract class MouseAdapter : MouseListener { /** * Sent when a mouse button is pressed twice within the diff -r fb2555104d70 -r 5b53d338c709 dwt/events/MouseEvent.d --- a/dwt/events/MouseEvent.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/events/MouseEvent.d Fri Aug 29 22:04:22 2008 +0200 @@ -31,7 +31,7 @@ * @see MouseTrackListener */ -public class MouseEvent extends TypedEvent { +public class MouseEvent : TypedEvent { /** * the button that was pressed or released; 1 for the @@ -75,7 +75,7 @@ * * @param e the untyped event containing the information */ -public MouseEvent(Event e) { +public this(Event e) { super(e); this.x = e.x; this.y = e.y; diff -r fb2555104d70 -r 5b53d338c709 dwt/events/MouseListener.d --- a/dwt/events/MouseListener.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/events/MouseListener.d Fri Aug 29 22:04:22 2008 +0200 @@ -30,7 +30,7 @@ * @see MouseAdapter * @see MouseEvent */ -public interface MouseListener extends DWTEventListener { +public interface MouseListener : DWTEventListener { /** * Sent when a mouse button is pressed twice within the diff -r fb2555104d70 -r 5b53d338c709 dwt/events/MouseMoveListener.d --- a/dwt/events/MouseMoveListener.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/events/MouseMoveListener.d Fri Aug 29 22:04:22 2008 +0200 @@ -28,7 +28,7 @@ * * @see MouseEvent */ -public interface MouseMoveListener extends DWTEventListener { +public interface MouseMoveListener : DWTEventListener { /** * Sent when the mouse moves. diff -r fb2555104d70 -r 5b53d338c709 dwt/events/MouseTrackAdapter.d --- a/dwt/events/MouseTrackAdapter.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/events/MouseTrackAdapter.d Fri Aug 29 22:04:22 2008 +0200 @@ -26,7 +26,7 @@ * @see MouseTrackListener * @see MouseEvent */ -public abstract class MouseTrackAdapter implements MouseTrackListener { +public abstract class MouseTrackAdapter : MouseTrackListener { /** * Sent when the mouse pointer passes into the area of diff -r fb2555104d70 -r 5b53d338c709 dwt/events/MouseTrackListener.d --- a/dwt/events/MouseTrackListener.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/events/MouseTrackListener.d Fri Aug 29 22:04:22 2008 +0200 @@ -31,7 +31,7 @@ * @see MouseTrackAdapter * @see MouseEvent */ -public interface MouseTrackListener extends DWTEventListener { +public interface MouseTrackListener : DWTEventListener { /** * Sent when the mouse pointer passes into the area of diff -r fb2555104d70 -r 5b53d338c709 dwt/events/MouseWheelListener.d --- a/dwt/events/MouseWheelListener.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/events/MouseWheelListener.d Fri Aug 29 22:04:22 2008 +0200 @@ -31,7 +31,7 @@ * * @since 3.3 */ -public interface MouseWheelListener extends DWTEventListener { +public interface MouseWheelListener : DWTEventListener { /** * Sent when the mouse wheel is scrolled. diff -r fb2555104d70 -r 5b53d338c709 dwt/events/PaintEvent.d --- a/dwt/events/PaintEvent.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/events/PaintEvent.d Fri Aug 29 22:04:22 2008 +0200 @@ -23,7 +23,7 @@ * @see PaintListener */ -public final class PaintEvent extends TypedEvent { +public final class PaintEvent : TypedEvent { /** * the graphics context to use when painting @@ -72,7 +72,7 @@ * * @param e the untyped event containing the information */ -public PaintEvent(Event e) { +public this(Event e) { super(e); this.gc = e.gc; this.x = e.x; diff -r fb2555104d70 -r 5b53d338c709 dwt/events/PaintListener.d --- a/dwt/events/PaintListener.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/events/PaintListener.d Fri Aug 29 22:04:22 2008 +0200 @@ -29,7 +29,7 @@ * * @see PaintEvent */ -public interface PaintListener extends DWTEventListener { +public interface PaintListener : DWTEventListener { /** * Sent when a paint event occurs for the control. diff -r fb2555104d70 -r 5b53d338c709 dwt/events/SelectionAdapter.d --- a/dwt/events/SelectionAdapter.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/events/SelectionAdapter.d Fri Aug 29 22:04:22 2008 +0200 @@ -25,7 +25,7 @@ * @see SelectionListener * @see SelectionEvent */ -public abstract class SelectionAdapter implements SelectionListener { +public abstract class SelectionAdapter : SelectionListener { /** * Sent when selection occurs in the control. diff -r fb2555104d70 -r 5b53d338c709 dwt/events/SelectionEvent.d --- a/dwt/events/SelectionEvent.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/events/SelectionEvent.d Fri Aug 29 22:04:22 2008 +0200 @@ -26,7 +26,7 @@ * @see SelectionListener */ -public class SelectionEvent extends TypedEvent { +public class SelectionEvent : TypedEvent { /** * The item that was selected. @@ -107,7 +107,7 @@ * * @param e the untyped event containing the information */ -public SelectionEvent(Event e) { +public this(Event e) { super(e); this.item = e.item; this.x = e.x; diff -r fb2555104d70 -r 5b53d338c709 dwt/events/SelectionListener.d --- a/dwt/events/SelectionListener.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/events/SelectionListener.d Fri Aug 29 22:04:22 2008 +0200 @@ -30,7 +30,7 @@ * @see SelectionAdapter * @see SelectionEvent */ -public interface SelectionListener extends DWTEventListener { +public interface SelectionListener : DWTEventListener { /** * Sent when selection occurs in the control. diff -r fb2555104d70 -r 5b53d338c709 dwt/events/ShellAdapter.d --- a/dwt/events/ShellAdapter.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/events/ShellAdapter.d Fri Aug 29 22:04:22 2008 +0200 @@ -25,7 +25,7 @@ * @see ShellListener * @see ShellEvent */ -public abstract class ShellAdapter implements ShellListener { +public abstract class ShellAdapter : ShellListener { /** * Sent when a shell becomes the active window. diff -r fb2555104d70 -r 5b53d338c709 dwt/events/ShellEvent.d --- a/dwt/events/ShellEvent.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/events/ShellEvent.d Fri Aug 29 22:04:22 2008 +0200 @@ -22,7 +22,7 @@ * @see ShellListener */ -public final class ShellEvent extends TypedEvent { +public final class ShellEvent : TypedEvent { /** * A flag indicating whether the operation should be allowed. @@ -38,7 +38,7 @@ * * @param e the untyped event containing the information */ -public ShellEvent(Event e) { +public this(Event e) { super(e); this.doit = e.doit; } diff -r fb2555104d70 -r 5b53d338c709 dwt/events/ShellListener.d --- a/dwt/events/ShellListener.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/events/ShellListener.d Fri Aug 29 22:04:22 2008 +0200 @@ -29,7 +29,7 @@ * @see ShellAdapter * @see ShellEvent */ -public interface ShellListener extends DWTEventListener { +public interface ShellListener : DWTEventListener { /** * Sent when a shell becomes the active window. diff -r fb2555104d70 -r 5b53d338c709 dwt/events/TraverseEvent.d --- a/dwt/events/TraverseEvent.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/events/TraverseEvent.d Fri Aug 29 22:04:22 2008 +0200 @@ -79,7 +79,7 @@ * @see TraverseListener */ -public final class TraverseEvent extends KeyEvent { +public final class TraverseEvent : KeyEvent { /** * The traversal type. @@ -118,7 +118,7 @@ * * @param e the untyped event containing the information */ -public TraverseEvent(Event e) { +public this(Event e) { super(e); this.detail = e.detail; } diff -r fb2555104d70 -r 5b53d338c709 dwt/events/TraverseListener.d --- a/dwt/events/TraverseListener.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/events/TraverseListener.d Fri Aug 29 22:04:22 2008 +0200 @@ -29,7 +29,7 @@ * * @see TraverseEvent */ -public interface TraverseListener extends DWTEventListener { +public interface TraverseListener : DWTEventListener { /** * Sent when a traverse event occurs in a control. diff -r fb2555104d70 -r 5b53d338c709 dwt/events/TreeAdapter.d --- a/dwt/events/TreeAdapter.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/events/TreeAdapter.d Fri Aug 29 22:04:22 2008 +0200 @@ -25,7 +25,7 @@ * @see TreeListener * @see TreeEvent */ -public abstract class TreeAdapter implements TreeListener { +public abstract class TreeAdapter : TreeListener { /** * Sent when a tree branch is collapsed. diff -r fb2555104d70 -r 5b53d338c709 dwt/events/TreeEvent.d --- a/dwt/events/TreeEvent.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/events/TreeEvent.d Fri Aug 29 22:04:22 2008 +0200 @@ -22,7 +22,7 @@ * @see TreeListener */ -public final class TreeEvent extends SelectionEvent { +public final class TreeEvent : SelectionEvent { static final long serialVersionUID = 3257282548009677109L; @@ -32,7 +32,7 @@ * * @param e the untyped event containing the information */ -public TreeEvent(Event e) { +public this(Event e) { super(e); } diff -r fb2555104d70 -r 5b53d338c709 dwt/events/TreeListener.d --- a/dwt/events/TreeListener.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/events/TreeListener.d Fri Aug 29 22:04:22 2008 +0200 @@ -30,7 +30,7 @@ * @see TreeAdapter * @see TreeEvent */ -public interface TreeListener extends DWTEventListener { +public interface TreeListener : DWTEventListener { /** * Sent when a tree branch is collapsed. diff -r fb2555104d70 -r 5b53d338c709 dwt/events/TypedEvent.d --- a/dwt/events/TypedEvent.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/events/TypedEvent.d Fri Aug 29 22:04:22 2008 +0200 @@ -25,7 +25,7 @@ * * @see dwt.widgets.Event */ -public class TypedEvent extends DWTEventObject { +public class TypedEvent : DWTEventObject { /** * the display where the event occurred @@ -60,7 +60,7 @@ * * @param object the object that fired the event */ -public TypedEvent(Object object) { +public this(Object object) { super(object); } @@ -70,7 +70,7 @@ * * @param e the low level event to initialize the receiver with */ -public TypedEvent(Event e) { +public this(Event e) { super(e.widget); this.display = e.display; this.widget = e.widget; diff -r fb2555104d70 -r 5b53d338c709 dwt/events/VerifyEvent.d --- a/dwt/events/VerifyEvent.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/events/VerifyEvent.d Fri Aug 29 22:04:22 2008 +0200 @@ -22,7 +22,7 @@ * @see VerifyListener */ -public final class VerifyEvent extends KeyEvent { +public final class VerifyEvent : KeyEvent { /** * the range of text being modified. @@ -45,7 +45,7 @@ * * @param e the untyped event containing the information */ -public VerifyEvent(Event e) { +public this(Event e) { super(e); this.start = e.start; this.end = e.end; diff -r fb2555104d70 -r 5b53d338c709 dwt/events/VerifyListener.d --- a/dwt/events/VerifyListener.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/events/VerifyListener.d Fri Aug 29 22:04:22 2008 +0200 @@ -29,7 +29,7 @@ * * @see VerifyEvent */ -public interface VerifyListener extends DWTEventListener { +public interface VerifyListener : DWTEventListener { /** * Sent when the text is about to be modified. diff -r fb2555104d70 -r 5b53d338c709 dwt/graphics/Color.d --- a/dwt/graphics/Color.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/graphics/Color.d Fri Aug 29 22:04:22 2008 +0200 @@ -30,7 +30,7 @@ * @see RGB * @see Device#getSystemColor */ -public final class Color extends Resource { +public final class Color : Resource { /** * the handle to the OS color resource * (Warning: This field is platform dependent) @@ -43,7 +43,7 @@ */ public float[] handle; -Color(Device device) { +this(Device device) { super(device); } @@ -71,7 +71,7 @@ * * @see #dispose */ -public Color(Device device, int red, int green, int blue) { +public this(Device device, int red, int green, int blue) { super(device); init(red, green, blue); init(); @@ -99,7 +99,7 @@ * * @see #dispose */ -public Color(Device device, RGB rgb) { +public this(Device device, RGB rgb) { super(device); if (rgb is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); init(rgb.red, rgb.green, rgb.blue); @@ -122,14 +122,14 @@ */ public bool equals(Object object) { if (object is this) return true; - if (!(object instanceof Color)) return false; - Color color = (Color)object; + if (!( null !is cast(Color)object )) return false; + Color color = cast(Color)object; float[] rgbColor = color.handle; if (handle is rgbColor) return true; return device is color.device && - (int)(handle[0] * 255) is (int)(rgbColor[0] * 255) && - (int)(handle[1] * 255) is (int)(rgbColor[1] * 255) && - (int)(handle[2] * 255) is (int)(rgbColor[2] * 255); + cast(int)(handle[0] * 255) is cast(int)(rgbColor[0] * 255) && + cast(int)(handle[1] * 255) is cast(int)(rgbColor[1] * 255) && + cast(int)(handle[2] * 255) is cast(int)(rgbColor[2] * 255); } /** @@ -143,7 +143,7 @@ */ public int getBlue() { if (isDisposed()) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED); - return (int)(handle[2] * 255); + return cast(int)(handle[2] * 255); } /** @@ -157,7 +157,7 @@ */ public int getGreen() { if (isDisposed()) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED); - return (int)(handle[1] * 255); + return cast(int)(handle[1] * 255); } /** @@ -171,7 +171,7 @@ */ public int getRed() { if (isDisposed()) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED); - return (int)(handle[0] * 255); + return cast(int)(handle[0] * 255); } /** @@ -186,7 +186,7 @@ */ public int hashCode() { if (isDisposed()) return 0; - return (int)(handle[0] * 255) ^ (int)(handle[1] * 255) ^ (int)(handle[2] * 255); + return cast(int)(handle[0] * 255) ^ cast(int)(handle[1] * 255) ^ cast(int)(handle[2] * 255); } /** diff -r fb2555104d70 -r 5b53d338c709 dwt/graphics/Cursor.d --- a/dwt/graphics/Cursor.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/graphics/Cursor.d Fri Aug 29 22:04:22 2008 +0200 @@ -48,7 +48,7 @@ *

*/ -public final class Cursor extends Resource { +public final class Cursor : Resource { /** * the handle to the OS cursor resource @@ -65,7 +65,7 @@ /** * Prevents uninitialized instances from being created outside the package. */ -Cursor(Device device) { +this(Device device) { super(device); } @@ -110,7 +110,7 @@ * @see DWT#CURSOR_NO * @see DWT#CURSOR_HAND */ -public Cursor(Device device, int style) { +public this(Device device, int style) { super(device); switch (style) { case DWT.CURSOR_HAND: handle = NSCursor.pointingHandCursor(); break; @@ -174,7 +174,7 @@ *
  • ERROR_NO_HANDLES - if a handle could not be obtained for cursor creation
  • * */ -public Cursor(Device device, ImageData source, ImageData mask, int hotspotX, int hotspotY) { +public this(Device device, ImageData source, ImageData mask, int hotspotX, int hotspotY) { super(device); if (source is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); if (mask is null) { @@ -200,10 +200,10 @@ int maskPixel = mask.getPixel(x, y); if (pixel is 0 && maskPixel is 0) { // BLACK - data[offset] = (byte)0xFF; + data[offset] = cast(byte)0xFF; } else if (pixel is 0 && maskPixel is 1) { // WHITE - cursor color - data[offset] = data[offset + 1] = data[offset + 2] = data[offset + 3] = (byte)0xFF; + data[offset] = data[offset + 1] = data[offset + 2] = data[offset + 3] = cast(byte)0xFF; } else if (pixel is 1 && maskPixel is 0) { // SCREEN } else { @@ -222,9 +222,9 @@ } void createNSCursor(int hotspotX, int hotspotY, byte[] buffer, int width, int height) { - NSImage nsImage = (NSImage)new NSImage().alloc(); - NSBitmapImageRep nsImageRep = (NSBitmapImageRep)new NSBitmapImageRep().alloc(); - handle = (NSCursor)new NSCursor().alloc(); + NSImage nsImage = cast(NSImage)new NSImage().alloc(); + NSBitmapImageRep nsImageRep = cast(NSBitmapImageRep)new NSBitmapImageRep().alloc(); + handle = cast(NSCursor)new NSCursor().alloc(); NSSize size = new NSSize(); size.width = width; size.height = height; @@ -269,7 +269,7 @@ * * @since 3.0 */ -public Cursor(Device device, ImageData source, int hotspotX, int hotspotY) { +public this(Device device, ImageData source, int hotspotX, int hotspotY) { super(device); if (source is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); if (hotspotX >= source.width || hotspotX < 0 || @@ -293,9 +293,9 @@ for (int i = 0; i < rgbs.length; i++) { RGB rgb = rgbs[i]; if (rgb is null) continue; - srcReds[i] = (byte)rgb.red; - srcGreens[i] = (byte)rgb.green; - srcBlues[i] = (byte)rgb.blue; + srcReds[i] = cast(byte)rgb.red; + srcGreens[i] = cast(byte)rgb.green; + srcBlues[i] = cast(byte)rgb.blue; } ImageData.blit(ImageData.BLIT_SRC, source.data, source.depth, source.bytesPerLine, source.getByteOrder(), 0, 0, source.width, source.height, srcReds, srcGreens, srcBlues, @@ -310,13 +310,13 @@ int offset = 0, maskOffset = 0; for (int y = 0; y> 3)]) & (1 << (7 - (x & 0x7)))) !is 0 ? (byte)0xff : 0; + data[offset] = ((maskData[maskOffset + (x >> 3)]) & (1 << (7 - (x & 0x7)))) !is 0 ? cast(byte)0xff : 0; offset += 4; } maskOffset += maskBpl; } } else if (source.alpha !is -1) { - byte alpha = (byte)source.alpha; + byte alpha = cast(byte)source.alpha; for (int i=0; iDrawable can have a graphics context (GC) + * Implementers of Drawable can have a graphics context cast(GC) * created for them, and then they can be drawn on by sending messages to * their associated GC. DWT images, and device objects such as the Display * device and the Printer device, are drawables. diff -r fb2555104d70 -r 5b53d338c709 dwt/graphics/Font.d --- a/dwt/graphics/Font.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/graphics/Font.d Fri Aug 29 22:04:22 2008 +0200 @@ -32,7 +32,7 @@ * * @see FontData */ -public final class Font extends Resource { +public final class Font : Resource { /** * the handle to the OS font resource @@ -46,7 +46,7 @@ */ public NSFont handle; -Font(Device device) { +this(Device device) { super(device); } @@ -68,7 +68,7 @@ *
  • ERROR_NO_HANDLES - if a font could not be created from the given font data
  • * */ -public Font(Device device, FontData fd) { +public this(Device device, FontData fd) { super(device); if (fd is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); init(fd.getName(), fd.getHeightF(), fd.getStyle(), fd.nsName); @@ -98,7 +98,7 @@ * * @since 2.1 */ -public Font(Device device, FontData[] fds) { +public this(Device device, FontData[] fds) { super(device); if (fds is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); if (fds.length is 0) DWT.error(DWT.ERROR_INVALID_ARGUMENT); @@ -132,7 +132,7 @@ *
  • ERROR_NO_HANDLES - if a font could not be created from the given arguments
  • * */ -public Font(Device device, String name, int height, int style) { +public this(Device device, String name, int height, int style) { super(device); init(name, height, style, null); init(); @@ -161,8 +161,8 @@ */ public bool equals(Object object) { if (object is this) return true; - if (!(object instanceof Font)) return false; - Font font = (Font)object; + if (!( null !is cast(Font)object )) return false; + Font font = cast(Font)object; return handle is font.handle; } diff -r fb2555104d70 -r 5b53d338c709 dwt/graphics/FontData.d --- a/dwt/graphics/FontData.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/graphics/FontData.d Fri Aug 29 22:04:22 2008 +0200 @@ -96,7 +96,7 @@ /** * Constructs a new uninitialized font data. */ -public FontData () { +public this () { this("", 12, DWT.NORMAL); } @@ -119,7 +119,7 @@ * * @see #toString */ -public FontData(String string) { +public this(String string) { if (string is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); int start = 0; int end = string.indexOf('|'); @@ -190,7 +190,7 @@ *
  • ERROR_INVALID_ARGUMENT - if the height is negative
  • * */ -public FontData(String name, int height, int style) { +public this(String name, int height, int style) { setName(name); setHeight(height); setStyle(style); @@ -214,8 +214,8 @@ */ public bool equals (Object object) { if (object is this) return true; - if (!(object instanceof FontData)) return false; - FontData data = (FontData)object; + if (!( null !is cast(FontData)object )) return false; + FontData data = cast(FontData)object; return name.equals(data.name) && height is data.height && style is data.style; } @@ -227,7 +227,7 @@ * @see #setHeight(int) */ public int getHeight() { - return (int)height; + return cast(int)height; } /*public*/ float getHeightF() { diff -r fb2555104d70 -r 5b53d338c709 dwt/graphics/FontMetrics.d --- a/dwt/graphics/FontMetrics.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/graphics/FontMetrics.d Fri Aug 29 22:04:22 2008 +0200 @@ -25,7 +25,7 @@ public final class FontMetrics { int ascent, descent, averageCharWidth, leading, height; -FontMetrics() { +this() { } public static FontMetrics cocoa_new(int ascent, int descent, int averageCharWidth, int leading, int height) { @@ -50,8 +50,8 @@ */ public bool equals (Object object) { if (object is this) return true; - if (!(object instanceof FontMetrics)) return false; - FontMetrics metrics = (FontMetrics)object; + if (!( null !is cast(FontMetrics)object )) return false; + FontMetrics metrics = cast(FontMetrics)object; return ascent is metrics.ascent && descent is metrics.descent && averageCharWidth is metrics.averageCharWidth && leading is metrics.leading && height is metrics.height; diff -r fb2555104d70 -r 5b53d338c709 dwt/graphics/GC.d --- a/dwt/graphics/GC.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/graphics/GC.d Fri Aug 29 22:04:22 2008 +0200 @@ -60,7 +60,7 @@ * * @see dwt.events.PaintEvent */ -public final class GC extends Resource { +public final class GC : Resource { /** * the handle to the OS device context * (Warning: This field is platform dependent) @@ -102,7 +102,7 @@ static final float[] LINE_DASHDOT_ZERO = new float[]{9, 6, 3, 6}; static final float[] LINE_DASHDOTDOT_ZERO = new float[]{9, 3, 3, 3, 3, 3}; -GC() { +this() { } /** @@ -127,7 +127,7 @@ *
  • ERROR_THREAD_INVALID_ACCESS if not called from the thread that created the drawable
  • * */ -public GC(Drawable drawable) { +public this(Drawable drawable) { this(drawable, 0); } @@ -158,7 +158,7 @@ * * @since 2.1.2 */ -public GC(Drawable drawable, int style) { +public this(Drawable drawable, int style) { if (drawable is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); GCData data = new GCData(); data.style = checkStyle(style); @@ -331,13 +331,13 @@ float scaling = size.width; if (scaling < 0) scaling = -scaling; float strokeWidth = data.lineWidth * scaling; - if (strokeWidth is 0 || ((int)strokeWidth % 2) is 1) { + if (strokeWidth is 0 || (cast(int)strokeWidth % 2) is 1) { data.drawXOffset = 0.5f / scaling; } scaling = size.height; if (scaling < 0) scaling = -scaling; strokeWidth = data.lineWidth * scaling; - if (strokeWidth is 0 || ((int)strokeWidth % 2) is 1) { + if (strokeWidth is 0 || (cast(int)strokeWidth % 2) is 1) { data.drawYOffset = 0.5f / scaling; } } @@ -375,23 +375,23 @@ // int[] contentView = new int[1]; // OS.HIViewFindByID(OS.HIViewGetRoot(window), OS.kHIViewWindowContentID(), contentView); // OS.HIViewConvertPoint (pt, data.control, contentView[0]); -// x += (int) pt.x; -// y += (int) pt.y; +// x += cast(int) pt.x; +// y += cast(int) pt.y; // Rect inset = data.insetRect; // x -= inset.left; // y -= inset.top; -// srcRect.left = (short)x; -// srcRect.top = (short)y; -// srcRect.right = (short)(x + width); -// srcRect.bottom = (short)(y + height); +// srcRect.left = cast(short)x; +// srcRect.top = cast(short)y; +// srcRect.right = cast(short)(x + width); +// srcRect.bottom = cast(short)(y + height); // Rect destRect = new Rect(); -// destRect.right = (short)width; -// destRect.bottom = (short)height; +// destRect.right = cast(short)width; +// destRect.bottom = cast(short)height; // int bpl = width * 4; // int[] gWorld = new int[1]; // int port = OS.GetWindowPort(window); // OS.NewGWorldFromPtr(gWorld, OS.k32ARGBPixelFormat, destRect, 0, 0, 0, image.data, bpl); -// OS.CopyBits(OS.GetPortBitMapForCopyBits(port), OS.GetPortBitMapForCopyBits(gWorld[0]), srcRect, destRect, (short)OS.srcCopy, 0); +// OS.CopyBits(OS.GetPortBitMapForCopyBits(port), OS.GetPortBitMapForCopyBits(gWorld[0]), srcRect, destRect, cast(short)OS.srcCopy, 0); // OS.DisposeGWorld(gWorld [0]); // } else if (data.window !is 0) { // int imageHandle = image.handle; @@ -532,22 +532,22 @@ // int[] contentView = new int[1]; // OS.HIViewFindByID(OS.HIViewGetRoot(window), OS.kHIViewWindowContentID(), contentView); // OS.HIViewConvertPoint(pt, OS.HIViewGetSuperview(data.control), contentView[0]); -// convertX = rect.left + (int) pt.x; -// convertY = rect.top + (int) pt.y; -// rect.left += (int) pt.x; -// rect.top += (int) pt.y; -// rect.right += (int) pt.x; -// rect.bottom += (int) pt.y; +// convertX = rect.left + cast(int) pt.x; +// convertY = rect.top + cast(int) pt.y; +// rect.left += cast(int) pt.x; +// rect.top += cast(int) pt.y; +// rect.right += cast(int) pt.x; +// rect.bottom += cast(int) pt.y; // Rect srcRect = new Rect(); // int left = rect.left + srcX; // int top = rect.top + srcY; -// OS.SetRect(srcRect, (short)left, (short)top, (short)(left + width), (short)(top + height)); +// OS.SetRect(srcRect, cast(short)left, cast(short)top, cast(short)(left + width), cast(short)(top + height)); // int srcRgn = OS.NewRgn(); // OS.RectRgn(srcRgn, srcRect); // OS.SectRect(rect, srcRect, srcRect); // Rect destRect = new Rect (); // OS.SetRect(destRect, srcRect.left, srcRect.top, srcRect.right, srcRect.bottom); -// OS.OffsetRect(destRect, (short)deltaX, (short)deltaY); +// OS.OffsetRect(destRect, cast(short)deltaX, cast(short)deltaY); // int destRgn = OS.NewRgn(); // OS.RectRgn(destRgn, destRect); // @@ -579,13 +579,13 @@ // OS.GetClip(oldClip); // OS.SetClip(clipRgn); // OS.UnionRect(srcRect, destRect, rect); -// OS.ScrollRect(rect, (short)deltaX, (short)deltaY, 0); +// OS.ScrollRect(rect, cast(short)deltaX, cast(short)deltaY, 0); // OS.SetClip(oldClip); // OS.DisposeRgn(oldClip); // OS.SetPort(currentPort[0]); // } else { // int portBitMap = OS.GetPortBitMapForCopyBits (port); -// OS.CopyBits(portBitMap, portBitMap, srcRect, destRect, (short)OS.srcCopy, clipRgn); +// OS.CopyBits(portBitMap, portBitMap, srcRect, destRect, cast(short)OS.srcCopy, clipRgn); // OS.QDFlushPortBuffer(port, destRgn); // } // } @@ -598,11 +598,11 @@ // if (paint) { // int invalRgn = OS.NewRgn(); // OS.DiffRgn(srcRgn, data.visibleRgn, invalRgn); -// OS.OffsetRgn(invalRgn, (short)deltaX, (short)deltaY); +// OS.OffsetRgn(invalRgn, cast(short)deltaX, cast(short)deltaY); // OS.DiffRgn(srcRgn, destRgn, srcRgn); // OS.UnionRgn(srcRgn, invalRgn, invalRgn); // OS.SectRgn(data.visibleRgn, invalRgn, invalRgn); -// OS.OffsetRgn(invalRgn, (short)-convertX, (short)-convertY); +// OS.OffsetRgn(invalRgn, cast(short)-convertX, cast(short)-convertY); // OS.HIViewSetNeedsDisplayInRegion(data.control, invalRgn, true); // OS.DisposeRgn(invalRgn); // } @@ -663,7 +663,7 @@ // length = j; // } NSString str = NSString.stringWithCharacters(chars, length); - return ((NSAttributedString)new NSAttributedString().alloc()).initWithString_attributes_(str, dict); + return (cast(NSAttributedString)new NSAttributedString().alloc()).initWithString_attributes_(str, dict); } void destroy() { @@ -859,8 +859,8 @@ checkGC(CLIPPING | TRANSFORM); NSImage imageHandle = srcImage.handle; NSSize size = imageHandle.size(); - int imgWidth = (int)size.width; - int imgHeight = (int)size.height; + int imgWidth = cast(int)size.width; + int imgHeight = cast(int)size.height; if (simple) { srcWidth = destWidth = imgWidth; srcHeight = destHeight = imgHeight; @@ -1400,8 +1400,8 @@ */ public bool equals(Object object) { if (object is this) return true; - if (!(object instanceof GC)) return false; - return handle is ((GC)object).handle; + if (!( null !is cast(GC)object )) return false; + return handle is (cast(GC)object).handle; } /** @@ -1521,7 +1521,7 @@ } else { NSColor startingColor = NSColor.colorWithDeviceRed(fromRGB.red / 255f, fromRGB.green / 255f, fromRGB.blue / 255f, data.alpha / 255f); NSColor endingColor = NSColor.colorWithDeviceRed(toRGB.red / 255f, toRGB.green / 255f, toRGB.blue / 255f, data.alpha / 255f); - NSGradient gradient = ((NSGradient)new NSGradient().alloc()).initWithStartingColor(startingColor, endingColor); + NSGradient gradient = (cast(NSGradient)new NSGradient().alloc()).initWithStartingColor(startingColor, endingColor); NSRect rect = new NSRect(); rect.x = x; rect.y = y; @@ -1983,7 +1983,7 @@ rect.height = size.height; } } - return new Rectangle((int)rect.x, (int)rect.y, (int)rect.width, (int)rect.height); + return new Rectangle(cast(int)rect.x, cast(int)rect.y, cast(int)rect.width, cast(int)rect.height); } /** @@ -2019,10 +2019,10 @@ rect.height = data.size.height; } } - region.add((int)rect.x, (int)rect.y, (int)rect.width, (int)rect.height); + region.add(cast(int)rect.x, cast(int)rect.y, cast(int)rect.width, cast(int)rect.height); NSRect paintRect = data.paintRect; if (paintRect !is null) { - region.intersect((int)paintRect.x, (int)paintRect.y, (int)paintRect.width, (int)paintRect.height); + region.intersect(cast(int)paintRect.x, cast(int)paintRect.y, cast(int)paintRect.width, cast(int)paintRect.height); } if (data.clipPath !is null) { NSBezierPath clip = data.clipPath.bezierPathByFlatteningPath(); @@ -2040,13 +2040,13 @@ if (pointCount !is 0) clipRgn.add(pointArray, pointCount); pointCount = 0; OS.memmove(pt, points, NSPoint.sizeof); - pointArray[pointCount++] = (int)pt.x; - pointArray[pointCount++] = (int)pt.y; + pointArray[pointCount++] = cast(int)pt.x; + pointArray[pointCount++] = cast(int)pt.y; break; case OS.NSLineToBezierPathElement: OS.memmove(pt, points, NSPoint.sizeof); - pointArray[pointCount++] = (int)pt.x; - pointArray[pointCount++] = (int)pt.y; + pointArray[pointCount++] = cast(int)pt.x; + pointArray[pointCount++] = cast(int)pt.y; break; case OS.NSClosePathBezierPathElement: if (pointCount !is 0) clipRgn.add(pointArray, pointCount); @@ -2111,8 +2111,8 @@ if (handle is null) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED); checkGC(FONT); NSFont font = data.font.handle; - int ascent = (int)(0.5f + font.ascender()); - int descent = (int)(0.5f + (-font.descender() + font.leading())); + int ascent = cast(int)(0.5f + font.ascender()); + int descent = cast(int)(0.5f + (-font.descender() + font.leading())); String s = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; int averageCharWidth = stringExtent(s).x / s.length(); return FontMetrics.cocoa_new(ascent, descent, averageCharWidth, 0, ascent + descent); @@ -2257,7 +2257,7 @@ if (data.lineDashes is null) return null; int[] lineDashes = new int[data.lineDashes.length]; for (int i = 0; i < lineDashes.length; i++) { - lineDashes[i] = (int)data.lineDashes[i]; + lineDashes[i] = cast(int)data.lineDashes[i]; } return lineDashes; } @@ -2311,7 +2311,7 @@ */ public int getLineWidth() { if (handle is null) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED); - return (int)data.lineWidth; + return cast(int)data.lineWidth; } /** @@ -2530,7 +2530,7 @@ setAlpha(0xFF); setAntialias(DWT.DEFAULT); setBackgroundPattern(null); - setClipping((Rectangle)null); + setClipping(cast(Rectangle)null); setForegroundPattern(null); setInterpolation(DWT.DEFAULT); setTextAntialias(DWT.DEFAULT); @@ -2748,7 +2748,7 @@ public void setClipping(Rectangle rect) { if (handle is null) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED); if (rect is null) { - setClipping((NSBezierPath)null); + setClipping(cast(NSBezierPath)null); } else { setClipping(rect.x, rect.y, rect.width, rect.height); } @@ -3312,8 +3312,8 @@ if (transform !is null) { if (data.transform !is null) data.transform.release(); if (data.inverseTransform !is null) data.inverseTransform.release(); - data.transform = ((NSAffineTransform)new NSAffineTransform().alloc()).initWithTransform(transform.handle); - data.inverseTransform = ((NSAffineTransform)new NSAffineTransform().alloc()).initWithTransform(transform.handle); + data.transform = (cast(NSAffineTransform)new NSAffineTransform().alloc()).initWithTransform(transform.handle); + data.inverseTransform = (cast(NSAffineTransform)new NSAffineTransform().alloc()).initWithTransform(transform.handle); NSAffineTransformStruct struct = data.inverseTransform.transformStruct(); if ((struct.m11 * struct.m22 - struct.m12 * struct.m21) !is 0) { data.inverseTransform.invert(); @@ -3407,7 +3407,7 @@ checkGC(FONT); NSAttributedString str = createString(string, flags); NSSize size = str.size(); - return new Point((int)size.width, (int)size.height); + return new Point(cast(int)size.width, cast(int)size.height); } /** diff -r fb2555104d70 -r 5b53d338c709 dwt/graphics/GlyphMetrics.d --- a/dwt/graphics/GlyphMetrics.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/graphics/GlyphMetrics.d Fri Aug 29 22:04:22 2008 +0200 @@ -58,7 +58,7 @@ *
  • ERROR_INVALID_ARGUMENT - if the ascent, descent or width argument is negative
  • * */ -public GlyphMetrics(int ascent, int descent, int width) { +public this(int ascent, int descent, int width) { if (ascent < 0 || descent < 0 || width < 0) { DWT.error(DWT.ERROR_INVALID_ARGUMENT); } @@ -79,8 +79,8 @@ */ public bool equals (Object object) { if (object is this) return true; - if (!(object instanceof GlyphMetrics)) return false; - GlyphMetrics metrics = (GlyphMetrics)object; + if (!( null !is cast(GlyphMetrics)object )) return false; + GlyphMetrics metrics = cast(GlyphMetrics)object; return metrics.ascent is ascent && metrics.descent is descent && metrics.width is width; } diff -r fb2555104d70 -r 5b53d338c709 dwt/graphics/Image.d --- a/dwt/graphics/Image.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/graphics/Image.d Fri Aug 29 22:04:22 2008 +0200 @@ -74,7 +74,7 @@ * @see ImageData * @see ImageLoader */ -public final class Image extends Resource implements Drawable { +public final class Image : Resource , Drawable { /** * specifies whether the receiver is a bitmap or an icon @@ -136,7 +136,7 @@ */ static final int DEFAULT_SCANLINE_PAD = 4; -Image(Device device) { +this(Device device) { super(device); } @@ -170,7 +170,7 @@ *
  • ERROR_NO_HANDLES if a handle could not be obtained for image creation
  • * */ -public Image(Device device, int width, int height) { +public this(Device device, int width, int height) { super(device); init(width, height); init(); @@ -207,7 +207,7 @@ *
  • ERROR_NO_HANDLES if a handle could not be obtained for image creation
  • * */ -public Image(Device device, Image srcImage, int flag) { +public this(Device device, Image srcImage, int flag) { super(device); if (srcImage is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); if (srcImage.isDisposed()) DWT.error(DWT.ERROR_INVALID_ARGUMENT); @@ -224,8 +224,8 @@ /* Get source image size */ NSSize size = srcImage.handle.size(); - int width = (int)size.width; - int height = (int)size.height; + int width = cast(int)size.width; + int height = cast(int)size.height; NSBitmapImageRep srcRep = srcImage.imageRep; int bpr = srcRep.bytesPerRow(); @@ -238,9 +238,9 @@ } /* Create the image */ - handle = (NSImage)new NSImage().alloc(); + handle = cast(NSImage)new NSImage().alloc(); handle = handle.initWithSize(size); - NSBitmapImageRep rep = imageRep = (NSBitmapImageRep)new NSBitmapImageRep().alloc(); + NSBitmapImageRep rep = imageRep = cast(NSBitmapImageRep)new NSBitmapImageRep().alloc(); rep = rep.initWithBitmapDataPlanes_pixelsWide_pixelsHigh_bitsPerSample_samplesPerPixel_hasAlpha_isPlanar_colorSpaceName_bitmapFormat_bytesPerRow_bitsPerPixel_(0, width, height, srcRep.bitsPerSample(), srcRep.samplesPerPixel(), srcRep.samplesPerPixel() is 4, srcRep.isPlanar(), new NSString(OS.NSDeviceRGBColorSpace()), OS.NSAlphaFirstBitmapFormat | OS.NSAlphaNonpremultipliedBitmapFormat, srcRep.bytesPerRow(), srcRep.bitsPerPixel()); handle.addRepresentation(rep); @@ -253,14 +253,14 @@ case DWT.IMAGE_DISABLE: { Color zeroColor = device.getSystemColor(DWT.COLOR_WIDGET_NORMAL_SHADOW); RGB zeroRGB = zeroColor.getRGB(); - byte zeroRed = (byte)zeroRGB.red; - byte zeroGreen = (byte)zeroRGB.green; - byte zeroBlue = (byte)zeroRGB.blue; + byte zeroRed = cast(byte)zeroRGB.red; + byte zeroGreen = cast(byte)zeroRGB.green; + byte zeroBlue = cast(byte)zeroRGB.blue; Color oneColor = device.getSystemColor(DWT.COLOR_WIDGET_BACKGROUND); RGB oneRGB = oneColor.getRGB(); - byte oneRed = (byte)oneRGB.red; - byte oneGreen = (byte)oneRGB.green; - byte oneBlue = (byte)oneRGB.blue; + byte oneRed = cast(byte)oneRGB.red; + byte oneGreen = cast(byte)oneRGB.green; + byte oneBlue = cast(byte)oneRGB.blue; byte[] line = new byte[bpr]; for (int y=0; y> 3); + byte intensity = cast(byte)((red+red+green+green+green+green+green+blue) >> 3); line[offset+1] = line[offset+2] = line[offset+3] = intensity; offset += 4; } @@ -337,7 +337,7 @@ *
  • ERROR_NO_HANDLES if a handle could not be obtained for image creation
  • * */ -public Image(Device device, Rectangle bounds) { +public this(Device device, Rectangle bounds) { super(device); if (bounds is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); init(bounds.width, bounds.height); @@ -362,7 +362,7 @@ *
  • ERROR_NO_HANDLES if a handle could not be obtained for image creation
  • * */ -public Image(Device device, ImageData data) { +public this(Device device, ImageData data) { super(device); init(data); init(); @@ -393,7 +393,7 @@ *
  • ERROR_NO_HANDLES if a handle could not be obtained for image creation
  • * */ -public Image(Device device, ImageData source, ImageData mask) { +public this(Device device, ImageData source, ImageData mask) { super(device); if (source is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); if (mask is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); @@ -455,7 +455,7 @@ *
  • ERROR_NO_HANDLES if a handle could not be obtained for image creation
  • * */ -public Image(Device device, InputStream stream) { +public this(Device device, InputStream stream) { super(device); init(new ImageData(stream)); init(); @@ -488,7 +488,7 @@ *
  • ERROR_NO_HANDLES if a handle could not be obtained for image creation
  • * */ -public Image(Device device, String filename) { +public this(Device device, String filename) { super(device); init(new ImageData(filename)); init(); @@ -497,7 +497,7 @@ void createAlpha () { if (transparentPixel is -1 && alpha is -1 && alphaData is null) return; NSSize size = handle.size(); - int height = (int)size.height; + int height = cast(int)size.height; int bpr = imageRep.bytesPerRow(); int dataSize = height * bpr; byte[] srcData = new byte[dataSize]; @@ -505,15 +505,15 @@ if (transparentPixel !is -1) { for (int i=0; i> 3)]) & (1 << (7 - (x & 0x7)))) !is 0 ? (byte)0xff : 0; + buffer[offset] = ((maskData[maskOffset + (x >> 3)]) & (1 << (7 - (x & 0x7)))) !is 0 ? cast(byte)0xff : 0; offset += 4; } maskOffset += maskBpl; @@ -807,7 +807,7 @@ if (image.alpha !is -1) { hasAlpha = true; this.alpha = image.alpha; - byte a = (byte)this.alpha; + byte a = cast(byte)this.alpha; for (int dataIndex=0; dataIndex> 16) & 0xFF); -// byte green = (byte)((transparentPixel >> 8) & 0xFF); -// byte blue = (byte)((transparentPixel >> 0) & 0xFF); -// byte newRed = (byte)((int)(color.handle[0] * 255) & 0xFF); -// byte newGreen = (byte)((int)(color.handle[1] * 255) & 0xFF); -// byte newBlue = (byte)((int)(color.handle[2] * 255) & 0xFF); +// byte red = cast(byte)((transparentPixel >> 16) & 0xFF); +// byte green = cast(byte)((transparentPixel >> 8) & 0xFF); +// byte blue = cast(byte)((transparentPixel >> 0) & 0xFF); +// byte newRed = cast(byte)(cast(int)(color.handle[0] * 255) & 0xFF); +// byte newGreen = cast(byte)(cast(int)(color.handle[1] * 255) & 0xFF); +// byte newBlue = cast(byte)(cast(int)(color.handle[2] * 255) & 0xFF); // int height = OS.CGImageGetHeight(handle); // int bpl = OS.CGImageGetBytesPerRow(handle); // byte[] line = new byte[bpl]; diff -r fb2555104d70 -r 5b53d338c709 dwt/graphics/ImageData.d --- a/dwt/graphics/ImageData.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/graphics/ImageData.d Fri Aug 29 22:04:22 2008 +0200 @@ -35,7 +35,7 @@ * @see ImageLoader */ -public final class ImageData implements CloneableCompatibility { +public final class ImageData : CloneableCompatibility { /** * The width of the image, in pixels. @@ -218,7 +218,7 @@ if (b is 0) continue; int inc = 0; for (int bit = 0x10000; (bit >>= b) !is 0;) inc |= bit; - for (int v = 0, p = 0; v < 0x10000; v+= inc) data[p++] = (byte)(v >> 8); + for (int v = 0, p = 0; v < 0x10000; v+= inc) data[p++] = cast(byte)(v >> 8); } } static final byte[] ONE_TO_ONE_MAPPING = ANY_TO_EIGHT[8]; @@ -253,7 +253,7 @@ *
  • ERROR_NULL_ARGUMENT - if the palette is null
  • * */ -public ImageData(int width, int height, int depth, PaletteData palette) { +public this(int width, int height, int depth, PaletteData palette) { this(width, height, depth, palette, 4, null, 0, null, null, -1, -1, DWT.IMAGE_UNDEFINED, @@ -278,7 +278,7 @@ *
  • ERROR_CANNOT_BE_ZERO - if the scanlinePad is zero
  • * */ -public ImageData(int width, int height, int depth, PaletteData palette, int scanlinePad, byte[] data) { +public this(int width, int height, int depth, PaletteData palette, int scanlinePad, byte[] data) { this(width, height, depth, palette, scanlinePad, checkData(data), 0, null, null, -1, -1, DWT.IMAGE_UNDEFINED, @@ -328,7 +328,7 @@ * * @see ImageLoader#load(InputStream) */ -public ImageData(InputStream stream) { +public this(InputStream stream) { ImageData[] data = ImageDataLoader.load(stream); if (data.length < 1) DWT.error(DWT.ERROR_INVALID_IMAGE); ImageData i = data[0]; @@ -374,7 +374,7 @@ *
  • ERROR_UNSUPPORTED_FORMAT - if the image file contains an unrecognized format
  • * */ -public ImageData(String filename) { +public this(String filename) { ImageData[] data = ImageDataLoader.load(filename); if (data.length < 1) DWT.error(DWT.ERROR_INVALID_IMAGE); ImageData i = data[0]; @@ -401,7 +401,7 @@ /** * Prevents uninitialized instances from being created outside the package. */ -ImageData() { +this() { } /** @@ -410,7 +410,7 @@ * This method is for internal use, and is not described further. *

    */ -ImageData( +this( int width, int height, int depth, PaletteData palette, int scanlinePad, byte[] data, int maskPad, byte[] maskData, byte[] alphaData, int alpha, int transparentPixel, int type, @@ -627,7 +627,7 @@ if (alphaData is null) { int endIndex = startIndex + getWidth; for (int i = startIndex; i < endIndex; i++) { - alphas[i] = (byte)255; + alphas[i] = cast(byte)255; } return; } @@ -750,7 +750,7 @@ index = (y * bytesPerLine) + (x >> 1); if ((x & 0x1) is 1) { theByte = data[index] & 0xFF; - pixels[i] = (byte)(theByte & 0x0F); + pixels[i] = cast(byte)(theByte & 0x0F); i++; n--; srcX++; @@ -764,7 +764,7 @@ } while (n > 1) { theByte = data[index] & 0xFF; - pixels[i] = (byte)(theByte >> 4); + pixels[i] = cast(byte)(theByte >> 4); i++; n--; srcX++; @@ -773,7 +773,7 @@ index = srcY * bytesPerLine; srcX = 0; } else { - pixels[i] = (byte)(theByte & 0x0F); + pixels[i] = cast(byte)(theByte & 0x0F); i++; n--; srcX++; @@ -788,7 +788,7 @@ } if (n > 0) { theByte = data[index] & 0xFF; - pixels[i] = (byte)(theByte >> 4); + pixels[i] = cast(byte)(theByte >> 4); } return; case 2: @@ -798,7 +798,7 @@ while (n > 0) { offset = 3 - (srcX % 4); mask = 3 << (offset * 2); - pixels[i] = (byte)((theByte & mask) >> (offset * 2)); + pixels[i] = cast(byte)((theByte & mask) >> (offset * 2)); i++; n--; srcX++; @@ -992,7 +992,7 @@ while (n > 0) { offset = 3 - (srcX % 4); mask = 3 << (offset * 2); - pixels[i] = (byte)((theByte & mask) >> (offset * 2)); + pixels[i] = cast(byte)((theByte & mask) >> (offset * 2)); i++; n--; srcX++; @@ -1169,7 +1169,7 @@ DWT.error(DWT.ERROR_INVALID_ARGUMENT); if (alphaData is null) alphaData = new byte[width * height]; - alphaData[y * width + x] = (byte)alpha; + alphaData[y * width + x] = cast(byte)alpha; } /** @@ -1224,32 +1224,32 @@ switch (depth) { case 32: index = (y * bytesPerLine) + (x * 4); - data[index] = (byte)((pixelValue >> 24) & 0xFF); - data[index + 1] = (byte)((pixelValue >> 16) & 0xFF); - data[index + 2] = (byte)((pixelValue >> 8) & 0xFF); - data[index + 3] = (byte)(pixelValue & 0xFF); + data[index] = cast(byte)((pixelValue >> 24) & 0xFF); + data[index + 1] = cast(byte)((pixelValue >> 16) & 0xFF); + data[index + 2] = cast(byte)((pixelValue >> 8) & 0xFF); + data[index + 3] = cast(byte)(pixelValue & 0xFF); return; case 24: index = (y * bytesPerLine) + (x * 3); - data[index] = (byte)((pixelValue >> 16) & 0xFF); - data[index + 1] = (byte)((pixelValue >> 8) & 0xFF); - data[index + 2] = (byte)(pixelValue & 0xFF); + data[index] = cast(byte)((pixelValue >> 16) & 0xFF); + data[index + 1] = cast(byte)((pixelValue >> 8) & 0xFF); + data[index + 2] = cast(byte)(pixelValue & 0xFF); return; case 16: index = (y * bytesPerLine) + (x * 2); - data[index + 1] = (byte)((pixelValue >> 8) & 0xFF); - data[index] = (byte)(pixelValue & 0xFF); + data[index + 1] = cast(byte)((pixelValue >> 8) & 0xFF); + data[index] = cast(byte)(pixelValue & 0xFF); return; case 8: index = (y * bytesPerLine) + x ; - data[index] = (byte)(pixelValue & 0xFF); + data[index] = cast(byte)(pixelValue & 0xFF); return; case 4: index = (y * bytesPerLine) + (x >> 1); if ((x & 0x1) is 0) { - data[index] = (byte)((data[index] & 0x0F) | ((pixelValue & 0x0F) << 4)); + data[index] = cast(byte)((data[index] & 0x0F) | ((pixelValue & 0x0F) << 4)); } else { - data[index] = (byte)((data[index] & 0xF0) | (pixelValue & 0x0F)); + data[index] = cast(byte)((data[index] & 0xF0) | (pixelValue & 0x0F)); } return; case 2: @@ -1257,16 +1257,16 @@ theByte = data[index]; int offset = 3 - (x % 4); mask = 0xFF ^ (3 << (offset * 2)); - data[index] = (byte)((data[index] & mask) | (pixelValue << (offset * 2))); + data[index] = cast(byte)((data[index] & mask) | (pixelValue << (offset * 2))); return; case 1: index = (y * bytesPerLine) + (x >> 3); theByte = data[index]; mask = 1 << (7 - (x & 0x7)); if ((pixelValue & 0x1) is 1) { - data[index] = (byte)(theByte | mask); + data[index] = cast(byte)(theByte | mask); } else { - data[index] = (byte)(theByte & (mask ^ -1)); + data[index] = cast(byte)(theByte & (mask ^ -1)); } return; } @@ -1310,7 +1310,7 @@ case 8: index = (y * bytesPerLine) + x; for (int j = 0; j < putWidth; j++) { - data[index] = (byte)(pixels[i] & 0xFF); + data[index] = cast(byte)(pixels[i] & 0xFF); i++; srcX++; if (srcX >= width) { @@ -1328,9 +1328,9 @@ while (n > 0) { theByte = pixels[i] & 0x0F; if (high) { - data[index] = (byte)((data[index] & 0x0F) | (theByte << 4)); + data[index] = cast(byte)((data[index] & 0x0F) | (theByte << 4)); } else { - data[index] = (byte)((data[index] & 0xF0) | theByte); + data[index] = cast(byte)((data[index] & 0xF0) | theByte); } i++; n--; @@ -1347,12 +1347,12 @@ } return; case 2: - byte [] masks = { (byte)0xFC, (byte)0xF3, (byte)0xCF, (byte)0x3F }; + byte [] masks = { cast(byte)0xFC, cast(byte)0xF3, cast(byte)0xCF, cast(byte)0x3F }; index = (y * bytesPerLine) + (x >> 2); int offset = 3 - (x % 4); while (n > 0) { theByte = pixels[i] & 0x3; - data[index] = (byte)((data[index] & masks[offset]) | (theByte << (offset * 2))); + data[index] = cast(byte)((data[index] & masks[offset]) | (theByte << (offset * 2))); i++; n--; srcX++; @@ -1376,9 +1376,9 @@ while (n > 0) { mask = 1 << (7 - (srcX & 0x7)); if ((pixels[i] & 0x1) is 1) { - data[index] = (byte)((data[index] & 0xFF) | mask); + data[index] = cast(byte)((data[index] & 0xFF) | mask); } else { - data[index] = (byte)((data[index] & 0xFF) & (mask ^ -1)); + data[index] = cast(byte)((data[index] & 0xFF) & (mask ^ -1)); } i++; n--; @@ -1436,10 +1436,10 @@ index = (y * bytesPerLine) + (x * 4); for (int j = 0; j < putWidth; j++) { pixel = pixels[i]; - data[index] = (byte)((pixel >> 24) & 0xFF); - data[index + 1] = (byte)((pixel >> 16) & 0xFF); - data[index + 2] = (byte)((pixel >> 8) & 0xFF); - data[index + 3] = (byte)(pixel & 0xFF); + data[index] = cast(byte)((pixel >> 24) & 0xFF); + data[index + 1] = cast(byte)((pixel >> 16) & 0xFF); + data[index + 2] = cast(byte)((pixel >> 8) & 0xFF); + data[index + 3] = cast(byte)(pixel & 0xFF); i++; srcX++; if (srcX >= width) { @@ -1455,9 +1455,9 @@ index = (y * bytesPerLine) + (x * 3); for (int j = 0; j < putWidth; j++) { pixel = pixels[i]; - data[index] = (byte)((pixel >> 16) & 0xFF); - data[index + 1] = (byte)((pixel >> 8) & 0xFF); - data[index + 2] = (byte)(pixel & 0xFF); + data[index] = cast(byte)((pixel >> 16) & 0xFF); + data[index + 1] = cast(byte)((pixel >> 8) & 0xFF); + data[index + 2] = cast(byte)(pixel & 0xFF); i++; srcX++; if (srcX >= width) { @@ -1473,8 +1473,8 @@ index = (y * bytesPerLine) + (x * 2); for (int j = 0; j < putWidth; j++) { pixel = pixels[i]; - data[index] = (byte)(pixel & 0xFF); - data[index + 1] = (byte)((pixel >> 8) & 0xFF); + data[index] = cast(byte)(pixel & 0xFF); + data[index + 1] = cast(byte)((pixel >> 8) & 0xFF); i++; srcX++; if (srcX >= width) { @@ -1489,7 +1489,7 @@ case 8: index = (y * bytesPerLine) + x; for (int j = 0; j < putWidth; j++) { - data[index] = (byte)(pixels[i] & 0xFF); + data[index] = cast(byte)(pixels[i] & 0xFF); i++; srcX++; if (srcX >= width) { @@ -1507,9 +1507,9 @@ while (n > 0) { theByte = pixels[i] & 0x0F; if (high) { - data[index] = (byte)((data[index] & 0x0F) | (theByte << 4)); + data[index] = cast(byte)((data[index] & 0x0F) | (theByte << 4)); } else { - data[index] = (byte)((data[index] & 0xF0) | theByte); + data[index] = cast(byte)((data[index] & 0xF0) | theByte); } i++; n--; @@ -1526,12 +1526,12 @@ } return; case 2: - byte [] masks = { (byte)0xFC, (byte)0xF3, (byte)0xCF, (byte)0x3F }; + byte [] masks = { cast(byte)0xFC, cast(byte)0xF3, cast(byte)0xCF, cast(byte)0x3F }; index = (y * bytesPerLine) + (x >> 2); int offset = 3 - (x % 4); while (n > 0) { theByte = pixels[i] & 0x3; - data[index] = (byte)((data[index] & masks[offset]) | (theByte << (offset * 2))); + data[index] = cast(byte)((data[index] & masks[offset]) | (theByte << (offset * 2))); i++; n--; srcX++; @@ -1555,9 +1555,9 @@ while (n > 0) { mask = 1 << (7 - (srcX & 0x7)); if ((pixels[i] & 0x1) is 1) { - data[index] = (byte)((data[index] & 0xFF) | mask); + data[index] = cast(byte)((data[index] & 0xFF) | mask); } else { - data[index] = (byte)((data[index] & 0xFF) & (mask ^ -1)); + data[index] = cast(byte)((data[index] & 0xFF) & (mask ^ -1)); } i++; n--; @@ -1776,9 +1776,9 @@ /*** Prepare scaling data ***/ final int dwm1 = destWidth - 1; - final int sfxi = (dwm1 !is 0) ? (int)((((long)srcWidth << 16) - 1) / dwm1) : 0; + final int sfxi = (dwm1 !is 0) ? cast(int)(((cast(long)srcWidth << 16) - 1) / dwm1) : 0; final int dhm1 = destHeight - 1; - final int sfyi = (dhm1 !is 0) ? (int)((((long)srcHeight << 16) - 1) / dhm1) : 0; + final int sfyi = (dhm1 !is 0) ? cast(int)(((cast(long)srcHeight << 16) - 1) / dhm1) : 0; /*** Prepare source-related data ***/ final int sbpp, stype; @@ -2107,32 +2107,32 @@ (a >>> destAlphaPreShift << destAlphaShift); switch (dtype) { case TYPE_GENERIC_8: { - destData[dp] = (byte) data; + destData[dp] = cast(byte) data; } break; case TYPE_GENERIC_16_MSB: { - destData[dp] = (byte) (data >>> 8); - destData[dp + 1] = (byte) (data & 0xff); + destData[dp] = cast(byte) (data >>> 8); + destData[dp + 1] = cast(byte) (data & 0xff); } break; case TYPE_GENERIC_16_LSB: { - destData[dp] = (byte) (data & 0xff); - destData[dp + 1] = (byte) (data >>> 8); + destData[dp] = cast(byte) (data & 0xff); + destData[dp + 1] = cast(byte) (data >>> 8); } break; case TYPE_GENERIC_24: { - destData[dp] = (byte) (data >>> 16); - destData[dp + 1] = (byte) (data >>> 8); - destData[dp + 2] = (byte) (data & 0xff); + destData[dp] = cast(byte) (data >>> 16); + destData[dp + 1] = cast(byte) (data >>> 8); + destData[dp + 2] = cast(byte) (data & 0xff); } break; case TYPE_GENERIC_32_MSB: { - destData[dp] = (byte) (data >>> 24); - destData[dp + 1] = (byte) (data >>> 16); - destData[dp + 2] = (byte) (data >>> 8); - destData[dp + 3] = (byte) (data & 0xff); + destData[dp] = cast(byte) (data >>> 24); + destData[dp + 1] = cast(byte) (data >>> 16); + destData[dp + 2] = cast(byte) (data >>> 8); + destData[dp + 3] = cast(byte) (data & 0xff); } break; case TYPE_GENERIC_32_LSB: { - destData[dp] = (byte) (data & 0xff); - destData[dp + 1] = (byte) (data >>> 8); - destData[dp + 2] = (byte) (data >>> 16); - destData[dp + 3] = (byte) (data >>> 24); + destData[dp] = cast(byte) (data & 0xff); + destData[dp + 1] = cast(byte) (data >>> 8); + destData[dp + 2] = cast(byte) (data >>> 16); + destData[dp + 3] = cast(byte) (data >>> 24); } break; } } @@ -2198,9 +2198,9 @@ /*** Prepare scaling data ***/ final int dwm1 = destWidth - 1; - final int sfxi = (dwm1 !is 0) ? (int)((((long)srcWidth << 16) - 1) / dwm1) : 0; + final int sfxi = (dwm1 !is 0) ? cast(int)(((cast(long)srcWidth << 16) - 1) / dwm1) : 0; final int dhm1 = destHeight - 1; - final int sfyi = (dhm1 !is 0) ? (int)((((long)srcHeight << 16) - 1) / dhm1) : 0; + final int sfyi = (dhm1 !is 0) ? cast(int)(((cast(long)srcHeight << 16) - 1) / dhm1) : 0; /*** Prepare source-related data ***/ final int stype; @@ -2305,7 +2305,7 @@ } else { paletteMapping = new byte[1 << srcDepth]; int mask = (0xff << destDepth) >>> 8; - for (int i = 0; i < paletteMapping.length; ++i) paletteMapping[i] = (byte)(i & mask); + for (int i = 0; i < paletteMapping.length; ++i) paletteMapping[i] = cast(byte)(i & mask); } break; } @@ -2334,7 +2334,7 @@ minDistance = distance; } } - paletteMapping[i] = (byte)index; + paletteMapping[i] = cast(byte)index; if (minDistance !is 0) isExactPaletteMapping = false; } break; @@ -2358,8 +2358,8 @@ if ((sp & 1) !is 0) v = paletteMapping[srcData[sp >> 1] & 0x0f]; else v = (srcData[sp >> 1] >>> 4) & 0x0f; sp += (sfx >>> 16); - if ((dp & 1) !is 0) destData[dp >> 1] = (byte)((destData[dp >> 1] & 0xf0) | v); - else destData[dp >> 1] = (byte)((destData[dp >> 1] & 0x0f) | (v << 4)); + 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)); } } break; @@ -2369,7 +2369,7 @@ final int index = paletteMapping[(srcData[sp >> 2] >>> (6 - (sp & 3) * 2)) & 0x03]; sp += (sfx >>> 16); final int shift = 6 - (dp & 3) * 2; - destData[dp >> 2] = (byte)(destData[dp >> 2] & ~(0x03 << shift) | (index << shift)); + destData[dp >> 2] = cast(byte)(destData[dp >> 2] & ~(0x03 << shift) | (index << shift)); } } break; @@ -2379,7 +2379,7 @@ final int index = paletteMapping[(srcData[sp >> 3] >>> (7 - (sp & 7))) & 0x01]; sp += (sfx >>> 16); final int shift = 7 - (dp & 7); - destData[dp >> 3] = (byte)(destData[dp >> 3] & ~(0x01 << shift) | (index << shift)); + destData[dp >> 3] = cast(byte)(destData[dp >> 3] & ~(0x01 << shift) | (index << shift)); } } break; @@ -2389,7 +2389,7 @@ final int index = paletteMapping[(srcData[sp >> 3] >>> (sp & 7)) & 0x01]; sp += (sfx >>> 16); final int shift = dp & 7; - destData[dp >> 3] = (byte)(destData[dp >> 3] & ~(0x01 << shift) | (index << shift)); + destData[dp >> 3] = cast(byte)(destData[dp >> 3] & ~(0x01 << shift) | (index << shift)); } } break; @@ -2464,23 +2464,23 @@ /*** WRITE NEXT PIXEL ***/ switch (dtype) { case TYPE_INDEX_8: - destData[dp] = (byte) index; + destData[dp] = cast(byte) index; break; case TYPE_INDEX_4: - if ((dp & 1) !is 0) destData[dp >> 1] = (byte)((destData[dp >> 1] & 0xf0) | index); - else destData[dp >> 1] = (byte)((destData[dp >> 1] & 0x0f) | (index << 4)); + 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: { final int shift = 6 - (dp & 3) * 2; - destData[dp >> 2] = (byte)(destData[dp >> 2] & ~(0x03 << shift) | (index << shift)); + destData[dp >> 2] = cast(byte)(destData[dp >> 2] & ~(0x03 << shift) | (index << shift)); } break; case TYPE_INDEX_1_MSB: { final int shift = 7 - (dp & 7); - destData[dp >> 3] = (byte)(destData[dp >> 3] & ~(0x01 << shift) | (index << shift)); + destData[dp >> 3] = cast(byte)(destData[dp >> 3] & ~(0x01 << shift) | (index << shift)); } break; case TYPE_INDEX_1_LSB: { final int shift = dp & 7; - destData[dp >> 3] = (byte)(destData[dp >> 3] & ~(0x01 << shift) | (index << shift)); + destData[dp >> 3] = cast(byte)(destData[dp >> 3] & ~(0x01 << shift) | (index << shift)); } break; } } @@ -2644,23 +2644,23 @@ /*** WRITE NEXT PIXEL ***/ switch (dtype) { case TYPE_INDEX_8: - destData[dp] = (byte) lastindex; + destData[dp] = cast(byte) lastindex; break; case TYPE_INDEX_4: - if ((dp & 1) !is 0) destData[dp >> 1] = (byte)((destData[dp >> 1] & 0xf0) | lastindex); - else destData[dp >> 1] = (byte)((destData[dp >> 1] & 0x0f) | (lastindex << 4)); + 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: { final int shift = 6 - (dp & 3) * 2; - destData[dp >> 2] = (byte)(destData[dp >> 2] & ~(0x03 << shift) | (lastindex << shift)); + destData[dp >> 2] = cast(byte)(destData[dp >> 2] & ~(0x03 << shift) | (lastindex << shift)); } break; case TYPE_INDEX_1_MSB: { final int shift = 7 - (dp & 7); - destData[dp >> 3] = (byte)(destData[dp >> 3] & ~(0x01 << shift) | (lastindex << shift)); + destData[dp >> 3] = cast(byte)(destData[dp >> 3] & ~(0x01 << shift) | (lastindex << shift)); } break; case TYPE_INDEX_1_LSB: { final int shift = dp & 7; - destData[dp >> 3] = (byte)(destData[dp >> 3] & ~(0x01 << shift) | (lastindex << shift)); + destData[dp >> 3] = cast(byte)(destData[dp >> 3] & ~(0x01 << shift) | (lastindex << shift)); } break; } } @@ -2728,9 +2728,9 @@ /*** Prepare scaling data ***/ final int dwm1 = destWidth - 1; - final int sfxi = (dwm1 !is 0) ? (int)((((long)srcWidth << 16) - 1) / dwm1) : 0; + final int sfxi = (dwm1 !is 0) ? cast(int)(((cast(long)srcWidth << 16) - 1) / dwm1) : 0; final int dhm1 = destHeight - 1; - final int sfyi = (dhm1 !is 0) ? (int)((((long)srcHeight << 16) - 1) / dhm1) : 0; + final int sfyi = (dhm1 !is 0) ? cast(int)(((cast(long)srcHeight << 16) - 1) / dhm1) : 0; /*** Prepare source-related data ***/ final int stype; @@ -2973,32 +2973,32 @@ (a >>> destAlphaPreShift << destAlphaShift); switch (dtype) { case TYPE_GENERIC_8: { - destData[dp] = (byte) data; + destData[dp] = cast(byte) data; } break; case TYPE_GENERIC_16_MSB: { - destData[dp] = (byte) (data >>> 8); - destData[dp + 1] = (byte) (data & 0xff); + destData[dp] = cast(byte) (data >>> 8); + destData[dp + 1] = cast(byte) (data & 0xff); } break; case TYPE_GENERIC_16_LSB: { - destData[dp] = (byte) (data & 0xff); - destData[dp + 1] = (byte) (data >>> 8); + destData[dp] = cast(byte) (data & 0xff); + destData[dp + 1] = cast(byte) (data >>> 8); } break; case TYPE_GENERIC_24: { - destData[dp] = (byte) (data >>> 16); - destData[dp + 1] = (byte) (data >>> 8); - destData[dp + 2] = (byte) (data & 0xff); + destData[dp] = cast(byte) (data >>> 16); + destData[dp + 1] = cast(byte) (data >>> 8); + destData[dp + 2] = cast(byte) (data & 0xff); } break; case TYPE_GENERIC_32_MSB: { - destData[dp] = (byte) (data >>> 24); - destData[dp + 1] = (byte) (data >>> 16); - destData[dp + 2] = (byte) (data >>> 8); - destData[dp + 3] = (byte) (data & 0xff); + destData[dp] = cast(byte) (data >>> 24); + destData[dp + 1] = cast(byte) (data >>> 16); + destData[dp + 2] = cast(byte) (data >>> 8); + destData[dp + 3] = cast(byte) (data & 0xff); } break; case TYPE_GENERIC_32_LSB: { - destData[dp] = (byte) (data & 0xff); - destData[dp + 1] = (byte) (data >>> 8); - destData[dp + 2] = (byte) (data >>> 16); - destData[dp + 3] = (byte) (data >>> 24); + destData[dp] = cast(byte) (data & 0xff); + destData[dp + 1] = cast(byte) (data >>> 8); + destData[dp + 2] = cast(byte) (data >>> 16); + destData[dp + 3] = cast(byte) (data >>> 24); } break; } } @@ -3066,9 +3066,9 @@ /*** Prepare scaling data ***/ final int dwm1 = destWidth - 1; - final int sfxi = (dwm1 !is 0) ? (int)((((long)srcWidth << 16) - 1) / dwm1) : 0; + final int sfxi = (dwm1 !is 0) ? cast(int)(((cast(long)srcWidth << 16) - 1) / dwm1) : 0; final int dhm1 = destHeight - 1; - final int sfyi = (dhm1 !is 0) ? (int)((((long)srcHeight << 16) - 1) / dhm1) : 0; + final int sfyi = (dhm1 !is 0) ? cast(int)(((cast(long)srcHeight << 16) - 1) / dhm1) : 0; /*** Prepare source-related data ***/ final int sbpp, stype; @@ -3351,23 +3351,23 @@ /*** WRITE NEXT PIXEL ***/ switch (dtype) { case TYPE_INDEX_8: - destData[dp] = (byte) lastindex; + destData[dp] = cast(byte) lastindex; break; case TYPE_INDEX_4: - if ((dp & 1) !is 0) destData[dp >> 1] = (byte)((destData[dp >> 1] & 0xf0) | lastindex); - else destData[dp >> 1] = (byte)((destData[dp >> 1] & 0x0f) | (lastindex << 4)); + 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: { final int shift = 6 - (dp & 3) * 2; - destData[dp >> 2] = (byte)(destData[dp >> 2] & ~(0x03 << shift) | (lastindex << shift)); + destData[dp >> 2] = cast(byte)(destData[dp >> 2] & ~(0x03 << shift) | (lastindex << shift)); } break; case TYPE_INDEX_1_MSB: { final int shift = 7 - (dp & 7); - destData[dp >> 3] = (byte)(destData[dp >> 3] & ~(0x01 << shift) | (lastindex << shift)); + destData[dp >> 3] = cast(byte)(destData[dp >> 3] & ~(0x01 << shift) | (lastindex << shift)); } break; case TYPE_INDEX_1_LSB: { final int shift = dp & 7; - destData[dp >> 3] = (byte)(destData[dp >> 3] & ~(0x01 << shift) | (lastindex << shift)); + destData[dp >> 3] = cast(byte)(destData[dp >> 3] & ~(0x01 << shift) | (lastindex << shift)); } break; } } @@ -3491,14 +3491,14 @@ ++dy, blend += blendi, dp += bytesPerLine) { for (int dx = 0; dx < bandWidth; ++dx) { bitmapData[dp + dx] = (blend + DITHER_MATRIX[dy & 7][dx]) < - 0x1000000 ? (byte)0 : (byte)1; + 0x1000000 ? cast(byte)0 : cast(byte)1; } } } else { for (int dx = 0, blend = 0; dx < bandWidth; ++dx, blend += blendi) { for (int dy = 0, dptr = dx; dy < bandHeight; ++dy, dptr += bytesPerLine) { bitmapData[dptr] = (blend + DITHER_MATRIX[dy][dx & 7]) < - 0x1000000 ? (byte)0 : (byte)1; + 0x1000000 ? cast(byte)0 : cast(byte)1; } } } @@ -3516,12 +3516,12 @@ final int inc = ((to << 16) - val) / steps + 1; if (vertical) { for (int dy = 0; dy < bandHeight; ++dy, dp += bytesPerLine) { - bitmapData[dp] = (byte)(val >>> 16); + bitmapData[dp] = cast(byte)(val >>> 16); val += inc; } } else { for (int dx = 0; dx < bandWidth; ++dx, dp += 4) { - bitmapData[dp] = (byte)(val >>> 16); + bitmapData[dp] = cast(byte)(val >>> 16); val += inc; } } @@ -3542,7 +3542,7 @@ final int thresh = DITHER_MATRIX[dy & 7][dx] >>> bits; int temp = val + thresh; if (temp > 0xffffff) bitmapData[dptr] = -1; - else bitmapData[dptr] = (byte)((temp >>> 16) & mask); + else bitmapData[dptr] = cast(byte)((temp >>> 16) & mask); } val += inc; } @@ -3552,7 +3552,7 @@ final int thresh = DITHER_MATRIX[dy][dx & 7] >>> bits; int temp = val + thresh; if (temp > 0xffffff) bitmapData[dptr] = -1; - else bitmapData[dptr] = (byte)((temp >>> 16) & mask); + else bitmapData[dptr] = cast(byte)((temp >>> 16) & mask); } val += inc; } diff -r fb2555104d70 -r 5b53d338c709 dwt/graphics/ImageLoader.d --- a/dwt/graphics/ImageLoader.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/graphics/ImageLoader.d Fri Aug 29 22:04:22 2008 +0200 @@ -93,7 +93,7 @@ /** * Construct a new empty ImageLoader. */ -public ImageLoader() { +public this() { reset(); } @@ -318,7 +318,7 @@ if (!hasListeners()) return; int size = imageLoaderListeners.size(); for (int i = 0; i < size; i++) { - ImageLoaderListener listener = (ImageLoaderListener) imageLoaderListeners.elementAt(i); + ImageLoaderListener listener = cast(ImageLoaderListener) imageLoaderListeners.elementAt(i); listener.imageDataLoaded(event); } } diff -r fb2555104d70 -r 5b53d338c709 dwt/graphics/ImageLoaderEvent.d --- a/dwt/graphics/ImageLoaderEvent.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/graphics/ImageLoaderEvent.d Fri Aug 29 22:04:22 2008 +0200 @@ -32,7 +32,7 @@ * @see ImageLoaderListener */ -public class ImageLoaderEvent extends DWTEventObject { +public class ImageLoaderEvent : DWTEventObject { /** * if the endOfImage flag is false, then this is a @@ -67,7 +67,7 @@ * @param incrementCount the image data increment for the event * @param endOfImage the end of image flag for the event */ -public ImageLoaderEvent(ImageLoader source, ImageData imageData, int incrementCount, bool endOfImage) { +public this(ImageLoader source, ImageData imageData, int incrementCount, bool endOfImage) { super(source); this.imageData = imageData; this.incrementCount = incrementCount; diff -r fb2555104d70 -r 5b53d338c709 dwt/graphics/ImageLoaderListener.d --- a/dwt/graphics/ImageLoaderListener.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/graphics/ImageLoaderListener.d Fri Aug 29 22:04:22 2008 +0200 @@ -30,7 +30,7 @@ * @see ImageLoaderEvent */ -public interface ImageLoaderListener extends DWTEventListener { +public interface ImageLoaderListener : DWTEventListener { /** * Sent when image data is either partially or completely loaded. diff -r fb2555104d70 -r 5b53d338c709 dwt/graphics/LineAttributes.d --- a/dwt/graphics/LineAttributes.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/graphics/LineAttributes.d Fri Aug 29 22:04:22 2008 +0200 @@ -85,7 +85,7 @@ * * @param width the line width */ -public LineAttributes(float width) { +public this(float width) { this(width, DWT.CAP_FLAT, DWT.JOIN_MITER, DWT.LINE_SOLID, null, 0, 10); } @@ -96,7 +96,7 @@ * @param cap the line cap style * @param join the line join style */ -public LineAttributes(float width, int cap, int join) { +public this(float width, int cap, int join) { this(width, cap, join, DWT.LINE_SOLID, null, 0, 10); } @@ -111,7 +111,7 @@ * @param dashOffset the line dash style offset * @param miterLimit the line miter limit */ -public LineAttributes(float width, int cap, int join, int style, float[] dash, float dashOffset, float miterLimit) { +public this(float width, int cap, int join, int style, float[] dash, float dashOffset, float miterLimit) { this.width = width; this.cap = cap; this.join = join; diff -r fb2555104d70 -r 5b53d338c709 dwt/graphics/PaletteData.d --- a/dwt/graphics/PaletteData.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/graphics/PaletteData.d Fri Aug 29 22:04:22 2008 +0200 @@ -107,7 +107,7 @@ *
  • ERROR_NULL_ARGUMENT - if the argument is null
  • * */ -public PaletteData(RGB[] colors) { +public this(RGB[] colors) { if (colors is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); this.colors = colors; this.isDirect = false; @@ -120,7 +120,7 @@ * @param greenMask the green mask * @param blueMask the blue mask */ -public PaletteData(int redMask, int greenMask, int blueMask) { +public this(int redMask, int greenMask, int blueMask) { this.redMask = redMask; this.greenMask = greenMask; this.blueMask = blueMask; diff -r fb2555104d70 -r 5b53d338c709 dwt/graphics/Path.d --- a/dwt/graphics/Path.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/graphics/Path.d Fri Aug 29 22:04:22 2008 +0200 @@ -44,7 +44,7 @@ * * @since 3.1 */ -public class Path extends Resource { +public class Path : Resource { /** * the OS resource for the Path @@ -80,7 +80,7 @@ * * @see #dispose() */ -public Path (Device device) { +public this (Device device) { super(device); handle = NSBezierPath.bezierPath(); if (handle is null) DWT.error(DWT.ERROR_NO_HANDLES); @@ -89,7 +89,7 @@ init(); } -public Path (Device device, Path path, float flatness) { +public this (Device device, Path path, float flatness) { super(device); if (path is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); if (path.isDisposed()) DWT.error(DWT.ERROR_INVALID_ARGUMENT); @@ -106,7 +106,7 @@ init(); } -public Path (Device device, PathData data) { +public this (Device device, PathData data) { this(device); if (data is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); init(data); @@ -219,10 +219,10 @@ if (font is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); if (font.isDisposed()) DWT.error(DWT.ERROR_INVALID_ARGUMENT); NSString str = NSString.stringWith(string); - NSTextStorage textStorage = ((NSTextStorage)new NSTextStorage().alloc()); + NSTextStorage textStorage = (cast(NSTextStorage)new NSTextStorage().alloc()); textStorage.initWithString_(str); - NSLayoutManager layoutManager = (NSLayoutManager)new NSLayoutManager().alloc().init(); - NSTextContainer textContainer = (NSTextContainer)new NSTextContainer().alloc(); + NSLayoutManager layoutManager = cast(NSLayoutManager)new NSLayoutManager().alloc().init(); + NSTextContainer textContainer = cast(NSTextContainer)new NSTextContainer().alloc(); NSSize size = new NSSize(); size.width = Float.MAX_VALUE; size.height = Float.MAX_VALUE; @@ -413,26 +413,26 @@ case OS.NSMoveToBezierPathElement: types[typeCount++] = DWT.PATH_MOVE_TO; OS.memmove(pt, points, NSPoint.sizeof); - pointArray[pointCount++] = (int)pt.x; - pointArray[pointCount++] = (int)pt.y; + pointArray[pointCount++] = cast(int)pt.x; + pointArray[pointCount++] = cast(int)pt.y; break; case OS.NSLineToBezierPathElement: types[typeCount++] = DWT.PATH_LINE_TO; OS.memmove(pt, points, NSPoint.sizeof); - pointArray[pointCount++] = (int)pt.x; - pointArray[pointCount++] = (int)pt.y; + pointArray[pointCount++] = cast(int)pt.x; + pointArray[pointCount++] = cast(int)pt.y; break; case OS.NSCurveToBezierPathElement: types[typeCount++] = DWT.PATH_CUBIC_TO; OS.memmove(pt, points, NSPoint.sizeof); - pointArray[pointCount++] = (int)pt.x; - pointArray[pointCount++] = (int)pt.y; + pointArray[pointCount++] = cast(int)pt.x; + pointArray[pointCount++] = cast(int)pt.y; OS.memmove(pt, points + NSPoint.sizeof, NSPoint.sizeof); - pointArray[pointCount++] = (int)pt.x; - pointArray[pointCount++] = (int)pt.y; + pointArray[pointCount++] = cast(int)pt.x; + pointArray[pointCount++] = cast(int)pt.y; OS.memmove(pt, points + NSPoint.sizeof + NSPoint.sizeof, NSPoint.sizeof); - pointArray[pointCount++] = (int)pt.x; - pointArray[pointCount++] = (int)pt.y; + pointArray[pointCount++] = cast(int)pt.x; + pointArray[pointCount++] = cast(int)pt.y; break; case OS.NSClosePathBezierPathElement: types[typeCount++] = DWT.PATH_CLOSE; diff -r fb2555104d70 -r 5b53d338c709 dwt/graphics/Pattern.d --- a/dwt/graphics/Pattern.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/graphics/Pattern.d Fri Aug 29 22:04:22 2008 +0200 @@ -34,7 +34,7 @@ * * @since 3.1 */ -public class Pattern extends Resource { +public class Pattern : Resource { NSColor color; NSGradient gradient; NSPoint pt1, pt2; @@ -67,7 +67,7 @@ * * @see #dispose() */ -public Pattern(Device device, Image image) { +public this(Device device, Image image) { super(device); if (image is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); if (image.isDisposed()) DWT.error(DWT.ERROR_INVALID_ARGUMENT); @@ -109,7 +109,7 @@ * * @see #dispose() */ -public Pattern(Device device, float x1, float y1, float x2, float y2, Color color1, Color color2) { +public this(Device device, float x1, float y1, float x2, float y2, Color color1, Color color2) { this(device, x1, y1, x2, y2, color1, 0xFF, color2, 0xFF); } /** @@ -148,7 +148,7 @@ * * @since 3.2 */ -public Pattern(Device device, float x1, float y1, float x2, float y2, Color color1, int alpha1, Color color2, int alpha2) { +public this(Device device, float x1, float y1, float x2, float y2, Color color1, int alpha1, Color color2, int alpha2) { super(device); if (color1 is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); if (color1.isDisposed()) DWT.error(DWT.ERROR_INVALID_ARGUMENT); @@ -166,7 +166,7 @@ this.alpha2 = alpha2; NSColor start = NSColor.colorWithDeviceRed(color1.handle[0], color1.handle[1], color1.handle[2], alpha1 / 255f); NSColor end = NSColor.colorWithDeviceRed(color2.handle[0], color2.handle[1], color2.handle[2], alpha2 / 255f); - gradient = ((NSGradient)new NSGradient().alloc()).initWithStartingColor(start, end); + gradient = (cast(NSGradient)new NSGradient().alloc()).initWithStartingColor(start, end); init(); } diff -r fb2555104d70 -r 5b53d338c709 dwt/graphics/Point.d --- a/dwt/graphics/Point.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/graphics/Point.d Fri Aug 29 22:04:22 2008 +0200 @@ -38,7 +38,7 @@ * @see Rectangle */ -public final class Point implements SerializableCompatibility { +public final class Point : SerializableCompatibility { /** * the x coordinate of the point @@ -58,7 +58,7 @@ * @param x the x coordinate of the new point * @param y the y coordinate of the new point */ -public Point (int x, int y) { +public this (int x, int y) { this.x = x; this.y = y; } @@ -75,8 +75,8 @@ */ public bool equals (Object object) { if (object is this) return true; - if (!(object instanceof Point)) return false; - Point p = (Point)object; + if (!( null !is cast(Point)object )) return false; + Point p = cast(Point)object; return (p.x is this.x) && (p.y is this.y); } diff -r fb2555104d70 -r 5b53d338c709 dwt/graphics/RGB.d --- a/dwt/graphics/RGB.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/graphics/RGB.d Fri Aug 29 22:04:22 2008 +0200 @@ -38,7 +38,7 @@ * @see Color */ -public final class RGB implements SerializableCompatibility { +public final class RGB : SerializableCompatibility { /** * the red component of the RGB @@ -69,7 +69,7 @@ *
  • ERROR_INVALID_ARGUMENT - if the red, green or blue argument is not between 0 and 255
  • * */ -public RGB(int red, int green, int blue) { +public this(int red, int green, int blue) { if ((red > 255) || (red < 0) || (green > 255) || (green < 0) || (blue > 255) || (blue < 0)) @@ -94,7 +94,7 @@ * * @since 3.2 */ -public RGB(float hue, float saturation, float brightness) { +public this(float hue, float saturation, float brightness) { if (hue < 0 || hue > 360 || saturation < 0 || saturation > 1 || brightness < 0 || brightness > 1) { DWT.error(DWT.ERROR_INVALID_ARGUMENT); @@ -105,7 +105,7 @@ } else { if (hue is 360) hue = 0; hue /= 60; - int i = (int)hue; + int i = cast(int)hue; float f = hue - i; float p = brightness * (1 - saturation); float q = brightness * (1 - saturation * f); @@ -144,9 +144,9 @@ break; } } - red = (int)(r * 255 + 0.5); - green = (int)(g * 255 + 0.5); - blue = (int)(b * 255 + 0.5); + red = cast(int)(r * 255 + 0.5); + green = cast(int)(g * 255 + 0.5); + blue = cast(int)(b * 255 + 0.5); } /** @@ -194,8 +194,8 @@ */ public bool equals(Object object) { if (object is this) return true; - if (!(object instanceof RGB)) return false; - RGB rgb = (RGB)object; + if (!( null !is cast(RGB)object )) return false; + RGB rgb = cast(RGB)object; return (rgb.red is this.red) && (rgb.green is this.green) && (rgb.blue is this.blue); } diff -r fb2555104d70 -r 5b53d338c709 dwt/graphics/Rectangle.d --- a/dwt/graphics/Rectangle.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/graphics/Rectangle.d Fri Aug 29 22:04:22 2008 +0200 @@ -41,7 +41,7 @@ * @see Point */ -public final class Rectangle implements SerializableCompatibility { +public final class Rectangle : SerializableCompatibility { /** * the x coordinate of the rectangle @@ -74,7 +74,7 @@ * @param width the width of the rectangle * @param height the height of the rectangle */ -public Rectangle (int x, int y, int width, int height) { +public this (int x, int y, int width, int height) { this.x = x; this.y = y; this.width = width; @@ -152,8 +152,8 @@ */ public bool equals (Object object) { if (object is this) return true; - if (!(object instanceof Rectangle)) return false; - Rectangle r = (Rectangle)object; + if (!( null !is cast(Rectangle)object )) return false; + Rectangle r = cast(Rectangle)object; return (r.x is this.x) && (r.y is this.y) && (r.width is this.width) && (r.height is this.height); } diff -r fb2555104d70 -r 5b53d338c709 dwt/graphics/Region.d --- a/dwt/graphics/Region.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/graphics/Region.d Fri Aug 29 22:04:22 2008 +0200 @@ -33,7 +33,7 @@ * when those instances are no longer required. *

    */ -public final class Region extends Resource { +public final class Region : Resource { /** * the OS resource for the region * (Warning: This field is platform dependent) @@ -53,7 +53,7 @@ *
  • ERROR_NO_HANDLES if a handle could not be obtained for region creation
  • * */ -public Region() { +public this() { this(null); } @@ -76,14 +76,14 @@ * * @since 3.0 */ -public Region(Device device) { +public this(Device device) { super(device); handle = OS.NewRgn(); if (handle is 0) DWT.error(DWT.ERROR_NO_HANDLES); init(); } -Region(Device device, int handle) { +this(Device device, int handle) { super(device); this.handle = handle; } @@ -114,11 +114,11 @@ if (count <= 2) return; int polyRgn = OS.NewRgn(); OS.OpenRgn(); - OS.MoveTo((short)pointArray[0], (short)pointArray[1]); + OS.MoveTo(cast(short)pointArray[0], cast(short)pointArray[1]); for (int i = 1; i < count / 2; i++) { - OS.LineTo((short)pointArray[2 * i], (short)pointArray[2 * i + 1]); + OS.LineTo(cast(short)pointArray[2 * i], cast(short)pointArray[2 * i + 1]); } - OS.LineTo((short)pointArray[0], (short)pointArray[1]); + OS.LineTo(cast(short)pointArray[0], cast(short)pointArray[1]); OS.CloseRgn(polyRgn); OS.UnionRgn(handle, polyRgn, handle); OS.DisposeRgn(polyRgn); @@ -168,7 +168,7 @@ if (width < 0 || height < 0) DWT.error(DWT.ERROR_INVALID_ARGUMENT); int rectRgn = OS.NewRgn(); short[] r = new short[4]; - OS.SetRect(r, (short)x, (short)y, (short)(x + width),(short)(y + height)); + OS.SetRect(r, cast(short)x, cast(short)y, cast(short)(x + width),cast(short)(y + height)); OS.RectRgn(rectRgn, r); OS.UnionRgn(handle, rectRgn, handle); OS.DisposeRgn(rectRgn); @@ -211,7 +211,7 @@ */ public bool contains(int x, int y) { if (isDisposed()) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED); - short[] point = new short[]{(short)x, (short)y}; + short[] point = new short[]{cast(short)x, cast(short)y}; return OS.PtInRgn(point, handle); } @@ -260,19 +260,19 @@ point.y = rect[0]; point = transform.transformPoint(point); short startX, startY; - OS.MoveTo(startX = (short)point.x, startY = (short)point.y); + OS.MoveTo(startX = cast(short)point.x, startY = cast(short)point.y); point.x = rect[3]; point.y = rect[0]; point = transform.transformPoint(point); - OS.LineTo((short)Math.round(point.x), (short)point.y); + OS.LineTo(cast(short)Math.round(point.x), cast(short)point.y); point.x = rect[3]; point.y = rect[2]; point = transform.transformPoint(point); - OS.LineTo((short)Math.round(point.x), (short)Math.round(point.y)); + OS.LineTo(cast(short)Math.round(point.x), cast(short)Math.round(point.y)); point.x = rect[1]; point.y = rect[2]; point = transform.transformPoint(point); - OS.LineTo((short)point.x, (short)Math.round(point.y)); + OS.LineTo(cast(short)point.x, cast(short)Math.round(point.y)); OS.LineTo(startX, startY); OS.CloseRgn(polyRgn); OS.UnionRgn(newRgn, polyRgn, newRgn); @@ -298,8 +298,8 @@ */ public bool equals(Object object) { if (this is object) return true; - if (!(object instanceof Region)) return false; - Region region = (Region)object; + if (!( null !is cast(Region)object )) return false; + Region region = cast(Region)object; return handle is region.handle; } @@ -419,7 +419,7 @@ if (width < 0 || height < 0) DWT.error(DWT.ERROR_INVALID_ARGUMENT); int rectRgn = OS.NewRgn(); short[] r = new short[4]; - OS.SetRect(r, (short)x, (short)y, (short)(x + width),(short)(y + height)); + OS.SetRect(r, cast(short)x, cast(short)y, cast(short)(x + width),cast(short)(y + height)); OS.RectRgn(rectRgn, r); OS.SectRgn(handle, rectRgn, handle); OS.DisposeRgn(rectRgn); @@ -469,7 +469,7 @@ public bool intersects (int x, int y, int width, int height) { if (isDisposed()) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED); short[] r = new short[4]; - OS.SetRect(r, (short)x, (short)y, (short)(x + width),(short)(y + height)); + OS.SetRect(r, cast(short)x, cast(short)y, cast(short)(x + width),cast(short)(y + height)); return OS.RectInRgn(rect, handle); } @@ -546,11 +546,11 @@ if (pointArray.length < 2) return; int polyRgn = OS.NewRgn(); OS.OpenRgn(); - OS.MoveTo((short)pointArray[0], (short)pointArray[1]); + OS.MoveTo(cast(short)pointArray[0], cast(short)pointArray[1]); for (int i = 1; i < pointArray.length / 2; i++) { - OS.LineTo((short)pointArray[2 * i], (short)pointArray[2 * i + 1]); + OS.LineTo(cast(short)pointArray[2 * i], cast(short)pointArray[2 * i + 1]); } - OS.LineTo((short)pointArray[0], (short)pointArray[1]); + OS.LineTo(cast(short)pointArray[0], cast(short)pointArray[1]); OS.CloseRgn(polyRgn); OS.DiffRgn(handle, polyRgn, handle); OS.DisposeRgn(polyRgn); @@ -601,7 +601,7 @@ if (width < 0 || height < 0) DWT.error(DWT.ERROR_INVALID_ARGUMENT); int rectRgn = OS.NewRgn(); short[] r = new short[4]; - OS.SetRect(r, (short)x, (short)y, (short)(x + width),(short)(y + height)); + OS.SetRect(r, cast(short)x, cast(short)y, cast(short)(x + width),cast(short)(y + height)); OS.RectRgn(rectRgn, r); OS.DiffRgn(handle, rectRgn, handle); OS.DisposeRgn(rectRgn); @@ -646,7 +646,7 @@ */ public void translate (int x, int y) { if (isDisposed()) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED); - OS.OffsetRgn (handle, (short)x, (short)y); + OS.OffsetRgn (handle, cast(short)x, cast(short)y); } /** diff -r fb2555104d70 -r 5b53d338c709 dwt/graphics/Resource.d --- a/dwt/graphics/Resource.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/graphics/Resource.d Fri Aug 29 22:04:22 2008 +0200 @@ -43,10 +43,10 @@ */ Device device; -Resource() { +this() { } -Resource(Device device) { +this(Device device) { if (device is null) device = Device.getDevice(); if (device is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); this.device = device; diff -r fb2555104d70 -r 5b53d338c709 dwt/graphics/TextLayout.d --- a/dwt/graphics/TextLayout.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/graphics/TextLayout.d Fri Aug 29 22:04:22 2008 +0200 @@ -43,7 +43,7 @@ * * @since 3.0 */ -public final class TextLayout extends Resource { +public final class TextLayout : Resource { NSTextStorage textStorage; NSLayoutManager layoutManager; @@ -92,7 +92,7 @@ * * @see #dispose() */ -public TextLayout (Device device) { +public this (Device device) { super(device); wrapWidth = ascent = descent = -1; alignment = DWT.LEFT; @@ -111,10 +111,10 @@ void computeRuns() { if (textStorage !is null) return; NSString str = NSString.stringWith(text); - textStorage = ((NSTextStorage)new NSTextStorage().alloc()); + textStorage = (cast(NSTextStorage)new NSTextStorage().alloc()); textStorage.initWithString_(str); - layoutManager = (NSLayoutManager)new NSLayoutManager().alloc().init(); - textContainer = (NSTextContainer)new NSTextContainer().alloc(); + layoutManager = cast(NSLayoutManager)new NSLayoutManager().alloc().init(); + textContainer = cast(NSTextContainer)new NSTextContainer().alloc(); NSSize size = new NSSize(); size.width = wrapWidth !is -1 ? wrapWidth : Float.MAX_VALUE; size.height = Float.MAX_VALUE; @@ -128,7 +128,7 @@ range.length = str.length(); textStorage.addAttribute(OS.NSFontAttributeName(), defaultFont.handle, range); - NSMutableParagraphStyle paragraph = (NSMutableParagraphStyle)new NSMutableParagraphStyle().alloc().init(); + NSMutableParagraphStyle paragraph = cast(NSMutableParagraphStyle)new NSMutableParagraphStyle().alloc().init(); int align = OS.NSLeftTextAlignment; if (justify) { align = OS.NSJustifiedTextAlignment; @@ -423,7 +423,7 @@ rect.height = Math.max(rect.height, layoutManager.defaultLineHeightForFont(nsFont)); } rect.height = Math.max(rect.height, ascent + descent); - return new Rectangle(0, 0, (int)rect.width, (int)rect.height); + return new Rectangle(0, 0, cast(int)rect.width, cast(int)rect.height); } /** @@ -454,7 +454,7 @@ range.location = layoutManager.glyphIndexForCharacterAtIndex(start); range.length = layoutManager.glyphIndexForCharacterAtIndex(end + 1) - range.location; NSRect rect = layoutManager.boundingRectForGlyphRange(range, textContainer); - return new Rectangle((int)rect.x, (int)rect.y, (int)Math.ceil(rect.width), (int)Math.ceil(rect.height)); + return new Rectangle(cast(int)rect.x, cast(int)rect.y, cast(int)Math.ceil(rect.width), cast(int)Math.ceil(rect.height)); } /** @@ -615,7 +615,7 @@ computeRuns(); if (!(0 <= lineIndex && lineIndex < lineBounds.length)) DWT.error(DWT.ERROR_INVALID_RANGE); NSRect rect = lineBounds[lineIndex]; - return new Rectangle((int)rect.x, (int)rect.y, (int)rect.width, (int)rect.height); + return new Rectangle(cast(int)rect.x, cast(int)rect.y, cast(int)rect.width, cast(int)rect.height); } /** @@ -656,14 +656,14 @@ if (length is 0) { Font font = this.font !is null ? this.font : device.systemFont; NSFont nsFont = font.handle; - int ascent = (int)(0.5f + nsFont.ascender()); - int descent = (int)(0.5f + (-nsFont.descender() + nsFont.leading())); + int ascent = cast(int)(0.5f + nsFont.ascender()); + int descent = cast(int)(0.5f + (-nsFont.descender() + nsFont.leading())); ascent = Math.max(ascent, this.ascent); descent = Math.max(descent, this.descent); return FontMetrics.cocoa_new(ascent, descent, 0, 0, ascent + descent); } Rectangle rect = getLineBounds(lineIndex); - int baseline = (int)layoutManager.typesetter().baselineOffsetInLayoutManager(layoutManager, getLineOffsets()[lineIndex]); + int baseline = cast(int)layoutManager.typesetter().baselineOffsetInLayoutManager(layoutManager, getLineOffsets()[lineIndex]); return FontMetrics.cocoa_new(rect.height - baseline, baseline, 0, 0, rect.height); } @@ -700,7 +700,7 @@ NSRect bounds = layoutManager.boundingRectForGlyphRange(range, textContainer); point.x += bounds.width; } - return new Point((int)point.x, (int)rect.y); + return new Point(cast(int)point.x, cast(int)rect.y); } /** diff -r fb2555104d70 -r 5b53d338c709 dwt/graphics/TextStyle.d --- a/dwt/graphics/TextStyle.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/graphics/TextStyle.d Fri Aug 29 22:04:22 2008 +0200 @@ -143,7 +143,7 @@ * * @since 3.4 */ -public TextStyle () { +public this () { } /** @@ -154,7 +154,7 @@ * @param foreground the foreground color of the style, null if none * @param background the background color of the style, null if none */ -public TextStyle (Font font, Color foreground, Color background) { +public this (Font font, Color foreground, Color background) { if (font !is null && font.isDisposed()) DWT.error (DWT.ERROR_INVALID_ARGUMENT); if (foreground !is null && foreground.isDisposed()) DWT.error (DWT.ERROR_INVALID_ARGUMENT); if (background !is null && background.isDisposed()) DWT.error (DWT.ERROR_INVALID_ARGUMENT); @@ -171,7 +171,7 @@ * * @since 3.4 */ -public TextStyle (TextStyle style) { +public this (TextStyle style) { if (style is null) DWT.error (DWT.ERROR_INVALID_ARGUMENT); font = style.font; foreground = style.foreground; @@ -200,8 +200,8 @@ public bool equals(Object object) { if (object is this) return true; if (object is null) return false; - if (!(object instanceof TextStyle)) return false; - TextStyle style = (TextStyle)object; + if (!( null !is cast(TextStyle)object )) return false; + TextStyle style = cast(TextStyle)object; if (foreground !is null) { if (!foreground.equals(style.foreground)) return false; } else if (style.foreground !is null) return false; diff -r fb2555104d70 -r 5b53d338c709 dwt/graphics/Transform.d --- a/dwt/graphics/Transform.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/graphics/Transform.d Fri Aug 29 22:04:22 2008 +0200 @@ -34,7 +34,7 @@ * * @since 3.1 */ -public class Transform extends Resource { +public class Transform : Resource { /** * the OS resource for the Transform * (Warning: This field is platform dependent) @@ -69,7 +69,7 @@ * * @see #dispose() */ -public Transform (Device device) { +public this (Device device) { this(device, 1, 0, 0, 1, 0, 0); } @@ -98,7 +98,7 @@ * * @see #dispose() */ -public Transform(Device device, float[] elements) { +public this(Device device, float[] elements) { this (device, checkTransform(elements)[0], elements[1], elements[2], elements[3], elements[4], elements[5]); } @@ -131,7 +131,7 @@ * * @see #dispose() */ -public Transform (Device device, float m11, float m12, float m21, float m22, float dx, float dy) { +public this (Device device, float m11, float m12, float m21, float m22, float dx, float dy) { super(device); handle = NSAffineTransform.transform(); if (handle is null) DWT.error(DWT.ERROR_NO_HANDLES); diff -r fb2555104d70 -r 5b53d338c709 dwt/internal/Library.d diff -r fb2555104d70 -r 5b53d338c709 dwt/internal/c/callback.d diff -r fb2555104d70 -r 5b53d338c709 dwt/internal/c/qd/bindings.d diff -r fb2555104d70 -r 5b53d338c709 dwt/internal/cocoa/CGBase.d diff -r fb2555104d70 -r 5b53d338c709 dwt/internal/cocoa/CGFloat.d diff -r fb2555104d70 -r 5b53d338c709 dwt/internal/cocoa/MacGenerator.d diff -r fb2555104d70 -r 5b53d338c709 dwt/internal/cocoa/NSInteger.d diff -r fb2555104d70 -r 5b53d338c709 dwt/internal/cocoa/OS.d diff -r fb2555104d70 -r 5b53d338c709 dwt/internal/cocoa/WebDataSource.d diff -r fb2555104d70 -r 5b53d338c709 dwt/internal/cocoa/WebDocumentRepresentation.d diff -r fb2555104d70 -r 5b53d338c709 dwt/internal/cocoa/WebFrame.d diff -r fb2555104d70 -r 5b53d338c709 dwt/internal/cocoa/WebFrameView.d diff -r fb2555104d70 -r 5b53d338c709 dwt/internal/cocoa/WebOpenPanelResultListener.d diff -r fb2555104d70 -r 5b53d338c709 dwt/internal/cocoa/WebPolicyDecisionListener.d diff -r fb2555104d70 -r 5b53d338c709 dwt/internal/cocoa/WebPreferences.d diff -r fb2555104d70 -r 5b53d338c709 dwt/internal/cocoa/WebView.d diff -r fb2555104d70 -r 5b53d338c709 dwt/internal/image/FileFormat.d --- a/dwt/internal/image/FileFormat.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/internal/image/FileFormat.d Fri Aug 29 22:04:22 2008 +0200 @@ -51,7 +51,7 @@ inputStream = stream; return loadFromByteStream(); } catch (Exception e) { - if (e instanceof IOException) { + if ( null !is cast(IOException)e ) { DWT.error(DWT.ERROR_IO, e); } else { DWT.error(DWT.ERROR_INVALID_IMAGE, e); @@ -72,7 +72,7 @@ if (FORMATS[i] !is null) { try { Class clazz = Class.forName(FORMAT_PACKAGE + '.' + FORMATS[i] + FORMAT_SUFFIX); - fileFormat = (FileFormat) clazz.newInstance(); + fileFormat = cast(FileFormat) clazz.newInstance(); if (fileFormat.isFileFormat(stream)) { isSupported = true; break; @@ -101,7 +101,7 @@ FileFormat fileFormat = null; try { Class clazz = Class.forName(FORMAT_PACKAGE + '.' + FORMATS[format] + FORMAT_SUFFIX); - fileFormat = (FileFormat) clazz.newInstance(); + fileFormat = cast(FileFormat) clazz.newInstance(); } catch (Exception e) { DWT.error(DWT.ERROR_UNSUPPORTED_FORMAT); } diff -r fb2555104d70 -r 5b53d338c709 dwt/internal/image/GIFFileFormat.d --- a/dwt/internal/image/GIFFileFormat.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/internal/image/GIFFileFormat.d Fri Aug 29 22:04:22 2008 +0200 @@ -35,8 +35,8 @@ static final int GIF_EXTENSION_BLOCK_ID = 0x21; static final int GIF_IMAGE_BLOCK_ID = 0x2C; static final int GIF_TRAILER_ID = 0x3B; - static final byte [] GIF89a = new byte[] { (byte)'G', (byte)'I', (byte)'F', (byte)'8', (byte)'9', (byte)'a' }; - static final byte [] NETSCAPE2_0 = new byte[] { (byte)'N', (byte)'E', (byte)'T', (byte)'S', (byte)'C', (byte)'A', (byte)'P', (byte)'E', (byte)'2', (byte)'.', (byte)'0' }; + static final byte [] GIF89a = new byte[] { cast(byte)'G', cast(byte)'I', cast(byte)'F', cast(byte)'8', cast(byte)'9', cast(byte)'a' }; + static final byte [] NETSCAPE2_0 = new byte[] { cast(byte)'N', cast(byte)'E', cast(byte)'T', cast(byte)'S', cast(byte)'C', cast(byte)'A', cast(byte)'P', cast(byte)'E', cast(byte)'2', cast(byte)'.', cast(byte)'0' }; /** * Answer a palette containing numGrays @@ -46,7 +46,7 @@ int n = numGrays - 1; RGB[] colors = new RGB[numGrays]; for (int i = 0; i < numGrays; i++) { - int intensity = (byte)((i * 3) * 256 / n); + int intensity = cast(byte)((i * 3) * 256 / n); colors[i] = new RGB(intensity, intensity, intensity); } return new PaletteData(colors); @@ -121,7 +121,7 @@ id = inputStream.read(); if (id > 0) { /* We read the terminator earlier. */ - inputStream.unread(new byte[] {(byte)id}); + inputStream.unread(new byte[] {cast(byte)id}); } } catch (IOException e) { DWT.error(DWT.ERROR_IO, e); @@ -164,7 +164,7 @@ } if (id is GIF_IMAGE_BLOCK_ID || id is GIF_TRAILER_ID) { try { - inputStream.unread(new byte[] {(byte)id}); + inputStream.unread(new byte[] {cast(byte)id}); } catch (IOException e) { DWT.error(DWT.ERROR_IO, e); } @@ -483,8 +483,8 @@ /* Step 3: Write the GIF89a Header and Logical Screen Descriptor. */ outputStream.write(GIF89a); int bitField = globalTable*128 + (depth-1)*16 + depth-1; - outputStream.writeShort((short)logicalScreenWidth); - outputStream.writeShort((short)logicalScreenHeight); + outputStream.writeShort(cast(short)logicalScreenWidth); + outputStream.writeShort(cast(short)logicalScreenHeight); outputStream.write(bitField); outputStream.write(backgroundPixel); outputStream.write(0); // Aspect ratio is 1:1 @@ -507,7 +507,7 @@ outputStream.write(NETSCAPE2_0); outputStream.write(3); // Three bytes follow outputStream.write(1); // Extension type - outputStream.writeShort((short) repeatCount); + outputStream.writeShort(cast(short) repeatCount); outputStream.write(0); // Block terminator } catch (IOException e) { DWT.error(DWT.ERROR_IO, e); @@ -529,15 +529,15 @@ try { outputStream.write(GIF_IMAGE_BLOCK_ID); byte[] block = new byte[9]; - block[0] = (byte)(x & 0xFF); - block[1] = (byte)((x >> 8) & 0xFF); - block[2] = (byte)(y & 0xFF); - block[3] = (byte)((y >> 8) & 0xFF); - block[4] = (byte)(width & 0xFF); - block[5] = (byte)((width >> 8) & 0xFF); - block[6] = (byte)(height & 0xFF); - block[7] = (byte)((height >> 8) & 0xFF); - block[8] = (byte)(globalTable is 0 ? (depth-1) | 0x80 : 0x00); + block[0] = cast(byte)(x & 0xFF); + block[1] = cast(byte)((x >> 8) & 0xFF); + block[2] = cast(byte)(y & 0xFF); + block[3] = cast(byte)((y >> 8) & 0xFF); + block[4] = cast(byte)(width & 0xFF); + block[5] = cast(byte)((width >> 8) & 0xFF); + block[6] = cast(byte)(height & 0xFF); + block[7] = cast(byte)((height >> 8) & 0xFF); + block[8] = cast(byte)(globalTable is 0 ? (depth-1) | 0x80 : 0x00); outputStream.write(block); } catch (IOException e) { DWT.error(DWT.ERROR_IO, e); @@ -579,17 +579,17 @@ gcBlock[2] = 0; gcBlock[3] = 0; if (image.transparentPixel !is -1) { - gcBlock[0] = (byte)0x01; - gcBlock[3] = (byte)image.transparentPixel; + gcBlock[0] = cast(byte)0x01; + gcBlock[3] = cast(byte)image.transparentPixel; } if (image.disposalMethod !is 0) { - gcBlock[0] |= (byte)((image.disposalMethod & 0x07) << 2); + gcBlock[0] |= cast(byte)((image.disposalMethod & 0x07) << 2); } if (image.delayTime !is 0) { - gcBlock[1] = (byte)(image.delayTime & 0xFF); - gcBlock[2] = (byte)((image.delayTime >> 8) & 0xFF); + gcBlock[1] = cast(byte)(image.delayTime & 0xFF); + gcBlock[2] = cast(byte)((image.delayTime >> 8) & 0xFF); } - outputStream.write((byte)gcBlock.length); + outputStream.write(cast(byte)gcBlock.length); outputStream.write(gcBlock); outputStream.write(0); // Block terminator } catch (IOException e) { @@ -605,9 +605,9 @@ int offset = 0; for (int i = 0; i < palette.colors.length; i++) { RGB color = palette.colors[i]; - bytes[offset] = (byte)color.red; - bytes[offset + 1] = (byte)color.green; - bytes[offset + 2] = (byte)color.blue; + bytes[offset] = cast(byte)color.red; + bytes[offset + 1] = cast(byte)color.green; + bytes[offset + 2] = cast(byte)color.blue; offset += 3; } try { diff -r fb2555104d70 -r 5b53d338c709 dwt/internal/image/JPEGAppn.d --- a/dwt/internal/image/JPEGAppn.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/internal/image/JPEGAppn.d Fri Aug 29 22:04:22 2008 +0200 @@ -13,11 +13,11 @@ final class JPEGAppn : JPEGVariableSizeSegment { - public JPEGAppn(byte[] reference) { + public this(byte[] reference) { super(reference); } - public JPEGAppn(LEDataInputStream byteStream) { + public this(LEDataInputStream byteStream) { super(byteStream); } diff -r fb2555104d70 -r 5b53d338c709 dwt/internal/image/JPEGArithmeticConditioningTable.d --- a/dwt/internal/image/JPEGArithmeticConditioningTable.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/internal/image/JPEGArithmeticConditioningTable.d Fri Aug 29 22:04:22 2008 +0200 @@ -13,7 +13,7 @@ final class JPEGArithmeticConditioningTable : JPEGVariableSizeSegment { - public JPEGArithmeticConditioningTable(LEDataInputStream byteStream) { + public this(LEDataInputStream byteStream) { super(byteStream); } diff -r fb2555104d70 -r 5b53d338c709 dwt/internal/image/JPEGComment.d --- a/dwt/internal/image/JPEGComment.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/internal/image/JPEGComment.d Fri Aug 29 22:04:22 2008 +0200 @@ -13,11 +13,11 @@ final class JPEGComment : JPEGVariableSizeSegment { - public JPEGComment(byte[] reference) { + public this(byte[] reference) { super(reference); } - public JPEGComment(LEDataInputStream byteStream) { + public this(LEDataInputStream byteStream) { super(byteStream); } diff -r fb2555104d70 -r 5b53d338c709 dwt/internal/image/JPEGDecoder.d --- a/dwt/internal/image/JPEGDecoder.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/internal/image/JPEGDecoder.d Fri Aug 29 22:04:22 2008 +0200 @@ -466,7 +466,7 @@ } // look = PEEK_BITS(HUFF_LOOKAHEAD); if (nb !is 1) { - look = (( (get_buffer >> (bits_left - (HUFF_LOOKAHEAD)))) & ((1<<(HUFF_LOOKAHEAD))-1)); + look = (( (get_buffer >> (bits_left - cast(HUFF_LOOKAHEAD)))) & ((1<> (bits_left - (HUFF_LOOKAHEAD)))) & ((1<<(HUFF_LOOKAHEAD))-1)); + look = (( (get_buffer >> (bits_left - cast(HUFF_LOOKAHEAD)))) & ((1<> (bits_left - (HUFF_LOOKAHEAD)))) & ((1<<(HUFF_LOOKAHEAD))-1)); + look = (( (get_buffer >> (bits_left - cast(HUFF_LOOKAHEAD)))) & ((1<> (bits_left - (HUFF_LOOKAHEAD)))) & ((1<<(HUFF_LOOKAHEAD))-1)); + look = (( (get_buffer >> (bits_left - cast(HUFF_LOOKAHEAD)))) & ((1<> (bits_left - (HUFF_LOOKAHEAD)))) & ((1<<(HUFF_LOOKAHEAD))-1)); + look = (( (get_buffer >> (bits_left - cast(HUFF_LOOKAHEAD)))) & ((1<> (bits_left - (HUFF_LOOKAHEAD)))) & ((1<<(HUFF_LOOKAHEAD))-1)); + look = (( (get_buffer >> (bits_left - cast(HUFF_LOOKAHEAD)))) & ((1<R value is nearest int to 1.40200 * x */ - cconvert.Cr_r_tab[i] = ((int)(1.40200f * (1<> SCALEBITS; + cconvert.Cr_r_tab[i] = (cast(int)(1.40200f * (1<> SCALEBITS; /* Cb=>B value is nearest int to 1.77200 * x */ - cconvert.Cb_b_tab[i] = ((int)(1.77200f * (1<> SCALEBITS; + cconvert.Cb_b_tab[i] = (cast(int)(1.77200f * (1<> SCALEBITS; /* Cr=>G value is scaled-up -0.71414 * x */ - cconvert.Cr_g_tab[i] = ((int)(- (0.71414f * (1<G value is scaled-up -0.34414 * x */ /* We also add in ONE_HALF so that need not do it in inner loop */ - cconvert.Cb_g_tab[i] = ((int)(- (0.34414f* (1<= cinfo.progress.pass_limit) { // /* jdmaster underestimated number of scans; ratchet up one scan */ -// cinfo.progress.pass_limit += (long) cinfo.total_iMCU_rows; +// cinfo.progress.pass_limit += cast(long) cinfo.total_iMCU_rows; // } // } } @@ -3960,7 +3960,7 @@ pred = (1<= 2) { @@ -4564,10 +4564,10 @@ // ERREXIT1(cinfo, JERR_DAC_INDEX, index); if (index >= NUM_ARITH_TBLS) { /* define AC table */ - cinfo.arith_ac_K[index-NUM_ARITH_TBLS] = (byte) val; + cinfo.arith_ac_K[index-NUM_ARITH_TBLS] = cast(byte) val; } else { /* define DC table */ - cinfo.arith_dc_L[index] = (byte) (val & 0x0F); - cinfo.arith_dc_U[index] = (byte) (val >> 4); + cinfo.arith_dc_L[index] = cast(byte) (val & 0x0F); + cinfo.arith_dc_U[index] = cast(byte) (val >> 4); if (cinfo.arith_dc_L[index] > cinfo.arith_dc_U[index]) error(); // ERREXIT1(cinfo, JERR_DAC_VALUE, val); @@ -4688,7 +4688,7 @@ length -= 8; // TRACEMS4(cinfo, 1, JTRC_SOF, cinfo.unread_marker, -// (int) cinfo.image_width, (int) cinfo.image_height, +// cast(int) cinfo.image_width, cast(int) cinfo.image_height, // cinfo.num_components); if (cinfo.marker.saw_SOF) @@ -4872,20 +4872,20 @@ int inptr_offset = 0, outptr_offset = 0; /* Special case for first column */ invalue = inptr[inptr_offset++] & 0xFF; - outptr[outptr_offset++] = (byte) invalue; - outptr[outptr_offset++] = (byte) ((invalue * 3 + (inptr[inptr_offset] & 0xFF) + 2) >> 2); + outptr[outptr_offset++] = cast(byte) invalue; + outptr[outptr_offset++] = cast(byte) ((invalue * 3 + (inptr[inptr_offset] & 0xFF) + 2) >> 2); for (colctr = compptr.downsampled_width - 2; colctr > 0; colctr--) { /* General case: 3/4 * nearer pixel + 1/4 * further pixel */ invalue = (inptr[inptr_offset++] & 0xFF) * 3; - outptr[outptr_offset++] = (byte) ((invalue + (inptr[inptr_offset-2] & 0xFF) + 1) >> 2); - outptr[outptr_offset++] = (byte) ((invalue + (inptr[inptr_offset] & 0xFF) + 2) >> 2); + outptr[outptr_offset++] = cast(byte) ((invalue + (inptr[inptr_offset-2] & 0xFF) + 1) >> 2); + outptr[outptr_offset++] = cast(byte) ((invalue + (inptr[inptr_offset] & 0xFF) + 2) >> 2); } /* Special case for last column */ invalue = (inptr[inptr_offset] & 0xFF); - outptr[outptr_offset++] = (byte) ((invalue * 3 + (inptr[inptr_offset-1] & 0xFF) + 1) >> 2); - outptr[outptr_offset++] = (byte) invalue; + outptr[outptr_offset++] = cast(byte) ((invalue * 3 + (inptr[inptr_offset-1] & 0xFF) + 1) >> 2); + outptr[outptr_offset++] = cast(byte) invalue; } } @@ -4915,22 +4915,22 @@ /* Special case for first column */ thiscolsum = (inptr0[inptr0_offset++] & 0xFF) * 3 + (inptr1[inptr1_offset++] & 0xFF); nextcolsum = (inptr0[inptr0_offset++] & 0xFF) * 3 + (inptr1[inptr1_offset++] & 0xFF); - outptr[outptr_offset++] = (byte) ((thiscolsum * 4 + 8) >> 4); - outptr[outptr_offset++] = (byte) ((thiscolsum * 3 + nextcolsum + 7) >> 4); + outptr[outptr_offset++] = cast(byte) ((thiscolsum * 4 + 8) >> 4); + outptr[outptr_offset++] = cast(byte) ((thiscolsum * 3 + nextcolsum + 7) >> 4); lastcolsum = thiscolsum; thiscolsum = nextcolsum; for (colctr = compptr.downsampled_width - 2; colctr > 0; colctr--) { /* General case: 3/4 * nearer pixel + 1/4 * further pixel in each */ /* dimension, thus 9/16, 3/16, 3/16, 1/16 overall */ nextcolsum = (inptr0[inptr0_offset++] & 0xFF) * 3 + (inptr1[inptr1_offset++] & 0xFF); - outptr[outptr_offset++] = (byte) ((thiscolsum * 3 + lastcolsum + 8) >> 4); - outptr[outptr_offset++] = (byte) ((thiscolsum * 3 + nextcolsum + 7) >> 4); + outptr[outptr_offset++] = cast(byte) ((thiscolsum * 3 + lastcolsum + 8) >> 4); + outptr[outptr_offset++] = cast(byte) ((thiscolsum * 3 + nextcolsum + 7) >> 4); lastcolsum = thiscolsum; thiscolsum = nextcolsum; } /* Special case for last column */ - outptr[outptr_offset++] = (byte) ((thiscolsum * 3 + lastcolsum + 8) >> 4); - outptr[outptr_offset++] = (byte) ((thiscolsum * 4 + 7) >> 4); + outptr[outptr_offset++] = cast(byte) ((thiscolsum * 3 + lastcolsum + 8) >> 4); + outptr[outptr_offset++] = cast(byte) ((thiscolsum * 4 + 7) >> 4); } inrow++; } @@ -5110,7 +5110,7 @@ length -= 2; -// TRACEMS2(cinfo, 1, JTRC_MISC_MARKER, cinfo.unread_marker, (int) length); +// TRACEMS2(cinfo, 1, JTRC_MISC_MARKER, cinfo.unread_marker, cast(int) length); if (length > 0) { skip_input_data (cinfo, length); @@ -5185,10 +5185,10 @@ /* Found JFIF APP0 marker: save info */ cinfo.saw_JFIF_marker = true; cinfo.JFIF_major_version = (data[5]); - cinfo.JFIF_minor_version = (byte)(data[6] & 0xFF); - cinfo.density_unit = (byte)(data[7] & 0xFF); - cinfo.X_density = (short)(((data[8] & 0xFF) << 8) + (data[9] & 0xFF)); - cinfo.Y_density = (short)(((data[10] & 0xFF) << 8) + (data[11] & 0xFF)); + cinfo.JFIF_minor_version = cast(byte)(data[6] & 0xFF); + cinfo.density_unit = cast(byte)(data[7] & 0xFF); + cinfo.X_density = cast(short)(((data[8] & 0xFF) << 8) + (data[9] & 0xFF)); + cinfo.Y_density = cast(short)(((data[10] & 0xFF) << 8) + (data[11] & 0xFF)); /* Check version. * Major version must be 1, anything else signals an incompatible change. * (We used to treat this as an error, but now it's a nonfatal warning, @@ -5210,7 +5210,7 @@ } totallen -= APP0_DATA_LEN; if (totallen != ((data[12] & 0xFF) * (data[13] & 0xFF) * 3)) { -// TRACEMS1(cinfo, 1, JTRC_JFIF_BADTHUMBNAILSIZE, (int) totallen); +// TRACEMS1(cinfo, 1, JTRC_JFIF_BADTHUMBNAILSIZE, cast(int) totallen); } } else if (datalen >= 6 && (data[0] & 0xFF) is 0x4A && @@ -5225,21 +5225,21 @@ */ switch ((data[5]) & 0xFF) { case 0x10: -// TRACEMS1(cinfo, 1, JTRC_THUMB_JPEG, (int) totallen); +// TRACEMS1(cinfo, 1, JTRC_THUMB_JPEG, cast(int) totallen); break; case 0x11: -// TRACEMS1(cinfo, 1, JTRC_THUMB_PALETTE, (int) totallen); +// TRACEMS1(cinfo, 1, JTRC_THUMB_PALETTE, cast(int) totallen); break; case 0x13: -// TRACEMS1(cinfo, 1, JTRC_THUMB_RGB, (int) totallen); +// TRACEMS1(cinfo, 1, JTRC_THUMB_RGB, cast(int) totallen); break; default: -// TRACEMS2(cinfo, 1, JTRC_JFIF_EXTENSION, GETJOCTET(data[5]), (int) totallen); +// TRACEMS2(cinfo, 1, JTRC_JFIF_EXTENSION, GETJOCTET(data[5]), cast(int) totallen); break; } } else { /* Start of APP0 does not match "JFIF" or "JFXX", or too short */ -// TRACEMS1(cinfo, 1, JTRC_APP0, (int) totallen); +// TRACEMS1(cinfo, 1, JTRC_APP0, cast(int) totallen); } } @@ -5265,10 +5265,10 @@ transform = (data[11] & 0xFF); // TRACEMS4(cinfo, 1, JTRC_ADOBE, version, flags0, flags1, transform); cinfo.saw_Adobe_marker = true; - cinfo.Adobe_transform = (byte) transform; + cinfo.Adobe_transform = cast(byte) transform; } else { /* Start of APP14 does not match "Adobe", or too short */ -// TRACEMS1(cinfo, 1, JTRC_APP14, (int) (datalen + remaining)); +// TRACEMS1(cinfo, 1, JTRC_APP14, cast(int) (datalen + remaining)); } } @@ -5558,8 +5558,8 @@ // ERREXIT(cinfo, JERR_INPUT_EMPTY); // WARNMS(cinfo, JWRN_JPEG_EOF); /* Insert a fake EOI marker */ - cinfo.buffer[0] = (byte)0xFF; - cinfo.buffer[1] = (byte)M_EOI; + cinfo.buffer[0] = cast(byte)0xFF; + cinfo.buffer[1] = cast(byte)M_EOI; nbytes = 2; } cinfo.bytes_in_buffer = nbytes; @@ -5835,15 +5835,15 @@ compptr = cinfo.comp_info[ci]; compptr.DCT_scaled_size = DCTSIZE; /* Size in DCT blocks */ - compptr.width_in_blocks = (int)jdiv_round_up((long) cinfo.image_width * (long) compptr.h_samp_factor, (cinfo.max_h_samp_factor * DCTSIZE)); - compptr.height_in_blocks = (int)jdiv_round_up((long) cinfo.image_height * (long) compptr.v_samp_factor, (cinfo.max_v_samp_factor * DCTSIZE)); + compptr.width_in_blocks = cast(int)jdiv_round_up(cast(long) cinfo.image_width * cast(long) compptr.h_samp_factor, (cinfo.max_h_samp_factor * DCTSIZE)); + compptr.height_in_blocks = cast(int)jdiv_round_up(cast(long) cinfo.image_height * cast(long) compptr.v_samp_factor, (cinfo.max_v_samp_factor * DCTSIZE)); /* downsampled_width and downsampled_height will also be overridden by * jdmaster.c if we are doing full decompression. The transcoder library * doesn't use these values, but the calling application might. */ /* Size in samples */ - compptr.downsampled_width = (int)jdiv_round_up((long) cinfo.image_width * (long) compptr.h_samp_factor, cinfo.max_h_samp_factor); - compptr.downsampled_height = (int)jdiv_round_up((long) cinfo.image_height * (long) compptr.v_samp_factor, cinfo.max_v_samp_factor); + compptr.downsampled_width = cast(int)jdiv_round_up(cast(long) cinfo.image_width * cast(long) compptr.h_samp_factor, cinfo.max_h_samp_factor); + compptr.downsampled_height = cast(int)jdiv_round_up(cast(long) cinfo.image_height * cast(long) compptr.v_samp_factor, cinfo.max_v_samp_factor); /* Mark component needed, until color conversion says otherwise */ compptr.component_needed = true; /* Mark no quantization table yet saved for component */ @@ -5851,7 +5851,7 @@ } /* Compute number of fully interleaved MCU rows. */ - cinfo.total_iMCU_rows = (int)jdiv_round_up( cinfo.image_height, (cinfo.max_v_samp_factor*DCTSIZE)); + cinfo.total_iMCU_rows = cast(int)jdiv_round_up( cinfo.image_height, (cinfo.max_v_samp_factor*DCTSIZE)); /* Decide whether file contains multiple scans */ if (cinfo.comps_in_scan < cinfo.num_components || cinfo.progressive_mode) @@ -5902,8 +5902,8 @@ // ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo.comps_in_scan, MAX_COMPS_IN_SCAN); /* Overall image size in MCUs */ - cinfo.MCUs_per_row = (int)jdiv_round_up( cinfo.image_width, (cinfo.max_h_samp_factor*DCTSIZE)); - cinfo.MCU_rows_in_scan = (int)jdiv_round_up( cinfo.image_height, (cinfo.max_v_samp_factor*DCTSIZE)); + cinfo.MCUs_per_row = cast(int)jdiv_round_up( cinfo.image_width, (cinfo.max_h_samp_factor*DCTSIZE)); + cinfo.MCU_rows_in_scan = cast(int)jdiv_round_up( cinfo.image_height, (cinfo.max_v_samp_factor*DCTSIZE)); cinfo.blocks_in_MCU = 0; @@ -5990,7 +5990,7 @@ error(); // ERREXIT(cinfo, JERR_BAD_HUFF_TABLE); while (i-- !is 0) - huffsize[p++] = (byte) l; + huffsize[p++] = cast(byte) l; } huffsize[p] = 0; numsymbols = p; @@ -6348,7 +6348,7 @@ System.arraycopy(buffer[0], 0, data, offset, row_stride); } jpeg_finish_output(cinfo); - loader.notifyListeners(new ImageLoaderEvent(loader, (ImageData)imageData.clone(), incrementCount, done = jpeg_input_complete(cinfo))); + loader.notifyListeners(new ImageLoaderEvent(loader, cast(ImageData)imageData.clone(), incrementCount, done = jpeg_input_complete(cinfo))); } while (!done); } else { while (cinfo.output_scanline < cinfo.output_height) { diff -r fb2555104d70 -r 5b53d338c709 dwt/internal/image/JPEGEndOfImage.d --- a/dwt/internal/image/JPEGEndOfImage.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/internal/image/JPEGEndOfImage.d Fri Aug 29 22:04:22 2008 +0200 @@ -13,11 +13,11 @@ final class JPEGEndOfImage : JPEGFixedSizeSegment { - public JPEGEndOfImage() { + public this() { super(); } - public JPEGEndOfImage(byte[] reference) { + public this(byte[] reference) { super(reference); } diff -r fb2555104d70 -r 5b53d338c709 dwt/internal/image/JPEGFileFormat.d --- a/dwt/internal/image/JPEGFileFormat.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/internal/image/JPEGFileFormat.d Fri Aug 29 22:04:22 2008 +0200 @@ -242,7 +242,7 @@ sum += dataCbComp[srcIndex + ih] & 0xFF; } } - imageComponents[ID_CB][destRowIndex + xPos] = (byte)(sum / vhFactor); + imageComponents[ID_CB][destRowIndex + xPos] = cast(byte)(sum / vhFactor); } } frameComponent = frameComponents[componentIds[ID_CR]]; @@ -256,7 +256,7 @@ sum += dataCrComp[srcIndex + ih] & 0xFF; } } - imageComponents[ID_CR][destRowIndex + xPos] = (byte)(sum / vhFactor); + imageComponents[ID_CR][destRowIndex + xPos] = cast(byte)(sum / vhFactor); } } for (int iComp = 0; iComp < nComponents; iComp++) { @@ -274,7 +274,7 @@ int dstOfs = ((yPos + 1) * componentWidth - delta); int dataValue = imageComponent[(dstOfs > 0) ? dstOfs - 1 : 0] & 0xFF; for (int i = 0; i < delta; i++) { - imageComponent[dstOfs + i] = (byte)dataValue; + imageComponent[dstOfs + i] = cast(byte)dataValue; } } } @@ -301,13 +301,13 @@ int g = color.green; int b = color.blue; int n = RYTable[r] + GYTable[g] + BYTable[b]; - yComp[i] = (byte)(n >> 16); + yComp[i] = cast(byte)(n >> 16); if ((n < 0) && ((n & 0xFFFF) !is 0)) yComp[i]--; n = RCbTable[r] + GCbTable[g] + BCbTable[b]; - cbComp[i] = (byte)(n >> 16); + cbComp[i] = cast(byte)(n >> 16); if ((n < 0) && ((n & 0xFFFF) !is 0)) cbComp[i]--; n = RCrTable[r] + GCrTable[g] + BCrTable[b]; - crComp[i] = (byte)(n >> 16); + crComp[i] = cast(byte)(n >> 16); if ((n < 0) && ((n & 0xFFFF) !is 0)) crComp[i]--; } int bSize = srcWidth * srcHeight; @@ -348,13 +348,13 @@ int g = color.green; int b = color.blue; int n = RYTable[r] + GYTable[g] + BYTable[b]; - yComp[i] = (byte)(n >> 16); + yComp[i] = cast(byte)(n >> 16); if ((n < 0) && ((n & 0xFFFF) !is 0)) yComp[i]--; n = RCbTable[r] + GCbTable[g] + BCbTable[b]; - cbComp[i] = (byte)(n >> 16); + cbComp[i] = cast(byte)(n >> 16); if ((n < 0) && ((n & 0xFFFF) !is 0)) cbComp[i]--; n = RCrTable[r] + GCrTable[g] + BCrTable[b]; - crComp[i] = (byte)(n >> 16); + crComp[i] = cast(byte)(n >> 16); if ((n < 0) && ((n & 0xFFFF) !is 0)) crComp[i]--; } int dstWidth = image.width; @@ -428,9 +428,9 @@ g = (greenShift < 0) ? g >>> -greenShift : g << greenShift; int b = pixel & blueMask; b = (blueShift < 0) ? b >>> -blueShift : b << blueShift; - dataYComp[dstDataIndex] = (byte)((RYTable[r] + GYTable[g] + BYTable[b]) >> 16); - dataCbComp[dstDataIndex] = (byte)((RCbTable[r] + GCbTable[g] + BCbTable[b]) >> 16); - dataCrComp[dstDataIndex] = (byte)((RCrTable[r] + GCrTable[g] + BCrTable[b]) >> 16); + dataYComp[dstDataIndex] = cast(byte)((RYTable[r] + GYTable[g] + BYTable[b]) >> 16); + dataCbComp[dstDataIndex] = cast(byte)((RCbTable[r] + GCbTable[g] + BCbTable[b]) >> 16); + dataCrComp[dstDataIndex] = cast(byte)((RCrTable[r] + GCrTable[g] + BCrTable[b]) >> 16); } } } else { @@ -444,9 +444,9 @@ int r = rgb.red; int g = rgb.green; int b = rgb.blue; - dataYComp[dstDataIndex] = (byte)((RYTable[r] + GYTable[g] + BYTable[b]) >> 16); - dataCbComp[dstDataIndex] = (byte)((RCbTable[r] + GCbTable[g] + BCbTable[b]) >> 16); - dataCrComp[dstDataIndex] = (byte)((RCrTable[r] + GCrTable[g] + BCrTable[b]) >> 16); + dataYComp[dstDataIndex] = cast(byte)((RYTable[r] + GYTable[g] + BYTable[b]) >> 16); + dataCbComp[dstDataIndex] = cast(byte)((RCbTable[r] + GCbTable[g] + BCbTable[b]) >> 16); + dataCrComp[dstDataIndex] = cast(byte)((RCrTable[r] + GCrTable[g] + BCrTable[b]) >> 16); } } } @@ -470,7 +470,7 @@ if (j >= imageWidth) { y = 0; } - data[destIndex] = (byte)y; + data[destIndex] = cast(byte)y; srcIndex++; destIndex++; } @@ -537,9 +537,9 @@ } else { if (b > 255) b = 255; } - rgbData[destIndex] = (byte)b; - rgbData[destIndex + 1] = (byte)g; - rgbData[destIndex + 2] = (byte)r; + rgbData[destIndex] = cast(byte)b; + rgbData[destIndex + 1] = cast(byte)g; + rgbData[destIndex + 2] = cast(byte)r; destIndex += 3; srcIndex++; } @@ -830,15 +830,15 @@ }; int code = (huffCode & power2m1[nBits - 1]) << (24 - nBits - currentBitCount); byte[] codeBuffer = new byte[4]; - codeBuffer[0] = (byte)(code & 0xFF); - codeBuffer[1] = (byte)((code >> 8) & 0xFF); - codeBuffer[2] = (byte)((code >> 16) & 0xFF); - codeBuffer[3] = (byte)((code >> 24) & 0xFF); + codeBuffer[0] = cast(byte)(code & 0xFF); + codeBuffer[1] = cast(byte)((code >> 8) & 0xFF); + codeBuffer[2] = cast(byte)((code >> 16) & 0xFF); + codeBuffer[3] = cast(byte)((code >> 24) & 0xFF); int abs = nBits - (8 - currentBitCount); if (abs < 0) abs = -abs; if ((abs >> 3) > 0) { currentByte += codeBuffer[2]; - emitByte((byte)currentByte); + emitByte(cast(byte)currentByte); emitByte(codeBuffer[1]); currentByte = codeBuffer[0]; currentBitCount += nBits - 16; @@ -846,7 +846,7 @@ currentBitCount += nBits; if (currentBitCount >= 8) { currentByte += codeBuffer[2]; - emitByte((byte)currentByte); + emitByte(cast(byte)currentByte); currentByte = codeBuffer[1]; currentBitCount -= 8; } else { @@ -861,7 +861,7 @@ dataBuffer[bufferCurrentPosition] = byteValue; bufferCurrentPosition++; if (byteValue is -1) { - emitByte((byte)0); + emitByte(cast(byte)0); } } void encodeACCoefficients(int[] dataUnit, int iComp) { @@ -947,7 +947,7 @@ } } if (currentBitCount !is 0) { - emitByte((byte)currentByte); + emitByte(cast(byte)currentByte); } resetOutputBuffer(); } @@ -1702,9 +1702,9 @@ try { while (true) { if (byteStream.read(byteArray, 0, 1) !is 1) return null; - if (byteArray[0] is (byte) 0xFF) { + if (byteArray[0] is cast(byte) 0xFF) { if (byteStream.read(byteArray, 1, 1) !is 1) return null; - if (byteArray[1] !is (byte) 0xFF && byteArray[1] !is 0) { + if (byteArray[1] !is cast(byte) 0xFF && byteArray[1] !is 0) { byteStream.unread(byteArray); return new JPEGSegment(byteArray); } @@ -1756,7 +1756,7 @@ } else { if (x > 255) x = 255; } - compImage[destIndex + col] = (byte)x; + compImage[destIndex + col] = cast(byte)x; srcIndex++; } destIndex += compWidth; @@ -1767,7 +1767,7 @@ if (!new JPEGStartOfImage().writeToStream(outputStream)) { DWT.error(DWT.ERROR_IO); } - JPEGAppn appn = new JPEGAppn(new byte[] {(byte)0xFF, (byte)0xE0, 0, 0x10, 0x4A, 0x46, 0x49, 0x46, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0}); + JPEGAppn appn = new JPEGAppn(new byte[] {cast(byte)0xFF, cast(byte)0xE0, 0, 0x10, 0x4A, 0x46, 0x49, 0x46, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0}); if (!appn.writeToStream(outputStream)) { DWT.error(DWT.ERROR_IO); } diff -r fb2555104d70 -r 5b53d338c709 dwt/internal/image/JPEGFixedSizeSegment.d --- a/dwt/internal/image/JPEGFixedSizeSegment.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/internal/image/JPEGFixedSizeSegment.d Fri Aug 29 22:04:22 2008 +0200 @@ -15,16 +15,16 @@ abstract class JPEGFixedSizeSegment : JPEGSegment { - public JPEGFixedSizeSegment() { + public this() { reference = new byte[fixedSize()]; setSegmentMarker(signature()); } - public JPEGFixedSizeSegment(byte[] reference) { + public this(byte[] reference) { super(reference); } - public JPEGFixedSizeSegment(LEDataInputStream byteStream) { + public this(LEDataInputStream byteStream) { reference = new byte[fixedSize()]; try { byteStream.read(reference); diff -r fb2555104d70 -r 5b53d338c709 dwt/internal/image/JPEGFrameHeader.d --- a/dwt/internal/image/JPEGFrameHeader.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/internal/image/JPEGFrameHeader.d Fri Aug 29 22:04:22 2008 +0200 @@ -19,11 +19,11 @@ public int[] componentIdentifiers; public int[][] componentParameters; - public JPEGFrameHeader(byte[] reference) { + public this(byte[] reference) { super(reference); } - public JPEGFrameHeader(LEDataInputStream byteStream) { + public this(LEDataInputStream byteStream) { super(byteStream); initializeComponentParameters(); } @@ -45,21 +45,21 @@ } public void setSamplePrecision(int precision) { - reference[4] = (byte)(precision & 0xFF); + reference[4] = cast(byte)(precision & 0xFF); } public void setNumberOfLines(int anInteger) { - reference[5] = (byte)((anInteger & 0xFF00) >> 8); - reference[6] = (byte)(anInteger & 0xFF); + reference[5] = cast(byte)((anInteger & 0xFF00) >> 8); + reference[6] = cast(byte)(anInteger & 0xFF); } public void setSamplesPerLine(int samples) { - reference[7] = (byte)((samples & 0xFF00) >> 8); - reference[8] = (byte)(samples & 0xFF); + reference[7] = cast(byte)((samples & 0xFF00) >> 8); + reference[8] = cast(byte)(samples & 0xFF); } public void setNumberOfImageComponents(int anInteger) { - reference[9] = (byte)(anInteger & 0xFF); + reference[9] = cast(byte)(anInteger & 0xFF); } public int getMaxHFactor() { @@ -145,9 +145,9 @@ if (hi * vi > 4) { DWT.error(DWT.ERROR_INVALID_IMAGE); } - reference[ofs] = (byte)(i + 1); - reference[ofs + 1] = (byte)(hi * 16 + vi); - reference[ofs + 2] = (byte)(compParam[0]); + reference[ofs] = cast(byte)(i + 1); + reference[ofs + 1] = cast(byte)(hi * 16 + vi); + reference[ofs + 2] = cast(byte)(compParam[0]); if (hi > hmax) hmax = hi; if (vi > vmax) vmax = vi; } diff -r fb2555104d70 -r 5b53d338c709 dwt/internal/image/JPEGHuffmanTable.d --- a/dwt/internal/image/JPEGHuffmanTable.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/internal/image/JPEGHuffmanTable.d Fri Aug 29 22:04:22 2008 +0200 @@ -32,53 +32,53 @@ int[] ehCodes; byte[] ehCodeLengths; static byte[] DCLuminanceTable = { - (byte)255, (byte)196, 0, 31, 0, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, + cast(byte)255, cast(byte)196, 0, 31, 0, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 }; static byte[] DCChrominanceTable = { - (byte)255, (byte)196, 0, 31, 1, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, + cast(byte)255, cast(byte)196, 0, 31, 1, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 }; static byte[] ACLuminanceTable = { - (byte)255, (byte)196, 0, (byte)181, 16, 0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 125, + cast(byte)255, cast(byte)196, 0, cast(byte)181, 16, 0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 125, 1, 2, 3, 0, 4, 17, 5, 18, 33, 49, 65, 6, 19, 81, 97, 7, 34, 113, 20, - 50, (byte)129, (byte)145, (byte)161, 8, 35, 66, (byte)177, (byte)193, 21, 82, (byte)209, (byte)240, 36, 51, 98, - 114, (byte)130, 9, 10, 22, 23, 24, 25, 26, 37, 38, 39, 40, 41, 42, 52, 53, + 50, cast(byte)129, cast(byte)145, cast(byte)161, 8, 35, 66, cast(byte)177, cast(byte)193, 21, 82, cast(byte)209, cast(byte)240, 36, 51, 98, + 114, cast(byte)130, 9, 10, 22, 23, 24, 25, 26, 37, 38, 39, 40, 41, 42, 52, 53, 54, 55, 56, 57, 58, 67, 68, 69, 70, 71, 72, 73, 74, 83, 84, 85, 86, 87, 88, 89, 90, 99, 100, 101, 102, 103, 104, 105, 106, 115, 116, 117, 118, - 119, 120, 121, 122, (byte)131, (byte)132, (byte)133, (byte)134, (byte)135, (byte)136, (byte)137, (byte)138, (byte)146, (byte)147, (byte)148, - (byte)149, (byte)150, (byte)151, (byte)152, (byte)153, (byte)154, (byte)162, (byte)163, (byte)164, (byte)165, (byte)166, (byte)167, (byte)168, (byte)169, (byte)170, - (byte)178, (byte)179, (byte)180, (byte)181, (byte)182, (byte)183, (byte)184, (byte)185, (byte)186, (byte)194, (byte)195, (byte)196, (byte)197, (byte)198, (byte)199, - (byte)200, (byte)201, (byte)202, (byte)210, (byte)211, (byte)212, (byte)213, (byte)214, (byte)215, (byte)216, (byte)217, (byte)218, (byte)225, (byte)226, (byte)227, - (byte)228, (byte)229, (byte)230, (byte)231, (byte)232, (byte)233, (byte)234, (byte)241, (byte)242, (byte)243, (byte)244, (byte)245, (byte)246, (byte)247, (byte)248, - (byte)249, (byte)250 + 119, 120, 121, 122, cast(byte)131, cast(byte)132, cast(byte)133, cast(byte)134, cast(byte)135, cast(byte)136, cast(byte)137, cast(byte)138, cast(byte)146, cast(byte)147, cast(byte)148, + cast(byte)149, cast(byte)150, cast(byte)151, cast(byte)152, cast(byte)153, cast(byte)154, cast(byte)162, cast(byte)163, cast(byte)164, cast(byte)165, cast(byte)166, cast(byte)167, cast(byte)168, cast(byte)169, cast(byte)170, + cast(byte)178, cast(byte)179, cast(byte)180, cast(byte)181, cast(byte)182, cast(byte)183, cast(byte)184, cast(byte)185, cast(byte)186, cast(byte)194, cast(byte)195, cast(byte)196, cast(byte)197, cast(byte)198, cast(byte)199, + cast(byte)200, cast(byte)201, cast(byte)202, cast(byte)210, cast(byte)211, cast(byte)212, cast(byte)213, cast(byte)214, cast(byte)215, cast(byte)216, cast(byte)217, cast(byte)218, cast(byte)225, cast(byte)226, cast(byte)227, + cast(byte)228, cast(byte)229, cast(byte)230, cast(byte)231, cast(byte)232, cast(byte)233, cast(byte)234, cast(byte)241, cast(byte)242, cast(byte)243, cast(byte)244, cast(byte)245, cast(byte)246, cast(byte)247, cast(byte)248, + cast(byte)249, cast(byte)250 }; static byte[] ACChrominanceTable = { - (byte)255, (byte)196, 0, (byte)181, 17, 0, 2, 1, 2, 4, 4, 3, 4, 7, 5, 4, 4, 0, + cast(byte)255, cast(byte)196, 0, cast(byte)181, 17, 0, 2, 1, 2, 4, 4, 3, 4, 7, 5, 4, 4, 0, 1, 2, 119, 0, 1, 2, 3, 17, 4, 5, 33, 49, 6, 18, 65, 81, 7, 97, 113, 19, 34, - 50, (byte)129, 8, 20, 66, (byte)145, (byte)161, (byte)177, (byte)193, 9, 35, - 51, 82, (byte)240, 21, 98, 114, (byte)209, 10, 22, 36, 52, (byte)225, 37, - (byte)241, 23, 24, 25, 26, 38, 39, 40, 41, 42, 53, 54, 55, 56, 57, 58, 67, + 50, cast(byte)129, 8, 20, 66, cast(byte)145, cast(byte)161, cast(byte)177, cast(byte)193, 9, 35, + 51, 82, cast(byte)240, 21, 98, 114, cast(byte)209, 10, 22, 36, 52, cast(byte)225, 37, + cast(byte)241, 23, 24, 25, 26, 38, 39, 40, 41, 42, 53, 54, 55, 56, 57, 58, 67, 68, 69, 70, 71, 72, 73, 74, 83, 84, 85, 86, 87, 88, 89, 90, 99, 100, 101, 102, - 103, 104, 105, 106, 115, 116, 117, 118, 119, 120, 121, 122, (byte)130, - (byte)131, (byte)132, (byte)133, (byte)134, (byte)135, (byte)136, (byte)137, - (byte)138, (byte)146, (byte)147, (byte)148, (byte)149, (byte)150, (byte)151, - (byte)152, (byte)153, (byte)154, (byte)162, (byte)163, (byte)164, (byte)165, - (byte)166, (byte)167, (byte)168, (byte)169, (byte)170, (byte)178, (byte)179, - (byte)180, (byte)181, (byte)182, (byte)183, (byte)184, (byte)185, (byte)186, - (byte)194, (byte)195, (byte)196, (byte)197, (byte)198, (byte)199, (byte)200, - (byte)201, (byte)202, (byte)210, (byte)211, (byte)212, (byte)213, (byte)214, - (byte)215, (byte)216, (byte)217, (byte)218, (byte)226, (byte)227, (byte)228, - (byte)229, (byte)230, (byte)231, (byte)232, (byte)233, (byte)234, (byte)242, - (byte)243, (byte)244, (byte)245, (byte)246, (byte)247, (byte)248, (byte)249, - (byte)250 + 103, 104, 105, 106, 115, 116, 117, 118, 119, 120, 121, 122, cast(byte)130, + cast(byte)131, cast(byte)132, cast(byte)133, cast(byte)134, cast(byte)135, cast(byte)136, cast(byte)137, + cast(byte)138, cast(byte)146, cast(byte)147, cast(byte)148, cast(byte)149, cast(byte)150, cast(byte)151, + cast(byte)152, cast(byte)153, cast(byte)154, cast(byte)162, cast(byte)163, cast(byte)164, cast(byte)165, + cast(byte)166, cast(byte)167, cast(byte)168, cast(byte)169, cast(byte)170, cast(byte)178, cast(byte)179, + cast(byte)180, cast(byte)181, cast(byte)182, cast(byte)183, cast(byte)184, cast(byte)185, cast(byte)186, + cast(byte)194, cast(byte)195, cast(byte)196, cast(byte)197, cast(byte)198, cast(byte)199, cast(byte)200, + cast(byte)201, cast(byte)202, cast(byte)210, cast(byte)211, cast(byte)212, cast(byte)213, cast(byte)214, + cast(byte)215, cast(byte)216, cast(byte)217, cast(byte)218, cast(byte)226, cast(byte)227, cast(byte)228, + cast(byte)229, cast(byte)230, cast(byte)231, cast(byte)232, cast(byte)233, cast(byte)234, cast(byte)242, + cast(byte)243, cast(byte)244, cast(byte)245, cast(byte)246, cast(byte)247, cast(byte)248, cast(byte)249, + cast(byte)250 }; -public JPEGHuffmanTable(byte[] reference) { +public this(byte[] reference) { super(reference); } -public JPEGHuffmanTable(LEDataInputStream byteStream) { +public this(LEDataInputStream byteStream) { super(byteStream); initialize(); } @@ -238,7 +238,7 @@ byte[] eHuffSize = new byte[256]; for (int i = 0; i < huffCodesIndex; i++) { eHuffCodes[huffVals[i]] = huffCodes[i]; - eHuffSize[huffVals[i]] = (byte)huffCodeLengths[i]; + eHuffSize[huffVals[i]] = cast(byte)huffCodeLengths[i]; } /* Create the new JPEGHuffmanTable and add it to the allTables array. */ diff -r fb2555104d70 -r 5b53d338c709 dwt/internal/image/JPEGQuantizationTable.d --- a/dwt/internal/image/JPEGQuantizationTable.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/internal/image/JPEGQuantizationTable.d Fri Aug 29 22:04:22 2008 +0200 @@ -13,7 +13,7 @@ final class JPEGQuantizationTable : JPEGVariableSizeSegment { public static byte[] DefaultLuminanceQTable = { - (byte)255, (byte)219, 0, 67, 0, + cast(byte)255, cast(byte)219, 0, 67, 0, 16, 11, 10, 16, 24, 40, 51, 61, 12, 12, 14, 19, 26, 58, 60, 55, 14, 13, 16, 24, 40, 57, 69, 56, @@ -24,7 +24,7 @@ 72, 92, 95, 98, 112, 100, 103, 99 }; public static byte[] DefaultChrominanceQTable = { - (byte)255, (byte)219, 0, 67, 1, + cast(byte)255, cast(byte)219, 0, 67, 1, 17, 18, 24, 47, 99, 99, 99, 99, 18, 21, 26, 66, 99, 99, 99, 99, 24, 26, 56, 99, 99, 99, 99, 99, @@ -35,11 +35,11 @@ 99, 99, 99, 99, 99, 99, 99, 99 }; -public JPEGQuantizationTable(byte[] reference) { +public this(byte[] reference) { super(reference); } -public JPEGQuantizationTable(LEDataInputStream byteStream) { +public this(LEDataInputStream byteStream) { super(byteStream); } @@ -141,7 +141,7 @@ int temp = ((reference[i] & 0xFF) * qFactor + 50) / 100; if (temp <= 0) temp = 1; if (temp > 255) temp = 255; - reference[i] = (byte)temp; + reference[i] = cast(byte)temp; } ofs += 65; totalLength -= 65; @@ -150,8 +150,8 @@ int temp = (((reference[i] & 0xFF) * 256 + (reference[i + 1] & 0xFF)) * qFactor + 50) / 100; if (temp <= 0) temp = 1; if (temp > 32767) temp = 32767; - reference[i] = (byte)(temp >> 8); - reference[i + 1] = (byte)(temp & 0xFF); + reference[i] = cast(byte)(temp >> 8); + reference[i + 1] = cast(byte)(temp & 0xFF); } ofs += 129; totalLength -= 129; diff -r fb2555104d70 -r 5b53d338c709 dwt/internal/image/JPEGRestartInterval.d --- a/dwt/internal/image/JPEGRestartInterval.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/internal/image/JPEGRestartInterval.d Fri Aug 29 22:04:22 2008 +0200 @@ -13,7 +13,7 @@ final class JPEGRestartInterval : JPEGFixedSizeSegment { - public JPEGRestartInterval(LEDataInputStream byteStream) { + public this(LEDataInputStream byteStream) { super(byteStream); } diff -r fb2555104d70 -r 5b53d338c709 dwt/internal/image/JPEGScanHeader.d --- a/dwt/internal/image/JPEGScanHeader.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/internal/image/JPEGScanHeader.d Fri Aug 29 22:04:22 2008 +0200 @@ -16,11 +16,11 @@ final class JPEGScanHeader : JPEGVariableSizeSegment { public int[][] componentParameters; -public JPEGScanHeader(byte[] reference) { +public this(byte[] reference) { super(reference); } -public JPEGScanHeader(LEDataInputStream byteStream) { +public this(LEDataInputStream byteStream) { super(byteStream); initializeComponentParameters(); } @@ -73,21 +73,21 @@ for (int i = 0; i < compCount; i++) { int ofs = i * 2 + 5; int[] compParams = compSpecParams[i]; - reference[ofs] = (byte)(i + 1); - reference[ofs + 1] = (byte)(compParams[0] * 16 + compParams[1]); + reference[ofs] = cast(byte)(i + 1); + reference[ofs + 1] = cast(byte)(compParams[0] * 16 + compParams[1]); } } public void setEndOfSpectralSelection(int anInteger) { - reference[(2 * getNumberOfImageComponents()) + 6] = (byte)anInteger; + reference[(2 * getNumberOfImageComponents()) + 6] = cast(byte)anInteger; } public void setNumberOfImageComponents(int anInteger) { - reference[4] = (byte)(anInteger & 0xFF); + reference[4] = cast(byte)(anInteger & 0xFF); } public void setStartOfSpectralSelection(int anInteger) { - reference[(2 * getNumberOfImageComponents()) + 5] = (byte)anInteger; + reference[(2 * getNumberOfImageComponents()) + 5] = cast(byte)anInteger; } public int signature() { diff -r fb2555104d70 -r 5b53d338c709 dwt/internal/image/JPEGSegment.d --- a/dwt/internal/image/JPEGSegment.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/internal/image/JPEGSegment.d Fri Aug 29 22:04:22 2008 +0200 @@ -14,10 +14,10 @@ class JPEGSegment { public byte[] reference; - JPEGSegment() { + this() { } - public JPEGSegment(byte[] reference) { + public this(byte[] reference) { this.reference = reference; } @@ -34,8 +34,8 @@ } public void setSegmentMarker(int marker) { - reference[0] = (byte)((marker & 0xFF00) >> 8); - reference[1] = (byte)(marker & 0xFF); + reference[0] = cast(byte)((marker & 0xFF00) >> 8); + reference[1] = cast(byte)(marker & 0xFF); } public int getSegmentLength() { @@ -43,8 +43,8 @@ } public void setSegmentLength(int length) { - reference[2] = (byte)((length & 0xFF00) >> 8); - reference[3] = (byte)(length & 0xFF); + reference[2] = cast(byte)((length & 0xFF00) >> 8); + reference[3] = cast(byte)(length & 0xFF); } public bool writeToStream(LEDataOutputStream byteStream) { diff -r fb2555104d70 -r 5b53d338c709 dwt/internal/image/JPEGStartOfImage.d --- a/dwt/internal/image/JPEGStartOfImage.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/internal/image/JPEGStartOfImage.d Fri Aug 29 22:04:22 2008 +0200 @@ -13,15 +13,15 @@ final class JPEGStartOfImage : JPEGFixedSizeSegment { - public JPEGStartOfImage() { + public this() { super(); } - public JPEGStartOfImage(byte[] reference) { + public this(byte[] reference) { super(reference); } - public JPEGStartOfImage(LEDataInputStream byteStream) { + public this(LEDataInputStream byteStream) { super(byteStream); } diff -r fb2555104d70 -r 5b53d338c709 dwt/internal/image/JPEGVariableSizeSegment.d --- a/dwt/internal/image/JPEGVariableSizeSegment.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/internal/image/JPEGVariableSizeSegment.d Fri Aug 29 22:04:22 2008 +0200 @@ -15,11 +15,11 @@ abstract class JPEGVariableSizeSegment : JPEGSegment { - public JPEGVariableSizeSegment(byte[] reference) { + public this(byte[] reference) { super(reference); } - public JPEGVariableSizeSegment(LEDataInputStream byteStream) { + public this(LEDataInputStream byteStream) { try { byte[] header = new byte[4]; byteStream.read(header); diff -r fb2555104d70 -r 5b53d338c709 dwt/internal/image/LEDataInputStream.d --- a/dwt/internal/image/LEDataInputStream.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/internal/image/LEDataInputStream.d Fri Aug 29 22:04:22 2008 +0200 @@ -31,11 +31,11 @@ protected int pos; - public LEDataInputStream(InputStream input) { + public this(InputStream input) { this(input, 512); } - public LEDataInputStream(InputStream input, int bufferSize) { + public this(InputStream input, int bufferSize) { this.in = input; if (bufferSize > 0) { buf = new byte[bufferSize]; @@ -44,7 +44,7 @@ else throw new IllegalArgumentException(); } - public void close() throws IOException { + public void close() { buf = null; if (in !is null) { in.close(); @@ -62,7 +62,7 @@ /** * Answers how many bytes are available for reading without blocking */ - public int available() throws IOException { + public int available() { if (buf is null) throw new IOException(); return (buf.length - pos) + in.available(); } @@ -70,7 +70,7 @@ /** * Answer the next byte of the input stream. */ - public int read() throws IOException { + public int read() { if (buf is null) throw new IOException(); if (pos < buf.length) { position++; @@ -85,7 +85,7 @@ * Don't imitate the JDK behaviour of reading a random number * of bytes when you can actually read them all. */ - public int read(byte b[], int off, int len) throws IOException { + public int read(byte b[], int off, int len) { int read = 0, count; while (read !is len && (count = readData(b, off, len - read)) !is -1) { off += count; @@ -113,7 +113,7 @@ * * @exception java.io.IOException if an IOException occurs. */ - private int readData(byte[] buffer, int offset, int length) throws IOException { + private int readData(byte[] buffer, int offset, int length) { if (buf is null) throw new IOException(); if (offset < 0 || offset > buffer.length || length < 0 || (length > buffer.length - offset)) { @@ -146,7 +146,7 @@ * Answer an integer comprised of the next * four bytes of the input stream. */ - public int readInt() throws IOException { + public int readInt() { byte[] buf = new byte[4]; read(buf); return ((buf[3] & 0xFF) << 24) | @@ -159,10 +159,10 @@ * Answer a short comprised of the next * two bytes of the input stream. */ - public short readShort() throws IOException { + public short readShort() { byte[] buf = new byte[2]; read(buf); - return (short)(((buf[1] & 0xFF) << 8) | (buf[0] & 0xFF)); + return cast(short)(((buf[1] & 0xFF) << 8) | (buf[0] & 0xFF)); } /** @@ -177,7 +177,7 @@ * * @exception java.io.IOException if the pushback buffer is too small */ - public void unread(byte[] b) throws IOException { + public void unread(byte[] b) { int length = b.length; if (length > pos) throw new IOException(); position -= length; diff -r fb2555104d70 -r 5b53d338c709 dwt/internal/image/LEDataOutputStream.d --- a/dwt/internal/image/LEDataOutputStream.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/internal/image/LEDataOutputStream.d Fri Aug 29 22:04:22 2008 +0200 @@ -16,33 +16,33 @@ final class LEDataOutputStream : OutputStream { OutputStream out; -public LEDataOutputStream(OutputStream output) { +public this(OutputStream output) { this.out = output; } /** * Write the specified number of bytes of the given byte array, * starting at the specified offset, to the output stream. */ -public void write(byte b[], int off, int len) throws IOException { +public void write(byte b[], int off, int len) { out.write(b, off, len); } /** * Write the given byte to the output stream. */ -public void write(int b) throws IOException { +public void write(int b) { out.write(b); } /** * Write the given byte to the output stream. */ -public void writeByte(byte b) throws IOException { +public void writeByte(byte b) { out.write(b & 0xFF); } /** * Write the four bytes of the given integer * to the output stream. */ -public void writeInt(int theInt) throws IOException { +public void writeInt(int theInt) { out.write(theInt & 0xFF); out.write((theInt >> 8) & 0xFF); out.write((theInt >> 16) & 0xFF); @@ -52,7 +52,7 @@ * Write the two bytes of the given short * to the output stream. */ -public void writeShort(int theShort) throws IOException { +public void writeShort(int theShort) { out.write(theShort & 0xFF); out.write((theShort >> 8) & 0xFF); } diff -r fb2555104d70 -r 5b53d338c709 dwt/internal/image/LZWCodec.d --- a/dwt/internal/image/LZWCodec.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/internal/image/LZWCodec.d Fri Aug 29 22:04:22 2008 +0200 @@ -53,7 +53,7 @@ while ((c = nextCode()) is clearCode) {} if (c !is endCode) { oc = fc = c; - buf[bufIndex] = (byte)c; + buf[bufIndex] = cast(byte)c; bufIndex++; if (bufIndex is imageWidth) { nextPutPixels(buf); @@ -90,7 +90,7 @@ } while (stackIndex > 0) { stackIndex--; - buf[bufIndex] = (byte)stack[stackIndex]; + buf[bufIndex] = cast(byte)stack[stackIndex]; bufIndex++; if (bufIndex is imageWidth) { nextPutPixels(buf); @@ -127,9 +127,9 @@ // Write out last partial block if (bitsLeft is 8) { - block[0] = (byte)(blockIndex - 1); // Nothing in last byte + block[0] = cast(byte)(blockIndex - 1); // Nothing in last byte } else { - block[0] = (byte)(blockIndex); // Last byte has data + block[0] = cast(byte)(blockIndex); // Last byte has data } writeBlock(); @@ -257,7 +257,7 @@ blockIndex = 1; blockSize = 255; block = new byte[blockSize]; - block[0] = (byte)(blockSize - 1); + block[0] = cast(byte)(blockSize - 1); nodeStack = new LZWNode[1 << bitsPerPixel]; for (int i = 0; i < nodeStack.length; i++) { LZWNode node = new LZWNode(); @@ -344,7 +344,7 @@ // *high-order* bits of the code. int c = codeToDo & MASK_TABLE[bitsLeft - 1]; currentByte = currentByte | (c << (8 - bitsLeft)); - block[blockIndex] = (byte)currentByte; + block[blockIndex] = cast(byte)currentByte; codeBitsToDo -= bitsLeft; if (codeBitsToDo < 1) { // The whole code fit in the first byte, so we are done. @@ -372,7 +372,7 @@ } while (codeBitsToDo >= 8) { currentByte = codeToDo & 0xFF; - block[blockIndex] = (byte)currentByte; + block[blockIndex] = cast(byte)currentByte; codeToDo = codeToDo >> 8; codeBitsToDo -= 8; blockIndex++; @@ -384,7 +384,7 @@ // Fill the *low-order* bits of the last byte with the remainder bitsLeft = 8 - codeBitsToDo; currentByte = codeToDo; - block[blockIndex] = (byte)currentByte; + block[blockIndex] = cast(byte)currentByte; } /** * Copy a row of pixel values to the image. @@ -421,7 +421,7 @@ else if (pass is 5) line = 0; if (pass < 5) { if (loader.hasListeners()) { - ImageData imageCopy = (ImageData) image.clone(); + ImageData imageCopy = cast(ImageData) image.clone(); loader.notifyListeners( new ImageLoaderEvent(loader, imageCopy, pass - 2, false)); } @@ -455,7 +455,7 @@ if (size is -1) { DWT.error(DWT.ERROR_INVALID_IMAGE); } - block[0] = (byte)size; + block[0] = cast(byte)size; size = inputStream.read(block, 1, size); if (size is -1) { DWT.error(DWT.ERROR_INVALID_IMAGE); diff -r fb2555104d70 -r 5b53d338c709 dwt/internal/image/OS2BMPFileFormat.d --- a/dwt/internal/image/OS2BMPFileFormat.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/internal/image/OS2BMPFileFormat.d Fri Aug 29 22:04:22 2008 +0200 @@ -149,9 +149,9 @@ int offset = 0; for (int i = 0; i < n; i++) { RGB col = pal.colors[i]; - bytes[offset] = (byte)col.blue; - bytes[offset + 1] = (byte)col.green; - bytes[offset + 2] = (byte)col.red; + bytes[offset] = cast(byte)col.blue; + bytes[offset + 1] = cast(byte)col.green; + bytes[offset + 2] = cast(byte)col.red; offset += 3; } return bytes; @@ -262,7 +262,7 @@ outputStream.writeShort(image.width); outputStream.writeShort(image.height); outputStream.writeShort(1); - outputStream.writeShort((short)image.depth); + outputStream.writeShort(cast(short)image.depth); } catch (IOException e) { DWT.error(DWT.ERROR_IO, e); } diff -r fb2555104d70 -r 5b53d338c709 dwt/internal/image/PNGFileFormat.d --- a/dwt/internal/image/PNGFileFormat.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/internal/image/PNGFileFormat.d Fri Aug 29 22:04:22 2008 +0200 @@ -37,7 +37,7 @@ * Skip over signature data. This has already been * verified in isFileFormat(). */ -void readSignature() throws IOException { +void readSignature() { byte[] signature = new byte[SIGNATURE_LENGTH]; inputStream.read(signature); } @@ -90,19 +90,19 @@ * Read and handle the next chunk of data from the * PNG file. */ -void readNextChunk(PngChunkReader chunkReader) throws IOException { +void readNextChunk(PngChunkReader chunkReader) { PngChunk chunk = chunkReader.readNextChunk(); switch (chunk.getChunkType()) { case PngChunk.CHUNK_IEND: break; case PngChunk.CHUNK_PLTE: if (!headerChunk.usesDirectColor()) { - paletteChunk = (PngPlteChunk) chunk; + paletteChunk = cast(PngPlteChunk) chunk; imageData.palette = paletteChunk.getPaletteData(); } break; case PngChunk.CHUNK_tRNS: - PngTrnsChunk trnsChunk = (PngTrnsChunk) chunk; + PngTrnsChunk trnsChunk = cast(PngTrnsChunk) chunk; if (trnsChunk.getTransparencyType(headerChunk) is PngTrnsChunk.TRANSPARENCY_TYPE_PIXEL) { @@ -135,7 +135,7 @@ } else { // Read in the pixel data for the image. This should // go through all the image's IDAT chunks. - PngIdatChunk dataChunk = (PngIdatChunk) chunk; + PngIdatChunk dataChunk = cast(PngIdatChunk) chunk; readPixelData(dataChunk, chunkReader); } break; @@ -293,7 +293,7 @@ * Read the image data from the data stream. This must handle * decoding the data, filtering, and interlacing. */ -void readPixelData(PngIdatChunk chunk, PngChunkReader chunkReader) throws IOException { +void readPixelData(PngIdatChunk chunk, PngChunkReader chunkReader) { InputStream stream = new PngInputStream(chunk, chunkReader); //TEMPORARY CODE bool use3_2 = System.getProperty("dwt.internal.image.PNGFileFormat_3.2") !is null; @@ -366,7 +366,7 @@ int columnInterval, int startRow, int startColumn, - int frameCount) throws IOException + int frameCount) { int width = headerChunk.getWidth(); int alignedBytesPerRow = getAlignedBytesPerRow(); @@ -380,7 +380,7 @@ byte[] currentRow = row1; byte[] lastRow = row2; for (int row = startRow; row < height; row += rowInterval) { - byte filterType = (byte)inputStream.read(); + byte filterType = cast(byte)inputStream.read(); int read = 0; while (read !is bytesPerRow) { read += inputStream.read(currentRow, read, bytesPerRow - read); @@ -428,7 +428,7 @@ * Read the pixel data for an interlaced image from the * data stream. */ -void readInterlacedImage(InputStream inputStream) throws IOException { +void readInterlacedImage(InputStream inputStream) { readInterlaceFrame(inputStream, 8, 8, 0, 0, 0); readInterlaceFrame(inputStream, 8, 8, 0, 4, 1); readInterlaceFrame(inputStream, 8, 4, 4, 0, 2); @@ -445,7 +445,7 @@ */ void fireInterlacedFrameEvent(int frameCount) { if (loader.hasListeners()) { - ImageData image = (ImageData) imageData.clone(); + ImageData image = cast(ImageData) imageData.clone(); bool finalFrame = frameCount is 6; loader.notifyListeners(new ImageLoaderEvent(loader, image, frameCount, finalFrame)); } @@ -455,7 +455,7 @@ * data stream. * Update the imageData to reflect the new data. */ -void readNonInterlacedImage(InputStream inputStream) throws IOException { +void readNonInterlacedImage(InputStream inputStream) { int dataOffset = 0; int alignedBytesPerRow = getAlignedBytesPerRow(); int bytesPerRow = getBytesPerRow(); @@ -465,7 +465,7 @@ byte[] lastRow = row2; int height = headerChunk.getHeight(); for (int row = 0; row < height; row++) { - byte filterType = (byte)inputStream.read(); + byte filterType = cast(byte)inputStream.read(); int read = 0; while (read !is bytesPerRow) { read += inputStream.read(currentRow, read, bytesPerRow - read); @@ -499,7 +499,7 @@ int sourceIndex = sourceOffset + (2 * i); int destinationIndex = destinationOffset + i; //int value = (source[sourceIndex] << 8) | source[sourceIndex + 1]; - //byte compressedValue = (byte)(value * multiplier); + //byte compressedValue = cast(byte)(value * multiplier); byte compressedValue = source[sourceIndex]; destination[destinationIndex] = compressedValue; } @@ -515,7 +515,7 @@ */ static int compress16BitDepthTo8BitDepth(int value) { //double multiplier = (Compatibility.pow2(8) - 1) / (Compatibility.pow2(16) - 1); - //byte compressedValue = (byte)(value * multiplier); + //byte compressedValue = cast(byte)(value * multiplier); return value >> 8; } /** @@ -532,14 +532,14 @@ for (int i = byteOffset; i < row.length; i++) { int current = row[i] & 0xFF; int left = row[i - byteOffset] & 0xFF; - row[i] = (byte)((current + left) & 0xFF); + row[i] = cast(byte)((current + left) & 0xFF); } break; case PngIhdrChunk.FILTER_UP: for (int i = 0; i < row.length; i++) { int current = row[i] & 0xFF; int above = previousRow[i] & 0xFF; - row[i] = (byte)((current + above) & 0xFF); + row[i] = cast(byte)((current + above) & 0xFF); } break; case PngIhdrChunk.FILTER_AVERAGE: @@ -547,7 +547,7 @@ int left = (i < byteOffset) ? 0 : row[i - byteOffset] & 0xFF; int above = previousRow[i] & 0xFF; int current = row[i] & 0xFF; - row[i] = (byte)((current + ((left + above) / 2)) & 0xFF); + row[i] = cast(byte)((current + ((left + above) / 2)) & 0xFF); } break; case PngIhdrChunk.FILTER_PAETH: @@ -570,7 +570,7 @@ } int currentValue = row[i] & 0xFF; - row[i] = (byte) ((currentValue + preductor) & 0xFF); + row[i] = cast(byte) ((currentValue + preductor) & 0xFF); } break; } diff -r fb2555104d70 -r 5b53d338c709 dwt/internal/image/PngChunk.d --- a/dwt/internal/image/PngChunk.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/internal/image/PngChunk.d Fri Aug 29 22:04:22 2008 +0200 @@ -35,11 +35,11 @@ // Non-critical chunks. static final int CHUNK_tRNS = 5; - static final byte[] TYPE_IHDR = {(byte) 'I', (byte) 'H', (byte) 'D', (byte) 'R'}; - static final byte[] TYPE_PLTE = {(byte) 'P', (byte) 'L', (byte) 'T', (byte) 'E'}; - static final byte[] TYPE_IDAT = {(byte) 'I', (byte) 'D', (byte) 'A', (byte) 'T'}; - static final byte[] TYPE_IEND = {(byte) 'I', (byte) 'E', (byte) 'N', (byte) 'D'}; - static final byte[] TYPE_tRNS = {(byte) 't', (byte) 'R', (byte) 'N', (byte) 'S'}; + static final byte[] TYPE_IHDR = {cast(byte) 'I', cast(byte) 'H', cast(byte) 'D', cast(byte) 'R'}; + static final byte[] TYPE_PLTE = {cast(byte) 'P', cast(byte) 'L', cast(byte) 'T', cast(byte) 'E'}; + static final byte[] TYPE_IDAT = {cast(byte) 'I', cast(byte) 'D', cast(byte) 'A', cast(byte) 'T'}; + static final byte[] TYPE_IEND = {cast(byte) 'I', cast(byte) 'E', cast(byte) 'N', cast(byte) 'D'}; + static final byte[] TYPE_tRNS = {cast(byte) 't', cast(byte) 'R', cast(byte) 'N', cast(byte) 'S'}; static final int[] CRC_TABLE; static { @@ -62,7 +62,7 @@ * Construct a PngChunk using the reference bytes * given. */ -PngChunk(byte[] reference) { +this(byte[] reference) { super(); setReference(reference); if (reference.length < LENGTH_OFFSET + LENGTH_FIELD_LENGTH) DWT.error(DWT.ERROR_INVALID_IMAGE); @@ -73,7 +73,7 @@ * Construct a PngChunk with the specified number of * data bytes. */ -PngChunk(int dataLength) { +this(int dataLength) { this(new byte[MIN_LENGTH + dataLength]); setLength(dataLength); } @@ -108,8 +108,8 @@ * array at the given offset. */ void setInt16(int offset, int value) { - reference[offset] = (byte) ((value >> 8) & 0xFF); - reference[offset + 1] = (byte) (value & 0xFF); + reference[offset] = cast(byte) ((value >> 8) & 0xFF); + reference[offset + 1] = cast(byte) (value & 0xFF); } /** @@ -130,10 +130,10 @@ * array at the given offset. */ void setInt32(int offset, int value) { - reference[offset] = (byte) ((value >> 24) & 0xFF); - reference[offset + 1] = (byte) ((value >> 16) & 0xFF); - reference[offset + 2] = (byte) ((value >> 8) & 0xFF); - reference[offset + 3] = (byte) (value & 0xFF); + reference[offset] = cast(byte) ((value >> 24) & 0xFF); + reference[offset + 1] = cast(byte) ((value >> 16) & 0xFF); + reference[offset + 2] = cast(byte) ((value >> 8) & 0xFF); + reference[offset + 3] = cast(byte) (value & 0xFF); } /** @@ -273,7 +273,7 @@ } bool isCritical() { - char c = (char) getTypeBytes()[0]; + char c = cast(wchar) getTypeBytes()[0]; return 'A' <= c && c <= 'Z'; } @@ -333,12 +333,12 @@ byte[] type = getTypeBytes(); // The third character MUST be upper case. - char c = (char) type[2]; + char c = cast(wchar) type[2]; if (!('A' <= c && c <= 'Z')) DWT.error(DWT.ERROR_INVALID_IMAGE); // All characters must be letters. for (int i = 0; i < TYPE_FIELD_LENGTH; i++) { - c = (char) type[i]; + c = cast(wchar) type[i]; if (!(('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z'))) { DWT.error(DWT.ERROR_INVALID_IMAGE); } @@ -368,7 +368,7 @@ buffer.append("\n\tType: "); byte[] type = getTypeBytes(); for(int i = 0; i < type.length; i++) { - buffer.append((char) type[i]); + buffer.append(cast(wchar) type[i]); } contributeToString(buffer); diff -r fb2555104d70 -r 5b53d338c709 dwt/internal/image/PngChunkReader.d --- a/dwt/internal/image/PngChunkReader.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/internal/image/PngChunkReader.d Fri Aug 29 22:04:22 2008 +0200 @@ -19,7 +19,7 @@ PngIhdrChunk headerChunk; PngPlteChunk paletteChunk; -PngChunkReader(LEDataInputStream inputStream) { +this(LEDataInputStream inputStream) { this.inputStream = inputStream; readState = new PngFileReadState(); headerChunk = null; @@ -30,7 +30,7 @@ try { PngChunk chunk = PngChunk.readNextFromStream(inputStream); if (chunk is null) DWT.error(DWT.ERROR_INVALID_IMAGE); - headerChunk = (PngIhdrChunk) chunk; + headerChunk = cast(PngIhdrChunk) chunk; headerChunk.validate(readState, null); } catch (ClassCastException e) { DWT.error(DWT.ERROR_INVALID_IMAGE); @@ -46,11 +46,11 @@ if (chunk is null) DWT.error(DWT.ERROR_INVALID_IMAGE); switch (chunk.getChunkType()) { case PngChunk.CHUNK_tRNS: - ((PngTrnsChunk) chunk).validate(readState, headerChunk, paletteChunk); + (cast(PngTrnsChunk) chunk).validate(readState, headerChunk, paletteChunk); break; case PngChunk.CHUNK_PLTE: chunk.validate(readState, headerChunk); - paletteChunk = (PngPlteChunk) chunk; + paletteChunk = cast(PngPlteChunk) chunk; break; default: chunk.validate(readState, headerChunk); diff -r fb2555104d70 -r 5b53d338c709 dwt/internal/image/PngDecodingDataStream.d --- a/dwt/internal/image/PngDecodingDataStream.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/internal/image/PngDecodingDataStream.d Fri Aug 29 22:04:22 2008 +0200 @@ -27,7 +27,7 @@ static final int PRIME = 65521; static final int MAX_BIT = 7; -PngDecodingDataStream(InputStream stream) throws IOException { +this(InputStream stream) { super(); this.stream = stream; nextBitIndex = MAX_BIT + 1; @@ -44,16 +44,16 @@ * block marker. If there are more blocks after this one, * the method will read them and ensure that they are empty. */ -void assertImageDataAtEnd() throws IOException { +void assertImageDataAtEnd() { lzBlockReader.assertCompressedDataAtEnd(); } -public void close() throws IOException { +public void close() { assertImageDataAtEnd(); checkAdler(); } -int getNextIdatBits(int length) throws IOException { +int getNextIdatBits(int length) { int value = 0; for (int i = 0; i < length; i++) { value |= (getNextIdatBit() << i); @@ -61,7 +61,7 @@ return value; } -int getNextIdatBit() throws IOException { +int getNextIdatBit() { if (nextBitIndex > MAX_BIT) { currentByte = getNextIdatByte(); nextBitIndex = 0; @@ -69,8 +69,8 @@ return (currentByte & (1 << nextBitIndex)) >> nextBitIndex++; } -byte getNextIdatByte() throws IOException { - byte nextByte = (byte)stream.read(); +byte getNextIdatByte() { + byte nextByte = cast(byte)stream.read(); nextBitIndex = MAX_BIT + 1; return nextByte; } @@ -84,17 +84,17 @@ adlerValue = (high << 16) | low; } -public int read() throws IOException { +public int read() { byte nextDecodedByte = lzBlockReader.getNextByte(); updateAdler(nextDecodedByte); return nextDecodedByte & 0xFF; } -public int read(byte[] buffer, int off, int len) throws IOException { +public int read(byte[] buffer, int off, int len) { for (int i = 0; i < len; i++) { int b = read(); if (b is -1) return i; - buffer[off + i] = (byte)b; + buffer[off + i] = cast(byte)b; } return len; } @@ -103,7 +103,7 @@ DWT.error(DWT.ERROR_INVALID_IMAGE); } -private void readCompressedDataHeader() throws IOException { +private void readCompressedDataHeader() { byte headerByte1 = getNextIdatByte(); byte headerByte2 = getNextIdatByte(); @@ -124,7 +124,7 @@ // int compressionLevel = (headerByte2 & 0xC0) >> 6; } -void checkAdler() throws IOException { +void checkAdler() { int storedAdler = ((getNextIdatByte() & 0xFF) << 24) | ((getNextIdatByte() & 0xFF) << 16) | ((getNextIdatByte() & 0xFF) << 8) diff -r fb2555104d70 -r 5b53d338c709 dwt/internal/image/PngDeflater.d --- a/dwt/internal/image/PngDeflater.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/internal/image/PngDeflater.d Fri Aug 29 22:04:22 2008 +0200 @@ -38,7 +38,7 @@ int hash, value; Link previous, next; - Link() { + this() { this.hash = 0; this.value = 0; @@ -53,7 +53,7 @@ int length, distance; - Match(int length, int distance) { + this(int length, int distance) { this.length = length; this.distance = distance; @@ -103,7 +103,7 @@ int code, extraBits, min, max; - Code(int code, int extraBits, int min, int max) { + this(int code, int extraBits, int min, int max) { this.code = code; this.extraBits = extraBits; @@ -185,8 +185,8 @@ void writeShortLSB(ByteArrayOutputStream baos, int theShort) { - byte byte1 = (byte) (theShort & 0xff); - byte byte2 = (byte) ((theShort >> 8) & 0xff); + byte byte1 = cast(byte) (theShort & 0xff); + byte byte2 = cast(byte) ((theShort >> 8) & 0xff); byte[] temp = {byte1, byte2}; baos.write(temp, 0, 2); @@ -194,10 +194,10 @@ void writeInt(ByteArrayOutputStream baos, int theInt) { - byte byte1 = (byte) ((theInt >> 24) & 0xff); - byte byte2 = (byte) ((theInt >> 16) & 0xff); - byte byte3 = (byte) ((theInt >> 8) & 0xff); - byte byte4 = (byte) (theInt & 0xff); + byte byte1 = cast(byte) ((theInt >> 24) & 0xff); + byte byte2 = cast(byte) ((theInt >> 16) & 0xff); + byte byte3 = cast(byte) ((theInt >> 8) & 0xff); + byte byte4 = cast(byte) (theInt & 0xff); byte[] temp = {byte1, byte2, byte3, byte4}; baos.write(temp, 0, 4); @@ -229,8 +229,8 @@ buffer |= value << bitCount; bitCount += count; if (bitCount >= 16) { - bytes.write((byte) buffer); - bytes.write((byte) (buffer >>> 8)); + bytes.write(cast(byte) buffer); + bytes.write(cast(byte) (buffer >>> 8)); buffer >>>= 16; bitCount -= 16; } @@ -240,8 +240,8 @@ void alignToByte() { if (bitCount > 0) { - bytes.write((byte) buffer); - if (bitCount > 8) bytes.write((byte) (buffer >>> 8)); + bytes.write(cast(byte) buffer); + if (bitCount > 8) bytes.write(cast(byte) (buffer >>> 8)); } buffer = 0; bitCount = 0; @@ -574,7 +574,7 @@ } // write data header - bytes.write((byte) BFINAL); + bytes.write(cast(byte) BFINAL); writeShortLSB(bytes, blockLength); // LEN writeShortLSB(bytes, blockLength ^ 0xffff); // NLEN (one's complement of LEN) @@ -594,8 +594,8 @@ inLength = input.length; // write zlib header - bytes.write((byte) 0x78); // window size = 0x70 (32768), compression method = 0x08 - bytes.write((byte) 0x9C); // compression level = 0x80 (default), check bits = 0x1C + bytes.write(cast(byte) 0x78); // window size = 0x70 (32768), compression method = 0x08 + bytes.write(cast(byte) 0x9C); // compression level = 0x80 (default), check bits = 0x1C // compute checksum for (int i = 0; i < inLength; i++) { diff -r fb2555104d70 -r 5b53d338c709 dwt/internal/image/PngEncoder.d --- a/dwt/internal/image/PngEncoder.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/internal/image/PngEncoder.d Fri Aug 29 22:04:22 2008 +0200 @@ -22,12 +22,12 @@ final class PngEncoder : Object { - static final byte SIGNATURE[] = {(byte) '\211', (byte) 'P', (byte) 'N', (byte) 'G', (byte) '\r', (byte) '\n', (byte) '\032', (byte) '\n'}; - static final byte TAG_IHDR[] = {(byte) 'I', (byte) 'H', (byte) 'D', (byte) 'R'}; - static final byte TAG_PLTE[] = {(byte) 'P', (byte) 'L', (byte) 'T', (byte) 'E'}; - static final byte TAG_TRNS[] = {(byte) 't', (byte) 'R', (byte) 'N', (byte) 'S'}; - static final byte TAG_IDAT[] = {(byte) 'I', (byte) 'D', (byte) 'A', (byte) 'T'}; - static final byte TAG_IEND[] = {(byte) 'I', (byte) 'E', (byte) 'N', (byte) 'D'}; + static final byte SIGNATURE[] = {cast(byte) '\211', cast(byte) 'P', cast(byte) 'N', cast(byte) 'G', cast(byte) '\r', cast(byte) '\n', cast(byte) '\032', cast(byte) '\n'}; + static final byte TAG_IHDR[] = {cast(byte) 'I', cast(byte) 'H', cast(byte) 'D', cast(byte) 'R'}; + static final byte TAG_PLTE[] = {cast(byte) 'P', cast(byte) 'L', cast(byte) 'T', cast(byte) 'E'}; + static final byte TAG_TRNS[] = {cast(byte) 't', cast(byte) 'R', cast(byte) 'N', cast(byte) 'S'}; + static final byte TAG_IDAT[] = {cast(byte) 'I', cast(byte) 'D', cast(byte) 'A', cast(byte) 'T'}; + static final byte TAG_IEND[] = {cast(byte) 'I', cast(byte) 'E', cast(byte) 'N', cast(byte) 'D'}; ByteArrayOutputStream bytes = new ByteArrayOutputStream(1024); PngChunk chunk; @@ -42,7 +42,7 @@ int filterMethod = 0; int interlaceMethod = 0; -public PngEncoder(ImageLoader loader) { +public this(ImageLoader loader) { this.loader = loader; this.data = loader.data[0]; @@ -70,8 +70,8 @@ void writeShort(ByteArrayOutputStream baos, int theShort) { - byte byte1 = (byte) ((theShort >> 8) & 0xff); - byte byte2 = (byte) (theShort & 0xff); + byte byte1 = cast(byte) ((theShort >> 8) & 0xff); + byte byte2 = cast(byte) (theShort & 0xff); byte[] temp = {byte1, byte2}; baos.write(temp, 0, 2); @@ -79,10 +79,10 @@ void writeInt(ByteArrayOutputStream baos, int theInt) { - byte byte1 = (byte) ((theInt >> 24) & 0xff); - byte byte2 = (byte) ((theInt >> 16) & 0xff); - byte byte3 = (byte) ((theInt >> 8) & 0xff); - byte byte4 = (byte) (theInt & 0xff); + byte byte1 = cast(byte) ((theInt >> 24) & 0xff); + byte byte2 = cast(byte) ((theInt >> 16) & 0xff); + byte byte3 = cast(byte) ((theInt >> 8) & 0xff); + byte byte4 = cast(byte) (theInt & 0xff); byte[] temp = {byte1, byte2, byte3, byte4}; baos.write(temp, 0, 4); @@ -140,9 +140,9 @@ for (int i = 0; i < RGBs.length; i++) { - baos.write((byte) RGBs[i].red); - baos.write((byte) RGBs[i].green); - baos.write((byte) RGBs[i].blue); + baos.write(cast(byte) RGBs[i].red); + baos.write(cast(byte) RGBs[i].green); + baos.write(cast(byte) RGBs[i].blue); } @@ -169,7 +169,7 @@ pixelValue = data.getPixel(x, y); alphaValue = data.getAlpha(x, y); - alphas[pixelValue] = (byte) alphaValue; + alphas[pixelValue] = cast(byte) alphaValue; } @@ -211,11 +211,11 @@ for (int i = 0; i < pixel; i++) { - padding[i] = (byte) 255; + padding[i] = cast(byte) 255; } - padding[pixel] = (byte) 0; + padding[pixel] = cast(byte) 0; baos.write(padding, 0, padding.length); @@ -229,7 +229,7 @@ } -void writeImageData() throws IOException { +void writeImageData() { ByteArrayOutputStream baos = new ByteArrayOutputStream(1024); OutputStream os = Compatibility.newDeflaterOutputStream(baos); diff -r fb2555104d70 -r 5b53d338c709 dwt/internal/image/PngHuffmanTable.d --- a/dwt/internal/image/PngHuffmanTable.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/internal/image/PngHuffmanTable.d Fri Aug 29 22:04:22 2008 +0200 @@ -20,7 +20,7 @@ static final int BAD_CODE = 0xFFFFFFF; static final int incs[] = {1391376, 463792, 198768, 86961, 33936, 13776, 4592, 1968, 861, 336, 112, 48, 21, 7, 3, 1}; -PngHuffmanTable (int[] lengths) { +this (int[] lengths) { super(); initialize(lengths); generateTable(lengths); @@ -91,7 +91,7 @@ } } -int getNextValue(PngDecodingDataStream stream) throws IOException { +int getNextValue(PngDecodingDataStream stream) { int code = stream.getNextIdatBit(); int codelength = 0; diff -r fb2555104d70 -r 5b53d338c709 dwt/internal/image/PngHuffmanTables.d --- a/dwt/internal/image/PngHuffmanTables.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/internal/image/PngHuffmanTables.d Fri Aug 29 22:04:22 2008 +0200 @@ -47,7 +47,7 @@ 11, 4, 12, 3, 13, 2, 14, 1, 15 }; -static PngHuffmanTables getDynamicTables(PngDecodingDataStream stream) throws IOException { +static PngHuffmanTables getDynamicTables(PngDecodingDataStream stream) { return new PngHuffmanTables(stream); } static PngHuffmanTables getFixedTables() { @@ -68,12 +68,12 @@ return FixedDistanceTable; } -private PngHuffmanTables () { +private this () { literalTable = getFixedLiteralTable(); distanceTable = getFixedDistanceTable(); } -private PngHuffmanTables (PngDecodingDataStream stream) throws IOException { +private this (PngDecodingDataStream stream) { int literals = PngLzBlockReader.FIRST_LENGTH_CODE + stream.getNextIdatBits(5); int distances = PngLzBlockReader.FIRST_DISTANCE_CODE @@ -111,7 +111,7 @@ private int [] readLengths (PngDecodingDataStream stream, int numLengths, PngHuffmanTable lengthsTable, - int tableSize) throws IOException + int tableSize) { int[] lengths = new int[tableSize]; @@ -149,11 +149,11 @@ return lengths; } -int getNextLiteralValue(PngDecodingDataStream stream) throws IOException { +int getNextLiteralValue(PngDecodingDataStream stream) { return literalTable.getNextValue(stream); } -int getNextDistanceValue(PngDecodingDataStream stream) throws IOException { +int getNextDistanceValue(PngDecodingDataStream stream) { return distanceTable.getNextValue(stream); } diff -r fb2555104d70 -r 5b53d338c709 dwt/internal/image/PngIdatChunk.d --- a/dwt/internal/image/PngIdatChunk.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/internal/image/PngIdatChunk.d Fri Aug 29 22:04:22 2008 +0200 @@ -21,7 +21,7 @@ static final int HEADER_BYTE2_DATA_OFFSET = DATA_OFFSET + 1; static final int ADLER_DATA_OFFSET = DATA_OFFSET + 2; // plus variable compressed data length -PngIdatChunk(byte headerByte1, byte headerByte2, byte[] data, int adler) { +this(byte headerByte1, byte headerByte2, byte[] data, int adler) { super(data.length + HEADER_BYTES_LENGTH + ADLER_FIELD_LENGTH); setType(TYPE_IDAT); reference[HEADER_BYTE1_DATA_OFFSET] = headerByte1; @@ -31,7 +31,7 @@ setCRC(computeCRC()); } -PngIdatChunk(byte[] reference) { +this(byte[] reference) { super(reference); } diff -r fb2555104d70 -r 5b53d338c709 dwt/internal/image/PngIendChunk.d --- a/dwt/internal/image/PngIendChunk.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/internal/image/PngIendChunk.d Fri Aug 29 22:04:22 2008 +0200 @@ -15,13 +15,13 @@ class PngIendChunk : PngChunk { -PngIendChunk() { +this() { super(0); setType(TYPE_IEND); setCRC(computeCRC()); } -PngIendChunk(byte[] reference){ +this(byte[] reference){ super(reference); } diff -r fb2555104d70 -r 5b53d338c709 dwt/internal/image/PngIhdrChunk.d --- a/dwt/internal/image/PngIhdrChunk.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/internal/image/PngIhdrChunk.d Fri Aug 29 22:04:22 2008 +0200 @@ -47,7 +47,7 @@ int width, height; byte bitDepth, colorType, compressionMethod, filterMethod, interlaceMethod; -PngIhdrChunk(int width, int height, byte bitDepth, byte colorType, byte compressionMethod, byte filterMethod, byte interlaceMethod) { +this(int width, int height, byte bitDepth, byte colorType, byte compressionMethod, byte filterMethod, byte interlaceMethod) { super(IHDR_DATA_LENGTH); setType(TYPE_IHDR); setWidth(width); @@ -64,7 +64,7 @@ * Construct a PNGChunk using the reference bytes * given. */ -PngIhdrChunk(byte[] reference) { +this(byte[] reference) { super(reference); if (reference.length <= IHDR_DATA_LENGTH) DWT.error(DWT.ERROR_INVALID_IMAGE); width = getInt32(WIDTH_DATA_OFFSET); diff -r fb2555104d70 -r 5b53d338c709 dwt/internal/image/PngInputStream.d --- a/dwt/internal/image/PngInputStream.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/internal/image/PngInputStream.d Fri Aug 29 22:04:22 2008 +0200 @@ -20,14 +20,14 @@ final static int DATA_OFFSET = 8; -public PngInputStream(PngIdatChunk chunk, PngChunkReader reader) { +public this(PngIdatChunk chunk, PngChunkReader reader) { this.chunk = chunk; this.reader = reader; length = chunk.getLength(); offset = 0; } -private bool checkChunk() throws IOException { +private bool checkChunk() { while (offset is length) { chunk = reader.readNextChunk(); if (chunk is null) throw new IOException(); @@ -39,11 +39,11 @@ return true; } -public void close() throws IOException { +public void close() { chunk = null; } -public int read() throws IOException { +public int read() { if (chunk is null) throw new IOException(); if (offset is length && !checkChunk()) return -1; int b = chunk.reference[DATA_OFFSET + offset] & 0xFF; @@ -51,7 +51,7 @@ return b; } -public int read(byte[] b, int off, int len) throws IOException { +public int read(byte[] b, int off, int len) { if (chunk is null) throw new IOException(); if (offset is length && !checkChunk()) return -1; len = Math.min(len, length - offset); diff -r fb2555104d70 -r 5b53d338c709 dwt/internal/image/PngLzBlockReader.d --- a/dwt/internal/image/PngLzBlockReader.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/internal/image/PngLzBlockReader.d Fri Aug 29 22:04:22 2008 +0200 @@ -55,7 +55,7 @@ }; -PngLzBlockReader(PngDecodingDataStream stream) { +this(PngDecodingDataStream stream) { this.stream = stream; isLastBlock = false; } @@ -64,9 +64,9 @@ window = new byte[windowSize]; } -void readNextBlockHeader() throws IOException { +void readNextBlockHeader() { isLastBlock = stream.getNextIdatBit() !is 0; - compressionType = (byte)(stream.getNextIdatBits(2) & 0xFF); + compressionType = cast(byte)(stream.getNextIdatBits(2) & 0xFF); if (compressionType > 2) stream.error(); if (compressionType is UNCOMPRESSED) { @@ -83,7 +83,7 @@ } } -byte getNextByte() throws IOException { +byte getNextByte() { if (compressionType is UNCOMPRESSED) { if (uncompressedBytesRemaining is 0) { readNextBlockHeader(); @@ -103,7 +103,7 @@ } } -private void assertBlockAtEnd() throws IOException { +private void assertBlockAtEnd() { if (compressionType is UNCOMPRESSED) { if (uncompressedBytesRemaining > 0) stream.error(); } else if (copyBytesRemaining > 0 || @@ -112,7 +112,7 @@ stream.error(); } } -void assertCompressedDataAtEnd() throws IOException { +void assertCompressedDataAtEnd() { assertBlockAtEnd(); while (!isLastBlock) { readNextBlockHeader(); @@ -120,7 +120,7 @@ } } -private byte getNextCompressedByte() throws IOException { +private byte getNextCompressedByte() { if (copyBytesRemaining > 0) { byte value = window[copyIndex]; window[windowIndex] = value; @@ -136,10 +136,10 @@ int value = huffmanTables.getNextLiteralValue(stream); if (value < END_OF_COMPRESSED_BLOCK) { - window[windowIndex] = (byte) (value & 0xFF); + window[windowIndex] = cast(byte) (value & 0xFF); windowIndex++; if (windowIndex >= window.length) windowIndex = 0; - return (byte) (value & 0xFF); + return cast(byte) (value & 0xFF); } else if (value is END_OF_COMPRESSED_BLOCK) { readNextBlockHeader(); return getNextByte(); diff -r fb2555104d70 -r 5b53d338c709 dwt/internal/image/PngPlteChunk.d --- a/dwt/internal/image/PngPlteChunk.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/internal/image/PngPlteChunk.d Fri Aug 29 22:04:22 2008 +0200 @@ -19,7 +19,7 @@ int paletteSize; -PngPlteChunk(PaletteData palette) { +this(PaletteData palette) { super(palette.getRGBs().length * 3); paletteSize = length / 3; setType(TYPE_PLTE); @@ -27,7 +27,7 @@ setCRC(computeCRC()); } -PngPlteChunk(byte[] reference){ +this(byte[] reference){ super(reference); paletteSize = length / 3; } @@ -71,9 +71,9 @@ RGB[] rgbs = palette.getRGBs(); for (int i = 0; i < rgbs.length; i++) { int offset = DATA_OFFSET + (i * 3); - reference[offset] = (byte) rgbs[i].red; - reference[offset + 1] = (byte) rgbs[i].green; - reference[offset + 2] = (byte) rgbs[i].blue; + reference[offset] = cast(byte) rgbs[i].red; + reference[offset + 1] = cast(byte) rgbs[i].green; + reference[offset + 2] = cast(byte) rgbs[i].blue; } } diff -r fb2555104d70 -r 5b53d338c709 dwt/internal/image/PngTrnsChunk.d --- a/dwt/internal/image/PngTrnsChunk.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/internal/image/PngTrnsChunk.d Fri Aug 29 22:04:22 2008 +0200 @@ -19,7 +19,7 @@ static final int TRANSPARENCY_TYPE_ALPHAS = 1; static final int RGB_DATA_LENGTH = 6; -PngTrnsChunk(RGB rgb) { +this(RGB rgb) { super(RGB_DATA_LENGTH); setType(TYPE_tRNS); setInt16(DATA_OFFSET, rgb.red); @@ -28,7 +28,7 @@ setCRC(computeCRC()); } -PngTrnsChunk(byte[] reference){ +this(byte[] reference){ super(reference); } @@ -40,11 +40,11 @@ bool valid; switch (header.getColorType()) { case PngIhdrChunk.COLOR_TYPE_RGB: - // Three 2-byte values (RGB) + // Three 2-byte values cast(RGB) valid = getLength() is 6; break; case PngIhdrChunk.COLOR_TYPE_PALETTE: - // Three 2-byte values (RGB) + // Three 2-byte values cast(RGB) valid = getLength() <= paletteChunk.getLength(); break; case PngIhdrChunk.COLOR_TYPE_GRAYSCALE: @@ -147,7 +147,7 @@ * alpha of 255. */ for (int j = i; j < alphas.length; j++) { - alphas[j] = (byte) 255; + alphas[j] = cast(byte) 255; } return alphas; } diff -r fb2555104d70 -r 5b53d338c709 dwt/internal/image/TIFFDirectory.d --- a/dwt/internal/image/TIFFDirectory.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/internal/image/TIFFDirectory.d Fri Aug 29 22:04:22 2008 +0200 @@ -74,13 +74,13 @@ static final int IFD_ENTRY_SIZE = 12; -public TIFFDirectory(TIFFRandomFileAccess file, bool isLittleEndian, ImageLoader loader) { +public this(TIFFRandomFileAccess file, bool isLittleEndian, ImageLoader loader) { this.file = file; this.isLittleEndian = isLittleEndian; this.loader = loader; } -public TIFFDirectory(ImageData image) { +public this(ImageData image) { this.image = image; } @@ -115,7 +115,7 @@ return toInt(buffer, index + 8, type); } -void getEntryValue(int type, byte[] buffer, int index, int[] values) throws IOException { +void getEntryValue(int type, byte[] buffer, int index, int[] values) { int start = index + 8; int size; int offset = toInt(buffer, start, TYPE_LONG); @@ -138,7 +138,7 @@ } } -void decodePixels(ImageData image) throws IOException { +void decodePixels(ImageData image) { /* Each row is byte aligned */ byte[] imageData = new byte[(imageWidth * depth + 7) / 8 * imageLength]; image.data = imageData; @@ -169,7 +169,7 @@ } } -PaletteData getColorMap() throws IOException { +PaletteData getColorMap() { int numColors = 1 << bitsPerSample[0]; /* R, G, B entries are 16 bit wide (2 bytes) */ int numBytes = 3 * 2 * numColors; @@ -298,7 +298,7 @@ return colorMap; } -void parseEntries(byte[] buffer) throws IOException { +void parseEntries(byte[] buffer) { for (int offset = 0; offset < buffer.length; offset += IFD_ENTRY_SIZE) { int tag = toInt(buffer, offset, TYPE_SHORT); int type = toInt(buffer, offset + 2, TYPE_SHORT); @@ -379,7 +379,7 @@ } } -public ImageData read() throws IOException { +public ImageData read() { /* Set TIFF default values */ bitsPerSample = new int[] {1}; colorMapOffset = NO_VALUE; @@ -466,7 +466,7 @@ return -1; } -void write(int photometricInterpretation) throws IOException { +void write(int photometricInterpretation) { bool isRGB = photometricInterpretation is 2; bool isColorMap = photometricInterpretation is 3; bool isBiLevel = photometricInterpretation is 0 || photometricInterpretation is 1; @@ -567,14 +567,14 @@ out.write(data); } -void writeEntry(short tag, int type, int count, int value) throws IOException { +void writeEntry(short tag, int type, int count, int value) { out.writeShort(tag); out.writeShort(type); out.writeInt(count); out.writeInt(value); } -void writeHeader() throws IOException { +void writeHeader() { /* little endian */ out.write(0x49); out.write(0x49); @@ -588,7 +588,7 @@ out.writeInt(8); } -void writeToStream(LEDataOutputStream byteStream) throws IOException { +void writeToStream(LEDataOutputStream byteStream) { out = byteStream; int photometricInterpretation = -1; diff -r fb2555104d70 -r 5b53d338c709 dwt/internal/image/TIFFModifiedHuffmanCodec.d --- a/dwt/internal/image/TIFFModifiedHuffmanCodec.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/internal/image/TIFFModifiedHuffmanCodec.d Fri Aug 29 22:04:22 2008 +0200 @@ -192,8 +192,8 @@ int n = cnt; while (bitOffsetDest > 0 && bitOffsetDest <= 7 && n > 0) { dest[byteOffsetDest] = value is 1 ? - (byte)(dest[byteOffsetDest] | (1 << (7 - bitOffsetDest))) : - (byte)(dest[byteOffsetDest] & ~(1 << (7 - bitOffsetDest))); + cast(byte)(dest[byteOffsetDest] | (1 << (7 - bitOffsetDest))) : + cast(byte)(dest[byteOffsetDest] & ~(1 << (7 - bitOffsetDest))); n--; bitOffsetDest++; } @@ -202,13 +202,13 @@ bitOffsetDest = 0; } while (n >= 8) { - dest[byteOffsetDest++] = (byte) (value is 1 ? 0xFF : 0); + dest[byteOffsetDest++] = cast(byte) (value is 1 ? 0xFF : 0); n -= 8; } while (n > 0) { dest[byteOffsetDest] = value is 1 ? - (byte)(dest[byteOffsetDest] | (1 << (7 - bitOffsetDest))) : - (byte)(dest[byteOffsetDest] & ~(1 << (7 - bitOffsetDest))); + cast(byte)(dest[byteOffsetDest] | (1 << (7 - bitOffsetDest))) : + cast(byte)(dest[byteOffsetDest] & ~(1 << (7 - bitOffsetDest))); n--; bitOffsetDest++; } diff -r fb2555104d70 -r 5b53d338c709 dwt/internal/image/TIFFRandomFileAccess.d --- a/dwt/internal/image/TIFFRandomFileAccess.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/internal/image/TIFFRandomFileAccess.d Fri Aug 29 22:04:22 2008 +0200 @@ -21,13 +21,13 @@ static final int CHUNK_SIZE = 8192; static final int LIST_SIZE = 128; -public TIFFRandomFileAccess(LEDataInputStream stream) { +public this(LEDataInputStream stream) { inputStream = stream; start = current = next = inputStream.getPosition(); buffers = new byte[LIST_SIZE][]; } -void seek(int pos) throws IOException { +void seek(int pos) { if (pos is current) return; if (pos < start) throw new IOException(); current = pos; @@ -52,7 +52,7 @@ } } -void read(byte b[]) throws IOException { +void read(byte b[]) { int size = b.length; int nCached = Math.min(size, next - current); int nMissing = size - next + current; diff -r fb2555104d70 -r 5b53d338c709 dwt/internal/image/WinBMPFileFormat.d --- a/dwt/internal/image/WinBMPFileFormat.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/internal/image/WinBMPFileFormat.d Fri Aug 29 22:04:22 2008 +0200 @@ -72,7 +72,7 @@ break; default: dest[dp] = 0; dp++; - dest[dp] = (byte)(n + n); dp++; /* n bytes = n*2 pixels */ + dest[dp] = cast(byte)(n + n); dp++; /* n bytes = n*2 pixels */ for (i = n; i > 0; i--) { dest[dp] = src[sp]; dp++; sp++; @@ -95,7 +95,7 @@ if (src[sp + n] !is theByte) break; } - dest[dp] = (byte)(n + n); dp++; /* n bytes = n*2 pixels */ + dest[dp] = cast(byte)(n + n); dp++; /* n bytes = n*2 pixels */ dest[dp] = theByte; dp++; sp += n; size += 2; @@ -147,7 +147,7 @@ break; default: dest[dp] = 0; dp++; - dest[dp] = (byte)n; dp++; + dest[dp] = cast(byte)n; dp++; for (i = n; i > 0; i--) { dest[dp] = src[sp]; dp++; sp++; @@ -170,7 +170,7 @@ if (src[sp + n] !is theByte) break; } - dest[dp] = (byte)n; dp++; + dest[dp] = cast(byte)n; dp++; dest[dp] = theByte; dp++; sp += n; size += 2; @@ -497,9 +497,9 @@ int offset = 0; for (int i = 0; i < n; i++) { RGB col = pal.colors[i]; - bytes[offset] = (byte)col.blue; - bytes[offset + 1] = (byte)col.green; - bytes[offset + 2] = (byte)col.red; + bytes[offset] = cast(byte)col.blue; + bytes[offset + 1] = cast(byte)col.green; + bytes[offset + 2] = cast(byte)col.red; offset += 4; } return bytes; @@ -653,7 +653,7 @@ outputStream.writeInt(image.width); outputStream.writeInt(image.height); outputStream.writeShort(1); - outputStream.writeShort((short)image.depth); + outputStream.writeShort(cast(short)image.depth); outputStream.writeInt(comp); outputStream.writeInt(data.length); outputStream.writeInt(pelsPerMeter.x); diff -r fb2555104d70 -r 5b53d338c709 dwt/internal/image/WinICOFileFormat.d --- a/dwt/internal/image/WinICOFileFormat.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/internal/image/WinICOFileFormat.d Fri Aug 29 22:04:22 2008 +0200 @@ -23,7 +23,7 @@ byte[] bitInvertData(byte[] data, int startIndex, int endIndex) { // Destructively bit invert data in the given byte array. for (int i = startIndex; i < endIndex; i++) { - data[i] = (byte)(255 - data[i - startIndex]); + data[i] = cast(byte)(255 - data[i - startIndex]); } return data; } @@ -208,10 +208,10 @@ if (!((width is infoWidth) && (height * 2 is infoHeight) && (bitCount is 1 || bitCount is 4 || bitCount is 8 || bitCount is 24 || bitCount is 32))) DWT.error(DWT.ERROR_INVALID_IMAGE); - infoHeader[8] = (byte)(height & 0xFF); - infoHeader[9] = (byte)((height >> 8) & 0xFF); - infoHeader[10] = (byte)((height >> 16) & 0xFF); - infoHeader[11] = (byte)((height >> 24) & 0xFF); + infoHeader[8] = cast(byte)(height & 0xFF); + infoHeader[9] = cast(byte)((height >> 8) & 0xFF); + infoHeader[10] = cast(byte)((height >> 16) & 0xFF); + infoHeader[11] = cast(byte)((height >> 24) & 0xFF); return infoHeader; } /** @@ -225,7 +225,7 @@ outputStream.writeInt(icon.width); outputStream.writeInt(icon.height * 2); outputStream.writeShort(1); - outputStream.writeShort((short)icon.depth); + outputStream.writeShort(cast(short)icon.depth); outputStream.writeInt(0); outputStream.writeInt(sizeImage); outputStream.writeInt(0); diff -r fb2555104d70 -r 5b53d338c709 dwt/internal/objc/appkit/NSAttributedString.d diff -r fb2555104d70 -r 5b53d338c709 dwt/internal/objc/appkit/bindings.d diff -r fb2555104d70 -r 5b53d338c709 dwt/internal/objc/bindings.d diff -r fb2555104d70 -r 5b53d338c709 dwt/internal/objc/foundation/bindings.d diff -r fb2555104d70 -r 5b53d338c709 dwt/internal/objc/runtime.d diff -r fb2555104d70 -r 5b53d338c709 dwt/internal/theme/ButtonDrawData.d --- a/dwt/internal/theme/ButtonDrawData.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/internal/theme/ButtonDrawData.d Fri Aug 29 22:04:22 2008 +0200 @@ -12,7 +12,7 @@ public class ButtonDrawData : DrawData { -public ButtonDrawData() { +public this() { state = new int[1]; } diff -r fb2555104d70 -r 5b53d338c709 dwt/internal/theme/ComboDrawData.d --- a/dwt/internal/theme/ComboDrawData.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/internal/theme/ComboDrawData.d Fri Aug 29 22:04:22 2008 +0200 @@ -12,7 +12,7 @@ public class ComboDrawData : DrawData { -public ComboDrawData() { +public this() { state = new int[2]; } diff -r fb2555104d70 -r 5b53d338c709 dwt/internal/theme/DrawData.d --- a/dwt/internal/theme/DrawData.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/internal/theme/DrawData.d Fri Aug 29 22:04:22 2008 +0200 @@ -64,7 +64,7 @@ public static final int COMBO_ARROW = 1; -public DrawData() { +public this() { state = new int[1]; } diff -r fb2555104d70 -r 5b53d338c709 dwt/internal/theme/ExpanderDrawData.d --- a/dwt/internal/theme/ExpanderDrawData.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/internal/theme/ExpanderDrawData.d Fri Aug 29 22:04:22 2008 +0200 @@ -12,7 +12,7 @@ public class ExpanderDrawData : DrawData { -public ExpanderDrawData() { +public this() { state = new int[1]; } diff -r fb2555104d70 -r 5b53d338c709 dwt/internal/theme/GroupDrawData.d --- a/dwt/internal/theme/GroupDrawData.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/internal/theme/GroupDrawData.d Fri Aug 29 22:04:22 2008 +0200 @@ -17,7 +17,7 @@ public int headerHeight; public Rectangle headerArea; -public GroupDrawData() { +public this() { state = new int[1]; } diff -r fb2555104d70 -r 5b53d338c709 dwt/internal/theme/ProgressBarDrawData.d --- a/dwt/internal/theme/ProgressBarDrawData.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/internal/theme/ProgressBarDrawData.d Fri Aug 29 22:04:22 2008 +0200 @@ -12,7 +12,7 @@ public class ProgressBarDrawData : RangeDrawData { -public ProgressBarDrawData() { +public this() { state = new int[1]; } diff -r fb2555104d70 -r 5b53d338c709 dwt/internal/theme/ScaleDrawData.d --- a/dwt/internal/theme/ScaleDrawData.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/internal/theme/ScaleDrawData.d Fri Aug 29 22:04:22 2008 +0200 @@ -14,7 +14,7 @@ public int increment; public int pageIncrement; -public ScaleDrawData() { +public this() { state = new int[4]; } diff -r fb2555104d70 -r 5b53d338c709 dwt/internal/theme/ScrollBarDrawData.d --- a/dwt/internal/theme/ScrollBarDrawData.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/internal/theme/ScrollBarDrawData.d Fri Aug 29 22:04:22 2008 +0200 @@ -15,7 +15,7 @@ public int increment; public int pageIncrement; -public ScrollBarDrawData() { +public this() { state = new int[6]; } diff -r fb2555104d70 -r 5b53d338c709 dwt/internal/theme/TabFolderDrawData.d --- a/dwt/internal/theme/TabFolderDrawData.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/internal/theme/TabFolderDrawData.d Fri Aug 29 22:04:22 2008 +0200 @@ -21,7 +21,7 @@ public int selectedWidth; public int spacing; -public TabFolderDrawData() { +public this() { state = new int[1]; if (DWT.getPlatform().opEquals("gtk")) { spacing = -2; diff -r fb2555104d70 -r 5b53d338c709 dwt/internal/theme/TabItemDrawData.d --- a/dwt/internal/theme/TabItemDrawData.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/internal/theme/TabItemDrawData.d Fri Aug 29 22:04:22 2008 +0200 @@ -16,7 +16,7 @@ public TabFolderDrawData parent; public int position; -public TabItemDrawData() { +public this() { state = new int[1]; } diff -r fb2555104d70 -r 5b53d338c709 dwt/internal/theme/Theme.d --- a/dwt/internal/theme/Theme.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/internal/theme/Theme.d Fri Aug 29 22:04:22 2008 +0200 @@ -16,7 +16,7 @@ public class Theme { Device device; -public Theme(Device device) { +public this(Device device) { this.device = device; } diff -r fb2555104d70 -r 5b53d338c709 dwt/internal/theme/ToolBarDrawData.d --- a/dwt/internal/theme/ToolBarDrawData.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/internal/theme/ToolBarDrawData.d Fri Aug 29 22:04:22 2008 +0200 @@ -12,7 +12,7 @@ public class ToolBarDrawData : DrawData { -public ToolBarDrawData() { +public this() { state = new int[1]; } diff -r fb2555104d70 -r 5b53d338c709 dwt/internal/theme/ToolItemDrawData.d --- a/dwt/internal/theme/ToolItemDrawData.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/internal/theme/ToolItemDrawData.d Fri Aug 29 22:04:22 2008 +0200 @@ -14,7 +14,7 @@ public ToolBarDrawData parent; -public ToolItemDrawData() { +public this() { state = new int[2]; } diff -r fb2555104d70 -r 5b53d338c709 dwt/layout/FillLayout.d --- a/dwt/layout/FillLayout.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/layout/FillLayout.d Fri Aug 29 22:04:22 2008 +0200 @@ -46,7 +46,7 @@ * *

    */ -public final class FillLayout extends Layout { +public final class FillLayout : Layout { /** * type specifies how controls will be positioned * within the layout. @@ -93,7 +93,7 @@ /** * Constructs a new instance of this class. */ -public FillLayout () { +public this () { } /** @@ -103,7 +103,7 @@ * * @since 2.0 */ -public FillLayout (int type) { +public this (int type) { this.type = type; } @@ -144,7 +144,7 @@ } Point computeChildSize (Control control, int wHint, int hHint, bool flushCache) { - FillData data = (FillData)control.getLayoutData (); + FillData data = cast(FillData)control.getLayoutData (); if (data is null) { data = new FillData (); control.setLayoutData (data); @@ -155,8 +155,8 @@ } else { // TEMPORARY CODE int trimX, trimY; - if (control instanceof Scrollable) { - Rectangle rect = ((Scrollable) control).computeTrim (0, 0, 0, 0); + if ( null !is cast(Scrollable)control ) { + Rectangle rect = (cast(Scrollable) control).computeTrim (0, 0, 0, 0); trimX = rect.width; trimY = rect.height; } else { @@ -171,7 +171,7 @@ protected bool flushCache (Control control) { Object data = control.getLayoutData(); - if (data !is null) ((FillData)data).flushCache(); + if (data !is null) (cast(FillData)data).flushCache(); return true; } diff -r fb2555104d70 -r 5b53d338c709 dwt/layout/FormAttachment.d --- a/dwt/layout/FormAttachment.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/layout/FormAttachment.d Fri Aug 29 22:04:22 2008 +0200 @@ -140,7 +140,7 @@ * * @since 3.2 */ -public FormAttachment () { +public this () { } /** @@ -153,7 +153,7 @@ * * @since 3.0 */ -public FormAttachment (int numerator) { +public this (int numerator) { this (numerator, 100, 0); } @@ -166,7 +166,7 @@ * @param numerator the percentage of the position * @param offset the offset of the side from the position */ -public FormAttachment (int numerator, int offset) { +public this (int numerator, int offset) { this (numerator, 100, offset); } @@ -180,7 +180,7 @@ * @param denominator the denominator of the position * @param offset the offset of the side from the position */ -public FormAttachment (int numerator, int denominator, int offset) { +public this (int numerator, int denominator, int offset) { if (denominator is 0) DWT.error (DWT.ERROR_CANNOT_BE_ZERO); this.numerator = numerator; this.denominator = denominator; @@ -196,7 +196,7 @@ * * @param control the control the side is attached to */ -public FormAttachment (Control control) { +public this (Control control) { this (control, 0, DWT.DEFAULT); } @@ -209,7 +209,7 @@ * @param control the control the side is attached to * @param offset the offset of the side from the control */ -public FormAttachment (Control control, int offset) { +public this (Control control, int offset) { this (control, offset, DWT.DEFAULT); } @@ -221,7 +221,7 @@ * @param offset the offset of the side from the control * @param alignment the alignment of the side to the control it is attached to */ -public FormAttachment (Control control, int offset, int alignment) { +public this (Control control, int offset, int alignment) { this.control = control; this.offset = offset; this.alignment = alignment; diff -r fb2555104d70 -r 5b53d338c709 dwt/layout/FormData.d --- a/dwt/layout/FormData.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/layout/FormData.d Fri Aug 29 22:04:22 2008 +0200 @@ -95,7 +95,7 @@ * Constructs a new instance of FormData using * default values. */ -public FormData () { +public this () { } /** @@ -106,7 +106,7 @@ * @param width a minimum width for the control * @param height a minimum height for the control */ -public FormData (int width, int height) { +public this (int width, int height) { this.width = width; this.height = height; } @@ -172,7 +172,7 @@ } if (bottomControl is null) return cacheBottom = bottom; isVisited = true; - FormData bottomData = (FormData) bottomControl.getLayoutData (); + FormData bottomData = cast(FormData) bottomControl.getLayoutData (); FormAttachment bottomAttachment = bottomData.getBottomAttachment (bottomControl, spacing, flushCache); switch (bottom.alignment) { case DWT.BOTTOM: @@ -213,7 +213,7 @@ } if (leftControl is null) return cacheLeft = left; isVisited = true; - FormData leftData = (FormData) leftControl.getLayoutData (); + FormData leftData = cast(FormData) leftControl.getLayoutData (); FormAttachment leftAttachment = leftData.getLeftAttachment (leftControl, spacing, flushCache); switch (left.alignment) { case DWT.LEFT: @@ -260,7 +260,7 @@ } if (rightControl is null) return cacheRight = right; isVisited = true; - FormData rightData = (FormData) rightControl.getLayoutData (); + FormData rightData = cast(FormData) rightControl.getLayoutData (); FormAttachment rightAttachment = rightData.getRightAttachment (rightControl, spacing, flushCache); switch (right.alignment) { case DWT.RIGHT: @@ -301,7 +301,7 @@ } if (topControl is null) return cacheTop = top; isVisited = true; - FormData topData = (FormData) topControl.getLayoutData (); + FormData topData = cast(FormData) topControl.getLayoutData (); FormAttachment topAttachment = topData.getTopAttachment (topControl, spacing, flushCache); switch (top.alignment) { case DWT.TOP: diff -r fb2555104d70 -r 5b53d338c709 dwt/layout/FormLayout.d --- a/dwt/layout/FormLayout.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/layout/FormLayout.d Fri Aug 29 22:04:22 2008 +0200 @@ -90,7 +90,7 @@ * @since 2.0 * */ -public final class FormLayout extends Layout { +public final class FormLayout : Layout { /** * marginWidth specifies the number of pixels of horizontal margin @@ -162,25 +162,25 @@ /** * Constructs a new instance of this class. */ -public FormLayout () { +public this () { } /* * Computes the preferred height of the form with * respect to the preferred height of the control. * - * Given that the equations for top (T) and bottom (B) - * of the control in terms of the height of the form (X) + * Given that the equations for top cast(T) and bottom cast(B) + * of the control in terms of the height of the form cast(X) * are: * T = AX + B * B = CX + D * - * The equation for the height of the control (H) - * is bottom (B) minus top (T) or (H = B - T) or: + * The equation for the height of the control cast(H) + * is bottom cast(B) minus top cast(T) or (H = B - T) or: * * H = (CX + D) - (AX + B) * - * Solving for (X), the height of the form, we get: + * Solving for cast(X), the height of the form, we get: * * X = (H + B - D) / (C - A) * @@ -188,7 +188,7 @@ * solution for X. This is a special case meaning that * the control does not constrain the height of the * form. In this case, we need to arbitrarily define - * the height of the form (X): + * the height of the form cast(X): * * Case 1: A = C, A = 0, C = 0 * @@ -250,7 +250,7 @@ protected bool flushCache (Control control) { Object data = control.getLayoutData (); - if (data !is null) ((FormData) data).flushCache (); + if (data !is null) (cast(FormData) data).flushCache (); return true; } @@ -294,7 +294,7 @@ Control [] children = composite.getChildren (); for (int i=0; i currentWidth)) { int trim = 0; - if (child instanceof Scrollable) { - Rectangle rect = ((Scrollable) child).computeTrim (0, 0, 0, 0); + if ( null !is cast(Scrollable)child ) { + Rectangle rect = (cast(Scrollable) child).computeTrim (0, 0, 0, 0); trim = rect.width; } else { trim = child.getBorderWidth () * 2; diff -r fb2555104d70 -r 5b53d338c709 dwt/layout/RowData.d --- a/dwt/layout/RowData.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/layout/RowData.d Fri Aug 29 22:04:22 2008 +0200 @@ -73,7 +73,7 @@ * Constructs a new instance of RowData using * default values. */ -public RowData () { +public this () { } /** @@ -84,7 +84,7 @@ * @param width a minimum width for the control * @param height a minimum height for the control */ -public RowData (int width, int height) { +public this (int width, int height) { this.width = width; this.height = height; } @@ -97,7 +97,7 @@ * @param point a point whose x coordinate specifies a minimum width for the control * and y coordinate specifies a minimum height for the control */ -public RowData (Point point) { +public this (Point point) { this (point.x, point.y); } diff -r fb2555104d70 -r 5b53d338c709 dwt/layout/RowLayout.d --- a/dwt/layout/RowLayout.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/layout/RowLayout.d Fri Aug 29 22:04:22 2008 +0200 @@ -57,7 +57,7 @@ * * @see RowData */ -public final class RowLayout extends Layout { +public final class RowLayout : Layout { /** * type specifies whether the layout places controls in rows or @@ -186,7 +186,7 @@ /** * Constructs a new instance of this class. */ -public RowLayout () { +public this () { } /** @@ -196,7 +196,7 @@ * * @since 2.0 */ -public RowLayout (int type) { +public this (int type) { this.type = type; } @@ -214,7 +214,7 @@ Point computeSize (Control control, bool flushCache) { int wHint = DWT.DEFAULT, hHint = DWT.DEFAULT; - RowData data = (RowData) control.getLayoutData (); + RowData data = cast(RowData) control.getLayoutData (); if (data !is null) { wHint = data.width; hHint = data.height; @@ -247,7 +247,7 @@ int count = 0; for (int i=0; iERROR_UNSUPPORTED_DEPTH when the requested attributes cannot be provided * */ -public GLCanvas (Composite parent, int style, GLData data) { +public this (Composite parent, int style, GLData data) { super (parent, style); if (data is null) DWT.error (DWT.ERROR_NULL_ARGUMENT); int attrib [] = new int [MAX_ATTRIBUTES]; @@ -105,14 +105,14 @@ attrib [pos++] = data.samples; } attrib [pos++] = 0; - pixelFormat = (NSOpenGLPixelFormat)new NSOpenGLPixelFormat().alloc(); + pixelFormat = cast(NSOpenGLPixelFormat)new NSOpenGLPixelFormat().alloc(); if (pixelFormat is null) { dispose (); DWT.error (DWT.ERROR_UNSUPPORTED_DEPTH); } pixelFormat.initWithAttributes(attrib); - glView = (NSOpenGLView)new NSOpenGLView().alloc(); + glView = cast(NSOpenGLView)new NSOpenGLView().alloc(); if (glView is null) { dispose (); DWT.error (DWT.ERROR_UNSUPPORTED_DEPTH); diff -r fb2555104d70 -r 5b53d338c709 dwt/printing/PrintDialog.d --- a/dwt/printing/PrintDialog.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/printing/PrintDialog.d Fri Aug 29 22:04:22 2008 +0200 @@ -29,7 +29,7 @@ * within the DWT implementation. *

    */ -public class PrintDialog extends Dialog { +public class PrintDialog : Dialog { PrinterData printerData; int scope = PrinterData.ALL_PAGES; int startPage = 1, endPage = 1; @@ -52,7 +52,7 @@ * @see Widget#checkSubclass * @see Widget#getStyle */ -public PrintDialog (Shell parent) { +public this (Shell parent) { this (parent, DWT.PRIMARY_MODAL); } @@ -84,7 +84,7 @@ * @see Widget#checkSubclass * @see Widget#getStyle */ -public PrintDialog (Shell parent, int style) { +public this (Shell parent, int style) { super (parent, style); checkSubclass (); } @@ -126,7 +126,7 @@ */ public PrinterData open() { NSPrintPanel panel = NSPrintPanel.printPanel(); - NSPrintInfo printInfo =(NSPrintInfo)new NSPrintInfo().alloc(); + NSPrintInfo printInfo =cast(NSPrintInfo)new NSPrintInfo().alloc(); printInfo.initWithDictionary(null); panel.runModalWithPrintInfo(printInfo); printInfo.release(); @@ -139,7 +139,7 @@ // if (OS.PMCreatePageFormat(buffer) is OS.noErr) { // int pageFormat = buffer[0]; // OS.PMSessionDefaultPageFormat(printSession, pageFormat); -// OS.PMSessionSetDestination(printSession, printSettings, (short) (printToFile ? OS.kPMDestinationFile : OS.kPMDestinationPrinter), 0, 0); +// OS.PMSessionSetDestination(printSession, printSettings, cast(short) (printToFile ? OS.kPMDestinationFile : OS.kPMDestinationPrinter), 0, 0); // if (scope is PrinterData.PAGE_RANGE) { // OS.PMSetFirstPage(printSettings, startPage, false); // OS.PMSetLastPage(printSettings, endPage, false); diff -r fb2555104d70 -r 5b53d338c709 dwt/printing/Printer.d --- a/dwt/printing/Printer.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/printing/Printer.d Fri Aug 29 22:04:22 2008 +0200 @@ -44,7 +44,7 @@ * @see PrinterData * @see PrintDialog */ -public final class Printer extends Device { +public final class Printer : Device { PrinterData data; NSPrinter printer; bool inPage, isGCCreated; @@ -91,10 +91,10 @@ } //static int packData(int handle, byte[] buffer, int offset) { // int length = OS.GetHandleSize (handle); -// buffer[offset++] = (byte)((length & 0xFF) >> 0); -// buffer[offset++] = (byte)((length & 0xFF00) >> 8); -// buffer[offset++] = (byte)((length & 0xFF0000) >> 16); -// buffer[offset++] = (byte)((length & 0xFF000000) >> 24); +// buffer[offset++] = cast(byte)((length & 0xFF) >> 0); +// buffer[offset++] = cast(byte)((length & 0xFF00) >> 8); +// buffer[offset++] = cast(byte)((length & 0xFF0000) >> 16); +// buffer[offset++] = cast(byte)((length & 0xFF000000) >> 24); // int [] ptr = new int [1]; // OS.HLock(handle); // OS.memmove(ptr, handle, 4); @@ -134,7 +134,7 @@ * * @see Device#dispose */ -public Printer() { +public this() { this(null); } @@ -156,7 +156,7 @@ * * @see Device#dispose */ -public Printer(PrinterData data) { +public this(PrinterData data) { super (checkNull(data)); } @@ -197,7 +197,7 @@ // PMRect paperRect = new PMRect(); // OS.PMGetAdjustedPageRect(pageFormat, pageRect); // OS.PMGetAdjustedPaperRect(pageFormat, paperRect); -// return new Rectangle(x+(int)paperRect.left, y+(int)paperRect.top, width+(int)(paperRect.right-pageRect.right), height+(int)(paperRect.bottom-pageRect.bottom)); +// return new Rectangle(x+cast(int)paperRect.left, y+cast(int)paperRect.top, width+cast(int)(paperRect.right-pageRect.right), height+cast(int)(paperRect.bottom-pageRect.bottom)); return null; } @@ -208,7 +208,7 @@ * @param deviceData the device data */ protected void create(DeviceData deviceData) { - data = (PrinterData)deviceData; + data = cast(PrinterData)deviceData; printer = NSPrinter.static_printerWithName_(NSString.stringWith(data.name)); printer.retain(); @@ -247,7 +247,7 @@ // } // // if (PREVIEW_DRIVER.equals(data.driver)) { -// OS.PMSessionSetDestination(printSession, printSettings, (short) OS.kPMDestinationPreview, 0, 0); +// OS.PMSessionSetDestination(printSession, printSettings, cast(short) OS.kPMDestinationPreview, 0, 0); // } // String name = data.name; // char[] buffer1 = new char[name.length ()]; @@ -304,10 +304,10 @@ // PMRect paperRect= new PMRect(); // OS.PMGetAdjustedPaperRect(pageFormat, paperRect); // Rect portRect = new Rect(); -// portRect.left = (short)paperRect.left; -// portRect.right = (short)paperRect.right; -// portRect.top = (short)paperRect.top; -// portRect.bottom = (short)paperRect.bottom; +// portRect.left = cast(short)paperRect.left; +// portRect.right = cast(short)paperRect.right; +// portRect.top = cast(short)paperRect.top; +// portRect.bottom = cast(short)paperRect.bottom; // data.portRect = portRect; // isGCCreated = true; // } @@ -491,7 +491,7 @@ checkDevice(); // PMResolution resolution = new PMResolution(); // OS.PMGetResolution(pageFormat, resolution); -// return new Point((int)resolution.hRes, (int)resolution.vRes); +// return new Point(cast(int)resolution.hRes, cast(int)resolution.vRes); return null; } @@ -512,7 +512,7 @@ checkDevice(); // PMRect paperRect = new PMRect(); // OS.PMGetAdjustedPaperRect(pageFormat, paperRect); -// return new Rectangle(0, 0, (int)(paperRect.right-paperRect.left), (int)(paperRect.bottom-paperRect.top)); +// return new Rectangle(0, 0, cast(int)(paperRect.right-paperRect.left), cast(int)(paperRect.bottom-paperRect.top)); return null; } @@ -535,7 +535,7 @@ checkDevice(); // PMRect pageRect = new PMRect(); // OS.PMGetAdjustedPageRect(pageFormat, pageRect); -// return new Rectangle(0, 0, (int)(pageRect.right-pageRect.left), (int)(pageRect.bottom-pageRect.top)); +// return new Rectangle(0, 0, cast(int)(pageRect.right-pageRect.left), cast(int)(pageRect.bottom-pageRect.top)); return null; } @@ -600,7 +600,7 @@ // PMRect paperRect= new PMRect(); // OS.PMGetAdjustedPaperRect(pageFormat, paperRect); // OS.CGContextScaleCTM(context, 1, -1); -// OS.CGContextTranslateCTM(context, 0, -(float)(paperRect.bottom-paperRect.top)); +// OS.CGContextTranslateCTM(context, 0, -cast(float)(paperRect.bottom-paperRect.top)); // OS.CGContextSetStrokeColorSpace(context, colorspace); // OS.CGContextSetFillColorSpace(context, colorspace); // } diff -r fb2555104d70 -r 5b53d338c709 dwt/printing/PrinterData.d --- a/dwt/printing/PrinterData.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/printing/PrinterData.d Fri Aug 29 22:04:22 2008 +0200 @@ -32,7 +32,7 @@ * @see PrintDialog#open */ -public final class PrinterData extends DeviceData { +public final class PrinterData : DeviceData { /** * the printer driver @@ -141,7 +141,7 @@ * * @see Printer#getDefaultPrinterData */ - public PrinterData() { + public this() { } /** @@ -154,7 +154,7 @@ * @see #driver * @see #name */ - public PrinterData(String driver, String name) { + public this(String driver, String name) { this.driver = driver; this.name = name; } diff -r fb2555104d70 -r 5b53d338c709 dwt/program/Program.d --- a/dwt/program/Program.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/program/Program.d Fri Aug 29 22:04:22 2008 +0200 @@ -31,7 +31,7 @@ /** * Prevents uninitialized instances from being created outside the package. */ -Program () { +this () { } /** @@ -335,7 +335,7 @@ // Program[] programs = new Program[bundles.size()]; // Enumeration values = bundles.elements(); // while (values.hasMoreElements()) { -// programs[count++] = (Program)values.nextElement(); +// programs[count++] = cast(Program)values.nextElement(); // } // return programs; } @@ -517,8 +517,8 @@ */ public bool equals(Object other) { if (this is other) return true; - if (other instanceof Program) { - final Program program = (Program) other; + if ( null !is cast(Program)other ) { + final Program program = cast(Program) other; return name.equals(program.name); } return false; diff -r fb2555104d70 -r 5b53d338c709 dwt/widgets/Button.d --- a/dwt/widgets/Button.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/widgets/Button.d Fri Aug 29 22:04:22 2008 +0200 @@ -53,7 +53,7 @@ * within the DWT implementation. *

    */ -public class Button extends Control { +public class Button : Control { String text = ""; Image image; bool grayed; @@ -94,7 +94,7 @@ * @see Widget#checkSubclass * @see Widget#getStyle */ -public Button (Composite parent, int style) { +public this (Composite parent, int style) { super (parent, checkStyle (style)); } @@ -166,7 +166,7 @@ } else { alignment = OS.NSRightTextAlignment; } - NSMutableParagraphStyle pStyle = (NSMutableParagraphStyle)new NSMutableParagraphStyle().alloc().init(); + NSMutableParagraphStyle pStyle = cast(NSMutableParagraphStyle)new NSMutableParagraphStyle().alloc().init(); pStyle.autorelease(); pStyle.setAlignment(alignment); dict.setObject(pStyle, OS.NSParagraphStyleAttributeName()); @@ -174,13 +174,13 @@ text.getChars (0, chars.length, chars, 0); int length = fixMnemonic (chars); NSString str = NSString.stringWithCharacters(chars, length); - NSAttributedString attribStr = ((NSAttributedString)new NSAttributedString().alloc()).initWithString_attributes_(str, dict); + NSAttributedString attribStr = (cast(NSAttributedString)new NSAttributedString().alloc()).initWithString_attributes_(str, dict); attribStr.autorelease(); return attribStr; } void createHandle () { - NSButton widget = (NSButton)new SWTButton().alloc(); + NSButton widget = cast(NSButton)new SWTButton().alloc(); widget.initWithFrame(new NSRect()); int type = OS.NSMomentaryPushButton; if ((style & DWT.PUSH) !is 0) { @@ -283,8 +283,8 @@ public bool getSelection () { checkWidget (); if ((style & (DWT.CHECK | DWT.RADIO | DWT.TOGGLE)) is 0) return false; - if ((style & DWT.CHECK) !is 0 && grayed) return ((NSButton)view).state() is OS.NSMixedState; - return ((NSButton)view).state() is OS.NSOnState; + if ((style & DWT.CHECK) !is 0 && grayed) return (cast(NSButton)view).state() is OS.NSMixedState; + return (cast(NSButton)view).state() is OS.NSOnState; } /** @@ -367,11 +367,11 @@ } } if ((style & DWT.CHECK) !is 0) { - if (grayed && ((NSButton)view).state() is OS.NSOnState) { - ((NSButton)view).setState(OS.NSOffState); + if (grayed && (cast(NSButton)view).state() is OS.NSOnState) { + (cast(NSButton)view).setState(OS.NSOffState); } - if (!grayed && ((NSButton)view).state() is OS.NSMixedState) { - ((NSButton)view).setState(OS.NSOnState); + if (!grayed && (cast(NSButton)view).state() is OS.NSMixedState) { + (cast(NSButton)view).setState(OS.NSOnState); } } postEvent (DWT.Selection); @@ -417,7 +417,7 @@ style |= alignment & (DWT.LEFT | DWT.RIGHT | DWT.CENTER); /* text is still null when this is called from createHandle() */ if (text !is null) { - ((NSButton)view).setAttributedTitle(createString()); + (cast(NSButton)view).setAttributedTitle(createString()); } // /* Alignment not honoured when image and text is visible */ // bool bothVisible = text !is null && text.length () > 0 && image !is null; @@ -439,10 +439,10 @@ // textAlignment = OS.kControlBevelButtonAlignTextFlushRight; // graphicAlignment = OS.kControlBevelButtonAlignRight; // } -// OS.SetControlData (handle, OS.kControlEntireControl, OS.kControlBevelButtonTextAlignTag, 2, new short [] {(short)textAlignment}); -// OS.SetControlData (handle, OS.kControlEntireControl, OS.kControlBevelButtonGraphicAlignTag, 2, new short [] {(short)graphicAlignment}); +// OS.SetControlData (handle, OS.kControlEntireControl, OS.kControlBevelButtonTextAlignTag, 2, new short [] {cast(short)textAlignment}); +// OS.SetControlData (handle, OS.kControlEntireControl, OS.kControlBevelButtonGraphicAlignTag, 2, new short [] {cast(short)graphicAlignment}); // if (bothVisible) { -// OS.SetControlData (handle, OS.kControlEntireControl, OS.kControlBevelButtonTextPlaceTag, 2, new short [] {(short)OS.kControlBevelButtonPlaceToRightOfGraphic}); +// OS.SetControlData (handle, OS.kControlEntireControl, OS.kControlBevelButtonTextPlaceTag, 2, new short [] {cast(short)OS.kControlBevelButtonPlaceToRightOfGraphic}); // } } @@ -453,7 +453,7 @@ } else { nsColor = NSColor.colorWithDeviceRed(color[0], color[1], color[2], 1); } - NSButtonCell cell = new NSButtonCell(((NSButton)view).cell()); + NSButtonCell cell = new NSButtonCell((cast(NSButton)view).cell()); cell.setBackgroundColor(nsColor); } @@ -464,7 +464,7 @@ } void setForeground (float [] color) { - ((NSButton)view).setAttributedTitle(createString()); + (cast(NSButton)view).setAttributedTitle(createString()); } public void setGrayed(bool grayed) { @@ -474,9 +474,9 @@ this.grayed = grayed; if (checked) { if (grayed) { - ((NSButton) view).setState (OS.NSMixedState); + (cast(NSButton) view).setState (OS.NSMixedState); } else { - ((NSButton) view).setState (OS.NSOnState); + (cast(NSButton) view).setState (OS.NSOnState); } } } @@ -507,7 +507,7 @@ error (DWT.ERROR_INVALID_ARGUMENT); } this.image = image; - ((NSButton)view).setImage(image.handle); + (cast(NSButton)view).setImage(image.handle); } bool setRadioSelection (bool value){ @@ -539,9 +539,9 @@ checkWidget(); if ((style & (DWT.CHECK | DWT.RADIO | DWT.TOGGLE)) is 0) return; if (grayed) { - ((NSButton)view).setState (selected ? OS.NSMixedState : OS.NSOffState); + (cast(NSButton)view).setState (selected ? OS.NSMixedState : OS.NSOffState); } else { - ((NSButton)view).setState (selected ? OS.NSOnState : OS.NSOffState); + (cast(NSButton)view).setState (selected ? OS.NSOnState : OS.NSOffState); } } @@ -581,7 +581,7 @@ if (string is null) error (DWT.ERROR_NULL_ARGUMENT); if ((style & DWT.ARROW) !is 0) return; text = string; - ((NSButton)view).setAttributedTitle(createString()); + (cast(NSButton)view).setAttributedTitle(createString()); } int traversalCode (int key, NSEvent theEvent) { diff -r fb2555104d70 -r 5b53d338c709 dwt/widgets/Canvas.d --- a/dwt/widgets/Canvas.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/widgets/Canvas.d Fri Aug 29 22:04:22 2008 +0200 @@ -46,11 +46,11 @@ * * @see Composite */ -public class Canvas extends Composite { +public class Canvas : Composite { Caret caret; IME ime; -Canvas () { +this () { /* Do nothing */ } @@ -92,7 +92,7 @@ * @see Widget#checkSubclass * @see Widget#getStyle */ -public Canvas (Composite parent, int style) { +public this (Composite parent, int style) { super (parent, style); } diff -r fb2555104d70 -r 5b53d338c709 dwt/widgets/Caret.d diff -r fb2555104d70 -r 5b53d338c709 dwt/widgets/ColorDialog.d --- a/dwt/widgets/ColorDialog.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/widgets/ColorDialog.d Fri Aug 29 22:04:22 2008 +0200 @@ -38,7 +38,7 @@ * within the DWT implementation. *

    */ -public class ColorDialog extends Dialog { +public class ColorDialog : Dialog { RGB rgb; /** @@ -58,7 +58,7 @@ * @see Widget#checkSubclass * @see Widget#getStyle */ -public ColorDialog(Shell parent) { +public this(Shell parent) { this(parent, DWT.APPLICATION_MODAL); } @@ -90,7 +90,7 @@ * @see Widget#checkSubclass * @see Widget#getStyle */ -public ColorDialog(Shell parent, int style) { +public this(Shell parent, int style) { super(parent, style); checkSubclass (); } @@ -129,7 +129,7 @@ NSColor color = NSColor.colorWithDeviceRed(rgb.red / 255f, rgb.green / 255f, rgb.blue / 255f, 1); panel.setColor(color); } - SWTPanelDelegate delegate = (SWTPanelDelegate)new SWTPanelDelegate().alloc().init(); + SWTPanelDelegate delegate = cast(SWTPanelDelegate)new SWTPanelDelegate().alloc().init(); int jniRef = OS.NewGlobalRef(this); if (jniRef is 0) DWT.error(DWT.ERROR_NO_HANDLES); delegate.setTag(jniRef); @@ -143,7 +143,7 @@ NSColor color = panel.color(); if (color !is null) { color = color.colorUsingColorSpaceName_(NSString.stringWith("NSCalibratedRGBColorSpace")); - rgb = new RGB((int)(color.redComponent() * 255), (int)(color.greenComponent() * 255), (int)(color.blueComponent() * 255)); + rgb = new RGB(cast(int)(color.redComponent() * 255), cast(int)(color.greenComponent() * 255), cast(int)(color.blueComponent() * 255)); } return rgb; } diff -r fb2555104d70 -r 5b53d338c709 dwt/widgets/Combo.d --- a/dwt/widgets/Combo.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/widgets/Combo.d Fri Aug 29 22:04:22 2008 +0200 @@ -70,7 +70,7 @@ * * @see List */ -public class Combo extends Composite { +public class Combo : Composite { int textLimit = LIMIT; /** @@ -119,7 +119,7 @@ * @see Widget#checkSubclass * @see Widget#getStyle */ -public Combo (Composite parent, int style) { +public this (Composite parent, int style) { super (parent, checkStyle (style)); } @@ -143,13 +143,13 @@ if (string is null) error (DWT.ERROR_NULL_ARGUMENT); NSString str = NSString.stringWith(string); if ((style & DWT.READ_ONLY) !is 0) { - NSMenu nsMenu = ((NSPopUpButton)view).menu(); - NSMenuItem nsItem = (NSMenuItem)new NSMenuItem().alloc(); + NSMenu nsMenu = (cast(NSPopUpButton)view).menu(); + NSMenuItem nsItem = cast(NSMenuItem)new NSMenuItem().alloc(); nsItem.initWithTitle(str, 0, NSString.stringWith("")); nsMenu.addItem(nsItem); nsItem.release(); } else { - ((NSComboBox)view).addItemWithObjectValue(str); + (cast(NSComboBox)view).addItemWithObjectValue(str); } } @@ -183,13 +183,13 @@ if (0 > index || index > count) error (DWT.ERROR_INVALID_RANGE); NSString str = NSString.stringWith(string); if ((style & DWT.READ_ONLY) !is 0) { - NSMenu nsMenu = ((NSPopUpButton)view).menu(); - NSMenuItem nsItem = (NSMenuItem)new NSMenuItem().alloc(); + NSMenu nsMenu = (cast(NSPopUpButton)view).menu(); + NSMenuItem nsItem = cast(NSMenuItem)new NSMenuItem().alloc(); nsItem.initWithTitle(str, 0, NSString.stringWith("")); nsMenu.insertItem(nsItem, index); nsItem.release(); } else { - ((NSComboBox)view).insertItemWithObjectValue(str, index); + (cast(NSComboBox)view).insertItemWithObjectValue(str, index); } } @@ -344,13 +344,13 @@ public Point computeSize (int wHint, int hHint, bool changed) { checkWidget (); int width = 0, height = 0; - NSControl widget = (NSControl)view; + NSControl widget = cast(NSControl)view; NSRect oldRect = widget.frame(); widget.sizeToFit(); NSRect newRect = widget.frame(); widget.setFrame (oldRect); - width = (int)newRect.width; - height = (int)newRect.height; + width = cast(int)newRect.width; + height = cast(int)newRect.height; if (wHint !is DWT.DEFAULT) width = wHint; if (hHint !is DWT.DEFAULT) height = hHint; return new Point (width, height); @@ -378,7 +378,7 @@ void createHandle () { if ((style & DWT.READ_ONLY) !is 0) { - NSPopUpButton widget = (NSPopUpButton)new SWTPopUpButton().alloc(); + NSPopUpButton widget = cast(NSPopUpButton)new SWTPopUpButton().alloc(); widget.initWithFrame(new NSRect(), false); widget.menu().setAutoenablesItems(false); widget.setTarget(widget); @@ -387,7 +387,7 @@ view = widget; parent.view.addSubview_(widget); } else { - NSComboBox widget = (NSComboBox)new SWTComboBox().alloc(); + NSComboBox widget = cast(NSComboBox)new SWTComboBox().alloc(); widget.initWithFrame(new NSRect()); widget.setTag(jniRef); widget.setDelegate(widget); @@ -459,10 +459,10 @@ if (index is -1) return; if (index is getSelectionIndex ()) { if ((style & DWT.READ_ONLY) !is 0) { - ((NSPopUpButton)view).selectItem(null); + (cast(NSPopUpButton)view).selectItem(null); sendEvent (DWT.Modify); } else { - ((NSComboBox)view).deselectItemAtIndex(index); + (cast(NSComboBox)view).deselectItemAtIndex(index); } } } @@ -484,7 +484,7 @@ public void deselectAll () { checkWidget (); if ((style & DWT.READ_ONLY) !is 0) { - ((NSPopUpButton)view).selectItem(null); + (cast(NSPopUpButton)view).selectItem(null); sendEvent (DWT.Modify); } else { setText (""); @@ -494,9 +494,9 @@ int getCharCount() { NSString str; if ((style & DWT.READ_ONLY) !is 0) { - str = ((NSPopUpButton)view).titleOfSelectedItem(); + str = (cast(NSPopUpButton)view).titleOfSelectedItem(); } else { - str = new NSCell(((NSComboBox)view).cell()).title(); + str = new NSCell((cast(NSComboBox)view).cell()).title(); } return str.length(); } @@ -523,9 +523,9 @@ if (0 > index || index >= count) error (DWT.ERROR_INVALID_RANGE); NSString str; if ((style & DWT.READ_ONLY) !is 0) { - str = ((NSPopUpButton)view).itemTitleAtIndex(index); + str = (cast(NSPopUpButton)view).itemTitleAtIndex(index); } else { - str = new NSString(((NSComboBox)view).itemObjectValueAtIndex(index)); + str = new NSString((cast(NSComboBox)view).itemObjectValueAtIndex(index)); } if (str is null) error(DWT.ERROR_CANNOT_GET_ITEM); char[] buffer = new char[str.length()]; @@ -546,9 +546,9 @@ public int getItemCount () { checkWidget (); if ((style & DWT.READ_ONLY) !is 0) { - return ((NSPopUpButton)view).numberOfItems(); + return (cast(NSPopUpButton)view).numberOfItems(); } else { - return ((NSComboBox)view).numberOfItems(); + return (cast(NSComboBox)view).numberOfItems(); } } @@ -643,7 +643,7 @@ // selection = this.selection; // } else { // selection = new ControlEditTextSelectionRec (); -// OS.GetControlData (handle, (short) OS.kHIComboBoxEditTextPart, OS.kControlEditTextSelectionTag, 4, selection, null); +// OS.GetControlData (handle, cast(short) OS.kHIComboBoxEditTextPart, OS.kControlEditTextSelectionTag, 4, selection, null); // } // return new Point (selection.selStart, selection.selEnd); return null; @@ -664,9 +664,9 @@ public int getSelectionIndex () { checkWidget (); if ((style & DWT.READ_ONLY) !is 0) { - return ((NSPopUpButton)view).indexOfSelectedItem(); + return (cast(NSPopUpButton)view).indexOfSelectedItem(); } else { - return ((NSComboBox)view).indexOfSelectedItem(); + return (cast(NSComboBox)view).indexOfSelectedItem(); } } @@ -690,9 +690,9 @@ String getText (int start, int end) { NSString str; if ((style & DWT.READ_ONLY) !is 0) { - str = ((NSPopUpButton)view).titleOfSelectedItem(); + str = (cast(NSPopUpButton)view).titleOfSelectedItem(); } else { - str = new NSCell(((NSComboBox)view).cell()).title(); + str = new NSCell((cast(NSComboBox)view).cell()).title(); } if (str is null) return ""; int length = str.length(); @@ -763,7 +763,7 @@ if ((style & DWT.READ_ONLY) !is 0) { return getItemCount (); } else { - return ((NSComboBox)view).numberOfVisibleItems(); + return (cast(NSComboBox)view).numberOfVisibleItems(); } } @@ -879,9 +879,9 @@ int count = getItemCount (); if (0 > index || index >= count) error (DWT.ERROR_INVALID_RANGE); if ((style & DWT.READ_ONLY) !is 0) { - ((NSPopUpButton)view).removeItemAtIndex(index); + (cast(NSPopUpButton)view).removeItemAtIndex(index); } else { - ((NSComboBox)view).removeItemAtIndex(index); + (cast(NSComboBox)view).removeItemAtIndex(index); } } @@ -950,10 +950,10 @@ public void removeAll () { checkWidget (); if ((style & DWT.READ_ONLY) !is 0) { - ((NSPopUpButton)view).removeAllItems(); + (cast(NSPopUpButton)view).removeAllItems(); } else { setText ("", true); - ((NSComboBox)view).removeAllItems(); + (cast(NSComboBox)view).removeAllItems(); } } @@ -1049,10 +1049,10 @@ int count = getItemCount (); if (0 <= index && index < count) { if ((style & DWT.READ_ONLY) !is 0) { - ((NSPopUpButton)view).selectItemAtIndex(index); + (cast(NSPopUpButton)view).selectItemAtIndex(index); sendEvent (DWT.Modify); } else { - ((NSComboBox)view).selectItemAtIndex(index); + (cast(NSComboBox)view).selectItemAtIndex(index); } } } @@ -1124,7 +1124,7 @@ } else { nsColor = NSColor.colorWithDeviceRed(color[0], color[1], color[2], 1); } - ((NSTextField)view).setBackgroundColor(nsColor); + (cast(NSTextField)view).setBackgroundColor(nsColor); } void setForeground (float [] color) { @@ -1134,7 +1134,7 @@ } else { nsColor = NSColor.colorWithDeviceRed(color[0], color[1], color[2], 1); } - ((NSTextField)view).setTextColor(nsColor); + (cast(NSTextField)view).setTextColor(nsColor); } /** @@ -1160,10 +1160,10 @@ if (0 > index || index >= count) error (DWT.ERROR_INVALID_RANGE); NSString str = NSString.stringWith(string); if ((style & DWT.READ_ONLY) !is 0) { - NSMenuItem nsItem = ((NSPopUpButton)view).itemAtIndex(index); + NSMenuItem nsItem = (cast(NSPopUpButton)view).itemAtIndex(index); nsItem.setTitle(str); } else { - NSComboBox widget = (NSComboBox)view; + NSComboBox widget = cast(NSComboBox)view; widget.insertItemWithObjectValue(str, index); widget.removeItemAtIndex(index + 1); } @@ -1194,13 +1194,13 @@ for (int i= 0; i < items.length; i++) { NSString str = NSString.stringWith(items[i]); if ((style & DWT.READ_ONLY) !is 0) { - NSMenu nsMenu = ((NSPopUpButton)view).menu(); - NSMenuItem nsItem = (NSMenuItem)new NSMenuItem().alloc(); + NSMenu nsMenu = (cast(NSPopUpButton)view).menu(); + NSMenuItem nsItem = cast(NSMenuItem)new NSMenuItem().alloc(); nsItem.initWithTitle(str, 0, NSString.stringWith("")); nsMenu.addItem(nsItem); nsItem.release(); } else { - ((NSComboBox)view).addItemWithObjectValue(str); + (cast(NSComboBox)view).addItemWithObjectValue(str); } } } @@ -1208,7 +1208,7 @@ /*public*/ void setListVisible (bool visible) { checkWidget (); if ((style & DWT.READ_ONLY) !is 0) { - ((NSPopUpButton)view).setPullsDown(visible); + (cast(NSPopUpButton)view).setPullsDown(visible); } else { } } @@ -1254,8 +1254,8 @@ // int length = getCharCount (); // int start = selection.x, end = selection.y; // ControlEditTextSelectionRec sel = new ControlEditTextSelectionRec (); -// sel.selStart = (short) Math.min (Math.max (Math.min (start, end), 0), length); -// sel.selEnd = (short) Math.min (Math.max (Math.max (start, end), 0), length); +// sel.selStart = cast(short) Math.min (Math.max (Math.min (start, end), 0), length); +// sel.selEnd = cast(short) Math.min (Math.max (Math.max (start, end), 0), length); // if (hasFocus ()) { // OS.SetControlData (handle, OS.kHIComboBoxEditTextPart, OS.kControlEditTextSelectionTag, 4, sel); // } else { @@ -1305,7 +1305,7 @@ if (notify) sendEvent (DWT.Modify); } } else { - new NSCell(((NSComboBox)view).cell()).setTitle(NSString.stringWith(string)); + new NSCell((cast(NSComboBox)view).cell()).setTitle(NSString.stringWith(string)); if (notify) sendEvent (DWT.Modify); } } @@ -1359,7 +1359,7 @@ if ((style & DWT.READ_ONLY) !is 0) { //TODO } else { - ((NSComboBox)view).setNumberOfVisibleItems(count); + (cast(NSComboBox)view).setNumberOfVisibleItems(count); } } diff -r fb2555104d70 -r 5b53d338c709 dwt/widgets/Composite.d --- a/dwt/widgets/Composite.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/widgets/Composite.d Fri Aug 29 22:04:22 2008 +0200 @@ -54,13 +54,13 @@ * * @see Canvas */ -public class Composite extends Scrollable { +public class Composite : Scrollable { Layout layout; Control[] tabList; int scrolledVisibleRgn, siblingsVisibleRgn; int layoutCount, backgroundMode; -Composite () { +this () { /* Do nothing */ } @@ -94,7 +94,7 @@ * @see DWT#NO_RADIO_GROUP * @see Widget#getStyle */ -public Composite (Composite parent, int style) { +public this (Composite parent, int style) { super (parent, style); } @@ -108,8 +108,8 @@ if (tag !is 0 && tag !is -1) { Object widget = OS.JNIGetObject(tag); if (widget !is null && widget !is this) { - if (widget instanceof Control) { - children [j++] = (Control) widget; + if ( null !is cast(Control)widget ) { + children [j++] = cast(Control) widget; } } } @@ -248,7 +248,7 @@ state |= CANVAS; NSRect rect = new NSRect(); if ((style & (DWT.V_SCROLL | DWT.H_SCROLL)) !is 0 || hasBorder ()) { - SWTScrollView scrollWidget = (SWTScrollView)new SWTScrollView().alloc(); + SWTScrollView scrollWidget = cast(SWTScrollView)new SWTScrollView().alloc(); scrollWidget.initWithFrame (rect); scrollWidget.setDrawsBackground(false); if ((style & DWT.H_SCROLL) !is 0) scrollWidget.setHasHorizontalScroller(true); @@ -258,7 +258,7 @@ scrollView = scrollWidget; rect.width = rect.height = 100000; } - SWTView widget = (SWTView)new SWTView().alloc(); + SWTView widget = cast(SWTView)new SWTView().alloc(); widget.initWithFrame (rect); // widget.setFocusRingType(OS.NSFocusRingTypeExterior); widget.setTag(jniRef); diff -r fb2555104d70 -r 5b53d338c709 dwt/widgets/Control.d --- a/dwt/widgets/Control.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/widgets/Control.d Fri Aug 29 22:04:22 2008 +0200 @@ -790,14 +790,14 @@ // int window = OS.GetControlOwner (handle); // CGPoint pt = new CGPoint (); // OS.HIViewConvertPoint (pt, handle, 0); -// x += (int) pt.x; -// y += (int) pt.y; -// OS.GetWindowBounds (window, (short) OS.kWindowStructureRgn, rect); +// x += cast(int) pt.x; +// y += cast(int) pt.y; +// OS.GetWindowBounds (window, cast(short) OS.kWindowStructureRgn, rect); // x += rect.left; // y += rect.top; // dwt.internal.carbon.Point pt1 = new dwt.internal.carbon.Point (); -// pt1.h = (short) x; -// pt1.v = (short) y; +// pt1.h = cast(short) x; +// pt1.v = cast(short) y; // return OS.WaitMouseMoved (pt1); return false; } @@ -2222,15 +2222,15 @@ // CGPoint pt = new CGPoint (); // OS.GetEventParameter (theEvent, OS.kEventParamWindowMouseLocation, OS.typeHIPoint, null, CGPoint.sizeof, null, pt); // OS.HIViewConvertPoint (pt, 0, handle); -// int x = (int) pt.x; -// int y = (int) pt.y; +// int x = cast(int) pt.x; +// int y = cast(int) pt.y; // display.lastX = x; // display.lastY = y; // int [] chord = new int [1]; // OS.GetEventParameter (theEvent, OS.kEventParamMouseChord, OS.typeUInt32, null, 4, null, chord); // int [] modifiers = new int [1]; // OS.GetEventParameter (theEvent, OS.kEventParamKeyModifiers, OS.typeUInt32, null, 4, null, modifiers); -// return sendMouseEvent (type, button, count, detail, send, chord [0], (short) x, (short) y, modifiers [0]); +// return sendMouseEvent (type, button, count, detail, send, chord [0], cast(short) x, cast(short) y, modifiers [0]); return false; } @@ -2334,11 +2334,11 @@ void setBackground (int control, float [] color) { // ControlFontStyleRec fontStyle = new ControlFontStyleRec (); -// OS.GetControlData (control, (short) OS.kControlEntireControl, OS.kControlFontStyleTag, ControlFontStyleRec.sizeof, fontStyle, null); +// OS.GetControlData (control, cast(short) OS.kControlEntireControl, OS.kControlFontStyleTag, ControlFontStyleRec.sizeof, fontStyle, null); // if (color !is null) { -// fontStyle.backColor_red = (short) (color [0] * 0xffff); -// fontStyle.backColor_green = (short) (color [1] * 0xffff); -// fontStyle.backColor_blue = (short) (color [2] * 0xffff); +// fontStyle.backColor_red = cast(short) (color [0] * 0xffff); +// fontStyle.backColor_green = cast(short) (color [1] * 0xffff); +// fontStyle.backColor_blue = cast(short) (color [2] * 0xffff); // fontStyle.flags |= OS.kControlUseBackColorMask; // } else { // fontStyle.flags &= ~OS.kControlUseBackColorMask; @@ -2625,11 +2625,11 @@ void setForeground (int control, float [] color) { // ControlFontStyleRec fontStyle = new ControlFontStyleRec (); -// OS.GetControlData (control, (short) OS.kControlEntireControl, OS.kControlFontStyleTag, ControlFontStyleRec.sizeof, fontStyle, null); +// OS.GetControlData (control, cast(short) OS.kControlEntireControl, OS.kControlFontStyleTag, ControlFontStyleRec.sizeof, fontStyle, null); // if (color !is null) { -// fontStyle.foreColor_red = (short) (color [0] * 0xffff); -// fontStyle.foreColor_green = (short) (color [1] * 0xffff); -// fontStyle.foreColor_blue = (short) (color [2] * 0xffff); +// fontStyle.foreColor_red = cast(short) (color [0] * 0xffff); +// fontStyle.foreColor_green = cast(short) (color [1] * 0xffff); +// fontStyle.foreColor_blue = cast(short) (color [2] * 0xffff); // fontStyle.flags |= OS.kControlUseForeColorMask; // } else { // fontStyle.flags &= ~OS.kControlUseForeColorMask; diff -r fb2555104d70 -r 5b53d338c709 dwt/widgets/CoolBar.d --- a/dwt/widgets/CoolBar.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/widgets/CoolBar.d Fri Aug 29 22:04:22 2008 +0200 @@ -44,7 +44,7 @@ * IMPORTANT: This class is not intended to be subclassed. *

    */ -public class CoolBar extends Composite { +public class CoolBar : Composite { CoolItem[][] items = new CoolItem[0][0]; CoolItem[] originalItems = new CoolItem[0]; Cursor hoverCursor, dragCursor, cursor; @@ -85,7 +85,7 @@ * @see Widget#checkSubclass * @see Widget#getStyle */ -public CoolBar (Composite parent, int style) { +public this (Composite parent, int style) { super (parent, checkStyle(style)); if ((style & DWT.VERTICAL) !is 0) { this.style |= DWT.VERTICAL; diff -r fb2555104d70 -r 5b53d338c709 dwt/widgets/CoolItem.d --- a/dwt/widgets/CoolItem.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/widgets/CoolItem.d Fri Aug 29 22:04:22 2008 +0200 @@ -40,7 +40,7 @@ * IMPORTANT: This class is not intended to be subclassed. *

    */ -public class CoolItem extends Item { +public class CoolItem : Item { Control control; CoolBar parent; bool ideal; @@ -90,7 +90,7 @@ * @see Widget#checkSubclass * @see Widget#getStyle */ -public CoolItem (CoolBar parent, int style) { +public this (CoolBar parent, int style) { super(parent, style); this.parent = parent; parent.createItem (this, parent.getItemCount()); @@ -128,7 +128,7 @@ * @see Widget#checkSubclass * @see Widget#getStyle */ -public CoolItem (CoolBar parent, int style, int index) { +public this (CoolBar parent, int style, int index) { super(parent, style); this.parent = parent; parent.createItem (this, index); diff -r fb2555104d70 -r 5b53d338c709 dwt/widgets/DateTime.d --- a/dwt/widgets/DateTime.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/widgets/DateTime.d Fri Aug 29 22:04:22 2008 +0200 @@ -49,7 +49,7 @@ * * @since 3.3 */ -public class DateTime extends Composite { +public class DateTime : Composite { /** * Constructs a new instance of this class given its parent @@ -81,7 +81,7 @@ * @see Widget#checkSubclass * @see Widget#getStyle */ -public DateTime (Composite parent, int style) { +public this (Composite parent, int style) { super (parent, checkStyle (style)); } @@ -137,13 +137,13 @@ public Point computeSize (int wHint, int hHint, bool changed) { checkWidget (); int width = 0, height = 0; - NSControl widget = (NSControl)view; + NSControl widget = cast(NSControl)view; NSRect oldRect = widget.frame(); widget.sizeToFit(); NSRect newRect = widget.frame(); widget.setFrame (oldRect); - width = (int)newRect.width; - height = (int)newRect.height; + width = cast(int)newRect.width; + height = cast(int)newRect.height; if (width is 0) width = DEFAULT_WIDTH; if (height is 0) height = DEFAULT_HEIGHT; if (wHint !is DWT.DEFAULT) width = wHint; @@ -154,7 +154,7 @@ } void createHandle () { - NSDatePicker widget = (NSDatePicker)new SWTDatePicker().alloc(); + NSDatePicker widget = cast(NSDatePicker)new SWTDatePicker().alloc(); widget.initWithFrame(new NSRect()); int pickerStyle = OS.NSTextFieldAndStepperDatePickerStyle; int elementFlags = 0; @@ -196,7 +196,7 @@ */ public int getDay () { checkWidget (); - NSDate date = ((NSDatePicker)view).dateValue(); + NSDate date = (cast(NSDatePicker)view).dateValue(); NSCalendarDate calendarDate = date.dateWithCalendarFormat(null, null); return calendarDate.dayOfMonth(); } @@ -216,7 +216,7 @@ */ public int getHours () { checkWidget (); - return new NSCalendarDate(((NSDatePicker)view).dateValue().id).hourOfDay(); + return new NSCalendarDate((cast(NSDatePicker)view).dateValue().id).hourOfDay(); } /** @@ -234,7 +234,7 @@ */ public int getMinutes () { checkWidget (); - return new NSCalendarDate(((NSDatePicker)view).dateValue().id).minuteOfHour(); + return new NSCalendarDate((cast(NSDatePicker)view).dateValue().id).minuteOfHour(); } /** @@ -252,7 +252,7 @@ */ public int getMonth () { checkWidget (); - return new NSCalendarDate(((NSDatePicker)view).dateValue().id).monthOfYear() - 1; + return new NSCalendarDate((cast(NSDatePicker)view).dateValue().id).monthOfYear() - 1; } String getNameText() { @@ -275,7 +275,7 @@ */ public int getSeconds () { checkWidget (); - return new NSCalendarDate(((NSDatePicker)view).dateValue().id).secondOfMinute(); + return new NSCalendarDate((cast(NSDatePicker)view).dateValue().id).secondOfMinute(); } /** @@ -293,7 +293,7 @@ */ public int getYear () { checkWidget (); - return new NSCalendarDate(((NSDatePicker)view).dateValue().id).yearOfCommonEra(); + return new NSCalendarDate((cast(NSDatePicker)view).dateValue().id).yearOfCommonEra(); } /** @@ -332,7 +332,7 @@ } else { nsColor = NSColor.colorWithDeviceRed(color[0], color[1], color[2], 1); } - ((NSDatePicker)view).setBackgroundColor(nsColor); + (cast(NSDatePicker)view).setBackgroundColor(nsColor); } /** @@ -355,11 +355,11 @@ */ public void setDate (int year, int month, int day) { checkWidget (); - NSCalendarDate date = new NSCalendarDate(((NSDatePicker)view).dateValue().id); + NSCalendarDate date = new NSCalendarDate((cast(NSDatePicker)view).dateValue().id); NSCalendarDate newDate = NSCalendarDate.dateWithYear(year, month + 1, day, date.hourOfDay(), date.minuteOfHour(), date.secondOfMinute(), date.timeZone()); if (newDate.yearOfCommonEra() is year && newDate.monthOfYear() is month + 1 && newDate.dayOfMonth() is day) { - ((NSDatePicker)view).setDateValue(newDate); + (cast(NSDatePicker)view).setDateValue(newDate); } } @@ -378,11 +378,11 @@ */ public void setDay (int day) { checkWidget (); - NSCalendarDate date = new NSCalendarDate(((NSDatePicker)view).dateValue().id); + NSCalendarDate date = new NSCalendarDate((cast(NSDatePicker)view).dateValue().id); NSCalendarDate newDate = NSCalendarDate.dateWithYear(date.yearOfCommonEra(), date.monthOfYear(), day, date.hourOfDay(), date.minuteOfHour(), date.secondOfMinute(), date.timeZone()); if (newDate.yearOfCommonEra() is date.yearOfCommonEra() && newDate.monthOfYear() is date.monthOfYear() && newDate.dayOfMonth() is day) { - ((NSDatePicker)view).setDateValue(newDate); + (cast(NSDatePicker)view).setDateValue(newDate); } } @@ -393,7 +393,7 @@ } else { nsColor = NSColor.colorWithDeviceRed(color[0], color[1], color[2], 1); } - ((NSDatePicker)view).setTextColor(nsColor); + (cast(NSDatePicker)view).setTextColor(nsColor); } /** @@ -412,10 +412,10 @@ public void setHours (int hours) { checkWidget (); if (hours < 0 || hours > 23) return; - NSCalendarDate date = new NSCalendarDate(((NSDatePicker)view).dateValue().id); + NSCalendarDate date = new NSCalendarDate((cast(NSDatePicker)view).dateValue().id); NSCalendarDate newDate = NSCalendarDate.dateWithYear(date.yearOfCommonEra(), date.monthOfYear(), date.dayOfMonth(), hours, date.minuteOfHour(), date.secondOfMinute(), date.timeZone()); - ((NSDatePicker)view).setDateValue(newDate); + (cast(NSDatePicker)view).setDateValue(newDate); } /** @@ -434,10 +434,10 @@ public void setMinutes (int minutes) { checkWidget (); if (minutes < 0 || minutes > 59) return; - NSCalendarDate date = new NSCalendarDate(((NSDatePicker)view).dateValue().id); + NSCalendarDate date = new NSCalendarDate((cast(NSDatePicker)view).dateValue().id); NSCalendarDate newDate = NSCalendarDate.dateWithYear(date.yearOfCommonEra(), date.monthOfYear(), date.dayOfMonth(), date.hourOfDay(), minutes, date.secondOfMinute(), date.timeZone()); - ((NSDatePicker)view).setDateValue(newDate); + (cast(NSDatePicker)view).setDateValue(newDate); } /** @@ -455,11 +455,11 @@ */ public void setMonth (int month) { checkWidget (); - NSCalendarDate date = new NSCalendarDate(((NSDatePicker)view).dateValue().id); + NSCalendarDate date = new NSCalendarDate((cast(NSDatePicker)view).dateValue().id); NSCalendarDate newDate = NSCalendarDate.dateWithYear(date.yearOfCommonEra(), month + 1, date.dayOfMonth(), date.hourOfDay(), date.minuteOfHour(), date.secondOfMinute(), date.timeZone()); if (newDate.yearOfCommonEra() is date.yearOfCommonEra() && newDate.monthOfYear() is month + 1 && newDate.dayOfMonth() is date.dayOfMonth()) { - ((NSDatePicker)view).setDateValue(newDate); + (cast(NSDatePicker)view).setDateValue(newDate); } } @@ -479,10 +479,10 @@ public void setSeconds (int seconds) { checkWidget (); if (seconds < 0 || seconds > 59) return; - NSCalendarDate date = new NSCalendarDate(((NSDatePicker)view).dateValue().id); + NSCalendarDate date = new NSCalendarDate((cast(NSDatePicker)view).dateValue().id); NSCalendarDate newDate = NSCalendarDate.dateWithYear(date.yearOfCommonEra(), date.monthOfYear(), date.dayOfMonth(), date.hourOfDay(), date.minuteOfHour(), seconds, date.timeZone()); - ((NSDatePicker)view).setDateValue(newDate); + (cast(NSDatePicker)view).setDateValue(newDate); } /** @@ -502,10 +502,10 @@ public void setTime (int hours, int minutes, int seconds) { checkWidget (); if (hours < 0 || hours > 23 || minutes < 0 || minutes > 59 || seconds < 0 || seconds > 59) return; - NSCalendarDate date = new NSCalendarDate(((NSDatePicker)view).dateValue().id); + NSCalendarDate date = new NSCalendarDate((cast(NSDatePicker)view).dateValue().id); NSCalendarDate newDate = NSCalendarDate.dateWithYear(date.yearOfCommonEra(), date.monthOfYear(), date.dayOfMonth(), hours, minutes, seconds, date.timeZone()); - ((NSDatePicker)view).setDateValue(newDate); + (cast(NSDatePicker)view).setDateValue(newDate); } /** @@ -523,11 +523,11 @@ */ public void setYear (int year) { checkWidget (); - NSCalendarDate date = new NSCalendarDate(((NSDatePicker)view).dateValue().id); + NSCalendarDate date = new NSCalendarDate((cast(NSDatePicker)view).dateValue().id); NSCalendarDate newDate = NSCalendarDate.dateWithYear(year, date.monthOfYear(), date.dayOfMonth(), date.hourOfDay(), date.minuteOfHour(), date.secondOfMinute(), date.timeZone()); if (newDate.yearOfCommonEra() is year && newDate.monthOfYear() is date.monthOfYear() && newDate.dayOfMonth() is date.dayOfMonth()) { - ((NSDatePicker)view).setDateValue(newDate); + (cast(NSDatePicker)view).setDateValue(newDate); } } } diff -r fb2555104d70 -r 5b53d338c709 dwt/widgets/Decorations.d --- a/dwt/widgets/Decorations.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/widgets/Decorations.d Fri Aug 29 22:04:22 2008 +0200 @@ -95,7 +95,7 @@ * @see Shell * @see DWT */ -public class Decorations extends Canvas { +public class Decorations : Canvas { Image image; Image [] images = new Image [0]; Menu menuBar; @@ -104,7 +104,7 @@ Control savedFocus; Button defaultButton; -Decorations () { +this () { /* Do nothing */ } @@ -146,7 +146,7 @@ * @see Widget#checkSubclass * @see Widget#getStyle */ -public Decorations (Composite parent, int style) { +public this (Composite parent, int style) { super (parent, checkStyle (style)); } diff -r fb2555104d70 -r 5b53d338c709 dwt/widgets/Dialog.d diff -r fb2555104d70 -r 5b53d338c709 dwt/widgets/DirectoryDialog.d --- a/dwt/widgets/DirectoryDialog.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/widgets/DirectoryDialog.d Fri Aug 29 22:04:22 2008 +0200 @@ -34,7 +34,7 @@ * within the DWT implementation. *

    */ -public class DirectoryDialog extends Dialog { +public class DirectoryDialog : Dialog { String message = "", filterPath = ""; /** @@ -50,7 +50,7 @@ *
  • ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass
  • * */ -public DirectoryDialog (Shell parent) { +public this (Shell parent) { this (parent, DWT.APPLICATION_MODAL); } @@ -78,7 +78,7 @@ *
  • ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass
  • * */ -public DirectoryDialog (Shell parent, int style) { +public this (Shell parent, int style) { super (parent, style); checkSubclass (); } diff -r fb2555104d70 -r 5b53d338c709 dwt/widgets/Display.d --- a/dwt/widgets/Display.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/widgets/Display.d Fri Aug 29 22:04:22 2008 +0200 @@ -426,13 +426,13 @@ // if (menus is null) menus = new Menu [12]; // for (int i=0; i */ -public class FileDialog extends Dialog { +public class FileDialog : Dialog { String [] filterNames = new String [0]; String [] filterExtensions = new String [0]; String [] fileNames = new String[0]; @@ -59,7 +59,7 @@ *
  • ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass
  • * */ -public FileDialog (Shell parent) { +public this (Shell parent) { this (parent, DWT.APPLICATION_MODAL); } @@ -87,7 +87,7 @@ *
  • ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass
  • * */ -public FileDialog (Shell parent, int style) { +public this (Shell parent, int style) { super (parent, style); checkSubclass (); } @@ -212,7 +212,7 @@ filename.getCharacters_(buffer); fullPath = new String(buffer); if ((style & DWT.SAVE) is 0) { - NSArray filenames = ((NSOpenPanel)panel).filenames(); + NSArray filenames = (cast(NSOpenPanel)panel).filenames(); int count = filenames.count(); fileNames = new String[count]; for (int i = 0; i < count; i++) { @@ -327,7 +327,7 @@ * @since 3.4 */ public void setOverwrite (bool overwrite) { - //TODO: May be able to implement this with private NSSavePanel method (BOOL)_overwriteExistingFileCheck:(NSString *)filename + //TODO: May be able to implement this with private NSSavePanel method cast(BOOL)_overwriteExistingFileCheck:(NSString *)filename /* See bug 223703 */ //this.overwrite = overwrite; } diff -r fb2555104d70 -r 5b53d338c709 dwt/widgets/FontDialog.d --- a/dwt/widgets/FontDialog.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/widgets/FontDialog.d Fri Aug 29 22:04:22 2008 +0200 @@ -41,7 +41,7 @@ * within the DWT implementation. *

    */ -public class FontDialog extends Dialog { +public class FontDialog : Dialog { FontData fontData; RGB rgb; bool open; @@ -60,7 +60,7 @@ *
  • ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass
  • * */ -public FontDialog (Shell parent) { +public this (Shell parent) { this (parent, DWT.APPLICATION_MODAL); } @@ -88,7 +88,7 @@ *
  • ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass
  • * */ -public FontDialog (Shell parent, int style) { +public this (Shell parent, int style) { super (parent, style); checkSubclass (); } @@ -220,7 +220,7 @@ NSFontManager.sharedFontManager().setSelectedFont(font.handle, false); font.dispose(); } - SWTPanelDelegate delegate = (SWTPanelDelegate)new SWTPanelDelegate().alloc().init(); + SWTPanelDelegate delegate = cast(SWTPanelDelegate)new SWTPanelDelegate().alloc().init(); int jniRef = OS.NewGlobalRef(this); if (jniRef is 0) DWT.error(DWT.ERROR_NO_HANDLES); delegate.setTag(jniRef); diff -r fb2555104d70 -r 5b53d338c709 dwt/widgets/Group.d --- a/dwt/widgets/Group.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/widgets/Group.d Fri Aug 29 22:04:22 2008 +0200 @@ -44,7 +44,7 @@ * IMPORTANT: This class is not intended to be subclassed. *

    */ -public class Group extends Composite { +public class Group : Composite { SWTView contentView; String text = ""; @@ -80,7 +80,7 @@ * @see Widget#checkSubclass * @see Widget#getStyle */ -public Group (Composite parent, int style) { +public this (Composite parent, int style) { super (parent, checkStyle (style)); } @@ -102,7 +102,7 @@ public Rectangle computeTrim (int x, int y, int width, int height) { checkWidget (); - NSBox widget = (NSBox)view; + NSBox widget = cast(NSBox)view; NSSize margins = widget.contentViewMargins(); NSRect frame = contentView.frame(); width += margins.width * 2; @@ -115,11 +115,11 @@ } void createHandle () { - SWTBox widget = (SWTBox)new SWTBox().alloc(); + SWTBox widget = cast(SWTBox)new SWTBox().alloc(); widget.initWithFrame(new NSRect()); widget.setTitle(NSString.stringWith("")); widget.setTag(jniRef); - SWTView contentWidget = (SWTView)new SWTView().alloc(); + SWTView contentWidget = cast(SWTView)new SWTView().alloc(); contentWidget.initWithFrame(new NSRect()); contentWidget.setTag(jniRef); // contentWidget.setDrawsBackground(false); @@ -132,7 +132,7 @@ public Rectangle getClientArea () { checkWidget(); NSRect rect = contentView.bounds(); - return new Rectangle((int)rect.x, (int)rect.y, (int)rect.width, (int)rect.height); + return new Rectangle(cast(int)rect.x, cast(int)rect.y, cast(int)rect.width, cast(int)rect.height); } String getNameText () { @@ -196,7 +196,7 @@ char [] buffer = new char [text.length ()]; text.getChars (0, buffer.length, buffer, 0); int length = fixMnemonic (buffer); - ((NSBox)view).setTitle(NSString.stringWithCharacters(buffer, length)); + (cast(NSBox)view).setTitle(NSString.stringWithCharacters(buffer, length)); } } diff -r fb2555104d70 -r 5b53d338c709 dwt/widgets/IME.d --- a/dwt/widgets/IME.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/widgets/IME.d Fri Aug 29 22:04:22 2008 +0200 @@ -16,7 +16,7 @@ import dwt.DWT; import dwt.graphics.TextStyle; -public class IME extends Widget { +public class IME : Widget { Canvas parent; int caretOffset; int startOffset; @@ -28,14 +28,14 @@ /** * Prevents uninitialized instances from being created outside the package. */ -IME () { +this () { } /** * * @see DWT */ -public IME (Canvas parent, int style) { +public this (Canvas parent, int style) { super (parent, style); this.parent = parent; createWidget (); diff -r fb2555104d70 -r 5b53d338c709 dwt/widgets/Item.d diff -r fb2555104d70 -r 5b53d338c709 dwt/widgets/Label.d --- a/dwt/widgets/Label.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/widgets/Label.d Fri Aug 29 22:04:22 2008 +0200 @@ -55,7 +55,7 @@ * within the DWT implementation. *

    */ -public class Label extends Control { +public class Label : Control { String text = ""; Image image; bool isImage; @@ -99,7 +99,7 @@ * @see Widget#checkSubclass * @see Widget#getStyle */ -public Label (Composite parent, int style) { +public this (Composite parent, int style) { super (parent, checkStyle (style)); } @@ -133,8 +133,8 @@ textView.sizeToFit(); NSRect newRect = textView.frame(); textView.setFrame (oldRect); - width = (int)newRect.width; - height = (int)newRect.height; + width = cast(int)newRect.width; + height = cast(int)newRect.height; } } if (wHint !is DWT.DEFAULT) width = wHint; @@ -143,7 +143,7 @@ } void createHandle () { - SWTBox widget = (SWTBox)new SWTBox().alloc(); + SWTBox widget = cast(SWTBox)new SWTBox().alloc(); widget.initWithFrame(new NSRect()); widget.setTag(jniRef); widget.setTitle(NSString.stringWith("")); @@ -152,11 +152,11 @@ } else { widget.setBorderType(OS.NSNoBorder); - NSImageView imageWidget = (NSImageView)new SWTImageView().alloc(); + NSImageView imageWidget = cast(NSImageView)new SWTImageView().alloc(); imageWidget.initWithFrame(new NSRect()); imageWidget.setTag(jniRef); - SWTTextField textWidget = (SWTTextField)new SWTTextField().alloc(); + SWTTextField textWidget = cast(SWTTextField)new SWTTextField().alloc(); textWidget.initWithFrame(new NSRect()); textWidget.setBordered(false); textWidget.setEditable(false); @@ -193,7 +193,7 @@ int length = fixMnemonic (chars); NSString str = NSString.stringWithCharacters(chars, length); - NSAttributedString attribStr = ((NSAttributedString)new NSAttributedString().alloc()).initWithString_attributes_(str, dict); + NSAttributedString attribStr = (cast(NSAttributedString)new NSAttributedString().alloc()).initWithString_attributes_(str, dict); attribStr.autorelease(); return attribStr; } @@ -349,7 +349,7 @@ this.image = image; isImage = true; imageView.setImage(image !is null ? image.handle : null); - ((NSBox)view).setContentView(imageView); + (cast(NSBox)view).setContentView(imageView); } /** @@ -387,7 +387,7 @@ text = string; NSCell cell = new NSCell(textView.cell()); cell.setAttributedStringValue(createString()); - ((NSBox)view).setContentView(textView); + (cast(NSBox)view).setContentView(textView); } } diff -r fb2555104d70 -r 5b53d338c709 dwt/widgets/Link.d --- a/dwt/widgets/Link.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/widgets/Link.d Fri Aug 29 22:04:22 2008 +0200 @@ -46,7 +46,7 @@ * * @since 3.1 */ -public class Link extends Control { +public class Link : Control { NSScrollView scrollView; String text; Point [] offsets; @@ -81,7 +81,7 @@ * @see Widget#checkSubclass * @see Widget#getStyle */ -public Link (Composite parent, int style) { +public this (Composite parent, int style) { super (parent, style); } @@ -135,10 +135,10 @@ //TODO wrapping, wHint int borderStyle = hasBorder() ? OS.NSBezelBorder : OS.NSNoBorder; NSSize borderSize = NSScrollView.frameSizeForContentSize(new NSSize(), false, false, borderStyle); - NSTextView widget = (NSTextView)view; + NSTextView widget = cast(NSTextView)view; NSSize size = widget.textStorage().size(); - width = (int)(size.width + borderSize.width); - height = (int)(size.height + borderSize.height); + width = cast(int)(size.width + borderSize.width); + height = cast(int)(size.height + borderSize.height); if (wHint !is DWT.DEFAULT) width = wHint; if (hHint !is DWT.DEFAULT) height = hHint; int border = getBorderWidth (); @@ -148,13 +148,13 @@ } void createHandle () { - SWTScrollView scrollWidget = (SWTScrollView)new SWTScrollView().alloc(); + SWTScrollView scrollWidget = cast(SWTScrollView)new SWTScrollView().alloc(); scrollWidget.initWithFrame(new NSRect ()); scrollWidget.setDrawsBackground(false); scrollWidget.setBorderType(hasBorder() ? OS.NSBezelBorder : OS.NSNoBorder); scrollWidget.setTag(jniRef); - SWTTextView widget = (SWTTextView)new SWTTextView().alloc(); + SWTTextView widget = cast(SWTTextView)new SWTTextView().alloc(); widget.initWithFrame(new NSRect()); widget.setEditable(false); widget.setDrawsBackground(false); @@ -406,7 +406,7 @@ if (string is null) error (DWT.ERROR_NULL_ARGUMENT); if (string.equals (text)) return; text = string; - NSTextView widget = (NSTextView)view; + NSTextView widget = cast(NSTextView)view; widget.setString(NSString.stringWith(parse(string))); NSTextStorage textStorage = widget.textStorage(); NSRange range = new NSRange(); diff -r fb2555104d70 -r 5b53d338c709 dwt/widgets/List.d --- a/dwt/widgets/List.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/widgets/List.d Fri Aug 29 22:04:22 2008 +0200 @@ -53,7 +53,7 @@ * IMPORTANT: This class is not intended to be subclassed. *

    */ -public class List extends Scrollable { +public class List : Scrollable { NSTableColumn column; String [] items; int itemCount; @@ -88,7 +88,7 @@ * @see Widget#checkSubclass * @see Widget#getStyle */ -public List (Composite parent, int style) { +public this (Composite parent, int style) { super (parent, checkStyle (style)); } @@ -116,7 +116,7 @@ items = newItems; } items [itemCount++] = string; - ((NSTableView)view).reloadData(); + (cast(NSTableView)view).reloadData(); //TODO adjust horizontal scrollbar } @@ -155,7 +155,7 @@ } System.arraycopy (items, index, items, index + 1, itemCount++ - index); items [index] = string; - ((NSTableView)view).reloadData(); + (cast(NSTableView)view).reloadData(); } /** @@ -221,7 +221,7 @@ } void createHandle () { - SWTScrollView scrollWidget = (SWTScrollView)new SWTScrollView().alloc(); + SWTScrollView scrollWidget = cast(SWTScrollView)new SWTScrollView().alloc(); scrollWidget.initWithFrame(new NSRect ()); if ((style & DWT.H_SCROLL) !is 0) scrollWidget.setHasHorizontalScroller(true); if ((style & DWT.V_SCROLL) !is 0) scrollWidget.setHasVerticalScroller(true); @@ -229,7 +229,7 @@ scrollWidget.setBorderType((style & DWT.BORDER) !is 0 ? OS.NSBezelBorder : OS.NSNoBorder); scrollWidget.setTag(jniRef); - NSTableView widget = (NSTableView)new SWTTableView().alloc(); + NSTableView widget = cast(NSTableView)new SWTTableView().alloc(); widget.initWithFrame(new NSRect()); widget.setAllowsMultipleSelection((style & DWT.MULTI) !is 0); widget.setDataSource(widget); @@ -239,7 +239,7 @@ if (!hasBorder()) widget.setFocusRingType(OS.NSFocusRingTypeNone); widget.setTag(jniRef); - column = (NSTableColumn)new NSTableColumn().alloc(); + column = cast(NSTableColumn)new NSTableColumn().alloc(); column.initWithIdentifier(NSString.stringWith("")); widget.addTableColumn (column); @@ -277,7 +277,7 @@ public void deselect (int index) { checkWidget(); if (0 <= index && index < itemCount) { - NSTableView widget = (NSTableView)view; + NSTableView widget = cast(NSTableView)view; ignoreSelect = true; widget.deselectRow (index); ignoreSelect = false; @@ -310,7 +310,7 @@ if (start is 0 && end is itemCount - 1) { deselectAll (); } else { - NSTableView widget = (NSTableView)view; + NSTableView widget = cast(NSTableView)view; ignoreSelect = true; for (int i=0; i 1)) return; int count = 0; - NSMutableIndexSet indexes = (NSMutableIndexSet)new NSMutableIndexSet().alloc().init(); + NSMutableIndexSet indexes = cast(NSMutableIndexSet)new NSMutableIndexSet().alloc().init(); for (int i=0; i= 0 && index < itemCount) { @@ -938,7 +938,7 @@ } } if (count > 0) { - NSTableView widget = (NSTableView)view; + NSTableView widget = cast(NSTableView)view; ignoreSelect = true; widget.selectRowIndexes(indexes, true); ignoreSelect = false; @@ -946,9 +946,9 @@ } void select (int [] ids, int count, bool clear) { - NSMutableIndexSet indexes = (NSMutableIndexSet)new NSMutableIndexSet().alloc().init(); + NSMutableIndexSet indexes = cast(NSMutableIndexSet)new NSMutableIndexSet().alloc().init(); for (int i=0; inot intended to be subclassed. *

    */ -public class Menu extends Widget { +public class Menu : Widget { /** * the handle to the OS resource * (Warning: This field is platform dependent) @@ -85,7 +85,7 @@ * @see Widget#checkSubclass * @see Widget#getStyle */ -public Menu (Control parent) { +public this (Control parent) { this (checkNull (parent).menuShell (), DWT.POP_UP); } @@ -120,7 +120,7 @@ * @see Widget#checkSubclass * @see Widget#getStyle */ -public Menu (Decorations parent, int style) { +public this (Decorations parent, int style) { super (parent, checkStyle (style)); this.parent = parent; createWidget (); @@ -146,7 +146,7 @@ * @see Widget#checkSubclass * @see Widget#getStyle */ -public Menu (Menu parentMenu) { +public this (Menu parentMenu) { this (checkNull (parentMenu).parent, DWT.DROP_DOWN); } @@ -170,7 +170,7 @@ * @see Widget#checkSubclass * @see Widget#getStyle */ -public Menu (MenuItem parentItem) { +public this (MenuItem parentItem) { this (checkNull (parentItem).parent); } @@ -208,7 +208,7 @@ } else { location = window.mouseLocationOutsideOfEventStream(); } - NSEvent nsEvent = NSEvent.otherEventWithType(OS.NSApplicationDefined, location, 0, 0.0, window.windowNumber(), window.graphicsContext(), (short)0, 0, 0); + NSEvent nsEvent = NSEvent.otherEventWithType(OS.NSApplicationDefined, location, 0, 0.0, window.windowNumber(), window.graphicsContext(), cast(short)0, 0, 0); NSMenu.static_popUpContextMenu_withEvent_forView_ (nsMenu, nsEvent, shell.view); } else { nsMenu.cancelTracking (); @@ -270,7 +270,7 @@ void createHandle () { // display.addMenu (this); - SWTMenu widget = (SWTMenu)new SWTMenu().alloc(); + SWTMenu widget = cast(SWTMenu)new SWTMenu().alloc(); widget.initWithTitle(NSString.stringWith("")); widget.setAutoenablesItems(false); widget.setTag(jniRef); @@ -286,7 +286,7 @@ nsItem = NSMenuItem.separatorItem(); nsItem.retain(); } else { - nsItem = (NSMenuItem)new SWTMenuItem().alloc(); + nsItem = cast(NSMenuItem)new SWTMenuItem().alloc(); nsItem.initWithTitle(NSString.stringWith(""), 0, NSString.stringWith("")); nsItem.setTarget(nsItem); nsItem.setAction(OS.sel_sendSelection); @@ -640,8 +640,8 @@ int jniRef = OS.objc_msgSend(itemID, OS.sel_tag); if (jniRef !is -1 && jniRef !is 0) { Object object = OS.JNIGetObject(jniRef); - if (object instanceof MenuItem) { - MenuItem item = (MenuItem)object; + if ( null !is cast(MenuItem)object ) { + MenuItem item = cast(MenuItem)object; item.sendEvent (DWT.Arm); } } @@ -802,10 +802,10 @@ checkWidget(); if (enabled) { state &= ~DISABLED; - //OS.EnableMenuItem (handle, (short)0); + //OS.EnableMenuItem (handle, cast(short)0); } else { state |= DISABLED; - //OS.DisableMenuItem (handle, (short)0); + //OS.DisableMenuItem (handle, cast(short)0); } } diff -r fb2555104d70 -r 5b53d338c709 dwt/widgets/MenuItem.d --- a/dwt/widgets/MenuItem.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/widgets/MenuItem.d Fri Aug 29 22:04:22 2008 +0200 @@ -42,7 +42,7 @@ * IMPORTANT: This class is not intended to be subclassed. *

    */ -public class MenuItem extends Item { +public class MenuItem : Item { NSMenuItem nsItem; Menu parent, menu; int accelerator; @@ -82,7 +82,7 @@ * @see Widget#checkSubclass * @see Widget#getStyle */ -public MenuItem (Menu parent, int style) { +public this (Menu parent, int style) { super (parent, checkStyle (style)); this.parent = parent; parent.createItem (this, parent.getItemCount ()); @@ -124,7 +124,7 @@ * @see Widget#checkSubclass * @see Widget#getStyle */ -public MenuItem (Menu parent, int style, int index) { +public this (Menu parent, int style, int index) { super (parent, checkStyle (style)); this.parent = parent; parent.createItem (this, index); @@ -224,7 +224,7 @@ NSMenu createEmptyMenu () { if ((parent.style & DWT.BAR) !is 0) { - return (NSMenu) new SWTMenu ().alloc ().init (); + return cast(NSMenu) new SWTMenu ().alloc ().init (); } return null; } @@ -330,7 +330,7 @@ public bool getSelection () { checkWidget (); if ((style & (DWT.CHECK | DWT.RADIO)) is 0) return false; - return ((NSMenuItem)nsItem).state() is OS.NSOnState; + return (cast(NSMenuItem)nsItem).state() is OS.NSOnState; } //int kEventProcessCommand (int nextHandler, int theEvent, int userData) { @@ -351,7 +351,7 @@ // int [] modifiers = new int [1]; // OS.GetEventParameter (theEvent, OS.kEventParamKeyModifiers, OS.typeUInt32, null, 4, null, modifiers); // Event event = new Event (); -// setInputState (event, (short) 0, OS.GetCurrentEventButtonState (), modifiers [0]); +// setInputState (event, cast(short) 0, OS.GetCurrentEventButtonState (), modifiers [0]); // postEvent (DWT.Selection, event); // return OS.noErr; //} @@ -530,7 +530,7 @@ } Event event = new Event (); //TODO state mask -// setInputState (event, (short) 0, OS.GetCurrentEventButtonState (), modifiers [0]); +// setInputState (event, cast(short) 0, OS.GetCurrentEventButtonState (), modifiers [0]); postEvent (DWT.Selection, event); } @@ -557,9 +557,9 @@ int virtualKey = Display.untranslateKey (key); NSString string = null; if (virtualKey !is 0) { - string = NSString.stringWith ((char)virtualKey + ""); + string = NSString.stringWith (cast(wchar)virtualKey + ""); } else { - string = NSString.stringWith ((char)key + "").lowercaseString(); + string = NSString.stringWith (cast(wchar)key + "").lowercaseString(); } nsItem.setKeyEquivalent (string); int mask = 0; @@ -589,7 +589,7 @@ */ public void setEnabled (bool enabled) { checkWidget (); - ((NSMenuItem)nsItem).setEnabled(enabled); + (cast(NSMenuItem)nsItem).setEnabled(enabled); } /** @@ -610,7 +610,7 @@ checkWidget (); if ((style & DWT.SEPARATOR) !is 0) return; super.setImage (image); - ((NSMenuItem)nsItem).setImage(image !is null? image.handle : null); + (cast(NSMenuItem)nsItem).setImage(image !is null? image.handle : null); } /** @@ -699,7 +699,7 @@ public void setSelection (bool selected) { checkWidget (); if ((style & (DWT.CHECK | DWT.RADIO)) is 0) return; - ((NSMenuItem)nsItem).setState(selected ? OS.NSOnState : OS.NSOffState); + (cast(NSMenuItem)nsItem).setState(selected ? OS.NSOnState : OS.NSOffState); } /** diff -r fb2555104d70 -r 5b53d338c709 dwt/widgets/MessageBox.d --- a/dwt/widgets/MessageBox.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/widgets/MessageBox.d Fri Aug 29 22:04:22 2008 +0200 @@ -39,7 +39,7 @@ * within the DWT implementation. *

    */ -public class MessageBox extends Dialog { +public class MessageBox : Dialog { String message = ""; @@ -56,7 +56,7 @@ *
  • ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass
  • * */ -public MessageBox (Shell parent) { +public this (Shell parent) { this (parent, DWT.OK | DWT.ICON_INFORMATION | DWT.APPLICATION_MODAL); } @@ -83,7 +83,7 @@ *
  • ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass
  • * */ -public MessageBox (Shell parent, int style) { +public this (Shell parent, int style) { super (parent, checkStyle (style)); checkSubclass (); } diff -r fb2555104d70 -r 5b53d338c709 dwt/widgets/Monitor.d diff -r fb2555104d70 -r 5b53d338c709 dwt/widgets/ProgressBar.d --- a/dwt/widgets/ProgressBar.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/widgets/ProgressBar.d Fri Aug 29 22:04:22 2008 +0200 @@ -37,7 +37,7 @@ * within the DWT implementation. *

    */ -public class ProgressBar extends Control { +public class ProgressBar : Control { /** * Constructs a new instance of this class given its parent @@ -69,7 +69,7 @@ * @see Widget#checkSubclass * @see Widget#getStyle */ -public ProgressBar (Composite parent, int style) { +public this (Composite parent, int style) { super (parent, checkStyle (style)); } @@ -80,12 +80,12 @@ public Point computeSize (int wHint, int hHint, bool changed) { checkWidget(); - NSProgressIndicator widget = (NSProgressIndicator)view; + NSProgressIndicator widget = cast(NSProgressIndicator)view; NSRect oldRect = widget.frame(); widget.sizeToFit(); NSRect newRect = widget.frame(); widget.setFrame (oldRect); - int size = (int)newRect.height; + int size = cast(int)newRect.height; int width = 0, height = 0; if ((style & DWT.HORIZONTAL) !is 0) { height = size; @@ -100,7 +100,7 @@ } void createHandle () { - SWTProgressIndicator widget = (SWTProgressIndicator)new SWTProgressIndicator().alloc(); + SWTProgressIndicator widget = cast(SWTProgressIndicator)new SWTProgressIndicator().alloc(); widget.initWithFrame(new NSRect()); widget.setUsesThreadedAnimation(false); widget.setIndeterminate((style & DWT.INDETERMINATE) !is 0); @@ -122,7 +122,7 @@ */ public int getMaximum () { checkWidget(); - return (int)((NSProgressIndicator)view).maxValue(); + return cast(int)(cast(NSProgressIndicator)view).maxValue(); } /** @@ -137,7 +137,7 @@ */ public int getMinimum () { checkWidget(); - return (int)((NSProgressIndicator)view).minValue(); + return cast(int)(cast(NSProgressIndicator)view).minValue(); } /** @@ -152,7 +152,7 @@ */ public int getSelection () { checkWidget(); - return (int)((NSProgressIndicator)view).doubleValue(); + return cast(int)(cast(NSProgressIndicator)view).doubleValue(); } public int getState () { @@ -176,7 +176,7 @@ public void setMaximum (int value) { checkWidget(); if (value < 0) return; - ((NSProgressIndicator)view).setMaxValue(value); + (cast(NSProgressIndicator)view).setMaxValue(value); } /** @@ -195,7 +195,7 @@ public void setMinimum (int value) { checkWidget(); if (value < 0) return; - ((NSProgressIndicator)view).setMinValue(value); + (cast(NSProgressIndicator)view).setMinValue(value); } /** @@ -212,7 +212,7 @@ */ public void setSelection (int value) { checkWidget(); - ((NSProgressIndicator)view).setDoubleValue(value); + (cast(NSProgressIndicator)view).setDoubleValue(value); } public void setState (int state) { diff -r fb2555104d70 -r 5b53d338c709 dwt/widgets/RunnableLock.d diff -r fb2555104d70 -r 5b53d338c709 dwt/widgets/Sash.d --- a/dwt/widgets/Sash.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/widgets/Sash.d Fri Aug 29 22:04:22 2008 +0200 @@ -42,7 +42,7 @@ * within the DWT implementation. *

    */ -public class Sash extends Control { +public class Sash : Control { Cursor sizeCursor; bool dragging; int lastX, lastY, startX, startY; @@ -78,7 +78,7 @@ * @see Widget#checkSubclass * @see Widget#getStyle */ -public Sash (Composite parent, int style) { +public this (Composite parent, int style) { super (parent, checkStyle (style)); int cursorStyle = (style & DWT.VERTICAL) !is 0 ? DWT.CURSOR_SIZEWE : DWT.CURSOR_SIZENS; sizeCursor = new Cursor (display, cursorStyle); @@ -128,8 +128,8 @@ bool becomeFirstResponder () { bool result = super.becomeFirstResponder(); NSRect frame = view.frame(); - lastX = (int)frame.x; - lastY = (int)frame.y; + lastX = cast(int)frame.x; + lastY = cast(int)frame.y; return result; } @@ -147,7 +147,7 @@ } void createHandle () { - SWTView widget = (SWTView)new SWTView().alloc(); + SWTView widget = cast(SWTView)new SWTView().alloc(); widget.initWithFrame (new NSRect()); widget.setTag(jniRef); view = widget; @@ -219,14 +219,14 @@ if (nsEvent.clickCount() !is 1) return; NSPoint location = nsEvent.locationInWindow(); NSPoint point = view.convertPoint_fromView_(location, null); - startX = (int)point.x; - startY = (int)point.y; + startX = cast(int)point.x; + startY = cast(int)point.y; NSRect frame = view.frame(); Event event = new Event (); - event.x = (int)frame.x; - event.y = (int)frame.y; - event.width = (int)frame.width; - event.height = (int)frame.height; + event.x = cast(int)frame.x; + event.y = cast(int)frame.y; + event.width = cast(int)frame.width; + event.height = cast(int)frame.height; sendEvent (DWT.Selection, event); if (isDisposed ()) return; if (event.doit) { @@ -247,22 +247,22 @@ NSRect parentFrame = parent.topView().frame(); int newX = lastX, newY = lastY; if ((style & DWT.VERTICAL) !is 0) { - newX = Math.min (Math.max (0, (int)(point.x + frame.x - startX)), (int)(parentFrame.width - frame.width)); + newX = Math.min (Math.max (0, cast(int)(point.x + frame.x - startX)), cast(int)(parentFrame.width - frame.width)); } else { - newY = Math.min (Math.max (0, (int)(point.y + frame.y - startY)), (int)(parentFrame.height - frame.height)); + newY = Math.min (Math.max (0, cast(int)(point.y + frame.y - startY)), cast(int)(parentFrame.height - frame.height)); } if (newX is lastX && newY is lastY) return; Event event = new Event (); event.x = newX; event.y = newY; - event.width = (int)frame.width; - event.height = (int)frame.height; + event.width = cast(int)frame.width; + event.height = cast(int)frame.height; sendEvent (DWT.Selection, event); if (isDisposed ()) return; if (event.doit) { lastX = event.x; lastY = event.y; - setBounds (event.x, event.y, (int)frame.width, (int)frame.height); + setBounds (event.x, event.y, cast(int)frame.width, cast(int)frame.height); } } @@ -280,12 +280,12 @@ Event event = new Event (); event.x = lastX; event.y = lastY; - event.width = (int)frame.width; - event.height = (int)frame.height; + event.width = cast(int)frame.width; + event.height = cast(int)frame.height; sendEvent (DWT.Selection, event); if (isDisposed ()) return; if (event.doit) { - setBounds (event.x, event.y, (int)frame.width, (int)frame.height); + setBounds (event.x, event.y, cast(int)frame.width, cast(int)frame.height); } } diff -r fb2555104d70 -r 5b53d338c709 dwt/widgets/Scale.d --- a/dwt/widgets/Scale.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/widgets/Scale.d Fri Aug 29 22:04:22 2008 +0200 @@ -39,7 +39,7 @@ * within the DWT implementation. *

    */ -public class Scale extends Control { +public class Scale : Control { int increment = 1; int pageIncrement = 10; @@ -72,7 +72,7 @@ * @see Widget#checkSubclass * @see Widget#getStyle */ -public Scale (Composite parent, int style) { +public this (Composite parent, int style) { super (parent, checkStyle (style)); } @@ -113,17 +113,17 @@ public Point computeSize (int wHint, int hHint, bool changed) { checkWidget(); - NSSlider widget = (NSSlider)view; + NSSlider widget = cast(NSSlider)view; NSRect oldRect = widget.frame(); widget.sizeToFit(); NSRect newRect = widget.frame(); widget.setFrame (oldRect); int width = 0, height = 0; if ((style & DWT.HORIZONTAL) !is 0) { - height = (int)newRect.width; + height = cast(int)newRect.width; width = height * 10; } else { - width = (int)newRect.width; + width = cast(int)newRect.width; height = width * 10; } if (wHint !is DWT.DEFAULT) width = wHint; @@ -132,7 +132,7 @@ } void createHandle () { - NSSlider widget = (NSSlider)new SWTSlider().alloc(); + NSSlider widget = cast(NSSlider)new SWTSlider().alloc(); NSRect rect = new NSRect(); if ((style & DWT.HORIZONTAL) !is 0) { rect.width = 1; @@ -175,7 +175,7 @@ */ public int getMaximum () { checkWidget(); - return (int)((NSSlider)view).maxValue(); + return cast(int)(cast(NSSlider)view).maxValue(); } /** @@ -190,7 +190,7 @@ */ public int getMinimum () { checkWidget(); - return (int)((NSSlider)view).minValue(); + return cast(int)(cast(NSSlider)view).minValue(); } /** @@ -228,7 +228,7 @@ // int maximum = OS.GetControl32BitMaximum (handle); // value = maximum - value + minimum; // } - return (int)((NSSlider)view).doubleValue(); + return cast(int)(cast(NSSlider)view).doubleValue(); } /** @@ -291,7 +291,7 @@ public void setMaximum (int value) { checkWidget(); if (value < 0) return; - ((NSSlider)view).setMaxValue(value); + (cast(NSSlider)view).setMaxValue(value); } /** @@ -310,7 +310,7 @@ public void setMinimum (int value) { checkWidget(); if (value < 0) return; - ((NSSlider)view).setMinValue(value); + (cast(NSSlider)view).setMinValue(value); } /** @@ -345,7 +345,7 @@ */ public void setSelection (int value) { checkWidget(); - ((NSSlider)view).setDoubleValue(value); + (cast(NSSlider)view).setDoubleValue(value); } } diff -r fb2555104d70 -r 5b53d338c709 dwt/widgets/ScrollBar.d --- a/dwt/widgets/ScrollBar.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/widgets/ScrollBar.d Fri Aug 29 22:04:22 2008 +0200 @@ -85,7 +85,7 @@ * @see Scrollable#getHorizontalBar * @see Scrollable#getVerticalBar */ -public class ScrollBar extends Widget { +public class ScrollBar : Widget { NSScroller view; Scrollable parent; int minimum, maximum, thumb; @@ -94,7 +94,7 @@ id target; int actionSelector;; -ScrollBar () { +this () { /* Do nothing */ } @@ -259,9 +259,9 @@ */ public int getSelection () { checkWidget(); - NSScroller widget = (NSScroller)view; + NSScroller widget = cast(NSScroller)view; float value = widget.floatValue(); - return (int)((maximum - thumb - minimum) * value + minimum); + return cast(int)((maximum - thumb - minimum) * value + minimum); } /** @@ -412,7 +412,7 @@ value = getSelection (); } Event event = new Event(); - int hitPart = ((NSScroller)view).hitPart(); + int hitPart = (cast(NSScroller)view).hitPart(); switch (hitPart) { case OS.NSScrollerDecrementLine: value -= increment; @@ -652,11 +652,11 @@ } void updateBar(int selection, int minimum, int maximum, int thumb) { - NSScroller widget = (NSScroller)view; + NSScroller widget = cast(NSScroller)view; selection = Math.max(minimum, Math.min(maximum - thumb, selection)); int range = maximum - thumb - minimum; - float fraction = range < 0 ? 1 : (float)(selection - minimum) / range; - float knob = minimum is maximum ? 1 : (float)(thumb - minimum) / maximum - minimum; + float fraction = range < 0 ? 1 : cast(float)(selection - minimum) / range; + float knob = minimum is maximum ? 1 : cast(float)(thumb - minimum) / maximum - minimum; widget.setFloatValue(fraction, knob); widget.setEnabled(range > 0); } diff -r fb2555104d70 -r 5b53d338c709 dwt/widgets/Scrollable.d --- a/dwt/widgets/Scrollable.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/widgets/Scrollable.d Fri Aug 29 22:04:22 2008 +0200 @@ -38,11 +38,11 @@ * within the DWT implementation. *

    */ -public abstract class Scrollable extends Control { +public abstract class Scrollable : Control { SWTScrollView scrollView; ScrollBar horizontalBar, verticalBar; -Scrollable () { +this () { /* Do nothing */ } @@ -75,7 +75,7 @@ * @see Widget#checkSubclass * @see Widget#getStyle */ -public Scrollable (Composite parent, int style) { +public this (Composite parent, int style) { super (parent, style); } @@ -114,8 +114,8 @@ size.height = height; int border = hasBorder() ? OS.NSBezelBorder : OS.NSNoBorder; size = NSScrollView.frameSizeForContentSize(size, (style & DWT.H_SCROLL) !is 0, (style & DWT.V_SCROLL) !is 0, border); - width = (int)size.width; - height = (int)size.height; + width = cast(int)size.width; + height = cast(int)size.height; NSRect frame = scrollView.contentView().frame(); x -= frame.x; y -= frame.y; @@ -174,10 +174,10 @@ checkWidget(); if (scrollView !is null) { NSSize size = scrollView.contentSize(); - return new Rectangle(0, 0, (int)size.width, (int)size.height); + return new Rectangle(0, 0, cast(int)size.width, cast(int)size.height); } else { NSRect rect = view.bounds(); - return new Rectangle(0, 0, (int)rect.width, (int)rect.height); + return new Rectangle(0, 0, cast(int)rect.width, cast(int)rect.height); } } @@ -252,8 +252,8 @@ // int width, height; // CGRect rect = new CGRect (); // OS.HIViewGetBounds (scrolledHandle, rect); -// width = (int) rect.width; -// height = (int) rect.height; +// width = cast(int) rect.width; +// height = cast(int) rect.height; // Rect inset = inset (); // width = Math.max (0, width - vWidth - inset.left - inset.right); // height = Math.max (0, height - hHeight - inset.top - inset.bottom); diff -r fb2555104d70 -r 5b53d338c709 dwt/widgets/Shell.d --- a/dwt/widgets/Shell.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/widgets/Shell.d Fri Aug 29 22:04:22 2008 +0200 @@ -128,7 +128,7 @@ * @see Decorations * @see DWT */ -public class Shell extends Decorations { +public class Shell : Decorations { NSWindow window; SWTWindowDelegate windowDelegate; bool opened, moved, resized, fullScreen; @@ -142,21 +142,21 @@ /** * Constructs a new instance of this class. This is equivalent - * to calling Shell((Display) null). + * to calling Shell(cast(Display) null). * * @exception DWTException
      *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent
    • *
    • ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass
    • *
    */ -public Shell () { - this ((Display) null); +public this () { + this (cast(Display) null); } /** * Constructs a new instance of this class given only the style * value describing its behavior and appearance. This is equivalent - * to calling Shell((Display) null, style). + * to calling Shell(cast(Display) null, style). *

    * The style value is either one of the style constants defined in * class DWT which is applicable to instances of this @@ -188,8 +188,8 @@ * @see DWT#APPLICATION_MODAL * @see DWT#SYSTEM_MODAL */ -public Shell (int style) { - this ((Display) null, style); +public this (int style) { + this (cast(Display) null, style); } /** @@ -211,7 +211,7 @@ *

  • ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass
  • * */ -public Shell (Display display) { +public this (Display display) { this (display, DWT.SHELL_TRIM); } @@ -258,11 +258,11 @@ * @see DWT#APPLICATION_MODAL * @see DWT#SYSTEM_MODAL */ -public Shell (Display display, int style) { +public this (Display display, int style) { this (display, null, style, 0, false); } -Shell (Display display, Shell parent, int style, int handle, bool embedded) { +this (Display display, Shell parent, int style, int handle, bool embedded) { super (); checkSubclass (); if (display is null) display = Display.getCurrent (); @@ -309,7 +309,7 @@ *
  • ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass
  • * */ -public Shell (Shell parent) { +public this (Shell parent) { this (parent, DWT.DIALOG_TRIM); } @@ -360,7 +360,7 @@ * @see DWT#APPLICATION_MODAL * @see DWT#SYSTEM_MODAL */ -public Shell (Shell parent, int style) { +public this (Shell parent, int style) { this (parent !is null ? parent.display : null, parent, style, 0, false); } @@ -457,7 +457,7 @@ rect.width = trim.width; rect.height = trim.height; rect = NSWindow.static_frameRectForContentRect_styleMask_(rect, window.styleMask()); - return new Rectangle ((int)rect.x, (int)rect.y, (int)rect.width, (int)rect.height); + return new Rectangle (cast(int)rect.x, cast(int)rect.y, cast(int)rect.width, cast(int)rect.height); } void createHandle () { @@ -466,9 +466,9 @@ view = window.contentView(); return; } else { - SWTWindow swtWindow = (SWTWindow) new SWTWindow ().alloc (); + SWTWindow swtWindow = cast(SWTWindow) new SWTWindow ().alloc (); swtWindow.setTag(jniRef); - window = (NSWindow)swtWindow; + window = cast(NSWindow)swtWindow; NSRect rect = new NSRect(); Monitor monitor = getMonitor (); Rectangle clientArea = monitor.getClientArea (); @@ -492,7 +492,7 @@ createHandle (null); window.setContentView (topView()); - windowDelegate = (SWTWindowDelegate)new SWTWindowDelegate().alloc().init(); + windowDelegate = cast(SWTWindowDelegate)new SWTWindowDelegate().alloc().init(); windowDelegate.setTag(jniRef); window.setDelegate(windowDelegate); } @@ -586,27 +586,27 @@ public int getAlpha () { checkWidget (); - return (int)(window.alphaValue() * 255); + return cast(int)(window.alphaValue() * 255); } public Rectangle getBounds () { checkWidget(); NSRect frame = window.frame (); - return new Rectangle ((int)frame.x, (int) frame.y, (int) frame.width, (int) frame.height); + return new Rectangle (cast(int)frame.x, cast(int) frame.y, cast(int) frame.width, cast(int) frame.height); } public Rectangle getClientArea () { checkWidget(); //TODO why super implementation fails NSRect rect = window.contentRectForFrameRect_(window.frame()); - int width = (int)rect.width, height = (int)rect.height; + int width = cast(int)rect.width, height = cast(int)rect.height; if (scrollView !is null) { NSSize size = new NSSize(); size.width = width; size.height = height; size = NSScrollView.contentSizeForFrameSize(size, (style & DWT.H_SCROLL) !is 0, (style & DWT.V_SCROLL) !is 0, OS.NSNoBorder); - width = (int)size.width; - height = (int)size.height; + width = cast(int)size.width; + height = cast(int)size.height; } return new Rectangle (0, 0, width, height); } @@ -646,7 +646,7 @@ public Point getLocation () { checkWidget(); NSRect frame = window.frame (); - return new Point ((int) frame.x, (int) frame.y); + return new Point (cast(int) frame.x, cast(int) frame.y); } public bool getMaximized () { @@ -683,8 +683,8 @@ // OS.GetWindowStructureWidths (shellHandle, rect); // CGPoint inMinLimits = new CGPoint (), inMaxLimits = new CGPoint (); // OS.GetWindowResizeLimits (shellHandle, inMinLimits, inMaxLimits); -// int width = Math.max (1, (int) inMinLimits.x + (rect.left + rect.right)); -// int height = Math.max (1, (int) inMinLimits.y + (rect.top + rect.bottom)); +// int width = Math.max (1, cast(int) inMinLimits.x + (rect.left + rect.right)); +// int height = Math.max (1, cast(int) inMinLimits.y + (rect.top + rect.bottom)); // return new Point (width, height); return null; } @@ -757,7 +757,7 @@ public Point getSize () { checkWidget(); NSRect frame = window.frame (); - return new Point ((int) frame.width, (int) frame.height); + return new Point (cast(int) frame.width, cast(int) frame.height); } bool hasBorder () { @@ -972,7 +972,7 @@ NSRect rect = new NSRect (); rect.x = x; //TODO - get the screen for the point - int screenHeight = (int) window.screen().frame().height; + int screenHeight = cast(int) window.screen().frame().height; rect.y = screenHeight - y; rect.width = width; rect.height = height; @@ -982,7 +982,7 @@ NSPoint point = new NSPoint(); point.x = x; //TODO - get the screen for the point - int screenHeight = (int) window.screen().frame().height; + int screenHeight = cast(int) window.screen().frame().height; point.y = screenHeight - y; window.setFrameTopLeftPoint (point); } else { @@ -1022,8 +1022,8 @@ // screen.y += rect.top; // } // Rect rect = new Rect (); -// OS.SetRect (rect, (short) screen.x, (short) screen.y, (short) (screen.x + screen.width), (short) (screen.y + screen.height)); -// OS.SetWindowBounds (shellHandle, (short) OS.kWindowStructureRgn, rect); +// OS.SetRect (rect, cast(short) screen.x, cast(short) screen.y, cast(short) (screen.x + screen.width), cast(short) (screen.y + screen.height)); +// OS.SetWindowBounds (shellHandle, cast(short) OS.kWindowStructureRgn, rect); // } else { // int attributes = 0; // if ((style & DWT.RESIZE) !is 0) { @@ -1044,8 +1044,8 @@ // setMaximized (true); // } else { // Rect rect = new Rect (); -// if (normalBounds !is null) OS.SetRect (rect, (short) normalBounds.x, (short) normalBounds.y, (short) (normalBounds.x + normalBounds.width), (short) (normalBounds.y + normalBounds.height)); -// OS.SetWindowBounds (shellHandle, (short) OS.kWindowStructureRgn, rect); +// if (normalBounds !is null) OS.SetRect (rect, cast(short) normalBounds.x, cast(short) normalBounds.y, cast(short) (normalBounds.x + normalBounds.width), cast(short) (normalBounds.y + normalBounds.height)); +// OS.SetWindowBounds (shellHandle, cast(short) OS.kWindowStructureRgn, rect); // } // normalBounds = null; // } @@ -1087,10 +1087,10 @@ // Rect rect = new Rect (); // int gdevice = OS.GetMainDevice (); // OS.GetAvailableWindowPositioningBounds (gdevice, rect); -// pt.h = (short) (rect.right - rect.left); -// pt.v = (short) (rect.bottom - rect.top); +// pt.h = cast(short) (rect.right - rect.left); +// pt.v = cast(short) (rect.bottom - rect.top); // } -// short inPartCode = (short) (maximized ? OS.inZoomOut : OS.inZoomIn); +// short inPartCode = cast(short) (maximized ? OS.inZoomOut : OS.inZoomIn); // OS.ZoomWindowIdeal (shellHandle, inPartCode, pt); } @@ -1193,8 +1193,8 @@ // } else { // if (rgnRect is null) { // rgnRect = new Rect (); -// OS.GetWindowBounds (shellHandle, (short) OS.kWindowStructureRgn, rgnRect); -// OS.SetRect (rgnRect, (short) 0, (short) 0, (short) (rgnRect.right - rgnRect.left), (short) (rgnRect.bottom - rgnRect.top)); +// OS.GetWindowBounds (shellHandle, cast(short) OS.kWindowStructureRgn, rgnRect); +// OS.SetRect (rgnRect, cast(short) 0, cast(short) 0, cast(short) (rgnRect.right - rgnRect.left), cast(short) (rgnRect.bottom - rgnRect.top)); // } // } // this.region = region; @@ -1288,7 +1288,7 @@ isActive = true; break; } - current = (Shell) current.parent; + current = cast(Shell) current.parent; } if (!isActive) return; // if (fullScreen) { diff -r fb2555104d70 -r 5b53d338c709 dwt/widgets/Slider.d --- a/dwt/widgets/Slider.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/widgets/Slider.d Fri Aug 29 22:04:22 2008 +0200 @@ -71,7 +71,7 @@ * * @see ScrollBar */ -public class Slider extends Control { +public class Slider : Control { bool dragging; int minimum, maximum, thumb; int increment = 1; @@ -106,7 +106,7 @@ * @see Widget#checkSubclass * @see Widget#getStyle */ -public Slider (Composite parent, int style) { +public this (Composite parent, int style) { super (parent, checkStyle (style)); } @@ -158,10 +158,10 @@ checkWidget(); int width = 0, height = 0; if ((style & DWT.HORIZONTAL) !is 0) { - height = (int)NSScroller.scrollerWidth(); + height = cast(int)NSScroller.scrollerWidth(); width = height * 10; } else { - width = (int)NSScroller.scrollerWidth(); + width = cast(int)NSScroller.scrollerWidth(); height = width * 10; } if (wHint !is DWT.DEFAULT) width = wHint; @@ -170,7 +170,7 @@ } void createHandle () { - NSScroller widget = (NSScroller)new SWTScroller().alloc(); + NSScroller widget = cast(NSScroller)new SWTScroller().alloc(); NSRect rect = new NSRect(); if ((style & DWT.HORIZONTAL) !is 0) { rect.width = 1; @@ -269,9 +269,9 @@ */ public int getSelection () { checkWidget(); - NSScroller widget = (NSScroller)view; + NSScroller widget = cast(NSScroller)view; float value = widget.floatValue(); - return (int)((maximum - thumb - minimum) * value + minimum); + return cast(int)((maximum - thumb - minimum) * value + minimum); } /** @@ -317,7 +317,7 @@ void sendSelection () { Event event = new Event(); - int hitPart = ((NSScroller)view).hitPart(); + int hitPart = (cast(NSScroller)view).hitPart(); int value = getSelection (); switch (hitPart) { case OS.NSScrollerDecrementLine: @@ -452,10 +452,10 @@ } void updateBar(int selection, int minimum, int maximum, int thumb) { - NSScroller widget = (NSScroller)view; + NSScroller widget = cast(NSScroller)view; selection = Math.max(minimum, Math.min(maximum - thumb, selection)); - float fraction = minimum is maximum ? 1 : (float)(selection - minimum) / (maximum - thumb - minimum); - float knob = minimum is maximum ? 1 : (float)(thumb - minimum) / (maximum - minimum); + float fraction = minimum is maximum ? 1 : cast(float)(selection - minimum) / (maximum - thumb - minimum); + float knob = minimum is maximum ? 1 : cast(float)(thumb - minimum) / (maximum - minimum); widget.setFloatValue(fraction, knob); } diff -r fb2555104d70 -r 5b53d338c709 dwt/widgets/Spinner.d --- a/dwt/widgets/Spinner.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/widgets/Spinner.d Fri Aug 29 22:04:22 2008 +0200 @@ -53,7 +53,7 @@ * * @since 3.1 */ -public class Spinner extends Composite { +public class Spinner : Composite { NSTextField textView; NSStepper buttonView; int pageIncrement = 10; @@ -90,7 +90,7 @@ * @see Widget#checkSubclass * @see Widget#getStyle */ -public Spinner (Composite parent, int style) { +public this (Composite parent, int style) { super (parent, checkStyle (style)); } @@ -203,7 +203,7 @@ char [] chars = new char [length]; string.getChars (0, length, chars, 0); NSString nsString = NSString.stringWithCharacters (chars, length); - NSAttributedString str = ((NSAttributedString) new NSAttributedString ().alloc ()).initWithString_attributes_ (nsString, dict); + NSAttributedString str = (cast(NSAttributedString) new NSAttributedString ().alloc ()).initWithString_attributes_ (nsString, dict); NSSize size = str.size (); str.release (); width = size.width; @@ -222,7 +222,7 @@ height = Math.max (height, newRect.height); if (wHint !is DWT.DEFAULT) width = wHint; if (hHint !is DWT.DEFAULT) height = hHint; - Rectangle trim = computeTrim (0, 0, (int) width, (int) height); + Rectangle trim = computeTrim (0, 0, cast(int) width, cast(int) height); return new Point (trim.width, trim.height); } @@ -240,11 +240,11 @@ public void copy () { checkWidget (); // short [] selection = new short [2]; -// if (OS.GetControlData (textHandle, (short)OS.kControlEntireControl, OS.kControlEditTextSelectionTag, 4, selection, null) !is OS.noErr) return; +// if (OS.GetControlData (textHandle, cast(short)OS.kControlEntireControl, OS.kControlEditTextSelectionTag, 4, selection, null) !is OS.noErr) return; // if (selection [0] is selection [1]) return; // int [] actualSize = new int [1]; // int [] ptr = new int [1]; -// if (OS.GetControlData (textHandle, (short)OS.kControlEntireControl, OS.kControlEditTextCFStringTag, 4, ptr, actualSize) !is OS.noErr) return; +// if (OS.GetControlData (textHandle, cast(short)OS.kControlEntireControl, OS.kControlEditTextCFStringTag, 4, ptr, actualSize) !is OS.noErr) return; // CFRange range = new CFRange (); // range.location = selection [0]; // range.length = selection [1] - selection [0]; @@ -255,17 +255,17 @@ } void createHandle () { - SWTView widget = (SWTView)new SWTView().alloc(); + SWTView widget = cast(SWTView)new SWTView().alloc(); widget.initWithFrame(new NSRect()); // widget.setDrawsBackground(false); widget.setTag(jniRef); - NSStepper buttonWidget = (NSStepper)new SWTStepper().alloc(); + NSStepper buttonWidget = cast(NSStepper)new SWTStepper().alloc(); buttonWidget.initWithFrame(new NSRect()); buttonWidget.setValueWraps((style & DWT.WRAP) !is 0); buttonWidget.setTarget(buttonWidget); buttonWidget.setAction(OS.sel_sendSelection); buttonWidget.setTag(jniRef); - NSTextField textWidget = (NSTextField)new SWTTextField().alloc(); + NSTextField textWidget = cast(NSTextField)new SWTTextField().alloc(); textWidget.initWithFrame(new NSRect()); // textWidget.setTarget(widget); textWidget.setTag(jniRef); @@ -295,7 +295,7 @@ checkWidget (); if ((style & DWT.READ_ONLY) !is 0) return; // short [] selection = new short [2]; -// if (OS.GetControlData (textHandle, (short)OS.kControlEntireControl, OS.kControlEditTextSelectionTag, 4, selection, null) !is OS.noErr) return; +// if (OS.GetControlData (textHandle, cast(short)OS.kControlEntireControl, OS.kControlEditTextSelectionTag, 4, selection, null) !is OS.noErr) return; // if (selection [0] is selection [1]) return; // char [] buffer = setText ("", selection [0], selection [1], true); // if (buffer !is null) { @@ -336,7 +336,7 @@ */ public int getIncrement () { checkWidget (); - return (int)buttonView.increment(); + return cast(int)buttonView.increment(); } /** @@ -351,7 +351,7 @@ */ public int getMaximum () { checkWidget (); - return (int)buttonView.maxValue(); + return cast(int)buttonView.maxValue(); } /** @@ -366,7 +366,7 @@ */ public int getMinimum () { checkWidget (); - return (int)buttonView.minValue(); + return cast(int)buttonView.minValue(); } /** @@ -397,7 +397,7 @@ */ public int getSelection () { checkWidget (); - return (int)((NSStepper)buttonView).doubleValue(); + return cast(int)(cast(NSStepper)buttonView).doubleValue(); } int getSelectionText () { @@ -421,7 +421,7 @@ if ((style & DWT.READ_ONLY) !is 0) return; // String text = getClipboardText (); // short [] selection = new short [2]; -// if (OS.GetControlData (textHandle, (short)OS.kControlEntireControl, OS.kControlEditTextSelectionTag, 4, selection, null) !is OS.noErr) return; +// if (OS.GetControlData (textHandle, cast(short)OS.kControlEntireControl, OS.kControlEditTextSelectionTag, 4, selection, null) !is OS.noErr) return; // setText (text, selection [0], selection [1], true); } @@ -667,7 +667,7 @@ void setSelection (int value, bool setPos, bool setText, bool notify) { if (setPos) { - ((NSStepper)buttonView).setDoubleValue(value); + (cast(NSStepper)buttonView).setDoubleValue(value); } if (setText) { String string = String.valueOf (value); @@ -694,8 +694,8 @@ if (string is null) return; } cell.setTitle(NSString.stringWith(string)); -// short [] selection = new short [] {0, (short)string.length ()}; -// OS.SetControlData (textHandle, (short)OS.kControlEntireControl, OS.kControlEditTextSelectionTag, 4, selection); +// short [] selection = new short [] {0, cast(short)string.length ()}; +// OS.SetControlData (textHandle, cast(short)OS.kControlEntireControl, OS.kControlEditTextSelectionTag, 4, selection); sendEvent (DWT.Modify); } if (notify) postEvent (DWT.Selection); diff -r fb2555104d70 -r 5b53d338c709 dwt/widgets/Synchronizer.d diff -r fb2555104d70 -r 5b53d338c709 dwt/widgets/TabFolder.d --- a/dwt/widgets/TabFolder.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/widgets/TabFolder.d Fri Aug 29 22:04:22 2008 +0200 @@ -53,7 +53,7 @@ * IMPORTANT: This class is not intended to be subclassed. *

    */ -public class TabFolder extends Composite { +public class TabFolder : Composite { TabItem [] items; int itemCount; @@ -85,7 +85,7 @@ * @see Widget#checkSubclass * @see Widget#getStyle */ -public TabFolder (Composite parent, int style) { +public this (Composite parent, int style) { super (parent, checkStyle (style)); } @@ -140,8 +140,8 @@ public Point computeSize (int wHint, int hHint, bool changed) { Point size = super.computeSize (wHint, hHint, changed); if (wHint is DWT.DEFAULT && items.length > 0) { - NSSize mimSize = ((NSTabView)view).minimumSize(); - Rectangle trim = computeTrim (0, 0, (int)mimSize.width, 0); + NSSize mimSize = (cast(NSTabView)view).minimumSize(); + Rectangle trim = computeTrim (0, 0, cast(int)mimSize.width, 0); size.x = Math.max (trim.width, size.x); } return size; @@ -166,8 +166,8 @@ // } // x -= client.left; // y -= client.top; -// width += (int) bounds.width - (client.right - client.left); -// height += (int) bounds.height - (client.bottom - client.top); +// width += cast(int) bounds.width - (client.right - client.left); +// height += cast(int) bounds.height - (client.bottom - client.top); // Rect inset = getInset (); // x -= inset.left; // y -= inset.top; @@ -178,7 +178,7 @@ } void createHandle () { - SWTTabView widget = (SWTTabView)new SWTTabView().alloc(); + SWTTabView widget = cast(SWTTabView)new SWTTabView().alloc(); widget.initWithFrame (new NSRect()); widget.setTag(jniRef); widget.setDelegate(widget); @@ -200,9 +200,9 @@ System.arraycopy (items, index, items, index + 1, count - index); items [index] = item; itemCount++; - NSTabViewItem nsItem = (NSTabViewItem)new NSTabViewItem().alloc().init(); + NSTabViewItem nsItem = cast(NSTabViewItem)new NSTabViewItem().alloc().init(); item.nsItem = nsItem; - ((NSTabView)view).insertTabViewItem(nsItem, index); + (cast(NSTabView)view).insertTabViewItem(nsItem, index); } void createWidget () { @@ -225,16 +225,16 @@ items = new TabItem [4]; } itemCount = count; - ((NSTabView)view).removeTabViewItem(item.nsItem); + (cast(NSTabView)view).removeTabViewItem(item.nsItem); } public Rectangle getClientArea () { checkWidget (); - NSRect rect = ((NSTabView)view).contentRect(); - int x = Math.max (0, (int)rect.x); - int y = Math.max (0, (int)rect.y); - int width = Math.max (0, (int)rect.width); - int height = Math.max (0, (int)rect.height); + NSRect rect = (cast(NSTabView)view).contentRect(); + int x = Math.max (0, cast(int)rect.x); + int y = Math.max (0, cast(int)rect.y); + int width = Math.max (0, cast(int)rect.width); + int height = Math.max (0, cast(int)rect.height); return new Rectangle (x, y, width, height); } @@ -266,7 +266,7 @@ NSPoint nsPoint = new NSPoint (); nsPoint.x = point.x; nsPoint.y = point.y; - NSTabView tabView = (NSTabView) view; + NSTabView tabView = cast(NSTabView) view; NSTabViewItem tabViewItem = tabView.tabViewItemAtPoint (nsPoint); for (int i = 0; i < itemCount; i++) { NSTabViewItem item = items[i].nsItem; @@ -352,7 +352,7 @@ */ public int getSelectionIndex () { checkWidget (); - NSTabViewItem selected = ((NSTabView)view).selectedTabViewItem(); + NSTabViewItem selected = (cast(NSTabView)view).selectedTabViewItem(); if (selected is null) return -1; for (int i = 0; i < itemCount; i++) { if (items[i].nsItem.id is selected.id) return i; @@ -474,7 +474,7 @@ } void setFont (NSFont font) { - ((NSTabView)view).setFont(font); + (cast(NSTabView)view).setFont(font); } /** @@ -561,7 +561,7 @@ } } } - ((NSTabView)view).selectTabViewItemAtIndex(index); + (cast(NSTabView)view).selectTabViewItemAtIndex(index); index = getSelectionIndex(); if (index !is -1) { TabItem item = items [index]; diff -r fb2555104d70 -r 5b53d338c709 dwt/widgets/TabItem.d --- a/dwt/widgets/TabItem.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/widgets/TabItem.d Fri Aug 29 22:04:22 2008 +0200 @@ -38,7 +38,7 @@ * IMPORTANT: This class is not intended to be subclassed. *

    */ -public class TabItem extends Item { +public class TabItem : Item { TabFolder parent; Control control; String toolTipText; @@ -74,7 +74,7 @@ * @see Widget#checkSubclass * @see Widget#getStyle */ -public TabItem (TabFolder parent, int style) { +public this (TabFolder parent, int style) { super (parent, style); this.parent = parent; parent.createItem (this, parent.getItemCount ()); @@ -112,7 +112,7 @@ * @see Widget#checkSubclass * @see Widget#getStyle */ -public TabItem (TabFolder parent, int style, int index) { +public this (TabFolder parent, int style, int index) { super (parent, style); this.parent = parent; parent.createItem (this, index); @@ -152,12 +152,12 @@ pt.y = window.screen ().frame ().height - pt.y; pt = parent.view.convertPoint_fromView_ (pt, null); pt = window.convertScreenToBase (pt); - result.x = (int) pt.x; - result.y = (int) pt.y; + result.x = cast(int) pt.x; + result.y = cast(int) pt.y; val = new NSValue (sizeValue); NSSize size = val.sizeValue (); - result.width = (int) size.width; - result.height = (int) size.height; + result.width = cast(int) size.width; + result.height = cast(int) size.height; } return result; } diff -r fb2555104d70 -r 5b53d338c709 dwt/widgets/Table.d --- a/dwt/widgets/Table.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/widgets/Table.d Fri Aug 29 22:04:22 2008 +0200 @@ -60,7 +60,7 @@ * table.setItemCount (1000000); * table.addListener (DWT.SetData, new Listener () { * public void handleEvent (Event event) { - * TableItem item = (TableItem) event.item; + * TableItem item = cast(TableItem) event.item; * int index = table.indexOf (item); * item.setText ("Item " + index); * System.out.println (item.getText ()); @@ -84,7 +84,7 @@ * IMPORTANT: This class is not intended to be subclassed. *

    */ -public class Table extends Composite { +public class Table : Composite { TableItem [] items; TableColumn [] columns; TableColumn sortColumn; @@ -127,7 +127,7 @@ * @see Widget#checkSubclass * @see Widget#getStyle */ -public Table (Composite parent, int style) { +public this (Composite parent, int style) { super (parent, checkStyle (style)); } @@ -386,7 +386,7 @@ void createHandle () { //TODO - DWT.CHECK - SWTScrollView scrollWidget = (SWTScrollView)new SWTScrollView().alloc(); + SWTScrollView scrollWidget = cast(SWTScrollView)new SWTScrollView().alloc(); scrollWidget.initWithFrame(new NSRect ()); scrollWidget.setHasHorizontalScroller(true); scrollWidget.setHasVerticalScroller(true); @@ -394,7 +394,7 @@ scrollWidget.setBorderType(hasBorder() ? OS.NSBezelBorder : OS.NSNoBorder); scrollWidget.setTag(jniRef); - NSTableView widget = (NSTableView)new SWTTableView().alloc(); + NSTableView widget = cast(NSTableView)new SWTTableView().alloc(); widget.initWithFrame(new NSRect()); widget.setAllowsMultipleSelection((style & DWT.MULTI) !is 0); widget.setDataSource(widget); @@ -409,11 +409,11 @@ NSString str = NSString.stringWith(""); if ((style & DWT.CHECK) !is 0) { - checkColumn = (NSTableColumn)new NSTableColumn().alloc(); + checkColumn = cast(NSTableColumn)new NSTableColumn().alloc(); checkColumn.initWithIdentifier(str); checkColumn.headerCell().setTitle(str); widget.addTableColumn (checkColumn); - NSButtonCell cell = (NSButtonCell)new NSButtonCell().alloc().init(); + NSButtonCell cell = cast(NSButtonCell)new NSButtonCell().alloc().init(); checkColumn.setDataCell(cell); cell.setButtonType(OS.NSSwitchButton); cell.setImagePosition(OS.NSImageOnly); @@ -424,10 +424,10 @@ checkColumn.setEditable(false); } - firstColumn = (NSTableColumn)new NSTableColumn().alloc(); + firstColumn = cast(NSTableColumn)new NSTableColumn().alloc(); firstColumn.initWithIdentifier(str); //column.setResizingMask(OS.NSTableColumnAutoresizingMask); - NSCell cell = (NSBrowserCell)new NSBrowserCell().alloc().init(); + NSCell cell = cast(NSBrowserCell)new NSBrowserCell().alloc().init(); firstColumn.setDataCell(cell); cell.release(); widget.addTableColumn (firstColumn); @@ -452,12 +452,12 @@ firstColumn = null; } else { //TODO - set attributes, alignment etc. - nsColumn = (NSTableColumn)new NSTableColumn().alloc(); + nsColumn = cast(NSTableColumn)new NSTableColumn().alloc(); nsColumn.initWithIdentifier(NSString.stringWith("")); - ((NSTableView)view).addTableColumn (nsColumn); + (cast(NSTableView)view).addTableColumn (nsColumn); int checkColumn = (style & DWT.CHECK) !is 0 ? 1 : 0; - ((NSTableView)view).moveColumn (columnCount + checkColumn, index + checkColumn); - NSCell cell = (NSBrowserCell)new NSBrowserCell().alloc().init(); + (cast(NSTableView)view).moveColumn (columnCount + checkColumn, index + checkColumn); + NSCell cell = cast(NSBrowserCell)new NSBrowserCell().alloc().init(); nsColumn.setDataCell(cell); cell.release(); } @@ -525,7 +525,7 @@ System.arraycopy (items, index, items, index + 1, itemCount++ - index); items [index] = item; //TODO - use noteNumberOfRowsChanged? - ((NSTableView)view).reloadData(); + (cast(NSTableView)view).reloadData(); } void createWidget () { @@ -557,7 +557,7 @@ public void deselect (int index) { checkWidget(); if (0 <= index && index < itemCount) { - NSTableView widget = (NSTableView)view; + NSTableView widget = cast(NSTableView)view; ignoreSelect = true; widget.deselectRow (index); ignoreSelect = false; @@ -586,7 +586,7 @@ deselectAll (); } else { int length = end - start + 1; - NSTableView widget = (NSTableView)view; + NSTableView widget = cast(NSTableView)view; ignoreSelect = true; for (int i=0; i 1)) return; int count = 0; - NSMutableIndexSet indexes = (NSMutableIndexSet)new NSMutableIndexSet().alloc().init(); + NSMutableIndexSet indexes = cast(NSMutableIndexSet)new NSMutableIndexSet().alloc().init(); for (int i=0; i= 0 && index < itemCount) { @@ -1687,7 +1687,7 @@ } } if (count > 0) { - NSTableView widget = (NSTableView)view; + NSTableView widget = cast(NSTableView)view; ignoreSelect = true; widget.selectRowIndexes(indexes, true); ignoreSelect = false; @@ -1695,9 +1695,9 @@ } void select (int [] ids, int count, bool clear) { - NSMutableIndexSet indexes = (NSMutableIndexSet)new NSMutableIndexSet().alloc().init(); + NSMutableIndexSet indexes = cast(NSMutableIndexSet)new NSMutableIndexSet().alloc().init(); for (int i=0; i= newWidth) return false; // } -// OS.SetDataBrowserTableViewNamedColumnWidth (handle, column_id, (short) newWidth); +// OS.SetDataBrowserTableViewNamedColumnWidth (handle, column_id, cast(short) newWidth); if (!set) { if (firstColumn.width() > newWidth) return false; } @@ -2164,7 +2164,7 @@ // OS.SetDataBrowserCallbacks (handle, callbacks); // if (column is null) { // if (sortColumn !is null && !sortColumn.isDisposed () && sortDirection !is DWT.NONE) { -// OS.SetDataBrowserSortOrder (handle, (short) OS.kDataBrowserOrderIncreasing); +// OS.SetDataBrowserSortOrder (handle, cast(short) OS.kDataBrowserOrderIncreasing); // sortColumn = null; // OS.SetDataBrowserSortProperty (handle, 0); // } @@ -2173,7 +2173,7 @@ // if (sortColumn !is null && !sortColumn.isDisposed () && sortDirection !is DWT.NONE) { // OS.SetDataBrowserSortProperty (handle, sortColumn.id); // int order = sortDirection is DWT.DOWN ? OS.kDataBrowserOrderDecreasing : OS.kDataBrowserOrderIncreasing; -// OS.SetDataBrowserSortOrder (handle, (short) order); +// OS.SetDataBrowserSortOrder (handle, cast(short) order); // } // callbacks.v1_itemCompareCallback = itemCompareProc (); // OS.SetDataBrowserCallbacks (handle, callbacks); @@ -2203,7 +2203,7 @@ // OS.SetDataBrowserCallbacks (handle, callbacks); // if (sortColumn !is null && !sortColumn.isDisposed ()) { // if (sortDirection is DWT.NONE) { -// OS.SetDataBrowserSortOrder (handle, (short) OS.kDataBrowserOrderIncreasing); +// OS.SetDataBrowserSortOrder (handle, cast(short) OS.kDataBrowserOrderIncreasing); // TableColumn column = sortColumn; // sortColumn = null; // OS.SetDataBrowserSortProperty (handle, 0); @@ -2212,7 +2212,7 @@ // OS.SetDataBrowserSortProperty (handle, 0); // OS.SetDataBrowserSortProperty (handle, sortColumn.id); // int order = sortDirection is DWT.DOWN ? OS.kDataBrowserOrderDecreasing : OS.kDataBrowserOrderIncreasing; -// OS.SetDataBrowserSortOrder (handle, (short) order); +// OS.SetDataBrowserSortOrder (handle, cast(short) order); // } // } // callbacks.v1_itemCompareCallback = itemCompareProc (); @@ -2238,8 +2238,8 @@ */ public void setTopIndex (int index) { checkWidget(); - NSRect rect = ((NSTableView)view).rectOfRow(index); - ((NSTableView)view).scrollRectToVisible(rect); + NSRect rect = (cast(NSTableView)view).rectOfRow(index); + (cast(NSTableView)view).scrollRectToVisible(rect); } /** @@ -2267,12 +2267,12 @@ if (column.parent !is this) return; int index = indexOf (column); if (columnCount <= 1 || !(0 <= index && index < columnCount)) return; - ((NSTableView)view).scrollColumnToVisible(index + ((style & DWT.CHECK) !is 0 ? 1 : 0)); + (cast(NSTableView)view).scrollColumnToVisible(index + ((style & DWT.CHECK) !is 0 ? 1 : 0)); } void showIndex (int index) { if (0 <= index && index < itemCount) { - ((NSTableView)view).scrollRowToVisible(index); + (cast(NSTableView)view).scrollRowToVisible(index); } } @@ -2326,7 +2326,7 @@ void tableViewSelectionDidChange (int aNotification) { if (ignoreSelect) return; - NSTableView widget = (NSTableView)view; + NSTableView widget = cast(NSTableView)view; int row = widget.selectedRow(); if(row is -1) postEvent(DWT.Selection); diff -r fb2555104d70 -r 5b53d338c709 dwt/widgets/TableColumn.d --- a/dwt/widgets/TableColumn.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/widgets/TableColumn.d Fri Aug 29 22:04:22 2008 +0200 @@ -38,7 +38,7 @@ * IMPORTANT: This class is not intended to be subclassed. *

    */ -public class TableColumn extends Item { +public class TableColumn : Item { Table parent; NSTableColumn nsColumn; String toolTipText; @@ -75,7 +75,7 @@ * @see Widget#checkSubclass * @see Widget#getStyle */ -public TableColumn (Table parent, int style) { +public this (Table parent, int style) { super (parent, checkStyle (style)); this.parent = parent; parent.createItem (this, parent.getColumnCount ()); @@ -115,7 +115,7 @@ * @see Widget#checkSubclass * @see Widget#getStyle */ -public TableColumn (Table parent, int style, int index) { +public this (Table parent, int style, int index) { super (parent, checkStyle (style)); this.parent = parent; parent.createItem (this, index); @@ -307,7 +307,7 @@ */ public int getWidth () { checkWidget (); - return (int)nsColumn.width(); + return cast(int)nsColumn.width(); } /** diff -r fb2555104d70 -r 5b53d338c709 dwt/widgets/TableItem.d --- a/dwt/widgets/TableItem.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/widgets/TableItem.d Fri Aug 29 22:04:22 2008 +0200 @@ -41,7 +41,7 @@ * IMPORTANT: This class is not intended to be subclassed. *

    */ -public class TableItem extends Item { +public class TableItem : Item { Table parent; String [] strings; Image [] images; @@ -82,7 +82,7 @@ * @see Widget#checkSubclass * @see Widget#getStyle */ -public TableItem (Table parent, int style) { +public this (Table parent, int style) { this (parent, style, checkNull (parent).getItemCount (), true); } @@ -118,11 +118,11 @@ * @see Widget#checkSubclass * @see Widget#getStyle */ -public TableItem (Table parent, int style, int index) { +public this (Table parent, int style, int index) { this (parent, style, index, true); } -TableItem (Table parent, int style, int index, bool create) { +this (Table parent, int style, int index, bool create) { super (parent, style); this.parent = parent; if (create) parent.createItem (this, index); @@ -153,7 +153,7 @@ // parent.sendEvent (DWT.MeasureItem, event); // if (parent.itemHeight < event.height) { // parent.itemHeight = event.height; -// OS.SetDataBrowserTableViewRowHeight (parent.handle, (short) event.height); +// OS.SetDataBrowserTableViewRowHeight (parent.handle, cast(short) event.height); // } // width = event.width; // } @@ -204,7 +204,7 @@ char[] chars = new char[length]; text.getChars(0, length, chars, 0); NSString str = NSString.stringWithCharacters(chars, length); - NSAttributedString attribStr = ((NSAttributedString)new NSAttributedString().alloc()).initWithString_attributes_(str, dict); + NSAttributedString attribStr = (cast(NSAttributedString)new NSAttributedString().alloc()).initWithString_attributes_(str, dict); attribStr.autorelease(); return attribStr; } @@ -270,10 +270,10 @@ public Rectangle getBounds () { checkWidget (); if (!parent.checkData (this, true)) error (DWT.ERROR_WIDGET_DISPOSED); - NSTableView tableView = (NSTableView) parent.view; + NSTableView tableView = cast(NSTableView) parent.view; NSRect rect = tableView.rectOfRow (parent.indexOf (this)); rect = tableView.convertRect_toView_ (rect, parent.scrollView); - Rectangle result = new Rectangle((int) rect.x, (int) rect.y, (int) rect.width, (int) rect.height); + Rectangle result = new Rectangle(cast(int) rect.x, cast(int) rect.y, cast(int) rect.width, cast(int) rect.height); return result; } @@ -292,11 +292,11 @@ public Rectangle getBounds (int index) { checkWidget (); if (!parent.checkData (this, true)) error (DWT.ERROR_WIDGET_DISPOSED); - NSTableView tableView = (NSTableView) parent.view; + NSTableView tableView = cast(NSTableView) parent.view; if ((parent.style & DWT.CHECK) !is 0) index ++; NSRect rect = tableView.frameOfCellAtColumn (index, parent.indexOf (this)); rect = tableView.convertRect_toView_ (rect, parent.scrollView); - Rectangle result = new Rectangle((int) rect.x, (int) rect.y, (int) rect.width, (int) rect.height); + Rectangle result = new Rectangle(cast(int) rect.x, cast(int) rect.y, cast(int) rect.width, cast(int) rect.height); return result; } @@ -619,8 +619,8 @@ void redraw () { // 0[aTableView setNeedsDisplayInRect:[aTableView rectOfRow:row]]; - ((NSTableView)parent.view).reloadData(); - ((NSTableView)parent.view).tile(); + (cast(NSTableView)parent.view).reloadData(); + (cast(NSTableView)parent.view).tile(); } void releaseHandle () { @@ -670,7 +670,7 @@ background = color; if (oldColor !is null && oldColor.equals (color)) return; cached = true; - NSTableView view = (NSTableView)parent.view; + NSTableView view = cast(NSTableView)parent.view; NSRect rect = view.rectOfRow(parent.indexOf(this)); view.setNeedsDisplayInRect(rect); } @@ -709,7 +709,7 @@ cellBackground [index] = color; if (oldColor !is null && oldColor.equals (color)) return; cached = true; - NSTableView view = (NSTableView)parent.view; + NSTableView view = cast(NSTableView)parent.view; NSRect rect = view.frameOfCellAtColumn(index + ((parent.style & DWT.CHECK) !is 0 ? 1 : 0), parent.indexOf(this)); view.setNeedsDisplayInRect(rect); } @@ -731,7 +731,7 @@ if (this.checked is checked) return; this.checked = checked; cached = true; - NSTableView view = (NSTableView)parent.view; + NSTableView view = cast(NSTableView)parent.view; NSRect rect = view.rectOfRow(parent.indexOf(this)); view.setNeedsDisplayInRect(rect); } @@ -763,7 +763,7 @@ this.font = font; if (oldFont !is null && oldFont.equals (font)) return; cached = true; - NSTableView view = (NSTableView)parent.view; + NSTableView view = cast(NSTableView)parent.view; NSRect rect = view.rectOfRow(parent.indexOf(this)); view.setNeedsDisplayInRect(rect); } @@ -803,7 +803,7 @@ cellFont [index] = font; if (oldFont !is null && oldFont.equals (font)) return; cached = true; - NSTableView view = (NSTableView)parent.view; + NSTableView view = cast(NSTableView)parent.view; NSRect rect = view.frameOfCellAtColumn(index + ((parent.style & DWT.CHECK) !is 0 ? 1 : 0), parent.indexOf(this)); view.setNeedsDisplayInRect(rect); } @@ -835,7 +835,7 @@ foreground = color; if (oldColor !is null && oldColor.equals (color)) return; cached = true; - NSTableView view = (NSTableView)parent.view; + NSTableView view = cast(NSTableView)parent.view; NSRect rect = view.rectOfRow(parent.indexOf(this)); view.setNeedsDisplayInRect(rect); } @@ -874,7 +874,7 @@ cellForeground [index] = color; if (oldColor !is null && oldColor.equals (color)) return; cached = true; - NSTableView view = (NSTableView)parent.view; + NSTableView view = cast(NSTableView)parent.view; NSRect rect = view.frameOfCellAtColumn(index + ((parent.style & DWT.CHECK) !is 0 ? 1 : 0), parent.indexOf(this)); view.setNeedsDisplayInRect(rect); } @@ -896,7 +896,7 @@ if (this.grayed is grayed) return; this.grayed = grayed; cached = true; - NSTableView view = (NSTableView)parent.view; + NSTableView view = cast(NSTableView)parent.view; NSRect rect = view.rectOfRow(parent.indexOf(this)); view.setNeedsDisplayInRect(rect); } @@ -964,7 +964,7 @@ } // cached = true; // if (index is 0) parent.setScrollWidth (this); - NSTableView view = (NSTableView)parent.view; + NSTableView view = cast(NSTableView)parent.view; NSRect rect = view.frameOfCellAtColumn(index + ((parent.style & DWT.CHECK) !is 0 ? 1 : 0), parent.indexOf(this)); view.setNeedsDisplayInRect(rect); } @@ -1046,7 +1046,7 @@ } cached = true; if (index is 0) parent.setScrollWidth (this); - NSTableView view = (NSTableView)parent.view; + NSTableView view = cast(NSTableView)parent.view; NSRect rect = view.frameOfCellAtColumn(index + ((parent.style & DWT.CHECK) !is 0 ? 1 : 0), parent.indexOf(this)); view.setNeedsDisplayInRect(rect); } diff -r fb2555104d70 -r 5b53d338c709 dwt/widgets/Text.d --- a/dwt/widgets/Text.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/widgets/Text.d Fri Aug 29 22:04:22 2008 +0200 @@ -57,7 +57,7 @@ * IMPORTANT: This class is not intended to be subclassed. *

    */ -public class Text extends Scrollable { +public class Text : Scrollable { int textLimit = LIMIT, tabs = 8; char echoCharacter; bool doubleClick; @@ -122,7 +122,7 @@ * @see Widget#checkSubclass * @see Widget#getStyle */ -public Text (Composite parent, int style) { +public this (Composite parent, int style) { super (parent, checkStyle (style)); if ((style & DWT.SEARCH) !is 0) { // int inAttributesToSet = (style & DWT.CANCEL) !is 0 ? OS.kHISearchFieldAttributesCancel : 0; @@ -251,9 +251,9 @@ } NSString str = NSString.stringWith(string); if ((style & DWT.SINGLE) !is 0) { -// new NSTextFieldCell(((NSTextField)view).cell()).title(). +// new NSTextFieldCell((cast(NSTextField)view).cell()).title(). } else { - NSTextView widget = (NSTextView)view; + NSTextView widget = cast(NSTextView)view; NSMutableString mutableString = widget.textStorage().mutableString(); mutableString.appendString(str); NSRange range = new NSRange(); @@ -301,21 +301,21 @@ checkWidget(); int width = 0, height = 0; if ((style & DWT.SINGLE) !is 0) { - NSTextField widget = (NSTextField)view; + NSTextField widget = cast(NSTextField)view; NSRect oldRect = widget.frame(); widget.sizeToFit(); NSRect newRect = widget.frame(); widget.setFrame (oldRect); - width = (int)newRect.width; - height = (int)newRect.height; + width = cast(int)newRect.width; + height = cast(int)newRect.height; } else { - NSTextView widget = (NSTextView)view; + NSTextView widget = cast(NSTextView)view; NSRect oldRect = widget.frame(); widget.sizeToFit(); NSRect newRect = widget.frame(); widget.setFrame (oldRect); - width = (int)newRect.width; - height = (int)newRect.height; + width = cast(int)newRect.width; + height = cast(int)newRect.height; } if (width <= 0) width = DEFAULT_WIDTH; if (height <= 0) height = DEFAULT_HEIGHT; @@ -343,7 +343,7 @@ if ((style & DWT.SINGLE) !is 0) { } else { - ((NSTextView)view).copy(); + (cast(NSTextView)view).copy(); } } @@ -351,11 +351,11 @@ if ((style & DWT.SINGLE) !is 0) { NSTextField widget; if ((style & DWT.PASSWORD) !is 0) { - widget = (NSTextField)new NSSecureTextField().alloc(); + widget = cast(NSTextField)new NSSecureTextField().alloc(); } else if ((style & DWT.SEARCH) !is 0) { - widget = (NSTextField)new NSSearchField().alloc(); + widget = cast(NSTextField)new NSSearchField().alloc(); } else { - widget = (NSTextField)new SWTTextField().alloc(); + widget = cast(NSTextField)new SWTTextField().alloc(); } widget.initWithFrame(new NSRect()); widget.setSelectable(true); @@ -371,14 +371,14 @@ view = widget; parent.contentView().addSubview_(widget); } else { - SWTScrollView scrollWidget = (SWTScrollView)new SWTScrollView().alloc(); + SWTScrollView scrollWidget = cast(SWTScrollView)new SWTScrollView().alloc(); scrollWidget.initWithFrame(new NSRect()); scrollWidget.setHasVerticalScroller((style & DWT.VERTICAL) !is 0); scrollWidget.setHasHorizontalScroller((style & DWT.HORIZONTAL) !is 0); scrollWidget.setAutoresizesSubviews(true); scrollWidget.setTag(jniRef); - SWTTextView widget = (SWTTextView)new SWTTextView().alloc(); + SWTTextView widget = cast(SWTTextView)new SWTTextView().alloc(); widget.initWithFrame(new NSRect()); widget.setEditable((style & DWT.READ_ONLY) is 0); if ((style & DWT.BORDER) is 0) widget.setFocusRingType(OS.NSFocusRingTypeNone); @@ -437,7 +437,7 @@ if ((style & DWT.SINGLE) !is 0) { } else { - ((NSTextView)view).cut(null); + (cast(NSTextView)view).cut(null); } // bool cut = true; // char [] oldText = null; @@ -543,7 +543,7 @@ return new Point (0, 0); } // NSText - NSRange range = ((NSTextView)view).selectedRange(); + NSRange range = (cast(NSTextView)view).selectedRange(); System.out.println(range.location + " " + range.length); return null; } @@ -567,7 +567,7 @@ //TODO return 0; } else { - NSRange range = ((NSTextView)view).selectedRange(); + NSRange range = (cast(NSTextView)view).selectedRange(); return range.location; } } @@ -585,7 +585,7 @@ public int getCharCount () { checkWidget (); if ((style & DWT.SINGLE) !is 0) { - return new NSCell(((NSControl)view).cell()).title().length(); + return new NSCell((cast(NSControl)view).cell()).title().length(); } else { //TODO return 0; @@ -662,7 +662,7 @@ public int getLineCount () { checkWidget(); if ((style & DWT.SINGLE) !is 0) return 1; - return ((NSTextView)view).textStorage().paragraphs().count(); + return (cast(NSTextView)view).textStorage().paragraphs().count(); } /** @@ -773,10 +773,10 @@ public Point getSelection () { checkWidget(); if ((style & DWT.SINGLE) !is 0) { -// new NSTextFieldCell(((NSTextField)view).cell()).title(). +// new NSTextFieldCell((cast(NSTextField)view).cell()).title(). return new Point(0, 0); } else { - NSTextView widget = (NSTextView)view; + NSTextView widget = cast(NSTextView)view; NSRange range = widget.selectedRange(); return new Point(range.location, range.location + range.length); } @@ -795,10 +795,10 @@ public int getSelectionCount () { checkWidget(); if ((style & DWT.SINGLE) !is 0) { -// new NSTextFieldCell(((NSTextField)view).cell()).title(). +// new NSTextFieldCell((cast(NSTextField)view).cell()).title(). return -1; } else { - NSTextView widget = (NSTextView)view; + NSTextView widget = cast(NSTextView)view; NSRange range = widget.selectedRange(); return range.length; } @@ -820,7 +820,7 @@ //TODO return ""; } else { - NSTextView widget = (NSTextView)view; + NSTextView widget = cast(NSTextView)view; NSRange range = widget.selectedRange(); NSString str = widget.textStorage().string(); char[] buffer = new char[range.length]; @@ -867,9 +867,9 @@ checkWidget(); NSString str; if ((style & DWT.SINGLE) !is 0) { - str = new NSTextFieldCell(((NSTextField)view).cell()).title(); + str = new NSTextFieldCell((cast(NSTextField)view).cell()).title(); } else { - str = ((NSTextView)view).textStorage().string(); + str = (cast(NSTextView)view).textStorage().string(); } if (str is null) return ""; char[] buffer = new char[str.length()]; @@ -899,7 +899,7 @@ checkWidget (); NSString str; if ((style & DWT.SINGLE) !is 0) { - str = new NSTextFieldCell(((NSTextField)view).cell()).title(); + str = new NSTextFieldCell((cast(NSTextField)view).cell()).title(); } else { str = null; @@ -1004,11 +1004,11 @@ if (string is null) return; } if ((style & DWT.SINGLE) !is 0) { -// new NSTextFieldCell(((NSTextField)view).cell()).title(). +// new NSTextFieldCell((cast(NSTextField)view).cell()).title(). } else { // NSString str = NSString.stringWith(string); - NSTextView widget = (NSTextView)view; + NSTextView widget = cast(NSTextView)view; NSRange range = widget.selectedRange(); widget.textStorage().replaceCharactersInRange_withString_(range, str); } @@ -1157,7 +1157,7 @@ if ((style & DWT.SINGLE) !is 0) { setSelection (0, getCharCount ()); } else { - ((NSTextView)view).selectAll(null); + (cast(NSTextView)view).selectAll(null); } } @@ -1231,9 +1231,9 @@ nsColor = NSColor.colorWithDeviceRed(color[0], color[1], color[2], 1); } if ((style & DWT.SINGLE) !is 0) { - ((NSTextField)view).setBackgroundColor(nsColor); + (cast(NSTextField)view).setBackgroundColor(nsColor); } else { - ((NSTextView)view).setBackgroundColor(nsColor); + (cast(NSTextView)view).setBackgroundColor(nsColor); } } @@ -1316,9 +1316,9 @@ style |= DWT.READ_ONLY; } if ((style & DWT.SINGLE) !is 0) { - ((NSTextField)view).setEditable(editable); + (cast(NSTextField)view).setEditable(editable); } else { - ((NSTextView)view).setEditable(editable); + (cast(NSTextView)view).setEditable(editable); } } @@ -1330,9 +1330,9 @@ nsColor = NSColor.colorWithDeviceRed(color[0], color[1], color[2], 1); } if ((style & DWT.SINGLE) !is 0) { - ((NSTextField)view).setTextColor(nsColor); + (cast(NSTextField)view).setTextColor(nsColor); } else { - ((NSTextView)view).setTextColor_(nsColor); + (cast(NSTextView)view).setTextColor_(nsColor); } } @@ -1451,8 +1451,8 @@ if ((style & DWT.SINGLE) !is 0) { // int length = getCharCount (); // ControlEditTextSelectionRec selection = new ControlEditTextSelectionRec (); -// selection.selStart = (short) Math.min (Math.max (Math.min (start, end), 0), length); -// selection.selEnd = (short) Math.min (Math.max (Math.max (start, end), 0), length); +// selection.selStart = cast(short) Math.min (Math.max (Math.min (start, end), 0), length); +// selection.selEnd = cast(short) Math.min (Math.max (Math.max (start, end), 0), length); // if (hasFocus ()) { // OS.SetControlData (handle, OS.kControlEntireControl, OS.kControlEditTextSelectionTag, 4, selection); // } else { @@ -1463,7 +1463,7 @@ NSRange range = new NSRange (); range.location = start; range.length = end - start + 1; - ((NSTextView)view).setSelectedRange (range); + (cast(NSTextView)view).setSelectedRange (range); } } @@ -1524,7 +1524,7 @@ // if (txnObject is 0) return; // this.tabs = tabs; // TXNTab tab = new TXNTab (); -// tab.value = (short) (textExtent (new char[]{' '}, 0).x * tabs); +// tab.value = cast(short) (textExtent (new char[]{' '}, 0).x * tabs); // int [] tags = new int [] {OS.kTXNTabSettingsTag}; // int [] datas = new int [1]; // OS.memmove (datas, tab, TXNTab.sizeof); @@ -1555,9 +1555,9 @@ } NSString str = NSString.stringWith(string); if ((style & DWT.SINGLE) !is 0) { - new NSCell(((NSTextField)view).cell()).setTitle(str); + new NSCell((cast(NSTextField)view).cell()).setTitle(str); } else { - ((NSTextView)view).setString(str); + (cast(NSTextView)view).setString(str); } sendEvent (DWT.Modify); } @@ -1608,7 +1608,7 @@ checkWidget(); if ((style & DWT.SINGLE) !is 0) return; //TODO no working - NSTextView widget = (NSTextView)view; + NSTextView widget = cast(NSTextView)view; NSRange range = new NSRange(); NSRect rect = widget.firstRectForCharacterRange(range); view.scrollRectToVisible(rect); @@ -1632,7 +1632,7 @@ if ((style & DWT.SINGLE) !is 0) { setSelection (getSelection()); } else { - NSTextView widget = (NSTextView)view; + NSTextView widget = cast(NSTextView)view; widget.scrollRangeToVisible(widget.selectedRange()); } } diff -r fb2555104d70 -r 5b53d338c709 dwt/widgets/ToolBar.d --- a/dwt/widgets/ToolBar.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/widgets/ToolBar.d Fri Aug 29 22:04:22 2008 +0200 @@ -44,7 +44,7 @@ * IMPORTANT: This class is not intended to be subclassed. *

    */ -public class ToolBar extends Composite { +public class ToolBar : Composite { int itemCount; ToolItem [] items; @@ -81,7 +81,7 @@ * @see Widget#checkSubclass() * @see Widget#getStyle() */ -public ToolBar (Composite parent, int style) { +public this (Composite parent, int style) { super (parent, checkStyle (style)); /* @@ -127,7 +127,7 @@ } void createHandle () { - SWTView widget = (SWTView)new SWTView().alloc(); + SWTView widget = cast(SWTView)new SWTView().alloc(); widget.initWithFrame(new NSRect()); // widget.setDrawsBackground(false); widget.setTag(jniRef); @@ -183,7 +183,7 @@ public Rectangle getClientArea () { checkWidget(); NSRect rect = view.bounds(); - return new Rectangle((int)rect.x, (int)rect.y, (int)rect.width, (int)rect.height); + return new Rectangle(cast(int)rect.x, cast(int)rect.y, cast(int)rect.width, cast(int)rect.height); } /** diff -r fb2555104d70 -r 5b53d338c709 dwt/widgets/ToolItem.d --- a/dwt/widgets/ToolItem.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/widgets/ToolItem.d Fri Aug 29 22:04:22 2008 +0200 @@ -49,7 +49,7 @@ * IMPORTANT: This class is not intended to be subclassed. *

    */ -public class ToolItem extends Item { +public class ToolItem : Item { NSView view; NSButton button, arrow; int width = DEFAULT_SEPARATOR_WIDTH; @@ -100,7 +100,7 @@ * @see Widget#checkSubclass * @see Widget#getStyle */ -public ToolItem (ToolBar parent, int style) { +public this (ToolBar parent, int style) { super (parent, checkStyle (style)); this.parent = parent; parent.createItem (this, parent.getItemCount ()); @@ -142,7 +142,7 @@ * @see Widget#checkSubclass * @see Widget#getStyle */ -public ToolItem (ToolBar parent, int style, int index) { +public this (ToolBar parent, int style, int index) { super (parent, checkStyle (style)); this.parent = parent; parent.createItem (this, index); @@ -204,10 +204,10 @@ height = Math.max (height, control.getMininumHeight ()); } } else { - ((NSButton)button).sizeToFit (); + (cast(NSButton)button).sizeToFit (); NSRect frame = button.frame(); - width = (int)frame.width + INSET; - height = (int)frame.height; + width = cast(int)frame.width + INSET; + height = cast(int)frame.height; if (arrow !is null) { width += ARROW_INSET + ARROW_WIDTH; } @@ -219,17 +219,17 @@ void createWidget() { createJNIRef (); if ((style & DWT.SEPARATOR) !is 0) { - SWTBox widget = (SWTBox)new SWTBox().alloc(); + SWTBox widget = cast(SWTBox)new SWTBox().alloc(); widget.initWithFrame(new NSRect()); widget.setBoxType(OS.NSBoxSeparator); widget.setTag(jniRef); view = widget; } else { - SWTView widget = (SWTView)new SWTView().alloc(); + SWTView widget = cast(SWTView)new SWTView().alloc(); widget.initWithFrame(new NSRect()); widget.setTag(parent.jniRef); parent.contentView().addSubview_(widget); - button = (NSButton)new SWTButton().alloc(); + button = cast(NSButton)new SWTButton().alloc(); button.initWithFrame(new NSRect()); button.setBordered(false); button.setAction(OS.sel_sendSelection); @@ -240,7 +240,7 @@ button.setEnabled(parent.getEnabled()); widget.addSubview_(button); if ((style & DWT.DROP_DOWN) !is 0) { - arrow = (NSButton)new SWTButton().alloc(); + arrow = cast(NSButton)new SWTButton().alloc(); arrow.initWithFrame(new NSRect()); arrow.setBordered(false); arrow.setAction(OS.sel_sendArrowSelection); @@ -278,13 +278,13 @@ NSGraphicsContext context = NSGraphicsContext.currentContext(); context.saveGraphicsState(); NSPoint p1 = new NSPoint(); - p1.y = (float)Math.ceil(frame.height / 2 - frame.width / 2); + p1.y = cast(float)Math.ceil(frame.height / 2 - frame.width / 2); NSPoint p2 = new NSPoint(); p2.x = frame.width; p2.y = p1.y; NSPoint p3 = new NSPoint(); p3.x = frame.width / 2; - p3.y = (float)(p2.y + Math.sqrt(Math.pow(frame.width, 2) - Math.pow(frame.width / 2, 2))); + p3.y = cast(float)(p2.y + Math.sqrt(Math.pow(frame.width, 2) - Math.pow(frame.width / 2, 2))); NSBezierPath path = NSBezierPath.bezierPath(); path.moveToPoint(p1); path.lineToPoint(p2); @@ -299,9 +299,9 @@ void enableWidget(bool enabled) { if ((style & DWT.SEPARATOR) is 0) { - ((NSButton)button).setEnabled(enabled); + (cast(NSButton)button).setEnabled(enabled); if (arrow !is null) { - ((NSButton)arrow).setEnabled(enabled); + (cast(NSButton)arrow).setEnabled(enabled); } } } @@ -320,7 +320,7 @@ public Rectangle getBounds () { checkWidget(); NSRect rect = view.frame(); - return new Rectangle((int)rect.x, (int)rect.y, (int)rect.width, (int)rect.height); + return new Rectangle(cast(int)rect.x, cast(int)rect.y, cast(int)rect.width, cast(int)rect.height); } /** @@ -555,8 +555,8 @@ NSRect frame = view.frame(); Event event = new Event (); event.detail = DWT.ARROW; - event.x = (int)frame.x; - event.y = (int)(frame.y + arrow.frame().height); + event.x = cast(int)frame.x; + event.y = cast(int)(frame.y + arrow.frame().height); postEvent (DWT.Selection, event); } @@ -765,16 +765,16 @@ if ((style & DWT.SEPARATOR) !is 0) return; super.setText (string); NSString str = NSString.stringWith(string); - ((NSButton)button).setTitle(str); + (cast(NSButton)button).setTitle(str); parent.relayout (); if (text.length() !is 0 && image !is null) { if ((parent.style & DWT.RIGHT) !is 0) { - ((NSButton)button).setImagePosition(OS.NSImageLeft); + (cast(NSButton)button).setImagePosition(OS.NSImageLeft); } else { - ((NSButton)button).setImagePosition(OS.NSImageAbove); + (cast(NSButton)button).setImagePosition(OS.NSImageAbove); } } else { - ((NSButton)button).setImagePosition(OS.NSImageOverlaps); + (cast(NSButton)button).setImagePosition(OS.NSImageOverlaps); } } @@ -836,15 +836,15 @@ image = disabledImage; } } - ((NSButton)button).setImage(image !is null ? image.handle : null); + (cast(NSButton)button).setImage(image !is null ? image.handle : null); if (text.length() !is 0 && image !is null) { if ((parent.style & DWT.RIGHT) !is 0) { - ((NSButton)button).setImagePosition(OS.NSImageLeft); + (cast(NSButton)button).setImagePosition(OS.NSImageLeft); } else { - ((NSButton)button).setImagePosition(OS.NSImageAbove); + (cast(NSButton)button).setImagePosition(OS.NSImageAbove); } } else { - ((NSButton)button).setImagePosition(OS.NSImageOverlaps); + (cast(NSButton)button).setImagePosition(OS.NSImageOverlaps); } parent.relayout(); } diff -r fb2555104d70 -r 5b53d338c709 dwt/widgets/ToolTip.d --- a/dwt/widgets/ToolTip.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/widgets/ToolTip.d Fri Aug 29 22:04:22 2008 +0200 @@ -48,7 +48,7 @@ * * @since 3.2 */ -public class ToolTip extends Widget { +public class ToolTip : Widget { Shell parent, tip; TrayItem item; int x, y; @@ -97,7 +97,7 @@ * @see Widget#checkSubclass * @see Widget#getStyle */ -public ToolTip (Shell parent, int style) { +public this (Shell parent, int style) { super (parent, checkStyle (style)); this.parent = parent; this.autohide = true; diff -r fb2555104d70 -r 5b53d338c709 dwt/widgets/Tracker.d --- a/dwt/widgets/Tracker.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/widgets/Tracker.d Fri Aug 29 22:04:22 2008 +0200 @@ -52,7 +52,7 @@ * IMPORTANT: This class is not intended to be subclassed. *

    */ -public class Tracker extends Widget { +public class Tracker : Widget { Control parent; bool tracking, cancelled, stippled; Cursor clientCursor, resizeCursor; @@ -101,7 +101,7 @@ * @see Widget#checkSubclass * @see Widget#getStyle */ -public Tracker (Composite parent, int style) { +public this (Composite parent, int style) { super (parent, checkStyle (style)); this.parent = parent; } @@ -140,7 +140,7 @@ * @see DWT#UP * @see DWT#DOWN */ -public Tracker (Display display, int style) { +public this (Display display, int style) { if (display is null) display = Display.getCurrent (); if (display is null) display = Display.getDefault (); if (!display.isValidThread ()) { @@ -442,7 +442,7 @@ location = eventWindow.convertBaseToScreen(location); location.y = eventWindow.screen().frame().height - location.y; } - int newX = (int)location.x, newY = (int)location.y; + int newX = cast(int)location.x, newY = cast(int)location.y; if (newX !is oldX || newY !is oldY) { Rectangle [] oldRectangles = rectangles; Rectangle [] rectsToErase = new Rectangle [rectangles.length]; @@ -715,7 +715,7 @@ checkWidget (); cancelled = false; tracking = true; - window = (NSWindow)new NSWindow().alloc(); + window = cast(NSWindow)new NSWindow().alloc(); NSRect frame = NSScreen.mainScreen().frame(); window = window.initWithContentRect_styleMask_backing_defer_(frame, OS.NSBorderlessWindowMask, OS.NSBackingStoreBuffered, false); window.setOpaque(false); @@ -767,7 +767,7 @@ /* Tracker behaves like a Dialog with its own OS event loop. */ while (tracking && !cancelled) { - NSAutoreleasePool pool = (NSAutoreleasePool)new NSAutoreleasePool().alloc().init(); + NSAutoreleasePool pool = cast(NSAutoreleasePool)new NSAutoreleasePool().alloc().init(); NSEvent event = application.nextEventMatchingMask(0, NSDate.distantFuture(), OS.NSDefaultRunLoopMode, true); if (event is null) continue; int type = event.type(); diff -r fb2555104d70 -r 5b53d338c709 dwt/widgets/Tray.d diff -r fb2555104d70 -r 5b53d338c709 dwt/widgets/TrayItem.d --- a/dwt/widgets/TrayItem.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/widgets/TrayItem.d Fri Aug 29 22:04:22 2008 +0200 @@ -46,7 +46,7 @@ * * @since 3.0 */ -public class TrayItem extends Item { +public class TrayItem : Item { Tray parent; ToolTip toolTip; String toolTipText; @@ -86,7 +86,7 @@ * @see Widget#checkSubclass * @see Widget#getStyle */ -public TrayItem (Tray parent, int style) { +public this (Tray parent, int style) { super (parent, style); this.parent = parent; parent.createItem (this, parent.getItemCount ()); @@ -164,7 +164,7 @@ item.retain(); item.setHighlightMode(true); NSRect rect = new NSRect(); - view = (NSImageView)new SWTImageView().alloc(); + view = cast(NSImageView)new SWTImageView().alloc(); if (view is null) error (DWT.ERROR_NO_HANDLES); view.initWithFrame(rect); item.setView(view); @@ -185,7 +185,7 @@ pt.y = rect.height; pt = view.convertPoint_fromView_(pt, null); pt.x += windowRect.x; - return new Point ((int)pt.x, (int)pt.y); + return new Point (cast(int)pt.x, cast(int)pt.y); } /** diff -r fb2555104d70 -r 5b53d338c709 dwt/widgets/Tree.d --- a/dwt/widgets/Tree.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/widgets/Tree.d Fri Aug 29 22:04:22 2008 +0200 @@ -59,7 +59,7 @@ * tree.setItemCount(20); * tree.addListener(DWT.SetData, new Listener() { * public void handleEvent(Event event) { - * TreeItem item = (TreeItem)event.item; + * TreeItem item = cast(TreeItem)event.item; * TreeItem parentItem = item.getParentItem(); * String text = null; * if (parentItem is null) { @@ -90,7 +90,7 @@ * IMPORTANT: This class is not intended to be subclassed. *

    */ -public class Tree extends Composite { +public class Tree : Composite { NSTableColumn firstColumn, checkColumn; NSTableHeaderView headerView; TreeItem [] items; @@ -131,7 +131,7 @@ * @see Widget#checkSubclass * @see Widget#getStyle */ -public Tree (Composite parent, int style) { +public this (Composite parent, int style) { super (parent, checkStyle (style)); } @@ -362,7 +362,7 @@ // if (OS.VERSION >= 0x1040) { // float [] metric = new float [1]; // OS.DataBrowserGetMetric (handle, OS.kDataBrowserMetricDisclosureColumnPerDepthGap, null, metric); -// levelIndent = (int) metric [0]; +// levelIndent = cast(int) metric [0]; // } // GC gc = new GC (this); // width = calculateWidth (childIds, gc, true, 0, levelIndent); @@ -374,7 +374,7 @@ width = wHint; } if (hHint is DWT.DEFAULT) { - height = ((NSTableView)view).numberOfRows() * getItemHeight () + getHeaderHeight(); + height = (cast(NSTableView)view).numberOfRows() * getItemHeight () + getHeaderHeight(); } else { height = hHint; } @@ -385,7 +385,7 @@ } void createHandle () { - SWTScrollView scrollWidget = (SWTScrollView)new SWTScrollView().alloc(); + SWTScrollView scrollWidget = cast(SWTScrollView)new SWTScrollView().alloc(); scrollWidget.initWithFrame(new NSRect ()); scrollWidget.setHasHorizontalScroller(true); scrollWidget.setHasVerticalScroller(true); @@ -393,7 +393,7 @@ scrollWidget.setBorderType(hasBorder() ? OS.NSBezelBorder : OS.NSNoBorder); scrollWidget.setTag(jniRef); - NSOutlineView widget = (NSOutlineView)new SWTOutlineView().alloc(); + NSOutlineView widget = cast(NSOutlineView)new SWTOutlineView().alloc(); widget.initWithFrame(new NSRect()); widget.setAllowsMultipleSelection((style & DWT.MULTI) !is 0); widget.setAutoresizesOutlineColumn(false); @@ -410,12 +410,12 @@ NSString str = NSString.stringWith(""); if ((style & DWT.CHECK) !is 0) { - checkColumn = (NSTableColumn)new NSTableColumn().alloc(); + checkColumn = cast(NSTableColumn)new NSTableColumn().alloc(); checkColumn.initWithIdentifier(str); checkColumn.headerCell().setTitle(str); widget.addTableColumn (checkColumn); widget.setOutlineTableColumn(checkColumn); - NSButtonCell cell = (NSButtonCell)new NSButtonCell().alloc().init(); + NSButtonCell cell = cast(NSButtonCell)new NSButtonCell().alloc().init(); checkColumn.setDataCell(cell); cell.setButtonType(OS.NSSwitchButton); cell.setImagePosition(OS.NSImageOnly); @@ -426,12 +426,12 @@ cell.release(); } - firstColumn = (NSTableColumn)new NSTableColumn().alloc(); + firstColumn = cast(NSTableColumn)new NSTableColumn().alloc(); firstColumn.initWithIdentifier(str); firstColumn.headerCell().setTitle(str); widget.addTableColumn (firstColumn); widget.setOutlineTableColumn(firstColumn); - NSBrowserCell cell = (NSBrowserCell)new NSBrowserCell().alloc().init(); + NSBrowserCell cell = cast(NSBrowserCell)new NSBrowserCell().alloc().init(); cell.setLeaf(true); firstColumn.setDataCell(cell); cell.release(); @@ -462,13 +462,13 @@ } else { //TODO - set attributes, alignment etc. NSString str = NSString.stringWith(""); - nsColumn = (NSTableColumn)new NSTableColumn().alloc(); + nsColumn = cast(NSTableColumn)new NSTableColumn().alloc(); nsColumn.initWithIdentifier(str); nsColumn.headerCell().setTitle(str); - ((NSTableView)view).addTableColumn (nsColumn); + (cast(NSTableView)view).addTableColumn (nsColumn); int checkColumn = (style & DWT.CHECK) !is 0 ? 1 : 0; - ((NSTableView)view).moveColumn (columnCount + checkColumn, index + checkColumn); - NSBrowserCell cell = (NSBrowserCell)new NSBrowserCell().alloc().init(); + (cast(NSTableView)view).moveColumn (columnCount + checkColumn, index + checkColumn); + NSBrowserCell cell = cast(NSBrowserCell)new NSBrowserCell().alloc().init(); cell.setLeaf(true); nsColumn.setDataCell(cell); cell.release(); @@ -551,7 +551,7 @@ items [index] = item; item.items = new TreeItem[4]; item.createJNIRef(); - SWTTreeItem handle = (SWTTreeItem)new SWTTreeItem().alloc().init(); + SWTTreeItem handle = cast(SWTTreeItem)new SWTTreeItem().alloc().init(); handle.setTag(item.jniRef); item.handle = handle; if (parentItem !is null) { @@ -560,7 +560,7 @@ this.itemCount = count; } //TODO ? - ((NSTableView)view).reloadData(); + (cast(NSTableView)view).reloadData(); } void createWidget () { @@ -587,7 +587,7 @@ */ public void deselectAll () { checkWidget (); - NSTableView widget = (NSTableView)view; + NSTableView widget = cast(NSTableView)view; ignoreSelect = true; widget.deselectAll(null); ignoreSelect = false; @@ -737,10 +737,10 @@ items [count] = null; if (parentItem !is null) { parentItem.itemCount = count; - ((NSOutlineView)view).reloadItem_reloadChildren_(parentItem.handle, true); + (cast(NSOutlineView)view).reloadItem_reloadChildren_(parentItem.handle, true); } else { this.itemCount = count; - ((NSOutlineView)view).reloadItem_(null); + (cast(NSOutlineView)view).reloadItem_(null); } //noteNumberOfRowsChanged was causing crashes whenever @@ -749,7 +749,7 @@ //Not sure that this NSTableView function //makes sense in an NSOutlineView. - //((NSTableView)view).noteNumberOfRowsChanged(); + //(cast(NSTableView)view).noteNumberOfRowsChanged(); // setScrollWidth (true); // fixScrollBar (); @@ -939,9 +939,9 @@ */ public int getHeaderHeight () { checkWidget (); - NSTableHeaderView headerView = ((NSTableView)view).headerView(); + NSTableHeaderView headerView = (cast(NSTableView)view).headerView(); if (headerView is null) return 0; - return (int)headerView.bounds().height; + return cast(int)headerView.bounds().height; } /** @@ -965,7 +965,7 @@ */ public bool getHeaderVisible () { checkWidget (); - return ((NSTableView)view).headerView() !is null; + return (cast(NSTableView)view).headerView() !is null; } /** @@ -1020,7 +1020,7 @@ if (point is null) error (DWT.ERROR_NULL_ARGUMENT); // Rect rect = new Rect (); // dwt.internal.carbon.Point pt = new dwt.internal.carbon.Point (); -// OS.SetPt (pt, (short) point.x, (short) point.y); +// OS.SetPt (pt, cast(short) point.x, cast(short) point.y); // if (0 < lastHittest && lastHittest <= items.length && lastHittestColumn !is 0) { // TreeItem item = _getItem (lastHittest, false); // if (item !is null) { @@ -1104,7 +1104,7 @@ */ public int getItemHeight () { checkWidget (); - return (int)((NSTableView)view).rowHeight(); + return cast(int)(cast(NSTableView)view).rowHeight(); } /** @@ -1197,7 +1197,7 @@ */ public TreeItem [] getSelection () { checkWidget (); - NSOutlineView widget = (NSOutlineView)view; + NSOutlineView widget = cast(NSOutlineView)view; if (widget.numberOfSelectedRows() is 0) { return new TreeItem [0]; } @@ -1211,7 +1211,7 @@ int jniRef = OS.objc_msgSend(item.id, OS.sel_tag); if (jniRef !is -1 && jniRef !is 0) { //TODO virtual - result[i] = (TreeItem)OS.JNIGetObject(jniRef); + result[i] = cast(TreeItem)OS.JNIGetObject(jniRef); } } return result; @@ -1229,7 +1229,7 @@ */ public int getSelectionCount () { checkWidget (); - return ((NSTableView)view).numberOfSelectedRows(); + return (cast(NSTableView)view).numberOfSelectedRows(); } /** @@ -1367,13 +1367,13 @@ int outlineView_child_ofItem(int outlineView, int index, int ref) { TreeItem parent = null; - if (ref !is 0) parent = (TreeItem)OS.JNIGetObject(OS.objc_msgSend(ref, OS.sel_tag)); + if (ref !is 0) parent = cast(TreeItem)OS.JNIGetObject(OS.objc_msgSend(ref, OS.sel_tag)); TreeItem item = _getItem(parent, index); return item.handle.id; } int outlineView_objectValueForTableColumn_byItem(int outlineView, int tableColumn, int ref) { - TreeItem item = (TreeItem)OS.JNIGetObject(OS.objc_msgSend(ref, OS.sel_tag)); + TreeItem item = cast(TreeItem)OS.JNIGetObject(OS.objc_msgSend(ref, OS.sel_tag)); if (checkColumn !is null && tableColumn is checkColumn.id) { NSNumber value; if (item.checked && item.grayed) { @@ -1393,17 +1393,17 @@ bool outlineView_isItemExpandable(int outlineView, int ref) { if (ref is 0) return true; - return ((TreeItem)OS.JNIGetObject(OS.objc_msgSend(ref, OS.sel_tag))).itemCount !is 0; + return (cast(TreeItem)OS.JNIGetObject(OS.objc_msgSend(ref, OS.sel_tag))).itemCount !is 0; } int outlineView_numberOfChildrenOfItem(int outlineView, int ref) { if (ref is 0) return itemCount; - return ((TreeItem)OS.JNIGetObject(OS.objc_msgSend(ref, OS.sel_tag))).itemCount; + return (cast(TreeItem)OS.JNIGetObject(OS.objc_msgSend(ref, OS.sel_tag))).itemCount; } void outlineView_willDisplayCell_forTableColumn_item(int outlineView, int cell, int tableColumn, int ref) { if (checkColumn !is null && tableColumn is checkColumn.id) return; - TreeItem item = (TreeItem)OS.JNIGetObject(OS.objc_msgSend(ref, OS.sel_tag)); + TreeItem item = cast(TreeItem)OS.JNIGetObject(OS.objc_msgSend(ref, OS.sel_tag)); Image image = item.image; for (int i=0; i= newWidth) return false; // } -// OS.SetDataBrowserTableViewNamedColumnWidth (handle, column_id, (short) newWidth); +// OS.SetDataBrowserTableViewNamedColumnWidth (handle, column_id, cast(short) newWidth); return true; } @@ -2071,7 +2071,7 @@ if (column is sortColumn) return; // if (column is null) { // if (sortColumn !is null && !sortColumn.isDisposed () && sortDirection !is DWT.NONE) { -// OS.SetDataBrowserSortOrder (handle, (short) OS.kDataBrowserOrderIncreasing); +// OS.SetDataBrowserSortOrder (handle, cast(short) OS.kDataBrowserOrderIncreasing); // sortColumn = null; // OS.SetDataBrowserSortProperty (handle, 0); // } @@ -2080,7 +2080,7 @@ // if (sortColumn !is null && !sortColumn.isDisposed () && sortDirection !is DWT.NONE) { // OS.SetDataBrowserSortProperty (handle, sortColumn.id); // int order = sortDirection is DWT.DOWN ? OS.kDataBrowserOrderDecreasing : OS.kDataBrowserOrderIncreasing; -// OS.SetDataBrowserSortOrder (handle, (short) order); +// OS.SetDataBrowserSortOrder (handle, cast(short) order); // } } @@ -2104,7 +2104,7 @@ // sortDirection = direction; // if (sortColumn !is null && !sortColumn.isDisposed ()) { // if (sortDirection is DWT.NONE) { -// OS.SetDataBrowserSortOrder (handle, (short) OS.kDataBrowserOrderIncreasing); +// OS.SetDataBrowserSortOrder (handle, cast(short) OS.kDataBrowserOrderIncreasing); // TreeColumn column = sortColumn; // sortColumn = null; // OS.SetDataBrowserSortProperty (handle, 0); @@ -2113,7 +2113,7 @@ // OS.SetDataBrowserSortProperty (handle, 0); // OS.SetDataBrowserSortProperty (handle, sortColumn.id); // int order = sortDirection is DWT.DOWN ? OS.kDataBrowserOrderDecreasing : OS.kDataBrowserOrderIncreasing; -// OS.SetDataBrowserSortOrder (handle, (short) order); +// OS.SetDataBrowserSortOrder (handle, cast(short) order); // } // } } @@ -2144,7 +2144,7 @@ if (item.isDisposed ()) error (DWT.ERROR_INVALID_ARGUMENT); // showItem (item, false); // int columnId = (columnCount is 0) ? column_id : columns [0].id; -// OS.RevealDataBrowserItem (handle, item.id, columnId, (byte) OS.kDataBrowserRevealWithoutSelecting); +// OS.RevealDataBrowserItem (handle, item.id, columnId, cast(byte) OS.kDataBrowserRevealWithoutSelecting); // Rect rect = new Rect (); // if (OS.GetDataBrowserItemPartBounds (handle, item.id, column_id, OS.kDataBrowserPropertyEnclosingPart, rect) is OS.noErr) { // int border = getBorder (); @@ -2179,7 +2179,7 @@ if (column.parent !is this) return; int index = indexOf (column); if (columnCount <= 1 || !(0 <= index && index < columnCount)) return; - ((NSTableView)view).scrollColumnToVisible(index + ((style & DWT.CHECK) !is 0 ? 1 : 0)); + (cast(NSTableView)view).scrollColumnToVisible(index + ((style & DWT.CHECK) !is 0 ? 1 : 0)); } /** @@ -2260,7 +2260,7 @@ // * end in some cases). // */ // //options |= OS.kDataBrowserRevealAndCenterInView; -// OS.RevealDataBrowserItem (handle, item.id, columnId, (byte) options); +// OS.RevealDataBrowserItem (handle, item.id, columnId, cast(byte) options); // int [] newTop = new int [1], newLeft = new int [1]; // if (columnCount is 0) { // bool fixScroll = false; @@ -2280,7 +2280,7 @@ // if (OS.VERSION >= 0x1040) { // float [] metric = new float [1]; // OS.DataBrowserGetMetric (handle, OS.kDataBrowserMetricDisclosureColumnPerDepthGap, null, metric); -// levelIndent = (int) metric [0]; +// levelIndent = cast(int) metric [0]; // } // TreeItem temp = item; // while (temp.parentItem !is null) { diff -r fb2555104d70 -r 5b53d338c709 dwt/widgets/TreeColumn.d --- a/dwt/widgets/TreeColumn.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/widgets/TreeColumn.d Fri Aug 29 22:04:22 2008 +0200 @@ -39,7 +39,7 @@ * * @since 3.1 */ -public class TreeColumn extends Item { +public class TreeColumn : Item { NSTableColumn nsColumn; Tree parent; String toolTipText; @@ -76,7 +76,7 @@ * @see Widget#checkSubclass * @see Widget#getStyle */ -public TreeColumn (Tree parent, int style) { +public this (Tree parent, int style) { super (parent, checkStyle (style)); this.parent = parent; parent.createItem (this, parent.getColumnCount ()); @@ -116,7 +116,7 @@ * @see Widget#checkSubclass * @see Widget#getStyle */ -public TreeColumn (Tree parent, int style, int index) { +public this (Tree parent, int style, int index) { super (parent, checkStyle (style)); this.parent = parent; parent.createItem (this, index); @@ -308,7 +308,7 @@ */ public int getWidth () { checkWidget (); - return (int)nsColumn.width(); + return cast(int)nsColumn.width(); } /** diff -r fb2555104d70 -r 5b53d338c709 dwt/widgets/TreeItem.d --- a/dwt/widgets/TreeItem.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/widgets/TreeItem.d Fri Aug 29 22:04:22 2008 +0200 @@ -43,7 +43,7 @@ * IMPORTANT: This class is not intended to be subclassed. *

    */ -public class TreeItem extends Item { +public class TreeItem : Item { Tree parent; TreeItem parentItem; TreeItem[] items; @@ -89,7 +89,7 @@ * @see Widget#checkSubclass * @see Widget#getStyle */ -public TreeItem (Tree parent, int style) { +public this (Tree parent, int style) { this (checkNull (parent), null, style, -1, true); } @@ -125,7 +125,7 @@ * @see Widget#checkSubclass * @see Widget#getStyle */ -public TreeItem (Tree parent, int style, int index) { +public this (Tree parent, int style, int index) { this (checkNull (parent), null, style, checkIndex (index), true); } @@ -159,7 +159,7 @@ * @see Widget#checkSubclass * @see Widget#getStyle */ -public TreeItem (TreeItem parentItem, int style) { +public this (TreeItem parentItem, int style) { this (checkNull (parentItem).parent, parentItem, style, -1, true); } @@ -195,11 +195,11 @@ * @see Widget#checkSubclass * @see Widget#getStyle */ -public TreeItem (TreeItem parentItem, int style, int index) { +public this (TreeItem parentItem, int style, int index) { this (checkNull (parentItem).parent, parentItem, style, checkIndex (index), true); } -TreeItem (Tree parent, TreeItem parentItem, int style, int index, bool create) { +this (Tree parent, TreeItem parentItem, int style, int index, bool create) { super (parent, style); this.parent = parent; this.parentItem = parentItem; @@ -241,7 +241,7 @@ // parent.sendEvent (DWT.MeasureItem, event); // if (parent.itemHeight < event.height) { // parent.itemHeight = event.height; -// OS.SetDataBrowserTableViewRowHeight (parent.handle, (short) event.height); +// OS.SetDataBrowserTableViewRowHeight (parent.handle, cast(short) event.height); // } // width = event.width; // } @@ -347,7 +347,7 @@ char[] chars = new char[length]; text.getChars(0, length, chars, 0); NSString str = NSString.stringWithCharacters(chars, length); - NSAttributedString attribStr = ((NSAttributedString)new NSAttributedString().alloc()).initWithString_attributes_(str, dict); + NSAttributedString attribStr = (cast(NSAttributedString)new NSAttributedString().alloc()).initWithString_attributes_(str, dict); attribStr.autorelease(); return attribStr; } @@ -412,11 +412,11 @@ public Rectangle getBounds () { checkWidget (); if (!parent.checkData (this, true)) error (DWT.ERROR_WIDGET_DISPOSED); - NSOutlineView outlineView = (NSOutlineView) parent.view; + NSOutlineView outlineView = cast(NSOutlineView) parent.view; int row = outlineView.rowForItem(handle); NSRect rect = outlineView.rectOfRow (row); rect = outlineView.convertRect_toView_ (rect, parent.scrollView); - Rectangle result = new Rectangle((int) rect.x, (int) rect.y, (int) rect.width, (int) rect.height); + Rectangle result = new Rectangle(cast(int) rect.x, cast(int) rect.y, cast(int) rect.width, cast(int) rect.height); return result; } @@ -438,12 +438,12 @@ checkWidget (); if (!parent.checkData (this, true)) error (DWT.ERROR_WIDGET_DISPOSED); if (index !is 0 && !(0 <= index && index < parent.columnCount)) return new Rectangle (0, 0, 0, 0); - NSOutlineView outlineView = (NSOutlineView) parent.view; + NSOutlineView outlineView = cast(NSOutlineView) parent.view; int row = outlineView.rowForItem(handle); if ((parent.style & DWT.CHECK) !is 0) index ++; NSRect rect = outlineView.frameOfCellAtColumn(index, row); rect = outlineView.convertRect_toView_ (rect, parent.scrollView); - return new Rectangle((int)rect.x, (int)rect.y, (int)rect.width, (int)rect.height); + return new Rectangle(cast(int)rect.x, cast(int)rect.y, cast(int)rect.width, cast(int)rect.height); } /** @@ -961,7 +961,7 @@ background = color; if (oldColor !is null && oldColor.equals (color)) return; cached = true; - ((NSOutlineView)parent.view).reloadItem_(handle); + (cast(NSOutlineView)parent.view).reloadItem_(handle); } /** @@ -999,7 +999,7 @@ cellBackground [index] = color; if (oldColor !is null && oldColor.equals (color)) return; cached = true; - ((NSOutlineView)parent.view).reloadItem_(handle); + (cast(NSOutlineView)parent.view).reloadItem_(handle); } /** @@ -1019,7 +1019,7 @@ if (this.checked is checked) return; this.checked = checked; cached = true; - ((NSOutlineView)parent.view).reloadItem_(handle); + (cast(NSOutlineView)parent.view).reloadItem_(handle); } /** @@ -1038,9 +1038,9 @@ if (expanded is getExpanded ()) return; parent.ignoreExpand = true; if (expanded) { - ((NSOutlineView)parent.view).expandItem_(handle); + (cast(NSOutlineView)parent.view).expandItem_(handle); } else { - ((NSOutlineView)parent.view).collapseItem_(handle); + (cast(NSOutlineView)parent.view).collapseItem_(handle); } parent.ignoreExpand = false; cached = true; @@ -1079,7 +1079,7 @@ this.font = font; if (oldFont !is null && oldFont.equals (font)) return; cached = true; - ((NSOutlineView)parent.view).reloadItem_(handle); + (cast(NSOutlineView)parent.view).reloadItem_(handle); } /** @@ -1117,7 +1117,7 @@ cellFont [index] = font; if (oldFont !is null && oldFont.equals (font)) return; cached = true; - ((NSOutlineView)parent.view).reloadItem_(handle); + (cast(NSOutlineView)parent.view).reloadItem_(handle); } /** @@ -1150,7 +1150,7 @@ foreground = color; if (oldColor !is null && oldColor.equals (color)) return; cached = true; - ((NSOutlineView)parent.view).reloadItem_(handle); + (cast(NSOutlineView)parent.view).reloadItem_(handle); } /** @@ -1188,7 +1188,7 @@ cellForeground [index] = color; if (oldColor !is null && oldColor.equals (color)) return; cached = true; - ((NSOutlineView)parent.view).reloadItem_(handle); + (cast(NSOutlineView)parent.view).reloadItem_(handle); } /** @@ -1208,7 +1208,7 @@ if (this.grayed is grayed) return; this.grayed = grayed; cached = true; - ((NSOutlineView)parent.view).reloadItem_(handle); + (cast(NSOutlineView)parent.view).reloadItem_(handle); } /** @@ -1276,7 +1276,7 @@ } // cached = true; // if (index is 0) parent.setScrollWidth (this); - ((NSOutlineView)parent.view).reloadItem_(handle); + (cast(NSOutlineView)parent.view).reloadItem_(handle); } public void setImage (Image image) { @@ -1358,7 +1358,7 @@ } cached = true; if (index is 0) parent.setScrollWidth (this); - ((NSOutlineView)parent.view).reloadItem_(handle); + (cast(NSOutlineView)parent.view).reloadItem_(handle); } public void setText (String string) { diff -r fb2555104d70 -r 5b53d338c709 dwt/widgets/TypedListener.d diff -r fb2555104d70 -r 5b53d338c709 dwt/widgets/Widget.d --- a/dwt/widgets/Widget.d Fri Aug 29 21:47:55 2008 +0200 +++ b/dwt/widgets/Widget.d Fri Aug 29 22:04:22 2008 +0200 @@ -1176,20 +1176,20 @@ // */ // } // if (event.keyCode is 0) { -// int kchrPtr = OS.GetScriptManagerVariable ((short) OS.smKCHRCache); +// int kchrPtr = OS.GetScriptManagerVariable (cast(short) OS.smKCHRCache); // if (display.kchrPtr !is kchrPtr) { // display.kchrPtr = kchrPtr; // display.kchrState [0] = 0; // } -// int result = OS.KeyTranslate (display.kchrPtr, (short)keyCode [0], display.kchrState); +// int result = OS.KeyTranslate (display.kchrPtr, cast(short)keyCode [0], display.kchrState); // if (result <= 0x7f) { // event.keyCode = result & 0x7f; // } else { // int [] encoding = new int [1]; -// short keyScript = (short) OS.GetScriptManagerVariable ((short) OS.smKeyScript); -// short regionCode = (short) OS.GetScriptManagerVariable ((short) OS.smRegionCode); -// if (OS.UpgradeScriptInfoToTextEncoding (keyScript, (short) OS.kTextLanguageDontCare, regionCode, null, encoding) is OS.paramErr) { -// if (OS.UpgradeScriptInfoToTextEncoding (keyScript, (short) OS.kTextLanguageDontCare, (short) OS.kTextRegionDontCare, null, encoding) is OS.paramErr) { +// short keyScript = cast(short) OS.GetScriptManagerVariable (cast(short) OS.smKeyScript); +// short regionCode = cast(short) OS.GetScriptManagerVariable (cast(short) OS.smRegionCode); +// if (OS.UpgradeScriptInfoToTextEncoding (keyScript, cast(short) OS.kTextLanguageDontCare, regionCode, null, encoding) is OS.paramErr) { +// if (OS.UpgradeScriptInfoToTextEncoding (keyScript, cast(short) OS.kTextLanguageDontCare, cast(short) OS.kTextRegionDontCare, null, encoding) is OS.paramErr) { // encoding [0] = OS.kTextEncodingMacRoman; // } // } @@ -1200,7 +1200,7 @@ // int [] nchars = new int [1]; // byte [] buffer = new byte [2]; // buffer [0] = 1; -// buffer [1] = (byte) (result & 0xFF); +// buffer [1] = cast(byte) (result & 0xFF); // OS.ConvertFromPStringToUnicode (encodingInfo [0], buffer, chars.length * 2, nchars, chars); // OS.DisposeTextToUnicodeInfo (encodingInfo); // event.keyCode = chars [0];