changeset 170:dd156298d22f

tango -r3232, dmd 1.027, some reedits in StyledText
author Frank Benoit <benoit@tionex.de>
date Thu, 21 Feb 2008 01:58:48 +0100
parents bbd04636536f
children b7d87b56bbc7
files README dwt/custom/StyledText.d dwt/graphics/TextLayout.d
diffstat 3 files changed, 106 insertions(+), 106 deletions(-) [+]
line wrap: on
line diff
--- a/README	Mon Feb 18 00:49:58 2008 +0100
+++ b/README	Thu Feb 21 01:58:48 2008 +0100
@@ -1,7 +1,7 @@
 
 OS          : Linux Ubuntu 7.10
-Compiler    : DMD 1.026
-Runtime     : Tango SVN trunk rev. 3188
+Compiler    : DMD 1.027
+Runtime     : Tango SVN trunk rev. 3232
 DSSS        : 0.75
 
 Note: DSSS has by default the feature active to compile one file a time.
--- a/dwt/custom/StyledText.d	Mon Feb 18 00:49:58 2008 +0100
+++ b/dwt/custom/StyledText.d	Thu Feb 21 01:58:48 2008 +0100
@@ -89,6 +89,8 @@
 import tango.util.Convert;
 
 alias tango.text.Text.Text!(char) StringBuffer;
