From 5ed189b5afc5b86bb1fb549fc3ff7e54f01abc96 Mon Sep 17 00:00:00 2001 From: benfry Date: Thu, 23 Jun 2011 21:46:31 +0000 Subject: [PATCH] more tweaks for XML on Android, write release notes --- android/core/src/processing/core/PApplet.java | 3 +- android/core/src/processing/core/PNode.java | 64 ++++------ .../core/src/processing/core/PShapeSVG.java | 2 - build/shared/revisions.txt | 117 ++++++++++++++++++ core/src/processing/core/PApplet.java | 4 +- core/todo.txt | 3 + 6 files changed, 144 insertions(+), 49 deletions(-) diff --git a/android/core/src/processing/core/PApplet.java b/android/core/src/processing/core/PApplet.java index fcae687ef..3ecd4a570 100644 --- a/android/core/src/processing/core/PApplet.java +++ b/android/core/src/processing/core/PApplet.java @@ -25,7 +25,6 @@ package processing.core; import java.io.IOException; import java.io.InputStream; -import processing.xml.XMLElement; import android.content.*; import android.content.pm.ActivityInfo; import android.content.res.AssetManager; @@ -3598,7 +3597,7 @@ public class PApplet extends Activity implements PConstants, Runnable { } else if (extension.equals("svgz")) { try { InputStream input = new GZIPInputStream(createInput(filename)); - XMLElement xml = new XMLElement(createReader(input)); + PNode xml = new PNode(createReader(input)); return new PShapeSVG(xml); } catch (IOException e) { e.printStackTrace(); diff --git a/android/core/src/processing/core/PNode.java b/android/core/src/processing/core/PNode.java index a8934a551..cba8efa85 100644 --- a/android/core/src/processing/core/PNode.java +++ b/android/core/src/processing/core/PNode.java @@ -28,10 +28,6 @@ import javax.xml.parsers.*; import org.w3c.dom.*; import org.xml.sax.*; -import javax.xml.transform.*; -import javax.xml.transform.dom.*; -import javax.xml.transform.stream.*; - import processing.core.PApplet; @@ -532,7 +528,17 @@ public class PNode implements Serializable { * @return the content. */ public String getContent() { - return node.getTextContent(); + //return node.getTextContent(); // requires Android 2.2 + + StringBuilder buffer = new StringBuilder(); + NodeList childList = node.getChildNodes(); + for (int i = 0; i < childList.getLength(); i++) { + Node child = childList.item(i); + if (child.getNodeType() == Node.TEXT_NODE) { // skip non-text nodes + buffer.append(child.getNodeValue()); + } + } + return buffer.toString(); } @@ -542,6 +548,16 @@ public class PNode implements Serializable { public String toString(int indent) { + return super.toString(); + + // requires API level 8 +// javax.xml.transform.TransformerFactory factory = new javax.xml.transform.TransformerFactory(); +// javax.xml.transform.Transformer transformer = factory.newTransformer(); +// javax.xml.transform.dom.DOMSource domSource = new javax.xml.transform.dom.DOMSource(rootNode); +// javax.xml.transform.stream.StreamResult result = new javax.xml.transform.stream.StreamResult(outputStream); +// transformer(domSource, result); + + /* try { DOMSource dumSource = new DOMSource(node); TransformerFactory tf = TransformerFactory.newInstance(); @@ -567,42 +583,6 @@ public class PNode implements Serializable { e.printStackTrace(); } return null; - -// DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); -// try { -// DocumentBuilder builder = factory.newDocumentBuilder(); -// //builder.get -//// Document document = builder. -// -// } catch (ParserConfigurationException e) { -// e.printStackTrace(); -// } - - - - // Document doc = new DocumentImpl(); -// return node.toString(); - -// TransformerFactory transfac = TransformerFactory.newInstance(); -// Transformer trans = transfac.newTransformer(); -// trans.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); -// trans.setOutputProperty(OutputKeys.INDENT, "yes"); -// -// //create string from xml tree -// StringWriter sw = new StringWriter(); -// StreamResult result = new StreamResult(sw); -//// Document doc = -// DOMSource source = new DOMSource(doc); -// trans.transform(source, result); -// String xmlString = sw.toString(); - + */ } - - -// static final String HEADER = ""; -// -// public void write(PrintWriter writer) { -// writer.println(HEADER); -// writer.print(toString(2)); -// } } diff --git a/android/core/src/processing/core/PShapeSVG.java b/android/core/src/processing/core/PShapeSVG.java index 85bbe4700..6313bf4ad 100644 --- a/android/core/src/processing/core/PShapeSVG.java +++ b/android/core/src/processing/core/PShapeSVG.java @@ -27,8 +27,6 @@ import java.util.HashMap; import android.graphics.*; -import processing.xml.PNode; - /** * SVG stands for Scalable Vector Graphics, a portable graphics format. It is diff --git a/build/shared/revisions.txt b/build/shared/revisions.txt index 07df2cafd..f18455276 100644 --- a/build/shared/revisions.txt +++ b/build/shared/revisions.txt @@ -1,3 +1,120 @@ +PROCESSING REV 0198 - 23 June 2011 + +Major internal work as we start blowing things up for 2.0. The main things are +covered on the changes page in the Wiki: http://wiki.processing.org/w/Changes + +This is an interim release so that Andres can do a workshop. Not recommended +for casual use. Hostile or belligerent whiners need not apply. + +Android mode has received zero testing, so XML, SVG, 3D, and other major +features may be broken. See statement directly above. + +[ bugs fixed ] + ++ Examples window placed off-screen when PDE window is maximized + http://code.google.com/p/processing/issues/detail?id=669 + ++ Make examples window respond to ESC, and double-click events to + expand/collapse nodes. + ++ Launch script for Linux fails to open a sketches with relative paths + http://code.google.com/p/processing/issues/detail?id=707 + ++ Badly formed character constant exception + http://code.google.com/p/processing/issues/detail?id=714 + ++ Resize box on OS X is not present in Examples box + http://code.google.com/p/processing/issues/detail?id=730 + ++ New/Rename Tab commands inhibited when Console/Message Area is hidden + http://code.google.com/p/processing/issues/detail?id=745 + ++ Make sketch.properties usable elsewhere by loading/reloading + http://code.google.com/p/processing/issues/detail?id=722 + ++ Export to Application reports "Could not copy source file:" + http://code.google.com/p/processing/issues/detail?id=638 + ++ Automatically insert the 'import processing.opengl' when P3D used. + ++ Export Application Fails When Large File in Data Folder + http://code.google.com/p/processing/issues/detail?id=747 + +[ reference ] + ++ Add some notes about how to work with deployJava.js and applets + http://dev.processing.org/bugs/show_bug.cgi?id=1259 + +[ core ] + ++ Added quadraticVertex() method to do a quadratic bezier vertex. + ++ More efficient version of copy() added for 2D. + ++ Implemented rounded rectangle method. + http://code.google.com/p/processing/issues/detail?id=265 + ++ Removed the delay() method. It was awful. + ++ Addded thread() method that takes a function name as a parameter, + and runs it on its own thread. No more classes! + ++ PImage.save() returns a success boolean (rather than throwing an + exception when it fails). + +[ core bugs fixed ] + ++ saveBytes() error when writing to existing file + http://code.google.com/p/processing/issues/detail?id=667 + ++ problem with destroy() calling System.exit() + http://code.google.com/p/processing/issues/detail?id=698 + ++ post() is called after setup() + http://code.google.com/p/processing/issues/detail?id=455 + ++ Remove auto-sizing from binary() (was inconsistent with hex() method). + +[ libraries ] + ++ Reverted back to the older serial libs, which should improve stability a bit. + Also grabbed the 64 bit Linux driver and a patch for /dev/ttyACM0 from + the Arduino guys. Thanks to Dave Mellis for the pointer. + http://code.google.com/p/processing/issues/detail?id=634 + ++ Fix applet exporting for new OpenGL, also fixes signed applet requirement. + http://code.google.com/p/processing/issues/detail?id=429 + ++ New XML library that more accurately reflects how DOM parsing works. + Also straightening out the API a bit. Documentation to come later. + http://code.google.com/p/processing/issues/detail?id=277 + http://code.google.com/p/processing/issues/detail?id=440 + +[ andres' bag of awesome ] + ++ Finish OPENGL2 renderer + http://code.google.com/p/processing/issues/detail?id=495 + ++ Using createGraphics() image repeatedly runs out of memory with OPENGL + http://code.google.com/p/processing/issues/detail?id=483 + ++ Resizing window in OPENGL breaks ImageCaches + http://code.google.com/p/processing/issues/detail?id=184 + ++ Resize not working in revision 5707 + camera() and perspective() were commented out in setSize() + http://dev.processing.org/bugs/show_bug.cgi?id=1391 + ++ Resizing opengl destroys context and textures + http://dev.processing.org/bugs/show_bug.cgi?id=1176 + ++ Implement repeating textures + http://code.google.com/p/processing/issues/detail?id=94 + + +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + PROCESSING 1.5.1 (REV 0197) - 15 May 2011 This release fixes a handful of regressions and quirks that were found in diff --git a/core/src/processing/core/PApplet.java b/core/src/processing/core/PApplet.java index 480be6d74..69e1e82aa 100644 --- a/core/src/processing/core/PApplet.java +++ b/core/src/processing/core/PApplet.java @@ -3,7 +3,7 @@ /* Part of the Processing project - http://processing.org - Copyright (c) 2004-10 Ben Fry and Casey Reas + Copyright (c) 2004-11 Ben Fry and Casey Reas Copyright (c) 2001-04 Massachusetts Institute of Technology This library is free software; you can redistribute it and/or @@ -39,8 +39,6 @@ import javax.imageio.ImageIO; import javax.swing.JFileChooser; import javax.swing.SwingUtilities; -import processing.core.PShape; - /** * Base class for all sketches that use processing.core. diff --git a/core/todo.txt b/core/todo.txt index 38f7caa73..300d6ac71 100644 --- a/core/todo.txt +++ b/core/todo.txt @@ -437,6 +437,9 @@ _ 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 +_ finish xml writing on android +_ http://stackoverflow.com/questions/2290945/writing-xml-on-android +_ consider switch to android 2.2 as the minimum _ finish updating XML documentation _ http://code.google.com/p/processing/issues/detail?id=382 _ json issues