comparison dwtx/jface/internal/text/source/DiffPainter.d @ 134:51e6e63f930e

Regex fix for casts
author Frank Benoit <benoit@tionex.de>
date Sun, 24 Aug 2008 01:46:20 +0200
parents 7d818bd32d63
children 65801ad2b265
comparison
equal deleted inserted replaced
133:7d818bd32d63 134:51e6e63f930e
208 /** 208 /**
209 * Disposes of this painter and releases any resources. 209 * Disposes of this painter and releases any resources.
210 */ 210 */
211 private void handleDispose() { 211 private void handleDispose() {
212 if (fLineDiffer !is null) { 212 if (fLineDiffer !is null) {
213 ((IAnnotationModel) fLineDiffer).removeAnnotationModelListener(fAnnotationListener); 213 (cast(IAnnotationModel) fLineDiffer).removeAnnotationModelListener(fAnnotationListener);
214 fLineDiffer= null; 214 fLineDiffer= null;
215 } 215 }
216 } 216 }
217 217
218 /** 218 /**
340 * @see IVerticalRulerColumn#setModel(IAnnotationModel) 340 * @see IVerticalRulerColumn#setModel(IAnnotationModel)
341 */ 341 */
342 public void setModel(IAnnotationModel model) { 342 public void setModel(IAnnotationModel model) {
343 IAnnotationModel newModel; 343 IAnnotationModel newModel;
344 if (model instanceof IAnnotationModelExtension) 344 if (model instanceof IAnnotationModelExtension)
345 newModel= ((IAnnotationModelExtension) model).getAnnotationModel(IChangeRulerColumn.QUICK_DIFF_MODEL_ID); 345 newModel= (cast(IAnnotationModelExtension) model).getAnnotationModel(IChangeRulerColumn.QUICK_DIFF_MODEL_ID);
346 else 346 else
347 newModel= model; 347 newModel= model;
348 348
349 setDiffer(newModel); 349 setDiffer(newModel);
350 } 350 }
356 */ 356 */
357 private void setDiffer(IAnnotationModel differ) { 357 private void setDiffer(IAnnotationModel differ) {
358 if (differ instanceof ILineDiffer) { 358 if (differ instanceof ILineDiffer) {
359 if (fLineDiffer !is differ) { 359 if (fLineDiffer !is differ) {
360 if (fLineDiffer !is null) 360 if (fLineDiffer !is null)
361 ((IAnnotationModel) fLineDiffer).removeAnnotationModelListener(fAnnotationListener); 361 (cast(IAnnotationModel) fLineDiffer).removeAnnotationModelListener(fAnnotationListener);
362 fLineDiffer= (ILineDiffer) differ; 362 fLineDiffer= cast(ILineDiffer) differ;
363 if (fLineDiffer !is null) 363 if (fLineDiffer !is null)
364 ((IAnnotationModel) fLineDiffer).addAnnotationModelListener(fAnnotationListener); 364 (cast(IAnnotationModel) fLineDiffer).addAnnotationModelListener(fAnnotationListener);
365 } 365 }
366 } 366 }
367 } 367 }
368 368
369 /** 369 /**
496 * @param bg the background color 496 * @param bg the background color
497 * @param scale the scale factor 497 * @param scale the scale factor
498 * @return the interpolated color 498 * @return the interpolated color
499 */ 499 */
500 private static RGB interpolate(RGB fg, RGB bg, double scale) { 500 private static RGB interpolate(RGB fg, RGB bg, double scale) {
501 return new RGB((int) ((1.0 - scale) * fg.red + scale * bg.red), (int) ((1.0 - scale) * fg.green + scale * bg.green), (int) ((1.0 - scale) * fg.blue + scale * bg.blue)); 501 return new RGB(cast(int) ((1.0 - scale) * fg.red + scale * bg.red), cast(int) ((1.0 - scale) * fg.green + scale * bg.green), cast(int) ((1.0 - scale) * fg.blue + scale * bg.blue));
502 } 502 }
503 503
504 /** 504 /**
505 * Returns the grey value in which the given color would be drawn in grey-scale. 505 * Returns the grey value in which the given color would be drawn in grey-scale.
506 * 506 *
529 * @return <code>true</code> if diff information is being displayed, <code>false</code> otherwise 529 * @return <code>true</code> if diff information is being displayed, <code>false</code> otherwise
530 * @since 3.3 530 * @since 3.3
531 */ 531 */
532 public bool hasInformation() { 532 public bool hasInformation() {
533 if (fLineDiffer instanceof ILineDifferExtension2) 533 if (fLineDiffer instanceof ILineDifferExtension2)
534 return !((ILineDifferExtension2) fLineDiffer).isSuspended(); 534 return !(cast(ILineDifferExtension2) fLineDiffer).isSuspended();
535 return fLineDiffer !is null; 535 return fLineDiffer !is null;
536 } 536 }
537 537
538 } 538 }