aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilipp Thun2011-03-24 09:37:36 (EDT)
committerMathias Kinzler2011-03-25 04:04:37 (EDT)
commit4f2b44e61ab86fec9062c6a4bd69104bf7b5b0f9 (patch)
tree755f7ec7418c752f388279e43943261c4e24688c
parent0c1c9e4488759194d0b6bf0ec2defe29b2ee6784 (diff)
downloadegit-4f2b44e61ab86fec9062c6a4bd69104bf7b5b0f9.zip
egit-4f2b44e61ab86fec9062c6a4bd69104bf7b5b0f9.tar.gz
egit-4f2b44e61ab86fec9062c6a4bd69104bf7b5b0f9.tar.bz2
[historyView] Take bold font into account when drawing branch labelsrefs/changes/05/2905/2
Change I693694bca055c4b913b064a3e3f3a0bced058296 introduced the usage of bold fonts for branch labels that are checked out. As this also changes the text's width, parts of the text did not fit into the background anymore. This fix takes the new width into account when calculating the background width. Change-Id: I009411dffbbce4395112201f9d4180a32d25c6d7 Signed-off-by: Philipp Thun <philipp.thun@sap.com>
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/SWTPlotRenderer.java15
1 files changed, 8 insertions, 7 deletions
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/SWTPlotRenderer.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/SWTPlotRenderer.java
index 412a3d4..c93334c 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/SWTPlotRenderer.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/SWTPlotRenderer.java
@@ -152,6 +152,12 @@ class SWTPlotRenderer extends AbstractPlotRenderer<SWTLane, Color> {
if (txt.length() > 12)
txt = txt.substring(0,11) + "\u2026"; // ellipsis "..." (in UTF-8) //$NON-NLS-1$
+ // highlight checked out branch
+ Font oldFont = g.getFont();
+ boolean isHead = isHead(name);
+ if (isHead)
+ g.setFont(CommitGraphTable.highlightFont());
+
Point textsz = g.stringExtent(txt);
int arc = textsz.y/2;
final int texty = (y * 2 - textsz.y) / 2;
@@ -160,19 +166,14 @@ class SWTPlotRenderer extends AbstractPlotRenderer<SWTLane, Color> {
g.fillRoundRectangle(cellX + x + 1, cellY + texty -1, textsz.x + 3, textsz.y + 1, arc, arc);
g.setForeground(sys_black);
- // highlight checked out branch
- Font oldFont = g.getFont();
- boolean isHead = isHead(name);
- if (isHead)
- g.setFont(CommitGraphTable.highlightFont());
-
+ // Draw text
g.drawString(txt,cellX + x + 2, cellY + texty, true);
if (isHead)
g.setFont(oldFont);
g.setLineWidth(2);
- // And a two color shaded border, blend with whatever background there already is
+ // Add a two color shaded border, blend with whatever background there already is
g.setAlpha(128);
g.setForeground(sys_gray);
g.drawRoundRectangle(cellX + x, cellY + texty -2, textsz.x + 5, textsz.y + 3, arc, arc);