From 6d8ebec0c0fe7081702b8b361a587fb82898e5c0 Mon Sep 17 00:00:00 2001 From: benfry Date: Sat, 21 Jul 2012 16:37:46 +0000 Subject: [PATCH] get core loading properly on Windows, change displays to be numbered at 0 --- app/build.xml | 16 +----- app/src/processing/app/Preferences.java | 50 +++++++++---------- app/src/processing/mode/java/JavaMode.java | 46 ++++++++--------- .../processing/mode/java/runner/Runner.java | 4 +- build/build.xml | 14 +++++- build/linux/processing | 3 ++ build/shared/lib/preferences.txt | 2 +- build/windows/launcher/config.xml | 2 +- core/src/processing/core/PApplet.java | 27 +++++----- 9 files changed, 85 insertions(+), 79 deletions(-) diff --git a/app/build.xml b/app/build.xml index 2525843cf..f9d75873d 100644 --- a/app/build.xml +++ b/app/build.xml @@ -105,29 +105,17 @@ - - diff --git a/app/src/processing/app/Preferences.java b/app/src/processing/app/Preferences.java index eb881464a..086e7dd2e 100644 --- a/app/src/processing/app/Preferences.java +++ b/app/src/processing/app/Preferences.java @@ -278,11 +278,11 @@ public class Preferences { fontSizeField.setText(String.valueOf(editorFont.getSize())); top += d.height + GUI_BETWEEN; - - // [ ] Use smooth text in editor window + + // [ ] Use smooth text in editor window editorAntialiasBox = - new JCheckBox("Use smooth text in editor window " + + new JCheckBox("Use smooth text in editor window " + "(requires restart of Processing)"); pain.add(editorAntialiasBox); d = editorAntialiasBox.getPreferredSize(); @@ -291,7 +291,7 @@ public class Preferences { right = Math.max(right, left + d.width); top += d.height + GUI_BETWEEN; - + // [ ] Increase maximum available memory to [______] MB Container memoryBox = Box.createHorizontalBox(); @@ -348,8 +348,8 @@ public class Preferences { checkUpdatesBox.setBounds(left, top, d.width + 10, d.height); right = Math.max(right, left + d.width); top += d.height + GUI_BETWEEN; - - + + // Run sketches on display [ 1 ] Container displayBox = Box.createHorizontalBox(); @@ -357,7 +357,7 @@ public class Preferences { final String tip = "" + "Sets the display where sketches are initially placed.
" + "As usual, if the sketch window is moved, it will re-open
" + - "at the same location, however when running in present
" + + "at the same location, however when running in present
" + "(full screen) mode, this display will always be used."; displayLabel.setToolTipText(tip); displayBox.add(displayLabel); @@ -381,10 +381,10 @@ public class Preferences { right = Math.max(right, left + d.width); top += d.height + GUI_BETWEEN; } - - + + // Launch programs as [ ] 32-bit [ ] 64-bit (Mac OS X only) - + if (Base.isMacOS()) { box = Box.createHorizontalBox(); label = new JLabel("Launch programs in "); @@ -393,17 +393,17 @@ public class Preferences { box.add(bitsThirtyTwoButton); bitsSixtyFourButton = new JRadioButton("64-bit mode"); box.add(bitsSixtyFourButton); - + ButtonGroup bg = new ButtonGroup(); bg.add(bitsThirtyTwoButton); bg.add(bitsSixtyFourButton); - + pain.add(box); d = box.getPreferredSize(); box.setBounds(left, top, d.width, d.height); top += d.height + GUI_BETWEEN; } - + // More preferences are in the ... @@ -543,7 +543,7 @@ public class Preferences { */ protected void applyFrame() { setBoolean("editor.antialias", editorAntialiasBox.isSelected()); - + // put each of the settings into the table setBoolean("export.applet.separate_jar_files", exportSeparateBox.isSelected()); @@ -571,7 +571,7 @@ public class Preferences { displayIndex = d; } } - setInteger("run.display", displayIndex + 1); + setInteger("run.display", displayIndex); setBoolean("run.options.memory", memoryOverrideBox.isSelected()); int memoryMin = Preferences.getInteger("run.options.memory.initial"); @@ -656,13 +656,13 @@ public class Preferences { setSelected(getBoolean("update.check")); updateDisplayList(); - int displayNum = getInteger("run.display") - 1; + int displayNum = getInteger("run.display"); // System.out.println("display is " + displayNum + ", d count is " + displayCount); if (displayNum >= 0 && displayNum < displayCount) { // System.out.println("setting num to " + displayNum); displaySelectionBox.setSelectedIndex(displayNum); } - + memoryOverrideBox. setSelected(getBoolean("run.options.memory")); memoryField. @@ -681,7 +681,7 @@ public class Preferences { bitsThirtyTwoButton.setEnabled(false); } } - + if (autoAssociateBox != null) { autoAssociateBox. setSelected(getBoolean("platform.auto_file_type_associations")); @@ -697,7 +697,7 @@ public class Preferences { // displaySelectionBox.removeAll(); String[] items = new String[displayCount]; for (int i = 0; i < displayCount; i++) { - items[i] = String.valueOf(i + 1); + items[i] = String.valueOf(i); // displaySelectionBox.add(String.valueOf(i + 1)); } // PApplet.println(items); @@ -706,13 +706,13 @@ public class Preferences { } - // Workaround for Apple bullsh*t caused by their not releasing a 32-bit + // Workaround for Apple bullsh*t caused by their not releasing a 32-bit // version of Java for Mac OS X 10.5. // static public String checkBits() { // String bits = Preferences.get("run.options.bits"); // if (bits == null) { // if (System.getProperty("os.version").startsWith("10.5")) { -// bits = "64"; +// bits = "64"; // } else { // bits = "32"; // } @@ -720,8 +720,8 @@ public class Preferences { // } // return bits; // } - - + + // ................................................................. @@ -800,8 +800,8 @@ public class Preferences { static public void set(String attribute, String value) { table.put(attribute, value); } - - + + static public void unset(String attribute) { table.remove(attribute); } diff --git a/app/src/processing/mode/java/JavaMode.java b/app/src/processing/mode/java/JavaMode.java index 846afa863..2f27ebf85 100644 --- a/app/src/processing/mode/java/JavaMode.java +++ b/app/src/processing/mode/java/JavaMode.java @@ -45,7 +45,7 @@ public class JavaMode extends Mode { // found in the sketchbook) // static public String librariesClassPath; - + public Editor createEditor(Base base, String path, EditorState state) { return new JavaEditor(base, path, state, this); } @@ -60,7 +60,7 @@ public class JavaMode extends Mode { Base.showError("Problem loading keywords", "Could not load keywords.txt, please re-install Processing.", e); } - + /* item = newJMenuItem("Export", 'E'); if (editor != null) { @@ -116,7 +116,7 @@ public class JavaMode extends Mode { } } - + public String getTitle() { return "Standard"; } @@ -126,50 +126,50 @@ public class JavaMode extends Mode { // return new Toolbar(editor); // } - + // public Formatter createFormatter() { // return new AutoFormat(); // } - - + + // public Editor createEditor(Base ibase, String path, int[] location) { // } - + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . public File[] getExampleCategoryFolders() { // Basics, Topics, OpenGL, Books - return new File[] { + return new File[] { new File(examplesFolder, "Basics"), new File(examplesFolder, "Topics"), new File(examplesFolder, "OpenGL"), new File(examplesFolder, "Books") }; } - + public String getDefaultExtension() { return "pde"; } - - + + public String[] getExtensions() { return new String[] { "pde", "java" }; } - + public String[] getIgnorable() { - return new String[] { + return new String[] { "applet", "application.macosx", "application.windows", "application.linux" }; } - - + + public Library getCoreLibrary() { if (coreLibrary == null) { File coreFolder = Base.getContentFile("core"); @@ -177,11 +177,11 @@ public class JavaMode extends Mode { } return coreLibrary; } - - + + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . - + public Runner handleRun(Sketch sketch, RunnerListener listener) throws SketchException { JavaBuild build = new JavaBuild(sketch); String appletClassName = build.build(false); @@ -208,7 +208,7 @@ public class JavaMode extends Mode { runtime.launch(true); } }).start(); - return runtime; + return runtime; } return null; } @@ -220,14 +220,14 @@ public class JavaMode extends Mode { // runtime = null; // will this help? // } // } - - + + // public boolean handleExportApplet(Sketch sketch) throws SketchException, IOException { // JavaBuild build = new JavaBuild(sketch); // return build.exportApplet(); // } - - + + public boolean handleExportApplication(Sketch sketch) throws SketchException, IOException { JavaBuild build = new JavaBuild(sketch); return build.exportApplication(); diff --git a/app/src/processing/mode/java/runner/Runner.java b/app/src/processing/mode/java/runner/Runner.java index 93911a47e..6d9a536ea 100644 --- a/app/src/processing/mode/java/runner/Runner.java +++ b/app/src/processing/mode/java/runner/Runner.java @@ -220,8 +220,8 @@ public class Runner implements MessageConsumer { } else { params.add("processing.core.PApplet"); - // get the stored device index (starts at 1) - int runDisplay = Preferences.getInteger("run.display") - 1; + // get the stored device index (starts at 0) + int runDisplay = Preferences.getInteger("run.display"); // If there was a saved location (this guy has been run more than once) // then the location will be set to the last position of the sketch window. diff --git a/build/build.xml b/build/build.xml index 76aff9373..37ccd1963 100644 --- a/build/build.xml +++ b/build/build.xml @@ -463,6 +463,12 @@ + + @@ -573,7 +579,13 @@ http://www.gnu.org/software/tar/manual/html_section/transform.html - + + + diff --git a/build/linux/processing b/build/linux/processing index 36a7c01f9..44761a205 100755 --- a/build/linux/processing +++ b/build/linux/processing @@ -88,6 +88,9 @@ CLASSPATH="$CLASSPATH"${CLASSPATH:+:}"$JDKCP" for LIB in "$APPDIR"/lib/*.jar; do CLASSPATH="$CLASSPATH"${CLASSPATH:+:}"$LIB" done +for LIB in "$APPDIR"/core/library/*.jar; do + CLASSPATH="$CLASSPATH"${CLASSPATH:+:}"$LIB" +done export CLASSPATH log CLASSPATH diff --git a/build/shared/lib/preferences.txt b/build/shared/lib/preferences.txt index 919ef8cba..7a3adcd42 100755 --- a/build/shared/lib/preferences.txt +++ b/build/shared/lib/preferences.txt @@ -178,7 +178,7 @@ run.options.bits.macosx = 32 # Index of the display to use for running sketches (starts at 1). # Kept this 1-indexed because older vesions of Processing were setting # the preference even before it was being used. -run.display = 1 +run.display = 0 # set internally #run.window.bgcolor= diff --git a/build/windows/launcher/config.xml b/build/windows/launcher/config.xml index 4efd2dc29..0d5a2b805 100755 --- a/build/windows/launcher/config.xml +++ b/build/windows/launcher/config.xml @@ -16,7 +16,7 @@ processing.app.Base lib/pde.jar - lib/core.jar + core/library/core.jar lib/jna.jar lib/ecj.jar lib/antlr.jar diff --git a/core/src/processing/core/PApplet.java b/core/src/processing/core/PApplet.java index e01f54667..8f1583511 100644 --- a/core/src/processing/core/PApplet.java +++ b/core/src/processing/core/PApplet.java @@ -655,9 +655,9 @@ public class PApplet extends Applet * ( end auto-generated ) * @webref environment */ - @Deprecated + @Deprecated public boolean online = false; - // This is deprecated because it's poorly named (and even more poorly + // This is deprecated because it's poorly named (and even more poorly // understood). Further, we'll probably be removing applets soon, in which // case this won't work at all. If you want this feature, you can check // whether getAppletContext() returns null. @@ -945,7 +945,7 @@ public class PApplet extends Applet // new Exception().printStackTrace(System.out); paused = false; // unpause the thread - + resume(); resumeMethods.handle(); @@ -1827,7 +1827,7 @@ public class PApplet extends Applet if (!online) { start(); } - + while ((Thread.currentThread() == thread) && !finished) { if (paused) { debug("PApplet.run() paused, calling object wait..."); @@ -2197,17 +2197,17 @@ public class PApplet extends Applet comp.removeKeyListener(this); comp.removeFocusListener(this); } - - /** - * Call to remove, then add, listeners to a component. - * Avoids issues with double-adding. + + /** + * Call to remove, then add, listeners to a component. + * Avoids issues with double-adding. */ public void updateListeners(Component comp) { removeListeners(comp); addListeners(comp); } - + ////////////////////////////////////////////////////////////// @@ -5296,7 +5296,7 @@ public class PApplet extends Applet return new XML(file); } - + public Table loadTable(String filename) { return new Table(this, filename); } @@ -6682,10 +6682,10 @@ public class PApplet extends Applet if (question != -1) { extension = extension.substring(0, question); } - + return extension; } - + ////////////////////////////////////////////////////////////// @@ -9156,6 +9156,9 @@ public class PApplet extends Applet } else { System.err.println("Display " + value + " does not exist, " + "using the default display instead."); + for (int i = 0; i < devices.length; i++) { + System.err.println(i + " is " + devices[i]); + } } } else if (param.equals(ARGS_BGCOLOR)) {