From 0689a4cc7d18e33f1508ad01d05a3ddcddd26319 Mon Sep 17 00:00:00 2001 From: Ben Fry Date: Sat, 1 Jun 2013 10:57:38 -0400 Subject: [PATCH] using accessors for version number --- app/src/processing/app/About.java | 2 +- app/src/processing/app/Base.java | 44 +++++++++------------ app/src/processing/app/Editor.java | 2 +- app/src/processing/app/UpdateCheck.java | 6 +-- app/src/processing/mode/java/Commander.java | 2 +- app/src/processing/mode/java/JavaBuild.java | 2 +- core/todo.txt | 3 ++ 7 files changed, 29 insertions(+), 32 deletions(-) diff --git a/app/src/processing/app/About.java b/app/src/processing/app/About.java index a8f85d009..f034c0a74 100644 --- a/app/src/processing/app/About.java +++ b/app/src/processing/app/About.java @@ -52,6 +52,6 @@ public class About extends Window { g.setFont(new Font("SansSerif", Font.PLAIN, 11)); //$NON-NLS-1$ g.setColor(Color.white); - g.drawString(Base.VERSION_NAME, 50, 30); + g.drawString(Base.getVersionName(), 50, 30); } } \ No newline at end of file diff --git a/app/src/processing/app/Base.java b/app/src/processing/app/Base.java index 6b90c7665..35bd2efde 100644 --- a/app/src/processing/app/Base.java +++ b/app/src/processing/app/Base.java @@ -44,11 +44,13 @@ import processing.core.*; * files and images, etc) that comes from that. */ public class Base { - static public final int REVISION = 218; + // Added accessors for 0218 because the UpdateCheck class was not properly + // updating the values, because javac was inlining the static final values. + static private final int REVISION = 218; /** This might be replaced by main() if there's a lib/version.txt file. */ - static public String VERSION_NAME = "0218"; //$NON-NLS-1$ + static private String VERSION_NAME = "0218"; //$NON-NLS-1$ /** Set true if this a proper release rather than a numbered revision. */ - static public boolean RELEASE = false; +// static private boolean RELEASE = false; /** True if heavy debugging error/log messages are enabled */ static public boolean DEBUG = false; @@ -147,7 +149,7 @@ public class Base { String version = PApplet.loadStrings(versionFile)[0]; if (!version.equals(VERSION_NAME)) { VERSION_NAME = version; - RELEASE = true; +// RELEASE = true; } } } catch (Exception e) { @@ -1547,33 +1549,25 @@ public class Base { updateManagerFrame.showFrame(activeEditor); } + // ................................................................... + static public int getRevision() { + return REVISION; + } + + /** - * Get list of platform constants. + * Return the version name, something like 1.5 or 2.0b8 or 0213 if it's not + * a release version. */ -// static public int[] getPlatforms() { -// return platforms; -// } + static public String getVersionName() { + return VERSION_NAME; + } - -// static public int getPlatform() { -// String osname = System.getProperty("os.name"); -// -// if (osname.indexOf("Mac") != -1) { -// return PConstants.MACOSX; -// -// } else if (osname.indexOf("Windows") != -1) { -// return PConstants.WINDOWS; -// -// } else if (osname.equals("Linux")) { // true for the ibm vm -// return PConstants.LINUX; -// -// } else { -// return PConstants.OTHER; -// } -// } + + //................................................................... static public Platform getPlatform() { diff --git a/app/src/processing/app/Editor.java b/app/src/processing/app/Editor.java index 923045253..cfbe5931e 100644 --- a/app/src/processing/app/Editor.java +++ b/app/src/processing/app/Editor.java @@ -2215,7 +2215,7 @@ public abstract class Editor extends JFrame implements RunnerListener { * something like "sketch_070752a - Processing 0126" */ public void updateTitle() { - setTitle(sketch.getName() + " | Processing " + Base.VERSION_NAME); + setTitle(sketch.getName() + " | Processing " + Base.getVersionName()); if (!sketch.isUntitled()) { // set current file for OS X so that cmd-click in title bar works diff --git a/app/src/processing/app/UpdateCheck.java b/app/src/processing/app/UpdateCheck.java index 045f22467..86693e6a3 100644 --- a/app/src/processing/app/UpdateCheck.java +++ b/app/src/processing/app/UpdateCheck.java @@ -88,7 +88,7 @@ public class UpdateCheck { } String info = PApplet.urlEncode(id + "\t" + - PApplet.nf(Base.REVISION, 4) + "\t" + + PApplet.nf(Base.getRevision(), 4) + "\t" + System.getProperty("java.version") + "\t" + System.getProperty("java.vendor") + "\t" + System.getProperty("os.name") + "\t" + @@ -111,9 +111,9 @@ public class UpdateCheck { if (base.activeEditor != null) { boolean offerToUpdateContributions = true; - if (latest > Base.REVISION) { + if (latest > Base.getRevision()) { System.out.println("You are running Processing revision " + - Base.REVISION + ", the latest is " + latest + "."); + Base.getRevision() + ", the latest is " + latest + "."); // Assume the person is busy downloading the latest version offerToUpdateContributions = !promptToVisitDownloadPage(); } diff --git a/app/src/processing/mode/java/Commander.java b/app/src/processing/mode/java/Commander.java index e0a86b720..fdf55848a 100644 --- a/app/src/processing/mode/java/Commander.java +++ b/app/src/processing/mode/java/Commander.java @@ -345,7 +345,7 @@ public class Commander implements RunnerListener { static void printCommandLine(PrintStream out) { out.println(); - out.println("Command line edition for Processing " + Base.VERSION_NAME + " (Java Mode)"); + out.println("Command line edition for Processing " + Base.getVersionName() + " (Java Mode)"); out.println(); out.println("--help Show this help text. Congratulations."); out.println(); diff --git a/app/src/processing/mode/java/JavaBuild.java b/app/src/processing/mode/java/JavaBuild.java index 483899782..e132c09cf 100644 --- a/app/src/processing/mode/java/JavaBuild.java +++ b/app/src/processing/mode/java/JavaBuild.java @@ -1529,7 +1529,7 @@ public class JavaBuild { String contents = "Manifest-Version: 1.0\n" + - "Created-By: Processing " + Base.VERSION_NAME + "\n" + + "Created-By: Processing " + Base.getVersionName() + "\n" + "Main-Class: " + sketch.getName() + "\n"; // TODO not package friendly zos.write(contents.getBytes()); zos.closeEntry(); diff --git a/core/todo.txt b/core/todo.txt index 2508f38af..ff6fcff66 100644 --- a/core/todo.txt +++ b/core/todo.txt @@ -29,6 +29,9 @@ A Implement textMode(SHAPE) for 3D A https://github.com/processing/processing/issues/777 A PImage.loadPixels() shouldn't be calling out to the renderer A setting image.parent = null for it makes it work again for get().save() case +A Setting smooth(n) affects disables background in setup() +A https://github.com/processing/processing/issues/1452 + _ data decision stuff _ key/valueIterator to get a version that can be removed in a loop