using accessors for version number

This commit is contained in:
Ben Fry
2013-06-01 10:57:38 -04:00
parent ca8c8ff759
commit 0689a4cc7d
7 changed files with 29 additions and 32 deletions
+1 -1
View File
@@ -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);
}
}
+19 -25
View File
@@ -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() {
+1 -1
View File
@@ -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
+3 -3
View File
@@ -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();
}
+1 -1
View File
@@ -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();
+1 -1
View File
@@ -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();
+3
View File
@@ -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