diff --git a/pdex/Todo, GSoC 2013.txt b/pdex/Todo, GSoC 2013.txt index 6c583fef4..4c8abef07 100644 --- a/pdex/Todo, GSoC 2013.txt +++ b/pdex/Todo, GSoC 2013.txt @@ -130,7 +130,7 @@ General Stuff ============= * Ensure all editor windows are closed when editor is closed. -* Add a red marker near Errors label in console toggle, to indicate errors present in sketch. +x Add a red marker near Errors label in console toggle, to indicate errors present in sketch. x Add option for toggling debug output x On Run/Debug Console is visible(ProblemsList hidden) * Update wiki for Ctrl + H instead of Ctrl + J shortcuts diff --git a/pdex/src/processing/mode/experimental/DebugEditor.java b/pdex/src/processing/mode/experimental/DebugEditor.java index f134e506b..8f17f9494 100755 --- a/pdex/src/processing/mode/experimental/DebugEditor.java +++ b/pdex/src/processing/mode/experimental/DebugEditor.java @@ -1251,6 +1251,11 @@ public class DebugEditor extends JavaEditor implements ActionListener { return errorTable.updateTable(tableModel); } + public void updateErrorToggle(){ + btnShowErrors.updateMarker(errorCheckerService.hasErrors(), + errorBar.errorColor); + } + private void handleRefactor() { log("Caret at:"); log(ta.getLineText(ta.getCaretLine())); diff --git a/pdex/src/processing/mode/experimental/ErrorCheckerService.java b/pdex/src/processing/mode/experimental/ErrorCheckerService.java index fb582af53..afc54b8cd 100644 --- a/pdex/src/processing/mode/experimental/ErrorCheckerService.java +++ b/pdex/src/processing/mode/experimental/ErrorCheckerService.java @@ -342,6 +342,7 @@ public class ErrorCheckerService implements Runnable{ updateEditorStatus(); editor.getTextArea().repaint(); updatePaintedThingys(); + editor.updateErrorToggle(); int x = textModified.get(); //log("TM " + x); if (x >= 2) { @@ -371,8 +372,9 @@ public class ErrorCheckerService implements Runnable{ public boolean hasErrors(){ synchronized (problemsList) { for (Problem p : problemsList) { - if (p.isError()) - return false; + if (p.isError()){ + return true; + } } return false; } diff --git a/pdex/src/processing/mode/experimental/XQConsoleToggle.java b/pdex/src/processing/mode/experimental/XQConsoleToggle.java index c30ae5b99..279099825 100755 --- a/pdex/src/processing/mode/experimental/XQConsoleToggle.java +++ b/pdex/src/processing/mode/experimental/XQConsoleToggle.java @@ -90,10 +90,22 @@ public class XQConsoleToggle extends JPanel implements MouseListener { g.fillRect(0, 0, 4, this.getHeight()); g.setColor(Color.WHITE); } - + g.drawString(buttonName, getWidth() / 2 + 2 // + 2 is a offset - getFontMetrics(getFont()).stringWidth(buttonName) / 2, this.getHeight() - 6); + if(drawMarker){ + g.setColor(markerColor); + g.fillRect(4, 0, 2, this.getHeight()); + } + } + + boolean drawMarker = false; + protected Color markerColor; + public void updateMarker(boolean value, Color color){ + drawMarker = value; + markerColor = color; + repaint(); } @Override