comparison dwtx/jface/internal/text/revisions/RevisionPainter.d @ 159:7926b636c282

...
author Frank Benoit <benoit@tionex.de>
date Wed, 27 Aug 2008 01:57:58 +0200
parents 25f1f92fa3df
children 1a5b8f8129df
comparison
equal deleted inserted replaced
158:25f1f92fa3df 159:7926b636c282
91 * 91 *
92 * @since 3.2 92 * @since 3.2
93 */ 93 */
94 public final class RevisionPainter { 94 public final class RevisionPainter {
95 /** Tells whether this class is in debug mode. */ 95 /** Tells whether this class is in debug mode. */
96 private static bool DEBUG= "true".equalsIgnoreCase(Platform.getDebugOption("dwtx.jface.text.source/debug/RevisionRulerColumn")); //$NON-NLS-1$//$NON-NLS-2$ 96 private static bool DEBUG_init = false;
97 private static bool DEBUG_;
98 private static bool DEBUG(){
99 if( !DEBUG_init ){
100 DEBUG_init = true;
101 DEBUG_ = "true".equalsIgnoreCase(Platform.getDebugOption("dwtx.jface.text.source/debug/RevisionRulerColumn")); //$NON-NLS-1$//$NON-NLS-2$
102 }
103 return DEBUG_;
104 }
97 105
98 // RGBs provided by UI Designer 106 // RGBs provided by UI Designer
99 private static const RGB BY_DATE_START_COLOR= new RGB(199, 134, 57); 107 private static const RGB BY_DATE_START_COLOR= new RGB(199, 134, 57);
100 private static const RGB BY_DATE_END_COLOR= new RGB(241, 225, 206); 108 private static const RGB BY_DATE_END_COLOR= new RGB(241, 225, 206);
101 109
519 /* Listeners and helpers. */ 527 /* Listeners and helpers. */
520 528
521 /** The shared color provider. */ 529 /** The shared color provider. */
522 private const ISharedTextColors fSharedColors; 530 private const ISharedTextColors fSharedColors;
523 /** The color tool. */ 531 /** The color tool. */
524 private const ColorTool fColorTool= new ColorTool(); 532 private const ColorTool fColorTool;
525 /** The mouse handler. */ 533 /** The mouse handler. */
526 private const MouseHandler fMouseHandler= new MouseHandler(); 534 private const MouseHandler fMouseHandler;
527 /** The hover. */ 535 /** The hover. */
528 private const RevisionHover fHover= new RevisionHover(); 536 private const RevisionHover fHover;
529 /** The annotation listener. */ 537 /** The annotation listener. */
530 private const AnnotationListener fAnnotationListener= new AnnotationListener(); 538 private const AnnotationListener fAnnotationListener;
531 /** The selection provider. */ 539 /** The selection provider. */
532 private const RevisionSelectionProvider fRevisionSelectionProvider= new RevisionSelectionProvider(this); 540 private const RevisionSelectionProvider fRevisionSelectionProvider;
533 /** 541 /**
534 * The list of revision listeners. 542 * The list of revision listeners.
535 * @since 3.3. 543 * @since 3.3.
536 */ 544 */
537 private const ListenerList fRevisionListeners= new ListenerList(ListenerList.IDENTITY); 545 private const ListenerList fRevisionListeners;
538 546
539 /* The context - column and viewer we are connected to. */ 547 /* The context - column and viewer we are connected to. */
540 548
541 /** The vertical ruler column that delegates painting to this painter. */ 549 /** The vertical ruler column that delegates painting to this painter. */
542 private const IVerticalRulerColumn fColumn; 550 private const IVerticalRulerColumn fColumn;
563 /* Cache. */ 571 /* Cache. */
564 572
565 /** The cached list of ranges adapted to quick diff. */ 573 /** The cached list of ranges adapted to quick diff. */
566 private List fRevisionRanges= null; 574 private List fRevisionRanges= null;
567 /** The annotations created for the overview ruler temporary display. */ 575 /** The annotations created for the overview ruler temporary display. */
568 private List fAnnotations= new ArrayList(); 576 private List fAnnotations;
569 577
570 /* State */ 578 /* State */
571 579
572 /** The current focus line, -1 for none. */ 580 /** The current focus line, -1 for none. */
573 private int fFocusLine= -1; 581 private int fFocusLine= -1;
587 /** <code>true</code> if the mouse wheel handler is installed, <code>false</code> otherwise. */ 595 /** <code>true</code> if the mouse wheel handler is installed, <code>false</code> otherwise. */
588 private bool fWheelHandlerInstalled= false; 596 private bool fWheelHandlerInstalled= false;
589 /** 597 /**
590 * The revision rendering mode. 598 * The revision rendering mode.
591 */ 599 */
592 private IRevisionRulerColumnExtension.RenderingMode fRenderingMode= IRevisionRulerColumnExtension.AUTHOR_SHADED_BY_AGE; 600 private IRevisionRulerColumnExtension.RenderingMode fRenderingMode;
593 /** 601 /**
594 * The required with in characters. 602 * The required with in characters.
595 * @since 3.3 603 * @since 3.3
596 */ 604 */
597 private int fRequiredWidth= -1; 605 private int fRequiredWidth= -1;
627 * @param column the column that will delegate{@link #paint(GC, ILineRange) painting} to the 635 * @param column the column that will delegate{@link #paint(GC, ILineRange) painting} to the
628 * newly created painter. 636 * newly created painter.
629 * @param sharedColors a shared colors object to store shaded colors in 637 * @param sharedColors a shared colors object to store shaded colors in
630 */ 638 */
631 public this(IVerticalRulerColumn column, ISharedTextColors sharedColors) { 639 public this(IVerticalRulerColumn column, ISharedTextColors sharedColors) {
640
641 fColorTool= new ColorTool();
642 fMouseHandler= new MouseHandler();
643 fHover= new RevisionHover();
644 fAnnotationListener= new AnnotationListener();
645 fRevisionSelectionProvider= new RevisionSelectionProvider(this);
646 fRevisionListeners= new ListenerList(ListenerList.IDENTITY);
647 fAnnotations= new ArrayList();
648 fRenderingMode= IRevisionRulerColumnExtension.AUTHOR_SHADED_BY_AGE;
649
632 Assert.isLegal(column !is null); 650 Assert.isLegal(column !is null);
633 Assert.isLegal(sharedColors !is null); 651 Assert.isLegal(sharedColors !is null);
634 fColumn= column; 652 fColumn= column;
635 fSharedColors= sharedColors; 653 fSharedColors= sharedColors;
636 } 654 }