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

Add 'cast' to casts
author Frank Benoit <benoit@tionex.de>
date Wed, 27 Aug 2008 14:30:35 +0200
parents 1a8b3cb347e0
children a9ab4c738ed8
line wrap: on
line diff
--- a/dwt/custom/SashForm.d	Wed Aug 27 14:10:03 2008 +0200
+++ b/dwt/custom/SashForm.d	Wed Aug 27 14:30:35 2008 +0200
@@ -153,7 +153,7 @@
     for (int i = 0; i < cArray.length; i++) {
         Object data = cArray[i].getLayoutData();
         if (data !is null && data instanceof SashFormData) {
-            ratios[i] = (int)(((SashFormData)data).weight * 1000 >> 16);
+            ratios[i] = cast(int)((cast(SashFormData)data).weight * 1000 >> 16);
         } else {
             ratios[i] = 200;
         }
@@ -175,7 +175,7 @@
     return result;
 }
 void onDragSash(Event event) {
-    Sash sash = (Sash)event.widget;
+    Sash sash = cast(Sash)event.widget;
     int sashIndex = -1;
     for (int i= 0; i < sashes.length; i++) {
         if (sashes[i] is sash) {
@@ -224,8 +224,8 @@
             data2 = new SashFormData();
             c2.setLayoutData(data2);
         }
-        ((SashFormData)data1).weight = (((long)b1.width << 16) + area.width - 1) / area.width;
-        ((SashFormData)data2).weight = (((long)b2.width << 16) + area.width - 1) / area.width;
+        (cast(SashFormData)data1).weight = ((cast(long)b1.width << 16) + area.width - 1) / area.width;
+        (cast(SashFormData)data2).weight = ((cast(long)b2.width << 16) + area.width - 1) / area.width;
     } else {
         correction = b1.height < DRAG_MINIMUM || b2.height < DRAG_MINIMUM;
         int totalHeight = b2.y + b2.height - b1.y;
@@ -257,8 +257,8 @@
             data2 = new SashFormData();
             c2.setLayoutData(data2);
         }
-        ((SashFormData)data1).weight = (((long)b1.height << 16) + area.height - 1) / area.height;
-        ((SashFormData)data2).weight = (((long)b2.height << 16) + area.height - 1) / area.height;
+        (cast(SashFormData)data1).weight = ((cast(long)b1.height << 16) + area.height - 1) / area.height;
+        (cast(SashFormData)data2).weight = ((cast(long)b2.height << 16) + area.height - 1) / area.height;
     }
     if (correction || (event.doit && event.detail !is DWT.DRAG)) {
         c1.setBounds(b1);
@@ -420,7 +420,7 @@
             data = new SashFormData();
             cArray[i].setLayoutData(data);
         }
-        ((SashFormData)data).weight = (((long)weights[i] << 16) + total - 1) / total;
+        (cast(SashFormData)data).weight = ((cast(long)weights[i] << 16) + total - 1) / total;
     }
 
     layout(false);