Mercurial > projects > dwt-mac
comparison 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 |
comparison
equal
deleted
inserted
replaced
6:b903c16b6f48 | 7:e831403a80a9 |
---|---|
151 Control[] cArray = getControls(false); | 151 Control[] cArray = getControls(false); |
152 int[] ratios = new int[cArray.length]; | 152 int[] ratios = new int[cArray.length]; |
153 for (int i = 0; i < cArray.length; i++) { | 153 for (int i = 0; i < cArray.length; i++) { |
154 Object data = cArray[i].getLayoutData(); | 154 Object data = cArray[i].getLayoutData(); |
155 if (data !is null && data instanceof SashFormData) { | 155 if (data !is null && data instanceof SashFormData) { |
156 ratios[i] = (int)(((SashFormData)data).weight * 1000 >> 16); | 156 ratios[i] = cast(int)((cast(SashFormData)data).weight * 1000 >> 16); |
157 } else { | 157 } else { |
158 ratios[i] = 200; | 158 ratios[i] = 200; |
159 } | 159 } |
160 } | 160 } |
161 return ratios; | 161 return ratios; |
173 result = newResult; | 173 result = newResult; |
174 } | 174 } |
175 return result; | 175 return result; |
176 } | 176 } |
177 void onDragSash(Event event) { | 177 void onDragSash(Event event) { |
178 Sash sash = (Sash)event.widget; | 178 Sash sash = cast(Sash)event.widget; |
179 int sashIndex = -1; | 179 int sashIndex = -1; |
180 for (int i= 0; i < sashes.length; i++) { | 180 for (int i= 0; i < sashes.length; i++) { |
181 if (sashes[i] is sash) { | 181 if (sashes[i] is sash) { |
182 sashIndex = i; | 182 sashIndex = i; |
183 break; | 183 break; |
222 Object data2 = c2.getLayoutData(); | 222 Object data2 = c2.getLayoutData(); |
223 if (data2 is null || !(data2 instanceof SashFormData)) { | 223 if (data2 is null || !(data2 instanceof SashFormData)) { |
224 data2 = new SashFormData(); | 224 data2 = new SashFormData(); |
225 c2.setLayoutData(data2); | 225 c2.setLayoutData(data2); |
226 } | 226 } |
227 ((SashFormData)data1).weight = (((long)b1.width << 16) + area.width - 1) / area.width; | 227 (cast(SashFormData)data1).weight = ((cast(long)b1.width << 16) + area.width - 1) / area.width; |
228 ((SashFormData)data2).weight = (((long)b2.width << 16) + area.width - 1) / area.width; | 228 (cast(SashFormData)data2).weight = ((cast(long)b2.width << 16) + area.width - 1) / area.width; |
229 } else { | 229 } else { |
230 correction = b1.height < DRAG_MINIMUM || b2.height < DRAG_MINIMUM; | 230 correction = b1.height < DRAG_MINIMUM || b2.height < DRAG_MINIMUM; |
231 int totalHeight = b2.y + b2.height - b1.y; | 231 int totalHeight = b2.y + b2.height - b1.y; |
232 int shift = event.y - sashBounds.y; | 232 int shift = event.y - sashBounds.y; |
233 b1.height += shift; | 233 b1.height += shift; |
255 Object data2 = c2.getLayoutData(); | 255 Object data2 = c2.getLayoutData(); |
256 if (data2 is null || !(data2 instanceof SashFormData)) { | 256 if (data2 is null || !(data2 instanceof SashFormData)) { |
257 data2 = new SashFormData(); | 257 data2 = new SashFormData(); |
258 c2.setLayoutData(data2); | 258 c2.setLayoutData(data2); |
259 } | 259 } |
260 ((SashFormData)data1).weight = (((long)b1.height << 16) + area.height - 1) / area.height; | 260 (cast(SashFormData)data1).weight = ((cast(long)b1.height << 16) + area.height - 1) / area.height; |
261 ((SashFormData)data2).weight = (((long)b2.height << 16) + area.height - 1) / area.height; | 261 (cast(SashFormData)data2).weight = ((cast(long)b2.height << 16) + area.height - 1) / area.height; |
262 } | 262 } |
263 if (correction || (event.doit && event.detail !is DWT.DRAG)) { | 263 if (correction || (event.doit && event.detail !is DWT.DRAG)) { |
264 c1.setBounds(b1); | 264 c1.setBounds(b1); |
265 sash.setBounds(event.x, event.y, event.width, event.height); | 265 sash.setBounds(event.x, event.y, event.width, event.height); |
266 c2.setBounds(b2); | 266 c2.setBounds(b2); |
418 Object data = cArray[i].getLayoutData(); | 418 Object data = cArray[i].getLayoutData(); |
419 if (data is null || !(data instanceof SashFormData)) { | 419 if (data is null || !(data instanceof SashFormData)) { |
420 data = new SashFormData(); | 420 data = new SashFormData(); |
421 cArray[i].setLayoutData(data); | 421 cArray[i].setLayoutData(data); |
422 } | 422 } |
423 ((SashFormData)data).weight = (((long)weights[i] << 16) + total - 1) / total; | 423 (cast(SashFormData)data).weight = ((cast(long)weights[i] << 16) + total - 1) / total; |
424 } | 424 } |
425 | 425 |
426 layout(false); | 426 layout(false); |
427 } | 427 } |
428 } | 428 } |