Permalink
Browse files

Syncing with Processing 1.0.9 (revision 5766).

  • Loading branch information...
1 parent 7f58e22 commit 2e26a2d994d6a082f4a83ddc7bcdb7f29d9b69b6 @damellis damellis committed Oct 22, 2009
Showing with 16,809 additions and 892 deletions.
  1. +24 −129 app/src/processing/app/Base.java
  2. +65 −0 app/src/processing/app/Editor.java
  3. +30 −144 app/src/processing/app/Preferences.java
  4. +24 −12 app/src/processing/app/Sketch.java
  5. +6 −0 app/src/processing/app/debug/Runner.java
  6. +2 −0 app/src/processing/app/macosx/Platform.java
  7. +195 −212 app/src/processing/app/preproc/PdePreprocessor.java
  8. +15 −15 build/macosx/dist/Arduino.app/Contents/Info.plist
  9. +0 −6 build/macosx/make.sh
  10. +0 −1 build/shared/lib/preferences.txt
  11. +0 −5 build/shared/libraries/howto.txt
  12. +0 −6 build/shared/libraries/javascript/library/export.txt
  13. BIN build/shared/libraries/javascript/library/javascript.jar
  14. BIN build/shared/libraries/minim/library/jl1.0.jar
  15. BIN build/shared/libraries/minim/library/jsminim.jar
  16. BIN build/shared/libraries/minim/library/minim-spi.jar
  17. BIN build/shared/libraries/minim/library/minim.jar
  18. BIN build/shared/libraries/minim/library/mp3spi1.9.4.jar
  19. BIN build/shared/libraries/minim/library/tritonus_aos.jar
  20. BIN build/shared/libraries/minim/library/tritonus_share.jar
  21. +0 −339 build/shared/libraries/minim/license.txt
  22. +0 −1 build/shared/libraries/minim/version.txt
  23. +89 −0 build/shared/revisions.txt
  24. +26 −0 core/done.txt
  25. +7 −0 core/preproc/.classpath
  26. +17 −0 core/preproc/.project
  27. +22 −0 core/preproc/build.xml
  28. +8,155 −0 core/preproc/demo/PApplet.java
  29. +5,043 −0 core/preproc/demo/PGraphics.java
  30. +2,713 −0 core/preproc/demo/PImage.java
  31. BIN core/preproc/preproc.jar
  32. +236 −0 core/preproc/src/processing/build/PAppletMethods.java
  33. +82 −4 core/src/processing/core/PApplet.java
  34. +1 −1 core/src/processing/core/PGraphics.java
  35. +23 −3 core/src/processing/core/PGraphics3D.java
  36. +2 −1 core/src/processing/core/PImage.java
  37. +5 −0 core/src/processing/core/PVector.java
  38. +27 −13 core/todo.txt
@@ -180,71 +180,7 @@ static public void main(String args[]) {
// setup the theme coloring fun
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
- // For 0158, moving it lower so that the apple.laf.useScreenMenuBar stuff works
try {
platform.setLookAndFeel();
} catch (Exception e) {
@@ -815,7 +751,8 @@ protected Editor handleOpen(String path, int[] location) {
*/
public boolean handleClose(Editor editor) {
// Check if modified
- if (!editor.checkModified(false)) {
+ boolean immediate = editors.size() == 1;
+ if (!editor.checkModified(immediate)) {
return false;
}
@@ -993,17 +930,9 @@ public void actionPerformed(ActionEvent e) {
protected void rebuildSketchbookMenu(JMenu menu) {
//System.out.println("rebuilding sketchbook menu");
//new Exception().printStackTrace();
- //boolean nativeButBroken = Base.isMacOS() ?
- //Preferences.getBoolean("apple.laf.useScreenMenuBar") : false;
- boolean nativeButBroken = false;
-
try {
- if (nativeButBroken) { // osx workaround
- menu.setEnabled(false);
- } else {
menu.removeAll();
addSketches(menu, getSketchbookFolder(), false);
- }
} catch (IOException e) {
e.printStackTrace();
}
@@ -1045,21 +974,13 @@ public void rebuildImportMenu(JMenu importMenu) {
public void rebuildExamplesMenu(JMenu menu) {
//System.out.println("rebuilding examples menu");
- //boolean nativeButBroken = Base.isMacOS() ?
- //Preferences.getBoolean("apple.laf.useScreenMenuBar") : false;
- boolean nativeButBroken = false;
-
try {
- if (nativeButBroken) { // osx workaround
- menu.setEnabled(false);
- } else {
- menu.removeAll();
- boolean found = addSketches(menu, examplesFolder, false);
- if (found) menu.addSeparator();
- found = addSketches(menu, getSketchbookLibrariesFolder(), false);
- if (found) menu.addSeparator();
- addSketches(menu, librariesFolder, false);
- }
+ menu.removeAll();
+ boolean found = addSketches(menu, examplesFolder, false);
+ if (found) menu.addSeparator();
+ found = addSketches(menu, getSketchbookLibrariesFolder(), false);
+ if (found) menu.addSeparator();
+ addSketches(menu, librariesFolder, false);
} catch (IOException e) {
e.printStackTrace();
}
@@ -1965,56 +1886,30 @@ static public void copyFile(File sourceFile,
* Grab the contents of a file as a string.
*/
static public String loadFile(File file) throws IOException {
- return PApplet.join(PApplet.loadStrings(file), "\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');
+ String[] contents = PApplet.loadStrings(file);
+ if (contents == null) return null;
+ return PApplet.join(contents, "\n");
}
- reader.close();
- return buffer.toString();
- */
- }
/**
* Spew the contents of a String object out to a file.
*/
static public void saveFile(String str, File file) throws IOException {
- PApplet.saveStrings(file, new String[] { str });
- /*
- ByteArrayInputStream bis = new ByteArrayInputStream(str.getBytes());
- InputStreamReader isr = new InputStreamReader(bis);
- BufferedReader reader = new BufferedReader(isr);
-
- FileOutputStream fos = new FileOutputStream(file);
- OutputStreamWriter osw = new OutputStreamWriter(fos, "UTF-8");
- PrintWriter writer = new PrintWriter(osw);
-
- String line = null;
- while ((line = reader.readLine()) != null) {
- writer.println(line);
+ File temp = File.createTempFile(file.getName(), null, file.getParentFile());
+ PApplet.saveStrings(temp, new String[] { str });
+ if (file.exists()) {
+ boolean result = file.delete();
+ if (!result) {
+ throw new IOException("Could not remove old version of " +
+ file.getAbsolutePath());
+ }
+ }
+ boolean result = temp.renameTo(file);
+ if (!result) {
+ throw new IOException("Could not replace " +
+ file.getAbsolutePath());
}
- writer.flush();
- writer.close();
- */
}
@@ -114,6 +114,9 @@
EditorLineStatus lineStatus;
+ boolean newEditor = true;
+ JEditorPane editorPane;
+
JEditTextArea textarea;
EditorListener listener;
@@ -229,7 +232,22 @@ public void windowDeactivated(WindowEvent e) {
lineStatus = new EditorLineStatus(textarea);
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);
+// }
splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT,
upper, consolePanel);
@@ -345,6 +363,46 @@ public boolean importData(JComponent src, Transferable transferable) {
}
+ /*
+ // 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) {
setBounds(location[0], location[1], location[2], location[3]);
if (location[4] != 0) {
@@ -859,6 +917,13 @@ protected JMenu addInternalTools(JMenu menu) {
menu.add(createToolMenuItem("processing.app.tools.Archiver"));
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;
}
Oops, something went wrong.

0 comments on commit 2e26a2d

Please sign in to comment.