Skip to content

Commit e9f2840

Browse files
committed
further refactoring
1 parent e06c7a4 commit e9f2840

8 files changed

Lines changed: 161 additions & 369 deletions

File tree

app/src/processing/app/syntax/JEditTextArea.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -794,26 +794,27 @@ public int xToOffset(int line, int x) {
794794
}
795795
}
796796

797+
797798
/**
798799
* Converts a point to an offset, from the start of the text.
799800
* @param x The x co-ordinate of the point
800801
* @param y The y co-ordinate of the point
801802
*/
802-
public int xyToOffset(int x, int y)
803-
{
803+
public int xyToOffset(int x, int y) {
804804
int line = yToLine(y);
805805
int start = getLineStartOffset(line);
806806
return start + xToOffset(line,x);
807807
}
808808

809+
809810
/**
810811
* Returns the document this text area is editing.
811812
*/
812-
public final SyntaxDocument getDocument()
813-
{
813+
public final SyntaxDocument getDocument() {
814814
return document;
815815
}
816816

817+
817818
/**
818819
* Sets the document this text area is editing.
819820
* @param document The document

app/src/processing/app/syntax/TextAreaPainter.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,12 @@ public FontMetrics getFontMetrics(SyntaxStyle style) {
438438
}
439439

440440

441+
// fry [160806 for 3.2]
442+
public int getLineHeight() {
443+
return fm.getHeight() + fm.getDescent();
444+
}
445+
446+
441447
// /**
442448
// * Sets the font for this component. This is overridden to update the
443449
// * cached font metrics and to recalculate which lines are visible.

app/src/processing/app/ui/Editor.java

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2358,6 +2358,14 @@ public Point getSketchLocation() {
23582358
// }
23592359

23602360

2361+
public boolean isDebuggerEnabled() {
2362+
return false;
2363+
}
2364+
2365+
2366+
public void toggleBreakpoint(int lineIndex) { }
2367+
2368+
23612369
/**
23622370
* Check if the sketch is modified and ask user to save changes.
23632371
* @return false if canceling the close/quit operation
@@ -2930,18 +2938,6 @@ public boolean isHalted() {
29302938
static Color bgColorError;
29312939

29322940

2933-
/*
2934-
public void toolTipError(JComponent comp, String message) {
2935-
setToolTip(comp, message, true);
2936-
}
2937-
2938-
2939-
public void toolTipWarning(JComponent comp, String message) {
2940-
setToolTip(comp, message, false);
2941-
}
2942-
*/
2943-
2944-
29452941
public void statusToolTip(JComponent comp, String message, boolean error) {
29462942
if (font == null) {
29472943
font = Toolkit.getSansFont(9, Font.PLAIN);

core/todo.txt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
0252 (3.1.3?)
1+
0252 (3.2)
22
X some Table cleanup based on other CSV parsing work
33
X use StandardCharsets.UTF_8 instead of getting encoding by name
44
X PApplet.main(Blah.class) now works
@@ -7,6 +7,14 @@ _ do the same for the other data classes
77
_ note the difference between this and toJSONObject() or toJSONArray()
88
_ or is that the better way to handle it? hm
99

10+
jakub
11+
X Fix resizing targets for async save
12+
X https://github.com/processing/processing/pull/4607
13+
X https://github.com/processing/processing/issues/4578
14+
15+
_ disable OpenGL ES on Linux?
16+
_ https://github.com/processing/processing/issues/4584
17+
1018

1119
_ Can't render PGraphics object using image() within a PDF
1220
_ https://github.com/processing/processing/issues/4473

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

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,8 @@ protected JavaEditor(Base base, String path, EditorState state,
126126

127127
getJavaTextArea().setMode(jmode);
128128

129-
initPDEX();
129+
preprocessingService = new PreprocessingService(this);
130+
pdex = new PDEX(this, preprocessingService);
130131

131132
Toolkit.setMenuMnemonics(textarea.getRightClickPopup());
132133

@@ -146,18 +147,12 @@ public void caretUpdate(CaretEvent e) {
146147
});
147148
}
148149

149-
150+
150151
public PdePreprocessor createPreprocessor(final String sketchName) {
151-
return new PdePreprocessor(sketchName);
152+
return new PdePreprocessor(sketchName);
152153
}
153154

154-
155-
protected void initPDEX() {
156-
preprocessingService = new PreprocessingService(this);
157-
pdex = new PDEX(this, preprocessingService);
158-
}
159-
160-
155+
161156
protected JEditTextArea createTextArea() {
162157
return new JavaTextArea(new PdeTextAreaDefaults(mode), this);
163158
}
@@ -1195,12 +1190,13 @@ public void handleContinue() {
11951190
}
11961191

11971192

1198-
/** Toggle a breakpoint on the current line. */
1199-
public void toggleBreakpoint() {
1200-
debugger.toggleBreakpoint(getCurrentLineID().lineIdx());
1201-
}
1193+
// /** Toggle a breakpoint on the current line. */
1194+
// public void toggleBreakpoint() {
1195+
// toggleBreakpoint(getCurrentLineID().lineIdx());
1196+
// }
12021197

12031198

1199+
@Override
12041200
public void toggleBreakpoint(int lineIndex) {
12051201
debugger.toggleBreakpoint(lineIndex);
12061202
}
@@ -1430,7 +1426,8 @@ public void actionPerformed(ActionEvent e) {
14301426
item.addActionListener(new ActionListener() {
14311427
public void actionPerformed(ActionEvent e) {
14321428
Logger.getLogger(JavaEditor.class.getName()).log(Level.INFO, "Invoked 'Toggle Breakpoint' menu item");
1433-
toggleBreakpoint();
1429+
// TODO wouldn't getCaretLine() do the same thing with less effort?
1430+
toggleBreakpoint(getCurrentLineID().lineIdx());
14341431
}
14351432
});
14361433
debugMenu.add(item);
@@ -1522,8 +1519,8 @@ public void actionPerformed(ActionEvent e) {
15221519
}
15231520

15241521

1522+
@Override
15251523
public boolean isDebuggerEnabled() {
1526-
//return enableDebug.isSelected();
15271524
return debugEnabled;
15281525
}
15291526

0 commit comments

Comments
 (0)