private void paintRange(RevisionRange range, GC gc) {
ILineRange widgetRange= modelLinesToWidgetLines(range);
if (widgetRange == null)
return;
Revision revision= range.getRevision();
boolean drawArmedFocus= range == fMouseHandler.fMouseDownRegion;
boolean drawSelection= !drawArmedFocus && revision == fSelectedRevision;
boolean drawFocus= !drawSelection && !drawArmedFocus && revision == fFocusRevision;
Rectangle box= computeBoxBounds(widgetRange);
gc.setBackground(lookupColor(revision, false));
if (drawArmedFocus) {
Color foreground= gc.getForeground();
Color focusColor= lookupColor(revision, true);
gc.setForeground(focusColor);
gc.fillRectangle(box);
gc.drawRectangle(box.x, box.y, box.width - 1, box.height - 1); // highlight box
gc.drawRectangle(box.x + 1, box.y + 1, box.width - 3, box.height - 3); // inner highlight box
gc.setForeground(foreground);
} else if (drawFocus || drawSelection) {
Color foreground= gc.getForeground();
Color focusColor= lookupColor(revision, true);
gc.setForeground(focusColor);
gc.fillRectangle(box);
gc.drawRectangle(box.x, box.y, box.width - 1, box.height - 1); // highlight box
gc.setForeground(foreground);
} else {
gc.fillRectangle(box);
}
if ((fShowAuthor || fShowRevision)) {
int indentation= 1;
int baselineBias= getBaselineBias(gc, widgetRange.getStartLine());
if (fShowAuthor && fShowRevision) {
gc.drawString(revision.getId(), indentation, box.y + baselineBias, true);
gc.drawString(revision.getAuthor(), fAuthorInset, box.y + baselineBias, true);
} else if (fShowAuthor) {
gc.drawString(revision.getAuthor(), indentation, box.y + baselineBias, true);
} else if (fShowRevision) {
gc.drawString(revision.getId(), indentation, box.y + baselineBias, true);
}
}
}