only draw when >0 updates

This commit is contained in:
Ben Fry
2015-09-29 22:22:06 -04:00
parent 929d45d716
commit 07b1cbe558
2 changed files with 24 additions and 22 deletions

View File

@@ -281,22 +281,24 @@ public class EditorFooter extends Box {
private void drawUpdates(Graphics2D g2) {
FontRenderContext frc = g2.getFontRenderContext();
final int GAP = 5;
final String updateLabel = "Updates";
String updatesStr = "" + updateCount;
double countWidth = font.getStringBounds(updatesStr, frc).getWidth();
float diameter = (float) (countWidth * 1.65f);
float ex = getWidth() - Editor.RIGHT_GUTTER - diameter;
float ey = (getHeight() - diameter) / 2;
g2.setColor(updateColor);
g2.fill(new Ellipse2D.Float(ex, ey, diameter, diameter));
g2.setColor(textColor[SELECTED]);
int baseline = (getHeight() + fontAscent) / 2;
g2.drawString(updatesStr, (int) (ex + (diameter - countWidth)/2), baseline);
double updatesWidth = font.getStringBounds(updateLabel, frc).getWidth();
g2.setColor(textColor[UNSELECTED]);
g2.drawString(updateLabel, (int) (ex - updatesWidth - GAP), baseline);
if (updateCount != 0) {
FontRenderContext frc = g2.getFontRenderContext();
final int GAP = 5;
final String updateLabel = "Updates";
String updatesStr = "" + updateCount;
double countWidth = font.getStringBounds(updatesStr, frc).getWidth();
float diameter = (float) (countWidth * 1.65f);
float ex = getWidth() - Editor.RIGHT_GUTTER - diameter;
float ey = (getHeight() - diameter) / 2;
g2.setColor(updateColor);
g2.fill(new Ellipse2D.Float(ex, ey, diameter, diameter));
g2.setColor(textColor[SELECTED]);
int baseline = (getHeight() + fontAscent) / 2;
g2.drawString(updatesStr, (int) (ex + (diameter - countWidth)/2), baseline);
double updatesWidth = font.getStringBounds(updateLabel, frc).getWidth();
g2.setColor(textColor[UNSELECTED]);
g2.drawString(updateLabel, (int) (ex - updatesWidth - GAP), baseline);
}
}

View File

@@ -16,6 +16,11 @@ X https://github.com/processing/processing/pull/3887
X grab bag of CM work from Jakub
X https://github.com/processing/processing/issues/3895
X https://github.com/processing/processing/pull/3897
X show number of updates available in the footer
X https://github.com/processing/processing/issues/3518
X https://github.com/processing/processing/pull/3896
X https://github.com/processing/processing/pull/3901
o total number of updates available is not correct? (may be fixed)
gui
X distinguish errors and warnings
@@ -93,12 +98,7 @@ _ bring back the # of updates on the update tab
_ use this instead of the 'icon' stuff?
_ or in addition, since only the 'updates' tab has it
_ https://github.com/processing/processing/issues/3855
_ show number of updates available in the footer
_ https://github.com/processing/processing/issues/3518
X https://github.com/processing/processing/pull/3896
X https://github.com/processing/processing/pull/3901
_ and have it be clickable so to open the manager
_ total number of updates available is not correct? (may be fixed)
_ for updates available, have it be clickable to open the manager
_ ugly white gap at the top of scroll bar
_ the table header doesn't extend far enough
_ scrolling "past" top/bottom causes the screen to jiggle (OS X and Trackpad)