mirror of
https://github.com/processing/processing4.git
synced 2026-02-13 10:30:44 +01:00
fixing issues with threading, stop button, and defaults not being called
This commit is contained in:
@@ -52,8 +52,11 @@ class PdeMessageSiphon implements Runnable {
|
||||
String currentLine;
|
||||
while ((currentLine = streamReader.readLine()) != null) {
|
||||
// \n is added again because readLine() strips it out
|
||||
//PdeEditorConsole.systemOut.println("messaging in");
|
||||
consumer.message(currentLine + "\n");
|
||||
//PdeEditorConsole.systemOut.println("messaging out");
|
||||
}
|
||||
//PdeEditorConsole.systemOut.println("messaging thread done");
|
||||
thread = null;
|
||||
|
||||
} catch (NullPointerException npe) {
|
||||
|
||||
@@ -662,6 +662,9 @@ public class PApplet extends Applet
|
||||
* Note that you cannot change the renderer once outside of setup().
|
||||
* You can call size() to give it a new size, but you need to always
|
||||
* ask for the same renderer, otherwise you're gonna run into trouble.
|
||||
* <P>
|
||||
* Also note that this calls defaults(), which will reset any
|
||||
* settings for colorMode or lights or whatever.
|
||||
*/
|
||||
public void size(int iwidth, int iheight, String renderer) {
|
||||
String currentRenderer = (g == null) ? null : g.getClass().getName();
|
||||
@@ -672,6 +675,10 @@ public class PApplet extends Applet
|
||||
// all set, the renderer was queued up last time
|
||||
// before throwing the exception
|
||||
//System.out.println("ignoring additional size()");
|
||||
// but this time set the defaults
|
||||
//g.defaults();
|
||||
//System.out.println("defaults set");
|
||||
g.defaults();
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
@@ -707,9 +714,10 @@ public class PApplet extends Applet
|
||||
g = (PGraphics)
|
||||
constructor.newInstance(constructorValues);
|
||||
|
||||
//System.out.println("setting size to
|
||||
this.width = iwidth;
|
||||
this.height = iheight;
|
||||
// can't do this here because of gl
|
||||
//g.defaults();
|
||||
|
||||
//width = g.width;
|
||||
//height = g.height;
|
||||
@@ -745,13 +753,19 @@ public class PApplet extends Applet
|
||||
die("Could not start because of a problem with size()", e);
|
||||
}
|
||||
|
||||
// throw an exception so that setup() is called again
|
||||
// but with a properly sized render
|
||||
if ((currentRenderer != null) &&
|
||||
!currentRenderer.equals(renderer)) {
|
||||
// throw an exception so that setup() is called again
|
||||
// but with a properly sized render
|
||||
// this is for opengl, which needs a valid, properly sized
|
||||
// display before calling anything inside setup().
|
||||
throw new RuntimeException(NEW_RENDERER);
|
||||
}
|
||||
|
||||
// if the default renderer is just being resized,
|
||||
// restore it to its default values
|
||||
g.defaults();
|
||||
|
||||
/*
|
||||
if (g == null) return;
|
||||
g.resize(iwidth, iheight);
|
||||
@@ -958,12 +972,13 @@ public class PApplet extends Applet
|
||||
" 1b draw");
|
||||
|
||||
if (frameCount == 0) {
|
||||
g.defaults();
|
||||
|
||||
try {
|
||||
//System.out.println("attempting setup");
|
||||
//System.out.println("into try");
|
||||
setup();
|
||||
//g.defaults();
|
||||
|
||||
//System.out.println("done attempting setup");
|
||||
//System.out.println("out of try");
|
||||
g.postSetup(); // FIXME
|
||||
@@ -4530,6 +4545,7 @@ v PApplet.this.stop();
|
||||
setPriority(Thread.MIN_PRIORITY);
|
||||
*/
|
||||
final Worker worker = new Worker();
|
||||
worker.start();
|
||||
|
||||
/*
|
||||
final SwingWorker worker = new SwingWorker() {
|
||||
@@ -4566,12 +4582,10 @@ v PApplet.this.stop();
|
||||
|
||||
parentFrame.addComponentListener(new ComponentAdapter() {
|
||||
public void componentMoved(ComponentEvent e) {
|
||||
//System.out.println(e);
|
||||
Point where = ((Frame) e.getSource()).getLocation();
|
||||
//System.out.println(e);
|
||||
System.err.println(PApplet.EXTERNAL_MOVE + " " +
|
||||
where.x + " " + where.y);
|
||||
System.err.flush();
|
||||
System.err.flush(); // doesn't seem to help or hurt
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -61,25 +61,25 @@ public class PGraphics extends PImage implements PConstants {
|
||||
// underscored_names are used for private functions or variables
|
||||
|
||||
/** The current colorMode */
|
||||
public int colorMode;
|
||||
public int colorMode; // = RGB;
|
||||
|
||||
/** Max value for red (or hue) set by colorMode */
|
||||
public float colorModeX;
|
||||
public float colorModeX; // = 255;
|
||||
|
||||
/** Max value for green (or saturation) set by colorMode */
|
||||
public float colorModeY;
|
||||
public float colorModeY; // = 255;
|
||||
|
||||
/** Max value for blue (or value) set by colorMode */
|
||||
public float colorModeZ;
|
||||
public float colorModeZ; // = 255;
|
||||
|
||||
/** Max value for alpha set by colorMode */
|
||||
public float colorModeA;
|
||||
public float colorModeA; // = 255;
|
||||
|
||||
/** True if colors are not in the range 0..1 */
|
||||
boolean colorScale;
|
||||
boolean colorScale; // = true;
|
||||
|
||||
/** True if colorMode(RGB, 255) */
|
||||
boolean colorRgb255;
|
||||
boolean colorRgb255; // = true;
|
||||
|
||||
// ........................................................
|
||||
|
||||
|
||||
@@ -1015,6 +1015,7 @@ public class PGraphics2 extends PGraphics {
|
||||
* even if noDepth() was called before draw() exited.
|
||||
*/
|
||||
public void clear() {
|
||||
//System.out.println("clearing " + PApplet.hex(backgroundColor));
|
||||
g2.setColor(new Color(backgroundColor));
|
||||
g2.fillRect(0, 0, width, height);
|
||||
}
|
||||
|
||||
@@ -4,10 +4,11 @@ X additional note about screen sizes and displays
|
||||
X sto instead of stop in present mode
|
||||
X appears that opengl libraries weren't correctly added in 81?
|
||||
|
||||
_ why does diffuse just mirror fill()?
|
||||
X just removed it
|
||||
_ fix bezierVertex() for newer api
|
||||
|
||||
tweaking up simong light code
|
||||
_ why does diffuse just mirror fill()?
|
||||
X just removed it
|
||||
_ remove/rename postSetup() stuff from PGraphics/PApplet
|
||||
_ what's up with resetLights?
|
||||
_ angleMode stuff is kinda overkill
|
||||
@@ -79,7 +80,6 @@ _ that way more stuff can be static w/o losing useful error handling
|
||||
_ (emitting errors when closest to source.. i.e. w/ the filename)
|
||||
|
||||
PGraphics3
|
||||
_ fix bezierVertex() for newer api
|
||||
_ error message saying that strokeCap and strokeJoin don't work
|
||||
_ PPolygon no longer in use and PLine is a mess
|
||||
_ also have a simple way to hook in triangle leeches to PGraphics3
|
||||
|
||||
10
todo.txt
10
todo.txt
@@ -5,10 +5,14 @@ o when centering applet on-screen, needs to check for multiple screens
|
||||
o this is both for PApplet and PdeRuntime
|
||||
o PApplet screen size constant is no good
|
||||
X nope, because centers on default screen
|
||||
X external apps don't stop at all when 'stop' is hit
|
||||
|
||||
_ external apps don't stop at all when 'stop' is hit
|
||||
_ moving an external window around a lot will halt the parent
|
||||
_ external apps also seem to not do newlines properly
|
||||
_ does move even need to be called? could just wait till stop?
|
||||
_ PdeMessageSiphon has problems with message()
|
||||
_ external apps also seem to not do newlines properly on exceptions
|
||||
_ appendText launches a new thread for every blip of text
|
||||
_ this is totally wrong and really horks things
|
||||
|
||||
_ make a linux version of this release
|
||||
_ need to fix up the make/dist scripts for linux
|
||||
@@ -60,6 +64,8 @@ _ lib could call queueEvent with the args
|
||||
_ then call them inside post()
|
||||
_ scrubbing all the code to include proper license and copyright info
|
||||
|
||||
_ revisions.txt et al aren't properly having LFs converted
|
||||
|
||||
_ update checker (can be turned off in prefs)
|
||||
_ send unique id, and information about person's java vm/platform
|
||||
_ using timezone would be an interesting method for tracking location
|
||||
|
||||
Reference in New Issue
Block a user