diff --git a/app/src/processing/app/ui/Editor.java b/app/src/processing/app/ui/Editor.java index 380980df1..22d3beaad 100644 --- a/app/src/processing/app/ui/Editor.java +++ b/app/src/processing/app/ui/Editor.java @@ -74,7 +74,7 @@ public abstract class Editor extends JFrame implements RunnerListener { protected Mode mode; static public final int LEFT_GUTTER = 44; - static public final int RIGHT_GUTTER = 20; + static public final int RIGHT_GUTTER = 12; static public final int GUTTER_MARGIN = 3; @@ -1094,11 +1094,10 @@ public abstract class Editor extends JFrame implements RunnerListener { /** * Updates update count in the UI. Called on EDT. - * @param n number of available updates + * @param count number of available updates */ - public void setUpdatesAvailable(int n) { - // TODO: refresh UI and remove the debug message - PApplet.println("setting update count to", n); + public void setUpdatesAvailable(int count) { + footer.setUpdateCount(count); } diff --git a/app/src/processing/app/ui/EditorFooter.java b/app/src/processing/app/ui/EditorFooter.java index af3e673ae..589483c01 100644 --- a/app/src/processing/app/ui/EditorFooter.java +++ b/app/src/processing/app/ui/EditorFooter.java @@ -32,6 +32,8 @@ import java.awt.Graphics2D; import java.awt.Image; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; +import java.awt.font.FontRenderContext; +import java.awt.geom.Ellipse2D; import java.util.ArrayList; import java.util.List; @@ -68,6 +70,7 @@ public class EditorFooter extends Box { Color[] textColor = new Color[2]; Color[] tabColor = new Color[2]; + Color updateColor; Editor editor; @@ -86,6 +89,8 @@ public class EditorFooter extends Box { CardLayout cardLayout; Controller controller; + int updateCount; + public EditorFooter(Editor eddie) { super(BoxLayout.Y_AXIS); @@ -145,6 +150,12 @@ public class EditorFooter extends Box { } + public void setUpdateCount(int count) { + this.updateCount = count; + repaint(); + } + + public void updateMode() { Mode mode = editor.getMode(); @@ -155,7 +166,7 @@ public class EditorFooter extends Box { tabColor[SELECTED] = mode.getColor("footer.tab.selected.color"); tabColor[UNSELECTED] = mode.getColor("footer.tab.unselected.color"); -// errorColor = mode.getColor("status.error.bgcolor"); + updateColor = mode.getColor("footer.updates.color"); gradient = mode.makeGradient("footer", 400, HIGH); } @@ -233,7 +244,9 @@ public class EditorFooter extends Box { } // now actually draw the tabs - placeTabs(Editor.LEFT_GUTTER, g2); + drawTabs(Editor.LEFT_GUTTER, g2); + + drawUpdates(g2); // // draw the two pixel line that extends left/right below the tabs // g.setColor(tabColor[SELECTED]); @@ -249,7 +262,7 @@ public class EditorFooter extends Box { * @param left starting position from the left * @param g graphics context, or null if we're not drawing */ - private void placeTabs(int left, Graphics2D g) { + private void drawTabs(int left, Graphics2D g) { int x = left; for (Tab tab : tabs) { @@ -261,43 +274,30 @@ public class EditorFooter extends Box { x += tab.textWidth + MARGIN; tab.right = x; - // if drawing and not just placing - if (g != null) { - tab.draw(g); - /* - int state = tab.isCurrent() ? SELECTED : UNSELECTED; - g.setColor(tabColor[state]); - if (tab.notification) { - g.setColor(errorColor); - } - //drawTab(g, tab.left, tab.right, tab.isFirst(), tab.isLast()); - tab.draw(g); - - int textLeft = tab.getTextLeft(); - if (tab.notification && state == UNSELECTED) { - g.setColor(Color.LIGHT_GRAY); - } else { - g.setColor(textColor[state]); - } - int tabHeight = TAB_BOTTOM - TAB_TOP; - int baseline = TAB_TOP + (tabHeight + fontAscent) / 2; - g.drawString(tab.name, textLeft, baseline); - */ - } + tab.draw(g); x += TAB_BETWEEN; } } - /* - private void drawTab(Graphics g, int left, int right, - boolean leftNotch, boolean rightNotch) { - Graphics2D g2 = (Graphics2D) g; - g2.fill(Toolkit.createRoundRect(left, TAB_TOP, right, TAB_BOTTOM, 0, 0, - rightNotch ? CURVE_RADIUS : 0, - leftNotch ? CURVE_RADIUS : 0)); + 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); } - */ public Dimension getPreferredSize() { diff --git a/build/shared/lib/theme.txt b/build/shared/lib/theme.txt index 567b6c78a..06101c6a0 100644 --- a/build/shared/lib/theme.txt +++ b/build/shared/lib/theme.txt @@ -30,6 +30,7 @@ footer.gradient.bottom = #122535 footer.tab.selected.color = #2d4251 footer.tab.unselected.color = #1f3241 # updates orange #eb7f15 +footer.updates.color = #ed7f15 # CONSOLE # The font is handled by preferences, so its size/etc are modifiable. diff --git a/java/src/processing/mode/java/MarkerColumn.java b/java/src/processing/mode/java/MarkerColumn.java index 8d5a0c86a..cbc6fcc11 100644 --- a/java/src/processing/mode/java/MarkerColumn.java +++ b/java/src/processing/mode/java/MarkerColumn.java @@ -39,6 +39,7 @@ import processing.app.Mode; import processing.app.Sketch; import processing.app.SketchCode; import processing.app.Util; +import processing.app.ui.Editor; import processing.core.PApplet; import processing.mode.java.pdex.LineMarker; import processing.mode.java.pdex.Problem; @@ -56,7 +57,7 @@ import processing.mode.java.pdex.Problem; public class MarkerColumn extends JPanel { protected JavaEditor editor; - static final int WIDE = 12; +// static final int WIDE = 12; private Color errorColor; private Color warningColor; @@ -244,11 +245,11 @@ public class MarkerColumn extends JPanel { public Dimension getPreferredSize() { - return new Dimension(WIDE, super.getPreferredSize().height); + return new Dimension(Editor.RIGHT_GUTTER, super.getPreferredSize().height); } public Dimension getMinimumSize() { - return new Dimension(WIDE, super.getMinimumSize().height); + return new Dimension(Editor.RIGHT_GUTTER, super.getMinimumSize().height); } } diff --git a/todo.txt b/todo.txt index 71f84f2e5..1945b9752 100644 --- a/todo.txt +++ b/todo.txt @@ -53,13 +53,15 @@ X applies to both MarkerColumn and JavaTextAreaPainter X make gutter of console match error list X https://github.com/processing/processing/issues/3904 -earlier +earlier/cleaning X list with contrib types separated is really wonky o do we keep the list? o does it even work for different contrib types? X cleaned this up in the last release X remove the dated releases from download.processing.org X new Android release (EditorButton constructor changed) +o JavaEditor has several null colors, remove color support +o once the design is complete and we for sure do not need color known issues @@ -74,15 +76,12 @@ _ mouse events (i.e. toggle breakpoint) seem to be firing twice 3.0 final _ https://github.com/processing/processing/milestones/3.0%20final -_ JavaEditor has several null colors, remove color support -_ once the design is complete and we for sure do not need color - -gui / James _ fix the design of the completions window -_ remove extra border around the outside -_ change font -_ change selection highlight color -_ put some margin around it +_ remove extra border around the outside +_ change font +_ change selection highlight color +_ put some margin around it +_ https://github.com/processing/processing/issues/3906 _ import suggestions box needs design review _ https://github.com/processing/processing/issues/3407 _ different design of squiggly line