diff --git a/app/src/processing/app/Base.java b/app/src/processing/app/Base.java index 3bde7f071..d8e4fc51e 100644 --- a/app/src/processing/app/Base.java +++ b/app/src/processing/app/Base.java @@ -533,10 +533,17 @@ public class Base { // save a mode file into this sketch folder File sketchProps = new File(sketch.getFolder(), "sketch.properties"); - PrintWriter writer = PApplet.createWriter(sketchProps); - writer.println("mode=" + mode.getTitle()); - writer.flush(); - writer.close(); + try { + Settings props = new Settings(sketchProps); + props.set("mode", mode.getTitle()); + props.save(); + } catch (IOException e) { + e.printStackTrace(); + } +// PrintWriter writer = PApplet.createWriter(sketchProps); +// writer.println("mode=" + mode.getTitle()); +// writer.flush(); +// writer.close(); // close this sketch int[] where = activeEditor.getPlacement(); diff --git a/app/src/processing/app/Mode.java b/app/src/processing/app/Mode.java index a106264c1..46d76320e 100644 --- a/app/src/processing/app/Mode.java +++ b/app/src/processing/app/Mode.java @@ -62,6 +62,10 @@ public abstract class Mode { try { theme = new Settings(new File(folder, "theme/theme.txt")); + + // other things that have to be set explicitly for the defaults + theme.setColor("run.window.bgcolor", SystemColor.control); + } catch (IOException e) { Base.showError("Problem loading theme.txt", "Could not load theme.txt, please re-install Processing", e); diff --git a/app/src/processing/app/Settings.java b/app/src/processing/app/Settings.java index e87da3531..98365b8f0 100644 --- a/app/src/processing/app/Settings.java +++ b/app/src/processing/app/Settings.java @@ -3,7 +3,7 @@ /* Part of the Processing project - http://processing.org - Copyright (c) 2004-10 Ben Fry and Casey Reas + Copyright (c) 2004-11 Ben Fry and Casey Reas Copyright (c) 2001-04 Massachusetts Institute of Technology This program is free software; you can redistribute it and/or modify @@ -37,21 +37,31 @@ import processing.core.*; * and to make way for future ability to customize. */ public class Settings { - /** Copy of the defaults in case the user mangles a preference. */ + /** + * Copy of the defaults in case the user mangles a preference. + * It's necessary to keep a copy of the defaults around, because the user may + * have mangled a setting on their own. In the past, we used to load the + * defaults, then replace those with what was in the user's preferences file. + * Problem is, if something like a font entry in the user's file no longer + * parses properly, we need to be able to get back to a clean version of that + * setting so we can recover. + */ HashMap defaults; - /** Table of attributes/values for the theme. */ + + /** Table of attributes/values. */ HashMap table = new HashMap();; + /** Associated file for this settings data. */ File file; public Settings(File file) throws IOException { this.file = file; - load(); - - // other things that have to be set explicitly for the defaults - setColor("run.window.bgcolor", SystemColor.control); - + + if (file.exists()) { + load(); + } + // clone the hash table defaults = (HashMap) table.clone(); } @@ -86,19 +96,23 @@ public class Settings { } + public void save() { + PrintWriter writer = PApplet.createWriter(file); + + for (String key : table.keySet()) { + writer.println(key + "=" + table.get(key)); + } + + writer.flush(); + writer.close(); + } + + public String get(String attribute) { return table.get(attribute); } - /** - * It's necessary to keep a copy of the defaults around, because the user may - * have mangled a setting on their own. In the past, we used to load the - * defaults, then replace those with what was in the user's preferences file. - * Problem is, if something like a font entry in the user's file no longer - * parses properly, we need to be able to get back to a clean version of that - * setting so we can recover. - */ public String getDefault(String attribute) { return defaults.get(attribute); } diff --git a/core/todo.txt b/core/todo.txt index bb9384755..6ea58aeb2 100644 --- a/core/todo.txt +++ b/core/todo.txt @@ -441,11 +441,11 @@ _ add docs for screenWidth and screenHeight _ remove delay() documentation 2.0 +_ PNode.getChildren() shouldn't make a new array.. toArray() can do that _ texts using textMode(SCREEN) not displayed in Processing 1.5.1 _ http://code.google.com/p/processing/issues/detail?id=741 _ thread() causes weird flickering _ http://code.google.com/p/processing/issues/detail?id=742 - _ toArray(), toArray(float[]), toVectorArray(), toVectorArray(PVector[]) _ toColorArray(), toColorArray(float[])... _ remove blend(), add blendMode() @@ -524,6 +524,18 @@ _ http://code.google.com/p/processing/issues/detail?id=722 _ add methods to PShape to apply all transformations in the tree _ need to clean up the hints in the reference/source +gui priorities ++ Label ++ Button ++ Scrollbar/Slider +- Checkbox +- Radio +. List +. Textblock +\ Knob +\ Progress bar +\ Toggle + decisions to make _ possible addition for 'implementation' variable _ http://code.google.com/p/processing/issues/detail?id=281 @@ -552,6 +564,8 @@ _ http://code.google.com/p/processing/issues/detail?id=246 _ path for selectXxxxx() functions _ http://code.google.com/p/processing/issues/detail?id=233 _ provide a way to clear the PGraphics with plain alpha +_ add breakShape to the public API +_ or handle differently in general.. nested beginPath() calls? _ opengl applet problems _ http://code.google.com/p/processing/issues/detail?id=196 diff --git a/todo.txt b/todo.txt index 87da522ba..580d011a4 100644 --- a/todo.txt +++ b/todo.txt @@ -21,6 +21,8 @@ X Resize box on OS X is not present in Examples box X http://code.google.com/p/processing/issues/detail?id=730 X New/Rename Tab commands inhibited when Console/Message Area is hidden X http://code.google.com/p/processing/issues/detail?id=745 +X make sketch.properties usable elsewhere by loading/reloading +X http://code.google.com/p/processing/issues/detail?id=722 cleanup X how is autoformat doing? good now @@ -41,6 +43,12 @@ o prevent people from setting the font size too small in the editor o how do we figure out what "too small" is? X -> everyone thinks this is funny +decisions +_ kill external editor (for all its quirks) in favor of command line? +_ use external editor needs to enable/disable across all windows +_ http://code.google.com/p/processing/issues/detail?id=515 +_ lots of other things in the google code issues list + required for 0198 release _ automatically insert the 'import processing.opengl' when P3D used _ add support for automatically including OpenGL when asking for P3D