Skip to content

Commit 5804f96

Browse files
committed
formatting updates and todo notes
1 parent 16d1526 commit 5804f96

8 files changed

Lines changed: 185 additions & 208 deletions

File tree

android/todo.txt

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,16 @@
22
X finish xml writing on android
33
X http://stackoverflow.com/questions/2290945/writing-xml-on-android
44
X consider switch to android 2.2 as the minimum
5-
X GL2 specific code in Processing 2.0a5 break P3D on GLES2 hardware
6-
X http://code.google.com/p/processing/issues/detail?id=1029
75

8-
2.0a5
6+
andres
7+
A GL2 specific code in Processing 2.0a5 break P3D on GLES2 hardware
8+
A http://code.google.com/p/processing/issues/detail?id=1029
9+
_ Android OPENGL renderer + JAVA2D PGraphics results in PTexture exception
10+
_ http://code.google.com/p/processing/issues/detail?id=1019
11+
X OpenGL/ES requires precision specifier on float types
12+
X http://code.google.com/p/processing/issues/detail?id=1035
13+
14+
earlier
915
X remove unnecessary processing.xml.* code from android-core
1016
X http://code.google.com/p/processing/issues/detail?id=214
1117

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,3 @@
11
eclipse.preferences.version=1
2-
editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=false
32
formatter_profile=_processing
43
formatter_settings_version=12
5-
sp_cleanup.add_default_serial_version_id=true
6-
sp_cleanup.add_generated_serial_version_id=false
7-
sp_cleanup.add_missing_annotations=true
8-
sp_cleanup.add_missing_deprecated_annotations=true
9-
sp_cleanup.add_missing_methods=false
10-
sp_cleanup.add_missing_nls_tags=false
11-
sp_cleanup.add_missing_override_annotations=true
12-
sp_cleanup.add_serial_version_id=false
13-
sp_cleanup.always_use_blocks=true
14-
sp_cleanup.always_use_parentheses_in_expressions=false
15-
sp_cleanup.always_use_this_for_non_static_field_access=false
16-
sp_cleanup.always_use_this_for_non_static_method_access=false
17-
sp_cleanup.convert_to_enhanced_for_loop=true
18-
sp_cleanup.correct_indentation=true
19-
sp_cleanup.format_source_code=false
20-
sp_cleanup.format_source_code_changes_only=false
21-
sp_cleanup.make_local_variable_final=true
22-
sp_cleanup.make_parameters_final=true
23-
sp_cleanup.make_private_fields_final=true
24-
sp_cleanup.make_type_abstract_if_missing_method=false
25-
sp_cleanup.make_variable_declarations_final=true
26-
sp_cleanup.never_use_blocks=false
27-
sp_cleanup.never_use_parentheses_in_expressions=true
28-
sp_cleanup.on_save_use_additional_actions=false
29-
sp_cleanup.organize_imports=false
30-
sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
31-
sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
32-
sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
33-
sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
34-
sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
35-
sp_cleanup.remove_private_constructors=true
36-
sp_cleanup.remove_trailing_whitespaces=true
37-
sp_cleanup.remove_trailing_whitespaces_all=false
38-
sp_cleanup.remove_trailing_whitespaces_ignore_empty=true
39-
sp_cleanup.remove_unnecessary_casts=true
40-
sp_cleanup.remove_unnecessary_nls_tags=false
41-
sp_cleanup.remove_unused_imports=true
42-
sp_cleanup.remove_unused_local_variables=false
43-
sp_cleanup.remove_unused_private_fields=true
44-
sp_cleanup.remove_unused_private_members=false
45-
sp_cleanup.remove_unused_private_methods=true
46-
sp_cleanup.remove_unused_private_types=true
47-
sp_cleanup.sort_members=false
48-
sp_cleanup.sort_members_all=false
49-
sp_cleanup.use_blocks=true
50-
sp_cleanup.use_blocks_only_for_return_and_throw=false
51-
sp_cleanup.use_parentheses_in_expressions=false
52-
sp_cleanup.use_this_for_non_static_field_access=false
53-
sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
54-
sp_cleanup.use_this_for_non_static_method_access=false
55-
sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true

