From 15cff822149b27db24dd7fee1a29777c28471be3 Mon Sep 17 00:00:00 2001 From: "David A. Mellis" Date: Thu, 18 Jun 2009 19:22:43 +0000 Subject: [PATCH] Removing unused preferences. Fixing upload when not deleting applet/ directory. Treating examples in the sketchbook/libraries folder as read-only. --- app/src/processing/app/Base.java | 5 ++ app/src/processing/app/Preferences.java | 57 ++-------------------- app/src/processing/app/Sketch.java | 3 +- app/src/processing/app/debug/Compiler.java | 1 + todo.txt | 5 +- 5 files changed, 15 insertions(+), 56 deletions(-) diff --git a/app/src/processing/app/Base.java b/app/src/processing/app/Base.java index cb4453577..95bd43af2 100644 --- a/app/src/processing/app/Base.java +++ b/app/src/processing/app/Base.java @@ -1446,6 +1446,11 @@ public class Base { static public File getSketchbookLibrariesFolder() { return new File(getSketchbookFolder(), "libraries"); } + + + static public String getSketchbookLibrariesPath() { + return getSketchbookLibrariesFolder().getAbsolutePath(); + } protected File getDefaultSketchbookFolder() { diff --git a/app/src/processing/app/Preferences.java b/app/src/processing/app/Preferences.java index e47ca920c..623ff807f 100644 --- a/app/src/processing/app/Preferences.java +++ b/app/src/processing/app/Preferences.java @@ -158,7 +158,7 @@ public class Preferences { load(Base.getLibStream("preferences.txt")); } catch (Exception e) { Base.showError(null, "Could not read default settings.\n" + - "You'll need to reinstall Processing.", e); + "You'll need to reinstall Arduino.", e); } // check for platform-specific properties in the defaults @@ -210,7 +210,7 @@ public class Preferences { "Error reading the preferences file. " + "Please delete (or move)\n" + preferencesFile.getAbsolutePath() + - " and restart Processing.", ex); + " and restart Arduino.", ex); } } @@ -364,7 +364,7 @@ public class Preferences { box.add(label); fontSizeField = new JTextField(4); box.add(fontSizeField); - label = new JLabel(" (requires restart of Processing)"); + label = new JLabel(" (requires restart of Arduino)"); box.add(label); pain.add(box); d = box.getPreferredSize(); @@ -374,33 +374,6 @@ public class Preferences { top += d.height + GUI_BETWEEN; - // [ ] Increase maximum available memory to [______] MB - - Container memoryBox = Box.createHorizontalBox(); - memoryOverrideBox = new JCheckBox("Increase maximum available memory to "); - memoryBox.add(memoryOverrideBox); - memoryField = new JTextField(4); - memoryBox.add(memoryField); - memoryBox.add(new JLabel(" MB")); - pain.add(memoryBox); - d = memoryBox.getPreferredSize(); - memoryBox.setBounds(left, top, d.width, d.height); - top += d.height + GUI_BETWEEN; - - - // [ ] Use multiple .jar files when exporting applets - - exportSeparateBox = - new JCheckBox("Use multiple .jar files when exporting applets " + - "(ignored when using libraries)"); - pain.add(exportSeparateBox); - d = exportSeparateBox.getPreferredSize(); - // adding +10 because ubuntu + jre 1.5 truncating items - exportSeparateBox.setBounds(left, top, d.width + 10, d.height); - right = Math.max(right, left + d.width); - top += d.height + GUI_BETWEEN; - - // [ ] Delete previous applet or application folder on export deletePreviousBox = @@ -436,7 +409,7 @@ public class Preferences { if (Base.isWindows()) { autoAssociateBox = - new JCheckBox("Automatically associate .pde files with Processing"); + new JCheckBox("Automatically associate .pde files with Arduino"); pain.add(autoAssociateBox); d = autoAssociateBox.getPreferredSize(); autoAssociateBox.setBounds(left, top, d.width + 10, d.height); @@ -478,7 +451,7 @@ public class Preferences { right = Math.max(right, left + d.width); top += d.height; - label = new JLabel("(edit only when Processing is not running)"); + label = new JLabel("(edit only when Arduino is not running)"); pain.add(label); d = label.getPreferredSize(); label.setForeground(Color.gray); @@ -606,8 +579,6 @@ public class Preferences { */ protected void applyFrame() { // put each of the settings into the table - setBoolean("export.applet.separate_jar_files", - exportSeparateBox.isSelected()); setBoolean("export.delete_target_folder", deletePreviousBox.isSelected()); @@ -627,18 +598,6 @@ public class Preferences { setBoolean("editor.external", externalEditorBox.isSelected()); setBoolean("update.check", checkUpdatesBox.isSelected()); - setBoolean("run.options.memory", memoryOverrideBox.isSelected()); - int memoryMin = Preferences.getInteger("run.options.memory.initial"); - int memoryMax = Preferences.getInteger("run.options.memory.maximum"); - try { - memoryMax = Integer.parseInt(memoryField.getText().trim()); - // make sure memory setting isn't too small - if (memoryMax < memoryMin) memoryMax = memoryMin; - setInteger("run.options.memory.maximum", memoryMax); - } catch (NumberFormatException e) { - System.err.println("Ignoring bad memory setting"); - } - /* // was gonna use this to check memory settings, // but it quickly gets much too messy @@ -680,8 +639,6 @@ public class Preferences { this.editor = editor; // set all settings entry boxes to their actual status - exportSeparateBox. - setSelected(getBoolean("export.applet.separate_jar_files")); deletePreviousBox. setSelected(getBoolean("export.delete_target_folder")); @@ -698,10 +655,6 @@ public class Preferences { setSelected(getBoolean("editor.external")); checkUpdatesBox. setSelected(getBoolean("update.check")); - memoryOverrideBox. - setSelected(getBoolean("run.options.memory")); - memoryField. - setText(get("run.options.memory.maximum")); if (autoAssociateBox != null) { autoAssociateBox. diff --git a/app/src/processing/app/Sketch.java b/app/src/processing/app/Sketch.java index bd976c939..a07ddc250 100644 --- a/app/src/processing/app/Sketch.java +++ b/app/src/processing/app/Sketch.java @@ -1723,7 +1723,8 @@ public class Sketch { public boolean isReadOnly() { String apath = folder.getAbsolutePath(); if (apath.startsWith(Base.getExamplesPath()) || - apath.startsWith(Base.getLibrariesPath())) { + apath.startsWith(Base.getLibrariesPath()) || + apath.startsWith(Base.getSketchbookLibrariesPath())) { return true; // canWrite() doesn't work on directories diff --git a/app/src/processing/app/debug/Compiler.java b/app/src/processing/app/debug/Compiler.java index 9368587c2..eae1910df 100644 --- a/app/src/processing/app/debug/Compiler.java +++ b/app/src/processing/app/debug/Compiler.java @@ -482,6 +482,7 @@ public class Compiler implements MessageConsumer { ///////////////////////////////////////////////////////////////////////////// static private void createFolder(File folder) throws RunnerException { + if (folder.isDirectory()) return; if (!folder.mkdir()) throw new RunnerException("Couldn't create: " + folder); } diff --git a/todo.txt b/todo.txt index b2ec29aa7..fa6480ee2 100644 --- a/todo.txt +++ b/todo.txt @@ -3,14 +3,12 @@ PROCESSING 5503 SYNC -Get rid of unused preferences in the preferences dialog. +Disable checking for updates. Add library keyword highlighting. Fix document icon on Windows. -Don't allow in-place modification of user-installed library examples. - Escape characters with copy as html. Enable verbose output if shift (or alt?) is held down when pressing run or upload. @@ -63,6 +61,7 @@ Base.java Editor.java - allow the Board and Serial port to differ across editor windows. This will require creating a separate instance of the menu for each window, and passing the selections into the sketch when compiling or uploading. - send the current board and serial port selections to the sketch (which will forward them to the compiler) when compiling or uploading (this should eliminate the need for the Target class, since the compiler will be able to find the target path and its source files itself) + - remove references to the Runner and runtime Preferences.java - get rid of unused preferences in the dialog box