From b05c59c27c108a17aedd4ead08ade1490efddb23 Mon Sep 17 00:00:00 2001 From: David Fokkema Date: Mon, 14 Apr 2014 11:09:47 +0200 Subject: [PATCH 01/29] Do not set indeterminate state on progress bars The progress bars for installing third-party libraries were initialized with indeterminate mode. This results in a pretty *I'm doing something* animation which slows down the system. Furthermore, the progress bars are not even visible, so there is no need for any animation. Fixes processing#1561 --- app/src/processing/app/contrib/ContributionPanel.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/processing/app/contrib/ContributionPanel.java b/app/src/processing/app/contrib/ContributionPanel.java index 09ba24faf..6a6a5e90e 100644 --- a/app/src/processing/app/contrib/ContributionPanel.java +++ b/app/src/processing/app/contrib/ContributionPanel.java @@ -484,7 +484,7 @@ class ContributionPanel extends JPanel { protected void resetInstallProgressBarState() { installProgressBar.setString("Starting"); - installProgressBar.setIndeterminate(true); + installProgressBar.setIndeterminate(false); installProgressBar.setValue(0); installProgressBar.setVisible(false); } From 3a032ac3705b94eda49bc94afb3a6c0c55437e0b Mon Sep 17 00:00:00 2001 From: Jonathan Feinberg Date: Mon, 14 Apr 2014 15:52:05 -0400 Subject: [PATCH 02/29] Allow user to suppress JVM warning if they know what they're doing. --- .../app/platform/LinuxPlatform.java | 29 +++++++++++-------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/app/src/processing/app/platform/LinuxPlatform.java b/app/src/processing/app/platform/LinuxPlatform.java index 8e9ee7c71..d1dc0451f 100644 --- a/app/src/processing/app/platform/LinuxPlatform.java +++ b/app/src/processing/app/platform/LinuxPlatform.java @@ -31,21 +31,26 @@ import processing.app.Preferences; public class LinuxPlatform extends Platform { + private static final boolean SUPPRESS_JVM_WARNING = + Boolean.parseBoolean(System.getProperty("SUPPRESS_JVM_WARNING", "false")); + public void init(Base base) { super.init(base); - String javaVendor = System.getProperty("java.vendor"); - String javaVM = System.getProperty("java.vm.name"); - if (javaVendor == null || - (!javaVendor.contains("Sun") && !javaVendor.contains("Oracle")) || - javaVM == null || !javaVM.contains("Java")) { - Base.showWarning("Not fond of this Java VM", - "Processing requires Java 6 from Sun (i.e. the sun-java-jdk\n" + - "package on Ubuntu). Other versions such as OpenJDK, IcedTea,\n" + - "and GCJ are strongly discouraged. Among other things, you're\n" + - "likely to run into problems with sketch window size and\n" + - "placement. For more background, please read the wiki:\n" + - "http://wiki.processing.org/w/Supported_Platforms#Linux", null); + if (!SUPPRESS_JVM_WARNING) { + final String javaVendor = System.getProperty("java.vendor"); + final String javaVM = System.getProperty("java.vm.name"); + if (javaVendor == null || + (!javaVendor.contains("Sun") && !javaVendor.contains("Oracle")) || + javaVM == null || !javaVM.contains("Java")) { + Base.showWarning("Not fond of this Java VM", + "Processing requires Java 6 from Sun (i.e. the sun-java-jdk\n" + + "package on Ubuntu). Other versions such as OpenJDK, IcedTea,\n" + + "and GCJ are strongly discouraged. Among other things, you're\n" + + "likely to run into problems with sketch window size and\n" + + "placement. For more background, please read the wiki:\n" + + "http://wiki.processing.org/w/Supported_Platforms#Linux", null); + } } } From 563a5f3c6bbe383480d512e3a9b2c57e69e7bbb1 Mon Sep 17 00:00:00 2001 From: Jonathan Feinberg Date: Mon, 14 Apr 2014 15:53:19 -0400 Subject: [PATCH 03/29] Permit Modes to specify different default file extension for auxilliary (not main pde) files created in new tabs. --- app/src/processing/app/Mode.java | 12 ++++++++++++ app/src/processing/app/Sketch.java | 5 +---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/app/src/processing/app/Mode.java b/app/src/processing/app/Mode.java index dc609ae81..741474606 100644 --- a/app/src/processing/app/Mode.java +++ b/app/src/processing/app/Mode.java @@ -1046,6 +1046,18 @@ public abstract class Mode { abstract public String getDefaultExtension(); + /** + * Returns the appropriate file extension to use for auxilliary source files in a sketch. + * For example, in a Java-mode sketch, auxilliary files should be name "Foo.java"; in + * Python mode, they should be named "foo.py". + * + *

Modes that do not override this function will get the default behavior of returning the + * default extension. + */ + public String getModuleExtension() { + return getDefaultExtension(); + } + /** * Returns a String[] array of proper extensions. diff --git a/app/src/processing/app/Sketch.java b/app/src/processing/app/Sketch.java index 198eadeec..20e96b56e 100644 --- a/app/src/processing/app/Sketch.java +++ b/app/src/processing/app/Sketch.java @@ -333,9 +333,6 @@ public class Sketch { /** * This is called upon return from entering a new file name. * (that is, from either newCode or renameCode after the prompt) - * This code is almost identical for both the newCode and renameCode - * cases, so they're kept merged except for right in the middle - * where they diverge. */ protected void nameCode(String newName) { newName = newName.trim(); @@ -348,7 +345,7 @@ public class Sketch { // Add the extension here, this simplifies some of the logic below. if (newName.indexOf('.') == -1) { - newName += "." + mode.getDefaultExtension(); + newName += "." + (renamingCode ? mode.getDefaultExtension() : mode.getModuleExtension()); } // if renaming to the same thing as before, just ignore. From a9503b56a21fa3451635085c65fb68c0f7928c7c Mon Sep 17 00:00:00 2001 From: Ben Fry Date: Mon, 14 Apr 2014 17:27:54 -0400 Subject: [PATCH 04/29] additional fix for #1561 --- app/src/processing/app/contrib/ContributionPanel.java | 1 + core/todo.txt | 5 +++-- todo.txt | 5 +++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/app/src/processing/app/contrib/ContributionPanel.java b/app/src/processing/app/contrib/ContributionPanel.java index 6a6a5e90e..ca6f2da4e 100644 --- a/app/src/processing/app/contrib/ContributionPanel.java +++ b/app/src/processing/app/contrib/ContributionPanel.java @@ -122,6 +122,7 @@ class ContributionPanel extends JPanel { updateButton.setEnabled(false); installRemoveButton.setEnabled(false); installProgressBar.setVisible(true); + installProgressBar.setIndeterminate(true); ((LocalContribution) contrib).removeContribution(listPanel.contribManager.editor, new JProgressMonitor(installProgressBar) { diff --git a/core/todo.txt b/core/todo.txt index ca651de95..ca1b62f42 100644 --- a/core/todo.txt +++ b/core/todo.txt @@ -5,8 +5,6 @@ X call revalidate() via reflection X text looks lousy compared to the Apple JVM X mess with rendering hints? (notes in PGraphicsJava2D) X improvements made, but still not amazing.. just at level of Windows/Linux -o XML.getChildren() throwing NPE when getInt() called on non-existent var -o https://github.com/processing/processing/issues/2367 X PGraphics.colorCalcARGB(int, float) doesn't cap alpha X https://github.com/processing/processing/issues/2439 X run window border color changed in 2.1 @@ -45,6 +43,9 @@ A https://github.com/processing/processing/issues/2416 A fix pixels[] array for video capture A https://github.com/processing/processing/issues/2424 +_ XML.getChildren() throwing NPE when getInt() called on non-existent var +_ https://github.com/processing/processing/issues/2367 +_ need to sort out with docs what's happening here _ point() rendering differently in 2.0.3 and 2.1 _ https://github.com/processing/processing/issues/2278 diff --git a/todo.txt b/todo.txt index c625ed9e8..e1488bd48 100644 --- a/todo.txt +++ b/todo.txt @@ -10,11 +10,14 @@ J non-pde extensions for modes cause a crash J https://github.com/processing/processing/issues/2419 J some hardcoding for .pde still exists J https://github.com/processing/processing/issues/2420 +X the PDE uses 15% of CPU while just sitting idle (thx to David Fokkema) +X https://github.com/processing/processing/issues/1561 high _ use --deep for codesign to work? _ http://furbo.org/2013/10/17/code-signing-and-mavericks/ +_ http://brockerhoff.net/RB/AppCheckerLite/ _ exported apps reporting as "damaged" on OS X _ https://github.com/processing/processing/issues/2095 _ sketchPath() returns user.home in exported apps on OSX @@ -388,8 +391,6 @@ _ active editor not being set null _ in Base.nextEditorLocation(), changed to "editors.size() == 0" _ instead of (activeEditor == null), but that's papering over a problem _ where the active editor is not being set null -_ the PDE uses 15% of CPU while just sitting idle -_ https://github.com/processing/processing/issues/1561 _ renaming RGB (.pde) to Rgb.java says "a file named RGB.pde already exists" _ improve update check message "a new release (1.0.1) is available" _ be more descriptive, use a second line in latest.txt From 9b14288d48bb4c56ea647826d1c4f5f1233f1ad7 Mon Sep 17 00:00:00 2001 From: Jonathan Feinberg Date: Mon, 14 Apr 2014 17:56:44 -0400 Subject: [PATCH 05/29] Roll back ability to silence JVM warning. --- .../app/platform/LinuxPlatform.java | 29 ++++++++----------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/app/src/processing/app/platform/LinuxPlatform.java b/app/src/processing/app/platform/LinuxPlatform.java index d1dc0451f..8e9ee7c71 100644 --- a/app/src/processing/app/platform/LinuxPlatform.java +++ b/app/src/processing/app/platform/LinuxPlatform.java @@ -31,26 +31,21 @@ import processing.app.Preferences; public class LinuxPlatform extends Platform { - private static final boolean SUPPRESS_JVM_WARNING = - Boolean.parseBoolean(System.getProperty("SUPPRESS_JVM_WARNING", "false")); - public void init(Base base) { super.init(base); - if (!SUPPRESS_JVM_WARNING) { - final String javaVendor = System.getProperty("java.vendor"); - final String javaVM = System.getProperty("java.vm.name"); - if (javaVendor == null || - (!javaVendor.contains("Sun") && !javaVendor.contains("Oracle")) || - javaVM == null || !javaVM.contains("Java")) { - Base.showWarning("Not fond of this Java VM", - "Processing requires Java 6 from Sun (i.e. the sun-java-jdk\n" + - "package on Ubuntu). Other versions such as OpenJDK, IcedTea,\n" + - "and GCJ are strongly discouraged. Among other things, you're\n" + - "likely to run into problems with sketch window size and\n" + - "placement. For more background, please read the wiki:\n" + - "http://wiki.processing.org/w/Supported_Platforms#Linux", null); - } + String javaVendor = System.getProperty("java.vendor"); + String javaVM = System.getProperty("java.vm.name"); + if (javaVendor == null || + (!javaVendor.contains("Sun") && !javaVendor.contains("Oracle")) || + javaVM == null || !javaVM.contains("Java")) { + Base.showWarning("Not fond of this Java VM", + "Processing requires Java 6 from Sun (i.e. the sun-java-jdk\n" + + "package on Ubuntu). Other versions such as OpenJDK, IcedTea,\n" + + "and GCJ are strongly discouraged. Among other things, you're\n" + + "likely to run into problems with sketch window size and\n" + + "placement. For more background, please read the wiki:\n" + + "http://wiki.processing.org/w/Supported_Platforms#Linux", null); } } From 34b1eef4f8871122c6668908198745be1e51a3c9 Mon Sep 17 00:00:00 2001 From: Jonathan Feinberg Date: Mon, 14 Apr 2014 15:53:19 -0400 Subject: [PATCH 06/29] Permit Modes to specify different default file extension for auxilliary (not main pde) files created in new tabs. --- app/src/processing/app/Mode.java | 12 ++++++++++++ app/src/processing/app/Sketch.java | 5 +---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/app/src/processing/app/Mode.java b/app/src/processing/app/Mode.java index dc609ae81..741474606 100644 --- a/app/src/processing/app/Mode.java +++ b/app/src/processing/app/Mode.java @@ -1046,6 +1046,18 @@ public abstract class Mode { abstract public String getDefaultExtension(); + /** + * Returns the appropriate file extension to use for auxilliary source files in a sketch. + * For example, in a Java-mode sketch, auxilliary files should be name "Foo.java"; in + * Python mode, they should be named "foo.py". + * + *

Modes that do not override this function will get the default behavior of returning the + * default extension. + */ + public String getModuleExtension() { + return getDefaultExtension(); + } + /** * Returns a String[] array of proper extensions. diff --git a/app/src/processing/app/Sketch.java b/app/src/processing/app/Sketch.java index 198eadeec..20e96b56e 100644 --- a/app/src/processing/app/Sketch.java +++ b/app/src/processing/app/Sketch.java @@ -333,9 +333,6 @@ public class Sketch { /** * This is called upon return from entering a new file name. * (that is, from either newCode or renameCode after the prompt) - * This code is almost identical for both the newCode and renameCode - * cases, so they're kept merged except for right in the middle - * where they diverge. */ protected void nameCode(String newName) { newName = newName.trim(); @@ -348,7 +345,7 @@ public class Sketch { // Add the extension here, this simplifies some of the logic below. if (newName.indexOf('.') == -1) { - newName += "." + mode.getDefaultExtension(); + newName += "." + (renamingCode ? mode.getDefaultExtension() : mode.getModuleExtension()); } // if renaming to the same thing as before, just ignore. From db7135376bc85e1d007a7438e41eaf1fd4c02b21 Mon Sep 17 00:00:00 2001 From: Ben Fry Date: Tue, 15 Apr 2014 12:33:28 -0400 Subject: [PATCH 07/29] fix for code signing on Mavericks (#2453) --- build/build.xml | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/build/build.xml b/build/build.xml index 38c42244d..095542697 100755 --- a/build/build.xml +++ b/build/build.xml @@ -630,12 +630,20 @@ With a proper ID, if code signing fails, you may need to use: export CODESIGN_ALLOCATE="/Applications/Xcode.app/Contents/Developer/usr/bin/codesign_allocate" - - + + + + + + + + + + + + - - From 9dbb48a17c765e2da432567ac9df6f0e6a1537d4 Mon Sep 17 00:00:00 2001 From: Ben Fry Date: Tue, 15 Apr 2014 12:34:45 -0400 Subject: [PATCH 08/29] paper over Oracle Java bug for user.dir #2181 --- core/src/processing/core/PApplet.java | 37 ++++++++++++++++++++++----- todo.txt | 9 ++++--- 2 files changed, 36 insertions(+), 10 deletions(-) diff --git a/core/src/processing/core/PApplet.java b/core/src/processing/core/PApplet.java index ae66a1231..353cd2b34 100755 --- a/core/src/processing/core/PApplet.java +++ b/core/src/processing/core/PApplet.java @@ -327,7 +327,7 @@ public class PApplet extends Applet public String[] args; /** Path to sketch folder */ - public String sketchPath; //folder; + public String sketchPath; static final boolean DEBUG = false; // static final boolean DEBUG = true; @@ -913,11 +913,12 @@ public class PApplet extends Applet online = false; } - try { - if (sketchPath == null) { - sketchPath = System.getProperty("user.dir"); - } - } catch (Exception e) { } // may be a security problem + // overridden in runSketch(), removing for 2.1.2 +// try { +// if (sketchPath == null) { +// sketchPath = System.getProperty("user.dir"); +// } +// } catch (Exception e) { } // may be a security problem // Figure out the available display width and height. // No major problem if this fails, we have to try again anyway in @@ -10525,7 +10526,29 @@ public class PApplet extends Applet String folder = null; try { folder = System.getProperty("user.dir"); - } catch (Exception e) { } +// println("user dir is " + folder); + + // Workaround for bug in Java for OS X from Oracle (7u51) + // https://github.com/processing/processing/issues/2181 + if (platform == MACOSX) { + String jarPath = + PApplet.class.getProtectionDomain().getCodeSource().getLocation().getPath(); +// println("jar path: " + jarPath); + // The jarPath from above will be URL encoded (%20 for spaces) + jarPath = urlDecode(jarPath); +// println("decoded jar path: " + jarPath); + if (jarPath.contains("Contents/Java/")) { + String appPath = jarPath.substring(0, jarPath.indexOf(".app") + 4); + File containingFolder = new File(appPath).getParentFile(); + folder = containingFolder.getAbsolutePath(); +// println("folder is " + folder); + } +// } else { +// println("platform is " + platform); + } + } catch (Exception e) { + e.printStackTrace(); + } int argIndex = 0; while (argIndex < args.length) { diff --git a/todo.txt b/todo.txt index e1488bd48..d8d7f630b 100644 --- a/todo.txt +++ b/todo.txt @@ -12,12 +12,15 @@ J some hardcoding for .pde still exists J https://github.com/processing/processing/issues/2420 X the PDE uses 15% of CPU while just sitting idle (thx to David Fokkema) X https://github.com/processing/processing/issues/1561 +X https://github.com/processing/processing/pull/2451 +X Update code signing for Processing.app for Mavericks changes +X https://github.com/processing/processing/issues/2453 +o use --deep for codesign to work? (nope) +o http://furbo.org/2013/10/17/code-signing-and-mavericks/ +o http://brockerhoff.net/RB/AppCheckerLite/ high -_ use --deep for codesign to work? -_ http://furbo.org/2013/10/17/code-signing-and-mavericks/ -_ http://brockerhoff.net/RB/AppCheckerLite/ _ exported apps reporting as "damaged" on OS X _ https://github.com/processing/processing/issues/2095 _ sketchPath() returns user.home in exported apps on OSX From 75e238462c53cb6d74d7bef04c7c2ec0428c4d90 Mon Sep 17 00:00:00 2001 From: Ben Fry Date: Tue, 15 Apr 2014 12:55:40 -0400 Subject: [PATCH 09/29] release notes and merges --- build/shared/revisions.txt | 10 +++++++++- todo.txt | 2 ++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/build/shared/revisions.txt b/build/shared/revisions.txt index 304242672..d0d06dd06 100644 --- a/build/shared/revisions.txt +++ b/build/shared/revisions.txt @@ -1,4 +1,4 @@ -PROCESSING 2.1.2 (REV 0225) - 11 April 2014 +PROCESSING 2.1.2 (REV 0225) - 15 April 2014 Lots of small bug fixes plus some additional changes to support the new Python Mode, coming soon: https://github.com/jdf/processing.py @@ -6,6 +6,11 @@ the new Python Mode, coming soon: https://github.com/jdf/processing.py [ the pde ] ++ The PDE was using 15% of CPU while just sitting idle. Thanks to + David Fokkema for the fix (and pull request). + https://github.com/processing/processing/issues/1561 + https://github.com/processing/processing/pull/2451 + + Fix exception caused by Runner when it can't find location https://github.com/processing/processing/issues/2346 https://github.com/processing/processing/pull/2359 @@ -22,6 +27,9 @@ the new Python Mode, coming soon: https://github.com/jdf/processing.py + Remove some hardcoding for .pde as extension https://github.com/processing/processing/issues/2420 ++ Update code signing for Processing.app for Mavericks changes + https://github.com/processing/processing/issues/2453 + [ the core ] diff --git a/todo.txt b/todo.txt index d8d7f630b..f4cf7a868 100644 --- a/todo.txt +++ b/todo.txt @@ -18,6 +18,8 @@ X https://github.com/processing/processing/issues/2453 o use --deep for codesign to work? (nope) o http://furbo.org/2013/10/17/code-signing-and-mavericks/ o http://brockerhoff.net/RB/AppCheckerLite/ +J permit modes to specify alternate extension (.py for .pyde stuff) +J https://github.com/processing/processing/pull/2452 high From a32226e79978ef3440837b4434f1c0d8fad43ad5 Mon Sep 17 00:00:00 2001 From: Scott Murray Date: Tue, 15 Apr 2014 10:20:48 -0700 Subject: [PATCH 10/29] Fixes processing/processing-web#277 and cleans up lots of related mouse reference page links --- core/src/processing/core/PApplet.java | 80 +++++++++++++++++++++++++-- 1 file changed, 75 insertions(+), 5 deletions(-) diff --git a/core/src/processing/core/PApplet.java b/core/src/processing/core/PApplet.java index 353cd2b34..8de399ccc 100755 --- a/core/src/processing/core/PApplet.java +++ b/core/src/processing/core/PApplet.java @@ -444,11 +444,16 @@ public class PApplet extends Applet * ( end auto-generated ) * @webref input:mouse * @see PApplet#mouseY + * @see PApplet#pmouseX + * @see PApplet#pmouseY * @see PApplet#mousePressed * @see PApplet#mousePressed() * @see PApplet#mouseReleased() + * @see PApplet#mouseClicked() * @see PApplet#mouseMoved() * @see PApplet#mouseDragged() + * @see PApplet#mouseButton + * @see PApplet#mouseWheel(MouseEvent) * * */ @@ -463,11 +468,16 @@ public class PApplet extends Applet * ( end auto-generated ) * @webref input:mouse * @see PApplet#mouseX + * @see PApplet#pmouseX + * @see PApplet#pmouseY * @see PApplet#mousePressed * @see PApplet#mousePressed() * @see PApplet#mouseReleased() + * @see PApplet#mouseClicked() * @see PApplet#mouseMoved() * @see PApplet#mouseDragged() + * @see PApplet#mouseButton + * @see PApplet#mouseWheel(MouseEvent) * */ public int mouseY; @@ -496,9 +506,17 @@ public class PApplet extends Applet * * ( end auto-generated ) * @webref input:mouse - * @see PApplet#pmouseY * @see PApplet#mouseX * @see PApplet#mouseY + * @see PApplet#pmouseY + * @see PApplet#mousePressed + * @see PApplet#mousePressed() + * @see PApplet#mouseReleased() + * @see PApplet#mouseClicked() + * @see PApplet#mouseMoved() + * @see PApplet#mouseDragged() + * @see PApplet#mouseButton + * @see PApplet#mouseWheel(MouseEvent) */ public int pmouseX; @@ -512,9 +530,17 @@ public class PApplet extends Applet * * ( end auto-generated ) * @webref input:mouse - * @see PApplet#pmouseX * @see PApplet#mouseX * @see PApplet#mouseY + * @see PApplet#pmouseX + * @see PApplet#mousePressed + * @see PApplet#mousePressed() + * @see PApplet#mouseReleased() + * @see PApplet#mouseClicked() + * @see PApplet#mouseMoved() + * @see PApplet#mouseDragged() + * @see PApplet#mouseButton + * @see PApplet#mouseWheel(MouseEvent) */ public int pmouseY; @@ -564,10 +590,15 @@ public class PApplet extends Applet * @webref input:mouse * @see PApplet#mouseX * @see PApplet#mouseY + * @see PApplet#pmouseX + * @see PApplet#pmouseY + * @see PApplet#mousePressed * @see PApplet#mousePressed() * @see PApplet#mouseReleased() + * @see PApplet#mouseClicked() * @see PApplet#mouseMoved() * @see PApplet#mouseDragged() + * @see PApplet#mouseWheel(MouseEvent) */ public int mouseButton; @@ -582,9 +613,15 @@ public class PApplet extends Applet * @webref input:mouse * @see PApplet#mouseX * @see PApplet#mouseY + * @see PApplet#pmouseX + * @see PApplet#pmouseY + * @see PApplet#mousePressed() * @see PApplet#mouseReleased() + * @see PApplet#mouseClicked() * @see PApplet#mouseMoved() * @see PApplet#mouseDragged() + * @see PApplet#mouseButton + * @see PApplet#mouseWheel(MouseEvent) */ public boolean mousePressed; @@ -3025,11 +3062,15 @@ public class PApplet extends Applet * @webref input:mouse * @see PApplet#mouseX * @see PApplet#mouseY + * @see PApplet#pmouseX + * @see PApplet#pmouseY * @see PApplet#mousePressed - * @see PApplet#mouseButton * @see PApplet#mouseReleased() + * @see PApplet#mouseClicked() * @see PApplet#mouseMoved() * @see PApplet#mouseDragged() + * @see PApplet#mouseButton + * @see PApplet#mouseWheel(MouseEvent) */ public void mousePressed() { } @@ -3049,11 +3090,15 @@ public class PApplet extends Applet * @webref input:mouse * @see PApplet#mouseX * @see PApplet#mouseY + * @see PApplet#pmouseX + * @see PApplet#pmouseY * @see PApplet#mousePressed - * @see PApplet#mouseButton * @see PApplet#mousePressed() + * @see PApplet#mouseClicked() * @see PApplet#mouseMoved() * @see PApplet#mouseDragged() + * @see PApplet#mouseButton + * @see PApplet#mouseWheel(MouseEvent) */ public void mouseReleased() { } @@ -3077,11 +3122,15 @@ public class PApplet extends Applet * @webref input:mouse * @see PApplet#mouseX * @see PApplet#mouseY - * @see PApplet#mouseButton + * @see PApplet#pmouseX + * @see PApplet#pmouseY + * @see PApplet#mousePressed * @see PApplet#mousePressed() * @see PApplet#mouseReleased() * @see PApplet#mouseMoved() * @see PApplet#mouseDragged() + * @see PApplet#mouseButton + * @see PApplet#mouseWheel(MouseEvent) */ public void mouseClicked() { } @@ -3101,10 +3150,15 @@ public class PApplet extends Applet * @webref input:mouse * @see PApplet#mouseX * @see PApplet#mouseY + * @see PApplet#pmouseX + * @see PApplet#pmouseY * @see PApplet#mousePressed * @see PApplet#mousePressed() * @see PApplet#mouseReleased() + * @see PApplet#mouseClicked() * @see PApplet#mouseMoved() + * @see PApplet#mouseButton + * @see PApplet#mouseWheel(MouseEvent) */ public void mouseDragged() { } @@ -3124,10 +3178,15 @@ public class PApplet extends Applet * @webref input:mouse * @see PApplet#mouseX * @see PApplet#mouseY + * @see PApplet#pmouseX + * @see PApplet#pmouseY * @see PApplet#mousePressed * @see PApplet#mousePressed() * @see PApplet#mouseReleased() + * @see PApplet#mouseClicked() * @see PApplet#mouseDragged() + * @see PApplet#mouseButton + * @see PApplet#mouseWheel(MouseEvent) */ public void mouseMoved() { } @@ -3164,6 +3223,17 @@ public class PApplet extends Applet * * @webref input:mouse * @param event the MouseEvent + * @see PApplet#mouseX + * @see PApplet#mouseY + * @see PApplet#pmouseX + * @see PApplet#pmouseY + * @see PApplet#mousePressed + * @see PApplet#mousePressed() + * @see PApplet#mouseReleased() + * @see PApplet#mouseClicked() + * @see PApplet#mouseMoved() + * @see PApplet#mouseDragged() + * @see PApplet#mouseButton */ public void mouseWheel(MouseEvent event) { mouseWheel(); From c8c01e537381c2233c62fa1623163632658c2c7c Mon Sep 17 00:00:00 2001 From: Ben Fry Date: Tue, 15 Apr 2014 13:42:54 -0400 Subject: [PATCH 11/29] tweak release notes --- build/shared/revisions.txt | 3 +++ todo.txt | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/build/shared/revisions.txt b/build/shared/revisions.txt index d0d06dd06..0f7004242 100644 --- a/build/shared/revisions.txt +++ b/build/shared/revisions.txt @@ -33,6 +33,9 @@ the new Python Mode, coming soon: https://github.com/jdf/processing.py [ the core ] ++ sketchPath() was returning user.home in exported apps on OS X + https://github.com/processing/processing/issues/2181 + + Fix bug in StringDict(Reader) that wasn't setting the indices hashmap + Call revalidate() via reflection so that build works under 1.6 (using diff --git a/todo.txt b/todo.txt index f4cf7a868..531f23a6e 100644 --- a/todo.txt +++ b/todo.txt @@ -20,13 +20,13 @@ o http://furbo.org/2013/10/17/code-signing-and-mavericks/ o http://brockerhoff.net/RB/AppCheckerLite/ J permit modes to specify alternate extension (.py for .pyde stuff) J https://github.com/processing/processing/pull/2452 +X sketchPath() returns user.home in exported apps on OSX +X https://github.com/processing/processing/issues/2181 high _ exported apps reporting as "damaged" on OS X _ https://github.com/processing/processing/issues/2095 -_ sketchPath() returns user.home in exported apps on OSX -_ https://github.com/processing/processing/issues/2181 _ QuickReference tool was able to bring down the environment _ https://github.com/processing/processing/issues/2229 _ tab characters not recognized/drawn in the editor (2.1) From 5e939b1316ddaa58f856b0f8f71a44285e798e6c Mon Sep 17 00:00:00 2001 From: Ben Fry Date: Tue, 15 Apr 2014 13:51:34 -0400 Subject: [PATCH 12/29] add debug message.. found Java 1.8 problem with build. --- core/build.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/core/build.xml b/core/build.xml index 1e6a0455d..8bb8b3a2c 100755 --- a/core/build.xml +++ b/core/build.xml @@ -22,6 +22,7 @@ else="modern"> + Date: Tue, 15 Apr 2014 20:50:30 +0200 Subject: [PATCH 13/29] Do not wait for debugger to start running sketch By default, the java VM is started with options for attaching a remote debugger. The sketch is suspended until the remote debugger connects. This always succeeds the first time a sketch is run. At least on OS X 10.9, this seems to be very fragile, and successive runs of the sketch often fail to start. This commit tells the VM to *not* wait for the debugger before starting the sketch. Fixes processing#2402 --- app/src/processing/mode/java/runner/Runner.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/processing/mode/java/runner/Runner.java b/app/src/processing/mode/java/runner/Runner.java index 9bea617b5..887266d6e 100644 --- a/app/src/processing/mode/java/runner/Runner.java +++ b/app/src/processing/mode/java/runner/Runner.java @@ -133,7 +133,7 @@ public class Runner implements MessageConsumer { // String jdwpArg = "-Xrunjdwp:transport=dt_socket,address=" + portStr + ",server=y,suspend=y"; // String debugArg = "-Xdebug"; // Newer (Java 1.5+) version that uses JVMTI - String jdwpArg = "-agentlib:jdwp=transport=dt_socket,address=" + portStr + ",server=y,suspend=y"; + String jdwpArg = "-agentlib:jdwp=transport=dt_socket,address=" + portStr + ",server=y,suspend=n"; // Everyone works the same under Java 7 (also on OS X) String[] commandArgs = new String[] { Base.getJavaPath(), jdwpArg }; From 20ce7605e3714fd70c418f02f6533af0579fb057 Mon Sep 17 00:00:00 2001 From: Ben Fry Date: Tue, 15 Apr 2014 15:58:23 -0400 Subject: [PATCH 14/29] starting the next revision --- app/src/processing/app/Base.java | 4 +-- core/done.txt | 46 ++++++++++++++++++++++++++++++++ core/todo.txt | 44 +----------------------------- done.txt | 26 ++++++++++++++++++ todo.txt | 30 +++++---------------- 5 files changed, 81 insertions(+), 69 deletions(-) diff --git a/app/src/processing/app/Base.java b/app/src/processing/app/Base.java index 877ead4c9..0a5f5a321 100644 --- a/app/src/processing/app/Base.java +++ b/app/src/processing/app/Base.java @@ -46,9 +46,9 @@ import processing.mode.java.JavaMode; public class Base { // Added accessors for 0218 because the UpdateCheck class was not properly // updating the values, due to javac inlining the static final values. - static private final int REVISION = 225; + static private final int REVISION = 226; /** This might be replaced by main() if there's a lib/version.txt file. */ - static private String VERSION_NAME = "0225"; //$NON-NLS-1$ + static private String VERSION_NAME = "0226"; //$NON-NLS-1$ /** Set true if this a proper release rather than a numbered revision. */ // static private boolean RELEASE = false; diff --git a/core/done.txt b/core/done.txt index 3016a6c4f..02382bf8b 100644 --- a/core/done.txt +++ b/core/done.txt @@ -1,3 +1,49 @@ +0225 core (2.1.2) +X bug with StringDict(Reader) that wasn't setting the indices hashmap +X check this with other versions of this class +X call revalidate() via reflection +X text looks lousy compared to the Apple JVM +X mess with rendering hints? (notes in PGraphicsJava2D) +X improvements made, but still not amazing.. just at level of Windows/Linux +X PGraphics.colorCalcARGB(int, float) doesn't cap alpha +X https://github.com/processing/processing/issues/2439 +X run window border color changed in 2.1 +X https://github.com/processing/processing/issues/2297 +X simple NPE issue that needs workaround +X https://github.com/processing/processing/issues/2354 + +fixed in 2.1 +X draw() called again before finishing on OS X (retina issue) +X https://github.com/processing/processing/issues/1709 +X get() not always setting alpha channel when used with point() +X https://github.com/processing/processing/issues/1756 +A support for geometry and tessellation shaders (on desktop) +A https://github.com/processing/processing/issues/2252 + +andres +X copy() under OPENGL uses upside-down coordinates for cropping +X https://github.com/processing/processing/issues/2345 +X video on windows causes exception +X https://github.com/processing/processing/issues/2327 +X Shape Font Rendering was broken with the OpenGL Renderer +X https://github.com/processing/processing/issues/2375 +A depth buffer shouldn't be cleared when depth mask is disabled +A https://github.com/processing/processing/issues/2296 +A set pixels transparent by default in P2D/P3D +A https://github.com/processing/processing/issues/2207 +A unwind depth sorting because it was breaking DXF export +A https://github.com/processing/processing/issues/2404 +A Sketch hangs if sketchRenderer() returns an OpenGL renderer +A https://github.com/processing/processing/issues/2363 +A "buffer" uniform triggers shader compilation error +A https://github.com/processing/processing/issues/2325 +A buffer has been renamed to ppixels for shaders +A noLoop clears screen on Windows 8 +A https://github.com/processing/processing/issues/2416 +A fix pixels[] array for video capture +A https://github.com/processing/processing/issues/2424 + + 0224 core (2.1.1) X PImage resize() causes PImage not to be rendered in JAVA2D X https://github.com/processing/processing/issues/2179 diff --git a/core/todo.txt b/core/todo.txt index ca1b62f42..3172a887f 100644 --- a/core/todo.txt +++ b/core/todo.txt @@ -1,47 +1,5 @@ -0225 core -X bug with StringDict(Reader) that wasn't setting the indices hashmap -X check this with other versions of this class -X call revalidate() via reflection -X text looks lousy compared to the Apple JVM -X mess with rendering hints? (notes in PGraphicsJava2D) -X improvements made, but still not amazing.. just at level of Windows/Linux -X PGraphics.colorCalcARGB(int, float) doesn't cap alpha -X https://github.com/processing/processing/issues/2439 -X run window border color changed in 2.1 -X https://github.com/processing/processing/issues/2297 -X simple NPE issue that needs workaround -X https://github.com/processing/processing/issues/2354 +0226 core -fixed in 2.1 -X draw() called again before finishing on OS X (retina issue) -X https://github.com/processing/processing/issues/1709 -X get() not always setting alpha channel when used with point() -X https://github.com/processing/processing/issues/1756 -A support for geometry and tessellation shaders (on desktop) -A https://github.com/processing/processing/issues/2252 - -andres -X copy() under OPENGL uses upside-down coordinates for cropping -X https://github.com/processing/processing/issues/2345 -X video on windows causes exception -X https://github.com/processing/processing/issues/2327 -X Shape Font Rendering was broken with the OpenGL Renderer -X https://github.com/processing/processing/issues/2375 -A depth buffer shouldn't be cleared when depth mask is disabled -A https://github.com/processing/processing/issues/2296 -A set pixels transparent by default in P2D/P3D -A https://github.com/processing/processing/issues/2207 -A unwind depth sorting because it was breaking DXF export -A https://github.com/processing/processing/issues/2404 -A Sketch hangs if sketchRenderer() returns an OpenGL renderer -A https://github.com/processing/processing/issues/2363 -A "buffer" uniform triggers shader compilation error -A https://github.com/processing/processing/issues/2325 -A buffer has been renamed to ppixels for shaders -A noLoop clears screen on Windows 8 -A https://github.com/processing/processing/issues/2416 -A fix pixels[] array for video capture -A https://github.com/processing/processing/issues/2424 _ XML.getChildren() throwing NPE when getInt() called on non-existent var _ https://github.com/processing/processing/issues/2367 diff --git a/done.txt b/done.txt index c99b1e8e5..b3e569697 100644 --- a/done.txt +++ b/done.txt @@ -1,3 +1,29 @@ +0225 pde (2.1.2) +X Fix exception caused by Runner when it can't find location +X https://github.com/processing/processing/issues/2346 +X https://github.com/processing/processing/pull/2359 +G Serial: Update to latest upstream (fixes potential port handle leak) +G https://github.com/processing/processing/pull/2361 +J add affordance for mode developers to run from Eclipse +J https://github.com/processing/processing/pull/2422 +J non-pde extensions for modes cause a crash +J https://github.com/processing/processing/issues/2419 +J some hardcoding for .pde still exists +J https://github.com/processing/processing/issues/2420 +X the PDE uses 15% of CPU while just sitting idle (thx to David Fokkema) +X https://github.com/processing/processing/issues/1561 +X https://github.com/processing/processing/pull/2451 +X Update code signing for Processing.app for Mavericks changes +X https://github.com/processing/processing/issues/2453 +o use --deep for codesign to work? (nope) +o http://furbo.org/2013/10/17/code-signing-and-mavericks/ +o http://brockerhoff.net/RB/AppCheckerLite/ +J permit modes to specify alternate extension (.py for .pyde stuff) +J https://github.com/processing/processing/pull/2452 +X sketchPath() returns user.home in exported apps on OSX +X https://github.com/processing/processing/issues/2181 + + 0224 pde (2.1.1) M fix infinite loop in Find/Replace M https://github.com/processing/processing/issues/2082 diff --git a/todo.txt b/todo.txt index 531f23a6e..23b39471e 100644 --- a/todo.txt +++ b/todo.txt @@ -1,30 +1,10 @@ -0225 pde -X Fix exception caused by Runner when it can't find location -X https://github.com/processing/processing/issues/2346 -X https://github.com/processing/processing/pull/2359 -G Serial: Update to latest upstream (fixes potential port handle leak) -G https://github.com/processing/processing/pull/2361 -J add affordance for mode developers to run from Eclipse -J https://github.com/processing/processing/pull/2422 -J non-pde extensions for modes cause a crash -J https://github.com/processing/processing/issues/2419 -J some hardcoding for .pde still exists -J https://github.com/processing/processing/issues/2420 -X the PDE uses 15% of CPU while just sitting idle (thx to David Fokkema) -X https://github.com/processing/processing/issues/1561 -X https://github.com/processing/processing/pull/2451 -X Update code signing for Processing.app for Mavericks changes -X https://github.com/processing/processing/issues/2453 -o use --deep for codesign to work? (nope) -o http://furbo.org/2013/10/17/code-signing-and-mavericks/ -o http://brockerhoff.net/RB/AppCheckerLite/ -J permit modes to specify alternate extension (.py for .pyde stuff) -J https://github.com/processing/processing/pull/2452 -X sketchPath() returns user.home in exported apps on OSX -X https://github.com/processing/processing/issues/2181 +0226 pde high +_ sketch sometimes simply does not launch +_ https://github.com/processing/processing/issues/2402 +_ https://github.com/processing/processing/pull/2455 _ exported apps reporting as "damaged" on OS X _ https://github.com/processing/processing/issues/2095 _ QuickReference tool was able to bring down the environment @@ -43,6 +23,8 @@ _ maybe OS X Java can't look in subfolders? (just auto-adds things) medium +_ re/move things from Google Code downloads +_ https://code.google.com/p/support/wiki/DownloadsFAQ _ actual help with cleaning out the repo _ https://github.com/processing/processing/issues/1898 _ requires re-forking, so still a ton of work From f42d4e67429ce4a12e813b437e771282bcdf458e Mon Sep 17 00:00:00 2001 From: Jonathan Feinberg Date: Wed, 16 Apr 2014 09:17:49 -0400 Subject: [PATCH 15/29] Fix "switch mode" to edit current code in new mode when compatible. --- app/src/processing/app/Base.java | 52 ++++++++++++++++++++++-------- app/src/processing/app/Editor.java | 5 +-- app/src/processing/app/Sketch.java | 3 +- 3 files changed, 43 insertions(+), 17 deletions(-) diff --git a/app/src/processing/app/Base.java b/app/src/processing/app/Base.java index 0a5f5a321..b19e6f340 100644 --- a/app/src/processing/app/Base.java +++ b/app/src/processing/app/Base.java @@ -607,13 +607,30 @@ public class Base { Base.showWarning("Save", "Please save the sketch before changing the mode.", null); + return; + } + nextMode = mode; + + // If the current editor contains file extensions that the new mode can handle, then + // write a sketch.properties file with the new mode specified, and reopen. + boolean newModeCanHandleCurrentSource = true; + for (final SketchCode code: sketch.getCode()) { + if (!mode.validExtension(code.getExtension())) { + newModeCanHandleCurrentSource = false; + break; + } + } + if (newModeCanHandleCurrentSource) { + final File props = new File(sketch.getCodeFolder(), "sketch.properties"); + saveModeSettings(props, nextMode); + handleClose(activeEditor, LastEditorClosePolicy.DO_NOT_QUIT); + handleOpen(sketch.getMainFilePath()); } else { // If you're changing modes, and there's nothing in the current sketch, you probably // don't intend to keep the old, wrong-mode editor around. if (sketch.isUntitled()) { - handleClose(activeEditor, true); + handleClose(activeEditor, LastEditorClosePolicy.DO_NOT_QUIT); } - nextMode = mode; handleNew(); } } @@ -729,15 +746,7 @@ public class Base { } // Create sketch properties. - final File sketchProps = new File(newbieDir, "sketch.properties"); - try { - final Settings settings = new Settings(sketchProps); - settings.set("mode", nextMode.getTitle()); - settings.set("mode.id", nextMode.getIdentifier()); - settings.save(); - } catch (IOException e) { - System.err.println("While creating " + sketchProps + ": " + e.getMessage()); - } + saveModeSettings(new File(newbieDir, "sketch.properties"), nextMode); String path = newbieFile.getAbsolutePath(); /*Editor editor =*/ handleOpen(path, true); @@ -749,6 +758,18 @@ public class Base { } } + // Create or modify a sketch.proprties file to specify the given Mode. + private void saveModeSettings(final File sketchProps, final Mode mode) { + try { + final Settings settings = new Settings(sketchProps); + settings.set("mode", mode.getTitle()); + settings.set("mode.id", mode.getIdentifier()); + settings.save(); + } catch (IOException e) { + System.err.println("While creating " + sketchProps + ": " + e.getMessage()); + } + } + // /** // * Replace the sketch in the current window with a new untitled document. @@ -1053,13 +1074,16 @@ public class Base { return null; } - + enum LastEditorClosePolicy { + QUIT, DO_NOT_QUIT + } + /** * Close a sketch as specified by its editor window. * @param editor Editor object of the sketch to be closed. * @return true if succeeded in closing, false if canceled. */ - public boolean handleClose(Editor editor, boolean modeSwitch) { + public boolean handleClose(Editor editor, LastEditorClosePolicy closePolicy) { // Check if modified // boolean immediate = editors.size() == 1; if (!editor.checkModified()) { @@ -1116,7 +1140,7 @@ public class Base { Preferences.save(); if (defaultFileMenu == null) { - if (modeSwitch) { + if (closePolicy == LastEditorClosePolicy.DO_NOT_QUIT) { // need to close this editor, ever so temporarily editor.setVisible(false); editor.dispose(); diff --git a/app/src/processing/app/Editor.java b/app/src/processing/app/Editor.java index 5c6067b3f..b3124af3c 100644 --- a/app/src/processing/app/Editor.java +++ b/app/src/processing/app/Editor.java @@ -22,6 +22,7 @@ package processing.app; +import processing.app.Base.LastEditorClosePolicy; import processing.app.contrib.ToolContribution; import processing.app.syntax.*; import processing.app.tools.*; @@ -126,7 +127,7 @@ public abstract class Editor extends JFrame implements RunnerListener { // add listener to handle window close box hit event addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { - base.handleClose(Editor.this, false); + base.handleClose(Editor.this, LastEditorClosePolicy.QUIT); } }); // don't close the window when clicked, the app will take care @@ -601,7 +602,7 @@ public abstract class Editor extends JFrame implements RunnerListener { item = Toolkit.newJMenuItem("Close", 'W'); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - base.handleClose(Editor.this, false); + base.handleClose(Editor.this, LastEditorClosePolicy.QUIT); } }); fileMenu.add(item); diff --git a/app/src/processing/app/Sketch.java b/app/src/processing/app/Sketch.java index 20e96b56e..1f33fe8ee 100644 --- a/app/src/processing/app/Sketch.java +++ b/app/src/processing/app/Sketch.java @@ -23,6 +23,7 @@ package processing.app; +import processing.app.Base.LastEditorClosePolicy; import processing.core.*; import java.awt.*; @@ -569,7 +570,7 @@ public class Sketch { // make a new sketch, and i think this will rebuild the sketch menu //editor.handleNewUnchecked(); //editor.handleClose2(); - editor.base.handleClose(editor, false); + editor.base.handleClose(editor, LastEditorClosePolicy.QUIT); } else { // delete the file From 400fda8bb0965fe0e33cdbbd72662eb38681bc79 Mon Sep 17 00:00:00 2001 From: Ben Fry Date: Wed, 16 Apr 2014 15:40:33 -0400 Subject: [PATCH 16/29] fix for categorical missing values --- core/src/processing/data/Table.java | 11 ++++++++++- core/todo.txt | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/core/src/processing/data/Table.java b/core/src/processing/data/Table.java index 8dd7b73a6..d945f9d2c 100644 --- a/core/src/processing/data/Table.java +++ b/core/src/processing/data/Table.java @@ -2087,7 +2087,12 @@ public class Table { if (piece == null) { indexData[row] = missingCategory; } else { - indexData[row] = columnCategories[col].index(String.valueOf(piece)); + String peace = String.valueOf(piece); + if (peace.equals(missingString)) { // missingString might be null + indexData[row] = missingCategory; + } else { + indexData[row] = columnCategories[col].index(peace); + } } break; default: @@ -2933,6 +2938,9 @@ public class Table { } + /** + * Treat entries with this string as "missing". Also used for categorial. + */ public void setMissingString(String value) { missingString = value; } @@ -3562,6 +3570,7 @@ public class Table { read(input); } + /** gets the index, and creates one if it doesn't already exist. */ int index(String key) { Integer value = dataToIndex.get(key); if (value != null) { diff --git a/core/todo.txt b/core/todo.txt index 3172a887f..83928da74 100644 --- a/core/todo.txt +++ b/core/todo.txt @@ -1,4 +1,5 @@ 0226 core +X fix parsing with missing categorical values _ XML.getChildren() throwing NPE when getInt() called on non-existent var From 511f5a82081578e204386b9a5db0dfd36926d977 Mon Sep 17 00:00:00 2001 From: Ben Fry Date: Wed, 16 Apr 2014 19:09:30 -0400 Subject: [PATCH 17/29] update to u55 for OS X build, and disallow 1.8 --- build/build.xml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/build/build.xml b/build/build.xml index 095542697..2b3d91b8d 100755 --- a/build/build.xml +++ b/build/build.xml @@ -20,13 +20,12 @@ + Java 1.8 caused build problems (with ECJ?) so not supported. --> - @@ -152,7 +151,7 @@ - + From 2ede696737093cfa2c24bcc912c7d1195cfc832e Mon Sep 17 00:00:00 2001 From: Kyle Feuz Date: Wed, 16 Apr 2014 21:08:08 -0700 Subject: [PATCH 18/29] Fixed splice() ClassCastException issue 1445 --- core/src/processing/core/PApplet.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/core/src/processing/core/PApplet.java b/core/src/processing/core/PApplet.java index 8de399ccc..5a1e47ee9 100755 --- a/core/src/processing/core/PApplet.java +++ b/core/src/processing/core/PApplet.java @@ -8606,19 +8606,20 @@ public class PApplet extends Applet } static final public Object splice(Object list, Object value, int index) { - Object[] outgoing = null; + Class type = list.getClass().getComponentType(); + Object outgoing = null; int length = Array.getLength(list); // check whether item being spliced in is an array if (value.getClass().getName().charAt(0) == '[') { int vlength = Array.getLength(value); - outgoing = new Object[length + vlength]; + outgoing = Array.newInstance(type, length + vlength); System.arraycopy(list, 0, outgoing, 0, index); System.arraycopy(value, 0, outgoing, index, vlength); System.arraycopy(list, index, outgoing, index + vlength, length - index); } else { - outgoing = new Object[length + 1]; + outgoing = Array.newInstance(type, length + 1); System.arraycopy(list, 0, outgoing, 0, index); Array.set(outgoing, index, value); System.arraycopy(list, index, outgoing, index + 1, length - index); From 406f2c3ffa1ed052254156545ead1e0458468214 Mon Sep 17 00:00:00 2001 From: Jonathan Feinberg Date: Thu, 17 Apr 2014 13:14:04 -0400 Subject: [PATCH 19/29] Roll back introduction of enum for handleClose param. --- app/src/processing/app/Base.java | 14 ++++++-------- app/src/processing/app/Editor.java | 5 ++--- app/src/processing/app/Sketch.java | 3 +-- 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/app/src/processing/app/Base.java b/app/src/processing/app/Base.java index b19e6f340..6f018aaa8 100644 --- a/app/src/processing/app/Base.java +++ b/app/src/processing/app/Base.java @@ -623,13 +623,13 @@ public class Base { if (newModeCanHandleCurrentSource) { final File props = new File(sketch.getCodeFolder(), "sketch.properties"); saveModeSettings(props, nextMode); - handleClose(activeEditor, LastEditorClosePolicy.DO_NOT_QUIT); + handleClose(activeEditor, true); handleOpen(sketch.getMainFilePath()); } else { // If you're changing modes, and there's nothing in the current sketch, you probably // don't intend to keep the old, wrong-mode editor around. if (sketch.isUntitled()) { - handleClose(activeEditor, LastEditorClosePolicy.DO_NOT_QUIT); + handleClose(activeEditor, true); } handleNew(); } @@ -1074,16 +1074,14 @@ public class Base { return null; } - enum LastEditorClosePolicy { - QUIT, DO_NOT_QUIT - } - /** * Close a sketch as specified by its editor window. * @param editor Editor object of the sketch to be closed. + * @param modeSwitch Whether this close is being done in the context of a + * mode switch. * @return true if succeeded in closing, false if canceled. */ - public boolean handleClose(Editor editor, LastEditorClosePolicy closePolicy) { + public boolean handleClose(Editor editor, boolean modeSwitch) { // Check if modified // boolean immediate = editors.size() == 1; if (!editor.checkModified()) { @@ -1140,7 +1138,7 @@ public class Base { Preferences.save(); if (defaultFileMenu == null) { - if (closePolicy == LastEditorClosePolicy.DO_NOT_QUIT) { + if (modeSwitch) { // need to close this editor, ever so temporarily editor.setVisible(false); editor.dispose(); diff --git a/app/src/processing/app/Editor.java b/app/src/processing/app/Editor.java index b3124af3c..5c6067b3f 100644 --- a/app/src/processing/app/Editor.java +++ b/app/src/processing/app/Editor.java @@ -22,7 +22,6 @@ package processing.app; -import processing.app.Base.LastEditorClosePolicy; import processing.app.contrib.ToolContribution; import processing.app.syntax.*; import processing.app.tools.*; @@ -127,7 +126,7 @@ public abstract class Editor extends JFrame implements RunnerListener { // add listener to handle window close box hit event addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { - base.handleClose(Editor.this, LastEditorClosePolicy.QUIT); + base.handleClose(Editor.this, false); } }); // don't close the window when clicked, the app will take care @@ -602,7 +601,7 @@ public abstract class Editor extends JFrame implements RunnerListener { item = Toolkit.newJMenuItem("Close", 'W'); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - base.handleClose(Editor.this, LastEditorClosePolicy.QUIT); + base.handleClose(Editor.this, false); } }); fileMenu.add(item); diff --git a/app/src/processing/app/Sketch.java b/app/src/processing/app/Sketch.java index 1f33fe8ee..20e96b56e 100644 --- a/app/src/processing/app/Sketch.java +++ b/app/src/processing/app/Sketch.java @@ -23,7 +23,6 @@ package processing.app; -import processing.app.Base.LastEditorClosePolicy; import processing.core.*; import java.awt.*; @@ -570,7 +569,7 @@ public class Sketch { // make a new sketch, and i think this will rebuild the sketch menu //editor.handleNewUnchecked(); //editor.handleClose2(); - editor.base.handleClose(editor, LastEditorClosePolicy.QUIT); + editor.base.handleClose(editor, false); } else { // delete the file From 0b50a98219a691b73dfc85a580614ae4138d45cc Mon Sep 17 00:00:00 2001 From: Kyle Feuz Date: Fri, 18 Apr 2014 01:42:54 -0700 Subject: [PATCH 20/29] Implements disconnectEvent for the Server code as requested in Issue #2133 --- java/libraries/net/src/processing/net/Client.java | 11 +++++++++++ java/libraries/net/src/processing/net/Server.java | 6 +++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/java/libraries/net/src/processing/net/Client.java b/java/libraries/net/src/processing/net/Client.java index 18867e5dc..a93baa838 100644 --- a/java/libraries/net/src/processing/net/Client.java +++ b/java/libraries/net/src/processing/net/Client.java @@ -118,6 +118,7 @@ public class Client implements Runnable { * @throws IOException */ public Client(PApplet parent, Socket socket) throws IOException { + this.parent = parent; this.socket = socket; input = socket.getInputStream(); @@ -125,6 +126,16 @@ public class Client implements Runnable { thread = new Thread(this); thread.start(); + + // reflection to check whether host sketch has a call for + // public void disconnectEvent(processing.net.Client) + try { + disconnectEventMethod = + parent.getClass().getMethod("disconnectEvent", + new Class[] { Client.class }); + } catch (Exception e) { + // no such method, or an error.. which is fine, just ignore + } } diff --git a/java/libraries/net/src/processing/net/Server.java b/java/libraries/net/src/processing/net/Server.java index 12b73a71b..cdc81a386 100644 --- a/java/libraries/net/src/processing/net/Server.java +++ b/java/libraries/net/src/processing/net/Server.java @@ -109,7 +109,11 @@ public class Server implements Runnable { * @param client the client to disconnect */ public void disconnect(Client client) { - //client.stop(); + //Calling client.stop() here would cause duplicate + //calls to disconnectEvent in the containing sketch, + //once for the stop() and once for the terminated connection. + //Instead just dispose of the client and let the terminated + //connection generate the disconnectEvent message; client.dispose(); int index = clientIndex(client); if (index != -1) { From fd40dbfb314be31ccc6205ceb1ccf412554609c0 Mon Sep 17 00:00:00 2001 From: David Fokkema Date: Fri, 18 Apr 2014 21:11:05 +0200 Subject: [PATCH 21/29] Revert "Do not wait for debugger to start running sketch" This reverts commit 5d5a5841c820a26bbaa7ceb393d0e8ce1ca09ad4. --- app/src/processing/mode/java/runner/Runner.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/processing/mode/java/runner/Runner.java b/app/src/processing/mode/java/runner/Runner.java index 887266d6e..9bea617b5 100644 --- a/app/src/processing/mode/java/runner/Runner.java +++ b/app/src/processing/mode/java/runner/Runner.java @@ -133,7 +133,7 @@ public class Runner implements MessageConsumer { // String jdwpArg = "-Xrunjdwp:transport=dt_socket,address=" + portStr + ",server=y,suspend=y"; // String debugArg = "-Xdebug"; // Newer (Java 1.5+) version that uses JVMTI - String jdwpArg = "-agentlib:jdwp=transport=dt_socket,address=" + portStr + ",server=y,suspend=n"; + String jdwpArg = "-agentlib:jdwp=transport=dt_socket,address=" + portStr + ",server=y,suspend=y"; // Everyone works the same under Java 7 (also on OS X) String[] commandArgs = new String[] { Base.getJavaPath(), jdwpArg }; From fca59082a8068be5f627ee6c3878a2205da312c9 Mon Sep 17 00:00:00 2001 From: Kyle Feuz Date: Fri, 18 Apr 2014 15:48:14 -0700 Subject: [PATCH 22/29] Fixed missing disconnect for some clients --- java/libraries/net/src/processing/net/Client.java | 2 +- java/libraries/net/src/processing/net/Server.java | 11 +++-------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/java/libraries/net/src/processing/net/Client.java b/java/libraries/net/src/processing/net/Client.java index a93baa838..de39b6e9f 100644 --- a/java/libraries/net/src/processing/net/Client.java +++ b/java/libraries/net/src/processing/net/Client.java @@ -151,7 +151,7 @@ public class Client implements Runnable { * @usage application */ public void stop() { - if (disconnectEventMethod != null) { + if (disconnectEventMethod != null && thread != null){ try { disconnectEventMethod.invoke(parent, new Object[] { this }); } catch (Exception e) { diff --git a/java/libraries/net/src/processing/net/Server.java b/java/libraries/net/src/processing/net/Server.java index cdc81a386..bbf116917 100644 --- a/java/libraries/net/src/processing/net/Server.java +++ b/java/libraries/net/src/processing/net/Server.java @@ -109,12 +109,7 @@ public class Server implements Runnable { * @param client the client to disconnect */ public void disconnect(Client client) { - //Calling client.stop() here would cause duplicate - //calls to disconnectEvent in the containing sketch, - //once for the stop() and once for the terminated connection. - //Instead just dispose of the client and let the terminated - //connection generate the disconnectEvent message; - client.dispose(); + client.stop(); int index = clientIndex(client); if (index != -1) { removeIndex(index); @@ -220,8 +215,8 @@ public class Server implements Runnable { thread = null; if (clients != null) { - for (int i = 0; i < clientCount; i++) { - disconnect(clients[i]); + while(clientCount>0){ + disconnect(clients[0]); } clientCount = 0; clients = null; From c46c34c033955b022c7aa57590d7bda41e54c6be Mon Sep 17 00:00:00 2001 From: David Fokkema Date: Sat, 19 Apr 2014 10:09:10 +0200 Subject: [PATCH 23/29] Another 'fix': added a timeout before vm.resume() I think we have a race condition: vm.resume() is called *before* the VM is actually ready to resume. That is strange, since the debugger is attached, eventQueues are set up and ready... Still, waiting for a bit ensures that the VM actually resumes. This behavior was not present when Java 1.6 was still used. Is this a bug in Java 1.7? Or is it simply that the VM in 1.6 started up quickly enough to hide the race condition? I'll continue looking... --- app/src/processing/mode/java/runner/Runner.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/src/processing/mode/java/runner/Runner.java b/app/src/processing/mode/java/runner/Runner.java index 9bea617b5..dbee59be1 100644 --- a/app/src/processing/mode/java/runner/Runner.java +++ b/app/src/processing/mode/java/runner/Runner.java @@ -710,6 +710,12 @@ public class Runner implements MessageConsumer { errThread.start(); outThread.start(); + try { + Thread.sleep(1000); + } catch(InterruptedException ex) { + Thread.currentThread().interrupt(); + } + vm.resume(); // Shutdown begins when event thread terminates From e3090697e4e92586bb85b3bf32541b066773bea7 Mon Sep 17 00:00:00 2001 From: David Fokkema Date: Sat, 19 Apr 2014 10:36:00 +0200 Subject: [PATCH 24/29] Wait for VMStartEvent before resuming VM Fixes processing#2402 (Oh, yes!) --- app/src/processing/mode/java/runner/Runner.java | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/app/src/processing/mode/java/runner/Runner.java b/app/src/processing/mode/java/runner/Runner.java index dbee59be1..314e37f0d 100644 --- a/app/src/processing/mode/java/runner/Runner.java +++ b/app/src/processing/mode/java/runner/Runner.java @@ -678,7 +678,9 @@ public class Runner implements MessageConsumer { for (Event event : eventSet) { // System.out.println("EventThread.handleEvent -> " + event); - if (event instanceof ExceptionEvent) { + if (event instanceof VMStartEvent) { + vm.resume(); + } else if (event instanceof ExceptionEvent) { // for (ThreadReference thread : vm.allThreads()) { // System.out.println("thread : " + thread); //// thread.suspend(); @@ -710,14 +712,6 @@ public class Runner implements MessageConsumer { errThread.start(); outThread.start(); - try { - Thread.sleep(1000); - } catch(InterruptedException ex) { - Thread.currentThread().interrupt(); - } - - vm.resume(); - // Shutdown begins when event thread terminates try { if (eventThread != null) eventThread.join(); // is this the problem? From ad583897a19a1fc3eacb6801c706b11cbe8b2862 Mon Sep 17 00:00:00 2001 From: Ben Fry Date: Sat, 19 Apr 2014 04:45:06 -0400 Subject: [PATCH 25/29] other tweaks to server class --- .../net/src/processing/net/Server.java | 32 +++++++++++-------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/java/libraries/net/src/processing/net/Server.java b/java/libraries/net/src/processing/net/Server.java index bbf116917..b9d076fba 100644 --- a/java/libraries/net/src/processing/net/Server.java +++ b/java/libraries/net/src/processing/net/Server.java @@ -24,12 +24,14 @@ */ package processing.net; + import processing.core.*; import java.io.*; import java.lang.reflect.*; import java.net.*; + /** * ( begin auto-generated from Server.xml ) * @@ -128,6 +130,21 @@ public class Server implements Runnable { } + protected void disconnectAll() { + synchronized (clients) { + for (int i = 0; i < clientCount; i++) { + try { + clients[i].stop(); + } catch (Exception e) { + // ignore + } + clients[i] = null; + } + clientCount = 0; + } + } + + protected void addClient(Client client) { if (clientCount == clients.length) { clients = (Client[]) PApplet.expand(clients); @@ -215,9 +232,7 @@ public class Server implements Runnable { thread = null; if (clients != null) { - while(clientCount>0){ - disconnect(clients[0]); - } + disconnectAll(); clientCount = 0; clients = null; } @@ -310,15 +325,4 @@ public class Server implements Runnable { } } } - - - /** - * General error reporting, all corralled here just in case - * I think of something slightly more intelligent to do. - */ -// public void errorMessage(String where, Exception e) { -// parent.die("Error inside Server." + where + "()", e); -// //System.err.println("Error inside Server." + where + "()"); -// //e.printStackTrace(System.err); -// } } From 34a3ed18520661d89ea617bbce427ba5d85f1616 Mon Sep 17 00:00:00 2001 From: codeanticode Date: Tue, 22 Apr 2014 16:53:17 -0400 Subject: [PATCH 26/29] take care of #2465 --- core/src/processing/opengl/Texture.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/processing/opengl/Texture.java b/core/src/processing/opengl/Texture.java index f74da6a6e..db3c165e9 100644 --- a/core/src/processing/opengl/Texture.java +++ b/core/src/processing/opengl/Texture.java @@ -1267,7 +1267,7 @@ public class Texture implements PConstants { pg.setFramebuffer(tempFbo); // Clear the color buffer to make sure that the alpha channel is set to // full transparency - pgl.clearColor(1, 1, 1, 1); + pgl.clearColor(0, 0, 0, 0); pgl.clear(PGL.COLOR_BUFFER_BIT); if (scale) { // Rendering tex into "this", and scaling the source rectangle From e3ccd69ce62dca45b166a5997e4a073320a2d9e7 Mon Sep 17 00:00:00 2001 From: codeanticode Date: Fri, 25 Apr 2014 22:53:50 -0400 Subject: [PATCH 27/29] missing categories are correctly saved in binary --- core/src/processing/data/Table.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/core/src/processing/data/Table.java b/core/src/processing/data/Table.java index d945f9d2c..d98a9db51 100644 --- a/core/src/processing/data/Table.java +++ b/core/src/processing/data/Table.java @@ -1165,7 +1165,12 @@ public class Table { output.writeDouble(row.getDouble(col)); break; case CATEGORY: - output.writeInt(columnCategories[col].index(row.getString(col))); + String peace = row.getString(col); + if (peace.equals(missingString)) { + output.writeInt(missingCategory); + } else { + output.writeInt(columnCategories[col].index(peace)); + } break; } } @@ -4140,7 +4145,12 @@ public class Table { } break; case CATEGORY: - output.writeInt(columnCategories[col].index(pieces[col])); + String peace = pieces[col]; + if (peace.equals(missingString)) { + output.writeInt(missingCategory); + } else { + output.writeInt(columnCategories[col].index(peace)); + } break; } } From 776d1eb75cecaeaa3109899f5a9c4c3cda588ab6 Mon Sep 17 00:00:00 2001 From: AmnonOwed Date: Sun, 27 Apr 2014 01:51:53 +0200 Subject: [PATCH 28/29] Clarify fromAngle() input (in radians) --- core/src/processing/core/PVector.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/processing/core/PVector.java b/core/src/processing/core/PVector.java index 1d2bd4b8a..58f86da3d 100644 --- a/core/src/processing/core/PVector.java +++ b/core/src/processing/core/PVector.java @@ -322,7 +322,7 @@ public class PVector implements Serializable { * @webref pvector:method * @usage web_application * @brief Make a new 2D unit vector from an angle - * @param angle the angle + * @param angle the angle in radians * @return the new unit PVector */ static public PVector fromAngle(float angle) { From 7097691f8ff9fb9a760e918a0c79c72ef8ce68d0 Mon Sep 17 00:00:00 2001 From: codeanticode Date: Mon, 28 Apr 2014 00:02:43 -0400 Subject: [PATCH 29/29] testing non-blocking seek --- .../video/src/processing/video/Movie.java | 41 +++++++++++-------- 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/java/libraries/video/src/processing/video/Movie.java b/java/libraries/video/src/processing/video/Movie.java index 9707d3c61..93a74ab64 100644 --- a/java/libraries/video/src/processing/video/Movie.java +++ b/java/libraries/video/src/processing/video/Movie.java @@ -297,33 +297,38 @@ public class Movie extends PImage implements PConstants { * @brief Jumps to a specific location */ public void jump(float where) { - if (seeking) return; + if (seeking) return; // don't seek again until the current seek operation is done. if (!sinkReady) { initSink(); } // Round the time to a multiple of the source framerate, in - // order to eliminate stutter. Suggested by Daniel Shiffman + // order to eliminate stutter. Suggested by Daniel Shiffman float fps = getSourceFrameRate(); int frame = (int)(where * fps); - where = frame / fps; + final float seconds = frame / fps; + + // Put the seek operation inside a thread to avoid blocking the main + // animation thread + Thread seeker = new Thread() { + @Override + public void run() { + long pos = Video.secToNanoLong(seconds); + boolean res = playbin.seek(rate, Format.TIME, SeekFlags.FLUSH, + SeekType.SET, pos, SeekType.NONE, -1); + if (!res) { + PGraphics.showWarning("Seek operation failed."); + } - boolean res; - long pos = Video.secToNanoLong(where); - - res = playbin.seek(rate, Format.TIME, SeekFlags.FLUSH, - SeekType.SET, pos, SeekType.NONE, -1); - - if (!res) { - PGraphics.showWarning("Seek operation failed."); - } - - // getState() will wait until any async state change - // (like seek in this case) has completed - seeking = true; - playbin.getState(); - seeking = false; + // getState() will wait until any async state change + // (like seek in this case) has completed + seeking = true; + playbin.getState(); + seeking = false; + } + }; + seeker.start(); }