more node and android fixes, starting on ColorSelector

This commit is contained in:
benfry
2011-06-19 14:52:51 +00:00
parent fa772df0ad
commit 6682ad1454
5 changed files with 47 additions and 24 deletions
@@ -411,16 +411,18 @@ public class ColorSelector implements Tool, DocumentListener {
public void setup() {
size(WIDE, HIGH, P3D);
size(WIDE, HIGH); //, P3D);
noLoop();
colorMode(HSB, 360, 256, 256);
noFill();
rectMode(CENTER);
loadPixels();
}
public void draw() {
if ((g == null) || (g.pixels == null)) return;
// if ((g == null) || (g.pixels == null)) return;
if ((width != WIDE) || (height < HIGH)) {
//System.out.println("bad size " + width + " " + height);
return;
@@ -487,7 +489,7 @@ public class ColorSelector implements Tool, DocumentListener {
static final int HIGH = 256;
public void setup() {
size(WIDE, HIGH, P3D);
size(WIDE, HIGH); //, P3D);
colorMode(HSB, 255, 100, 100);
noLoop();
}
+10 -4
View File
@@ -111,9 +111,11 @@ public class Manifest {
}
// ...and add the new kids back
for (String name : names) {
PNode newbie = new PNodeXML("uses-permission");
// PNode newbie = new PNodeXML("uses-permission");
// newbie.setString("android:name", PERMISSION_PREFIX + name);
// xml.addChild(newbie);
PNode newbie = xml.addChild("uses-permission");
newbie.setString("android:name", PERMISSION_PREFIX + name);
xml.addChild(newbie);
}
save();
}
@@ -216,7 +218,9 @@ public class Manifest {
activity.setString("android:name", "." + className); // this has to be right
PrintWriter writer = PApplet.createWriter(file);
mf.write(writer);
writer.print(mf.toString());
writer.flush();
// mf.write(writer);
writer.close();
}
@@ -271,7 +275,9 @@ public class Manifest {
*/
protected void save(File file) {
PrintWriter writer = PApplet.createWriter(file);
xml.write(writer);
// xml.write(writer);
writer.print(xml.toString());
writer.flush();
writer.close();
}
+2 -2
View File
@@ -98,7 +98,7 @@ public interface PNode extends Serializable {
public PNode[] getChildren(String name);
public void addChild(PNode kid);
public PNode addChild(String name);
public void removeChild(PNode kid);
@@ -202,5 +202,5 @@ public interface PNode extends Serializable {
public String toString(int indent);
public void write(PrintWriter writer);
// public void write(PrintWriter writer);
}
+17 -11
View File
@@ -362,12 +362,18 @@ public class PNodeXML implements PNode, Serializable {
}
public void addChild(PNode kid) {
node.appendChild(((PNodeXML) kid).node);
children = null; // TODO not efficient
public PNode addChild(String tag) {
Document document = node.getOwnerDocument();
Node newChild = document.createElement(tag);
node.appendChild(newChild);
PNode pn = new PNodeXML(this, newChild);
if (children != null) {
children = (PNode[]) PApplet.concat(children, new PNode[] { pn });
}
return pn;
}
public void removeChild(PNode kid) {
node.removeChild(((PNodeXML) kid).node);
children = null; // TODO not efficient
@@ -593,10 +599,10 @@ public class PNodeXML implements PNode, Serializable {
}
static final String HEADER = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
public void write(PrintWriter writer) {
writer.println(HEADER);
writer.print(toString(2));
}
// static final String HEADER = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
//
// public void write(PrintWriter writer) {
// writer.println(HEADER);
// writer.print(toString(2));
// }
}
+13 -4
View File
@@ -23,11 +23,20 @@ cleaning
o call reapplySettings() when using beginRecord()?
X nope, won't work for many fonts, can't get the background
_ see if write() is necessary inside PNodeXML
_ it needs a proper header on it, so maybe that's the difference w/ toString()
_ inefficient: the way new nodes are created
_ also inefficient: adding/removing kids just nukes the children array
xml changes
o see if write() is necessary inside PNodeXML
o it needs a proper header on it, so maybe that's the difference w/ toString()
o inefficient: the way new nodes are created
o also inefficient: adding/removing kids just nukes the children array
X toString() adds the XML header
_ add support for automatically including OpenGL when asking for P3D
_ when using P3D and not realizing that it's really OpenGL...
Exception in thread "Animation Thread" java.lang.NoClassDefFoundError: Could not initialize class javax.media.opengl.GLProfile
Exception in thread "Animation Thread" java.lang.UnsatisfiedLinkError: no gluegen-rt in java.library.path
_ check on DXFWriter, since it used to subclass P3D
_ at least implement is3D?
_ Potential race condition when resizing sketches
_ http://code.google.com/p/processing/issues/detail?id=697