diff --git a/pdex/Todo, GSoC 2013.txt b/pdex/Todo, GSoC 2013.txt index ca0338e23..0b772dda4 100644 --- a/pdex/Todo, GSoC 2013.txt +++ b/pdex/Todo, GSoC 2013.txt @@ -144,6 +144,7 @@ x boolean warningsEnabled - made it volatile General Stuff ============= +x Hide breakpoint markers when Debugger isn't active x Ensure all editor windows are closed when editor is closed. x Add a red marker near Errors label in console toggle, to indicate errors present in sketch. x Add option for toggling debug output diff --git a/pdex/src/processing/mode/experimental/DebugEditor.java b/pdex/src/processing/mode/experimental/DebugEditor.java index a2f07efbe..663b27896 100755 --- a/pdex/src/processing/mode/experimental/DebugEditor.java +++ b/pdex/src/processing/mode/experimental/DebugEditor.java @@ -34,6 +34,7 @@ import java.io.IOException; import java.nio.charset.Charset; import java.util.ArrayList; import java.util.List; +import java.util.concurrent.atomic.AtomicBoolean; import java.util.logging.Level; import java.util.logging.Logger; @@ -239,9 +240,7 @@ public class DebugEditor extends JavaEditor implements ActionListener { initializeErrorChecker(); ta.setECSandThemeforTextArea(errorCheckerService, dmode); addXQModeUI(); - //TODO: Remove this later - if(ExperimentalMode.DEBUG) - setBounds(160, 300, getWidth(), getHeight()); + debugToolbarEnabled = new AtomicBoolean(false); } private void addXQModeUI(){ @@ -404,17 +403,17 @@ public class DebugEditor extends JavaEditor implements ActionListener { return buildSketchMenu(new JMenuItem[]{runItem, presentItem, stopItem}); }*/ - boolean debugToolbarShown = false; + AtomicBoolean debugToolbarEnabled; protected EditorToolbar javaToolbar, debugToolbar; protected void switchToolbars(){ final EditorToolbar nextToolbar; - if(debugToolbarShown){ + if(debugToolbarEnabled.get()){ // switch to java if(javaToolbar == null) javaToolbar = createToolbar(); nextToolbar = javaToolbar; - debugToolbarShown = false; + debugToolbarEnabled.set(false); log("Switching to Java Mode Toolbar"); } else{ @@ -422,7 +421,7 @@ public class DebugEditor extends JavaEditor implements ActionListener { if(debugToolbar == null) debugToolbar = new DebugToolbar(this, getBase()); nextToolbar = debugToolbar; - debugToolbarShown = true; + debugToolbarEnabled.set(true); log("Switching to Debugger Toolbar"); } @@ -445,6 +444,7 @@ public class DebugEditor extends JavaEditor implements ActionListener { break; } } + ta.repaint(); } }); } diff --git a/pdex/src/processing/mode/experimental/TextArea.java b/pdex/src/processing/mode/experimental/TextArea.java index 7c1c5c42d..77e26b5cc 100644 --- a/pdex/src/processing/mode/experimental/TextArea.java +++ b/pdex/src/processing/mode/experimental/TextArea.java @@ -396,6 +396,9 @@ public class TextArea extends JEditTextArea { * @return gutter width in pixels */ protected int getGutterWidth() { + if(editor.debugToolbarEnabled == null || !editor.debugToolbarEnabled.get()){ + return 0; + } FontMetrics fm = painter.getFontMetrics(); // log("fm: " + (fm == null)); // log("editor: " + (editor == null)); @@ -413,6 +416,9 @@ public class TextArea extends JEditTextArea { * @return margins in pixels */ protected int getGutterMargins() { + if(editor.debugToolbarEnabled == null || !editor.debugToolbarEnabled.get()){ + return 0; + } return gutterPadding; } diff --git a/pdex/src/processing/mode/experimental/TextAreaPainter.java b/pdex/src/processing/mode/experimental/TextAreaPainter.java index 382501202..07c04ab61 100644 --- a/pdex/src/processing/mode/experimental/TextAreaPainter.java +++ b/pdex/src/processing/mode/experimental/TextAreaPainter.java @@ -172,19 +172,19 @@ public class TextAreaPainter extends processing.app.syntax.TextAreaPainter { @Override protected void paintLine(Graphics gfx, TokenMarker tokenMarker, int line, int x) { - - // paint gutter - paintGutterBg(gfx, line, x); - - paintLineBgColor(gfx, line, x + ta.getGutterWidth()); - - paintGutterLine(gfx, line, x); - - // paint gutter symbol - paintGutterText(gfx, line, x); - + if(ta.editor.debugToolbarEnabled != null && ta.editor.debugToolbarEnabled.get()){ + // paint gutter + paintGutterBg(gfx, line, x); + + paintLineBgColor(gfx, line, x + ta.getGutterWidth()); + + paintGutterLine(gfx, line, x); + + // paint gutter symbol + paintGutterText(gfx, line, x); + } + paintErrorLine(gfx, line, x); - super.paintLine(gfx, tokenMarker, line, x + ta.getGutterWidth()); } @@ -296,7 +296,6 @@ public class TextAreaPainter extends processing.app.syntax.TextAreaPainter { * @param x */ protected void paintErrorLine(Graphics gfx, int line, int x) { - if (errorCheckerService == null) { return; } @@ -354,8 +353,8 @@ public class TextAreaPainter extends processing.app.syntax.TextAreaPainter { int rw = fm.stringWidth(linetext.trim()); // real width int x1 = 0 + (aw - rw), y1 = y + fm.getHeight() - 2, x2 = x1 + rw; // Adding offsets for the gutter - x1 += 20; - x2 += 20; + x1 += ta.getGutterWidth(); + x2 += ta.getGutterWidth(); // gfx.fillRect(x1, y, rw, height);