Mercurial > projects > dwt-linux
changeset 238:380bad9f6852
reverted char[] to String
line wrap: on
line diff
--- a/dsss.conf Sat Apr 26 10:01:30 2008 +0200 +++ b/dsss.conf Mon May 05 00:42:55 2008 +0200 @@ -1,4 +1,4 @@ [dwt] -type=sourcelibrary +type=library
--- a/dwt/DWT.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/DWT.d Mon May 05 00:42:55 2008 +0200 @@ -3422,7 +3422,7 @@ * * @see DWT */ -static char[] findErrorText (int code) { +static String findErrorText (int code) { switch (code) { case ERROR_UNSPECIFIED: return "Unspecified error"; //$NON-NLS-1$ case ERROR_NO_HANDLES: return "No more handles"; //$NON-NLS-1$ @@ -3479,7 +3479,7 @@ * <li>ERROR_NULL_ARGUMENT - if the key is null</li> * </ul> */ -public static char[] getMessage(char[] key) { +public static String getMessage(String key) { // PORTING_FIXME: Implement return "msg not found"; //return Compatibility.getMessage(key); @@ -3491,7 +3491,7 @@ * * @return the DWT platform name */ -public static char[] getPlatform () { +public static String getPlatform () { return Platform.PLATFORM; } @@ -3510,7 +3510,7 @@ * * @param code the DWT error code */ -public static void error (char[] file, long line, int code) { +public static void error (String file, long line, int code) { error (code, null); } public static void error (int code) { @@ -3574,7 +3574,7 @@ * * @since 3.0 */ -public static void error (int code, Exception throwable, char[] detail) { +public static void error (int code, Exception throwable, String detail) { /* * This code prevents the creation of "chains" of SWTErrors and @@ -3595,7 +3595,7 @@ if (auto t = cast(DWTException)throwable) throw t; } - char[] message = findErrorText (code); + String message = findErrorText (code); if (detail != null) message ~= detail; switch (code) {
--- a/dwt/DWTError.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/DWTError.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.DWTError; +import dwt.dwthelper.utils; + import dwt.DWT; import tango.core.Exception; @@ -80,7 +82,7 @@ * * @param message the detail message for the exception */ -public this (char[] message) { +public this (String message) { this (DWT.ERROR_UNSPECIFIED, message); } @@ -103,7 +105,7 @@ * @param code the DWT error code * @param message the detail message for the exception */ -public this (int code, char[] message) { +public this (int code, String message) { super (message); this.code = code; } @@ -132,7 +134,7 @@ * </p> * @return the error message string of this DWTError object */ -public char[] getMessage () { +public String getMessage () { if (throwable is null) return super.toString(); return super.toString () ~ " (" ~ throwable.toString () ~ ")"; //$NON-NLS-1$ //$NON-NLS-2$
--- a/dwt/DWTException.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/DWTException.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.DWTException; +import dwt.dwthelper.utils; + import dwt.DWT; import tango.core.Exception; @@ -72,7 +74,7 @@ * * @param message the detail message for the exception */ -public this (char[] message) { +public this (String message) { this (DWT.ERROR_UNSPECIFIED, message); } @@ -95,7 +97,7 @@ * @param code the DWT error code * @param message the detail message for the exception */ -public this (int code, char[] message) { +public this (int code, String message) { super (message); this.code = code; } @@ -124,7 +126,7 @@ * </p> * @return the error message string of this DWTException object */ -public char[] getMessage () { +public String getMessage () { if (throwable is null) return super.toString (); return super.toString () ~ " (" ~ throwable.toString () ~ ")"; //$NON-NLS-1$ //$NON-NLS-2$ }
--- a/dwt/accessibility/AccessibleControlEvent.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/accessibility/AccessibleControlEvent.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.accessibility.AccessibleControlEvent; +import dwt.dwthelper.utils; + import dwt.accessibility.Accessible; import dwt.internal.DWTEventObject; @@ -39,7 +41,7 @@ public int x, y; // IN/OUT public int width, height; // OUT public int detail; // IN/OUT - public char[] result; // OUT + public String result; // OUT public Object children[]; // [OUT] //static final long serialVersionUID = 3257281444169529141L; @@ -59,7 +61,7 @@ * * @return a string representation of the event */ -public override char[] toString () { +public override String toString () { return Format( "AccessibleControlEvent {childID={} accessible={} x={} y={} width={} heigth={} detail={} result={}", childID, accessible, x, y, width, height, detail, result); }
--- a/dwt/accessibility/AccessibleEvent.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/accessibility/AccessibleEvent.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.accessibility.AccessibleEvent; +import dwt.dwthelper.utils; + import dwt.internal.DWTEventObject; import tango.text.convert.Format; @@ -45,7 +47,7 @@ * What to set it to depends on the listener method called, and * the childID specified by the client. */ - public char[] result; + public String result; //static final long serialVersionUID = 3257567304224026934L; @@ -64,7 +66,7 @@ * * @return a string representation of the event */ -public char[] toString () { +public String toString () { return Format( "AccessibleEvent {childID={} result={}}", childID, result ); } }
--- a/dwt/accessibility/AccessibleFactory.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/accessibility/AccessibleFactory.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.accessibility.AccessibleFactory; +import dwt.dwthelper.utils; + import dwt.internal.accessibility.gtk.ATK; import dwt.internal.gtk.OS; @@ -35,14 +37,14 @@ //Callback gTypeInfo_base_init_factory; Accessible[GtkWidget*] accessibles; - static long[char[]] Types; + static long[String] Types; static AccessibleFactory[long] Factories; static uint DefaultParentType; //$NON-NLS-1$ - static const char[] FACTORY_PARENTTYPENAME = "AtkObjectFactory"; - static const char[] SWT_TYPE_PREFIX = "DWT"; - static const char[] CHILD_TYPENAME = "Child"; - static const char[] FACTORY_TYPENAME = "SWTFactory"; + static const String FACTORY_PARENTTYPENAME = "AtkObjectFactory"; + static const String SWT_TYPE_PREFIX = "DWT"; + static const String CHILD_TYPENAME = "Child"; + static const String FACTORY_TYPENAME = "SWTFactory"; static const int[] actionRoles = [ ACC.ROLE_CHECKBUTTON, ACC.ROLE_COMBOBOX, ACC.ROLE_LINK, ACC.ROLE_MENUITEM, ACC.ROLE_PUSHBUTTON, ACC.ROLE_RADIOBUTTON, @@ -96,7 +98,7 @@ private this (int /*long*/ widgetType) { widgetTypeName = OS.g_type_name (widgetType); - char[] factoryName = FACTORY_TYPENAME ~ fromStringz( widgetTypeName ) ~ \0; + String factoryName = FACTORY_TYPENAME ~ fromStringz( widgetTypeName ) ~ \0; if (OS.g_type_from_name (factoryName.ptr) is 0) { /* register the factory */ auto registry = ATK.atk_get_default_registry (); @@ -138,7 +140,7 @@ if (accessible.accessibleObject !is null) { return accessible.accessibleObject.handle; } - char[] buffer = fromStringz( widgetTypeName ).dup; + String buffer = fromStringz( widgetTypeName ).dup; auto type = getType (buffer, accessible, objectParentType, ACC.CHILDID_SELF); AccessibleObject object = new AccessibleObject (type, cast(GtkWidget*)widget, accessible, objectParentType, false); accessible.accessibleObject = object; @@ -158,7 +160,7 @@ return DefaultParentType; } - static int /*long*/ getType (char[] widgetTypeName, Accessible accessible, int /*long*/ parentType, int childId) { + static int /*long*/ getType (String widgetTypeName, Accessible accessible, int /*long*/ parentType, int childId) { AccessibleControlEvent event = new AccessibleControlEvent (accessible); event.childID = childId; AccessibleControlListener[] listeners = accessible.getControlListeners (); @@ -194,7 +196,7 @@ } else { action = hypertext = selection = text = true; } - char[] swtTypeName = SWT_TYPE_PREFIX.dup; + String swtTypeName = SWT_TYPE_PREFIX.dup; swtTypeName ~= widgetTypeName; if (action) swtTypeName ~= "Action"; //$NON-NLS-1$ if (hypertext) swtTypeName ~= "Hypertext"; //$NON-NLS-1$
--- a/dwt/accessibility/AccessibleObject.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/accessibility/AccessibleObject.d Mon May 05 00:42:55 2008 +0200 @@ -43,10 +43,10 @@ */ bool isLightweight = false; - static char[] actionNamePtr; - static char[] descriptionPtr; - static char[] keybindingPtr; - static char[] namePtr; + static String actionNamePtr; + static String descriptionPtr; + static String keybindingPtr; + static String namePtr; static AccessibleObject[AtkObject*] AccessibleObjects; static /*const*/ uint ATK_ACTION_TYPE; static /*const*/ uint ATK_COMPONENT_TYPE; @@ -101,7 +101,7 @@ AccessibleEvent event = new AccessibleEvent (object); event.childID = object.id; if (parentResult !is null) { - char[] res = fromStringz( parentResult ); + String res = fromStringz( parentResult ); event.result = res.dup; } for (int i = 0; i < listeners.length; i++) { @@ -109,7 +109,7 @@ } if (event.result is null) return parentResult; if (keybindingPtr !is null ) OS.g_free (keybindingPtr.ptr); - char[] name = event.result.dup ~ \0; + String name = event.result.dup ~ \0; char* p = cast(char*) OS.g_malloc (name.length); keybindingPtr = p ? p[ 0 .. name.length ] : null; return keybindingPtr.ptr; @@ -133,7 +133,7 @@ AccessibleControlEvent event = new AccessibleControlEvent (object); event.childID = object.id; if (parentResult !is null) { - char[] res = fromStringz( parentResult ); + String res = fromStringz( parentResult ); event.result = res.dup; } for (int i = 0; i < listeners.length; i++) { @@ -142,7 +142,7 @@ if (event.result is null) return parentResult; if (actionNamePtr !is null) OS.g_free (actionNamePtr.ptr); - char[] name = event.result.dup ~ \0; + String name = event.result.dup ~ \0; auto p = cast(char*)OS.g_malloc (name.length); actionNamePtr = p ? p[ 0 .. name.length ] : null; return actionNamePtr.ptr; @@ -367,7 +367,7 @@ if (event.result is null) return parentResult; if (descriptionPtr !is null) OS.g_free (descriptionPtr.ptr); - char[] name = event.result.dup ~ \0; + String name = event.result.dup ~ \0; char* p = cast(char*)OS.g_malloc (name.length); descriptionPtr = p ? p[ 0 .. name.length ] : null; return descriptionPtr.ptr; } @@ -394,7 +394,7 @@ } if (event.result is null) return parentResult; if (namePtr !is null) OS.g_free (namePtr.ptr); - char[] name = event.result.dup ~ \0; + String name = event.result.dup ~ \0; char* p = cast(char*)OS.g_malloc (name.length); namePtr = p ? p[ 0 .. name.length ] : null; return namePtr.ptr; @@ -635,7 +635,7 @@ if (DEBUG) Stdout.formatln ("-->atkText_get_character_at_offset"); AccessibleObject object = getAccessibleObject (atkObject); if (object is null) return 0; - char[] text = object.getText (); + String text = object.getText (); if (text !is null) return text[cast(int)/*64*/offset ]; // TODO if (ATK.g_type_is_a (object.parentType, ATK_TEXT_TYPE)) { auto textIface = cast(AtkTextIface*)ATK.g_type_class_peek (object.parentType); @@ -651,7 +651,7 @@ if (DEBUG) Stdout.formatln ("-->atkText_get_character_count"); AccessibleObject object = getAccessibleObject (atkObject); if (object is null) return 0; - char[] text = object.getText (); + String text = object.getText (); if (text !is null) return text.length; if (ATK.g_type_is_a (object.parentType, ATK_TEXT_TYPE)) { auto textIface = cast(AtkTextIface*)ATK.g_type_class_peek (object.parentType); @@ -722,7 +722,7 @@ if (DEBUG) Stdout.formatln ("-->atkText_get_text: {},{}", start_offset, end_offset); AccessibleObject object = getAccessibleObject (atkObject); if (object is null) return null; - char[] text = object.getText (); + String text = object.getText (); if (text.length > 0) { if (end_offset is -1) { end_offset = text.length ; @@ -745,7 +745,7 @@ AccessibleObject object = getAccessibleObject (atkObject); if (object is null) return null; int offset = cast(int)/*64*/offset_value; - char[] text = object.getText (); + String text = object.getText (); if (text.length > 0) { int length = text.length ; offset = Math.min (offset, length - 1); @@ -922,7 +922,7 @@ AccessibleObject object = getAccessibleObject (atkObject); if (object is null) return null; int offset = offset_value; - char[] text = object.getText (); + String text = object.getText (); if (text.length > 0) { int length = text.length; offset = Math.min (offset, length - 1); @@ -1040,7 +1040,7 @@ AccessibleObject object = getAccessibleObject (atkObject); if (object is null) return null; int offset = offset_value; - char[] text = object.getText (); + String text = object.getText (); if (text.length > 0) { int length = text.length; offset = Math.min (offset, length - 1); @@ -1192,9 +1192,9 @@ return result !is null ? result : new AccessibleControlListener [0]; } - char[] getText () { + String getText () { char* parentResult; - char[] parentText = ""; //$NON-NLS-1$ + String parentText = ""; //$NON-NLS-1$ if (ATK.g_type_is_a (parentType, ATK_TEXT_TYPE)) { auto textIface = cast(AtkTextIface*)ATK.g_type_interface_peek_parent (ATK.ATK_TEXT_GET_IFACE (handle)); int /*long*/ characterCount = 0; @@ -1236,7 +1236,7 @@ } } - static int nextIndexOfChar (char[] string, char[] searchChars, int startIndex) { + static int nextIndexOfChar (String string, String searchChars, int startIndex) { int result = string.length; for (int i = 0; i < searchChars.length; i++) { char current = searchChars[i]; @@ -1246,7 +1246,7 @@ return result; } - static int nextIndexOfNotChar (char[] string, char[] searchChars, int startIndex) { + static int nextIndexOfNotChar (String string, String searchChars, int startIndex) { int length = string.length; int index = startIndex; while (index < length) { @@ -1257,7 +1257,7 @@ return index; } - static int previousIndexOfChar (char[] string, char[] searchChars, int startIndex) { + static int previousIndexOfChar (String string, String searchChars, int startIndex) { int result = -1; if (startIndex < 0) return result; string = string[0 .. startIndex]; @@ -1269,7 +1269,7 @@ return result; } - static int previousIndexOfNotChar (char[] string, char[] searchChars, int startIndex) { + static int previousIndexOfNotChar (String string, String searchChars, int startIndex) { if (startIndex < 0) return -1; int index = startIndex - 1; while (index >= 0) {
--- a/dwt/accessibility/AccessibleTextEvent.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/accessibility/AccessibleTextEvent.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.accessibility.AccessibleTextEvent; +import dwt.dwthelper.utils; + import dwt.internal.DWTEventObject; import tango.text.convert.Format; @@ -53,7 +55,7 @@ * * @return a string representation of the event */ -public override char[] toString () { +public override String toString () { return Format( "AccessibleTextEvent {{childID={} offset={} length={}}", childID, offset,
--- a/dwt/custom/BidiSegmentEvent.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/custom/BidiSegmentEvent.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.custom.BidiSegmentEvent; +import dwt.dwthelper.utils; + import dwt.events.TypedEvent; import dwt.custom.StyledTextEvent; @@ -70,7 +72,7 @@ /** * line text */ - public char[] lineText; + public String lineText; /** * bidi segments, see above
--- a/dwt/custom/Bullet.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/custom/Bullet.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.custom.Bullet; +import dwt.dwthelper.utils; + import dwt.DWT; import dwt.custom.StyleRange; import dwt.custom.ST; @@ -38,7 +40,7 @@ public class Bullet { public int type; public StyleRange style; - public char[] text; + public String text; int[] linesIndices; int count;
--- a/dwt/custom/BusyIndicator.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/custom/BusyIndicator.d Mon May 05 00:42:55 2008 +0200 @@ -27,8 +27,8 @@ public class BusyIndicator { static int nextBusyId = 1; - static const char[] BUSYID_NAME = "DWT BusyIndicator"; //$NON-NLS-1$ - static const char[] BUSY_CURSOR = "DWT BusyIndicator Cursor"; //$NON-NLS-1$ + static const String BUSYID_NAME = "DWT BusyIndicator"; //$NON-NLS-1$ + static const String BUSY_CURSOR = "DWT BusyIndicator Cursor"; //$NON-NLS-1$ /** * Runs the given <code>Runnable</code> while providing
--- a/dwt/custom/CCombo.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/custom/CCombo.d Mon May 05 00:42:55 2008 +0200 @@ -196,7 +196,7 @@ * * @see #add(String,int) */ -public void add (char[] string) { +public void add (String string) { checkWidget(); if (string is null) DWT.error (DWT.ERROR_NULL_ARGUMENT); list.add (string); @@ -224,7 +224,7 @@ * * @see #add(String) */ -public void add (char[] string, int index) { +public void add (String string, int index) { checkWidget(); if (string is null) DWT.error (DWT.ERROR_NULL_ARGUMENT); list.add (string, index); @@ -376,7 +376,7 @@ public override Point computeSize (int wHint, int hHint, bool changed) { checkWidget (); int width = 0, height = 0; - char[][] items = list.getItems (); + String[] items = list.getItems (); GC gc = new GC (text); int spacer = gc.stringExtent (" ").x; //$NON-NLS-1$ int textWidth = gc.stringExtent (text.getText ()).x; @@ -412,7 +412,7 @@ checkWidget (); text.copy (); } -void createPopup(char[][] items, int selectionIndex) { +void createPopup(String[] items, int selectionIndex) { // create shell and list popup = new Shell (getShell (), DWT.NO_TRIM | DWT.ON_TOP); int style = getStyle (); @@ -496,7 +496,7 @@ } if (getShell() !is popup.getParent ()) { - char[][] items = list.getItems (); + String[] items = list.getItems (); int selectionIndex = list.getSelectionIndex (); list.removeListener (DWT.Dispose, listener); popup.dispose(); @@ -534,7 +534,7 @@ * an '&' character in the given string. If there are no '&' * characters in the given string, return '\0'. */ -dchar _findMnemonic (char[] string) { +dchar _findMnemonic (String string) { if (string is null) return '\0'; int index = 0; int length = string.length; @@ -602,7 +602,7 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ -public char[] getItem (int index) { +public String getItem (int index) { checkWidget(); return list.getItem (index); } @@ -651,7 +651,7 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ -public char[] [] getItems () { +public String [] getItems () { checkWidget (); return list.getItems (); } @@ -708,7 +708,7 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ -public char[] getText () { +public String getText () { checkWidget (); return text.getText (); } @@ -810,7 +810,7 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ -public int indexOf (char[] string) { +public int indexOf (String string) { checkWidget (); if (string is null) DWT.error (DWT.ERROR_NULL_ARGUMENT); return list.indexOf (string); @@ -834,7 +834,7 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ -public int indexOf (char[] string, int start) { +public int indexOf (String string, int start) { checkWidget (); if (string is null) DWT.error (DWT.ERROR_NULL_ARGUMENT); return list.indexOf (string, start); @@ -843,7 +843,7 @@ void initAccessible() { AccessibleAdapter accessibleAdapter = new class() AccessibleAdapter { public void getName (AccessibleEvent e) { - char[] name = null; + String name = null; Label label = getAssociatedLabel (); if (label !is null) { name = stripMnemonic (label.getText()); @@ -851,10 +851,10 @@ e.result = name; } public void getKeyboardShortcut(AccessibleEvent e) { - char[] shortcut = null; + String shortcut = null; Label label = getAssociatedLabel (); if (label !is null) { - char[] text = label.getText (); + String text = label.getText (); if (text !is null) { dchar mnemonic = _findMnemonic (text); if (mnemonic !is '\0') { @@ -964,7 +964,7 @@ switch (event.type) { case DWT.Dispose: if (getShell () !is popup.getParent ()) { - char[][] items = list.getItems (); + String[] items = list.getItems (); int selectionIndex = list.getSelectionIndex (); popup = null; list = null; @@ -1170,7 +1170,7 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ -public void remove (char[] string) { +public void remove (String string) { checkWidget(); if (string is null) DWT.error (DWT.ERROR_NULL_ARGUMENT); list.remove (string); @@ -1352,7 +1352,7 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ -public void setItem (int index, char[] string) { +public void setItem (int index, String string) { checkWidget(); list.setItem (index, string); } @@ -1370,7 +1370,7 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ -public void setItems (char[] [] items) { +public void setItems (String [] items) { checkWidget (); list.setItems (items); if (!text.getEditable ()) text.setText (""); //$NON-NLS-1$ @@ -1440,7 +1440,7 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ -public void setText (char[] string) { +public void setText (String string) { checkWidget(); if (string is null) DWT.error (DWT.ERROR_NULL_ARGUMENT); int index = list.indexOf (string); @@ -1473,7 +1473,7 @@ text.setTextLimit (limit); } -public override void setToolTipText (char[] string) { +public override void setToolTipText (String string) { checkWidget(); super.setToolTipText(string); arrow.setToolTipText (string); @@ -1507,7 +1507,7 @@ if (count < 0) return; visibleItemCount = count; } -char[] stripMnemonic (char[] string) { +String stripMnemonic (String string) { int index = 0; int length_ = string.length; do {
--- a/dwt/custom/CLabel.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/custom/CLabel.d Mon May 05 00:42:55 2008 +0200 @@ -74,13 +74,13 @@ /** Left and right margins */ private static const int INDENT = 3; /** a string inserted in the middle of text that has been shortened */ - private static const char[] ELLIPSIS = "..."; //$NON-NLS-1$ // could use the ellipsis glyph on some platforms "\u2026" + private static const String ELLIPSIS = "..."; //$NON-NLS-1$ // could use the ellipsis glyph on some platforms "\u2026" /** the alignment. Either CENTER, RIGHT, LEFT. Default is LEFT*/ private int align_ = DWT.LEFT; private int hIndent = INDENT; private int vIndent = INDENT; /** the current text */ - private char[] text; + private String text; /** the current icon */ private Image image; // The tooltip is used for two purposes - the application can set @@ -88,7 +88,7 @@ // the text has been truncated due to the label being too short. // The appToolTip stores the tooltip set by the application. Control.tooltiptext // contains whatever tooltip is currently being displayed. - private char[] appToolTipText; + private String appToolTipText; private Image backgroundImage; private Color[] gradientColors; @@ -209,7 +209,7 @@ * an '&' character in the given string. If there are no '&' * characters in the given string, return '\0'. */ -dchar _findMnemonic (char[] string) { +dchar _findMnemonic (String string) { if (string is null) return '\0'; int index = 0; int length = string.length; @@ -248,7 +248,7 @@ /** * Compute the minimum size. */ -private Point getTotalSize(Image image, char[] text) { +private Point getTotalSize(Image image, String text) { Point size = new Point(0, 0); if (image !is null) { @@ -286,11 +286,11 @@ * * @return the text of the label or null */ -public char[] getText() { +public String getText() { //checkWidget(); return text; } -public override char[] getToolTipText () { +public override String getToolTipText () { checkWidget(); return appToolTipText; } @@ -379,7 +379,7 @@ if (rect.width is 0 || rect.height is 0) return; bool shortenText_ = false; - char[] t = text; + String t = text; Image img = image; int availableWidth = Math.max(0, rect.width - 2*hIndent); Point extent = getTotalSize(img, t); @@ -392,7 +392,7 @@ } GC gc = event.gc; - char[][] lines = text is null ? null : splitString(text); + String[] lines = text is null ? null : splitString(text); // shorten the text if (shortenText_) { @@ -765,7 +765,7 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ -public void setText(char[] text) { +public void setText(String text) { checkWidget(); if (text is null) text = ""; //$NON-NLS-1$ if ( text !=/*eq*/ this.text) { @@ -773,7 +773,7 @@ redraw(); } } -public override void setToolTipText (char[] string) { +public override void setToolTipText (String string) { super.setToolTipText (string); appToolTipText = super.getToolTipText(); } @@ -788,7 +788,7 @@ * @param width the width to shorten the text to, in pixels * @return the shortened text */ -protected char[] shortenText(GC gc, char[] t, int width) { +protected String shortenText(GC gc, String t, int width) { if (t is null) return null; int w = gc.textExtent(ELLIPSIS, DRAW_FLAGS).x; if (width<=w) return t; @@ -798,8 +798,8 @@ int mid = (max+min)/2 - 1; if (mid <= 0) return t; while (min < mid && mid < max) { - char[] s1 = t[0 .. mid].dup; - char[] s2 = t[l-mid .. l].dup; + String s1 = t[0 .. mid].dup; + String s2 = t[l-mid .. l].dup; int l1 = gc.textExtent(s1, DRAW_FLAGS).x; int l2 = gc.textExtent(s2, DRAW_FLAGS).x; if (l1+w+l2 > width) { @@ -816,8 +816,8 @@ return t[ 0 .. mid ] ~ ELLIPSIS ~ t[ l-mid .. l ]; } -private char[][] splitString(char[] text) { - char[][] lines = new char[][1]; +private String[] splitString(String text) { + String[] lines = new String[1]; int start = 0, pos; do { pos = tango.text.Util.locate( text, '\n', start); @@ -827,7 +827,7 @@ bool crlf = (pos > 0) && (text[ pos - 1 ] is '\r'); lines[lines.length - 1] = text[ start .. pos - (crlf ? 1 : 0)]; start = pos + 1; - char[][] newLines = new char[][lines.length+1]; + String[] newLines = new String[lines.length+1]; System.arraycopy(lines, 0, newLines, 0, lines.length); lines = newLines; }
--- a/dwt/custom/CTabFolder.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/custom/CTabFolder.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,7 @@ *******************************************************************************/ module dwt.custom.CTabFolder; +import tango.util.log.Trace; import dwt.DWT; import dwt.DWTException; @@ -411,7 +412,7 @@ * NO_BACKGROUND style. The NO_BACKGROUND style is not required on platforms * that use double buffering which is true in both of these cases. */ - char[] platform = DWT.getPlatform(); + String platform = DWT.getPlatform(); if ("carbon"==platform || "gtk"==platform) return style; //$NON-NLS-1$ //$NON-NLS-2$ //TEMPORARY CODE @@ -883,7 +884,7 @@ } count = items.length - showCount; } - char[] chevronString = count > 99 ? "99+" : to!(char[])(count); //$NON-NLS-1$ + String chevronString = count > 99 ? "99+" : to!(String)(count); //$NON-NLS-1$ switch (chevronImageState) { case NORMAL: { Color chevronBorder = single ? getSelectionForeground() : getForeground(); @@ -1300,7 +1301,7 @@ * an '&' character in the given string. If there are no '&' * characters in the given string, return '\0'. */ -dchar _findMnemonic (char[] string) { +dchar _findMnemonic (String string) { if (string is null) return '\0'; int index = 0; int length_ = string.length; @@ -1312,7 +1313,7 @@ } while (index < length_); return '\0'; } -char[] stripMnemonic (char[] string) { +String stripMnemonic (String string) { int index = 0; int length_ = string.length; do { @@ -1642,10 +1643,10 @@ return -1; } void initAccessible() { - final Accessible accessible = getAccessible(); + Accessible accessible = getAccessible(); accessible.addAccessibleListener(new class() AccessibleAdapter { public void getName(AccessibleEvent e) { - char[] name = null; + String name = null; int childID = e.childID; if (childID >= 0 && childID < items.length) { name = stripMnemonic(items[childID].getText()); @@ -1660,7 +1661,7 @@ } public void getHelp(AccessibleEvent e) { - char[] help = null; + String help = null; int childID = e.childID; if (childID is ACC.CHILDID_SELF) { help = getToolTipText(); @@ -1671,10 +1672,10 @@ } public void getKeyboardShortcut(AccessibleEvent e) { - char[] shortcut = null; + String shortcut = null; int childID = e.childID; if (childID >= 0 && childID < items.length) { - char[] text = items[childID].getText(); + String text = items[childID].getText(); if (text !is null) { dchar mnemonic = _findMnemonic(text); if (mnemonic !is '\0') { @@ -1742,7 +1743,7 @@ } public void getDefaultAction(AccessibleControlEvent e) { - char[] action = null; + String action = null; int childID = e.childID; if (childID >= 0 && childID < items.length) { action = DWT.getMessage ("SWT_Switch"); //$NON-NLS-1$ @@ -1818,31 +1819,52 @@ } }); - addListener(DWT.Selection, new class(accessible) Listener { - Accessible acc; - this( Accessible acc ){ this.acc = acc; } +addListener(DWT.Selection, getInst(accessible) ); + addListener(DWT.FocusIn, new class(accessible) Listener { + Accessible acc2; + this( Accessible acc2 ){ this.acc2 = acc2; } public void handleEvent(Event event) { - if (isFocusControl()) { - if (selectedIndex is -1) { - acc.setFocus(ACC.CHILDID_SELF); - } else { - acc.setFocus(selectedIndex); - } + if (this.outer.selectedIndex is -1) { + acc2.setFocus(ACC.CHILDID_SELF); + } else { + acc2.setFocus(this.outer.selectedIndex); } } }); - - addListener(DWT.FocusIn, new class(accessible) Listener { - Accessible acc; - this( Accessible acc ){ this.acc = acc; } +} +Listener getInst(Accessible accessible ){ + return new class/+accessible+/ Listener { + //Accessible acc; + //this( Accessible acc ){ this.acc = acc; } public void handleEvent(Event event) { - if (selectedIndex is -1) { - acc.setFocus(ACC.CHILDID_SELF); - } else { - acc.setFocus(selectedIndex); + Trace.formatln( "{} {}", __FILE__, __LINE__ ); + Trace.formatln( "{} {} {}", __FILE__, __LINE__, cast(void*)this ); + Trace.formatln( "{} {} {}", __FILE__, __LINE__, cast(void*)this.outer ); + //auto p = &this.outer.isFocusControl; + //Trace.formatln( "{} {} {}", __FILE__, __LINE__, cast(void*)p.ptr ); + //Trace.formatln( "{} {} {}", __FILE__, __LINE__, cast(void*)p.funcptr ); + test(); + Trace.formatln( "{} {}", __FILE__, __LINE__ ); +// if (this.outer.isFocusControl()) { +// Trace.formatln( "{} {}", __FILE__, __LINE__ ); + if (selectedIndex is -1) { +// Trace.formatln( "{} {}", __FILE__, __LINE__ ); + // acc.setFocus(ACC.CHILDID_SELF); +// Trace.formatln( "{} {}", __FILE__, __LINE__ ); +// } else { +// Trace.formatln( "{} {}", __FILE__, __LINE__ ); +// // acc.setFocus(this.outer.selectedIndex); +// Trace.formatln( "{} {}", __FILE__, __LINE__ ); +// } + Trace.formatln( "{} {}", __FILE__, __LINE__ ); } + Trace.formatln( "{} {}", __FILE__, __LINE__ ); + } - }); + }; +} +void test(){ + Trace.formatln( "{} {}", __FILE__, __LINE__ ); } void onKeyDown (Event event) { switch (event.keyCode) { @@ -3872,7 +3894,7 @@ items[i].dispose(); } } - static const char[] id = "CTabFolder_showList_Index"; //$NON-NLS-1$ + static const String id = "CTabFolder_showList_Index"; //$NON-NLS-1$ for (int i = 0; i < items.length; i++) { CTabItem tab = items[i]; if (tab.showing) continue; @@ -3916,8 +3938,8 @@ } void _setToolTipText (int x, int y) { - char[] oldTip = getToolTipText(); - char[] newTip = _getToolTip(x, y); + String oldTip = getToolTipText(); + String newTip = _getToolTip(x, y); if (newTip is null || newTip!=oldTip) { setToolTipText(newTip); } @@ -4049,7 +4071,7 @@ notifyListeners(DWT.Resize, new Event()); return true; } -char[] _getToolTip(int x, int y) { +String _getToolTip(int x, int y) { if (showMin && minRect.contains(x, y)) return minimized ? DWT.getMessage("SWT_Restore") : DWT.getMessage("SWT_Minimize"); //$NON-NLS-1$ //$NON-NLS-2$ if (showMax && maxRect.contains(x, y)) return maximized ? DWT.getMessage("SWT_Restore") : DWT.getMessage("SWT_Maximize"); //$NON-NLS-1$ //$NON-NLS-2$ if (showChevron && chevronRect.contains(x, y)) return DWT.getMessage("SWT_ShowList"); //$NON-NLS-1$
--- a/dwt/custom/CTabFolderEvent.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/custom/CTabFolderEvent.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.custom.CTabFolderEvent; +import dwt.dwthelper.utils; + import dwt.events.TypedEvent; @@ -81,15 +83,15 @@ * * @return a string representation of the event */ -public override char[] toString() { - char[] string = super.toString (); +public override String toString() { + String string = super.toString (); return string[0.. $ - 1] // remove trailing '}' - ~ " item=" ~ to!(char[])(item) - ~ " doit=" ~ to!(char[])(doit) - ~ " x=" ~ to!(char[])(x) - ~ " y=" ~ to!(char[])(y) - ~ " width=" ~ to!(char[])(width) - ~ " height=" ~ to!(char[])(height) + ~ " item=" ~ to!(String)(item) + ~ " doit=" ~ to!(String)(doit) + ~ " x=" ~ to!(String)(x) + ~ " y=" ~ to!(String)(y) + ~ " width=" ~ to!(String)(width) + ~ " height=" ~ to!(String)(height) ~ "}"; } }
--- a/dwt/custom/CTabItem.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/custom/CTabItem.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.custom.CTabItem; +import dwt.dwthelper.utils; + import dwt.DWT; @@ -48,8 +50,8 @@ int x,y,width,height = 0; Control control; // the tab page - char[] toolTipText; - char[] shortenedText; + String toolTipText; + String shortenedText; int shortenedTextWidth; // Appearance @@ -68,7 +70,7 @@ static final int RIGHT_MARGIN = 4; static final int INTERNAL_SPACING = 4; static final int FLAGS = DWT.DRAW_TRANSPARENT | DWT.DRAW_MNEMONIC; - static final char[] ELLIPSIS = "..."; //$NON-NLS-1$ // could use the ellipsis glyph on some platforms "\u2026" + static final String ELLIPSIS = "..."; //$NON-NLS-1$ // could use the ellipsis glyph on some platforms "\u2026" /** * Constructs a new instance of this class given its parent @@ -148,13 +150,13 @@ return parent.simple; } -char[] shortenText(GC gc, char[] text, int width) { +String shortenText(GC gc, String text, int width) { return useEllipses() ? shortenText(gc, text, width, ELLIPSIS) : shortenText(gc, text, width, ""); //$NON-NLS-1$ } -char[] shortenText(GC gc, char[] text, int width, char[] ellipses) { +String shortenText(GC gc, String text, int width, String ellipses) { if (gc.textExtent(text, FLAGS).x <= width) return text; int ellipseWidth = gc.textExtent(ellipses, FLAGS).x; int length = text.length; @@ -776,10 +778,10 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ -public char[] getToolTipText () { +public String getToolTipText () { checkWidget(); if (toolTipText is null && shortenedText !is null) { - char[] text = getText(); + String text = getText(); if (shortenedText!=text) return text; } return toolTipText; @@ -811,7 +813,7 @@ int preferredHeight(GC gc) { Image image = getImage(); int h = (image is null) ? 0 : image.getBounds().height; - char[] text = getText(); + String text = getText(); if (font is null) { h = Math.max(h, gc.textExtent(text, FLAGS).y); } else { @@ -831,7 +833,7 @@ if (image !is null && (isSelected || parent.showUnselectedImage)) { w += image.getBounds().width; } - char[] text = null; + String text = null; if (minimum) { int minChars = parent.minChars; text = minChars is 0 ? null : getText(); @@ -996,7 +998,7 @@ parent.redrawTabs(); } } -public override void setText (char[] string) { +public override void setText (String string) { checkWidget(); if (string is null) DWT.error (DWT.ERROR_NULL_ARGUMENT); if (string==getText()) return; @@ -1019,7 +1021,7 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ -public void setToolTipText (char[] string) { +public void setToolTipText (String string) { checkWidget(); toolTipText = string; }
--- a/dwt/custom/DefaultContent.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/custom/DefaultContent.d Mon May 05 00:42:55 2008 +0200 @@ -29,7 +29,7 @@ alias tango.text.Text.Text!(char) StringBuffer; class DefaultContent : StyledTextContent { - private final static char[] LineDelimiter = tango.io.FileConst.FileConst.NewlineString; + private final static String LineDelimiter = tango.io.FileConst.FileConst.NewlineString; StyledTextListener[] textListeners; // stores text listeners for event sending char[] textStore; // stores the actual text @@ -187,7 +187,7 @@ * @param newText start offset of text to replace * @return a bool specifying whether or not the replace operation is valid */ -protected bool isValidReplace(int start, int replaceLength, char[] newText){ +protected bool isValidReplace(int start, int replaceLength, String newText){ if (replaceLength is 0) { // inserting text, see if the \r\n line delimiter is being split if (start is 0) return true; @@ -272,7 +272,7 @@ * @param position the position at which to insert the text * @param text the text to insert */ -void insert(int position, char[] text) { +void insert(int position, String text) { if (text.length is 0) return; int startLine = getLineAtOffset(position); @@ -454,7 +454,7 @@ * @param text the text to lineate * @return number of lines in the text */ -int lineCount(char[] text){ +int lineCount(String text){ int lineCount_ = 0; int length = text.length; for (int i = 0; i < length; i++) { @@ -487,7 +487,7 @@ * <li>ERROR_INVALID_ARGUMENT when index is out of range</li> * </ul> */ -public char[] getLine(int index) { +public String getLine(int index) { if ((index >= lineCount_) || (index < 0)) error(DWT.ERROR_INVALID_ARGUMENT); int start = lines[index][0]; int length_ = lines[index][1]; @@ -520,7 +520,7 @@ * @return the platform line delimiter as specified in the line.separator * system property. */ -public char[] getLineDelimiter() { +public String getLineDelimiter() { return LineDelimiter; } /** @@ -529,7 +529,7 @@ * @param index the index of the line to return * @return the logical line text (i.e., without the gap) with delimiters */ -char[] getFullLine(int index) { +String getFullLine(int index) { int start = lines[index][0]; int length_ = lines[index][1]; int end = start + length_ - 1; @@ -552,7 +552,7 @@ * @param index the line index * @return the physical line */ -char[] getPhysicalLine(int index) { +String getPhysicalLine(int index) { int start = lines[index][0]; int length_ = lines[index][1]; return getPhysicalText(start, length_); @@ -700,7 +700,7 @@ * @param length the physical length of the text to return * @return the text */ -char[] getPhysicalText(int start, int length_) { +String getPhysicalText(int start, int length_) { return textStore[ start .. start + length_ ].dup; } /** @@ -712,7 +712,7 @@ * @param length the logical length of the text to return * @return the text */ -public char[] getTextRange(int start, int length_) { +public String getTextRange(int start, int length_) { if (textStore is null) return ""; if (length_ is 0) @@ -775,7 +775,7 @@ * \r\n delimiter or deleting part of this line delimiter is not supported</li> * </ul> */ -public void replaceTextRange(int start, int replaceLength, char[] newText){ +public void replaceTextRange(int start, int replaceLength, String newText){ // check for invalid replace operations if (!isValidReplace(start, replaceLength, newText)) DWT.error(DWT.ERROR_INVALID_ARGUMENT); @@ -814,7 +814,7 @@ * * @param text the text */ -public void setText (char[] text){ +public void setText (String text){ textStore = text.dup; gapStart = -1; gapEnd = -1; @@ -839,7 +839,7 @@ int startLineOffset = getOffsetAtLine(startLine); int endLine = getLineAtOffset(position + length_); - char[] endText = ""; + String endText = ""; bool splittingDelimiter = false; if (position + length_ < getCharCount()) { endText = getTextRange(position + length_ - 1, 2);
--- a/dwt/custom/ExtendedModifyEvent.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/custom/ExtendedModifyEvent.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.custom.ExtendedModifyEvent; +import dwt.dwthelper.utils; + import dwt.events.TypedEvent; import dwt.custom.StyledTextEvent; @@ -24,7 +26,7 @@ /** length of the new text */ public int length; /** replaced text or empty string if no text was replaced */ - public char[] replacedText; + public String replacedText; static final long serialVersionUID = 3258696507027830832L;
--- a/dwt/custom/LineBackgroundEvent.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/custom/LineBackgroundEvent.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.custom.LineBackgroundEvent; +import dwt.dwthelper.utils; + import dwt.events.TypedEvent; import dwt.graphics.Color; @@ -30,7 +32,7 @@ /** * line text */ - public char[] lineText; + public String lineText; /** * line background color
--- a/dwt/custom/LineStyleEvent.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/custom/LineStyleEvent.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.custom.LineStyleEvent; +import dwt.dwthelper.utils; + import dwt.events.TypedEvent; import dwt.custom.StyleRange; import dwt.custom.Bullet; @@ -30,7 +32,7 @@ /** * line text (input) */ - public char[] lineText; + public String lineText; /** * line ranges (output)
--- a/dwt/custom/MovementEvent.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/custom/MovementEvent.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.custom.MovementEvent; +import dwt.dwthelper.utils; + import dwt.events.TypedEvent; import dwt.custom.StyledTextEvent; @@ -31,7 +33,7 @@ /** * line text (input) */ - public char[] lineText; + public String lineText; /** * the current offset (input)
--- a/dwt/custom/PopupList.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/custom/PopupList.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.custom.PopupList; +import dwt.dwthelper.utils; + import dwt.DWT; import dwt.DWTException; @@ -127,7 +129,7 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ -public char[][] getItems () { +public String[] getItems () { return list.getItems(); } /** @@ -146,7 +148,7 @@ * * @return the text of the selected item or null if no item is selected */ -public char[] open (Rectangle rect) { +public String open (Rectangle rect) { Point listSize = list.computeSize (rect.width, DWT.DEFAULT, false); Rectangle screenSize = shell.getDisplay().getBounds(); @@ -194,16 +196,16 @@ if (!display.readAndDispatch()) display.sleep(); } - char[] result = null; + String result = null; if (!shell.isDisposed ()) { - char[] [] strings = list.getSelection (); + String [] strings = list.getSelection (); shell.dispose(); if (strings.length !is 0) result = strings [0]; } return result; } /** -* Selects an item with text that starts with specified char[]. +* Selects an item with text that starts with specified String. * <p> * If the item is not currently selected, it is selected. * If the item at an index is selected, it remains selected. @@ -216,8 +218,8 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ -public void select(char[] string) { - char[][] items = list.getItems(); +public void select(String string) { + String[] items = list.getItems(); // find the first entry in the list that starts with the // specified string @@ -269,7 +271,7 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ -public void setItems (char[][] strings) { +public void setItems (String[] strings) { list.setItems(strings); } /**
--- a/dwt/custom/SashFormData.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/custom/SashFormData.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.custom.SashFormData; +import dwt.dwthelper.utils; + static import tango.text.Util; import tango.util.Convert; @@ -19,8 +21,8 @@ long weight; -char[] getName () { - char[] string = this.classinfo.name; +String getName () { + String string = this.classinfo.name; int index = tango.text.Util.locatePrior( string ,'.' ); if (index is string.length ) return string; return string[ index + 1 .. $ ]; @@ -32,7 +34,7 @@ * * @return a string representation of the event */ -public override char[] toString () { - return getName()~" {weight="~to!(char[])(weight)~"}"; //$NON-NLS-2$ +public override String toString () { + return getName()~" {weight="~to!(String)(weight)~"}"; //$NON-NLS-2$ } }
--- a/dwt/custom/ScrolledComposite.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/custom/ScrolledComposite.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.custom.ScrolledComposite; +import dwt.dwthelper.utils; + import dwt.DWT; import dwt.DWTException;
--- a/dwt/custom/StackLayout.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/custom/StackLayout.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.custom.StackLayout; +import dwt.dwthelper.utils; + import dwt.DWT; @@ -128,8 +130,8 @@ } } -char[] getName () { - char[] string = this.classinfo.name; +String getName () { + String string = this.classinfo.name; int index = tango.text.Util.locatePrior( string ,'.'); if (index is string.length ) return string; return string[ index + 1 .. $ ]; @@ -141,11 +143,11 @@ * * @return a string representation of the layout */ -public override char[] toString () { - char[] string = getName ()~" {"; - if (marginWidth !is 0) string ~= "marginWidth="~to!(char[])(marginWidth)~" "; - if (marginHeight !is 0) string ~= "marginHeight="~to!(char[])(marginHeight)~" "; - if (topControl !is null) string ~= "topControl="~to!(char[])(topControl)~" "; +public override String toString () { + String string = getName ()~" {"; + if (marginWidth !is 0) string ~= "marginWidth="~to!(String)(marginWidth)~" "; + if (marginHeight !is 0) string ~= "marginHeight="~to!(String)(marginHeight)~" "; + if (topControl !is null) string ~= "topControl="~to!(String)(topControl)~" "; string = tango.text.Util.trim(string); string ~= "}"; return string;
--- a/dwt/custom/StyleRange.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/custom/StyleRange.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.custom.StyleRange; +import dwt.dwthelper.utils; + import dwt.DWT; import dwt.graphics.Color; @@ -175,7 +177,7 @@ * * @return a string representation of the StyleRange */ -public override char[] toString() { +public override String toString() { StringBuffer buffer = new StringBuffer(); buffer.append("StyleRange {"); buffer.append(start); @@ -195,7 +197,7 @@ default: buffer.append("normal"); } - char[] str = super.toString(); + String str = super.toString(); int index = tango.text.Util.locate( str, '{'); if( index is str.length ) index = -1; str = str[ index + 1 .. $ ];
--- a/dwt/custom/StyledText.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/custom/StyledText.d Mon May 05 00:42:55 2008 +0200 @@ -851,7 +851,7 @@ write( string[start .. index ] ); } write("\\u"); - write( to!(char[])( cast(short)ch )); + write( to!(String)( cast(short)ch )); write(' '); // control word delimiter start = index + incr; } else if (ch is '}' || ch is '{' || ch is '\\') { @@ -880,8 +880,8 @@ header.append("{\\rtf1\\ansi"); // specify code page, necessary for copy to work in bidi // systems that don't support Unicode RTF. - // PORTING_TODO: char[] cpg = System.getProperty("file.encoding").toLowerCase(); - char[] cpg = "UTF16"; + // PORTING_TODO: String cpg = System.getProperty("file.encoding").toLowerCase(); + String cpg = "UTF16"; /+ if (cpg.startsWith("cp") || cpg.startsWith("ms")) { cpg = cpg.substring(2, cpg.length());
--- a/dwt/custom/StyledTextContent.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/custom/StyledTextContent.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.custom.StyledTextContent; +import dwt.dwthelper.utils; + import dwt.custom.TextChangeListener; /** * Clients may implement the StyledTextContent interface to provide a @@ -53,7 +55,7 @@ * content. * @return the line text without delimiters */ -public char[] getLine(int lineIndex); +public String getLine(int lineIndex); /** * Return the line index at the given character offset. @@ -103,7 +105,7 @@ * @return the line delimiter that should be used by the StyledText widget * when inserting new lines. */ -public char[] getLineDelimiter(); +public String getLineDelimiter(); /** * Return the character offset of the first character of the given line. @@ -134,7 +136,7 @@ * @param length the length of the text to return * @return the text at the given range */ -public char[] getTextRange(int start, int length); +public String getTextRange(int start, int length); /** * Remove the specified text changed listener. @@ -192,7 +194,7 @@ * @param text text to replace * @see TextChangeListener */ -public void replaceTextRange(int start, int replaceLength, char[] text); +public void replaceTextRange(int start, int replaceLength, String text); /** * Set text to "text". @@ -204,7 +206,7 @@ * @param text the new text * @see TextChangeListener */ -public void setText(char[] text); +public void setText(String text); /++ + DWT Extension
--- a/dwt/custom/StyledTextPrintOptions.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/custom/StyledTextPrintOptions.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.custom.StyledTextPrintOptions; +import dwt.dwthelper.utils; + /** * Use StyledTextPrintOptions to specify printing options for the * StyledText.print(Printer, StyledTextPrintOptions) API. @@ -36,12 +38,12 @@ * Page number placeholder constant for use in <code>header</code> * and <code>footer</code>. Value is <code><page></code> */ - public static final char[] PAGE_TAG = "<page>"; + public static final String PAGE_TAG = "<page>"; /** * Separator constant for use in <code>header</code> and * <code>footer</code>. Value is <code>\t</code> */ - public static final char[] SEPARATOR = "\t"; + public static final String SEPARATOR = "\t"; /** * Formatted text to print in the header of each page. * <p>"left '\t' center '\t' right"</p> @@ -52,7 +54,7 @@ * left aligned, centered and right aligned. They are separated by a tab * character (<code>StyledTextPrintOptions.SEPARATOR</code>). */ - public char[] header = null; + public String header = null; /** * Formatted text to print in the footer of each page. * <p>"left '\t' center '\t' right"</p> @@ -63,11 +65,11 @@ * left aligned, centered and right aligned. They are separated by a tab * character (<code>StyledTextPrintOptions.SEPARATOR</code>). */ - public char[] footer = null; + public String footer = null; /** * Name of the print job. */ - public char[] jobName = null; + public String jobName = null; /** * Print the text foreground color. Default value is <code>false</code>.
--- a/dwt/custom/StyledTextRenderer.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/custom/StyledTextRenderer.d Mon May 05 00:42:55 2008 +0200 @@ -359,11 +359,11 @@ } Font font = style.font; if (font !is null) gc.setFont(font); - char[] string = ""; + String string = ""; int type = bullet.type & (ST.BULLET_DOT|ST.BULLET_NUMBER|ST.BULLET_LETTER_LOWER|ST.BULLET_LETTER_UPPER); switch (type) { case ST.BULLET_DOT: string = "\u2022"; break; - case ST.BULLET_NUMBER: string = to!(char[])(index); break; + case ST.BULLET_NUMBER: string = to!(String)(index); break; case ST.BULLET_LETTER_LOWER: string = [cast(char) (index % 26 + 97)]; break; case ST.BULLET_LETTER_UPPER: string = [cast(char) (index % 26 + 65)]; break; default: @@ -384,7 +384,7 @@ } int drawLine(int lineIndex, int paintX, int paintY, GC gc, Color widgetBackground, Color widgetForeground) { TextLayout layout = getTextLayout(lineIndex); - char[] line = content.getLine(lineIndex); + String line = content.getLine(lineIndex); int lineOffset = content.getOffsetAtLine(lineIndex); int lineLength = line.length; Point selection = styledText.getSelection(); @@ -731,7 +731,7 @@ } } if (layout is null) layout = new TextLayout(device); - char[] line = content.getLine(lineIndex); + String line = content.getLine(lineIndex); int lineOffset = content.getOffsetAtLine(lineIndex); int[] segments = null; int indent = 0;
--- a/dwt/custom/TableCursor.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/custom/TableCursor.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.custom.TableCursor; +import dwt.dwthelper.utils; + import dwt.DWT; import dwt.DWTException; @@ -437,12 +439,12 @@ gc.drawImage(image, x, imageY); x += imageSize.width; } - char[] text = row.getText(columnIndex); + String text = row.getText(columnIndex); if (text.length > 0) { Rectangle bounds = row.getBounds(columnIndex); Point extent = gc.stringExtent(text); // Temporary code - need a better way to determine table trim - char[] platform = DWT.getPlatform(); + String platform = DWT.getPlatform(); if ("win32"==platform) { //$NON-NLS-1$ if (table.getColumnCount() is 0 || columnIndex is 0) { x += 2;
--- a/dwt/custom/TableEditor.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/custom/TableEditor.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.custom.TableEditor; +import dwt.dwthelper.utils; + import dwt.DWT; @@ -40,7 +42,7 @@ * TableColumn column2 = new TableColumn(table, DWT.NONE); * for (int i = 0; i < 10; i++) { * TableItem item = new TableItem(table, DWT.NONE); -* item.setText(new char[][] {"item " + i, "edit this value"}); +* item.setText(new String[] {"item " + i, "edit this value"}); * } * column1.pack(); * column2.pack();
--- a/dwt/custom/TableTree.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/custom/TableTree.d Mon May 05 00:42:55 2008 +0200 @@ -84,9 +84,9 @@ bool inDispose = false; static final TableTreeItem[] EMPTY_ITEMS; - static final char[][] EMPTY_TEXTS; + static final String[] EMPTY_TEXTS; static final Image[] EMPTY_IMAGES; - static final char[] ITEMID = "TableTreeItemID"; //$NON-NLS-1$ + static final String ITEMID = "TableTreeItemID"; //$NON-NLS-1$ /** * Constructs a new instance of this class given its parent @@ -790,7 +790,7 @@ } table.setSelection(tableItems); } -public override void setToolTipText (char[] string) { +public override void setToolTipText (String string) { super.setToolTipText(string); table.setToolTipText(string); }
--- a/dwt/custom/TableTreeItem.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/custom/TableTreeItem.d Mon May 05 00:42:55 2008 +0200 @@ -42,7 +42,7 @@ TableTree parent; TableTreeItem parentItem; TableTreeItem [] items; - char[][] texts; + String[] texts; Image[] images; Color background; Color foreground; @@ -488,7 +488,7 @@ //checkWidget(); return parentItem; } -public override char[] getText () { +public override String getText () { checkWidget(); return getText(0); } @@ -505,7 +505,7 @@ * @param index the index of the item * @return the item text at the specified index, which can be null */ -public char[] getText(int index) { +public String getText(int index) { //checkWidget(); if (0 <= index && index < texts.length) return texts[index]; return null; @@ -827,20 +827,20 @@ * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> * </ul> */ -public void setText(int index, char[] text) { +public void setText(int index, String text) { checkWidget(); if (text is null) DWT.error (DWT.ERROR_NULL_ARGUMENT); int columnCount = Math.max(parent.getTable().getColumnCount(), 1); if (index < 0 || index >= columnCount) return; if (texts.length < columnCount) { - char[][] newTexts = new char[][columnCount]; + String[] newTexts = new String[columnCount]; System.arraycopy(texts, 0, newTexts, 0, texts.length); texts = newTexts; } texts[index] = text; if (tableItem !is null) tableItem.setText(index, text); } -public override void setText (char[] string) { +public override void setText (String string) { setText(0, string); }
--- a/dwt/custom/TextChangingEvent.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/custom/TextChangingEvent.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.custom.TextChangingEvent; +import dwt.dwthelper.utils; + import dwt.events.TypedEvent; import dwt.custom.StyledTextContent; @@ -30,7 +32,7 @@ * Text that is going to be inserted or empty string * if no text will be inserted */ - public char[] newText; + public String newText; /** * Length of text that is going to be replaced */
--- a/dwt/custom/ViewForm.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/custom/ViewForm.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.custom.ViewForm; +import dwt.dwthelper.utils; + import dwt.DWT;
--- a/dwt/dnd/Clipboard.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/dnd/Clipboard.d Mon May 05 00:42:55 2008 +0200 @@ -113,8 +113,8 @@ * </ul> */ protected void checkSubclass () { - char[] name = this.classinfo.name; - char[] validName = Clipboard.classinfo.name; + String name = this.classinfo.name; + String validName = Clipboard.classinfo.name; if ( validName !=/*eq*/ name ) { DND.error (DWT.ERROR_INVALID_SUBCLASS); } @@ -552,18 +552,18 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ -public char[][] getAvailableTypeNames() { +public String[] getAvailableTypeNames() { checkWidget(); auto types1 = getAvailableClipboardTypes(); auto types2 = getAvailablePrimaryTypes(); - char[][] result = new char[][types1.length + types2.length]; + String[] result = new String[types1.length + types2.length]; int count = 0; for (int i = 0; i < types1.length; i++) { auto pName = OS.gdk_atom_name(types1[i]); if (pName is null) { continue; } - char[] buffer = tango.stdc.stringz.fromStringz( pName ).dup; + String buffer = tango.stdc.stringz.fromStringz( pName ).dup; OS.g_free (pName); result[count++] = "GTKCLIPBOARD "~buffer; } @@ -572,12 +572,12 @@ if (pName is null) { continue; } - char[] buffer = tango.stdc.stringz.fromStringz( pName ).dup; + String buffer = tango.stdc.stringz.fromStringz( pName ).dup; OS.g_free (pName); result[count++] = "GTKPRIMARYCLIPBOARD "~buffer; } if (count < result.length){ - char[][] temp = new char[][count]; + String[] temp = new String[count]; System.arraycopy(result, 0, temp, 0, count); result = temp; } @@ -618,7 +618,7 @@ } GtkSelectionData* gtk_clipboard_wait_for_contents(void* clipboard, void* target) { - char[] key = "org.eclipse.swt.internal.gtk.dispatchEvent"; + String key = "org.eclipse.swt.internal.gtk.dispatchEvent"; Display display = this.display; ArrayWrapperInt arr = new ArrayWrapperInt( [ OS.GDK_PROPERTY_NOTIFY, OS.GDK_SELECTION_CLEAR, OS.GDK_SELECTION_REQUEST, OS.GDK_SELECTION_NOTIFY ] ); display.setData(key, arr );
--- a/dwt/dnd/ClipboardProxy.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/dnd/ClipboardProxy.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.dnd.ClipboardProxy; +import dwt.dwthelper.utils; + import dwt.DWT; @@ -41,7 +43,7 @@ Clipboard activeClipboard = null; Clipboard activePrimaryClipboard = null; - static char[] ID = "CLIPBOARD PROXY OBJECT"; //$NON-NLS-1$ + static String ID = "CLIPBOARD PROXY OBJECT"; //$NON-NLS-1$ static ClipboardProxy _getInstance(Display display) { ClipboardProxy proxy = cast(ClipboardProxy) display.getData(ID); @@ -149,7 +151,7 @@ for (int i = 0; i < dataTypes.length; i++) { Transfer transfer = dataTypes[i]; int[] typeIds = transfer.getTypeIds(); - char[][] typeNames = transfer.getTypeNames(); + String[] typeNames = transfer.getTypeNames(); for (int j = 0; j < typeIds.length; j++) { GtkTargetEntry* entry = new GtkTargetEntry(); entry.info = typeIds[j];
--- a/dwt/dnd/DND.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/dnd/DND.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.dnd.DND; +import dwt.dwthelper.utils; + import dwt.DWT; import dwt.DWTError; @@ -200,10 +202,10 @@ public static const int ERROR_INVALID_DATA = 2003; - static const char[] INIT_DRAG_MESSAGE = "Cannot initialize Drag"; //$NON-NLS-1$ - static const char[] INIT_DROP_MESSAGE = "Cannot initialize Drop"; //$NON-NLS-1$ - static const char[] CANNOT_SET_CLIPBOARD_MESSAGE = "Cannot set data in clipboard"; //$NON-NLS-1$ - static const char[] INVALID_DATA_MESSAGE = "Data does not have correct format for type"; //$NON-NLS-1$ + static const String INIT_DRAG_MESSAGE = "Cannot initialize Drag"; //$NON-NLS-1$ + static const String INIT_DROP_MESSAGE = "Cannot initialize Drop"; //$NON-NLS-1$ + static const String CANNOT_SET_CLIPBOARD_MESSAGE = "Cannot set data in clipboard"; //$NON-NLS-1$ + static const String INVALID_DATA_MESSAGE = "Data does not have correct format for type"; //$NON-NLS-1$ /** * Throws an appropriate exception based on the passed in error code. @@ -243,23 +245,23 @@ switch (code) { /* OS Failure/Limit (fatal, may occur only on some platforms) */ case DND.ERROR_CANNOT_INIT_DRAG:{ - char[] msg = DND.INIT_DRAG_MESSAGE; - if (hresult !is 0) msg ~= " result = "~to!(char[])(hresult); //$NON-NLS-1$ + String msg = DND.INIT_DRAG_MESSAGE; + if (hresult !is 0) msg ~= " result = "~to!(String)(hresult); //$NON-NLS-1$ throw new DWTError (code, msg); } case DND.ERROR_CANNOT_INIT_DROP:{ - char[] msg = DND.INIT_DROP_MESSAGE; - if (hresult !is 0) msg ~= " result = "~to!(char[])(hresult); //$NON-NLS-1$ + String msg = DND.INIT_DROP_MESSAGE; + if (hresult !is 0) msg ~= " result = "~to!(String)(hresult); //$NON-NLS-1$ throw new DWTError (code, msg); } case DND.ERROR_CANNOT_SET_CLIPBOARD:{ - char[] msg = DND.CANNOT_SET_CLIPBOARD_MESSAGE; - if (hresult !is 0) msg ~= " result = "~to!(char[])(hresult); //$NON-NLS-1$ + String msg = DND.CANNOT_SET_CLIPBOARD_MESSAGE; + if (hresult !is 0) msg ~= " result = "~to!(String)(hresult); //$NON-NLS-1$ throw new DWTError (code, msg); } case DND.ERROR_INVALID_DATA:{ - char[] msg = DND.INVALID_DATA_MESSAGE; - if (hresult !is 0) msg ~= " result = "~to!(char[])(hresult); //$NON-NLS-1$ + String msg = DND.INVALID_DATA_MESSAGE; + if (hresult !is 0) msg ~= " result = "~to!(String)(hresult); //$NON-NLS-1$ throw new DWTException (code, msg); } default:
--- a/dwt/dnd/DragSource.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/dnd/DragSource.d Mon May 05 00:42:55 2008 +0200 @@ -129,8 +129,8 @@ //workaround - remember action performed for DragEnd bool moveData = false; - static const char[] DEFAULT_DRAG_SOURCE_EFFECT = "DEFAULT_DRAG_SOURCE_EFFECT"; //$NON-NLS-1$ - static const char[] DRAGSOURCEID = "DragSource"; //$NON-NLS-1$ + static const String DEFAULT_DRAG_SOURCE_EFFECT = "DEFAULT_DRAG_SOURCE_EFFECT"; //$NON-NLS-1$ + static const String DRAGSOURCEID = "DragSource"; //$NON-NLS-1$ // static Callback DragGetData; // static Callback DragEnd; @@ -309,8 +309,8 @@ } protected override void checkSubclass () { - char[] name = this.classinfo.name; - char[] validName = DragSource.classinfo.name; + String name = this.classinfo.name; + String validName = DragSource.classinfo.name; if ( validName !=/*eq*/ name ) { DND.error (DWT.ERROR_INVALID_SUBCLASS); } @@ -551,10 +551,10 @@ Transfer transfer = transferAgents[i]; if (transfer !is null) { int[] typeIds = transfer.getTypeIds(); - char[][] typeNames = transfer.getTypeNames(); + String[] typeNames = transfer.getTypeNames(); for (int j = 0; j < typeIds.length; j++) { GtkTargetEntry* entry = new GtkTargetEntry(); - char[] type = typeNames[j]; + String type = typeNames[j]; entry.target = cast(char*)OS.g_malloc(type.length+1); entry.target[ 0 .. type.length ] = type[]; entry.target[ type.length ] = '\0';
--- a/dwt/dnd/DropTarget.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/dnd/DropTarget.d Mon May 05 00:42:55 2008 +0200 @@ -116,8 +116,8 @@ int drag_data_received_handler; int drag_drop_handler; - static const char[] DEFAULT_DROP_TARGET_EFFECT = "DEFAULT_DROP_TARGET_EFFECT"; //$NON-NLS-1$ - static const char[] DROPTARGETID = "DropTarget"; //$NON-NLS-1$ + static const String DEFAULT_DROP_TARGET_EFFECT = "DEFAULT_DROP_TARGET_EFFECT"; //$NON-NLS-1$ + static const String DROPTARGETID = "DropTarget"; //$NON-NLS-1$ static const int DRAGOVER_HYSTERESIS = 50; // static Callback Drag_Motion; @@ -369,8 +369,8 @@ } protected override void checkSubclass () { - char[] name = this.classinfo.name; - char[] validName = DropTarget.classinfo.name; + String name = this.classinfo.name; + String validName = DropTarget.classinfo.name; if ( validName !=/*eq*/ name ) { DND.error (DWT.ERROR_INVALID_SUBCLASS); } @@ -702,7 +702,7 @@ Transfer transfer = transferAgents[i]; if (transfer !is null) { int[] typeIds = transfer.getTypeIds(); - char[][] typeNames = transfer.getTypeNames(); + String[] typeNames = transfer.getTypeNames(); for (int j = 0; j < typeIds.length; j++) { GtkTargetEntry* entry = new GtkTargetEntry(); entry.target = cast(char*)OS.g_malloc(typeNames[j].length +1);
--- a/dwt/dnd/DropTargetListener.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/dnd/DropTargetListener.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.dnd.DropTargetListener; +import dwt.dwthelper.utils; + import dwt.internal.DWTEventListener; import dwt.dnd.DropTargetEvent;
--- a/dwt/dnd/FileTransfer.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/dnd/FileTransfer.d Mon May 05 00:42:55 2008 +0200 @@ -40,9 +40,9 @@ public class FileTransfer : ByteArrayTransfer { private static FileTransfer _instance; - private static const char[] URI_LIST = "text/uri-list"; //$NON-NLS-1$ + private static const String URI_LIST = "text/uri-list"; //$NON-NLS-1$ private static const int URI_LIST_ID; - private static const char[] separator = "\r\n"; + private static const String separator = "\r\n"; static this(){ URI_LIST_ID = registerType(URI_LIST); @@ -77,10 +77,10 @@ if (!checkFile(object) || !isSupportedType(transferData)) { DND.error(DND.ERROR_INVALID_DATA); } - char[][] files = (cast(ArrayWrapperString2)object).array; - char[] buffer; + String[] files = (cast(ArrayWrapperString2)object).array; + String buffer; for (int i = 0; i < files.length; i++) { - char[] string = files[i]; + String string = files[i]; if (string.ptr is null) continue; if (string.length is 0) continue; GError* error; @@ -89,10 +89,10 @@ auto uriPtr = OS.g_filename_to_uri(localePtr, null, &error); OS.g_free(localePtr); if (error !is null || uriPtr is null) continue; - char[] temp = tango.stdc.stringz.fromStringz( uriPtr ).dup; + String temp = tango.stdc.stringz.fromStringz( uriPtr ).dup; OS.g_free(uriPtr); int newLength = (i > 0) ? buffer.length+separator.length+temp.length : temp.length; - char[] newBuffer = new char[newLength]; + String newBuffer = new char[newLength]; int offset = 0; if (i > 0) { System.arraycopy(buffer, 0, newBuffer, 0, buffer.length); @@ -125,14 +125,14 @@ */ public override Object nativeToJava(TransferData transferData) { if ( !isSupportedType(transferData) || transferData.pValue is null || transferData.length <= 0 ) return null; - char[] temp = transferData.pValue[ 0 .. transferData.length ]; + String temp = transferData.pValue[ 0 .. transferData.length ]; char*[] files; int offset = 0; for (int i = 0; i < temp.length - 1; i++) { if (temp[i] is '\r' && temp[i+1] is '\n') { int size = i - offset; char* file = cast(char*)OS.g_malloc(size + 1); - char[] fileBuffer = new char[size + 1]; + String fileBuffer = new char[size + 1]; System.arraycopy(temp, offset, fileBuffer, 0, size); file[ 0 .. size + 1 ] = fileBuffer; char*[] newFiles = new char*[files.length + 1]; @@ -145,7 +145,7 @@ if (offset < temp.length - 2) { int size = temp.length - offset; char* file = cast(char*)OS.g_malloc(size + 1); - char[] fileBuffer = new char[size + 1]; + String fileBuffer = new char[size + 1]; System.arraycopy(temp, offset, fileBuffer, 0, size); file[ 0 .. size+1 ] = fileBuffer; char*[] newFiles = new char*[files.length + 1]; @@ -153,7 +153,7 @@ newFiles[files.length] = file; files = newFiles; } - char[][] fileNames; + String[] fileNames; for (int i = 0; i < files.length; i++) { GError* error; auto localePtr = OS.g_filename_from_uri(files[i], null, &error); @@ -162,10 +162,10 @@ auto utf8Ptr = OS.g_locale_to_utf8(localePtr, -1, null, null, &error); OS.g_free(localePtr); if (error !is null || utf8Ptr is null) continue; - char[] buffer = tango.stdc.stringz.fromStringz( utf8Ptr ).dup; + String buffer = tango.stdc.stringz.fromStringz( utf8Ptr ).dup; OS.g_free(utf8Ptr); - char[] name = buffer; - char[][] newFileNames = new char[][]( fileNames.length + 1 ); + String name = buffer; + String[] newFileNames = new String[]( fileNames.length + 1 ); System.arraycopy(fileNames, 0, newFileNames, 0, fileNames.length); newFileNames[fileNames.length] = name; fileNames = newFileNames; @@ -178,7 +178,7 @@ return [URI_LIST_ID]; } -protected override char[][] getTypeNames(){ +protected override String[] getTypeNames(){ return [URI_LIST]; } @@ -188,7 +188,7 @@ if( arr is null ) return false; if( arr.array.length is 0 ) return false; - char[][] strings = arr.array; + String[] strings = arr.array; for (int i = 0; i < strings.length; i++) { if (strings[i] is null || strings[i].length is 0) return false; }
--- a/dwt/dnd/HTMLTransfer.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/dnd/HTMLTransfer.d Mon May 05 00:42:55 2008 +0200 @@ -36,9 +36,9 @@ public class HTMLTransfer : ByteArrayTransfer { private static HTMLTransfer _instance; - private static const char[] TEXT_HTML = "text/html"; //$NON-NLS-1$ + private static const String TEXT_HTML = "text/html"; //$NON-NLS-1$ private static const int TEXT_HTML_ID; - private static const char[] TEXT_HTML2 = "TEXT/HTML"; //$NON-NLS-1$ + private static const String TEXT_HTML2 = "TEXT/HTML"; //$NON-NLS-1$ private static const int TEXT_HTML2_ID; static this(){ @@ -72,7 +72,7 @@ if (!checkHTML(object) || !isSupportedType(transferData)) { DND.error(DND.ERROR_INVALID_DATA); } - char[] string = (cast(ArrayWrapperString)object).array; + String string = (cast(ArrayWrapperString)object).array; char* pValue = cast(char*)OS.g_malloc(string.length); if (pValue is null) return; pValue[0 .. string.length ] = string; @@ -97,14 +97,14 @@ /* Ensure byteCount is a multiple of 2 bytes */ int size = (transferData.format * transferData.length / 8) / 2 * 2; if (size <= 0) return null; - char[] chars = transferData.pValue[ 0 .. size ].dup; + String chars = transferData.pValue[ 0 .. size ].dup; return new ArrayWrapperString( chars[ 0 .. tango.text.Util.locate( chars, '\0' ) ] ); } protected override int[] getTypeIds() { return [TEXT_HTML_ID, TEXT_HTML2_ID]; } -protected override char[][] getTypeNames() { +protected override String[] getTypeNames() { return [TEXT_HTML, TEXT_HTML2]; }
--- a/dwt/dnd/RTFTransfer.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/dnd/RTFTransfer.d Mon May 05 00:42:55 2008 +0200 @@ -37,11 +37,11 @@ public class RTFTransfer : ByteArrayTransfer { private static RTFTransfer _instance; - private static const char[] TEXT_RTF = "text/rtf"; //$NON-NLS-1$ + private static const String TEXT_RTF = "text/rtf"; //$NON-NLS-1$ private static const int TEXT_RTF_ID; - private static const char[] TEXT_RTF2 = "TEXT/RTF"; //$NON-NLS-1$ + private static const String TEXT_RTF2 = "TEXT/RTF"; //$NON-NLS-1$ private static const int TEXT_RTF2_ID; - private static const char[] APPLICATION_RTF = "application/rtf"; //$NON-NLS-1$ + private static const String APPLICATION_RTF = "application/rtf"; //$NON-NLS-1$ private static const int APPLICATION_RTF_ID; static this(){ @@ -76,7 +76,7 @@ if (!checkRTF(object) || !isSupportedType(transferData)) { DND.error(DND.ERROR_INVALID_DATA); } - char[] string = (cast(ArrayWrapperString)object).array; + String string = (cast(ArrayWrapperString)object).array; char* pValue = cast(char*)OS.g_malloc(string.length + 1); if (pValue is null) return; pValue[ 0 .. string.length ] = string; @@ -110,7 +110,7 @@ return [TEXT_RTF_ID, TEXT_RTF2_ID, APPLICATION_RTF_ID]; } -protected override char[][] getTypeNames() { +protected override String[] getTypeNames() { return [TEXT_RTF, TEXT_RTF2, APPLICATION_RTF]; }
--- a/dwt/dnd/TextTransfer.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/dnd/TextTransfer.d Mon May 05 00:42:55 2008 +0200 @@ -39,9 +39,9 @@ public class TextTransfer : ByteArrayTransfer { private static TextTransfer _instance; - private static const char[] COMPOUND_TEXT = "COMPOUND_TEXT"; //$NON-NLS-1$ - private static const char[] UTF8_STRING = "UTF8_STRING"; //$NON-NLS-1$ - private static const char[] STRING = "STRING"; //$NON-NLS-1$ + private static const String COMPOUND_TEXT = "COMPOUND_TEXT"; //$NON-NLS-1$ + private static const String UTF8_STRING = "UTF8_STRING"; //$NON-NLS-1$ + private static const String STRING = "STRING"; //$NON-NLS-1$ private static const int COMPOUND_TEXT_ID; private static const int UTF8_STRING_ID; private static const int STRING_ID; @@ -79,7 +79,7 @@ if (!checkText(object) || !isSupportedType(transferData)) { DND.error(DND.ERROR_INVALID_DATA); } - char[] string = (cast(ArrayWrapperString)object).array; + String string = (cast(ArrayWrapperString)object).array; char* utf8 = tango.stdc.stringz.toStringz(string); if (transferData.type is cast(void*) COMPOUND_TEXT_ID) { void* encoding; @@ -130,7 +130,7 @@ char** list; int count = OS.gdk_text_property_to_utf8_list(transferData.type, transferData.format, transferData.pValue, transferData.length, &list); if (count is 0) return null; - char[] utf8 = tango.stdc.stringz.fromStringz( list[0] ).dup; + String utf8 = tango.stdc.stringz.fromStringz( list[0] ).dup; OS.g_strfreev(list); return new ArrayWrapperString( utf8 ); } @@ -139,7 +139,7 @@ return [UTF8_STRING_ID, COMPOUND_TEXT_ID, STRING_ID]; } -override protected char[][] getTypeNames() { +override protected String[] getTypeNames() { return [UTF8_STRING, COMPOUND_TEXT, STRING]; }
--- a/dwt/dnd/Transfer.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/dnd/Transfer.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.dnd.Transfer; +import dwt.dwthelper.utils; + import dwt.internal.Converter; import dwt.internal.gtk.OS; @@ -64,7 +66,7 @@ * @return the platform specific names of the data types that can be converted * using this transfer agent. */ -abstract public char[][] getTypeNames(); +abstract public String[] getTypeNames(); /** * Returns the platform specific ids of the data types that can be converted using @@ -135,7 +137,7 @@ * * @return the unique identifier associated with this data type */ -public static int registerType(char[] formatName){ +public static int registerType(String formatName){ if (formatName is null) return OS.GDK_NONE; char* buffer = tango.stdc.stringz.toStringz( formatName ); return cast(int)/*64*/OS.gdk_atom_intern(buffer, false);
--- a/dwt/dwthelper/ByteArrayOutputStream.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/dwthelper/ByteArrayOutputStream.d Mon May 05 00:42:55 2008 +0200 @@ -44,17 +44,17 @@ return 0; } - public override char[] toString(){ + public override String toString(){ implMissing( __FILE__, __LINE__ ); return null; } - public char[] toString( char[] enc ){ + public String toString( String enc ){ implMissing( __FILE__, __LINE__ ); return null; } - public char[] toString( int hibyte ){ + public String toString( int hibyte ){ implMissing( __FILE__, __LINE__ ); return null; }
--- a/dwt/dwthelper/File.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/dwthelper/File.d Mon May 05 00:42:55 2008 +0200 @@ -12,9 +12,9 @@ public class File { public static char separatorChar; - public static char[] separator; + public static String separator; public static char pathSeparatorChar; - public static char[] pathSeparator; + public static String pathSeparator; private tango.io.FilePath.FilePath mFilePath; @@ -25,15 +25,15 @@ pathSeparatorChar = tango.io.FileConst.FileConst.SystemPathChar; } - public this ( char[] pathname ){ + public this ( String pathname ){ mFilePath = new tango.io.FilePath.FilePath( pathname ); } - public this ( char[] parent, char[] child ){ + public this ( String parent, String child ){ mFilePath = new tango.io.FilePath.FilePath( tango.io.FilePath.FilePath.join( parent, child ) ); } - public this ( dwt.dwthelper.File.File parent, char[] child ){ + public this ( dwt.dwthelper.File.File parent, String child ){ mFilePath = new tango.io.FilePath.FilePath( tango.io.FilePath.FilePath.join( parent.mFilePath.toString, child ) ); } @@ -42,12 +42,12 @@ return 0; } - public char[] getName(){ + public String getName(){ implMissing( __FILE__, __LINE__ ); return null; } - public char[] getParent(){ + public String getParent(){ implMissing( __FILE__, __LINE__ ); return null; } @@ -57,7 +57,7 @@ return null; } - public char[] getPath(){ + public String getPath(){ implMissing( __FILE__, __LINE__ ); return null; } @@ -67,7 +67,7 @@ return false; } - public char[] getAbsolutePath(){ + public String getAbsolutePath(){ return tango.io.FileSystem.FileSystem.toAbsolute( mFilePath ).toString; } @@ -75,7 +75,7 @@ return new File( getAbsolutePath() ); } - public char[] getCanonicalPath(){ + public String getCanonicalPath(){ implMissing( __FILE__, __LINE__ ); return null; } @@ -136,7 +136,7 @@ implMissing( __FILE__, __LINE__ ); } - public char[][] list(){ + public String[] list(){ implMissing( __FILE__, __LINE__ ); return null; } @@ -176,12 +176,12 @@ return null; } - public static dwt.dwthelper.File.File createTempFile( char[] prefix, char[] suffix, dwt.dwthelper.File.File directory ){ + public static dwt.dwthelper.File.File createTempFile( String prefix, String suffix, dwt.dwthelper.File.File directory ){ implMissing( __FILE__, __LINE__ ); return null; } - public static dwt.dwthelper.File.File createTempFile( char[] prefix, char[] suffix ){ + public static dwt.dwthelper.File.File createTempFile( String prefix, String suffix ){ implMissing( __FILE__, __LINE__ ); return null; } @@ -191,7 +191,7 @@ return 0; } - public char[] toString(){ + public String toString(){ implMissing( __FILE__, __LINE__ ); return null; }
--- a/dwt/dwthelper/FileInputStream.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/dwthelper/FileInputStream.d Mon May 05 00:42:55 2008 +0200 @@ -23,7 +23,7 @@ private const int BUFFER_SIZE = 0x10000; private bool eof; - public this ( char[] name ){ + public this ( String name ){ conduit = new FileConduit( name ); buffer = new ubyte[]( BUFFER_SIZE ); }
--- a/dwt/dwthelper/FileOutputStream.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/dwthelper/FileOutputStream.d Mon May 05 00:42:55 2008 +0200 @@ -13,11 +13,11 @@ alias dwt.dwthelper.OutputStream.OutputStream.write write; alias dwt.dwthelper.OutputStream.OutputStream.close close; - public this ( char[] name ){ + public this ( String name ){ implMissing( __FILE__, __LINE__ ); } - public this ( char[] name, bool append ){ + public this ( String name, bool append ){ implMissing( __FILE__, __LINE__ ); }
--- a/dwt/dwthelper/Loader.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/dwthelper/Loader.d Mon May 05 00:42:55 2008 +0200 @@ -20,6 +20,8 @@ module dwt.dwthelper.Loader; +import dwt.dwthelper.utils; + private import tango.io.Stdout, tango.sys.SharedLib; @@ -57,7 +59,7 @@ version (Windows) { - const char[][LIBRARY.max+1] importLibs = [ + const String[LIBRARY.max+1] importLibs = [ LIBRARY.ATK: "libatk-1.0-0.dll", LIBRARY.CAIRO: "libcairo-2.dll", LIBRARY.GDK: "libgdk-win32-2.0-0.dll", @@ -86,7 +88,7 @@ version(linux) { - const char[][LIBRARY.max+1] importLibs = [ + const String[LIBRARY.max+1] importLibs = [ LIBRARY.ATK: "libatk-1.0.so", LIBRARY.CAIRO: "libcairo.so.2", LIBRARY.GDK: "libgdk-x11-2.0.so", @@ -119,7 +121,7 @@ version(Windows) { - char[] getLibraryPath() + String getLibraryPath() { return "\\Program Files\\GTK2-Runtime\\lib\\"; } @@ -133,7 +135,7 @@ version(linux) { - char[] getLibraryPath() { return ""; } + String getLibraryPath() { return ""; } } /***************************************************************************** @@ -145,7 +147,7 @@ public struct Symbol { - char[] name; + String name; void** pointer; } @@ -157,7 +159,7 @@ public class Linker { - static char[][][char[]] loadFailures; + static String[][String] loadFailures; /************************************************************************* @@ -169,7 +171,7 @@ **************************************************************************/ - public static char[][] getLoadFailures(char[] libName) + public static String[] getLoadFailures(String libName) { if ( libName in loadFailures ) { @@ -190,7 +192,7 @@ **************************************************************************/ - public static char[][] getLoadLibraries() + public static String[] getLoadLibraries() { return loadFailures.keys; } @@ -213,9 +215,9 @@ public static void dumpFailedLoads() { - foreach ( char[] lib ; Linker.getLoadLibraries() ) + foreach ( String lib ; Linker.getLoadLibraries() ) { - foreach ( char[] symbol ; Linker.getLoadFailures(lib) ) + foreach ( String symbol ; Linker.getLoadFailures(lib) ) { version(Tango) Stdout.formatln("failed ({}) {}", lib, symbol).newline; @@ -230,10 +232,10 @@ private SharedLib primaryLib; private SharedLib alternateLib; - private char[] libraryName; - private char[] alternateLibraryName; + private String libraryName; + private String alternateLibraryName; - alias void function( char[] libraryName, char[] symbolName, char[] message=null) FailureCallback; + alias void function( String libraryName, String symbolName, String message=null) FailureCallback; private FailureCallback onLoadFailure; @@ -241,7 +243,7 @@ **************************************************************************/ - this( char[] libraryName, char[] alternateLibraryName=null ) + this( String libraryName, String alternateLibraryName=null ) { this(libraryName, alternateLibraryName, &(Linker.defaultFail)); } @@ -250,7 +252,7 @@ **************************************************************************/ - this (char[] libraryName, char[] alternateLibraryName, FailureCallback fn ) + this (String libraryName, String alternateLibraryName, FailureCallback fn ) { this.libraryName = libraryName; this.alternateLibraryName = alternateLibraryName; @@ -283,11 +285,11 @@ **************************************************************************/ - static void defaultFail( char[] libraryName, char[] symbolName, char[] message=null ) + static void defaultFail( String libraryName, String symbolName, String message=null ) { if ( !(libraryName in loadFailures) ) { - char[][] cc; + String[] cc; loadFailures[libraryName] = cc; }
--- a/dwt/dwthelper/OutputStream.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/dwthelper/OutputStream.d Mon May 05 00:42:55 2008 +0200 @@ -27,7 +27,7 @@ ostr.write(b); } - public void write(char[] c) { + public void write(String c) { ostr.write(c); }
--- a/dwt/dwthelper/ResourceBundle.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/dwthelper/ResourceBundle.d Mon May 05 00:42:55 2008 +0200 @@ -12,10 +12,10 @@ class ResourceBundle { - char[][ char[] ] map; + String[ String ] map; - public this( char[] data ){ - char[] line; + public this( String data ){ + String line; int dataIndex; //tango.io.Stdout.Stdout.formatln( "properties put ..." ); @@ -31,8 +31,8 @@ //tango.io.Stdout.Stdout.formatln( "properties put {}", __LINE__ ); bool linecontinue = false; bool iskeypart = true; - char[] key; - char[] value; + String key; + String value; nextline: while( dataIndex < data.length ){ //tango.io.Stdout.Stdout.formatln( "properties put {} startline", __LINE__ ); @@ -107,35 +107,35 @@ } } - public bool hasString( char[] key ){ + public bool hasString( String key ){ return ( key in map ) !is null; } - public char[] getString( char[] key ){ + public String getString( String key ){ if( auto v = key in map ){ return (*v).dup; } throw new MissingResourceException( "key not found", this.classinfo.name, key ); } - public char[][] getKeys(){ + public String[] getKeys(){ return map.keys; } public static ResourceBundle getBundle( ImportData data ){ - return new ResourceBundle( cast(char[]) data.data ); + return new ResourceBundle( cast(String) data.data ); } - public static ResourceBundle getBundle( char[] name ){ + public static ResourceBundle getBundle( String name ){ try{ scope f = new File(name); - return new ResourceBundle( cast(char[]) f.read() ); + return new ResourceBundle( cast(String) f.read() ); } catch( IOException e){ e.msg ~= " file:" ~ name; throw e; } } - public static ResourceBundle getBundleFromData( char[] data ){ + public static ResourceBundle getBundleFromData( String data ){ return new ResourceBundle( data ); } }
--- a/dwt/dwthelper/System.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/dwthelper/System.d Mon May 05 00:42:55 2008 +0200 @@ -3,6 +3,8 @@ */ module dwt.dwthelper.System; +import dwt.dwthelper.utils; + import tango.core.Exception; import tango.time.Clock; import tango.stdc.stdlib : exit; @@ -115,7 +117,7 @@ alias SimpleType!(ushort[]).arraycopy arraycopy; alias SimpleType!(ubyte[]).arraycopy arraycopy; alias SimpleType!(ulong[]).arraycopy arraycopy; - alias SimpleType!(char[]).arraycopy arraycopy; + alias SimpleType!(String).arraycopy arraycopy; alias SimpleType!(wchar[]).arraycopy arraycopy; alias SimpleType!(Object[]).arraycopy arraycopy; alias SimpleType!(void*[]).arraycopy arraycopy; @@ -135,7 +137,7 @@ return (*cast(Object *)&x).toHash(); } - public static char[] getProperty( char[] key ){ + public static String getProperty( String key ){ switch( key ){ case "os.name": return "linux"; default: return null;
--- a/dwt/dwthelper/XmlTranscode.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/dwthelper/XmlTranscode.d Mon May 05 00:42:55 2008 +0200 @@ -9,7 +9,7 @@ + Throws TextException on failure + The given string is modified. +/ -char[] xmlUnescape( char[] str ){ +String xmlUnescape( String str ){ void error(){ throw new TextException( "xmlUnescape" ); @@ -17,8 +17,8 @@ // < ... // Ӓ // ኯ - char[] src = str; - char[] trg = str; + String src = str; + String trg = str; while( src.length ){ if( src[0] !is '&' ){ trg[0] = src[0]; @@ -34,7 +34,7 @@ int semi = tango.text.Util.locate( src[0 .. len ], ';' ); if( semi is len ) error(); // no semi found - char[] entityName = src[ 0 .. semi ]; // name without semi + String entityName = src[ 0 .. semi ]; // name without semi dchar entityValue = 0; switch( entityName ){ case "lt": entityValue = '<'; break; @@ -79,7 +79,7 @@ dchar[1] arr; arr[0] = entityValue; uint ate = 0; - char[] res = tango.text.convert.Utf.toString( arr, trg, &ate ); + String res = tango.text.convert.Utf.toString( arr, trg, &ate ); trg = trg[ res.length .. $ ]; src = src[ semi +1 .. $ ]; // go past semi } @@ -94,7 +94,7 @@ + If not, the original string is returned. + If processing is needed, a new string is allocated. +/ -char[] xmlEscape( char[] xml ){ +String xmlEscape( String xml ){ bool needsReplacement( dchar c ){ switch( c ){ case '<': @@ -121,7 +121,7 @@ Lprocess: // yes, do a new string, start with +20 chars - char[] res = new char[ xml.length + 20 ]; + String res = new char[ xml.length + 20 ]; res.length = 0; foreach( dchar c; xml ){
--- a/dwt/dwthelper/utils.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/dwthelper/utils.d Mon May 05 00:42:55 2008 +0200 @@ -35,7 +35,7 @@ alias char[] String; alias tango.text.Text.Text!(char) StringBuffer; -void implMissing( char[] file, uint line ){ +void implMissing( String file, uint line ){ Stderr.formatln( "implementation missing in file {} line {}", file, line ); Stderr.formatln( "exiting ..." ); exit(1); @@ -94,7 +94,7 @@ public bool booleanValue(){ return value; } - public static Boolean valueOf( char[] s ){ + public static Boolean valueOf( String s ){ if( s == "yes" || s == "true" ){ return TRUE; } @@ -109,7 +109,7 @@ class Byte : ValueWrapperT!(byte) { - public static byte parseByte( char[] s ){ + public static byte parseByte( String s ){ try{ int res = tango.text.convert.Integer.parse( s ); if( res < byte.min || res > byte.max ){ @@ -138,11 +138,11 @@ super( value ); } - public this ( char[] s ){ + public this ( String s ){ super(parseInt(s)); } - public static char[] toString( int i, int radix ){ + public static String toString( int i, int radix ){ switch( radix ){ case 2: return toBinaryString(i); @@ -158,23 +158,23 @@ } } - public static char[] toHexString( int i ){ + public static String toHexString( int i ){ return tango.text.convert.Integer.toString(i, tango.text.convert.Integer.Style.Hex ); } - public static char[] toOctalString( int i ){ + public static String toOctalString( int i ){ return tango.text.convert.Integer.toString(i, tango.text.convert.Integer.Style.Octal ); } - public static char[] toBinaryString( int i ){ + public static String toBinaryString( int i ){ return tango.text.convert.Integer.toString(i, tango.text.convert.Integer.Style.Binary ); } - public static char[] toString( int i ){ + public static String toString( int i ){ return tango.text.convert.Integer.toString(i); } - public static int parseInt( char[] s, int radix ){ + public static int parseInt( String s, int radix ){ try{ return tango.text.convert.Integer.parse( s, cast(uint)radix ); } @@ -183,7 +183,7 @@ } } - public static int parseInt( char[] s ){ + public static int parseInt( String s ){ try{ return tango.text.convert.Integer.parse( s ); } @@ -192,12 +192,12 @@ } } - public static Integer valueOf( char[] s, int radix ){ + public static Integer valueOf( String s, int radix ){ implMissing( __FILE__, __LINE__ ); return null; } - public static Integer valueOf( char[] s ){ + public static Integer valueOf( String s ){ return valueOf( parseInt(s)); } @@ -233,7 +233,7 @@ return intValue(); } - public override char[] toString(){ + public override String toString(){ return tango.text.convert.Integer.toString( value ); } } @@ -243,14 +243,14 @@ this( double value ){ super(value); } - this( char[] str ){ + this( String str ){ implMissing( __FILE__, __LINE__ ); super(0.0); } public double doubleValue(){ return value; } - public static char[] toString( double value ){ + public static String toString( double value ){ implMissing( __FILE__, __LINE__ ); return null; } @@ -268,18 +268,18 @@ this( float value ){ super(value); } - this( char[] str ){ + this( String str ){ implMissing( __FILE__, __LINE__ ); super(0.0); } public float floatValue(){ return value; } - public static char[] toString( float value ){ + public static String toString( float value ){ implMissing( __FILE__, __LINE__ ); return null; } - public static float parseFloat( char[] s ){ + public static float parseFloat( String s ){ try{ return tango.text.convert.Float.toFloat( s ); } @@ -293,18 +293,18 @@ this( long value ){ super(value); } - this( char[] str ){ + this( String str ){ implMissing( __FILE__, __LINE__ ); super(0); } public long longValue(){ return value; } - public static long parseLong(char[] s){ + public static long parseLong(String s){ implMissing( __FILE__, __LINE__ ); return 0; } - public static char[] toString( double value ){ + public static String toString( double value ){ implMissing( __FILE__, __LINE__ ); return null; } @@ -318,7 +318,7 @@ alias ArrayWrapperT!(int) ArrayWrapperInt; alias ArrayWrapperT!(Object) ArrayWrapperObject; alias ArrayWrapperT!(char) ArrayWrapperString; -alias ArrayWrapperT!(char[]) ArrayWrapperString2; +alias ArrayWrapperT!(String) ArrayWrapperString2; Object[] StringArrayToObjectArray( String[] strs ){ Object[] res = new Object[strs.length]; @@ -327,7 +327,7 @@ } return res; } -int codepointIndexToIndex( char[] str, int cpIndex ){ +int codepointIndexToIndex( String str, int cpIndex ){ int cps = cpIndex; int res = 0; while( cps > 0 ){ @@ -347,7 +347,7 @@ } return res; } -int indexToCodepointIndex( char[] str, int index ){ +int indexToCodepointIndex( String str, int index ){ int i = 0; int res = 0; while( i < index ){ @@ -368,7 +368,7 @@ return res; } -char[] firstCodePointStr( char[] str, out int consumed ){ +String firstCodePointStr( String str, out int consumed ){ dchar[1] buf; uint ate; dchar[] res = str.toString32( buf, &ate ); @@ -376,11 +376,11 @@ return str[ 0 .. ate ]; } -dchar firstCodePoint( char[] str ){ +dchar firstCodePoint( String str ){ int dummy; return firstCodePoint( str, dummy ); } -dchar firstCodePoint( char[] str, out int consumed ){ +dchar firstCodePoint( String str, out int consumed ){ dchar[1] buf; uint ate; dchar[] res = str.toString32( buf, &ate ); @@ -393,13 +393,13 @@ return res[0]; } -char[] dcharToString( dchar key ){ +String dcharToString( dchar key ){ dchar[1] buf; buf[0] = key; return tango.text.convert.Utf.toString( buf ); } -int codepointCount( char[] str ){ +int codepointCount( String str ){ scope dchar[] buf = new dchar[]( str.length ); uint ate; dchar[] res = tango.text.convert.Utf.toString32( str, buf, &ate ); @@ -410,7 +410,7 @@ alias tango.text.convert.Utf.toString16 toString16; alias tango.text.convert.Utf.toString toString; -int getRelativeCodePointOffset( char[] str, int startIndex, int searchRelCp ){ +int getRelativeCodePointOffset( String str, int startIndex, int searchRelCp ){ int ignore; int i = startIndex; if( searchRelCp > 0 ){ @@ -462,13 +462,13 @@ } return i - startIndex; } -dchar getRelativeCodePoint( char[] str, int startIndex, int searchRelCp, out int relIndex ){ +dchar getRelativeCodePoint( String str, int startIndex, int searchRelCp, out int relIndex ){ relIndex = getRelativeCodePointOffset( str, startIndex, searchRelCp ); int ignore; return firstCodePoint( str[ startIndex+relIndex .. $ ], ignore ); } -int utf8AdjustOffset( char[] str, int offset ){ +int utf8AdjustOffset( String str, int offset ){ if( str.length <= offset || offset <= 0 ){ return offset; } @@ -481,11 +481,11 @@ bool CharacterIsDefined( dchar ch ){ return (ch in tango.text.UnicodeData.unicodeData) !is null; } -dchar CharacterFirstToLower( char[] str ){ +dchar CharacterFirstToLower( String str ){ int consumed; return CharacterFirstToLower( str, consumed ); } -dchar CharacterFirstToLower( char[] str, out int consumed ){ +dchar CharacterFirstToLower( String str, out int consumed ){ dchar[1] buf; buf[0] = firstCodePoint( str, consumed ); dchar[] r = tango.text.Unicode.toLower( buf ); @@ -509,58 +509,58 @@ bool CharacterIsLetter( dchar c ){ return tango.text.Unicode.isLetter( c ); } -public char[] toUpperCase( char[] str ){ +public String toUpperCase( String str ){ return tango.text.Unicode.toUpper( str ); } -public int indexOf( char[] str, char searched ){ +public int indexOf( String str, char searched ){ int res = tango.text.Util.locate( str, searched ); if( res is str.length ) res = -1; return res; } -public int indexOf( char[] str, char searched, int startpos ){ +public int indexOf( String str, char searched, int startpos ){ int res = tango.text.Util.locate( str, searched, startpos ); if( res is str.length ) res = -1; return res; } -public int indexOf(char[] str, char[] ch){ +public int indexOf(String str, String ch){ return indexOf( str, ch, 0 ); } -public int indexOf(char[] str, char[] ch, int start){ +public int indexOf(String str, String ch, int start){ int res = tango.text.Util.locatePattern( str, ch, start ); if( res is str.length ) res = -1; return res; } -public int lastIndexOf(char[] str, char ch){ +public int lastIndexOf(String str, char ch){ return lastIndexOf( str, ch, str.length ); } -public int lastIndexOf(char[] str, char ch, int formIndex){ +public int lastIndexOf(String str, char ch, int formIndex){ int res = tango.text.Util.locatePrior( str, ch, formIndex ); if( res is str.length ) res = -1; return res; } -public int lastIndexOf(char[] str, char[] ch ){ +public int lastIndexOf(String str, String ch ){ return lastIndexOf( str, ch, str.length ); } -public int lastIndexOf(char[] str, char[] ch, int start ){ +public int lastIndexOf(String str, String ch, int start ){ int res = tango.text.Util.locatePatternPrior( str, ch, start ); if( res is str.length ) res = -1; return res; } -public char[] replace( char[] str, char from, char to ){ +public String replace( String str, char from, char to ){ return tango.text.Util.replace( str.dup, from, to ); } -public char[] substring( char[] str, int start ){ +public String substring( String str, int start ){ return str[ start .. $ ].dup; } -public char[] substring( char[] str, int start, int end ){ +public String substring( String str, int start, int end ){ return str[ start .. end ].dup; } @@ -572,66 +572,66 @@ return str[ start .. end ].dup; } -public char charAt( char[] str, int pos ){ +public char charAt( String str, int pos ){ return str[ pos ]; } -public void getChars( char[] src, int srcBegin, int srcEnd, char[] dst, int dstBegin){ +public void getChars( String src, int srcBegin, int srcEnd, String dst, int dstBegin){ dst[ dstBegin .. dstBegin + srcEnd - srcBegin ] = src[ srcBegin .. srcEnd ]; } -public wchar[] toCharArray( char[] str ){ +public wchar[] toCharArray( String str ){ return toString16( str ); } -public bool endsWith( char[] src, char[] pattern ){ +public bool endsWith( String src, String pattern ){ if( src.length < pattern.length ){ return false; } return src[ $-pattern.length .. $ ] == pattern; } -public bool equals( char[] src, char[] other ){ +public bool equals( String src, String other ){ return src == other; } -public bool equalsIgnoreCase( char[] src, char[] other ){ +public bool equalsIgnoreCase( String src, String other ){ return tango.text.Unicode.toFold(src) == tango.text.Unicode.toFold(other); } -public bool startsWith( char[] src, char[] pattern ){ +public bool startsWith( String src, String pattern ){ if( src.length < pattern.length ){ return false; } return src[ 0 .. pattern.length ] == pattern; } -public char[] toLowerCase( char[] src ){ +public String toLowerCase( String src ){ return tango.text.Unicode.toLower( src ); } -public hash_t toHash( char[] src ){ - return typeid(char[]).getHash(&src); +public hash_t toHash( String src ){ + return typeid(String).getHash(&src); } -public char[] trim( char[] str ){ +public String trim( String str ){ return tango.text.Util.trim( str ).dup; } -public char[] intern( char[] str ){ +public String intern( String str ){ return str; } -public char* toStringzValidPtr( char[] src ){ +public char* toStringzValidPtr( String src ){ if( src ){ return src.toStringz(); } else{ - static const char[] nullPtr = "\0"; + static const String nullPtr = "\0"; return nullPtr.ptr; } } -static char[] toHex(uint value, bool prefix = true, int radix = 8){ +static String toHex(uint value, bool prefix = true, int radix = 8){ return tango.text.convert.Integer.toString( value, radix is 10 ? tango.text.convert.Integer.Style.Signed : @@ -643,7 +643,7 @@ } class RuntimeException : Exception { - this( char[] e = null){ + this( String e = null){ super(e); } this( Exception e ){ @@ -656,13 +656,13 @@ } class IndexOutOfBoundsException : Exception { - this( char[] e = null){ + this( String e = null){ super(e); } } class UnsupportedOperationException : RuntimeException { - this( char[] e = null){ + this( String e = null){ super(e); } this( Exception e ){ @@ -670,7 +670,7 @@ } } class NumberFormatException : IllegalArgumentException { - this( char[] e ){ + this( String e ){ super(e); } this( Exception e ){ @@ -678,7 +678,7 @@ } } class NullPointerException : Exception { - this( char[] e = null ){ + this( String e = null ){ super(e); } this( Exception e ){ @@ -686,7 +686,7 @@ } } class IllegalStateException : Exception { - this( char[] e = null ){ + this( String e = null ){ super(e); } this( Exception e ){ @@ -694,7 +694,7 @@ } } class InterruptedException : Exception { - this( char[] e = null ){ + this( String e = null ){ super(e); } this( Exception e ){ @@ -703,7 +703,7 @@ } class InvocationTargetException : Exception { Exception cause; - this( Exception e = null, char[] msg = null ){ + this( Exception e = null, String msg = null ){ super(msg); cause = e; } @@ -714,16 +714,16 @@ } } class MissingResourceException : Exception { - char[] classname; - char[] key; - this( char[] msg, char[] classname, char[] key ){ + String classname; + String key; + this( String msg, String classname, String key ){ super(msg); this.classname = classname; this.key = key; } } class ParseException : Exception { - this( char[] e = null ){ + this( String e = null ){ super(e); } } @@ -753,7 +753,7 @@ return source; } - public override char[] toString() { + public override String toString() { return this.classinfo.name ~ "[source=" ~ source.toString() ~ "]"; } } @@ -831,23 +831,23 @@ } } -char[] stringcast( Object o ){ +String stringcast( Object o ){ if( auto str = cast(ArrayWrapperString) o ){ return str.array; } return null; } -char[][] stringcast( Object[] objs ){ - char[][] res = new char[][](objs.length); +String[] stringcast( Object[] objs ){ + String[] res = new String[](objs.length); foreach( idx, obj; objs ){ res[idx] = stringcast(obj); } return res; } -ArrayWrapperString stringcast( char[] str ){ +ArrayWrapperString stringcast( String str ){ return new ArrayWrapperString( str ); } -ArrayWrapperString[] stringcast( char[][] strs ){ +ArrayWrapperString[] stringcast( String[] strs ){ ArrayWrapperString[] res = new ArrayWrapperString[ strs.length ]; foreach( idx, str; strs ){ res[idx] = stringcast(str); @@ -936,7 +936,7 @@ return res; } -void PrintStackTrace( int deepth = 100, char[] prefix = "trc" ){ +void PrintStackTrace( int deepth = 100, String prefix = "trc" ){ auto e = new Exception( null ); int idx = 0; const start = 3; @@ -950,9 +950,9 @@ struct ImportData{ void[] data; - char[] name; + String name; - public static ImportData opCall( void[] data, char[] name ){ + public static ImportData opCall( void[] data, String name ){ ImportData res; res.data = data; res.name = name; @@ -960,6 +960,6 @@ } } -template getImportData(char[] name ){ +template getImportData(String name ){ const ImportData getImportData = ImportData( import(name), name ); -} \ No newline at end of file +}
--- a/dwt/events/KeyEvent.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/events/KeyEvent.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.events.KeyEvent; +import dwt.dwthelper.utils; + import dwt.widgets.Event; import dwt.events.TypedEvent; @@ -98,7 +100,7 @@ * * @return a string representation of the event */ -public override char[] toString() { +public override String toString() { return Format( "{} character={} keyCode={} stateMask={} doit={}}", super.toString[ 0 .. $-2 ], character, keyCode, stateMask, doit );
--- a/dwt/events/MenuDetectEvent.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/events/MenuDetectEvent.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.events.MenuDetectEvent; +import dwt.dwthelper.utils; + import dwt.widgets.Event; import dwt.events.TypedEvent; @@ -67,7 +69,7 @@ * * @return a string representation of the event */ -public override char[] toString() { +public override String toString() { return Format( "{} x={} y={} doit={}}", super.toString[ 0 .. $-2 ], x, y, doit ); } }
--- a/dwt/events/MouseEvent.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/events/MouseEvent.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.events.MouseEvent; +import dwt.dwthelper.utils; + import dwt.widgets.Event; import dwt.events.TypedEvent; @@ -93,7 +95,7 @@ * * @return a string representation of the event */ -public override char[] toString() { +public override String toString() { return Format( "{} button={} stateMask={} x={} y={} count={}}", super.toString[ 0 .. $-1 ], button, stateMask, x, y, count );
--- a/dwt/events/PaintEvent.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/events/PaintEvent.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.events.PaintEvent; +import dwt.dwthelper.utils; + import dwt.widgets.Event; import dwt.graphics.GC; @@ -92,7 +94,7 @@ * * @return a string representation of the event */ -public override char[] toString() { +public override String toString() { return Format( "{} gc={} x={} y={} width={} height={} count={}}", super.toString[ 0 .. $-1 ], gc is null ? "null" : gc.toString,
--- a/dwt/events/SelectionEvent.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/events/SelectionEvent.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.events.SelectionEvent; +import dwt.dwthelper.utils; + import dwt.widgets.Event; import dwt.widgets.Widget; @@ -92,7 +94,7 @@ * @see dwt.widgets.Link#setText(String) * @since 3.1 */ - public char[] text; + public String text; /** * A flag indicating whether the operation should be allowed. @@ -128,7 +130,7 @@ * * @return a string representation of the event */ -public override char[] toString() { +public override String toString() { return Format( "{} item={} detail={} x={} y={} width={} height={} stateMask={} text={} doit={}}", super.toString[ 0 .. $-2 ], item,
--- a/dwt/events/ShellEvent.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/events/ShellEvent.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.events.ShellEvent; +import dwt.dwthelper.utils; + import dwt.widgets.Event; import dwt.events.TypedEvent; @@ -52,7 +54,7 @@ * * @return a string representation of the event */ -public override char[] toString() { +public override String toString() { return Format( "{} doit={}}", super.toString[ 0 .. $-2 ], doit ); } }
--- a/dwt/events/TraverseEvent.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/events/TraverseEvent.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.events.TraverseEvent; +import dwt.dwthelper.utils; + import dwt.widgets.Event; import dwt.events.KeyEvent; @@ -131,7 +133,7 @@ * * @return a string representation of the event */ -public override char[] toString() { +public override String toString() { return Format( "{} detail={}}", super.toString[ 0 .. $-2 ], detail ); } }
--- a/dwt/events/TypedEvent.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/events/TypedEvent.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.events.TypedEvent; +import dwt.dwthelper.utils; + import dwt.widgets.Event; import dwt.widgets.Display; @@ -87,8 +89,8 @@ * * @return the name of the event */ -char[] getName () { - char[] str = this.classinfo.name; +String getName () { + String str = this.classinfo.name; return split( str, "." )[$-1]; } @@ -98,9 +100,9 @@ * * @return a string representation of the event */ -public override char[] toString() { - char[] str_widget = widget is null ? "null" : widget.toString; - char[] str_data = data is null ? "null" : data.toString; +public override String toString() { + String str_widget = widget is null ? "null" : widget.toString; + String str_data = data is null ? "null" : data.toString; return Format( "{}{{time={} data={}}", str_widget, time, str_data ); } }
--- a/dwt/events/VerifyEvent.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/events/VerifyEvent.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.events.VerifyEvent; +import dwt.dwthelper.utils; + import dwt.widgets.Event; import dwt.events.KeyEvent; @@ -37,7 +39,7 @@ * Setting this field will change the text that is about to * be inserted or deleted. */ - public char[] text; + public String text; //static final long serialVersionUID = 3257003246269577014L; @@ -60,7 +62,7 @@ * * @return a string representation of the event */ -public override char[] toString() { +public override String toString() { return Format( "{} start={} end={} text={}}", super.toString[ 0 .. $-2 ], start, end, text ); } }
--- a/dwt/graphics/Color.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/graphics/Color.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.graphics.Color; +import dwt.dwthelper.utils; + import dwt.DWT; import dwt.internal.gtk.OS; @@ -300,7 +302,7 @@ * * @return a string representation of the receiver */ -public override char[] toString () { +public override String toString () { if (isDisposed()) return "Color {*DISPOSED*}"; return Format( "Color {{{}, {}, {}}", getRed(), getGreen(), getBlue()); }
--- a/dwt/graphics/Cursor.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/graphics/Cursor.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.graphics.Cursor; +import dwt.dwthelper.utils; + import dwt.DWT; import dwt.graphics.Resource; @@ -544,7 +546,7 @@ * * @return a string representation of the receiver */ -public override char[] toString () { +public override String toString () { if (isDisposed()) return "Cursor {*DISPOSED*}"; return Format( "Cursor {{{}}", handle ); }
--- a/dwt/graphics/Device.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/graphics/Device.d Mon May 05 00:42:55 2008 +0200 @@ -69,7 +69,7 @@ //int /*long*/ logProcFld; //GLogFunc logCallback; //NOT DONE - get list of valid names - char[] [] log_domains = ["GLib-GObject"[], "GLib", "GObject", "Pango", "ATK", "GdkPixbuf", "Gdk", "Gtk", "GnomeVFS"]; + String [] log_domains = ["GLib-GObject"[], "GLib", "GObject", "Pango", "ATK", "GdkPixbuf", "Gdk", "Gtk", "GnomeVFS"]; int [] handler_ids;// = new int [log_domains.length]; int warningLevel; @@ -405,7 +405,7 @@ * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> * </ul> */ -public FontData[] getFontList (char[] faceName, bool scalable) { +public FontData[] getFontList (String faceName, bool scalable) { checkDevice (); if (!scalable) return new FontData[0]; PangoFontFamily* family; @@ -673,7 +673,7 @@ * * @since 3.3 */ -public bool loadFont (char[] path) { +public bool loadFont (String path) { checkDevice(); if (path is null) DWT.error (DWT.ERROR_NULL_ARGUMENT); return cast(bool) OS.FcConfigAppFontAddFile (null, toStringz(path));
--- a/dwt/graphics/DeviceData.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/graphics/DeviceData.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.graphics.DeviceData; +import dwt.dwthelper.utils; + import tango.core.Exception; public class DeviceData { @@ -24,9 +26,9 @@ * platforms and should never be accessed from application code. * </p> */ - public char[] display_name; - public char[] application_name; - public char[] application_class; + public String display_name; + public String application_name; + public String application_class; /* * Debug fields - may not be honoured
--- a/dwt/graphics/Font.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/graphics/Font.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.graphics.Font; +import dwt.dwthelper.utils; + import dwt.DWT; import dwt.graphics.Resource; @@ -136,14 +138,14 @@ * <li>ERROR_NO_HANDLES - if a font could not be created from the given arguments</li> * </ul> */ -public this(Device device, char[] name, int height, int style) { +public this(Device device, String name, int height, int style) { if (device is null) device = Device.getDevice(); if (device is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); init_(device, name, height, style, null); if (device.tracking) device.new_Object(this); } -/*public*/ this(Device device, char[] name, float height, int style) { +/*public*/ this(Device device, String name, float height, int style) { if (device is null) device = Device.getDevice(); if (device is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); init_(device, name, height, style, null); @@ -199,7 +201,7 @@ if (isDisposed()) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED); auto family = OS.pango_font_description_get_family(handle); - char[] name = fromStringz( family ); + String name = fromStringz( family ); float height = cast(float)OS.pango_font_description_get_size(handle) / OS.PANGO_SCALE; int pangoStyle = OS.pango_font_description_get_style(handle); int pangoWeight = OS.pango_font_description_get_weight(handle); @@ -252,7 +254,7 @@ return cast(hash_t)/*64*/handle; } -void init_(Device device, char[] name, float height, int style, char[] fontString) { +void init_(Device device, String name, float height, int style, String fontString) { if (name is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); if (height < 0) DWT.error(DWT.ERROR_INVALID_ARGUMENT); this.device = device; @@ -296,7 +298,7 @@ * * @return a string representation of the receiver */ -public char[] toString () { +public String toString () { if (isDisposed()) return "Font {*DISPOSED*}"; return Format( "Font {{{}}", handle ); }
--- a/dwt/graphics/FontData.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/graphics/FontData.d Mon May 05 00:42:55 2008 +0200 @@ -19,6 +19,7 @@ import tango.text.Util : locate; import tango.util.Convert; import dwt.dwthelper.utils; +import tango.util.log.Trace; /** * Instances of this class describe operating system fonts. @@ -55,7 +56,7 @@ * platforms and should never be accessed from application code. * </p> */ - public char[] name; + public String name; /** * The height of the font data in points @@ -91,12 +92,12 @@ * platforms and should never be accessed from application code. * </p> */ - public char[] str; + public String str; /** * The locales of the font */ - char[] lang, country, variant; + String lang, country, variant; /** * Constructs a new uninitialized font data. @@ -124,12 +125,12 @@ * * @see #toString */ -public this(char[] str) { +public this(String str) { if (str is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); int start = 0; int end = locate( str, '|' ); if (end is str.length ) DWT.error(DWT.ERROR_INVALID_ARGUMENT); - char[] version1 = str[ start .. end ]; + String version1 = str[ start .. end ]; try { if (to!(int)(version1) !is 1) DWT.error(DWT.ERROR_INVALID_ARGUMENT); } catch (ConversionException e) { @@ -139,7 +140,7 @@ start = end + 1; end = locate( str, '|', start ); if (end is str.length ) DWT.error(DWT.ERROR_INVALID_ARGUMENT); - char[] name = str[start .. end ]; + String name = str[start .. end ]; start = end + 1; end = locate( str, '|', start ); @@ -167,12 +168,12 @@ setHeight(height); setStyle(style); if (end is str.length) return; - char[] platform = str[ start .. end ]; + String platform = str[ start .. end ]; start = end + 1; end = locate( str, '|', start ); if (end is str.length) return; - char[] version2 = str[ start .. end ]; + String version2 = str[ start .. end ]; if (platform.equals("GTK") && version2.equals("1")) { return; @@ -193,13 +194,13 @@ * <li>ERROR_INVALID_ARGUMENT - if the height is negative</li> * </ul> */ -public this(char[] name, int height, int style) { +public this(String name, int height, int style) { setName(name); setHeight(height); setStyle(style); } -/*public*/ this(char[] name, float height, int style) { +/*public*/ this(String name, float height, int style) { setName(name); setHeight(height); setStyle(style); @@ -255,8 +256,8 @@ * @return the <code>String</code> representing a Locale object * @since 3.0 */ -public char[] getLocale () { - char[] result; +public String getLocale () { + String result; const char sep = '_'; if (lang !is null) { result ~= lang; @@ -275,6 +276,7 @@ result = result[0 .. $ - 1]; } } +Trace.formatln( "getLocal {}", result ); return result; } @@ -287,7 +289,7 @@ * * @see #setName */ -public char[] getName() { +public String getName() { return name; } @@ -315,7 +317,7 @@ * @see #equals */ public override hash_t toHash () { - return typeid(char[]).getHash(&name) ^ getHeight() ^ style; + return typeid(String).getHash(&name) ^ getHeight() ^ style; } /** @@ -360,7 +362,8 @@ * @param locale the <code>String</code> representing a Locale object * @see java.util.Locale#toString */ -public void setLocale(char[] locale) { +public void setLocale(String locale) { +Trace.formatln( "setLocal {}", locale ); lang = country = variant = null; if (locale !is null) { char sep = '_'; @@ -405,7 +408,7 @@ * * @see #getName */ -public void setName(char[] name) { +public void setName(String name) { if (name is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); this.name = name; this.str = null; @@ -435,7 +438,7 @@ * * @see FontData */ -public override char[] toString() { +public override String toString() { return Format( "1|{}|{}|{}|GTK|1|", getName, getHeightF, getStyle ); }
--- a/dwt/graphics/GC.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/graphics/GC.d Mon May 05 00:42:55 2008 +0200 @@ -184,7 +184,7 @@ if (device.tracking) device.new_Object(this); } -static void addCairoString(cairo_t* cairo, char[] str, float x, float y, Font font) { +static void addCairoString(cairo_t* cairo, String str, float x, float y, Font font) { char* buffer = toStringz( str ); if (OS.GTK_VERSION >= OS.buildVERSION(2, 8, 0)) { auto layout = OS.pango_cairo_create_layout(cairo); @@ -376,7 +376,7 @@ } if (dashes !is null) { if ((state & LINE_STYLE) !is 0) { - char[] dash_list = new char[dashes.length]; + String dash_list = new char[dashes.length]; for (int i = 0; i < dash_list.length; i++) { dash_list[i] = cast(char)(width is 0 || data.lineStyle is DWT.LINE_CUSTOM ? dashes[i] : dashes[i] * width); } @@ -1016,7 +1016,7 @@ int newWidth = srcX + srcWidth; int newHeight = srcY + srcHeight; int bytesPerLine = (newWidth + 7) / 8; - char[] maskData = new char[bytesPerLine * newHeight]; + String maskData = new char[bytesPerLine * newHeight]; auto mask = cast(GdkDrawable *) OS.gdk_bitmap_create_from_data(null, maskData.ptr, newWidth, newHeight); if (mask !is null) { auto gc = OS.gdk_gc_new(mask); @@ -1515,7 +1515,7 @@ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li> * </ul> */ -public void drawString (char[] str, int x, int y) { +public void drawString (String str, int x, int y) { drawString(str, x, y, false); } /** @@ -1538,7 +1538,7 @@ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li> * </ul> */ -public void drawString(char[] str, int x, int y, bool isTransparent) { +public void drawString(String str, int x, int y, bool isTransparent) { drawText(str, x, y, isTransparent ? DWT.DRAW_TRANSPARENT : 0); } @@ -1560,7 +1560,7 @@ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li> * </ul> */ -public void drawText(char[] str, int x, int y) { +public void drawText(String str, int x, int y) { drawText(str, x, y, DWT.DRAW_DELIMITER | DWT.DRAW_TAB); } @@ -1584,7 +1584,7 @@ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li> * </ul> */ -public void drawText(char[] str, int x, int y, bool isTransparent) { +public void drawText(String str, int x, int y, bool isTransparent) { int flags = DWT.DRAW_DELIMITER | DWT.DRAW_TAB; if (isTransparent) flags |= DWT.DRAW_TRANSPARENT; drawText(str, x, y, flags); @@ -1624,7 +1624,7 @@ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li> * </ul> */ -public void drawText (char[] str, int x, int y, int flags) { +public void drawText (String str, int x, int y, int flags) { if (handle is null) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED); if (str is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); if (str.length is 0) return; @@ -3055,7 +3055,7 @@ static void setCairoFont(cairo_t* cairo, PangoFontDescription* font) { auto family = OS.pango_font_description_get_family(font); int len = /*OS.*/strlen(family); - char[] buffer = new char[len + 1]; + String buffer = new char[len + 1]; memmove(buffer.ptr, family, len); //TODO - convert font height from pango to cairo double height = OS.PANGO_PIXELS(OS.pango_font_description_get_size(font)) * 96 / 72; @@ -3688,12 +3688,12 @@ data.state &= ~(LINE_WIDTH | DRAW_OFFSET); } -void setString(char[] str, int flags) { +void setString(String str, int flags) { if (data.layout is null) createLayout(); if (str is data.str && (flags & ~DWT.DRAW_TRANSPARENT) is (data.drawFlags & ~DWT.DRAW_TRANSPARENT)) { return; } - char[] buffer; + String buffer; int mnemonic, len = str.length ; auto layout = data.layout; char[] text = str.dup; @@ -3864,7 +3864,7 @@ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li> * </ul> */ -public Point stringExtent(char[] str) { +public Point stringExtent(String str) { return textExtent(str, 0); } @@ -3887,7 +3887,7 @@ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li> * </ul> */ -public Point textExtent(char[] str) { +public Point textExtent(String str) { return textExtent(str, DWT.DRAW_DELIMITER | DWT.DRAW_TAB); } @@ -3922,7 +3922,7 @@ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li> * </ul> */ -public Point textExtent(char[] str, int flags) { +public Point textExtent(String str, int flags) { if (handle is null) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED); if (str is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); auto cairo = data.cairo; @@ -3952,7 +3952,7 @@ * * @return a str representation of the receiver */ -public override char[] toString () { +public override String toString () { if (isDisposed()) return "GC {*DISPOSED*}"; return Format( "GC {{{}}", handle ); }
--- a/dwt/graphics/GCData.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/graphics/GCData.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.graphics.GCData; +import dwt.dwthelper.utils; + import dwt.internal.gtk.OS; import dwt.DWT; import dwt.graphics.Device; @@ -57,7 +59,7 @@ public double cairoXoffset, cairoYoffset; public bool disposeCairo; public double[] clippingTransform; - public char[] str; + public String str; public int stringWidth = -1; public int stringHeight = -1; public int drawFlags;
--- a/dwt/graphics/GlyphMetrics.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/graphics/GlyphMetrics.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.graphics.GlyphMetrics; +import dwt.dwthelper.utils; + import dwt.DWT; import tango.text.convert.Format; /** @@ -106,7 +108,7 @@ * * @return a string representation of the <code>GlyphMetrics</code> */ -public override char[] toString () { +public override String toString () { return Format( "GlyphMetrics {{{}, {}, {}}", ascent, descent, width ); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ }
--- a/dwt/graphics/Image.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/graphics/Image.d Mon May 05 00:42:55 2008 +0200 @@ -548,7 +548,7 @@ * <li>ERROR_NO_HANDLES if a handle could not be obtained for image creation</li> * </ul> */ -public this(Device device, char[] filename) { +public this(Device device, String filename) { if (device is null) device = Device.getDevice(); if (device is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); if (filename is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); @@ -1191,7 +1191,7 @@ * * @return a string representation of the receiver */ -public override char[] toString () { +public override String toString () { if (isDisposed()) return "Image {*DISPOSED*}"; return Format( "Image {{{}}", pixmap); }
--- a/dwt/graphics/ImageData.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/graphics/ImageData.d Mon May 05 00:42:55 2008 +0200 @@ -390,7 +390,7 @@ * <li>ERROR_UNSUPPORTED_FORMAT - if the image file contains an unrecognized format</li> * </ul> */ -public this(char[] filename) { +public this(String filename) { ImageData[] data = ImageDataLoader.load(filename); if (data.length < 1) DWT.error(DWT.ERROR_INVALID_IMAGE); ImageData i = data[0];
--- a/dwt/graphics/ImageDataLoader.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/graphics/ImageDataLoader.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.graphics.ImageDataLoader; +import dwt.dwthelper.utils; + public import dwt.graphics.ImageData; public import dwt.dwthelper.InputStream; @@ -27,7 +29,7 @@ return (new ImageLoader()).load(stream); } - public static ImageData[] load(char[] filename) { + public static ImageData[] load(String filename) { return (new ImageLoader()).load(filename); }
--- a/dwt/graphics/ImageLoader.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/graphics/ImageLoader.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.graphics.ImageLoader; +import dwt.dwthelper.utils; + public import dwt.graphics.ImageLoaderListener; public import dwt.graphics.ImageLoaderEvent; @@ -154,7 +156,7 @@ * <li>ERROR_UNSUPPORTED_FORMAT - if the image file contains an unrecognized format</li> * </ul> */ -public ImageData[] load(char[] filename) { +public ImageData[] load(String filename) { if (filename is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); InputStream stream = null; void close(){ @@ -240,7 +242,7 @@ * <li>ERROR_UNSUPPORTED_FORMAT - if the image data cannot be saved to the requested format</li> * </ul> */ -public void save(char[] filename, int format) { +public void save(String filename, int format) { if (filename is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); OutputStream stream = null; try {
--- a/dwt/graphics/ImageLoaderEvent.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/graphics/ImageLoaderEvent.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.graphics.ImageLoaderEvent; +import dwt.dwthelper.utils; + public import dwt.internal.DWTEventObject; public import dwt.graphics.ImageLoader; @@ -85,7 +87,7 @@ * * @return a string representation of the event */ -public override char[] toString () { +public override String toString () { return Format( "ImageLoaderEvent {source={} imageData={} incrementCount={} endOfImage={}}", source, imageData, incrementCount, endOfImage); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ }
--- a/dwt/graphics/Path.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/graphics/Path.d Mon May 05 00:42:55 2008 +0200 @@ -212,7 +212,7 @@ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li> * </ul> */ -public void addString(char[] str, float x, float y, Font font) { +public void addString(String str, float x, float y, Font font) { if (isDisposed()) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED); if (font is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); if (font.isDisposed()) DWT.error(DWT.ERROR_INVALID_ARGUMENT); @@ -585,7 +585,7 @@ * * @return a string representation of the receiver */ -public override char[] toString() { +public override String toString() { if (isDisposed()) return "Path {*DISPOSED*}"; return Format( "Path {{{}}", handle ); }
--- a/dwt/graphics/Pattern.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/graphics/Pattern.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.graphics.Pattern; +import dwt.dwthelper.utils; + import dwt.DWT; import dwt.graphics.Resource; @@ -213,7 +215,7 @@ * * @return a string representation of the receiver */ -public override char[] toString() { +public override String toString() { if (isDisposed()) return "Pattern {*DISPOSED*}"; return Format( "Pattern {{{}}", handle ); }
--- a/dwt/graphics/Point.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/graphics/Point.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.graphics.Point; +import dwt.dwthelper.utils; + public import dwt.internal.SerializableCompatibility; @@ -104,7 +106,7 @@ * * @return a string representation of the point */ -override public char[] toString () { +override public String toString () { return Format( "Point {{{}, {}}", x, y );; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ }
--- a/dwt/graphics/RGB.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/graphics/RGB.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.graphics.RGB; +import dwt.dwthelper.utils; + public import dwt.internal.SerializableCompatibility; import dwt.DWT; @@ -223,7 +225,7 @@ * * @return a String representation of the <code>RGB</code> */ -public override char[] toString() { +public override String toString() { return Format( "RGB {{{}, {}, {}}", red, green, blue ); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ }
--- a/dwt/graphics/Rectangle.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/graphics/Rectangle.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.graphics.Rectangle; +import dwt.dwthelper.utils; + public import dwt.graphics.Point; public import dwt.internal.SerializableCompatibility; @@ -313,7 +315,7 @@ * * @return a string representation of the rectangle */ -public override char[] toString () { +public override String toString () { return Format( "Rectangle {{{}, {}, {}, {}}", x, y, width, height ); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ }
--- a/dwt/graphics/Region.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/graphics/Region.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.graphics.Region; +import dwt.dwthelper.utils; + import dwt.DWT; import dwt.graphics.Resource; @@ -593,7 +595,7 @@ * * @return a string representation of the receiver */ -public override char[] toString () { +public override String toString () { if (isDisposed()) return "Region {*DISPOSED*}"; return Format( "Region {{{}}", handle ); }
--- a/dwt/graphics/TextLayout.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/graphics/TextLayout.d Mon May 05 00:42:55 2008 +0200 @@ -57,13 +57,13 @@ TextStyle style; int start; - public override char[] toString () { + public override String toString () { return Format( "StyleItem {{{}, {}}", start, style ); } } Font font; - char[] text; + String text; int ascent, descent; int[] segments; int[] tabs; @@ -77,7 +77,7 @@ // ZWS ZERO WIDTH SPACE // ZWNBS ZERO WIDTH NO-BREAK SPACE static const dchar LTR_MARK = '\u200E', RTL_MARK = '\u200F', ZWS = '\u200B', ZWNBS = '\uFEFF'; - static const char[] STR_LTR_MARK = "\u200E", STR_RTL_MARK = "\u200F", STR_ZWS = "\u200B", STR_ZWNBS = "\uFEFF"; + static const String STR_LTR_MARK = "\u200E", STR_RTL_MARK = "\u200F", STR_ZWS = "\u200B", STR_ZWNBS = "\uFEFF"; /** * Constructs a new instance of this class on the given device. @@ -123,7 +123,7 @@ void computeRuns () { if (attrList !is null) return; - char[] segmentsText = getSegmentsText(); + String segmentsText = getSegmentsText(); OS.pango_layout_set_text (layout, segmentsText.ptr, segmentsText.length); if (styles.length is 2 && styles[0].style is null && ascent is -1 && descent is -1 && segments is null) return; auto ptr = OS.pango_layout_get_text(layout); @@ -163,7 +163,7 @@ OS.pango_layout_iter_free (iter); chars[ oldPos + count*6 .. oldPos + count*6 + segementsLength - oldPos ] = segmentsText[ oldPos .. segementsLength ]; - char[] buffer = chars;// Converter.wcsToMbcs(null, chars, false); + String buffer = chars;// Converter.wcsToMbcs(null, chars, false); OS.pango_layout_set_text (layout, buffer.ptr, buffer.length); ptr = OS.pango_layout_get_text(layout); @@ -1198,7 +1198,7 @@ return segments; } -char[] getSegmentsText() { +String getSegmentsText() { if (segments is null) return text; int nSegments = segments.length; if (nSegments <= 1) return text; @@ -1210,7 +1210,7 @@ char[] oldChars = text[0..len].dup; char[] newChars = new char[len + nSegments*3]; int charCount = 0, segmentCount = 0; - char[] separator = getOrientation() is DWT.RIGHT_TO_LEFT ? STR_RTL_MARK : STR_LTR_MARK; + String separator = getOrientation() is DWT.RIGHT_TO_LEFT ? STR_RTL_MARK : STR_LTR_MARK; while (charCount < len) { if (segmentCount < nSegments && charCount is segments[segmentCount]) { newChars[charCount + segmentCount .. charCount + segmentCount + separator.length ] = separator; @@ -1322,7 +1322,7 @@ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li> * </ul> */ -public char[] getText () { +public String getText () { checkLayout (); return text; } @@ -1735,7 +1735,7 @@ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li> * </ul> */ -public void setText (char[] text) { +public void setText (String text) { checkLayout (); if (text.equals(this.text)) return; freeRuns(); @@ -1797,7 +1797,7 @@ * * @return a string representation of the receiver */ -public override char[] toString () { +public override String toString () { if (isDisposed()) return "TextLayout {*DISPOSED*}"; return Format( "TextLayout {{{}}", layout ); } @@ -1835,7 +1835,7 @@ return offset - invalidOffsets.length; } -int validateOffset( char[] cont, int offset, int step) { +int validateOffset( String cont, int offset, int step) { if (invalidOffsets is null) return offset + step; int i = step > 0 ? 0 : invalidOffsets.length - 1; do {
--- a/dwt/graphics/TextStyle.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/graphics/TextStyle.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.graphics.TextStyle; +import dwt.dwthelper.utils; + import dwt.DWT; import dwt.graphics.Font; import dwt.graphics.Color; @@ -173,8 +175,8 @@ * * @return a string representation of the <code>TextStyle</code> */ -override public char[] toString () { - char[] buffer = "TextStyle {"; +override public String toString () { + String buffer = "TextStyle {"; int startLength = buffer.length; if (font !is null) { if (buffer.length > startLength) buffer ~= ", "; @@ -202,7 +204,7 @@ if (rise !is 0) { if (buffer.length > startLength) buffer ~= ", "; buffer ~= "rise="; - buffer ~= to!(char[])(rise); + buffer ~= to!(String)(rise); } if (metrics !is null) { if (buffer.length > startLength) buffer ~= ", ";
--- a/dwt/graphics/Transform.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/graphics/Transform.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.graphics.Transform; +import dwt.dwthelper.utils; + import dwt.DWT; import dwt.internal.Compatibility; import dwt.internal.cairo.Cairo; @@ -357,7 +359,7 @@ * * @return a string representation of the receiver */ -public override char[] toString() { +public override String toString() { if (isDisposed()) return "Transform {*DISPOSED*}"; float[] elements = new float[6]; getElements(elements);
--- a/dwt/internal/BidiUtil.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/internal/BidiUtil.d Mon May 05 00:42:55 2008 +0200 @@ -1,4 +1,4 @@ -/******************************************************************************* +/******************************************************************************* * Copyright (c) 2000, 2004 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 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.internal.BidiUtil; +import dwt.dwthelper.utils; + import dwt.graphics.GC; import dwt.internal.gtk.OS; import dwt.dwthelper.Runnable; @@ -76,13 +78,13 @@ * Not implemented. * */ -public static void getOrderInfo(GC gc, char[] text, int[] order, byte[] classBuffer, int flags, int [] offsets) { +public static void getOrderInfo(GC gc, String text, int[] order, byte[] classBuffer, int flags, int [] offsets) { } /* * Not implemented. Returns null. * */ -public static char[] getRenderInfo(GC gc, char[] text, int[] order, byte[] classBuffer, int[] dx, int flags, int[] offsets) { +public static char[] getRenderInfo(GC gc, String text, int[] order, byte[] classBuffer, int[] dx, int flags, int[] offsets) { return null; } /*
--- a/dwt/internal/Compatibility.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/internal/Compatibility.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.internal.Compatibility; +import dwt.dwthelper.utils; + /+ import java.io.*; import java.text.MessageFormat; @@ -163,7 +165,7 @@ * @return a stream on the file if it could be opened. * @exception IOException */ -public static InputStream newFileInputStream(char[] filename) { +public static InputStream newFileInputStream(String filename) { return new FileInputStream(filename); } @@ -174,7 +176,7 @@ * @return a stream on the file if it could be opened. * @exception IOException */ -public static OutputStream newFileOutputStream(char[] filename) { +public static OutputStream newFileOutputStream(String filename) { return new FileOutputStream(filename); } @@ -243,7 +245,7 @@ * @exception ProcessException * if the program cannot be executed */ -public static void exec(char[] prog) { +public static void exec(String prog) { auto proc = new Process( prog ); proc.execute; } @@ -260,7 +262,7 @@ * @exception ProcessException * if the program cannot be executed */ -public static void exec(char[][] progArray) { +public static void exec(String[] progArray) { auto proc = new Process( progArray ); proc.execute; } @@ -341,15 +343,15 @@ * @param s2 string * @return true if the two instances of class String are equal */ -public static bool equalsIgnoreCase(char[] s1, char[] s2) { - char[] s1b = new char[ s1.length ]; - char[] s2b = new char[ s1.length ]; +public static bool equalsIgnoreCase(String s1, String s2) { + String s1b = new char[ s1.length ]; + String s2b = new char[ s1.length ]; scope(exit){ delete s1b; delete s2b; } - char[] s1c = Unicode.toFold( s1, s1b ); - char[] s2c = Unicode.toFold( s2, s2b ); + String s1c = Unicode.toFold( s1, s1b ); + String s2c = Unicode.toFold( s2, s2b ); return s1c == s2c; }
--- a/dwt/internal/Converter.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/internal/Converter.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.internal.Converter; +import dwt.dwthelper.utils; + //import dwt.internal.gtk.OS; import tango.stdc.stringz; @@ -50,11 +52,11 @@ * * @return the default code page */ -public static char[] defaultCodePage () { +public static String defaultCodePage () { return "UTF8"; } -public static wchar [] mbcsToWcs (char[] codePage, char [] buffer) { +public static wchar [] mbcsToWcs (String codePage, char [] buffer) { int items_written; wchar* ptr = g_utf8_to_utf16 (toStringz(buffer), buffer.length, null, &items_written, null); if (!ptr){ @@ -65,8 +67,8 @@ return chars; } -/+ // only difference with String vs. char[] arg, so no diff in dwt -public static char [] wcsToMbcs (char[] codePage, String str, bool terminate) { +/+ // only difference with String vs. String arg, so no diff in dwt +public static char [] wcsToMbcs (String codePage, String str, bool terminate) { int length = str.length (); wchar [] buffer = new wchar [length]; string.getChars (0, length, buffer, 0); @@ -74,7 +76,7 @@ } +/ -public static char [] wcsToMbcs (char[] codePage, wchar [] buffer, bool terminate) { +public static char [] wcsToMbcs (String codePage, wchar [] buffer, bool terminate) { int items_read, items_written; /* * Note that g_utf16_to_utf8() stops converting
--- a/dwt/internal/Library.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/internal/Library.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.internal.Library; +import dwt.dwthelper.utils; + import tango.util.Convert; // do it here, so it can be evaluated at compile time @@ -47,14 +49,14 @@ public static const int SWT_VERSION = .buildSWT_VERSION(MAJOR_VERSION, MINOR_VERSION); version( linux ){ - static const char[] SEPARATOR = "\n"; + static const String SEPARATOR = "\n"; } else { static assert( false, "only linux supported for this port" ); } -static int parseVersion(char[] aVersion) { +static int parseVersion(String aVersion) { if (aVersion == null) return 0; int major = 0, minor = 0, micro = 0; int length = aVersion.length, index = 0, start = 0; @@ -101,7 +103,7 @@ return .buildSWT_VERSION(major, minor); } /+ PORTING_LEFT -static bool extract (char[] fileName, char[] mappedName) { +static bool extract (String fileName, String mappedName) { FileOutputStream os = null; InputStream is = null; File file = new File(fileName); @@ -137,7 +139,7 @@ return false; } -static bool load (char[] libName) { +static bool load (String libName) { try { if (libName.indexOf (SEPARATOR) != -1) { System.load (libName); @@ -160,7 +162,7 @@ * * @param name the name of the library to load */ -public static void loadLibrary (char[] name) { +public static void loadLibrary (String name) { loadLibrary (name, true); } @@ -176,7 +178,7 @@ * @param name the name of the library to load * @param mapName true if the name should be mapped, false otherwise */ -public static void loadLibrary (char[] name, boolean mapName) { +public static void loadLibrary (String name, boolean mapName) { /* Compute the library name and mapped name */ String libName1, libName2, mappedName1, mappedName2;
--- a/dwt/internal/Platform.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/internal/Platform.d Mon May 05 00:42:55 2008 +0200 @@ -16,10 +16,12 @@ *******************************************************************************/ module dwt.internal.Platform; +import dwt.dwthelper.utils; + import dwt.internal.Lock; public class Platform { - public static const char[] PLATFORM = "gtk"; //$NON-NLS-1$ + public static const String PLATFORM = "gtk"; //$NON-NLS-1$ public static const Lock lock; static this() { lock = new Lock();
--- a/dwt/internal/accessibility/gtk/ATK.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/internal/accessibility/gtk/ATK.d Mon May 05 00:42:55 2008 +0200 @@ -16,6 +16,8 @@ *******************************************************************************/ module dwt.internal.accessibility.gtk.ATK; +import dwt.dwthelper.utils; + import dwt.internal.Library; import dwt.internal.gtk.OS; @@ -63,7 +65,7 @@ template NameOfFunc(alias f) { // Note: highly dependent on the .stringof formatting // the value begins with "& " which is why the first two chars are cut off - const char[] NameOfFunc = (&f).stringof[2 .. $]; + const String NameOfFunc = (&f).stringof[2 .. $]; } template ForwardGtkAtkCFunc( alias cFunc ) { @@ -77,7 +79,7 @@ } /+ // alternative template implementation, might be more stable -template ForwardGtkOsCFunc(char[] name) { +template ForwardGtkOsCFunc(String name) { alias typeof(mixin(name)) func; alias ParameterTupleOf!(func) Params; alias ReturnTypeOf!(func) Ret; @@ -145,11 +147,11 @@ public static const int ATK_XY_WINDOW = 1; /** Signals */ - public static const char[] selection_changed = "selection_changed"; - public static const char[] text_changed_insert = "text_changed::insert"; - public static const char[] text_changed_delete = "text_changed::delete"; - public static const char[] text_caret_moved = "text_caret_moved"; - public static const char[] text_selection_changed = "text_selection_changed"; + public static const String selection_changed = "selection_changed"; + public static const String text_changed_insert = "text_changed::insert"; + public static const String text_changed_delete = "text_changed::delete"; + public static const String text_caret_moved = "text_caret_moved"; + public static const String text_selection_changed = "text_selection_changed"; mixin ForwardGtkAtkCFunc!(.ATK_ACTION_GET_IFACE ); mixin ForwardGtkAtkCFunc!(.ATK_COMPONENT_GET_IFACE);
--- a/dwt/internal/c/XTest.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/internal/c/XTest.d Mon May 05 00:42:55 2008 +0200 @@ -4,6 +4,8 @@ ******************************************************************************/ module dwt.internal.c.XTest; +import dwt.dwthelper.utils; + public import dwt.internal.c.Xlib; public import dwt.internal.c.XInput; @@ -18,7 +20,7 @@ const int XTestNumberErrors = 0; const int XTestMajorVersion = 2; const int XTestMinorVersion = 2; -const char[] XTestExtensionName = "XTEST"; +const String XTestExtensionName = "XTEST"; alias void function(void *, char *, int, int, char * *) _BCD_func__1414; alias int function(void *) _BCD_func__1456; alias int function(void *, XErrorEvent *) _BCD_func__1457;
--- a/dwt/internal/c/Xlib.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/internal/c/Xlib.d Mon May 05 00:42:55 2008 +0200 @@ -4,6 +4,8 @@ ******************************************************************************/ module dwt.internal.c.Xlib; +import dwt.dwthelper.utils; + extern(C): align(4): @@ -14,16 +16,16 @@ const int QueuedAlready = 0; const int QueuedAfterReading = 1; const int QueuedAfterFlush = 2; -const char[] XNRequiredCharSet = "requiredCharSet"; -const char[] XNQueryOrientation = "queryOrientation"; -const char[] XNBaseFontName = "baseFontName"; -const char[] XNOMAutomatic = "omAutomatic"; -const char[] XNMissingCharSet = "missingCharSet"; -const char[] XNDefaultString = "defaultString"; -const char[] XNOrientation = "orientation"; -const char[] XNDirectionalDependentDrawing = "directionalDependentDrawing"; -const char[] XNContextualDrawing = "contextualDrawing"; -const char[] XNFontInfo = "fontInfo"; +const String XNRequiredCharSet = "requiredCharSet"; +const String XNQueryOrientation = "queryOrientation"; +const String XNBaseFontName = "baseFontName"; +const String XNOMAutomatic = "omAutomatic"; +const String XNMissingCharSet = "missingCharSet"; +const String XNDefaultString = "defaultString"; +const String XNOrientation = "orientation"; +const String XNDirectionalDependentDrawing = "directionalDependentDrawing"; +const String XNContextualDrawing = "contextualDrawing"; +const String XNFontInfo = "fontInfo"; const int XIMPreeditArea = 0x0001; const int XIMPreeditCallbacks = 0x0002; const int XIMPreeditPosition = 0x0004; @@ -33,48 +35,48 @@ const int XIMStatusCallbacks = 0x0200; const int XIMStatusNothing = 0x0400; const int XIMStatusNone = 0x0800; -const char[] XNVaNestedList = "XNVaNestedList"; -const char[] XNQueryInputStyle = "queryInputStyle"; -const char[] XNClientWindow = "clientWindow"; -const char[] XNInputStyle = "inputStyle"; -const char[] XNFocusWindow = "focusWindow"; -const char[] XNResourceName = "resourceName"; -const char[] XNResourceClass = "resourceClass"; -const char[] XNGeometryCallback = "geometryCallback"; -const char[] XNDestroyCallback = "destroyCallback"; -const char[] XNFilterEvents = "filterEvents"; -const char[] XNPreeditStartCallback = "preeditStartCallback"; -const char[] XNPreeditDoneCallback = "preeditDoneCallback"; -const char[] XNPreeditDrawCallback = "preeditDrawCallback"; -const char[] XNPreeditCaretCallback = "preeditCaretCallback"; -const char[] XNPreeditStateNotifyCallback = "preeditStateNotifyCallback"; -const char[] XNPreeditAttributes = "preeditAttributes"; -const char[] XNStatusStartCallback = "statusStartCallback"; -const char[] XNStatusDoneCallback = "statusDoneCallback"; -const char[] XNStatusDrawCallback = "statusDrawCallback"; -const char[] XNStatusAttributes = "statusAttributes"; -const char[] XNArea = "area"; -const char[] XNAreaNeeded = "areaNeeded"; -const char[] XNSpotLocation = "spotLocation"; -const char[] XNColormap = "colorMap"; -const char[] XNStdColormap = "stdColorMap"; -const char[] XNForeground = "foreground"; -const char[] XNBackground = "background"; -const char[] XNBackgroundPixmap = "backgroundPixmap"; -const char[] XNFontSet = "fontSet"; -const char[] XNLineSpace = "lineSpace"; -const char[] XNCursor = "cursor"; -const char[] XNQueryIMValuesList = "queryIMValuesList"; -const char[] XNQueryICValuesList = "queryICValuesList"; -const char[] XNVisiblePosition = "visiblePosition"; -const char[] XNR6PreeditCallback = "r6PreeditCallback"; -const char[] XNStringConversionCallback = "stringConversionCallback"; -const char[] XNStringConversion = "stringConversion"; -const char[] XNResetState = "resetState"; -const char[] XNHotKey = "hotKey"; -const char[] XNHotKeyState = "hotKeyState"; -const char[] XNPreeditState = "preeditState"; -const char[] XNSeparatorofNestedList = "separatorofNestedList"; +const String XNVaNestedList = "XNVaNestedList"; +const String XNQueryInputStyle = "queryInputStyle"; +const String XNClientWindow = "clientWindow"; +const String XNInputStyle = "inputStyle"; +const String XNFocusWindow = "focusWindow"; +const String XNResourceName = "resourceName"; +const String XNResourceClass = "resourceClass"; +const String XNGeometryCallback = "geometryCallback"; +const String XNDestroyCallback = "destroyCallback"; +const String XNFilterEvents = "filterEvents"; +const String XNPreeditStartCallback = "preeditStartCallback"; +const String XNPreeditDoneCallback = "preeditDoneCallback"; +const String XNPreeditDrawCallback = "preeditDrawCallback"; +const String XNPreeditCaretCallback = "preeditCaretCallback"; +const String XNPreeditStateNotifyCallback = "preeditStateNotifyCallback"; +const String XNPreeditAttributes = "preeditAttributes"; +const String XNStatusStartCallback = "statusStartCallback"; +const String XNStatusDoneCallback = "statusDoneCallback"; +const String XNStatusDrawCallback = "statusDrawCallback"; +const String XNStatusAttributes = "statusAttributes"; +const String XNArea = "area"; +const String XNAreaNeeded = "areaNeeded"; +const String XNSpotLocation = "spotLocation"; +const String XNColormap = "colorMap"; +const String XNStdColormap = "stdColorMap"; +const String XNForeground = "foreground"; +const String XNBackground = "background"; +const String XNBackgroundPixmap = "backgroundPixmap"; +const String XNFontSet = "fontSet"; +const String XNLineSpace = "lineSpace"; +const String XNCursor = "cursor"; +const String XNQueryIMValuesList = "queryIMValuesList"; +const String XNQueryICValuesList = "queryICValuesList"; +const String XNVisiblePosition = "visiblePosition"; +const String XNR6PreeditCallback = "r6PreeditCallback"; +const String XNStringConversionCallback = "stringConversionCallback"; +const String XNStringConversion = "stringConversion"; +const String XNResetState = "resetState"; +const String XNHotKey = "hotKey"; +const String XNHotKeyState = "hotKeyState"; +const String XNPreeditState = "preeditState"; +const String XNSeparatorofNestedList = "separatorofNestedList"; const int XBufferOverflow = -1; const int XLookupNone = 1; const int XLookupChars = 2;
--- a/dwt/internal/c/cairo.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/internal/c/cairo.d Mon May 05 00:42:55 2008 +0200 @@ -4,13 +4,15 @@ ******************************************************************************/ module dwt.internal.c.cairo; +import dwt.dwthelper.utils; + extern(C): align(4): const int CAIRO_VERSION_MAJOR = 1; const int CAIRO_VERSION_MINOR = 4; const int CAIRO_VERSION_MICRO = 10; -const char[] CAIRO_VERSION_STRING = "1.4.10"; +const String CAIRO_VERSION_STRING = "1.4.10"; const int CAIRO_HAS_SVG_SURFACE = 1; const int CAIRO_HAS_PDF_SURFACE = 1; const int CAIRO_HAS_PS_SURFACE = 1;
--- a/dwt/internal/c/gdk.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/internal/c/gdk.d Mon May 05 00:42:55 2008 +0200 @@ -3,6 +3,8 @@ modified by: Frank Benoit <keinfarbton@googlemail.com> ******************************************************************************/ module dwt.internal.c.gdk; + +import dwt.dwthelper.utils; public import dwt.internal.c.pango; public import dwt.internal.c.cairo; public import dwt.internal.c.glib_object; @@ -13,7 +15,7 @@ const int GDK_CURRENT_TIME = 0; const int GDK_PARENT_RELATIVE = 1; const int GDK_PIXBUF_FEATURES_H = 1; -const char[] GDK_PIXBUF_VERSION = "2.12.0"; +const String GDK_PIXBUF_VERSION = "2.12.0"; const int GDK_MAX_TIMECOORD_AXES = 128; alias _GdkWindowObjectClass GdkWindowObjectClass; alias _GdkDrawableClass GdkDrawableClass;
--- a/dwt/internal/c/glib_object.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/internal/c/glib_object.d Mon May 05 00:42:55 2008 +0200 @@ -4,6 +4,8 @@ ******************************************************************************/ module dwt.internal.c.glib_object; +import dwt.dwthelper.utils; + extern(C): align(4): @@ -14,8 +16,8 @@ // gen .. -const char[] G_GNUC_FUNCTION = ""; -const char[] G_GNUC_PRETTY_FUNCTION = ""; +const String G_GNUC_FUNCTION = ""; +const String G_GNUC_PRETTY_FUNCTION = ""; const double G_E = 2.7182818284590452353602874713526624977572470937000; const double G_LN2 = 0.69314718055994530941723212145817656807550013436026; const double G_LN10 = 2.3025850929940456840179914546843642076011014886288; @@ -26,8 +28,8 @@ const int G_LITTLE_ENDIAN = 1234; const int G_BIG_ENDIAN = 4321; const int G_PDP_ENDIAN = 3412; -const char[] G_DIR_SEPARATOR_S = "/"; -const char[] G_SEARCHPATH_SEPARATOR_S = ":"; +const String G_DIR_SEPARATOR_S = "/"; +const String G_SEARCHPATH_SEPARATOR_S = ":"; const double G_MUTEX_DEBUG_MAGIC = 0xf8e18ad7; const int G_ALLOC_ONLY = 1; const int G_ALLOC_AND_FREE = 2; @@ -37,34 +39,34 @@ const int G_PRIORITY_HIGH_IDLE = 100; const int G_PRIORITY_DEFAULT_IDLE = 200; const int G_PRIORITY_LOW = 300; -const char[] G_KEY_FILE_DESKTOP_KEY_TYPE = "Type"; -const char[] G_KEY_FILE_DESKTOP_KEY_VERSION = "Version"; -const char[] G_KEY_FILE_DESKTOP_KEY_NAME = "Name"; -const char[] G_KEY_FILE_DESKTOP_KEY_GENERIC_NAME = "GenericName"; -const char[] G_KEY_FILE_DESKTOP_KEY_NO_DISPLAY = "NoDisplay"; -const char[] G_KEY_FILE_DESKTOP_KEY_COMMENT = "Comment"; -const char[] G_KEY_FILE_DESKTOP_KEY_ICON = "Icon"; -const char[] G_KEY_FILE_DESKTOP_KEY_HIDDEN = "Hidden"; -const char[] G_KEY_FILE_DESKTOP_KEY_ONLY_SHOW_IN = "OnlyShowIn"; -const char[] G_KEY_FILE_DESKTOP_KEY_NOT_SHOW_IN = "NotShowIn"; -const char[] G_KEY_FILE_DESKTOP_KEY_TRY_EXEC = "TryExec"; -const char[] G_KEY_FILE_DESKTOP_KEY_EXEC = "Exec"; -const char[] G_KEY_FILE_DESKTOP_KEY_PATH = "Path"; -const char[] G_KEY_FILE_DESKTOP_KEY_TERMINAL = "Terminal"; -const char[] G_KEY_FILE_DESKTOP_KEY_MIME_TYPE = "MimeType"; -const char[] G_KEY_FILE_DESKTOP_KEY_CATEGORIES = "Categories"; -const char[] G_KEY_FILE_DESKTOP_KEY_STARTUP_NOTIFY = "StartupNotify"; -const char[] G_KEY_FILE_DESKTOP_KEY_STARTUP_WM_CLASS = "StartupWMClass"; -const char[] G_KEY_FILE_DESKTOP_KEY_URL = "URL"; -const char[] G_KEY_FILE_DESKTOP_TYPE_APPLICATION = "Application"; -const char[] G_KEY_FILE_DESKTOP_TYPE_LINK = "Link"; -const char[] G_KEY_FILE_DESKTOP_TYPE_DIRECTORY = "Directory"; -const char[] G_OPTION_REMAINING = ""; -const char[] G_CSET_A_2_Z = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; -const char[] G_CSET_a_2_z = "abcdefghijklmnopqrstuvwxyz"; -const char[] G_CSET_DIGITS = "0123456789"; -const char[] G_CSET_LATINC = "\300\301\302\303\304\305\306"; -const char[] G_CSET_LATINS = "\337\340\341\342\343\344\345\346"; +const String G_KEY_FILE_DESKTOP_KEY_TYPE = "Type"; +const String G_KEY_FILE_DESKTOP_KEY_VERSION = "Version"; +const String G_KEY_FILE_DESKTOP_KEY_NAME = "Name"; +const String G_KEY_FILE_DESKTOP_KEY_GENERIC_NAME = "GenericName"; +const String G_KEY_FILE_DESKTOP_KEY_NO_DISPLAY = "NoDisplay"; +const String G_KEY_FILE_DESKTOP_KEY_COMMENT = "Comment"; +const String G_KEY_FILE_DESKTOP_KEY_ICON = "Icon"; +const String G_KEY_FILE_DESKTOP_KEY_HIDDEN = "Hidden"; +const String G_KEY_FILE_DESKTOP_KEY_ONLY_SHOW_IN = "OnlyShowIn"; +const String G_KEY_FILE_DESKTOP_KEY_NOT_SHOW_IN = "NotShowIn"; +const String G_KEY_FILE_DESKTOP_KEY_TRY_EXEC = "TryExec"; +const String G_KEY_FILE_DESKTOP_KEY_EXEC = "Exec"; +const String G_KEY_FILE_DESKTOP_KEY_PATH = "Path"; +const String G_KEY_FILE_DESKTOP_KEY_TERMINAL = "Terminal"; +const String G_KEY_FILE_DESKTOP_KEY_MIME_TYPE = "MimeType"; +const String G_KEY_FILE_DESKTOP_KEY_CATEGORIES = "Categories"; +const String G_KEY_FILE_DESKTOP_KEY_STARTUP_NOTIFY = "StartupNotify"; +const String G_KEY_FILE_DESKTOP_KEY_STARTUP_WM_CLASS = "StartupWMClass"; +const String G_KEY_FILE_DESKTOP_KEY_URL = "URL"; +const String G_KEY_FILE_DESKTOP_TYPE_APPLICATION = "Application"; +const String G_KEY_FILE_DESKTOP_TYPE_LINK = "Link"; +const String G_KEY_FILE_DESKTOP_TYPE_DIRECTORY = "Directory"; +const String G_OPTION_REMAINING = ""; +const String G_CSET_A_2_Z = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; +const String G_CSET_a_2_z = "abcdefghijklmnopqrstuvwxyz"; +const String G_CSET_DIGITS = "0123456789"; +const String G_CSET_LATINC = "\300\301\302\303\304\305\306"; +const String G_CSET_LATINS = "\337\340\341\342\343\344\345\346"; const int G_USEC_PER_SEC = 1000000; const int G_SIGNAL_FLAGS_MASK = 0x7f; const int G_SIGNAL_MATCH_MASK = 0x3f;
--- a/dwt/internal/c/glx.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/internal/c/glx.d Mon May 05 00:42:55 2008 +0200 @@ -4,6 +4,8 @@ ******************************************************************************/ module dwt.internal.c.glx; +import dwt.dwthelper.utils; + public import dwt.internal.c.Xutil; version=DYNLINK; @@ -12,14 +14,14 @@ import tango.sys.SharedLib : SharedLib; import tango.util.log.Trace; struct Symbol{ - char[] name; + String name; void** symbol; } } void loadLib(){ version(DYNLINK){ - char[] libname = "libGL.so"; + String libname = "libGL.so"; SharedLib lib = SharedLib.load( libname ); if( lib is null ){
--- a/dwt/internal/c/gtk.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/internal/c/gtk.d Mon May 05 00:42:55 2008 +0200 @@ -4,6 +4,8 @@ ******************************************************************************/ module dwt.internal.c.gtk; +import dwt.dwthelper.utils; + public import dwt.internal.c.atk; public import dwt.internal.c.cairo; public import dwt.internal.c.pango; @@ -27,14 +29,14 @@ import tango.sys.SharedLib : SharedLib; import tango.util.log.Trace; struct Symbol{ - char[] name; + String name; void** symbol; } } void loadLib(){ version(DYNLINK){ - char[] libname = "libgtk-x11-2.0.so"; + String libname = "libgtk-x11-2.0.so"; SharedLib lib = SharedLib.load( libname ); if( lib is null ){ @@ -842,139 +844,139 @@ const int GTK_PATH_PRIO_MASK = 0x0f; const int GTK_BUTTONBOX_DEFAULT = -1; const int GTK_MAX_COMPOSE_LEN = 7; -const char[] GTK_PAPER_NAME_A3 = "iso_a3"; -const char[] GTK_PAPER_NAME_A4 = "iso_a4"; -const char[] GTK_PAPER_NAME_A5 = "iso_a5"; -const char[] GTK_PAPER_NAME_B5 = "iso_b5"; -const char[] GTK_PAPER_NAME_LETTER = "na_letter"; -const char[] GTK_PAPER_NAME_EXECUTIVE = "na_executive"; -const char[] GTK_PAPER_NAME_LEGAL = "na_legal"; -const char[] GTK_PRINT_SETTINGS_PRINTER = "printer"; -const char[] GTK_PRINT_SETTINGS_ORIENTATION = "orientation"; -const char[] GTK_PRINT_SETTINGS_PAPER_FORMAT = "paper-format"; -const char[] GTK_PRINT_SETTINGS_PAPER_WIDTH = "paper-width"; -const char[] GTK_PRINT_SETTINGS_PAPER_HEIGHT = "paper-height"; -const char[] GTK_PRINT_SETTINGS_N_COPIES = "n-copies"; -const char[] GTK_PRINT_SETTINGS_DEFAULT_SOURCE = "default-source"; -const char[] GTK_PRINT_SETTINGS_QUALITY = "quality"; -const char[] GTK_PRINT_SETTINGS_RESOLUTION = "resolution"; -const char[] GTK_PRINT_SETTINGS_USE_COLOR = "use-color"; -const char[] GTK_PRINT_SETTINGS_DUPLEX = "duplex"; -const char[] GTK_PRINT_SETTINGS_COLLATE = "collate"; -const char[] GTK_PRINT_SETTINGS_REVERSE = "reverse"; -const char[] GTK_PRINT_SETTINGS_MEDIA_TYPE = "media-type"; -const char[] GTK_PRINT_SETTINGS_DITHER = "dither"; -const char[] GTK_PRINT_SETTINGS_SCALE = "scale"; -const char[] GTK_PRINT_SETTINGS_PRINT_PAGES = "print-pages"; -const char[] GTK_PRINT_SETTINGS_PAGE_RANGES = "page-ranges"; -const char[] GTK_PRINT_SETTINGS_PAGE_SET = "page-set"; -const char[] GTK_PRINT_SETTINGS_FINISHINGS = "finishings"; -const char[] GTK_PRINT_SETTINGS_NUMBER_UP = "number-up"; -const char[] GTK_PRINT_SETTINGS_OUTPUT_BIN = "output-bin"; -const char[] GTK_PRINT_SETTINGS_OUTPUT_FILE_FORMAT = "output-file-format"; -const char[] GTK_PRINT_SETTINGS_OUTPUT_URI = "output-uri"; -const char[] GTK_PRINT_SETTINGS_WIN32_DRIVER_VERSION = "win32-driver-version"; -const char[] GTK_PRINT_SETTINGS_WIN32_DRIVER_EXTRA = "win32-driver-extra"; +const String GTK_PAPER_NAME_A3 = "iso_a3"; +const String GTK_PAPER_NAME_A4 = "iso_a4"; +const String GTK_PAPER_NAME_A5 = "iso_a5"; +const String GTK_PAPER_NAME_B5 = "iso_b5"; +const String GTK_PAPER_NAME_LETTER = "na_letter"; +const String GTK_PAPER_NAME_EXECUTIVE = "na_executive"; +const String GTK_PAPER_NAME_LEGAL = "na_legal"; +const String GTK_PRINT_SETTINGS_PRINTER = "printer"; +const String GTK_PRINT_SETTINGS_ORIENTATION = "orientation"; +const String GTK_PRINT_SETTINGS_PAPER_FORMAT = "paper-format"; +const String GTK_PRINT_SETTINGS_PAPER_WIDTH = "paper-width"; +const String GTK_PRINT_SETTINGS_PAPER_HEIGHT = "paper-height"; +const String GTK_PRINT_SETTINGS_N_COPIES = "n-copies"; +const String GTK_PRINT_SETTINGS_DEFAULT_SOURCE = "default-source"; +const String GTK_PRINT_SETTINGS_QUALITY = "quality"; +const String GTK_PRINT_SETTINGS_RESOLUTION = "resolution"; +const String GTK_PRINT_SETTINGS_USE_COLOR = "use-color"; +const String GTK_PRINT_SETTINGS_DUPLEX = "duplex"; +const String GTK_PRINT_SETTINGS_COLLATE = "collate"; +const String GTK_PRINT_SETTINGS_REVERSE = "reverse"; +const String GTK_PRINT_SETTINGS_MEDIA_TYPE = "media-type"; +const String GTK_PRINT_SETTINGS_DITHER = "dither"; +const String GTK_PRINT_SETTINGS_SCALE = "scale"; +const String GTK_PRINT_SETTINGS_PRINT_PAGES = "print-pages"; +const String GTK_PRINT_SETTINGS_PAGE_RANGES = "page-ranges"; +const String GTK_PRINT_SETTINGS_PAGE_SET = "page-set"; +const String GTK_PRINT_SETTINGS_FINISHINGS = "finishings"; +const String GTK_PRINT_SETTINGS_NUMBER_UP = "number-up"; +const String GTK_PRINT_SETTINGS_OUTPUT_BIN = "output-bin"; +const String GTK_PRINT_SETTINGS_OUTPUT_FILE_FORMAT = "output-file-format"; +const String GTK_PRINT_SETTINGS_OUTPUT_URI = "output-uri"; +const String GTK_PRINT_SETTINGS_WIN32_DRIVER_VERSION = "win32-driver-version"; +const String GTK_PRINT_SETTINGS_WIN32_DRIVER_EXTRA = "win32-driver-extra"; const int GTK_INPUT_ERROR = -1; -const char[] GTK_STOCK_DIALOG_AUTHENTICATION = "gtk-dialog-authentication"; -const char[] GTK_STOCK_DIALOG_INFO = "gtk-dialog-info"; -const char[] GTK_STOCK_DIALOG_WARNING = "gtk-dialog-warning"; -const char[] GTK_STOCK_DIALOG_ERROR = "gtk-dialog-error"; -const char[] GTK_STOCK_DIALOG_QUESTION = "gtk-dialog-question"; -const char[] GTK_STOCK_DND = "gtk-dnd"; -const char[] GTK_STOCK_DND_MULTIPLE = "gtk-dnd-multiple"; -const char[] GTK_STOCK_ABOUT = "gtk-about"; -const char[] GTK_STOCK_ADD = "gtk-add"; -const char[] GTK_STOCK_APPLY = "gtk-apply"; -const char[] GTK_STOCK_BOLD = "gtk-bold"; -const char[] GTK_STOCK_CANCEL = "gtk-cancel"; -const char[] GTK_STOCK_CDROM = "gtk-cdrom"; -const char[] GTK_STOCK_CLEAR = "gtk-clear"; -const char[] GTK_STOCK_CLOSE = "gtk-close"; -const char[] GTK_STOCK_COLOR_PICKER = "gtk-color-picker"; -const char[] GTK_STOCK_CONVERT = "gtk-convert"; -const char[] GTK_STOCK_CONNECT = "gtk-connect"; -const char[] GTK_STOCK_COPY = "gtk-copy"; -const char[] GTK_STOCK_CUT = "gtk-cut"; -const char[] GTK_STOCK_DELETE = "gtk-delete"; -const char[] GTK_STOCK_DIRECTORY = "gtk-directory"; -const char[] GTK_STOCK_DISCARD = "gtk-discard"; -const char[] GTK_STOCK_DISCONNECT = "gtk-disconnect"; -const char[] GTK_STOCK_EDIT = "gtk-edit"; -const char[] GTK_STOCK_EXECUTE = "gtk-execute"; -const char[] GTK_STOCK_FILE = "gtk-file"; -const char[] GTK_STOCK_FIND = "gtk-find"; -const char[] GTK_STOCK_FIND_AND_REPLACE = "gtk-find-and-replace"; -const char[] GTK_STOCK_FLOPPY = "gtk-floppy"; -const char[] GTK_STOCK_FULLSCREEN = "gtk-fullscreen"; -const char[] GTK_STOCK_GOTO_BOTTOM = "gtk-goto-bottom"; -const char[] GTK_STOCK_GOTO_FIRST = "gtk-goto-first"; -const char[] GTK_STOCK_GOTO_LAST = "gtk-goto-last"; -const char[] GTK_STOCK_GOTO_TOP = "gtk-goto-top"; -const char[] GTK_STOCK_GO_BACK = "gtk-go-back"; -const char[] GTK_STOCK_GO_DOWN = "gtk-go-down"; -const char[] GTK_STOCK_GO_FORWARD = "gtk-go-forward"; -const char[] GTK_STOCK_GO_UP = "gtk-go-up"; -const char[] GTK_STOCK_HARDDISK = "gtk-harddisk"; -const char[] GTK_STOCK_HELP = "gtk-help"; -const char[] GTK_STOCK_HOME = "gtk-home"; -const char[] GTK_STOCK_INDEX = "gtk-index"; -const char[] GTK_STOCK_INDENT = "gtk-indent"; -const char[] GTK_STOCK_INFO = "gtk-info"; -const char[] GTK_STOCK_UNINDENT = "gtk-unindent"; -const char[] GTK_STOCK_ITALIC = "gtk-italic"; -const char[] GTK_STOCK_JUMP_TO = "gtk-jump-to"; -const char[] GTK_STOCK_JUSTIFY_CENTER = "gtk-justify-center"; -const char[] GTK_STOCK_JUSTIFY_FILL = "gtk-justify-fill"; -const char[] GTK_STOCK_JUSTIFY_LEFT = "gtk-justify-left"; -const char[] GTK_STOCK_JUSTIFY_RIGHT = "gtk-justify-right"; -const char[] GTK_STOCK_LEAVE_FULLSCREEN = "gtk-leave-fullscreen"; -const char[] GTK_STOCK_MISSING_IMAGE = "gtk-missing-image"; -const char[] GTK_STOCK_MEDIA_FORWARD = "gtk-media-forward"; -const char[] GTK_STOCK_MEDIA_NEXT = "gtk-media-next"; -const char[] GTK_STOCK_MEDIA_PAUSE = "gtk-media-pause"; -const char[] GTK_STOCK_MEDIA_PLAY = "gtk-media-play"; -const char[] GTK_STOCK_MEDIA_PREVIOUS = "gtk-media-previous"; -const char[] GTK_STOCK_MEDIA_RECORD = "gtk-media-record"; -const char[] GTK_STOCK_MEDIA_REWIND = "gtk-media-rewind"; -const char[] GTK_STOCK_MEDIA_STOP = "gtk-media-stop"; -const char[] GTK_STOCK_NETWORK = "gtk-network"; -const char[] GTK_STOCK_NEW = "gtk-new"; -const char[] GTK_STOCK_NO = "gtk-no"; -const char[] GTK_STOCK_OK = "gtk-ok"; -const char[] GTK_STOCK_OPEN = "gtk-open"; -const char[] GTK_STOCK_ORIENTATION_PORTRAIT = "gtk-orientation-portrait"; -const char[] GTK_STOCK_ORIENTATION_LANDSCAPE = "gtk-orientation-landscape"; -const char[] GTK_STOCK_ORIENTATION_REVERSE_LANDSCAPE = "gtk-orientation-reverse-landscape"; -const char[] GTK_STOCK_ORIENTATION_REVERSE_PORTRAIT = "gtk-orientation-reverse-portrait"; -const char[] GTK_STOCK_PASTE = "gtk-paste"; -const char[] GTK_STOCK_PREFERENCES = "gtk-preferences"; -const char[] GTK_STOCK_PRINT = "gtk-print"; -const char[] GTK_STOCK_PRINT_PREVIEW = "gtk-print-preview"; -const char[] GTK_STOCK_PROPERTIES = "gtk-properties"; -const char[] GTK_STOCK_QUIT = "gtk-quit"; -const char[] GTK_STOCK_REDO = "gtk-redo"; -const char[] GTK_STOCK_REFRESH = "gtk-refresh"; -const char[] GTK_STOCK_REMOVE = "gtk-remove"; -const char[] GTK_STOCK_REVERT_TO_SAVED = "gtk-revert-to-saved"; -const char[] GTK_STOCK_SAVE = "gtk-save"; -const char[] GTK_STOCK_SAVE_AS = "gtk-save-as"; -const char[] GTK_STOCK_SELECT_ALL = "gtk-select-all"; -const char[] GTK_STOCK_SELECT_COLOR = "gtk-select-color"; -const char[] GTK_STOCK_SELECT_FONT = "gtk-select-font"; -const char[] GTK_STOCK_SORT_ASCENDING = "gtk-sort-ascending"; -const char[] GTK_STOCK_SORT_DESCENDING = "gtk-sort-descending"; -const char[] GTK_STOCK_SPELL_CHECK = "gtk-spell-check"; -const char[] GTK_STOCK_STOP = "gtk-stop"; -const char[] GTK_STOCK_STRIKETHROUGH = "gtk-strikethrough"; -const char[] GTK_STOCK_UNDELETE = "gtk-undelete"; -const char[] GTK_STOCK_UNDERLINE = "gtk-underline"; -const char[] GTK_STOCK_UNDO = "gtk-undo"; -const char[] GTK_STOCK_YES = "gtk-yes"; -const char[] GTK_STOCK_ZOOM_100 = "gtk-zoom-100"; -const char[] GTK_STOCK_ZOOM_FIT = "gtk-zoom-fit"; -const char[] GTK_STOCK_ZOOM_IN = "gtk-zoom-in"; -const char[] GTK_STOCK_ZOOM_OUT = "gtk-zoom-out"; +const String GTK_STOCK_DIALOG_AUTHENTICATION = "gtk-dialog-authentication"; +const String GTK_STOCK_DIALOG_INFO = "gtk-dialog-info"; +const String GTK_STOCK_DIALOG_WARNING = "gtk-dialog-warning"; +const String GTK_STOCK_DIALOG_ERROR = "gtk-dialog-error"; +const String GTK_STOCK_DIALOG_QUESTION = "gtk-dialog-question"; +const String GTK_STOCK_DND = "gtk-dnd"; +const String GTK_STOCK_DND_MULTIPLE = "gtk-dnd-multiple"; +const String GTK_STOCK_ABOUT = "gtk-about"; +const String GTK_STOCK_ADD = "gtk-add"; +const String GTK_STOCK_APPLY = "gtk-apply"; +const String GTK_STOCK_BOLD = "gtk-bold"; +const String GTK_STOCK_CANCEL = "gtk-cancel"; +const String GTK_STOCK_CDROM = "gtk-cdrom"; +const String GTK_STOCK_CLEAR = "gtk-clear"; +const String GTK_STOCK_CLOSE = "gtk-close"; +const String GTK_STOCK_COLOR_PICKER = "gtk-color-picker"; +const String GTK_STOCK_CONVERT = "gtk-convert"; +const String GTK_STOCK_CONNECT = "gtk-connect"; +const String GTK_STOCK_COPY = "gtk-copy"; +const String GTK_STOCK_CUT = "gtk-cut"; +const String GTK_STOCK_DELETE = "gtk-delete"; +const String GTK_STOCK_DIRECTORY = "gtk-directory"; +const String GTK_STOCK_DISCARD = "gtk-discard"; +const String GTK_STOCK_DISCONNECT = "gtk-disconnect"; +const String GTK_STOCK_EDIT = "gtk-edit"; +const String GTK_STOCK_EXECUTE = "gtk-execute"; +const String GTK_STOCK_FILE = "gtk-file"; +const String GTK_STOCK_FIND = "gtk-find"; +const String GTK_STOCK_FIND_AND_REPLACE = "gtk-find-and-replace"; +const String GTK_STOCK_FLOPPY = "gtk-floppy"; +const String GTK_STOCK_FULLSCREEN = "gtk-fullscreen"; +const String GTK_STOCK_GOTO_BOTTOM = "gtk-goto-bottom"; +const String GTK_STOCK_GOTO_FIRST = "gtk-goto-first"; +const String GTK_STOCK_GOTO_LAST = "gtk-goto-last"; +const String GTK_STOCK_GOTO_TOP = "gtk-goto-top"; +const String GTK_STOCK_GO_BACK = "gtk-go-back"; +const String GTK_STOCK_GO_DOWN = "gtk-go-down"; +const String GTK_STOCK_GO_FORWARD = "gtk-go-forward"; +const String GTK_STOCK_GO_UP = "gtk-go-up"; +const String GTK_STOCK_HARDDISK = "gtk-harddisk"; +const String GTK_STOCK_HELP = "gtk-help"; +const String GTK_STOCK_HOME = "gtk-home"; +const String GTK_STOCK_INDEX = "gtk-index"; +const String GTK_STOCK_INDENT = "gtk-indent"; +const String GTK_STOCK_INFO = "gtk-info"; +const String GTK_STOCK_UNINDENT = "gtk-unindent"; +const String GTK_STOCK_ITALIC = "gtk-italic"; +const String GTK_STOCK_JUMP_TO = "gtk-jump-to"; +const String GTK_STOCK_JUSTIFY_CENTER = "gtk-justify-center"; +const String GTK_STOCK_JUSTIFY_FILL = "gtk-justify-fill"; +const String GTK_STOCK_JUSTIFY_LEFT = "gtk-justify-left"; +const String GTK_STOCK_JUSTIFY_RIGHT = "gtk-justify-right"; +const String GTK_STOCK_LEAVE_FULLSCREEN = "gtk-leave-fullscreen"; +const String GTK_STOCK_MISSING_IMAGE = "gtk-missing-image"; +const String GTK_STOCK_MEDIA_FORWARD = "gtk-media-forward"; +const String GTK_STOCK_MEDIA_NEXT = "gtk-media-next"; +const String GTK_STOCK_MEDIA_PAUSE = "gtk-media-pause"; +const String GTK_STOCK_MEDIA_PLAY = "gtk-media-play"; +const String GTK_STOCK_MEDIA_PREVIOUS = "gtk-media-previous"; +const String GTK_STOCK_MEDIA_RECORD = "gtk-media-record"; +const String GTK_STOCK_MEDIA_REWIND = "gtk-media-rewind"; +const String GTK_STOCK_MEDIA_STOP = "gtk-media-stop"; +const String GTK_STOCK_NETWORK = "gtk-network"; +const String GTK_STOCK_NEW = "gtk-new"; +const String GTK_STOCK_NO = "gtk-no"; +const String GTK_STOCK_OK = "gtk-ok"; +const String GTK_STOCK_OPEN = "gtk-open"; +const String GTK_STOCK_ORIENTATION_PORTRAIT = "gtk-orientation-portrait"; +const String GTK_STOCK_ORIENTATION_LANDSCAPE = "gtk-orientation-landscape"; +const String GTK_STOCK_ORIENTATION_REVERSE_LANDSCAPE = "gtk-orientation-reverse-landscape"; +const String GTK_STOCK_ORIENTATION_REVERSE_PORTRAIT = "gtk-orientation-reverse-portrait"; +const String GTK_STOCK_PASTE = "gtk-paste"; +const String GTK_STOCK_PREFERENCES = "gtk-preferences"; +const String GTK_STOCK_PRINT = "gtk-print"; +const String GTK_STOCK_PRINT_PREVIEW = "gtk-print-preview"; +const String GTK_STOCK_PROPERTIES = "gtk-properties"; +const String GTK_STOCK_QUIT = "gtk-quit"; +const String GTK_STOCK_REDO = "gtk-redo"; +const String GTK_STOCK_REFRESH = "gtk-refresh"; +const String GTK_STOCK_REMOVE = "gtk-remove"; +const String GTK_STOCK_REVERT_TO_SAVED = "gtk-revert-to-saved"; +const String GTK_STOCK_SAVE = "gtk-save"; +const String GTK_STOCK_SAVE_AS = "gtk-save-as"; +const String GTK_STOCK_SELECT_ALL = "gtk-select-all"; +const String GTK_STOCK_SELECT_COLOR = "gtk-select-color"; +const String GTK_STOCK_SELECT_FONT = "gtk-select-font"; +const String GTK_STOCK_SORT_ASCENDING = "gtk-sort-ascending"; +const String GTK_STOCK_SORT_DESCENDING = "gtk-sort-descending"; +const String GTK_STOCK_SPELL_CHECK = "gtk-spell-check"; +const String GTK_STOCK_STOP = "gtk-stop"; +const String GTK_STOCK_STRIKETHROUGH = "gtk-strikethrough"; +const String GTK_STOCK_UNDELETE = "gtk-undelete"; +const String GTK_STOCK_UNDERLINE = "gtk-underline"; +const String GTK_STOCK_UNDO = "gtk-undo"; +const String GTK_STOCK_YES = "gtk-yes"; +const String GTK_STOCK_ZOOM_100 = "gtk-zoom-100"; +const String GTK_STOCK_ZOOM_FIT = "gtk-zoom-fit"; +const String GTK_STOCK_ZOOM_IN = "gtk-zoom-in"; +const String GTK_STOCK_ZOOM_OUT = "gtk-zoom-out"; alias _GtkVSeparatorClass GtkVSeparatorClass; alias _GtkSeparatorClass GtkSeparatorClass; alias _GtkVSeparator GtkVSeparator;
--- a/dwt/internal/c/gtk_unix_print_2_0.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/internal/c/gtk_unix_print_2_0.d Mon May 05 00:42:55 2008 +0200 @@ -4,20 +4,22 @@ ******************************************************************************/ module dwt.internal.c.gtk_unix_print_2_0; +import dwt.dwthelper.utils; + version=DYNLINK; version(DYNLINK){ import tango.sys.SharedLib : SharedLib; import tango.util.log.Trace; struct Symbol{ - char[] name; + String name; void** symbol; } } void loadLib(){ version(DYNLINK){ - char[] libname = "libgtk-x11-2.0.so"; + String libname = "libgtk-x11-2.0.so"; SharedLib lib = SharedLib.load( libname ); if( lib is null ){
--- a/dwt/internal/c/pango.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/internal/c/pango.d Mon May 05 00:42:55 2008 +0200 @@ -4,6 +4,8 @@ ******************************************************************************/ module dwt.internal.c.pango; +import dwt.dwthelper.utils; + public import dwt.internal.c.glib_object; extern(C): @@ -17,7 +19,7 @@ const int PANGO_VERSION_MAJOR = 1; const int PANGO_VERSION_MINOR = 18; const int PANGO_VERSION_MICRO = 3; -const char[] PANGO_VERSION_STRING = "1.18.3"; +const String PANGO_VERSION_STRING = "1.18.3"; enum PangoRenderPart { PANGO_RENDER_PART_FOREGROUND=0, PANGO_RENDER_PART_BACKGROUND=1,
--- a/dwt/internal/cairo/Cairo.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/internal/cairo/Cairo.d Mon May 05 00:42:55 2008 +0200 @@ -23,6 +23,8 @@ */ module dwt.internal.cairo.Cairo; +import dwt.dwthelper.utils; + import dwt.internal.c.cairo; import dwt.internal.c.cairo_xlib; import dwt.internal.c.cairo_ps; @@ -61,7 +63,7 @@ template NameOfFunc(alias f) { // Note: highly dependent on the .stringof formatting // the value begins with "& " which is why the first two chars are cut off - const char[] NameOfFunc = (&f).stringof[2 .. $]; + const String NameOfFunc = (&f).stringof[2 .. $]; } template ForwardGtkCairoCFunc( alias cFunc ) {
--- a/dwt/internal/image/FileFormat.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/internal/image/FileFormat.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.internal.image.FileFormat; +import dwt.dwthelper.utils; + public import dwt.graphics.ImageLoader; public import dwt.graphics.ImageData; public import dwt.internal.image.LEDataInputStream; @@ -39,9 +41,9 @@ * */ public abstract class FileFormat { - static const char[] FORMAT_PACKAGE = "dwt.internal.image"; //$NON-NLS-1$ - static const char[] FORMAT_SUFFIX = "FileFormat"; //$NON-NLS-1$ - static const char[][] FORMATS = [ "WinBMP"[], "WinBMP", "GIF", "WinICO", "JPEG", "PNG", "TIFF", "OS2BMP" ]; //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$//$NON-NLS-5$ //$NON-NLS-6$//$NON-NLS-7$//$NON-NLS-8$ + static const String FORMAT_PACKAGE = "dwt.internal.image"; //$NON-NLS-1$ + static const String FORMAT_SUFFIX = "FileFormat"; //$NON-NLS-1$ + static const String[] FORMATS = [ "WinBMP"[], "WinBMP", "GIF", "WinICO", "JPEG", "PNG", "TIFF", "OS2BMP" ]; //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$//$NON-NLS-5$ //$NON-NLS-6$//$NON-NLS-7$//$NON-NLS-8$ alias Tuple!( WinBMPFileFormat, WinBMPFileFormat, GIFFileFormat, WinICOFileFormat, JPEGFileFormat, PNGFileFormat, TIFFFileFormat, OS2BMPFileFormat ) TFormats; LEDataInputStream inputStream; LEDataOutputStream outputStream;
--- a/dwt/internal/image/GIFFileFormat.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/internal/image/GIFFileFormat.d Mon May 05 00:42:55 2008 +0200 @@ -28,7 +28,7 @@ class Image{} final class GIFFileFormat : FileFormat { - char[] signature; + String signature; int screenWidth, screenHeight, backgroundPixel, bitsPerPixel, defaultDepth; int disposalMethod = 0; int delayTime = 0; @@ -64,7 +64,7 @@ byte[3] signature; stream.read(signature); stream.unread(signature); - return cast(char[])signature == "GIF"; //$NON-NLS-1$ + return cast(String)signature == "GIF"; //$NON-NLS-1$ } catch (Exception e) { return false; } @@ -80,7 +80,7 @@ byte[7] block; try { inputStream.read(signatureBytes); - signature = cast(char[])signatureBytes.dup; + signature = cast(String)signatureBytes.dup; if (signature != "GIF") //$NON-NLS-1$ DWT.error(DWT.ERROR_INVALID_IMAGE); @@ -317,11 +317,11 @@ // Read application identifier. byte[] applicationBytes = new byte[8]; inputStream.read(applicationBytes); - char[] application = cast(char[])(applicationBytes.dup); + String application = cast(String)(applicationBytes.dup); // Read authentication code. byte[] authenticationBytes = new byte[3]; inputStream.read(authenticationBytes); - char[] authentication = cast(char[])(authenticationBytes.dup); + String authentication = cast(String)(authenticationBytes.dup); // Read application data. byte[] data = new byte[0]; byte[] block = new byte[255];
--- a/dwt/internal/image/JPEGDecoder.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/internal/image/JPEGDecoder.d Mon May 05 00:42:55 2008 +0200 @@ -2288,7 +2288,7 @@ DWT.error(code); } -static void error(char[] msg) { +static void error(String msg) { DWT.error(DWT.ERROR_INVALID_IMAGE, null, msg); } @@ -5833,7 +5833,7 @@ /* For now, precision must match compiled-in value... */ if (cinfo.data_precision !is BITS_IN_JSAMPLE) - error(" [data precision=" ~ to!(char[])(cinfo.data_precision) ~ "]"); + error(" [data precision=" ~ to!(String)(cinfo.data_precision) ~ "]"); // ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo.data_precision); /* Check that number of components won't exceed internal array sizes */
--- a/dwt/internal/image/PngChunk.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/internal/image/PngChunk.d Mon May 05 00:42:55 2008 +0200 @@ -364,7 +364,7 @@ * Provided so that subclasses can override and add * data to the toString() call. */ -char[] contributeToString() { +String contributeToString() { return ""; } @@ -374,10 +374,10 @@ * * @return a string representation of the event */ -public override char[] toString() { - char[] buffer = Format( "{\n\tLength: {}\n\tType: {}{}\n\tCRC: {:X}\n}", +public override String toString() { + String buffer = Format( "{\n\tLength: {}\n\tType: {}{}\n\tCRC: {:X}\n}", getLength(), - cast(char[]) getTypeBytes(), + cast(String) getTypeBytes(), contributeToString(), getCRC()); return buffer;
--- a/dwt/internal/image/PngIhdrChunk.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/internal/image/PngIhdrChunk.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.internal.image.PngIhdrChunk; +import dwt.dwthelper.utils; + import dwt.DWT; import dwt.graphics.PaletteData; @@ -271,7 +273,7 @@ } } -char[] getColorTypeString() { +String getColorTypeString() { switch (colorType) { case COLOR_TYPE_GRAYSCALE: return "Grayscale"; case COLOR_TYPE_RGB: return "RGB"; @@ -282,7 +284,7 @@ } } -char[] getFilterMethodString() { +String getFilterMethodString() { switch (filterMethod) { case FILTER_NONE: return "None"; case FILTER_SUB: return "Sub"; @@ -293,7 +295,7 @@ } } -char[] getInterlaceMethodString() { +String getInterlaceMethodString() { switch (interlaceMethod) { case INTERLACE_METHOD_NONE: return "Not Interlaced"; case INTERLACE_METHOD_ADAM7: return "Interlaced - ADAM7"; @@ -301,7 +303,7 @@ } } -override char[] contributeToString() { +override String contributeToString() { return Format( "\n\tWidth: {}\n\tHeight: {}\n\tBit Depth: {}\n\tColor Type: {}\n\tCompression Method: {}\n\tFilter Method: {}\n\tInterlace Method: {}", width, height, bitDepth, getColorTypeString(), compressionMethod, getFilterMethodString(), getInterlaceMethodString() ); }
--- a/dwt/internal/image/PngPlteChunk.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/internal/image/PngPlteChunk.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.internal.image.PngPlteChunk; +import dwt.dwthelper.utils; + import dwt.DWT; import dwt.graphics.PaletteData; @@ -123,7 +125,7 @@ if (256 < paletteSize) DWT.error(DWT.ERROR_INVALID_IMAGE); } -override char[] contributeToString() { +override String contributeToString() { return Format("\n\tPalette size:{}", paletteSize ); }
--- a/dwt/layout/FillLayout.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/layout/FillLayout.d Mon May 05 00:42:55 2008 +0200 @@ -179,8 +179,8 @@ return true; } -char[] getName () { - char[] string = this.classinfo.name; +String getName () { + String string = this.classinfo.name; int index = string.lastIndexOf( '.'); if (index is -1 ) return string; return string[ index + 1 .. string.length ]; @@ -232,12 +232,12 @@ * * @return a string representation of the layout */ -override public char[] toString () { - char[] string = getName () ~ " {"; +override public String toString () { + String string = getName () ~ " {"; string ~= "type="~((type is DWT.VERTICAL) ? "DWT.VERTICAL" : "DWT.HORIZONTAL")~" "; - if (marginWidth !is 0) string ~= "marginWidth="~to!(char[])(marginWidth)~" "; - if (marginHeight !is 0) string ~= "marginHeight="~to!(char[])(marginHeight)~" "; - if (spacing !is 0) string ~= "spacing="~to!(char[])(spacing)~" "; + if (marginWidth !is 0) string ~= "marginWidth="~to!(String)(marginWidth)~" "; + if (marginHeight !is 0) string ~= "marginHeight="~to!(String)(marginHeight)~" "; + if (spacing !is 0) string ~= "spacing="~to!(String)(spacing)~" "; string = string.trim(); string ~= "}"; return string;
--- a/dwt/layout/FormAttachment.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/layout/FormAttachment.d Mon May 05 00:42:55 2008 +0200 @@ -18,6 +18,7 @@ import dwt.layout.FormData; import tango.text.convert.Format; +import dwt.dwthelper.utils; /** * Instances of this class are used to define the edges of a control @@ -298,8 +299,8 @@ * * @return a string representation of the FormAttachment */ -public override char[] toString () { - char[] string = control !is null ? control.toString () : Format( "{}/{}", numerator, denominator ); +public override String toString () { + String string = control !is null ? control.toString () : Format( "{}/{}", numerator, denominator ); return Format("{{y = ({})x + {}}", string, ( offset >= 0 ? Format(")x + {}", offset ) : Format( ")x - {}", -offset))); }
--- a/dwt/layout/FormData.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/layout/FormData.d Mon May 05 00:42:55 2008 +0200 @@ -18,8 +18,8 @@ import dwt.widgets.Control; import dwt.layout.FormAttachment; -import tango.text.Util; import tango.util.Convert; +import dwt.dwthelper.utils; /** * Instances of this class are used to define the attachments @@ -238,10 +238,10 @@ return cacheLeft; } -char[] getName () { - char[] string = this.classinfo.name; - int index = locatePrior( string, '.'); - if (index is string.length ) return string; +String getName () { + String string = this.classinfo.name; + int index = string.lastIndexOf( '.'); + if (index is -1 ) return string; return string[ index + 1 .. string.length ]; } @@ -333,15 +333,15 @@ * * @return a string representation of the FormData object */ -override public char[] toString () { - char[] string = getName()~" {"; - if (width !is DWT.DEFAULT) string ~= "width="~to!(char[])(width)~" "; - if (height !is DWT.DEFAULT) string ~= "height="~to!(char[])(height)~" "; - if (left !is null) string ~= "left="~to!(char[])(left)~" "; - if (right !is null) string ~= "right="~to!(char[])(right)~" "; - if (top !is null) string ~= "top="~to!(char[])(top)~" "; - if (bottom !is null) string ~= "bottom="~to!(char[])(bottom)~" "; - string = trim( string ); +override public String toString () { + String string = getName()~" {"; + if (width !is DWT.DEFAULT) string ~= "width="~to!(String)(width)~" "; + if (height !is DWT.DEFAULT) string ~= "height="~to!(String)(height)~" "; + if (left !is null) string ~= "left="~to!(String)(left)~" "; + if (right !is null) string ~= "right="~to!(String)(right)~" "; + if (top !is null) string ~= "top="~to!(String)(top)~" "; + if (bottom !is null) string ~= "bottom="~to!(String)(bottom)~" "; + string = string.trim(); string ~= "}"; return string; }
--- a/dwt/layout/FormLayout.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/layout/FormLayout.d Mon May 05 00:42:55 2008 +0200 @@ -22,9 +22,9 @@ import dwt.widgets.Composite; import dwt.widgets.Scrollable; -import tango.text.Util; import tango.util.Convert; import Math = tango.math.Math; +import dwt.dwthelper.utils; /** * Instances of this class control the position and size of the @@ -260,10 +260,10 @@ return true; } -char[] getName () { - char[] string = this.classinfo.name; - int index = locatePrior( string, '.'); - if (index is string.length ) return string; +String getName () { + String string = this.classinfo.name; + int index = string.lastIndexOf('.'); + if (index is -1 ) return string; return string[ index + 1 .. string.length ]; } @@ -379,16 +379,16 @@ * * @return a string representation of the layout */ -override public char[] toString () { - char[] string = getName ()~" {"; - if (marginWidth !is 0) string ~= "marginWidth="~to!(char[])(marginWidth)~" "; - if (marginHeight !is 0) string ~= "marginHeight="~to!(char[])(marginHeight)~" "; - if (marginLeft !is 0) string ~= "marginLeft="~to!(char[])(marginLeft)~" "; - if (marginRight !is 0) string ~= "marginRight="~to!(char[])(marginRight)~" "; - if (marginTop !is 0) string ~= "marginTop="~to!(char[])(marginTop)~" "; - if (marginBottom !is 0) string ~= "marginBottom="~to!(char[])(marginBottom)~" "; - if (spacing !is 0) string ~= "spacing="~to!(char[])(spacing)~" "; - string = trim( string ); +override public String toString () { + String string = getName ()~" {"; + if (marginWidth !is 0) string ~= "marginWidth="~to!(String)(marginWidth)~" "; + if (marginHeight !is 0) string ~= "marginHeight="~to!(String)(marginHeight)~" "; + if (marginLeft !is 0) string ~= "marginLeft="~to!(String)(marginLeft)~" "; + if (marginRight !is 0) string ~= "marginRight="~to!(String)(marginRight)~" "; + if (marginTop !is 0) string ~= "marginTop="~to!(String)(marginTop)~" "; + if (marginBottom !is 0) string ~= "marginBottom="~to!(String)(marginBottom)~" "; + if (spacing !is 0) string ~= "spacing="~to!(String)(spacing)~" "; + string = string.trim(); string ~= "}"; return string; }
--- a/dwt/layout/GridData.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/layout/GridData.d Mon May 05 00:42:55 2008 +0200 @@ -16,8 +16,8 @@ import dwt.graphics.Point; import dwt.widgets.Control; -import tango.text.Util; import tango.util.Convert; +import dwt.dwthelper.utils; /** * <code>GridData</code> is the layout data object associated with @@ -503,10 +503,10 @@ currentWidth = currentHeight = -1; } -char[] getName () { - char[] string = this.classinfo.name; - int index = locatePrior( string, '.'); - if (index is string.length ) return string; +String getName () { + String string = this.classinfo.name; + int index = string.lastIndexOf('.'); + if (index is -1 ) return string; return string[ index + 1 .. string.length ]; } @@ -516,8 +516,8 @@ * * @return a string representation of the GridData object */ -override public char[] toString () { - char[] hAlign = ""; +override public String toString () { + String hAlign = ""; switch (horizontalAlignment) { case DWT.FILL: hAlign = "DWT.FILL"; break; case DWT.BEGINNING: hAlign = "DWT.BEGINNING"; break; @@ -527,9 +527,9 @@ case DWT.RIGHT: hAlign = "DWT.RIGHT"; break; case DWT.CENTER: hAlign = "DWT.CENTER"; break; case CENTER: hAlign = "GridData.CENTER"; break; - default: hAlign = "Undefined "~to!(char[])(horizontalAlignment); break; + default: hAlign = "Undefined "~to!(String)(horizontalAlignment); break; } - char[] vAlign = ""; + String vAlign = ""; switch (verticalAlignment) { case DWT.FILL: vAlign = "DWT.FILL"; break; case DWT.BEGINNING: vAlign = "DWT.BEGINNING"; break; @@ -539,22 +539,22 @@ case DWT.BOTTOM: vAlign = "DWT.BOTTOM"; break; case DWT.CENTER: vAlign = "DWT.CENTER"; break; case CENTER: vAlign = "GridData.CENTER"; break; - default: vAlign = "Undefined "~to!(char[])(verticalAlignment); break; + default: vAlign = "Undefined "~to!(String)(verticalAlignment); break; } - char[] string = getName()~" {"; - string ~= "horizontalAlignment="~to!(char[])(hAlign)~" "; - if (horizontalIndent !is 0) string ~= "horizontalIndent="~to!(char[])(horizontalIndent)~" "; - if (horizontalSpan !is 1) string ~= "horizontalSpan="~to!(char[])(horizontalSpan)~" "; - if (grabExcessHorizontalSpace) string ~= "grabExcessHorizontalSpace="~to!(char[])(grabExcessHorizontalSpace)~" "; - if (widthHint !is DWT.DEFAULT) string ~= "widthHint="~to!(char[])(widthHint)~" "; - if (minimumWidth !is 0) string ~= "minimumWidth="~to!(char[])(minimumWidth)~" "; + String string = getName()~" {"; + string ~= "horizontalAlignment="~to!(String)(hAlign)~" "; + if (horizontalIndent !is 0) string ~= "horizontalIndent="~to!(String)(horizontalIndent)~" "; + if (horizontalSpan !is 1) string ~= "horizontalSpan="~to!(String)(horizontalSpan)~" "; + if (grabExcessHorizontalSpace) string ~= "grabExcessHorizontalSpace="~to!(String)(grabExcessHorizontalSpace)~" "; + if (widthHint !is DWT.DEFAULT) string ~= "widthHint="~to!(String)(widthHint)~" "; + if (minimumWidth !is 0) string ~= "minimumWidth="~to!(String)(minimumWidth)~" "; string ~= "verticalAlignment="~vAlign~" "; - if (verticalIndent !is 0) string ~= "verticalIndent="~to!(char[])(verticalIndent)~" "; - if (verticalSpan !is 1) string ~= "verticalSpan="~to!(char[])(verticalSpan)~" "; - if (grabExcessVerticalSpace) string ~= "grabExcessVerticalSpace="~to!(char[])(grabExcessVerticalSpace)~" "; - if (heightHint !is DWT.DEFAULT) string ~= "heightHint="~to!(char[])(heightHint)~" "; - if (minimumHeight !is 0) string ~= "minimumHeight="~to!(char[])(minimumHeight)~" "; - if (exclude) string ~= "exclude="~to!(char[])(exclude)~" "; + if (verticalIndent !is 0) string ~= "verticalIndent="~to!(String)(verticalIndent)~" "; + if (verticalSpan !is 1) string ~= "verticalSpan="~to!(String)(verticalSpan)~" "; + if (grabExcessVerticalSpace) string ~= "grabExcessVerticalSpace="~to!(String)(grabExcessVerticalSpace)~" "; + if (heightHint !is DWT.DEFAULT) string ~= "heightHint="~to!(String)(heightHint)~" "; + if (minimumHeight !is 0) string ~= "minimumHeight="~to!(String)(minimumHeight)~" "; + if (exclude) string ~= "exclude="~to!(String)(exclude)~" "; string = string.trim(); string ~= "}"; return string;
--- a/dwt/layout/GridLayout.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/layout/GridLayout.d Mon May 05 00:42:55 2008 +0200 @@ -23,9 +23,9 @@ import dwt.dwthelper.System; -import tango.text.Util; import tango.util.Convert; import Math = tango.math.Math; +import dwt.dwthelper.utils; /** @@ -726,10 +726,10 @@ return new Point (totalDefaultWidth, totalDefaultHeight); } -char[] getName () { - char[] string = this.classinfo.name; - int index = locatePrior( string, '.'); - if (index is string.length ) return string; +String getName () { + String string = this.classinfo.name; + int index = string.lastIndexOf('.'); + if (index is -1 ) return string; return string[ index + 1 .. string.length ]; } @@ -739,18 +739,18 @@ * * @return a string representation of the layout */ -override public char[] toString () { - char[] string = getName ()~" {"; - if (numColumns !is 1) string ~= "numColumns="~to!(char[])(numColumns)~" "; - if (makeColumnsEqualWidth) string ~= "makeColumnsEqualWidth="~to!(char[])(makeColumnsEqualWidth)~" "; - if (marginWidth !is 0) string ~= "marginWidth="~to!(char[])(marginWidth)~" "; - if (marginHeight !is 0) string ~= "marginHeight="~to!(char[])(marginHeight)~" "; - if (marginLeft !is 0) string ~= "marginLeft="~to!(char[])(marginLeft)~" "; - if (marginRight !is 0) string ~= "marginRight="~to!(char[])(marginRight)~" "; - if (marginTop !is 0) string ~= "marginTop="~to!(char[])(marginTop)~" "; - if (marginBottom !is 0) string ~= "marginBottom="~to!(char[])(marginBottom)~" "; - if (horizontalSpacing !is 0) string ~= "horizontalSpacing="~to!(char[])(horizontalSpacing)~" "; - if (verticalSpacing !is 0) string ~= "verticalSpacing="~to!(char[])(verticalSpacing)~" "; +override public String toString () { + String string = getName ()~" {"; + if (numColumns !is 1) string ~= "numColumns="~to!(String)(numColumns)~" "; + if (makeColumnsEqualWidth) string ~= "makeColumnsEqualWidth="~to!(String)(makeColumnsEqualWidth)~" "; + if (marginWidth !is 0) string ~= "marginWidth="~to!(String)(marginWidth)~" "; + if (marginHeight !is 0) string ~= "marginHeight="~to!(String)(marginHeight)~" "; + if (marginLeft !is 0) string ~= "marginLeft="~to!(String)(marginLeft)~" "; + if (marginRight !is 0) string ~= "marginRight="~to!(String)(marginRight)~" "; + if (marginTop !is 0) string ~= "marginTop="~to!(String)(marginTop)~" "; + if (marginBottom !is 0) string ~= "marginBottom="~to!(String)(marginBottom)~" "; + if (horizontalSpacing !is 0) string ~= "horizontalSpacing="~to!(String)(horizontalSpacing)~" "; + if (verticalSpacing !is 0) string ~= "verticalSpacing="~to!(String)(verticalSpacing)~" "; string = string.trim(); string ~= "}"; return string;
--- a/dwt/layout/RowData.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/layout/RowData.d Mon May 05 00:42:55 2008 +0200 @@ -16,8 +16,8 @@ import dwt.graphics.Point; import dwt.widgets.Control; -import tango.text.Util; import tango.util.Convert; +import dwt.dwthelper.utils; /** * Each control controlled by a <code>RowLayout</code> can have its initial @@ -105,10 +105,10 @@ this (point.x, point.y); } -char[] getName () { - char[] string = this.classinfo.name; - int index = locatePrior( string, '.'); - if (index is string.length ) return string; +String getName () { + String string = this.classinfo.name; + int index = string.lastIndexOf('.'); + if (index is -1 ) return string; return string[ index + 1 .. string.length ]; } @@ -118,12 +118,12 @@ * * @return a string representation of the RowData object */ -override public char[] toString () { - char[] string = getName ()~" {"; - if (width !is DWT.DEFAULT) string ~= "width="~to!(char[])(width)~" "; - if (height !is DWT.DEFAULT) string ~= "height="~to!(char[])(height)~" "; - if (exclude) string ~= "exclude="~to!(char[])(exclude)~" "; - string = trim( string ); +override public String toString () { + String string = getName ()~" {"; + if (width !is DWT.DEFAULT) string ~= "width="~to!(String)(width)~" "; + if (height !is DWT.DEFAULT) string ~= "height="~to!(String)(height)~" "; + if (exclude) string ~= "exclude="~to!(String)(exclude)~" "; + string = string.trim(); string ~= "}"; return string; }
--- a/dwt/layout/RowLayout.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/layout/RowLayout.d Mon May 05 00:42:55 2008 +0200 @@ -19,9 +19,9 @@ import dwt.widgets.Layout; import dwt.widgets.Composite; import dwt.layout.RowData; -import tango.text.Util; import tango.util.Convert; import Math = tango.math.Math; +import dwt.dwthelper.utils; /** @@ -220,10 +220,10 @@ return true; } -char[] getName () { - char[] string = this.classinfo.name; - int index = locatePrior( string, '.'); - if (index is string.length ) return string; +String getName () { + String string = this.classinfo.name; + int index = string.lastIndexOf('.'); + if (index is -1 ) return string; return string[ index + 1 .. string.length ]; } @@ -456,21 +456,21 @@ * * @return a string representation of the layout */ -override public char[] toString () { - char[] string = getName ()~" {"; +override public String toString () { + String string = getName ()~" {"; string ~= "type="~((type !is DWT.HORIZONTAL) ? "DWT.VERTICAL" : "DWT.HORIZONTAL")~" "; - if (marginWidth !is 0) string ~= "marginWidth="~to!(char[])(marginWidth)~" "; - if (marginHeight !is 0) string ~= "marginHeight="~to!(char[])(marginHeight)~" "; - if (marginLeft !is 0) string ~= "marginLeft="~to!(char[])(marginLeft)~" "; - if (marginTop !is 0) string ~= "marginTop="~to!(char[])(marginTop)~" "; - if (marginRight !is 0) string ~= "marginRight="~to!(char[])(marginRight)~" "; - if (marginBottom !is 0) string ~= "marginBottom="~to!(char[])(marginBottom)~" "; - if (spacing !is 0) string ~= "spacing="~to!(char[])(spacing)~" "; - string ~= "wrap="~to!(char[])(wrap)~" "; - string ~= "pack="~to!(char[])(pack)~" "; - string ~= "fill="~to!(char[])(fill)~" "; - string ~= "justify="~to!(char[])(justify)~" "; - string = trim( string ); + if (marginWidth !is 0) string ~= "marginWidth="~to!(String)(marginWidth)~" "; + if (marginHeight !is 0) string ~= "marginHeight="~to!(String)(marginHeight)~" "; + if (marginLeft !is 0) string ~= "marginLeft="~to!(String)(marginLeft)~" "; + if (marginTop !is 0) string ~= "marginTop="~to!(String)(marginTop)~" "; + if (marginRight !is 0) string ~= "marginRight="~to!(String)(marginRight)~" "; + if (marginBottom !is 0) string ~= "marginBottom="~to!(String)(marginBottom)~" "; + if (spacing !is 0) string ~= "spacing="~to!(String)(spacing)~" "; + string ~= "wrap="~to!(String)(wrap)~" "; + string ~= "pack="~to!(String)(pack)~" "; + string ~= "fill="~to!(String)(fill)~" "; + string ~= "justify="~to!(String)(justify)~" "; + string = string.trim(); string ~= "}"; return string; }
--- a/dwt/opengl/GLData.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/opengl/GLData.d Mon May 05 00:42:55 2008 +0200 @@ -13,6 +13,8 @@ module dwt.opengl.GLData; +import dwt.dwthelper.utils; + import tango.text.Util; import tango.util.Convert; @@ -133,15 +135,15 @@ * @return a string representation of the data */ - override public char[] toString() { - char[] string = doubleBuffer ? "doubleBuffer," : ""; + override public String toString() { + String string = doubleBuffer ? "doubleBuffer," : ""; string ~= stereo ? "stereo," : ""; - string ~= "r:" ~ to!(char[])(redSize) ~ " g:" ~ to!(char[])(greenSize) ~ - " b:" ~ to!(char[])(blueSize) ~ " a:" ~ to!(char[])(alphaSize) ~ "," ~ - "depth:" ~ to!(char[])(depthSize) ~ ",stencil:" ~ to!(char[])(stencilSize) ~ - ",accum r:" ~ to!(char[])(accumRedSize) ~ "g:" ~ to!(char[])(accumGreenSize) ~ - "b:" ~ to!(char[])(accumBlueSize) ~ "a:" ~ to!(char[])(accumAlphaSize) ~ - ",sampleBuffers:" ~ to!(char[])(sampleBuffers) ~ ",samples:" ~ to!(char[])(samples); + string ~= "r:" ~ to!(String)(redSize) ~ " g:" ~ to!(String)(greenSize) ~ + " b:" ~ to!(String)(blueSize) ~ " a:" ~ to!(String)(alphaSize) ~ "," ~ + "depth:" ~ to!(String)(depthSize) ~ ",stencil:" ~ to!(String)(stencilSize) ~ + ",accum r:" ~ to!(String)(accumRedSize) ~ "g:" ~ to!(String)(accumGreenSize) ~ + "b:" ~ to!(String)(accumBlueSize) ~ "a:" ~ to!(String)(accumAlphaSize) ~ + ",sampleBuffers:" ~ to!(String)(sampleBuffers) ~ ",samples:" ~ to!(String)(samples); return string; } }
--- a/dwt/printing/PrintDialog.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/printing/PrintDialog.d Mon May 05 00:42:55 2008 +0200 @@ -47,8 +47,8 @@ int index; char [] settingsData; - static const char[] ADD_IDLE_PROC_KEY = "org.eclipse.swt.internal.gtk2.addIdleProc"; - static const char[] REMOVE_IDLE_PROC_KEY = "org.eclipse.swt.internal.gtk2.removeIdleProc"; + static const String ADD_IDLE_PROC_KEY = "org.eclipse.swt.internal.gtk2.addIdleProc"; + static const String REMOVE_IDLE_PROC_KEY = "org.eclipse.swt.internal.gtk2.removeIdleProc"; /** * Constructs a new instance of this class given only its parent. @@ -353,23 +353,23 @@ store( tango.stdc.stringz.fromStringz(key).dup, tango.stdc.stringz.fromStringz(value).dup ); } -void store(char[] key, int value) { - store(key, to!(char[])(value)); +void store(String key, int value) { + store(key, to!(String)(value)); } -void store(char[] key, double value) { - store(key, to!(char[])(value)); +void store(String key, double value) { + store(key, to!(String)(value)); } -void store(char[] key, bool value) { - store(key, to!(char[])(value)); +void store(String key, bool value) { + store(key, to!(String)(value)); } -void storeBytes(char[] key, char* value) { +void storeBytes(String key, char* value) { store(key, tango.stdc.stringz.fromStringz(value).dup ); } -void store(char [] key, char[] value) { +void store(char [] key, String value) { int length = key.length + 1 + value.length + 1; if (index + length + 1 > settingsData.length) { char [] newData = new char[settingsData.length + Math.max(length + 1, 1024)];
--- a/dwt/printing/Printer.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/printing/Printer.d Mon May 05 00:42:55 2008 +0200 @@ -70,10 +70,10 @@ bool isGCCreated = false; Font systemFont; - char[] settingsData; + String settingsData; int start, end; - static const char[] GTK_LPR_BACKEND = "GtkPrintBackendLpr"; //$NON-NLS-1$ + static const String GTK_LPR_BACKEND = "GtkPrintBackendLpr"; //$NON-NLS-1$ static const bool disablePrinting = false;// System.getProperty("dwt.internal.gtk.disablePrinting") !is null; //$NON-NLS-1$ @@ -158,10 +158,10 @@ static PrinterData printerDataFromGtkPrinter(GtkPrinter* printer) { auto backend = OS.gtk_printer_get_backend(printer); auto address = OS.G_OBJECT_TYPE_NAME(backend); - char[] backendType =tango.stdc.stringz.fromStringz( address ).dup; + String backendType =tango.stdc.stringz.fromStringz( address ).dup; address = OS.gtk_printer_get_name (printer); - char[] name =tango.stdc.stringz.fromStringz( address ).dup; + String name =tango.stdc.stringz.fromStringz( address ).dup; return new PrinterData (backendType, name); } @@ -235,22 +235,22 @@ super(checkNull(data)); } -int restoreInt(char[] key) { +int restoreInt(String key) { char [] value = restoreBytes(key, false); return to!(int)( value ); } -double restoreDouble(char[] key) { +double restoreDouble(String key) { char [] value = restoreBytes(key, false); return to!(double)( value ); } -bool restoreBoolean(char[] key) { +bool restoreBoolean(String key) { char [] value = restoreBytes(key, false); return to!(bool)( value ); } -char[] restoreBytes(char[] key, bool nullTerminate) { +String restoreBytes(String key, bool nullTerminate) { //get key start = end; while (end < settingsData.length && settingsData[end] !is 0) end++; @@ -393,7 +393,7 @@ * @see #endPage * @see #endJob */ -public bool startJob(char[] jobName) { +public bool startJob(String jobName) { checkDevice(); char* buffer = tango.stdc.stringz.toStringz(jobName); printJob = OS.gtk_print_job_new (buffer, printer, settings, pageSetup);
--- a/dwt/printing/PrinterData.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/printing/PrinterData.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.printing.PrinterData; +import dwt.dwthelper.utils; + import dwt.graphics.DeviceData; @@ -46,14 +48,14 @@ * On GTK+, this is the backend type name (eg. GtkPrintBackendCups). */ // TODO: note that this api is not finalized for GTK+ - public char[] driver; + public String driver; /** * the name of the printer * On Windows systems, this is the name of the 'device'. * On Mac OSX, X/Window systems, and GTK+, this is the printer's 'name'. */ - public char[] name; + public String name; /** * the scope of the print job, expressed as one of the following values: @@ -89,7 +91,7 @@ * the name of the file to print to if printToFile is true. * Note that this field is ignored if printToFile is false. */ - public char[] fileName; + public String fileName; /** * the number of copies to print. @@ -153,7 +155,7 @@ * @see #driver * @see #name */ - public this(char[] driver, char[] name) { + public this(String driver, String name) { this.driver = driver; this.name = name; } @@ -164,7 +166,7 @@ * * @return a string representation of the receiver */ - public override char[] toString() { + public override String toString() { return Format( "PrinterData {{driver = {}, name = {}}", driver, name ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ } }
--- a/dwt/program/Program.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/program/Program.d Mon May 05 00:42:55 2008 +0200 @@ -177,9 +177,9 @@ * system. */ public final class Program { - char[] name; - char[] command; - char[] iconPath; + String name; + String command; + String iconPath; Display display; /* Gnome specific @@ -190,10 +190,10 @@ static int /*long*/ cdeShell; - static const char[][] CDE_ICON_EXT = [ ".m.pm"[], ".l.pm", ".s.pm", ".t.pm" ]; - static const char[][] CDE_MASK_EXT = [ ".m_m.bm"[], ".l_m.bm", ".s_m.bm", ".t_m.bm" ]; - static const char[] DESKTOP_DATA = "Program_DESKTOP"; - static const char[] ICON_THEME_DATA = "Program_GNOME_ICON_THEME"; + static const String[] CDE_ICON_EXT = [ ".m.pm"[], ".l.pm", ".s.pm", ".t.pm" ]; + static const String[] CDE_MASK_EXT = [ ".m_m.bm"[], ".l_m.bm", ".s_m.bm", ".t_m.bm" ]; + static const String DESKTOP_DATA = "Program_DESKTOP"; + static const String ICON_THEME_DATA = "Program_GNOME_ICON_THEME"; static const int DESKTOP_UNKNOWN = 0; static const int DESKTOP_GNOME = 1; static const int DESKTOP_GNOME_24 = 2; @@ -236,7 +236,7 @@ * our native library that depends on gnome-vfs. */ if (desktop is DESKTOP_UNKNOWN) { - char[] gnomeName = "_NET_SUPPORTING_WM_CHECK"; + String gnomeName = "_NET_SUPPORTING_WM_CHECK"; int /*long*/ gnome = OS.XInternAtom(xDisplay, gnomeName.ptr, true); if (gnome !is OS.None && gnome_init()) { desktop = DESKTOP_GNOME; @@ -257,7 +257,7 @@ } }); /* Check for libgnomevfs-2 version 2.4 */ - char[] buffer = "libgnomevfs-2.so.0"; + String buffer = "libgnomevfs-2.so.0"; auto libgnomevfs = SharedLib.load(buffer ); if (libgnomevfs !is null) { buffer = "gnome_vfs_url_show"; @@ -288,7 +288,7 @@ * applications can be queried. */ if (desktop is DESKTOP_UNKNOWN) { - char[] cdeName = "_DT_SM_PREFERENCES"; + String cdeName = "_DT_SM_PREFERENCES"; int /*long*/ cde = OS.XInternAtom(xDisplay, cdeName.ptr, true); for (int index = 0; desktop is DESKTOP_UNKNOWN && index < property.length; index++) { if (property[index] is OS.None) continue; /* do not match atoms that do not exist */ @@ -303,7 +303,7 @@ // PORTING CDE not supported /+ -bool cde_execute(char[] fileName) { +bool cde_execute(String fileName) { /* Use the character encoding for the default locale */ char* action = toStringz(command); char* ptr = cast(char*)OS.g_malloc(fileName.length+1); @@ -317,9 +317,9 @@ return actionID !is 0; } -static char[] cde_getAction(char[] dataType) { - char[] action = null; - char[] actions = cde_getAttribute(dataType, CDE.DtDTS_DA_ACTION_LIST); +static String cde_getAction(String dataType) { + String action = null; + String actions = cde_getAttribute(dataType, CDE.DtDTS_DA_ACTION_LIST); if (actions !is null) { int index = actions.indexOf("Open"); if (index !is -1) { @@ -332,7 +332,7 @@ return action; } -static char[] cde_getAttribute(char[] dataType, char[] attrName) { +static String cde_getAttribute(String dataType, String attrName) { /* Use the character encoding for the default locale */ byte[] dataTypeBuf = Converter.wcsToMbcs(null, dataType, true); byte[] attrNameBuf = Converter.wcsToMbcs(null, attrName, true); @@ -344,11 +344,11 @@ OS.memmove(attrValueBuf, attrValue, length); CDE.DtDtsFreeAttributeValue(attrValue); /* Use the character encoding for the default locale */ - return new char[](Converter.mbcsToWcs(null, attrValueBuf)); + return new String(Converter.mbcsToWcs(null, attrValueBuf)); } -static char[][][ char[] ] cde_getDataTypeInfo() { - char[][][ char[] ] dataTypeInfo; +static String[][ String ] cde_getDataTypeInfo() { + String[][ String ] dataTypeInfo; int index; int /*long*/ dataTypeList = CDE.DtDtsDataTypeNames(); if (dataTypeList !is 0) { @@ -361,13 +361,13 @@ byte[] dataTypeBuf = new byte[length]; OS.memmove(dataTypeBuf, dataType[0], length); /* Use the character encoding for the default locale */ - char[] dataTypeName = new char[](Converter.mbcsToWcs(null, dataTypeBuf)); + String dataTypeName = new String(Converter.mbcsToWcs(null, dataTypeBuf)); /* The data type is valid if it is not an action, and it has an extension and an action. */ - char[] extension = cde_getExtension(dataTypeName); + String extension = cde_getExtension(dataTypeName); if (!CDE.DtDtsDataTypeIsAction(dataTypeBuf) && extension !is null && cde_getAction(dataTypeName) !is null) { - char[][] exts; + String[] exts; exts ~= extension; dataTypeInfo[ dataTypeName ] = exts; } @@ -379,8 +379,8 @@ return dataTypeInfo; } -static char[] cde_getExtension(char[] dataType) { - char[] fileExt = cde_getAttribute(dataType, CDE.DtDTS_DA_NAME_TEMPLATE); +static String cde_getExtension(String dataType) { + String fileExt = cde_getAttribute(dataType, CDE.DtDTS_DA_NAME_TEMPLATE); if (fileExt is null || fileExt.indexOf("%s.") is -1) return null; int dot = fileExt.indexOf("."); return fileExt.substring(dot); @@ -402,15 +402,15 @@ return null; } -static char[] cde_getMimeType(char[] extension) { - char[] mimeType = null; - char[][][ char[] ] mimeInfo = cde_getDataTypeInfo(); +static String cde_getMimeType(String extension) { + String mimeType = null; + String[][ String ] mimeInfo = cde_getDataTypeInfo(); if (mimeInfo is null) return null; - char[][] keys = mimeInfo.keys(); + String[] keys = mimeInfo.keys(); int keyIdx = 0; while (mimeType is null && keyIdx < keys.length ) { - char[] type = keys[ keyIdx ]; - char[][] mimeExts = mimeInfo[type]; + String type = keys[ keyIdx ]; + String[] mimeExts = mimeInfo[type]; for (int index = 0; index < mimeExts.length; index++){ if (extension.equals(mimeExts[index])) { mimeType = type; @@ -422,7 +422,7 @@ return mimeType; } -static Program cde_getProgram(Display display, char[] mimeType) { +static Program cde_getProgram(Display display, String mimeType) { Program program = new Program(); program.display = display; program.name = mimeType; @@ -457,8 +457,8 @@ } +/ -static char[][] parseCommand(char[] cmd) { - char[][] args; +static String[] parseCommand(String cmd) { + String[] args; int sIndex = 0; int eIndex; while (sIndex < cmd.length) { @@ -495,7 +495,7 @@ } } - char[][] strings = new char[][args.length]; + String[] strings = new String[args.length]; for (int index =0; index < args.length; index++) { strings[index] = args[index]; } @@ -505,7 +505,7 @@ /** * GNOME 2.4 - Execute the program for the given file. */ -bool gnome_24_execute(char[] fileName) { +bool gnome_24_execute(String fileName) { char* mimeTypeBuffer = toStringz(name); auto ptr = GNOME.gnome_vfs_mime_get_default_application(mimeTypeBuffer); char* fileNameBuffer = toStringz(fileName); @@ -521,7 +521,7 @@ /** * GNOME 2.4 - Launch the default program for the given file. */ -static bool gnome_24_launch(char[] fileName) { +static bool gnome_24_launch(String fileName) { char* fileNameBuffer = toStringz(fileName); char* uri = GNOME.gnome_vfs_make_uri_from_input_with_dirs(fileNameBuffer, GNOME.GNOME_VFS_MAKE_URI_DIR_CURRENT); int result = GNOME.gnome_vfs_url_show(uri); @@ -532,7 +532,7 @@ /** * GNOME 2.2 - Execute the program for the given file. */ -bool gnome_execute(char[] fileName) { +bool gnome_execute(String fileName) { if (gnomeExpectUri) { /* Convert the given path into a URL */ char* fileNameBuffer = toStringz(fileName); @@ -544,13 +544,13 @@ } /* Parse the command into its individual arguments. */ - char[][] args = parseCommand(command); + String[] args = parseCommand(command); int fileArg = -1; int index; for (index = 0; index < args.length; index++) { int j = args[index].indexOf("%f"); if (j !is -1) { - char[] value = args[index]; + String value = args[index]; fileArg = index; args[index] = value.substring(0, j) ~ fileName ~ value.substring(j + 2); } @@ -558,7 +558,7 @@ /* If a file name was given but the command did not have "%f" */ if ((fileName.length > 0) && (fileArg < 0)) { - char[][] newArgs = new char[][args.length + 1]; + String[] newArgs = new String[args.length + 1]; for (index = 0; index < args.length; index++) newArgs[index] = args[index]; newArgs[args.length] = fileName; args = newArgs; @@ -589,11 +589,11 @@ + DWT Extension + This is a temporary workaround until SWT will get the real implementation. +/ -static char[][][ char[] ] gnome24_getMimeInfo() { +static String[][ String ] gnome24_getMimeInfo() { scope file = new FileConduit ("/usr/share/mime/globs"); scope it = new LineIterator!(char)(file); // process file one line at a time - char[][][ char[] ] mimeInfo; + String[][ String ] mimeInfo; foreach (line; it ){ int colon = line.indexOf(':'); if( colon is line.length ){ @@ -602,8 +602,8 @@ if( line.length < colon+3 || line[colon+1 .. colon+3 ] != "*." ){ continue; } - char[] mimeType = line[0..colon].dup; - char[] ext = line[colon+3 .. $].dup; + String mimeType = line[0..colon].dup; + String ext = line[colon+3 .. $].dup; if( auto exts = mimeType in mimeInfo ){ mimeInfo[ mimeType ] = *exts ~ ext; } @@ -621,22 +621,22 @@ * in the map is the mime type name. The value is * a vector of the associated file extensions. */ -static char[][][ char[] ] gnome_getMimeInfo() { - char[][][ char[] ] mimeInfo; +static String[][ String ] gnome_getMimeInfo() { + String[][ String ] mimeInfo; GList* mimeList = GNOME.gnome_vfs_get_registered_mime_types(); GList* mimeElement = mimeList; while (mimeElement !is null) { char* mimePtr = cast(char*) OS.g_list_data(mimeElement); - char[] mimeTypeBuffer = fromStringz(mimePtr).dup; - char[] mimeType = mimeTypeBuffer;//new char[](Converter.mbcsToWcs(null, mimeTypeBuffer)); + String mimeTypeBuffer = fromStringz(mimePtr).dup; + String mimeType = mimeTypeBuffer;//new String(Converter.mbcsToWcs(null, mimeTypeBuffer)); GList* extensionList = GNOME.gnome_vfs_mime_get_extensions_list(mimePtr); if (extensionList !is null) { - char[][] extensions; + String[] extensions; GList* extensionElement = extensionList; while (extensionElement !is null) { char* extensionPtr = cast(char*) OS.g_list_data(extensionElement); - char[] extensionBuffer = fromStringz(extensionPtr).dup; - char[] extension = extensionBuffer; + String extensionBuffer = fromStringz(extensionPtr).dup; + String extension = extensionBuffer; extension = '.' ~ extension; extensions ~= extension; extensionElement = OS.g_list_next(extensionElement); @@ -650,9 +650,9 @@ return mimeInfo; } -static char[] gnome_getMimeType(char[] extension) { - char[] mimeType = null; - char[] fileName = "swt" ~ extension; +static String gnome_getMimeType(String extension) { + String mimeType = null; + String fileName = "swt" ~ extension; char* extensionBuffer = toStringz(fileName); char* typeName = GNOME.gnome_vfs_mime_type_from_name(extensionBuffer); if (typeName !is null) { @@ -661,7 +661,7 @@ return mimeType; } -static Program gnome_getProgram(Display display, char[] mimeType) { +static Program gnome_getProgram(Display display, String mimeType) { Program program = null; char* mimeTypeBuffer = toStringz(mimeType); GnomeVFSMimeApplication* ptr = GNOME.gnome_vfs_mime_get_default_application(mimeTypeBuffer); @@ -670,7 +670,7 @@ program.display = display; program.name = mimeType; GnomeVFSMimeApplication* application = ptr; - char[] buffer = fromStringz(application.command).dup; + String buffer = fromStringz(application.command).dup; program.command = buffer; program.gnomeExpectUri = application.expects_uris is GNOME.GNOME_VFS_MIME_APPLICATION_ARGUMENT_TYPE_URIS; @@ -707,7 +707,7 @@ * <li>ERROR_NULL_ARGUMENT when extension is null</li> * </ul> */ -public static Program findProgram(char[] extension) { +public static Program findProgram(String extension) { return findProgram(Display.getCurrent(), extension); } @@ -715,12 +715,12 @@ * API: When support for multiple displays is added, this method will * become public and the original method above can be deprecated. */ -static Program findProgram(Display display, char[] extension) { +static Program findProgram(Display display, String extension) { if (extension is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); if (extension.length is 0) return null; if (extension.charAt(0) !is '.') extension = "." ~ extension; int desktop = getDesktop(display); - char[] mimeType = null; + String mimeType = null; switch (desktop) { case DESKTOP_GNOME_24: case DESKTOP_GNOME: mimeType = gnome_getMimeType(extension); break; @@ -745,7 +745,7 @@ * * @return an array of extensions */ -public static char[][] getExtensions() { +public static String[] getExtensions() { return getExtensions(Display.getCurrent()); } @@ -753,9 +753,9 @@ * API: When support for multiple displays is added, this method will * become public and the original method above can be deprecated. */ -static char[][] getExtensions(Display display) { +static String[] getExtensions(Display display) { int desktop = getDesktop(display); - char[][][ char[] ] mimeInfo = null; + String[][ String ] mimeInfo = null; switch (desktop) { case DESKTOP_GNOME_24: mimeInfo = gnome24_getMimeInfo(); break; case DESKTOP_GNOME: mimeInfo = gnome_getMimeInfo(); break; @@ -765,12 +765,12 @@ if (mimeInfo is null) return null; /* Create a unique set of the file extensions. */ - char[][] extensions; - char[][] keys = mimeInfo.keys; + String[] extensions; + String[] keys = mimeInfo.keys; int keyIdx = 0; while ( keyIdx < keys.length ) { - char[] mimeType = keys[ keyIdx ]; - char[][] mimeExts = mimeInfo[mimeType]; + String mimeType = keys[ keyIdx ]; + String[] mimeExts = mimeInfo[mimeType]; for (int index = 0; index < mimeExts.length; index++){ if (!extensions.contains(mimeExts[index])) { extensions ~= mimeExts[index]; @@ -780,7 +780,7 @@ } /* Return the list of extensions. */ - char[][] extStrings = new char[][]( extensions.length ); + String[] extStrings = new String[]( extensions.length ); for (int index = 0; index < extensions.length; index++) { extStrings[index] = extensions[index]; } @@ -804,7 +804,7 @@ */ static Program[] getPrograms(Display display) { int desktop = getDesktop(display); - char[][][ char[] ] mimeInfo = null; + String[][ String ] mimeInfo = null; switch (desktop) { case DESKTOP_GNOME_24: break; case DESKTOP_GNOME: mimeInfo = gnome_getMimeInfo(); break; @@ -813,10 +813,10 @@ } if (mimeInfo is null) return new Program[0]; Program[] programs; - char[][] keys = mimeInfo.keys; + String[] keys = mimeInfo.keys; int keyIdx = 0; while ( keyIdx < keys.length ) { - char[] mimeType = keys[ keyIdx ]; + String mimeType = keys[ keyIdx ]; Program program = null; switch (desktop) { case DESKTOP_GNOME: program = gnome_getProgram(display, mimeType); break; @@ -847,7 +847,7 @@ * <li>ERROR_NULL_ARGUMENT when fileName is null</li> * </ul> */ -public static bool launch(char[] fileName) { +public static bool launch(String fileName) { return launch(Display.getCurrent(), fileName); } @@ -855,7 +855,7 @@ * API: When support for multiple displays is added, this method will * become public and the original method above can be deprecated. */ -static bool launch(Display display, char[] fileName) { +static bool launch(Display display, String fileName) { if (fileName is null) DWT.error (DWT.ERROR_NULL_ARGUMENT); switch(getDesktop(display)) { case DESKTOP_GNOME_24: @@ -863,7 +863,7 @@ default: int index = fileName.lastIndexOf('.'); if (index !is -1) { - char[] extension = fileName.substring (index); + String extension = fileName.substring (index); Program program = Program.findProgram (display, extension); if (program !is null && program.execute (fileName)) return true; } @@ -907,7 +907,7 @@ * <li>ERROR_NULL_ARGUMENT when fileName is null</li> * </ul> */ -public bool execute(char[] fileName) { +public bool execute(String fileName) { if (fileName is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); int desktop = getDesktop(display); switch (desktop) { @@ -944,7 +944,7 @@ * * @return the name of the program */ -public char[] getName() { +public String getName() { return name; } @@ -968,7 +968,7 @@ * * @return a string representation of the program */ -public char[] toString() { +public String toString() { return Format( "Program {{{}}", name ); } }
--- a/dwt/widgets/Button.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/widgets/Button.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.widgets.Button; +import dwt.dwthelper.utils; + import dwt.widgets.Control; import dwt.internal.gtk.OS; @@ -62,7 +64,7 @@ bool selected; ImageList imageList; Image image; - char[] text; + String text; /** * Constructs a new instance of this class given its parent @@ -326,7 +328,7 @@ return image; } -override char[] getNameText () { +override String getNameText () { return getText (); } @@ -364,7 +366,7 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ -public char[] getText () { +public String getText () { checkWidget(); if ((style & DWT.ARROW) !is 0) return ""; return text; @@ -753,7 +755,7 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ -public void setText (char[] string) { +public void setText (String string) { checkWidget (); if (string is null) error (DWT.ERROR_NULL_ARGUMENT); if ((style & DWT.ARROW) !is 0) return;
--- a/dwt/widgets/Combo.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/widgets/Combo.d Mon May 05 00:42:55 2008 +0200 @@ -79,7 +79,7 @@ int lastEventTime, visibleCount = 5; GdkEventKey* gdkEventKey; int fixStart = -1, fixEnd = -1; - char[][] items; + String[] items; bool ignoreSelect, lockText; static const int INNER_BORDER = 2; @@ -148,7 +148,7 @@ * * @see #add(String,int) */ -public void add (char[] string) { +public void add (String string) { checkWidget(); if (string is null) error (DWT.ERROR_NULL_ARGUMENT); add (string, items.length); @@ -177,13 +177,13 @@ * * @see #add(String) */ -public void add (char[] string, int index) { +public void add (String string, int index) { checkWidget(); if (string is null) error (DWT.ERROR_NULL_ARGUMENT); if (!(0 <= index && index <= items.length)) { error (DWT.ERROR_INVALID_RANGE); } - char[] [] newItems = new char[][]( items.length + 1 ); + String [] newItems = new String[]( items.length + 1 ); System.arraycopy (items, 0, newItems, 0, index); newItems [index] = string; System.arraycopy (items, index, newItems, index + 1, items.length - index); @@ -774,7 +774,7 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ -public char[] getItem (int index) { +public String getItem (int index) { checkWidget(); if (!(0 <= index && index < items.length)) { error (DWT.ERROR_INVALID_RANGE); @@ -829,9 +829,9 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ -public char[] [] getItems () { +public String [] getItems () { checkWidget(); - char[] [] result = new char[][](items.length); + String [] result = new String[](items.length); System.arraycopy (items, 0, result, 0, items.length); return result; } @@ -937,7 +937,7 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ -public char[] getText () { +public String getText () { checkWidget(); if (entryHandle !is null) { auto str = OS.gtk_entry_get_text (entryHandle); @@ -949,7 +949,7 @@ } } -char[] getText (int start, int stop) { +String getText (int start, int stop) { /* * NOTE: The current implementation uses substring () * which can reference a potentially large character @@ -1048,7 +1048,7 @@ } else { if (!ignoreSelect) { auto ptr = OS.gtk_entry_get_text (entryHandle); - char[] text = fromStringz(ptr).dup; + String text = fromStringz(ptr).dup; for (int i = 0; i < items.length; i++) { if (items [i] ==/*eq*/ text) { postEvent (DWT.Selection); @@ -1125,7 +1125,7 @@ return 0; } if (!hooks (DWT.Verify) && !filters (DWT.Verify)) return 0; - char[] newText = verifyText ("", cast(int)/*64*/start_pos, cast(int)/*64*/end_pos); + String newText = verifyText ("", cast(int)/*64*/start_pos, cast(int)/*64*/end_pos); if (newText is null) { OS.g_signal_stop_emission_by_name (entryHandle, OS.delete_text.ptr); } else { @@ -1156,14 +1156,14 @@ } if (!hooks (DWT.Verify) && !filters (DWT.Verify)) return 0; if (new_text is null || new_text_length is 0) return 0; - char[] oldText = new_text[0..new_text_length]; + String oldText = new_text[0..new_text_length]; int pos; pos = position; if (pos is -1) { auto ptr = OS.gtk_entry_get_text (entryHandle); pos = fromStringz(ptr).length; } - char[] newText = verifyText (oldText, pos, pos); + String newText = verifyText (oldText, pos, pos); if (newText !is oldText) { int newStart, newEnd; OS.gtk_editable_get_selection_bounds (entryHandle, &newStart, &newEnd); @@ -1216,7 +1216,7 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ -public int indexOf (char[] string) { +public int indexOf (String string) { checkWidget(); return indexOf (string, 0); } @@ -1240,7 +1240,7 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ -public int indexOf (char[] string, int start) { +public int indexOf (String string, int start) { checkWidget(); if (string is null) error (DWT.ERROR_NULL_ARGUMENT); if (!(0 <= start && start < items.length)) return -1; @@ -1325,8 +1325,8 @@ if (!(0 <= index && index < items.length)) { error (DWT.ERROR_INVALID_RANGE); } - char[] [] oldItems = items; - char[] [] newItems = new char[][]( oldItems.length - 1 ); + String [] oldItems = items; + String [] newItems = new String[]( oldItems.length - 1 ); System.arraycopy (oldItems, 0, newItems, 0, index); System.arraycopy (oldItems, index + 1, newItems, index, oldItems.length - index - 1); items = newItems; @@ -1371,8 +1371,8 @@ if (!(0 <= start && start <= end && end < items.length)) { error (DWT.ERROR_INVALID_RANGE); } - char[] [] oldItems = items; - char[] [] newItems = new char[][](oldItems.length - (end - start + 1)); + String [] oldItems = items; + String [] newItems = new String[](oldItems.length - (end - start + 1)); System.arraycopy (oldItems, 0, newItems, 0, start); System.arraycopy (oldItems, end + 1, newItems, start, oldItems.length - end - 1); items = newItems; @@ -1418,7 +1418,7 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ -public void remove (char[] string) { +public void remove (String string) { checkWidget(); if (string is null) error (DWT.ERROR_NULL_ARGUMENT); int index = indexOf (string, 0); @@ -1641,7 +1641,7 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ -public void setItem (int index, char[] string) { +public void setItem (int index, String string) { checkWidget(); if (string is null) error (DWT.ERROR_NULL_ARGUMENT); if (!(0 <= index && index < items.length)) { @@ -1677,14 +1677,14 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ -public void setItems (char[] [] items) { +public void setItems (String [] items) { checkWidget(); if (items is null) error (DWT.ERROR_NULL_ARGUMENT); for (int i=0; i<items.length; i++) { if (items [i] is null) error (DWT.ERROR_INVALID_ARGUMENT); } int count = this.items.length; - this.items = new char[][](items.length); + this.items = new String[](items.length); System.arraycopy (items, 0, this.items, 0, items.length); if (OS.GTK_VERSION >= OS.buildVERSION (2, 4, 0)) { clearText (); @@ -1692,7 +1692,7 @@ OS.gtk_combo_box_remove_text (handle, i); } for (int i = 0; i < items.length; i++) { - char[] string = items [i]; + String string = items [i]; char* buffer = toStringz(string); OS.gtk_combo_box_insert_text (handle, i, buffer); } @@ -1704,7 +1704,7 @@ int direction = OS.gtk_widget_get_direction (handle); int i = 0; while (i < items.length) { - char[] string = items [i]; + String string = items [i]; char * buffer = toStringz(string); auto item = OS.gtk_list_item_new_with_label (buffer); auto label = OS.gtk_bin_get_child (item); @@ -1824,7 +1824,7 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ -public void setText (char[] string) { +public void setText (String string) { checkWidget(); if (string is null) error (DWT.ERROR_NULL_ARGUMENT); if ((style & DWT.READ_ONLY) !is 0) { @@ -1890,7 +1890,7 @@ if (entryHandle !is null) OS.gtk_entry_set_max_length (entryHandle, limit); } -override void setToolTipText (Shell shell, char[] newString) { +override void setToolTipText (Shell shell, String newString) { if (entryHandle !is null) shell.setToolTipText (entryHandle, newString); if (buttonHandle !is null) shell.setToolTipText (buttonHandle, newString); } @@ -1939,7 +1939,7 @@ return super.translateTraversal (keyEvent); } -char[] verifyText (char[] string, int start, int end) { +String verifyText (String string, int start, int end) { if (string.length is 0 && start is end) return null; Event event = new Event (); event.text = string;
--- a/dwt/widgets/Composite.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/widgets/Composite.d Mon May 05 00:42:55 2008 +0200 @@ -81,7 +81,7 @@ Control[] tabList; int layoutCount, backgroundMode; - static const char[] NO_INPUT_METHOD = "dwt.internal.gtk.noInputMethod"; //$NON-NLS-1$ + static const String NO_INPUT_METHOD = "dwt.internal.gtk.noInputMethod"; //$NON-NLS-1$ this () { /* Do nothing */
--- a/dwt/widgets/Control.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/widgets/Control.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.widgets.Control; +import dwt.dwthelper.utils; + import dwt.DWT; //import dwt.accessibility.Accessible; @@ -94,7 +96,7 @@ Menu menu; Image backgroundImage; Font font; - char[] toolTipText; + String toolTipText; Object layoutData; Accessible accessible; @@ -2311,7 +2313,7 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ -public char[] getToolTipText () { +public String getToolTipText () { checkWidget(); return toolTipText; } @@ -3196,7 +3198,7 @@ auto style = OS.gtk_widget_get_modifier_style (handle); auto ptr = OS.gtk_rc_style_get_bg_pixmap_name (style, index); if (ptr !is null) OS.g_free (ptr); - char[] name = color is null ? "<parent>" : "<none>" ; + String name = color is null ? "<parent>" : "<none>" ; ptr = cast(char*)OS.g_malloc (name.length+1); ptr[ 0 .. name.length ] = name; ptr[ name.length ] = '\0'; @@ -3714,13 +3716,13 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ -public void setToolTipText (char[] str) { +public void setToolTipText (String str) { checkWidget(); setToolTipText (_getShell (), str); toolTipText = str; } -void setToolTipText (Shell shell, char[] newString) { +void setToolTipText (Shell shell, String newString) { shell.setToolTipText (eventHandle (), newString); }
--- a/dwt/widgets/DateTime.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/widgets/DateTime.d Mon May 05 00:42:55 2008 +0200 @@ -278,8 +278,8 @@ private class DateFormatSymbols { - private const char[][] ampm = [ "AM"[], "PM" ]; - char[][] getAmPmStrings(){ + private const String[] ampm = [ "AM"[], "PM" ]; + String[] getAmPmStrings(){ return ampm; } } @@ -381,17 +381,17 @@ DateFormatSymbols formatSymbols; Button down, up; Text text; - char[] format; + String format; Point[] fieldIndices; int[] fieldNames; int fieldCount, currentField = 0, characterCount = 0; bool ignoreVerify = false; - static const char[] DEFAULT_SHORT_DATE_FORMAT = "MM/YYYY"; - static const char[] DEFAULT_MEDIUM_DATE_FORMAT = "MM/DD/YYYY"; - static const char[] DEFAULT_LONG_DATE_FORMAT = "MM/DD/YYYY"; - static const char[] DEFAULT_SHORT_TIME_FORMAT = "HH:MM AM"; - static const char[] DEFAULT_MEDIUM_TIME_FORMAT = "HH:MM:SS AM"; - static const char[] DEFAULT_LONG_TIME_FORMAT = "HH:MM:SS AM"; + static const String DEFAULT_SHORT_DATE_FORMAT = "MM/YYYY"; + static const String DEFAULT_MEDIUM_DATE_FORMAT = "MM/DD/YYYY"; + static const String DEFAULT_LONG_DATE_FORMAT = "MM/DD/YYYY"; + static const String DEFAULT_SHORT_TIME_FORMAT = "HH:MM AM"; + static const String DEFAULT_MEDIUM_TIME_FORMAT = "HH:MM:SS AM"; + static const String DEFAULT_LONG_TIME_FORMAT = "HH:MM:SS AM"; @@ -591,7 +591,7 @@ int fieldName = fieldNames[currentField]; int start = fieldIndices[currentField].x; int end = fieldIndices[currentField].y; - char[] value = text.getText(start, end - 1); + String value = text.getText(start, end - 1); int s = value.lastIndexOf(' '); if (s !is -1) value = value.substring(s + 1); int newValue = unformattedIntValue(fieldName, value, characterCount is 0, calendar.getActualMaximum(fieldName)); @@ -599,23 +599,23 @@ } } -char[] formattedStringValue(int fieldName, int value, bool adjust) { +String formattedStringValue(int fieldName, int value, bool adjust) { if (fieldName is Calendar.AM_PM) { - char[][] ampm = formatSymbols.getAmPmStrings(); + String[] ampm = formatSymbols.getAmPmStrings(); return ampm[value]; } if (adjust) { if (fieldName is Calendar.HOUR && value is 0) { - return to!(char[])(12); + return to!(String)(12); } if (fieldName is Calendar.MONTH) { - return to!(char[])(value + 1); + return to!(String)(value + 1); } } - return to!(char[])(value); + return to!(String)(value); } -char[] getComputeSizeString(int style) { +String getComputeSizeString(int style) { if ((style & DWT.DATE) !is 0) { return (style & DWT.SHORT) !is 0 ? DEFAULT_SHORT_DATE_FORMAT : (style & DWT.LONG) !is 0 ? DEFAULT_LONG_DATE_FORMAT : DEFAULT_MEDIUM_DATE_FORMAT; } @@ -632,22 +632,22 @@ return -1; } -char[] getFormattedString(int style) { +String getFormattedString(int style) { if ((style & DWT.TIME) !is 0) { - char[][] ampm = formatSymbols.getAmPmStrings(); + String[] ampm = formatSymbols.getAmPmStrings(); int h = calendar.get(Calendar.HOUR); if (h is 0) h = 12; int m = calendar.get(Calendar.MINUTE); int s = calendar.get(Calendar.SECOND); int a = calendar.get(Calendar.AM_PM); - if ((style & DWT.SHORT) !is 0) return "" ~ (h < 10 ? " " : "") ~ to!(char[])(h) ~ ":" ~ (m < 10 ? " " : "") ~ to!(char[])(m) ~ " " ~ ampm[a]; - return "" ~ (h < 10 ? " " : "") ~ to!(char[])(h) ~ ":" ~ (m < 10 ? " " : "") ~ to!(char[])(m) ~ ":" ~ (s < 10 ? " " : "") ~ to!(char[])(s) ~ " " ~ ampm[a]; + if ((style & DWT.SHORT) !is 0) return "" ~ (h < 10 ? " " : "") ~ to!(String)(h) ~ ":" ~ (m < 10 ? " " : "") ~ to!(String)(m) ~ " " ~ ampm[a]; + return "" ~ (h < 10 ? " " : "") ~ to!(String)(h) ~ ":" ~ (m < 10 ? " " : "") ~ to!(String)(m) ~ ":" ~ (s < 10 ? " " : "") ~ to!(String)(s) ~ " " ~ ampm[a]; } /* DWT.DATE */ int y = calendar.get(Calendar.YEAR); int m = calendar.get(Calendar.MONTH) + 1; int d = calendar.get(Calendar.DAY_OF_MONTH); - if ((style & DWT.SHORT) !is 0) return "" ~ (m < 10 ? " " : "") ~ to!(char[])(m) ~ "/" ~ to!(char[])(y); - return "" ~ (m < 10 ? " " : "") ~ to!(char[])(m) ~ "/" ~ (d < 10 ? " " : "") ~ to!(char[])(d) ~ "/" ~ to!(char[])(y); + if ((style & DWT.SHORT) !is 0) return "" ~ (m < 10 ? " " : "") ~ to!(String)(m) ~ "/" ~ to!(String)(y); + return "" ~ (m < 10 ? " " : "") ~ to!(String)(m) ~ "/" ~ (d < 10 ? " " : "") ~ to!(String)(d) ~ "/" ~ to!(String)(y); } void getDate() { @@ -930,9 +930,9 @@ int start = fieldIndices[currentField].x; int end = fieldIndices[currentField].y; int length_ = end - start; - char[] newText = event.text; + String newText = event.text; if (fieldName is Calendar.AM_PM) { - char[][] ampm = formatSymbols.getAmPmStrings(); + String[] ampm = formatSymbols.getAmPmStrings(); if (newText.equalsIgnoreCase(ampm[Calendar.AM].substring(0, 1)) || newText.equalsIgnoreCase(ampm[Calendar.AM])) { setTextField(fieldName, Calendar.AM, true, false); } else if (newText.equalsIgnoreCase(ampm[Calendar.PM].substring(0, 1)) || newText.equalsIgnoreCase(ampm[Calendar.PM])) { @@ -946,7 +946,7 @@ } catch (ConversionException ex) { return; } - char[] value = text.getText(start, end - 1); + String value = text.getText(start, end - 1); int s = value.lastIndexOf(' '); if (s !is -1) value = value.substring(s + 1); newText = value ~ newText; @@ -1025,7 +1025,7 @@ } public void run() { if (!text.isDisposed()) { - char[] value = text.getText(start, end - 1); + String value = text.getText(start, end - 1); int s = value.lastIndexOf(' '); if (s is -1 ) s = start; else s = start + s + 1; @@ -1070,7 +1070,7 @@ if (text !is null) text.setForeground(color); } -/*public*/ void setFormat(char[] string) { +/*public*/ void setFormat(String string) { checkWidget(); // TODO: this needs to be locale sensitive fieldCount = (style & DWT.DATE) !is 0 ? ((style & DWT.SHORT) !is 0 ? 2 : 3) : ((style & DWT.SHORT) !is 0 ? 3 : 4); @@ -1133,7 +1133,7 @@ int start = fieldIndices[currentField].x; int end = fieldIndices[currentField].y; text.setSelection(start, end); - char[] newValue = formattedStringValue(fieldName, value, adjust); + String newValue = formattedStringValue(fieldName, value, adjust); TangoText buffer = new TangoText(newValue); /* Convert leading 0's into spaces. */ int prependCount = end - start - buffer.length(); @@ -1296,7 +1296,7 @@ } } -int unformattedIntValue(int fieldName, char[] newText, bool adjust, int max) { +int unformattedIntValue(int fieldName, String newText, bool adjust, int max) { int newValue; try { newValue = to!(int)(newText); @@ -1315,7 +1315,7 @@ public void updateControl() { if (text !is null) { - char[] string = getFormattedString(style); + String string = getFormattedString(style); ignoreVerify = true; text.setText(string); ignoreVerify = false;
--- a/dwt/widgets/Decorations.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/widgets/Decorations.d Mon May 05 00:42:55 2008 +0200 @@ -109,7 +109,7 @@ alias Canvas.sort sort; - char[] text; + String text; Image image; Image [] images; bool minimized, maximized; @@ -426,7 +426,7 @@ return minimized; } -override char[] getNameText () { +override String getNameText () { return getText (); } @@ -443,7 +443,7 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ -public char[] getText () { +public String getText () { checkWidget(); return text; } @@ -717,7 +717,7 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ -public void setText (char[] string) { +public void setText (String string) { checkWidget(); if (string is null) error (DWT.ERROR_NULL_ARGUMENT); text = string;
--- a/dwt/widgets/Dialog.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/widgets/Dialog.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.widgets.Dialog; +import dwt.dwthelper.utils; + import dwt.DWT; import dwt.DWTException; @@ -81,7 +83,7 @@ public abstract class Dialog { int style; Shell parent; - char[] title; + String title; /** * Constructs a new instance of this class given only its @@ -228,7 +230,7 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ -public char[] getText () { +public String getText () { return title; } @@ -247,7 +249,7 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ -public void setText (char[] string) { +public void setText (String string) { if (string is null) error (DWT.ERROR_NULL_ARGUMENT); title = string; }
--- a/dwt/widgets/DirectoryDialog.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/widgets/DirectoryDialog.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.widgets.DirectoryDialog; +import dwt.dwthelper.utils; + import dwt.DWT; @@ -40,8 +42,8 @@ * </p> */ public class DirectoryDialog : Dialog { - char[] message = "", filterPath = ""; - static const char[] SEPARATOR = tango.io.FileConst.FileConst.PathSeparatorString;; + String message = "", filterPath = ""; + static const String SEPARATOR = tango.io.FileConst.FileConst.PathSeparatorString;; /** * Constructs a new instance of this class given only its parent. @@ -95,7 +97,7 @@ * * @see #setFilterPath */ -public char[] getFilterPath () { +public String getFilterPath () { return filterPath; } /** @@ -105,7 +107,7 @@ * * @return the message */ -public char[] getMessage () { +public String getMessage () { return message; } /** @@ -120,7 +122,7 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the dialog</li> * </ul> */ -public char[] open () { +public String open () { bool useChooserDialog = OS.GTK_VERSION >= OS.buildVERSION (2, 4, 10); if (useChooserDialog) { return openChooserDialog (); @@ -128,7 +130,7 @@ return openClassicDialog (); } } -char[] openChooserDialog () { +String openChooserDialog () { char* titleBytes = tango.stdc.stringz.toStringz(title); auto shellHandle = parent.topHandle (); auto handle = OS.gtk_file_chooser_dialog_new2 ( @@ -143,7 +145,7 @@ OS.g_list_free (pixbufs); } if (filterPath !is null && filterPath.length > 0) { - char[] p; + String p; /* filename must be a full path */ if ( filterPath[ 0 .. SEPARATOR.length ] != SEPARATOR ) { p ~= SEPARATOR; @@ -166,7 +168,7 @@ OS.gtk_label_set_justify (label, OS.GTK_JUSTIFY_CENTER); OS.gtk_file_chooser_set_extra_widget (handle, box); } - char[] answer = null; + String answer = null; Display display = parent !is null ? parent.getDisplay (): Display.getCurrent (); display.addIdleProc (); int response = OS.gtk_dialog_run (handle); @@ -187,7 +189,7 @@ OS.gtk_widget_destroy (handle); return answer; } -char[] openClassicDialog () { +String openClassicDialog () { char* titleBytes = tango.stdc.stringz.toStringz(title); auto handle = OS.gtk_file_selection_new (titleBytes); if (parent !is null) { @@ -199,9 +201,9 @@ OS.g_list_free (pixbufs); } } - char[] answer = null; + String answer = null; if (filterPath !is null) { - char[] path = filterPath; + String path = filterPath; if (path.length > 0 && path[ $-1 .. $ ] != SEPARATOR ) { path ~= SEPARATOR; } @@ -231,7 +233,7 @@ uint items_written; char* utf8Ptr = OS.g_filename_to_utf8 (fileNamePtr, -1, null, &items_written, null); if (utf8Ptr !is null) { - char[] osAnswer = utf8Ptr[ 0 .. items_written ]; + String osAnswer = utf8Ptr[ 0 .. items_written ]; if (osAnswer.length !is 0) { /* remove trailing separator, unless root directory */ if ( osAnswer != SEPARATOR && osAnswer[ $-1 .. $ ] == SEPARATOR ) { @@ -259,7 +261,7 @@ * * @param string the filter path */ -public void setFilterPath (char[] string) { +public void setFilterPath (String string) { filterPath = string.dup; } /** @@ -273,7 +275,7 @@ * <li>ERROR_NULL_ARGUMENT - if the string is null</li> * </ul> */ -public void setMessage (char[] string) { +public void setMessage (String string) { if (string is null) error (DWT.ERROR_NULL_ARGUMENT); message = string.dup; }
--- a/dwt/widgets/Display.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/widgets/Display.d Mon May 05 00:42:55 2008 +0200 @@ -144,9 +144,9 @@ CallbackData filterProcCallbackData; EventTable eventTable, filterTable; - static char[] APP_NAME = "DWT"; - static const char[] DISPATCH_EVENT_KEY = "dwt.internal.gtk.dispatchEvent"; - static const char[] ADD_WIDGET_KEY = "dwt.internal.addWidget"; + static String APP_NAME = "DWT"; + static const String DISPATCH_EVENT_KEY = "dwt.internal.gtk.dispatchEvent"; + static const String ADD_WIDGET_KEY = "dwt.internal.addWidget"; GClosure*[] closures; int [] signalIds; @@ -212,8 +212,8 @@ /* Idle proc callback */ CallbackData idleProcCallbackData; int idleHandle; - static const char[] ADD_IDLE_PROC_KEY = "dwt.internal.gtk2.addIdleProc"; - static const char[] REMOVE_IDLE_PROC_KEY = "dwt.internal.gtk2.removeIdleProc"; + static const String ADD_IDLE_PROC_KEY = "dwt.internal.gtk2.addIdleProc"; + static const String REMOVE_IDLE_PROC_KEY = "dwt.internal.gtk2.removeIdleProc"; Object idleLock; bool idleNeeded; @@ -381,12 +381,12 @@ static Display [] Displays; /* Package name */ - static const char[] PACKAGE_PREFIX = "dwt.widgets."; + static const String PACKAGE_PREFIX = "dwt.widgets."; /* This code is intentionally commented. * ".class" can not be used on CLDC. */ // static { -// char[] name = Display.class.getName (); +// String name = Display.class.getName (); // int index = name.lastIndexOf ('.'); // PACKAGE_NAME = name.substring (0, index + 1); // } @@ -412,7 +412,7 @@ /* Display Data */ Object data; - char[] [] keys; + String [] keys; Object [] values; /* Initial Guesses for Shell Trimmings. */ @@ -424,7 +424,7 @@ bool ignoreTrim; /* Window Manager */ - char[] windowManager; + String windowManager; /* * TEMPORARY CODE. Install the runnable that @@ -983,9 +983,9 @@ OS.gdk_window_remove_filter(window, &filterProcFunc, cbdata ); } -Image createImage (char[] name) { +Image createImage (String name) { auto style = OS.gtk_widget_get_default_style (); - char[] buffer = name; + String buffer = name; auto pixbuf = OS.gtk_icon_set_render_icon ( OS.gtk_icon_factory_lookup_default (buffer.ptr), style, OS.GTK_TEXT_DIR_NONE, @@ -1584,7 +1584,7 @@ * @see #setData(String, Object) * @see #disposeExec(Runnable) */ -public Object getData (char[] key) { +public Object getData (String key) { checkDevice (); if (key is null) error (DWT.ERROR_NULL_ARGUMENT); if (key ==/*eq*/ DISPATCH_EVENT_KEY) { @@ -1673,7 +1673,7 @@ } // /+static bool isValidClass (Class clazz) { -// //PORTING_TODO char[] name = clazz.getName (); +// //PORTING_TODO String name = clazz.getName (); // //PORTING_TODO int index = name.lastIndexOf ('.'); // //PORTING_TODO return name.substring (0, index + 1)==/*eq*/ PACKAGE_PREFIX; // return true; @@ -3369,7 +3369,7 @@ * * @param name the new app name or <code>null</code> */ -public static void setAppName (char[] name) { +public static void setAppName (String name) { APP_NAME = name; } @@ -3443,7 +3443,7 @@ * @see #getData(String) * @see #disposeExec(Runnable) */ -public void setData (char[] key, Object value) { +public void setData (String key, Object value) { checkDevice (); if (key is null) error (DWT.ERROR_NULL_ARGUMENT); @@ -3488,7 +3488,7 @@ keys = null; values = null; } else { - char[] [] newKeys = new char[] [keys.length - 1]; + String [] newKeys = new String [keys.length - 1]; Object [] newValues = new Object [values.length - 1]; System.arraycopy (keys, 0, newKeys, 0, index); System.arraycopy (keys, index + 1, newKeys, index, newKeys.length - index); @@ -3512,7 +3512,7 @@ return; } } - char[] [] newKeys = new char[] [keys.length + 1]; + String [] newKeys = new String [keys.length + 1]; Object [] newValues = new Object [values.length + 1]; System.arraycopy (keys, 0, newKeys, 0, keys.length); System.arraycopy (values, 0, newValues, 0, values.length);
--- a/dwt/widgets/Event.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/widgets/Event.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.widgets.Event; +import dwt.dwthelper.utils; + import dwt.graphics.GC; import dwt.graphics.Rectangle; @@ -180,7 +182,7 @@ * Setting this field will change the text that is about to * be inserted or deleted. */ - public char[] text; + public String text; /** * depending on the event, a flag indicating whether the operation @@ -221,7 +223,7 @@ * * @return a string representation of the event */ -public override char[] toString () { +public override String toString () { return Format( "Event {{type={} {} time={} data={} x={} y={} width={} height={} detail={}}", type, widget, time, data, x, y, width, height, detail ); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ }
--- a/dwt/widgets/ExpandItem.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/widgets/ExpandItem.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.widgets.ExpandItem; +import dwt.dwthelper.utils; + import dwt.DWT; import dwt.DWTException; @@ -594,7 +596,7 @@ } } -public override void setText (char[] string) { +public override void setText (String string) { super.setText (string); if (OS.GTK_VERSION >= OS.buildVERSION (2, 4, 0)) { OS.gtk_label_set_text (labelHandle, tango.stdc.stringz.toStringz(string));
--- a/dwt/widgets/FileDialog.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/widgets/FileDialog.d Mon May 05 00:42:55 2008 +0200 @@ -43,12 +43,12 @@ * </p> */ public class FileDialog : Dialog { - char[] [] filterNames; - char[] [] filterExtensions; - char[] filterPath = ""; - char[] fileName = ""; - char[][] fileNames; - char[] fullPath = ""; + String [] filterNames; + String [] filterExtensions; + String filterPath = ""; + String fileName = ""; + String[] fileNames; + String fullPath = ""; GtkWidget* handle; static final char SEPARATOR = tango.io.FileConst.FileConst.PathSeparatorChar; static final char EXTENSION_SEPARATOR = ';'; @@ -97,13 +97,13 @@ super (parent, style); checkSubclass (); } -char[] computeResultChooserDialog () { +String computeResultChooserDialog () { /* MULTI is only valid if the native dialog's action is Open */ fullPath = null; if ((style & (DWT.SAVE | DWT.MULTI)) is DWT.MULTI) { auto list = OS.gtk_file_chooser_get_filenames (handle); int listLength = OS.g_slist_length (list); - fileNames = new char[] [listLength]; + fileNames = new String [listLength]; auto current = list; int writePos = 0; for (int i = 0; i < listLength; i++) { @@ -121,7 +121,7 @@ current = OS.g_slist_next (current); } if (writePos !is 0 && writePos !is listLength) { - char[] [] validFileNames = new char[] [writePos]; + String [] validFileNames = new String [writePos]; System.arraycopy (fileNames, 0, validFileNames, 0, writePos); fileNames = validFileNames; } @@ -134,7 +134,7 @@ OS.g_free (path); if (utf8Ptr !is null) { fullPath = utf8Ptr[ 0 .. items_written ].dup; - fileNames = new char[] [1]; + fileNames = new String [1]; int start = tango.text.Util.locatePrior( fullPath, SEPARATOR); if( start == fullPath.length ) start = -1; fileNames[0] = fullPath[ start + 1 .. $ ]; @@ -150,11 +150,11 @@ } return fullPath; } -char[] computeResultClassicDialog () { +String computeResultClassicDialog () { GtkFileSelection* selection = cast(GtkFileSelection*)handle; auto entry = selection.selection_entry; auto entryText = OS.gtk_entry_get_text (entry); - char[] txt = tango.stdc.stringz.fromStringz( entryText ); + String txt = tango.stdc.stringz.fromStringz( entryText ); if (txt.length is 0) { auto fileList = selection.file_list; auto listSelection = OS.gtk_tree_view_get_selection (fileList); @@ -184,7 +184,7 @@ auto fileNamePtr = OS.gtk_file_selection_get_filename (handle); uint items_written; auto utf8Ptr = OS.g_filename_to_utf8 (fileNamePtr, -1, null, &items_written, null); - char[] osAnswer = utf8Ptr[ 0 .. items_written ].dup; + String osAnswer = utf8Ptr[ 0 .. items_written ].dup; OS.g_free (utf8Ptr); if (osAnswer.length is 0) return null; @@ -192,7 +192,7 @@ if (separatorIndex is osAnswer.length ) separatorIndex = -1; if (separatorIndex+1 is osAnswer.length ) return null; - char[] answer = fullPath = osAnswer; + String answer = fullPath = osAnswer; fileName = fullPath[ separatorIndex+1 .. $ ]; filterPath = fullPath[ 0 .. separatorIndex ]; if ((style & DWT.MULTI) is 0) { @@ -206,10 +206,10 @@ length_++; namePtr = namesPtr1[length_]; } - fileNames = new char[][](length_); + fileNames = new String[](length_); for (int i = 0; i < length_; i++) { utf8Ptr = OS.g_filename_to_utf8 (namesPtr [i], -1, null, &items_written, null); - char[] name = utf8Ptr[ 0 .. items_written ].dup; + String name = utf8Ptr[ 0 .. items_written ].dup; int start = tango.text.Util.locatePrior( name, SEPARATOR); if( start == name.length ) start = -1; fileNames [i] = name[ start + 1 .. $ ].dup; @@ -226,7 +226,7 @@ * * @return the relative path of the file */ -public char[] getFileName () { +public String getFileName () { return fileName; } /** @@ -235,7 +235,7 @@ * * @return the relative paths of the files */ -public char[] [] getFileNames () { +public String [] getFileNames () { return fileNames; } /** @@ -244,7 +244,7 @@ * * @return the file extensions filter */ -public char[] [] getFilterExtensions () { +public String [] getFilterExtensions () { return filterExtensions; } /** @@ -253,7 +253,7 @@ * * @return the list of filter names */ -public char[] [] getFilterNames () { +public String [] getFilterNames () { return filterNames; } /** @@ -265,7 +265,7 @@ * * @see #setFilterExtensions */ -public char[] getFilterPath () { +public String getFilterPath () { return filterPath; } /** @@ -280,7 +280,7 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the dialog</li> * </ul> */ -public char[] open () { +public String open () { bool useChooserDialog = OS.GTK_VERSION >= OS.buildVERSION (2, 4, 10); if (useChooserDialog) { return openChooserDialog (); @@ -288,7 +288,7 @@ return openClassicDialog (); } } -char[] openChooserDialog () { +String openChooserDialog () { char* titleBytes = tango.stdc.stringz.toStringz( title ); int action = (style & DWT.SAVE) !is 0 ? OS.GTK_FILE_CHOOSER_ACTION_SAVE : @@ -308,7 +308,7 @@ presetChooserDialog (); Display display = parent !is null ? parent.getDisplay (): Display.getCurrent (); display.addIdleProc (); - char[] answer = null; + String answer = null; if (OS.gtk_dialog_run (handle) is OS.GTK_RESPONSE_OK) { answer = computeResultChooserDialog (); } @@ -316,7 +316,7 @@ OS.gtk_widget_destroy (handle); return answer; } -char[] openClassicDialog () { +String openClassicDialog () { char* titleBytes = tango.stdc.stringz.toStringz( title ); handle = OS.gtk_file_selection_new (titleBytes); if (parent !is null) { @@ -331,7 +331,7 @@ presetClassicDialog (); Display display = parent !is null ? parent.getDisplay (): Display.getCurrent (); display.addIdleProc (); - char[] answer = null; + String answer = null; if (OS.gtk_dialog_run (handle) is OS.GTK_RESPONSE_OK) { answer = computeResultClassicDialog (); } @@ -411,13 +411,13 @@ int start = 0; int index = tango.text.Util.locate( filterExtensions [i], EXTENSION_SEPARATOR ); while (index !is filterExtensions [i].length ) { - char[] current = filterExtensions [i][ start .. index ]; + String current = filterExtensions [i][ start .. index ]; char* filterString = tango.stdc.stringz.toStringz(current); OS.gtk_file_filter_add_pattern (filter, filterString); start = index + 1; index = tango.text.Util.locate( filterExtensions [i], EXTENSION_SEPARATOR, start); } - char[] current = filterExtensions [i][ start .. $ ]; + String current = filterExtensions [i][ start .. $ ]; char* filterString = tango.stdc.stringz.toStringz(current); OS.gtk_file_filter_add_pattern (filter, filterString); OS.gtk_file_chooser_add_filter (handle, filter); @@ -464,7 +464,7 @@ * * @param string the file name */ -public void setFileName (char[] string) { +public void setFileName (String string) { fileName = string; } /** @@ -482,7 +482,7 @@ * @see #setFilterNames to specify the user-friendly * names corresponding to the extensions */ -public void setFilterExtensions (char[] [] extensions) { +public void setFilterExtensions (String [] extensions) { filterExtensions = extensions; } /** @@ -499,7 +499,7 @@ * * @see #setFilterExtensions */ -public void setFilterNames (char[] [] names) { +public void setFilterNames (String [] names) { filterNames = names; } /** @@ -519,7 +519,7 @@ * * @see #setFilterExtensions */ -public void setFilterPath (char[] string) { +public void setFilterPath (String string) { filterPath = string; } }
--- a/dwt/widgets/Group.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/widgets/Group.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.widgets.Group; +import dwt.dwthelper.utils; + import dwt.DWT; import dwt.internal.gtk.OS; @@ -52,7 +54,7 @@ alias Composite.setForegroundColor setForegroundColor; GtkWidget* clientHandle_, labelHandle; - char[] text = ""; + String text = ""; /** * Constructs a new instance of this class given its parent @@ -171,7 +173,7 @@ return fixedHandle; } -override char[] getNameText () { +override String getNameText () { return getText (); } @@ -187,7 +189,7 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ -public char[] getText () { +public String getText () { checkWidget(); return text; } @@ -278,7 +280,7 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ -public void setText (char[] string) { +public void setText (String string) { checkWidget(); if (string is null) error (DWT.ERROR_NULL_ARGUMENT); text = string;
--- a/dwt/widgets/Item.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/widgets/Item.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.widgets.Item; +import dwt.dwthelper.utils; + import dwt.widgets.Widget; import dwt.DWT; @@ -30,7 +32,7 @@ */ public abstract class Item : Widget { - char[] text; + String text; Image image; /** @@ -119,7 +121,7 @@ return image; } -override char[] getNameText () { +override String getNameText () { return getText (); } @@ -134,7 +136,7 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ -public char[] getText () { +public String getText () { checkWidget(); return text; } @@ -178,7 +180,7 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ -public void setText (char[] string) { +public void setText (String string) { checkWidget (); if (string is null) error (DWT.ERROR_NULL_ARGUMENT); text = string.dup;
--- a/dwt/widgets/Label.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/widgets/Label.d Mon May 05 00:42:55 2008 +0200 @@ -57,7 +57,7 @@ GtkWidget* frameHandle, labelHandle, imageHandle; ImageList imageList; Image image; - char[] text; + String text; /** * Constructs a new instance of this class given its parent @@ -298,7 +298,7 @@ return image; } -override char[] getNameText () { +override String getNameText () { return getText (); } @@ -314,7 +314,7 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ -public char[] getText () { +public String getText () { checkWidget (); if ((style & DWT.SEPARATOR) !is 0) return ""; return text; @@ -565,7 +565,7 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ -public void setText (char[] string) { +public void setText (String string) { checkWidget (); // DWT extension: allow null for zero length string //if (string is null) error (DWT.ERROR_NULL_ARGUMENT);
--- a/dwt/widgets/Link.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/widgets/Link.d Mon May 05 00:42:55 2008 +0200 @@ -69,12 +69,12 @@ alias Control.fixStyle fixStyle; alias Control.setBounds setBounds; - char[] text; + String text; TextLayout layout; Color linkColor, disabledColor; Point [] offsets; Point selection; - char[] [] ids; + String [] ids; int [] mnemonics; int focusIndex; @@ -268,7 +268,7 @@ }); } -override char[] getNameText () { +override String getNameText () { return getText (); } @@ -312,7 +312,7 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ -public char[] getText () { +public String getText () { checkWidget (); return text; } @@ -525,10 +525,10 @@ eventTable.unhook (DWT.DefaultSelection, listener); } -char[] parse (char[] string) { +String parse (String string) { int length_ = string.length; offsets = new Point[]( length_ / 4 ); - ids = new char[][]( length_ / 4 ); + ids = new String[]( length_ / 4 ); mnemonics = new int[] ( length_ / 4 + 1 ); Text8 result = new Text8 (); char [] buffer = string.dup; @@ -648,7 +648,7 @@ Point [] newOffsets = new Point [linkIndex]; System.arraycopy (offsets, 0, newOffsets, 0, linkIndex); offsets = newOffsets; - char[] [] newIDs = new char[] [linkIndex]; + String [] newIDs = new String [linkIndex]; System.arraycopy (ids, 0, newIDs, 0, linkIndex); ids = newIDs; int [] newMnemonics = new int [linkIndex + 1]; @@ -714,7 +714,7 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ -public void setText (char[] string) { +public void setText (String string) { checkWidget (); if (string is null) error (DWT.ERROR_NULL_ARGUMENT); if (string.equals(text)) return;
--- a/dwt/widgets/List.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/widgets/List.d Mon May 05 00:42:55 2008 +0200 @@ -106,7 +106,7 @@ * * @see #add(String,int) */ -public void add (char[] string) { +public void add (String string) { checkWidget(); if (string is null) error (DWT.ERROR_NULL_ARGUMENT); char* buffer = toStringz(string); @@ -138,7 +138,7 @@ * * @see #add(String) */ -public void add (char[] string, int index) { +public void add (String string, int index) { checkWidget(); if (string is null) error (DWT.ERROR_NULL_ARGUMENT); int count = OS.gtk_tree_model_iter_n_children (cast(GtkTreeStore*)modelHandle, null); @@ -444,7 +444,7 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ -public char[] getItem (int index) { +public String getItem (int index) { checkWidget(); if (!(0 <= index && index < OS.gtk_tree_model_iter_n_children (cast(GtkTreeStore*)modelHandle, null))) { error (DWT.ERROR_INVALID_RANGE); @@ -454,7 +454,7 @@ OS.gtk_tree_model_iter_nth_child (cast(GtkTreeStore*)modelHandle, &iter, null, index); OS.gtk_tree_model_get1 (cast(GtkTreeStore*)modelHandle, &iter, 0, cast(void**)&ptr ); if (ptr is null) return null; - char[] res = fromStringz( ptr ).dup; + String res = fromStringz( ptr ).dup; OS.g_free (ptr); return res; } @@ -519,17 +519,17 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ -public char[] [] getItems () { +public String [] getItems () { checkWidget(); int count = OS.gtk_tree_model_iter_n_children (cast(GtkTreeStore*)modelHandle, null); char* ptr; - char[] [] result = new char[][]( count ); + String [] result = new String[]( count ); GtkTreeIter iter; for (int index=0; index<count; index++) { OS.gtk_tree_model_iter_nth_child (cast(GtkTreeStore*)modelHandle, &iter, null, index); OS.gtk_tree_model_get1 (cast(GtkTreeStore*)modelHandle, &iter, 0, cast(void**)&ptr); if (ptr !is null) { - char[] res = fromStringz( ptr ).dup; + String res = fromStringz( ptr ).dup; OS.g_free (ptr); result [index] = res; } @@ -553,10 +553,10 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ -public char[] [] getSelection () { +public String [] getSelection () { checkWidget(); int [] indices = getSelectionIndices (); - char[] [] result = new char[][](indices.length); + String [] result = new String[](indices.length); for (int i=0; i<indices.length; i++) { result [i] = getItem (indices [i]); } @@ -838,7 +838,7 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ -public int indexOf (char[] string) { +public int indexOf (String string) { checkWidget(); return indexOf (string, 0); } @@ -862,10 +862,10 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ -public int indexOf (char[] string, int start) { +public int indexOf (String string, int start) { checkWidget(); if (string is null) error (DWT.ERROR_NULL_ARGUMENT); - char[] [] items = getItems (); + String [] items = getItems (); for (int i=start; i<items.length; i++) { if (items [i] ==/*eq*/ (string)) return i; } @@ -987,7 +987,7 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ -public void remove (char[] string) { +public void remove (String string) { checkWidget(); if (string is null) error (DWT.ERROR_NULL_ARGUMENT); int index = indexOf (string, 0); @@ -1285,7 +1285,7 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ -public void setItem (int index, char[] string) { +public void setItem (int index, String string) { checkWidget(); if (string is null) error (DWT.ERROR_NULL_ARGUMENT); if (!(0 <= index && index < OS.gtk_tree_model_iter_n_children (cast(GtkTreeStore*)modelHandle, null))) { @@ -1311,7 +1311,7 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ -public void setItems (char[] [] items) { +public void setItems (String [] items) { checkWidget(); // DWT extension, allow null a null length list. //if (items is null) error (DWT.ERROR_NULL_ARGUMENT); @@ -1324,7 +1324,7 @@ OS.g_signal_handlers_unblock_matched (selection, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udCHANGED); GtkTreeIter iter; for (int i=0; i<items.length; i++) { - char[] string = items [i]; + String string = items [i]; char* buffer = toStringz(string); OS.gtk_list_store_append (cast(GtkListStore*)modelHandle, &iter); OS.gtk_list_store_set1 (cast(GtkListStore*)modelHandle, &iter, TEXT_COLUMN, buffer); @@ -1445,7 +1445,7 @@ * @see List#select(int[]) * @see List#setSelection(int[]) */ -public void setSelection (char[] [] items) { +public void setSelection (String [] items) { checkWidget (); if (items is null) error (DWT.ERROR_NULL_ARGUMENT); deselectAll (); @@ -1454,7 +1454,7 @@ bool first = true; for (int i = 0; i < length; i++) { int index = 0; - char[] string = items [i]; + String string = items [i]; if (string !is null) { while ((index = indexOf (string, index)) !is -1) { if ((style & DWT.MULTI) !is 0) {
--- a/dwt/widgets/Menu.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/widgets/Menu.d Mon May 05 00:42:55 2008 +0200 @@ -469,8 +469,8 @@ return items; } -override char[] getNameText () { - char[] result = ""; +override String getNameText () { + String result = ""; MenuItem [] items = getItems (); int length_ = items.length; if (length_ > 0) {
--- a/dwt/widgets/MenuItem.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/widgets/MenuItem.d Mon May 05 00:42:55 2008 +0200 @@ -833,13 +833,13 @@ * * @see #setAccelerator */ -public override void setText (char[] string) { +public override void setText (String string) { checkWidget(); if (string is null) error (DWT.ERROR_NULL_ARGUMENT); if ((style & DWT.SEPARATOR) !is 0) return; if (text.equals(string)) return; super.setText (string); - char[] accelString = ""; + String accelString = ""; int index = string.indexOf ('\t'); if (index !is -1) { accelString = string.substring (index, string.length);
--- a/dwt/widgets/MessageBox.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/widgets/MessageBox.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.widgets.MessageBox; +import dwt.dwthelper.utils; + import dwt.DWT; @@ -45,7 +47,7 @@ */ public class MessageBox : Dialog { - char[] message = ""; + String message = ""; GtkWidget* handle; private bool allowNullParent = false; /** @@ -116,7 +118,7 @@ * * @return the message */ -public char[] getMessage () { +public String getMessage () { return message; } @@ -131,7 +133,7 @@ * <li>ERROR_NULL_ARGUMENT - if the string is null</li> * </ul> */ -public void setMessage (char[] string) { +public void setMessage (String string) { if (string is null) error (DWT.ERROR_NULL_ARGUMENT); message = string; } @@ -200,9 +202,9 @@ return style; } -char[] fixPercent (char[] string) { +char[] fixPercent (String string) { int i = 0, j = 0; - char [] result = new char[]( string.length * 2 ); + char [] result = new String( string.length * 2 ); while (i < string.length) { switch (string [i]) { case '%': @@ -219,7 +221,7 @@ /++ + DWT extension +/ -public static int showMessageBox(char[] str, char[] title, Shell shell, int style) { +public static int showMessageBox(String str, String title, Shell shell, int style) { MessageBox msgBox = (shell is null ) ? new MessageBox( style ) : new MessageBox(shell, style); msgBox.setMessage(str); if(title !is null){ @@ -229,18 +231,18 @@ } /// DWT extension -public static int showInfo(char[] str, char[] title = null, Shell shell = null) { +public static int showInfo(String str, String title = null, Shell shell = null) { return showMessageBox( str, title, shell, DWT.OK | DWT.ICON_INFORMATION ); } /// DWT extension alias showInfo showInformation; /// DWT extension -public static int showWarning(char[] str, char[] title = null, Shell shell = null) { +public static int showWarning(String str, String title = null, Shell shell = null) { return showMessageBox( str, title, shell, DWT.OK | DWT.ICON_WARNING ); } /// DWT extension -public static int showError(char[] str, char[] title = null, Shell shell = null) { +public static int showError(String str, String title = null, Shell shell = null) { return showMessageBox( str, title, shell, DWT.OK | DWT.ICON_ERROR ); }
--- a/dwt/widgets/Sash.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/widgets/Sash.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.widgets.Sash; +import dwt.dwthelper.utils; + import dwt.DWT; @@ -156,7 +158,7 @@ if ((style & DWT.SMOOTH) !is 0) return; auto window = OS.GTK_WIDGET_WINDOW (parent.paintHandle()); if (window is null) return; - char [] bits = cast(char[])[ cast(byte)-86, 85, -86, 85, -86, 85, -86, 85 ]; + char [] bits = cast(String)[ cast(byte)-86, 85, -86, 85, -86, 85, -86, 85 ]; auto stipplePixmap = OS.gdk_bitmap_create_from_data (cast(GdkDrawable*)window, bits.ptr, 8, 8); auto gc = OS.gdk_gc_new (window); auto colormap = OS.gdk_colormap_get_system();
--- a/dwt/widgets/Shell.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/widgets/Shell.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.widgets.Shell; +import dwt.dwthelper.utils; + import dwt.widgets.Composite; import dwt.widgets.Control; import dwt.internal.c.gtk; @@ -639,7 +641,7 @@ createHandle (index, false, true); OS.gtk_container_add (cast(GtkContainer*)vboxHandle, scrolledHandle); OS.gtk_box_set_child_packing (cast(GtkBox*)vboxHandle, scrolledHandle, true, true, 0, OS.GTK_PACK_END); - char[] dummy = "a"; + String dummy = "a"; OS.gtk_window_set_title (cast(GtkWindow*)shellHandle, dummy.ptr ); if ((style & (DWT.NO_TRIM | DWT.BORDER | DWT.SHELL_TRIM)) is 0) { OS.gtk_container_set_border_width (cast(GtkContainer*)shellHandle, 1); @@ -795,7 +797,7 @@ void fixShell (Shell newShell, Control control) { if (this is newShell) return; if (control is lastActive) setActiveControl (null); - char[] toolTipText = control.toolTipText; + String toolTipText = control.toolTipText; if (toolTipText !is null) { control.setToolTipText (this, null); control.setToolTipText (newShell, toolTipText); @@ -1482,7 +1484,7 @@ override void setRelations() { } -public override void setText (char[] string) { +public override void setText (String string) { super.setText (string); /* @@ -1755,7 +1757,7 @@ lastActive = null; } -void setToolTipText (GtkWidget* widget, char[] string) { +void setToolTipText (GtkWidget* widget, String string) { char* buffer = toStringz( string ); if (tooltipsHandle is null) { tooltipsHandle = cast(GtkWidget*)OS.gtk_tooltips_new ();
--- a/dwt/widgets/Spinner.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/widgets/Spinner.d Mon May 05 00:42:55 2008 +0200 @@ -29,7 +29,6 @@ import tango.stdc.stringz; import tango.util.Convert; import dwt.dwthelper.utils; -alias char[] String; /** * Instances of this class are selectable user interface
--- a/dwt/widgets/TabItem.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/widgets/TabItem.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.widgets.TabItem; +import dwt.dwthelper.utils; + import dwt.DWT; @@ -45,7 +47,7 @@ GtkWidget* labelHandle, imageHandle, pageHandle; Control control; TabFolder parent; - char[] toolTipText; + String toolTipText; /** * Constructs a new instance of this class given its parent @@ -186,7 +188,7 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ -public char[] getToolTipText () { +public String getToolTipText () { checkWidget (); return toolTipText; } @@ -327,7 +329,7 @@ * </ul> * */ -public override void setText (char[] string) { +public override void setText (String string) { checkWidget (); if (string is null) error (DWT.ERROR_NULL_ARGUMENT); super.setText (string); @@ -352,7 +354,7 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ -public void setToolTipText (char[] string) { +public void setToolTipText (String string) { checkWidget (); toolTipText = string; }
--- a/dwt/widgets/Table.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/widgets/Table.d Mon May 05 00:42:55 2008 +0200 @@ -2116,7 +2116,7 @@ public bool isSelected (int index) { checkWidget(); auto selection = OS.gtk_tree_view_get_selection (handle); - char* buffer = tango.stdc.stringz.toStringz( to!(char[])(index)); + char* buffer = tango.stdc.stringz.toStringz( to!(String)(index)); auto path = OS.gtk_tree_path_new_from_string (buffer); bool answer = cast(bool)OS.gtk_tree_selection_path_is_selected (selection, path); OS.gtk_tree_path_free (path);
--- a/dwt/widgets/TableColumn.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/widgets/TableColumn.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.widgets.TableColumn; +import dwt.dwthelper.utils; + import dwt.DWT; @@ -49,7 +51,7 @@ Table parent; int modelIndex, lastButton, lastTime, lastX, lastWidth; bool customDraw, useFixedWidth; - char[] toolTipText; + String toolTipText; /** * Constructs a new instance of this class given its parent @@ -306,7 +308,7 @@ * * @since 3.2 */ -public char[] getToolTipText () { +public String getToolTipText () { checkWidget(); return toolTipText; } @@ -606,7 +608,7 @@ } } -public override void setText (char[] string) { +public override void setText (String string) { checkWidget(); if (string is null) error (DWT.ERROR_NULL_ARGUMENT); super.setText (string); @@ -633,14 +635,14 @@ * * @since 3.2 */ -public void setToolTipText (char[] string) { +public void setToolTipText (String string) { checkWidget(); Shell shell = parent._getShell (); setToolTipText (shell, string); toolTipText = string; } -void setToolTipText (Shell shell, char[] newString) { +void setToolTipText (Shell shell, String newString) { shell.setToolTipText (buttonHandle, newString); }
--- a/dwt/widgets/TableItem.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/widgets/TableItem.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.widgets.TableItem; +import dwt.dwthelper.utils; + import dwt.DWT; @@ -567,7 +569,7 @@ return 0; } -override char[] getNameText () { +override String getNameText () { if ((parent.style & DWT.VIRTUAL) !is 0) { if (!cached) return "*virtual*"; //$NON-NLS-1$ } @@ -589,7 +591,7 @@ return parent; } -public override char[] getText () { +public override String getText () { checkWidget (); if (!parent.checkData (this)) error (DWT.ERROR_WIDGET_DISPOSED); return getText (0); @@ -607,7 +609,7 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ -public char[] getText (int index) { +public String getText (int index) { checkWidget (); if (!parent.checkData (this)) error (DWT.ERROR_WIDGET_DISPOSED); int count = Math.max (1, parent.getColumnCount ()); @@ -616,7 +618,7 @@ int modelIndex = parent.columnCount is 0 ? Table.FIRST_COLUMN : parent.columns [index].modelIndex; OS.gtk_tree_model_get1 (parent.modelHandle, handle, modelIndex + Table.CELL_TEXT, cast(void**) &ptr); if (ptr is null) return ""; - char[] res = tango.stdc.stringz.fromStringz( ptr ).dup; + String res = tango.stdc.stringz.fromStringz( ptr ).dup; OS.g_free (ptr); return res; } @@ -1228,7 +1230,7 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ -public void setText (int index, char[] string) { +public void setText (int index, String string) { checkWidget (); if (string is null) error (DWT.ERROR_NULL_ARGUMENT); int count = Math.max (1, parent.getColumnCount ()); @@ -1249,7 +1251,7 @@ cached = true; } -public override void setText (char[] string) { +public override void setText (String string) { checkWidget (); setText (0, string); } @@ -1267,11 +1269,11 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ -public void setText (char[] [] strings) { +public void setText (String [] strings) { checkWidget (); if (strings is null) error (DWT.ERROR_NULL_ARGUMENT); for (int i=0; i<strings.length; i++) { - char[] string = strings [i]; + String string = strings [i]; if (string !is null) setText (i, string); } }
--- a/dwt/widgets/Text.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/widgets/Text.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.widgets.Text; +import dwt.dwthelper.utils; + import dwt.DWT; import dwt.internal.gtk.OS; @@ -60,7 +62,7 @@ GdkEventKey* gdkEventKey; int fixStart = -1, fixEnd = -1; bool doubleClick; - char[] message = ""; + String message = ""; static const int INNER_BORDER = 2; //static const int ITER_SIZEOF = GtkTextIter.sizeof; @@ -79,7 +81,7 @@ * is queried and from the widget, it will be delimited using * this delimiter. */ - public const static char[] DELIMITER = "\n"; + public const static String DELIMITER = "\n"; /* * These values can be different on different platforms. * Therefore they are not initialized in the declaration @@ -297,7 +299,7 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ -public void append (char[] string) { +public void append (String string) { checkWidget (); if (string is null) error (DWT.ERROR_NULL_ARGUMENT); if ((style & DWT.SINGLE) !is 0) { @@ -755,7 +757,7 @@ * * @see #DELIMITER */ -public char[] getLineDelimiter () { +public String getLineDelimiter () { checkWidget (); return "\n"; } @@ -794,7 +796,7 @@ * * @since 3.3 */ -public char[] getMessage () { +public String getMessage () { checkWidget (); return message; } @@ -894,7 +896,7 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ -public char[] getSelectionText () { +public String getSelectionText () { checkWidget (); Point selection = getSelection (); return getText ()[ selection.x .. selection.y ]; @@ -943,7 +945,7 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ -public char[] getText () { +public String getText () { checkWidget (); char* address; if ((style & DWT.SINGLE) !is 0) { @@ -955,7 +957,7 @@ address = OS.gtk_text_buffer_get_text (bufferHandle, &start, &end, true); } if (address is null) return ""; - char[] res = fromStringz( address ).dup; + String res = fromStringz( address ).dup; if ((style & DWT.MULTI) !is 0) OS.g_free (address); return res; } @@ -978,7 +980,7 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ -public char[] getText (int start, int end) { +public String getText (int start, int end) { checkWidget (); if (!(start <= end && 0 <= end)) return ""; start = Math.max (0, start); @@ -995,7 +997,7 @@ address = OS.gtk_text_buffer_get_text (bufferHandle, &startIter, &endIter, true); } if (address is null) error (DWT.ERROR_CANNOT_GET_TEXT); - char[] res = fromStringz( address ).dup; + String res = fromStringz( address ).dup; OS.g_free (address); return res; } @@ -1170,7 +1172,7 @@ GtkTextIter endIter = *cast(GtkTextIter*)iter2; int start = OS.gtk_text_iter_get_offset (&startIter); int end = OS.gtk_text_iter_get_offset (&endIter); - char[] newText = verifyText ("", start, end); + String newText = verifyText ("", start, end); if (newText is null) { /* Remember the selection when the text was deleted */ OS.gtk_text_buffer_get_selection_bounds (bufferHandle, &startIter, &endIter); @@ -1199,7 +1201,7 @@ override int /*long*/ gtk_delete_text (GtkWidget* widget, int /*long*/ start_pos, int /*long*/ end_pos) { if (!hooks (DWT.Verify) && !filters (DWT.Verify)) return 0; - char[] newText = verifyText ("", cast(int)/*64*/start_pos, cast(int)/*64*/end_pos); + String newText = verifyText ("", cast(int)/*64*/start_pos, cast(int)/*64*/end_pos); if (newText is null) { /* Remember the selection when the text was deleted */ int newStart, newEnd; @@ -1271,7 +1273,7 @@ override int /*long*/ gtk_insert_text (GtkEditable* widget, char* new_text, int new_text_length, int position) { if (!hooks (DWT.Verify) && !filters (DWT.Verify)) return 0; if (new_text is null || new_text_length is 0) return 0; - char[] oldText = (cast(char*)new_text)[ 0 .. new_text_length ].dup; + String oldText = (cast(char*)new_text)[ 0 .. new_text_length ].dup; int pos; pos = *cast(int*)position; if (pos is -1) { @@ -1285,7 +1287,7 @@ end = fixEnd; fixStart = fixEnd = -1; } - char[] newText = verifyText (oldText, start, end); + String newText = verifyText (oldText, start, end); if (newText !is oldText) { int newStart, newEnd; OS.gtk_editable_get_selection_bounds (cast(GtkEditable*)handle, &newStart, &newEnd); @@ -1331,8 +1333,8 @@ end = fixEnd; fixStart = fixEnd = -1; } - char[] oldText = text[ 0 .. len ]; - char[] newText = verifyText (oldText, start, end); + String oldText = text[ 0 .. len ]; + String newText = verifyText (oldText, start, end); if (newText is null) { OS.g_signal_stop_emission_by_name (bufferHandle, OS.insert_text.ptr); } else { @@ -1388,7 +1390,7 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ -public void insert (char[] string) { +public void insert (String string) { checkWidget (); if (string is null) error (DWT.ERROR_NULL_ARGUMENT); if ((style & DWT.SINGLE) !is 0) { @@ -1678,7 +1680,7 @@ * * @since 3.3 */ -public void setMessage (char[] message) { +public void setMessage (String message) { checkWidget (); if (message is null) error (DWT.ERROR_NULL_ARGUMENT); this.message = message; @@ -1864,7 +1866,7 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ -public void setText (char[] string) { +public void setText (String string) { checkWidget (); if (string is null) error (DWT.ERROR_NULL_ARGUMENT); /* @@ -2009,7 +2011,7 @@ return bits; } -char[] verifyText (char[] string, int start, int end) { +String verifyText (String string, int start, int end) { if (string.length is 0 && start is end) return null; Event event = new Event (); event.text = string;
--- a/dwt/widgets/ToolBar.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/widgets/ToolBar.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.widgets.ToolBar; +import dwt.dwthelper.utils; + import dwt.DWT; @@ -460,13 +462,13 @@ } } -public override void setToolTipText (char[] string) { +public override void setToolTipText (String string) { checkWidget(); super.setToolTipText (string); Shell shell = _getShell (); ToolItem [] items = getItems (); for (int i = 0; i < items.length; i++) { - char[] newString = string !is null ? null : items [i].toolTipText; + String newString = string !is null ? null : items [i].toolTipText; shell.setToolTipText (items [i].handle, newString); } }
--- a/dwt/widgets/ToolItem.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/widgets/ToolItem.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.widgets.ToolItem; +import dwt.dwthelper.utils; + import dwt.DWT; @@ -55,7 +57,7 @@ ToolBar parent; Control control; Image hotImage, disabledImage; - char[] toolTipText; + String toolTipText; bool drawHotImage; /** @@ -464,7 +466,7 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ -public char[] getToolTipText () { +public String getToolTipText () { checkWidget(); return toolTipText; } @@ -978,7 +980,7 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ -public override void setText (char[] string) { +public override void setText (String string) { checkWidget(); if (string is null) error (DWT.ERROR_NULL_ARGUMENT); if ((style & DWT.SEPARATOR) !is 0) return; @@ -1005,7 +1007,7 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ -public void setToolTipText (char[] string) { +public void setToolTipText (String string) { checkWidget(); if (parent.toolTipText is null) { Shell shell = parent._getShell (); @@ -1014,7 +1016,7 @@ toolTipText = string; } -void setToolTipText (Shell shell, char[] newString) { +void setToolTipText (Shell shell, String newString) { shell.setToolTipText (handle, newString); }
--- a/dwt/widgets/ToolTip.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/widgets/ToolTip.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.widgets.ToolTip; +import dwt.dwthelper.utils; + import dwt.widgets.Widget; import dwt.widgets.TrayItem; import dwt.widgets.Shell; @@ -50,7 +52,7 @@ */ public class ToolTip : Widget { Shell parent; - char[] text, message; + String text, message; TrayItem item; int x, y, timerId; void* layoutText, layoutMessage; @@ -332,12 +334,12 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ -public char[] getMessage () { +public String getMessage () { checkWidget (); return message; } -override char[] getNameText () { +override String getNameText () { return getText (); } @@ -400,7 +402,7 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ -public char[] getText () { +public String getText () { checkWidget (); return text; } @@ -443,7 +445,7 @@ int y = BORDER + PADDING; if (spikeAbove) y += TIP_HEIGHT; if (layoutText !is null) { - char[] buffer = null; + String buffer = null; int id = style & (DWT.ICON_ERROR | DWT.ICON_INFORMATION | DWT.ICON_WARNING); switch (id) { case DWT.ICON_ERROR: buffer = "gtk-dialog-error"; break; @@ -668,7 +670,7 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ -public void setMessage (char[] string) { +public void setMessage (String string) { checkWidget (); if (string is null) error (DWT.ERROR_NULL_ARGUMENT); message = string; @@ -698,7 +700,7 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ -public void setText (char[] string) { +public void setText (String string) { checkWidget (); if (string is null) error (DWT.ERROR_NULL_ARGUMENT); text = string; @@ -747,7 +749,7 @@ OS.gtk_widget_show (handle); } else { auto vboxHandle = parent.vboxHandle; - char[] string = text; + String string = text; if (text.length > 0) string ~= "\n\n"; string ~= message; char* buffer = toStringz( string );
--- a/dwt/widgets/TrayItem.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/widgets/TrayItem.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.widgets.TrayItem; +import dwt.dwthelper.utils; + import dwt.DWT; import dwt.widgets.Tray; import dwt.widgets.ToolTip; @@ -49,7 +51,7 @@ public class TrayItem : Item { Tray parent; ToolTip toolTip; - char[] toolTipText; + String toolTipText; GtkWidget* imageHandle; GtkWidget* tooltipsHandle; ImageList imageList; @@ -174,7 +176,7 @@ if (screen !is null) { monitor = OS.gdk_screen_get_number (screen); } - auto trayAtom = OS.gdk_atom_intern (toStringz("_NET_SYSTEM_TRAY_S" ~ to!(char[])(monitor)), true); + auto trayAtom = OS.gdk_atom_intern (toStringz("_NET_SYSTEM_TRAY_S" ~ to!(String)(monitor)), true); auto xTrayAtom = OS.gdk_x11_atom_to_xatom (trayAtom); auto xDisplay = OS.GDK_DISPLAY (); auto trayWindow = OS.XGetSelectionOwner (xDisplay, xTrayAtom); @@ -248,7 +250,7 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ -public char[] getToolTipText () { +public String getToolTipText () { checkWidget (); return toolTipText; } @@ -462,7 +464,7 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ -public void setToolTipText (char[] string) { +public void setToolTipText (String string) { checkWidget (); toolTipText = string; char* buffer = null;
--- a/dwt/widgets/TreeColumn.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/widgets/TreeColumn.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.widgets.TreeColumn; +import dwt.dwthelper.utils; + import dwt.DWT; @@ -51,7 +53,7 @@ Tree parent; int modelIndex, lastButton, lastTime, lastX, lastWidth; bool customDraw, useFixedWidth; - char[] toolTipText; + String toolTipText; /** * Constructs a new instance of this class given its parent @@ -307,7 +309,7 @@ * * @since 3.2 */ -public char[] getToolTipText () { +public String getToolTipText () { checkWidget(); return toolTipText; } @@ -591,7 +593,7 @@ OS.gtk_tree_view_column_set_resizable (handle, resizable); } -public override void setText (char[] string) { +public override void setText (String string) { checkWidget(); if (string is null) error (DWT.ERROR_NULL_ARGUMENT); super.setText (string); @@ -618,14 +620,14 @@ * * @since 3.2 */ -public void setToolTipText (char[] string) { +public void setToolTipText (String string) { checkWidget(); Shell shell = parent._getShell (); setToolTipText (shell, string); toolTipText = string; } -void setToolTipText (Shell shell, char[] newString) { +void setToolTipText (Shell shell, String newString) { shell.setToolTipText (buttonHandle, newString); }
--- a/dwt/widgets/TreeItem.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/widgets/TreeItem.d Mon May 05 00:42:55 2008 +0200 @@ -12,6 +12,8 @@ *******************************************************************************/ module dwt.widgets.TreeItem; +import dwt.dwthelper.utils; + import dwt.DWT; @@ -799,7 +801,7 @@ return parent.getItems (cast(GtkTreeIter*)handle); } -override char[] getNameText () { +override String getNameText () { if ((parent.style & DWT.VIRTUAL) !is 0) { if (!cached) return "*virtual*"; //$NON-NLS-1$ } @@ -849,7 +851,7 @@ return item; } -public override char[] getText () { +public override String getText () { checkWidget (); if (!parent.checkData (this)) error (DWT.ERROR_WIDGET_DISPOSED); return getText (0); @@ -869,7 +871,7 @@ * * @since 3.1 */ -public char[] getText (int index) { +public String getText (int index) { checkWidget (); if (!parent.checkData (this)) error (DWT.ERROR_WIDGET_DISPOSED); int count = Math.max (1, parent.getColumnCount ()); @@ -878,7 +880,7 @@ int modelIndex = parent.columnCount is 0 ? Tree.FIRST_COLUMN : parent.columns [index].modelIndex; OS.gtk_tree_model_get1 (parent.modelHandle, handle, modelIndex + Tree.CELL_TEXT, &ptr); if (ptr is null) return ""; //$NON-NLS-1$ - char[] res = tango.stdc.stringz.fromStringz( cast(char*)ptr ).dup; + String res = tango.stdc.stringz.fromStringz( cast(char*)ptr ).dup; OS.g_free (ptr); return res; } @@ -1610,7 +1612,7 @@ * * @since 3.1 */ -public void setText (int index, char[] string) { +public void setText (int index, String string) { checkWidget (); if (string is null) error (DWT.ERROR_NULL_ARGUMENT); int count = Math.max (1, parent.getColumnCount ()); @@ -1631,7 +1633,7 @@ cached = true; } -public override void setText (char[] string) { +public override void setText (String string) { checkWidget (); setText (0, string); } @@ -1651,11 +1653,11 @@ * * @since 3.1 */ -public void setText (char[] [] strings) { +public void setText (String [] strings) { checkWidget (); if (strings is null) error (DWT.ERROR_NULL_ARGUMENT); for (int i=0; i<strings.length; i++) { - char[] string = strings [i]; + String string = strings [i]; if (string !is null) setText (i, string); } }
--- a/dwt/widgets/Widget.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/widgets/Widget.d Mon May 05 00:42:55 2008 +0200 @@ -179,8 +179,8 @@ static const int MONTH_CHANGED = 61; static const int LAST_SIGNAL = 62; - template UD_Getter( char[] name ){ - const char[] UD_Getter = "void* ud"~name~"(){ return getDisplay().getWindowProcUserData( "~name~"); }\n"; + template UD_Getter( String name ){ + const String UD_Getter = "void* ud"~name~"(){ return getDisplay().getWindowProcUserData( "~name~"); }\n"; } mixin ( UD_Getter!( "ACTIVATE" )); @@ -578,13 +578,13 @@ * * @see #setData(String, Object) */ -public Object getData (char[] key) { +public Object getData (String key) { checkWidget(); if (key is null) error (DWT.ERROR_NULL_ARGUMENT); if ((state & KEYED_DATA) !is 0) { Object[] table = (cast(ArrayWrapperObject) data).array; for (int i=1; i<table.length; i+=2) { - char[] tablekey = (cast(ArrayWrapperString) table[i]).array; + String tablekey = (cast(ArrayWrapperString) table[i]).array; if (key ==/*eq*/ tablekey ) return table [i+1]; } } @@ -612,17 +612,17 @@ return display; } -char[] getName () { -// char[] str = getClass ().getName (); +String getName () { +// String str = getClass ().getName (); // int index = str.lastIndexOf ('.'); // if (index is -1) return str; - char[] str = this.classinfo.name; + String str = this.classinfo.name; int index = str.length; while ((--index > 0) && (str[index] !is '.')) {} return str[index + 1 .. $ ]; } -char[] getNameText () { +String getNameText () { return ""; } @@ -909,9 +909,9 @@ return 0; } -char [] fixMnemonic (char[] str) { +char [] fixMnemonic (String str) { int len = str.length; - char[] text = str[0 .. len].dup; + String text = str[0 .. len].dup; int i = 0, j = 0; char [] result = new char [len * 2]; while (i < len) { @@ -1379,7 +1379,7 @@ * * @see #getData(String) */ -public void setData (char[] key, Object value) { +public void setData (String key, Object value) { checkWidget(); if (key.length is 0) error (DWT.ERROR_NULL_ARGUMENT); int index = 1; @@ -1387,7 +1387,7 @@ if ((state & KEYED_DATA) !is 0) { table = (cast(ArrayWrapperObject) data).array; while (index < table.length) { - char[] tablekey = (cast(ArrayWrapperString)table[index]).array; + String tablekey = (cast(ArrayWrapperString)table[index]).array; if (key ==/*eq*/ tablekey ) break; index += 2; } @@ -1527,8 +1527,8 @@ * * @return a string representation of the receiver */ -public override char[] toString () { - char[] str = "*Disposed*"; +public override String toString () { + String str = "*Disposed*"; if (!isDisposed ()) { str = "*Wrong Thread*"; if (isValidThread ()) str = getNameText (); @@ -1558,7 +1558,7 @@ } int /*long*/ windowProc (GtkWidget* handle, int /*long*/ user_data) { - void trace( char[] str ){ + void trace( String str ){ version(LOG) Stderr.formatln( "Widget windowProc {}", str ).flush; } @@ -1621,7 +1621,7 @@ } int /*long*/ windowProc (GtkWidget* handle, int /*long*/ arg0, int /*long*/ user_data) { - void trace( char[] str ){ + void trace( String str ){ version(LOG) Stderr.formatln( "Widget windowProc1 {}", str ).flush; } @@ -1731,7 +1731,7 @@ } int /*long*/ windowProc (GtkWidget* handle, int /*long*/ arg0, int /*long*/ arg1, int /*long*/ user_data) { - void trace( char[] str ){ + void trace( String str ){ version(LOG) Stderr.formatln( "Widget windowProc2 {}", str ).flush; } @@ -1765,7 +1765,7 @@ } int /*long*/ windowProc (GtkWidget* handle, int /*long*/ arg0, int /*long*/ arg1, int /*long*/ arg2, int /*long*/ user_data) { - void trace( char[] str ){ + void trace( String str ){ version(LOG) Stderr.formatln( "Widget windowProc3 {}", str ).flush; }