| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 5fa9e4a commit a83f88e
5 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -74,7 +74,7 @@ public abstract class Editor extends JFrame implements RunnerListener { | |||
| 74 | 74 | protected Mode mode; | |
| 75 | 75 | ||
| 76 | 76 | static public final int LEFT_GUTTER = 44; | |
| 77 | - static public final int RIGHT_GUTTER = 20; | ||
| 77 | + static public final int RIGHT_GUTTER = 12; | ||
| 78 | 78 | static public final int GUTTER_MARGIN = 3; | |
| 79 | 79 | ||
| 80 | 80 | ||
@@ -1094,11 +1094,10 @@ public void clearToolMenu() { | |||
| 1094 | 1094 | ||
| 1095 | 1095 | /** | |
| 1096 | 1096 | * Updates update count in the UI. Called on EDT. | |
| 1097 | - * @param n number of available updates | ||
| 1097 | + * @param count number of available updates | ||
| 1098 | 1098 | */ | |
| 1099 | - public void setUpdatesAvailable(int n) { | ||
| 1100 | - // TODO: refresh UI and remove the debug message | ||
| 1101 | - PApplet.println("setting update count to", n); | ||
| 1099 | + public void setUpdatesAvailable(int count) { | ||
| 1100 | + footer.setUpdateCount(count); | ||
| 1102 | 1101 | } | |
| 1103 | 1102 | ||
| 1104 | 1103 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -32,6 +32,8 @@ | |||
| 32 | 32 | import java.awt.Image; | |
| 33 | 33 | import java.awt.event.MouseAdapter; | |
| 34 | 34 | import java.awt.event.MouseEvent; | |
| 35 | + import java.awt.font.FontRenderContext; | ||
| 36 | + import java.awt.geom.Ellipse2D; | ||
| 35 | 37 | import java.util.ArrayList; | |
| 36 | 38 | import java.util.List; | |
| 37 | 39 | ||
@@ -68,6 +70,7 @@ public class EditorFooter extends Box { | |||
| 68 | 70 | ||
| 69 | 71 | Color[] textColor = new Color[2]; | |
| 70 | 72 | Color[] tabColor = new Color[2]; | |
| 73 | + Color updateColor; | ||
| 71 | 74 | ||
| 72 | 75 | Editor editor; | |
| 73 | 76 | ||
@@ -86,6 +89,8 @@ public class EditorFooter extends Box { | |||
| 86 | 89 | CardLayout cardLayout; | |
| 87 | 90 | Controller controller; | |
| 88 | 91 | ||
| 92 | + int updateCount; | ||
| 93 | + | ||
| 89 | 94 | ||
| 90 | 95 | public EditorFooter(Editor eddie) { | |
| 91 | 96 | super(BoxLayout.Y_AXIS); | |
@@ -145,6 +150,12 @@ public void setNotification(Component comp, boolean note) { | |||
| 145 | 150 | } | |
| 146 | 151 | ||
| 147 | 152 | ||
| 153 | + public void setUpdateCount(int count) { | ||
| 154 | + this.updateCount = count; | ||
| 155 | + repaint(); | ||
| 156 | + } | ||
| 157 | + | ||
| 158 | + | ||
| 148 | 159 | public void updateMode() { | |
| 149 | 160 | Mode mode = editor.getMode(); | |
| 150 | 161 | ||
@@ -155,7 +166,7 @@ public void updateMode() { | |||
| 155 | 166 | tabColor[SELECTED] = mode.getColor("footer.tab.selected.color"); | |
| 156 | 167 | tabColor[UNSELECTED] = mode.getColor("footer.tab.unselected.color"); | |
| 157 | 168 | ||
| 158 | - // errorColor = mode.getColor("status.error.bgcolor"); | ||
| 169 | + updateColor = mode.getColor("footer.updates.color"); | ||
| 159 | 170 | ||
| 160 | 171 | gradient = mode.makeGradient("footer", 400, HIGH); | |
| 161 | 172 | } | |
@@ -233,7 +244,9 @@ public void paintComponent(Graphics screen) { | |||
| 233 | 244 | } | |
| 234 | 245 | ||
| 235 | 246 | // now actually draw the tabs | |
| 236 | - placeTabs(Editor.LEFT_GUTTER, g2); | ||
| 247 | + drawTabs(Editor.LEFT_GUTTER, g2); | ||
| 248 | + | ||
| 249 | + drawUpdates(g2); | ||
| 237 | 250 | ||
| 238 | 251 | // // draw the two pixel line that extends left/right below the tabs | |
| 239 | 252 | // g.setColor(tabColor[SELECTED]); | |
@@ -249,7 +262,7 @@ public void paintComponent(Graphics screen) { | |||
| 249 | 262 | * @param left starting position from the left | |
| 250 | 263 | * @param g graphics context, or null if we're not drawing | |
| 251 | 264 | */ | |
| 252 | - private void placeTabs(int left, Graphics2D g) { | ||
| 265 | + private void drawTabs(int left, Graphics2D g) { | ||
| 253 | 266 | int x = left; | |
| 254 | 267 | ||
| 255 | 268 | for (Tab tab : tabs) { | |
@@ -261,43 +274,30 @@ private void placeTabs(int left, Graphics2D g) { | |||
| 261 | 274 | x += tab.textWidth + MARGIN; | |
| 262 | 275 | tab.right = x; | |
| 263 | 276 | ||
| 264 | - // if drawing and not just placing | ||
| 265 | - if (g != null) { | ||
| 266 | - tab.draw(g); | ||
| 267 | - /* | ||
| 268 | - int state = tab.isCurrent() ? SELECTED : UNSELECTED; | ||
| 269 | - g.setColor(tabColor[state]); | ||
| 270 | - if (tab.notification) { | ||
| 271 | - g.setColor(errorColor); | ||
| 272 | - } | ||
| 273 | - //drawTab(g, tab.left, tab.right, tab.isFirst(), tab.isLast()); | ||
| 274 | - tab.draw(g); | ||
| 275 | - | ||
| 276 | - int textLeft = tab.getTextLeft(); | ||
| 277 | - if (tab.notification && state == UNSELECTED) { | ||
| 278 | - g.setColor(Color.LIGHT_GRAY); | ||
| 279 | - } else { | ||
| 280 | - g.setColor(textColor[state]); | ||
| 281 | - } | ||
| 282 | - int tabHeight = TAB_BOTTOM - TAB_TOP; | ||
| 283 | - int baseline = TAB_TOP + (tabHeight + fontAscent) / 2; | ||
| 284 | - g.drawString(tab.name, textLeft, baseline); | ||
| 285 | - */ | ||
| 286 | - } | ||
| 277 | + tab.draw(g); | ||
| 287 | 278 | x += TAB_BETWEEN; | |
| 288 | 279 | } | |
| 289 | 280 | } | |
| 290 | 281 | ||
| 291 | 282 | ||
| 292 | - /* | ||
| 293 | - private void drawTab(Graphics g, int left, int right, | ||
| 294 | - boolean leftNotch, boolean rightNotch) { | ||
| 295 | - Graphics2D g2 = (Graphics2D) g; | ||
| 296 | - g2.fill(Toolkit.createRoundRect(left, TAB_TOP, right, TAB_BOTTOM, 0, 0, | ||
| 297 | - rightNotch ? CURVE_RADIUS : 0, | ||
| 298 | - leftNotch ? CURVE_RADIUS : 0)); | ||
| 283 | + private void drawUpdates(Graphics2D g2) { | ||
| 284 | + FontRenderContext frc = g2.getFontRenderContext(); | ||
| 285 | + final int GAP = 5; | ||
| 286 | + final String updateLabel = "Updates"; | ||
| 287 | + String updatesStr = "" + updateCount; | ||
| 288 | + double countWidth = font.getStringBounds(updatesStr, frc).getWidth(); | ||
| 289 | + float diameter = (float) (countWidth * 1.65f); | ||
| 290 | + float ex = getWidth() - Editor.RIGHT_GUTTER - diameter; | ||
| 291 | + float ey = (getHeight() - diameter) / 2; | ||
| 292 | + g2.setColor(updateColor); | ||
| 293 | + g2.fill(new Ellipse2D.Float(ex, ey, diameter, diameter)); | ||
| 294 | + g2.setColor(textColor[SELECTED]); | ||
| 295 | + int baseline = (getHeight() + fontAscent) / 2; | ||
| 296 | + g2.drawString(updatesStr, (int) (ex + (diameter - countWidth)/2), baseline); | ||
| 297 | + double updatesWidth = font.getStringBounds(updateLabel, frc).getWidth(); | ||
| 298 | + g2.setColor(textColor[UNSELECTED]); | ||
| 299 | + g2.drawString(updateLabel, (int) (ex - updatesWidth - GAP), baseline); | ||
| 299 | 300 | } | |
| 300 | - */ | ||
| 301 | 301 | ||
| 302 | 302 | ||
| 303 | 303 | public Dimension getPreferredSize() { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -30,6 +30,7 @@ footer.gradient.bottom = #122535 | |||
| 30 | 30 | footer.tab.selected.color = #2d4251 | |
| 31 | 31 | footer.tab.unselected.color = #1f3241 | |
| 32 | 32 | # updates orange #eb7f15 | |
| 33 | + footer.updates.color = #ed7f15 | ||
| 33 | 34 | ||
| 34 | 35 | # CONSOLE | |
| 35 | 36 | # The font is handled by preferences, so its size/etc are modifiable. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -39,6 +39,7 @@ | |||
| 39 | 39 | import processing.app.Sketch; | |
| 40 | 40 | import processing.app.SketchCode; | |
| 41 | 41 | import processing.app.Util; | |
| 42 | + import processing.app.ui.Editor; | ||
| 42 | 43 | import processing.core.PApplet; | |
| 43 | 44 | import processing.mode.java.pdex.LineMarker; | |
| 44 | 45 | import processing.mode.java.pdex.Problem; | |
@@ -56,7 +57,7 @@ | |||
| 56 | 57 | public class MarkerColumn extends JPanel { | |
| 57 | 58 | protected JavaEditor editor; | |
| 58 | 59 | ||
| 59 | - static final int WIDE = 12; | ||
| 60 | + // static final int WIDE = 12; | ||
| 60 | 61 | ||
| 61 | 62 | private Color errorColor; | |
| 62 | 63 | private Color warningColor; | |
@@ -244,11 +245,11 @@ private LineMarker findClosestMarker(final int y) { | |||
| 244 | 245 | ||
| 245 | 246 | ||
| 246 | 247 | public Dimension getPreferredSize() { | |
| 247 | - return new Dimension(WIDE, super.getPreferredSize().height); | ||
| 248 | + return new Dimension(Editor.RIGHT_GUTTER, super.getPreferredSize().height); | ||
| 248 | 249 | } | |
| 249 | 250 | ||
| 250 | 251 | ||
| 251 | 252 | public Dimension getMinimumSize() { | |
| 252 | - return new Dimension(WIDE, super.getMinimumSize().height); | ||
| 253 | + return new Dimension(Editor.RIGHT_GUTTER, super.getMinimumSize().height); | ||
| 253 | 254 | } | |
| 254 | 255 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -53,13 +53,15 @@ X applies to both MarkerColumn and JavaTextAreaPainter | |||
| 53 | 53 | X make gutter of console match error list | |
| 54 | 54 | X https://github.com/processing/processing/issues/3904 | |
| 55 | 55 | ||
| 56 | - earlier | ||
| 56 | + earlier/cleaning | ||
| 57 | 57 | X list with contrib types separated is really wonky | |
| 58 | 58 | o do we keep the list? | |
| 59 | 59 | o does it even work for different contrib types? | |
| 60 | 60 | X cleaned this up in the last release | |
| 61 | 61 | X remove the dated releases from download.processing.org | |
| 62 | 62 | X new Android release (EditorButton constructor changed) | |
| 63 | + o JavaEditor has several null colors, remove color support | ||
| 64 | + o once the design is complete and we for sure do not need color | ||
| 63 | 65 | ||
| 64 | 66 | ||
| 65 | 67 | known issues | |
@@ -74,15 +76,12 @@ _ mouse events (i.e. toggle breakpoint) seem to be firing twice | |||
| 74 | 76 | ||
| 75 | 77 | 3.0 final | |
| 76 | 78 | _ https://github.com/processing/processing/milestones/3.0%20final | |
| 77 | - _ JavaEditor has several null colors, remove color support | ||
| 78 | - _ once the design is complete and we for sure do not need color | ||
| 79 | - | ||
| 80 | - gui / James | ||
| 81 | 79 | _ fix the design of the completions window | |
| 82 | - _ remove extra border around the outside | ||
| 83 | - _ change font | ||
| 84 | - _ change selection highlight color | ||
| 85 | - _ put some margin around it | ||
| 80 | + _ remove extra border around the outside | ||
| 81 | + _ change font | ||
| 82 | + _ change selection highlight color | ||
| 83 | + _ put some margin around it | ||
| 84 | + _ https://github.com/processing/processing/issues/3906 | ||
| 86 | 85 | _ import suggestions box needs design review | |
| 87 | 86 | _ https://github.com/processing/processing/issues/3407 | |
| 88 | 87 | _ different design of squiggly line | |
| Back | FazBrowse Home | New Git URL |
0 commit comments