diff --git a/android/core/src/processing/core/PApplet.java b/android/core/src/processing/core/PApplet.java
index 56a5ad120..94a906854 100644
--- a/android/core/src/processing/core/PApplet.java
+++ b/android/core/src/processing/core/PApplet.java
@@ -78,9 +78,7 @@ public class PApplet extends Activity implements PConstants, Runnable {
* not all instances of PApplet will necessarily be started on a screen of
* the same size.
*/
- public int screenWidth, screenHeight;
-// public Dimension screen =
-// Toolkit.getDefaultToolkit().getScreenSize();
+ public int displayWidth, displayHeight;
/**
* Command line options passed in from main().
@@ -439,8 +437,8 @@ public class PApplet extends Activity implements PConstants, Runnable {
DisplayMetrics dm = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(dm);
- screenWidth = dm.widthPixels;
- screenHeight = dm.heightPixels;
+ displayWidth = dm.widthPixels;
+ displayHeight = dm.heightPixels;
// println("density is " + dm.density);
// println("densityDpi is " + dm.densityDpi);
if (DEBUG) println("display metrics: " + dm);
@@ -485,7 +483,7 @@ public class PApplet extends Activity implements PConstants, Runnable {
// new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT,
// RelativeLayout.LayoutParams.FILL_PARENT);
- if (sw == screenWidth && sh == screenHeight) {
+ if (sw == displayWidth && sh == displayHeight) {
// If using the full screen, don't embed inside other layouts
window.setContentView(surfaceView);
} else {
@@ -1003,12 +1001,12 @@ public class PApplet extends Activity implements PConstants, Runnable {
public int sketchWidth() {
- return screenWidth;
+ return displayWidth;
}
public int sketchHeight() {
- return screenHeight;
+ return displayHeight;
}
diff --git a/android/todo.txt b/android/todo.txt
index 7d4249db8..c5f9a6687 100644
--- a/android/todo.txt
+++ b/android/todo.txt
@@ -2,6 +2,8 @@
X finish xml writing on android
X http://stackoverflow.com/questions/2290945/writing-xml-on-android
X consider switch to android 2.2 as the minimum
+X screenWidth/Height replaced with displayWidth/Height
+_ update this on the Wiki page
andres
A GL2 specific code in Processing 2.0a5 break P3D on GLES2 hardware
diff --git a/app/src/processing/mode/android/AndroidPreprocessor.java b/app/src/processing/mode/android/AndroidPreprocessor.java
index 906461bfc..927b485b1 100644
--- a/app/src/processing/mode/android/AndroidPreprocessor.java
+++ b/app/src/processing/mode/android/AndroidPreprocessor.java
@@ -71,13 +71,24 @@ public class AndroidPreprocessor extends PdePreprocessor {
if (matches != null) {
boolean badSize = false;
- if (!matches[1].equals("screenWidth") &&
- !matches[1].equals("screenHeight") &&
+ if (matches[1].equals("screenWidth") ||
+ matches[1].equals("screenHeight") ||
+ matches[2].equals("screenWidth") ||
+ matches[2].equals("screenHeight")) {
+ final String message =
+ "The screenWidth and screenHeight variables are named\n" +
+ "displayWidth and displayHeight in this release of Processing.";
+ Base.showWarning("Time for a quick update", message, null);
+ return false;
+ }
+
+ if (!matches[1].equals("displayWidth") &&
+ !matches[1].equals("displayHeight") &&
PApplet.parseInt(matches[1], -1) == -1) {
badSize = true;
}
- if (!matches[2].equals("screenWidth") &&
- !matches[2].equals("screenHeight") &&
+ if (!matches[2].equals("displayWidth") &&
+ !matches[2].equals("displayHeight") &&
PApplet.parseInt(matches[2], -1) == -1) {
badSize = true;
}
@@ -112,18 +123,15 @@ public class AndroidPreprocessor extends PdePreprocessor {
}
- public PreprocessorResult write(Writer out, String program, String codeFolderPackages[])
+ public PreprocessorResult write(Writer out, String program, String[] codeFolderPackages)
throws SketchException, RecognitionException, TokenStreamException {
if (sizeStatement != null) {
int start = program.indexOf(sizeStatement);
program = program.substring(0, start) +
program.substring(start + sizeStatement.length());
}
- // String[] found = PApplet.match(program, "import\\s+processing.opengl.*\\s*");
- // if (found != null) {
- // }
- program = program.replaceAll("import\\s+processing\\.opengl\\.\\S+;", "");
- // PApplet.println(program);
+ // the OpenGL package is back in 2.0a5
+ //program = program.replaceAll("import\\s+processing\\.opengl\\.\\S+;", "");
return super.write(out, program, codeFolderPackages);
}
diff --git a/app/src/processing/mode/java/Compiler.java b/app/src/processing/mode/java/Compiler.java
index 5b94b0df6..d1ecc9cd1 100644
--- a/app/src/processing/mode/java/Compiler.java
+++ b/app/src/processing/mode/java/Compiler.java
@@ -67,7 +67,7 @@ public class Compiler {
};
//PApplet.println(baseCommand);
- // make list of code files that need to be compiled
+ // make list of code files that need to be compiled
// String[] sourceFiles = new String[sketch.getCodeCount()];
// int sourceCount = 0;
// sourceFiles[sourceCount++] =
@@ -148,8 +148,8 @@ public class Compiler {
int dotJavaLineIndex = PApplet.parseInt(pieces[2]) - 1;
String errorMessage = pieces[4];
- exception = build.placeException(errorMessage,
- dotJavaFilename,
+ exception = build.placeException(errorMessage,
+ dotJavaFilename,
dotJavaLineIndex);
/*
int codeIndex = 0; //-1;
@@ -274,15 +274,20 @@ public class Compiler {
exception.setMessage("LINE_LOOP and LINE_STRIP are not available, " +
"please update your code.");
handleCrustyCode();
-
+
} else if (what.equals("framerate")) {
- exception.setMessage("framerate should be changed to frameRate");
+ exception.setMessage("framerate should be changed to frameRate.");
handleCrustyCode();
-
+
} else if (what.equals("screen")) {
-// handleCrustyCode(exception, what);
exception.setMessage("Change screen.width and screen.height to " +
- "screenWidth and screenHeight for 2.0.");
+ "displayWidth and displayHeight.");
+ handleCrustyCode();
+
+ } else if (what.equals("screenWidth") ||
+ what.equals("screenHeight")) {
+ exception.setMessage("Change screenWidth and screenHeight to " +
+ "displayWidth and displayHeight.");
handleCrustyCode();
} else {
@@ -314,11 +319,11 @@ public class Compiler {
} else if (parts[1].equals("push()")) {
exception.setMessage("push() no longer exists, use pushMatrix() instead.");
handleCrustyCode();
-
+
} else if (parts[1].equals("pop()")) {
exception.setMessage("pop() no longer exists, use popMatrix() instead.");
handleCrustyCode();
-
+
} else {
String mess = "The function " + parts[1] + " does not exist.";
exception.setMessage(mess);
diff --git a/core/src/processing/core/PApplet.java b/core/src/processing/core/PApplet.java
index c05aa0276..be803a3ee 100644
--- a/core/src/processing/core/PApplet.java
+++ b/core/src/processing/core/PApplet.java
@@ -229,26 +229,23 @@ public class PApplet extends Applet
/** The PGraphics renderer associated with this PApplet */
public PGraphics g;
- //protected Object glock = new Object(); // for sync
-
/** The frame containing this applet (if any) */
public Frame frame;
-// public JFrame frame;
// /**
// * Usually just 0, but with multiple displays, the X and Y coordinates of
// * the screen will depend on the current screen's position relative to
// * the other displays.
// */
-// public int screenX;
-// public int screenY;
+// public int displayX;
+// public int displayY;
/**
* ( begin auto-generated from screenWidth.xml )
*
* System variable which stores the width of the computer screen. For
* example, if the current screen resolution is 1024x768,
- * screenWidth is 1024 and screenHeight is 768. These
+ * displayWidth is 1024 and displayHeight is 768. These
* dimensions are useful when exporting full-screen applications.
*
* To ensure that the sketch takes over the entire screen, use "Present"
@@ -259,7 +256,7 @@ public class PApplet extends Applet
* ( end auto-generated )
* @webref environment
*/
- public int screenWidth;
+ public int displayWidth;
/**
* ( begin auto-generated from screenHeight.xml )
@@ -277,7 +274,7 @@ public class PApplet extends Applet
* ( end auto-generated )
* @webref environment
*/
- public int screenHeight;
+ public int displayHeight;
/**
* A leech graphics object that is echoing all events.
@@ -1899,8 +1896,8 @@ public class PApplet extends Applet
displayDevice.getDefaultConfiguration().getBounds();
// screenX = screenRect.x;
// screenY = screenRect.y;
- screenWidth = screenRect.width;
- screenHeight = screenRect.height;
+ displayWidth = screenRect.width;
+ displayHeight = screenRect.height;
try {
//println("Calling setup()");
@@ -9434,11 +9431,11 @@ public class PApplet extends Applet
locationX = editorLocation[0] + 66;
locationY = editorLocation[1] + 66;
- if ((locationX + windowW > applet.screenWidth - 33) ||
- (locationY + windowH > applet.screenHeight - 33)) {
+ if ((locationX + windowW > applet.displayWidth - 33) ||
+ (locationY + windowH > applet.displayHeight - 33)) {
// otherwise center on screen
- locationX = (applet.screenWidth - windowW) / 2;
- locationY = (applet.screenHeight - windowH) / 2;
+ locationX = (applet.displayWidth - windowW) / 2;
+ locationY = (applet.displayHeight - windowH) / 2;
}
frame.setLocation(locationX, locationY);
}
diff --git a/core/todo.txt b/core/todo.txt
index 020aeb614..bc1f4ac5d 100644
--- a/core/todo.txt
+++ b/core/todo.txt
@@ -8,6 +8,10 @@ X move to processing.data.* package
X update the internal code for Android and desktop to add the import
X add loadTable()..
X loadXML and loadTable are now in desktop
+o trimming text on URLs?
+o http://code.google.com/p/processing/issues/detail?id=715
+X change screenWidth/Height to displayWidth/Height
+_ update wiki.processing.org/w/Window_Size_and_Full_Screen
fixed in 2.0a5
A OpenGL noSmooth() does not work
@@ -52,15 +56,11 @@ o or also add a method for getting the vectors?
X no longer an issue post-NanoXML
X several other items under the LIBRARIES / XML section below
-_ change screenWidth/Height to displayWidth/Height
-_ also fix the Android etc docs
+
_ add screen(PVector), model(PVector) and world(PVector)?
X test what happens with NPE in OpenGL, does the error make sense?
_ nope, it doesn't, need to clean this up
-_ shared intf for 3D view data across PGraphicsOpenGL and PGraphicsAndroid3D
-_ libraries have to do a lot of casting
-
_ look into using BufferStrategy again to improve performance
_ there are more improvements to be made ala issue #729
_ make sure rendering is happening on the EDT
@@ -115,13 +115,8 @@ X this is fine since opengl can't usually go across both
o but include an example for how to use full in gl
o full screen not working on snow leopard
X fix build script to include the jnilib, also add more error checks
-_ screenX and screenY are both already taken, so not including vars for them
-_ decide on naming for the next release
-_ wiki.processing.org/w/Window_Size_and_Full_Screen
-
-_ static mode sketches seem to break ESC... noLoop() problem?
-_ need to find another way to get ESC on static mode
-_ b/c static mode sketches *do* finish because they have no draw()
+X screenX and screenY are both already taken, so not including vars for them
+X decide on naming for the next release
_ PUtil -> move match(), lots of other non-gui functions into own class
_ and merge it in statically via the methods code
@@ -132,12 +127,16 @@ _ need to add clear() method so clear out ARGB surfaces
C clear() ok to add
X decided clear(r, g, b, a) problematic since it's an exception to color model
X and that people should use background() anyway
-_ or background(r, g, b, a) would be the thing
+o or background(r, g, b, a) would be the thing
+_ clear() with a color doesn't make sense
_ pause()/resume() need to work on the desktop side as well
_ stop() not called in 1.5
_ http://code.google.com/p/processing/issues/detail?id=636
_ In reply to c#1, I noticed that dispose() is getting called. stop() isn't.
+_ static mode sketches seem to break ESC... noLoop() problem?
+_ need to find another way to get ESC on static mode
+_ b/c static mode sketches *do* finish because they have no draw()
_ selectInput() and selectOutput() freezes
_ http://code.google.com/p/processing/issues/detail?id=173
@@ -177,9 +176,6 @@ _ also need to copy this over to android
_ disable smoothing on noSmooth(), use hint to do 2x vs 4x smoothing
-_ trimming text on URLs?
-_ http://code.google.com/p/processing/issues/detail?id=715
-
andres
_ beginRaw() not working with 3D
_ http://code.google.com/p/processing/issues/detail?id=744
@@ -252,11 +248,8 @@ _ http://java.sun.com/docs/books/tutorial/deployment/applet/lifeCycle.html
_ really, stop() should just call noLoop() (and start re-enable if done)
_ and on android, start/stop can be used to save state information
_ need to fix opengl applets so that we can safely kill P3D
-
-more xml/json changes
-_ json issues
-_ http://www.xml.com/lpt/a/1658
-_ http://www.json.org/java/
+_ shared intf for 3D view data across PGraphicsOpenGL and PGraphicsAndroid3D
+_ libraries have to do a lot of casting
2.0 / methods
_ decision on registered methods
@@ -280,6 +273,9 @@ _ decision: go with what looks like javascript/ios
_ touchEvent(), gestureEvent()?
2.0
+_ implement JSON class
+_ http://www.xml.com/lpt/a/1658
+_ http://www.json.org/java/
_ PNode.getChildren() shouldn't make a new array.. toArray() can do that
_ toArray(), toArray(float[]), toVectorArray(), toVectorArray(PVector[])
_ toColorArray(), toColorArray(float[])...
@@ -379,8 +375,10 @@ _ http://code.google.com/p/processing/issues/detail?id=195
stop() mess
_ sort out destroy(), stop(), pause() et al
_ ColorSelector should stop/pause when not visible
+_ right now it's doing a low-level looping
_ start()/stop() perform like onPause()/onResume()
_ all of which call pause() and resume()
+_ destroy() (from Applet) calls (our) dispose()
_ destroy() shouldn't call exit()... change from lonnen
_ calls ((PApplet)this).exit() instead of stop() (since stop is pause)
_ notes
diff --git a/todo.txt b/todo.txt
index e6e954f31..23bdef3a0 100644
--- a/todo.txt
+++ b/todo.txt
@@ -42,6 +42,8 @@ X http://code.google.com/p/processing/issues/detail?id=606
X Marked closed around 1.5?
X incorporate gsvideo library from Andres
o fast java2d video?
+o saving files... save("...svg") or saveSVG("...")
+o lots of other things in the google code issues list
displays
X ability to select monitor via preferences panel
@@ -100,9 +102,7 @@ _ http://code.google.com/p/processing/issues/detail?id=27
Base.restoreSketches() has commented out code that checked for out of bounds windows with the preferences last.window.x and last.window.y. These prefs don't exist anymore, but it would be quick to implement it again using last.sketch.location instead. It would probably result in less code, because it would mean we could get rid of the windowPositionValid stuff.
-decisions
-_ saving files... save("...svg") or saveSVG("...")
-_ lots of other things in the google code issues list
+with casey
_ does editor.bgcolor live in the theme.txt file for the mode?
_ or should it be a user preference thing
_ for that matter, need to decide on how much modes can customize themselves
@@ -110,8 +110,6 @@ _ find in reference for copy() (on image) tries to open PVector.copy()
_ might need disambiguation pages?
_ if a reference page is missing, throws a bunch of exceptions
_ i.e. PVector.copy() not in the reference
-
-with casey
_ specifically add "eclipse" to integration description
_ link books and sample chapters from the "getting started" portion of the faq
_ keep examples.zip in a zip file? (5000 files @ 30 MB instead of 15 MB zip)