Skip to content

Commit e3b0bff

Browse files
committed
don't show breakpoints when debugger is off (fixes processing#3093)
1 parent a9dd1b4 commit e3b0bff

3 files changed

Lines changed: 43 additions & 126 deletions

File tree

java/src/processing/mode/java/JavaEditor.java

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1663,7 +1663,7 @@ public void actionPerformed(ActionEvent e) {
16631663
}
16641664

16651665

1666-
protected boolean isDebuggerEnabled() {
1666+
public boolean isDebuggerEnabled() {
16671667
//return enableDebug.isSelected();
16681668
return debugEnabled;
16691669
}
@@ -2199,37 +2199,18 @@ protected void deactivateStep() {
21992199

22002200

22012201
public void toggleDebug() {
2202-
// enableDebug.setSelected(!enableDebug.isSelected());
22032202
debugEnabled = !debugEnabled;
2204-
// updateDebugToggle();
2205-
// }
2206-
//
2207-
//
2208-
// public void updateDebugToggle() {
2209-
// final boolean enabled = isDebuggerEnabled();
2203+
22102204
rebuildToolbar();
2205+
repaint(); // show/hide breakpoints in the gutter
22112206

22122207
if (debugEnabled) {
22132208
debugItem.setText(Language.text("menu.debug.disable"));
22142209
} else {
22152210
debugItem.setText(Language.text("menu.debug.enable"));
22162211
}
2217-
2218-
// // Hide the variable inspector if it's currently visible
2219-
// if (!debugEnabled && inspector.isVisible()) {
2220-
// toggleVariableInspector();
2221-
// }
22222212
inspector.setVisible(debugEnabled);
22232213

2224-
/*
2225-
if (enabled) {
2226-
inspector.setFocusableWindowState(false); // to not get focus when set visible
2227-
inspector.setVisible(true);
2228-
inspector.setFocusableWindowState(true); // allow to get focus again
2229-
} else {
2230-
inspector.setVisible(false);
2231-
}
2232-
*/
22332214
for (Component item : debugMenu.getMenuComponents()) {
22342215
if (item instanceof JMenuItem && item != debugItem) {
22352216
((JMenuItem) item).setEnabled(debugEnabled);

java/src/processing/mode/java/pdex/JavaTextAreaPainter.java

Lines changed: 18 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -76,27 +76,24 @@ public class JavaTextAreaPainter extends TextAreaPainter
7676
protected Font gutterTextFont;
7777
protected Color gutterTextColor;
7878
protected Color gutterLineHighlightColor;
79-
// protected Color gutterTempColor;
8079

8180
public static class ErrorLineCoord {
82-
public int xStart;
83-
public int xEnd;
84-
public int yStart;
85-
public int yEnd;
86-
public Problem problem;
87-
88-
public ErrorLineCoord(int xStart, int xEnd, int yStart, int yEnd, Problem problem) {
89-
this.xStart = xStart;
90-
this.xEnd = xEnd;
91-
this.yStart = yStart;
92-
this.yEnd = yEnd;
93-
this.problem = problem;
81+
public int xStart;
82+
public int xEnd;
83+
public int yStart;
84+
public int yEnd;
85+
public Problem problem;
86+
87+
public ErrorLineCoord(int xStart, int xEnd, int yStart, int yEnd, Problem problem) {
88+
this.xStart = xStart;
89+
this.xEnd = xEnd;
90+
this.yStart = yStart;
91+
this.yEnd = yEnd;
92+
this.problem = problem;
9493
}
9594
}
9695
public List<ErrorLineCoord> errorLineCoords = new ArrayList<>();
9796

98-
// static int ctrlMask = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
99-
10097

10198
public JavaTextAreaPainter(JavaTextArea textArea, TextAreaDefaults defaults) {
10299
super(textArea, defaults);
@@ -271,7 +268,10 @@ protected void paintLeftGutter(Graphics gfx, int line, int x) {
271268
}
272269
gfx.fillRect(0, y, Editor.LEFT_GUTTER, fm.getHeight());
273270

274-
String text = getTextArea().getGutterText(line);
271+
String text = null;
272+
if (getEditor().isDebuggerEnabled()) {
273+
text = getTextArea().getGutterText(line);
274+
}
275275
// if no special text for a breakpoint, just show the line number
276276
if (text == null) {
277277
text = String.valueOf(line + 1);
@@ -293,6 +293,7 @@ protected void paintLeftGutter(Graphics gfx, int line, int x) {
293293
}
294294

295295

296+
/*
296297
// Failed attempt to switch line numbers to old-style figures
297298
String makeOSF(String what) {
298299
char[] c = what.toCharArray();
@@ -301,81 +302,7 @@ String makeOSF(String what) {
301302
}
302303
return new String(c);
303304
}
304-
305-
306-
// /**
307-
// * Paint the gutter background (solid color).
308-
// *
309-
// * @param gfx
310-
// * the graphics context
311-
// * @param line
312-
// * 0-based line number
313-
// * @param x
314-
// * horizontal position
315-
// */
316-
// protected void paintGutterBg(Graphics gfx, int line, int x) {
317-
// gfx.setColor(getTextArea().gutterBgColor);
318-
// gfx.setColor(Color.ORANGE);
319-
// int y = textArea.lineToY(line) + fm.getLeading() + fm.getMaxDescent();
320-
// gfx.fillRect(0, y, Editor.LEFT_GUTTER, fm.getHeight());
321-
// }
322-
323-
324-
// /**
325-
// * Paint the vertical gutter separator line.
326-
// *
327-
// * @param gfx
328-
// * the graphics context
329-
// * @param line
330-
// * 0-based line number
331-
// * @param x
332-
// * horizontal position
333-
// */
334-
// protected void paintGutterLine(Graphics gfx, int line, int x) {
335-
// int y = textArea.lineToY(line) + fm.getLeading() + fm.getMaxDescent();
336-
// gfx.setColor(getTextArea().gutterLineColor);
337-
// gfx.setColor(Color.GREEN);
338-
// gfx.drawLine(Editor.LEFT_GUTTER, y,
339-
// Editor.LEFT_GUTTER, y + fm.getHeight());
340-
// }
341-
342-
343-
// /**
344-
// * Paint the gutter text.
345-
// *
346-
// * @param gfx
347-
// * the graphics context
348-
// * @param line
349-
// * 0-based line number
350-
// * @param x
351-
// * horizontal position
352-
// */
353-
// protected void paintGutterText(Graphics gfx, int line, int x) {
354-
// String text = getTextArea().getGutterText(line);
355-
// if (text == null) {
356-
// return;
357-
// }
358-
//
359-
// gfx.setFont(getFont());
360-
// Color textColor = getTextArea().getGutterTextColor(line);
361-
// if (textColor == null) {
362-
// gfx.setColor(getForeground());
363-
// } else {
364-
// gfx.setColor(textColor);
365-
// }
366-
// int y = textArea.lineToY(line) + fm.getHeight();
367-
//
368-
// // draw 4 times to make it appear bold, displaced 1px to the right, to the bottom and bottom right.
369-
// //int len = text.length() > ta.gutterChars ? ta.gutterChars : text.length();
370-
// Utilities.drawTabbedText(new Segment(text.toCharArray(), 0, text.length()),
371-
// Editor.GUTTER_MARGIN, y, gfx, this, 0);
372-
// Utilities.drawTabbedText(new Segment(text.toCharArray(), 0, text.length()),
373-
// Editor.GUTTER_MARGIN + 1, y, gfx, this, 0);
374-
// Utilities.drawTabbedText(new Segment(text.toCharArray(), 0, text.length()),
375-
// Editor.GUTTER_MARGIN, y + 1, gfx, this, 0);
376-
// Utilities.drawTabbedText(new Segment(text.toCharArray(), 0, text.length()),
377-
// Editor.GUTTER_MARGIN + 1, y + 1, gfx, this, 0);
378-
// }
305+
*/
379306

380307

381308
/**

todo.txt

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,39 @@
11
0241 (3.0b3)
2+
_ 'examples' shows as a folder in the sketchbook window
3+
4+
cleaning/earlier
5+
X move to launch4j 3.7 http://launch4j.sourceforge.net/
6+
X actually upgraded to 3.8
7+
X make examples pull/build automatic during dist
28

39

410
known issues
511
_ launch4j doesn't work from folders with non-native charsets
612
_ anything in CP1252 on an English Windows system is fine
713
_ but anything else reports "font sadness" b/c it's using the system JRE
814
_ https://github.com/processing/processing/issues/3543
15+
_ move to javapackager or another option?
16+
_ http://www.excelsiorjet.com/kb/35/howto-create-a-single-exe-from-your-java-application
917

1018

1119
3.0 final
20+
_ more ARM patches
21+
_ https://github.com/processing/processing/pull/3566
1222
_ Contributions Manager UI design
1323
_ https://github.com/processing/processing/issues/3482
1424
_ Ready to add contributed example packages?
1525
_ https://github.com/processing/processing/issues/2953
1626
_ processing-java isn't working in OSX 10.11 El Capitan
1727
_ https://github.com/processing/processing/issues/3497
1828
_ probably have to add the script/Processing.app location to user's path
29+
_ move processing-java inside the Java Mode?
30+
_ make a Tool that installs it for all platforms, not just OS X
31+
_ not really part of the 'build' anymore
32+
_ should Platform be a static instance?
33+
_ lots of platform stuff in base, but might be better handled elsewhere
1934

2035

2136
gui
22-
_ another round of ARM patches
23-
_ https://github.com/processing/processing/pull/3555
2437
_ fix red in sidebar, the squiggly line beneath code
2538
_ show hover text with 'debug'
2639
_ show number of updates available in the footer
@@ -83,19 +96,9 @@ _ sketchbook window too?
8396
_ 'ant clean' not removing old versions created by dist
8497
_ continue clearing out ProgressFrame
8598
_ also hook up the statusNotice() when done
86-
_ move to launch4j 3.7 http://launch4j.sourceforge.net/
87-
_ move processing-java inside the Java Mode?
88-
_ make a Tool that installs it for all platforms, not just OS X
89-
_ not really part of the 'build' anymore
9099
_ break out Mode options to their own panels in prefs
91100
_ Mode should just provide a panel for their prefs
92-
_ make examples pull/build automatic during dist
93-
_ make reference build process part of dist
94-
_ https://github.com/processing/processing-docs/issues/85
95-
_ separate ant target, but only require them for dist
96-
_ as separate targets, folks can build explicitly if they'd like
97-
_ processing-docs/java_generate/ReferenceGenerator/processingrefBuild.sh
98-
_ remove reference.zip from main repo
101+
_ make the build fail it git pull on processing-docs fails
99102
_ move the language stuff to the settings folder
100103
_ that way people can modify and test w/o recompiling
101104
_ https://github.com/processing/processing/issues/2938
@@ -976,6 +979,12 @@ FUTURE
976979

977980
Notes for some indefinite later release...
978981

982+
_ make reference build process part of dist
983+
_ https://github.com/processing/processing-docs/issues/85
984+
_ separate ant target, but only require them for dist
985+
_ as separate targets, folks can build explicitly if they'd like
986+
_ processing-docs/java_generate/ReferenceGenerator/processingrefBuild.sh
987+
_ remove reference.zip from main repo
979988
_ using svg images for res-indep icons/gui
980989
_ http://stackoverflow.com/questions/2495501/swing-batik-create-an-imageicon-from-an-svg-file
981990
_ nurbs or other architecture stuff

0 commit comments

Comments
 (0)