breakpoint markers hidden when Debugger not active

This commit is contained in:
Manindra Moharana
2013-09-01 21:21:05 +05:30
parent 6eb903f665
commit 4dceb7dda7
4 changed files with 28 additions and 22 deletions
+1
View File
@@ -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
@@ -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();
}
});
}
@@ -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;
}
@@ -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);