app/src/processing/app/Base.java

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -398,20 +398,8 @@ public boolean matches(Contribution contrib) {
398398
*/
399399
protected void restoreSketches() {
400400
String lastMode = Preferences.get("last.sketch.mode");
401-
if (DEBUG) {
402-
System.out.println("setting mode to " + lastMode);
403-
}
401+
log("setting mode to " + lastMode);
404402
if (lastMode != null) {
405-
// try {
406-
// Class<?> modeClass = Class.forName(lastMode);
407-
// defaultMode = (Mode) modeClass.newInstance();
408-
// } catch (ClassNotFoundException e) {
409-
// e.printStackTrace();
410-
// } catch (InstantiationException e) {
411-
// e.printStackTrace();
412-
// } catch (IllegalAccessException e) {
413-
// e.printStackTrace();
414-
// }
415403
for (Mode m : getModeList()) {
416404
if (m.getClass().getName().equals(lastMode)) {
417405
defaultMode = m;

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

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
/**
3232
* The text area component from the JEdit Syntax (syntax.jedit.org) project.
3333
* This is a very early version of what later was completely rewritten and
34-
* become jEdit (jedit.org). Over the years we've also added minor features
34+
* become jEdit (jedit.org). Over the years we've also added minor features
3535
* for use with Processing (notably mouse wheel support and copyAsHTML). [fry]
3636
* <p>
3737
* jEdit's text area component. It is more suited for editing program
@@ -70,7 +70,7 @@ public class JEditTextArea extends JComponent
7070
* bar is added this way.
7171
*/
7272
public static String LEFT_OF_SCROLLBAR = "los";
73-
73+
7474
/** The size of the offset between the leftmost padding and the code */
7575
public static final int leftHandGutter = 6;
7676

@@ -87,13 +87,13 @@ public JEditTextArea(TextAreaDefaults defaults) {
8787
caretTimer = new Timer(500, new ActionListener() {
8888
public void actionPerformed(ActionEvent e) {
8989
if (hasFocus()) {
90-
blinkCaret();
90+
blinkCaret();
9191
}
9292
}
9393
}); //new CaretBlinker//new CaretBlinker());
9494
caretTimer.setInitialDelay(500);
9595
caretTimer.start();
96-
96+
9797
// Initialize some misc. stuff
9898
painter = new TextAreaPainter(this, defaults);
9999
documentHandler = new DocumentHandler();
@@ -641,7 +641,7 @@ public int xToOffset(int line, int x) {
641641

642642
} else {
643643
Token tokens;
644-
if (painter.currentLineIndex == line &&
644+
if (painter.currentLineIndex == line &&
645645
painter.currentLineTokens != null) {
646646
tokens = painter.currentLineTokens;
647647
} else {
@@ -668,7 +668,7 @@ public int xToOffset(int line, int x) {
668668

669669
for (int i = 0; i < length; i++) {
670670
// System.out.println("segmentOffset = " + segmentOffset +
671-
// ", offset = " + offset +
671+
// ", offset = " + offset +
672672
// ", i = " + i +
673673
// ", length = " + length +
674674
// ", array len = " + segmentArray.length);
@@ -833,7 +833,7 @@ public int getLineStartNonWhiteSpaceOffset(int line)
833833
}
834834
return offset + length;
835835
}
836-
836+
837837
/**
838838
* Returns the end offset of the specified line.
839839
* @param line The line
@@ -849,7 +849,7 @@ public int getLineStopOffset(int line)
849849
else
850850
return lineElement.getEndOffset();
851851
}
852-
852+
853853
public int getLineStopNonWhiteSpaceOffset(int line)
854854
{
855855
int offset = getLineStopOffset(line);
@@ -861,12 +861,12 @@ public int getLineStopNonWhiteSpaceOffset(int line)
861861
return offset - i;
862862
}
863863
}
864-
864+
865865
return offset - length;
866866
}
867867

868868
/**
869-
* Returns the start offset of the line after this line, or the end of
869+
* Returns the start offset of the line after this line, or the end of
870870
* this line if there is no next line.
871871
* @param line The line
872872
* @return The end offset of the specified line, or -1 if the line is
@@ -1249,13 +1249,13 @@ public void select(int start, int end)
12491249
// getLineOfOffset(end));
12501250
}
12511251
}
1252-
1252+
12531253
private enum CharacterKinds {
12541254
Word,
12551255
Whitespace,
12561256
Other
12571257
}
1258-
1258+
12591259
private CharacterKinds CharacterKind( char ch, String noWordSep )
12601260
{
12611261
if ( Character.isLetterOrDigit(ch) || ch=='_' || noWordSep.indexOf(ch) != -1 )
@@ -1273,7 +1273,7 @@ protected void setNewSelectionWord( int line, int offset )
12731273
newSelectionEnd = newSelectionStart;
12741274
return;
12751275
}
1276-
1276+
12771277
String noWordSep = (String)document.getProperty("noWordSep");
12781278
if(noWordSep == null)
12791279
noWordSep = "";
@@ -1284,9 +1284,9 @@ protected void setNewSelectionWord( int line, int offset )
12841284
int wordEnd = lineText.length();
12851285

12861286
char ch = lineText.charAt(Math.max(0,offset - 1));
1287-
1287+
12881288
CharacterKinds thisWord = CharacterKind(ch,noWordSep);
1289-
1289+
12901290
for(int i = offset - 1; i >= 0; i--) {
12911291
ch = lineText.charAt(i);
12921292
if(CharacterKind(ch,noWordSep) != thisWord) {
@@ -1303,7 +1303,7 @@ protected void setNewSelectionWord( int line, int offset )
13031303
}
13041304
}
13051305
int lineStart = getLineStartOffset(line);
1306-
1306+
13071307
newSelectionStart = lineStart + wordStart;
13081308
newSelectionEnd = lineStart + wordEnd;
13091309
}
@@ -1678,14 +1678,14 @@ public void copy() {
16781678
* rather than opening a new window.
16791679
* <p/>
16801680
* Updated for 0144 to only format the selected lines.
1681-
* <p/>
1682-
* Updated for 0185 to incorporate the HTML changes from the Arduino project,
1683-
* and set the formatter to always use HTML (disabling, but not removing the
1681+
* <p/>
1682+
* Updated for 0185 to incorporate the HTML changes from the Arduino project,
1683+
* and set the formatter to always use HTML (disabling, but not removing the
16841684
* YaBB version of the code) and also fixing it for the Tools API.
16851685
* <p/>
1686-
* Updated for 0190 to simply be part of JEditTextArea, removed YaBB code.
1686+
* Updated for 0190 to simply be part of JEditTextArea, removed YaBB code.
16871687
* Simplest and most sensible to have it live here, since it's no longer
1688-
* specific to any language or version of the PDE.
1688+
* specific to any language or version of the PDE.
16891689
*/
16901690
public void copyAsHTML() {
16911691
StringBuffer cf = new StringBuffer("<pre>\n");
@@ -1803,7 +1803,7 @@ private void emitAsHTML(StringBuffer cf, int line) {
18031803

18041804

18051805
/**
1806-
* Handle encoding HTML entities for lt, gt, and anything non-ASCII.
1806+
* Handle encoding HTML entities for lt, gt, and anything non-ASCII.
18071807
*/
18081808
private void appendAsHTML(StringBuffer buffer, char c) {
18091809
if (c == '<') {
@@ -1826,11 +1826,11 @@ public void paste() {
18261826
if (editable) {
18271827
Clipboard clipboard = getToolkit().getSystemClipboard();
18281828
try {
1829-
String selection =
1829+
String selection =
18301830
((String) clipboard.getContents(this).getTransferData(DataFlavor.stringFlavor));
18311831

18321832
if (selection.contains("\r\n")) {
1833-
selection = selection.replaceAll("\r\n", "\n");
1833+
selection = selection.replaceAll("\r\n", "\n");
18341834

18351835
} else if (selection.contains("\r")) {
18361836
// The Mac OS MRJ doesn't convert \r to \n, so do it here
@@ -1844,7 +1844,7 @@ public void paste() {
18441844
char[] c = new char[tabSize];
18451845
Arrays.fill(c, ' ');
18461846
String tabString = new String(c);
1847-
selection = selection.replaceAll("\t", tabString);
1847+
selection = selection.replaceAll("\t", tabString);
18481848
}
18491849

18501850
// particularly on macosx when pasting from safari,
@@ -2332,7 +2332,7 @@ public void mouseDragged(MouseEvent evt)
23322332
public void mouseMoved(MouseEvent evt) {}
23332333
}
23342334

2335-
2335+
23362336
class FocusHandler implements FocusListener
23372337
{
23382338
public void focusGained(FocusEvent evt)
@@ -2361,14 +2361,14 @@ public void mousePressed(MouseEvent evt)
23612361
// setCaretVisible(true);
23622362
// focusedComponent = JEditTextArea.this;
23632363
// Here be dragons: for release 0195, this fixes a problem where the
2364-
// line segment data from the previous window was being used for
2364+
// line segment data from the previous window was being used for
23652365
// selections, causing an exception when the window you're clicking to
23662366
// was not full of text. Simply ignoring clicks when not focused fixes
23672367
// the problem, though it's not clear why the wrong Document data was
23682368
// being using regardless of the focusedComponent.
23692369
// if (focusedComponent != JEditTextArea.this) return;
23702370
if (!hasFocus()) {
2371-
System.out.println("requesting focus in window");
2371+
// System.out.println("requesting focus in window");
23722372
requestFocusInWindow();
23732373
return;
23742374
}

app/src/processing/mode/java/JavaBuild.java

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -298,37 +298,52 @@ public String preprocess(File srcFolder,
298298
// System.out.println(errorLine + " " + errorFile + " " + code[errorFile].getPreprocOffset());
299299

300300
String msg = re.getMessage();
301+
302+
//System.out.println(java.getAbsolutePath());
303+
System.out.println(bigCode);
301304

302-
if (msg.equals("expecting RCURLY, found 'null'")) {
305+
if (msg.contains("expecting RCURLY")) {
306+
//if (msg.equals("expecting RCURLY, found 'null'")) {
303307
// This can be a problem since the error is sometimes listed as a line
304308
// that's actually past the number of lines. For instance, it might
305309
// report "line 15" of a 14 line program. Added code to highlightLine()
306310
// inside Editor to deal with this situation (since that code is also
307311
// useful for other similar situations).
308312
throw new SketchException("Found one too many { characters " +
309313
"without a } to match it.",
310-
errorFile, errorLine, re.getColumn());
314+
errorFile, errorLine, re.getColumn(), false);
315+
}
316+
317+
if (msg.contains("expecting LCURLY")) {
318+
System.err.println(msg);
319+
String suffix = ".";
320+
String[] m = PApplet.match(msg, "found ('.*')");
321+
if (m != null) {
322+
suffix = ", not " + m[1] + ".";
323+
}
324+
throw new SketchException("Was expecting a { character" + suffix,
325+
errorFile, errorLine, re.getColumn(), false);
311326
}
312327

313328
if (msg.indexOf("expecting RBRACK") != -1) {
314329
System.err.println(msg);
315330
throw new SketchException("Syntax error, " +
316331
"maybe a missing ] character?",
317-
errorFile, errorLine, re.getColumn());
332+
errorFile, errorLine, re.getColumn(), false);
318333
}
319334

320335
if (msg.indexOf("expecting SEMI") != -1) {
321336
System.err.println(msg);
322337
throw new SketchException("Syntax error, " +
323338
"maybe a missing semicolon?",
324-
errorFile, errorLine, re.getColumn());
339+
errorFile, errorLine, re.getColumn(), false);
325340
}
326341

327342
if (msg.indexOf("expecting RPAREN") != -1) {
328343
System.err.println(msg);
329344
throw new SketchException("Syntax error, " +
330345
"maybe a missing right parenthesis?",
331-
errorFile, errorLine, re.getColumn());
346+
errorFile, errorLine, re.getColumn(), false);
332347
}
333348

334349
if (msg.indexOf("preproc.web_colors") != -1) {
@@ -339,7 +354,7 @@ public String preprocess(File srcFolder,
339354

340355
//System.out.println("msg is " + msg);
341356
throw new SketchException(msg, errorFile,
342-
errorLine, re.getColumn());
357+
errorLine, re.getColumn(), false);
343358

344359
} catch (antlr.TokenStreamRecognitionException tsre) {
345360
// while this seems to store line and column internally,

0 commit comments

Comments
 (0)