Mercurial > projects > dwt-mac
diff dwt/custom/SashFormLayout.d @ 7:e831403a80a9
Add 'cast' to casts
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Wed, 27 Aug 2008 14:30:35 +0200 |
parents | 380af2bdd8e5 |
children | a9ab4c738ed8 |
line wrap: on
line diff
--- a/dwt/custom/SashFormLayout.d Wed Aug 27 14:10:03 2008 +0200 +++ b/dwt/custom/SashFormLayout.d Wed Aug 27 14:30:35 2008 +0200 @@ -21,7 +21,7 @@ */ class SashFormLayout : Layout { protected Point computeSize(Composite composite, int wHint, int hHint, bool flushCache) { - SashForm sashForm = (SashForm)composite; + SashForm sashForm = cast(SashForm)composite; Control[] cArray = sashForm.getControls(true); int width = 0; int height = 0; @@ -57,11 +57,11 @@ for (int i = 0; i < cArray.length; i++) { Object data = cArray[i].getLayoutData(); if (data !is null && data instanceof SashFormData) { - ratios[i] = ((SashFormData)data).weight; + ratios[i] = (cast(SashFormData)data).weight; } else { data = new SashFormData(); cArray[i].setLayoutData(data); - ((SashFormData)data).weight = ratios[i] = ((200 << 16) + 999) / 1000; + (cast(SashFormData)data).weight = ratios[i] = ((200 << 16) + 999) / 1000; } total += ratios[i]; @@ -69,9 +69,9 @@ if (ratios[maxIndex] > 0) { int sashwidth = sashForm.sashes.length > 0 ? sashForm.SASH_WIDTH + sashForm.sashes [0].getBorderWidth() * 2 : sashForm.SASH_WIDTH; if (vertical) { - height += (int)(total * maxValue / ratios[maxIndex]) + (cArray.length - 1) * sashwidth; + height += cast(int)(total * maxValue / ratios[maxIndex]) + (cArray.length - 1) * sashwidth; } else { - width += (int)(total * maxValue / ratios[maxIndex]) + (cArray.length - 1) * sashwidth; + width += cast(int)(total * maxValue / ratios[maxIndex]) + (cArray.length - 1) * sashwidth; } } width += sashForm.getBorderWidth()*2; @@ -86,7 +86,7 @@ } protected void layout(Composite composite, bool flushCache) { - SashForm sashForm = (SashForm)composite; + SashForm sashForm = cast(SashForm)composite; Rectangle area = sashForm.getClientArea(); if (area.width <= 1 || area.height <= 1) return; @@ -142,11 +142,11 @@ for (int i = 0; i < controls.length; i++) { Object data = controls[i].getLayoutData(); if (data !is null && data instanceof SashFormData) { - ratios[i] = ((SashFormData)data).weight; + ratios[i] = (cast(SashFormData)data).weight; } else { data = new SashFormData(); controls[i].setLayoutData(data); - ((SashFormData)data).weight = ratios[i] = ((200 << 16) + 999) / 1000; + (cast(SashFormData)data).weight = ratios[i] = ((200 << 16) + 999) / 1000; } total += ratios[i]; @@ -154,14 +154,14 @@ int sashwidth = sashes.length > 0 ? sashForm.SASH_WIDTH + sashes [0].getBorderWidth() * 2 : sashForm.SASH_WIDTH; if (sashForm.getOrientation() is DWT.HORIZONTAL) { - int width = (int)(ratios[0] * (area.width - sashes.length * sashwidth) / total); + int width = cast(int)(ratios[0] * (area.width - sashes.length * sashwidth) / total); int x = area.x; controls[0].setBounds(x, area.y, width, area.height); x += width; for (int i = 1; i < controls.length - 1; i++) { sashes[i - 1].setBounds(x, area.y, sashwidth, area.height); x += sashwidth; - width = (int)(ratios[i] * (area.width - sashes.length * sashwidth) / total); + width = cast(int)(ratios[i] * (area.width - sashes.length * sashwidth) / total); controls[i].setBounds(x, area.y, width, area.height); x += width; } @@ -172,14 +172,14 @@ controls[controls.length - 1].setBounds(x, area.y, width, area.height); } } else { - int height = (int)(ratios[0] * (area.height - sashes.length * sashwidth) / total); + int height = cast(int)(ratios[0] * (area.height - sashes.length * sashwidth) / total); int y = area.y; controls[0].setBounds(area.x, y, area.width, height); y += height; for (int i = 1; i < controls.length - 1; i++) { sashes[i - 1].setBounds(area.x, y, area.width, sashwidth); y += sashwidth; - height = (int)(ratios[i] * (area.height - sashes.length * sashwidth) / total); + height = cast(int)(ratios[i] * (area.height - sashes.length * sashwidth) / total); controls[i].setBounds(area.x, y, area.width, height); y += height; }