diff --git a/app/Base.java b/app/Base.java index 9d8e63e2a..e93624b6b 100644 --- a/app/Base.java +++ b/app/Base.java @@ -301,26 +301,39 @@ public class Base { } - static public File getBuildFolder() { - String buildPath = Preferences.get("build.path"); - if (buildPath != null) return new File(buildPath); + static File buildFolder; - File folder = new File(getTempFolder(), "build"); - if (!folder.exists()) folder.mkdirs(); - return folder; + static public File getBuildFolder() { + if (buildFolder == null) { + String buildPath = Preferences.get("build.path"); + if (buildPath != null) { + buildFolder = new File(buildPath); + + } else { + //File folder = new File(getTempFolder(), "build"); + //if (!folder.exists()) folder.mkdirs(); + buildFolder = getTempFolder("build"); + } + } + return buildFolder; } /** * Get the path to the platform's temporary folder, by creating * a temporary temporary file and getting its parent folder. + *
+ * Modified for revision 0094 to actually make the folder randomized + * to avoid conflicts in multi-user environments. (Bug 177) */ - static public File getTempFolder() { + static public File getTempFolder(String name) { try { - File ignored = File.createTempFile("ignored", null); - String tempPath = ignored.getParent(); - ignored.delete(); - return new File(tempPath); + File folder = File.createTempFile(name, null); + //String tempPath = ignored.getParent(); + //return new File(tempPath); + folder.delete(); + folder.mkdirs(); + return folder; } catch (Exception e) { e.printStackTrace(); diff --git a/app/EditorConsole.java b/app/EditorConsole.java index b339301d0..d609e473c 100644 --- a/app/EditorConsole.java +++ b/app/EditorConsole.java @@ -119,12 +119,14 @@ public class EditorConsole extends JScrollPane { try { String outFileName = Preferences.get("console.output.file"); if (outFileName != null) { - stdoutFile = new FileOutputStream(outFileName); + File outFile = new File(Base.getBuildFolder(), outFileName); + stdoutFile = new FileOutputStream(outFile); } String errFileName = Preferences.get("console.error.file"); if (errFileName != null) { - stderrFile = new FileOutputStream(outFileName); + File errFile = new File(Base.getBuildFolder(), errFileName); + stderrFile = new FileOutputStream(errFile); } } catch (IOException e) { Base.showWarning("Console Error", @@ -157,10 +159,13 @@ public class EditorConsole extends JScrollPane { // should the interval come from the preferences file? new javax.swing.Timer(250, new ActionListener() { public void actionPerformed(ActionEvent evt) { - consoleDoc.insertAll(); - - // always move to the end of the text as it's added - consoleTextPane.setCaretPosition(consoleDoc.getLength()); + // only if new text has been added + if (consoleDoc.hasAppendage) { + // insert the text that's been added in the meantime + consoleDoc.insertAll(); + // always move to the end of the text as it's added + consoleTextPane.setCaretPosition(consoleDoc.getLength()); + } } }).start(); } @@ -306,6 +311,7 @@ class BufferedStyledDocument extends DefaultStyledDocument { int maxLineLength, maxLineCount; int currentLineLength = 0; boolean needLineBreak = false; + boolean hasAppendage = false; public BufferedStyledDocument(int maxLineLength, int maxLineCount) { this.maxLineLength = maxLineLength; @@ -314,6 +320,10 @@ class BufferedStyledDocument extends DefaultStyledDocument { /** buffer a string for insertion at the end of the DefaultStyledDocument */ public synchronized void appendString(String str, AttributeSet a) { + // do this so that it's only updated when needed (otherwise console + // updates every 250 ms when an app isn't even running.. see bug 180) + hasAppendage = true; + // process each line of the string while (str.length() > 0) { // newlines within an element have (almost) no effect, so we need to @@ -323,7 +333,7 @@ class BufferedStyledDocument extends DefaultStyledDocument { elements.add(new ElementSpec(a, ElementSpec.StartTagType)); currentLineLength = 0; } - + if (str.indexOf('\n') == -1) { elements.add(new ElementSpec(a, ElementSpec.ContentType, str.toCharArray(), 0, str.length())); @@ -368,5 +378,6 @@ class BufferedStyledDocument extends DefaultStyledDocument { // maybe not a good idea in the long run? } elements.clear(); + hasAppendage = false; } } diff --git a/build/windows/launcher/launcher.cpp b/build/windows/launcher/launcher.cpp index 8db3faa27..0cf781cc4 100644 --- a/build/windows/launcher/launcher.cpp +++ b/build/windows/launcher/launcher.cpp @@ -101,13 +101,24 @@ WinMain (HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpCmd, int nShow) qtjava_path[0] = 0; if (getenv("QTJAVA") != NULL) { - strcpy(qtjava_path, getenv("QTJAVA")); + char *qtjava_temp = (char *)malloc(16384 * sizeof(char)); + strcpy(qtjava_temp, getenv("QTJAVA")); + if (qtjava_temp[0] == '\"') { // has quotes + // remove quotes by subsetting string by two + strncpy(qtjava_path, &qtjava_temp[1], strlen(qtjava_temp) - 2); + } else { + strcpy(qtjava_path, getenv("QTJAVA")); + } FILE *fp = fopen(qtjava_path, "rb"); if (fp != NULL) { fclose(fp); // found it, all set strcat(qtjava_path, ";"); // add path separator + //MessageBox(NULL, "found 1", "msg", MB_OK); + } else { + qtjava_path[0] = 0; // not a valid path } } + if (qtjava_path[0] == 0) { // not set yet //if (getenv("WINDIR") == NULL) { // uh-oh.. serious problem.. gonna have to report this @@ -121,24 +132,32 @@ WinMain (HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpCmd, int nShow) if (fp != NULL) { fclose(fp); // found it, all set strcat(qtjava_path, ";"); // add path separator - + //MessageBox(NULL, "found 2", "msg", MB_OK); } else { - strcpy(qtjava_path, getenv("WINDIR")); - strcat(qtjava_path, "\\SYSTEM\\QTJava.zip"); - - fp = fopen(qtjava_path, "rb"); - if (fp != NULL) { - fclose(fp); // found it, all set - strcat(qtjava_path, ";"); // add path separator - - } else { - // doesn't seem to be installed, which is a problem. - // but the error will be reported by the pde - qtjava_path[0] = 0; - } + qtjava_path[0] = 0; // not a valid path } } + if (qtjava_path[0] == 0) { + strcpy(qtjava_path, getenv("WINDIR")); + strcat(qtjava_path, "\\SYSTEM\\QTJava.zip"); + + fp = fopen(qtjava_path, "rb"); + if (fp != NULL) { + fclose(fp); // found it, all set + strcat(qtjava_path, ";"); // add path separator + //MessageBox(NULL, "found 3", "msg", MB_OK); + } else { + // doesn't seem to be installed, which is a problem. + // but the error will be reported by the pde + qtjava_path[0] = 0; + } + } + + //if (qtjava_path[0] == 0) { + //MessageBox(NULL, "not found", "msg", MB_OK); + //} + // NO! put quotes around contents of cp, because %s might have spaces in it. // don't put quotes in it, because it's setting the environment variable // for CLASSPATH, not being included on the command line. so setting the diff --git a/build/windows/launcher/processing.exe b/build/windows/launcher/processing.exe index c2d990880..3834b2036 100755 Binary files a/build/windows/launcher/processing.exe and b/build/windows/launcher/processing.exe differ diff --git a/core/PApplet.java b/core/PApplet.java index c955e76b4..de81d2619 100644 --- a/core/PApplet.java +++ b/core/PApplet.java @@ -181,11 +181,16 @@ public class PApplet extends Applet /** current y position of the mouse */ public int mouseY; - /** previous x position of the mouse */ - public int pmouseX; - - /** previous y position of the mouse */ - public int pmouseY; + /** + * Previous x/y position of the mouse. This will be a different value + * when inside a mouse handler (like the mouseMoved() method) versus + * when inside draw(). Inside draw(), pmouseX is updated once each + * frame, but inside mousePressed() and friends, it's updated each time + * an event comes through. Be sure to use only one or the other type of + * means for tracking pmouseX and pmouseY within your sketch, otherwise + * you're gonna run into trouble. + */ + public int pmouseX, pmouseY; /** * previous mouseX/Y for the draw loop, separated out because this is @@ -1289,6 +1294,7 @@ public class PApplet extends Applet mouseX = event.getX(); mouseY = event.getY(); + mouseEvent = event; int modifiers = event.getModifiers(); @@ -1307,13 +1313,6 @@ public class PApplet extends Applet } mouseEventMethods.handle(new Object[] { event }); - /* - for (int i = 0; i < libraryCount; i++) { - if (libraryCalls[i][PLibrary.MOUSE]) { - libraries[i].mouse(event); // endNet/endSerial etc - } - } - */ // this used to only be called on mouseMoved and mouseDragged // change it back if people run into trouble @@ -1325,7 +1324,8 @@ public class PApplet extends Applet firstMouse = false; } - switch (event.getID()) { + int id = event.getID(); + switch (id) { case MouseEvent.MOUSE_PRESSED: mousePressed = true; mousePressed(); @@ -1344,8 +1344,14 @@ public class PApplet extends Applet mouseMoved(); break; } + // an attempt to solve bug 170 + // http://dev.processing.org/bugs/show_bug.cgi?id=170 + //if ((id == MouseEvent.MOUSE_DRAGGED) || + // (id == MouseEvent.MOUSE_MOVED)) { + //println(emouseX + " " + emouseY + " " + mouseX + " " + mouseY); emouseX = mouseX; emouseY = mouseY; + //} } diff --git a/core/todo.txt b/core/todo.txt index 79f5c00e6..d86deb998 100644 --- a/core/todo.txt +++ b/core/todo.txt @@ -4,14 +4,33 @@ X http://dev.processing.org/bugs/show_bug.cgi?id=174 X apply fix from toxi to make targa files less picky X http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action=display;num=1127999630 +_ add a e2mouseX and e2mouseY +_ so that the prev mouse location is still good on mouseReleased +_ http://dev.processing.org/bugs/show_bug.cgi?id=170 + _ update to java 1.4.2_09 _ add auto-install of cab file inside applet.html -http://java.sun.com/update/1.4.2/jinstall-1_4_2_09-windows-i586.cab +_ http://dev.processing.org/bugs/show_bug.cgi?id=181 +_ http://java.sun.com/j2se/1.4.2/docs/guide/plugin/developer_guide/using_tags.html +_ http://java.sun.com/j2se/1.5.0/docs/guide/javaws/developersguide/launch.html#creating +_ http://java.sun.com/update/1.4.2/jinstall-1_4_2_09-windows-i586.cab for the 1.5 versions: -http://java.sun.com/update/1.5.0/jinstall-1_5_0_03-windows-i586.cab +_ http://java.sun.com/update/1.5.0/jinstall-1_5_0_03-windows-i586.cab -_ check to see noLoop() breakage is fixed in 92 vs 91 -_ http://dev.processing.org/bugs/show_bug.cgi?id=164 +_ related to the fill bugs: when fill is identical, no fill applied +_ http://dev.processing.org/bugs/show_bug.cgi?id=169 +_ fix tint() for PGraphics3 (what could be wrong?) +_ tint() honoring alpha but not colored tint +_ maybe not setting fill color when drawing textures +_ guessing it's an implementation issue in sami's renderer +_ check with the a_Displaying example and tint(255, 0, 0, 100); +_ http://dev.processing.org/bugs/show_bug.cgi?id=90 +_ is fill() not coloring textures properly? +_ don't need to apply tint() to textures, supposed to use fill color + +_ update run.bat for new quicktime +_ unfortunately this is messy because qtjava sometimes has quotes +_ and qtsystem might be somewhere besides c:\progra~1 _ STROKE_WEIGHT field in PGraphics3 is a disaster, because it's an int _ use the SW from vertex instead.. why set stroke in triangle vars at all? @@ -412,14 +431,6 @@ _ http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action _ simon reports borders on P3D and OPENGL if background() not called _ clipping not yet completely implemented _ http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action=display;num=1114184516 -_ fix tint() for PGraphics3 (what could be wrong?) -_ tint() honoring alpha but not colored tint -_ maybe not setting fill color when drawing textures -_ guessing it's an implementation issue in sami's renderer -_ check with the a_Displaying example and tint(255, 0, 0, 100); -_ http://dev.processing.org/bugs/show_bug.cgi?id=90 -_ is fill() not coloring textures properly? -_ don't need to apply tint() to textures, supposed to use fill color _ Stroking a rect() leaves off the upper right pixel _ PPolygon no longer in use and PLine is a mess _ make a version of PGraphics3 that uses it for more accurate rendering? @@ -561,6 +572,10 @@ _ texture re-allocated on each frame _ http://dev.processing.org/bugs/show_bug.cgi?id=150 _ point() doesn't work with some graphics card setups _ http://dev.processing.org/bugs/show_bug.cgi?id=121 +_ opengl + noLoop() causes InterruptedException +_ http://dev.processing.org/bugs/show_bug.cgi?id=164 +X check to see noLoop() breakage is fixed in 92 vs 91 +X checked, not fixed _ blend(), get(), set(), loadPixels, updatePixels() are broken in opengl _ set(x, y, image) y reversed in openGL _ http://dev.processing.org/bugs/show_bug.cgi?id=91 diff --git a/todo.txt b/todo.txt index 4714c870f..f76dfa247 100644 --- a/todo.txt +++ b/todo.txt @@ -1,7 +1,15 @@ 0094 pde - -_ don't write stdout.txt to the processing folder (write it to build dir?) -_ http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action=display;num=1129066571 +X don't write stdout.txt/stderr.txt to the build folder +X writing to the p5 folder was causing security problems +X http://dev.processing.org/bugs/show_bug.cgi?id=177 +X bug in console that was causing stderr and stdout +X to be written over one another.. oops +X console text selection immediately de-selects +X suspect console is updated every 250 ms even when the app isn't running +X simplest to just not update the console if nothing is waiting in buffer +X http://dev.processing.org/bugs/show_bug.cgi?id=180 +X problem with using qtjava is probably the quotes.. +X remove them because they're matching quotes elsewhere _ external apps should inherit memory settings from p5 itself _ too confusing to set the memory in two places @@ -25,11 +33,15 @@ _ explanation of what the areas are _ be sure to look at the reference, especially the extended reference other faq +_ is there a way to do xxx? +_ advanced users who are outgrowing the basic reference: +_ be sure to check the "complete" reference _ change bugs.html to issues.html _ fastest machine possible _ turn off hyperthreading in the bios _ nice gfx card only helps opengl _ dual processor not particularly useful, unless you make more threads +_ but making more threads is often more work than is useful _ save code before export, otherwise .pde exported is empty _ ask user ok or cancel to save code before exporting @@ -92,10 +104,6 @@ _ ctrl-x-2 split window _ ctrl-x-o switch windows _ ctrl-x-1 single window - -_ faq - is there a way to do xxx? -_ advanced users who are outgrowing the basic reference: -_ be sure to check the "complete" reference _ javadoc - make notes about preproc _ move the readme stuff for each file into the files themselves _ also put a general rundown of the preproc into Preprocessor.java @@ -115,7 +123,9 @@ _ appears to use 1.6.8 version since it's just two classes _ explanation of can't mix awt components with p5 _ post to web example _ http://processing.org/discourse/yabb_beta/YaBB.cgi?board=VideoCamera;action=display;num=1117194066#7 - +_ example for using mediatracker to load images +_ (rather than blocking on each) +_ maybe add a loadImages(String files[]) function? ////////////////////////////////////////////////////////////////////