diff --git a/processing/app/PdeEditor.java b/processing/app/PdeEditor.java index bd6e3e9ee..59c0816da 100644 --- a/processing/app/PdeEditor.java +++ b/processing/app/PdeEditor.java @@ -673,7 +673,6 @@ implements MRJAboutHandler, MRJQuitHandler, MRJPrefsHandler JMenuItem item; item = new JMenuItem("Environment"); - /* item.setEnabled(false); */ item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { PdeBase.openURL(System.getProperty("user.dir") + File.separator + diff --git a/processing/app/PdeMessageSiphon.java b/processing/app/PdeMessageSiphon.java index ddb357780..57392442f 100644 --- a/processing/app/PdeMessageSiphon.java +++ b/processing/app/PdeMessageSiphon.java @@ -82,8 +82,10 @@ class PdeMessageSiphon implements Runnable { // on linux, a "bad file descriptor" message comes up when // closing an applet that's being run externally. // use this to cause that to fail silently since not important - if ((PdeBase.platform != PdeBase.LINUX) || - (e.getMessage().indexOf("Bad file descriptor") == -1)) { + //String mess = e.getMessage(); + //if ((PdeBase.platform != PdeBase.LINUX) || + //(e.getMessage().indexOf("Bad file descriptor") == -1)) { + if (e.getMessage().indexOf("Bad file descriptor") == -1) { System.err.println("PdeMessageSiphon err " + e); e.printStackTrace(); thread = null; diff --git a/processing/app/PdeRuntime.java b/processing/app/PdeRuntime.java index e7153bdbb..217503e88 100644 --- a/processing/app/PdeRuntime.java +++ b/processing/app/PdeRuntime.java @@ -46,7 +46,9 @@ public class PdeRuntime implements PdeMessageConsumer { boolean foundMessageSource; Process process; + SystemOutSiphon processInput; OutputStream processOutput; + PdeMessageSiphon processError; //boolean externalRuntime; //String libraryPath; @@ -109,8 +111,8 @@ public class PdeRuntime implements PdeMessageConsumer { //PApplet.println(PApplet.join(command, " ")); process = Runtime.getRuntime().exec(command); - new SystemOutSiphon(process.getInputStream()); - new PdeMessageSiphon(process.getErrorStream(), this); + processInput = new SystemOutSiphon(process.getInputStream()); + processError = new PdeMessageSiphon(process.getErrorStream(), this); processOutput = process.getOutputStream(); } else { // !externalRuntime @@ -527,11 +529,14 @@ java.lang.NullPointerException } + /** + * Siphons from an InputStream of System.out (from a Process) + * and sends it to the real System.out. + */ class SystemOutSiphon implements Runnable { InputStream input; Thread thread; - public SystemOutSiphon(InputStream input) { this.input = input; @@ -550,45 +555,16 @@ java.lang.NullPointerException if (count == -1) thread = null; //System.out.print("bc" + count + " " + new String(boofer, 0, count)); //PApplet.println(boofer); + System.out.print(new String(boofer, 0, count)); } catch (IOException e) { + // this is prolly because the app was quit & the stream broken + //e.printStackTrace(System.out); thread = null; } //System.out.println("SystemOutSiphon: out"); - //thread = null; + thread = null; } } - - - /* - //while (Thread.currentThread() == thread) { - //try { - //while (true) { - //int count = input.available(); - //int offset = 0; - int count = input.read(boofer, 0, boofer.length); - if (count == -1) { - System.out.println("SystemOutSiphon: out"); - thread = null; - } - //if (count != -1) { - if (count > 0) { - System.out.print(new String(boofer, 0, count)); - } - //} - //} - - } catch (Exception e) { - System.err.println("SystemOutSiphon error " + e); - e.printStackTrace(); - } - //Thread.yield(); - try { - Thread.sleep(100); - } catch (InterruptedException e) { } - } - } - */ - } } diff --git a/processing/build/macosx/make.sh b/processing/build/macosx/make.sh index 61b529495..22b96396d 100755 --- a/processing/build/macosx/make.sh +++ b/processing/build/macosx/make.sh @@ -195,14 +195,48 @@ cp work/lib/*.jar work/Processing.app/Contents/Resources/Java/ ### -- BUILD LIBRARIES ------------------------------------------------ -#CLASSPATH=../../build/macosx/work/lib/core.jar +CLASSPATH=../../build/macosx/work/lib/core.jar:$CLASSPATH -#pwd + +# SERIAL LIBRARY +echo Building serial library... cd ../../lib/serial ../../build/macosx/work/jikes +D -classpath "RXTXcomm.jar:../../build/macosx/work/lib/core.jar:$CLASSPATH" -d . *.java -#../../build/windows/work/jikes +D -classpath "comm.jar;$CLASSPATH" -d . *.java zip -r0q serial.jar processing rm -rf processing +mkdir -p ../../build/macosx/work/libraries/serial/library/ +cp serial.jar ../../build/macosx/work/libraries/serial/library/ +# NET LIBRARY +echo Building net library... +cd ../../lib/net +../../build/macosx/work/jikes +D -d . *.java +zip -r0q net.jar processing +rm -rf processing +mkdir -p ../../build/macosx/work/libraries/net/library/ +cp net.jar ../../build/macosx/work/libraries/net/library/ + + +# VIDEO LIBRARY +echo Building video library... +QTJAVA=/System/Library/Java/Extensions/QTJava.zip +if test -f "${QTJAVA}" +then + echo "Found Quicktime at $QTJAVA" +else + echo "could not find qtjava.zip in" + echo "${WINDIR}\\system32\\qtjava.zip" + echo "quicktime for java must be installed before building." + exit 1; +fi +cd ../../lib/video +../../build/macosx/work/jikes +D -classpath "$QTJAVA:$CLASSPATH" -d . *.java +zip -r0q video.jar processing +rm -rf processing +mkdir -p ../../build/macosx/work/libraries/video/library/ +cp video.jar ../../build/macosx/work/libraries/video/library/ + + +echo echo Done. \ No newline at end of file diff --git a/processing/build/windows/make.sh b/processing/build/windows/make.sh index 7102a2c8f..0d7265dff 100755 --- a/processing/build/windows/make.sh +++ b/processing/build/windows/make.sh @@ -206,6 +206,7 @@ CLASSPATH="..\\..\\build\\windows\\work\\lib\\core.jar;..\\..\\build\\windows\\w # SERIAL LIBRARY +echo Build serial library... cd ../../lib/serial ../../build/windows/work/jikes +D -classpath "RXTXcomm.jar;$CLASSPATH" -d . *.java zip -r0q serial.jar processing @@ -215,6 +216,7 @@ cp serial.jar ../../build/windows/work/libraries/serial/library/ # NET LIBRARY +echo Build net library... cd ../../lib/net ../../build/windows/work/jikes +D -d . *.java zip -r0q net.jar processing @@ -224,6 +226,7 @@ cp net.jar ../../build/windows/work/libraries/net/library/ # VIDEO LIBRARY +echo Build video library... QTJAVA="$WINDIR\\system32\\QTJava.zip" if test -f "${QTJAVA}" then diff --git a/processing/core/PApplet.java b/processing/core/PApplet.java index dae642b42..3dcc9bcd4 100644 --- a/processing/core/PApplet.java +++ b/processing/core/PApplet.java @@ -1707,6 +1707,10 @@ public class PApplet extends Applet public File inputFile() { + return inputFile("Select a file..."); + } + + public File inputFile(String prompt) { Frame frame = null; Component comp = getParent(); while (comp != null) { @@ -1718,10 +1722,7 @@ public class PApplet extends Applet } //System.out.println("found frame " + frame); if (frame == null) frame = new Frame(); - - FileDialog fd = new FileDialog(frame, - "Select a file...", - FileDialog.LOAD); + FileDialog fd = new FileDialog(frame, prompt, FileDialog.LOAD); fd.show(); String directory = fd.getDirectory(); @@ -1732,9 +1733,15 @@ public class PApplet extends Applet public File outputFile() { + return outputFile("Save as..."); + } + + public File outputFile(String prompt) { Frame frame = null; Component comp = getParent(); + //System.out.println(comp + " " + comp.getClass()); while (comp != null) { + System.out.println(comp + " " + comp.getClass()); if (comp instanceof Frame) { frame = (Frame) comp; break; @@ -1743,10 +1750,7 @@ public class PApplet extends Applet } //System.out.println("found frame " + frame); if (frame == null) frame = new Frame(); - - FileDialog fd = new FileDialog(frame, - "Save as...", - FileDialog.SAVE); + FileDialog fd = new FileDialog(frame, prompt, FileDialog.SAVE); fd.show(); String directory = fd.getDirectory(); @@ -1756,6 +1760,10 @@ public class PApplet extends Applet } + /** + * I want to read lines from a file. I have RSI from typing these + * eight lines of code so many times. + */ public BufferedReader reader(File file) { try { FileInputStream fis = new FileInputStream(file); @@ -1769,6 +1777,10 @@ public class PApplet extends Applet } + /** + * I want to print lines to a file. I have RSI from typing these + * eight lines of code so many times. + */ public PrintWriter writer(File file) { try { FileOutputStream fos = new FileOutputStream(file); diff --git a/processing/core/PLibrary.java b/processing/core/PLibrary.java index 3e639db3a..295a02870 100644 --- a/processing/core/PLibrary.java +++ b/processing/core/PLibrary.java @@ -2,11 +2,9 @@ /* PLibrary - interface for classes that plug into bagel - Part of the Processing project - http://Proce55ing.net + Part of the Processing project - http://processing.org - Copyright (c) 2001-03 - Ben Fry, Massachusetts Institute of Technology and - Casey Reas, Interaction Design Institute Ivrea + Copyright (c) 2004 Ben Fry and the Processing project. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -24,13 +22,32 @@ Boston, MA 02111-1307 USA */ - package processing.core; public interface PLibrary { - // called when the applet is stopped + /** + * This sets the parent PApplet in case that's needed for anything. + * It's called on attach(). + */ + public void setParent(PApplet parent); + + /** + * Called before (outside of) draw() or loop(). + * Note that this also gets called before beginFrame() + * so no drawing can occur. + */ + public void pre(); + + /** + * Called after (outside of) draw() or loop(). + */ + public void post(); + + /** + * Called when the applet or application is stopped. + */ public void stop(); } diff --git a/processing/core/todo.txt b/processing/core/todo.txt index bffa110e0..abc44e4f8 100644 --- a/processing/core/todo.txt +++ b/processing/core/todo.txt @@ -345,6 +345,7 @@ CORE / PGraphics b _ clipping planes b _ http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1058491568;start=0 b _ http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1052313604;start=0 + b _ http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_Software;action=display;num=1095170607;start=0 b _ things are flying into the camera and halting apps b _ http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1042699742 b _ NullPointerException apparently when things way offscreen diff --git a/processing/todo.txt b/processing/todo.txt index 77ca796f8..66bd296a9 100644 --- a/processing/todo.txt +++ b/processing/todo.txt @@ -66,12 +66,19 @@ X append the user's classpath to the end of that 040913 afternoon X "Processing" folder not properly created on new install -_ when running externally, build into sketch folder +_ add all imported libs to hash table of jars + +_ something calling + _ after export of library, rebuild "import library" menu -_ libraries: static and non-static init for libs -_ final stop() for static shutdown of lib -_ but also potential stop() for individual items +_ when running externally, build into sketch folder? + +_ libraries +_ attachLibrary(new libsomething()) and attachLibrary("pitaru.Sonia"); +o final stop() for static shutdown of lib +X no static init - make the library designers deal with it +_ stop() for individual items _ register pre() and post() calls _ this would avoid having to patch BApplet _ register for setup() calls @@ -84,6 +91,11 @@ _ exception in setup() on external app doesn't kill run button _ also doesn't kill external vm _ make preferences a modal dialog +_ System.out isn't being heard from P* classes +_ errors inside those classes also causing weirdness +_ this might be a broader running as external app problem +_ errorMessage in PSerial/PClient/PServer are all using System.out + _ get export working again _ make multiple jar files thing work as an option _ http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_Software;action=display;num=1067360903;start=0 @@ -95,11 +107,6 @@ _ or rename the old applet folder to something else? (nah, too messy) _ package processing.app for PdeBase, PdeEditor.. -_ System.out isn't being heard from P* classes -_ errors inside those classes also causing weirdness -_ this might be a broader running as external app problem -_ errorMessage in PSerial/PClient/PServer are all using System.out - _ support for editor plugins _ make dynamically loaded plugins and "tools" menu _ break out beautify as its own plugin @@ -117,6 +124,8 @@ _ http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_Software;ac o make "get quicktime libs" function o can java get the root directory for system/win32 etc? +_ macosx.. use better font metrics to get width for tab names + _ implement new version of history _ make history folder, and a zip (not gz) file for each entry _ history causing trouble - super slow with a huge sketch