mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
prompt for filename archiver, tightening thread stuff, back down on insideXxxxWait() functions
This commit is contained in:
+1
-4
@@ -169,11 +169,8 @@ public class Sketchbook {
|
||||
if (noPrompt) prompt = false;
|
||||
|
||||
if (prompt) {
|
||||
//if (!startup) {
|
||||
// prompt for the filename and location for the new sketch
|
||||
|
||||
FileDialog fd = new FileDialog(editor, //new Frame(),
|
||||
//"Create new sketch named",
|
||||
FileDialog fd = new FileDialog(editor,
|
||||
"Create sketch folder named:",
|
||||
FileDialog.SAVE);
|
||||
fd.setDirectory(getSketchbookPath());
|
||||
|
||||
+30
-12
@@ -25,6 +25,7 @@ package processing.app.tools;
|
||||
|
||||
import processing.app.*;
|
||||
|
||||
import java.awt.FileDialog;
|
||||
import java.io.*;
|
||||
import java.text.*;
|
||||
import java.util.*;
|
||||
@@ -96,22 +97,39 @@ public class Archiver {
|
||||
index++;
|
||||
} while (newbie.exists());
|
||||
|
||||
try {
|
||||
//System.out.println(newbie);
|
||||
FileOutputStream zipOutputFile = new FileOutputStream(newbie);
|
||||
ZipOutputStream zos = new ZipOutputStream(zipOutputFile);
|
||||
// open up a prompt for where to save this fella
|
||||
FileDialog fd =
|
||||
new FileDialog(editor, "Archive sketch as:", FileDialog.SAVE);
|
||||
fd.setDirectory(parent.getAbsolutePath());
|
||||
fd.setFile(newbie.getName());
|
||||
fd.show();
|
||||
|
||||
// recursively fill the zip file
|
||||
buildZip(location, name, zos);
|
||||
String directory = fd.getDirectory();
|
||||
String filename = fd.getFile();
|
||||
|
||||
// close up the jar file
|
||||
zos.flush();
|
||||
zos.close();
|
||||
// only write the file if not canceled
|
||||
if (filename != null) {
|
||||
newbie = new File(directory, filename);
|
||||
|
||||
editor.message("Created archive " + newbie.getName() + ".");
|
||||
try {
|
||||
//System.out.println(newbie);
|
||||
FileOutputStream zipOutputFile = new FileOutputStream(newbie);
|
||||
ZipOutputStream zos = new ZipOutputStream(zipOutputFile);
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
// recursively fill the zip file
|
||||
buildZip(location, name, zos);
|
||||
|
||||
// close up the jar file
|
||||
zos.flush();
|
||||
zos.close();
|
||||
|
||||
editor.message("Created archive " + newbie.getName() + ".");
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
editor.message("Archive sketch canceled.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -33,6 +33,8 @@ as well as several API changes as we try to firm up the API for 1.0.
|
||||
|
||||
[ Major changes to the use of PGraphics and its subclasses ]
|
||||
|
||||
+ PImage objects default to ARGB instead of RGB format
|
||||
|
||||
+ The PGraphics classes have all been reworked and renamed.
|
||||
|
||||
- PGraphics is an abstract class on which additional PGraphics
|
||||
|
||||
@@ -490,7 +490,8 @@ public class PApplet extends Applet
|
||||
|
||||
// during rev 0100 dev cycle, working on new threading model,
|
||||
// but need to disable and go conservative with changes in order
|
||||
// to get pdf and audio working properly first
|
||||
// to get pdf and audio working properly first.
|
||||
// for 0116, the CRUSTY_THREADS are being disabled to fix lots of bugs.
|
||||
static final boolean CRUSTY_THREADS = false; //true;
|
||||
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ public abstract class PGraphics extends PImage implements PConstants {
|
||||
boolean defaultsInited;
|
||||
|
||||
/// true if in-between beginDraw() and endDraw()
|
||||
boolean insideDraw;
|
||||
protected boolean insideDraw;
|
||||
|
||||
/// true if in the midst of resize (no drawing can take place)
|
||||
boolean insideResize;
|
||||
@@ -524,10 +524,12 @@ public abstract class PGraphics extends PImage implements PConstants {
|
||||
* new width and height internally, as well as re-allocating
|
||||
* the pixel buffer for the new size.
|
||||
* <P>
|
||||
* Note that this will nuke any cameraMode() settings.
|
||||
* Note that this will nuke any camera settings.
|
||||
*/
|
||||
public void resize(int iwidth, int iheight) { // ignore
|
||||
//System.out.println("resize " + iwidth + " " + iheight);
|
||||
insideDrawWait();
|
||||
insideResize = true;
|
||||
|
||||
width = iwidth;
|
||||
height = iheight;
|
||||
@@ -536,8 +538,7 @@ public abstract class PGraphics extends PImage implements PConstants {
|
||||
|
||||
allocate();
|
||||
|
||||
// clear the screen with the old background color
|
||||
//background(backgroundColor);
|
||||
insideResize = false; // ok to draw again
|
||||
}
|
||||
|
||||
|
||||
@@ -550,6 +551,10 @@ public abstract class PGraphics extends PImage implements PConstants {
|
||||
*/
|
||||
public void setMainDrawingSurface() {
|
||||
mainDrawingSurface = true;
|
||||
// base images must be opaque (for performance and general
|
||||
// headache reasons.. argh, a semi-transparent opengl surface?)
|
||||
// use createGraphics() if you want a transparent surface.
|
||||
format = RGB;
|
||||
parent.addListeners();
|
||||
}
|
||||
|
||||
@@ -575,22 +580,26 @@ public abstract class PGraphics extends PImage implements PConstants {
|
||||
|
||||
|
||||
protected void insideResizeWait() {
|
||||
/*
|
||||
while (insideResize) {
|
||||
//System.out.println("waiting");
|
||||
try {
|
||||
Thread.sleep(5);
|
||||
} catch (InterruptedException e) { }
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
protected void insideDrawWait() {
|
||||
/*
|
||||
while (insideDraw) {
|
||||
//System.out.println("waiting");
|
||||
try {
|
||||
Thread.sleep(5);
|
||||
} catch (InterruptedException e) { }
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
@@ -3262,11 +3271,12 @@ public abstract class PGraphics extends PImage implements PConstants {
|
||||
* Note, no need for a bounds check since it's a 32 bit number.
|
||||
*/
|
||||
protected void colorCalcARGB(int argb, float alpha) {
|
||||
calcColor = argb;
|
||||
if (alpha == colorModeA) {
|
||||
calcAi = (argb >> 24) & 0xff;
|
||||
calcColor = argb;
|
||||
} else {
|
||||
calcAi = (int) (((argb >> 24) & 0xff) * (alpha / colorModeA));
|
||||
calcColor = (calcAi << 24) | (argb & 0xFFFFFF);
|
||||
}
|
||||
calcRi = (argb >> 16) & 0xff;
|
||||
calcGi = (argb >> 8) & 0xff;
|
||||
@@ -3276,6 +3286,7 @@ public abstract class PGraphics extends PImage implements PConstants {
|
||||
calcG = (float)calcGi / 255.0f;
|
||||
calcB = (float)calcBi / 255.0f;
|
||||
calcAlpha = (calcAi != 255);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -113,6 +113,9 @@ public class PGraphics2D extends PGraphics {
|
||||
|
||||
|
||||
public void beginDraw() {
|
||||
insideResizeWait();
|
||||
insideDraw = true;
|
||||
|
||||
// need to call defaults(), but can only be done when it's ok
|
||||
// to draw (i.e. for opengl, no drawing can be done outside
|
||||
// beginDraw/endDraw).
|
||||
@@ -141,6 +144,8 @@ public class PGraphics2D extends PGraphics {
|
||||
// mark pixels as having been updated, so that they'll work properly
|
||||
// when this PGraphics is drawn using image().
|
||||
updatePixels();
|
||||
|
||||
insideDraw = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -221,14 +221,6 @@ public class PGraphics3D extends PGraphics {
|
||||
*/
|
||||
public void resize(int iwidth, int iheight) { // ignore
|
||||
insideDrawWait();
|
||||
/*
|
||||
while (insideDraw) {
|
||||
//System.out.println("waiting");
|
||||
try {
|
||||
Thread.sleep(5);
|
||||
} catch (InterruptedException e) { }
|
||||
}
|
||||
*/
|
||||
insideResize = true;
|
||||
|
||||
width = iwidth;
|
||||
|
||||
@@ -106,6 +106,8 @@ public class PGraphicsJava2D extends PGraphics {
|
||||
*/
|
||||
public void resize(int iwidth, int iheight) { // ignore
|
||||
//System.out.println("resize " + iwidth + " " + iheight);
|
||||
insideDrawWait();
|
||||
insideResize = true;
|
||||
|
||||
width = iwidth;
|
||||
height = iheight;
|
||||
@@ -114,8 +116,8 @@ public class PGraphicsJava2D extends PGraphics {
|
||||
|
||||
allocate();
|
||||
|
||||
// clear the screen with the old background color
|
||||
//background(backgroundColor);
|
||||
// ok to draw again
|
||||
insideResize = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -133,6 +135,9 @@ public class PGraphicsJava2D extends PGraphics {
|
||||
|
||||
|
||||
public void beginDraw() {
|
||||
insideResizeWait();
|
||||
insideDraw = true;
|
||||
|
||||
// need to call defaults(), but can only be done when it's ok
|
||||
// to draw (i.e. for opengl, no drawing can be done outside
|
||||
// beginDraw/endDraw).
|
||||
@@ -149,6 +154,8 @@ public class PGraphicsJava2D extends PGraphics {
|
||||
// hm, mark pixels as changed, because this will instantly do a full
|
||||
// copy of all the pixels to the surface.. so that's kind of a mess.
|
||||
//updatePixels();
|
||||
|
||||
insideDraw = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -99,7 +99,8 @@ public class PImage implements PConstants, Cloneable {
|
||||
* The pixel array is not allocated.
|
||||
*/
|
||||
public PImage() {
|
||||
format = RGB; // makes sure that this guy is useful
|
||||
//format = RGB; // makes sure that this guy is useful
|
||||
format = ARGB; // default to ARGB images for release 0116
|
||||
cache = null;
|
||||
}
|
||||
|
||||
|
||||
+13
-16
@@ -90,6 +90,9 @@ X change reader() to createReader() for consistency?
|
||||
X though printwriter is odd for output..
|
||||
X also createWriter() and the rest
|
||||
o add to docs: save() on a PImage needs savePath() added
|
||||
X figure out default behavior for native text fonts
|
||||
X make sure insideDrawWait() is in other resize() methods
|
||||
X begin/end/alloc waits to PGraphicsJava2D, PGraphicsOpenGL, PGraphics3D
|
||||
|
||||
more recent
|
||||
X only update mouse pos on moved and dragged
|
||||
@@ -109,9 +112,8 @@ o right now the camera doesn't get set up unless you call depth()
|
||||
o box and sphere are broken in gl
|
||||
o what should the update image function be called?
|
||||
|
||||
|
||||
_ make sure insideDrawWait() is in other resize() methods
|
||||
_ begin/end/alloc waits to PGraphicsJava2D, PGraphicsOpenGL, PGraphics3D
|
||||
_ toInt() on a float string needs to work
|
||||
_ need to check for periods to see if float -> int first
|
||||
_ shape changes
|
||||
_ remove LINE_STRIP - tell people to use beginShape() with no params
|
||||
_ remove LINE_LOOP - tell people to use endShape(CLOSE)
|
||||
@@ -127,20 +129,10 @@ _ in opengl lib, need beginTexture(PImage) and endTexture()
|
||||
_ this will be helpful to have access to the raw texture data
|
||||
_ that way it can be re-bound by itself, and ppl can write directly to it
|
||||
_ use parseFloat instead of toFloat()? to be consistent with javascript
|
||||
_ bring back the old P2D, rename PGraphics2 into PGraphicsJava
|
||||
_ when running as an applet, sketchPath won't be set
|
||||
_ http://processing.org/discourse/yabb_beta/YaBB.cgi?board=Syntax;action=display;num=1153150923
|
||||
|
||||
|
||||
text and fonts
|
||||
_ figure out default behavior for native text fonts
|
||||
_ was grabbing the wrong native font with ico sketch
|
||||
_ seems that the psname is no longer a good way to grab the font? related?
|
||||
_ fonts in java 1.5 have changed again
|
||||
_ appears that asking for the postscript name no longer works
|
||||
_ fix "create font" and associated font stuff to straighten it out
|
||||
|
||||
|
||||
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
||||
|
||||
|
||||
@@ -620,6 +612,11 @@ _ maybe a hack where a new menubar is added?
|
||||
|
||||
CORE / PFont and text()
|
||||
|
||||
_ fonts in java 1.5 have changed again
|
||||
_ appears that asking for the postscript name no longer works
|
||||
_ fix "create font" and associated font stuff to straighten it out
|
||||
_ was grabbing the wrong native font with ico sketch
|
||||
_ seems that the psname is no longer a good way to grab the font? related?
|
||||
_ leading looks too big, at least in PGraphics2 with news gothic
|
||||
_ though it may be the converted version of the .ttf?
|
||||
_ font encoding issues
|
||||
@@ -800,7 +797,7 @@ _ not clipping areas from offscreen
|
||||
_ huge geometry slows things way down
|
||||
|
||||
|
||||
CORE / PGraphics2
|
||||
CORE / PGraphicsJava2D
|
||||
|
||||
_ make get/getImpl for PGraphics/PGraphics2
|
||||
_ make sure there's a loadPixels/updatePixels in PGraphics2
|
||||
@@ -830,7 +827,7 @@ g2.setPaint(gradient);
|
||||
g2.draw(gp);
|
||||
|
||||
|
||||
CORE / PGraphics3
|
||||
CORE / PGraphics3D
|
||||
|
||||
_ rect() changes size as it changes position
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=95
|
||||
@@ -923,7 +920,7 @@ _ http://dev.processing.org/bugs/show_bug.cgi?id=127
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
PGraphicsGL
|
||||
PGraphicsOpenGL
|
||||
|
||||
_ opengl keeping memory around..
|
||||
_ could this be in vertices that have an image associated
|
||||
|
||||
@@ -411,6 +411,7 @@ public class PGraphicsOpenGL extends PGraphics3D {
|
||||
flush();
|
||||
}
|
||||
|
||||
insideDraw = false;
|
||||
report("bot endDraw()");
|
||||
}
|
||||
|
||||
|
||||
@@ -53,6 +53,24 @@ X move fwd/back tab into the tab menu
|
||||
X however it includes a bug that loses focus (at least on osx)
|
||||
X http://dev.processing.org/bugs/show_bug.cgi?id=402
|
||||
X "export folder" tool has been removed, if temporarily
|
||||
X add info to the new faq
|
||||
X where to find out about embedding PApplet (the dev ref)
|
||||
X also the link to the eclipse integration
|
||||
X also add to the platforms page
|
||||
X i want to use java 1.5 crap (so do it, just don't use our env)
|
||||
X where have all the old faq pages gone?
|
||||
X add to opengl ref the information about downloading more native libs
|
||||
X we only include linux-i586, macosx (ppc and universal), windows
|
||||
X also can get linux amd64 and sunos, just need to include the libs
|
||||
X add to createImage() or createGraphics reference:
|
||||
X Creating bitmap images - from advanced.html
|
||||
X the "export folder" command doesn't seem to work at all
|
||||
X check with casey, see if he's using it
|
||||
o fix up how archive sketch saves files
|
||||
X bring up name, and let people change if they want
|
||||
X that's prolly better, can send it to desktop or whatever
|
||||
X but default folder will be sketchbook/its parent folder
|
||||
X add "save sketch before archive? (or cancel)" option
|
||||
|
||||
video
|
||||
X quicktime in applets
|
||||
@@ -146,29 +164,9 @@ X this means no need to install an additional java vm
|
||||
X or an option to include the 'java' folder on windows/linux with export
|
||||
X on unix machines it's also possible to use a symlink
|
||||
|
||||
|
||||
_ need to write converter that will handle syntax changes
|
||||
_ basically find & replace with regexps
|
||||
_ framerate() -> frameRate()
|
||||
X add info to the new faq
|
||||
X where to find out about embedding PApplet (the dev ref)
|
||||
X also the link to the eclipse integration
|
||||
X also add to the platforms page
|
||||
X i want to use java 1.5 crap (so do it, just don't use our env)
|
||||
X where have all the old faq pages gone?
|
||||
X add to opengl ref the information about downloading more native libs
|
||||
X we only include linux-i586, macosx (ppc and universal), windows
|
||||
X also can get linux amd64 and sunos, just need to include the libs
|
||||
X add to createImage() or createGraphics reference:
|
||||
X Creating bitmap images - from advanced.html
|
||||
_ the "export folder" command doesn't seem to work at all
|
||||
_ check with casey, see if he's using it
|
||||
_ on archive sketch, open the sketch folder where it's saved
|
||||
_ or bring up name, and let people change if they want
|
||||
_ that's prolly better, can send it to desktop or whatever
|
||||
_ but default folder will be sketchbook/its parent folder
|
||||
_ add "save sketch before archive? (or cancel)" option
|
||||
_ also need to export sketch as applet when uploading
|
||||
|
||||
|
||||
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
||||
@@ -822,6 +820,13 @@ _ ftp upload sketch
|
||||
_ archive sketch direct to bug report
|
||||
|
||||
|
||||
TOOLS / Courseware
|
||||
|
||||
_ export sketch as applet when uploading
|
||||
_ save sketch zip files, have a means to load them from "teacher" version of p5
|
||||
_ figure out how to use the
|
||||
|
||||
|
||||
TOOLS / libraries
|
||||
|
||||
_ could have library developers update compatability note
|
||||
|
||||
Reference in New Issue
Block a user