diff --git a/processing/app/PdeBase.java b/processing/app/PdeBase.java
index 044e5fb47..417daa894 100644
--- a/processing/app/PdeBase.java
+++ b/processing/app/PdeBase.java
@@ -608,12 +608,12 @@ public class PdeBase {
Image image = null;
Toolkit tk = Toolkit.getDefaultToolkit();
- if ((PdeBase.platform == PdeBase.MACOSX) ||
- (PdeBase.platform == PdeBase.MACOS9)) {
- image = tk.getImage("lib/" + name);
- } else {
- image = tk.getImage(who.getClass().getResource(name));
- }
+ //if ((PdeBase.platform == PdeBase.MACOSX) ||
+ //(PdeBase.platform == PdeBase.MACOS9)) {
+ image = tk.getImage("lib/" + name);
+ //} else {
+ //image = tk.getImage(who.getClass().getResource(name));
+ //}
//image = tk.getImage("lib/" + name);
//URL url = PdeApplet.class.getResource(name);
@@ -629,20 +629,18 @@ public class PdeBase {
}
- static public InputStream getStream(String filename)
- throws IOException {
- if ((PdeBase.platform == PdeBase.MACOSX) ||
- (PdeBase.platform == PdeBase.MACOS9)) {
- // macos doesn't seem to think that files in the lib folder
- // are part of the resources, unlike windows or linux.
- // actually, this is only the case when running as a .app,
- // since it works fine from run.sh, but not Processing.app
- return new FileInputStream("lib/" + filename);
- }
+ static public InputStream getStream(String filename) throws IOException {
+ //if (PdeBase.platform == PdeBase.MACOSX) {
+ // macos doesn't seem to think that files in the lib folder
+ // are part of the resources, unlike windows or linux.
+ // actually, this is only the case when running as a .app,
+ // since it works fine from run.sh, but not Processing.app
+ return new FileInputStream("lib/" + filename);
+ //}
// all other, more reasonable operating systems
//return cls.getResource(filename).openStream();
- return PdeBase.class.getResource(filename).openStream();
+ //return PdeBase.class.getResource(filename).openStream();
}
diff --git a/processing/app/PdeRuntime.java b/processing/app/PdeRuntime.java
index b4a0a4953..05f7c5360 100644
--- a/processing/app/PdeRuntime.java
+++ b/processing/app/PdeRuntime.java
@@ -123,6 +123,7 @@ public class PdeRuntime implements PdeMessageConsumer {
processInput = new SystemOutSiphon(process.getInputStream());
processError = new PdeMessageSiphon(process.getErrorStream(), this);
processOutput = process.getOutputStream();
+
//processOutput.write(' ');
//processOutput.flush();
@@ -375,7 +376,7 @@ public class PdeRuntime implements PdeMessageConsumer {
// this is PApplet sending a message (via System.out.println)
// that signals that the applet has been quit.
if (s.indexOf(PApplet.EXTERNAL_QUIT) == 0) {
- System.out.println("external: quit");
+ //System.out.println("external: quit");
editor.doClose();
return;
}
@@ -388,7 +389,7 @@ public class PdeRuntime implements PdeMessageConsumer {
int left = Integer.parseInt(nums.substring(0, space));
int top = Integer.parseInt(nums.substring(space + 1));
editor.appletLocation = new Point(left, top);
- System.out.println("external: move to " + left + " " + top);
+ //System.out.println("external: move to " + left + " " + top);
return;
}
diff --git a/processing/core/PApplet.java b/processing/core/PApplet.java
index 5c521d123..519a664fa 100644
--- a/processing/core/PApplet.java
+++ b/processing/core/PApplet.java
@@ -1939,6 +1939,7 @@ public class PApplet extends Applet
}
+
//////////////////////////////////////////////////////////////
// PERLIN NOISE
@@ -2319,7 +2320,7 @@ public class PApplet extends Applet
}
return img;
}
- System.err.println("loadImage(): bad targa image format");
+ die("loadImage(): bad targa image format");
return null;
}
@@ -2344,14 +2345,10 @@ public class PApplet extends Applet
}
return new PFont(input);
- //} catch (IOException e) {
} catch (Exception e) {
- e.printStackTrace();
- System.err.println("Could not load font " + filename);
- System.err.println("Make sure that the font has been copied");
- System.err.println("to the data folder of your sketch.");
- System.err.println();
- e.printStackTrace();
+ die("Could not load font " + filename + "\n" +
+ "Make sure that the font has been copied\n" +
+ "to the data folder of your sketch.", e);
}
return null;
}
@@ -4270,42 +4267,212 @@ public class PApplet extends Applet
// MAIN
+ private static class WorkerVar {
+ private Thread thread;
+ WorkerVar(Thread t) { thread = t; }
+ synchronized Thread get() { return thread; }
+ synchronized void clear() { thread = null; }
+ }
+
+ class Worker {
+ private Object value;
+ private WorkerVar workerVar;
+
+ protected synchronized Object getValue() {
+ return value;
+ }
+
+ private synchronized void setValue(Object x) {
+ value = x;
+ }
+
+ /**
+ * Compute the value to be returned by the get method.
+ */
+ //public abstract Object construct();
+ public Object construct() {
+ //while ((Thread.currentThread() == this) && !finished) {
+ try {
+ // is this what's causing all the trouble?
+ int anything = System.in.read();
+ if (anything == EXTERNAL_STOP) {
+ //System.out.println("********** STOPPING");
+
+ // adding this for 0073.. need to stop libraries
+ // when the stop button is hit.
+ PApplet.this.stop();
+
+ //System.out.println("********** REALLY");
+ finished = true;
+ }
+ } catch (IOException e) {
+ // not tested (needed?) but seems correct
+ //stop();
+ finished = true;
+ //thread = null;
+ }
+ try {
+ Thread.sleep(250);
+ //Thread.sleep(100); // kick up latency for 0075?
+ } catch (InterruptedException e) { }
+ return null;
+ }
+
+ /**
+ * Called on the event dispatching thread (not on the worker thread)
+ * after the construct method has returned.
+ */
+ public void finished() {
+ }
+
+ /**
+ * A new method that interrupts the worker thread. Call this method
+ * to force the worker to stop what it's doing.
+ */
+ public void interrupt() {
+ Thread t = workerVar.get();
+ if (t != null) {
+ t.interrupt();
+ }
+ workerVar.clear();
+ }
+
+ /**
+ * Return the value created by the construct method.
+ * Returns null if either the constructing thread or the current
+ * thread was interrupted before a value was produced.
+ *
+ * @return the value created by the construct method
+ */
+ public Object get() {
+ while (true) {
+ Thread t = workerVar.get();
+ if (t == null) {
+ return getValue();
+ }
+ try {
+ t.join();
+ }
+ catch (InterruptedException e) {
+ Thread.currentThread().interrupt(); // propagate
+ return null;
+ }
+ }
+ }
+
+
+ /**
+ * Start a thread that will call the construct method
+ * and then exit.
+ */
+ public Worker() {
+ final Runnable doFinished = new Runnable() {
+ public void run() { finished(); }
+ };
+
+ Runnable doConstruct = new Runnable() {
+ public void run() {
+ try {
+ setValue(construct());
+ }
+ finally {
+ workerVar.clear();
+ }
+
+ javax.swing.SwingUtilities.invokeLater(doFinished);
+ }
+ };
+
+ Thread t = new Thread(doConstruct);
+ workerVar = new WorkerVar(t);
+ }
+
+ /**
+ * Start the worker thread.
+ */
+ public void start() {
+ Thread t = workerVar.get();
+ if (t != null) {
+ t.start();
+ }
+ }
+ }
+
+
public void setupExternal(Frame frame) {
//externalRuntime = true;
+ /*
+ javax.swing.SwingUtilities.invokeLater(new Runnable() {
+ public void run() {
+ //while ((Thread.currentThread() == this) && !finished) {
+ try {
+ // is this what's causing all the trouble?
+ int anything = System.in.read();
+ if (anything == EXTERNAL_STOP) {
+ //System.out.println("********** STOPPING");
+
+ // adding this for 0073.. need to stop libraries
+ // when the stop button is hit.
+ PApplet.this.stop();
+
+ //System.out.println("********** REALLY");
+ finished = true;
+ }
+ } catch (IOException e) {
+ // not tested (needed?) but seems correct
+ //stop();
+ finished = true;
+ //thread = null;
+ }
+ try {
+ Thread.sleep(250);
+ //Thread.sleep(100); // kick up latency for 0075?
+ } catch (InterruptedException e) { }
+ }
+ });
+ */
+
+ /*
Thread ethread = new Thread() { //new Runnable() {
public void run() {
// this fixes the "code folder hanging bug" (mostly)
setPriority(Thread.MIN_PRIORITY);
+ */
+ final Worker worker = new Worker();
- while ((Thread.currentThread() == this) && !finished) {
- try {
- // is this what's causing all the trouble?
- int anything = System.in.read();
- if (anything == EXTERNAL_STOP) {
- //System.out.println("********** STOPPING");
+ /*
+ final SwingWorker worker = new SwingWorker() {
+ public Object construct() {
+ //while ((Thread.currentThread() == this) && !finished) {
+ try {
+ // is this what's causing all the trouble?
+ int anything = System.in.read();
+ if (anything == EXTERNAL_STOP) {
+ //System.out.println("********** STOPPING");
- // adding this for 0073.. need to stop libraries
- // when the stop button is hit.
- PApplet.this.stop();
+ // adding this for 0073.. need to stop libraries
+ // when the stop button is hit.
+ PApplet.this.stop();
- //System.out.println("********** REALLY");
- finished = true;
- }
- } catch (IOException e) {
- // not tested (needed?) but seems correct
- //stop();
+ //System.out.println("********** REALLY");
finished = true;
- //thread = null;
}
- try {
- Thread.sleep(250);
- //Thread.sleep(100); // kick up latency for 0075?
- } catch (InterruptedException e) { }
+ } catch (IOException e) {
+ // not tested (needed?) but seems correct
+ //stop();
+ finished = true;
+ //thread = null;
}
+ try {
+ Thread.sleep(250);
+ //Thread.sleep(100); // kick up latency for 0075?
+ } catch (InterruptedException e) { }
+ return null;
}
};
- ethread.start();
+ //ethread.start();
+ */
frame.addComponentListener(new ComponentAdapter() {
public void componentMoved(ComponentEvent e) {
diff --git a/processing/core/todo.txt b/processing/core/todo.txt
index c35795b6d..2d9cd25e7 100644
--- a/processing/core/todo.txt
+++ b/processing/core/todo.txt
@@ -24,6 +24,14 @@ X changed PMovie.length to PMovie.duration
X move around/simplify loadImage() inside PApplet
X working to add more die() statements inside PApplet
+fixed in previous releases
+X text stuff
+X text() with alignment doesn't work for multiple lines
+X don't change the size of a font when in screen space mode
+X patch rotated text (from visualclusto) into bfont
+X what sort of api? textSpace(ROTATED) ?
+X rotated text has a bug for when it goes offscreen
+
opengl
X why is the thing hanging until 'stop' is hit?
X what happens when stop is hit that sets it free?
@@ -48,8 +56,6 @@ X why is the first one failing?
_ basic sample audio playback needed for p5
_ make separate java 1.1 and java 1.3 classes
-_ once debugged, merge these back together and use reflection
-_ (unless it's a messy disaster)
X beginFrame() around setup()
X draw mode stuff happens inside setup..
@@ -57,6 +63,8 @@ o or maybe need to get better at size() inside of draw() ?
_ make this consistent with the regular PApplet
_ otherwise things are going to be weird/difficult for debugging
+_ threading horks up dual processor machine..
+
_ make sure background() gets called at least once with opengl
_ otherwise screen never actually updates
_ depth() shouldn't be needed for opengl unless actually 3D
@@ -71,6 +79,9 @@ _ still threading issues with running opengl
_ first run hangs until quit
_ though doesn't seem to replicate when p5 is restarted
+_ should image i/o and sound i/o be moved into PImage and PSound?
+_ how to load external encoders/decoders
+
_ fix non-bound textures from mangling everything else
_ fix enable/disable textures for some objects
_ fix endian ordering issues so that things work properly
@@ -84,6 +95,12 @@ _ needs custom animator thread..
_ be consistent about getXxx() methods
+_ how to handle full screen (opengl especially) or no screen (for scripts)
+
+_ add gzipInput and gzipOutput
+
+_ image loading bug is huge
+
_ can ALPHA fonts work using the other replace modes?
_ resolve ARGB versus RGBA versus just A issues for fonts
_ make sure that current scenario works identically on mac
@@ -122,7 +139,8 @@ _ implement size(0, 0) -> just doesn't bother doing a frame.show();
_ too abstract, just have draw() call exit by default
_ so if nothing inside draw, just quits
-opengl documentation
+documentation
+_ must call depth() for 3D applications
_ lights cannot be enabled/disabled throughout
_ lighting will be based on what's left at endFrame()
_ images should be a power of 2, or call modified()
@@ -135,10 +153,11 @@ _ specifically, if drawn rotated 90 in either direction, or 180
_ if just rotate/translate, then can use SCREEN_SPACE for fonts
_ bring screen space and font size settings back in to PGraphics
_ causing too much trouble to be stuck down in PFont
-_ don't allocate zbuffer & stencil until depth() is called
+
+_ explicitly state depth()/nodepth()
+_ don't allocate zbuffer & stencil until depth() is called
_ massive graphics engine changes
-_ explicitly state depth()/nodepth()
_ move to new graphics engine
_ test with rgb cube, shut off smoothing
_ make sure line artifacts are because of smoothing
@@ -166,10 +185,6 @@ _ perhaps something gets corrected?
_ arc with stroke only draws the arc shape itself
_ may need a 'wedge' function to draw a stroke around the whole thing
-_ how to handle full screen (opengl especially) or no screen (for scripts)
-
-_ image loading bug is huge
-
_ need timer in as part of the api
_ or at least include an example that uses it
@@ -446,6 +461,13 @@ CORE / PGraphics
1 _ http://processing.org/discourse/yabb/YaBB.cgi?board=Tools;action=display;num=1082055374;start=0
+CORE / Sound
+
+ 1 _ merge PSound and PSound2 via reflection?
+ 1 _ once debugged, merge these back together and use reflection
+ 1 _ (unless it's a messy disaster)
+
+
CORE / Details
1 _ framerate(30) is still flickery and jumpy..
@@ -509,13 +531,6 @@ CORE / Mac OS X
CORE / PFont
- 1 _ text() with alignment doesn't work for multiple lines
- 1 _ don't change the size of a font when in screen space mode
- 1 _ patch rotated text (from visualclusto) into bfont
- 1 _ what sort of api? textSpace(ROTATED) ?
- 1 _ rotated text has a bug for when it goes offscreen
-
-
CORE / New Graphics
What the hell do we do with this code?
diff --git a/processing/todo.txt b/processing/todo.txt
index 2d9ce4a73..a37247dc7 100644
--- a/processing/todo.txt
+++ b/processing/todo.txt
@@ -233,7 +233,7 @@ _ mouse wheel broken in the text editor? (windows jdk 1.5?)
_ implement horizontal version of PdeEditorButtons
_ http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_Software;action=display;num=1076707944
-_ transparently convert spaces to underscores
+_ transparently convert spaces to underscores (?)
_ underscoring everything is kinda nasty