This commit is contained in:
Manindra Moharana
2014-09-12 01:24:36 +05:30
52 changed files with 1510 additions and 1233 deletions
+3 -1
View File
@@ -6,6 +6,8 @@ the “core” and the libraries that are included with the [download](http://pr
> Development of Processing 3 has started, so major changes are underway inside this repository. **If you need a stable version of the source, use the tag processing-0227-2.2.1.** Do not expect this code to be stable. Major changes include severe things like breaking libraries (due to chaining operations in PVector) or the removal of `Applet` as the base class for PApplet. Some of these will be sorted out before the release, others are simply being tested or are developments that are in-progress.
> Update 8 September 2014: java.awt.Applet is no longer the base class, which means lots of things may break (especially while we sort out the mess). You can use [the 3.0a3 tag](https://github.com/processing/processing/releases/tag/processing-0230-3.0a3) if you'd like the last “stable” alpha release.
If you have found a bug in the Processing software, you can file it here under the [“issues” tab](https://github.com/processing/processing/issues).
If it relates to the [JavaScript](http://processingjs.org) version, please use [their issue tracker](https://processing-js.lighthouseapp.com/).
All Android-related development has moved to its own repository [here](https://github.com/processing/processing-android),
@@ -31,4 +33,4 @@ But in the meantime, I ask for your patience,
and [patches](https://github.com/processing/processing/pulls).
Ben Fry, 3 February 2013
Last updated 30 July 2014
Last updated 8 September 2014
+43 -287
View File
@@ -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 = 230;
static private final int REVISION = 231;
/** This might be replaced by main() if there's a lib/version.txt file. */
static private String VERSION_NAME = "0230"; //$NON-NLS-1$
static private String VERSION_NAME = "0231"; //$NON-NLS-1$
/** Set true if this a proper release rather than a numbered revision. */
// static private boolean RELEASE = false;
@@ -121,8 +121,8 @@ public class Base {
*/
private Mode nextMode;
/** The built-in modes. coreModes[0] will be considered the 'default'. */
private Mode[] coreModes;
//public List<ModeContribution> contribModes;
protected ArrayList<ModeContribution> modeContribs;
protected ArrayList<ExamplesPackageContribution> exampleContribs;
@@ -278,44 +278,20 @@ public class Base {
private void buildCoreModes() {
// Mode javaMode =
// ModeContribution.getCoreMode(this, "processing.mode.java.JavaMode",
// getContentFile("modes/java"));
// Mode androidMode =
// ModeContribution.getCoreMode(this, "processing.mode.android.AndroidMode",
// getContentFile("modes/android"));
// Mode javaScriptMode =
// ModeContribution.getCoreMode(this, "processing.mode.javascript.JavaScriptMode",
// getContentFile("modes/javascript"));
Mode javaMode =
ModeContribution.load(this, getContentFile("modes/java"), //$NON-NLS-1$
"processing.mode.java.JavaMode").getMode(); //$NON-NLS-1$
// Mode androidMode =
// ModeContribution.load(this, getContentFile("modes/android"),
// "processing.mode.android.AndroidMode").getMode();
// Mode javaScriptMode =
// ModeContribution.load(this, getContentFile("modes/javascript"),
// "processing.mode.javascript.JavaScriptMode").getMode();
//coreModes = new Mode[] { javaMode, androidMode };
// PDE X calls getModeList() while it's loading, so coreModes must be set
coreModes = new Mode[] { javaMode };
// check for the new mode in case it's available
// try {
// Class.forName("processing.mode.java2.DebugMode");
ModeContribution experimentalContrib =
Mode pdexMode =
ModeContribution.load(this, getContentFile("modes/ExperimentalMode"), //$NON-NLS-1$
"processing.mode.experimental.ExperimentalMode"); //$NON-NLS-1$
if (experimentalContrib != null) {
Mode experimentalMode = experimentalContrib.getMode();
//coreModes = new Mode[] { javaMode, androidMode, experimentalMode };
coreModes = new Mode[] { experimentalMode, javaMode };
}
// } catch (ClassNotFoundException e) { }
"processing.mode.experimental.ExperimentalMode").getMode(); //$NON-NLS-1$
// for (Mode mode : coreModes) { // already called by load() above
// mode.setupGUI();
// }
// Safe to remove the old Java mode here?
//coreModes = new Mode[] { pdexMode };
coreModes = new Mode[] { pdexMode, javaMode };
}
@@ -380,10 +356,10 @@ public class Base {
// marked as an example.
recent = new Recent(this);
String lastModeIdentifier = Preferences.get("last.sketch.mode"); //$NON-NLS-1$
String lastModeIdentifier = Preferences.get("mode.last"); //$NON-NLS-1$
if (lastModeIdentifier == null) {
nextMode = coreModes[0];
log("Nothing set for last.sketch.mode, using coreMode[0]."); //$NON-NLS-1$
nextMode = getDefaultMode();
log("Nothing set for last.sketch.mode, using default."); //$NON-NLS-1$
} else {
for (Mode m : getModeList()) {
if (m.getIdentifier().equals(lastModeIdentifier)) {
@@ -392,7 +368,7 @@ public class Base {
}
}
if (nextMode == null) {
nextMode = coreModes[0];
nextMode = getDefaultMode();
logf("Could not find mode %s, using default.", lastModeIdentifier); //$NON-NLS-1$
}
}
@@ -456,160 +432,6 @@ public class Base {
}
/**
* Single location for the default extension, rather than hardwiring .pde
* all over the place. While it may seem like fun to send the Arduino guys
* on a treasure hunt, it gets old after a while.
*/
// static protected String getExtension() {
// return ".pde";
// }
// public Mode getDefaultMode() {
// return defaultMode;
// }
// /**
// * Post-constructor setup for the editor area. Loads the last
// * sketch that was used (if any), and restores other Editor settings.
// * The complement to "storePreferences", this is called when the
// * application is first launched.
// */
// protected boolean restoreSketches() {
//// String lastMode = Preferences.get("last.sketch.mode");
//// log("setting mode to " + lastMode);
//// if (lastMode != null) {
//// for (Mode m : getModeList()) {
//// if (m.getClass().getName().equals(lastMode)) {
//// defaultMode = m;
//// }
//// }
//// }
//// log("default mode set to " + defaultMode.getClass().getName());
//
// if (Preferences.getBoolean("last.sketch.restore")) {
// return false;
// }
//
// return true;
//
//// // figure out window placement
//// Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
//// boolean windowPositionValid = true;
////
//// if (Preferences.get("last.screen.height") != null) {
//// // if screen size has changed, the window coordinates no longer
//// // make sense, so don't use them unless they're identical
//// int screenW = Preferences.getInteger("last.screen.width");
//// int screenH = Preferences.getInteger("last.screen.height");
////
//// if ((screen.width != screenW) || (screen.height != screenH)) {
//// windowPositionValid = false;
//// }
//// /*
//// int windowX = Preferences.getInteger("last.window.x");
//// int windowY = Preferences.getInteger("last.window.y");
//// if ((windowX < 0) || (windowY < 0) ||
//// (windowX > screenW) || (windowY > screenH)) {
//// windowPositionValid = false;
//// }
//// */
//// } else {
//// windowPositionValid = false;
//// }
////
//// // Iterate through all sketches that were open last time p5 was running.
//// // If !windowPositionValid, then ignore the coordinates found for each.
////
//// // Save the sketch path and window placement for each open sketch
//// int count = Preferences.getInteger("last.sketch.count");
//// int opened = 0;
//// for (int i = 0; i < count; i++) {
//// String path = Preferences.get("last.sketch" + i + ".path");
//// int[] location;
//// if (windowPositionValid) {
//// String locationStr = Preferences.get("last.sketch" + i + ".location");
//// location = PApplet.parseInt(PApplet.split(locationStr, ','));
//// } else {
//// location = nextEditorLocation();
//// }
//// // If file did not exist, null will be returned for the Editor
//// if (handleOpen(path, location) != null) {
//// opened++;
//// }
//// }
//// return (opened > 0);
// }
// /**
// * Store list of sketches that are currently open.
// * Called when the application is quitting and documents are still open.
// */
// protected void storeSketches() {
// // Save the width and height of the screen
// Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
// Preferences.setInteger("last.screen.width", screen.width);
// Preferences.setInteger("last.screen.height", screen.height);
//
// String untitledPath = untitledFolder.getAbsolutePath();
//
// // Save the sketch path and window placement for each open sketch
// int index = 0;
// for (Editor editor : editors) {
// String path = editor.getSketch().getMainFilePath();
// // In case of a crash, save untitled sketches if they contain changes.
// // (Added this for release 0158, may not be a good idea.)
// if (path.startsWith(untitledPath) &&
// !editor.getSketch().isModified()) {
// continue;
// }
// Preferences.set("last.sketch" + index + ".path", path);
//
// int[] location = editor.getPlacement();
// String locationStr = PApplet.join(PApplet.str(location), ",");
// Preferences.set("last.sketch" + index + ".location", locationStr);
// index++;
// }
// Preferences.setInteger("last.sketch.count", index);
// Preferences.set("last.sketch.mode", defaultMode.getClass().getName());
// }
//
//
// // If a sketch is untitled on quit, may need to store the new name
// // rather than the location from the temp folder.
// protected void storeSketchPath(Editor editor, int index) {
// String path = editor.getSketch().getMainFilePath();
// String untitledPath = untitledFolder.getAbsolutePath();
// if (path.startsWith(untitledPath)) {
// path = "";
// }
// Preferences.set("last.sketch" + index + ".path", path);
// }
/*
public void storeSketch(Editor editor) {
int index = -1;
for (int i = 0; i < editorCount; i++) {
if (editors[i] == editor) {
index = i;
break;
}
}
if (index == -1) {
System.err.println("Problem storing sketch " + editor.sketch.name);
} else {
String path = editor.sketch.getMainFilePath();
Preferences.set("last.sketch" + index + ".path", path);
}
}
*/
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
@@ -695,7 +517,7 @@ public class Base {
// make this the next mode to be loaded
nextMode = whichEditor.getMode();
Preferences.set("last.sketch.mode", nextMode.getIdentifier()); //$NON-NLS-1$
Preferences.set("mode.last", nextMode.getIdentifier()); //$NON-NLS-1$
}
@@ -774,8 +596,8 @@ public class Base {
throw new IOException(newbieFile + " already exists.");
}
// Create sketch properties file if it's not a default mode.
if (!isDefaultMode(nextMode)) {
// Create sketch properties file if it's not the default mode.
if (!nextMode.equals(getDefaultMode())) {
saveModeSettings(new File(newbieDir, "sketch.properties"), nextMode);
}
@@ -801,71 +623,16 @@ public class Base {
}
}
/**
* Is it a default mode?
* @param mode
* @return
*/
public boolean isDefaultMode(Mode mode) {
for (int i = 0; i < coreModes.length; i++) {
if (mode.equals(coreModes[i])) {
return true;
}
}
return false;
public Mode getDefaultMode() {
return coreModes[0];
}
/** Used by ThinkDifferent so that it can have a Sketchbook menu. */
public Mode getNextMode() {
return nextMode;
}
// /**
// * Replace the sketch in the current window with a new untitled document.
// */
// public void handleNewReplace() {
// if (!activeEditor.checkModified()) {
// return; // sketch was modified, and user canceled
// }
// // Close the running window, avoid window boogers with multiple sketches
// activeEditor.internalCloseRunner();
//
// // Actually replace things
// handleNewReplaceImpl();
// }
// protected void handleNewReplaceImpl() {
// try {
// String path = createNewUntitled();
// if (path != null) {
// activeEditor.handleOpenInternal(path);
// activeEditor.untitled = true;
// }
//// return true;
//
// } catch (IOException e) {
// activeEditor.statusError(e);
//// return false;
// }
// }
// /**
// * Open a sketch, replacing the sketch in the current window.
// * @param path Location of the primary pde file for the sketch.
// */
// public void handleOpenReplace(String path) {
// if (!activeEditor.checkModified()) {
// return; // sketch was modified, and user canceled
// }
// // Close the running window, avoid window boogers with multiple sketches
// activeEditor.internalCloseRunner();
//
// boolean loaded = activeEditor.handleOpenInternal(path);
// if (!loaded) {
// // replace the document without checking if that's ok
// handleNewReplaceImpl();
// } else {
// handleRecent(activeEditor);
// }
// }
/**
@@ -1007,14 +774,15 @@ public class Base {
if (editor == null) {
// if it's not mode[0] already, then don't go into an infinite loop
// trying to recreate a window with the default mode.
if (nextMode == coreModes[0]) {
Mode defaultMode = getDefaultMode();
if (nextMode == defaultMode) {
Base.showError("Editor Problems",
"An error occurred while trying to change modes.\n" +
"We'll have to quit for now because it's an\n" +
"unfortunate bit of indigestion.",
null);
"We'll have to quit for now because it's an\n" +
"unfortunate bit of indigestion.",
null);
} else {
editor = coreModes[0].createEditor(this, path, state);
editor = defaultMode.createEditor(this, path, state);
}
}
@@ -1038,7 +806,7 @@ public class Base {
showBadnessTrace("Terrible News",
"A serious error occurred while " +
"trying to create a new editor window.", t, false);
nextMode = coreModes[0];
nextMode = getDefaultMode();
return null;
}
}
@@ -1214,12 +982,10 @@ public class Base {
// Since this wasn't an actual Quit event, call System.exit()
System.exit(0);
}
} else {
} else { // on OS X, update the default file menu
editor.setVisible(false);
editor.dispose();
defaultFileMenu.insert(sketchbookMenu, 2);
defaultFileMenu.insert(getRecentMenu(), 3);
// defaultFileMenu.insert(defaultMode.getExamplesMenu(), 3);
defaultFileMenu.insert(getRecentMenu(), 2);
activeEditor = null;
editors.remove(editor);
}
@@ -1229,16 +995,6 @@ public class Base {
// proceed with closing the current window.
editor.setVisible(false);
editor.dispose();
// for (int i = 0; i < editorCount; i++) {
// if (editor == editors[i]) {
// for (int j = i; j < editorCount-1; j++) {
// editors[j] = editors[j+1];
// }
// editorCount--;
// // Set to null so that garbage collection occurs
// editors[editorCount] = null;
// }
// }
editors.remove(editor);
}
return true;
@@ -1370,13 +1126,13 @@ public class Base {
}
public JMenu getSketchbookMenu() {
if (sketchbookMenu == null) {
sketchbookMenu = new JMenu(Language.text("menu.file.sketchbook"));
rebuildSketchbookMenu();
}
return sketchbookMenu;
}
// public JMenu getSketchbookMenu() {
// if (sketchbookMenu == null) {
// sketchbookMenu = new JMenu(Language.text("menu.file.sketchbook"));
// rebuildSketchbookMenu();
// }
// return sketchbookMenu;
// }
// public JMenu getRecentMenu() {
@@ -2381,7 +2137,7 @@ public class Base {
// on macosx, setting the destructive property places this option
// away from the others at the lefthand side
pane.putClientProperty("Quaqua.OptionPane.destructiveOption",
new Integer(2));
Integer.valueOf(2));
JDialog dialog = pane.createDialog(editor, null);
dialog.setVisible(true);
+2 -2
View File
@@ -639,7 +639,7 @@ public class ColorChooser { //extends JFrame implements DocumentListener {
/**
* Extension of JTextField that only allows numbers
*/
class NumberField extends JTextField {
static class NumberField extends JTextField {
public boolean allowHex;
@@ -672,7 +672,7 @@ public class ColorChooser { //extends JFrame implements DocumentListener {
/**
* Document model to go with JTextField that only allows numbers.
*/
class NumberDocument extends PlainDocument {
static class NumberDocument extends PlainDocument {
NumberField parentField;
+23 -35
View File
@@ -549,28 +549,15 @@ public abstract class Editor extends JFrame implements RunnerListener {
menubar.add(fileMenu);
menubar.add(buildEditMenu());
menubar.add(buildSketchMenu());
// rebuildToolList();
rebuildToolMenu();
menubar.add(getToolMenu());
// For 3.0a4 move mode menu to the left of the Tool menu
JMenu modeMenu = buildModeMenu();
if (modeMenu != null) {
menubar.add(modeMenu);
}
// // These are temporary entries while Android mode is being worked out.
// // The mode will not be in the tools menu, and won't involve a cmd-key
// if (!Base.RELEASE) {
// try {
// Class clazz = Class.forName("processing.app.tools.android.AndroidMode");
// Object mode = clazz.newInstance();
// Method m = clazz.getMethod("init", new Class[] { Editor.class, JMenuBar.class });
// //String libraryPath = (String) m.invoke(null, new Object[] { });
// m.invoke(mode, new Object[] { this, menubar });
// } catch (Exception e) {
// e.printStackTrace();
// }
// }
rebuildToolMenu();
menubar.add(getToolMenu());
menubar.add(buildHelpMenu());
setJMenuBar(menubar);
@@ -2372,7 +2359,8 @@ public abstract class Editor extends JFrame implements RunnerListener {
Base.showWarning("Error", "Could not create the sketch.", e);
return false;
}
if (Preferences.getBoolean("editor.watcher")) {
// Disabling for 3.0a4
if (false && Preferences.getBoolean("editor.watcher")) {
initFileChangeListener();
}
@@ -2410,12 +2398,11 @@ public abstract class Editor extends JFrame implements RunnerListener {
private void initFileChangeListener() {
try {
WatchService watchService = FileSystems.getDefault().newWatchService();
watcherKey = sketch
.getFolder()
.toPath()
.register(watchService, StandardWatchEventKinds.ENTRY_CREATE,
StandardWatchEventKinds.ENTRY_DELETE,
StandardWatchEventKinds.ENTRY_MODIFY);
Path sp = sketch.getFolder().toPath();
watcherKey = sp.register(watchService,
StandardWatchEventKinds.ENTRY_CREATE,
StandardWatchEventKinds.ENTRY_DELETE,
StandardWatchEventKinds.ENTRY_MODIFY);
} catch (IOException e) {
e.printStackTrace();
}
@@ -2437,7 +2424,9 @@ public abstract class Editor extends JFrame implements RunnerListener {
//if the directory was deleted, then don't scan
if (finKey.isValid()) {
List<WatchEvent<?>> events = finKey.pollEvents();
processFileEvents(events);
if (!watcherSave) {
processFileEvents(events);
}
}
List<WatchEvent<?>> events = finKey.pollEvents();
@@ -2471,8 +2460,9 @@ public abstract class Editor extends JFrame implements RunnerListener {
for (WatchEvent<?> e : events) {
boolean sketchFile = false;
Path file = ((Path) e.context()).getFileName();
System.out.println(file);
for (String s : getMode().getExtensions()) {
//if it is a change to a file with a known extension
// if it is a change to a file with a known extension
if (file.toString().endsWith(s)) {
sketchFile = true;
break;
@@ -2483,11 +2473,11 @@ public abstract class Editor extends JFrame implements RunnerListener {
continue;
}
int response = Base
.showYesNoQuestion(Editor.this,
"File Modified",
"Your sketch has been modified externally",
"Would you like to reload the sketch?");
int response =
Base.showYesNoQuestion(Editor.this,
"File Modified",
"Your sketch has been modified externally",
"Would you like to reload the sketch?");
if (response == 0) {
//grab the 'main' code in case this reload tries to delete everything
File sc = sketch.getMainFile();
@@ -2497,17 +2487,15 @@ public abstract class Editor extends JFrame implements RunnerListener {
header.rebuild();
} catch (Exception f) {
if (sketch.getCodeCount() < 1) {
Base
.showWarning("Canceling Reload",
"You cannot delete the last code file in a sketch!");
Base.showWarning("Canceling Reload",
"You cannot delete the last code file in a sketch.");
//if they deleted the last file, re-save the SketchCode
try {
//make a blank file
sc.createNewFile();
} catch (IOException e1) {
//if that didn't work, tell them it's un-recoverable
Base.showError("Reload failed",
"The sketch contians no code files", e1);
Base.showError("Reload failed", "The sketch contains no code files", e1);
//don't try to reload again after the double fail
//this editor is probably trashed by this point, but a save-as might be possible
break;
+1 -1
View File
@@ -626,7 +626,7 @@ public class EditorHeader extends JComponent {
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
class Tab implements Comparable {
static class Tab implements Comparable {
int index;
int left;
int right;
+3 -1
View File
@@ -87,6 +87,7 @@ public class Language {
static private String[] listSupported() {
// List of languages in alphabetical order. (Add yours here.)
// Also remember to add it to the corresponding build/build.xml rule.
final String[] SUPPORTED = {
"de", // German, Deutsch
"en", // English
@@ -147,6 +148,7 @@ public class Language {
} catch (Exception e) {
e.printStackTrace();
}
Base.getPlatform().saveLanguage(language);
}
@@ -221,7 +223,7 @@ public class Language {
* Custom 'Control' class for consistent encoding.
* http://stackoverflow.com/questions/4659929/how-to-use-utf-8-in-resource-properties-with-resourcebundle
*/
class UTF8Control extends ResourceBundle.Control {
static class UTF8Control extends ResourceBundle.Control {
public ResourceBundle newBundle(String baseName, Locale locale, String format, ClassLoader loader, boolean reload) throws IllegalAccessException, InstantiationException,IOException {
// The below is a copy of the default implementation.
String bundleName = toBundleName(baseName, locale);
+2 -1
View File
@@ -74,6 +74,7 @@ public class Platform {
}
}
public void saveLanguage(String languageCode) {}
public void init(Base base) {
this.base = base;
@@ -216,4 +217,4 @@ public class Platform {
null);
}
*/
}
}
+8 -3
View File
@@ -45,7 +45,7 @@ import processing.core.*;
* sounds like a lot of work. Not unlike writing this paragraph.
*/
public class Preferences {
// had to rename this file because people were editing it
// had to rename the defaults file because people were editing it
static final String DEFAULTS_FILE = "defaults.txt"; //$NON-NLS-1$
static final String PREFS_FILE = "preferences.txt"; //$NON-NLS-1$
@@ -151,6 +151,11 @@ public class Preferences {
}
}
static protected String getPreferencesPath() {
return preferencesFile.getAbsolutePath();
}
// .................................................................
@@ -232,7 +237,7 @@ public class Preferences {
static public boolean getBoolean(String attribute) {
String value = get(attribute); //, null);
return (new Boolean(value)).booleanValue();
return Boolean.parseBoolean(value);
/*
supposedly not needed, because anything besides 'true'
@@ -382,4 +387,4 @@ public class Preferences {
static protected void setSketchbookPath(String path) {
set("sketchbook.path.three", path); //$NON-NLS-1$
}
}
}
+4 -4
View File
@@ -526,7 +526,7 @@ public class PreferencesFrame {
right = Math.max(right, left + d.width);
top += d.height; // + GUI_SMALL;
label = new JLabel(Preferences.getSketchbookPath());
label = new JLabel(Preferences.getPreferencesPath());
final JLabel clickable = label;
label.addMouseListener(new MouseAdapter() {
public void mousePressed(MouseEvent e) {
@@ -800,11 +800,11 @@ public class PreferencesFrame {
}
// This takes a while to load, so run it from a separate thread
new Thread(new Runnable() {
EventQueue.invokeLater(new Runnable() {
public void run() {
initFontList();
}
}).start();
});
fontSizeField.setSelectedItem(Preferences.getInteger("editor.font.size"));
consoleSizeField.setSelectedItem(Preferences.getInteger("console.font.size"));
@@ -832,7 +832,7 @@ public class PreferencesFrame {
* most basic usage scenarios. Is there someone on the team I can contact?
* Oracle, are you listening?
*/
class FontNamer extends JLabel implements ListCellRenderer<Font> {
static class FontNamer extends JLabel implements ListCellRenderer<Font> {
public Component getListCellRendererComponent(JList<? extends Font> list,
Font value, int index,
boolean isSelected,
+2 -2
View File
@@ -310,7 +310,7 @@ public class Recent {
// }
class Record {
static class Record {
String path; // if not loaded, this is non-null
// EditorState state; // if not loaded, this is non-null
@@ -376,4 +376,4 @@ public class Recent {
// return getPath().equals(r.getPath());
// }
}
}
}
+1 -22
View File
@@ -3,6 +3,7 @@
/*
Part of the Processing project - http://processing.org
Copyright (c) 2012-14 The Processing Foundation
Copyright (c) 2011-12 Ben Fry and Casey Reas
This program is free software; you can redistribute it and/or modify
@@ -54,7 +55,6 @@ public class SingleInstance {
*/
static boolean alreadyRunning(String[] args) {
return Preferences.get(SERVER_PORT) != null && sendArguments(args);
// sendArguments(args, 5000));
}
@@ -125,25 +125,9 @@ public class SingleInstance {
static boolean sendArguments(String[] args) { //, long timeout) {
try {
//int port = Integer.parseInt(Preferences.get("server.port"));
//String key = Preferences.get("server.key");
int port = Preferences.getInteger(SERVER_PORT);
String key = Preferences.get(SERVER_KEY);
// long endTime = System.currentTimeMillis() + timeout;
//
// Socket socket = null;
// while (socket == null && System.currentTimeMillis() < endTime) {
// try {
// socket = new Socket(InetAddress.getByName(null), port);
// } catch (Exception ioe) {
// try {
// Thread.sleep(50);
// } catch (InterruptedException ie) {
// Thread.yield();
// }
// }
// }
Socket socket = null;
try {
socket = new Socket(InetAddress.getByName(null), port);
@@ -151,15 +135,10 @@ public class SingleInstance {
if (socket != null) {
PrintWriter writer = PApplet.createWriter(socket.getOutputStream());
// bw.write(key + "\n");
writer.println(key);
for (String arg : args) {
// if (filename != null) {
//// bw.write(filename + "\n");
// writer.println(filename);
writer.println(arg);
}
// bw.close();
writer.flush();
writer.close();
return true;
+4
View File
@@ -465,6 +465,10 @@ public class Toolkit {
static private Font createFont(String filename, int size) throws IOException, FontFormatException {
//InputStream is = Base.getLibStream("fonts/" + filename);
File fontFile = new File(System.getProperty("java.home"), "lib/fonts/" + filename);
if (!fontFile.exists()) {
// if we're debugging from Eclipse, grab it from the work folder (user.dir is /app)
fontFile = new File(System.getProperty("user.dir"), "../build/shared/lib/fonts/" + filename);
}
BufferedInputStream input = new BufferedInputStream(new FileInputStream(fontFile));
Font font = Font.createFont(Font.TRUETYPE_FONT, input);
input.close();
@@ -1,4 +1,4 @@
/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
/*
Part of the Processing project - http://processing.org
@@ -49,18 +49,31 @@ class AvailableContribution extends Contribution {
url = params.get("url");
sentence = params.get("sentence");
paragraph = params.get("paragraph");
String versionStr = params.get("version");
if (versionStr != null) {
version = PApplet.parseInt(versionStr, 0);
}
prettyVersion = params.get("prettyVersion");
String lastUpdatedStr = params.get("lastUpdated");
if (lastUpdatedStr != null)
if (lastUpdatedStr != null) {
try {
lastUpdated = Long.parseLong(lastUpdatedStr);
} catch (NumberFormatException e) {
lastUpdated = 0;
}
}
String minRev = params.get("minRevision");
if (minRev != null) {
minRevision = PApplet.parseInt(minRev, 0);
}
String maxRev = params.get("maxRevision");
if (maxRev != null) {
maxRevision = PApplet.parseInt(maxRev, 0);
}
}
@@ -115,9 +128,9 @@ class AvailableContribution extends Contribution {
tempFolder.renameTo(contribFolder);
tempFolder = enclosingFolder;
*/
if (status != null)
if (status != null) {
status.setErrorMessage(Language.interpolate("contrib.errors.needs_repackage", getName(), type.getTitle()));
//status.setErrorMessage("This " + type + " needs to be repackaged according to the guidelines.");
}
return null;
}
@@ -128,15 +141,15 @@ class AvailableContribution extends Contribution {
LocalContribution installedContrib = null;
if (contribFolder == null) {
if (status != null)
if (status != null) {
status.setErrorMessage(Language.interpolate("contrib.errors.no_contribution_found", type));
}
} else {
File propFile = new File(contribFolder, type + ".properties");
if (writePropertiesFile(propFile)) {
// 1. contribFolder now has a legit contribution, load it to get info.
LocalContribution newContrib =
type.load(base, contribFolder);
LocalContribution newContrib = type.load(base, contribFolder);
// 1.1. get info we need to delete the newContrib folder later
File newContribFolder = newContrib.getFolder();
@@ -180,8 +193,9 @@ class AvailableContribution extends Contribution {
Base.removeDir(newContribFolder);
} else {
if (status != null)
if (status != null) {
status.setErrorMessage(Language.text("contrib.errors.overwriting_properties"));
}
}
}
@@ -217,7 +231,6 @@ class AvailableContribution extends Contribution {
*/
public boolean writePropertiesFile(File propFile) {
try {
HashMap<String, String> properties = Base.readSettings(propFile);
String name = properties.get("name");
@@ -226,9 +239,9 @@ class AvailableContribution extends Contribution {
String category;
List<String> categoryList = parseCategories(properties.get("category"));
if (categoryList.size() == 1 && categoryList.get(0).equals("Unknown"))
if (categoryList.size() == 1 && categoryList.get(0).equals("Unknown")) {
category = getCategoryStr();
else {
} else {
StringBuilder sb = new StringBuilder();
for (String cat : categories) {
sb.append(cat);
@@ -239,20 +252,24 @@ class AvailableContribution extends Contribution {
}
String authorList = properties.get("authorList");
if (authorList == null || authorList.isEmpty())
if (authorList == null || authorList.isEmpty()) {
authorList = getAuthorList();
}
String url = properties.get("url");
if (url == null || url.isEmpty())
if (url == null || url.isEmpty()) {
url = getUrl();
}
String sentence = properties.get("sentence");
if (sentence == null || sentence.isEmpty())
if (sentence == null || sentence.isEmpty()) {
sentence = getSentence();
}
String paragraph = properties.get("paragraph");
if (paragraph == null || paragraph.isEmpty())
if (paragraph == null || paragraph.isEmpty()) {
paragraph = getParagraph();
}
int version;
try {
@@ -272,14 +289,13 @@ class AvailableContribution extends Contribution {
String compatibleContribsList = null;
if (getType() == ContributionType.EXAMPLES_PACKAGE) {
compatibleContribsList = properties.get("compatibleModesList");
compatibleContribsList = properties.get("compatibleModesList");
}
long lastUpdated;
try {
lastUpdated = Long.parseLong(properties.get("lastUpdated"));
}
catch (NumberFormatException nfe) {
} catch (NumberFormatException nfe) {
lastUpdated = getLastUpdated();
// Better comment these out till all contribs have a lastUpdated
// System.err.println("The last updated date for the “" + name
@@ -288,6 +304,24 @@ class AvailableContribution extends Contribution {
// .println("Please contact the author to fix it according to the guidelines.");
}
int minRev;
try {
minRev = Integer.parseInt(properties.get("minRevision"));
} catch (NumberFormatException e) {
minRev = getMinRevision();
System.err.println("The minimum compatible revision for the “" + name
+ "” contribution is not set properly. Assuming minimum revision 0.");
}
int maxRev;
try {
maxRev = Integer.parseInt(properties.get("maxRevision"));
} catch (NumberFormatException e) {
maxRev = getMaxRevision();
System.err.println("The maximum compatible revision for the “" + name
+ "” contribution is not set properly. Assuming maximum revision INF.");
}
if (propFile.delete() && propFile.createNewFile() && propFile.setWritable(true)) {
PrintWriter writer = PApplet.createWriter(propFile);
@@ -300,6 +334,8 @@ class AvailableContribution extends Contribution {
writer.println("version=" + version);
writer.println("prettyVersion=" + prettyVersion);
writer.println("lastUpdated=" + lastUpdated);
writer.println("minRevision=" + minRev);
writer.println("maxRevision=" + maxRev);
if (getType() == ContributionType.EXAMPLES_PACKAGE) {
writer.println("compatibleModesList=" + compatibleContribsList);
}
@@ -25,7 +25,6 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import processing.app.Language;
import processing.core.PApplet;
@@ -46,6 +45,8 @@ abstract public class Contribution {
protected int version; // 102
protected String prettyVersion; // "1.0.2"
protected long lastUpdated; // 1402805757
protected int minRevision; // 0
protected int maxRevision; // 227
// "Sound"
@@ -129,6 +130,21 @@ abstract public class Contribution {
return lastUpdated;
}
// 0
public int getMinRevision() {
return minRevision;
}
// 227
public int getMaxRevision() {
return maxRevision;
}
public boolean isCompatible(int versionNum) {
return ((maxRevision == 0 || versionNum < maxRevision) && versionNum > minRevision);
}
abstract public ContributionType getType();
@@ -173,9 +189,12 @@ abstract public class Contribution {
* @return
*/
boolean isSpecial() {
if (authorList.indexOf("The Processing Foundation") != -1 || categories.contains(SPECIAL_CATEGORY_NAME))
return true;
return false;
try {
return (authorList.indexOf("The Processing Foundation") != -1 ||
categories.contains(SPECIAL_CATEGORY_NAME));
} catch (NullPointerException npe) {
return false;
}
}
@@ -34,7 +34,7 @@ import processing.core.PApplet;
public class ContributionListing {
// Stable URL that will redirect to wherever we're hosting the file
static final String LISTING_URL =
"http://download.processing.org/contributions.txt";
"http://download.processing.org/contribs.txt";
static volatile ContributionListing singleInstance;
@@ -308,6 +308,24 @@ public class ContributionListing {
}
protected List<Contribution> getCompatibleContributionList(List<Contribution> filteredLibraries, boolean filter) {
ArrayList<Contribution> filteredList =
new ArrayList<Contribution>(filteredLibraries);
if (!filter)
return filteredList;
Iterator<Contribution> it = filteredList.iterator();
while (it.hasNext()) {
Contribution libInfo = it.next();
if (!libInfo.isCompatible(Base.getRevision())) {
it.remove();
}
}
return filteredList;
}
private void notifyRemove(Contribution contribution) {
for (ContributionChangeListener listener : listeners) {
listener.contributionRemoved(contribution);
@@ -57,6 +57,8 @@ public class ContributionManagerDialog {
// the calling editor, so updates can be applied
Editor editor;
String category;
String compatibleContribType;
boolean isCompatibilityFilter;
ContributionListing contribListing;
@@ -64,6 +66,7 @@ public class ContributionManagerDialog {
if (type == null) {
title = Language.text("contrib.manager_title.update");
filter = ContributionType.createUpdateFilter();
compatibleContribType = "Updates";
} else {
if (type == ContributionType.MODE)
title = Language.text("contrib.manager_title.mode");
@@ -73,6 +76,11 @@ public class ContributionManagerDialog {
title = Language.text("contrib.manager_title.library");
filter = type.createFilter();
if (type == ContributionType.LIBRARY)
compatibleContribType = "Libraries";
else
compatibleContribType = type.getTitle() + "s";
}
contribListing = ContributionListing.getInstance();
contributionListPanel = new ContributionListPanel(this, filter);
@@ -217,7 +225,7 @@ public class ContributionManagerDialog {
if (ContributionManagerDialog.ANY_CATEGORY.equals(category)) {
category = null;
}
filterLibraries(category, filterField.filters);
filterLibraries(category, filterField.filters, isCompatibilityFilter);
contributionListPanel.updateColors();
}
});
@@ -226,6 +234,20 @@ public class ContributionManagerDialog {
// filterPanel.add(Box.createHorizontalGlue());
filterField = new FilterField();
filterPanel.add(filterField);
filterPanel.add(Box.createHorizontalStrut(5));
final JCheckBox compatibleContrib = new JCheckBox("Show Only Compatible " + compatibleContribType);
compatibleContrib.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent arg0) {
isCompatibilityFilter = compatibleContrib.isSelected();
filterLibraries(category, filterField.filters, isCompatibilityFilter);
contributionListPanel.updateColors();
}
});
filterPanel.add(compatibleContrib);
// filterPanel.add(Box.createHorizontalGlue());
// }
//filterPanel.setBorder(new EmptyBorder(13, 13, 13, 13));
@@ -387,6 +409,14 @@ public class ContributionManagerDialog {
contributionListPanel.filterLibraries(filteredLibraries);
}
protected void filterLibraries(String category, List<String> filters, boolean isCompatibilityFilter) {
List<Contribution> filteredLibraries =
contribListing.getFilteredLibraryList(category, filters);
filteredLibraries = contribListing.getCompatibleContributionList(filteredLibraries, isCompatibilityFilter);
contributionListPanel.filterLibraries(filteredLibraries);
}
protected void updateContributionListing() {
if (editor != null) {
@@ -523,7 +553,7 @@ public class ContributionManagerDialog {
// Replace anything but 0-9, a-z, or : with a space
filter = filter.replaceAll("[^\\x30-\\x39^\\x61-\\x7a^\\x3a]", " ");
filters = Arrays.asList(filter.split(" "));
filterLibraries(category, filters);
filterLibraries(category, filters, isCompatibilityFilter);
contributionListPanel.updateColors();
}
@@ -63,6 +63,9 @@ class ContributionPanel extends JPanel {
static public final String BUTTON_CONSTRAINT = "Install/Remvoe Button Panel";
static public final String INCOMPATIBILITY_BLUR = "This contribution is not compatible with "
+ "the current revision of Processing";
private final ContributionListPanel listPanel;
private final ContributionListing contribListing = ContributionListing.getInstance();
@@ -230,7 +233,11 @@ class ContributionPanel extends JPanel {
setExpandListener(this, new MouseAdapter() {
public void mousePressed(MouseEvent e) {
listPanel.setSelectedPanel(ContributionPanel.this);
if (contrib.isCompatible(Base.getRevision()))
listPanel.setSelectedPanel(ContributionPanel.this);
else
listPanel.contribManager.status.setErrorMessage(contrib.getName()
+ " is not compatible with this revision of Processing");
}
});
}
@@ -513,6 +520,19 @@ class ContributionPanel extends JPanel {
}
}
private void blurContributionPanel(Component component) {
component.setFocusable(false);
component.setEnabled(false);
if (component instanceof JComponent)
((JComponent) component).setToolTipText(INCOMPATIBILITY_BLUR);
if (component instanceof Container) {
for (Component child : ((Container) component).getComponents()) {
blurContributionPanel(child);
}
}
}
public void setContribution(Contribution contrib) {
this.contrib = contrib;
@@ -681,6 +701,9 @@ class ContributionPanel extends JPanel {
setComponentPopupMenu(null);
}
if (!contrib.isCompatible(Base.getRevision())) {
blurContributionPanel(this);
}
}
private void installContribution(AvailableContribution info) {
@@ -31,6 +31,7 @@ import java.util.zip.*;
import javax.swing.JOptionPane;
import processing.app.*;
import processing.core.PApplet;
/**
@@ -74,7 +75,9 @@ public abstract class LocalContribution extends Contribution {
System.err.println("The version number for the “" + name + "” library is not set properly.");
System.err.println("Please contact the library author to fix it according to the guidelines.");
}
prettyVersion = properties.get("prettyVersion");
try {
lastUpdated = Long.parseLong(properties.get("lastUpdated"));
} catch (NumberFormatException e) {
@@ -84,6 +87,16 @@ public abstract class LocalContribution extends Contribution {
// System.err.println("The last updated timestamp for the “" + name + "” library is not set properly.");
// System.err.println("Please contact the library author to fix it according to the guidelines.");
}
String minRev = properties.get("minRevision");
if (minRev != null) {
minRevision = PApplet.parseInt(minRev, 0);
}
String maxRev = properties.get("maxRevision");
if (maxRev != null) {
maxRevision = PApplet.parseInt(maxRev, 0);
}
} else {
Base.log("No properties file at " + propertiesFile.getAbsolutePath());
@@ -134,13 +134,13 @@ public class ModeContribution extends LocalContribution {
}
// This allows you to build and test your Mode code from Eclipse.
// -Dusemode=com.foo.FrobMode:/path/to/FrobMode/resources
final String usemode = System.getProperty("usemode");
if (usemode != null) {
final String[] modeinfo = usemode.split(":", 2);
final String modeClass = modeinfo[0];
final String modeResourcePath = modeinfo[1];
System.err.println("Attempting to load " + modeClass + " with resources at " + modeResourcePath);
// -Dusemode=com.foo.FrobMode:/path/to/FrobMode
final String useMode = System.getProperty("usemode");
if (useMode != null) {
final String[] modeInfo = useMode.split(":", 2);
final String modeClass = modeInfo[0];
final String modeResourcePath = modeInfo[1];
System.out.println("Attempting to load " + modeClass + " with resources at " + modeResourcePath);
contribModes.add(ModeContribution.load(base, new File(modeResourcePath), modeClass));
}
}
@@ -24,6 +24,7 @@ package processing.app.platform;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import com.apple.eio.FileManager;
@@ -47,6 +48,18 @@ public class MacPlatform extends Platform {
}
*/
public void saveLanguage(String language) {
String[] cmdarray = new String[]{
"defaults", "write",
System.getProperty("user.home") + "/Library/Preferences/org.processing.app",
"AppleLanguages", "-array", language
};
try {
Runtime.getRuntime().exec(cmdarray);
} catch (IOException e) {
Base.log("Error saving platform language: " + e.getMessage());
}
}
public void init(Base base) {
super.init(base);
@@ -205,4 +218,4 @@ public class MacPlatform extends Platform {
protected String getDocumentsFolder() throws FileNotFoundException {
return FileManager.findFolder(kUserDomain, kDocumentsFolderType);
}
}
}
@@ -135,7 +135,14 @@ public class ThinkDifferent implements ApplicationListener {
});
fileMenu.add(item);
fileMenu.add(base.getSketchbookMenu());
item = Toolkit.newJMenuItemShift(Language.text("menu.file.sketchbook"), 'K');
item.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
base.getNextMode().showSketchbookFrame();
}
});
fileMenu.add(item);
item = Toolkit.newJMenuItemShift(Language.text("menu.file.examples"), 'O');
item.addActionListener(new ActionListener() {
+18 -14
View File
@@ -45,6 +45,8 @@ public class ColorSelector implements Tool {
*/
static ColorChooser selector;
private Editor editor;
public String getMenuTitle() {
return Language.text("menu.tools.color_selector");
@@ -52,24 +54,26 @@ public class ColorSelector implements Tool {
public void init(Editor editor) {
// Language.text("color_selector")
if (selector == null) {
selector = new ColorChooser(editor, false, Color.WHITE,
"Copy", new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
Clipboard clipboard = Toolkit.getSystemClipboard();
clipboard.setContents(new StringSelection(selector.getHexColor()), null);
}
});
}
this.editor = editor;
}
public void run() {
if (selector == null) {
synchronized(ColorSelector.class) {
if (selector == null) {
selector = new ColorChooser(editor, false, Color.WHITE,
"Copy", new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
Clipboard clipboard = Toolkit.getSystemClipboard();
clipboard.setContents(new StringSelection(selector.getHexColor()), null);
}
});
}
}
}
selector.show();
}
}
+2 -2
View File
@@ -577,7 +577,7 @@ public class JavaEditor extends Editor {
Object value = optionPane.getValue();
if (value.equals(options[0])) {
return jmode.handleExportApplication(sketch);
} else if (value.equals(options[1]) || value.equals(new Integer(-1))) {
} else if (value.equals(options[1]) || value.equals(Integer.valueOf(-1))) {
// closed window by hitting Cancel or ESC
statusNotice("Export to Application canceled.");
}
@@ -832,4 +832,4 @@ public class JavaEditor extends Editor {
//jmode.handleStop();
handleStop();
}
}
}
+2
View File
@@ -496,6 +496,8 @@
value="macosx/work/Processing.app/Contents/Java" />
</antcall>
<exec executable="macosx/language_gen.py" />
<property name="launch4j.dir" value="macosx/work/Processing.app/Contents/Java/modes/java/application/launch4j" />
<!-- rename the version we need -->
+26
View File
@@ -0,0 +1,26 @@
#!/usr/bin/python
import os, re
BASEDIR = os.path.dirname(os.path.realpath(__file__))
def supported_languages():
path = "../../app/src/processing/app/languages/languages.txt"
with open(os.path.join(BASEDIR, path)) as f:
lines = f.read().splitlines()
lines = filter(lambda l: re.match(r'^[a-z]{2}', l), lines)
lines = map(lambda l: re.sub(r'#.*', '', l).strip(), lines)
return lines
def lproj_directory(lang):
path = "work/Processing.app/Contents/Resources/{}.lproj".format(lang)
return os.path.join(BASEDIR, path)
if __name__ == "__main__":
for lang in supported_languages():
try:
os.mkdir(lproj_directory(lang))
except OSError:
pass
+234
View File
@@ -1,3 +1,237 @@
PROCESSING 3.0a4 (REV 0231) - 1X September 2014
Another release to deal with a handful of bugs found in the last alpha.
The next alpha release will contain major changes and break a few libraries
and tools, so this is an attempt at a final "stable" alpha that can be used
until all those issues are sorted out.
[ changes ]
+ Contributions (Libraries, Modes, Tools) are now read from their own
listing that's specific to Processing 3.
https://github.com/processing/processing/issues/2850
https://github.com/processing/processing/issues/2849
+ Made the new editor the default.
+ The OS X default File menu (shown when no windows are open) now has the
order/naming changes found in the sketch window File menu.
[ bug fixes ]
+ TGAs from saveFrame() create transparent/black movies with Movie Maker
https://github.com/processing/processing/issues/2851
+ Fix export problem on Windows when using the new editor
https://github.com/processing/processing/issues/2806
[ internal tweaks ]
+ Optimize creation of boxed primitives
https://github.com/processing/processing/pull/2826
+ Add static modifier to inner classes that don't access parent
https://github.com/processing/processing/pull/2839
+ Fix localization in OS X (requires writing property files)
https://github.com/processing/processing/pull/2844
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
PROCESSING 3.0a3 (REV 0230) - 26 August 2014
The 3.0 process continues as we've wrapped up a very successful
Google Summer of Code, and have also been integrating contributions
(internationalization!) from some helpful community members.
In particular, Jakub Valtar, Darius M, and Frederico Bond are my heroes:
https://github.com/processing/processing/commits/master?author=jakubvaltar
https://github.com/processing/processing/commits/master?author=federicobond
https://github.com/processing/processing/commits/master?author=voidplus
[ changes ]
+ Removed toolbar buttons except for start/stop. This is part of a larger
set of GUI changes for 3.0. At the moment it makes the design really
awkward, but we needed to take the step in preparation for the larger
changes to come.
[ fixes and updates ]
+ The sound library is now available for 64-bit Windows and Linux.
32-bit versions are still in the works.
+ Don't write sketch.properties unless it's a non-default mode
https://github.com/processing/processing/issues/2531
+ Add another NaN check when sorting FloatList/Dict classes.
If all values were NaN, an ArrayIndexOutOfBoundsException was thrown.
+ PShape for JAVA2D (in progress)
https://github.com/processing/processing/pull/2756
+ Add trim() method to the XML library to remove whitespace #text.
+ Maximizing window leads to erroneous mouse coordinates
https://github.com/processing/processing/issues/2562
[ summer of code ]
+ Fixes for mode/tool installation
https://github.com/processing/processing/pull/2705
+ Fix mode updating to work properly
https://github.com/processing/processing/issues/2579
+ Contribution manager temp folders weren't always deleting
https://github.com/processing/processing/issues/2606
+ Problems when deleting a mode
https://github.com/processing/processing/issues/2507
+ Autocompletion dialog box sticking
https://github.com/processing/processing/issues/2741
+ Line warning indicators next to scrollbar break after moving around text
https://github.com/processing/processing/issues/2655
+ Code completion generates wrong code
https://github.com/processing/processing/issues/2753
+ Code completion: Hide overloaded methods unless inside parentheses
https://github.com/processing/processing/issues/2755
+ Close auto-completion suggestion box when deleting/backspacing code
https://github.com/processing/processing/issues/2757
+ Error checking too aggressive in the current alpha
https://github.com/processing/processing/issues/2677
+ If 'void' left out before setup or draw, cryptic error message ensues
http://code.google.com/p/processing/issues/detail?id=8
https://github.com/processing/processing/issues/47
+ Improve how the Contributions Manager handles no internet connection
https://github.com/processing/processing/pull/2800
+ Added examples-package as a new contribution type
https://github.com/processing/processing/pull/2795
https://github.com/processing/processing/issues/2444
https://github.com/processing/processing/issues/2582
+ Contributions Managers now show specific titles
https://github.com/processing/processing/pull/2777
+ Add rank (starred / recommended) to contributions manager items
https://github.com/processing/processing/issues/2580
[ contributions ]
+ Add internationalization (support for other languages)
https://github.com/processing/processing/issues/632
https://github.com/processing/processing/pull/2084
http://code.google.com/p/processing/issues/detail?id=593
https://github.com/processing/processing/pull/2704
https://github.com/processing/processing/pull/2725
https://github.com/processing/processing/pull/2726
https://github.com/processing/processing/pull/2770
https://github.com/processing/processing/pull/2780
+ Add localizations (support for individual languages)
Japanese https://github.com/processing/processing/pull/2688
Spanish https://github.com/processing/processing/pull/2691
and https://github.com/processing/processing/pull/2769
Dutch https://github.com/processing/processing/pull/2694
French https://github.com/processing/processing/pull/2695
Portugese https://github.com/processing/processing/pull/2701
Korean https://github.com/processing/processing/commit/7b60e2ded9ca81f6a5a08a818aaf84ee4bb029e3
Turkish https://github.com/processing/processing/pull/2740
Chinese https://github.com/processing/processing/pull/2748
+ Add polling to detect file system changes
https://github.com/processing/processing/issues/1939
https://github.com/processing/processing/pull/2628
https://github.com/processing/processing/pull/2794
https://github.com/processing/processing/issues/2759
+ Indent breaks when hitting enter before spaces
https://github.com/processing/processing/issues/2004
https://github.com/processing/processing/pull/2690
+ Localize status messages and contributions panel
https://github.com/processing/processing/pull/2696
+ Prevent adding files to read-only sketches
https://github.com/processing/processing/issues/2459
https://github.com/processing/processing/pull/2697
+ Add thread names for easier debugging and profiling
https://github.com/processing/processing/pull/2729
+ Fix firstLine when modifying lines above it
https://github.com/processing/processing/issues/2654
https://github.com/processing/processing/pull/2674
+ Clean up completion panel styling when using Nimbus LAF
https://github.com/processing/processing/pull/2718
https://github.com/processing/processing/pull/2762
+ Implement support for enums
https://github.com/processing/processing/issues/1390
http://code.google.com/p/processing/issues/detail?id=1352
https://github.com/processing/processing/pull/2774
+ Combining char/int/etc casts in one statement causes preproc trouble
https://github.com/processing/processing/issues/1936
https://github.com/processing/processing/pull/2772
+ Make --output optional in the command line version
https://github.com/processing/processing/pull/1866
https://github.com/processing/processing/issues/1855
https://github.com/processing/processing/issues/1816
+ Fix unneeded scroll bar display in code completion suggestion box
https://github.com/processing/processing/pull/2763
+ Replace Thread with invokeLater in PreferencesFrame
https://github.com/processing/processing/pull/2811
+ Initialize the ColorSelector tool on demand
https://github.com/processing/processing/pull/2823
+ Call applet.exit() instead of System.exit() from Present Mode's 'stop'
https://github.com/processing/processing/pull/2680
+ Drawing RECT PShape with rounded corners crashes the sketch
https://github.com/processing/processing/issues/2648
+ Corrected a typo in Tessellator#addQuadraticVertex()
https://github.com/processing/processing/pull/2649
+ Fix tiny typo in Table writeHTML()
https://github.com/processing/processing/pull/2773
[ fixed earlier but un-noted ]
+ PShape disableStyle() does not work with createShape()
https://github.com/processing/processing/issues/1523
+ Multisampled offscreen PGraphics don't clear the screen properly
https://github.com/processing/processing/issues/2679
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
PROCESSING 3.0a2 (REV 0229) - 31 July 2014
The 3.0 train gains steam and continues to hurtle down the track.
@@ -200,23 +200,15 @@ public class MovieMaker extends JFrame implements Tool {
heightLabel = new JLabel();
heightField = new JTextField();
compressionLabel = new JLabel();
compressionBox = new JComboBox();
compressionBox = new JComboBox<String>();
fpsLabel = new JLabel();
fpsField = new JTextField();
originalSizeCheckBox = new JCheckBox();
// streamingLabel = new JLabel();
// streamingGroup = new ButtonGroup();
// noPreparationRadio = new JRadioButton();
// fastStartRadio = new JRadioButton();
// fastStartCompressedRadio = new JRadioButton();
// FormListener formListener = new FormListener();
setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
setVisible(false);
// System.exit(0);
}
});
registerWindowCloseKeys(getRootPane(), new ActionListener() {
@@ -345,7 +337,7 @@ public class MovieMaker extends JFrame implements Tool {
compressionLabel.setText("Compression:");
compressionBox.setFont(font);
//compressionBox.setModel(new DefaultComboBoxModel(new String[] { "None", "Animation", "JPEG", "PNG" }));
compressionBox.setModel(new DefaultComboBoxModel(new String[] { "Animation", "JPEG", "PNG" }));
compressionBox.setModel(new DefaultComboBoxModel<String>(new String[] { "Animation", "JPEG", "PNG" }));
fpsLabel.setFont(font);
fpsLabel.setText("Frame Rate:");
@@ -635,9 +627,6 @@ public class MovieMaker extends JFrame implements Tool {
// Check on first image, if we can actually do pass through
if (originalSize) {
// This was using ImageIcon, which can't handle some file types.
// For 2.1, switching to ImageIO (which is used for movie
// generation anyway) [fry 131008]
BufferedImage temp = readImage(imgFiles[0]);
if (temp == null) {
return new RuntimeException("Coult not read " + imgFiles[0].getAbsolutePath());
@@ -690,6 +679,11 @@ public class MovieMaker extends JFrame implements Tool {
}//GEN-LAST:event_createMovie
/**
* Read an image from a file. ImageIcon doesn't don't do well with some file
* types, so we use ImageIO. ImageIO doesn't handle TGA files created by
* Processing, so this calls our own loadImageTGA().
*/
private BufferedImage readImage(File file) throws IOException {
// Make sure that we're using a ClassLoader that's aware of the ImageIO jar
//Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
@@ -709,87 +703,21 @@ public class MovieMaker extends JFrame implements Tool {
}
}
*/
if (image == null) {
String path = file.getAbsolutePath();
String pathLower = path.toLowerCase();
// Might be an incompatible TGA or TIFF created by Processing
if (path.toLowerCase().endsWith(".tga")) {
if (pathLower.endsWith(".tga")) {
return loadImageTGA(file);
} else if (path.toLowerCase().endsWith(".tif")) {
} else if (pathLower.endsWith(".tif") || pathLower.endsWith(".tiff")) {
throw new IOException("Try TGA or PNG images instead of TIFF.");
}
}
return image;
}
/*
static public void selectFolder(final Frame parentFrame,
final String prompt,
// final String callbackMethod,
final File defaultSelection,
// final Object callbackObject,
final SelectCallback callback) {
// EventQueue.invokeLater(new Runnable() {
// public void run() {
File selectedFile = null;
if (System.getProperty("os.name").contains("Mac")) {
FileDialog fileDialog =
new FileDialog(parentFrame, prompt, FileDialog.LOAD);
System.setProperty("apple.awt.fileDialogForDirectories", "true");
fileDialog.setVisible(true);
System.setProperty("apple.awt.fileDialogForDirectories", "false");
String filename = fileDialog.getFile();
if (filename != null) {
selectedFile = new File(fileDialog.getDirectory(), fileDialog.getFile());
}
} else {
JFileChooser fileChooser = new JFileChooser();
fileChooser.setDialogTitle(prompt);
fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
if (defaultSelection != null) {
fileChooser.setSelectedFile(defaultSelection);
}
int result = fileChooser.showOpenDialog(parentFrame);
if (result == JFileChooser.APPROVE_OPTION) {
selectedFile = fileChooser.getSelectedFile();
}
}
//selectCallback(selectedFile, callbackMethod, callbackObject);
callback.select(selectedFile);
// }
// });
}
*/
// static private void selectCallback(File selectedFile,
// String callbackMethod,
// Object callbackObject) {
// try {
// Class<?> callbackClass = callbackObject.getClass();
// Method selectMethod =
// callbackClass.getMethod(callbackMethod, new Class[] { File.class });
// selectMethod.invoke(callbackObject, new Object[] { selectedFile });
//
// } catch (IllegalAccessException iae) {
// System.err.println(callbackMethod + "() must be public");
//
// } catch (InvocationTargetException ite) {
// ite.printStackTrace();
//
// } catch (NoSuchMethodException nsme) {
// System.err.println(callbackMethod + "() could not be found");
// }
// }
// private void streamingRadioPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_streamingRadioPerformed
// prefs.put("movie.streaming", evt.getActionCommand());
// }//GEN-LAST:event_streamingRadioPerformed
/** variable frame rate. */
private void writeVideoOnlyVFR(File movieFile, File[] imgFiles, int width, int height, double fps, QuickTimeWriter.VideoFormat videoFormat, /*boolean passThrough,*/ String streaming) throws IOException {
@@ -831,7 +759,8 @@ public class MovieMaker extends JFrame implements Tool {
if (false) {
qtOut.writeSample(0, f, duration);
} else {
BufferedImage fImg = ImageIO.read(f);
//BufferedImage fImg = ImageIO.read(f);
BufferedImage fImg = readImage(f);
g.drawImage(fImg, 0, 0, width, height, null);
if (i != 0 && Arrays.equals(data, prevData)) {
prevImgDuration += duration;
@@ -870,65 +799,6 @@ public class MovieMaker extends JFrame implements Tool {
}
}
/** fixed framerate. */
/*
private void writeVideoOnlyFFR(File movieFile, File[] imgFiles, int width, int height, double fps, QuickTimeWriter.VideoFormat videoFormat, boolean passThrough, String streaming) throws IOException {
File tmpFile = streaming.equals("none") ? movieFile : new File(movieFile.getPath() + ".tmp");
ProgressMonitor p = new ProgressMonitor(MovieMaker.this, "Creating " + movieFile.getName(), "Creating Output File...", 0, imgFiles.length);
Graphics2D g = null;
BufferedImage imgBuffer = null;
QuickTimeWriter qtOut = null;
try {
int timeScale = (int) (fps * 100.0);
int duration = 100;
qtOut = new QuickTimeWriter(videoFormat == QuickTimeWriter.VideoFormat.RAW ? movieFile : tmpFile);
qtOut.addVideoTrack(videoFormat, timeScale, width, height);
//qtOut.setSyncInterval(0,0);
if (!passThrough) {
imgBuffer = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
g = imgBuffer.createGraphics();
g.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
}
for (int i = 0; i < imgFiles.length && !p.isCanceled(); i++) {
File f = imgFiles[i];
p.setNote("Processing " + f.getName());
p.setProgress(i);
if (passThrough) {
qtOut.writeSample(0, f, duration);
} else {
BufferedImage fImg = ImageIO.read(f);
if (fImg == null) {
continue;
}
g.drawImage(fImg, 0, 0, width, height, null);
qtOut.writeFrame(0, imgBuffer, duration);
}
}
if (streaming.equals("fastStart")) {
qtOut.toWebOptimizedMovie(movieFile, false);
tmpFile.delete();
} else if (streaming.equals("fastStartCompressed")) {
qtOut.toWebOptimizedMovie(movieFile, true);
tmpFile.delete();
}
qtOut.close();
qtOut = null;
} finally {
p.close();
if (g != null) {
g.dispose();
}
if (imgBuffer != null) {
imgBuffer.flush();
}
if (qtOut != null) {
qtOut.close();
}
}
}
*/
private void writeAudioOnly(File movieFile, File audioFile, String streaming) throws IOException {
File tmpFile = streaming.equals("none") ? movieFile : new File(movieFile.getPath() + ".tmp");
@@ -1085,7 +955,8 @@ public class MovieMaker extends JFrame implements Tool {
if (false) {
qtOut.writeSample(1, imgFiles[imgIndex], vsDuration);
} else {
BufferedImage fImg = ImageIO.read(imgFiles[imgIndex]);
//BufferedImage fImg = ImageIO.read(imgFiles[imgIndex]);
BufferedImage fImg = readImage(imgFiles[imgIndex]);
if (fImg == null) {
continue;
}
@@ -1268,12 +1139,11 @@ public class MovieMaker extends JFrame implements Tool {
break;
case RGB:
pixel = 0xFF000000 |
is.read() | (is.read() << 8) | (is.read() << 16);
//(is.read() << 16) | (is.read() << 8) | is.read();
is.read() | (is.read() << 8) | (is.read() << 16);
break;
case ARGB:
pixel = is.read() |
(is.read() << 8) | (is.read() << 16) | (is.read() << 24);
(is.read() << 8) | (is.read() << 16) | (is.read() << 24);
break;
}
for (int i = 0; i < num; i++) {
@@ -1291,13 +1161,13 @@ public class MovieMaker extends JFrame implements Tool {
case RGB:
for (int i = 0; i < num; i++) {
pixels[index++] = 0xFF000000 |
is.read() | (is.read() << 8) | (is.read() << 16);
is.read() | (is.read() << 8) | (is.read() << 16);
}
break;
case ARGB:
for (int i = 0; i < num; i++) {
pixels[index++] = is.read() |
(is.read() << 8) | (is.read() << 16) | (is.read() << 24);
(is.read() << 8) | (is.read() << 16) | (is.read() << 24);
}
break;
}
@@ -1347,7 +1217,7 @@ public class MovieMaker extends JFrame implements Tool {
private JLabel aboutLabel;
private JButton chooseImageFolderButton;
private JButton chooseSoundFileButton;
private JComboBox<?> compressionBox;
private JComboBox<String> compressionBox;
private JLabel compressionLabel;
// private JRadioButton fastStartCompressedRadio;
// private JRadioButton fastStartRadio;
+29
View File
@@ -1,3 +1,32 @@
0230 core (3.0a3)
X add another NaN check when sorting FloatList/Dict classes
X if all values were NaN, an ArrayIndexOutOfBoundsException was thrown
X PShape for JAVA2D
X https://github.com/processing/processing/pull/2756
X add trim() method to the XML library
andres
X maximizing window leads to erroneous mouse coordinates
X https://github.com/processing/processing/issues/2562
earlier
X PShape disableStyle() does not work with createShape()
X https://github.com/processing/processing/issues/1523
X multisampled offscreen PGraphics don't clear the screen properly
X https://github.com/processing/processing/issues/2679
X this was done midway through the 3.0a2 release process
pull requests
X call applet.exit() instead of System.exit() from Present Mode's 'stop'
X https://github.com/processing/processing/pull/2680
X Drawing RECT PShape with rounded corners crashes the sketch
X https://github.com/processing/processing/issues/2648
X Corrected a typo in Tessellator#addQuadraticVertex()
X https://github.com/processing/processing/pull/2649
X fix tiny typo in Table writeHTML()
X https://github.com/processing/processing/pull/2773
0229 core (3.0a2)
X PImage resize() causes images to not draw
X https://github.com/processing/processing/issues/2228
+2 -2
View File
@@ -5959,7 +5959,7 @@ public class PApplet extends Applet
* @return true if 'what' is "true" or "TRUE", false otherwise
*/
static final public boolean parseBoolean(String what) {
return new Boolean(what).booleanValue();
return Boolean.parseBoolean(what);
}
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
@@ -6017,7 +6017,7 @@ public class PApplet extends Applet
static final public boolean[] parseBoolean(String what[]) {
boolean outgoing[] = new boolean[what.length];
for (int i = 0; i < what.length; i++) {
outgoing[i] = new Boolean(what[i]).booleanValue();
outgoing[i] = Boolean.parseBoolean(what[i]);
}
return outgoing;
}
+2 -2
View File
@@ -9260,7 +9260,7 @@ public class PApplet extends Applet
* @return true if 'what' is "true" or "TRUE", false otherwise
*/
static final public boolean parseBoolean(String what) {
return new Boolean(what).booleanValue();
return Boolean.parseBoolean(what);
}
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
@@ -9320,7 +9320,7 @@ public class PApplet extends Applet
static final public boolean[] parseBoolean(String what[]) {
boolean outgoing[] = new boolean[what.length];
for (int i = 0; i < what.length; i++) {
outgoing[i] = new Boolean(what[i]).booleanValue();
outgoing[i] = Boolean.parseBoolean(what[i]);
}
return outgoing;
}
@@ -1450,7 +1450,7 @@ public class PGraphicsJava2D extends PGraphics {
}
class ImageCache {
static class ImageCache {
boolean tinted;
int tintedColor;
int[] tintedTemp; // one row of tinted pixels
+1 -1
View File
@@ -335,7 +335,7 @@ public class PShapeOBJ extends PShape {
// Starting new material.
String mtlname = parts[1];
currentMtl = new OBJMaterial(mtlname);
materialsHash.put(mtlname, new Integer(materials.size()));
materialsHash.put(mtlname, Integer.valueOf(materials.size()));
materials.add(currentMtl);
} else if (parts[0].equals("map_Kd") && parts.length > 1) {
// Loading texture map.
+7 -7
View File
@@ -1431,7 +1431,7 @@ public class PShapeSVG extends PShape {
}
class LinearGradient extends Gradient {
static class LinearGradient extends Gradient {
float x1, y1, x2, y2;
public LinearGradient(PShapeSVG parent, XML properties) {
@@ -1461,7 +1461,7 @@ public class PShapeSVG extends PShape {
}
class RadialGradient extends Gradient {
static class RadialGradient extends Gradient {
float cx, cy, r;
public RadialGradient(PShapeSVG parent, XML properties) {
@@ -1490,7 +1490,7 @@ public class PShapeSVG extends PShape {
class LinearGradientPaint implements Paint {
static class LinearGradientPaint implements Paint {
float x1, y1, x2, y2;
float[] offset;
int[] color;
@@ -1615,7 +1615,7 @@ public class PShapeSVG extends PShape {
}
class RadialGradientPaint implements Paint {
static class RadialGradientPaint implements Paint {
float cx, cy, radius;
float[] offset;
int[] color;
@@ -1773,7 +1773,7 @@ public class PShapeSVG extends PShape {
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
public class Font extends PShapeSVG {
public static class Font extends PShapeSVG {
public FontFace face;
public HashMap<String,FontGlyph> namedGlyphs;
@@ -1887,7 +1887,7 @@ public class PShapeSVG extends PShape {
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
class FontFace extends PShapeSVG {
static class FontFace extends PShapeSVG {
int horizOriginX; // dflt 0
int horizOriginY; // dflt 0
// int horizAdvX; // no dflt?
@@ -1924,7 +1924,7 @@ public class PShapeSVG extends PShape {
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
public class FontGlyph extends PShapeSVG { // extends Path
public static class FontGlyph extends PShapeSVG { // extends Path
public String name;
char unicode;
int horizAdvX;
+3 -3
View File
@@ -493,7 +493,7 @@ public class FloatDict {
keys = PApplet.expand(keys);
values = PApplet.expand(values);
}
indices.put(what, new Integer(count));
indices.put(what, Integer.valueOf(count));
keys[count] = what;
values[count] = much;
count++;
@@ -540,8 +540,8 @@ public class FloatDict {
keys[b] = tkey;
values[b] = tvalue;
indices.put(keys[a], new Integer(a));
indices.put(keys[b], new Integer(b));
indices.put(keys[a], Integer.valueOf(a));
indices.put(keys[b], Integer.valueOf(b));
}
+3 -8
View File
@@ -486,7 +486,7 @@ public class IntDict {
keys = PApplet.expand(keys);
values = PApplet.expand(values);
}
indices.put(what, new Integer(count));
indices.put(what, Integer.valueOf(count));
keys[count] = what;
values[count] = much;
count++;
@@ -532,8 +532,8 @@ public class IntDict {
keys[b] = tkey;
values[b] = tvalue;
indices.put(keys[a], new Integer(a));
indices.put(keys[b], new Integer(b));
indices.put(keys[a], Integer.valueOf(a));
indices.put(keys[b], Integer.valueOf(b));
}
@@ -561,13 +561,8 @@ public class IntDict {
/**
<<<<<<< HEAD
* Sort by values in descending order (largest value will be at [0]).
*
=======
* Sort by values in ascending order. The smallest value will be at [0].
*
>>>>>>> cd467dc12a42d588638aaab06746bebdfb333cc4
* @webref intdict:method
* @brief Sort by values in ascending order
*/
+7 -7
View File
@@ -168,7 +168,7 @@ public class JSONArray {
public JSONArray(IntList list) {
myArrayList = new ArrayList<Object>();
for (int item : list.values()) {
myArrayList.add(new Integer(item));
myArrayList.add(Integer.valueOf(item));
}
}
@@ -718,7 +718,7 @@ public class JSONArray {
* @return this.
*/
public JSONArray append(int value) {
this.append(new Integer(value));
this.append(Integer.valueOf(value));
return this;
}
@@ -731,7 +731,7 @@ public class JSONArray {
* @return this.
*/
public JSONArray append(long value) {
this.append(new Long(value));
this.append(Long.valueOf(value));
return this;
}
@@ -758,7 +758,7 @@ public class JSONArray {
* @return this.
*/
public JSONArray append(double value) {
Double d = new Double(value);
Double d = value;
JSONObject.testValidity(d);
this.append(d);
return this;
@@ -884,7 +884,7 @@ public class JSONArray {
* @see JSONArray#setBoolean(int, boolean)
*/
public JSONArray setInt(int index, int value) {
this.set(index, new Integer(value));
this.set(index, Integer.valueOf(value));
return this;
}
@@ -899,7 +899,7 @@ public class JSONArray {
* @throws JSONException If the index is negative.
*/
public JSONArray setLong(int index, long value) {
return set(index, new Long(value));
return set(index, Long.valueOf(value));
}
@@ -936,7 +936,7 @@ public class JSONArray {
* not finite.
*/
public JSONArray setDouble(int index, double value) {
return set(index, new Double(value));
return set(index, Double.valueOf(value));
}
+3 -3
View File
@@ -1168,7 +1168,7 @@ public class JSONObject {
* @see JSONObject#setBoolean(String, boolean)
*/
public JSONObject setInt(String key, int value) {
this.put(key, new Integer(value));
this.put(key, Integer.valueOf(value));
return this;
}
@@ -1182,7 +1182,7 @@ public class JSONObject {
* @throws JSONException If the key is null.
*/
public JSONObject setLong(String key, long value) {
this.put(key, new Long(value));
this.put(key, Long.valueOf(value));
return this;
}
@@ -1494,7 +1494,7 @@ public class JSONObject {
} else {
Long myLong = new Long(string);
if (myLong.longValue() == myLong.intValue()) {
return new Integer(myLong.intValue());
return Integer.valueOf(myLong.intValue());
} else {
return myLong;
}
+3 -3
View File
@@ -279,7 +279,7 @@ public class StringDict {
keys = PApplet.expand(keys);
values = PApplet.expand(values);
}
indices.put(key, new Integer(count));
indices.put(key, Integer.valueOf(count));
keys[count] = key;
values[count] = value;
count++;
@@ -325,8 +325,8 @@ public class StringDict {
keys[b] = tkey;
values[b] = tvalue;
indices.put(keys[a], new Integer(a));
indices.put(keys[b], new Integer(b));
indices.put(keys[a], Integer.valueOf(a));
indices.put(keys[b], Integer.valueOf(b));
}
+1 -1
View File
@@ -390,4 +390,4 @@ class FontTexture implements PConstants {
crop[2] + 2, -crop[3] + 2);
}
}
}
}
@@ -2527,7 +2527,7 @@ public class PGraphicsOpenGL extends PGraphics {
}
class Triangle {
static class Triangle {
int i0, i1, i2;
PImage tex;
float dist;
@@ -8185,7 +8185,8 @@ public class PGraphicsOpenGL extends PGraphics {
addEdge(pidx, idx, i == 0, false);
} else if (0 < i) {
// when drawing full circle, the edge is closed later
addEdge(pidx, idx, i == inc, i == length && !fullCircle);
addEdge(pidx, idx, i == PApplet.min(inc, length),
i == length && !fullCircle);
}
}
} while (i < length);
+3 -26
View File
@@ -1,30 +1,5 @@
0230 core (3.0a3)
X add another NaN check when sorting FloatList/Dict classes
X if all values were NaN, an ArrayIndexOutOfBoundsException was thrown
X PShape for JAVA2D
X https://github.com/processing/processing/pull/2756
X add trim() method to the XML library
0231 core (3.0a4 or 3.0b1)
andres
X maximizing window leads to erroneous mouse coordinates
X https://github.com/processing/processing/issues/2562
earlier
X PShape disableStyle() does not work with createShape()
X https://github.com/processing/processing/issues/1523
X multisampled offscreen PGraphics don't clear the screen properly
X https://github.com/processing/processing/issues/2679
X this was done midway through the 3.0a2 release process
pull requests
X call applet.exit() instead of System.exit() from Present Mode's 'stop'
X https://github.com/processing/processing/pull/2680
X Drawing RECT PShape with rounded corners crashes the sketch
X https://github.com/processing/processing/issues/2648
X Corrected a typo in Tessellator#addQuadraticVertex()
X https://github.com/processing/processing/pull/2649
X fix tiny typo in Table writeHTML()
X https://github.com/processing/processing/pull/2773
applet/component
_ remove Applet as base class
@@ -123,6 +98,8 @@ _ test with JG's 13" retina laptop
decisions/misc
_ use enums for constants
_ https://github.com/processing/processing/issues/2778
_ make join() work with Iterable?
_ will this collide with the current String[] version?
_ add options for image.save() (or saveImage?)
+135
View File
@@ -1,3 +1,138 @@
0230 pde (3.0a3)
X remove toolbar buttons except for start/stop
X rename sketchbook tree name, re-order menu, add language hooks
X split Preferences and PreferencesFrame
X https://github.com/processing/processing/issues/68
X http://code.google.com/p/processing/issues/detail?id=29
X https://github.com/processing/processing/pull/2716
X shouldn't write sketch.properties unless it's a non-default mode
X https://github.com/processing/processing/issues/2531
gsoc
X fixes for mode/tool installation
X https://github.com/processing/processing/pull/2705
X fix mode updating to work properly
X https://github.com/processing/processing/issues/2579
X contrib manager temp folders not always deleting
X https://github.com/processing/processing/issues/2606
X problem when removing a mode
X https://github.com/processing/processing/issues/2507
X autocompletion dialog box sticking
X https://github.com/processing/processing/issues/2741
X Line warning indicators next to scrollbar break after moving around text
X https://github.com/processing/processing/issues/2655
X Code completion generates wrong code
X https://github.com/processing/processing/issues/2753
X Code completion: Hide overloaded methods unless inside parentheses
X https://github.com/processing/processing/issues/2755
X Close auto-completion suggestion box when deleting/backspacing code
X https://github.com/processing/processing/issues/2757
X error checking too aggressive in the current alpha
X https://github.com/processing/processing/issues/2677
X if 'void' left out before loop or setup, cryptic message about
X 'constructor loop must be named Temporary_23498_2343'
X add a better handler for this specific thing?
X http://code.google.com/p/processing/issues/detail?id=8
X https://github.com/processing/processing/issues/47
X Improve how the Contributions Manager handles no internet connection
X https://github.com/processing/processing/pull/2800
X Added examples-package as a new contribution type
X https://github.com/processing/processing/pull/2795
X https://github.com/processing/processing/issues/2444
X https://github.com/processing/processing/issues/2582
X Contributions Managers now show specific titles
X https://github.com/processing/processing/pull/2777
X Add rank (starred / recommended) to contributions manager items
X https://github.com/processing/processing/issues/2580
o Improve detection and handling of missing semicolons
o http://code.google.com/p/processing/issues/detail?id=136
X should be fixed with PDE X (closed by Dan
X https://github.com/processing/processing/issues/175
X missing brackets, unmatched brackets
X examples added to the bug report
X http://code.google.com/p/processing/issues/detail?id=6
X closed by Shiffman, working better now
X https://github.com/processing/processing/issues/45
X 64-bit versions of sound available on Windows and Linux
pulls
X Add polling to detect file system changes
X https://github.com/processing/processing/issues/1939
X https://github.com/processing/processing/pull/2628
X huge i18n patch
X https://github.com/processing/processing/issues/632
X https://github.com/processing/processing/pull/2084
X http://code.google.com/p/processing/issues/detail?id=593
X need to make sure the .properties files are read properly as UTF-8
X Indent breaks when hitting enter before spaces
X https://github.com/processing/processing/issues/2004
X https://github.com/processing/processing/pull/2690
X Localize status messages and contributions panel
X https://github.com/processing/processing/pull/2696
X prevent adding files to read-only sketches
X https://github.com/processing/processing/issues/2459
X https://github.com/processing/processing/pull/2697
X Added some helper methods to Language
X https://github.com/processing/processing/pull/2704
X More i18n updates
X https://github.com/processing/processing/pull/2725
X Add thread names for easier debugging and profiling
X https://github.com/processing/processing/pull/2729
X Add missing translations for OS X menu
X https://github.com/processing/processing/pull/2726
X fix firstLine when modifying lines above it
X https://github.com/processing/processing/issues/2654
X https://github.com/processing/processing/pull/2674
X Style completion panel when using Nimbus LAF
X https://github.com/processing/processing/pull/2718
X enums not supported properly
X https://github.com/processing/processing/issues/1390
X http://code.google.com/p/processing/issues/detail?id=1352
X https://github.com/processing/processing/pull/2774
X combining char/int/etc casts in one statement causes preproc trouble
X https://github.com/processing/processing/issues/1936
X https://github.com/processing/processing/pull/2772
X Update contributions.* strings to contrib
X https://github.com/processing/processing/pull/2770
X Style completion panel on windows
X https://github.com/processing/processing/pull/2762
X Update Spanish language strings
X https://github.com/processing/processing/pull/2769
X make --output optional in the command line version
X https://github.com/processing/processing/pull/1866
X https://github.com/processing/processing/issues/1855
X https://github.com/processing/processing/issues/1816
X Fix unneeded scroll bar display in code completion suggestion box
X https://github.com/processing/processing/pull/2763
X PDE erroneously detects changes in non-sketch files
X https://github.com/processing/processing/pull/2794
X https://github.com/processing/processing/issues/2759
X Catch MissingResourceException when language key is missing
X https://github.com/processing/processing/pull/2780
X Replace Thread with invokeLater in PreferencesFrame
X https://github.com/processing/processing/pull/2811
X Initialize the ColorSelector tool on demand
X https://github.com/processing/processing/pull/2823
languages
X Japanese https://github.com/processing/processing/pull/2688
X Spanish https://github.com/processing/processing/pull/2691
X Dutch https://github.com/processing/processing/pull/2694
X French https://github.com/processing/processing/pull/2695
X Portugese https://github.com/processing/processing/pull/2701
X Korean https://github.com/processing/processing/commit/7b60e2ded9ca81f6a5a08a818aaf84ee4bb029e3
X Turkish https://github.com/processing/processing/pull/2740
X Chinese https://github.com/processing/processing/pull/2748
earlier
X repo cleanup
X remove non-web stuff from web
X remove non-android stuff from android
X remove web and android from the main repo
X separate prefs and sketch state info?
X this would mean prefs being rewritten far less
0229 pde (3.0a2)
X fix "No such file or directory" error when exporting an application on OSX
X this also resulted in the application not being signed at all
+11 -11
View File
@@ -1,11 +1,11 @@
all:
g++ -Ic:/Java/jdk1.8.0_11/include -Ic:/Java/jdk1.8.0_11/include/win32 -I./include -std=c++11 -g -c processing_sound_MethClaInterface.cpp;
g++ -dynamiclib -lmethcla -L../../library/windows32/ -o libMethClaInterface.dll *.o;
clean:
rm *.o
rm *.dll
install:
cp libMethClaInterface.dll ../../lib/windows32
all:
g++ -Ic:/Java/jdk1.8.0_11/include -Ic:/Java/jdk1.8.0_11/include/win32 -I./include -std=c++11 -g -c processing_sound_MethClaInterface.cpp;
g++ -shared -lmethcla -L../../library/windows64/ -static-libgcc -static-libstdc++ -o libMethClaInterface.dll *.o;
clean:
rm *.o
rm *.dll
install:
cp libMethClaInterface.dll ../../lib/windows64
@@ -1,153 +1,168 @@
package processing.sound;
public class MethClaInterface
{
// load Library
static {
System.loadLibrary("MethClaInterface");
}
// Functions I want
public native int[] mixPlay(int[] input, float[] amp);
// Engine
public native int engineNew(int sampleRate, int bufferSize );
public native void engineStart();
public native void engineStop();
// general Synth methods
public native void synthStop(int[] nodeId);
// general Oscillator methods
public native void oscSet(float freq, float amp, float add, float pos, int[] nodeId);
public native void oscAudioSet(int[] freqId, int[] ampId, int[] addId, int[] posId, int[] nodeId);
// Sine Wave Oscillator
public native int[] sinePlay(float freq, float amp, float add, float pos);
//Saw Wave Oscillator
public native int[] sawPlay(float freq, float amp, float add, float pos);
//Square Wave Oscillator
public native int[] sqrPlay(float freq, float amp, float add, float pos);
public native void sqrSet(float freq, float amp, float add, float pos, int[] nodeId);
// Triangle Wave Oscillator
public native int[] triPlay(float freq, float amp, float add, float pos);
// Pulse Wave Oscillator
public native int[] pulsePlay(float freq, float width, float amp, float add, float pos);
public native void pulseSet(float freq, float width, float amp, float add, float pos, int[] nodeId);
// Audio In
public native int[] audioInPlay(float amp, float add, float pos, int in);
public native void audioInSet(float amp, float add, float pos, int[] nodeId);
// SoundFile
public native int[] soundFileInfo(String path);
public native int[] soundFilePlayMono(float rate, float pos, float amp, float add, boolean loop, String path, float dur, int cue);
public native int[] soundFilePlayMulti(float rate, float amp, float add, boolean loop, String path, float dur, int cue);
public native void soundFileSetMono(float rate, float pos, float amp, float add, int[] nodeId);
public native void soundFileSetStereo(float rate, float amp, float add, int[] nodeId);
// White Noise
public native int[] whiteNoisePlay(float amp, float add, float pos);
public native void whiteNoiseSet(float amp, float add, float pos, int[] nodeId);
// Pink Noise
public native int[] pinkNoisePlay(float amp, float add, float pos);
public native void pinkNoiseSet(float amp, float add, float pos, int[] nodeId);
// Brown Noise
public native int[] brownNoisePlay(float amp, float add, float pos);
public native void brownNoiseSet(float amp, float add, float pos, int[] nodeId);
// Envelope
public native int[] envelopePlay(int[] input, float attackTime, float sustainTime, float sustainLevel, float releaseTime);
public native int doneAfter(float seconds);
// Filters
public native int[] highPassPlay(int[] input, float freq);
public native int[] lowPassPlay(int[] input, float freq);
public native int[] bandPassPlay(int[] input, float freq, float bw);
public native void filterSet(float freq, int nodeId);
public native void filterBwSet(float freq, float bw, int nodeId);
// Delay
public native int[] delayPlay(int[] input, float maxDelayTime, float delayTime, float feedBack);
public native void delaySet(float delayTime, float feedBack, int nodeId);
// Reverb
public native int[] reverbPlay(int[] input, float room, float damp, float wet);
public native void reverbSet(float room, float damp, float wet, int nodeId);
// Patch cable
//public native int out(int[] in, int[] out);
// Pan + Out
public native void out(int out, int[] nodeId);
// connect
// public native void connect(int nodeIdOut, int nodeIdIn);
// Descriptors
// Amplitude Follower
public native long amplitude(int[] nodeId);
public native float poll_amplitude(long ptr);
public native void destroy_amplitude(long ptr);
// FFT
public native long fft(int[] nodeId, int fftSize);
public native float[] poll_fft(long ptr);
public native void destroy_fft(long ptr);
}
package processing.sound;
public class MethClaInterface
{
// load Library
static {
String osName = System.getProperty("os.name");
String arch = System.getProperty("os.arch");
if (osName.startsWith("Win")){
System.loadLibrary("LIBWINPTHREAD-1");
System.loadLibrary("LIBSNDFILE-1");
System.loadLibrary("LIBMPG123-0");
System.loadLibrary("LIBMETHCLA");
System.loadLibrary("LIBMETHCLAINTERFACE");
}
else if (osName.startsWith("Mac")){
System.loadLibrary("MethClaInterface");
}
else if (osName.equals("Linux")){
System.loadLibrary("MethClaInterface");
}
}
// Functions I want
// Engine
public native int[] mixPlay(int[] input, float[] amp);
public native int engineNew(int sampleRate, int bufferSize );
public native void engineStart();
public native void engineStop();
// general Synth methods
public native void synthStop(int[] nodeId);
// general Oscillator methods
public native void oscSet(float freq, float amp, float add, float pos, int[] nodeId);
public native void oscAudioSet(int[] freqId, int[] ampId, int[] addId, int[] posId, int[] nodeId);
// Sine Wave Oscillator
public native int[] sinePlay(float freq, float amp, float add, float pos);
//Saw Wave Oscillator
public native int[] sawPlay(float freq, float amp, float add, float pos);
//Square Wave Oscillator
public native int[] sqrPlay(float freq, float amp, float add, float pos);
public native void sqrSet(float freq, float amp, float add, float pos, int[] nodeId);
// Triangle Wave Oscillator
public native int[] triPlay(float freq, float amp, float add, float pos);
// Pulse Wave Oscillator
public native int[] pulsePlay(float freq, float width, float amp, float add, float pos);
public native void pulseSet(float freq, float width, float amp, float add, float pos, int[] nodeId);
// Audio In
public native int[] audioInPlay(float amp, float add, float pos, int in);
public native void audioInSet(float amp, float add, float pos, int[] nodeId);
// SoundFile
public native int[] soundFileInfo(String path);
public native int[] soundFilePlayMono(float rate, float pos, float amp, float add, boolean loop, String path, float dur, int cue);
public native int[] soundFilePlayMulti(float rate, float amp, float add, boolean loop, String path, float dur, int cue);
public native void soundFileSetMono(float rate, float pos, float amp, float add, int[] nodeId);
public native void soundFileSetStereo(float rate, float amp, float add, int[] nodeId);
// White Noise
public native int[] whiteNoisePlay(float amp, float add, float pos);
public native void whiteNoiseSet(float amp, float add, float pos, int[] nodeId);
// Pink Noise
public native int[] pinkNoisePlay(float amp, float add, float pos);
public native void pinkNoiseSet(float amp, float add, float pos, int[] nodeId);
// Brown Noise
public native int[] brownNoisePlay(float amp, float add, float pos);
public native void brownNoiseSet(float amp, float add, float pos, int[] nodeId);
// Envelope
public native int[] envelopePlay(int[] input, float attackTime, float sustainTime, float sustainLevel, float releaseTime);
public native int doneAfter(float seconds);
// Filters
public native int[] highPassPlay(int[] input, float freq);
public native int[] lowPassPlay(int[] input, float freq);
public native int[] bandPassPlay(int[] input, float freq, float bw);
public native void filterSet(float freq, int nodeId);
public native void filterBwSet(float freq, float bw, int nodeId);
// Delay
public native int[] delayPlay(int[] input, float maxDelayTime, float delayTime, float feedBack);
public native void delaySet(float delayTime, float feedBack, int nodeId);
// Reverb
public native int[] reverbPlay(int[] input, float room, float damp, float wet);
public native void reverbSet(float room, float damp, float wet, int nodeId);
// Patch cable
//public native int out(int[] in, int[] out);
// Pan + Out
public native void out(int out, int[] nodeId);
// connect
// public native void connect(int nodeIdOut, int nodeIdIn);
// Descriptors
// Amplitude Follower
public native long amplitude(int[] nodeId);
public native float poll_amplitude(long ptr);
public native void destroy_amplitude(long ptr);
// FFT
public native long fft(int[] nodeId, int fftSize);
public native float[] poll_fft(long ptr);
public native void destroy_fft(long ptr);
}
+5 -5
View File
@@ -2,11 +2,11 @@
2.0 SOUND
FOR RELEASE (GSoC)
FOR RELEASE
- Improve/make examples
Bugs (GSoC):
Bugs:
+ Fix FFT Crash
+ Fix Low Pass Distortion
+ Review Filter Algorithms, exclude Resonance, introduce Bandwith for BPass
@@ -14,8 +14,8 @@
+ Make audio input work
- Use Patch Cables for signal splitting for effects
Features (GSoC):
- Compile Windows Version
Features:
+ Compile Windows Version
- Make oscillators modulatable
- Bandlimit oscillators
- Introduce wet/dry for Delay
@@ -28,7 +28,7 @@
- Review Processing Book
NICE
- Pitchtracker (GSoC optional)
- Pitchtracker (optional)
- isPlaying method for Synths
- helper functions (ampToDB, midiToFreq etc..)
- make non-bandlimited a pro option
@@ -248,7 +248,7 @@ public class OSCByteArrayToJavaConverter {
intBytes[2] = bytes[streamPosition++];
intBytes[3] = bytes[streamPosition++];
BigInteger intBits = new BigInteger(intBytes);
return new Integer(intBits.intValue());
return Integer.valueOf(intBits.intValue());
}
/**
+79 -106
View File
@@ -18,7 +18,7 @@ public class Handle {
public int newEndChar;
public int line;
int tabIndex;
int decimalPlaces; // number of digits after the decimal point
int decimalPlaces; // number of digits after the decimal point
float incValue;
java.lang.Number value, newValue;
@@ -33,10 +33,11 @@ public class Handle {
HProgressBar progBar = null;
String textFormat;
int oscPort;
// the client that sends the changes
UDPTweakClient tweakClient;
public Handle(String t, String n, int vi, String v, int ti, int l, int sc, int ec, int dp)
{
public Handle(String t, String n, int vi, String v, int ti, int l, int sc,
int ec, int dp) {
type = t;
name = n;
varIndex = vi;
@@ -47,27 +48,26 @@ public class Handle {
endChar = ec;
decimalPlaces = dp;
incValue = (float)(1/Math.pow(10, decimalPlaces));
incValue = (float) (1 / Math.pow(10, decimalPlaces));
if (type == "int") {
value = newValue = Integer.parseInt(strValue);
strNewValue = strValue;
textFormat = "%d";
}
else if (type == "hex") {
Long val = Long.parseLong(strValue.substring(2, strValue.length()), 16);
} else if (type == "hex") {
Long val = Long.parseLong(strValue.substring(2, strValue.length()),
16);
value = newValue = val.intValue();
strNewValue = strValue;
textFormat = "0x%x";
}
else if (type == "webcolor") {
Long val = Long.parseLong(strValue.substring(1, strValue.length()), 16);
} else if (type == "webcolor") {
Long val = Long.parseLong(strValue.substring(1, strValue.length()),
16);
val = val | 0xff000000;
value = newValue = val.intValue();
strNewValue = strValue;
textFormat = "#%06x";
}
else if (type == "float") {
} else if (type == "float") {
value = newValue = Float.parseFloat(strValue);
strNewValue = strValue;
textFormat = "%.0" + decimalPlaces + "f";
@@ -77,8 +77,7 @@ public class Handle {
newEndChar = endChar;
}
public void initInterface(int x, int y, int width, int height)
{
public void initInterface(int x, int y, int width, int height) {
this.x = x;
this.y = y;
this.width = width;
@@ -88,13 +87,11 @@ public class Handle {
progBar = new HProgressBar(height, width);
}
public void setCenterX(int mx)
{
public void setCenterX(int mx) {
xLast = xCurrent = xCenter = mx;
}
public void setCurrentX(int mx)
{
public void setCurrentX(int mx) {
xLast = xCurrent;
xCurrent = mx;
@@ -103,92 +100,80 @@ public class Handle {
updateValue();
}
public void resetProgress()
{
public void resetProgress() {
progBar.setPos(0);
}
public void updateValue()
{
public void updateValue() {
float change = getChange();
if (type == "int") {
if (newValue.intValue() + (int)change > Integer.MAX_VALUE ||
newValue.intValue() + (int)change < Integer.MIN_VALUE) {
if (newValue.intValue() + (int) change > Integer.MAX_VALUE
|| newValue.intValue() + (int) change < Integer.MIN_VALUE) {
change = 0;
return;
}
setValue(newValue.intValue() + (int)change);
}
else if (type == "hex") {
setValue(newValue.intValue() + (int)change);
}
else if (type == "webcolor") {
setValue(newValue.intValue() + (int)change);
}
else if (type == "float") {
setValue(newValue.intValue() + (int) change);
} else if (type == "hex") {
setValue(newValue.intValue() + (int) change);
} else if (type == "webcolor") {
setValue(newValue.intValue() + (int) change);
} else if (type == "float") {
setValue(newValue.floatValue() + change);
}
updateColorBox();
}
public void setValue(Number value)
{
public void setValue(Number value) {
if (type == "int") {
newValue = value.intValue();
strNewValue = String.format(Locale.US,textFormat, newValue.intValue());
}
else if (type == "hex") {
strNewValue = String.format(Locale.US, textFormat,
newValue.intValue());
} else if (type == "hex") {
newValue = value.intValue();
strNewValue = String.format(Locale.US,textFormat, newValue.intValue());
}
else if (type == "webcolor") {
strNewValue = String.format(Locale.US, textFormat,
newValue.intValue());
} else if (type == "webcolor") {
newValue = value.intValue();
// keep only RGB
int val = (newValue.intValue() & 0xffffff);
strNewValue = String.format(Locale.US,textFormat, val);
}
else if (type == "float") {
strNewValue = String.format(Locale.US, textFormat, val);
} else if (type == "float") {
BigDecimal bd = new BigDecimal(value.floatValue());
bd = bd.setScale(decimalPlaces, BigDecimal.ROUND_HALF_UP);
newValue = bd.floatValue();
strNewValue = String.format(Locale.US,textFormat, newValue.floatValue());
strNewValue = String.format(Locale.US, textFormat,
newValue.floatValue());
}
// send new data to the server in the sketch
oscSendNewValue();
sendNewValue();
}
public void updateColorBox()
{
if (colorBox != null)
{
public void updateColorBox() {
if (colorBox != null) {
colorBox.colorChanged();
}
}
private float getChange()
{
private float getChange() {
int pixels = xCurrent - xLast;
return pixels*incValue;
return pixels * incValue;
}
public void setPos(int nx, int ny)
{
public void setPos(int nx, int ny) {
x = nx;
y = ny;
}
public void setWidth(int w)
{
public void setWidth(int w) {
width = w;
progBar.setWidth(w);
}
public void draw(Graphics2D g2d, boolean hasFocus)
{
public void draw(Graphics2D g2d, boolean hasFocus) {
AffineTransform prevTrans = g2d.getTransform();
g2d.translate(x, y);
@@ -198,7 +183,7 @@ public class Handle {
if (hasFocus) {
if (progBar != null) {
g2d.translate(width/2, 2);
g2d.translate(width / 2, 2);
progBar.draw(g2d);
}
}
@@ -206,70 +191,59 @@ public class Handle {
g2d.setTransform(prevTrans);
}
public boolean pick(int mx, int my)
{
public boolean pick(int mx, int my) {
return pickText(mx, my);
}
public boolean pickText(int mx, int my)
{
if (mx>x-2 && mx<x+width+2 && my>y-height && my<y) {
public boolean pickText(int mx, int my) {
if (mx > x - 2 && mx < x + width + 2 && my > y - height && my < y) {
return true;
}
return false;
}
public boolean valueChanged()
{
public boolean valueChanged() {
if (type == "int") {
return (value.intValue() != newValue.intValue());
}
else if (type == "hex") {
} else if (type == "hex") {
return (value.intValue() != newValue.intValue());
}
else if (type == "webcolor") {
} else if (type == "webcolor") {
return (value.intValue() != newValue.intValue());
}
else {
} else {
return (value.floatValue() != newValue.floatValue());
}
}
public void setColorBox(ColorControlBox box)
{
public void setColorBox(ColorControlBox box) {
colorBox = box;
}
public void setOscPort(int port)
{
oscPort = port;
public void setTweakClient(UDPTweakClient client) {
tweakClient = client;
}
public void oscSendNewValue()
{
public void sendNewValue() {
int index = varIndex;
try {
if (type == "int") {
OSCSender.sendInt(index, newValue.intValue(), oscPort);
tweakClient.sendInt(index, newValue.intValue());
} else if (type == "hex") {
tweakClient.sendInt(index, newValue.intValue());
} else if (type == "webcolor") {
tweakClient.sendInt(index, newValue.intValue());
} else if (type == "float") {
tweakClient.sendFloat(index, newValue.floatValue());
}
else if (type == "hex") {
OSCSender.sendInt(index, newValue.intValue(), oscPort);
}
else if (type == "webcolor") {
OSCSender.sendInt(index, newValue.intValue(), oscPort);
}
else if (type == "float") {
OSCSender.sendFloat(index, newValue.floatValue(), oscPort);
}
} catch (Exception e) { System.out.println("error sending OSC message!"); }
} catch (Exception e) {
System.out.println("error sending new value!");
}
}
public String toString()
{
return type + " " + name + " = " + strValue +
" (tab: " + tabIndex + ", line: " + line +
", start: " + startChar + ", end: " + endChar + ")";
public String toString() {
return type + " " + name + " = " + strValue + " (tab: " + tabIndex
+ ", line: " + line + ", start: " + startChar + ", end: "
+ endChar + ")";
}
}
@@ -277,13 +251,12 @@ public class Handle {
* Used for sorting the handles by order of occurrence inside each tab
*/
class HandleComparator implements Comparator<Handle> {
public int compare(Handle handle1, Handle handle2) {
int tab = handle1.tabIndex - handle2.tabIndex;
if (tab == 0) {
return handle1.startChar - handle2.startChar;
}
else {
return tab;
}
}
public int compare(Handle handle1, Handle handle2) {
int tab = handle1.tabIndex - handle2.tabIndex;
if (tab == 0) {
return handle1.startChar - handle2.startChar;
} else {
return tab;
}
}
}
+6 -6
View File
@@ -11,8 +11,8 @@ public class OSCSender {
{
OSCPortOut sender = new OSCPortOut(InetAddress.getByName("localhost"), port);
ArrayList<Object> args = new ArrayList<Object>();
args.add(new Integer(index));
args.add(new Float(val));
args.add(Integer.valueOf(index));
args.add(Float.valueOf(val));
OSCMessage msg = new OSCMessage("/tm_change_float", args);
try {
sender.send(msg);
@@ -25,8 +25,8 @@ public class OSCSender {
{
OSCPortOut sender = new OSCPortOut(InetAddress.getByName("localhost"), port);
ArrayList<Object> args = new ArrayList<Object>();
args.add(new Integer(index));
args.add(new Integer(val));
args.add(Integer.valueOf(index));
args.add(Integer.valueOf(val));
OSCMessage msg = new OSCMessage("/tm_change_int", args);
try {
sender.send(msg);
@@ -40,8 +40,8 @@ public class OSCSender {
{
OSCPortOut sender = new OSCPortOut(InetAddress.getByName("localhost"), port);
ArrayList<Object> args = new ArrayList<Object>();
args.add(new Integer(index));
args.add(new Long(val));
args.add(Integer.valueOf(index));
args.add(Long.valueOf(val));
OSCMessage msg = new OSCMessage("/tm_change_long", args);
try {
sender.send(msg);
@@ -0,0 +1,182 @@
package galsasson.mode.tweak;
import java.net.*;
import java.nio.ByteBuffer;
public class UDPTweakClient {
private DatagramSocket socket;
private InetAddress address;
private boolean initialized;
private int sketchPort;
static final int VAR_INT = 0;
static final int VAR_FLOAT = 1;
static final int SHUTDOWN = 0xffffffff;
public UDPTweakClient(int sketchPort)
{
this.sketchPort = sketchPort;
try {
socket = new DatagramSocket();
// only local sketch is allowed
address = InetAddress.getByName("127.0.0.1");
initialized = true;
}
catch (SocketException e) {
initialized = false;
}
catch (UnknownHostException e) {
socket.close();
initialized = false;
}
catch (SecurityException e) {
socket.close();
initialized = false;
}
}
public void shutdown()
{
if (!initialized) {
return;
}
// send shutdown to the sketch
sendShutdown();
initialized = false;
}
public boolean sendInt(int index, int val)
{
if (!initialized) {
return false;
}
try {
byte[] buf = new byte[12];
ByteBuffer bb = ByteBuffer.wrap(buf);
bb.putInt(0, VAR_INT);
bb.putInt(4, index);
bb.putInt(8, val);
DatagramPacket packet = new DatagramPacket(buf, buf.length, address, sketchPort);
socket.send(packet);
}
catch (Exception e) {
return false;
}
return true;
}
public boolean sendFloat(int index, float val)
{
if (!initialized) {
return false;
}
try {
byte[] buf = new byte[12];
ByteBuffer bb = ByteBuffer.wrap(buf);
bb.putInt(0, VAR_FLOAT);
bb.putInt(4, index);
bb.putFloat(8, val);
DatagramPacket packet = new DatagramPacket(buf, buf.length, address, sketchPort);
socket.send(packet);
}
catch (Exception e) {
return false;
}
return true;
}
public boolean sendShutdown()
{
if (!initialized) {
return false;
}
try {
byte[] buf = new byte[12];
ByteBuffer bb = ByteBuffer.wrap(buf);
bb.putInt(0, SHUTDOWN);
DatagramPacket packet = new DatagramPacket(buf, buf.length, address, sketchPort);
socket.send(packet);
}
catch (Exception e) {
return false;
}
return true;
}
public static String getServerCode(int listenPort, boolean hasInts, boolean hasFloats)
{
String serverCode = ""+
"class TweakModeServer extends Thread\n"+
"{\n"+
" protected DatagramSocket socket = null;\n"+
" protected boolean running = true;\n"+
" final int INT_VAR = 0;\n"+
" final int FLOAT_VAR = 1;\n"+
" final int SHUTDOWN = 0xffffffff;\n"+
" public TweakModeServer() {\n"+
" this(\"TweakModeServer\");\n"+
" }\n"+
" public TweakModeServer(String name) {\n"+
" super(name);\n"+
" }\n"+
" public void setup()\n"+
" {\n"+
" try {\n"+
" socket = new DatagramSocket("+listenPort+");\n"+
" socket.setSoTimeout(250);\n"+
" } catch (IOException e) {\n"+
" println(\"error: could not create TweakMode server socket\");\n"+
" }\n"+
" }\n"+
" public void run()\n"+
" {\n"+
" byte[] buf = new byte[256];\n"+
" while(running)\n"+
" {\n"+
" try {\n"+
" DatagramPacket packet = new DatagramPacket(buf, buf.length);\n"+
" socket.receive(packet);\n"+
" ByteBuffer bb = ByteBuffer.wrap(buf);\n"+
" int type = bb.getInt(0);\n"+
" int index = bb.getInt(4);\n";
if (hasInts) {
serverCode +=
" if (type == INT_VAR) {\n"+
" int val = bb.getInt(8);\n"+
" tweakmode_int[index] = val;\n"+
" }\n"+
" else ";
}
if (hasFloats) {
serverCode +=
" if (type == FLOAT_VAR) {\n"+
" float val = bb.getFloat(8);\n"+
" tweakmode_float[index] = val;\n"+
" }\n"+
" else";
}
serverCode +=
" if (type == SHUTDOWN) {\n"+
" running = false;\n"+
" }\n"+
" } catch (SocketTimeoutException e) {\n"+
" // nothing to do here just try receiving again\n"+
" } catch (Exception e) {\n"+
" }\n"+
" }\n"+
" socket.close();\n"+
" }\n"+
"}\n\n\n";
return serverCode;
}
}
@@ -21,6 +21,7 @@ import static processing.mode.experimental.ExperimentalMode.logE;
import galsasson.mode.tweak.ColorControlBox;
import galsasson.mode.tweak.Handle;
import galsasson.mode.tweak.SketchParser;
import galsasson.mode.tweak.UDPTweakClient;
import java.awt.BorderLayout;
import java.awt.CardLayout;
@@ -71,6 +72,7 @@ import processing.app.Base;
import processing.app.EditorState;
import processing.app.EditorToolbar;
import processing.app.Mode;
import processing.app.Preferences;
import processing.app.Sketch;
import processing.app.SketchCode;
import processing.app.Toolkit;
@@ -267,11 +269,6 @@ public class DebugEditor extends JavaEditor implements ActionListener {
addXQModeUI();
debugToolbarEnabled = new AtomicBoolean(false);
//log("Sketch Path: " + path);
// TweakMode code
// random port for OSC (0xff0 - 0xfff0)
oscPort = (int)(Math.random()*0xf000) + 0xff0;
}
private void addXQModeUI(){
@@ -1808,11 +1805,14 @@ public class DebugEditor extends JavaEditor implements ActionListener {
*/
//protected JCheckBoxMenuItem enableTweakCB;
public static final String prefTweakPort = "tweak.port";
public static final String prefTweakShowCode = "tweak.showcode";
String[] baseCode;
final static int SPACE_AMOUNT = 0;
int oscPort;
UDPTweakClient tweakClient;
public void startInteractiveMode()
{
@@ -1821,6 +1821,7 @@ public class DebugEditor extends JavaEditor implements ActionListener {
public void stopInteractiveMode(ArrayList<Handle> handles[])
{
tweakClient.shutdown();
ta.stopInteractiveMode();
// remove space from the code (before and after)
@@ -1893,11 +1894,11 @@ public class DebugEditor extends JavaEditor implements ActionListener {
public void updateInterface(ArrayList<Handle> handles[], ArrayList<ColorControlBox> colorBoxes[])
{
// set OSC port of handles
for (int i=0; i<handles.length; i++) {
for (Handle h : handles[i]) {
h.setOscPort(oscPort);
}
}
// for (int i=0; i<handles.length; i++) {
// for (Handle h : handles[i]) {
// h.setOscPort(oscPort);
// }
// }
ta.updateInterface(handles, colorBoxes);
}
@@ -2016,7 +2017,7 @@ public class DebugEditor extends JavaEditor implements ActionListener {
}
/**
* Replace all numbers with variables and add code to initialize these variables and handle OSC messages.
* Replace all numbers with variables and add code to initialize these variables and handle update messages.
* @param sketch
* the sketch to work on
* @param handles
@@ -2039,6 +2040,32 @@ public class DebugEditor extends JavaEditor implements ActionListener {
return false;
}
// get port number from preferences.txt
int port;
String portStr = Preferences.get(prefTweakPort);
if (portStr == null) {
Preferences.set(prefTweakPort, "auto");
portStr = "auto";
}
if (portStr.equals("auto")) {
// random port for udp (0xc000 - 0xffff)
port = (int)(Math.random()*0x3fff) + 0xc000;
}
else {
port = Preferences.getInteger(prefTweakPort);
}
/* create the client that will send the new values to the sketch */
tweakClient = new UDPTweakClient(port);
// update handles with a reference to the client object
for (int tab=0; tab<code.length; tab++) {
for (Handle h : handles[tab]) {
h.setTweakClient(tweakClient);
}
}
// Copy current program to interactive program
/* modify the code below, replace all numbers with their variable names */
@@ -2068,9 +2095,9 @@ public class DebugEditor extends JavaEditor implements ActionListener {
"\n\n";
// add needed OSC imports and the global OSC object
header += "import oscP5.*;\n";
header += "import netP5.*;\n\n";
header += "OscP5 tweakmode_oscP5;\n\n";
header += "import java.net.*;\n";
header += "import java.io.*;\n";
header += "import java.nio.*;\n\n";
// write a declaration for int and float arrays
int numOfInts = howManyInts(handles);
@@ -2081,31 +2108,11 @@ public class DebugEditor extends JavaEditor implements ActionListener {
if (numOfFloats > 0) {
header += "float[] tweakmode_float = new float["+numOfFloats+"];\n\n";
}
/* add the class for the OSC event handler that will respond to our messages */
header += "public class TweakMode_OscHandler {\n" +
" public void oscEvent(OscMessage msg) {\n" +
" String type = msg.addrPattern();\n";
if (numOfInts > 0) {
header += " if (type.contains(\"/tm_change_int\")) {\n" +
" int index = msg.get(0).intValue();\n" +
" int value = msg.get(1).intValue();\n" +
" tweakmode_int[index] = value;\n" +
" }\n";
if (numOfFloats > 0) {
header += " else ";
}
}
if (numOfFloats > 0) {
header += "if (type.contains(\"/tm_change_float\")) {\n" +
" int index = msg.get(0).intValue();\n" +
" float value = msg.get(1).floatValue();\n" +
" tweakmode_float[index] = value;\n" +
" }\n";
}
header += " }\n" +
"}\n";
header += "TweakMode_OscHandler tweakmode_oscHandler = new TweakMode_OscHandler();\n";
/* add the server code that will receive the value change messages */
header += UDPTweakClient.getServerCode(port, numOfInts>0, numOfFloats>0);
header += "TweakModeServer tweakmode_Server;\n";
header += "void tweakmode_initAllVars() {\n";
for (int i=0; i<handles.length; i++) {
@@ -2115,28 +2122,39 @@ public class DebugEditor extends JavaEditor implements ActionListener {
}
}
header += "}\n\n";
header += "void tweakmode_initOSC() {\n";
header += " tweakmode_oscP5 = new OscP5(tweakmode_oscHandler,"+oscPort+");\n";
header += "void tweakmode_initCommunication() {\n";
header += " tweakmode_Server = new TweakModeServer();\n";
header += " tweakmode_Server.setup();\n";
header += " tweakmode_Server.start();\n";
header += "}\n";
header += "\n\n\n\n\n";
// add call to our initAllVars and initOSC functions from the setup() function.
String addToSetup = "\n tweakmode_initAllVars();\n tweakmode_initOSC();\n\n";
String addToSetup = "\n"+
" tweakmode_initAllVars();\n"+
" tweakmode_initCommunication();\n\n";
setupStartPos = SketchParser.getSetupStart(c);
c = replaceString(c, setupStartPos, setupStartPos, addToSetup);
code[0].setProgram(header + c);
/* print out modified code */
// if (tweakMode.dumpModifiedCode) {
// System.out.println("\nModified code:\n");
// for (int i=0; i<code.length; i++)
// {
// System.out.println("file " + i + "\n=========");
// System.out.println(code[i].getProgram());
// }
// }
String showModCode = Preferences.get(prefTweakShowCode);
if (showModCode == null) {
Preferences.setBoolean(prefTweakShowCode, false);
}
if (Preferences.getBoolean(prefTweakShowCode)) {
System.out.println("\nTweakMode modified code:\n");
for (int i=0; i<code.length; i++)
{
System.out.println("tab " + i + "\n");
System.out.println("=======================================================\n");
System.out.println(code[i].getProgram());
}
}
return true;
}
@@ -49,15 +49,15 @@ import processing.mode.java.runner.Runner;
/**
* Experimental Mode for Processing, combines Debug Mode and XQMode and
* Experimental Mode for Processing, combines Debug Mode and XQMode and
* starts us working toward our next generation editor/debugger setup.
*/
public class ExperimentalMode extends JavaMode {
public static final boolean VERBOSE_LOGGING = true;
//public static final boolean VERBOSE_LOGGING = false;
//public static final boolean VERBOSE_LOGGING = false;
public static final int LOG_SIZE = 512 * 1024; // max log file size (in bytes)
public static boolean DEBUG = !true;
public ExperimentalMode(Base base, File folder) {
super(base, folder);
@@ -119,23 +119,23 @@ public class ExperimentalMode extends JavaMode {
//return "PDE X";
return "Java";
}
public File[] getKeywordFiles() {
return new File[] {
Base.getContentFile("modes/java/keywords.txt")
return new File[] {
Base.getContentFile("modes/java/keywords.txt")
};
}
public File getContentFile(String path) {
// workaround for #45
if (path.startsWith("application" + File.separator)) {
return new File(Base.getContentFile("modes" + File.separator + "java")
.getAbsolutePath() + File.separator + path);
File file = new File(folder, path);
if (!file.exists()) {
// check to see if it's part of the parent Java Mode
file = new File(Base.getContentFile("modes/java"), path);
}
return new File(folder, path);
return file;
}
volatile public static boolean errorCheckEnabled = true,
warningsEnabled = true, codeCompletionsEnabled = true,
debugOutputEnabled = false, errorLogsEnabled = false,
@@ -143,7 +143,7 @@ public class ExperimentalMode extends JavaMode {
defaultAutoSaveEnabled = true, // ,untitledAutoSaveEnabled;
ccTriggerEnabled = false, importSuggestEnabled = true;
public static int autoSaveInterval = 3; //in minutes
/**
* After how many typed characters, code completion is triggered
*/
@@ -155,15 +155,14 @@ public class ExperimentalMode extends JavaMode {
prefDebugOP = "pdex.dbgOutput",
prefErrorLogs = "pdex.writeErrorLogs",
prefAutoSaveInterval = "pdex.autoSaveInterval",
prefAutoSave = "pdex.autoSave.autoSaveEnabled", // prefUntitledAutoSave = "pdex.autoSave.untitledAutoSaveEnabled",
prefAutoSave = "pdex.autoSave.autoSaveEnabled", // prefUntitledAutoSave = "pdex.autoSave.untitledAutoSaveEnabled",
prefAutoSavePrompt = "pdex.autoSave.promptDisplay",
prefDefaultAutoSave = "pdex.autoSave.autoSaveByDefault",
prefCCTriggerEnabled = "pdex.ccTriggerEnabled",
prefImportSuggestEnabled = "pdex.importSuggestEnabled";
// TweakMode code (Preferences)
// // TweakMode code (Preferences)
volatile public static boolean enableTweak = false;
public static final String prefEnableTweak = "pdex.enableTweak";
public void loadPreferences() {
log("Load PDEX prefs");
@@ -180,8 +179,6 @@ public class ExperimentalMode extends JavaMode {
defaultAutoSaveEnabled = Preferences.getBoolean(prefDefaultAutoSave);
ccTriggerEnabled = Preferences.getBoolean(prefCCTriggerEnabled);
importSuggestEnabled = Preferences.getBoolean(prefImportSuggestEnabled);
// TweakMode code - not a sticky preference anymore
// enableTweak = Preferences.getBoolean(prefEnableTweak);
}
public void savePreferences() {
@@ -198,8 +195,6 @@ public class ExperimentalMode extends JavaMode {
Preferences.setBoolean(prefDefaultAutoSave, defaultAutoSaveEnabled);
Preferences.setBoolean(prefCCTriggerEnabled, ccTriggerEnabled);
Preferences.setBoolean(prefImportSuggestEnabled, importSuggestEnabled);
// TweakMode code - not a sticky preference anymore
// Preferences.setBoolean(prefEnableTweak, enableTweak);
}
public void ensurePrefsExist() {
@@ -216,7 +211,7 @@ public class ExperimentalMode extends JavaMode {
Preferences.setBoolean(prefErrorLogs, errorLogsEnabled);
if (Preferences.get(prefAutoSaveInterval) == null)
Preferences.setInteger(prefAutoSaveInterval, autoSaveInterval);
// if(Preferences.get(prefUntitledAutoSave) == null)
// if(Preferences.get(prefUntitledAutoSave) == null)
// Preferences.setBoolean(prefUntitledAutoSave,untitledAutoSaveEnabled);
if (Preferences.get(prefAutoSave) == null)
Preferences.setBoolean(prefAutoSave, autoSaveEnabled);
@@ -229,10 +224,6 @@ public class ExperimentalMode extends JavaMode {
if (Preferences.get(prefImportSuggestEnabled) == null)
Preferences.setBoolean(prefImportSuggestEnabled, importSuggestEnabled);
// TweakMode code - not a sticky preference anymore
// if (Preferences.get(prefEnableTweak) == null) {
// Preferences.setBoolean(prefEnableTweak, enableTweak);
// }
}
@@ -261,7 +252,7 @@ public class ExperimentalMode extends JavaMode {
Logger.getLogger(getClass().getName()).log(Level.WARNING, "Error loading String: {0}", attribute);
return defaultValue;
}
/**
* Load a Color value from theme.txt
@@ -280,7 +271,7 @@ public class ExperimentalMode extends JavaMode {
Logger.getLogger(ExperimentalMode.class.getName()).log(Level.WARNING, "Error loading Color: {0}", attribute);
return defaultValue;
}
protected ImageIcon classIcon, fieldIcon, methodIcon, localVarIcon;
protected void loadIcons(){
String iconPath = getContentFile("data")
@@ -290,13 +281,13 @@ public class ExperimentalMode extends JavaMode {
methodIcon = new ImageIcon(iconPath + File.separator
+ "methpub_obj.png");
fieldIcon = new ImageIcon(iconPath + File.separator
+ "field_protected_obj.png");
+ "field_protected_obj.png");
localVarIcon = new ImageIcon(iconPath + File.separator
+ "field_default_obj.png");
// log("Icons loaded");
}
public ClassLoader getJavaModeClassLoader() {
for (Mode m : base.getModeList()) {
if (m.getClass() == JavaMode.class) {
@@ -307,7 +298,7 @@ public class ExperimentalMode extends JavaMode {
// badness
return null;
}
/**
* System.out.println()
*/
@@ -315,7 +306,7 @@ public class ExperimentalMode extends JavaMode {
if(ExperimentalMode.DEBUG)
System.out.println(message);
}
/**
* System.err.println()
*/
@@ -323,7 +314,7 @@ public class ExperimentalMode extends JavaMode {
if(ExperimentalMode.DEBUG)
System.err.println(message);
}
/**
* System.out.print
*/
@@ -331,7 +322,7 @@ public class ExperimentalMode extends JavaMode {
if(ExperimentalMode.DEBUG)
System.out.print(message);
}
public String[] getIgnorable() {
return new String[] {
"applet",
@@ -343,143 +334,144 @@ public class ExperimentalMode extends JavaMode {
}
// TweakMode code
@Override
public Runner handleRun(Sketch sketch, RunnerListener listener) throws SketchException
{
if (enableTweak) {
enableTweak = false;
return handleTweakPresentOrRun(sketch, listener, false);
}
else {
/* Do the usual (JavaMode style) */
JavaBuild build = new JavaBuild(sketch);
String appletClassName = build.build(false);
if (appletClassName != null) {
final Runner runtime = new Runner(build, listener);
new Thread(new Runnable() {
public void run() {
runtime.launch(false); // this blocks until finished
}
}).start();
return runtime;
}
return null;
}
}
@Override
public Runner handleRun(Sketch sketch, RunnerListener listener) throws SketchException
{
if (enableTweak) {
enableTweak = false;
return handleTweakPresentOrRun(sketch, listener, false);
}
else {
/* Do the usual (JavaMode style) */
JavaBuild build = new JavaBuild(sketch);
String appletClassName = build.build(false);
if (appletClassName != null) {
final Runner runtime = new Runner(build, listener);
new Thread(new Runnable() {
public void run() {
runtime.launch(false); // this blocks until finished
}
}).start();
return runtime;
}
return null;
}
}
@Override
public Runner handlePresent(Sketch sketch, RunnerListener listener) throws SketchException
{
if (enableTweak) {
enableTweak = false;
return handleTweakPresentOrRun(sketch, listener, true);
}
else {
/* Do the usual (JavaMode style) */
JavaBuild build = new JavaBuild(sketch);
String appletClassName = build.build(false);
if (appletClassName != null) {
final Runner runtime = new Runner(build, listener);
new Thread(new Runnable() {
public void run() {
runtime.launch(true);
}
}).start();
return runtime;
}
return null;
}
}
@Override
public Runner handlePresent(Sketch sketch, RunnerListener listener) throws SketchException
{
if (enableTweak) {
enableTweak = false;
return handleTweakPresentOrRun(sketch, listener, true);
}
else {
/* Do the usual (JavaMode style) */
JavaBuild build = new JavaBuild(sketch);
String appletClassName = build.build(false);
if (appletClassName != null) {
final Runner runtime = new Runner(build, listener);
new Thread(new Runnable() {
public void run() {
runtime.launch(true);
}
}).start();
return runtime;
}
return null;
}
}
public Runner handleTweakPresentOrRun(Sketch sketch, RunnerListener listener, boolean present) throws SketchException
{
final DebugEditor editor = (DebugEditor)listener;
final boolean toPresent = present;
public Runner handleTweakPresentOrRun(Sketch sketch, RunnerListener listener, boolean present) throws SketchException
{
final DebugEditor editor = (DebugEditor)listener;
final boolean toPresent = present;
if (!verifyOscP5()) {
editor.deactivateRun();
return null;
}
if (!verifyOscP5()) {
editor.deactivateRun();
return null;
}
boolean launchInteractive = false;
boolean launchInteractive = false;
if (isSketchModified(sketch)) {
editor.deactivateRun();
Base.showMessage("Save", "Please save the sketch before running in Tweak Mode.");
return null;
}
if (isSketchModified(sketch)) {
editor.deactivateRun();
Base.showMessage("Save", "Please save the sketch before running in Tweak Mode.");
return null;
}
/* first try to build the unmodified code */
JavaBuild build = new JavaBuild(sketch);
String appletClassName = build.build(false);
if (appletClassName == null) {
// unmodified build failed, so fail
return null;
}
/* first try to build the unmodified code */
JavaBuild build = new JavaBuild(sketch);
String appletClassName = build.build(false);
if (appletClassName == null) {
// unmodified build failed, so fail
return null;
}
/* if compilation passed, modify the code and build again */
editor.initBaseCode();
// check for "// tweak" comment in the sketch
boolean requiresTweak = SketchParser.containsTweakComment(editor.baseCode);
// parse the saved sketch to get all (or only with "//tweak" comment) numbers
final SketchParser parser = new SketchParser(editor.baseCode, requiresTweak);
/* if compilation passed, modify the code and build again */
// save the original sketch code of the user
editor.initBaseCode();
// check for "// tweak" comment in the sketch
boolean requiresTweak = SketchParser.containsTweakComment(editor.baseCode);
// parse the saved sketch to get all (or only with "//tweak" comment) numbers
final SketchParser parser = new SketchParser(editor.baseCode, requiresTweak);
// add our code to the sketch
launchInteractive = editor.automateSketch(sketch, parser.allHandles);
// add our code to the sketch
launchInteractive = editor.automateSketch(sketch, parser.allHandles);
build = new JavaBuild(sketch);
appletClassName = build.build(false);
build = new JavaBuild(sketch);
appletClassName = build.build(false);
if (appletClassName != null) {
final Runner runtime = new Runner(build, listener);
new Thread(new Runnable() {
public void run() {
runtime.launch(toPresent); // this blocks until finished
if (appletClassName != null) {
final Runner runtime = new Runner(build, listener);
new Thread(new Runnable() {
public void run() {
runtime.launch(toPresent); // this blocks until finished
// executed when the sketch quits
editor.initEditorCode(parser.allHandles, false);
editor.stopInteractiveMode(parser.allHandles);
}
// executed when the sketch quits
editor.initEditorCode(parser.allHandles, false);
editor.stopInteractiveMode(parser.allHandles);
}
}).start();
}).start();
if (launchInteractive) {
if (launchInteractive) {
// replace editor code with baseCode
editor.initEditorCode(parser.allHandles, false);
editor.updateInterface(parser.allHandles, parser.colorBoxes);
editor.startInteractiveMode();
}
// replace editor code with baseCode
editor.initEditorCode(parser.allHandles, false);
editor.updateInterface(parser.allHandles, parser.colorBoxes);
editor.startInteractiveMode();
}
return runtime;
}
return runtime;
}
return null;
}
return null;
}
private boolean verifyOscP5()
{
for (Library l : contribLibraries) {
if (l.getName().equals("oscP5")) {
return true;
}
}
private boolean verifyOscP5()
{
for (Library l : contribLibraries) {
if (l.getName().equals("oscP5")) {
return true;
}
}
// could not find oscP5 library
Base.showWarning("Tweak Mode", "Tweak Mode needs the 'oscP5' library.\n"
+ "Please install this library by clicking \"Sketch --> Import Library --> Add Library ...\" and choose 'ocsP5'", null);
// could not find oscP5 library
Base.showWarning("Tweak Mode", "Tweak Mode needs the 'oscP5' library.\n"
+ "Please install this library by clicking \"Sketch --> Import Library --> Add Library ...\" and choose 'ocsP5'", null);
return false;
}
return false;
}
private boolean isSketchModified(Sketch sketch)
{
for (SketchCode sc : sketch.getCode()) {
if (sc.isModified()) {
return true;
}
}
return false;
}
private boolean isSketchModified(Sketch sketch)
{
for (SketchCode sc : sketch.getCode()) {
if (sc.isModified()) {
return true;
}
}
return false;
}
}
+49 -121
View File
@@ -1,111 +1,52 @@
0230 pde (3.0a3)
X remove toolbar buttons except for start/stop
X rename sketchbook tree name, re-order menu, add language hooks
X split Preferences and PreferencesFrame
X https://github.com/processing/processing/issues/68
X http://code.google.com/p/processing/issues/detail?id=29
X https://github.com/processing/processing/pull/2716
X shouldn't write sketch.properties unless it's a non-default mode
X https://github.com/processing/processing/issues/2531
_ Fix OS X menu to be the same order as the other File menu
_ remove toolbar menu references and code to rebuild
gsoc
X fixes for mode/tool installation
X https://github.com/processing/processing/pull/2705
X fix mode updating to work properly
X https://github.com/processing/processing/issues/2579
X contrib manager temp folders not always deleting
X https://github.com/processing/processing/issues/2606
X problem when removing a mode
X https://github.com/processing/processing/issues/2507
X autocompletion dialog box sticking
X https://github.com/processing/processing/issues/2741
X Line warning indicators next to scrollbar break after moving around text
X https://github.com/processing/processing/issues/2655
X Code completion generates wrong code
X https://github.com/processing/processing/issues/2753
X Code completion: Hide overloaded methods unless inside parentheses
X https://github.com/processing/processing/issues/2755
X Close auto-completion suggestion box when deleting/backspacing code
X https://github.com/processing/processing/issues/2757
_ remove dependency on oscp5 library for tweak mode
_ https://github.com/processing/processing/issues/2730
0231 pde (3.0a4)
X add new download redirect for contribs.txt
X https://github.com/processing/processing/issues/2850
X contribs for 3.0 need to come from a different location
X https://github.com/processing/processing/issues/2849
X add the separate contribs.txt link on download.processing.org
X fix inside ContributionListing.java
X change default mode handling to use experimental as the default
X remove isDefaultMode(), since it was doing the wrong thing
X make a new preference setting for the default mode
X this will set folks to the PDE X mode, and prevent conflicts w/ 2.0
X change last.sketch.mode to mode.last
X fix OS X default File menu to be the same order as the other File menu
X TGAs from saveFrame() create transparent/black movies with Movie Maker
X https://github.com/processing/processing/issues/2851
X fix export problem on Windows with PDE X
X https://github.com/processing/processing/issues/2806
pulls
X Add polling to detect file system changes
X https://github.com/processing/processing/issues/1939
X https://github.com/processing/processing/pull/2628
X huge i18n patch
X https://github.com/processing/processing/issues/632
X https://github.com/processing/processing/pull/2084
X http://code.google.com/p/processing/issues/detail?id=593
X need to make sure the .properties files are read properly as UTF-8
X Indent breaks when hitting enter before spaces
X https://github.com/processing/processing/issues/2004
X https://github.com/processing/processing/pull/2690
X Localize status messages and contributions panel
X https://github.com/processing/processing/pull/2696
X prevent adding files to read-only sketches
X https://github.com/processing/processing/issues/2459
X https://github.com/processing/processing/pull/2697
X Added some helper methods to Language
X https://github.com/processing/processing/pull/2704
X More i18n updates
X https://github.com/processing/processing/pull/2725
X Add thread names for easier debugging and profiling
X https://github.com/processing/processing/pull/2729
X Add missing translations for OS X menu
X https://github.com/processing/processing/pull/2726
X fix firstLine when modifying lines above it
X https://github.com/processing/processing/issues/2654
X https://github.com/processing/processing/pull/2674
X Style completion panel when using Nimbus LAF
X https://github.com/processing/processing/pull/2718
X enums not supported properly
X https://github.com/processing/processing/issues/1390
X http://code.google.com/p/processing/issues/detail?id=1352
X https://github.com/processing/processing/pull/2774
X combining char/int/etc casts in one statement causes preproc trouble
X https://github.com/processing/processing/issues/1936
X https://github.com/processing/processing/pull/2772
X Update contributions.* strings to contrib
X https://github.com/processing/processing/pull/2770
X Style completion panel on windows
X https://github.com/processing/processing/pull/2762
X Update Spanish language strings
X https://github.com/processing/processing/pull/2769
X make --output optional in the command line version
X https://github.com/processing/processing/pull/1866
X https://github.com/processing/processing/issues/1855
X https://github.com/processing/processing/issues/1816
X Fix unneeded scroll bar display in code completion suggestion box
X https://github.com/processing/processing/pull/2763
X Optimize creation of boxed primitives
X https://github.com/processing/processing/pull/2826
X Add static modifier to inner classes that don't access parent
X https://github.com/processing/processing/pull/2839
X Fix localization in OS X (requires writing property files)
X https://github.com/processing/processing/pull/2844
_ PDE erroneously detects changes in non-sketch files
_ https://github.com/processing/processing/issues/2759
cleaning
X single line of code with no semicolon dies with "unexpected token: null"
X http://code.google.com/p/processing/issues/detail?id=1312
X https://github.com/processing/processing/issues/1350
X closed by Dan post-3.0a3
X move sketchbook into its own window
X move recent into the sketchbook menu
X try installing 10.7.3 on Mac Mini and check whether things run
X make sure it's only running on 64-bit machines?
languages
X Japanese https://github.com/processing/processing/pull/2688
X Spanish https://github.com/processing/processing/pull/2691
X Dutch https://github.com/processing/processing/pull/2694
X French https://github.com/processing/processing/pull/2695
X Portugese https://github.com/processing/processing/pull/2701
X Korean https://github.com/processing/processing/commit/7b60e2ded9ca81f6a5a08a818aaf84ee4bb029e3
X Turkish https://github.com/processing/processing/pull/2740
X Chinese https://github.com/processing/processing/pull/2748
earlier
X repo cleanup
X remove non-web stuff from web
X remove non-android stuff from android
X remove web and android from the main repo
X separate prefs and sketch state info?
X this would mean prefs being rewritten far less
pulls
_ Add support for localizing contributions
_ https://github.com/processing/processing/pull/2833
_ Fix renaming from RGB to Rgb.java and others
_ https://github.com/processing/processing/pull/2825
_ check on pull for mnemonics
_ https://github.com/processing/processing/pull/2382
high
_ "Your sketch has been modified externally" appear without reason
_ https://github.com/processing/processing/issues/2852
_ export application ubuntu -> windows not working (2.2.1)
_ https://github.com/processing/processing/issues/2698
_ might be something with libraries (native or otherwise)
@@ -127,6 +68,9 @@ _ https://github.com/processing/processing/issues/1898
gsoc/help me
X remove dependency on oscp5 library for tweak mode
_ https://github.com/processing/processing/issues/2730
X https://github.com/processing/processing/pull/2808
_ `return` keyword not treated as such when followed by a bracket
_ https://github.com/processing/processing/issues/2099
_ IllegalArgumentException when clicking between editor windows
@@ -135,10 +79,6 @@ _ "String index out of range" error
_ https://github.com/processing/processing/issues/1940
_ closing the color selector makes things freeze (only Linux and Windows?)
_ https://github.com/processing/processing/issues/2381
_ move sketchbook into its own window
_ move recent into the sketchbook menu
_ needs to recognize the p5 app folder
_ also should recognize the user's home dir
_ incorporate new preproc
_ https://github.com/fjenett/processing-preprocessor-antlr4
_ SOCKS proxy not working:
@@ -155,6 +95,11 @@ _ https://github.com/processing/processing/issues/2199
medium
_ remove toolbar menu references and code to rebuild
_ fix single instance server on OS X to load double-clicked files
_ when run from Eclipse, the single instance thing punts
_ 'recent' menu needs to recognize the p5 app folder
_ also should recognize the user's home dir
_ possibility of libraries folder inside a particular sketch?
_ display "1" is not correct in 2.1.2
_ https://github.com/processing/processing/issues/2502
@@ -168,8 +113,6 @@ _ should default to the local Java on Windows and Linux
_ have export apps default to the local JRE
_ Linux is probably using the system JRE if available
_ launch4j may be all set, but double-check
_ try installing 10.7.3 on Mac Mini and check whether things run
_ make sure it's only running on 64-bit machines?
_ use platformDelete() to remove untitled sketches?
_ would allow us to use the /tmp folder
_ change to using platformDelete() instead of Base.removeDir() where possible
@@ -396,10 +339,6 @@ _ http://www.javalobby.org/java/forums/t19012.html
PDE / Compiler & Preprocessor
need examples
_ Improve detection and handling of missing semicolons
_ http://code.google.com/p/processing/issues/detail?id=136
medium (bugs/features)
_ modify build to insert these after antlr run:
_ @SuppressWarnings({"unused", "cast"})
@@ -413,9 +352,6 @@ _ e.g. no setup()/draw() block
_ don't allow "for (blah; blah; blah) ;"
_ or if (blah blah blah) ;
_ it's never useful. students can use { } if they want an empty block
_ missing brackets, unmatched brackets
_ examples added to the bug report
_ http://code.google.com/p/processing/issues/detail?id=6
low (features)
_ copy running code from /tmp/buildXXxxx on crash of p5
@@ -441,14 +377,6 @@ _ http://code.google.com/p/processing/issues/detail?id=54
_ "unexpected token" on anonymous instance of parameterized Comparator
_ http://code.google.com/p/processing/issues/detail?id=494
low (better error messages)
_ single line of code with no semicolon dies with "unexpected token: null"
_ http://code.google.com/p/processing/issues/detail?id=1312
_ if 'void' left out before loop or setup, cryptic message about
_ 'constructor loop must be named Temporary_23498_2343'
_ add a better handler for this specific thing?
_ http://code.google.com/p/processing/issues/detail?id=8
PDE / Editor