mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-16 11:21:18 +03:00
Syncing with Processing 1.0.9 (revision 5766).
This commit is contained in:
@ -180,71 +180,7 @@ public class Base {
|
|||||||
// setup the theme coloring fun
|
// setup the theme coloring fun
|
||||||
Theme.init();
|
Theme.init();
|
||||||
|
|
||||||
if (Base.isMacOS()) {
|
|
||||||
String properMenuBar = "apple.laf.useScreenMenuBar";
|
|
||||||
String menubar = Preferences.get(properMenuBar);
|
|
||||||
if (menubar != null) {
|
|
||||||
// Get the current menu bar setting and use it
|
|
||||||
System.setProperty(properMenuBar, menubar);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
// 10.4 is not affected, 10.5 (and prolly 10.6) are
|
|
||||||
if (System.getProperty("os.version").startsWith("10.4")) {
|
|
||||||
// Don't bother checking next time
|
|
||||||
Preferences.set(properMenuBar, "true");
|
|
||||||
// Also set the menubar now
|
|
||||||
System.setProperty(properMenuBar, "true");
|
|
||||||
|
|
||||||
} else {
|
|
||||||
// Running 10.5 or 10.6 or whatever, give 'em the business
|
|
||||||
String warning =
|
|
||||||
"<html>" +
|
|
||||||
"<head> <style type=\"text/css\">"+
|
|
||||||
"b { font: 13pt \"Lucida Grande\" }"+
|
|
||||||
"p { font: 11pt \"Lucida Grande\"; margin-top: 8px }"+
|
|
||||||
"</style> </head> <body>" +
|
|
||||||
"<b>Some menus have been disabled.</b>" +
|
|
||||||
"<p>Due to an Apple bug, the Sketchbook and Example menus " +
|
|
||||||
"are unusable. <br>" +
|
|
||||||
"As a workaround, these items will be disabled from the " +
|
|
||||||
"standard menu bar, <br>" +
|
|
||||||
"but you can use the Open button on " +
|
|
||||||
"the toolbar to access the same items. <br>" +
|
|
||||||
"If this bug makes you sad, " +
|
|
||||||
"please contact Apple via bugreporter.apple.com.</p>" +
|
|
||||||
"</body> </html>";
|
|
||||||
Object[] options = { "OK", "More Info" };
|
|
||||||
int result = JOptionPane.showOptionDialog(new Frame(),
|
|
||||||
warning,
|
|
||||||
"Menu Bar Problem",
|
|
||||||
JOptionPane.YES_NO_OPTION,
|
|
||||||
JOptionPane.WARNING_MESSAGE,
|
|
||||||
null,
|
|
||||||
options,
|
|
||||||
options[0]);
|
|
||||||
if (result == -1) {
|
|
||||||
// They hit ESC or closed the window, so just hide it for now
|
|
||||||
// But don't bother setting the preference in the file
|
|
||||||
} else {
|
|
||||||
// Shut off in the preferences for next time
|
|
||||||
//Preferences.set(properMenuBar, "false");
|
|
||||||
// For 1.0.4, we'll stick with the Apple menu bar,
|
|
||||||
// and just disable the sketchbook and examples sub-menus.
|
|
||||||
Preferences.set(properMenuBar, "true");
|
|
||||||
if (result == 1) { // More Info
|
|
||||||
Base.openURL("http://dev.processing.org/bugs/show_bug.cgi?id=786");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Whether or not canceled, set to false (right now) if we're on 10.5
|
|
||||||
//System.setProperty(properMenuBar, "false");
|
|
||||||
// Changing this behavior for 1.0.4
|
|
||||||
System.setProperty(properMenuBar, "true");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set the look and feel before opening the window
|
// Set the look and feel before opening the window
|
||||||
// For 0158, moving it lower so that the apple.laf.useScreenMenuBar stuff works
|
|
||||||
try {
|
try {
|
||||||
platform.setLookAndFeel();
|
platform.setLookAndFeel();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@ -815,7 +751,8 @@ public class Base {
|
|||||||
*/
|
*/
|
||||||
public boolean handleClose(Editor editor) {
|
public boolean handleClose(Editor editor) {
|
||||||
// Check if modified
|
// Check if modified
|
||||||
if (!editor.checkModified(false)) {
|
boolean immediate = editors.size() == 1;
|
||||||
|
if (!editor.checkModified(immediate)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -993,17 +930,9 @@ public class Base {
|
|||||||
protected void rebuildSketchbookMenu(JMenu menu) {
|
protected void rebuildSketchbookMenu(JMenu menu) {
|
||||||
//System.out.println("rebuilding sketchbook menu");
|
//System.out.println("rebuilding sketchbook menu");
|
||||||
//new Exception().printStackTrace();
|
//new Exception().printStackTrace();
|
||||||
//boolean nativeButBroken = Base.isMacOS() ?
|
|
||||||
//Preferences.getBoolean("apple.laf.useScreenMenuBar") : false;
|
|
||||||
boolean nativeButBroken = false;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (nativeButBroken) { // osx workaround
|
|
||||||
menu.setEnabled(false);
|
|
||||||
} else {
|
|
||||||
menu.removeAll();
|
menu.removeAll();
|
||||||
addSketches(menu, getSketchbookFolder(), false);
|
addSketches(menu, getSketchbookFolder(), false);
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@ -1045,21 +974,13 @@ public class Base {
|
|||||||
|
|
||||||
public void rebuildExamplesMenu(JMenu menu) {
|
public void rebuildExamplesMenu(JMenu menu) {
|
||||||
//System.out.println("rebuilding examples menu");
|
//System.out.println("rebuilding examples menu");
|
||||||
//boolean nativeButBroken = Base.isMacOS() ?
|
|
||||||
//Preferences.getBoolean("apple.laf.useScreenMenuBar") : false;
|
|
||||||
boolean nativeButBroken = false;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (nativeButBroken) { // osx workaround
|
menu.removeAll();
|
||||||
menu.setEnabled(false);
|
boolean found = addSketches(menu, examplesFolder, false);
|
||||||
} else {
|
if (found) menu.addSeparator();
|
||||||
menu.removeAll();
|
found = addSketches(menu, getSketchbookLibrariesFolder(), false);
|
||||||
boolean found = addSketches(menu, examplesFolder, false);
|
if (found) menu.addSeparator();
|
||||||
if (found) menu.addSeparator();
|
addSketches(menu, librariesFolder, false);
|
||||||
found = addSketches(menu, getSketchbookLibrariesFolder(), false);
|
|
||||||
if (found) menu.addSeparator();
|
|
||||||
addSketches(menu, librariesFolder, false);
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@ -1965,56 +1886,30 @@ public class Base {
|
|||||||
* Grab the contents of a file as a string.
|
* Grab the contents of a file as a string.
|
||||||
*/
|
*/
|
||||||
static public String loadFile(File file) throws IOException {
|
static public String loadFile(File file) throws IOException {
|
||||||
return PApplet.join(PApplet.loadStrings(file), "\n");
|
String[] contents = PApplet.loadStrings(file);
|
||||||
|
if (contents == null) return null;
|
||||||
/*
|
return PApplet.join(contents, "\n");
|
||||||
// empty code file.. no worries, might be getting filled up later
|
|
||||||
if (file.length() == 0) return "";
|
|
||||||
|
|
||||||
//FileInputStream fis = new FileInputStream(file);
|
|
||||||
//InputStreamReader isr = new InputStreamReader(fis, "UTF-8");
|
|
||||||
//BufferedReader reader = new BufferedReader(isr);
|
|
||||||
BufferedReader reader = PApplet.createReader(file);
|
|
||||||
|
|
||||||
StringBuffer buffer = new StringBuffer();
|
|
||||||
String line = null;
|
|
||||||
while ((line = reader.readLine()) != null) {
|
|
||||||
// char[] cc = line.toCharArray();
|
|
||||||
// for (int i = 0; i < cc.length; i++) {
|
|
||||||
// char c = cc[i];
|
|
||||||
// if (c < 32 || c > 126) System.out.println("found " + c + " " + ((int) c));
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
buffer.append(line);
|
|
||||||
buffer.append('\n');
|
|
||||||
}
|
}
|
||||||
reader.close();
|
|
||||||
return buffer.toString();
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Spew the contents of a String object out to a file.
|
* Spew the contents of a String object out to a file.
|
||||||
*/
|
*/
|
||||||
static public void saveFile(String str, File file) throws IOException {
|
static public void saveFile(String str, File file) throws IOException {
|
||||||
PApplet.saveStrings(file, new String[] { str });
|
File temp = File.createTempFile(file.getName(), null, file.getParentFile());
|
||||||
/*
|
PApplet.saveStrings(temp, new String[] { str });
|
||||||
ByteArrayInputStream bis = new ByteArrayInputStream(str.getBytes());
|
if (file.exists()) {
|
||||||
InputStreamReader isr = new InputStreamReader(bis);
|
boolean result = file.delete();
|
||||||
BufferedReader reader = new BufferedReader(isr);
|
if (!result) {
|
||||||
|
throw new IOException("Could not remove old version of " +
|
||||||
FileOutputStream fos = new FileOutputStream(file);
|
file.getAbsolutePath());
|
||||||
OutputStreamWriter osw = new OutputStreamWriter(fos, "UTF-8");
|
}
|
||||||
PrintWriter writer = new PrintWriter(osw);
|
}
|
||||||
|
boolean result = temp.renameTo(file);
|
||||||
String line = null;
|
if (!result) {
|
||||||
while ((line = reader.readLine()) != null) {
|
throw new IOException("Could not replace " +
|
||||||
writer.println(line);
|
file.getAbsolutePath());
|
||||||
}
|
}
|
||||||
writer.flush();
|
|
||||||
writer.close();
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -114,6 +114,9 @@ public class Editor extends JFrame implements RunnerListener {
|
|||||||
|
|
||||||
EditorLineStatus lineStatus;
|
EditorLineStatus lineStatus;
|
||||||
|
|
||||||
|
boolean newEditor = true;
|
||||||
|
JEditorPane editorPane;
|
||||||
|
|
||||||
JEditTextArea textarea;
|
JEditTextArea textarea;
|
||||||
EditorListener listener;
|
EditorListener listener;
|
||||||
|
|
||||||
@ -229,7 +232,22 @@ public class Editor extends JFrame implements RunnerListener {
|
|||||||
lineStatus = new EditorLineStatus(textarea);
|
lineStatus = new EditorLineStatus(textarea);
|
||||||
consolePanel.add(lineStatus, BorderLayout.SOUTH);
|
consolePanel.add(lineStatus, BorderLayout.SOUTH);
|
||||||
|
|
||||||
|
// if (newEditor) {
|
||||||
|
// try {
|
||||||
|
// setupEditorPane();
|
||||||
|
// upper.add(editorPane);
|
||||||
|
// } catch (Exception e1) {
|
||||||
|
// PrintWriter w = PApplet.createWriter(new File("/Users/fry/Desktop/blah.txt"));
|
||||||
|
// w.println(e1.getMessage());
|
||||||
|
// e1.printStackTrace(w);
|
||||||
|
// w.flush();
|
||||||
|
// w.close();
|
||||||
|
//// e1.printStackTrace());
|
||||||
|
//// e1.printStackTrace(System.out);
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
upper.add(textarea);
|
upper.add(textarea);
|
||||||
|
// }
|
||||||
splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT,
|
splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT,
|
||||||
upper, consolePanel);
|
upper, consolePanel);
|
||||||
|
|
||||||
@ -345,6 +363,46 @@ public class Editor extends JFrame implements RunnerListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
// http://wiki.netbeans.org/DevFaqEditorCodeCompletionAnyJEditorPane
|
||||||
|
void setupEditorPane() throws IOException {
|
||||||
|
editorPane = new JEditorPane();
|
||||||
|
|
||||||
|
// This will find the Java editor kit and associate it with
|
||||||
|
// our editor pane. But that does not give us code completion
|
||||||
|
// just yet because we have no Java context (i.e. no class path, etc.).
|
||||||
|
// However, this does give us syntax coloring.
|
||||||
|
EditorKit kit = CloneableEditorSupport.getEditorKit("text/x-java");
|
||||||
|
editorPane.setEditorKit(kit);
|
||||||
|
|
||||||
|
// You can specify any ".java" file.
|
||||||
|
// If the file does not exist, it will be created.
|
||||||
|
// The contents of the file does not matter.
|
||||||
|
// The extension must be ".java", however.
|
||||||
|
// String newSourcePath = "/Users/fry/Desktop/tmp.java";
|
||||||
|
|
||||||
|
// File tmpFile = new File(newSourcePath);
|
||||||
|
// System.out.println(tmpFile.getParent() + " " + tmpFile.getName());
|
||||||
|
// FileObject fob = FileUtil.createData(tmpFile);
|
||||||
|
File tmpFile = File.createTempFile("temp", ".java");
|
||||||
|
FileObject fob = FileUtil.toFileObject(FileUtil.normalizeFile(tmpFile));
|
||||||
|
|
||||||
|
DataObject dob = DataObject.find(fob);
|
||||||
|
editorPane.getDocument().putProperty(Document.StreamDescriptionProperty, dob);
|
||||||
|
|
||||||
|
// This sets up a default class path for us so that
|
||||||
|
// we can find all the JDK classes via code completion.
|
||||||
|
DialogBinding.bindComponentToFile(fob, 0, 0, editorPane);
|
||||||
|
|
||||||
|
// Last but not least, we need to fill the editor pane with
|
||||||
|
// some initial dummy code - as it seems somehow required to
|
||||||
|
// kick-start code completion.
|
||||||
|
// A simple dummy package declaration will do.
|
||||||
|
editorPane.setText("package dummy;");
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
protected void setPlacement(int[] location) {
|
protected void setPlacement(int[] location) {
|
||||||
setBounds(location[0], location[1], location[2], location[3]);
|
setBounds(location[0], location[1], location[2], location[3]);
|
||||||
if (location[4] != 0) {
|
if (location[4] != 0) {
|
||||||
@ -859,6 +917,13 @@ public class Editor extends JFrame implements RunnerListener {
|
|||||||
menu.add(createToolMenuItem("processing.app.tools.Archiver"));
|
menu.add(createToolMenuItem("processing.app.tools.Archiver"));
|
||||||
menu.add(createToolMenuItem("processing.app.tools.FixEncoding"));
|
menu.add(createToolMenuItem("processing.app.tools.FixEncoding"));
|
||||||
|
|
||||||
|
/*
|
||||||
|
//menu.add(createToolMenuItem("processing.app.tools.android.Build"));
|
||||||
|
item = createToolMenuItem("processing.app.tools.android.Build");
|
||||||
|
item.setAccelerator(KeyStroke.getKeyStroke('D', modifiers));
|
||||||
|
menu.add(item);
|
||||||
|
*/
|
||||||
|
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,6 +34,8 @@ import processing.app.syntax.*;
|
|||||||
import processing.core.*;
|
import processing.core.*;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Storage class for user preferences and environment settings.
|
* Storage class for user preferences and environment settings.
|
||||||
* <P>
|
* <P>
|
||||||
@ -68,13 +70,6 @@ public class Preferences {
|
|||||||
static final String PREFS_FILE = "preferences.txt";
|
static final String PREFS_FILE = "preferences.txt";
|
||||||
|
|
||||||
|
|
||||||
// platform strings (used to get settings for specific platforms)
|
|
||||||
|
|
||||||
//static final String platforms[] = {
|
|
||||||
// "other", "windows", "macosx", "linux"
|
|
||||||
//};
|
|
||||||
|
|
||||||
|
|
||||||
// prompt text stuff
|
// prompt text stuff
|
||||||
|
|
||||||
static final String PROMPT_YES = "Yes";
|
static final String PROMPT_YES = "Yes";
|
||||||
@ -97,12 +92,6 @@ public class Preferences {
|
|||||||
* inside a static block.
|
* inside a static block.
|
||||||
*/
|
*/
|
||||||
static public int BUTTON_HEIGHT = 24;
|
static public int BUTTON_HEIGHT = 24;
|
||||||
/*
|
|
||||||
// remove this for 0121, because quaqua takes care of it
|
|
||||||
static {
|
|
||||||
if (Base.isMacOS()) BUTTON_HEIGHT = 29;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
// value for the size bars, buttons, etc
|
// value for the size bars, buttons, etc
|
||||||
|
|
||||||
@ -125,14 +114,12 @@ public class Preferences {
|
|||||||
JTextField sketchbookLocationField;
|
JTextField sketchbookLocationField;
|
||||||
JCheckBox exportSeparateBox;
|
JCheckBox exportSeparateBox;
|
||||||
JCheckBox deletePreviousBox;
|
JCheckBox deletePreviousBox;
|
||||||
// JCheckBox closingLastQuitsBox;
|
|
||||||
JCheckBox externalEditorBox;
|
JCheckBox externalEditorBox;
|
||||||
JCheckBox memoryOverrideBox;
|
JCheckBox memoryOverrideBox;
|
||||||
JTextField memoryField;
|
JTextField memoryField;
|
||||||
JCheckBox checkUpdatesBox;
|
JCheckBox checkUpdatesBox;
|
||||||
JTextField fontSizeField;
|
JTextField fontSizeField;
|
||||||
JCheckBox autoAssociateBox;
|
JCheckBox autoAssociateBox;
|
||||||
JCheckBox menubarWorkaroundBox;
|
|
||||||
|
|
||||||
|
|
||||||
// the calling editor, so updates can be applied
|
// the calling editor, so updates can be applied
|
||||||
@ -142,9 +129,9 @@ public class Preferences {
|
|||||||
|
|
||||||
// data model
|
// data model
|
||||||
|
|
||||||
static HashMap<String,String> defaults;
|
static Hashtable defaults;
|
||||||
static HashMap<String,String> table = new HashMap<String,String>();;
|
static Hashtable table = new Hashtable();;
|
||||||
static HashMap<String,HashMap<String,String>> prefixes = new HashMap<String,HashMap<String,String>>();
|
static Hashtable prefixes = new Hashtable();
|
||||||
static File preferencesFile;
|
static File preferencesFile;
|
||||||
|
|
||||||
|
|
||||||
@ -159,8 +146,22 @@ public class Preferences {
|
|||||||
"You'll need to reinstall Arduino.", e);
|
"You'll need to reinstall Arduino.", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// check for platform-specific properties in the defaults
|
||||||
|
String platformExt = "." + PConstants.platformNames[PApplet.platform];
|
||||||
|
int platformExtLength = platformExt.length();
|
||||||
|
Enumeration e = table.keys();
|
||||||
|
while (e.hasMoreElements()) {
|
||||||
|
String key = (String) e.nextElement();
|
||||||
|
if (key.endsWith(platformExt)) {
|
||||||
|
// this is a key specific to a particular platform
|
||||||
|
String actualKey = key.substring(0, key.length() - platformExtLength);
|
||||||
|
String value = get(key);
|
||||||
|
table.put(actualKey, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// clone the hash table
|
// clone the hash table
|
||||||
defaults = (HashMap<String, String>) table.clone();
|
defaults = (Hashtable) table.clone();
|
||||||
|
|
||||||
// other things that have to be set explicitly for the defaults
|
// other things that have to be set explicitly for the defaults
|
||||||
setColor("run.window.bgcolor", SystemColor.control);
|
setColor("run.window.bgcolor", SystemColor.control);
|
||||||
@ -197,14 +198,6 @@ public class Preferences {
|
|||||||
" and restart Arduino.", ex);
|
" and restart Arduino.", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Theme settings always override preferences
|
|
||||||
// try {
|
|
||||||
// load(Base.getStream("theme/theme.txt"));
|
|
||||||
// } catch (Exception te) {
|
|
||||||
// Base.showError(null, "Could not read color theme settings.\n" +
|
|
||||||
// "You'll need to reinstall Processing.", te);
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -250,43 +243,6 @@ public class Preferences {
|
|||||||
int h, vmax;
|
int h, vmax;
|
||||||
|
|
||||||
|
|
||||||
// [ ] Quit after closing last sketch window
|
|
||||||
/*
|
|
||||||
closingLastQuitsBox =
|
|
||||||
new JCheckBox("Quit after closing last sketch window");
|
|
||||||
pain.add(closingLastQuitsBox);
|
|
||||||
d = closingLastQuitsBox.getPreferredSize();
|
|
||||||
closingLastQuitsBox.setBounds(left, top, d.width + 10, d.height);
|
|
||||||
right = Math.max(right, left + d.width);
|
|
||||||
top += d.height + GUI_BETWEEN;
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
// [ ] Prompt for name and folder when creating new sketch
|
|
||||||
|
|
||||||
sketchPromptBox =
|
|
||||||
new JCheckBox("Prompt for name when opening or creating a sketch");
|
|
||||||
pain.add(sketchPromptBox);
|
|
||||||
d = sketchPromptBox.getPreferredSize();
|
|
||||||
sketchPromptBox.setBounds(left, top, d.width + 10, d.height);
|
|
||||||
right = Math.max(right, left + d.width);
|
|
||||||
top += d.height + GUI_BETWEEN;
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
// [ ] Delete empty sketches on Quit
|
|
||||||
|
|
||||||
/*
|
|
||||||
sketchCleanBox = new JCheckBox("Delete empty sketches on Quit");
|
|
||||||
pain.add(sketchCleanBox);
|
|
||||||
d = sketchCleanBox.getPreferredSize();
|
|
||||||
sketchCleanBox.setBounds(left, top, d.width + 10, d.height);
|
|
||||||
right = Math.max(right, left + d.width);
|
|
||||||
top += d.height + GUI_BETWEEN;
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
// Sketchbook location:
|
// Sketchbook location:
|
||||||
// [...............................] [ Browse ]
|
// [...............................] [ Browse ]
|
||||||
|
|
||||||
@ -303,17 +259,6 @@ public class Preferences {
|
|||||||
button = new JButton(PROMPT_BROWSE);
|
button = new JButton(PROMPT_BROWSE);
|
||||||
button.addActionListener(new ActionListener() {
|
button.addActionListener(new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
/*
|
|
||||||
JFileChooser fc = new JFileChooser();
|
|
||||||
fc.setSelectedFile(new File(sketchbookLocationField.getText()));
|
|
||||||
fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
|
|
||||||
|
|
||||||
int returned = fc.showOpenDialog(new JDialog());
|
|
||||||
if (returned == JFileChooser.APPROVE_OPTION) {
|
|
||||||
File file = fc.getSelectedFile();
|
|
||||||
sketchbookLocationField.setText(file.getAbsolutePath());
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
File dflt = new File(sketchbookLocationField.getText());
|
File dflt = new File(sketchbookLocationField.getText());
|
||||||
File file =
|
File file =
|
||||||
Base.selectFolder("Select new sketchbook location", dflt, dialog);
|
Base.selectFolder("Select new sketchbook location", dflt, dialog);
|
||||||
@ -327,13 +272,9 @@ public class Preferences {
|
|||||||
|
|
||||||
// take max height of all components to vertically align em
|
// take max height of all components to vertically align em
|
||||||
vmax = Math.max(d.height, d2.height);
|
vmax = Math.max(d.height, d2.height);
|
||||||
//label.setBounds(left, top + (vmax-d.height)/2,
|
|
||||||
// d.width, d.height);
|
|
||||||
|
|
||||||
//h = left + d.width + GUI_BETWEEN;
|
|
||||||
sketchbookLocationField.setBounds(left, top + (vmax-d.height)/2,
|
sketchbookLocationField.setBounds(left, top + (vmax-d.height)/2,
|
||||||
d.width, d.height);
|
d.width, d.height);
|
||||||
h = left + d.width + GUI_SMALL; //GUI_BETWEEN;
|
h = left + d.width + GUI_SMALL;
|
||||||
button.setBounds(h, top + (vmax-d2.height)/2,
|
button.setBounds(h, top + (vmax-d2.height)/2,
|
||||||
d2.width, d2.height);
|
d2.width, d2.height);
|
||||||
|
|
||||||
@ -402,22 +343,6 @@ public class Preferences {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// [ ] Place menu bar inside
|
|
||||||
|
|
||||||
if (Base.isMacOS()) {
|
|
||||||
if (System.getProperty("os.version").startsWith("10.5")) {
|
|
||||||
menubarWorkaroundBox =
|
|
||||||
new JCheckBox("Place menus inside editor window to avoid " +
|
|
||||||
"Apple Java bug (requires restart)");
|
|
||||||
pain.add(menubarWorkaroundBox);
|
|
||||||
d = menubarWorkaroundBox.getPreferredSize();
|
|
||||||
menubarWorkaroundBox.setBounds(left, top, d.width + 10, d.height);
|
|
||||||
right = Math.max(right, left + d.width);
|
|
||||||
top += d.height + GUI_BETWEEN;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// More preferences are in the ...
|
// More preferences are in the ...
|
||||||
|
|
||||||
label = new JLabel("More preferences can be edited directly in the file");
|
label = new JLabel("More preferences can be edited directly in the file");
|
||||||
@ -491,7 +416,6 @@ public class Preferences {
|
|||||||
|
|
||||||
wide = right + GUI_BIG;
|
wide = right + GUI_BIG;
|
||||||
high = top + GUI_SMALL;
|
high = top + GUI_SMALL;
|
||||||
//setSize(wide, high);
|
|
||||||
|
|
||||||
|
|
||||||
// closing the window is same as hitting cancel button
|
// closing the window is same as hitting cancel button
|
||||||
@ -535,26 +459,6 @@ public class Preferences {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
protected JRootPane createRootPane() {
|
|
||||||
System.out.println("creating root pane esc received");
|
|
||||||
|
|
||||||
ActionListener actionListener = new ActionListener() {
|
|
||||||
public void actionPerformed(ActionEvent actionEvent) {
|
|
||||||
//setVisible(false);
|
|
||||||
System.out.println("esc received");
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
JRootPane rootPane = new JRootPane();
|
|
||||||
KeyStroke stroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);
|
|
||||||
rootPane.registerKeyboardAction(actionListener, stroke,
|
|
||||||
JComponent.WHEN_IN_FOCUSED_WINDOW);
|
|
||||||
return rootPane;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
public Dimension getPreferredSize() {
|
public Dimension getPreferredSize() {
|
||||||
return new Dimension(wide, high);
|
return new Dimension(wide, high);
|
||||||
}
|
}
|
||||||
@ -624,11 +528,6 @@ public class Preferences {
|
|||||||
autoAssociateBox.isSelected());
|
autoAssociateBox.isSelected());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (menubarWorkaroundBox != null) {
|
|
||||||
setBoolean("apple.laf.useScreenMenuBar",
|
|
||||||
!menubarWorkaroundBox.isSelected());
|
|
||||||
}
|
|
||||||
|
|
||||||
editor.applyPreferences();
|
editor.applyPreferences();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -659,11 +558,6 @@ public class Preferences {
|
|||||||
setSelected(getBoolean("platform.auto_file_type_associations"));
|
setSelected(getBoolean("platform.auto_file_type_associations"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (menubarWorkaroundBox != null) {
|
|
||||||
menubarWorkaroundBox.
|
|
||||||
setSelected(!getBoolean("apple.laf.useScreenMenuBar"));
|
|
||||||
}
|
|
||||||
|
|
||||||
dialog.setVisible(true);
|
dialog.setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -676,16 +570,12 @@ public class Preferences {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static protected void load(InputStream input, String prefix) throws IOException {
|
static protected void load(InputStream input, String prefix) throws IOException {
|
||||||
LinkedHashMap<String,String> table = new LinkedHashMap<String,String>();
|
LinkedHashMap table = new LinkedHashMap();
|
||||||
prefixes.put(prefix, table);
|
prefixes.put(prefix, table);
|
||||||
load(input, table);
|
load(input, table);
|
||||||
}
|
}
|
||||||
|
|
||||||
static protected void load(InputStream input, Map table) throws IOException {
|
static protected void load(InputStream input, Map table) throws IOException {
|
||||||
// check for platform-specific properties in the defaults
|
|
||||||
String platformExt = "." + PConstants.platformNames[PApplet.platform];
|
|
||||||
int platformExtLength = platformExt.length();
|
|
||||||
|
|
||||||
String[] lines = PApplet.loadStrings(input); // Reads as UTF-8
|
String[] lines = PApplet.loadStrings(input); // Reads as UTF-8
|
||||||
for (String line : lines) {
|
for (String line : lines) {
|
||||||
if ((line.length() == 0) ||
|
if ((line.length() == 0) ||
|
||||||
@ -695,12 +585,6 @@ public class Preferences {
|
|||||||
int equals = line.indexOf('=');
|
int equals = line.indexOf('=');
|
||||||
if (equals != -1) {
|
if (equals != -1) {
|
||||||
String key = line.substring(0, equals).trim();
|
String key = line.substring(0, equals).trim();
|
||||||
|
|
||||||
// check if this is a platform-specific key, and if so, shave things
|
|
||||||
if (key.endsWith(platformExt)) {
|
|
||||||
// this is a key specific to this platform
|
|
||||||
key = key.substring(0, key.length() - platformExtLength);
|
|
||||||
}
|
|
||||||
String value = line.substring(equals + 1).trim();
|
String value = line.substring(equals + 1).trim();
|
||||||
table.put(key, value);
|
table.put(key, value);
|
||||||
}
|
}
|
||||||
@ -721,8 +605,10 @@ public class Preferences {
|
|||||||
// Fix for 0163 to properly use Unicode when writing preferences.txt
|
// Fix for 0163 to properly use Unicode when writing preferences.txt
|
||||||
PrintWriter writer = PApplet.createWriter(preferencesFile);
|
PrintWriter writer = PApplet.createWriter(preferencesFile);
|
||||||
|
|
||||||
for (String key : table.keySet()) {
|
Enumeration e = table.keys(); //properties.propertyNames();
|
||||||
writer.println(key + "=" + table.get(key));
|
while (e.hasMoreElements()) {
|
||||||
|
String key = (String) e.nextElement();
|
||||||
|
writer.println(key + "=" + ((String) table.get(key)));
|
||||||
}
|
}
|
||||||
|
|
||||||
writer.flush();
|
writer.flush();
|
||||||
@ -748,15 +634,15 @@ public class Preferences {
|
|||||||
// preference files, look up the attribute in that file's Hashtable
|
// preference files, look up the attribute in that file's Hashtable
|
||||||
// (don't override with or fallback to the main file). otherwise,
|
// (don't override with or fallback to the main file). otherwise,
|
||||||
// look up the attribute in the main file's Hashtable.
|
// look up the attribute in the main file's Hashtable.
|
||||||
HashMap<String,String> table = Preferences.table;
|
Map table = Preferences.table;
|
||||||
if (attribute.indexOf('.') != -1) {
|
if (attribute.indexOf('.') != -1) {
|
||||||
String prefix = attribute.substring(0, attribute.indexOf('.'));
|
String prefix = attribute.substring(0, attribute.indexOf('.'));
|
||||||
if (prefixes.containsKey(prefix)) {
|
if (prefixes.containsKey(prefix)) {
|
||||||
table = prefixes.get(prefix);
|
table = (Map) prefixes.get(prefix);
|
||||||
attribute = attribute.substring(attribute.indexOf('.') + 1);
|
attribute = attribute.substring(attribute.indexOf('.') + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return table.get(attribute);
|
return (String) table.get(attribute);
|
||||||
/*
|
/*
|
||||||
//String value = (properties != null) ?
|
//String value = (properties != null) ?
|
||||||
//properties.getProperty(attribute) : applet.getParameter(attribute);
|
//properties.getProperty(attribute) : applet.getParameter(attribute);
|
||||||
@ -791,7 +677,7 @@ public class Preferences {
|
|||||||
|
|
||||||
|
|
||||||
static public String getDefault(String attribute) {
|
static public String getDefault(String attribute) {
|
||||||
return defaults.get(attribute);
|
return (String) defaults.get(attribute);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -233,11 +233,12 @@ public class Sketch {
|
|||||||
ensureExistence();
|
ensureExistence();
|
||||||
|
|
||||||
// add file to the code/codeCount list, resort the list
|
// add file to the code/codeCount list, resort the list
|
||||||
if (codeCount == code.length) {
|
//if (codeCount == code.length) {
|
||||||
code = (SketchCode[]) PApplet.append(code, newCode);
|
code = (SketchCode[]) PApplet.append(code, newCode);
|
||||||
|
codeCount++;
|
||||||
|
//}
|
||||||
|
//code[codeCount++] = newCode;
|
||||||
}
|
}
|
||||||
code[codeCount++] = newCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
protected void sortCode() {
|
protected void sortCode() {
|
||||||
@ -390,7 +391,7 @@ public class Sketch {
|
|||||||
// Make sure no .pde *and* no .java files with the same name already exist
|
// Make sure no .pde *and* no .java files with the same name already exist
|
||||||
// http://dev.processing.org/bugs/show_bug.cgi?id=543
|
// http://dev.processing.org/bugs/show_bug.cgi?id=543
|
||||||
for (SketchCode c : code) {
|
for (SketchCode c : code) {
|
||||||
if (sanitaryName.equals(c.getPrettyName())) {
|
if (sanitaryName.equalsIgnoreCase(c.getPrettyName())) {
|
||||||
Base.showMessage("Nope",
|
Base.showMessage("Nope",
|
||||||
"A file named \"" + c.getFileName() + "\" already exists\n" +
|
"A file named \"" + c.getFileName() + "\" already exists\n" +
|
||||||
"in \"" + folder.getAbsolutePath() + "\"");
|
"in \"" + folder.getAbsolutePath() + "\"");
|
||||||
@ -599,6 +600,7 @@ public class Sketch {
|
|||||||
code[j] = code[j+1];
|
code[j] = code[j+1];
|
||||||
}
|
}
|
||||||
codeCount--;
|
codeCount--;
|
||||||
|
code = (SketchCode[]) PApplet.shorten(code);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -759,7 +761,7 @@ public class Sketch {
|
|||||||
// but ignore this situation for the first tab, since it's probably being
|
// but ignore this situation for the first tab, since it's probably being
|
||||||
// resaved (with the same name) to another location/folder.
|
// resaved (with the same name) to another location/folder.
|
||||||
for (int i = 1; i < codeCount; i++) {
|
for (int i = 1; i < codeCount; i++) {
|
||||||
if (newName.equals(code[i].getPrettyName())) {
|
if (newName.equalsIgnoreCase(code[i].getPrettyName())) {
|
||||||
Base.showMessage("Nope",
|
Base.showMessage("Nope",
|
||||||
"You can't save the sketch as \"" + newName + "\"\n" +
|
"You can't save the sketch as \"" + newName + "\"\n" +
|
||||||
"because the sketch already has a tab with that name.");
|
"because the sketch already has a tab with that name.");
|
||||||
@ -1198,6 +1200,10 @@ public class Sketch {
|
|||||||
* @return null if compilation failed, main class name if not
|
* @return null if compilation failed, main class name if not
|
||||||
*/
|
*/
|
||||||
public String preprocess(String buildPath, Target target) throws RunnerException {
|
public String preprocess(String buildPath, Target target) throws RunnerException {
|
||||||
|
return preprocess(buildPath, new PdePreprocessor(), target);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String preprocess(String buildPath, PdePreprocessor preprocessor, Target target) throws RunnerException {
|
||||||
// make sure the user didn't hide the sketch folder
|
// make sure the user didn't hide the sketch folder
|
||||||
ensureExistence();
|
ensureExistence();
|
||||||
|
|
||||||
@ -1268,7 +1274,18 @@ public class Sketch {
|
|||||||
// Note that the headerOffset isn't applied until compile and run, because
|
// Note that the headerOffset isn't applied until compile and run, because
|
||||||
// it only applies to the code after it's been written to the .java file.
|
// it only applies to the code after it's been written to the .java file.
|
||||||
int headerOffset = 0;
|
int headerOffset = 0;
|
||||||
PdePreprocessor preprocessor = new PdePreprocessor();
|
//PdePreprocessor preprocessor = new PdePreprocessor();
|
||||||
|
try {
|
||||||
|
headerOffset = preprocessor.writePrefix(bigCode.toString(),
|
||||||
|
buildPath,
|
||||||
|
name,
|
||||||
|
codeFolderPackages,
|
||||||
|
target);
|
||||||
|
} catch (FileNotFoundException fnfe) {
|
||||||
|
fnfe.printStackTrace();
|
||||||
|
String msg = "Build folder disappeared or could not be written";
|
||||||
|
throw new RunnerException(msg);
|
||||||
|
}
|
||||||
|
|
||||||
// 2. run preproc on that code using the sugg class name
|
// 2. run preproc on that code using the sugg class name
|
||||||
// to create a single .java file and write to buildpath
|
// to create a single .java file and write to buildpath
|
||||||
@ -1278,12 +1295,7 @@ public class Sketch {
|
|||||||
try {
|
try {
|
||||||
// if (i != 0) preproc will fail if a pde file is not
|
// if (i != 0) preproc will fail if a pde file is not
|
||||||
// java mode, since that's required
|
// java mode, since that's required
|
||||||
String className = preprocessor.write(bigCode.toString(),
|
String className = preprocessor.write();
|
||||||
buildPath,
|
|
||||||
name,
|
|
||||||
codeFolderPackages,
|
|
||||||
target);
|
|
||||||
headerOffset = preprocessor.headerCount + preprocessor.prototypeCount;
|
|
||||||
|
|
||||||
if (className == null) {
|
if (className == null) {
|
||||||
throw new RunnerException("Could not find main class");
|
throw new RunnerException("Could not find main class");
|
||||||
|
@ -385,9 +385,15 @@ public class Runner implements MessageConsumer {
|
|||||||
commandArgs =
|
commandArgs =
|
||||||
"java -Xrunjdwp:transport=dt_shmem,address=" + addr + ",suspend=y ";
|
"java -Xrunjdwp:transport=dt_shmem,address=" + addr + ",suspend=y ";
|
||||||
} else if (Base.isMacOS()) {
|
} else if (Base.isMacOS()) {
|
||||||
|
if (System.getProperty("os.version").startsWith("10.4")) {
|
||||||
|
// -d32 not understood by 10.4 (and not needed)
|
||||||
commandArgs =
|
commandArgs =
|
||||||
|
"java -Xrunjdwp:transport=dt_socket,address=" + addr + ",suspend=y ";
|
||||||
|
} else {
|
||||||
|
commandArgs =
|
||||||
"java -d32 -Xrunjdwp:transport=dt_socket,address=" + addr + ",suspend=y ";
|
"java -d32 -Xrunjdwp:transport=dt_socket,address=" + addr + ",suspend=y ";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i < vmParams.length; i++) {
|
for (int i = 0; i < vmParams.length; i++) {
|
||||||
commandArgs = addArgument(commandArgs, vmParams[i], ' ');
|
commandArgs = addArgument(commandArgs, vmParams[i], ' ');
|
||||||
|
@ -48,6 +48,7 @@ public class Platform extends processing.app.Platform {
|
|||||||
|
|
||||||
|
|
||||||
public void init(Base base) {
|
public void init(Base base) {
|
||||||
|
System.setProperty("apple.laf.useScreenMenuBar", "true");
|
||||||
ThinkDifferent.init(base);
|
ThinkDifferent.init(base);
|
||||||
/*
|
/*
|
||||||
try {
|
try {
|
||||||
@ -129,6 +130,7 @@ public class Platform extends processing.app.Platform {
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
// for Java 1.6, replace with java.awt.Desktop.browse() and java.awt.Desktop.open()
|
||||||
com.apple.eio.FileManager.openURL(url);
|
com.apple.eio.FileManager.openURL(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,58 +34,222 @@ import processing.app.debug.Target;
|
|||||||
import processing.core.*;
|
import processing.core.*;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import antlr.*;
|
|
||||||
import antlr.collections.*;
|
|
||||||
import antlr.collections.impl.*;
|
|
||||||
|
|
||||||
import com.oroinc.text.regex.*;
|
import com.oroinc.text.regex.*;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class that orchestrates preprocessing p5 syntax into straight Java.
|
||||||
|
*/
|
||||||
public class PdePreprocessor {
|
public class PdePreprocessor {
|
||||||
|
|
||||||
static final int JDK11 = 0;
|
|
||||||
static final int JDK13 = 1;
|
|
||||||
static final int JDK14 = 2;
|
|
||||||
|
|
||||||
//static String defaultImports[][] = new String[3][];
|
|
||||||
|
|
||||||
// these ones have the .* at the end, since a class name
|
|
||||||
// might be at the end instead of .* whcih would make trouble
|
|
||||||
// other classes using this can lop of the . and anything after
|
|
||||||
// it to produce a package name consistently.
|
|
||||||
//public String extraImports[];
|
|
||||||
ArrayList<String> programImports;
|
|
||||||
|
|
||||||
static public final int STATIC = 0; // formerly BEGINNER
|
|
||||||
static public final int ACTIVE = 1; // formerly INTERMEDIATE
|
|
||||||
static public final int JAVA = 2; // formerly ADVANCED
|
|
||||||
// static to make it easier for the antlr preproc to get at it
|
|
||||||
static public int programType = -1;
|
|
||||||
|
|
||||||
Reader programReader;
|
|
||||||
String buildPath;
|
|
||||||
|
|
||||||
// stores number of built user-defined function prototypes
|
// stores number of built user-defined function prototypes
|
||||||
public int prototypeCount = 0;
|
public int prototypeCount = 0;
|
||||||
|
|
||||||
// stores number of included library headers written
|
// stores number of included library headers written
|
||||||
// we always write one header: WProgram.h
|
// we always write one header: WProgram.h
|
||||||
public int headerCount = 1;
|
public int headerCount = 1;
|
||||||
|
|
||||||
/**
|
|
||||||
* These may change in-between (if the prefs panel adds this option)
|
|
||||||
* so grab them here on construction.
|
|
||||||
*/
|
|
||||||
public PdePreprocessor() {}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Used by PdeEmitter.dumpHiddenTokens()
|
|
||||||
*/
|
|
||||||
//public static TokenStreamCopyingHiddenTokenFilter filter;
|
|
||||||
|
|
||||||
|
Target target;
|
||||||
|
List prototypes;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
String[] defaultImports;
|
||||||
|
|
||||||
|
// these ones have the .* at the end, since a class name might be at the end
|
||||||
|
// instead of .* which would make trouble other classes using this can lop
|
||||||
|
// off the . and anything after it to produce a package name consistently.
|
||||||
|
//public String extraImports[];
|
||||||
|
ArrayList<String> programImports;
|
||||||
|
|
||||||
|
// imports just from the code folder, treated differently
|
||||||
|
// than the others, since the imports are auto-generated.
|
||||||
|
ArrayList<String> codeFolderImports;
|
||||||
|
|
||||||
|
String indent;
|
||||||
|
|
||||||
|
PrintStream stream;
|
||||||
|
String program;
|
||||||
|
String buildPath;
|
||||||
|
String name;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setup a new preprocessor.
|
||||||
|
*/
|
||||||
|
public PdePreprocessor() { }
|
||||||
|
|
||||||
|
public int writePrefix(String program, String buildPath,
|
||||||
|
String name, String codeFolderPackages[],
|
||||||
|
Target target)
|
||||||
|
throws FileNotFoundException {
|
||||||
|
this.buildPath = buildPath;
|
||||||
|
this.name = name;
|
||||||
|
this.target = target;
|
||||||
|
|
||||||
|
int tabSize = Preferences.getInteger("editor.tabs.size");
|
||||||
|
char[] indentChars = new char[tabSize];
|
||||||
|
Arrays.fill(indentChars, ' ');
|
||||||
|
indent = new String(indentChars);
|
||||||
|
|
||||||
|
// if the program ends with no CR or LF an OutOfMemoryError will happen.
|
||||||
|
// not gonna track down the bug now, so here's a hack for it:
|
||||||
|
// http://dev.processing.org/bugs/show_bug.cgi?id=5
|
||||||
|
program += "\n";
|
||||||
|
|
||||||
|
// if the program ends with an unterminated multi-line comment,
|
||||||
|
// an OutOfMemoryError or NullPointerException will happen.
|
||||||
|
// again, not gonna bother tracking this down, but here's a hack.
|
||||||
|
// http://dev.processing.org/bugs/show_bug.cgi?id=16
|
||||||
|
Sketch.scrubComments(program);
|
||||||
|
// this returns the scrubbed version, but more important for this
|
||||||
|
// function, it'll check to see if there are errors with the comments.
|
||||||
|
|
||||||
|
if (Preferences.getBoolean("preproc.substitute_unicode")) {
|
||||||
|
// check for non-ascii chars (these will be/must be in unicode format)
|
||||||
|
char p[] = program.toCharArray();
|
||||||
|
int unicodeCount = 0;
|
||||||
|
for (int i = 0; i < p.length; i++) {
|
||||||
|
if (p[i] > 127) unicodeCount++;
|
||||||
|
}
|
||||||
|
// if non-ascii chars are in there, convert to unicode escapes
|
||||||
|
if (unicodeCount != 0) {
|
||||||
|
// add unicodeCount * 5.. replacing each unicode char
|
||||||
|
// with six digit uXXXX sequence (xxxx is in hex)
|
||||||
|
// (except for nbsp chars which will be a replaced with a space)
|
||||||
|
int index = 0;
|
||||||
|
char p2[] = new char[p.length + unicodeCount*5];
|
||||||
|
for (int i = 0; i < p.length; i++) {
|
||||||
|
if (p[i] < 128) {
|
||||||
|
p2[index++] = p[i];
|
||||||
|
|
||||||
|
} else if (p[i] == 160) { // unicode for non-breaking space
|
||||||
|
p2[index++] = ' ';
|
||||||
|
|
||||||
|
} else {
|
||||||
|
int c = p[i];
|
||||||
|
p2[index++] = '\\';
|
||||||
|
p2[index++] = 'u';
|
||||||
|
char str[] = Integer.toHexString(c).toCharArray();
|
||||||
|
// add leading zeros, so that the length is 4
|
||||||
|
//for (int i = 0; i < 4 - str.length; i++) p2[index++] = '0';
|
||||||
|
for (int m = 0; m < 4 - str.length; m++) p2[index++] = '0';
|
||||||
|
System.arraycopy(str, 0, p2, index, str.length);
|
||||||
|
index += str.length;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
program = new String(p2, 0, index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// These may change in-between (if the prefs panel adds this option)
|
||||||
|
// so grab them here on construction.
|
||||||
|
String prefsLine = Preferences.get("preproc.imports");
|
||||||
|
defaultImports = PApplet.splitTokens(prefsLine, ", ");
|
||||||
|
|
||||||
|
//String importRegexp = "(?:^|\\s|;)(import\\s+)(\\S+)(\\s*;)";
|
||||||
|
String importRegexp = "^\\s*#include\\s+[<\"](\\S+)[\">]";
|
||||||
|
programImports = new ArrayList<String>();
|
||||||
|
|
||||||
|
String[][] pieces = PApplet.matchAll(program, importRegexp);
|
||||||
|
|
||||||
|
if (pieces != null)
|
||||||
|
for (int i = 0; i < pieces.length; i++)
|
||||||
|
programImports.add(pieces[i][1]); // the package name
|
||||||
|
|
||||||
|
codeFolderImports = new ArrayList<String>();
|
||||||
|
// if (codeFolderPackages != null) {
|
||||||
|
// for (String item : codeFolderPackages) {
|
||||||
|
// codeFolderImports.add(item + ".*");
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
prototypes = new ArrayList();
|
||||||
|
|
||||||
|
try {
|
||||||
|
prototypes = prototypes(program);
|
||||||
|
} catch (MalformedPatternException e) {
|
||||||
|
System.out.println("Internal error while pre-processing; " +
|
||||||
|
"not generating function prototypes.\n\n" + e);
|
||||||
|
}
|
||||||
|
|
||||||
|
// store # of prototypes so that line number reporting can be adjusted
|
||||||
|
prototypeCount = prototypes.size();
|
||||||
|
|
||||||
|
// do this after the program gets re-combobulated
|
||||||
|
this.program = program;
|
||||||
|
|
||||||
|
// output the code
|
||||||
|
File streamFile = new File(buildPath, name + ".cpp");
|
||||||
|
stream = new PrintStream(new FileOutputStream(streamFile));
|
||||||
|
|
||||||
|
return headerCount + prototypeCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* preprocesses a pde file and write out a java file
|
||||||
|
* @return the classname of the exported Java
|
||||||
|
*/
|
||||||
|
//public String write(String program, String buildPath, String name,
|
||||||
|
// String extraImports[]) throws java.lang.Exception {
|
||||||
|
public String write() throws java.lang.Exception {
|
||||||
|
writeProgram(stream, program, prototypes);
|
||||||
|
writeFooter(stream, target);
|
||||||
|
stream.close();
|
||||||
|
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Write the pde program to the cpp file
|
||||||
|
protected void writeProgram(PrintStream out, String program, List prototypes) {
|
||||||
|
int prototypeInsertionPoint = firstStatement(program);
|
||||||
|
|
||||||
|
out.print(program.substring(0, prototypeInsertionPoint));
|
||||||
|
out.print("#include \"WProgram.h\"\n");
|
||||||
|
|
||||||
|
// print user defined prototypes
|
||||||
|
for (int i = 0; i < prototypes.size(); i++) {
|
||||||
|
out.print(prototypes.get(i) + "\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
out.print(program.substring(prototypeInsertionPoint));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Write any necessary closing text.
|
||||||
|
*
|
||||||
|
* @param out PrintStream to write it to.
|
||||||
|
*/
|
||||||
|
protected void writeFooter(PrintStream out, Target target) throws java.lang.Exception {
|
||||||
|
// Open the file main.cxx and copy its entire contents to the bottom of the
|
||||||
|
// generated sketch .cpp file...
|
||||||
|
|
||||||
|
String mainFileName = target.getPath() + File.separator + "main.cxx";
|
||||||
|
FileReader reader = null;
|
||||||
|
reader = new FileReader(mainFileName);
|
||||||
|
|
||||||
|
LineNumberReader mainfile = new LineNumberReader(reader);
|
||||||
|
|
||||||
|
String line;
|
||||||
|
while ((line = mainfile.readLine()) != null) {
|
||||||
|
out.print(line + "\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
mainfile.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public ArrayList<String> getExtraImports() {
|
||||||
|
return programImports;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the index of the first character that's not whitespace, a comment
|
* Returns the index of the first character that's not whitespace, a comment
|
||||||
* or a pre-processor directive.
|
* or a pre-processor directive.
|
||||||
@ -204,185 +368,4 @@ public class PdePreprocessor {
|
|||||||
|
|
||||||
return matches;
|
return matches;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* preprocesses a pde file and write out a java file
|
|
||||||
* @param pretty true if should also space out/indent lines
|
|
||||||
* @return the classname of the exported Java
|
|
||||||
*/
|
|
||||||
//public String write(String program, String buildPath, String name,
|
|
||||||
// String extraImports[]) throws java.lang.Exception {
|
|
||||||
public String write(String program, String buildPath,
|
|
||||||
String name, String codeFolderPackages[],
|
|
||||||
Target target)
|
|
||||||
throws java.lang.Exception {
|
|
||||||
// if the program ends with no CR or LF an OutOfMemoryError will happen.
|
|
||||||
// not gonna track down the bug now, so here's a hack for it:
|
|
||||||
// bug filed at http://dev.processing.org/bugs/show_bug.cgi?id=5
|
|
||||||
//if ((program.length() > 0) &&
|
|
||||||
//program.charAt(program.length()-1) != '\n') {
|
|
||||||
program += "\n";
|
|
||||||
//}
|
|
||||||
|
|
||||||
// if the program ends with an unterminated multiline comment,
|
|
||||||
// an OutOfMemoryError or NullPointerException will happen.
|
|
||||||
// again, not gonna bother tracking this down, but here's a hack.
|
|
||||||
// http://dev.processing.org/bugs/show_bug.cgi?id=16
|
|
||||||
Sketch.scrubComments(program);
|
|
||||||
// this returns the scrubbed version, but more important for this
|
|
||||||
// function, it'll check to see if there are errors with the comments.
|
|
||||||
|
|
||||||
if (Preferences.getBoolean("preproc.substitute_unicode")) {
|
|
||||||
// check for non-ascii chars (these will be/must be in unicode format)
|
|
||||||
char p[] = program.toCharArray();
|
|
||||||
int unicodeCount = 0;
|
|
||||||
for (int i = 0; i < p.length; i++) {
|
|
||||||
if (p[i] > 127) unicodeCount++;
|
|
||||||
}
|
|
||||||
// if non-ascii chars are in there, convert to unicode escapes
|
|
||||||
if (unicodeCount != 0) {
|
|
||||||
// add unicodeCount * 5.. replacing each unicode char
|
|
||||||
// with six digit uXXXX sequence (xxxx is in hex)
|
|
||||||
// (except for nbsp chars which will be a replaced with a space)
|
|
||||||
int index = 0;
|
|
||||||
char p2[] = new char[p.length + unicodeCount*5];
|
|
||||||
for (int i = 0; i < p.length; i++) {
|
|
||||||
if (p[i] < 128) {
|
|
||||||
p2[index++] = p[i];
|
|
||||||
|
|
||||||
} else if (p[i] == 160) { // unicode for non-breaking space
|
|
||||||
p2[index++] = ' ';
|
|
||||||
|
|
||||||
} else {
|
|
||||||
int c = p[i];
|
|
||||||
p2[index++] = '\\';
|
|
||||||
p2[index++] = 'u';
|
|
||||||
char str[] = Integer.toHexString(c).toCharArray();
|
|
||||||
// add leading zeros, so that the length is 4
|
|
||||||
//for (int i = 0; i < 4 - str.length; i++) p2[index++] = '0';
|
|
||||||
for (int m = 0; m < 4 - str.length; m++) p2[index++] = '0';
|
|
||||||
System.arraycopy(str, 0, p2, index, str.length);
|
|
||||||
index += str.length;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
program = new String(p2, 0, index);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// if this guy has his own imports, need to remove them
|
|
||||||
// just in case it's not an advanced mode sketch
|
|
||||||
PatternMatcher matcher = new Perl5Matcher();
|
|
||||||
PatternCompiler compiler = new Perl5Compiler();
|
|
||||||
//String mess = "^\\s*(import\\s+\\S+\\s*;)";
|
|
||||||
//String mess = "^\\s*(import\\s+)(\\S+)(\\s*;)";
|
|
||||||
String mess = "^\\s*#include\\s+[<\"](\\S+)[\">]";
|
|
||||||
programImports = new ArrayList<String>();
|
|
||||||
|
|
||||||
Pattern pattern = null;
|
|
||||||
try {
|
|
||||||
pattern = compiler.compile(mess);
|
|
||||||
} catch (MalformedPatternException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
PatternMatcherInput input = new PatternMatcherInput(program);
|
|
||||||
while (matcher.contains(input, pattern)) {
|
|
||||||
programImports.add(matcher.getMatch().group(1));
|
|
||||||
}
|
|
||||||
|
|
||||||
// do this after the program gets re-combobulated
|
|
||||||
this.programReader = new StringReader(program);
|
|
||||||
this.buildPath = buildPath;
|
|
||||||
|
|
||||||
List prototypes = prototypes(program);
|
|
||||||
|
|
||||||
// store # of prototypes so that line number reporting can be adjusted
|
|
||||||
prototypeCount = prototypes.size();
|
|
||||||
|
|
||||||
if (name == null) return null;
|
|
||||||
|
|
||||||
// output the code
|
|
||||||
File streamFile = new File(buildPath, name + ".cpp");
|
|
||||||
PrintStream stream = new PrintStream(new FileOutputStream(streamFile));
|
|
||||||
|
|
||||||
writeHeader(stream);
|
|
||||||
//added to write the pde code to the cpp file
|
|
||||||
writeProgram(stream, program, prototypes);
|
|
||||||
writeFooter(stream, target);
|
|
||||||
stream.close();
|
|
||||||
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Write the pde program to the cpp file
|
|
||||||
void writeProgram(PrintStream out, String program, List prototypes) {
|
|
||||||
int prototypeInsertionPoint = firstStatement(program);
|
|
||||||
|
|
||||||
out.print(program.substring(0, prototypeInsertionPoint));
|
|
||||||
out.print("#include \"WProgram.h\"\n");
|
|
||||||
|
|
||||||
// print user defined prototypes
|
|
||||||
for (int i = 0; i < prototypes.size(); i++) {
|
|
||||||
out.print(prototypes.get(i) + "\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
out.print(program.substring(prototypeInsertionPoint));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Write any required header material (eg imports, class decl stuff)
|
|
||||||
*
|
|
||||||
* @param out PrintStream to write it to.
|
|
||||||
*/
|
|
||||||
void writeHeader(PrintStream out) throws IOException {}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Write any necessary closing text.
|
|
||||||
*
|
|
||||||
* @param out PrintStream to write it to.
|
|
||||||
*/
|
|
||||||
void writeFooter(PrintStream out, Target target) throws java.lang.Exception {
|
|
||||||
// Open the file main.cxx and copy its entire contents to the bottom of the
|
|
||||||
// generated sketch .cpp file...
|
|
||||||
|
|
||||||
String mainFileName = target.getPath() + File.separator + "main.cxx";
|
|
||||||
FileReader reader = null;
|
|
||||||
reader = new FileReader(mainFileName);
|
|
||||||
|
|
||||||
LineNumberReader mainfile = new LineNumberReader(reader);
|
|
||||||
|
|
||||||
String line;
|
|
||||||
while ((line = mainfile.readLine()) != null) {
|
|
||||||
out.print(line + "\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
mainfile.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public ArrayList<String> getExtraImports() {
|
|
||||||
return programImports;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static String advClassName = "";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Find the first CLASS_DEF node in the tree, and return the name of the
|
|
||||||
* class in question.
|
|
||||||
*
|
|
||||||
* XXXdmose right now, we're using a little hack to the grammar to get
|
|
||||||
* this info. In fact, we should be descending the AST passed in.
|
|
||||||
*/
|
|
||||||
String getFirstClassName(AST ast) {
|
|
||||||
|
|
||||||
String t = advClassName;
|
|
||||||
advClassName = "";
|
|
||||||
|
|
||||||
return t;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,10 @@
|
|||||||
<key>Java</key>
|
<key>Java</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>VMOptions</key>
|
<key>VMOptions</key>
|
||||||
<string>-Xms128M -Xmx256M</string>
|
<array>
|
||||||
|
<string>-Xms128M</string>
|
||||||
|
<string>-Xmx256M</string>
|
||||||
|
</array>
|
||||||
|
|
||||||
<key>MainClass</key>
|
<key>MainClass</key>
|
||||||
<string>processing.app.Base</string>
|
<string>processing.app.Base</string>
|
||||||
@ -62,26 +65,23 @@
|
|||||||
http://dev.processing.org/bugs/show_bug.cgi?id=1045 -->
|
http://dev.processing.org/bugs/show_bug.cgi?id=1045 -->
|
||||||
<string>$JAVAROOT/pde.jar:$JAVAROOT/core.jar:$JAVAROOT/antlr.jar:$JAVAROOT/ecj.jar:$JAVAROOT/registry.jar:$JAVAROOT/quaqua.jar:$JAVAROOT/oro.jar:$JAVAROOT/RXTXcomm.jar</string>
|
<string>$JAVAROOT/pde.jar:$JAVAROOT/core.jar:$JAVAROOT/antlr.jar:$JAVAROOT/ecj.jar:$JAVAROOT/registry.jar:$JAVAROOT/quaqua.jar:$JAVAROOT/oro.jar:$JAVAROOT/RXTXcomm.jar</string>
|
||||||
|
|
||||||
|
<key>JVMArchs</key>
|
||||||
|
<array>
|
||||||
|
<!--<string>x86_64</string>--> <!-- currently no 64 bit support -->
|
||||||
|
<string>i386</string>
|
||||||
|
<string>ppc</string>
|
||||||
|
</array>
|
||||||
|
|
||||||
|
<!-- More properties can be found in http://developer.apple.com/releasenotes/Java/java141/system_properties/chapter_4_section_1.html#//apple_ref/doc/uid/TP30000285 -->
|
||||||
<key>Properties</key>
|
<key>Properties</key>
|
||||||
<dict>
|
<dict>
|
||||||
<!-- Pass the full path of Contents/Resources/Java to the PDE -->
|
<!-- Pass the full path of Contents/Resources/Java to the PDE -->
|
||||||
<key>javaroot</key>
|
<key>javaroot</key>
|
||||||
<string>$JAVAROOT</string>
|
<string>$JAVAROOT</string>
|
||||||
|
|
||||||
<!-- More properties can be found in http://developer.apple.com/releasenotes/Java/java141/system_properties/chapter_4_section_1.html#//apple_ref/doc/uid/TP30000285 -->
|
<!-- as of 1.0.8, it's safe to use this option again -->
|
||||||
|
<key>apple.laf.useScreenMenuBar</key>
|
||||||
<!--
|
<string>true</string>
|
||||||
In release 0158, removed the menubar option from the .app and instead controlling it from the preferences window. By default, the menu bar is inside the editor window because of the Apple Java bug.
|
|
||||||
<key>apple.laf.useScreenMenuBar</key>
|
|
||||||
<string>true</string>
|
|
||||||
-->
|
|
||||||
|
|
||||||
<key>JVMArchs</key>
|
|
||||||
<array>
|
|
||||||
<!--<string>x86_64</string>--> <!-- currently no 64 bit support -->
|
|
||||||
<string>i386</string>
|
|
||||||
<string>ppc</string>
|
|
||||||
</array>
|
|
||||||
|
|
||||||
<key>apple.awt.showGrowBox</key>
|
<key>apple.awt.showGrowBox</key>
|
||||||
<string>false</string>
|
<string>false</string>
|
||||||
|
@ -9,12 +9,6 @@ then
|
|||||||
echo "or modify this script to remove use of the -X switch to continue."
|
echo "or modify this script to remove use of the -X switch to continue."
|
||||||
# and you will also need to remove this error message
|
# and you will also need to remove this error message
|
||||||
exit
|
exit
|
||||||
else
|
|
||||||
if [ "$OSX_VERSION" != "10.6" ]
|
|
||||||
then
|
|
||||||
echo "Note: This script has not been tested on this "
|
|
||||||
echo "release of Mac OS and may cause errors."
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
@ -147,7 +147,6 @@ run.display = 1
|
|||||||
#sketchbook.closing_last_window_quits = true
|
#sketchbook.closing_last_window_quits = true
|
||||||
#sketchbook.closing_last_window_quits.macosx = false
|
#sketchbook.closing_last_window_quits.macosx = false
|
||||||
|
|
||||||
apple.laf.useScreenMenuBar=true
|
|
||||||
|
|
||||||
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
This file has been replaced by an entire section of dev.processing.org
|
|
||||||
dedicated to libraries, people who make libraries, and people who
|
|
||||||
love library development trivia. The new page can be found here:
|
|
||||||
|
|
||||||
http://dev.processing.org/libraries/
|
|
@ -1,6 +0,0 @@
|
|||||||
# don't actually export anything.. this is only to link against
|
|
||||||
# inside of the p5 environment
|
|
||||||
applet=
|
|
||||||
|
|
||||||
# for an application, export to prevent from breaking
|
|
||||||
application=javascript.jar
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,339 +0,0 @@
|
|||||||
GNU GENERAL PUBLIC LICENSE
|
|
||||||
Version 2, June 1991
|
|
||||||
|
|
||||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
|
||||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
|
||||||
of this license document, but changing it is not allowed.
|
|
||||||
|
|
||||||
Preamble
|
|
||||||
|
|
||||||
The licenses for most software are designed to take away your
|
|
||||||
freedom to share and change it. By contrast, the GNU General Public
|
|
||||||
License is intended to guarantee your freedom to share and change free
|
|
||||||
software--to make sure the software is free for all its users. This
|
|
||||||
General Public License applies to most of the Free Software
|
|
||||||
Foundation's software and to any other program whose authors commit to
|
|
||||||
using it. (Some other Free Software Foundation software is covered by
|
|
||||||
the GNU Lesser General Public License instead.) You can apply it to
|
|
||||||
your programs, too.
|
|
||||||
|
|
||||||
When we speak of free software, we are referring to freedom, not
|
|
||||||
price. Our General Public Licenses are designed to make sure that you
|
|
||||||
have the freedom to distribute copies of free software (and charge for
|
|
||||||
this service if you wish), that you receive source code or can get it
|
|
||||||
if you want it, that you can change the software or use pieces of it
|
|
||||||
in new free programs; and that you know you can do these things.
|
|
||||||
|
|
||||||
To protect your rights, we need to make restrictions that forbid
|
|
||||||
anyone to deny you these rights or to ask you to surrender the rights.
|
|
||||||
These restrictions translate to certain responsibilities for you if you
|
|
||||||
distribute copies of the software, or if you modify it.
|
|
||||||
|
|
||||||
For example, if you distribute copies of such a program, whether
|
|
||||||
gratis or for a fee, you must give the recipients all the rights that
|
|
||||||
you have. You must make sure that they, too, receive or can get the
|
|
||||||
source code. And you must show them these terms so they know their
|
|
||||||
rights.
|
|
||||||
|
|
||||||
We protect your rights with two steps: (1) copyright the software, and
|
|
||||||
(2) offer you this license which gives you legal permission to copy,
|
|
||||||
distribute and/or modify the software.
|
|
||||||
|
|
||||||
Also, for each author's protection and ours, we want to make certain
|
|
||||||
that everyone understands that there is no warranty for this free
|
|
||||||
software. If the software is modified by someone else and passed on, we
|
|
||||||
want its recipients to know that what they have is not the original, so
|
|
||||||
that any problems introduced by others will not reflect on the original
|
|
||||||
authors' reputations.
|
|
||||||
|
|
||||||
Finally, any free program is threatened constantly by software
|
|
||||||
patents. We wish to avoid the danger that redistributors of a free
|
|
||||||
program will individually obtain patent licenses, in effect making the
|
|
||||||
program proprietary. To prevent this, we have made it clear that any
|
|
||||||
patent must be licensed for everyone's free use or not licensed at all.
|
|
||||||
|
|
||||||
The precise terms and conditions for copying, distribution and
|
|
||||||
modification follow.
|
|
||||||
|
|
||||||
GNU GENERAL PUBLIC LICENSE
|
|
||||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
|
||||||
|
|
||||||
0. This License applies to any program or other work which contains
|
|
||||||
a notice placed by the copyright holder saying it may be distributed
|
|
||||||
under the terms of this General Public License. The "Program", below,
|
|
||||||
refers to any such program or work, and a "work based on the Program"
|
|
||||||
means either the Program or any derivative work under copyright law:
|
|
||||||
that is to say, a work containing the Program or a portion of it,
|
|
||||||
either verbatim or with modifications and/or translated into another
|
|
||||||
language. (Hereinafter, translation is included without limitation in
|
|
||||||
the term "modification".) Each licensee is addressed as "you".
|
|
||||||
|
|
||||||
Activities other than copying, distribution and modification are not
|
|
||||||
covered by this License; they are outside its scope. The act of
|
|
||||||
running the Program is not restricted, and the output from the Program
|
|
||||||
is covered only if its contents constitute a work based on the
|
|
||||||
Program (independent of having been made by running the Program).
|
|
||||||
Whether that is true depends on what the Program does.
|
|
||||||
|
|
||||||
1. You may copy and distribute verbatim copies of the Program's
|
|
||||||
source code as you receive it, in any medium, provided that you
|
|
||||||
conspicuously and appropriately publish on each copy an appropriate
|
|
||||||
copyright notice and disclaimer of warranty; keep intact all the
|
|
||||||
notices that refer to this License and to the absence of any warranty;
|
|
||||||
and give any other recipients of the Program a copy of this License
|
|
||||||
along with the Program.
|
|
||||||
|
|
||||||
You may charge a fee for the physical act of transferring a copy, and
|
|
||||||
you may at your option offer warranty protection in exchange for a fee.
|
|
||||||
|
|
||||||
2. You may modify your copy or copies of the Program or any portion
|
|
||||||
of it, thus forming a work based on the Program, and copy and
|
|
||||||
distribute such modifications or work under the terms of Section 1
|
|
||||||
above, provided that you also meet all of these conditions:
|
|
||||||
|
|
||||||
a) You must cause the modified files to carry prominent notices
|
|
||||||
stating that you changed the files and the date of any change.
|
|
||||||
|
|
||||||
b) You must cause any work that you distribute or publish, that in
|
|
||||||
whole or in part contains or is derived from the Program or any
|
|
||||||
part thereof, to be licensed as a whole at no charge to all third
|
|
||||||
parties under the terms of this License.
|
|
||||||
|
|
||||||
c) If the modified program normally reads commands interactively
|
|
||||||
when run, you must cause it, when started running for such
|
|
||||||
interactive use in the most ordinary way, to print or display an
|
|
||||||
announcement including an appropriate copyright notice and a
|
|
||||||
notice that there is no warranty (or else, saying that you provide
|
|
||||||
a warranty) and that users may redistribute the program under
|
|
||||||
these conditions, and telling the user how to view a copy of this
|
|
||||||
License. (Exception: if the Program itself is interactive but
|
|
||||||
does not normally print such an announcement, your work based on
|
|
||||||
the Program is not required to print an announcement.)
|
|
||||||
|
|
||||||
These requirements apply to the modified work as a whole. If
|
|
||||||
identifiable sections of that work are not derived from the Program,
|
|
||||||
and can be reasonably considered independent and separate works in
|
|
||||||
themselves, then this License, and its terms, do not apply to those
|
|
||||||
sections when you distribute them as separate works. But when you
|
|
||||||
distribute the same sections as part of a whole which is a work based
|
|
||||||
on the Program, the distribution of the whole must be on the terms of
|
|
||||||
this License, whose permissions for other licensees extend to the
|
|
||||||
entire whole, and thus to each and every part regardless of who wrote it.
|
|
||||||
|
|
||||||
Thus, it is not the intent of this section to claim rights or contest
|
|
||||||
your rights to work written entirely by you; rather, the intent is to
|
|
||||||
exercise the right to control the distribution of derivative or
|
|
||||||
collective works based on the Program.
|
|
||||||
|
|
||||||
In addition, mere aggregation of another work not based on the Program
|
|
||||||
with the Program (or with a work based on the Program) on a volume of
|
|
||||||
a storage or distribution medium does not bring the other work under
|
|
||||||
the scope of this License.
|
|
||||||
|
|
||||||
3. You may copy and distribute the Program (or a work based on it,
|
|
||||||
under Section 2) in object code or executable form under the terms of
|
|
||||||
Sections 1 and 2 above provided that you also do one of the following:
|
|
||||||
|
|
||||||
a) Accompany it with the complete corresponding machine-readable
|
|
||||||
source code, which must be distributed under the terms of Sections
|
|
||||||
1 and 2 above on a medium customarily used for software interchange; or,
|
|
||||||
|
|
||||||
b) Accompany it with a written offer, valid for at least three
|
|
||||||
years, to give any third party, for a charge no more than your
|
|
||||||
cost of physically performing source distribution, a complete
|
|
||||||
machine-readable copy of the corresponding source code, to be
|
|
||||||
distributed under the terms of Sections 1 and 2 above on a medium
|
|
||||||
customarily used for software interchange; or,
|
|
||||||
|
|
||||||
c) Accompany it with the information you received as to the offer
|
|
||||||
to distribute corresponding source code. (This alternative is
|
|
||||||
allowed only for noncommercial distribution and only if you
|
|
||||||
received the program in object code or executable form with such
|
|
||||||
an offer, in accord with Subsection b above.)
|
|
||||||
|
|
||||||
The source code for a work means the preferred form of the work for
|
|
||||||
making modifications to it. For an executable work, complete source
|
|
||||||
code means all the source code for all modules it contains, plus any
|
|
||||||
associated interface definition files, plus the scripts used to
|
|
||||||
control compilation and installation of the executable. However, as a
|
|
||||||
special exception, the source code distributed need not include
|
|
||||||
anything that is normally distributed (in either source or binary
|
|
||||||
form) with the major components (compiler, kernel, and so on) of the
|
|
||||||
operating system on which the executable runs, unless that component
|
|
||||||
itself accompanies the executable.
|
|
||||||
|
|
||||||
If distribution of executable or object code is made by offering
|
|
||||||
access to copy from a designated place, then offering equivalent
|
|
||||||
access to copy the source code from the same place counts as
|
|
||||||
distribution of the source code, even though third parties are not
|
|
||||||
compelled to copy the source along with the object code.
|
|
||||||
|
|
||||||
4. You may not copy, modify, sublicense, or distribute the Program
|
|
||||||
except as expressly provided under this License. Any attempt
|
|
||||||
otherwise to copy, modify, sublicense or distribute the Program is
|
|
||||||
void, and will automatically terminate your rights under this License.
|
|
||||||
However, parties who have received copies, or rights, from you under
|
|
||||||
this License will not have their licenses terminated so long as such
|
|
||||||
parties remain in full compliance.
|
|
||||||
|
|
||||||
5. You are not required to accept this License, since you have not
|
|
||||||
signed it. However, nothing else grants you permission to modify or
|
|
||||||
distribute the Program or its derivative works. These actions are
|
|
||||||
prohibited by law if you do not accept this License. Therefore, by
|
|
||||||
modifying or distributing the Program (or any work based on the
|
|
||||||
Program), you indicate your acceptance of this License to do so, and
|
|
||||||
all its terms and conditions for copying, distributing or modifying
|
|
||||||
the Program or works based on it.
|
|
||||||
|
|
||||||
6. Each time you redistribute the Program (or any work based on the
|
|
||||||
Program), the recipient automatically receives a license from the
|
|
||||||
original licensor to copy, distribute or modify the Program subject to
|
|
||||||
these terms and conditions. You may not impose any further
|
|
||||||
restrictions on the recipients' exercise of the rights granted herein.
|
|
||||||
You are not responsible for enforcing compliance by third parties to
|
|
||||||
this License.
|
|
||||||
|
|
||||||
7. If, as a consequence of a court judgment or allegation of patent
|
|
||||||
infringement or for any other reason (not limited to patent issues),
|
|
||||||
conditions are imposed on you (whether by court order, agreement or
|
|
||||||
otherwise) that contradict the conditions of this License, they do not
|
|
||||||
excuse you from the conditions of this License. If you cannot
|
|
||||||
distribute so as to satisfy simultaneously your obligations under this
|
|
||||||
License and any other pertinent obligations, then as a consequence you
|
|
||||||
may not distribute the Program at all. For example, if a patent
|
|
||||||
license would not permit royalty-free redistribution of the Program by
|
|
||||||
all those who receive copies directly or indirectly through you, then
|
|
||||||
the only way you could satisfy both it and this License would be to
|
|
||||||
refrain entirely from distribution of the Program.
|
|
||||||
|
|
||||||
If any portion of this section is held invalid or unenforceable under
|
|
||||||
any particular circumstance, the balance of the section is intended to
|
|
||||||
apply and the section as a whole is intended to apply in other
|
|
||||||
circumstances.
|
|
||||||
|
|
||||||
It is not the purpose of this section to induce you to infringe any
|
|
||||||
patents or other property right claims or to contest validity of any
|
|
||||||
such claims; this section has the sole purpose of protecting the
|
|
||||||
integrity of the free software distribution system, which is
|
|
||||||
implemented by public license practices. Many people have made
|
|
||||||
generous contributions to the wide range of software distributed
|
|
||||||
through that system in reliance on consistent application of that
|
|
||||||
system; it is up to the author/donor to decide if he or she is willing
|
|
||||||
to distribute software through any other system and a licensee cannot
|
|
||||||
impose that choice.
|
|
||||||
|
|
||||||
This section is intended to make thoroughly clear what is believed to
|
|
||||||
be a consequence of the rest of this License.
|
|
||||||
|
|
||||||
8. If the distribution and/or use of the Program is restricted in
|
|
||||||
certain countries either by patents or by copyrighted interfaces, the
|
|
||||||
original copyright holder who places the Program under this License
|
|
||||||
may add an explicit geographical distribution limitation excluding
|
|
||||||
those countries, so that distribution is permitted only in or among
|
|
||||||
countries not thus excluded. In such case, this License incorporates
|
|
||||||
the limitation as if written in the body of this License.
|
|
||||||
|
|
||||||
9. The Free Software Foundation may publish revised and/or new versions
|
|
||||||
of the General Public License from time to time. Such new versions will
|
|
||||||
be similar in spirit to the present version, but may differ in detail to
|
|
||||||
address new problems or concerns.
|
|
||||||
|
|
||||||
Each version is given a distinguishing version number. If the Program
|
|
||||||
specifies a version number of this License which applies to it and "any
|
|
||||||
later version", you have the option of following the terms and conditions
|
|
||||||
either of that version or of any later version published by the Free
|
|
||||||
Software Foundation. If the Program does not specify a version number of
|
|
||||||
this License, you may choose any version ever published by the Free Software
|
|
||||||
Foundation.
|
|
||||||
|
|
||||||
10. If you wish to incorporate parts of the Program into other free
|
|
||||||
programs whose distribution conditions are different, write to the author
|
|
||||||
to ask for permission. For software which is copyrighted by the Free
|
|
||||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
|
||||||
make exceptions for this. Our decision will be guided by the two goals
|
|
||||||
of preserving the free status of all derivatives of our free software and
|
|
||||||
of promoting the sharing and reuse of software generally.
|
|
||||||
|
|
||||||
NO WARRANTY
|
|
||||||
|
|
||||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
|
||||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
|
||||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
|
||||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
|
||||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
||||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
|
||||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
|
||||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
|
||||||
REPAIR OR CORRECTION.
|
|
||||||
|
|
||||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
|
||||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
|
||||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
|
||||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
|
||||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
|
||||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
|
||||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
|
||||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
|
||||||
POSSIBILITY OF SUCH DAMAGES.
|
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
How to Apply These Terms to Your New Programs
|
|
||||||
|
|
||||||
If you develop a new program, and you want it to be of the greatest
|
|
||||||
possible use to the public, the best way to achieve this is to make it
|
|
||||||
free software which everyone can redistribute and change under these terms.
|
|
||||||
|
|
||||||
To do so, attach the following notices to the program. It is safest
|
|
||||||
to attach them to the start of each source file to most effectively
|
|
||||||
convey the exclusion of warranty; and each file should have at least
|
|
||||||
the "copyright" line and a pointer to where the full notice is found.
|
|
||||||
|
|
||||||
<one line to give the program's name and a brief idea of what it does.>
|
|
||||||
Copyright (C) <year> <name of author>
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License along
|
|
||||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
|
||||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
|
|
||||||
Also add information on how to contact you by electronic and paper mail.
|
|
||||||
|
|
||||||
If the program is interactive, make it output a short notice like this
|
|
||||||
when it starts in an interactive mode:
|
|
||||||
|
|
||||||
Gnomovision version 69, Copyright (C) year name of author
|
|
||||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
|
||||||
This is free software, and you are welcome to redistribute it
|
|
||||||
under certain conditions; type `show c' for details.
|
|
||||||
|
|
||||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
|
||||||
parts of the General Public License. Of course, the commands you use may
|
|
||||||
be called something other than `show w' and `show c'; they could even be
|
|
||||||
mouse-clicks or menu items--whatever suits your program.
|
|
||||||
|
|
||||||
You should also get your employer (if you work as a programmer) or your
|
|
||||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
|
||||||
necessary. Here is a sample; alter the names:
|
|
||||||
|
|
||||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
|
||||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
|
||||||
|
|
||||||
<signature of Ty Coon>, 1 April 1989
|
|
||||||
Ty Coon, President of Vice
|
|
||||||
|
|
||||||
This General Public License does not permit incorporating your program into
|
|
||||||
proprietary programs. If your program is a subroutine library, you may
|
|
||||||
consider it more useful to permit linking proprietary applications with the
|
|
||||||
library. If this is what you want to do, use the GNU Lesser General
|
|
||||||
Public License instead of this License.
|
|
@ -1 +0,0 @@
|
|||||||
2.0.1
|
|
@ -1,3 +1,92 @@
|
|||||||
|
PROCESSING 1.0.9 (REV 0171) - 20 October 2009
|
||||||
|
|
||||||
|
+ Removed NPOT texture support until further testing, because it was
|
||||||
|
resulting in blurring images in OPENGL sketches.
|
||||||
|
http://dev.processing.org/bugs/show_bug.cgi?id=1352
|
||||||
|
|
||||||
|
+ Complete the excision of the Apple menu bug code.
|
||||||
|
http://dev.processing.org/bugs/show_bug.cgi?id=786
|
||||||
|
|
||||||
|
|
||||||
|
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
||||||
|
|
||||||
|
|
||||||
|
PROCESSING 1.0.8 (REV 0170) - 18 October 2009
|
||||||
|
|
||||||
|
A bonfire of bug fixes.
|
||||||
|
|
||||||
|
[ environment ]
|
||||||
|
|
||||||
|
+ Fix bug causing preferences to not save correctly.
|
||||||
|
http://dev.processing.org/bugs/show_bug.cgi?id=1320
|
||||||
|
http://dev.processing.org/bugs/show_bug.cgi?id=1322
|
||||||
|
http://dev.processing.org/bugs/show_bug.cgi?id=1325
|
||||||
|
http://dev.processing.org/bugs/show_bug.cgi?id=1329
|
||||||
|
http://dev.processing.org/bugs/show_bug.cgi?id=1336
|
||||||
|
http://dev.processing.org/bugs/show_bug.cgi?id=1337
|
||||||
|
http://dev.processing.org/bugs/show_bug.cgi?id=1344
|
||||||
|
|
||||||
|
+ Remove menu dimming code, in-frame menu bar, and warning message on OS X.
|
||||||
|
A year later, Apple fixed the spinning wheel w/ the menu bar problem.
|
||||||
|
http://dev.processing.org/bugs/show_bug.cgi?id=786
|
||||||
|
|
||||||
|
+ Fix "Unrecognized option: -d32" on OS X 10.4
|
||||||
|
http://dev.processing.org/bugs/show_bug.cgi?id=1324
|
||||||
|
|
||||||
|
+ Update the outdated "Get the latest Java Plug-in here" in exported applets.
|
||||||
|
http://dev.processing.org/bugs/show_bug.cgi?id=1331
|
||||||
|
|
||||||
|
+ Use temporary files when saving files inside the PDE. Prevents problems
|
||||||
|
when the save goes badly (e.g. disk is full).
|
||||||
|
http://dev.processing.org/bugs/show_bug.cgi?id=967
|
||||||
|
|
||||||
|
+ Fix problem with "Save changes before closing?" was being ignored.
|
||||||
|
http://dev.processing.org/bugs/show_bug.cgi?id=1193
|
||||||
|
|
||||||
|
+ Fix problems with adding/deleting tabs.
|
||||||
|
http://dev.processing.org/bugs/show_bug.cgi?id=1332
|
||||||
|
http://dev.processing.org/bugs/show_bug.cgi?id=1092
|
||||||
|
|
||||||
|
+ Saving the project with the same name (but different case)
|
||||||
|
as an existing tab was deleting code on Windows and OS X.
|
||||||
|
http://dev.processing.org/bugs/show_bug.cgi?id=1102
|
||||||
|
|
||||||
|
[ core ]
|
||||||
|
|
||||||
|
+ filter(RGB) supposed to be filter(OPAQUE)
|
||||||
|
http://dev.processing.org/bugs/show_bug.cgi?id=1346
|
||||||
|
|
||||||
|
+ Implement non-power-of-2 textures for OpenGL (on cards where available).
|
||||||
|
This is a partial fix for texture edge problems:
|
||||||
|
http://dev.processing.org/bugs/show_bug.cgi?id=602
|
||||||
|
|
||||||
|
+ Fix get() when used with save() in OpenGL mode
|
||||||
|
|
||||||
|
+ Immediately update projection with OpenGL. In the past, projection
|
||||||
|
updates required a new frame. This also prevents camera/project from
|
||||||
|
being reset when the drawing size is changed.
|
||||||
|
|
||||||
|
+ Removed an error that caused the cameraNear value to be set to -8.
|
||||||
|
This may cause other problems with drawing/clipping however.
|
||||||
|
|
||||||
|
+ Removed methods from PApplet that use doubles. These were only temporarily
|
||||||
|
available in SVN, but that's that.
|
||||||
|
|
||||||
|
+ Use temporary file with saveStrings(File) and saveBytes(File).
|
||||||
|
|
||||||
|
[ updates ]
|
||||||
|
|
||||||
|
+ Updated to Minim 2.0.2. (Thanks Damien!)
|
||||||
|
http://code.compartmental.net/tools/minim
|
||||||
|
|
||||||
|
+ Updated Java on Linux and Windows to 6u16.
|
||||||
|
|
||||||
|
+ Updated Quaqua to 6.2 on Mac OS X.
|
||||||
|
|
||||||
|
|
||||||
|
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
||||||
|
|
||||||
|
|
||||||
PROCESSING 1.0.7 (REV 0169) - 4 September 2009
|
PROCESSING 1.0.7 (REV 0169) - 4 September 2009
|
||||||
|
|
||||||
Bug fixes and updates, also some tweaks for Mac OS X Snow Leopard.
|
Bug fixes and updates, also some tweaks for Mac OS X Snow Leopard.
|
||||||
|
@ -1,3 +1,29 @@
|
|||||||
|
0170 core (1.0.8)
|
||||||
|
X added some min/max functions that work with doubles
|
||||||
|
X not sure if those are staying in or not
|
||||||
|
X filter(RGB) supposed to be filter(OPAQUE)
|
||||||
|
X http://dev.processing.org/bugs/show_bug.cgi?id=1346
|
||||||
|
X implement non-power-of-2 textures
|
||||||
|
X fix get() when used with save() in OpenGL mode
|
||||||
|
X immediately update projection with OpenGL
|
||||||
|
X in the past, projection updates required a new frame
|
||||||
|
X also prevents camera/project from being reset with setSize() (regression?)
|
||||||
|
X which was a problem anyway because it made GL calls outside draw()
|
||||||
|
X partial fix for texture edge problems with opengl
|
||||||
|
o http://dev.processing.org/bugs/show_bug.cgi?id=602
|
||||||
|
X some camera problems may be coming from "cameraNear = -8" line
|
||||||
|
X this may cause other problems with drawing/clipping however
|
||||||
|
X opengl camera does not update on current frame (has to do a second frame)
|
||||||
|
X remove methods from PApplet that use doubles
|
||||||
|
|
||||||
|
|
||||||
|
0169 core (1.0.7)
|
||||||
|
X remove major try/catch block from PApplet.main()
|
||||||
|
X hopefully will allow some exception stuff to come through properly
|
||||||
|
X PVector.angleDistance() returns NaN
|
||||||
|
X http://dev.processing.org/bugs/show_bug.cgi?id=1316
|
||||||
|
|
||||||
|
|
||||||
0168 core (1.0.6)
|
0168 core (1.0.6)
|
||||||
X getImage() setting the wrong image type
|
X getImage() setting the wrong image type
|
||||||
X http://dev.processing.org/bugs/show_bug.cgi?id=1282
|
X http://dev.processing.org/bugs/show_bug.cgi?id=1282
|
||||||
|
7
core/preproc/.classpath
Normal file
7
core/preproc/.classpath
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<classpath>
|
||||||
|
<classpathentry kind="src" path="src"/>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||||
|
<classpathentry kind="lib" path="/usr/share/ant/lib/ant.jar"/>
|
||||||
|
<classpathentry kind="output" path="bin"/>
|
||||||
|
</classpath>
|
17
core/preproc/.project
Normal file
17
core/preproc/.project
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>preproc</name>
|
||||||
|
<comment></comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||||
|
</natures>
|
||||||
|
</projectDescription>
|
22
core/preproc/build.xml
Normal file
22
core/preproc/build.xml
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<project name="preproc" default="task-lib">
|
||||||
|
|
||||||
|
<target name="compile">
|
||||||
|
<mkdir dir="bin" />
|
||||||
|
<!-- <javac target="1.5" srcdir="src" destdir="bin" classpath="../ant/ant.jar" debug="true"/>-->
|
||||||
|
<javac target="1.5" srcdir="src" destdir="bin" classpath="/usr/share/ant/ant.jar" debug="true"/>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="task-lib" depends="compile">
|
||||||
|
<jar basedir="bin" destfile="preproc.jar" />
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="demo">
|
||||||
|
<taskdef name="preproc" classname="processing.build.PAppletMethods" classpath="preproc.jar" />
|
||||||
|
<preproc dir="demo"/>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="clean">
|
||||||
|
<delete dir="bin" />
|
||||||
|
<delete file="preproc.jar" />
|
||||||
|
</target>
|
||||||
|
</project>
|
8155
core/preproc/demo/PApplet.java
Normal file
8155
core/preproc/demo/PApplet.java
Normal file
File diff suppressed because it is too large
Load Diff
5043
core/preproc/demo/PGraphics.java
Normal file
5043
core/preproc/demo/PGraphics.java
Normal file
File diff suppressed because it is too large
Load Diff
2713
core/preproc/demo/PImage.java
Normal file
2713
core/preproc/demo/PImage.java
Normal file
File diff suppressed because it is too large
Load Diff
BIN
core/preproc/preproc.jar
Normal file
BIN
core/preproc/preproc.jar
Normal file
Binary file not shown.
236
core/preproc/src/processing/build/PAppletMethods.java
Normal file
236
core/preproc/src/processing/build/PAppletMethods.java
Normal file
@ -0,0 +1,236 @@
|
|||||||
|
package processing.build;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.io.PrintStream;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import org.apache.tools.ant.BuildException;
|
||||||
|
import org.apache.tools.ant.Task;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ant Task for copying the PImage and PGraphics methods into PApplet.
|
||||||
|
*/
|
||||||
|
public class PAppletMethods extends Task {
|
||||||
|
|
||||||
|
private File baseDir;
|
||||||
|
|
||||||
|
|
||||||
|
public PAppletMethods() {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setDir(String dir) {
|
||||||
|
baseDir = new File(dir);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void execute() throws BuildException {
|
||||||
|
// Do a bunch of checks...
|
||||||
|
if (baseDir == null) {
|
||||||
|
throw new BuildException("dir parameter must be set!");
|
||||||
|
}
|
||||||
|
|
||||||
|
File graphicsFile = new File(baseDir, "PGraphics.java");
|
||||||
|
File appletFile = new File(baseDir, "PApplet.java");
|
||||||
|
File imageFile = new File(baseDir, "PImage.java");
|
||||||
|
|
||||||
|
if (!graphicsFile.exists() || !graphicsFile.canRead()) {
|
||||||
|
throw new BuildException("PGraphics file not readable: " +
|
||||||
|
graphicsFile.getAbsolutePath());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!appletFile.exists() || !appletFile.canRead() || !appletFile.canWrite()) {
|
||||||
|
throw new BuildException("PApplet file not read/writeable: " +
|
||||||
|
appletFile.getAbsolutePath());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!imageFile.exists() || !imageFile.canRead()) {
|
||||||
|
throw new BuildException("PImage file not readable: " +
|
||||||
|
imageFile.getAbsolutePath());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Looking good, let's do this!
|
||||||
|
ByteArrayOutputStream outBytes = new ByteArrayOutputStream();
|
||||||
|
PrintStream out = new PrintStream(outBytes);
|
||||||
|
StringBuffer content = new StringBuffer();
|
||||||
|
|
||||||
|
try{
|
||||||
|
BufferedReader applet = createReader(appletFile);
|
||||||
|
String line;
|
||||||
|
while ((line = applet.readLine()) != null) {
|
||||||
|
out.println(line);
|
||||||
|
content.append(line + "\n");
|
||||||
|
|
||||||
|
if (line.indexOf("public functions for processing.core") >= 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// read the rest of the file and append it to the
|
||||||
|
while ((line = applet.readLine()) != null) {
|
||||||
|
content.append(line + "\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
applet.close();
|
||||||
|
process(out, graphicsFile);
|
||||||
|
process(out, imageFile);
|
||||||
|
|
||||||
|
out.println("}");
|
||||||
|
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
|
||||||
|
} catch(Exception ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
}
|
||||||
|
out.flush();
|
||||||
|
|
||||||
|
if (content.toString().equals(outBytes.toString())) {
|
||||||
|
System.out.println("No changes to PApplet API.");
|
||||||
|
} else {
|
||||||
|
System.out.println("Updating PApplet with API changes from PImage or PGraphics.");
|
||||||
|
try {
|
||||||
|
PrintStream temp = new PrintStream(appletFile);
|
||||||
|
temp.print(outBytes.toString());
|
||||||
|
temp.flush();
|
||||||
|
temp.close();
|
||||||
|
} catch (FileNotFoundException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void process(PrintStream out, File input) throws IOException {
|
||||||
|
BufferedReader in = createReader(input);
|
||||||
|
int comments = 0;
|
||||||
|
String line = null;
|
||||||
|
|
||||||
|
while ((line = in.readLine()) != null) {
|
||||||
|
String decl = "";
|
||||||
|
|
||||||
|
// Keep track of comments
|
||||||
|
if (line.matches(Pattern.quote("/*"))) {
|
||||||
|
comments ++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (line.matches(Pattern.quote("*/"))) {
|
||||||
|
comments --;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ignore everything inside comments
|
||||||
|
if (comments > 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean gotSomething = false;
|
||||||
|
boolean gotStatic = false;
|
||||||
|
|
||||||
|
Matcher result;
|
||||||
|
|
||||||
|
if ((result = Pattern.compile("^\\s*public ([\\w\\[\\]]+) [a-zA-z_]+\\(.*$").matcher(line)).matches()) {
|
||||||
|
gotSomething = true;
|
||||||
|
}
|
||||||
|
else if ((result = Pattern.compile("^\\s*abstract public ([\\w\\[\\]]+) [a-zA-z_]+\\(.*$").matcher(line)).matches()) {
|
||||||
|
gotSomething = true;
|
||||||
|
}
|
||||||
|
else if ((result = Pattern.compile("^\\s*public final ([\\w\\[\\]]+) [a-zA-z_]+\\(.*$").matcher(line)).matches()) {
|
||||||
|
gotSomething = true;
|
||||||
|
}
|
||||||
|
else if ((result = Pattern.compile("^\\s*static public ([\\w\\[\\]]+) [a-zA-z_]+\\(.*$").matcher(line)).matches()) {
|
||||||
|
gotSomething = true;
|
||||||
|
gotStatic = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// if function is marked "// ignore" then, uh, ignore it.
|
||||||
|
if (gotSomething && line.indexOf("// ignore") >= 0) {
|
||||||
|
gotSomething = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
String returns = "";
|
||||||
|
if (gotSomething) {
|
||||||
|
if (result.group(1).equals("void")) {
|
||||||
|
returns = "";
|
||||||
|
} else {
|
||||||
|
returns = "return ";
|
||||||
|
}
|
||||||
|
|
||||||
|
// remove the abstract modifier
|
||||||
|
line = line.replaceFirst(Pattern.quote("abstract"), " ");
|
||||||
|
|
||||||
|
// replace semicolons with a start def
|
||||||
|
line = line.replaceAll(Pattern.quote(";"), " {\n");
|
||||||
|
|
||||||
|
out.println("\n\n" + line);
|
||||||
|
|
||||||
|
decl += line;
|
||||||
|
while(line.indexOf(')') == -1) {
|
||||||
|
line = in.readLine();
|
||||||
|
decl += line;
|
||||||
|
line = line.replaceAll("\\;\\s*$", " {\n");
|
||||||
|
out.println(line);
|
||||||
|
}
|
||||||
|
|
||||||
|
result = Pattern.compile(".*?\\s(\\S+)\\(.*?").matcher(decl);
|
||||||
|
result.matches(); // try to match. DON't remove this or things will stop working!
|
||||||
|
String declName = result.group(1);
|
||||||
|
String gline = "";
|
||||||
|
String rline = "";
|
||||||
|
if (gotStatic) {
|
||||||
|
gline = " " + returns + "PGraphics." + declName + "(";
|
||||||
|
} else {
|
||||||
|
rline = " if (recorder != null) recorder." + declName + "(";
|
||||||
|
gline = " " + returns + "g." + declName + "(";
|
||||||
|
}
|
||||||
|
|
||||||
|
decl = decl.replaceAll("\\s+", " "); // smush onto a single line
|
||||||
|
decl = decl.replaceFirst("^.*\\(", "");
|
||||||
|
decl = decl.replaceFirst("\\).*$", "");
|
||||||
|
|
||||||
|
int prev = 0;
|
||||||
|
String parts[] = decl.split("\\, ");
|
||||||
|
|
||||||
|
for (String part : parts) {
|
||||||
|
if (!part.trim().equals("")) {
|
||||||
|
String blargh[] = part.split(" ");
|
||||||
|
String theArg = blargh[1].replaceAll("[\\[\\]]", "");
|
||||||
|
|
||||||
|
if (prev != 0) {
|
||||||
|
gline += ", ";
|
||||||
|
rline += ", ";
|
||||||
|
}
|
||||||
|
|
||||||
|
gline += theArg;
|
||||||
|
rline += theArg;
|
||||||
|
prev = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
gline += ");";
|
||||||
|
rline += ");";
|
||||||
|
|
||||||
|
if (!gotStatic && returns.equals("")) {
|
||||||
|
out.println(rline);
|
||||||
|
}
|
||||||
|
|
||||||
|
out.println(gline);
|
||||||
|
out.println(" }");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
in.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static BufferedReader createReader(File f) throws FileNotFoundException {
|
||||||
|
return new BufferedReader(new InputStreamReader(new FileInputStream(f)));
|
||||||
|
}
|
||||||
|
}
|
@ -2687,6 +2687,12 @@ public class PApplet extends Applet
|
|||||||
return (a > b) ? a : b;
|
return (a > b) ? a : b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
static public final double max(double a, double b) {
|
||||||
|
return (a > b) ? a : b;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
static public final int max(int a, int b, int c) {
|
static public final int max(int a, int b, int c) {
|
||||||
return (a > b) ? ((a > c) ? a : c) : ((b > c) ? b : c);
|
return (a > b) ? ((a > c) ? a : c) : ((b > c) ? b : c);
|
||||||
@ -2732,6 +2738,26 @@ public class PApplet extends Applet
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find the maximum value in an array.
|
||||||
|
* Throws an ArrayIndexOutOfBoundsException if the array is length 0.
|
||||||
|
* @param list the source array
|
||||||
|
* @return The maximum value
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
static public final double max(double[] list) {
|
||||||
|
if (list.length == 0) {
|
||||||
|
throw new ArrayIndexOutOfBoundsException(ERROR_MIN_MAX);
|
||||||
|
}
|
||||||
|
double max = list[0];
|
||||||
|
for (int i = 1; i < list.length; i++) {
|
||||||
|
if (list[i] > max) max = list[i];
|
||||||
|
}
|
||||||
|
return max;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
static public final int min(int a, int b) {
|
static public final int min(int a, int b) {
|
||||||
return (a < b) ? a : b;
|
return (a < b) ? a : b;
|
||||||
}
|
}
|
||||||
@ -2740,6 +2766,12 @@ public class PApplet extends Applet
|
|||||||
return (a < b) ? a : b;
|
return (a < b) ? a : b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
static public final double min(double a, double b) {
|
||||||
|
return (a < b) ? a : b;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
static public final int min(int a, int b, int c) {
|
static public final int min(int a, int b, int c) {
|
||||||
return (a < b) ? ((a < c) ? a : c) : ((b < c) ? b : c);
|
return (a < b) ? ((a < c) ? a : c) : ((b < c) ? b : c);
|
||||||
@ -2749,6 +2781,12 @@ public class PApplet extends Applet
|
|||||||
return (a < b) ? ((a < c) ? a : c) : ((b < c) ? b : c);
|
return (a < b) ? ((a < c) ? a : c) : ((b < c) ? b : c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
static public final double min(double a, double b, double c) {
|
||||||
|
return (a < b) ? ((a < c) ? a : c) : ((b < c) ? b : c);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find the minimum value in an array.
|
* Find the minimum value in an array.
|
||||||
@ -2766,6 +2804,8 @@ public class PApplet extends Applet
|
|||||||
}
|
}
|
||||||
return min;
|
return min;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find the minimum value in an array.
|
* Find the minimum value in an array.
|
||||||
* Throws an ArrayIndexOutOfBoundsException if the array is length 0.
|
* Throws an ArrayIndexOutOfBoundsException if the array is length 0.
|
||||||
@ -2784,6 +2824,25 @@ public class PApplet extends Applet
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find the minimum value in an array.
|
||||||
|
* Throws an ArrayIndexOutOfBoundsException if the array is length 0.
|
||||||
|
* @param list the source array
|
||||||
|
* @return The minimum value
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
static public final double min(double[] list) {
|
||||||
|
if (list.length == 0) {
|
||||||
|
throw new ArrayIndexOutOfBoundsException(ERROR_MIN_MAX);
|
||||||
|
}
|
||||||
|
double min = list[0];
|
||||||
|
for (int i = 1; i < list.length; i++) {
|
||||||
|
if (list[i] < min) min = list[i];
|
||||||
|
}
|
||||||
|
return min;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
static public final int constrain(int amt, int low, int high) {
|
static public final int constrain(int amt, int low, int high) {
|
||||||
return (amt < low) ? low : ((amt > high) ? high : amt);
|
return (amt < low) ? low : ((amt > high) ? high : amt);
|
||||||
}
|
}
|
||||||
@ -2888,11 +2947,13 @@ public class PApplet extends Applet
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
static public final double map(double value,
|
static public final double map(double value,
|
||||||
double istart, double istop,
|
double istart, double istop,
|
||||||
double ostart, double ostop) {
|
double ostart, double ostop) {
|
||||||
return ostart + (ostop - ostart) * ((value - istart) / (istop - istart));
|
return ostart + (ostop - ostart) * ((value - istart) / (istop - istart));
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -4355,18 +4416,34 @@ public class PApplet extends Applet
|
|||||||
* Saves bytes to a specific File location specified by the user.
|
* Saves bytes to a specific File location specified by the user.
|
||||||
*/
|
*/
|
||||||
static public void saveBytes(File file, byte buffer[]) {
|
static public void saveBytes(File file, byte buffer[]) {
|
||||||
|
File tempFile = null;
|
||||||
try {
|
try {
|
||||||
|
File parentDir = file.getParentFile();
|
||||||
|
tempFile = File.createTempFile(file.getName(), null, parentDir);
|
||||||
|
|
||||||
|
/*
|
||||||
String filename = file.getAbsolutePath();
|
String filename = file.getAbsolutePath();
|
||||||
createPath(filename);
|
createPath(filename);
|
||||||
OutputStream output = new FileOutputStream(file);
|
OutputStream output = new FileOutputStream(file);
|
||||||
if (file.getName().toLowerCase().endsWith(".gz")) {
|
if (file.getName().toLowerCase().endsWith(".gz")) {
|
||||||
output = new GZIPOutputStream(output);
|
output = new GZIPOutputStream(output);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
OutputStream output = createOutput(tempFile);
|
||||||
saveBytes(output, buffer);
|
saveBytes(output, buffer);
|
||||||
output.close();
|
output.close();
|
||||||
|
output = null;
|
||||||
|
|
||||||
|
if (!tempFile.renameTo(file)) {
|
||||||
|
System.err.println("Could not rename temporary file " +
|
||||||
|
tempFile.getAbsolutePath());
|
||||||
|
}
|
||||||
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
System.err.println("error saving bytes to " + file);
|
System.err.println("error saving bytes to " + file);
|
||||||
|
if (tempFile != null) {
|
||||||
|
tempFile.delete();
|
||||||
|
}
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4393,6 +4470,8 @@ public class PApplet extends Applet
|
|||||||
|
|
||||||
|
|
||||||
static public void saveStrings(File file, String strings[]) {
|
static public void saveStrings(File file, String strings[]) {
|
||||||
|
saveStrings(createOutput(file), strings);
|
||||||
|
/*
|
||||||
try {
|
try {
|
||||||
String location = file.getAbsolutePath();
|
String location = file.getAbsolutePath();
|
||||||
createPath(location);
|
createPath(location);
|
||||||
@ -4406,18 +4485,17 @@ public class PApplet extends Applet
|
|||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static public void saveStrings(OutputStream output, String strings[]) {
|
static public void saveStrings(OutputStream output, String strings[]) {
|
||||||
try {
|
PrintWriter writer = createWriter(output);
|
||||||
OutputStreamWriter osw = new OutputStreamWriter(output, "UTF-8");
|
|
||||||
PrintWriter writer = new PrintWriter(osw);
|
|
||||||
for (int i = 0; i < strings.length; i++) {
|
for (int i = 0; i < strings.length; i++) {
|
||||||
writer.println(strings[i]);
|
writer.println(strings[i]);
|
||||||
}
|
}
|
||||||
writer.flush();
|
writer.flush();
|
||||||
} catch (UnsupportedEncodingException e) { } // will not happen
|
writer.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
/*
|
/*
|
||||||
Part of the Processing project - http://processing.org
|
Part of the Processing project - http://processing.org
|
||||||
|
|
||||||
Copyright (c) 2004-08 Ben Fry and Casey Reas
|
Copyright (c) 2004-09 Ben Fry and Casey Reas
|
||||||
Copyright (c) 2001-04 Massachusetts Institute of Technology
|
Copyright (c) 2001-04 Massachusetts Institute of Technology
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
This library is free software; you can redistribute it and/or
|
||||||
|
@ -358,12 +358,12 @@ public class PGraphics3D extends PGraphics {
|
|||||||
cameraInv = new PMatrix3D();
|
cameraInv = new PMatrix3D();
|
||||||
|
|
||||||
// set up the default camera
|
// set up the default camera
|
||||||
camera();
|
// camera();
|
||||||
|
|
||||||
// defaults to perspective, if the user has setup up their
|
// defaults to perspective, if the user has setup up their
|
||||||
// own projection, they'll need to fix it after resize anyway.
|
// own projection, they'll need to fix it after resize anyway.
|
||||||
// this helps the people who haven't set up their own projection.
|
// this helps the people who haven't set up their own projection.
|
||||||
perspective();
|
// perspective();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -478,6 +478,12 @@ public class PGraphics3D extends PGraphics {
|
|||||||
forwardTransform = modelview;
|
forwardTransform = modelview;
|
||||||
reverseTransform = modelviewInv;
|
reverseTransform = modelviewInv;
|
||||||
|
|
||||||
|
// set up the default camera
|
||||||
|
camera();
|
||||||
|
|
||||||
|
// defaults to perspective, if the user has setup up their
|
||||||
|
// own projection, they'll need to fix it after resize anyway.
|
||||||
|
// this helps the people who haven't set up their own projection.
|
||||||
perspective();
|
perspective();
|
||||||
|
|
||||||
// easiest for beginners
|
// easiest for beginners
|
||||||
@ -1344,7 +1350,7 @@ public class PGraphics3D extends PGraphics {
|
|||||||
boolean bClipped = false;
|
boolean bClipped = false;
|
||||||
int clippedCount = 0;
|
int clippedCount = 0;
|
||||||
|
|
||||||
cameraNear = -8;
|
// cameraNear = -8;
|
||||||
if (vertices[a][VZ] > cameraNear) {
|
if (vertices[a][VZ] > cameraNear) {
|
||||||
aClipped = true;
|
aClipped = true;
|
||||||
clippedCount++;
|
clippedCount++;
|
||||||
@ -1358,8 +1364,15 @@ public class PGraphics3D extends PGraphics {
|
|||||||
clippedCount++;
|
clippedCount++;
|
||||||
}
|
}
|
||||||
if (clippedCount == 0) {
|
if (clippedCount == 0) {
|
||||||
|
// if (vertices[a][VZ] < cameraFar &&
|
||||||
|
// vertices[b][VZ] < cameraFar &&
|
||||||
|
// vertices[c][VZ] < cameraFar) {
|
||||||
addTriangleWithoutClip(a, b, c);
|
addTriangleWithoutClip(a, b, c);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// } else if (true) {
|
||||||
|
// return;
|
||||||
|
|
||||||
} else if (clippedCount == 3) {
|
} else if (clippedCount == 3) {
|
||||||
// In this case there is only one visible point. |/|
|
// In this case there is only one visible point. |/|
|
||||||
// So we'll have to make two new points on the clip line <| |
|
// So we'll have to make two new points on the clip line <| |
|
||||||
@ -3502,6 +3515,7 @@ public class PGraphics3D extends PGraphics {
|
|||||||
0, y, 0, ty,
|
0, y, 0, ty,
|
||||||
0, 0, z, tz,
|
0, 0, z, tz,
|
||||||
0, 0, 0, 1);
|
0, 0, 0, 1);
|
||||||
|
updateProjection();
|
||||||
|
|
||||||
frustumMode = false;
|
frustumMode = false;
|
||||||
}
|
}
|
||||||
@ -3569,6 +3583,12 @@ public class PGraphics3D extends PGraphics {
|
|||||||
0, (2*znear)/(top-bottom), (top+bottom)/(top-bottom), 0,
|
0, (2*znear)/(top-bottom), (top+bottom)/(top-bottom), 0,
|
||||||
0, 0, -(zfar+znear)/(zfar-znear),-(2*zfar*znear)/(zfar-znear),
|
0, 0, -(zfar+znear)/(zfar-znear),-(2*zfar*znear)/(zfar-znear),
|
||||||
0, 0, -1, 0);
|
0, 0, -1, 0);
|
||||||
|
updateProjection();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** Called after the 'projection' PMatrix3D has changed. */
|
||||||
|
protected void updateProjection() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -182,6 +182,7 @@ public class PImage implements PConstants, Cloneable {
|
|||||||
raster.getDataElements(0, 0, width, height, pixels);
|
raster.getDataElements(0, 0, width, height, pixels);
|
||||||
|
|
||||||
} else { // go the old school java 1.0 route
|
} else { // go the old school java 1.0 route
|
||||||
|
// System.out.println(img.getClass().getName());
|
||||||
width = img.getWidth(null);
|
width = img.getWidth(null);
|
||||||
height = img.getHeight(null);
|
height = img.getHeight(null);
|
||||||
pixels = new int[width * height];
|
pixels = new int[width * height];
|
||||||
@ -690,7 +691,7 @@ public class PImage implements PConstants, Cloneable {
|
|||||||
throw new RuntimeException("Use filter(POSTERIZE, int levels) " +
|
throw new RuntimeException("Use filter(POSTERIZE, int levels) " +
|
||||||
"instead of filter(POSTERIZE)");
|
"instead of filter(POSTERIZE)");
|
||||||
|
|
||||||
case RGB:
|
case OPAQUE:
|
||||||
for (int i = 0; i < pixels.length; i++) {
|
for (int i = 0; i < pixels.length; i++) {
|
||||||
pixels[i] |= 0xff000000;
|
pixels[i] |= 0xff000000;
|
||||||
}
|
}
|
||||||
|
@ -430,6 +430,11 @@ public class PVector {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static public float dot(PVector v1, PVector v2) {
|
||||||
|
return v1.x*v2.x + v1.y*v2.y + v1.z*v2.z;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a vector composed of the cross product between this and another.
|
* Return a vector composed of the cross product between this and another.
|
||||||
*/
|
*/
|
||||||
|
@ -1,8 +1,30 @@
|
|||||||
0169 core
|
0171 core
|
||||||
X remove major try/catch block from PApplet.main()
|
X Blurred PImages in OPENGL sketches
|
||||||
X hopefully will allow some exception stuff to come through properly
|
X removed NPOT texture support (for further testing)
|
||||||
X PVector.angleDistance() returns NaN
|
X http://dev.processing.org/bugs/show_bug.cgi?id=1352
|
||||||
X http://dev.processing.org/bugs/show_bug.cgi?id=1316
|
|
||||||
|
_ open up the pdf library more (philho)
|
||||||
|
_ http://dev.processing.org/bugs/show_bug.cgi?id=1343
|
||||||
|
_ changing vertex alpha in P3D in a QUAD_STRIP is ignored
|
||||||
|
_ with smoothing, it works fine, but with PTriangle, it's not
|
||||||
|
_ smooth() not working with applets an createGraphics(JAVA2D)
|
||||||
|
_ but works fine with applications
|
||||||
|
_ get() with OPENGL is grabbing the wrong coords
|
||||||
|
_ http://dev.processing.org/bugs/show_bug.cgi?id=1349
|
||||||
|
|
||||||
|
_ No textures render with hint(ENABLE_ACCURATE_TEXTURES)
|
||||||
|
_ http://dev.processing.org/bugs/show_bug.cgi?id=985
|
||||||
|
_ need to remove the hint from the reference
|
||||||
|
_ need to throw an error when it's used
|
||||||
|
_ deal with issue of single pixel seam at the edge of textures
|
||||||
|
_ http://dev.processing.org/bugs/show_bug.cgi?id=602
|
||||||
|
_ should vertexTexture() divide by width/height or width-1/height-1?
|
||||||
|
|
||||||
|
_ key and mouse events delivered out of order
|
||||||
|
_ http://dev.processing.org/bugs/show_bug.cgi?id=638
|
||||||
|
_ key/mouse events have concurrency problems with noLoop()
|
||||||
|
_ http://dev.processing.org/bugs/show_bug.cgi?id=1323
|
||||||
|
_ need to say "no drawing inside mouse/key events w/ noLoop"
|
||||||
|
|
||||||
_ make the index lookup use numbers up to 256?
|
_ make the index lookup use numbers up to 256?
|
||||||
|
|
||||||
@ -170,12 +192,6 @@ _ smooth in P3D has zbuffer glitches
|
|||||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=1000
|
_ http://dev.processing.org/bugs/show_bug.cgi?id=1000
|
||||||
_ smoothing is slow
|
_ smoothing is slow
|
||||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=1001
|
_ http://dev.processing.org/bugs/show_bug.cgi?id=1001
|
||||||
_ No textures render with hint(ENABLE_ACCURATE_TEXTURES)
|
|
||||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=985
|
|
||||||
_ need to remove the hint from the reference
|
|
||||||
_ need to throw an error when it's used
|
|
||||||
_ deal with issue of single pixel seam at the edge of textures
|
|
||||||
_ ??? what is the bug # for this one?
|
|
||||||
_ textured sphere example needs to set normals
|
_ textured sphere example needs to set normals
|
||||||
_ also needs fix for last edge and the seam
|
_ also needs fix for last edge and the seam
|
||||||
|
|
||||||
@ -235,8 +251,6 @@ _ PApplet.main(new String[] { "classname" }) won't pass in args
|
|||||||
_ this means that no args are after passed to the class
|
_ this means that no args are after passed to the class
|
||||||
_ the fix would be to use the following as the call to main()
|
_ the fix would be to use the following as the call to main()
|
||||||
_ PApplet.main(append(new String[] { "classname }, args));
|
_ PApplet.main(append(new String[] { "classname }, args));
|
||||||
_ key and mouse events delivered out of order
|
|
||||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=638
|
|
||||||
_ figure out why 1024x768 image takes 3.5 seconds to load
|
_ figure out why 1024x768 image takes 3.5 seconds to load
|
||||||
_ would using a BufferedImage work better?
|
_ would using a BufferedImage work better?
|
||||||
_ is the image actually a BufferedImage so PixelGrabber is a waste?
|
_ is the image actually a BufferedImage so PixelGrabber is a waste?
|
||||||
|
Reference in New Issue
Block a user