Mercurial > projects > dwt-win
changeset 182:811e926196d6
merge
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Mon, 10 Mar 2008 04:58:09 +0100 |
parents | 772f75da6a52 (diff) 52c185ec49e8 (current diff) |
children | c4643827733c |
files | dwt/widgets/DirectoryDialog.d |
diffstat | 4 files changed, 22 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/dwt/dwthelper/utils.d Mon Mar 10 11:31:43 2008 +0800 +++ b/dwt/dwthelper/utils.d Mon Mar 10 04:58:09 2008 +0100 @@ -320,6 +320,16 @@ return typeid(char[]).getHash(&src); } +public char* toStringzValidPtr( char[] src ){ + if( src ){ + return src.toStringz(); + } + else{ + static const char[] nullPtr = "\0"; + return nullPtr.ptr; + } +} + static char[] toHex(uint value, bool prefix = true, int radix = 8){ return tango.text.convert.Integer.toString( value,
--- a/dwt/layout/FormAttachment.d Mon Mar 10 11:31:43 2008 +0800 +++ b/dwt/layout/FormAttachment.d Mon Mar 10 04:58:09 2008 +0100 @@ -185,7 +185,7 @@ * @param offset the offset of the side from the position */ public this (int numerator, int denominator, int offset) { - if (denominator == 0) DWT.error (DWT.ERROR_CANNOT_BE_ZERO); + if (denominator is 0) DWT.error (DWT.ERROR_CANNOT_BE_ZERO); this.numerator = numerator; this.denominator = denominator; this.offset = offset; @@ -244,7 +244,7 @@ m = n; n = temp; } - while (n != 0){ + while (n !is 0){ temp = m; m = n; n = temp % n; @@ -283,12 +283,12 @@ } int solveX (int value) { - if (denominator == 0) DWT.error (DWT.ERROR_CANNOT_BE_ZERO); + if (denominator is 0) DWT.error (DWT.ERROR_CANNOT_BE_ZERO); return ((numerator * value) / denominator) + offset; } int solveY (int value) { - if (numerator == 0) DWT.error (DWT.ERROR_CANNOT_BE_ZERO); + if (numerator is 0) DWT.error (DWT.ERROR_CANNOT_BE_ZERO); return (value - offset) * denominator / numerator; } @@ -298,8 +298,8 @@ * * @return a string representation of the FormAttachment */ -override public char[] toString () { - char[] string = control != null ? control.toString () : Format( "{}/{}", numerator, denominator ); +public override char[] toString () { + char[] string = control !is null ? control.toString () : Format( "{}/{}", numerator, denominator ); return Format("{{y = ({})x + {}}", string, ( offset >= 0 ? Format(")x + {}", offset ) : Format( ")x - {}", -offset))); }
--- a/dwt/widgets/DirectoryDialog.d Mon Mar 10 11:31:43 2008 +0800 +++ b/dwt/widgets/DirectoryDialog.d Mon Mar 10 04:58:09 2008 +0100 @@ -113,7 +113,7 @@ // int byteCount = buffer.length * TCHAR.sizeof; // OS.MoveMemory (buffer, lParam, byteCount); // directoryPath = buffer.toString (0, length); - pThis.directoryPath = TCHARzToStr( cast(TCHAR*)lParam ); + pThis.directoryPath = TCHARzToStr( cast(TCHAR*)lParam ); break; default: } @@ -189,7 +189,7 @@ /* Create the BrowseCallbackProc */ /+ Callback callback = new Callback (this, "BrowseCallbackProc", 4); //$NON-NLS-1$ int lpfn = callback.getAddress ();+/ - BFFCALLBACK lpfn = &BrowseCallbackProc; + BFFCALLBACK lpfn = &BrowseCallbackProc; if (lpfn is null) DWT.error (DWT.ERROR_NO_MORE_CALLBACKS); /* Make the parent shell be temporary modal */
--- a/dwt/widgets/Label.d Mon Mar 10 11:31:43 2008 +0800 +++ b/dwt/widgets/Label.d Mon Mar 10 04:58:09 2008 +0100 @@ -394,7 +394,8 @@ */ public void setText (char[] string) { checkWidget (); - if (string is null) error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null for zero length string + //if (string is null) error (DWT.ERROR_NULL_ARGUMENT); if ((style & DWT.SEPARATOR) !is 0) return; /* * Feature in Windows. For some reason, SetWindowText() for @@ -402,7 +403,7 @@ * has not changed. The fix is to check for this case and do * nothing. */ - if (string==/*eq*/text) return; + if (string.equals(text)) return; text = string; if (image is null || !IMAGE_AND_TEXT) { int oldBits = OS.GetWindowLong (handle, OS.GWL_STYLE), newBits = oldBits; @@ -419,7 +420,7 @@ if (oldBits !is newBits) OS.SetWindowLong (handle, OS.GWL_STYLE, newBits); } string = Display.withCrLf (string); - TCHAR* buffer = StrToTCHARz (/+getCodePage (),+/ string); + TCHAR* buffer = StrToTCHARz ( getCodePage (), string); OS.SetWindowText (handle, buffer); /* * Bug in Windows. For some reason, the HBRUSH that