FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

change up how extra statements from size() are handled (fixes #3531) · WolfyD/processing@0385fd7 · GitHub

Repository navigation

Commit 0385fd7

Browse files
committed
change up how extra statements from size() are handled (fixes processing#3531)
1 parent 07e9403 commit 0385fd7

5 files changed

Lines changed: 94 additions & 36 deletions

File tree

‎core/todo.txt‎

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ X fix problem with JAR loading inside createInputRaw()
88
o https://github.com/processing/processing/pull/3514
99
_ are we clear on sketchPath() for OS X?
1010
_ working dir (user.dir?) returns home dir, not app dir in Oracle Java
11+
_ could add -Dapp.root=$APP_ROOT and get via System.getProperty("app.root")
1112

1213
jakub
1314
X Remove size() from setup() when copying to settings()
@@ -23,6 +24,22 @@ X https://github.com/processing/processing/issues/3473
2324
X https://github.com/processing/processing/pull/3521
2425
X size() errors
2526
X https://github.com/processing/processing/issues/3483
27+
X improve hint(ENABLE_DEPTH_SORT) to use proper painter's algo
28+
X https://github.com/processing/processing/issues/90
29+
X also for begin/endRaw:
30+
X https://github.com/processing/processing/issues/2235
31+
X polygon z-order depth sorting with alpha in opengl
32+
X complete the implementation of hint() with proper implementation
33+
X gl alpha on images when flipped around backwards
34+
X will sorting based on depth help this? also ask simon for ideas
35+
X need to merge sorting/drawing of lines and triangles
36+
X lines will occlude tris and vice versa
37+
X will need to split each based on the other
38+
X sort issues will affect both
39+
X https://github.com/processing/processing/pull/3507
40+
X https://github.com/processing/processing/pull/3477
41+
X https://github.com/processing/processing/pull/3410
42+
X https://github.com/processing/processing/pull/3372
2643

2744
opengl
2845
X ArrayIndexOutOfBoundsException error when enabling depth sorting in P3D
@@ -42,6 +59,7 @@ X Depth sorting wrong when drawing inside setup(), P3D
4259
X can no longer be reproduced
4360
X https://github.com/processing/processing/issues/2483
4461

62+
4563
docs
4664
_ note that full screen and present are now different
4765
_ on Export to Application, this has an impact
@@ -82,6 +100,7 @@ _ or is Canvas specific to the PGraphics, and we get another Context2D?
82100
_ http://docs.oracle.com/javafx/2/api/javafx/scene/canvas/Canvas.html
83101
_ loadPixels() (also 2x)
84102
_ text and fonts?
103+
_ maybe helpful: https://wiki.openjdk.java.net/display/OpenJFX/Font+Setup
85104
_ updatePixels()
86105
_ save() and saveFrame()
87106
_ get() and set()
@@ -623,18 +642,6 @@ _ Disabling Aero scheme sometimes prevents the problem
623642
_ Updating graphics drivers may prevent the problem
624643
_ ellipse scaling method isn't great
625644
_ http://code.google.com/p/processing/issues/detail?id=87
626-
_ improve hint(ENABLE_DEPTH_SORT) to use proper painter's algo
627-
_ https://github.com/processing/processing/issues/90
628-
_ for begin/endRaw: https://github.com/processing/processing/issues/2235
629-
_ http://code.google.com/p/processing/issues/detail?id=51
630-
_ polygon z-order depth sorting with alpha in opengl
631-
_ complete the implementation of hint() with proper implementation
632-
_ gl alpha on images when flipped around backwards
633-
_ will sorting based on depth help this? also ask simon for ideas
634-
_ need to merge sorting/drawing of lines and triangles
635-
_ lines will occlude tris and vice versa
636-
_ will need to split each based on the other
637-
_ sort issues will affect both
638645
_ Stroking a rect() leaves off the upper right pixel
639646
_ http://code.google.com/p/processing/issues/detail?id=67
640647
_ Signature issue on contributed libraries affects unrelated opengl sketches

‎java/src/processing/mode/java/JavaBuild.java‎

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -257,13 +257,22 @@ public String preprocess(File srcFolder,
257257
return null;
258258
}
259259
//System.out.format("size() is '%s'%n", info[0]);
260-
261-
// Remove the size() statement (will be added back by writeFooter())
260+
261+
// Remove the entries being moved to settings(). They will be re-inserted
262+
// by writeFooter() when it emits the settings() method.
262263
if (sizeInfo != null) {
263-
String sizeStatement = sizeInfo.getStatement();
264-
if (sizeStatement != null) {
265-
int index = bigCode.indexOf(sizeStatement);
266-
bigCode.delete(index, index + sizeStatement.length());
264+
// String sizeStatement = sizeInfo.getStatement();
265+
for (String stmt : sizeInfo.getStatements()) {
266+
// if (sizeStatement != null) {
267+
//System.out.format("size stmt is '%s'%n", sizeStatement);
268+
int index = bigCode.indexOf(stmt);
269+
if (index != -1) {
270+
bigCode.delete(index, index + stmt.length());
271+
} else {
272+
// TODO remove once we hit final; but prevent an exception like in
273+
// https://github.com/processing/processing/issues/3531
274+
System.err.format("Error removing '%s' from the code.", stmt);
275+
}
267276
}
268277
}
269278

‎java/src/processing/mode/java/preproc/PdePreprocessor.java‎

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,8 @@ make sure that it uses numbers (or displayWidth/Height), copy into settings
357357
if (sizeContents != null) {
358358
StringList args = breakCommas(sizeContents[1]);
359359
SurfaceInfo info = new SurfaceInfo();
360-
info.statement = sizeContents[0];
360+
// info.statement = sizeContents[0];
361+
info.addStatement(sizeContents[0]);
361362
info.width = args.get(0).trim();
362363
info.height = args.get(1).trim();
363364
info.renderer = (args.size() >= 3) ? args.get(2).trim() : null;
@@ -384,9 +385,7 @@ make sure that it uses numbers (or displayWidth/Height), copy into settings
384385
throw new SketchException("Please fix the size() line to continue.", false);
385386
}
386387

387-
if (extraStatements.size() != 0) {
388-
info.statement += extraStatements.join(" ");
389-
}
388+
info.addStatements(extraStatements);
390389
info.checkEmpty();
391390
return info;
392391
//return new String[] { contents[0], width, height, renderer, path };
@@ -395,7 +394,8 @@ make sure that it uses numbers (or displayWidth/Height), copy into settings
395394
//contents = PApplet.match(searchArea, FULL_SCREEN_CONTENTS_REGEX);
396395
if (fullContents != null) {
397396
SurfaceInfo info = new SurfaceInfo();
398-
info.statement = fullContents[0];
397+
// info.statement = fullContents[0];
398+
info.addStatement(fullContents[0]);
399399
StringList args = breakCommas(fullContents[1]);
400400
if (args.size() > 0) { // might have no args
401401
String args0 = args.get(0).trim();
@@ -416,9 +416,10 @@ make sure that it uses numbers (or displayWidth/Height), copy into settings
416416
}
417417
info.width = "displayWidth";
418418
info.height = "displayHeight";
419-
if (extraStatements.size() != 0) {
420-
info.statement += extraStatements.join(" ");
421-
}
419+
// if (extraStatements.size() != 0) {
420+
// info.statement += extraStatements.join(" ");
421+
// }
422+
info.addStatements(extraStatements);
422423
info.checkEmpty();
423424
return info;
424425
}
@@ -427,7 +428,8 @@ make sure that it uses numbers (or displayWidth/Height), copy into settings
427428
// need to pull out the noSmooth() and smooth(N) methods.
428429
if (extraStatements.size() != 0) {
429430
SurfaceInfo info = new SurfaceInfo();
430-
info.statement = extraStatements.join(" ");
431+
// info.statement = extraStatements.join(" ");
432+
info.addStatements(extraStatements);
431433
return info;
432434
}
433435

@@ -1094,10 +1096,10 @@ protected void writeFooter(PrintWriter out, String className) {
10941096
}
10951097

10961098
if ((mode == Mode.STATIC) || (mode == Mode.ACTIVE)) {
1097-
// doesn't remove the oriiginal size() method, but calling size()
1099+
// doesn't remove the original size() method, but calling size()
10981100
// again in setup() is harmless.
1099-
if (!hasMethod("settings") && sizeInfo.statement != null) {
1100-
out.println(indent + "public void settings() { " + sizeInfo.statement + " }");
1101+
if (!hasMethod("settings") && sizeInfo.hasSettings()) {
1102+
out.println(indent + "public void settings() { " + sizeInfo.getSettings() + " }");
11011103
// out.println(indent + "public void settings() {");
11021104
// out.println(indent + indent + sizeStatement);
11031105
// out.println(indent + "}");

‎java/src/processing/mode/java/preproc/SurfaceInfo.java‎

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,12 @@
2525

2626
import processing.app.Base;
2727
import processing.core.PApplet;
28+
import processing.data.StringList;
2829

2930

3031
public class SurfaceInfo {
31-
String statement;
32+
// String statement;
33+
StringList statements;
3234
String width;
3335
String height;
3436
String renderer;
@@ -101,7 +103,42 @@ void checkEmpty() {
101103
}
102104

103105

104-
public String getStatement() {
105-
return statement;
106+
// public String getStatements() {
107+
// return statements.join(" ");
108+
// }
109+
110+
111+
public StringList getStatements() {
112+
return statements;
113+
}
114+
115+
116+
/**
117+
* Add an item that will be moved from size() into the settings() method.
118+
* This needs to be the exact version of the statement so that it can be
119+
* matched against and removed from the size() method in the code.
120+
*/
121+
public void addStatement(String stmt) {
122+
if (statements == null) {
123+
statements = new StringList();
124+
}
125+
statements.append(stmt);
126+
}
127+
128+
129+
public void addStatements(StringList list) {
130+
statements.append(list);
131+
}
132+
133+
134+
/** @return true if there's code to be inserted for a settings() method. */
135+
public boolean hasSettings() {
136+
return statements != null;
137+
}
138+
139+
140+
/** @return the contents of the settings() method to be inserted */
141+
public String getSettings() {
142+
return statements.join(" ");
106143
}
107144
}

‎todo.txt‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ X https://github.com/processing/processing/issues/3474
44
X Add message that says it's safe to ignore the tools.jar warning
55
X add new lower console/errors icons
66
X dist needs to do a git pull on processing-docs
7-
_ don't show display warning when display 1 doesn't exist
7+
X StringIndexOutOfBoundsException while preprocessing
8+
X https://github.com/processing/processing/issues/3531
89

910
fixed earlier
1011
X font fixes for Georgia in the examples
@@ -28,6 +29,7 @@ X https://github.com/processing/processing/pull/3522
2829

2930

3031
beta
32+
_ don't show display warning when display 1 doesn't exist
3133
_ try to get images working in welcome screen
3234
_ https://github.com/processing/processing/blob/master/build/shared/lib/welcome/sketchbook.html#L60
3335
_ https://github.com/processing/processing/issues/3494
@@ -39,11 +41,11 @@ _ Contribution Manager design is really rough
3941
_ https://github.com/processing/processing/issues/3464
4042
_ Ready to add contributed example packages?
4143
_ https://github.com/processing/processing/issues/2953
44+
_ fix the red for the console/error stuff
45+
_ also the sidebar, the squiggly line beneath code, and the status bar
4246

4347

4448
gui
45-
_ fix the red for the console/error stuff
46-
_ also the sidebar, the squiggly line beneath code, and the status bar
4749
_ show hover text with 'debug'
4850
_ inquire about updated document icon
4951
_ don't show breakpoints when debugger is off
@@ -133,6 +135,7 @@ _ add last revision used / max revision used settings?
133135

134136
crashing
135137
_ fix appbundler problems due to rollback
138+
_ appbundler is no longer being developed by Oracle, switch to "packager"
136139
_ this re-introduces two bugs (serial export and scrolling)
137140
_ and any other changes later than 16 November 2015:
138141
_ https://github.com/processing/processing/commits/master/build/macosx/appbundler.jar

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL