diff dwt/custom/StyledText.d @ 7:e831403a80a9

Add 'cast' to casts
author Frank Benoit <benoit@tionex.de>
date Wed, 27 Aug 2008 14:30:35 +0200
parents b903c16b6f48
children db5a898b2119
line wrap: on
line diff
--- a/dwt/custom/StyledText.d	Wed Aug 27 14:10:03 2008 +0200
+++ b/dwt/custom/StyledText.d	Wed Aug 27 14:30:35 2008 +0200
@@ -273,7 +273,7 @@
             Color color = printerRenderer.getLineBackground(i, null);
             if (color !is null) {
                 if (printOptions.printLineBackground) {
-                    Color printerColor = (Color)resources.get(color);
+                    Color printerColor = cast(Color)resources.get(color);
                     if (printerColor is null) {
                         printerColor = new Color (printer, color.getRGB());
                         resources.put(color, printerColor); 
@@ -293,7 +293,7 @@
             StyleRange style = styles[i];
             Font font = style.font;
             if (style.font !is null) {
-                Font printerFont = (Font)resources.get(font);
+                Font printerFont = cast(Font)resources.get(font);
                 if (printerFont is null) {
                     printerFont = new Font (printer, font.getFontData());
                     resources.put(font, printerFont);                   
@@ -302,7 +302,7 @@
             }
             Color color = style.foreground;
             if (color !is null) {
-                Color printerColor = (Color)resources.get(color);
+                Color printerColor = cast(Color)resources.get(color);
                 if (printOptions.printTextForeground) {
                     if (printerColor is null) {
                         printerColor = new Color (printer, color.getRGB());
@@ -315,7 +315,7 @@
             }
             color = style.background;
             if (color !is null) {
-                Color printerColor = (Color)resources.get(color);
+                Color printerColor = cast(Color)resources.get(color);
                 if (printOptions.printTextBackground) {
                     if (printerColor is null) {
                         printerColor = new Color (printer, color.getRGB());
@@ -373,7 +373,7 @@
         if (resources !is null) {
             Enumeration enumeration = resources.elements();         
             while (enumeration.hasMoreElements()) {
-                Resource resource = (Resource) enumeration.nextElement();
+                Resource resource = cast(Resource) enumeration.nextElement();
                 resource.dispose();
             }
             resources = null;
@@ -505,7 +505,7 @@
                     int height = paragraphBottom - paintY;
                     gc.setClipping(clientArea.x, paintY, clientArea.width, height);
                     printLine(paintX, paintY, gc, foreground, lineBackground, layout, printLayout, i);
-                    gc.setClipping((Rectangle)null);
+                    gc.setClipping(cast(Rectangle)null);
                     printDecoration(page, false, printLayout);
                     printer.endPage();                  
                     page++;
@@ -516,7 +516,7 @@
                         int layoutHeight = layout.getBounds().height;
                         gc.setClipping(clientArea.x, clientArea.y, clientArea.width, layoutHeight - height);
                         printLine(paintX, paintY, gc, foreground, lineBackground, layout, printLayout, i);
-                        gc.setClipping((Rectangle)null);
+                        gc.setClipping(cast(Rectangle)null);
                         paintY += layoutHeight;
                     }
                 }
@@ -779,7 +779,7 @@
                     write(String.substring(start, index));
                 }
                 write("\\u");
-                write(Integer.toString((short) ch));
+                write(Integer.toString(cast(short) ch));
                 write(' ');                     // control word delimiter
                 start = index + 1;
             } else if (ch is '}' || ch is '{' || ch is '\\') {
@@ -821,13 +821,13 @@
             header.append("\\f");
             header.append(i);
             header.append(" ");
-            FontData fd = ((Font)fontTable.elementAt(i)).getFontData()[0];
+            FontData fd = (cast(Font)fontTable.elementAt(i)).getFontData()[0];
             header.append(fd.getName());
             header.append(";");         
         }
         header.append("}}\n{\\colortbl");
         for (int i = 0; i < colorTable.size(); i++) {
-            Color color = (Color) colorTable.elementAt(i);
+            Color color = cast(Color) colorTable.elementAt(i);
             header.append("\\red");
             header.append(color.getRed());
             header.append("\\green");
@@ -3367,7 +3367,7 @@
  */
 public int getKeyBinding(int key) {
     checkWidget();
-    Integer action = (Integer) keyActionMap.get(new Integer(key));  
+    Integer action = cast(Integer) keyActionMap.get(new Integer(key));  
     return action is null ? DWT.NULL : action.intValue();
 }
 /**
@@ -4069,8 +4069,8 @@
  * @return start and end of the selection, x is the offset of the first 
  *  selected character, y is the offset after the last selected character.
  *  The selection values returned are visual (i.e., x will always always be   
- *  <= y).  To determine if a selection is right-to-left (RtoL) vs. left-to-right 
- *  (LtoR), compare the caretOffset to the start and end of the selection 
+ *  <= y).  To determine if a selection is right-to-left cast(RtoL) vs. left-to-right 
+ *  cast(LtoR), compare the caretOffset to the start and end of the selection 
  *  (e.g., caretOffset is start of selection implies that the selection is RtoL).
  * @see #getSelectionRange
  * @exception DWTException <ul>
@@ -4089,8 +4089,8 @@
  *  first selected character, relative to the first character of the 
  *  widget content. y is the length of the selection. 
  *  The selection values returned are visual (i.e., length will always always be   
- *  positive).  To determine if a selection is right-to-left (RtoL) vs. left-to-right 
- *  (LtoR), compare the caretOffset to the start and end of the selection 
+ *  positive).  To determine if a selection is right-to-left cast(RtoL) vs. left-to-right 
+ *  cast(LtoR), compare the caretOffset to the start and end of the selection 
  *  (e.g., caretOffset is start of selection implies that the selection is RtoL).
  * @exception DWTException <ul>
  *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
@@ -5197,7 +5197,7 @@
         
     //paste clipboard selection
     if (event.button is 2) {
-        String text = (String)getClipboardContent(DND.SELECTION_CLIPBOARD);
+        String text = cast(String)getClipboardContent(DND.SELECTION_CLIPBOARD);
         if (text !is null && text.length() > 0) {
             // position cursor
             doMouseLocationChange(event.x, event.y, false);
@@ -5578,7 +5578,7 @@
     for (int i = 0; i < siblings.length; i++) {
         if (siblings [i] is StyledText.this) {
             if (i > 0 && siblings [i-1] instanceof Label) {
-                return (Label) siblings [i-1];
+                return cast(Label) siblings [i-1];
             }
         }
     }
@@ -5901,7 +5901,7 @@
  */
 public void paste(){
     checkWidget();  
-    String text = (String) getClipboardContent(DND.CLIPBOARD);
+    String text = cast(String) getClipboardContent(DND.CLIPBOARD);
     if (text !is null && text.length() > 0) {
         Event event = new Event();
         event.start = selection.x;
@@ -7139,7 +7139,7 @@
 public void setKeyBinding(int key, int action) {
     checkWidget();
     int modifierValue = key & DWT.MODIFIER_MASK;
-    char keyChar = (char)(key & DWT.KEY_MASK);
+    char keyChar = cast(wchar)(key & DWT.KEY_MASK);
     if (Compatibility.isLetter(keyChar)) {
         // make the keybinding case insensitive by adding it
         // in its upper and lower case form