+private alias char[] String;
+
 
 /**
  * A StyledText is an editable user interface object that displays lines
@@ -143,11 +145,10 @@
  * </p>
  */
 public class StyledText : Canvas {
-
     alias Canvas.computeSize computeSize;
 
     static const char TAB = '\t';
-    static const char[] PlatformLineDelimiter = tango.io.FileConst.FileConst.NewlineString;
+    static const String PlatformLineDelimiter = tango.io.FileConst.FileConst.NewlineString;
     static const int BIDI_CARET_WIDTH = 3;
     static const int DEFAULT_WIDTH  = 64;
     static const int DEFAULT_HEIGHT = 64;
@@ -228,7 +229,7 @@
 
     const static bool IS_CARBON, IS_GTK, IS_MOTIF;
     static this(){
-        char[] platform = DWT.getPlatform();
+        String platform = DWT.getPlatform();
         IS_CARBON = ("carbon" == platform);
         IS_GTK    = ("gtk"    == platform);
         IS_MOTIF  = ("motif"  == platform);
@@ -312,7 +313,7 @@
         if (styledText.isListening(LineGetBackground) || (styledText.isBidi() && styledText.isListening(LineGetSegments)) || styledText.isListening(LineGetStyle)) {
             StyledTextContent content = printerRenderer.content;
             for (int i = 0; i < lineCount; i++) {
-                char[] line = content.getLine(i);
+                String line = content.getLine(i);
                 int lineOffset = content.getOffsetAtLine(i);
                 StyledTextEvent event = styledText.getLineBackgroundData(lineOffset, line);
                 if (event !is null && event.lineBackground !is null) {
@@ -600,18 +601,18 @@
      * @param header true = print the header, false = print the footer
      */
     void printDecoration(int page, bool header, TextLayout layout) {
-        char[] text = header ? printOptions.header : printOptions.footer;
+        String text = header ? printOptions.header : printOptions.footer;
         if (text is null) return;
         int lastSegmentIndex = 0;
         for (int i = 0; i < 3; i++) {
-            int segmentIndex = tango.text.Util.locatePattern( text, StyledTextPrintOptions.SEPARATOR, lastSegmentIndex);
-            char[] segment;
-            if (segmentIndex is text.length ) {
-                segment = text[ lastSegmentIndex .. $ ].dup;
+            int segmentIndex = text.indexOf( StyledTextPrintOptions.SEPARATOR, lastSegmentIndex);
+            String segment;
+            if (segmentIndex is -1 ) {
+                segment = text.substring(lastSegmentIndex);
                 printDecorationSegment(segment, i, page, header, layout);
                 break;
             } else {
-                segment = text[ lastSegmentIndex .. segmentIndex ].dup;
+                segment = text.substring(lastSegmentIndex, segmentIndex);
                 printDecorationSegment(segment, i, page, header, layout);
                 lastSegmentIndex = segmentIndex + StyledTextPrintOptions.SEPARATOR.length;
             }
@@ -627,13 +628,13 @@
      * @param page page number to print, if specified in the decoration segment.
      * @param header true = print the header, false = print the footer
      */
-    void printDecorationSegment(char[] segment, int alignment, int page, bool header, TextLayout layout) {
-        int pageIndex = tango.text.Util.locatePattern( segment, StyledTextPrintOptions.PAGE_TAG );
-        if (pageIndex !is segment.length ) {
+    void printDecorationSegment(String segment, int alignment, int page, bool header, TextLayout layout) {
+        int pageIndex = segment.indexOf(StyledTextPrintOptions.PAGE_TAG);
+        if (pageIndex !is -1 ) {
             int pageTagLength = StyledTextPrintOptions.PAGE_TAG.length;
-            StringBuffer buffer = new StringBuffer(segment[ 0 .. pageIndex ]);
+            StringBuffer buffer = new StringBuffer(segment.substring (0, pageIndex));
             buffer.append (page);
-            buffer.append (segment[ pageIndex + pageTagLength .. $ ]);
+            buffer.append (segment.substring(pageIndex + pageTagLength));
             segment = buffer.toString().dup;
         }
         if (segment.length > 0) {
@@ -675,7 +676,7 @@
             FontMetrics metrics = layout.getLineMetrics(0);
             printLayout.setAscent(metrics.getAscent() + metrics.getDescent());
             printLayout.setDescent(metrics.getDescent());
-            printLayout.setText( to!(char[])(index) );
+            printLayout.setText( to!(String)(index) );
             int paintX = x - printMargin - printLayout.getBounds().width;
             printLayout.draw(gc, paintX, y);
             printLayout.setAscent(-1);
@@ -688,7 +689,7 @@
      * Starts a print job and prints the pages specified in the constructor.
      */
     public void run() {
-        char[] jobName = printOptions.jobName;
+        String jobName = printOptions.jobName;
         if (jobName is null) {
             jobName = "Printing";
         }
@@ -803,12 +804,12 @@
      * Don't write Unicode RTF on Windows 95/98/ME or NT.
      */
     void setUnicode() {
-//         const char[] Win95 = "windows 95";
-//         const char[] Win98 = "windows 98";
-//         const char[] WinME = "windows me";
-//         const char[] WinNT = "windows nt";
-//         char[] osName = System.getProperty("os.name").toLowerCase();
-//         char[] osVersion = System.getProperty("os.version");
+//         const String Win95 = "windows 95";
+//         const String Win98 = "windows 98";
+//         const String WinME = "windows me";
+//         const String WinNT = "windows nt";
+//         String osName = System.getProperty("os.name").toLowerCase();
+//         String osVersion = System.getProperty("os.version");
 //         int majorVersion = 0;
 //
 //         if (osName.startsWith(WinNT) && osVersion !is null) {
@@ -838,7 +839,7 @@
      * @param start start offset of segment. 0 based.
      * @param end end offset of segment
      */
-    void write(char[] string, int start, int end) {
+    void write(String string, int start, int end) {
         wchar[] wstring = tango.text.convert.Utf.toString16( string[ start .. end ] );
         start = 0;
         end = wstring.length;
@@ -933,7 +934,7 @@
      *   <li>ERROR_IO when the writer is closed.</li>
      * </ul>
      */
-    public override void writeLine(char[] line, int lineOffset) {
+    public override void writeLine(String line, int lineOffset) {
         if (isClosed()) {
             DWT.error(DWT.ERROR_IO);
         }
@@ -970,7 +971,7 @@
      *   <li>ERROR_IO when the writer is closed.</li>
      * </ul>
      */
-    public override void writeLineDelimiter(char[] lineDelimiter) {
+    public override void writeLineDelimiter(String lineDelimiter) {
         if (isClosed()) {
             DWT.error(DWT.ERROR_IO);
         }
@@ -995,7 +996,7 @@
      * @param lineBackground line background color to use for formatting.
      *  May be null.
      */
-    void writeStyledLine(char[] line, int lineOffset, int ranges[], StyleRange[] styles, Color lineBackground, int indent, int alignment, bool justify) {
+    void writeStyledLine(String line, int lineOffset, int ranges[], StyleRange[] styles, Color lineBackground, int indent, int alignment, bool justify) {
         int lineLength = line.length;
         int startOffset = getStart();
         int writeOffset = startOffset - lineOffset;
@@ -1173,13 +1174,13 @@
      *
      * @return the string
      */
-    public override char[] toString() {
+    public override String toString() {
         return buffer.toString();
     }
     /**
      * Appends the given string to the data.
      */
-    void write(char[] string) {
+    void write(String string) {
         buffer.append(string);
     }
     /**
@@ -1191,7 +1192,7 @@
      * @param string text to insert
      * @param offset offset in the existing data to insert "string" at.
      */
-    void write(char[] string, int offset) {
+    void write(String string, int offset) {
         if (offset < 0 || offset > buffer.length()) {
             return;
         }
@@ -1222,7 +1223,7 @@
      *   <li>ERROR_IO when the writer is closed.</li>
      * </ul>
      */
-    public void writeLine(char[] line, int lineOffset) {
+    public void writeLine(String line, int lineOffset) {
         if (isClosed_) {
             DWT.error(DWT.ERROR_IO);
         }
@@ -1238,7 +1239,7 @@
         }
         int copyEnd = Math.min(lineLength, endOffset - lineOffset);
         if (lineIndex < copyEnd) {
-            write(line[lineIndex .. copyEnd]);
+            write(line.substring(lineIndex, copyEnd));
         }
     }
     /**
@@ -1249,7 +1250,7 @@
      *   <li>ERROR_IO when the writer is closed.</li>
      * </ul>
      */
-    public void writeLineDelimiter(char[] lineDelimiter) {
+    public void writeLineDelimiter(String lineDelimiter) {
         if (isClosed_) {
             DWT.error(DWT.ERROR_IO);
         }
@@ -1566,7 +1567,7 @@
  * Appends a string to the text at the end of the widget.
  *
  * @param string the string to be appended
- * @see #replaceTextRange(int,int,char[])
+ * @see #replaceTextRange(int,int,String)
  * @exception DWTException <ul>
  *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
  *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
@@ -1575,7 +1576,7 @@
  *    <li>ERROR_NULL_ARGUMENT when listener is null</li>
  * </ul>
  */
-public void append(char[] string) {
+public void append(String string) {
     checkWidget();
     if (string is null) {
         DWT.error(DWT.ERROR_NULL_ARGUMENT);
@@ -1890,7 +1891,7 @@
  *  specified by the model. Returns only the first line if the widget
  *  has the DWT.SINGLE style.
  */
-char[] getModelDelimitedText(char[] text) {
+String getModelDelimitedText(String text) {
     int length = text.length;
     if (length is 0) {
         return text;
@@ -1899,27 +1900,25 @@
     int lfIndex = 0;
     int i = 0;
     StringBuffer convertedText = new StringBuffer(length);
-    char[] delimiter = getLineDelimiter();
+    String delimiter = getLineDelimiter();
     while (i < length) {
         if (crIndex !is -1) {
-            crIndex = tango.text.Util.locate( text, DWT.CR, i);
-            if( crIndex is text.length ) crIndex = -1;
+            crIndex = text.indexOf (DWT.CR, i);
         }
         if (lfIndex !is -1) {
-            lfIndex = tango.text.Util.locate( text, DWT.LF, i);
-            if( lfIndex is text.length ) lfIndex = -1;
+            lfIndex = text.indexOf (DWT.LF, i);
         }
         if (lfIndex is -1 && crIndex is -1) {   // no more line breaks?
             break;
         } else if ((crIndex < lfIndex && crIndex !is -1) || lfIndex is -1) {
-            convertedText.append(text[i .. crIndex]);
+            convertedText.append(text.substring(i, crIndex));
             if (lfIndex is crIndex + 1) {       // CR/LF combination?
                 i = lfIndex + 1;
             } else {
                 i = crIndex + 1;
             }
         } else {                                    // LF occurs before CR!
-            convertedText.append(text[i .. lfIndex]);
+            convertedText.append(text.substring(i, lfIndex));
             i = lfIndex + 1;
         }
         if (isSingleLine()) {
@@ -1930,7 +1929,7 @@
     // copy remaining text if any and if not in single line mode or no
     // text copied thus far (because there only is one line)
     if (i < length && (!isSingleLine() || convertedText.length() is 0)) {
-        convertedText.append(text[i .. $]);
+        convertedText.append(text.substring(i));
     }
     return convertedText.toString();
 }
@@ -2042,7 +2041,7 @@
     int caretWidth = BIDI_CARET_WIDTH;
     Display display = getDisplay();
     if (leftCaretBitmap !is null) {
-        if (defaultCaret !is null && leftCaretBitmap==defaultCaret.getImage()) {
+        if (defaultCaret !is null && leftCaretBitmap==/*eq*/defaultCaret.getImage()) {
             defaultCaret.setImage(null);
         }
         leftCaretBitmap.dispose();
@@ -2059,7 +2058,7 @@
     gc.dispose();
 
     if (rightCaretBitmap !is null) {
-        if (defaultCaret !is null && rightCaretBitmap==defaultCaret.getImage()) {
+        if (defaultCaret !is null && rightCaretBitmap==/*eq*/defaultCaret.getImage()) {
             defaultCaret.setImage(null);
         }
         rightCaretBitmap.dispose();
@@ -2254,7 +2253,7 @@
         // tab character (tabs are always inserted without overwriting)?
         int lineIndex = content.getLineAtOffset(event.end);
         int lineOffset = content.getOffsetAtLine(lineIndex);
-        char[] line = content.getLine(lineIndex);
+        String line = content.getLine(lineIndex);
         // replace character at caret offset if the caret is not at the
         // end of the line
         if (event.end < lineOffset + line.length) {
@@ -2567,10 +2566,10 @@
 }
 /**
  * Returns the offset of the word at the specified offset.
- * If the current selection : from high index to low index
+ * If the current selection extends from high index to low index
  * (i.e., right to left, or caret is at left border of selection on
  * non-bidi platforms) the start offset of the word preceding the
- * selection is returned. If the current selection : from
+ * selection is returned. If the current selection extends from
  * low index to high index the end offset of the word following
  * the selection is returned.
  *
@@ -3245,7 +3244,7 @@
 }
 Rectangle getBoundsAtOffset(int offset) {
     int lineIndex = content.getLineAtOffset(offset);
-    char[] line = content.getLine(lineIndex);
+    String line = content.getLine(lineIndex);
     Rectangle bounds;
     if (line.length !is 0) {
         int offsetInLine = offset - content.getOffsetAtLine(lineIndex);
@@ -3325,7 +3324,7 @@
     return dragDetect_;
 }
 /**
- * Returns whether the widget : double click mouse behavior.
+ * Returns whether the widget implements double click mouse behavior.
  *
  * @return true if double clicking a word selects the word, false if double clicks
  * have the same effect as regular mouse clicks
@@ -3451,6 +3450,7 @@
     if( auto p = key in keyActionMap ){
         return *p;
     }
+    return DWT.NULL;
 }
 /**
  * Gets the number of characters.
@@ -3572,7 +3572,7 @@
  * @param line line to get line background data for
  * @return line background data for the given line.
  */
-StyledTextEvent getLineBackgroundData(int lineOffset, char[] line) {
+StyledTextEvent getLineBackgroundData(int lineOffset, String line) {
     return sendLineEvent(LineGetBackground, lineOffset, line);
 }
 /**
@@ -3613,7 +3613,7 @@
  *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
  * </ul>
  */
-public char[] getLineDelimiter() {
+public String getLineDelimiter() {
     checkWidget();
     return content.getLineDelimiter();
 }
@@ -3751,7 +3751,7 @@
  * @return line style data for the given line. Styles may start before
  *  line start and end after line end
  */
-StyledTextEvent getLineStyleData(int lineOffset, char[] line) {
+StyledTextEvent getLineStyleData(int lineOffset, String line) {
     return sendLineEvent(LineGetStyle, lineOffset, line);
 }
 /**
@@ -3913,7 +3913,7 @@
     int x = point.x + horizontalScrollOffset - leftMargin ;
     int y = point.y - getLinePixel(lineIndex);
     int offsetInLine = layout.getOffset(x, y, trailing);
-    char[] line = content.getLine(lineIndex);
+    String line = content.getLine(lineIndex);
     if (offsetInLine !is line.length - 1) {
         offsetInLine = Math.min(line.length, offsetInLine + trailing[0]);
     }
@@ -3951,7 +3951,7 @@
             offsetInLine += trailing[0];
             caretAlignment = PREVIOUS_OFFSET_TRAILING;
         } else {
-            char[] line = content.getLine(lineIndex);
+            String line = content.getLine(lineIndex);
             int level;
             int offset = offsetInLine;
             while (offset > 0 && tango.text.Unicode.isDigit(line[offset])) offset--;
@@ -4021,11 +4021,11 @@
  * @return the content in the specified range using the platform line
  *  delimiter to separate lines as written by the specified TextWriter.
  */
-char[] getPlatformDelimitedText(TextWriter writer) {
+String getPlatformDelimitedText(TextWriter writer) {
     int end = writer.getStart() + writer.getCharCount();
     int startLine = content.getLineAtOffset(writer.getStart());
     int endLine = content.getLineAtOffset(end);
-    char[] endLineText = content.getLine(endLine);
+    String endLineText = content.getLine(endLine);
     int endLineOffset = content.getOffsetAtLine(endLine);
 
     for (int i = startLine; i <= endLine; i++) {
@@ -4214,7 +4214,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();
     return content.getTextRange(selection.x, selection.y - selection.x);
 }
@@ -4246,7 +4246,7 @@
  *      exceed the line length or have duplicates</li>
  * </ul>
  */
-int [] getBidiSegments(int lineOffset, char[] line) {
+int [] getBidiSegments(int lineOffset, String line) {
     if (!isBidi()) return null;
     if (!isListening(LineGetSegments)) {
         return getBidiSegmentsCompatibility(line, lineOffset);
@@ -4283,7 +4283,7 @@
  * @see #getBidiSegments
  * Supports deprecated setBidiColoring API. Remove when API is removed.
  */
-int [] getBidiSegmentsCompatibility(char[] line, int lineOffset) {
+int [] getBidiSegmentsCompatibility(String line, int lineOffset) {
     int lineLength = line.length;
     if (!bidiColoring) {
         return [0, lineLength];
@@ -4537,14 +4537,14 @@
  *    <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 content.getTextRange(0, getCharCount());
 }
 /**
  * Returns the widget content between the two offsets.
  *
- * @param start offset of the first character in the returned char[]
+ * @param start offset of the first character in the returned String
  * @param end offset of the last character in the returned String
  * @return widget content starting at start and ending at end
  * @see #getTextRange(int,int)
@@ -4556,7 +4556,7 @@
  *   <li>ERROR_INVALID_RANGE when start and/or end are outside the widget content</li>
  * </ul>
  */
-public char[] getText(int start, int end) {
+public String getText(int start, int end) {
     checkWidget();
     int contentLength = getCharCount();
     if (start < 0 || start >= contentLength || end < 0 || end >= contentLength || start > end) {
@@ -4598,7 +4598,7 @@
             if (i is lineStart && i is lineEnd) {
                 rect = layout.getBounds(start - lineOffset, end - lineOffset);
             } else if (i is lineStart) {
-                char[] line = content.getLine(i);
+                String line = content.getLine(i);
                 rect = layout.getBounds(start - lineOffset, line.length);
             } else if (i is lineEnd) {
                 rect = layout.getBounds(0, end - lineOffset);
@@ -4631,7 +4631,7 @@
  *   <li>ERROR_INVALID_RANGE when start and/or length are outside the widget content</li>
  * </ul>
  */
-public char[] getTextRange(int start, int length) {
+public String getTextRange(int start, int length) {
     checkWidget();
     int contentLength = getCharCount();
     int end = start + length;
@@ -4728,7 +4728,7 @@
     updateCaretDirection = false;
     int caretLine = getCaretLine();
     int lineOffset = content.getOffsetAtLine(caretLine);
-    char[] line = content.getLine(caretLine);
+    String line = content.getLine(caretLine);
     int offset = caretOffset - lineOffset;
     int lineLength = line.length;
     if (lineLength is 0) return isMirrored() ? DWT.RIGHT : DWT.LEFT;
@@ -4758,7 +4758,7 @@
 }
 int getWordNext (int offset, int movement) {
     int newOffset, lineOffset;
-    char[] lineText;
+    String lineText;
     if (offset >= getCharCount()) {
         newOffset = offset;
         int lineIndex = content.getLineCount() - 1;
@@ -4781,7 +4781,7 @@
 }
 int getWordPrevious(int offset, int movement) {
     int newOffset, lineOffset;
-    char[] lineText;
+    String lineText;
     if (offset <= 0) {
         newOffset = 0;
         int lineIndex = content.getLineAtOffset(newOffset);
@@ -4792,7 +4792,7 @@
         lineOffset = content.getOffsetAtLine(lineIndex);
         lineText = content.getLine(lineIndex);
         if (offset is lineOffset) {
-            char[] nextLineText = content.getLine(lineIndex - 1);
+            String nextLineText = content.getLine(lineIndex - 1);
             int nextLineOffset = content.getOffsetAtLine(lineIndex - 1);
             newOffset = nextLineOffset + nextLineText.length;
         } else {
@@ -4823,7 +4823,7 @@
  */
 Point getPointAtOffset(int offset) {
     int lineIndex = content.getLineAtOffset(offset);
-    char[] line = content.getLine(lineIndex);
+    String line = content.getLine(lineIndex);
     int lineOffset = content.getOffsetAtLine(lineIndex);
     int offsetInLine = offset - lineOffset;
     int lineLength = line.length;
@@ -4865,7 +4865,7 @@
  * Inserts a string.  The old selection is replaced with the new text.
  *
  * @param string the string
- * @see #replaceTextRange(int,int,char[])
+ * @see #replaceTextRange(int,int,String)
  * @exception DWTException <ul>
  *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
  *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
@@ -4874,7 +4874,7 @@
  *    <li>ERROR_NULL_ARGUMENT when string is null</li>
  * </ul>
  */
-public void insert(char[] string) {
+public void insert(String string) {
     checkWidget();
     if (string is null) {
         DWT.error(DWT.ERROR_NULL_ARGUMENT);
@@ -5208,7 +5208,7 @@
     //paste clipboard selection
     if (event.button is 2) {
         auto o = cast(ArrayWrapperString)getClipboardContent(DND.SELECTION_CLIPBOARD);
-        char[] text = o.array;
+        String text = o.array;
         if (text !is null && text.length > 0) {
             // position cursor
             doMouseLocationChange(event.x, event.y, false);
@@ -5524,7 +5524,7 @@
     final Accessible accessible = getAccessible();
     accessible.addAccessibleListener(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());
@@ -5535,10 +5535,10 @@
             e.result = getToolTipText();
         }
         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') {
@@ -5598,14 +5598,14 @@
     }
     return null;
 }
-char[] stripMnemonic (char[] string) {
+String stripMnemonic (String string) {
     int index = 0;
     int length_ = string.length;
     do {
         while ((index < length_) && (string[index] !is '&')) index++;
         if (++index >= length_) return string;
         if (string[index] !is '&') {
-            return string[0 .. index-1] ~ string[index .. length_];
+            return string.substring(0, index-1) ~ string.substring(index, length_);
         }
         index++;
     } while (index < length_);
@@ -5616,7 +5616,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;
@@ -5916,7 +5916,7 @@
  */
 public void paste(){
     checkWidget();
-    char[] text = (cast(ArrayWrapperString) getClipboardContent(DND.CLIPBOARD)).array;
+    String text = (cast(ArrayWrapperString) getClipboardContent(DND.CLIPBOARD)).array;
     if (text !is null && text.length > 0) {
         Event event = new Event();
         event.start = selection.x;
@@ -6393,7 +6393,7 @@
  *   <li>ERROR_NULL_ARGUMENT when string is null</li>
  * </ul>
  */
-public void replaceTextRange(int start, int length, char[] text) {
+public void replaceTextRange(int start, int length, String text) {
     checkWidget();
     if (text is null) {
         DWT.error(DWT.ERROR_NULL_ARGUMENT);
@@ -6636,7 +6636,7 @@
  * @return StyledTextEvent that can be used to request line data
  *  for the given line.
  */
-StyledTextEvent sendLineEvent(int eventType, int lineOffset, char[] line) {
+StyledTextEvent sendLineEvent(int eventType, int lineOffset, String line) {
     StyledTextEvent event = null;
     if (isListening(eventType)) {
         event = new StyledTextEvent(content);
@@ -6673,7 +6673,7 @@
     event.y = selection.y;
     notifyListeners(DWT.Selection, event);
 }
-int sendWordBoundaryEvent(int eventType, int movement, int offset, int newOffset, char[] lineText, int lineOffset) {
+int sendWordBoundaryEvent(int eventType, int movement, int offset, int newOffset, String lineText, int lineOffset) {
     if (isListening(eventType)) {
         StyledTextEvent event = new StyledTextEvent(content);
         event.detail = lineOffset;
@@ -6872,7 +6872,7 @@
     if (clipboardType is DND.SELECTION_CLIPBOARD && !(IS_MOTIF || IS_GTK)) return;
     TextTransfer plainTextTransfer = TextTransfer.getInstance();
     TextWriter plainTextWriter = new TextWriter(start, length);
-    char[] plainText = getPlatformDelimitedText(plainTextWriter);
+    String plainText = getPlatformDelimitedText(plainTextWriter);
     Object[] data;
     Transfer[] types;
     if (clipboardType is DND.SELECTION_CLIPBOARD) {
@@ -6881,7 +6881,7 @@
     } else {
         RTFTransfer rtfTransfer = RTFTransfer.getInstance();
         RTFWriter rtfWriter = new RTFWriter(start, length);
-        char[] rtfText = getPlatformDelimitedText(rtfWriter);
+        String rtfText = getPlatformDelimitedText(rtfWriter);
         data = [ cast(Object) new ArrayWrapperString(rtfText), new ArrayWrapperString(plainText) ];
         types = [ cast(Transfer)rtfTransfer, plainTextTransfer];
     }
@@ -8032,7 +8032,7 @@
  *    <li>ERROR_NULL_ARGUMENT when string is null</li>
  * </ul>
  */
-public void setText(char[] text) {
+public void setText(String text) {
     checkWidget();
     if (text is null) {
         DWT.error(DWT.ERROR_NULL_ARGUMENT);
--- a/dwt/graphics/TextLayout.d	Mon Feb 18 00:49:58 2008 +0100
+++ b/dwt/graphics/TextLayout.d	Thu Feb 21 01:58:48 2008 +0100
@@ -118,7 +118,7 @@
 void computeRuns () {
     if (attrList !is null) return;
     char[] segmentsText = getSegmentsText();
-    OS.pango_layout_set_text (layout, toStringz(segmentsText), segmentsText.length);
+    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);
     attrList = OS.pango_attr_list_new();
@@ -129,7 +129,7 @@
     if ((ascent !is -1  || descent !is -1) && segementsWLength > 0) {
         auto iter = OS.pango_layout_get_iter(layout);
         if (iter is null) DWT.error(DWT.ERROR_NO_HANDLES);
-        PangoRectangle* rect = new PangoRectangle();
+        PangoRectangle rect;
         if (ascent !is -1) rect.y =  -(ascent  * OS.PANGO_SCALE);
         rect.height = (Math.max(0, ascent) + Math.max(0, descent)) * OS.PANGO_SCALE;
         int lineCount = OS.pango_layout_get_line_count(layout);
@@ -139,11 +139,11 @@
             int bytePos = OS.pango_layout_iter_get_index(iter);
             /* Note: The length in bytes of ZWS and ZWNBS are both equals to 3 */
             int offset = count * 6;
-            PangoAttribute* attr = OS.pango_attr_shape_new (rect, rect);
+            PangoAttribute* attr = OS.pango_attr_shape_new (&rect, &rect);
             attr.start_index = bytePos + offset;
             attr.end_index = bytePos + offset + 3;
             OS.pango_attr_list_insert(attrList, attr);
-            attr = OS.pango_attr_shape_new (rect, rect);
+            attr = OS.pango_attr_shape_new (&rect, &rect);
             attr.start_index = bytePos + offset + 3;
             attr.end_index = bytePos + offset + 6;
             OS.pango_attr_list_insert(attrList, attr);
@@ -229,11 +229,11 @@
         }
         GlyphMetrics metrics = style.metrics;
         if (metrics !is null) {
-            PangoRectangle* rect = new PangoRectangle();
+            PangoRectangle rect;
             rect.y =  -(metrics.ascent * OS.PANGO_SCALE);
             rect.height = (metrics.ascent + metrics.descent) * OS.PANGO_SCALE;
             rect.width = metrics.width * OS.PANGO_SCALE;
-            auto attr = OS.pango_attr_shape_new (rect, rect);
+            auto attr = OS.pango_attr_shape_new (&rect, &rect);
             attr.start_index = byteStart;
             attr.end_index = byteEnd;
             OS.pango_attr_list_insert(attrList, attr);
@@ -352,7 +352,7 @@
         PangoLogAttr* attrs;
         int nAttrs;
         PangoLogAttr* logAttr = new PangoLogAttr();
-        PangoRectangle* rect = new PangoRectangle();
+        PangoRectangle rect;
         int lineCount = OS.pango_layout_get_line_count(layout);
         auto ptr = OS.pango_layout_get_text(layout);
         auto iter = OS.pango_layout_get_iter(layout);
@@ -367,7 +367,7 @@
         int lineIndex = 0;
         do {
             int lineEnd;
-            OS.pango_layout_iter_get_line_extents(iter, null, rect);
+            OS.pango_layout_iter_get_line_extents(iter, null, &rect);
             if (OS.pango_layout_iter_next_line(iter)) {
                 int bytePos = OS.pango_layout_iter_get_index(iter);
                 lineEnd = OS.g_utf8_pointer_to_offset(ptr, ptr + bytePos);
@@ -590,7 +590,7 @@
     int[] ranges = [byteStart, byteEnd];
     auto clipRegion = OS.gdk_pango_layout_get_clip_region(layout, 0, 0, ranges.ptr, 1);
     if (clipRegion is null) return new Rectangle(0, 0, 0, 0);
-    GdkRectangle* rect = new GdkRectangle();
+    GdkRectangle rect;
 
     /*
     * Bug in Pango. The region returned by gdk_pango_layout_get_clip_region()
@@ -615,13 +615,13 @@
         rect.y = OS.PANGO_PIXELS(pangoRect.y);
         rect.width = OS.PANGO_PIXELS(pangoRect.width);
         rect.height = OS.PANGO_PIXELS(pangoRect.height);
-        OS.gdk_region_union_with_rect(linesRegion, rect);
+        OS.gdk_region_union_with_rect(linesRegion, &rect);
     } while (lineEnd + 1 <= byteEnd);
     OS.gdk_region_intersect(clipRegion, linesRegion);
     OS.gdk_region_destroy(linesRegion);
     OS.pango_layout_iter_free(iter);
 
-    OS.gdk_region_get_clipbox(clipRegion, rect);
+    OS.gdk_region_get_clipbox(clipRegion, &rect);
     OS.gdk_region_destroy(clipRegion);
     return new Rectangle(rect.x, rect.y, rect.width, rect.height);
 }
@@ -757,8 +757,8 @@
     auto iter = OS.pango_layout_get_iter(layout);
     if (iter is null) DWT.error(DWT.ERROR_NO_HANDLES);
     for (int i = 0; i < lineIndex; i++) OS.pango_layout_iter_next_line(iter);
-    PangoRectangle* rect = new PangoRectangle();
-    OS.pango_layout_iter_get_line_extents(iter, null, rect);
+    PangoRectangle rect;
+    OS.pango_layout_iter_get_line_extents(iter, null, &rect);
     OS.pango_layout_iter_free(iter);
     int x = OS.PANGO_PIXELS(rect.x);
     int y = OS.PANGO_PIXELS(rect.y);
@@ -850,8 +850,8 @@
         descent = OS.pango_font_metrics_get_descent(metrics);
         OS.pango_font_metrics_unref(metrics);
     } else {
-        PangoRectangle* rect = new PangoRectangle();
-        OS.pango_layout_line_get_extents(OS.pango_layout_get_line(layout, lineIndex), null, rect);
+        PangoRectangle rect;
+        OS.pango_layout_line_get_extents(OS.pango_layout_get_line(layout, lineIndex), null, &rect);
         ascent = -rect.y;
         descent = rect.height - ascent;
     }
@@ -1054,9 +1054,9 @@
     */
     auto iter = OS.pango_layout_get_iter(layout);
     if (iter is null) DWT.error(DWT.ERROR_NO_HANDLES);
-    PangoRectangle* rect = new PangoRectangle();
+    PangoRectangle rect;
     do {
-        OS.pango_layout_iter_get_line_extents(iter, null, rect);
+        OS.pango_layout_iter_get_line_extents(iter, null, &rect);
         rect.y = OS.PANGO_PIXELS(rect.y);
         rect.height = OS.PANGO_PIXELS(rect.height);
         if (rect.y <= y && y < rect.y + rect.height) {