mirror of
https://github.com/esp8266/Arduino.git
synced 2025-07-30 16:24:09 +03:00
Moving the processing-6406-sync branch into trunk.
This commit is contained in:
52
app/build.xml
Normal file
52
app/build.xml
Normal file
@ -0,0 +1,52 @@
|
||||
<?xml version="1.0"?>
|
||||
<project name="Arduino PDE" default="build">
|
||||
|
||||
<target name="clean" description="Clean the build directories">
|
||||
<delete dir="bin" />
|
||||
<delete file="pde.jar" />
|
||||
</target>
|
||||
|
||||
<target name="compile" description="Compile sources">
|
||||
<condition property="core-built">
|
||||
<available file="../core/core.jar" />
|
||||
</condition>
|
||||
<fail unless="core-built" message="Please build the core library first and make sure it sits in ../core/core.jar" />
|
||||
|
||||
<mkdir dir="bin" />
|
||||
|
||||
<!-- ant seems to nuke ${java.home} for some reason, pointing at the JRE
|
||||
subfolder instead of the actual JDK found at JAVA_HOME.
|
||||
To avoid this, we grab the actual JAVA_HOME environment variable
|
||||
and use that to specify the location of tools.jar. -->
|
||||
|
||||
<!-- if someone is better with ant please help clean this up -->
|
||||
<property environment="env" />
|
||||
<property name="java_home" value="${env.JAVA_HOME}" />
|
||||
|
||||
<condition property="linux"><os family="unix" /></condition>
|
||||
<fail if="linux" unless="java_home"
|
||||
message="The JAVA_HOME variable must be set to the location of a full JDK. For instance, on Ubuntu Linux, this might be /usr/lib/jvm/java-6-sun." />
|
||||
|
||||
<condition property="windows"><os family="windows" /></condition>
|
||||
<fail if="windows" unless="java_home"
|
||||
message="The JAVA_HOME variable must be set to the location of a full JDK. For instance, on Windows, this might be c:\jdk1.6.0_18." />
|
||||
|
||||
<!--
|
||||
<dirname property="blah" file="${java.home}" />
|
||||
<echo message="here! ${java.home}/lib/tools.jar or there: ${blah}" />
|
||||
<echo message="override ${env.JAVA_HOME}/lib/tools.jar" />
|
||||
<fail />
|
||||
-->
|
||||
<javac target="1.5"
|
||||
srcdir="src"
|
||||
destdir="bin"
|
||||
excludes="**/tools/format/**"
|
||||
encoding="UTF-8"
|
||||
includeAntRuntime="false"
|
||||
classpath="../core/core.jar; ${env.JAVA_HOME}/lib/tools.jar; lib/ant.jar; lib/ant-launcher.jar; lib/apple.jar; lib/ecj.jar; lib/jna.jar; lib/oro.jar; lib/RXTXcomm.jar" />
|
||||
</target>
|
||||
|
||||
<target name="build" depends="compile" description="Build PDE">
|
||||
<jar basedir="bin" destfile="pde.jar" />
|
||||
</target>
|
||||
</project>
|
@ -1,132 +0,0 @@
|
||||
package antlr;
|
||||
|
||||
/* ANTLR Translator Generator
|
||||
* Project led by Terence Parr at http://www.jGuru.com
|
||||
* Software rights: http://www.antlr.org/RIGHTS.html
|
||||
*
|
||||
* $Id: ExtendedCommonASTWithHiddenTokens.java 3419 2007-07-16 14:02:05Z fry $
|
||||
*/
|
||||
|
||||
import java.io.*;
|
||||
//import antlr.*;
|
||||
import antlr.collections.*;
|
||||
//import antlr.collections.impl.*;
|
||||
|
||||
/** A CommonAST whose initialization copies hidden token
|
||||
* information from the Token used to create a node.
|
||||
*/
|
||||
public class ExtendedCommonASTWithHiddenTokens
|
||||
extends CommonASTWithHiddenTokens {
|
||||
|
||||
public ExtendedCommonASTWithHiddenTokens() {
|
||||
super();
|
||||
}
|
||||
|
||||
public ExtendedCommonASTWithHiddenTokens(Token tok) {
|
||||
super(tok);
|
||||
}
|
||||
|
||||
public void initialize(AST ast) {
|
||||
ExtendedCommonASTWithHiddenTokens a =
|
||||
(ExtendedCommonASTWithHiddenTokens)ast;
|
||||
super.initialize(a);
|
||||
hiddenBefore = a.getHiddenBefore();
|
||||
hiddenAfter = a.getHiddenAfter();
|
||||
}
|
||||
|
||||
public String getHiddenAfterString() {
|
||||
|
||||
CommonHiddenStreamToken t;
|
||||
StringBuffer hiddenAfterString = new StringBuffer(100);
|
||||
|
||||
for ( t = hiddenAfter ; t != null ; t = t.getHiddenAfter() ) {
|
||||
hiddenAfterString.append(t.getText());
|
||||
}
|
||||
|
||||
return hiddenAfterString.toString();
|
||||
}
|
||||
|
||||
public String getHiddenBeforeString() {
|
||||
|
||||
antlr.CommonHiddenStreamToken
|
||||
child = null,
|
||||
parent = hiddenBefore;
|
||||
|
||||
// if there aren't any hidden tokens here, quietly return
|
||||
//
|
||||
if (parent == null) {
|
||||
return "";
|
||||
}
|
||||
|
||||
// traverse back to the head of the list of tokens before this node
|
||||
do {
|
||||
child = parent;
|
||||
parent = child.getHiddenBefore();
|
||||
} while (parent != null);
|
||||
|
||||
// dump that list
|
||||
|
||||
StringBuffer hiddenBeforeString = new StringBuffer(100);
|
||||
|
||||
for ( CommonHiddenStreamToken t = child; t != null ;
|
||||
t = t.getHiddenAfter() ) {
|
||||
hiddenBeforeString.append(t.getText());
|
||||
}
|
||||
|
||||
return hiddenBeforeString.toString();
|
||||
}
|
||||
|
||||
public void xmlSerializeNode(Writer out)
|
||||
throws IOException {
|
||||
StringBuffer buf = new StringBuffer(100);
|
||||
buf.append("<");
|
||||
buf.append(getClass().getName() + " ");
|
||||
|
||||
buf.append("hiddenBeforeString=\"" +
|
||||
encode(getHiddenBeforeString()) +
|
||||
"\" text=\"" + encode(getText()) + "\" type=\"" +
|
||||
getType() + "\" hiddenAfterString=\"" +
|
||||
encode(getHiddenAfterString()) + "\"/>");
|
||||
out.write(buf.toString());
|
||||
}
|
||||
|
||||
public void xmlSerializeRootOpen(Writer out)
|
||||
throws IOException {
|
||||
StringBuffer buf = new StringBuffer(100);
|
||||
buf.append("<");
|
||||
buf.append(getClass().getName() + " ");
|
||||
buf.append("hiddenBeforeString=\"" +
|
||||
encode(getHiddenBeforeString()) +
|
||||
"\" text=\"" + encode(getText()) + "\" type=\"" +
|
||||
getType() + "\" hiddenAfterString=\"" +
|
||||
encode(getHiddenAfterString()) + "\">\n");
|
||||
out.write(buf.toString());
|
||||
}
|
||||
|
||||
public void xmlSerializeRootClose(Writer out)
|
||||
throws IOException {
|
||||
out.write("</" + getClass().getName() + ">\n");
|
||||
}
|
||||
|
||||
public void xmlSerialize(Writer out) throws IOException {
|
||||
// print out this node and all siblings
|
||||
for (AST node = this;
|
||||
node != null;
|
||||
node = node.getNextSibling()) {
|
||||
if (node.getFirstChild() == null) {
|
||||
// print guts (class name, attributes)
|
||||
((BaseAST)node).xmlSerializeNode(out);
|
||||
}
|
||||
else {
|
||||
((BaseAST)node).xmlSerializeRootOpen(out);
|
||||
|
||||
// print children
|
||||
((BaseAST)node.getFirstChild()).xmlSerialize(out);
|
||||
|
||||
// print end tag
|
||||
((BaseAST)node).xmlSerializeRootClose(out);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,221 +0,0 @@
|
||||
/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
|
||||
|
||||
package antlr;
|
||||
//package processing.app.preproc;
|
||||
|
||||
|
||||
//import antlr.*;
|
||||
import antlr.collections.impl.BitSet;
|
||||
|
||||
/**
|
||||
* This class provides TokenStreamHiddenTokenFilters with the concept of
|
||||
* tokens which can be copied so that they are seen by both the hidden token
|
||||
* stream as well as the parser itself. This is useful when one wants to use
|
||||
* an existing parser (like the Java parser included with ANTLR) that throws
|
||||
* away some tokens to create a parse tree which can be used to spit out
|
||||
* a copy of the code with only minor modifications.
|
||||
*
|
||||
* This code is partially derived from the public domain ANLTR TokenStream
|
||||
*/
|
||||
public class TokenStreamCopyingHiddenTokenFilter
|
||||
extends TokenStreamHiddenTokenFilter
|
||||
implements TokenStream {
|
||||
|
||||
protected BitSet copyMask;
|
||||
CommonHiddenStreamToken hiddenCopy = null;
|
||||
|
||||
public TokenStreamCopyingHiddenTokenFilter(TokenStream input) {
|
||||
super(input);
|
||||
copyMask = new BitSet();
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicate that all tokens of type tokenType should be copied. The copy
|
||||
* is put in the stream of hidden tokens, and the original is returned in the
|
||||
* stream of normal tokens.
|
||||
*
|
||||
* @param tokenType integer representing the token type to copied
|
||||
*/
|
||||
public void copy(int tokenType) {
|
||||
copyMask.add(tokenType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a clone of the important parts of the given token. Note that this
|
||||
* does NOT copy the hiddenBefore and hiddenAfter fields.
|
||||
*
|
||||
* @param t token to partially clone
|
||||
* @return newly created partial clone
|
||||
*/
|
||||
public CommonHiddenStreamToken partialCloneToken(CommonHiddenStreamToken t) {
|
||||
|
||||
CommonHiddenStreamToken u = new CommonHiddenStreamToken(t.getType(),
|
||||
t.getText());
|
||||
u.setColumn(t.getColumn());
|
||||
u.setLine(t.getLine());
|
||||
u.setFilename(t.getFilename());
|
||||
|
||||
return u;
|
||||
}
|
||||
|
||||
public void linkAndCopyToken(CommonHiddenStreamToken prev,
|
||||
CommonHiddenStreamToken monitored) {
|
||||
// create a copy of the token in the lookahead for use as hidden token
|
||||
hiddenCopy = partialCloneToken(LA(1));
|
||||
|
||||
// attach copy to the previous token, whether hidden or monitored
|
||||
prev.setHiddenAfter(hiddenCopy);
|
||||
|
||||
// if previous token was hidden, set the hiddenBefore pointer of the
|
||||
// copy to point back to it
|
||||
if (prev != monitored) {
|
||||
hiddenCopy.setHiddenBefore(prev);
|
||||
}
|
||||
|
||||
// we don't want the non-hidden copy to link back to the hidden
|
||||
// copy on the next pass through this function, so we leave
|
||||
// lastHiddenToken alone
|
||||
|
||||
//System.err.println("hidden copy: " + hiddenCopy.toString());
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
private void consumeFirst() throws TokenStreamException {
|
||||
consume(); // get first token of input stream
|
||||
|
||||
// Handle situation where hidden or discarded tokens
|
||||
// appear first in input stream
|
||||
CommonHiddenStreamToken p=null;
|
||||
|
||||
// while hidden, copied, or discarded scarf tokens
|
||||
while ( hideMask.member(LA(1).getType()) ||
|
||||
discardMask.member(LA(1).getType()) ||
|
||||
copyMask.member(LA(1).getType()) ) {
|
||||
|
||||
// if we've hit one of the tokens that needs to be copied, we copy it
|
||||
// and then break out of the loop, because the parser needs to see it
|
||||
// too
|
||||
//
|
||||
if (copyMask.member(LA(1).getType())) {
|
||||
|
||||
// copy the token in the lookahead
|
||||
hiddenCopy = partialCloneToken(LA(1));
|
||||
|
||||
// if there's an existing token before this, link that and the
|
||||
// copy together
|
||||
if (p != null) {
|
||||
p.setHiddenAfter(hiddenCopy);
|
||||
hiddenCopy.setHiddenBefore(p); // double-link
|
||||
}
|
||||
|
||||
lastHiddenToken = hiddenCopy;
|
||||
if (firstHidden == null) {
|
||||
firstHidden = hiddenCopy;
|
||||
}
|
||||
|
||||
// we don't want to consume this token, because it also needs to
|
||||
// be passed through to the parser, so break out of the while look
|
||||
// entirely
|
||||
//
|
||||
break;
|
||||
} else if (hideMask.member(LA(1).getType())) {
|
||||
if (p != null) {
|
||||
p.setHiddenAfter(LA(1));
|
||||
LA(1).setHiddenBefore(p); // double-link
|
||||
}
|
||||
p = LA(1);
|
||||
|
||||
lastHiddenToken = p;
|
||||
if (firstHidden == null) {
|
||||
firstHidden = p; // record hidden token if first
|
||||
}
|
||||
}
|
||||
consume();
|
||||
}
|
||||
}
|
||||
|
||||
/** Return the next monitored token.
|
||||
* Test the token following the monitored token.
|
||||
* If following is another monitored token, save it
|
||||
* for the next invocation of nextToken (like a single
|
||||
* lookahead token) and return it then.
|
||||
* If following is unmonitored, nondiscarded (hidden)
|
||||
* channel token, add it to the monitored token.
|
||||
*
|
||||
* Note: EOF must be a monitored Token.
|
||||
*/
|
||||
public Token nextToken() throws TokenStreamException {
|
||||
// handle an initial condition; don't want to get lookahead
|
||||
// token of this splitter until first call to nextToken
|
||||
if (LA(1) == null) {
|
||||
consumeFirst();
|
||||
}
|
||||
|
||||
//System.err.println();
|
||||
|
||||
// we always consume hidden tokens after monitored, thus,
|
||||
// upon entry LA(1) is a monitored token.
|
||||
CommonHiddenStreamToken monitored = LA(1);
|
||||
|
||||
// point to hidden tokens found during last invocation
|
||||
monitored.setHiddenBefore(lastHiddenToken);
|
||||
lastHiddenToken = null;
|
||||
|
||||
// Look for hidden tokens, hook them into list emanating
|
||||
// from the monitored tokens.
|
||||
consume();
|
||||
CommonHiddenStreamToken prev = monitored;
|
||||
|
||||
// deal with as many not-purely-monitored tokens as possible
|
||||
while ( hideMask.member(LA(1).getType()) ||
|
||||
discardMask.member(LA(1).getType()) ||
|
||||
copyMask.member(LA(1).getType()) ) {
|
||||
|
||||
if (copyMask.member(LA(1).getType())) {
|
||||
|
||||
// copy the token and link it backwards
|
||||
if (hiddenCopy != null) {
|
||||
linkAndCopyToken(hiddenCopy, monitored);
|
||||
} else {
|
||||
linkAndCopyToken(prev, monitored);
|
||||
}
|
||||
|
||||
// we now need to parse it as a monitored token, so we return, which
|
||||
// avoids the consume() call at the end of this loop. the next call
|
||||
// will parse it as a monitored token.
|
||||
//System.err.println("returned: " + monitored.toString());
|
||||
return monitored;
|
||||
|
||||
} else if (hideMask.member(LA(1).getType())) {
|
||||
|
||||
// attach the hidden token to the monitored in a chain
|
||||
// link forwards
|
||||
prev.setHiddenAfter(LA(1));
|
||||
|
||||
// link backwards
|
||||
if (prev != monitored) { //hidden cannot point to monitored tokens
|
||||
LA(1).setHiddenBefore(prev);
|
||||
} else if (hiddenCopy != null) {
|
||||
hiddenCopy.setHiddenAfter(LA(1));
|
||||
LA(1).setHiddenBefore(hiddenCopy);
|
||||
hiddenCopy = null;
|
||||
}
|
||||
|
||||
//System.err.println("hidden: " + prev.getHiddenAfter().toString() + "\" after: " + prev.toString());
|
||||
prev = lastHiddenToken = LA(1);
|
||||
}
|
||||
|
||||
consume();
|
||||
}
|
||||
|
||||
// remember the last hidden token for next time around
|
||||
if (hiddenCopy != null) {
|
||||
lastHiddenToken = hiddenCopy;
|
||||
hiddenCopy = null;
|
||||
}
|
||||
|
||||
//System.err.println("returned: " + monitored.toString());
|
||||
return monitored;
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,326 +0,0 @@
|
||||
package antlr;
|
||||
|
||||
|
||||
/** Java 1.3 AST Recognizer Grammar
|
||||
*
|
||||
* Author: (see java.g preamble)
|
||||
*
|
||||
* This grammar is in the PUBLIC DOMAIN
|
||||
*/
|
||||
class JavaTreeParser extends TreeParser;
|
||||
|
||||
options {
|
||||
importVocab = Java;
|
||||
}
|
||||
|
||||
compilationUnit
|
||||
: (packageDefinition)?
|
||||
(importDefinition)*
|
||||
(typeDefinition)*
|
||||
;
|
||||
|
||||
packageDefinition
|
||||
: #( PACKAGE_DEF identifier )
|
||||
;
|
||||
|
||||
importDefinition
|
||||
: #( IMPORT identifierStar )
|
||||
;
|
||||
|
||||
typeDefinition
|
||||
: #(CLASS_DEF modifiers IDENT extendsClause implementsClause objBlock )
|
||||
| #(INTERFACE_DEF modifiers IDENT extendsClause interfaceBlock )
|
||||
;
|
||||
|
||||
typeSpec
|
||||
: #(TYPE typeSpecArray)
|
||||
;
|
||||
|
||||
typeSpecArray
|
||||
: #( ARRAY_DECLARATOR typeSpecArray )
|
||||
| type
|
||||
;
|
||||
|
||||
type: identifier
|
||||
| builtInType
|
||||
;
|
||||
|
||||
builtInType
|
||||
: "void"
|
||||
| "boolean"
|
||||
| "byte"
|
||||
| "char"
|
||||
| "short"
|
||||
| "int"
|
||||
| "float"
|
||||
| "long"
|
||||
| "double"
|
||||
;
|
||||
|
||||
modifiers
|
||||
: #( MODIFIERS (modifier)* )
|
||||
;
|
||||
|
||||
modifier
|
||||
: "private"
|
||||
| "public"
|
||||
| "protected"
|
||||
| "static"
|
||||
| "transient"
|
||||
| "final"
|
||||
| "abstract"
|
||||
| "native"
|
||||
| "threadsafe"
|
||||
| "synchronized"
|
||||
| "const"
|
||||
| "volatile"
|
||||
| "strictfp"
|
||||
;
|
||||
|
||||
extendsClause
|
||||
: #(EXTENDS_CLAUSE (identifier)* )
|
||||
;
|
||||
|
||||
implementsClause
|
||||
: #(IMPLEMENTS_CLAUSE (identifier)* )
|
||||
;
|
||||
|
||||
|
||||
interfaceBlock
|
||||
: #( OBJBLOCK
|
||||
( methodDecl
|
||||
| variableDef
|
||||
)*
|
||||
)
|
||||
;
|
||||
|
||||
objBlock
|
||||
: #( OBJBLOCK
|
||||
( ctorDef
|
||||
| methodDef
|
||||
| variableDef
|
||||
| typeDefinition
|
||||
| #(STATIC_INIT slist)
|
||||
| #(INSTANCE_INIT slist)
|
||||
)*
|
||||
)
|
||||
;
|
||||
|
||||
ctorDef
|
||||
: #(CTOR_DEF modifiers methodHead (slist)?)
|
||||
;
|
||||
|
||||
methodDecl
|
||||
: #(METHOD_DEF modifiers typeSpec methodHead)
|
||||
;
|
||||
|
||||
methodDef
|
||||
: #(METHOD_DEF modifiers typeSpec methodHead (slist)?)
|
||||
;
|
||||
|
||||
variableDef
|
||||
: #(VARIABLE_DEF modifiers typeSpec variableDeclarator varInitializer)
|
||||
;
|
||||
|
||||
parameterDef
|
||||
: #(PARAMETER_DEF modifiers typeSpec IDENT )
|
||||
;
|
||||
|
||||
objectinitializer
|
||||
: #(INSTANCE_INIT slist)
|
||||
;
|
||||
|
||||
variableDeclarator
|
||||
: IDENT
|
||||
| LBRACK variableDeclarator
|
||||
;
|
||||
|
||||
varInitializer
|
||||
: #(ASSIGN initializer)
|
||||
|
|
||||
;
|
||||
|
||||
initializer
|
||||
: expression
|
||||
| arrayInitializer
|
||||
;
|
||||
|
||||
arrayInitializer
|
||||
: #(ARRAY_INIT (initializer)*)
|
||||
;
|
||||
|
||||
methodHead
|
||||
: IDENT #( PARAMETERS (parameterDef)* ) (throwsClause)?
|
||||
;
|
||||
|
||||
throwsClause
|
||||
: #( "throws" (identifier)* )
|
||||
;
|
||||
|
||||
identifier
|
||||
: IDENT
|
||||
| #( DOT identifier IDENT )
|
||||
;
|
||||
|
||||
identifierStar
|
||||
: IDENT
|
||||
| #( DOT identifier (STAR|IDENT) )
|
||||
;
|
||||
|
||||
slist
|
||||
: #( SLIST (stat)* )
|
||||
;
|
||||
|
||||
stat: typeDefinition
|
||||
| variableDef
|
||||
| expression
|
||||
| #(LABELED_STAT IDENT stat)
|
||||
| #("if" expression stat (stat)? )
|
||||
| #( "for"
|
||||
#(FOR_INIT (variableDef | elist)?)
|
||||
#(FOR_CONDITION (expression)?)
|
||||
#(FOR_ITERATOR (elist)?)
|
||||
stat
|
||||
)
|
||||
| #("while" expression stat)
|
||||
| #("do" stat expression)
|
||||
| #("break" (IDENT)? )
|
||||
| #("continue" (IDENT)? )
|
||||
| #("return" (expression)? )
|
||||
| #("switch" expression (caseGroup)*)
|
||||
| #("throw" expression)
|
||||
| #("synchronized" expression stat)
|
||||
| tryBlock
|
||||
| slist // nested SLIST
|
||||
// uncomment to make assert JDK 1.4 stuff work
|
||||
| #("assert" expression (expression)?)
|
||||
| EMPTY_STAT
|
||||
;
|
||||
|
||||
caseGroup
|
||||
: #(CASE_GROUP (#("case" expression) | "default")+ slist)
|
||||
;
|
||||
|
||||
tryBlock
|
||||
: #( "try" slist (handler)* (#("finally" slist))? )
|
||||
;
|
||||
|
||||
handler
|
||||
: #( "catch" parameterDef slist )
|
||||
;
|
||||
|
||||
elist
|
||||
: #( ELIST (expression)* )
|
||||
;
|
||||
|
||||
expression
|
||||
: #(EXPR expr)
|
||||
;
|
||||
|
||||
expr: #(QUESTION expr expr expr) // trinary operator
|
||||
| #(ASSIGN expr expr) // binary operators...
|
||||
| #(PLUS_ASSIGN expr expr)
|
||||
| #(MINUS_ASSIGN expr expr)
|
||||
| #(STAR_ASSIGN expr expr)
|
||||
| #(DIV_ASSIGN expr expr)
|
||||
| #(MOD_ASSIGN expr expr)
|
||||
| #(SR_ASSIGN expr expr)
|
||||
| #(BSR_ASSIGN expr expr)
|
||||
| #(SL_ASSIGN expr expr)
|
||||
| #(BAND_ASSIGN expr expr)
|
||||
| #(BXOR_ASSIGN expr expr)
|
||||
| #(BOR_ASSIGN expr expr)
|
||||
| #(LOR expr expr)
|
||||
| #(LAND expr expr)
|
||||
| #(BOR expr expr)
|
||||
| #(BXOR expr expr)
|
||||
| #(BAND expr expr)
|
||||
| #(NOT_EQUAL expr expr)
|
||||
| #(EQUAL expr expr)
|
||||
| #(LT expr expr)
|
||||
| #(GT expr expr)
|
||||
| #(LE expr expr)
|
||||
| #(GE expr expr)
|
||||
| #(SL expr expr)
|
||||
| #(SR expr expr)
|
||||
| #(BSR expr expr)
|
||||
| #(PLUS expr expr)
|
||||
| #(MINUS expr expr)
|
||||
| #(DIV expr expr)
|
||||
| #(MOD expr expr)
|
||||
| #(STAR expr expr)
|
||||
| #(INC expr)
|
||||
| #(DEC expr)
|
||||
| #(POST_INC expr)
|
||||
| #(POST_DEC expr)
|
||||
| #(BNOT expr)
|
||||
| #(LNOT expr)
|
||||
| #("instanceof" expr expr)
|
||||
| #(UNARY_MINUS expr)
|
||||
| #(UNARY_PLUS expr)
|
||||
| primaryExpression
|
||||
;
|
||||
|
||||
primaryExpression
|
||||
: IDENT
|
||||
| #( DOT
|
||||
( expr
|
||||
( IDENT
|
||||
| arrayIndex
|
||||
| "this"
|
||||
| "class"
|
||||
| #( "new" IDENT elist )
|
||||
| "super"
|
||||
)
|
||||
| #(ARRAY_DECLARATOR typeSpecArray)
|
||||
| builtInType ("class")?
|
||||
)
|
||||
)
|
||||
| arrayIndex
|
||||
| #(METHOD_CALL primaryExpression elist)
|
||||
| ctorCall
|
||||
| #(TYPECAST typeSpec expr)
|
||||
| newExpression
|
||||
| constant
|
||||
| "super"
|
||||
| "true"
|
||||
| "false"
|
||||
| "this"
|
||||
| "null"
|
||||
| typeSpec // type name used with instanceof
|
||||
;
|
||||
|
||||
ctorCall
|
||||
: #( CTOR_CALL elist )
|
||||
| #( SUPER_CTOR_CALL
|
||||
( elist
|
||||
| primaryExpression elist
|
||||
)
|
||||
)
|
||||
;
|
||||
|
||||
arrayIndex
|
||||
: #(INDEX_OP expr expression)
|
||||
;
|
||||
|
||||
constant
|
||||
: NUM_INT
|
||||
| CHAR_LITERAL
|
||||
| STRING_LITERAL
|
||||
| NUM_FLOAT
|
||||
| NUM_DOUBLE
|
||||
| NUM_LONG
|
||||
;
|
||||
|
||||
newExpression
|
||||
: #( "new" type
|
||||
( newArrayDeclarator (arrayInitializer)?
|
||||
| elist (objBlock)?
|
||||
)
|
||||
)
|
||||
|
||||
;
|
||||
|
||||
newArrayDeclarator
|
||||
: #( ARRAY_DECLARATOR (newArrayDeclarator)? (expression)? )
|
||||
;
|
@ -3,7 +3,7 @@
|
||||
/*
|
||||
Part of the Processing project - http://processing.org
|
||||
|
||||
Copyright (c) 2004-09 Ben Fry and Casey Reas
|
||||
Copyright (c) 2004-10 Ben Fry and Casey Reas
|
||||
Copyright (c) 2001-04 Massachusetts Institute of Technology
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
@ -42,7 +42,10 @@ import processing.core.*;
|
||||
*/
|
||||
public class Base {
|
||||
public static final int REVISION = 18;
|
||||
/** This might be replaced by main() if there's a lib/version.txt file. */
|
||||
static String VERSION_NAME = "0018";
|
||||
/** Set true if this a proper release rather than a numbered revision. */
|
||||
static public boolean RELEASE = false;
|
||||
|
||||
static HashMap<Integer, String> platformNames = new HashMap<Integer, String>();
|
||||
static {
|
||||
@ -101,31 +104,16 @@ public class Base {
|
||||
// ArrayList editors = Collections.synchronizedList(new ArrayList<Editor>());
|
||||
Editor activeEditor;
|
||||
|
||||
// int nextEditorX;
|
||||
// int nextEditorY;
|
||||
|
||||
// import com.sun.jna.Library;
|
||||
// import com.sun.jna.Native;
|
||||
|
||||
// public interface CLibrary extends Library {
|
||||
// CLibrary INSTANCE = (CLibrary)Native.loadLibrary("c", CLibrary.class);
|
||||
// int setenv(String name, String value, int overwrite);
|
||||
// String getenv(String name);
|
||||
// int unsetenv(String name);
|
||||
// int putenv(String string);
|
||||
// }
|
||||
|
||||
|
||||
static public void main(String args[]) {
|
||||
// /Users/fry/coconut/sketchbook/libraries/gsvideo/library
|
||||
// CLibrary clib = CLibrary.INSTANCE;
|
||||
// clib.setenv("DYLD_LIBRARY_PATH", "/Users/fry/coconut/sketchbook/libraries/gsvideo/library", 1);
|
||||
// System.out.println("env is now " + clib.getenv("DYLD_LIBRARY_PATH"));
|
||||
|
||||
try {
|
||||
File versionFile = getContentFile("lib/version.txt");
|
||||
if (versionFile.exists()) {
|
||||
VERSION_NAME = PApplet.loadStrings(versionFile)[0];
|
||||
String version = PApplet.loadStrings(versionFile)[0];
|
||||
if (!version.equals(VERSION_NAME)) {
|
||||
VERSION_NAME = version;
|
||||
RELEASE = true;
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
@ -187,10 +175,12 @@ public class Base {
|
||||
try {
|
||||
platform.setLookAndFeel();
|
||||
} catch (Exception e) {
|
||||
System.err.println("Non-fatal error while setting the Look & Feel.");
|
||||
System.err.println("The error message follows, however Arduino should run fine.");
|
||||
System.err.println(e.getMessage());
|
||||
//e.printStackTrace();
|
||||
String mess = e.getMessage();
|
||||
if (mess.indexOf("ch.randelshofer.quaqua.QuaquaLookAndFeel") == -1) {
|
||||
System.err.println("Non-fatal error while setting the Look & Feel.");
|
||||
System.err.println("The error message follows, however Arduino should run fine.");
|
||||
System.err.println(mess);
|
||||
}
|
||||
}
|
||||
|
||||
// Create a location for untitled sketches
|
||||
@ -213,7 +203,7 @@ public class Base {
|
||||
|
||||
static protected void initPlatform() {
|
||||
try {
|
||||
Class platformClass = Class.forName("processing.app.Platform");
|
||||
Class<?> platformClass = Class.forName("processing.app.Platform");
|
||||
if (Base.isMacOS()) {
|
||||
platformClass = Class.forName("processing.app.macosx.Platform");
|
||||
} else if (Base.isWindows()) {
|
||||
@ -270,7 +260,7 @@ public class Base {
|
||||
}
|
||||
}
|
||||
|
||||
// If not path is set, get the default sketchbook folder for this platform
|
||||
// If no path is set, get the default sketchbook folder for this platform
|
||||
if (sketchbookPath == null) {
|
||||
File defaultFolder = getDefaultSketchbookFolder();
|
||||
Preferences.set("sketchbook.path", defaultFolder.getAbsolutePath());
|
||||
@ -456,8 +446,8 @@ public class Base {
|
||||
|
||||
protected int[] nextEditorLocation() {
|
||||
Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
|
||||
int defaultWidth = Preferences.getInteger("default.window.width");
|
||||
int defaultHeight = Preferences.getInteger("default.window.height");
|
||||
int defaultWidth = Preferences.getInteger("editor.window.width.default");
|
||||
int defaultHeight = Preferences.getInteger("editor.window.height.default");
|
||||
|
||||
if (activeEditor == null) {
|
||||
// If no current active editor, use default placement
|
||||
@ -584,7 +574,7 @@ public class Base {
|
||||
* Replace the sketch in the current window with a new untitled document.
|
||||
*/
|
||||
public void handleNewReplace() {
|
||||
if (!activeEditor.checkModified(true)) {
|
||||
if (!activeEditor.checkModified()) {
|
||||
return; // sketch was modified, and user canceled
|
||||
}
|
||||
// Close the running window, avoid window boogers with multiple sketches
|
||||
@ -616,7 +606,7 @@ public class Base {
|
||||
* @param path Location of the primary pde file for the sketch.
|
||||
*/
|
||||
public void handleOpenReplace(String path) {
|
||||
if (!activeEditor.checkModified(true)) {
|
||||
if (!activeEditor.checkModified()) {
|
||||
return; // sketch was modified, and user canceled
|
||||
}
|
||||
// Close the running window, avoid window boogers with multiple sketches
|
||||
@ -758,8 +748,8 @@ public class Base {
|
||||
*/
|
||||
public boolean handleClose(Editor editor) {
|
||||
// Check if modified
|
||||
boolean immediate = editors.size() == 1;
|
||||
if (!editor.checkModified(immediate)) {
|
||||
// boolean immediate = editors.size() == 1;
|
||||
if (!editor.checkModified()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -862,7 +852,7 @@ public class Base {
|
||||
protected boolean handleQuitEach() {
|
||||
int index = 0;
|
||||
for (Editor editor : editors) {
|
||||
if (editor.checkModified(true)) {
|
||||
if (editor.checkModified()) {
|
||||
// Update to the new/final sketch path for this fella
|
||||
storeSketchPath(editor, index);
|
||||
index++;
|
||||
@ -914,7 +904,8 @@ public class Base {
|
||||
|
||||
// Add a list of all sketches and subfolders
|
||||
try {
|
||||
boolean sketches = addSketches(menu, getSketchbookFolder(), true);
|
||||
//boolean sketches = addSketches(menu, getSketchbookFolder(), true);
|
||||
boolean sketches = addSketches(menu, getSketchbookFolder());
|
||||
if (sketches) menu.addSeparator();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
@ -923,11 +914,11 @@ public class Base {
|
||||
//System.out.println("rebuilding examples menu");
|
||||
// Add each of the subfolders of examples directly to the menu
|
||||
try {
|
||||
boolean found = addSketches(menu, examplesFolder, true);
|
||||
boolean found = addSketches(menu, examplesFolder);
|
||||
if (found) menu.addSeparator();
|
||||
found = addSketches(menu, getSketchbookLibrariesFolder(), true);
|
||||
found = addSketches(menu, getSketchbookLibrariesFolder());
|
||||
if (found) menu.addSeparator();
|
||||
addSketches(menu, librariesFolder, true);
|
||||
addSketches(menu, librariesFolder);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -939,7 +930,8 @@ public class Base {
|
||||
//new Exception().printStackTrace();
|
||||
try {
|
||||
menu.removeAll();
|
||||
addSketches(menu, getSketchbookFolder(), false);
|
||||
//addSketches(menu, getSketchbookFolder(), false);
|
||||
addSketches(menu, getSketchbookFolder());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -983,11 +975,11 @@ public class Base {
|
||||
//System.out.println("rebuilding examples menu");
|
||||
try {
|
||||
menu.removeAll();
|
||||
boolean found = addSketches(menu, examplesFolder, false);
|
||||
boolean found = addSketches(menu, examplesFolder);
|
||||
if (found) menu.addSeparator();
|
||||
found = addSketches(menu, getSketchbookLibrariesFolder(), false);
|
||||
found = addSketches(menu, getSketchbookLibrariesFolder());
|
||||
if (found) menu.addSeparator();
|
||||
addSketches(menu, librariesFolder, false);
|
||||
addSketches(menu, librariesFolder);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -1050,8 +1042,7 @@ public class Base {
|
||||
* should replace the sketch in the current window, or false when the
|
||||
* sketch should open in a new window.
|
||||
*/
|
||||
protected boolean addSketches(JMenu menu, File folder,
|
||||
final boolean openReplaces) throws IOException {
|
||||
protected boolean addSketches(JMenu menu, File folder) throws IOException {
|
||||
// skip .DS_Store files, etc (this shouldn't actually be necessary)
|
||||
if (!folder.isDirectory()) return false;
|
||||
|
||||
@ -1068,7 +1059,8 @@ public class Base {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
String path = e.getActionCommand();
|
||||
if (new File(path).exists()) {
|
||||
if (openReplaces) {
|
||||
// if (openReplaces) {
|
||||
if ((e.getModifiers() & ActionEvent.SHIFT_MASK) == 0) {
|
||||
handleOpenReplace(path);
|
||||
} else {
|
||||
handleOpen(path);
|
||||
@ -1121,14 +1113,15 @@ public class Base {
|
||||
} else {
|
||||
// don't create an extra menu level for a folder named "examples"
|
||||
if (subfolder.getName().equals("examples")) {
|
||||
boolean found = addSketches(menu, subfolder, openReplaces); //, false);
|
||||
boolean found = addSketches(menu, subfolder);
|
||||
if (found) ifound = true;
|
||||
} else {
|
||||
// not a sketch folder, but maybe a subfolder containing sketches
|
||||
JMenu submenu = new JMenu(list[i]);
|
||||
// needs to be separate var
|
||||
// otherwise would set ifound to false
|
||||
boolean found = addSketches(submenu, subfolder, openReplaces); //, false);
|
||||
//boolean found = addSketches(submenu, subfolder, openReplaces); //, false);
|
||||
boolean found = addSketches(submenu, subfolder); //, false);
|
||||
if (found) {
|
||||
menu.add(submenu);
|
||||
ifound = true;
|
||||
@ -1319,6 +1312,11 @@ public class Base {
|
||||
// }
|
||||
|
||||
|
||||
static public Platform getPlatform() {
|
||||
return platform;
|
||||
}
|
||||
|
||||
|
||||
static public String getPlatformName() {
|
||||
String osname = System.getProperty("os.name");
|
||||
|
||||
@ -1714,12 +1712,11 @@ public class Base {
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Registers key events for a Ctrl-W and ESC with an ActionListener
|
||||
* that will take care of disposing the window.
|
||||
*/
|
||||
static public void registerWindowCloseKeys(JRootPane root, //Window window,
|
||||
static public void registerWindowCloseKeys(JRootPane root,
|
||||
ActionListener disposer) {
|
||||
KeyStroke stroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);
|
||||
root.registerKeyboardAction(disposer, stroke,
|
||||
@ -1836,6 +1833,129 @@ public class Base {
|
||||
// ...................................................................
|
||||
|
||||
|
||||
|
||||
// incomplete
|
||||
static public int showYesNoCancelQuestion(Editor editor, String title,
|
||||
String primary, String secondary) {
|
||||
if (!Base.isMacOS()) {
|
||||
int result =
|
||||
JOptionPane.showConfirmDialog(null, primary + "\n" + secondary, title,
|
||||
JOptionPane.YES_NO_CANCEL_OPTION,
|
||||
JOptionPane.QUESTION_MESSAGE);
|
||||
return result;
|
||||
// if (result == JOptionPane.YES_OPTION) {
|
||||
//
|
||||
// } else if (result == JOptionPane.NO_OPTION) {
|
||||
// return true; // ok to continue
|
||||
//
|
||||
// } else if (result == JOptionPane.CANCEL_OPTION) {
|
||||
// return false;
|
||||
//
|
||||
// } else {
|
||||
// throw new IllegalStateException();
|
||||
// }
|
||||
|
||||
} else {
|
||||
// Pane formatting adapted from the Quaqua guide
|
||||
// http://www.randelshofer.ch/quaqua/guide/joptionpane.html
|
||||
JOptionPane pane =
|
||||
new JOptionPane("<html> " +
|
||||
"<head> <style type=\"text/css\">"+
|
||||
"b { font: 13pt \"Lucida Grande\" }"+
|
||||
"p { font: 11pt \"Lucida Grande\"; margin-top: 8px }"+
|
||||
"</style> </head>" +
|
||||
"<b>Do you want to save changes to this sketch<BR>" +
|
||||
" before closing?</b>" +
|
||||
"<p>If you don't save, your changes will be lost.",
|
||||
JOptionPane.QUESTION_MESSAGE);
|
||||
|
||||
String[] options = new String[] {
|
||||
"Save", "Cancel", "Don't Save"
|
||||
};
|
||||
pane.setOptions(options);
|
||||
|
||||
// highlight the safest option ala apple hig
|
||||
pane.setInitialValue(options[0]);
|
||||
|
||||
// on macosx, setting the destructive property places this option
|
||||
// away from the others at the lefthand side
|
||||
pane.putClientProperty("Quaqua.OptionPane.destructiveOption",
|
||||
new Integer(2));
|
||||
|
||||
JDialog dialog = pane.createDialog(editor, null);
|
||||
dialog.setVisible(true);
|
||||
|
||||
Object result = pane.getValue();
|
||||
if (result == options[0]) {
|
||||
return JOptionPane.YES_OPTION;
|
||||
} else if (result == options[1]) {
|
||||
return JOptionPane.CANCEL_OPTION;
|
||||
} else if (result == options[2]) {
|
||||
return JOptionPane.NO_OPTION;
|
||||
} else {
|
||||
return JOptionPane.CLOSED_OPTION;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//if (result == JOptionPane.YES_OPTION) {
|
||||
//
|
||||
// } else if (result == JOptionPane.NO_OPTION) {
|
||||
// return true; // ok to continue
|
||||
//
|
||||
// } else if (result == JOptionPane.CANCEL_OPTION) {
|
||||
// return false;
|
||||
//
|
||||
// } else {
|
||||
// throw new IllegalStateException();
|
||||
// }
|
||||
|
||||
static public int showYesNoQuestion(Frame editor, String title,
|
||||
String primary, String secondary) {
|
||||
if (!Base.isMacOS()) {
|
||||
return JOptionPane.showConfirmDialog(editor,
|
||||
"<html><body>" +
|
||||
"<b>" + primary + "</b>" +
|
||||
"<br>" + secondary, title,
|
||||
JOptionPane.YES_NO_OPTION,
|
||||
JOptionPane.QUESTION_MESSAGE);
|
||||
} else {
|
||||
// Pane formatting adapted from the Quaqua guide
|
||||
// http://www.randelshofer.ch/quaqua/guide/joptionpane.html
|
||||
JOptionPane pane =
|
||||
new JOptionPane("<html> " +
|
||||
"<head> <style type=\"text/css\">"+
|
||||
"b { font: 13pt \"Lucida Grande\" }"+
|
||||
"p { font: 11pt \"Lucida Grande\"; margin-top: 8px }"+
|
||||
"</style> </head>" +
|
||||
"<b>" + primary + "</b>" +
|
||||
"<p>" + secondary + "</p>",
|
||||
JOptionPane.QUESTION_MESSAGE);
|
||||
|
||||
String[] options = new String[] {
|
||||
"Yes", "No"
|
||||
};
|
||||
pane.setOptions(options);
|
||||
|
||||
// highlight the safest option ala apple hig
|
||||
pane.setInitialValue(options[0]);
|
||||
|
||||
JDialog dialog = pane.createDialog(editor, null);
|
||||
dialog.setVisible(true);
|
||||
|
||||
Object result = pane.getValue();
|
||||
if (result == options[0]) {
|
||||
return JOptionPane.YES_OPTION;
|
||||
} else if (result == options[1]) {
|
||||
return JOptionPane.NO_OPTION;
|
||||
} else {
|
||||
return JOptionPane.CLOSED_OPTION;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retrieve a path to something in the Processing folder. Eventually this
|
||||
* may refer to the Contents subfolder of Processing.app, if we bundle things
|
||||
@ -1959,6 +2079,36 @@ public class Base {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Read from a file with a bunch of attribute/value pairs
|
||||
* that are separated by = and ignore comments with #.
|
||||
*/
|
||||
static public HashMap<String,String> readSettings(File inputFile) {
|
||||
HashMap<String,String> outgoing = new HashMap<String,String>();
|
||||
if (!inputFile.exists()) return outgoing; // return empty hash
|
||||
|
||||
String lines[] = PApplet.loadStrings(inputFile);
|
||||
for (int i = 0; i < lines.length; i++) {
|
||||
int hash = lines[i].indexOf('#');
|
||||
String line = (hash == -1) ?
|
||||
lines[i].trim() : lines[i].substring(0, hash).trim();
|
||||
if (line.length() == 0) continue;
|
||||
|
||||
int equals = line.indexOf('=');
|
||||
if (equals == -1) {
|
||||
System.err.println("ignoring illegal line in " + inputFile);
|
||||
System.err.println(" " + line);
|
||||
continue;
|
||||
}
|
||||
String attr = line.substring(0, equals).trim();
|
||||
String valu = line.substring(equals + 1).trim();
|
||||
outgoing.put(attr, valu);
|
||||
}
|
||||
return outgoing;
|
||||
}
|
||||
|
||||
|
||||
static public void copyFile(File sourceFile,
|
||||
File targetFile) throws IOException {
|
||||
InputStream from =
|
||||
@ -2116,7 +2266,7 @@ public class Base {
|
||||
|
||||
static public String[] listFiles(File folder, boolean relative) {
|
||||
String path = folder.getAbsolutePath();
|
||||
Vector vector = new Vector();
|
||||
Vector<String> vector = new Vector<String>();
|
||||
listFiles(relative ? (path + File.separator) : "", path, vector);
|
||||
String outgoing[] = new String[vector.size()];
|
||||
vector.copyInto(outgoing);
|
||||
@ -2125,7 +2275,7 @@ public class Base {
|
||||
|
||||
|
||||
static protected void listFiles(String basePath,
|
||||
String path, Vector vector) {
|
||||
String path, Vector<String> vector) {
|
||||
File folder = new File(path);
|
||||
String list[] = folder.list();
|
||||
if (list == null) return;
|
||||
|
@ -43,7 +43,6 @@ import javax.swing.undo.*;
|
||||
|
||||
import gnu.io.*;
|
||||
|
||||
|
||||
/**
|
||||
* Main editor panel for the Processing Development Environment.
|
||||
*/
|
||||
@ -114,7 +113,6 @@ public class Editor extends JFrame implements RunnerListener {
|
||||
|
||||
EditorLineStatus lineStatus;
|
||||
|
||||
boolean newEditor = true;
|
||||
JEditorPane editorPane;
|
||||
|
||||
JEditTextArea textarea;
|
||||
@ -122,14 +120,14 @@ public class Editor extends JFrame implements RunnerListener {
|
||||
|
||||
// runtime information and window placement
|
||||
Point sketchWindowLocation;
|
||||
Runner runtime;
|
||||
//Runner runtime;
|
||||
|
||||
JMenuItem exportAppItem;
|
||||
JMenuItem saveMenuItem;
|
||||
JMenuItem saveAsMenuItem;
|
||||
|
||||
boolean running;
|
||||
boolean presenting;
|
||||
//boolean presenting;
|
||||
boolean uploading;
|
||||
|
||||
// undo fellers
|
||||
@ -142,6 +140,12 @@ public class Editor extends JFrame implements RunnerListener {
|
||||
|
||||
FindReplace find;
|
||||
|
||||
Runnable runHandler;
|
||||
Runnable presentHandler;
|
||||
Runnable stopHandler;
|
||||
Runnable exportHandler;
|
||||
Runnable exportAppHandler;
|
||||
|
||||
|
||||
public Editor(Base ibase, String path, int[] location) {
|
||||
super("Arduino");
|
||||
@ -149,6 +153,9 @@ public class Editor extends JFrame implements RunnerListener {
|
||||
|
||||
//Base.setIcon(this);
|
||||
|
||||
// Install default actions for Run, Present, etc.
|
||||
resetHandlers();
|
||||
|
||||
// add listener to handle window close box hit event
|
||||
addWindowListener(new WindowAdapter() {
|
||||
public void windowClosing(WindowEvent e) {
|
||||
@ -232,22 +239,7 @@ public class Editor extends JFrame implements RunnerListener {
|
||||
lineStatus = new EditorLineStatus(textarea);
|
||||
consolePanel.add(lineStatus, BorderLayout.SOUTH);
|
||||
|
||||
// if (newEditor) {
|
||||
// try {
|
||||
// setupEditorPane();
|
||||
// upper.add(editorPane);
|
||||
// } catch (Exception e1) {
|
||||
// PrintWriter w = PApplet.createWriter(new File("/Users/fry/Desktop/blah.txt"));
|
||||
// w.println(e1.getMessage());
|
||||
// e1.printStackTrace(w);
|
||||
// w.flush();
|
||||
// w.close();
|
||||
//// e1.printStackTrace());
|
||||
//// e1.printStackTrace(System.out);
|
||||
// }
|
||||
// } else {
|
||||
upper.add(textarea);
|
||||
// }
|
||||
splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT,
|
||||
upper, consolePanel);
|
||||
|
||||
@ -276,64 +268,10 @@ public class Editor extends JFrame implements RunnerListener {
|
||||
listener = new EditorListener(this, textarea);
|
||||
pain.add(box);
|
||||
|
||||
pain.setTransferHandler(new TransferHandler() {
|
||||
// get shift down/up events so we can show the alt version of toolbar buttons
|
||||
textarea.addKeyListener(toolbar);
|
||||
|
||||
public boolean canImport(JComponent dest, DataFlavor[] flavors) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean importData(JComponent src, Transferable transferable) {
|
||||
int successful = 0;
|
||||
|
||||
try {
|
||||
DataFlavor uriListFlavor =
|
||||
new DataFlavor("text/uri-list;class=java.lang.String");
|
||||
|
||||
if (transferable.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) {
|
||||
java.util.List list = (java.util.List)
|
||||
transferable.getTransferData(DataFlavor.javaFileListFlavor);
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
File file = (File) list.get(i);
|
||||
if (sketch.addFile(file)) {
|
||||
successful++;
|
||||
}
|
||||
}
|
||||
} else if (transferable.isDataFlavorSupported(uriListFlavor)) {
|
||||
//System.out.println("uri list");
|
||||
String data = (String)transferable.getTransferData(uriListFlavor);
|
||||
String[] pieces = PApplet.splitTokens(data, "\r\n");
|
||||
//PApplet.println(pieces);
|
||||
for (int i = 0; i < pieces.length; i++) {
|
||||
if (pieces[i].startsWith("#")) continue;
|
||||
|
||||
String path = null;
|
||||
if (pieces[i].startsWith("file:///")) {
|
||||
path = pieces[i].substring(7);
|
||||
} else if (pieces[i].startsWith("file:/")) {
|
||||
path = pieces[i].substring(5);
|
||||
}
|
||||
if (sketch.addFile(new File(path))) {
|
||||
successful++;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (successful == 0) {
|
||||
statusError("No files were added to the sketch.");
|
||||
|
||||
} else if (successful == 1) {
|
||||
statusNotice("One file added to the sketch.");
|
||||
|
||||
} else {
|
||||
statusNotice(successful + " files added to the sketch.");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
pain.setTransferHandler(new FileDropHandler());
|
||||
|
||||
// System.out.println("t1");
|
||||
|
||||
@ -345,6 +283,20 @@ public class Editor extends JFrame implements RunnerListener {
|
||||
// Set the window bounds and the divider location before setting it visible
|
||||
setPlacement(location);
|
||||
|
||||
|
||||
// If the window is resized too small this will resize it again to the
|
||||
// minimums. Adapted by Chris Lonnen from comments here:
|
||||
// http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4320050
|
||||
// as a fix for http://dev.processing.org/bugs/show_bug.cgi?id=25
|
||||
final int minW = Preferences.getInteger("editor.window.width.min");
|
||||
final int minH = Preferences.getInteger("editor.window.height.min");
|
||||
addComponentListener(new java.awt.event.ComponentAdapter() {
|
||||
public void componentResized(ComponentEvent event) {
|
||||
setSize((getWidth() < minW) ? minW : getWidth(),
|
||||
(getHeight() < minH) ? minH : getHeight());
|
||||
}
|
||||
});
|
||||
|
||||
// System.out.println("t3");
|
||||
|
||||
// Bring back the general options for the editor
|
||||
@ -363,46 +315,71 @@ public class Editor extends JFrame implements RunnerListener {
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
// http://wiki.netbeans.org/DevFaqEditorCodeCompletionAnyJEditorPane
|
||||
void setupEditorPane() throws IOException {
|
||||
editorPane = new JEditorPane();
|
||||
/**
|
||||
* Handles files dragged & dropped from the desktop and into the editor
|
||||
* window. Dragging files into the editor window is the same as using
|
||||
* "Sketch → Add File" for each file.
|
||||
*/
|
||||
class FileDropHandler extends TransferHandler {
|
||||
public boolean canImport(JComponent dest, DataFlavor[] flavors) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// This will find the Java editor kit and associate it with
|
||||
// our editor pane. But that does not give us code completion
|
||||
// just yet because we have no Java context (i.e. no class path, etc.).
|
||||
// However, this does give us syntax coloring.
|
||||
EditorKit kit = CloneableEditorSupport.getEditorKit("text/x-java");
|
||||
editorPane.setEditorKit(kit);
|
||||
|
||||
// You can specify any ".java" file.
|
||||
// If the file does not exist, it will be created.
|
||||
// The contents of the file does not matter.
|
||||
// The extension must be ".java", however.
|
||||
// String newSourcePath = "/Users/fry/Desktop/tmp.java";
|
||||
@SuppressWarnings("unchecked")
|
||||
public boolean importData(JComponent src, Transferable transferable) {
|
||||
int successful = 0;
|
||||
|
||||
// File tmpFile = new File(newSourcePath);
|
||||
// System.out.println(tmpFile.getParent() + " " + tmpFile.getName());
|
||||
// FileObject fob = FileUtil.createData(tmpFile);
|
||||
File tmpFile = File.createTempFile("temp", ".java");
|
||||
FileObject fob = FileUtil.toFileObject(FileUtil.normalizeFile(tmpFile));
|
||||
try {
|
||||
DataFlavor uriListFlavor =
|
||||
new DataFlavor("text/uri-list;class=java.lang.String");
|
||||
|
||||
DataObject dob = DataObject.find(fob);
|
||||
editorPane.getDocument().putProperty(Document.StreamDescriptionProperty, dob);
|
||||
if (transferable.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) {
|
||||
java.util.List list = (java.util.List)
|
||||
transferable.getTransferData(DataFlavor.javaFileListFlavor);
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
File file = (File) list.get(i);
|
||||
if (sketch.addFile(file)) {
|
||||
successful++;
|
||||
}
|
||||
}
|
||||
} else if (transferable.isDataFlavorSupported(uriListFlavor)) {
|
||||
// Some platforms (Mac OS X and Linux, when this began) preferred
|
||||
// this method of moving files.
|
||||
String data = (String)transferable.getTransferData(uriListFlavor);
|
||||
String[] pieces = PApplet.splitTokens(data, "\r\n");
|
||||
for (int i = 0; i < pieces.length; i++) {
|
||||
if (pieces[i].startsWith("#")) continue;
|
||||
|
||||
// This sets up a default class path for us so that
|
||||
// we can find all the JDK classes via code completion.
|
||||
DialogBinding.bindComponentToFile(fob, 0, 0, editorPane);
|
||||
String path = null;
|
||||
if (pieces[i].startsWith("file:///")) {
|
||||
path = pieces[i].substring(7);
|
||||
} else if (pieces[i].startsWith("file:/")) {
|
||||
path = pieces[i].substring(5);
|
||||
}
|
||||
if (sketch.addFile(new File(path))) {
|
||||
successful++;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
|
||||
// Last but not least, we need to fill the editor pane with
|
||||
// some initial dummy code - as it seems somehow required to
|
||||
// kick-start code completion.
|
||||
// A simple dummy package declaration will do.
|
||||
editorPane.setText("package dummy;");
|
||||
if (successful == 0) {
|
||||
statusError("No files were added to the sketch.");
|
||||
|
||||
} else if (successful == 1) {
|
||||
statusNotice("One file added to the sketch.");
|
||||
|
||||
} else {
|
||||
statusNotice(successful + " files added to the sketch.");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
protected void setPlacement(int[] location) {
|
||||
setBounds(location[0], location[1], location[2], location[3]);
|
||||
if (location[4] != 0) {
|
||||
@ -434,10 +411,10 @@ public class Editor extends JFrame implements RunnerListener {
|
||||
* This appears to only be required on OS X 10.2, and is not
|
||||
* even being called on later versions of OS X or Windows.
|
||||
*/
|
||||
public Dimension getMinimumSize() {
|
||||
//System.out.println("getting minimum size");
|
||||
return new Dimension(500, 550);
|
||||
}
|
||||
// public Dimension getMinimumSize() {
|
||||
// //System.out.println("getting minimum size");
|
||||
// return new Dimension(500, 550);
|
||||
// }
|
||||
|
||||
|
||||
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
||||
@ -737,7 +714,7 @@ public class Editor extends JFrame implements RunnerListener {
|
||||
|
||||
|
||||
protected void addTools(JMenu menu, File sourceFolder) {
|
||||
HashMap toolItems = new HashMap();
|
||||
HashMap<String, JMenuItem> toolItems = new HashMap<String, JMenuItem>();
|
||||
|
||||
File[] folders = sourceFolder.listFiles(new FileFilter() {
|
||||
public boolean accept(File folder) {
|
||||
@ -807,7 +784,7 @@ public class Editor extends JFrame implements RunnerListener {
|
||||
// If no class name found, just move on.
|
||||
if (className == null) continue;
|
||||
|
||||
Class toolClass = Class.forName(className, true, loader);
|
||||
Class<?> toolClass = Class.forName(className, true, loader);
|
||||
final Tool tool = (Tool) toolClass.newInstance();
|
||||
|
||||
tool.init(Editor.this);
|
||||
@ -817,6 +794,7 @@ public class Editor extends JFrame implements RunnerListener {
|
||||
item.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
SwingUtilities.invokeLater(tool);
|
||||
//new Thread(tool).start();
|
||||
}
|
||||
});
|
||||
//menu.add(item);
|
||||
@ -826,7 +804,7 @@ public class Editor extends JFrame implements RunnerListener {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
ArrayList<String> toolList = new ArrayList(toolItems.keySet());
|
||||
ArrayList<String> toolList = new ArrayList<String>(toolItems.keySet());
|
||||
if (toolList.size() == 0) return;
|
||||
|
||||
menu.addSeparator();
|
||||
@ -843,7 +821,7 @@ public class Editor extends JFrame implements RunnerListener {
|
||||
|
||||
try {
|
||||
ZipFile zipFile = new ZipFile(file);
|
||||
Enumeration entries = zipFile.entries();
|
||||
Enumeration<?> entries = zipFile.entries();
|
||||
while (entries.hasMoreElements()) {
|
||||
ZipEntry entry = (ZipEntry) entries.nextElement();
|
||||
|
||||
@ -869,7 +847,7 @@ public class Editor extends JFrame implements RunnerListener {
|
||||
|
||||
protected JMenuItem createToolMenuItem(String className) {
|
||||
try {
|
||||
Class toolClass = Class.forName(className);
|
||||
Class<?> toolClass = Class.forName(className);
|
||||
final Tool tool = (Tool) toolClass.newInstance();
|
||||
|
||||
JMenuItem item = new JMenuItem(tool.getMenuTitle());
|
||||
@ -903,12 +881,14 @@ public class Editor extends JFrame implements RunnerListener {
|
||||
menu.add(createToolMenuItem("processing.app.tools.Archiver"));
|
||||
menu.add(createToolMenuItem("processing.app.tools.FixEncoding"));
|
||||
|
||||
/*
|
||||
//menu.add(createToolMenuItem("processing.app.tools.android.Build"));
|
||||
item = createToolMenuItem("processing.app.tools.android.Build");
|
||||
item.setAccelerator(KeyStroke.getKeyStroke('D', modifiers));
|
||||
menu.add(item);
|
||||
*/
|
||||
// // These are temporary entries while Android mode is being worked out.
|
||||
// // The mode will not be in the tools menu, and won't involve a cmd-key
|
||||
// if (!Base.RELEASE) {
|
||||
// item = createToolMenuItem("processing.app.tools.android.AndroidTool");
|
||||
// item.setAccelerator(KeyStroke.getKeyStroke('D', modifiers));
|
||||
// menu.add(item);
|
||||
// menu.add(createToolMenuItem("processing.app.tools.android.Reset"));
|
||||
// }
|
||||
|
||||
return menu;
|
||||
}
|
||||
@ -1363,6 +1343,35 @@ public class Editor extends JFrame implements RunnerListener {
|
||||
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
||||
|
||||
|
||||
// these will be done in a more generic way soon, more like:
|
||||
// setHandler("action name", Runnable);
|
||||
// but for the time being, working out the kinks of how many things to
|
||||
// abstract from the editor in this fashion.
|
||||
|
||||
|
||||
public void setHandlers(Runnable runHandler, Runnable presentHandler,
|
||||
Runnable stopHandler,
|
||||
Runnable exportHandler, Runnable exportAppHandler) {
|
||||
this.runHandler = runHandler;
|
||||
this.presentHandler = presentHandler;
|
||||
this.stopHandler = stopHandler;
|
||||
this.exportHandler = exportHandler;
|
||||
this.exportAppHandler = exportAppHandler;
|
||||
}
|
||||
|
||||
|
||||
public void resetHandlers() {
|
||||
runHandler = new DefaultRunHandler();
|
||||
presentHandler = new DefaultPresentHandler();
|
||||
stopHandler = new DefaultStopHandler();
|
||||
exportHandler = new DefaultExportHandler();
|
||||
exportAppHandler = new DefaultExportAppHandler();
|
||||
}
|
||||
|
||||
|
||||
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
||||
|
||||
|
||||
/**
|
||||
* Gets the current sketch object.
|
||||
*/
|
||||
@ -1799,26 +1808,50 @@ public class Editor extends JFrame implements RunnerListener {
|
||||
console.clear();
|
||||
}
|
||||
|
||||
//presenting = present;
|
||||
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
try {
|
||||
sketch.compile(verbose);
|
||||
statusNotice("Done compiling.");
|
||||
} catch (RunnerException e) {
|
||||
//statusError("Error compiling...");
|
||||
statusError(e);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
toolbar.deactivate(EditorToolbar.RUN);
|
||||
}
|
||||
});
|
||||
// Cannot use invokeLater() here, otherwise it gets
|
||||
// placed on the event thread and causes a hang--bad idea all around.
|
||||
new Thread(verbose ? presentHandler : runHandler).start();
|
||||
}
|
||||
|
||||
// DAM: in Arduino, this is compile
|
||||
class DefaultRunHandler implements Runnable {
|
||||
public void run() {
|
||||
try {
|
||||
sketch.prepare();
|
||||
String appletClassName = sketch.build(false);
|
||||
statusNotice("Done compiling.");
|
||||
} catch (Exception e) {
|
||||
statusError(e);
|
||||
}
|
||||
|
||||
toolbar.deactivate(EditorToolbar.RUN);
|
||||
}
|
||||
}
|
||||
|
||||
// DAM: in Arduino, this is compile (with verbose output)
|
||||
class DefaultPresentHandler implements Runnable {
|
||||
public void run() {
|
||||
try {
|
||||
sketch.prepare();
|
||||
String appletClassName = sketch.build(true);
|
||||
statusNotice("Done compiling.");
|
||||
} catch (Exception e) {
|
||||
statusError(e);
|
||||
}
|
||||
|
||||
toolbar.deactivate(EditorToolbar.RUN);
|
||||
}
|
||||
}
|
||||
|
||||
class DefaultStopHandler implements Runnable {
|
||||
public void run() {
|
||||
try {
|
||||
// DAM: we should try to kill the compilation or upload process here.
|
||||
} catch (Exception e) {
|
||||
statusError(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the location of the sketch run window. Used by Runner to update the
|
||||
@ -1855,8 +1888,10 @@ public class Editor extends JFrame implements RunnerListener {
|
||||
|
||||
|
||||
/**
|
||||
* Called by Runner to notify that the sketch has stopped running.
|
||||
* Tools should not call this function, use handleStop() instead.
|
||||
* Deactivate the Run button. This is called by Runner to notify that the
|
||||
* sketch has stopped running, usually in response to an error (or maybe
|
||||
* the sketch completing and exiting?) Tools should not call this function.
|
||||
* To initiate a "stop" action, call handleStop() instead.
|
||||
*/
|
||||
public void internalRunnerClosed() {
|
||||
running = false;
|
||||
@ -1870,11 +1905,9 @@ public class Editor extends JFrame implements RunnerListener {
|
||||
public void internalCloseRunner() {
|
||||
running = false;
|
||||
|
||||
if (stopHandler != null)
|
||||
try {
|
||||
if (runtime != null) {
|
||||
runtime.close(); // kills the window
|
||||
runtime = null; // will this help?
|
||||
}
|
||||
stopHandler.run();
|
||||
} catch (Exception e) { }
|
||||
|
||||
sketch.cleanup();
|
||||
@ -1883,13 +1916,14 @@ public class Editor extends JFrame implements RunnerListener {
|
||||
|
||||
/**
|
||||
* Check if the sketch is modified and ask user to save changes.
|
||||
* Immediately should be set true when quitting, or when the save should
|
||||
* not happen asynchronously. Come to think of it, that's always now?
|
||||
* @return false if canceling the close/quit operation
|
||||
*/
|
||||
protected boolean checkModified(boolean immediately) {
|
||||
protected boolean checkModified() {
|
||||
if (!sketch.isModified()) return true;
|
||||
|
||||
// As of Processing 1.0.10, this always happens immediately.
|
||||
// http://dev.processing.org/bugs/show_bug.cgi?id=1456
|
||||
|
||||
String prompt = "Save changes to " + sketch.getName() + "? ";
|
||||
|
||||
if (!Base.isMacOS()) {
|
||||
@ -1899,13 +1933,14 @@ public class Editor extends JFrame implements RunnerListener {
|
||||
JOptionPane.QUESTION_MESSAGE);
|
||||
|
||||
if (result == JOptionPane.YES_OPTION) {
|
||||
return handleSave(immediately);
|
||||
return handleSave(true);
|
||||
|
||||
} else if (result == JOptionPane.NO_OPTION) {
|
||||
return true; // ok to continue
|
||||
|
||||
} else if (result == JOptionPane.CANCEL_OPTION) {
|
||||
return false;
|
||||
|
||||
} else {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
@ -1950,7 +1985,7 @@ public class Editor extends JFrame implements RunnerListener {
|
||||
|
||||
Object result = pane.getValue();
|
||||
if (result == options[0]) { // save (and close/quit)
|
||||
return handleSave(immediately);
|
||||
return handleSave(true);
|
||||
|
||||
} else if (result == options[2]) { // don't save (still close/quit)
|
||||
return true;
|
||||
@ -2203,39 +2238,69 @@ public class Editor extends JFrame implements RunnerListener {
|
||||
synchronized public void handleExport(final boolean verbose) {
|
||||
//if (!handleExportCheckModified()) return;
|
||||
toolbar.activate(EditorToolbar.EXPORT);
|
||||
|
||||
console.clear();
|
||||
statusNotice("Uploading to I/O Board...");
|
||||
|
||||
//SwingUtilities.invokeLater(new Runnable() {
|
||||
Thread t = new Thread(new Runnable() {
|
||||
public void run() {
|
||||
try {
|
||||
serialMonitor.closeSerialPort();
|
||||
serialMonitor.setVisible(false);
|
||||
|
||||
uploading = true;
|
||||
|
||||
boolean success = sketch.exportApplet(verbose);
|
||||
if (success) {
|
||||
statusNotice("Done uploading.");
|
||||
} else {
|
||||
// error message will already be visible
|
||||
}
|
||||
} catch (RunnerException e) {
|
||||
//statusError("Error during upload.");
|
||||
//e.printStackTrace();
|
||||
statusError(e);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
uploading = false;
|
||||
//toolbar.clear();
|
||||
toolbar.deactivate(EditorToolbar.EXPORT);
|
||||
}});
|
||||
t.start();
|
||||
new Thread(verbose ? exportAppHandler : exportHandler).start();
|
||||
}
|
||||
|
||||
// DAM: in Arduino, this is upload
|
||||
class DefaultExportHandler implements Runnable {
|
||||
public void run() {
|
||||
|
||||
try {
|
||||
serialMonitor.closeSerialPort();
|
||||
serialMonitor.setVisible(false);
|
||||
|
||||
uploading = true;
|
||||
|
||||
boolean success = sketch.exportApplet(false);
|
||||
if (success) {
|
||||
statusNotice("Done uploading.");
|
||||
} else {
|
||||
// error message will already be visible
|
||||
}
|
||||
} catch (RunnerException e) {
|
||||
//statusError("Error during upload.");
|
||||
//e.printStackTrace();
|
||||
statusError(e);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
uploading = false;
|
||||
//toolbar.clear();
|
||||
toolbar.deactivate(EditorToolbar.EXPORT);
|
||||
}
|
||||
}
|
||||
|
||||
// DAM: in Arduino, this is upload (with verbose output)
|
||||
class DefaultExportAppHandler implements Runnable {
|
||||
public void run() {
|
||||
|
||||
try {
|
||||
serialMonitor.closeSerialPort();
|
||||
serialMonitor.setVisible(false);
|
||||
|
||||
uploading = true;
|
||||
|
||||
boolean success = sketch.exportApplet(true);
|
||||
if (success) {
|
||||
statusNotice("Done uploading.");
|
||||
} else {
|
||||
// error message will already be visible
|
||||
}
|
||||
} catch (RunnerException e) {
|
||||
//statusError("Error during upload.");
|
||||
//e.printStackTrace();
|
||||
statusError(e);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
uploading = false;
|
||||
//toolbar.clear();
|
||||
toolbar.deactivate(EditorToolbar.EXPORT);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks to see if the sketch has been modified, and if so,
|
||||
@ -2418,7 +2483,7 @@ public class Editor extends JFrame implements RunnerListener {
|
||||
}
|
||||
statusError(mess);
|
||||
}
|
||||
e.printStackTrace();
|
||||
// e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
@ -2563,4 +2628,3 @@ public class Editor extends JFrame implements RunnerListener {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -28,6 +28,7 @@ import java.awt.event.*;
|
||||
import java.io.*;
|
||||
import javax.swing.*;
|
||||
import javax.swing.text.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
||||
@ -47,8 +48,6 @@ public class EditorConsole extends JScrollPane {
|
||||
MutableAttributeSet stdStyle;
|
||||
MutableAttributeSet errStyle;
|
||||
|
||||
boolean cerror;
|
||||
|
||||
int maxLineCount;
|
||||
|
||||
static File errFile;
|
||||
@ -221,18 +220,9 @@ public class EditorConsole extends JScrollPane {
|
||||
|
||||
|
||||
public void write(byte b[], int offset, int length, boolean err) {
|
||||
if (err != cerror) {
|
||||
// advance the line because switching between err/out streams
|
||||
// potentially, could check whether we're already on a new line
|
||||
message("", cerror, true);
|
||||
}
|
||||
|
||||
// we could do some cross platform CR/LF mangling here before outputting
|
||||
|
||||
// add text to output document
|
||||
message(new String(b, offset, length), err, false);
|
||||
// set last error state
|
||||
cerror = err;
|
||||
}
|
||||
|
||||
|
||||
@ -291,10 +281,10 @@ public class EditorConsole extends JScrollPane {
|
||||
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
||||
|
||||
|
||||
class EditorConsoleStream extends OutputStream {
|
||||
private static class EditorConsoleStream extends OutputStream {
|
||||
//static EditorConsole current;
|
||||
boolean err; // whether stderr or stdout
|
||||
byte single[] = new byte[1];
|
||||
final boolean err; // whether stderr or stdout
|
||||
final byte single[] = new byte[1];
|
||||
|
||||
public EditorConsoleStream(boolean err) {
|
||||
this.err = err;
|
||||
@ -389,7 +379,7 @@ public class EditorConsole extends JScrollPane {
|
||||
* swing event thread, so they need to be synchronized
|
||||
*/
|
||||
class BufferedStyledDocument extends DefaultStyledDocument {
|
||||
ArrayList elements = new ArrayList();
|
||||
ArrayList<ElementSpec> elements = new ArrayList<ElementSpec>();
|
||||
int maxLineLength, maxLineCount;
|
||||
int currentLineLength = 0;
|
||||
boolean needLineBreak = false;
|
||||
|
@ -103,6 +103,10 @@ public class EditorListener {
|
||||
char c = event.getKeyChar();
|
||||
int code = event.getKeyCode();
|
||||
|
||||
// if (code == KeyEvent.VK_SHIFT) {
|
||||
// editor.toolbar.setShiftPressed(true);
|
||||
// }
|
||||
|
||||
//System.out.println((int)c + " " + code + " " + event);
|
||||
//System.out.println();
|
||||
|
||||
@ -457,6 +461,13 @@ public class EditorListener {
|
||||
}
|
||||
|
||||
|
||||
// public boolean keyReleased(KeyEvent event) {
|
||||
// if (code == KeyEvent.VK_SHIFT) {
|
||||
// editor.toolbar.setShiftPressed(false);
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
public boolean keyTyped(KeyEvent event) {
|
||||
char c = event.getKeyChar();
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
/*
|
||||
Part of the Processing project - http://processing.org
|
||||
|
||||
Copyright (c) 2004-08 Ben Fry and Casey Reas
|
||||
Copyright (c) 2004-09 Ben Fry and Casey Reas
|
||||
Copyright (c) 2001-04 Massachusetts Institute of Technology
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
@ -25,6 +25,7 @@ package processing.app;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.event.*;
|
||||
|
||||
@ -32,12 +33,18 @@ import javax.swing.event.*;
|
||||
/**
|
||||
* run/stop/etc buttons for the ide
|
||||
*/
|
||||
public class EditorToolbar extends JComponent implements MouseInputListener {
|
||||
public class EditorToolbar extends JComponent implements MouseInputListener, KeyListener {
|
||||
|
||||
/** Rollover titles for each button. */
|
||||
static final String title[] = {
|
||||
"Verify", "Stop", "New", "Open", "Save", "Upload", "Serial Monitor"
|
||||
};
|
||||
|
||||
/** Titles for each button when the shift key is pressed. */
|
||||
static final String titleShift[] = {
|
||||
"Verify (w/ Verbose Output)", "Stop", "New Editor Window", "Open in Another Window", "Save", "Upload (w/ Verbose Output)", "Serial Monitor"
|
||||
};
|
||||
|
||||
static final int BUTTON_COUNT = title.length;
|
||||
/** Width of each toolbar button. */
|
||||
static final int BUTTON_WIDTH = 27;
|
||||
@ -45,6 +52,9 @@ public class EditorToolbar extends JComponent implements MouseInputListener {
|
||||
static final int BUTTON_HEIGHT = 32;
|
||||
/** The amount of space between groups of buttons on the toolbar. */
|
||||
static final int BUTTON_GAP = 5;
|
||||
/** Size of the button image being chopped up. */
|
||||
static final int BUTTON_IMAGE_SIZE = 33;
|
||||
|
||||
|
||||
static final int RUN = 0;
|
||||
static final int STOP = 1;
|
||||
@ -61,45 +71,35 @@ public class EditorToolbar extends JComponent implements MouseInputListener {
|
||||
static final int ACTIVE = 2;
|
||||
|
||||
Editor editor;
|
||||
//boolean disableRun; // this was for library
|
||||
//Label status;
|
||||
|
||||
Image offscreen;
|
||||
int width, height;
|
||||
|
||||
Color bgcolor;
|
||||
|
||||
static Image buttons;
|
||||
static Image inactive[];
|
||||
static Image rollover[];
|
||||
static Image active[];
|
||||
static Image[][] buttonImages;
|
||||
int currentRollover;
|
||||
//int currentSelection;
|
||||
|
||||
JPopupMenu popup;
|
||||
JMenu menu;
|
||||
|
||||
int buttonCount;
|
||||
int state[] = new int[BUTTON_COUNT];
|
||||
Image stateImage[];
|
||||
int[] state = new int[BUTTON_COUNT];
|
||||
Image[] stateImage;
|
||||
int which[]; // mapping indices to implementation
|
||||
|
||||
int x1[], x2[];
|
||||
int y1, y2;
|
||||
|
||||
String status;
|
||||
Font statusFont;
|
||||
Color statusColor;
|
||||
|
||||
boolean shiftPressed;
|
||||
|
||||
public EditorToolbar(Editor editor, JMenu menu) {
|
||||
this.editor = editor;
|
||||
this.menu = menu;
|
||||
|
||||
if (buttons == null) {
|
||||
buttons = Base.getThemeImage("buttons.gif", this);
|
||||
}
|
||||
|
||||
buttonCount = 0;
|
||||
which = new int[BUTTON_COUNT];
|
||||
|
||||
@ -115,9 +115,6 @@ public class EditorToolbar extends JComponent implements MouseInputListener {
|
||||
currentRollover = -1;
|
||||
|
||||
bgcolor = Theme.getColor("buttons.bgcolor");
|
||||
|
||||
status = "";
|
||||
|
||||
statusFont = Theme.getFont("buttons.status.font");
|
||||
statusColor = Theme.getColor("buttons.status.color");
|
||||
|
||||
@ -125,30 +122,28 @@ public class EditorToolbar extends JComponent implements MouseInputListener {
|
||||
addMouseMotionListener(this);
|
||||
}
|
||||
|
||||
|
||||
public void paintComponent(Graphics screen) {
|
||||
// this data is shared by all EditorToolbar instances
|
||||
if (inactive == null) {
|
||||
inactive = new Image[BUTTON_COUNT];
|
||||
rollover = new Image[BUTTON_COUNT];
|
||||
active = new Image[BUTTON_COUNT];
|
||||
|
||||
int IMAGE_SIZE = 33;
|
||||
protected void loadButtons() {
|
||||
Image allButtons = Base.getThemeImage("buttons.gif", this);
|
||||
buttonImages = new Image[BUTTON_COUNT][3];
|
||||
|
||||
for (int i = 0; i < BUTTON_COUNT; i++) {
|
||||
inactive[i] = createImage(BUTTON_WIDTH, BUTTON_HEIGHT);
|
||||
Graphics g = inactive[i].getGraphics();
|
||||
g.drawImage(buttons, -(i*IMAGE_SIZE) - 3, -2*IMAGE_SIZE, null);
|
||||
|
||||
rollover[i] = createImage(BUTTON_WIDTH, BUTTON_HEIGHT);
|
||||
g = rollover[i].getGraphics();
|
||||
g.drawImage(buttons, -(i*IMAGE_SIZE) - 3, -1*IMAGE_SIZE, null);
|
||||
|
||||
active[i] = createImage(BUTTON_WIDTH, BUTTON_HEIGHT);
|
||||
g = active[i].getGraphics();
|
||||
g.drawImage(buttons, -(i*IMAGE_SIZE) - 3, -0*IMAGE_SIZE, null);
|
||||
for (int state = 0; state < 3; state++) {
|
||||
Image image = createImage(BUTTON_WIDTH, BUTTON_HEIGHT);
|
||||
Graphics g = image.getGraphics();
|
||||
g.drawImage(allButtons,
|
||||
-(i*BUTTON_IMAGE_SIZE) - 3,
|
||||
(-2 + state)*BUTTON_IMAGE_SIZE, null);
|
||||
buttonImages[i][state] = image;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintComponent(Graphics screen) {
|
||||
// this data is shared by all EditorToolbar instances
|
||||
if (buttonImages == null) {
|
||||
loadButtons();
|
||||
}
|
||||
|
||||
// this happens once per instance of EditorToolbar
|
||||
if (stateImage == null) {
|
||||
@ -191,21 +186,34 @@ public class EditorToolbar extends JComponent implements MouseInputListener {
|
||||
|
||||
/*
|
||||
// if i ever find the guy who wrote the java2d api, i will hurt him.
|
||||
*
|
||||
* whereas I love the Java2D API. --jdf. lol.
|
||||
*
|
||||
Graphics2D g2 = (Graphics2D) g;
|
||||
FontRenderContext frc = g2.getFontRenderContext();
|
||||
float statusW = (float) statusFont.getStringBounds(status, frc).getWidth();
|
||||
float statusX = (getSize().width - statusW) / 2;
|
||||
g2.drawString(status, statusX, statusY);
|
||||
*/
|
||||
//int statusY = (BUTTON_HEIGHT + statusFont.getAscent()) / 2;
|
||||
if (currentRollover != -1) {
|
||||
int statusY = (BUTTON_HEIGHT + g.getFontMetrics().getAscent()) / 2;
|
||||
String status = shiftPressed ? titleShift[currentRollover] : title[currentRollover];
|
||||
g.drawString(status, buttonCount * BUTTON_WIDTH + 3 * BUTTON_GAP, statusY);
|
||||
}
|
||||
|
||||
screen.drawImage(offscreen, 0, 0, null);
|
||||
|
||||
if (!isEnabled()) {
|
||||
screen.setColor(new Color(0,0,0,100));
|
||||
screen.fillRect(0, 0, getWidth(), getHeight());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void mouseMoved(MouseEvent e) {
|
||||
if (!isEnabled())
|
||||
return;
|
||||
|
||||
// mouse events before paint();
|
||||
if (state == null) return;
|
||||
|
||||
@ -213,16 +221,17 @@ public class EditorToolbar extends JComponent implements MouseInputListener {
|
||||
// avoid flicker, since there will probably be an update event
|
||||
setState(OPEN, INACTIVE, false);
|
||||
}
|
||||
//System.out.println(e);
|
||||
//mouseMove(e);
|
||||
handleMouse(e.getX(), e.getY());
|
||||
handleMouse(e);
|
||||
}
|
||||
|
||||
|
||||
public void mouseDragged(MouseEvent e) { }
|
||||
|
||||
|
||||
public void handleMouse(int x, int y) {
|
||||
public void handleMouse(MouseEvent e) {
|
||||
int x = e.getX();
|
||||
int y = e.getY();
|
||||
|
||||
if (currentRollover != -1) {
|
||||
if ((x > x1[currentRollover]) && (y > y1) &&
|
||||
(x < x2[currentRollover]) && (y < y2)) {
|
||||
@ -230,7 +239,6 @@ public class EditorToolbar extends JComponent implements MouseInputListener {
|
||||
|
||||
} else {
|
||||
setState(currentRollover, INACTIVE, true);
|
||||
messageClear(title[currentRollover]);
|
||||
currentRollover = -1;
|
||||
}
|
||||
}
|
||||
@ -238,10 +246,8 @@ public class EditorToolbar extends JComponent implements MouseInputListener {
|
||||
if (sel == -1) return;
|
||||
|
||||
if (state[sel] != ACTIVE) {
|
||||
//if (!(disableRun && ((sel == RUN) || (sel == STOP)))) {
|
||||
setState(sel, ROLLOVER, true);
|
||||
currentRollover = sel;
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
@ -263,32 +269,16 @@ public class EditorToolbar extends JComponent implements MouseInputListener {
|
||||
|
||||
|
||||
private void setState(int slot, int newState, boolean updateAfter) {
|
||||
//if (inactive == null) return;
|
||||
state[slot] = newState;
|
||||
switch (newState) {
|
||||
case INACTIVE:
|
||||
stateImage[slot] = inactive[which[slot]];
|
||||
break;
|
||||
case ACTIVE:
|
||||
stateImage[slot] = active[which[slot]];
|
||||
break;
|
||||
case ROLLOVER:
|
||||
stateImage[slot] = rollover[which[slot]];
|
||||
message(title[which[slot]]);
|
||||
break;
|
||||
}
|
||||
stateImage[slot] = buttonImages[which[slot]][newState];
|
||||
if (updateAfter) {
|
||||
//System.out.println("trying to update " + slot + " " + state[slot]);
|
||||
//new Exception("setting slot " + slot + " to " + state[slot]).printStackTrace();
|
||||
repaint(); // changed for swing from update();
|
||||
//Toolkit.getDefaultToolkit().sync();
|
||||
repaint();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void mouseEntered(MouseEvent e) {
|
||||
//mouseMove(e);
|
||||
handleMouse(e.getX(), e.getY());
|
||||
handleMouse(e);
|
||||
}
|
||||
|
||||
|
||||
@ -300,14 +290,18 @@ public class EditorToolbar extends JComponent implements MouseInputListener {
|
||||
if (state[OPEN] != INACTIVE) {
|
||||
setState(OPEN, INACTIVE, true);
|
||||
}
|
||||
status = "";
|
||||
handleMouse(e.getX(), e.getY());
|
||||
handleMouse(e);
|
||||
}
|
||||
|
||||
int wasDown = -1;
|
||||
|
||||
|
||||
public void mousePressed(MouseEvent e) {
|
||||
|
||||
// jdf
|
||||
if (!isEnabled())
|
||||
return;
|
||||
|
||||
final int x = e.getX();
|
||||
final int y = e.getY();
|
||||
|
||||
@ -331,8 +325,11 @@ public class EditorToolbar extends JComponent implements MouseInputListener {
|
||||
break;
|
||||
|
||||
case NEW:
|
||||
//editor.base.handleNew(e.isShiftDown());
|
||||
if (shiftPressed) {
|
||||
editor.base.handleNew();
|
||||
} else {
|
||||
editor.base.handleNewReplace();
|
||||
}
|
||||
break;
|
||||
|
||||
case SAVE:
|
||||
@ -353,84 +350,26 @@ public class EditorToolbar extends JComponent implements MouseInputListener {
|
||||
public void mouseClicked(MouseEvent e) { }
|
||||
|
||||
|
||||
public void mouseReleased(MouseEvent e) {
|
||||
/*
|
||||
switch (currentSelection) {
|
||||
|
||||
case OPEN:
|
||||
setState(OPEN, INACTIVE, true);
|
||||
break;
|
||||
}
|
||||
currentSelection = -1;
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
//public void disableRun(boolean what) {
|
||||
//disableRun = what;
|
||||
//}
|
||||
|
||||
|
||||
/*
|
||||
public void run() {
|
||||
if (inactive == null) return;
|
||||
clear();
|
||||
setState(RUN, ACTIVE, true);
|
||||
}
|
||||
*/
|
||||
|
||||
// public void running(boolean yesno) {
|
||||
// setState(RUN, yesno ? ACTIVE : INACTIVE, true);
|
||||
// }
|
||||
public void mouseReleased(MouseEvent e) { }
|
||||
|
||||
|
||||
/**
|
||||
* Set a particular button to be active.
|
||||
*/
|
||||
public void activate(int what) {
|
||||
//System.out.println("activating " + what);
|
||||
if (inactive == null) return;
|
||||
if (buttonImages != null) {
|
||||
setState(what, ACTIVE, true);
|
||||
}
|
||||
|
||||
//public void clearRun() {
|
||||
//if (inactive == null) return;
|
||||
//setState(RUN, INACTIVE, true);
|
||||
//}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set a particular button to be active.
|
||||
*/
|
||||
public void deactivate(int what) {
|
||||
if (inactive == null) return; // don't draw if not ready
|
||||
if (buttonImages != null) {
|
||||
setState(what, INACTIVE, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear all the state of all buttons.
|
||||
*/
|
||||
// public void clear() { // (int button) {
|
||||
// if (inactive == null) return;
|
||||
//
|
||||
// System.out.println("clearing state of buttons");
|
||||
// // skip the run button, do the others
|
||||
// for (int i = 1; i < buttonCount; i++) {
|
||||
// setState(i, INACTIVE, false);
|
||||
// }
|
||||
// repaint(); // changed for swing from update();
|
||||
// }
|
||||
|
||||
|
||||
public void message(String msg) {
|
||||
//status.setText(msg + " "); // don't mind the hack
|
||||
status = msg;
|
||||
}
|
||||
|
||||
|
||||
public void messageClear(String msg) {
|
||||
//if (status.getText().equals(msg + " ")) status.setText(Editor.EMPTY);
|
||||
if (status.equals(msg)) status = "";
|
||||
}
|
||||
|
||||
|
||||
@ -447,4 +386,23 @@ public class EditorToolbar extends JComponent implements MouseInputListener {
|
||||
public Dimension getMaximumSize() {
|
||||
return new Dimension(3000, BUTTON_HEIGHT);
|
||||
}
|
||||
|
||||
|
||||
public void keyPressed(KeyEvent e) {
|
||||
if (e.getKeyCode() == KeyEvent.VK_SHIFT) {
|
||||
shiftPressed = true;
|
||||
repaint();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void keyReleased(KeyEvent e) {
|
||||
if (e.getKeyCode() == KeyEvent.VK_SHIFT) {
|
||||
shiftPressed = false;
|
||||
repaint();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void keyTyped(KeyEvent e) { }
|
||||
}
|
||||
|
@ -26,6 +26,9 @@ import java.io.File;
|
||||
|
||||
import javax.swing.UIManager;
|
||||
|
||||
import com.sun.jna.Library;
|
||||
import com.sun.jna.Native;
|
||||
|
||||
|
||||
/**
|
||||
* Used by Base for platform-specific tweaking, for instance finding the
|
||||
@ -129,6 +132,36 @@ public class Platform {
|
||||
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
||||
|
||||
|
||||
public interface CLibrary extends Library {
|
||||
CLibrary INSTANCE = (CLibrary)Native.loadLibrary("c", CLibrary.class);
|
||||
int setenv(String name, String value, int overwrite);
|
||||
String getenv(String name);
|
||||
int unsetenv(String name);
|
||||
int putenv(String string);
|
||||
}
|
||||
|
||||
|
||||
public void setenv(String variable, String value) {
|
||||
CLibrary clib = CLibrary.INSTANCE;
|
||||
clib.setenv(variable, value, 1);
|
||||
}
|
||||
|
||||
|
||||
public String getenv(String variable) {
|
||||
CLibrary clib = CLibrary.INSTANCE;
|
||||
return clib.getenv(variable);
|
||||
}
|
||||
|
||||
|
||||
public int unsetenv(String variable) {
|
||||
CLibrary clib = CLibrary.INSTANCE;
|
||||
return clib.unsetenv(variable);
|
||||
}
|
||||
|
||||
|
||||
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
||||
|
||||
|
||||
protected void showLauncherWarning() {
|
||||
Base.showWarning("No launcher available",
|
||||
"Unspecified platform, no launcher available.\n" +
|
||||
|
@ -626,6 +626,11 @@ public class Preferences {
|
||||
}
|
||||
|
||||
|
||||
static public void unset(String attribute) {
|
||||
table.remove(attribute);
|
||||
}
|
||||
|
||||
|
||||
static public boolean getBoolean(String attribute) {
|
||||
String value = get(attribute); //, null);
|
||||
return (new Boolean(value)).booleanValue();
|
||||
|
@ -3,7 +3,7 @@
|
||||
/*
|
||||
Part of the Processing project - http://processing.org
|
||||
|
||||
Copyright (c) 2004-09 Ben Fry and Casey Reas
|
||||
Copyright (c) 2004-10 Ben Fry and Casey Reas
|
||||
Copyright (c) 2001-04 Massachusetts Institute of Technology
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
@ -95,6 +95,9 @@ public class Sketch {
|
||||
* DLLs or JNILIBs.
|
||||
*/
|
||||
private String libraryPath;
|
||||
/**
|
||||
* List of library folders.
|
||||
*/
|
||||
private ArrayList<File> importedLibraries;
|
||||
|
||||
/**
|
||||
@ -1165,11 +1168,14 @@ public class Sketch {
|
||||
* X. afterwards, some of these steps need a cleanup function
|
||||
* </PRE>
|
||||
*/
|
||||
protected String compile(boolean verbose)
|
||||
throws RunnerException {
|
||||
|
||||
String name;
|
||||
|
||||
//protected String compile() throws RunnerException {
|
||||
|
||||
|
||||
/**
|
||||
* When running from the editor, take care of preparations before running
|
||||
* the build.
|
||||
*/
|
||||
public void prepare() {
|
||||
// make sure the user didn't hide the sketch folder
|
||||
ensureExistence();
|
||||
|
||||
@ -1199,11 +1205,8 @@ public class Sketch {
|
||||
// better connected to the dataFolder stuff below.
|
||||
cleanup();
|
||||
|
||||
// handle preprocessing the main file's code
|
||||
name = build(tempBuildFolder.getAbsolutePath(), verbose);
|
||||
size(tempBuildFolder.getAbsolutePath(), name);
|
||||
|
||||
return name;
|
||||
// // handle preprocessing the main file's code
|
||||
// return build(tempBuildFolder.getAbsolutePath());
|
||||
}
|
||||
|
||||
|
||||
@ -1255,14 +1258,6 @@ public class Sketch {
|
||||
// 1. concatenate all .pde files to the 'main' pde
|
||||
// store line number for starting point of each code bit
|
||||
|
||||
// Unfortunately, the header has to be written on a single line, because
|
||||
// there's no way to determine how long it will be until the code has
|
||||
// already been preprocessed. The header will vary in length based on
|
||||
// the programming mode (STATIC, ACTIVE, or JAVA), which is determined
|
||||
// by the preprocessor. So the preprocOffset for the primary class remains
|
||||
// zero, even though it'd be nice to have a legitimate offset, and be able
|
||||
// to remove the 'pretty' boolean for preproc.write().
|
||||
|
||||
StringBuffer bigCode = new StringBuffer();
|
||||
int bigCount = 0;
|
||||
for (SketchCode sc : code) {
|
||||
@ -1271,29 +1266,9 @@ public class Sketch {
|
||||
bigCode.append(sc.getProgram());
|
||||
bigCode.append('\n');
|
||||
bigCount += sc.getLineCount();
|
||||
// if (sc != code[0]) {
|
||||
// sc.setPreprocName(null); // don't compile me
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
String program = code[0].getProgram();
|
||||
StringBuffer bigCode = new StringBuffer(program);
|
||||
int bigCount = code[0].getLineCount();
|
||||
bigCode.append('\n');
|
||||
|
||||
for (int i = 1; i < codeCount; i++) {
|
||||
if (code[i].isExtension("pde")) {
|
||||
code[i].setPreprocOffset(bigCount);
|
||||
bigCode.append(code[i].getProgram());
|
||||
bigCode.append('\n');
|
||||
bigCount += code[i].getLineCount();
|
||||
code[i].setPreprocName(null); // don't compile me
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
// Note that the headerOffset isn't applied until compile and run, because
|
||||
// it only applies to the code after it's been written to the .java file.
|
||||
int headerOffset = 0;
|
||||
@ -1359,7 +1334,7 @@ public class Sketch {
|
||||
|
||||
if (libFolder != null && !importedLibraries.contains(libFolder)) {
|
||||
importedLibraries.add(libFolder);
|
||||
classPath += Compiler.contentsToClassPath(libFolder);
|
||||
//classPath += Compiler.contentsToClassPath(libFolder);
|
||||
libraryPath += File.pathSeparator + libFolder.getAbsolutePath();
|
||||
}
|
||||
}
|
||||
@ -1391,6 +1366,134 @@ public class Sketch {
|
||||
}
|
||||
|
||||
|
||||
public ArrayList<File> getImportedLibraries() {
|
||||
return importedLibraries;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Map an error from a set of processed .java files back to its location
|
||||
* in the actual sketch.
|
||||
* @param message The error message.
|
||||
* @param filename The .java file where the exception was found.
|
||||
* @param line Line number of the .java file for the exception (1-indexed)
|
||||
* @return A RunnerException to be sent to the editor, or null if it wasn't
|
||||
* possible to place the exception to the sketch code.
|
||||
*/
|
||||
// public RunnerException placeExceptionAlt(String message,
|
||||
// String filename, int line) {
|
||||
// String appletJavaFile = appletClassName + ".java";
|
||||
// SketchCode errorCode = null;
|
||||
// if (filename.equals(appletJavaFile)) {
|
||||
// for (SketchCode code : getCode()) {
|
||||
// if (code.isExtension("pde")) {
|
||||
// if (line >= code.getPreprocOffset()) {
|
||||
// errorCode = code;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// for (SketchCode code : getCode()) {
|
||||
// if (code.isExtension("java")) {
|
||||
// if (filename.equals(code.getFileName())) {
|
||||
// errorCode = code;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// int codeIndex = getCodeIndex(errorCode);
|
||||
//
|
||||
// if (codeIndex != -1) {
|
||||
// //System.out.println("got line num " + lineNumber);
|
||||
// // in case this was a tab that got embedded into the main .java
|
||||
// line -= getCode(codeIndex).getPreprocOffset();
|
||||
//
|
||||
// // lineNumber is 1-indexed, but editor wants zero-indexed
|
||||
// line--;
|
||||
//
|
||||
// // getMessage() will be what's shown in the editor
|
||||
// RunnerException exception =
|
||||
// new RunnerException(message, codeIndex, line, -1);
|
||||
// exception.hideStackTrace();
|
||||
// return exception;
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
* Map an error from a set of processed .java files back to its location
|
||||
* in the actual sketch.
|
||||
* @param message The error message.
|
||||
* @param filename The .java file where the exception was found.
|
||||
* @param line Line number of the .java file for the exception (0-indexed!)
|
||||
* @return A RunnerException to be sent to the editor, or null if it wasn't
|
||||
* possible to place the exception to the sketch code.
|
||||
*/
|
||||
public RunnerException placeException(String message,
|
||||
String dotJavaFilename,
|
||||
int dotJavaLine) {
|
||||
int codeIndex = 0; //-1;
|
||||
int codeLine = -1;
|
||||
|
||||
// System.out.println("placing " + dotJavaFilename + " " + dotJavaLine);
|
||||
// System.out.println("code count is " + getCodeCount());
|
||||
|
||||
// first check to see if it's a .java file
|
||||
for (int i = 0; i < getCodeCount(); i++) {
|
||||
SketchCode code = getCode(i);
|
||||
if (!code.isExtension(getDefaultExtension())) {
|
||||
if (dotJavaFilename.equals(code.getFileName())) {
|
||||
codeIndex = i;
|
||||
codeLine = dotJavaLine;
|
||||
return new RunnerException(message, codeIndex, codeLine);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If not the preprocessed file at this point, then need to get out
|
||||
if (!dotJavaFilename.equals(name + ".cpp")) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// if it's not a .java file, codeIndex will still be 0
|
||||
// this section searches through the list of .pde files
|
||||
codeIndex = 0;
|
||||
for (int i = 0; i < getCodeCount(); i++) {
|
||||
SketchCode code = getCode(i);
|
||||
|
||||
if (code.isExtension(getDefaultExtension())) {
|
||||
// System.out.println("preproc offset is " + code.getPreprocOffset());
|
||||
// System.out.println("looking for line " + dotJavaLine);
|
||||
if (code.getPreprocOffset() <= dotJavaLine) {
|
||||
codeIndex = i;
|
||||
// System.out.println("i'm thinkin file " + i);
|
||||
codeLine = dotJavaLine - code.getPreprocOffset();
|
||||
}
|
||||
}
|
||||
}
|
||||
// could not find a proper line number, so deal with this differently.
|
||||
// but if it was in fact the .java file we're looking for, though,
|
||||
// send the error message through.
|
||||
// this is necessary because 'import' statements will be at a line
|
||||
// that has a lower number than the preproc offset, for instance.
|
||||
// if (codeLine == -1 && !dotJavaFilename.equals(name + ".java")) {
|
||||
// return null;
|
||||
// }
|
||||
return new RunnerException(message, codeIndex, codeLine);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Run the build inside the temporary build folder.
|
||||
* @return null if compilation failed, main class name if not
|
||||
* @throws RunnerException
|
||||
*/
|
||||
public String build(boolean verbose) throws RunnerException {
|
||||
return build(tempBuildFolder.getAbsolutePath(), verbose);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Preprocess and compile all the code for this sketch.
|
||||
*
|
||||
@ -1410,6 +1513,7 @@ public class Sketch {
|
||||
// that will bubble up to whomever called build().
|
||||
Compiler compiler = new Compiler();
|
||||
if (compiler.compile(this, buildPath, primaryClassName, verbose)) {
|
||||
size(buildPath, primaryClassName);
|
||||
return primaryClassName;
|
||||
}
|
||||
return null;
|
||||
@ -1461,7 +1565,6 @@ public class Sketch {
|
||||
// return false;
|
||||
// }
|
||||
|
||||
size(appletFolder.getPath(), foundName);
|
||||
upload(appletFolder.getPath(), foundName, verbose);
|
||||
|
||||
return true;
|
||||
@ -1500,7 +1603,7 @@ public class Sketch {
|
||||
verbose);
|
||||
|
||||
return success ? suggestedClassName : null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace all commented portions of a given String as spaces.
|
||||
@ -1538,7 +1641,8 @@ public class Sketch {
|
||||
break;
|
||||
|
||||
} else {
|
||||
index++;
|
||||
// continue blanking this area
|
||||
p[index++] = ' ';
|
||||
}
|
||||
}
|
||||
if (!endOfRainbow) {
|
||||
@ -1562,8 +1666,8 @@ public class Sketch {
|
||||
* Export to application via GUI.
|
||||
*/
|
||||
protected boolean exportApplication() throws IOException, RunnerException {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@ -1571,154 +1675,7 @@ public class Sketch {
|
||||
*/
|
||||
public boolean exportApplication(String destPath,
|
||||
int exportPlatform) throws IOException, RunnerException {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
protected void addManifest(ZipOutputStream zos) throws IOException {
|
||||
ZipEntry entry = new ZipEntry("META-INF/MANIFEST.MF");
|
||||
zos.putNextEntry(entry);
|
||||
|
||||
String contents =
|
||||
"Manifest-Version: 1.0\n" +
|
||||
"Created-By: Processing " + Base.VERSION_NAME + "\n" +
|
||||
"Main-Class: " + name + "\n"; // TODO not package friendly
|
||||
zos.write(contents.getBytes());
|
||||
zos.closeEntry();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Read from a file with a bunch of attribute/value pairs
|
||||
* that are separated by = and ignore comments with #.
|
||||
*/
|
||||
protected HashMap<String,String> readSettings(File inputFile) {
|
||||
HashMap<String,String> outgoing = new HashMap<String,String>();
|
||||
if (!inputFile.exists()) return outgoing; // return empty hash
|
||||
|
||||
String lines[] = PApplet.loadStrings(inputFile);
|
||||
for (int i = 0; i < lines.length; i++) {
|
||||
int hash = lines[i].indexOf('#');
|
||||
String line = (hash == -1) ?
|
||||
lines[i].trim() : lines[i].substring(0, hash).trim();
|
||||
if (line.length() == 0) continue;
|
||||
|
||||
int equals = line.indexOf('=');
|
||||
if (equals == -1) {
|
||||
System.err.println("ignoring illegal line in " + inputFile);
|
||||
System.err.println(" " + line);
|
||||
continue;
|
||||
}
|
||||
String attr = line.substring(0, equals).trim();
|
||||
String valu = line.substring(equals + 1).trim();
|
||||
outgoing.put(attr, valu);
|
||||
}
|
||||
return outgoing;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Slurps up .class files from a colon (or semicolon on windows)
|
||||
* separated list of paths and adds them to a ZipOutputStream.
|
||||
*/
|
||||
protected void packClassPathIntoZipFile(String path,
|
||||
ZipOutputStream zos,
|
||||
HashMap<String,Object> zipFileContents)
|
||||
throws IOException {
|
||||
String[] pieces = PApplet.split(path, File.pathSeparatorChar);
|
||||
|
||||
for (int i = 0; i < pieces.length; i++) {
|
||||
if (pieces[i].length() == 0) continue;
|
||||
|
||||
// is it a jar file or directory?
|
||||
if (pieces[i].toLowerCase().endsWith(".jar") ||
|
||||
pieces[i].toLowerCase().endsWith(".zip")) {
|
||||
try {
|
||||
ZipFile file = new ZipFile(pieces[i]);
|
||||
Enumeration<?> entries = file.entries();
|
||||
while (entries.hasMoreElements()) {
|
||||
ZipEntry entry = (ZipEntry) entries.nextElement();
|
||||
if (entry.isDirectory()) {
|
||||
// actually 'continue's for all dir entries
|
||||
|
||||
} else {
|
||||
String entryName = entry.getName();
|
||||
// ignore contents of the META-INF folders
|
||||
if (entryName.indexOf("META-INF") == 0) continue;
|
||||
|
||||
// don't allow duplicate entries
|
||||
if (zipFileContents.get(entryName) != null) continue;
|
||||
zipFileContents.put(entryName, new Object());
|
||||
|
||||
ZipEntry entree = new ZipEntry(entryName);
|
||||
|
||||
zos.putNextEntry(entree);
|
||||
byte buffer[] = new byte[(int) entry.getSize()];
|
||||
InputStream is = file.getInputStream(entry);
|
||||
|
||||
int offset = 0;
|
||||
int remaining = buffer.length;
|
||||
while (remaining > 0) {
|
||||
int count = is.read(buffer, offset, remaining);
|
||||
offset += count;
|
||||
remaining -= count;
|
||||
}
|
||||
|
||||
zos.write(buffer);
|
||||
zos.flush();
|
||||
zos.closeEntry();
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
System.err.println("Error in file " + pieces[i]);
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else { // not a .jar or .zip, prolly a directory
|
||||
File dir = new File(pieces[i]);
|
||||
// but must be a dir, since it's one of several paths
|
||||
// just need to check if it exists
|
||||
if (dir.exists()) {
|
||||
packClassPathIntoZipFileRecursive(dir, null, zos);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Continue the process of magical exporting. This function
|
||||
* can be called recursively to walk through folders looking
|
||||
* for more goodies that will be added to the ZipOutputStream.
|
||||
*/
|
||||
static protected void packClassPathIntoZipFileRecursive(File dir,
|
||||
String sofar,
|
||||
ZipOutputStream zos)
|
||||
throws IOException {
|
||||
String files[] = dir.list();
|
||||
for (int i = 0; i < files.length; i++) {
|
||||
// ignore . .. and .DS_Store
|
||||
if (files[i].charAt(0) == '.') continue;
|
||||
|
||||
File sub = new File(dir, files[i]);
|
||||
String nowfar = (sofar == null) ?
|
||||
files[i] : (sofar + "/" + files[i]);
|
||||
|
||||
if (sub.isDirectory()) {
|
||||
packClassPathIntoZipFileRecursive(sub, nowfar, zos);
|
||||
|
||||
} else {
|
||||
// don't add .jar and .zip files, since they only work
|
||||
// inside the root, and they're unpacked
|
||||
if (!files[i].toLowerCase().endsWith(".jar") &&
|
||||
!files[i].toLowerCase().endsWith(".zip") &&
|
||||
files[i].charAt(0) != '.') {
|
||||
ZipEntry entry = new ZipEntry(nowfar);
|
||||
zos.putNextEntry(entry);
|
||||
zos.write(Base.loadBytesRaw(sub));
|
||||
zos.closeEntry();
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -1923,11 +1880,6 @@ public class Sketch {
|
||||
}
|
||||
|
||||
|
||||
public ArrayList<File> getImportedLibraries() {
|
||||
return importedLibraries;
|
||||
}
|
||||
|
||||
|
||||
public String getClassPath() {
|
||||
return classPath;
|
||||
}
|
||||
|
@ -8,8 +8,12 @@ import java.util.zip.*;
|
||||
//import javax.swing.SwingUtilities;
|
||||
|
||||
/**
|
||||
* An example of a very simple, multi-threaded HTTP server.
|
||||
* Taken from <a href="http://java.sun.com/developer/technicalArticles/Networking/Webserver/">this</a> article on java.sun.com.
|
||||
* This code is placed here in anticipation of running the reference from an
|
||||
* internal web server that reads the docs from a zip file, instead of using
|
||||
* thousands of .html files on the disk, which is really inefficient.
|
||||
* <p/>
|
||||
* This is a very simple, multi-threaded HTTP server, originally based on
|
||||
* <a href="http://j.mp/6BQwpI">this</a> article on java.sun.com.
|
||||
*/
|
||||
public class WebServer implements HttpConstants {
|
||||
|
||||
|
@ -326,142 +326,42 @@ public class Compiler implements MessageConsumer {
|
||||
* and line number, which is then reported back to Editor.
|
||||
*/
|
||||
public void message(String s) {
|
||||
// This receives messages as full lines, so a newline needs
|
||||
// to be added as they're printed to the console.
|
||||
//System.err.print(s);
|
||||
int i;
|
||||
|
||||
// ignore cautions
|
||||
if (s.indexOf("warning") != -1) return;
|
||||
|
||||
// ignore this line; the real error is on the next one
|
||||
if (s.indexOf("In file included from") != -1) return;
|
||||
|
||||
// jikes always uses a forward slash character as its separator,
|
||||
// so replace any platform-specific separator characters before
|
||||
// attemping to compare
|
||||
//
|
||||
//String buildPathSubst = buildPath.replace(File.separatorChar, '/') + "/";
|
||||
String buildPathSubst =
|
||||
buildPath.replace(File.separatorChar,File.separatorChar) +
|
||||
File.separatorChar;
|
||||
|
||||
String partialTempPath = null;
|
||||
int partialStartIndex = -1; //s.indexOf(partialTempPath);
|
||||
int fileIndex = -1; // use this to build a better exception
|
||||
|
||||
// check the main sketch file first.
|
||||
partialTempPath = buildPathSubst + primaryClassName;
|
||||
partialStartIndex = s.indexOf(partialTempPath);
|
||||
|
||||
if (partialStartIndex != -1) {
|
||||
fileIndex = 0;
|
||||
} else {
|
||||
// wasn't there, check the other (non-pde) files in the sketch.
|
||||
// iterate through the project files to see who's causing the trouble
|
||||
for (int i = 0; i < sketch.getCodeCount(); i++) {
|
||||
if (sketch.getCode(i).isExtension("pde")) continue;
|
||||
|
||||
partialTempPath = buildPathSubst + sketch.getCode(i).getFileName();
|
||||
//System.out.println(partialTempPath);
|
||||
partialStartIndex = s.indexOf(partialTempPath);
|
||||
if (partialStartIndex != -1) {
|
||||
fileIndex = i;
|
||||
//System.out.println("fileIndex is " + fileIndex);
|
||||
break;
|
||||
}
|
||||
}
|
||||
//+ className + ".java";
|
||||
}
|
||||
|
||||
// if the partial temp path appears in the error message...
|
||||
//
|
||||
//int partialStartIndex = s.indexOf(partialTempPath);
|
||||
if (partialStartIndex != -1) {
|
||||
|
||||
// skip past the path and parse the int after the first colon
|
||||
//
|
||||
String s1 = s.substring(partialStartIndex +
|
||||
partialTempPath.length() + 1);
|
||||
//System.out.println(s1);
|
||||
int colon = s1.indexOf(':');
|
||||
|
||||
if (s1.indexOf("In function") != -1 || colon == -1) {
|
||||
System.err.print(s1);
|
||||
//firstErrorFound = true;
|
||||
return;
|
||||
}
|
||||
|
||||
int lineNumber;
|
||||
try {
|
||||
lineNumber = Integer.parseInt(s1.substring(0, colon));
|
||||
} catch (NumberFormatException e) {
|
||||
System.err.print(s1);
|
||||
return;
|
||||
}
|
||||
|
||||
//System.out.println("pde / line number: " + lineNumber);
|
||||
|
||||
if (fileIndex == 0) { // main class, figure out which tab
|
||||
for (int i = 1; i < sketch.getCodeCount(); i++) {
|
||||
if (sketch.getCode(i).isExtension("pde")) {
|
||||
//System.out.println("preprocOffset "+ sketch.getCode(i).getPreprocOffset());
|
||||
if (sketch.getCode(i).getPreprocOffset() < lineNumber) {
|
||||
fileIndex = i;
|
||||
//System.out.println("i'm thinkin file " + i);
|
||||
}
|
||||
}
|
||||
}
|
||||
// XXX: DAM: if the lineNumber is less than sketch.getCode(0).getPreprocOffset()
|
||||
// we shouldn't subtract anything from it, as the error is above the
|
||||
// location where the function prototypes and #include "WProgram.h"
|
||||
// were inserted.
|
||||
lineNumber -= sketch.getCode(fileIndex).getPreprocOffset();
|
||||
}
|
||||
|
||||
//String s2 = s1.substring(colon + 2);
|
||||
int err = s1.indexOf(":");
|
||||
if (err != -1) {
|
||||
|
||||
// if the first error has already been found, then this must be
|
||||
// (at least) the second error found
|
||||
if (firstErrorFound) {
|
||||
secondErrorFound = true;
|
||||
return;
|
||||
}
|
||||
|
||||
// if executing at this point, this is *at least* the first error
|
||||
firstErrorFound = true;
|
||||
|
||||
err += ":".length();
|
||||
String description = s1.substring(err);
|
||||
description = description.trim();
|
||||
System.err.print(description);
|
||||
|
||||
//System.out.println("description = " + description);
|
||||
//System.out.println("creating exception " + exception);
|
||||
exception = new RunnerException(description, fileIndex, lineNumber-1, -1, false);
|
||||
|
||||
// NOTE!! major change here, this exception will be queued
|
||||
// here to be thrown by the compile() function
|
||||
//editor.error(exception);
|
||||
|
||||
} else {
|
||||
System.err.println("i suck: " + s);
|
||||
}
|
||||
|
||||
} else {
|
||||
// this isn't the start of an error line, so don't attempt to parse
|
||||
// a line number out of it.
|
||||
|
||||
// if the second error hasn't been discovered yet, these lines
|
||||
// are probably associated with the first error message,
|
||||
// which is already in the status bar, and are likely to be
|
||||
// of interest to the user, so spit them to the console.
|
||||
//
|
||||
if (!secondErrorFound) {
|
||||
System.err.println(s);
|
||||
// remove the build path so people only see the filename
|
||||
// can't use replaceAll() because the path may have characters in it which
|
||||
// have meaning in a regular expression.
|
||||
if (!verbose) {
|
||||
while ((i = s.indexOf(buildPath + File.separator)) != -1) {
|
||||
s = s.substring(0, i) + s.substring(i + (buildPath + File.separator).length());
|
||||
}
|
||||
}
|
||||
|
||||
// look for error line, which contains file name, line number,
|
||||
// and at least the first line of the error message
|
||||
String errorFormat = "([\\w\\d_]+.\\w+):(\\d+):\\s*error:\\s*(.*)\\s*";
|
||||
String[] pieces = PApplet.match(s, errorFormat);
|
||||
|
||||
// if (pieces != null && exception == null) {
|
||||
// exception = sketch.placeException(pieces[3], pieces[1], PApplet.parseInt(pieces[2]) - 1);
|
||||
// if (exception != null) exception.hideStackTrace();
|
||||
// }
|
||||
|
||||
if (pieces != null) {
|
||||
RunnerException e = sketch.placeException(pieces[3], pieces[1], PApplet.parseInt(pieces[2]) - 1);
|
||||
|
||||
if (e != null) {
|
||||
SketchCode code = sketch.getCode(e.getCodeIndex());
|
||||
String fileName = code.isExtension(sketch.getDefaultExtension()) ? code.getPrettyName() : code.getFileName();
|
||||
if (!verbose) s = fileName + ":" + e.getCodeLine() + ": error: " + e.getMessage();
|
||||
if (exception == null) {
|
||||
exception = e;
|
||||
exception.hideStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
System.err.print(s);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
@ -593,167 +493,4 @@ public class Compiler implements MessageConsumer {
|
||||
|
||||
return files;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a folder, return a list of absolute paths to all jar or zip files
|
||||
* inside that folder, separated by pathSeparatorChar.
|
||||
*
|
||||
* This will prepend a colon (or whatever the path separator is)
|
||||
* so that it can be directly appended to another path string.
|
||||
*
|
||||
* As of 0136, this will no longer add the root folder as well.
|
||||
*
|
||||
* This function doesn't bother checking to see if there are any .class
|
||||
* files in the folder or within a subfolder.
|
||||
*/
|
||||
static public String contentsToClassPath(File folder) {
|
||||
if (folder == null) return "";
|
||||
|
||||
StringBuffer abuffer = new StringBuffer();
|
||||
String sep = System.getProperty("path.separator");
|
||||
|
||||
try {
|
||||
String path = folder.getCanonicalPath();
|
||||
|
||||
// disabled as of 0136
|
||||
// add the folder itself in case any unzipped files
|
||||
// abuffer.append(sep);
|
||||
// abuffer.append(path);
|
||||
//
|
||||
// When getting the name of this folder, make sure it has a slash
|
||||
// after it, so that the names of sub-items can be added.
|
||||
if (!path.endsWith(File.separator)) {
|
||||
path += File.separator;
|
||||
}
|
||||
|
||||
String list[] = folder.list();
|
||||
for (int i = 0; i < list.length; i++) {
|
||||
// Skip . and ._ files. Prior to 0125p3, .jar files that had
|
||||
// OS X AppleDouble files associated would cause trouble.
|
||||
if (list[i].startsWith(".")) continue;
|
||||
|
||||
if (list[i].toLowerCase().endsWith(".jar") ||
|
||||
list[i].toLowerCase().endsWith(".zip")) {
|
||||
abuffer.append(sep);
|
||||
abuffer.append(path);
|
||||
abuffer.append(list[i]);
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace(); // this would be odd
|
||||
}
|
||||
//System.out.println("included path is " + abuffer.toString());
|
||||
//packageListFromClassPath(abuffer.toString()); // WHY?
|
||||
return abuffer.toString();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* A classpath, separated by the path separator, will contain
|
||||
* a series of .jar/.zip files or directories containing .class
|
||||
* files, or containing subdirectories that have .class files.
|
||||
*
|
||||
* @param path the input classpath
|
||||
* @return array of possible package names
|
||||
*/
|
||||
static public String[] packageListFromClassPath(String path) {
|
||||
Hashtable table = new Hashtable();
|
||||
String pieces[] =
|
||||
PApplet.split(path, File.pathSeparatorChar);
|
||||
|
||||
for (int i = 0; i < pieces.length; i++) {
|
||||
//System.out.println("checking piece '" + pieces[i] + "'");
|
||||
if (pieces[i].length() == 0) continue;
|
||||
|
||||
if (pieces[i].toLowerCase().endsWith(".jar") ||
|
||||
pieces[i].toLowerCase().endsWith(".zip")) {
|
||||
//System.out.println("checking " + pieces[i]);
|
||||
packageListFromZip(pieces[i], table);
|
||||
|
||||
} else { // it's another type of file or directory
|
||||
File dir = new File(pieces[i]);
|
||||
if (dir.exists() && dir.isDirectory()) {
|
||||
packageListFromFolder(dir, null, table);
|
||||
//importCount = magicImportsRecursive(dir, null,
|
||||
// table);
|
||||
//imports, importCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
int tableCount = table.size();
|
||||
String output[] = new String[tableCount];
|
||||
int index = 0;
|
||||
Enumeration e = table.keys();
|
||||
while (e.hasMoreElements()) {
|
||||
output[index++] = ((String) e.nextElement()).replace('/', '.');
|
||||
}
|
||||
//System.arraycopy(imports, 0, output, 0, importCount);
|
||||
//PApplet.printarr(output);
|
||||
return output;
|
||||
}
|
||||
|
||||
|
||||
static private void packageListFromZip(String filename, Hashtable table) {
|
||||
try {
|
||||
ZipFile file = new ZipFile(filename);
|
||||
Enumeration entries = file.entries();
|
||||
while (entries.hasMoreElements()) {
|
||||
ZipEntry entry = (ZipEntry) entries.nextElement();
|
||||
|
||||
if (!entry.isDirectory()) {
|
||||
String name = entry.getName();
|
||||
|
||||
if (name.endsWith(".class")) {
|
||||
int slash = name.lastIndexOf('/');
|
||||
if (slash == -1) continue;
|
||||
|
||||
String pname = name.substring(0, slash);
|
||||
if (table.get(pname) == null) {
|
||||
table.put(pname, new Object());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
System.err.println("Ignoring " + filename + " (" + e.getMessage() + ")");
|
||||
//e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Make list of package names by traversing a directory hierarchy.
|
||||
* Each time a class is found in a folder, add its containing set
|
||||
* of folders to the package list. If another folder is found,
|
||||
* walk down into that folder and continue.
|
||||
*/
|
||||
static private void packageListFromFolder(File dir, String sofar,
|
||||
Hashtable table) {
|
||||
//String imports[],
|
||||
//int importCount) {
|
||||
//System.err.println("checking dir '" + dir + "'");
|
||||
boolean foundClass = false;
|
||||
String files[] = dir.list();
|
||||
|
||||
for (int i = 0; i < files.length; i++) {
|
||||
if (files[i].equals(".") || files[i].equals("..")) continue;
|
||||
|
||||
File sub = new File(dir, files[i]);
|
||||
if (sub.isDirectory()) {
|
||||
String nowfar =
|
||||
(sofar == null) ? files[i] : (sofar + "." + files[i]);
|
||||
packageListFromFolder(sub, nowfar, table);
|
||||
//System.out.println(nowfar);
|
||||
//imports[importCount++] = nowfar;
|
||||
//importCount = magicImportsRecursive(sub, nowfar,
|
||||
// imports, importCount);
|
||||
} else if (!foundClass) { // if no classes found in this folder yet
|
||||
if (files[i].endsWith(".class")) {
|
||||
//System.out.println("unique class: " + files[i] + " for " + sofar);
|
||||
table.put(sofar, new Object());
|
||||
foundClass = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,403 +0,0 @@
|
||||
/*
|
||||
* @(#)EventThread.java 1.4 03/01/23
|
||||
*
|
||||
* Copyright 2003 Sun Microsystems, Inc. All rights reserved.
|
||||
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 1997-2001 by Sun Microsystems, Inc. All Rights Reserved.
|
||||
*
|
||||
* Sun grants you ("Licensee") a non-exclusive, royalty free, license to use,
|
||||
* modify and redistribute this software in source and binary code form,
|
||||
* provided that i) this copyright notice and license appear on all copies of
|
||||
* the software; and ii) Licensee does not utilize the software in a manner
|
||||
* which is disparaging to Sun.
|
||||
*
|
||||
* This software is provided "AS IS," without a warranty of any kind. ALL
|
||||
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY
|
||||
* IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
|
||||
* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN AND ITS LICENSORS SHALL NOT BE
|
||||
* LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
|
||||
* OR DISTRIBUTING THE SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR ITS
|
||||
* LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT,
|
||||
* INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER
|
||||
* CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF
|
||||
* OR INABILITY TO USE SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* This software is not designed or intended for use in on-line control of
|
||||
* aircraft, air traffic, aircraft navigation or aircraft communications; or in
|
||||
* the design, construction, operation or maintenance of any nuclear
|
||||
* facility. Licensee represents and warrants that it will not use or
|
||||
* redistribute the Software for such purposes.
|
||||
*/
|
||||
|
||||
package processing.app.debug;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.sun.jdi.*;
|
||||
import com.sun.jdi.event.*;
|
||||
import com.sun.jdi.request.*;
|
||||
|
||||
/**
|
||||
* This class processes incoming JDI events and displays them
|
||||
*
|
||||
* @version @(#) EventThread.java 1.4 03/01/23 23:33:38
|
||||
* @author Robert Field
|
||||
*/
|
||||
public class EventThread extends Thread {
|
||||
|
||||
private final Runner parent;
|
||||
private final VirtualMachine vm; // Running VM
|
||||
private final String[] excludes; // Packages to exclude
|
||||
private final PrintWriter writer; // Where output goes
|
||||
|
||||
static String nextBaseIndent = ""; // Starting indent for next thread
|
||||
|
||||
private boolean connected = true; // Connected to VM
|
||||
private boolean vmDied = true; // VMDeath occurred
|
||||
|
||||
// Maps ThreadReference to ThreadTrace instances
|
||||
private Map traceMap = new HashMap();
|
||||
|
||||
EventThread(Runner parent, VirtualMachine vm, String[] excludes, PrintWriter writer) {
|
||||
super("event-handler");
|
||||
this.parent = parent;
|
||||
this.vm = vm;
|
||||
this.excludes = excludes;
|
||||
this.writer = writer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Run the event handling thread.
|
||||
* As long as we are connected, get event sets off
|
||||
* the queue and dispatch the events within them.
|
||||
*/
|
||||
public void run() {
|
||||
EventQueue queue = vm.eventQueue();
|
||||
while (connected) {
|
||||
try {
|
||||
EventSet eventSet = queue.remove();
|
||||
EventIterator it = eventSet.eventIterator();
|
||||
while (it.hasNext()) {
|
||||
handleEvent(it.nextEvent());
|
||||
}
|
||||
eventSet.resume();
|
||||
} catch (InterruptedException exc) {
|
||||
// Ignore
|
||||
} catch (VMDisconnectedException discExc) {
|
||||
handleDisconnectedException();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the desired event requests, and enable
|
||||
* them so that we will get events.
|
||||
* @param excludes Class patterns for which we don't want events
|
||||
* @param watchFields Do we want to watch assignments to fields
|
||||
*/
|
||||
void setEventRequests(boolean watchFields) {
|
||||
EventRequestManager mgr = vm.eventRequestManager();
|
||||
|
||||
// VMDeathRequest deathReq = mgr.createVMDeathRequest();
|
||||
// deathReq.setSuspendPolicy(EventRequest.SUSPEND_ALL);
|
||||
// deathReq.enable();
|
||||
|
||||
// get only the uncaught exceptions
|
||||
ExceptionRequest excReq = mgr.createExceptionRequest(null, false, true);
|
||||
// this version reports all exceptions, caught or uncaught
|
||||
//ExceptionRequest excReq = mgr.createExceptionRequest(null, true, true);
|
||||
// suspend so we can step
|
||||
excReq.setSuspendPolicy(EventRequest.SUSPEND_ALL);
|
||||
excReq.enable();
|
||||
|
||||
/*
|
||||
MethodEntryRequest menr = mgr.createMethodEntryRequest();
|
||||
for (int i=0; i<excludes.length; ++i) {
|
||||
menr.addClassExclusionFilter(excludes[i]);
|
||||
}
|
||||
menr.setSuspendPolicy(EventRequest.SUSPEND_NONE);
|
||||
menr.enable();
|
||||
|
||||
MethodExitRequest mexr = mgr.createMethodExitRequest();
|
||||
for (int i=0; i<excludes.length; ++i) {
|
||||
mexr.addClassExclusionFilter(excludes[i]);
|
||||
}
|
||||
mexr.setSuspendPolicy(EventRequest.SUSPEND_NONE);
|
||||
mexr.enable();
|
||||
|
||||
ThreadDeathRequest tdr = mgr.createThreadDeathRequest();
|
||||
// Make sure we sync on thread death
|
||||
tdr.setSuspendPolicy(EventRequest.SUSPEND_ALL);
|
||||
tdr.enable();
|
||||
*/
|
||||
|
||||
// turn on field watching (waaay slow)
|
||||
/*
|
||||
// if (watchFields) {
|
||||
ClassPrepareRequest cpr = mgr.createClassPrepareRequest();
|
||||
for (int i=0; i<excludes.length; ++i) {
|
||||
cpr.addClassExclusionFilter(excludes[i]);
|
||||
}
|
||||
cpr.setSuspendPolicy(EventRequest.SUSPEND_ALL);
|
||||
cpr.enable();
|
||||
// }
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* This class keeps context on events in one thread.
|
||||
* In this implementation, context is the indentation prefix.
|
||||
*/
|
||||
class ThreadTrace {
|
||||
final ThreadReference thread;
|
||||
final String baseIndent;
|
||||
static final String threadDelta = " ";
|
||||
StringBuffer indent;
|
||||
|
||||
ThreadTrace(ThreadReference thread) {
|
||||
this.thread = thread;
|
||||
this.baseIndent = nextBaseIndent;
|
||||
indent = new StringBuffer(baseIndent);
|
||||
nextBaseIndent += threadDelta;
|
||||
println("====== " + thread.name() + " ======");
|
||||
}
|
||||
|
||||
private void println(String str) {
|
||||
if (writer != null) {
|
||||
writer.print(indent);
|
||||
writer.println(str);
|
||||
writer.flush();
|
||||
}
|
||||
}
|
||||
|
||||
void methodEntryEvent(MethodEntryEvent event) {
|
||||
println(event.method().name() + " -- "
|
||||
+ event.method().declaringType().name());
|
||||
indent.append("| ");
|
||||
}
|
||||
|
||||
void methodExitEvent(MethodExitEvent event) {
|
||||
indent.setLength(indent.length()-2);
|
||||
}
|
||||
|
||||
void fieldWatchEvent(ModificationWatchpointEvent event) {
|
||||
Field field = event.field();
|
||||
Value value = event.valueToBe();
|
||||
println(" " + field.name() + " = " + value);
|
||||
}
|
||||
|
||||
void exceptionEvent(ExceptionEvent event) {
|
||||
println("Exception: " + event.exception() +
|
||||
" catch: " + event.catchLocation());
|
||||
// System.out.println("Exception: " + event.exception() +
|
||||
// " catch: " + event.catchLocation());
|
||||
|
||||
// Step to the catch
|
||||
EventRequestManager mgr = vm.eventRequestManager();
|
||||
StepRequest req = mgr.createStepRequest(thread,
|
||||
StepRequest.STEP_MIN,
|
||||
StepRequest.STEP_INTO);
|
||||
req.addCountFilter(1); // next step only
|
||||
req.setSuspendPolicy(EventRequest.SUSPEND_ALL);
|
||||
req.enable();
|
||||
}
|
||||
|
||||
// Step to exception catch
|
||||
void stepEvent(StepEvent event) {
|
||||
// Adjust call depth
|
||||
int cnt = 0;
|
||||
indent = new StringBuffer(baseIndent);
|
||||
try {
|
||||
cnt = thread.frameCount();
|
||||
} catch (IncompatibleThreadStateException exc) {
|
||||
}
|
||||
while (cnt-- > 0) {
|
||||
indent.append("| ");
|
||||
}
|
||||
|
||||
EventRequestManager mgr = vm.eventRequestManager();
|
||||
mgr.deleteEventRequest(event.request());
|
||||
}
|
||||
|
||||
void threadDeathEvent(ThreadDeathEvent event) {
|
||||
indent = new StringBuffer(baseIndent);
|
||||
println("====== " + thread.name() + " end ======");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the ThreadTrace instance for the specified thread,
|
||||
* creating one if needed.
|
||||
*/
|
||||
ThreadTrace threadTrace(ThreadReference thread) {
|
||||
ThreadTrace trace = (ThreadTrace)traceMap.get(thread);
|
||||
if (trace == null) {
|
||||
trace = new ThreadTrace(thread);
|
||||
traceMap.put(thread, trace);
|
||||
}
|
||||
return trace;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispatch incoming events
|
||||
*/
|
||||
private void handleEvent(Event event) {
|
||||
if (event instanceof ExceptionEvent) {
|
||||
exceptionEvent((ExceptionEvent)event);
|
||||
} else if (event instanceof ModificationWatchpointEvent) {
|
||||
fieldWatchEvent((ModificationWatchpointEvent)event);
|
||||
} else if (event instanceof MethodEntryEvent) {
|
||||
methodEntryEvent((MethodEntryEvent)event);
|
||||
} else if (event instanceof MethodExitEvent) {
|
||||
methodExitEvent((MethodExitEvent)event);
|
||||
} else if (event instanceof StepEvent) {
|
||||
stepEvent((StepEvent)event);
|
||||
} else if (event instanceof ThreadDeathEvent) {
|
||||
threadDeathEvent((ThreadDeathEvent)event);
|
||||
} else if (event instanceof ClassPrepareEvent) {
|
||||
classPrepareEvent((ClassPrepareEvent)event);
|
||||
} else if (event instanceof VMStartEvent) {
|
||||
vmStartEvent((VMStartEvent)event);
|
||||
} else if (event instanceof VMDeathEvent) {
|
||||
vmDeathEvent((VMDeathEvent)event);
|
||||
} else if (event instanceof VMDisconnectEvent) {
|
||||
vmDisconnectEvent((VMDisconnectEvent)event);
|
||||
} else {
|
||||
throw new Error("Unexpected event type");
|
||||
}
|
||||
}
|
||||
|
||||
/***
|
||||
* A VMDisconnectedException has happened while dealing with
|
||||
* another event. We need to flush the event queue, dealing only
|
||||
* with exit events (VMDeath, VMDisconnect) so that we terminate
|
||||
* correctly.
|
||||
*/
|
||||
synchronized void handleDisconnectedException() {
|
||||
EventQueue queue = vm.eventQueue();
|
||||
while (connected) {
|
||||
try {
|
||||
EventSet eventSet = queue.remove();
|
||||
EventIterator iter = eventSet.eventIterator();
|
||||
while (iter.hasNext()) {
|
||||
Event event = iter.nextEvent();
|
||||
if (event instanceof VMDeathEvent) {
|
||||
vmDeathEvent((VMDeathEvent)event);
|
||||
} else if (event instanceof VMDisconnectEvent) {
|
||||
vmDisconnectEvent((VMDisconnectEvent)event);
|
||||
}
|
||||
}
|
||||
eventSet.resume(); // Resume the VM
|
||||
} catch (InterruptedException exc) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void vmStartEvent(VMStartEvent event) {
|
||||
if (writer != null) writer.println("-- VM Started --");
|
||||
}
|
||||
|
||||
// Forward event for thread specific processing
|
||||
private void methodEntryEvent(MethodEntryEvent event) {
|
||||
threadTrace(event.thread()).methodEntryEvent(event);
|
||||
}
|
||||
|
||||
// Forward event for thread specific processing
|
||||
private void methodExitEvent(MethodExitEvent event) {
|
||||
threadTrace(event.thread()).methodExitEvent(event);
|
||||
}
|
||||
|
||||
// Forward event for thread specific processing
|
||||
private void stepEvent(StepEvent event) {
|
||||
threadTrace(event.thread()).stepEvent(event);
|
||||
}
|
||||
|
||||
// Forward event for thread specific processing
|
||||
private void fieldWatchEvent(ModificationWatchpointEvent event) {
|
||||
threadTrace(event.thread()).fieldWatchEvent(event);
|
||||
}
|
||||
|
||||
void threadDeathEvent(ThreadDeathEvent event) {
|
||||
ThreadTrace trace = (ThreadTrace)traceMap.get(event.thread());
|
||||
if (trace != null) { // only want threads we care about
|
||||
trace.threadDeathEvent(event); // Forward event
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A new class has been loaded.
|
||||
* Set watchpoints on each of its fields
|
||||
*/
|
||||
private void classPrepareEvent(ClassPrepareEvent event) {
|
||||
// System.out.println(event);
|
||||
// List list = event.referenceType().methodsByName("stop");
|
||||
// Object o = list.get(0);
|
||||
// System.out.println("stop methods = " + list);
|
||||
// System.out.println(o.getClass());
|
||||
|
||||
EventRequestManager mgr = vm.eventRequestManager();
|
||||
List fields = event.referenceType().visibleFields();
|
||||
for (Iterator it = fields.iterator(); it.hasNext(); ) {
|
||||
Field field = (Field)it.next();
|
||||
ModificationWatchpointRequest req =
|
||||
mgr.createModificationWatchpointRequest(field);
|
||||
for (int i=0; i<excludes.length; ++i) {
|
||||
req.addClassExclusionFilter(excludes[i]);
|
||||
}
|
||||
req.setSuspendPolicy(EventRequest.SUSPEND_NONE);
|
||||
req.enable();
|
||||
}
|
||||
}
|
||||
|
||||
private void exceptionEvent(ExceptionEvent event) {
|
||||
// com.sun.jdi.ObjectReference or = event.exception();
|
||||
// System.out.println("exceptionEvent() fired " + or);
|
||||
// System.out.println("catch location " + event.catchLocation());
|
||||
|
||||
parent.exception(event);
|
||||
|
||||
/*
|
||||
ObjectReference or = event.exception();
|
||||
ThreadReference thread = event.thread();
|
||||
ThreadTrace trace = (ThreadTrace)traceMap.get(thread);
|
||||
if (trace != null) { // only want threads we care about
|
||||
trace.exceptionEvent(event); // Forward event
|
||||
}
|
||||
try {
|
||||
List frames = thread.frames();
|
||||
for (Object item : frames) {
|
||||
System.out.println("got " + item);
|
||||
}
|
||||
//System.out.println(frames);
|
||||
} catch (IncompatibleThreadStateException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
public void vmDeathEvent(VMDeathEvent event) {
|
||||
//System.err.println("vm is dead! dead!");
|
||||
vmDied = true;
|
||||
if (writer != null) {
|
||||
writer.println("-- The application exited --");
|
||||
}
|
||||
}
|
||||
|
||||
public void vmDisconnectEvent(VMDisconnectEvent event) {
|
||||
connected = false;
|
||||
if (!vmDied) {
|
||||
if (writer != null) {
|
||||
writer.println("-- The application has been disconnected --");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -29,7 +29,7 @@ import java.io.*;
|
||||
/**
|
||||
* Slurps up messages from compiler.
|
||||
*/
|
||||
class MessageSiphon implements Runnable {
|
||||
public class MessageSiphon implements Runnable {
|
||||
BufferedReader streamReader;
|
||||
Thread thread;
|
||||
MessageConsumer consumer;
|
||||
@ -84,4 +84,9 @@ class MessageSiphon implements Runnable {
|
||||
thread = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public Thread getThread() {
|
||||
return thread;
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -37,10 +37,18 @@ public class RunnerException extends Exception /*RuntimeException*/ {
|
||||
|
||||
|
||||
public RunnerException(String message) {
|
||||
this(message, -1, -1, -1, true);
|
||||
this(message, true);
|
||||
}
|
||||
|
||||
public RunnerException(String message, boolean showStackTrace) {
|
||||
this(message, -1, -1, -1, showStackTrace);
|
||||
}
|
||||
|
||||
public RunnerException(String message, int file, int line) {
|
||||
this(message, file, line, -1, true);
|
||||
}
|
||||
|
||||
|
||||
public RunnerException(String message, int file, int line, int column) {
|
||||
this(message, file, line, column, true);
|
||||
}
|
||||
|
@ -28,4 +28,6 @@ public interface RunnerListener {
|
||||
public void statusError(String message);
|
||||
|
||||
public void statusError(Exception exception);
|
||||
|
||||
public void statusNotice(String message);
|
||||
}
|
@ -1,84 +0,0 @@
|
||||
/*
|
||||
* @(#)StreamRedirectThread.java 1.4 03/01/23
|
||||
*
|
||||
* Copyright 2003 Sun Microsystems, Inc. All rights reserved.
|
||||
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 1997-2001 by Sun Microsystems, Inc. All Rights Reserved.
|
||||
*
|
||||
* Sun grants you ("Licensee") a non-exclusive, royalty free, license to use,
|
||||
* modify and redistribute this software in source and binary code form,
|
||||
* provided that i) this copyright notice and license appear on all copies of
|
||||
* the software; and ii) Licensee does not utilize the software in a manner
|
||||
* which is disparaging to Sun.
|
||||
*
|
||||
* This software is provided "AS IS," without a warranty of any kind. ALL
|
||||
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY
|
||||
* IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
|
||||
* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN AND ITS LICENSORS SHALL NOT BE
|
||||
* LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
|
||||
* OR DISTRIBUTING THE SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR ITS
|
||||
* LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT,
|
||||
* INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER
|
||||
* CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF
|
||||
* OR INABILITY TO USE SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* This software is not designed or intended for use in on-line control of
|
||||
* aircraft, air traffic, aircraft navigation or aircraft communications; or in
|
||||
* the design, construction, operation or maintenance of any nuclear
|
||||
* facility. Licensee represents and warrants that it will not use or
|
||||
* redistribute the Software for such purposes.
|
||||
*/
|
||||
package processing.app.debug;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
/**
|
||||
* StreamRedirectThread is a thread which copies it's input to
|
||||
* it's output and terminates when it completes.
|
||||
*
|
||||
* @version @(#) StreamRedirectThread.java 1.4 03/01/23 23:33:38
|
||||
* @author Robert Field
|
||||
*/
|
||||
public class StreamRedirectThread extends Thread {
|
||||
|
||||
private final Reader in;
|
||||
private final Writer out;
|
||||
|
||||
private static final int BUFFER_SIZE = 2048;
|
||||
|
||||
/**
|
||||
* Set up for copy.
|
||||
* @param name Name of the thread
|
||||
* @param in Stream to copy from
|
||||
* @param out Stream to copy to
|
||||
*/
|
||||
public StreamRedirectThread(String name, InputStream in, OutputStream out) {
|
||||
super(name);
|
||||
this.in = new InputStreamReader(in);
|
||||
this.out = new OutputStreamWriter(out);
|
||||
setPriority(Thread.MAX_PRIORITY-1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy.
|
||||
*/
|
||||
public void run() {
|
||||
try {
|
||||
char[] cbuf = new char[BUFFER_SIZE];
|
||||
int count;
|
||||
//System.out.println("opening streamredirectthread");
|
||||
while ((count = in.read(cbuf, 0, BUFFER_SIZE)) >= 0) {
|
||||
out.write(cbuf, 0, count);
|
||||
// had to add the flush() here.. maybe shouldn't be using writer? [fry]
|
||||
out.flush();
|
||||
}
|
||||
//System.out.println("exiting streamredirectthread");
|
||||
out.flush();
|
||||
} catch(IOException exc) {
|
||||
System.err.println("Child I/O Transfer - " + exc);
|
||||
}
|
||||
}
|
||||
}
|
@ -67,10 +67,18 @@ public class Platform extends processing.app.Platform {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Attempt to use xdg-open
|
||||
try {
|
||||
Process p = Runtime.getRuntime().exec(new String[] { "xdg-open" });
|
||||
p.waitFor();
|
||||
Preferences.set("launcher", "xdg-open");
|
||||
return true;
|
||||
} catch (Exception e) { }
|
||||
|
||||
// Attempt to use gnome-open
|
||||
try {
|
||||
Process p = Runtime.getRuntime().exec(new String[] { "gnome-open" });
|
||||
/*int result =*/ p.waitFor();
|
||||
p.waitFor();
|
||||
// Not installed will throw an IOException (JDK 1.4.2, Ubuntu 7.04)
|
||||
Preferences.set("launcher", "gnome-open");
|
||||
return true;
|
||||
@ -79,7 +87,7 @@ public class Platform extends processing.app.Platform {
|
||||
// Attempt with kde-open
|
||||
try {
|
||||
Process p = Runtime.getRuntime().exec(new String[] { "kde-open" });
|
||||
/*int result =*/ p.waitFor();
|
||||
p.waitFor();
|
||||
Preferences.set("launcher", "kde-open");
|
||||
return true;
|
||||
} catch (Exception e) { }
|
||||
@ -100,7 +108,8 @@ public class Platform extends processing.app.Platform {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
System.out.println("not available");
|
||||
System.out.println("No launcher set, cannot open " +
|
||||
file.getAbsolutePath());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -25,12 +25,15 @@ package processing.app.macosx;
|
||||
import java.awt.Insets;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.URI;
|
||||
|
||||
import javax.swing.UIManager;
|
||||
|
||||
import com.apple.eio.FileManager;
|
||||
|
||||
import processing.app.Base;
|
||||
import processing.core.PApplet;
|
||||
|
||||
|
||||
/**
|
||||
@ -103,36 +106,45 @@ public class Platform extends processing.app.Platform {
|
||||
|
||||
|
||||
public void openURL(String url) throws Exception {
|
||||
if (!url.startsWith("http://")) {
|
||||
if (PApplet.javaVersion < 1.6f) {
|
||||
if (url.startsWith("http://")) {
|
||||
// formerly com.apple.eio.FileManager.openURL(url);
|
||||
// but due to deprecation, instead loading dynamically
|
||||
try {
|
||||
Class<?> eieio = Class.forName("com.apple.eio.FileManager");
|
||||
Method openMethod =
|
||||
eieio.getMethod("openURL", new Class[] { String.class });
|
||||
openMethod.invoke(null, new Object[] { url });
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
// Assume this is a file instead, and just open it.
|
||||
// Extension of http://dev.processing.org/bugs/show_bug.cgi?id=1010
|
||||
processing.core.PApplet.open(url);
|
||||
|
||||
/*
|
||||
// prepend file:// on this guy since it's a file
|
||||
url = "file://" + url;
|
||||
|
||||
// replace spaces with %20 for the file url
|
||||
// otherwise the mac doesn't like to open it
|
||||
// can't just use URLEncoder, since that makes slashes into
|
||||
// %2F characters, which is no good. some might say "useless"
|
||||
if (url.indexOf(' ') != -1) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
char c[] = url.toCharArray();
|
||||
for (int i = 0; i < c.length; i++) {
|
||||
if (c[i] == ' ') {
|
||||
sb.append("%20");
|
||||
} else {
|
||||
sb.append(c[i]);
|
||||
}
|
||||
}
|
||||
url = sb.toString();
|
||||
}
|
||||
*/
|
||||
} else {
|
||||
try {
|
||||
Class<?> desktopClass = Class.forName("java.awt.Desktop");
|
||||
Method getMethod = desktopClass.getMethod("getDesktop");
|
||||
Object desktop = getMethod.invoke(null, new Object[] { });
|
||||
|
||||
// for Java 1.6, replacing with java.awt.Desktop.browse()
|
||||
// and java.awt.Desktop.open()
|
||||
if (url.startsWith("http://")) { // browse to a location
|
||||
Method browseMethod =
|
||||
desktopClass.getMethod("browse", new Class[] { URI.class });
|
||||
browseMethod.invoke(desktop, new Object[] { new URI(url) });
|
||||
} else { // open a file
|
||||
Method openMethod =
|
||||
desktopClass.getMethod("open", new Class[] { File.class });
|
||||
openMethod.invoke(desktop, new Object[] { new File(url) });
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
// for Java 1.6, replace with java.awt.Desktop.browse() and java.awt.Desktop.open()
|
||||
com.apple.eio.FileManager.openURL(url);
|
||||
}
|
||||
|
||||
|
||||
public boolean openFolderAvailable() {
|
||||
|
@ -50,7 +50,8 @@ public class ThinkDifferent implements ApplicationListener {
|
||||
|
||||
static protected void init(Base base) {
|
||||
if (application == null) {
|
||||
application = new com.apple.eawt.Application();
|
||||
//application = new com.apple.eawt.Application();
|
||||
application = com.apple.eawt.Application.getApplication();
|
||||
}
|
||||
if (adapter == null) {
|
||||
adapter = new ThinkDifferent(base);
|
||||
|
@ -51,15 +51,9 @@ public class PdePreprocessor {
|
||||
|
||||
List prototypes;
|
||||
|
||||
|
||||
|
||||
|
||||
String[] defaultImports;
|
||||
|
||||
// these ones have the .* at the end, since a class name might be at the end
|
||||
// instead of .* which would make trouble other classes using this can lop
|
||||
// off the . and anything after it to produce a package name consistently.
|
||||
//public String extraImports[];
|
||||
ArrayList<String> programImports;
|
||||
|
||||
// imports just from the code folder, treated differently
|
||||
@ -71,24 +65,24 @@ public class PdePreprocessor {
|
||||
PrintStream stream;
|
||||
String program;
|
||||
String buildPath;
|
||||
// starts as sketch name, ends as main class name
|
||||
String name;
|
||||
|
||||
|
||||
/**
|
||||
* Setup a new preprocessor.
|
||||
*/
|
||||
public PdePreprocessor() { }
|
||||
|
||||
public int writePrefix(String program, String buildPath,
|
||||
String name, String codeFolderPackages[])
|
||||
throws FileNotFoundException {
|
||||
this.buildPath = buildPath;
|
||||
this.name = name;
|
||||
|
||||
public PdePreprocessor() {
|
||||
int tabSize = Preferences.getInteger("editor.tabs.size");
|
||||
char[] indentChars = new char[tabSize];
|
||||
Arrays.fill(indentChars, ' ');
|
||||
indent = new String(indentChars);
|
||||
}
|
||||
|
||||
public int writePrefix(String program, String buildPath,
|
||||
String sketchName, String codeFolderPackages[]) throws FileNotFoundException {
|
||||
this.buildPath = buildPath;
|
||||
this.name = sketchName;
|
||||
|
||||
// if the program ends with no CR or LF an OutOfMemoryError will happen.
|
||||
// not gonna track down the bug now, so here's a hack for it:
|
||||
@ -99,52 +93,13 @@ public class PdePreprocessor {
|
||||
// an OutOfMemoryError or NullPointerException will happen.
|
||||
// again, not gonna bother tracking this down, but here's a hack.
|
||||
// http://dev.processing.org/bugs/show_bug.cgi?id=16
|
||||
Sketch.scrubComments(program);
|
||||
// this returns the scrubbed version, but more important for this
|
||||
// function, it'll check to see if there are errors with the comments.
|
||||
String scrubbed = Sketch.scrubComments(program);
|
||||
// If there are errors, an exception is thrown and this fxn exits.
|
||||
|
||||
if (Preferences.getBoolean("preproc.substitute_unicode")) {
|
||||
// check for non-ascii chars (these will be/must be in unicode format)
|
||||
char p[] = program.toCharArray();
|
||||
int unicodeCount = 0;
|
||||
for (int i = 0; i < p.length; i++) {
|
||||
if (p[i] > 127) unicodeCount++;
|
||||
}
|
||||
// if non-ascii chars are in there, convert to unicode escapes
|
||||
if (unicodeCount != 0) {
|
||||
// add unicodeCount * 5.. replacing each unicode char
|
||||
// with six digit uXXXX sequence (xxxx is in hex)
|
||||
// (except for nbsp chars which will be a replaced with a space)
|
||||
int index = 0;
|
||||
char p2[] = new char[p.length + unicodeCount*5];
|
||||
for (int i = 0; i < p.length; i++) {
|
||||
if (p[i] < 128) {
|
||||
p2[index++] = p[i];
|
||||
|
||||
} else if (p[i] == 160) { // unicode for non-breaking space
|
||||
p2[index++] = ' ';
|
||||
|
||||
} else {
|
||||
int c = p[i];
|
||||
p2[index++] = '\\';
|
||||
p2[index++] = 'u';
|
||||
char str[] = Integer.toHexString(c).toCharArray();
|
||||
// add leading zeros, so that the length is 4
|
||||
//for (int i = 0; i < 4 - str.length; i++) p2[index++] = '0';
|
||||
for (int m = 0; m < 4 - str.length; m++) p2[index++] = '0';
|
||||
System.arraycopy(str, 0, p2, index, str.length);
|
||||
index += str.length;
|
||||
}
|
||||
}
|
||||
program = new String(p2, 0, index);
|
||||
}
|
||||
program = substituteUnicode(program);
|
||||
}
|
||||
|
||||
// These may change in-between (if the prefs panel adds this option)
|
||||
// so grab them here on construction.
|
||||
String prefsLine = Preferences.get("preproc.imports");
|
||||
defaultImports = PApplet.splitTokens(prefsLine, ", ");
|
||||
|
||||
//String importRegexp = "(?:^|\\s|;)(import\\s+)(\\S+)(\\s*;)";
|
||||
String importRegexp = "^\\s*#include\\s+[<\"](\\S+)[\">]";
|
||||
programImports = new ArrayList<String>();
|
||||
@ -184,8 +139,47 @@ public class PdePreprocessor {
|
||||
return headerCount + prototypeCount;
|
||||
}
|
||||
|
||||
|
||||
static String substituteUnicode(String program) {
|
||||
// check for non-ascii chars (these will be/must be in unicode format)
|
||||
char p[] = program.toCharArray();
|
||||
int unicodeCount = 0;
|
||||
for (int i = 0; i < p.length; i++) {
|
||||
if (p[i] > 127) unicodeCount++;
|
||||
}
|
||||
// if non-ascii chars are in there, convert to unicode escapes
|
||||
if (unicodeCount != 0) {
|
||||
// add unicodeCount * 5.. replacing each unicode char
|
||||
// with six digit uXXXX sequence (xxxx is in hex)
|
||||
// (except for nbsp chars which will be a replaced with a space)
|
||||
int index = 0;
|
||||
char p2[] = new char[p.length + unicodeCount*5];
|
||||
for (int i = 0; i < p.length; i++) {
|
||||
if (p[i] < 128) {
|
||||
p2[index++] = p[i];
|
||||
|
||||
} else if (p[i] == 160) { // unicode for non-breaking space
|
||||
p2[index++] = ' ';
|
||||
|
||||
} else {
|
||||
int c = p[i];
|
||||
p2[index++] = '\\';
|
||||
p2[index++] = 'u';
|
||||
char str[] = Integer.toHexString(c).toCharArray();
|
||||
// add leading zeros, so that the length is 4
|
||||
//for (int i = 0; i < 4 - str.length; i++) p2[index++] = '0';
|
||||
for (int m = 0; m < 4 - str.length; m++) p2[index++] = '0';
|
||||
System.arraycopy(str, 0, p2, index, str.length);
|
||||
index += str.length;
|
||||
}
|
||||
}
|
||||
program = new String(p2, 0, index);
|
||||
}
|
||||
return program;
|
||||
}
|
||||
|
||||
/**
|
||||
* preprocesses a pde file and write out a java file
|
||||
* preprocesses a pde file and writes out a java file
|
||||
* @return the classname of the exported Java
|
||||
*/
|
||||
//public String write(String program, String buildPath, String name,
|
||||
|
@ -24,7 +24,7 @@ import java.util.*;
|
||||
* to the implementations of this class to do so.
|
||||
*
|
||||
* @author Slava Pestov
|
||||
* @version $Id: InputHandler.java 4168 2008-08-09 17:24:37Z fry $
|
||||
* @version $Id: InputHandler.java 6126 2010-02-16 23:43:53Z fry $
|
||||
*/
|
||||
public abstract class InputHandler extends KeyAdapter
|
||||
{
|
||||
@ -70,6 +70,9 @@ public abstract class InputHandler extends KeyAdapter
|
||||
public static final ActionListener SELECT_PREV_WORD = new prev_word(true);
|
||||
public static final ActionListener REPEAT = new repeat();
|
||||
public static final ActionListener TOGGLE_RECT = new toggle_rect();
|
||||
public static final ActionListener CLIPBOARD_CUT = new clipboard_cut(); // [fry]
|
||||
public static final ActionListener CLIPBOARD_COPY = new clipboard_copy();
|
||||
public static final ActionListener CLIPBOARD_PASTE = new clipboard_paste();
|
||||
|
||||
// Default action
|
||||
public static final ActionListener INSERT_CHAR = new insert_char();
|
||||
@ -113,6 +116,9 @@ public abstract class InputHandler extends KeyAdapter
|
||||
actions.put("repeat",REPEAT);
|
||||
actions.put("toggle-rect",TOGGLE_RECT);
|
||||
actions.put("insert-char",INSERT_CHAR);
|
||||
actions.put("clipboard-cut",CLIPBOARD_CUT);
|
||||
actions.put("clipboard-copy",CLIPBOARD_COPY);
|
||||
actions.put("clipboard-paste",CLIPBOARD_PASTE);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1077,6 +1083,34 @@ public abstract class InputHandler extends KeyAdapter
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static class clipboard_cut implements ActionListener
|
||||
{
|
||||
public void actionPerformed(ActionEvent evt)
|
||||
{
|
||||
getTextArea(evt).cut();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static class clipboard_copy implements ActionListener
|
||||
{
|
||||
public void actionPerformed(ActionEvent evt)
|
||||
{
|
||||
getTextArea(evt).copy();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static class clipboard_paste implements ActionListener
|
||||
{
|
||||
public void actionPerformed(ActionEvent evt)
|
||||
{
|
||||
getTextArea(evt).paste();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static class insert_char implements ActionListener,
|
||||
InputHandler.NonRepeatable
|
||||
{
|
||||
|
@ -22,6 +22,9 @@ import java.awt.event.*;
|
||||
import java.awt.*;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Vector;
|
||||
import java.awt.im.InputMethodRequests;
|
||||
|
||||
import processing.app.syntax.im.InputMethodSupport;
|
||||
|
||||
/**
|
||||
* jEdit's text area component. It is more suited for editing program
|
||||
@ -51,7 +54,7 @@ import java.util.Vector;
|
||||
* + "}");</pre>
|
||||
*
|
||||
* @author Slava Pestov
|
||||
* @version $Id: JEditTextArea.java 5625 2009-06-07 21:08:59Z fry $
|
||||
* @version $Id: JEditTextArea.java 6123 2010-02-16 21:43:44Z fry $
|
||||
*/
|
||||
public class JEditTextArea extends JComponent
|
||||
{
|
||||
@ -127,6 +130,16 @@ public class JEditTextArea extends JComponent
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Inline Input Method Support for Japanese.
|
||||
*/
|
||||
private InputMethodSupport inputMethodSupport = null;
|
||||
public InputMethodRequests getInputMethodRequests() {
|
||||
if (inputMethodSupport == null) {
|
||||
inputMethodSupport = new InputMethodSupport(this);
|
||||
}
|
||||
return inputMethodSupport;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get current position of the vertical scroll bar. [fry]
|
||||
|
@ -34,18 +34,22 @@ public class PdeTextAreaDefaults extends TextAreaDefaults {
|
||||
inputHandler = new DefaultInputHandler();
|
||||
//inputHandler.addDefaultKeyBindings(); // 0122
|
||||
|
||||
// use option on mac for things that are ctrl on windows/linux
|
||||
// use option on mac for text edit controls that are ctrl on windows/linux
|
||||
String mod = Base.isMacOS() ? "A" : "C";
|
||||
|
||||
// right now, ctrl-up/down is select up/down, but mod should be
|
||||
// used instead, because the mac expects it to be option(alt)
|
||||
|
||||
inputHandler.addKeyBinding("BACK_SPACE", InputHandler.BACKSPACE);
|
||||
// for 0122, shift-backspace is delete, for 0176, it's now a preference,
|
||||
// to prevent holy warriors from attacking me for it.
|
||||
if (Preferences.getBoolean("editor.keys.shift_backspace_is_delete")) {
|
||||
inputHandler.addKeyBinding("S+BACK_SPACE", InputHandler.DELETE);
|
||||
} else {
|
||||
inputHandler.addKeyBinding("S+BACK_SPACE", InputHandler.BACKSPACE);
|
||||
}
|
||||
|
||||
inputHandler.addKeyBinding("DELETE", InputHandler.DELETE);
|
||||
|
||||
//inputHandler.addKeyBinding("S+BACK_SPACE", InputHandler.BACKSPACE);
|
||||
// for 0122, shift-backspace is delete
|
||||
inputHandler.addKeyBinding("S+BACK_SPACE", InputHandler.DELETE);
|
||||
inputHandler.addKeyBinding("S+DELETE", InputHandler.DELETE);
|
||||
|
||||
// the following two were changing for 0122 for better mac/pc compatability
|
||||
@ -57,12 +61,23 @@ public class PdeTextAreaDefaults extends TextAreaDefaults {
|
||||
//inputHandler.addKeyBinding("TAB", InputHandler.INSERT_TAB);
|
||||
|
||||
inputHandler.addKeyBinding("INSERT", InputHandler.OVERWRITE);
|
||||
|
||||
// http://dev.processing.org/bugs/show_bug.cgi?id=162
|
||||
// added for 0176, though the bindings do not appear relevant for osx
|
||||
if (Preferences.getBoolean("editor.keys.alternative_cut_copy_paste")) {
|
||||
inputHandler.addKeyBinding("C+INSERT", InputHandler.CLIPBOARD_COPY);
|
||||
inputHandler.addKeyBinding("S+INSERT", InputHandler.CLIPBOARD_PASTE);
|
||||
inputHandler.addKeyBinding("S+DELETE", InputHandler.CLIPBOARD_CUT);
|
||||
}
|
||||
|
||||
// disabling for 0122, not sure what this does
|
||||
//inputHandler.addKeyBinding("C+\\", InputHandler.TOGGLE_RECT);
|
||||
|
||||
// for 0122, these have been changed for better compatability
|
||||
// for 0122, these have been changed for better compatibility
|
||||
// HOME and END now mean the beginning/end of the document
|
||||
if (Base.isMacOS()) {
|
||||
// for 0176 changed this to a preference so that the Mac OS X people
|
||||
// can get the "normal" behavior as well if they prefer.
|
||||
if (Preferences.getBoolean("editor.keys.home_and_end_travel_far")) {
|
||||
inputHandler.addKeyBinding("HOME", InputHandler.DOCUMENT_HOME);
|
||||
inputHandler.addKeyBinding("END", InputHandler.DOCUMENT_END);
|
||||
inputHandler.addKeyBinding("S+HOME", InputHandler.SELECT_DOC_HOME);
|
||||
|
@ -12,6 +12,7 @@
|
||||
package processing.app.syntax;
|
||||
|
||||
import processing.app.*;
|
||||
import processing.app.syntax.im.CompositionTextPainter;
|
||||
|
||||
import javax.swing.ToolTipManager;
|
||||
import javax.swing.text.*;
|
||||
@ -33,6 +34,9 @@ implements TabExpander, Printable
|
||||
/** Current setting for editor.antialias preference */
|
||||
boolean antialias;
|
||||
|
||||
/** A specific painter composed by the InputMethod.*/
|
||||
protected CompositionTextPainter compositionTextPainter;
|
||||
|
||||
/**
|
||||
* Creates a new repaint manager. This should be not be called
|
||||
* directly.
|
||||
@ -73,6 +77,16 @@ implements TabExpander, Printable
|
||||
eolMarkers = defaults.eolMarkers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get CompositionTextPainter. if CompositionTextPainter is not created, create it.
|
||||
*/
|
||||
public CompositionTextPainter getCompositionTextpainter(){
|
||||
if(compositionTextPainter == null){
|
||||
compositionTextPainter = new CompositionTextPainter(textArea);
|
||||
}
|
||||
return compositionTextPainter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if this component can be traversed by pressing the
|
||||
* Tab key. This returns false.
|
||||
@ -602,7 +616,12 @@ implements TabExpander, Printable
|
||||
|
||||
y += fm.getHeight();
|
||||
x = Utilities.drawTabbedText(currentLine,x,y,gfx,this,0);
|
||||
|
||||
/*
|
||||
* Draw characters via input method.
|
||||
*/
|
||||
if (compositionTextPainter != null && compositionTextPainter.hasComposedTextLayout()) {
|
||||
compositionTextPainter.draw(gfx, lineHighlightColor);
|
||||
}
|
||||
if (eolMarkers) {
|
||||
gfx.setColor(eolMarkerColor);
|
||||
gfx.drawString(".",x,y);
|
||||
@ -625,7 +644,12 @@ implements TabExpander, Printable
|
||||
x = SyntaxUtilities.paintSyntaxLine(currentLine,
|
||||
currentLineTokens,
|
||||
styles, this, gfx, x, y);
|
||||
|
||||
/*
|
||||
* Draw characters via input method.
|
||||
*/
|
||||
if (compositionTextPainter != null && compositionTextPainter.hasComposedTextLayout()) {
|
||||
compositionTextPainter.draw(gfx, lineHighlightColor);
|
||||
}
|
||||
if (eolMarkers) {
|
||||
gfx.setColor(eolMarkerColor);
|
||||
gfx.drawString(".",x,y);
|
||||
|
187
app/src/processing/app/syntax/im/CompositionTextManager.java
Normal file
187
app/src/processing/app/syntax/im/CompositionTextManager.java
Normal file
@ -0,0 +1,187 @@
|
||||
package processing.app.syntax.im;
|
||||
|
||||
import java.awt.Font;
|
||||
import java.awt.FontMetrics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Point;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.font.FontRenderContext;
|
||||
import java.awt.font.TextAttribute;
|
||||
import java.awt.font.TextLayout;
|
||||
import java.text.AttributedCharacterIterator;
|
||||
import java.text.AttributedString;
|
||||
|
||||
import javax.swing.text.BadLocationException;
|
||||
|
||||
import processing.app.syntax.JEditTextArea;
|
||||
import processing.app.syntax.TextAreaPainter;
|
||||
|
||||
/**
|
||||
* This class Manage texts from input method
|
||||
* by begin-process-end steps.
|
||||
*
|
||||
* First, if a user start inputing via input method,
|
||||
* beginCompositionText is called from InputMethodSupport.
|
||||
* Second, the user continues from input method, processCompositionText is called
|
||||
* and reflect user inputs to text area.
|
||||
* Finally the user try to commit text, endCompositionText is called.
|
||||
*
|
||||
* @author Takashi Maekawa (takachin@generative.info)
|
||||
*/
|
||||
|
||||
public class CompositionTextManager {
|
||||
private JEditTextArea textArea;
|
||||
private String prevComposeString;
|
||||
private int prevCommittedCount;
|
||||
private boolean isInputProcess;
|
||||
private int initialCaretPosition;
|
||||
public static final int COMPOSING_UNDERBAR_HEIGHT = 5;
|
||||
|
||||
/**
|
||||
* Create text manager class with a textarea.
|
||||
* @param textArea texarea component for PDE.
|
||||
*/
|
||||
public CompositionTextManager(JEditTextArea textArea) {
|
||||
this.textArea = textArea;
|
||||
prevComposeString = "";
|
||||
isInputProcess = false;
|
||||
prevCommittedCount = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get this text manager is whether in input process or not.
|
||||
*/
|
||||
public boolean getIsInputProcess() {
|
||||
return isInputProcess;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a user begins input from input method.
|
||||
* This method initializes text manager.
|
||||
*
|
||||
* @param text Text from InputMethodEvent.
|
||||
* @param commited_count Numbers of committed characters in text.
|
||||
*/
|
||||
public void beginCompositionText(AttributedCharacterIterator text, int committed_count) {
|
||||
isInputProcess = true;
|
||||
prevComposeString = "";
|
||||
initialCaretPosition = textArea.getCaretPosition();
|
||||
processCompositionText(text, committed_count);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a user processing input characters and
|
||||
* select candidates from input method.
|
||||
*
|
||||
* @param text Text from InputMethodEvent.
|
||||
* @param commited_count Numbers of committed characters in text.
|
||||
*/
|
||||
public void processCompositionText(AttributedCharacterIterator text, int committed_count) {
|
||||
int layoutCaretPosition = initialCaretPosition + committed_count;
|
||||
CompositionTextPainter compositionPainter = textArea.getPainter().getCompositionTextpainter();
|
||||
compositionPainter.setComposedTextLayout(getTextLayout(text, committed_count), layoutCaretPosition);
|
||||
int textLength = text.getEndIndex() - text.getBeginIndex() - committed_count;
|
||||
StringBuffer unCommitedStringBuf = new StringBuffer(textLength);
|
||||
char c;
|
||||
for (c = text.setIndex(committed_count); c != AttributedCharacterIterator.DONE
|
||||
&& textLength > 0; c = text.next(), --textLength) {
|
||||
unCommitedStringBuf.append(c);
|
||||
}
|
||||
String unCommittedString = unCommitedStringBuf.toString();
|
||||
try {
|
||||
if(canRemovePreviousInput(committed_count)){
|
||||
textArea.getDocument().remove(layoutCaretPosition, prevComposeString.length());
|
||||
}
|
||||
textArea.getDocument().insertString(layoutCaretPosition, unCommittedString, null);
|
||||
if(committed_count > 0){
|
||||
initialCaretPosition = initialCaretPosition + committed_count;
|
||||
}
|
||||
prevComposeString = unCommittedString;
|
||||
prevCommittedCount = committed_count;
|
||||
} catch (BadLocationException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private boolean canRemovePreviousInput(int committed_count){
|
||||
return (prevCommittedCount == committed_count || prevCommittedCount > committed_count);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a user fixed text from input method or delete all
|
||||
* composition text. This method resets CompositionTextPainter.
|
||||
*
|
||||
* @param text Text from InputMethodEvent.
|
||||
* @param commited_count Numbers of committed characters in text.
|
||||
*/
|
||||
public void endCompositionText(AttributedCharacterIterator text, int committed_count) {
|
||||
isInputProcess = false;
|
||||
/*
|
||||
* If there are no committed characters, remove it all from textarea.
|
||||
* This case will happen if a user delete all composing characters by backspace or delete key.
|
||||
* If it does, these previous characters are needed to be deleted.
|
||||
*/
|
||||
if(committed_count == 0){
|
||||
removeNotCommittedText(text);
|
||||
}
|
||||
CompositionTextPainter compositionPainter = textArea.getPainter().getCompositionTextpainter();
|
||||
compositionPainter.invalidateComposedTextLayout(initialCaretPosition + committed_count);
|
||||
prevComposeString = "";
|
||||
isInputProcess = false;
|
||||
}
|
||||
|
||||
private void removeNotCommittedText(AttributedCharacterIterator text){
|
||||
if (prevComposeString.length() == 0) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
textArea.getDocument().remove(initialCaretPosition, prevComposeString.length());
|
||||
} catch (BadLocationException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private TextLayout getTextLayout(AttributedCharacterIterator text, int committed_count) {
|
||||
AttributedString composed = new AttributedString(text, committed_count, text.getEndIndex());
|
||||
Font font = textArea.getPainter().getFont();
|
||||
FontRenderContext context = ((Graphics2D) (textArea.getPainter().getGraphics())).getFontRenderContext();
|
||||
composed.addAttribute(TextAttribute.FONT, font);
|
||||
TextLayout layout = new TextLayout(composed.getIterator(), context);
|
||||
return layout;
|
||||
}
|
||||
|
||||
private Point getCaretLocation() {
|
||||
Point loc = new Point();
|
||||
TextAreaPainter painter = textArea.getPainter();
|
||||
FontMetrics fm = painter.getFontMetrics();
|
||||
int offsetY = fm.getHeight() - COMPOSING_UNDERBAR_HEIGHT;
|
||||
int lineIndex = textArea.getCaretLine();
|
||||
loc.y = lineIndex * fm.getHeight() + offsetY;
|
||||
int offsetX = textArea.getCaretPosition()
|
||||
- textArea.getLineStartOffset(lineIndex);
|
||||
loc.x = textArea.offsetToX(lineIndex, offsetX);
|
||||
return loc;
|
||||
}
|
||||
|
||||
public Rectangle getTextLocation() {
|
||||
Point caret = getCaretLocation();
|
||||
return getCaretRectangle(caret.x, caret.y);
|
||||
}
|
||||
|
||||
private Rectangle getCaretRectangle(int x, int y) {
|
||||
TextAreaPainter painter = textArea.getPainter();
|
||||
Point origin = painter.getLocationOnScreen();
|
||||
int height = painter.getFontMetrics().getHeight();
|
||||
return new Rectangle(origin.x + x, origin.y + y, 0, height);
|
||||
}
|
||||
|
||||
public AttributedCharacterIterator getCommittedText(int beginIndex, int endIndex) {
|
||||
int length = endIndex - beginIndex;
|
||||
String textAreaString = textArea.getText(beginIndex, length);
|
||||
return new AttributedString(textAreaString).getIterator();
|
||||
}
|
||||
|
||||
public int getInsertPositionOffset() {
|
||||
return textArea.getCaretPosition() * -1;
|
||||
}
|
||||
}
|
124
app/src/processing/app/syntax/im/CompositionTextPainter.java
Normal file
124
app/src/processing/app/syntax/im/CompositionTextPainter.java
Normal file
@ -0,0 +1,124 @@
|
||||
package processing.app.syntax.im;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.FontMetrics;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Point;
|
||||
import java.awt.font.TextLayout;
|
||||
|
||||
import processing.app.syntax.JEditTextArea;
|
||||
import processing.app.syntax.TextAreaPainter;
|
||||
|
||||
/**
|
||||
* Paint texts from input method. Text via input method are transmitted by
|
||||
* AttributedCaharacterIterator. This class helps the PDE's TextAreaPainter
|
||||
* to handle AttributedCaharacterIterator.
|
||||
*
|
||||
* For practical purposes, paint to textarea is done by TextLayout class.
|
||||
* Because TextLayout class is easy to draw composing texts. (For example,
|
||||
* draw underline composing texts, focus when select from candidates text.)
|
||||
*
|
||||
* @author Takashi Maekawa (takachin@generative.info)
|
||||
*/
|
||||
public class CompositionTextPainter {
|
||||
private TextLayout composedTextLayout;
|
||||
private int composedBeginCaretPosition = 0;
|
||||
private JEditTextArea textArea;
|
||||
|
||||
/**
|
||||
* Constructor for painter.
|
||||
* @param textarea textarea used by PDE.
|
||||
*/
|
||||
public CompositionTextPainter(JEditTextArea textArea) {
|
||||
this.textArea = textArea;
|
||||
composedTextLayout = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check the painter has TextLayout.
|
||||
* If a user input via InputMethod, this result will return true.
|
||||
* @param textarea textarea used by PDE.
|
||||
*/
|
||||
public boolean hasComposedTextLayout() {
|
||||
return (composedTextLayout != null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set TextLayout to the painter.
|
||||
* TextLayout will be created and set by CompositionTextManager.
|
||||
*
|
||||
* @see CompositionTextManager
|
||||
* @param textarea textarea used by PDE.
|
||||
*/
|
||||
public void setComposedTextLayout(TextLayout composedTextLayout, int composedStartCaretPosition) {
|
||||
this.composedTextLayout = composedTextLayout;
|
||||
this.composedBeginCaretPosition = composedStartCaretPosition;
|
||||
}
|
||||
|
||||
/**
|
||||
* Invalidate this TextLayout to set null.
|
||||
* If a user end input via InputMethod, this method will called from CompositionTextManager.endCompositionText
|
||||
*/
|
||||
public void invalidateComposedTextLayout(int composedEndCaretPosition) {
|
||||
this.composedTextLayout = null;
|
||||
this.composedBeginCaretPosition = composedEndCaretPosition;
|
||||
//this.composedBeginCaretPosition = textArea.getCaretPosition();
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw text via input method with composed text information.
|
||||
* This method can draw texts with some underlines to illustrate converting characters.
|
||||
*
|
||||
* This method is workaround for TextAreaPainter.
|
||||
* Because, TextAreaPainter can't treat AttributedCharacterIterator directly.
|
||||
* AttributedCharacterIterator has very important information when composing text.
|
||||
* It has a map where are converted characters and committed characters.
|
||||
* Ideally, changing TextAreaPainter method can treat AttributedCharacterIterator is better. But it's very tough!!
|
||||
* So I choose to write some code as a workaround.
|
||||
*
|
||||
* This draw method is proceeded with the following steps.
|
||||
* 1. Original TextAreaPainter draws characters.
|
||||
* 2. This refillComposedArea method erase previous paint characters by textarea's background color.
|
||||
* The refill area is only square that width and height defined by characters with input method.
|
||||
* 3. CompositionTextPainter.draw method paints composed text. It was actually drawn by TextLayout.
|
||||
*
|
||||
* @param gfx set TextAreaPainter's Graphics object.
|
||||
* @param fillBackGroundColor set textarea's background.
|
||||
*/
|
||||
public void draw(Graphics gfx, Color fillBackGroundColor) {
|
||||
assert(composedTextLayout != null);
|
||||
Point composedLoc = getCaretLocation();
|
||||
refillComposedArea(fillBackGroundColor, composedLoc.x, composedLoc.y);
|
||||
composedTextLayout.draw((Graphics2D) gfx, composedLoc.x, composedLoc.y);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fill color to erase characters drawn by original TextAreaPainter.
|
||||
*
|
||||
* @param fillColor fill color to erase characters drawn by original TextAreaPainter method.
|
||||
* @param x x-coordinate where to fill.
|
||||
* @param y y-coordinate where to fill.
|
||||
*/
|
||||
private void refillComposedArea(Color fillColor, int x, int y) {
|
||||
Graphics gfx = textArea.getPainter().getGraphics();
|
||||
gfx.setColor(fillColor);
|
||||
FontMetrics fm = textArea.getPainter().getFontMetrics();
|
||||
int newY = y - (fm.getHeight() - CompositionTextManager.COMPOSING_UNDERBAR_HEIGHT);
|
||||
int paintHeight = fm.getHeight();
|
||||
int paintWidth = (int) composedTextLayout.getBounds().getWidth();
|
||||
gfx.fillRect(x, newY, paintWidth, paintHeight);
|
||||
}
|
||||
|
||||
private Point getCaretLocation() {
|
||||
Point loc = new Point();
|
||||
TextAreaPainter painter = textArea.getPainter();
|
||||
FontMetrics fm = painter.getFontMetrics();
|
||||
int offsetY = fm.getHeight() - CompositionTextManager.COMPOSING_UNDERBAR_HEIGHT;
|
||||
int lineIndex = textArea.getCaretLine();
|
||||
loc.y = lineIndex * fm.getHeight() + offsetY;
|
||||
int offsetX = composedBeginCaretPosition - textArea.getLineStartOffset(lineIndex);
|
||||
loc.x = textArea.offsetToX(lineIndex, offsetX);
|
||||
return loc;
|
||||
}
|
||||
}
|
105
app/src/processing/app/syntax/im/InputMethodSupport.java
Normal file
105
app/src/processing/app/syntax/im/InputMethodSupport.java
Normal file
@ -0,0 +1,105 @@
|
||||
package processing.app.syntax.im;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.event.InputMethodEvent;
|
||||
import java.awt.event.InputMethodListener;
|
||||
import java.awt.font.TextHitInfo;
|
||||
import java.awt.im.InputMethodRequests;
|
||||
import java.text.AttributedCharacterIterator;
|
||||
|
||||
import processing.app.syntax.JEditTextArea;
|
||||
|
||||
/**
|
||||
* Support in-line Japanese input for PDE. (Maybe Chinese, Korean and more)
|
||||
* This class is implemented by Java Input Method Framework and handles
|
||||
* If you would like to know more about Java Input Method Framework,
|
||||
* Please see http://java.sun.com/j2se/1.5.0/docs/guide/imf/
|
||||
*
|
||||
* This class is implemented to fix Bug #854.
|
||||
* http://dev.processing.org/bugs/show_bug.cgi?id=854
|
||||
*
|
||||
* @author Takashi Maekawa (takachin@generative.info)
|
||||
*/
|
||||
public class InputMethodSupport implements InputMethodRequests,
|
||||
InputMethodListener {
|
||||
|
||||
private int committed_count = 0;
|
||||
private CompositionTextManager textManager;
|
||||
|
||||
public InputMethodSupport(JEditTextArea textArea) {
|
||||
textManager = new CompositionTextManager(textArea);
|
||||
textArea.enableInputMethods(true);
|
||||
textArea.addInputMethodListener(this);
|
||||
}
|
||||
|
||||
public Rectangle getTextLocation(TextHitInfo offset) {
|
||||
return textManager.getTextLocation();
|
||||
}
|
||||
|
||||
public TextHitInfo getLocationOffset(int x, int y) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public int getInsertPositionOffset() {
|
||||
return textManager.getInsertPositionOffset();
|
||||
}
|
||||
|
||||
public AttributedCharacterIterator getCommittedText(int beginIndex,
|
||||
int endIndex, AttributedCharacterIterator.Attribute[] attributes) {
|
||||
return textManager.getCommittedText(beginIndex, endIndex);
|
||||
}
|
||||
|
||||
public int getCommittedTextLength() {
|
||||
return committed_count;
|
||||
}
|
||||
|
||||
public AttributedCharacterIterator cancelLatestCommittedText(
|
||||
AttributedCharacterIterator.Attribute[] attributes) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public AttributedCharacterIterator getSelectedText(
|
||||
AttributedCharacterIterator.Attribute[] attributes) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles events from InputMethod.
|
||||
* This method judges whether beginning of input or
|
||||
* progress of input or end and call related method.
|
||||
*
|
||||
* @param event event from Input Method.
|
||||
*/
|
||||
public void inputMethodTextChanged(InputMethodEvent event) {
|
||||
AttributedCharacterIterator text = event.getText();
|
||||
committed_count = event.getCommittedCharacterCount();
|
||||
if(isBeginInputProcess(text, textManager)){
|
||||
textManager.beginCompositionText(text, committed_count);
|
||||
caretPositionChanged(event);
|
||||
return;
|
||||
}
|
||||
if (isInputProcess(text)){
|
||||
textManager.processCompositionText(text, committed_count);
|
||||
caretPositionChanged(event);
|
||||
return;
|
||||
}
|
||||
textManager.endCompositionText(text, committed_count);
|
||||
caretPositionChanged(event);
|
||||
}
|
||||
|
||||
private boolean isBeginInputProcess(AttributedCharacterIterator text, CompositionTextManager textManager){
|
||||
if(text == null)
|
||||
return false;
|
||||
return (isInputProcess(text) && !textManager.getIsInputProcess());
|
||||
}
|
||||
|
||||
private boolean isInputProcess(AttributedCharacterIterator text){
|
||||
if(text == null)
|
||||
return false;
|
||||
return (text.getEndIndex() - (text.getBeginIndex() + committed_count) > 0);
|
||||
}
|
||||
|
||||
public void caretPositionChanged(InputMethodEvent event) {
|
||||
event.consume();
|
||||
}
|
||||
}
|
@ -120,6 +120,7 @@ public class ColorSelector implements Tool, DocumentListener {
|
||||
frame.setVisible(false);
|
||||
}
|
||||
});
|
||||
|
||||
Base.setIcon(frame);
|
||||
|
||||
hueField.getDocument().addDocumentListener(this);
|
||||
@ -444,19 +445,25 @@ public class ColorSelector implements Tool, DocumentListener {
|
||||
}
|
||||
|
||||
public Dimension getPreferredSize() {
|
||||
//System.out.println("getting pref " + WIDE + " " + HIGH);
|
||||
return new Dimension(WIDE, HIGH);
|
||||
}
|
||||
|
||||
public Dimension getMinimumSize() {
|
||||
//System.out.println("getting min " + WIDE + " " + HIGH);
|
||||
return new Dimension(WIDE, HIGH);
|
||||
}
|
||||
|
||||
public Dimension getMaximumSize() {
|
||||
//System.out.println("getting max " + WIDE + " " + HIGH);
|
||||
return new Dimension(WIDE, HIGH);
|
||||
}
|
||||
|
||||
public void keyPressed() {
|
||||
if (key == ESC) {
|
||||
ColorSelector.this.frame.setVisible(false);
|
||||
// don't quit out of processing
|
||||
// http://dev.processing.org/bugs/show_bug.cgi?id=1006
|
||||
key = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -506,19 +513,25 @@ public class ColorSelector implements Tool, DocumentListener {
|
||||
}
|
||||
|
||||
public Dimension getPreferredSize() {
|
||||
//System.out.println("s getting pref " + WIDE + " " + HIGH);
|
||||
return new Dimension(WIDE, HIGH);
|
||||
}
|
||||
|
||||
public Dimension getMinimumSize() {
|
||||
//System.out.println("s getting min " + WIDE + " " + HIGH);
|
||||
return new Dimension(WIDE, HIGH);
|
||||
}
|
||||
|
||||
public Dimension getMaximumSize() {
|
||||
//System.out.println("s getting max " + WIDE + " " + HIGH);
|
||||
return new Dimension(WIDE, HIGH);
|
||||
}
|
||||
|
||||
public void keyPressed() {
|
||||
if (key == ESC) {
|
||||
ColorSelector.this.frame.setVisible(false);
|
||||
// don't quit out of processing
|
||||
// http://dev.processing.org/bugs/show_bug.cgi?id=1006
|
||||
key = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -540,7 +553,7 @@ public class ColorSelector implements Tool, DocumentListener {
|
||||
|
||||
public Dimension getPreferredSize() {
|
||||
if (!allowHex) {
|
||||
return new Dimension(35, super.getPreferredSize().height);
|
||||
return new Dimension(45, super.getPreferredSize().height);
|
||||
}
|
||||
return super.getPreferredSize();
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
/*
|
||||
Part of the Processing project - http://processing.org
|
||||
|
||||
Copyright (c) 2004-06 Ben Fry and Casey Reas
|
||||
Copyright (c) 2004-10 Ben Fry and Casey Reas
|
||||
Copyright (c) 2001-04 Massachusetts Institute of Technology
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
@ -37,7 +37,7 @@ import javax.swing.event.*;
|
||||
|
||||
|
||||
/**
|
||||
* gui interface to font creation heaven/hell.
|
||||
* GUI tool for font creation heaven/hell.
|
||||
*/
|
||||
public class CreateFont extends JFrame implements Tool {
|
||||
Editor editor;
|
||||
@ -46,30 +46,22 @@ public class CreateFont extends JFrame implements Tool {
|
||||
Dimension windowSize;
|
||||
|
||||
JList fontSelector;
|
||||
//JComboBox styleSelector;
|
||||
JTextField sizeSelector;
|
||||
JCheckBox allBox;
|
||||
JButton charsetButton;
|
||||
JCheckBox smoothBox;
|
||||
JTextArea sample;
|
||||
JComponent sample;
|
||||
JButton okButton;
|
||||
JTextField filenameField;
|
||||
|
||||
Hashtable table;
|
||||
HashMap<String,Font> table;
|
||||
boolean smooth = true;
|
||||
boolean all = false;
|
||||
|
||||
Font font;
|
||||
|
||||
String[] list;
|
||||
int selection = -1;
|
||||
|
||||
|
||||
//static {
|
||||
//System.out.println("yep yep yep");
|
||||
//}
|
||||
//static final String styles[] = {
|
||||
//"Plain", "Bold", "Italic", "Bold Italic"
|
||||
//};
|
||||
CharacterSelector charSelector;
|
||||
|
||||
|
||||
public CreateFont() {
|
||||
@ -117,7 +109,7 @@ public class CreateFont extends JFrame implements Tool {
|
||||
Font fonts[] = ge.getAllFonts();
|
||||
|
||||
String flist[] = new String[fonts.length];
|
||||
table = new Hashtable();
|
||||
table = new HashMap<String,Font>();
|
||||
|
||||
int index = 0;
|
||||
for (int i = 0; i < fonts.length; i++) {
|
||||
@ -150,20 +142,8 @@ public class CreateFont extends JFrame implements Tool {
|
||||
Dimension d1 = new Dimension(13, 13);
|
||||
pain.add(new Box.Filler(d1, d1, d1));
|
||||
|
||||
// see http://rinkworks.com/words/pangrams.shtml
|
||||
sample = new JTextArea("The quick brown fox blah blah.") {
|
||||
// Forsaking monastic tradition, twelve jovial friars gave up their
|
||||
// vocation for a questionable existence on the flying trapeze.
|
||||
public void paintComponent(Graphics g) {
|
||||
//System.out.println("disabling aa");
|
||||
Graphics2D g2 = (Graphics2D) g;
|
||||
g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
|
||||
smooth ?
|
||||
RenderingHints.VALUE_TEXT_ANTIALIAS_ON :
|
||||
RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);
|
||||
super.paintComponent(g2);
|
||||
}
|
||||
};
|
||||
sample = new SampleComponent(this);
|
||||
|
||||
// Seems that in some instances, no default font is set
|
||||
// http://dev.processing.org/bugs/show_bug.cgi?id=777
|
||||
sample.setFont(new Font("Dialog", Font.PLAIN, 12));
|
||||
@ -193,14 +173,22 @@ public class CreateFont extends JFrame implements Tool {
|
||||
smoothBox.setSelected(smooth);
|
||||
panel.add(smoothBox);
|
||||
|
||||
allBox = new JCheckBox("All Characters");
|
||||
allBox.addActionListener(new ActionListener() {
|
||||
// allBox = new JCheckBox("All Characters");
|
||||
// allBox.addActionListener(new ActionListener() {
|
||||
// public void actionPerformed(ActionEvent e) {
|
||||
// all = allBox.isSelected();
|
||||
// }
|
||||
// });
|
||||
// allBox.setSelected(all);
|
||||
// panel.add(allBox);
|
||||
charsetButton = new JButton("Characters...");
|
||||
charsetButton.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
all = allBox.isSelected();
|
||||
//showCharacterList();
|
||||
charSelector.setVisible(true);
|
||||
}
|
||||
});
|
||||
allBox.setSelected(all);
|
||||
panel.add(allBox);
|
||||
panel.add(charsetButton);
|
||||
|
||||
pain.add(panel);
|
||||
|
||||
@ -239,6 +227,7 @@ public class CreateFont extends JFrame implements Tool {
|
||||
Base.registerWindowCloseKeys(root, disposer);
|
||||
Base.setIcon(this);
|
||||
|
||||
setResizable(false);
|
||||
pack();
|
||||
|
||||
// do this after pack so it doesn't affect layout
|
||||
@ -251,6 +240,9 @@ public class CreateFont extends JFrame implements Tool {
|
||||
|
||||
setLocation((screen.width - windowSize.width) / 2,
|
||||
(screen.height - windowSize.height) / 2);
|
||||
|
||||
// create this behind the scenes
|
||||
charSelector = new CharacterSelector();
|
||||
}
|
||||
|
||||
|
||||
@ -259,26 +251,6 @@ public class CreateFont extends JFrame implements Tool {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* make the window vertically resizable
|
||||
*/
|
||||
public Dimension getMaximumSize() {
|
||||
return new Dimension(windowSize.width, 2000);
|
||||
}
|
||||
|
||||
public Dimension getMinimumSize() {
|
||||
return windowSize;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
public void show(File targetFolder) {
|
||||
this.targetFolder = targetFolder;
|
||||
show();
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
public void update() {
|
||||
int fontsize = 0;
|
||||
try {
|
||||
@ -313,7 +285,7 @@ public class CreateFont extends JFrame implements Tool {
|
||||
return;
|
||||
}
|
||||
|
||||
String filename = filenameField.getText();
|
||||
String filename = filenameField.getText().trim();
|
||||
if (filename.length() == 0) {
|
||||
JOptionPane.showMessageDialog(this, "Enter a file name for the font.",
|
||||
"Lameness", JOptionPane.WARNING_MESSAGE);
|
||||
@ -323,23 +295,519 @@ public class CreateFont extends JFrame implements Tool {
|
||||
filename += ".vlw";
|
||||
}
|
||||
|
||||
// Please implement me properly. The schematic is below, but not debugged.
|
||||
// http://dev.processing.org/bugs/show_bug.cgi?id=1464
|
||||
|
||||
// final String filename2 = filename;
|
||||
// final int fontsize2 = fontsize;
|
||||
// SwingUtilities.invokeLater(new Runnable() {
|
||||
// public void run() {
|
||||
try {
|
||||
Font instance = (Font) table.get(list[selection]);
|
||||
font = instance.deriveFont(Font.PLAIN, fontsize);
|
||||
PFont f = new PFont(font, smooth, all ? null : PFont.DEFAULT_CHARSET);
|
||||
//PFont f = new PFont(font, smooth, all ? null : PFont.CHARSET);
|
||||
PFont f = new PFont(font, smooth, charSelector.getCharacters());
|
||||
|
||||
// PFont f = new PFont(font, smooth, null);
|
||||
// char[] charset = charSelector.getCharacters();
|
||||
// ProgressMonitor progressMonitor = new ProgressMonitor(CreateFont.this,
|
||||
// "Creating font", "", 0, charset.length);
|
||||
// progressMonitor.setProgress(0);
|
||||
// for (int i = 0; i < charset.length; i++) {
|
||||
// System.out.println(charset[i]);
|
||||
// f.index(charset[i]); // load this char
|
||||
// progressMonitor.setProgress(i+1);
|
||||
// }
|
||||
|
||||
// make sure the 'data' folder exists
|
||||
File folder = editor.getSketch().prepareDataFolder();
|
||||
f.save(new FileOutputStream(new File(folder, filename)));
|
||||
|
||||
} catch (IOException e) {
|
||||
JOptionPane.showMessageDialog(this,
|
||||
JOptionPane.showMessageDialog(CreateFont.this,
|
||||
"An error occurred while creating font.",
|
||||
"No font for you",
|
||||
JOptionPane.WARNING_MESSAGE);
|
||||
e.printStackTrace();
|
||||
}
|
||||
// }
|
||||
// });
|
||||
|
||||
setVisible(false);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* make the window vertically resizable
|
||||
*/
|
||||
public Dimension getMaximumSize() {
|
||||
return new Dimension(windowSize.width, 2000);
|
||||
}
|
||||
|
||||
|
||||
public Dimension getMinimumSize() {
|
||||
return windowSize;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
public void show(File targetFolder) {
|
||||
this.targetFolder = targetFolder;
|
||||
show();
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Component that draws the sample text. This is its own subclassed component
|
||||
* because Mac OS X controls seem to reset the RenderingHints for smoothing
|
||||
* so that they cannot be overridden properly for JLabel or JTextArea.
|
||||
* @author fry
|
||||
*/
|
||||
class SampleComponent extends JComponent {
|
||||
// see http://rinkworks.com/words/pangrams.shtml
|
||||
String text =
|
||||
"Forsaking monastic tradition, twelve jovial friars gave up their " +
|
||||
"vocation for a questionable existence on the flying trapeze.";
|
||||
int high = 80;
|
||||
|
||||
CreateFont parent;
|
||||
|
||||
public SampleComponent(CreateFont p) {
|
||||
this.parent = p;
|
||||
|
||||
// and yet, we still need an inner class to handle the basics.
|
||||
// or no, maybe i'll refactor this as a separate class!
|
||||
// maybe a few getters and setters? mmm?
|
||||
addMouseListener(new MouseAdapter() {
|
||||
public void mousePressed(MouseEvent e) {
|
||||
String input =
|
||||
(String) JOptionPane.showInputDialog(parent,
|
||||
"Enter new sample text:",
|
||||
"Sample Text",
|
||||
JOptionPane.PLAIN_MESSAGE,
|
||||
null, // icon
|
||||
null, // choices
|
||||
text);
|
||||
if (input != null) {
|
||||
text = input;
|
||||
parent.repaint();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void paintComponent(Graphics g) {
|
||||
// System.out.println("smoothing set to " + smooth);
|
||||
Graphics2D g2 = (Graphics2D) g;
|
||||
g2.setColor(Color.WHITE);
|
||||
Dimension dim = getSize();
|
||||
g2.fillRect(0, 0, dim.width, dim.height);
|
||||
g2.setColor(Color.BLACK);
|
||||
|
||||
g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
|
||||
parent.smooth ?
|
||||
RenderingHints.VALUE_TEXT_ANTIALIAS_ON :
|
||||
RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);
|
||||
// add this one as well (after 1.0.9)
|
||||
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
|
||||
parent.smooth ?
|
||||
RenderingHints.VALUE_ANTIALIAS_ON :
|
||||
RenderingHints.VALUE_ANTIALIAS_OFF);
|
||||
//super.paintComponent(g2);
|
||||
Font font = getFont();
|
||||
int ascent = g2.getFontMetrics().getAscent();
|
||||
// System.out.println(f.getName());
|
||||
g2.setFont(font);
|
||||
g2.drawString(text, 5, dim.height - (dim.height - ascent) / 2);
|
||||
}
|
||||
|
||||
public Dimension getPreferredSize() {
|
||||
return new Dimension(400, high);
|
||||
}
|
||||
|
||||
public Dimension getMaximumSize() {
|
||||
return new Dimension(10000, high);
|
||||
}
|
||||
|
||||
public Dimension getMinimumSize() {
|
||||
return new Dimension(100, high);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Frame for selecting which characters will be included with the font.
|
||||
*/
|
||||
class CharacterSelector extends JFrame {
|
||||
JRadioButton defaultCharsButton;
|
||||
JRadioButton allCharsButton;
|
||||
JRadioButton unicodeCharsButton;
|
||||
JScrollPane unicodeBlockScroller;
|
||||
JList charsetList;
|
||||
|
||||
|
||||
public CharacterSelector() {
|
||||
super("Character Selector");
|
||||
|
||||
charsetList = new CheckBoxList();
|
||||
DefaultListModel model = new DefaultListModel();
|
||||
charsetList.setModel(model);
|
||||
for (String item : blockNames) {
|
||||
model.addElement(new JCheckBox(item));
|
||||
}
|
||||
|
||||
unicodeBlockScroller =
|
||||
new JScrollPane(charsetList,
|
||||
ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
|
||||
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
|
||||
|
||||
Container outer = getContentPane();
|
||||
outer.setLayout(new BorderLayout());
|
||||
|
||||
JPanel pain = new JPanel();
|
||||
pain.setBorder(new EmptyBorder(13, 13, 13, 13));
|
||||
outer.add(pain, BorderLayout.CENTER);
|
||||
|
||||
pain.setLayout(new BoxLayout(pain, BoxLayout.Y_AXIS));
|
||||
|
||||
String labelText =
|
||||
"Default characters will include most bitmaps for Mac OS\n" +
|
||||
"and Windows Latin scripts. Including all characters may\n" +
|
||||
"require large amounts of memory for all of the bitmaps.\n" +
|
||||
"For greater control, you can select specific Unicode blocks.";
|
||||
JTextArea textarea = new JTextArea(labelText);
|
||||
textarea.setBorder(new EmptyBorder(13, 8, 13, 8));
|
||||
textarea.setBackground(null);
|
||||
textarea.setEditable(false);
|
||||
textarea.setHighlighter(null);
|
||||
textarea.setFont(new Font("Dialog", Font.PLAIN, 12));
|
||||
pain.add(textarea);
|
||||
|
||||
ActionListener listener = new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
//System.out.println("action " + unicodeCharsButton.isSelected());
|
||||
//unicodeBlockScroller.setEnabled(unicodeCharsButton.isSelected());
|
||||
charsetList.setEnabled(unicodeCharsButton.isSelected());
|
||||
}
|
||||
};
|
||||
defaultCharsButton = new JRadioButton("Default Characters");
|
||||
allCharsButton = new JRadioButton("All Characters");
|
||||
unicodeCharsButton = new JRadioButton("Specific Unicode Blocks");
|
||||
|
||||
defaultCharsButton.addActionListener(listener);
|
||||
allCharsButton.addActionListener(listener);
|
||||
unicodeCharsButton.addActionListener(listener);
|
||||
|
||||
ButtonGroup group = new ButtonGroup();
|
||||
group.add(defaultCharsButton);
|
||||
group.add(allCharsButton);
|
||||
group.add(unicodeCharsButton);
|
||||
|
||||
JPanel radioPanel = new JPanel();
|
||||
//radioPanel.setBackground(Color.red);
|
||||
radioPanel.setLayout(new BoxLayout(radioPanel, BoxLayout.Y_AXIS));
|
||||
radioPanel.add(defaultCharsButton);
|
||||
radioPanel.add(allCharsButton);
|
||||
radioPanel.add(unicodeCharsButton);
|
||||
|
||||
JPanel rightStuff = new JPanel();
|
||||
rightStuff.setLayout(new BoxLayout(rightStuff, BoxLayout.X_AXIS));
|
||||
rightStuff.add(radioPanel);
|
||||
rightStuff.add(Box.createHorizontalGlue());
|
||||
pain.add(rightStuff);
|
||||
pain.add(Box.createVerticalStrut(13));
|
||||
|
||||
// pain.add(radioPanel);
|
||||
|
||||
// pain.add(defaultCharsButton);
|
||||
// pain.add(allCharsButton);
|
||||
// pain.add(unicodeCharsButton);
|
||||
|
||||
defaultCharsButton.setSelected(true);
|
||||
charsetList.setEnabled(false);
|
||||
|
||||
//frame.getContentPane().add(scroller);
|
||||
pain.add(unicodeBlockScroller);
|
||||
pain.add(Box.createVerticalStrut(8));
|
||||
|
||||
JPanel buttons = new JPanel();
|
||||
JButton okButton = new JButton("OK");
|
||||
okButton.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
setVisible(false);
|
||||
}
|
||||
});
|
||||
okButton.setEnabled(true);
|
||||
buttons.add(okButton);
|
||||
pain.add(buttons);
|
||||
|
||||
JRootPane root = getRootPane();
|
||||
root.setDefaultButton(okButton);
|
||||
ActionListener disposer = new ActionListener() {
|
||||
public void actionPerformed(ActionEvent actionEvent) {
|
||||
setVisible(false);
|
||||
}
|
||||
};
|
||||
Base.registerWindowCloseKeys(root, disposer);
|
||||
Base.setIcon(this);
|
||||
|
||||
pack();
|
||||
|
||||
Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
|
||||
Dimension windowSize = getSize();
|
||||
|
||||
setLocation((screen.width - windowSize.width) / 2,
|
||||
(screen.height - windowSize.height) / 2);
|
||||
}
|
||||
|
||||
|
||||
protected char[] getCharacters() {
|
||||
if (defaultCharsButton.isSelected()) {
|
||||
return PFont.CHARSET;
|
||||
}
|
||||
|
||||
char[] charset = new char[65536];
|
||||
if (allCharsButton.isSelected()) {
|
||||
for (int i = 0; i < 0xFFFF; i++) {
|
||||
charset[i] = (char) i;
|
||||
}
|
||||
} else {
|
||||
DefaultListModel model = (DefaultListModel) charsetList.getModel();
|
||||
int index = 0;
|
||||
for (int i = 0; i < BLOCKS.length; i++) {
|
||||
if (((JCheckBox) model.get(i)).isSelected()) {
|
||||
for (int j = blockStart[i]; j <= blockStop[i]; j++) {
|
||||
charset[index++] = (char) j;
|
||||
}
|
||||
}
|
||||
}
|
||||
charset = PApplet.subset(charset, 0, index);
|
||||
}
|
||||
//System.out.println("Creating font with " + charset.length + " characters.");
|
||||
return charset;
|
||||
}
|
||||
|
||||
|
||||
// http://www.unicode.org/Public/UNIDATA/Blocks.txt
|
||||
static final String[] BLOCKS = {
|
||||
"0000..007F; Basic Latin",
|
||||
"0080..00FF; Latin-1 Supplement",
|
||||
"0100..017F; Latin Extended-A",
|
||||
"0180..024F; Latin Extended-B",
|
||||
"0250..02AF; IPA Extensions",
|
||||
"02B0..02FF; Spacing Modifier Letters",
|
||||
"0300..036F; Combining Diacritical Marks",
|
||||
"0370..03FF; Greek and Coptic",
|
||||
"0400..04FF; Cyrillic",
|
||||
"0500..052F; Cyrillic Supplement",
|
||||
"0530..058F; Armenian",
|
||||
"0590..05FF; Hebrew",
|
||||
"0600..06FF; Arabic",
|
||||
"0700..074F; Syriac",
|
||||
"0750..077F; Arabic Supplement",
|
||||
"0780..07BF; Thaana",
|
||||
"07C0..07FF; NKo",
|
||||
"0800..083F; Samaritan",
|
||||
"0900..097F; Devanagari",
|
||||
"0980..09FF; Bengali",
|
||||
"0A00..0A7F; Gurmukhi",
|
||||
"0A80..0AFF; Gujarati",
|
||||
"0B00..0B7F; Oriya",
|
||||
"0B80..0BFF; Tamil",
|
||||
"0C00..0C7F; Telugu",
|
||||
"0C80..0CFF; Kannada",
|
||||
"0D00..0D7F; Malayalam",
|
||||
"0D80..0DFF; Sinhala",
|
||||
"0E00..0E7F; Thai",
|
||||
"0E80..0EFF; Lao",
|
||||
"0F00..0FFF; Tibetan",
|
||||
"1000..109F; Myanmar",
|
||||
"10A0..10FF; Georgian",
|
||||
"1100..11FF; Hangul Jamo",
|
||||
"1200..137F; Ethiopic",
|
||||
"1380..139F; Ethiopic Supplement",
|
||||
"13A0..13FF; Cherokee",
|
||||
"1400..167F; Unified Canadian Aboriginal Syllabics",
|
||||
"1680..169F; Ogham",
|
||||
"16A0..16FF; Runic",
|
||||
"1700..171F; Tagalog",
|
||||
"1720..173F; Hanunoo",
|
||||
"1740..175F; Buhid",
|
||||
"1760..177F; Tagbanwa",
|
||||
"1780..17FF; Khmer",
|
||||
"1800..18AF; Mongolian",
|
||||
"18B0..18FF; Unified Canadian Aboriginal Syllabics Extended",
|
||||
"1900..194F; Limbu",
|
||||
"1950..197F; Tai Le",
|
||||
"1980..19DF; New Tai Lue",
|
||||
"19E0..19FF; Khmer Symbols",
|
||||
"1A00..1A1F; Buginese",
|
||||
"1A20..1AAF; Tai Tham",
|
||||
"1B00..1B7F; Balinese",
|
||||
"1B80..1BBF; Sundanese",
|
||||
"1C00..1C4F; Lepcha",
|
||||
"1C50..1C7F; Ol Chiki",
|
||||
"1CD0..1CFF; Vedic Extensions",
|
||||
"1D00..1D7F; Phonetic Extensions",
|
||||
"1D80..1DBF; Phonetic Extensions Supplement",
|
||||
"1DC0..1DFF; Combining Diacritical Marks Supplement",
|
||||
"1E00..1EFF; Latin Extended Additional",
|
||||
"1F00..1FFF; Greek Extended",
|
||||
"2000..206F; General Punctuation",
|
||||
"2070..209F; Superscripts and Subscripts",
|
||||
"20A0..20CF; Currency Symbols",
|
||||
"20D0..20FF; Combining Diacritical Marks for Symbols",
|
||||
"2100..214F; Letterlike Symbols",
|
||||
"2150..218F; Number Forms",
|
||||
"2190..21FF; Arrows",
|
||||
"2200..22FF; Mathematical Operators",
|
||||
"2300..23FF; Miscellaneous Technical",
|
||||
"2400..243F; Control Pictures",
|
||||
"2440..245F; Optical Character Recognition",
|
||||
"2460..24FF; Enclosed Alphanumerics",
|
||||
"2500..257F; Box Drawing",
|
||||
"2580..259F; Block Elements",
|
||||
"25A0..25FF; Geometric Shapes",
|
||||
"2600..26FF; Miscellaneous Symbols",
|
||||
"2700..27BF; Dingbats",
|
||||
"27C0..27EF; Miscellaneous Mathematical Symbols-A",
|
||||
"27F0..27FF; Supplemental Arrows-A",
|
||||
"2800..28FF; Braille Patterns",
|
||||
"2900..297F; Supplemental Arrows-B",
|
||||
"2980..29FF; Miscellaneous Mathematical Symbols-B",
|
||||
"2A00..2AFF; Supplemental Mathematical Operators",
|
||||
"2B00..2BFF; Miscellaneous Symbols and Arrows",
|
||||
"2C00..2C5F; Glagolitic",
|
||||
"2C60..2C7F; Latin Extended-C",
|
||||
"2C80..2CFF; Coptic",
|
||||
"2D00..2D2F; Georgian Supplement",
|
||||
"2D30..2D7F; Tifinagh",
|
||||
"2D80..2DDF; Ethiopic Extended",
|
||||
"2DE0..2DFF; Cyrillic Extended-A",
|
||||
"2E00..2E7F; Supplemental Punctuation",
|
||||
"2E80..2EFF; CJK Radicals Supplement",
|
||||
"2F00..2FDF; Kangxi Radicals",
|
||||
"2FF0..2FFF; Ideographic Description Characters",
|
||||
"3000..303F; CJK Symbols and Punctuation",
|
||||
"3040..309F; Hiragana",
|
||||
"30A0..30FF; Katakana",
|
||||
"3100..312F; Bopomofo",
|
||||
"3130..318F; Hangul Compatibility Jamo",
|
||||
"3190..319F; Kanbun",
|
||||
"31A0..31BF; Bopomofo Extended",
|
||||
"31C0..31EF; CJK Strokes",
|
||||
"31F0..31FF; Katakana Phonetic Extensions",
|
||||
"3200..32FF; Enclosed CJK Letters and Months",
|
||||
"3300..33FF; CJK Compatibility",
|
||||
"3400..4DBF; CJK Unified Ideographs Extension A",
|
||||
"4DC0..4DFF; Yijing Hexagram Symbols",
|
||||
"4E00..9FFF; CJK Unified Ideographs",
|
||||
"A000..A48F; Yi Syllables",
|
||||
"A490..A4CF; Yi Radicals",
|
||||
"A4D0..A4FF; Lisu",
|
||||
"A500..A63F; Vai",
|
||||
"A640..A69F; Cyrillic Extended-B",
|
||||
"A6A0..A6FF; Bamum",
|
||||
"A700..A71F; Modifier Tone Letters",
|
||||
"A720..A7FF; Latin Extended-D",
|
||||
"A800..A82F; Syloti Nagri",
|
||||
"A830..A83F; Common Indic Number Forms",
|
||||
"A840..A87F; Phags-pa",
|
||||
"A880..A8DF; Saurashtra",
|
||||
"A8E0..A8FF; Devanagari Extended",
|
||||
"A900..A92F; Kayah Li",
|
||||
"A930..A95F; Rejang",
|
||||
"A960..A97F; Hangul Jamo Extended-A",
|
||||
"A980..A9DF; Javanese",
|
||||
"AA00..AA5F; Cham",
|
||||
"AA60..AA7F; Myanmar Extended-A",
|
||||
"AA80..AADF; Tai Viet",
|
||||
"ABC0..ABFF; Meetei Mayek",
|
||||
"AC00..D7AF; Hangul Syllables",
|
||||
"D7B0..D7FF; Hangul Jamo Extended-B",
|
||||
"D800..DB7F; High Surrogates",
|
||||
"DB80..DBFF; High Private Use Surrogates",
|
||||
"DC00..DFFF; Low Surrogates",
|
||||
"E000..F8FF; Private Use Area",
|
||||
"F900..FAFF; CJK Compatibility Ideographs",
|
||||
"FB00..FB4F; Alphabetic Presentation Forms",
|
||||
"FB50..FDFF; Arabic Presentation Forms-A",
|
||||
"FE00..FE0F; Variation Selectors",
|
||||
"FE10..FE1F; Vertical Forms",
|
||||
"FE20..FE2F; Combining Half Marks",
|
||||
"FE30..FE4F; CJK Compatibility Forms",
|
||||
"FE50..FE6F; Small Form Variants",
|
||||
"FE70..FEFF; Arabic Presentation Forms-B",
|
||||
"FF00..FFEF; Halfwidth and Fullwidth Forms",
|
||||
"FFF0..FFFF; Specials"
|
||||
};
|
||||
|
||||
static String[] blockNames;
|
||||
static int[] blockStart;
|
||||
static int[] blockStop;
|
||||
static {
|
||||
int count = BLOCKS.length;
|
||||
blockNames = new String[count];
|
||||
blockStart = new int[count];
|
||||
blockStop = new int[count];
|
||||
for (int i = 0; i < count; i++) {
|
||||
String line = BLOCKS[i];
|
||||
blockStart[i] = PApplet.unhex(line.substring(0, 4));
|
||||
blockStop[i] = PApplet.unhex(line.substring(6, 10));
|
||||
blockNames[i] = line.substring(12);
|
||||
}
|
||||
// PApplet.println(codePointStop);
|
||||
// PApplet.println(codePoints);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Code for this CheckBoxList class found on the net, though I've lost the
|
||||
// link. If you run across the original version, please let me know so that
|
||||
// the original author can be credited properly. It was from a snippet
|
||||
// collection, but it seems to have been picked up so many places with others
|
||||
// placing their copyright on it, that I haven't been able to determine the
|
||||
// original author. [fry 20100216]
|
||||
class CheckBoxList extends JList {
|
||||
protected static Border noFocusBorder = new EmptyBorder(1, 1, 1, 1);
|
||||
|
||||
public CheckBoxList() {
|
||||
setCellRenderer(new CellRenderer());
|
||||
|
||||
addMouseListener(new MouseAdapter() {
|
||||
public void mousePressed(MouseEvent e) {
|
||||
if (isEnabled()) {
|
||||
int index = locationToIndex(e.getPoint());
|
||||
|
||||
if (index != -1) {
|
||||
JCheckBox checkbox = (JCheckBox)
|
||||
getModel().getElementAt(index);
|
||||
checkbox.setSelected(!checkbox.isSelected());
|
||||
repaint();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
||||
}
|
||||
|
||||
|
||||
protected class CellRenderer implements ListCellRenderer {
|
||||
public Component getListCellRendererComponent(JList list, Object value,
|
||||
int index, boolean isSelected,
|
||||
boolean cellHasFocus) {
|
||||
JCheckBox checkbox = (JCheckBox) value;
|
||||
checkbox.setBackground(isSelected ? getSelectionBackground() : getBackground());
|
||||
checkbox.setForeground(isSelected ? getSelectionForeground() : getForeground());
|
||||
//checkbox.setEnabled(isEnabled());
|
||||
checkbox.setEnabled(list.isEnabled());
|
||||
checkbox.setFont(getFont());
|
||||
checkbox.setFocusPainted(false);
|
||||
checkbox.setBorderPainted(true);
|
||||
checkbox.setBorder(isSelected ? UIManager.getBorder("List.focusCellHighlightBorder") : noFocusBorder);
|
||||
return checkbox;
|
||||
}
|
||||
}
|
||||
}
|
@ -3,7 +3,7 @@
|
||||
/*
|
||||
Part of the Processing project - http://processing.org
|
||||
|
||||
Copyright (c) 2008 Ben Fry and Casey Reas
|
||||
Copyright (c) 2008-2009 Ben Fry and Casey Reas
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@ -25,6 +25,9 @@ package processing.app.windows;
|
||||
import java.io.File;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
|
||||
import com.sun.jna.Library;
|
||||
import com.sun.jna.Native;
|
||||
|
||||
import processing.app.Base;
|
||||
import processing.app.Preferences;
|
||||
import processing.app.windows.Registry.REGISTRY_ROOT_KEY;
|
||||
@ -265,4 +268,38 @@ public class Platform extends processing.app.Platform {
|
||||
// not tested
|
||||
//Runtime.getRuntime().exec("start explorer \"" + folder + "\"");
|
||||
}
|
||||
|
||||
|
||||
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
||||
|
||||
|
||||
// Code partially thanks to Richard Quirk from:
|
||||
// http://quirkygba.blogspot.com/2009/11/setting-environment-variables-in-java.html
|
||||
|
||||
static WinLibC clib = (WinLibC) Native.loadLibrary("msvcrt", WinLibC.class);
|
||||
|
||||
public interface WinLibC extends Library {
|
||||
//WinLibC INSTANCE = (WinLibC) Native.loadLibrary("msvcrt", WinLibC.class);
|
||||
//libc = Native.loadLibrary("msvcrt", WinLibC.class);
|
||||
public int _putenv(String name);
|
||||
}
|
||||
|
||||
|
||||
public void setenv(String variable, String value) {
|
||||
//WinLibC clib = WinLibC.INSTANCE;
|
||||
clib._putenv(variable + "=" + value);
|
||||
}
|
||||
|
||||
|
||||
public String getenv(String variable) {
|
||||
return System.getenv(variable);
|
||||
}
|
||||
|
||||
|
||||
public int unsetenv(String variable) {
|
||||
//WinLibC clib = WinLibC.INSTANCE;
|
||||
//clib._putenv(variable + "=");
|
||||
//return 0;
|
||||
return clib._putenv(variable + "=");
|
||||
}
|
||||
}
|
||||
|
468
build/build.xml
Normal file
468
build/build.xml
Normal file
@ -0,0 +1,468 @@
|
||||
<?xml version="1.0"?>
|
||||
<project name="Arduino" default="build">
|
||||
|
||||
<!-- Sets properties for macosx/windows/linux depending on current system -->
|
||||
<condition property="macosx"><os family="mac" /></condition>
|
||||
<condition property="windows"><os family="windows" /></condition>
|
||||
<condition property="linux"><os family="unix" /></condition>
|
||||
|
||||
<condition property="platform"
|
||||
value="macosx"><os family="mac" /></condition>
|
||||
<condition property="platform"
|
||||
value="windows"><os family="windows" /></condition>
|
||||
<condition property="platform"
|
||||
value="linux"><os family="unix" /></condition>
|
||||
|
||||
<!-- Libraries required for running arduino -->
|
||||
<fileset dir=".." id="runtime.jars">
|
||||
<include name="core/core.jar" />
|
||||
<include name="app/pde.jar" />
|
||||
<include name="app/lib/ecj.jar" />
|
||||
<include name="app/lib/jna.jar" />
|
||||
<include name="app/lib/oro.jar" />
|
||||
<include name="app/lib/RXTXcomm.jar" />
|
||||
<include name="app/lib/ant.jar" />
|
||||
<include name="app/lib/ant-launcher.jar" />
|
||||
</fileset>
|
||||
|
||||
<target name="build" description="Build Arduino.">
|
||||
<antcall target="${platform}-build" />
|
||||
</target>
|
||||
|
||||
<target name="run" description="Run Arduino.">
|
||||
<antcall target="${platform}-run" />
|
||||
</target>
|
||||
|
||||
<target name="dist" depends="revision-check"
|
||||
description="Build Arduino for distribution.">
|
||||
<input message="Enter version number:"
|
||||
addproperty="version"
|
||||
defaultvalue="${revision}" />
|
||||
<antcall target="${platform}-dist" />
|
||||
</target>
|
||||
|
||||
<!-- "§$§$&, ant doesn't have a built-in help target :( -->
|
||||
<target name="help" description="Show project help">
|
||||
<java classname="org.apache.tools.ant.Main">
|
||||
<arg value="-p" />
|
||||
</java>
|
||||
</target>
|
||||
|
||||
<!-- - - - - - - - - - - - - - - - - - -->
|
||||
<!-- Subprojects: Core, App, Libraries -->
|
||||
<!-- - - - - - - - - - - - - - - - - - -->
|
||||
|
||||
<target name="subprojects-clean">
|
||||
<subant buildpath="../core" target="clean"/>
|
||||
<subant buildpath="../app" target="clean"/>
|
||||
</target>
|
||||
|
||||
<target name="subprojects-build">
|
||||
<subant buildpath="../core" target="build"/>
|
||||
<subant buildpath="../app" target="build"/>
|
||||
</target>
|
||||
|
||||
|
||||
<!-- - - - - - - - - -->
|
||||
<!-- Basic Assembly -->
|
||||
<!-- - - - - - - - - -->
|
||||
|
||||
<target name="assemble">
|
||||
<fail unless="target.path"
|
||||
message="Do not call assemble from the command line." />
|
||||
|
||||
<!-- copy shared tools folder -->
|
||||
<copy todir="${target.path}/tools">
|
||||
<fileset dir="shared/tools" />
|
||||
</copy>
|
||||
|
||||
<!-- copy library folder -->
|
||||
<copy todir="${target.path}/libraries">
|
||||
<fileset dir="../libraries" />
|
||||
</copy>
|
||||
|
||||
<!-- copy hardware folder -->
|
||||
<copy todir="${target.path}/hardware">
|
||||
<fileset dir="../hardware" />
|
||||
</copy>
|
||||
|
||||
<!-- copy shared examples folder -->
|
||||
<copy todir="${target.path}/examples">
|
||||
<fileset dir="shared/examples" />
|
||||
</copy>
|
||||
|
||||
<!-- Unzip documentation -->
|
||||
<unzip dest="${target.path}" src="shared/reference.zip" overwrite="false"/>
|
||||
|
||||
<!-- Write the revision file! -->
|
||||
<echo file="${target.path}/lib/version.txt" message="${version}" />
|
||||
</target>
|
||||
|
||||
|
||||
<!-- - - - - - - - - -->
|
||||
<!-- Revision check -->
|
||||
<!-- - - - - - - - - -->
|
||||
<target name="revision-check">
|
||||
<!-- figure out the revision number -->
|
||||
<loadfile srcfile="../todo.txt" property="revision">
|
||||
<filterchain>
|
||||
<headfilter lines="1"/>
|
||||
<tokenfilter>
|
||||
<stringtokenizer suppressdelims="true"/>
|
||||
<!-- grab the thing from the first line that's 4 digits -->
|
||||
<containsregex pattern="(\d\d\d\d)" />
|
||||
</tokenfilter>
|
||||
</filterchain>
|
||||
</loadfile>
|
||||
<!-- <echo message="revision is ${revision}." /> -->
|
||||
|
||||
<!-- figure out the revision number in base.java -->
|
||||
<loadfile srcfile="../app/src/processing/app/Base.java"
|
||||
property="revision.base">
|
||||
<filterchain>
|
||||
<tokenfilter>
|
||||
<linetokenizer />
|
||||
<containsregex pattern="String VERSION_NAME = "/>
|
||||
<replaceregex pattern="[^0-9]*" flags="g" replace=""/>
|
||||
</tokenfilter>
|
||||
</filterchain>
|
||||
</loadfile>
|
||||
<!-- <echo message="base revision is ${revision.base}." /> -->
|
||||
|
||||
<condition property="revision.correct">
|
||||
<!-- Using contains because I can't figure out how to get rid of the
|
||||
LF in revision.base. Please file a bug if you have a fix. -->
|
||||
<contains string="${revision.base}" substring="${revision}"/>
|
||||
</condition>
|
||||
|
||||
<!-- the revision.base property won't be set
|
||||
if $revision wasn't found... -->
|
||||
<fail unless="revision.correct"
|
||||
message="Fix revision number in Base.java" />
|
||||
</target>
|
||||
|
||||
|
||||
<!-- - - - - - - - -->
|
||||
<!-- Mac OS X -->
|
||||
<!-- - - - - - - - -->
|
||||
|
||||
<target name="macosx-clean" depends="subprojects-clean" description="Clean Mac OS X build">
|
||||
<delete dir="macosx/work" />
|
||||
<delete dir="macosx/working_dir" />
|
||||
<delete dir="macosx/working.dmg" />
|
||||
<delete file="macosx/arduino-*.dmg" />
|
||||
</target>
|
||||
|
||||
<target name="macosx-checkos" unless="macosx">
|
||||
<echo>
|
||||
=======================================================
|
||||
Arduino for Mac OS X can only be built on Mac OS X.
|
||||
|
||||
Bye.
|
||||
=======================================================
|
||||
</echo>
|
||||
<fail message="wrong platform (${os.name})" />
|
||||
</target>
|
||||
|
||||
<target name="macosx-build" if="macosx" depends="revision-check, macosx-checkos, subprojects-build" description="Build Mac OS X version">
|
||||
<mkdir dir="macosx/work" />
|
||||
|
||||
<!-- assemble the pde -->
|
||||
<copy todir="macosx/work">
|
||||
<fileset dir="macosx/" includes="template.app/**"/>
|
||||
</copy>
|
||||
|
||||
<!-- <rename src="macosx/work/template.app"
|
||||
dest="macosx/work/Arduino.app" />-->
|
||||
<move file="macosx/work/template.app"
|
||||
tofile="macosx/work/Arduino.app" />
|
||||
|
||||
<chmod file="macosx/work/Arduino.app/Contents/MacOS/JavaApplicationStub" perm="755" />
|
||||
|
||||
<copy todir="macosx/work/Arduino.app/Contents/Resources/Java" flatten="true">
|
||||
<fileset refid="runtime.jars"/>
|
||||
</copy>
|
||||
|
||||
<copy todir="macosx/work/Arduino.app/Contents/Resources/Java">
|
||||
<fileset dir="shared" includes="lib/**" />
|
||||
<fileset file="shared/revisions.txt" />
|
||||
</copy>
|
||||
|
||||
<!-- Unzip AVR tools -->
|
||||
<!-- <unzip dest="macosx/work/Arduino.app/Contents/Resources/Java/hardware" src="macosx/dist/tools-universal.zip" overwrite="false"/> -->
|
||||
|
||||
<exec executable="unzip">
|
||||
<arg value="-q" />
|
||||
<arg value="-n" />
|
||||
<arg value="-d" />
|
||||
<arg value="macosx/work/Arduino.app/Contents/Resources/Java/hardware" />
|
||||
<arg value="macosx/dist/tools-universal.zip" />
|
||||
</exec>
|
||||
|
||||
<antcall target="assemble">
|
||||
<param name="target.path" value="macosx/work/Arduino.app/Contents/Resources/Java" />
|
||||
</antcall>
|
||||
</target>
|
||||
|
||||
<target name="macosx-run" depends="macosx-build" description="Run Mac OS X version">
|
||||
<exec executable="macosx/work/Arduino.app/Contents/MacOS/JavaApplicationStub" spawn="true"/>
|
||||
</target>
|
||||
|
||||
<target name="macosx-dist" if="macosx" depends="macosx-build" description="Create a .dmg of the Mac OS X version">
|
||||
<!-- now build the dmg -->
|
||||
<gunzip src="macosx/template.dmg.gz" dest="macosx/working.dmg" />
|
||||
|
||||
<mkdir dir="macosx/working_dir" />
|
||||
<exec executable="hdiutil">
|
||||
<arg line="attach macosx/working.dmg -noautoopen -mountpoint macosx/working_dir" />
|
||||
<!--<arg line="attach macosx/working.dmg -noautoopen -quiet -mountpoint macosx/working_dir" />-->
|
||||
</exec>
|
||||
|
||||
<copy todir="macosx/working_dir">
|
||||
<fileset dir="macosx/work" />
|
||||
</copy>
|
||||
|
||||
<!-- The ant copy command does not preserve permissions. -->
|
||||
<chmod file="macosx/working_dir/Arduino.app/Contents/MacOS/JavaApplicationStub" perm="+x" />
|
||||
|
||||
<!-- Pause briefly for the OS to catch up with the DMG changes.
|
||||
This prevents "hdiutil: couldn't eject "disk3" - Resource busy"
|
||||
errors when ejecting the disk in the next step.
|
||||
You may need to set this value higher for your system. -->
|
||||
<sleep seconds="3" />
|
||||
|
||||
<exec executable="hdiutil">
|
||||
<!--<arg line="detach macosx/working_dir -quiet -force" />-->
|
||||
<arg line="detach macosx/working_dir" />
|
||||
</exec>
|
||||
|
||||
<delete file="macosx/arduino-*.dmg" />
|
||||
<exec executable="hdiutil">
|
||||
<arg line="convert macosx/working.dmg -quiet -format UDZO -imagekey zlib-level=9 -o macosx/arduino-${version}.dmg" />
|
||||
</exec>
|
||||
|
||||
<!-- Clean up the interim files. -->
|
||||
<delete file="macosx/working.dmg" />
|
||||
<delete dir="macosx/working_dir" />
|
||||
|
||||
<echo>
|
||||
=======================================================
|
||||
Arduino for Mac OS X was built. Grab the image from
|
||||
|
||||
macosx/arduino-${version}.dmg
|
||||
=======================================================
|
||||
</echo>
|
||||
</target>
|
||||
|
||||
|
||||
<!-- - - - - - - - -->
|
||||
<!-- Linux -->
|
||||
<!-- - - - - - - - -->
|
||||
|
||||
<target name="linux-clean" depends="subprojects-clean" description="Clean linux version">
|
||||
<delete dir="linux/work" />
|
||||
</target>
|
||||
|
||||
<target name="linux-checkos" unless="linux">
|
||||
<echo>
|
||||
=======================================================
|
||||
Arduino for Linux can only be built on on unix systems.
|
||||
|
||||
Bye.
|
||||
=======================================================
|
||||
</echo>
|
||||
|
||||
<fail message="wrong platform (${os.name})" />
|
||||
</target>
|
||||
|
||||
<target name="linux-build" depends="revision-check, linux-checkos, subprojects-build" description="Build linux version">
|
||||
<mkdir dir="linux/work" />
|
||||
|
||||
<copy todir="linux/work">
|
||||
<fileset dir="shared" includes="lib/**" />
|
||||
<fileset file="shared/revisions.txt" />
|
||||
</copy>
|
||||
|
||||
<copy todir="linux/work">
|
||||
<fileset dir="linux/dist" includes="lib/**" />
|
||||
</copy>
|
||||
|
||||
<copy todir="linux/work/lib" flatten="true">
|
||||
<fileset refid="runtime.jars" />
|
||||
</copy>
|
||||
|
||||
<antcall target="assemble">
|
||||
<param name="target.path" value="linux/work" />
|
||||
</antcall>
|
||||
|
||||
<copy todir="linux/work/hardware">
|
||||
<fileset dir="linux/dist" includes="tools/**" />
|
||||
</copy>
|
||||
|
||||
<chmod perm="755" file="linux/work/hardware/tools/avrdude" />
|
||||
|
||||
<copy todir="linux/work" file="linux/dist/arduino" />
|
||||
<chmod perm="755" file="linux/work/arduino" />
|
||||
</target>
|
||||
|
||||
<target name="linux-run" depends="linux-build"
|
||||
description="Run Linux version">
|
||||
<exec executable="linux/work/arduino" dir="linux/work" spawn="false"/>
|
||||
</target>
|
||||
|
||||
<target name="linux-dist" depends="linux-build"
|
||||
description="Build .tar.gz of linux version">
|
||||
|
||||
<get src="http://dev.processing.org/build/jre-tools-6u18-linux-i586.tgz"
|
||||
dest="linux/jre.tgz"
|
||||
usetimestamp="true" />
|
||||
<untar compression="gzip"
|
||||
dest="linux/work"
|
||||
src="linux/jre.tgz"
|
||||
overwrite="false"/>
|
||||
|
||||
<!--
|
||||
<tar compression="gzip" basedir="linux/work"
|
||||
destfile="linux/arduino-${version}.tgz" />
|
||||
-->
|
||||
<tar compression="gzip" destfile="linux/arduino-${version}.tgz">
|
||||
<tarfileset dir="linux/work" prefix="arduino-${version}" />
|
||||
</tar>
|
||||
|
||||
<echo>
|
||||
=======================================================
|
||||
Arduino for Linux was built. Grab the archive from
|
||||
|
||||
build/linux/arduino-${version}.tgz
|
||||
=======================================================
|
||||
</echo>
|
||||
</target>
|
||||
|
||||
|
||||
<!-- - - - - - - - -->
|
||||
<!-- Windows -->
|
||||
<!-- - - - - - - - -->
|
||||
|
||||
<target name="windows-clean" depends="subprojects-clean"
|
||||
description="Clean windows version">
|
||||
<delete dir="windows/work" />
|
||||
</target>
|
||||
|
||||
<target name="windows-checkos" unless="windows">
|
||||
<echo>
|
||||
=======================================================
|
||||
Arduino for Windows can only be built on windows.
|
||||
|
||||
Bye.
|
||||
=======================================================
|
||||
</echo>
|
||||
|
||||
<fail message="wrong platform (${os.name})" />
|
||||
</target>
|
||||
|
||||
<target name="windows-build"
|
||||
depends="revision-check, windows-checkos, subprojects-build"
|
||||
description="Build windows version">
|
||||
<mkdir dir="windows/work" />
|
||||
|
||||
<!-- assemble the pde -->
|
||||
<mkdir dir="windows/work/lib" />
|
||||
<copy todir="windows/work/lib" flatten="true">
|
||||
<fileset refid="runtime.jars" />
|
||||
</copy>
|
||||
|
||||
<copy todir="windows/work">
|
||||
<fileset dir="shared" includes="lib/**" />
|
||||
<fileset file="shared/revisions.txt" />
|
||||
</copy>
|
||||
|
||||
<copy todir="windows/work">
|
||||
<fileset dir="windows/dist" includes="*.dll" />
|
||||
</copy>
|
||||
|
||||
<copy todir="windows/work">
|
||||
<fileset dir="windows/dist" includes="drivers/**" />
|
||||
</copy>
|
||||
|
||||
<!-- Unzip AVR tools -->
|
||||
<unzip dest="windows/work/hardware" src="windows/avr_tools.zip" overwrite="false"/>
|
||||
|
||||
<antcall target="assemble">
|
||||
<param name="target.path" value="windows/work" />
|
||||
</antcall>
|
||||
|
||||
<property name="launch4j.dir" value="windows/launcher/launch4j/" />
|
||||
<taskdef name="launch4j"
|
||||
classname="net.sf.launch4j.ant.Launch4jTask"
|
||||
classpath="${launch4j.dir}/launch4j.jar; ${launch4j.dir}/lib/xstream.jar" />
|
||||
|
||||
<copy todir="windows/work">
|
||||
<fileset dir="windows/launcher"
|
||||
includes="about.bmp, application.ico, config.xml"/>
|
||||
</copy>
|
||||
<launch4j configFile="windows/work/config.xml" />
|
||||
<delete dir="windows/work"
|
||||
includes="about.bmp, application.ico, config.xml" />
|
||||
|
||||
<!-- cygwin requires html, dll, and exe to have the +x flag -->
|
||||
<chmod perm="755">
|
||||
<fileset dir="windows/work" includes="**/*.html, **/*.dll, **/*.exe" />
|
||||
</chmod>
|
||||
</target>
|
||||
|
||||
<target name="windows-run" depends="windows-build"
|
||||
description="Run windows version">
|
||||
<exec executable="windows/work/arduino.exe"
|
||||
dir="windows/work" spawn="true"/>
|
||||
</target>
|
||||
|
||||
<target name="windows-dist" depends="windows-build"
|
||||
description="Create .zip files of windows version">
|
||||
|
||||
<get src="http://dev.processing.org/build/jre-tools-6u18-windows-i586.zip"
|
||||
dest="windows/jre.zip"
|
||||
usetimestamp="true" />
|
||||
|
||||
<unzip dest="windows/work" src="windows/jre.zip" overwrite="false"/>
|
||||
|
||||
<!--
|
||||
<zip basedir="windows/work"
|
||||
prefix="arduino-${version}"
|
||||
destfile="windows/arduino-${version}.zip" />
|
||||
<zip basedir="windows/work"
|
||||
prefix="arduino-${version}"
|
||||
destfile="windows/arduino-${version}-expert.zip"
|
||||
excludes="java/**" />
|
||||
-->
|
||||
|
||||
<zip destfile="windows/arduino-${version}.zip">
|
||||
<zipfileset dir="windows/work"
|
||||
prefix="arduino-${version}" />
|
||||
</zip>
|
||||
|
||||
<zip destfile="windows/arduino-${version}-expert.zip">
|
||||
<zipfileset dir="windows/work"
|
||||
prefix="arduino-${version}"
|
||||
excludes="java/**" />
|
||||
</zip>
|
||||
|
||||
<echo>
|
||||
=======================================================
|
||||
Arduino for Windows was built. Grab the archive from
|
||||
|
||||
windows/arduino-${version}.zip
|
||||
windows/arduino-${version}-expert.zip
|
||||
=======================================================
|
||||
</echo>
|
||||
</target>
|
||||
|
||||
|
||||
<!-- - - - - - - - -->
|
||||
<!-- Run It! -->
|
||||
<!-- - - - - - - - -->
|
||||
|
||||
<target name="clean" description="Perform a spring cleaning"
|
||||
depends="linux-clean, windows-clean, macosx-clean, subprojects-clean">
|
||||
</target>
|
||||
|
||||
</project>
|
BIN
build/macosx/dist/DS_Store
vendored
BIN
build/macosx/dist/DS_Store
vendored
Binary file not shown.
BIN
build/macosx/dist/background.png
vendored
BIN
build/macosx/dist/background.png
vendored
Binary file not shown.
Before Width: | Height: | Size: 10 KiB |
@ -113,6 +113,7 @@ javac \
|
||||
src/processing/app/macosx/*.java \
|
||||
src/processing/app/preproc/*.java \
|
||||
src/processing/app/syntax/*.java \
|
||||
src/processing/app/syntax/im/*.java \
|
||||
src/processing/app/tools/*.java
|
||||
|
||||
cd ../build/macosx/work/classes
|
||||
|
@ -72,8 +72,15 @@ platform.auto_file_type_associations = true
|
||||
|
||||
|
||||
# default size for the main window
|
||||
default.window.width = 500
|
||||
default.window.height = 600
|
||||
editor.window.width.default = 500
|
||||
editor.window.height.default = 600
|
||||
|
||||
editor.window.width.min = 400
|
||||
editor.window.height.min = 500
|
||||
# tested as approx 440 on OS X
|
||||
editor.window.height.min.macosx = 450
|
||||
# tested to be 515 on Windows XP, this leaves some room
|
||||
editor.window.height.min.windows = 530
|
||||
|
||||
# font size for editor
|
||||
editor.font=Monospaced,plain,12
|
||||
@ -92,6 +99,21 @@ editor.caret.blink=true
|
||||
# area that's not in use by the text (replaced with tildes)
|
||||
editor.invalid=false
|
||||
|
||||
# enable ctrl-ins, shift-ins, shift-delete for cut/copy/paste
|
||||
# on windows and linux, but disable on the mac
|
||||
editor.keys.alternative_cut_copy_paste = true
|
||||
editor.keys.alternative_cut_copy_paste.macosx = false
|
||||
|
||||
# true if shift-backspace sends the delete character,
|
||||
# false if shift-backspace just means backspace
|
||||
editor.keys.shift_backspace_is_delete = true
|
||||
|
||||
# home and end keys should only travel to the start/end of the current line
|
||||
editor.keys.home_and_end_travel_far = false
|
||||
# the OS X HI Guidelines say that home/end are relative to the document
|
||||
# if you don't like it, this is the preference to change
|
||||
editor.keys.home_and_end_travel_far.macosx = true
|
||||
|
||||
console = true
|
||||
console.output.file = stdout.txt
|
||||
console.error.file = stderr.txt
|
||||
@ -197,14 +219,14 @@ preproc.substitute_unicode = true
|
||||
# viewed in (at least) Mozilla or IE. useful when debugging the preprocessor.
|
||||
preproc.output_parse_tree = false
|
||||
|
||||
# imports to use by default (changed for 0149, some imports removed)
|
||||
preproc.imports = java.applet,java.awt,java.awt.image,java.awt.event,java.io,java.net,java.text,java.util,java.util.zip,java.util.regex
|
||||
# Changed after 1.0.9 to a new name, and also includes the specific entries
|
||||
preproc.imports.list = java.applet.*,java.awt.Dimension,java.awt.Frame,java.awt.event.MouseEvent,java.awt.event.KeyEvent,java.awt.event.FocusEvent,java.awt.Image,java.io.*,java.net.*,java.text.*,java.util.*,java.util.zip.*,java.util.regex.*
|
||||
|
||||
# set the browser to be used on linux
|
||||
browser.linux = mozilla
|
||||
|
||||
# set to the program to be used for launching apps on linux
|
||||
#launcher.linux = gnome-open
|
||||
#launcher.linux = xdg-open
|
||||
|
||||
# FULL SCREEN (PRESENT MODE)
|
||||
run.present.bgcolor = #666666
|
||||
|
@ -1,518 +1,365 @@
|
||||
PROCESSING 1.0.9 (REV 0171) - 20 October 2009
|
||||
|
||||
+ Removed NPOT texture support until further testing, because it was
|
||||
resulting in blurring images in OPENGL sketches.
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=1352
|
||||
|
||||
+ Complete the excision of the Apple menu bug code.
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=786
|
||||
|
||||
|
||||
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
||||
|
||||
|
||||
PROCESSING 1.0.8 (REV 0170) - 18 October 2009
|
||||
|
||||
A bonfire of bug fixes.
|
||||
|
||||
[ environment ]
|
||||
|
||||
+ Fix bug causing preferences to not save correctly.
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=1320
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=1322
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=1325
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=1329
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=1336
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=1337
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=1344
|
||||
|
||||
+ Remove menu dimming code, in-frame menu bar, and warning message on OS X.
|
||||
A year later, Apple fixed the spinning wheel w/ the menu bar problem.
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=786
|
||||
|
||||
+ Fix "Unrecognized option: -d32" on OS X 10.4
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=1324
|
||||
|
||||
+ Update the outdated "Get the latest Java Plug-in here" in exported applets.
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=1331
|
||||
|
||||
+ Use temporary files when saving files inside the PDE. Prevents problems
|
||||
when the save goes badly (e.g. disk is full).
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=967
|
||||
|
||||
+ Fix problem with "Save changes before closing?" was being ignored.
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=1193
|
||||
|
||||
+ Fix problems with adding/deleting tabs.
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=1332
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=1092
|
||||
|
||||
+ Saving the project with the same name (but different case)
|
||||
as an existing tab was deleting code on Windows and OS X.
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=1102
|
||||
|
||||
[ core ]
|
||||
|
||||
+ filter(RGB) supposed to be filter(OPAQUE)
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=1346
|
||||
|
||||
+ Implement non-power-of-2 textures for OpenGL (on cards where available).
|
||||
This is a partial fix for texture edge problems:
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=602
|
||||
|
||||
+ Fix get() when used with save() in OpenGL mode
|
||||
|
||||
+ Immediately update projection with OpenGL. In the past, projection
|
||||
updates required a new frame. This also prevents camera/project from
|
||||
being reset when the drawing size is changed.
|
||||
|
||||
+ Removed an error that caused the cameraNear value to be set to -8.
|
||||
This may cause other problems with drawing/clipping however.
|
||||
|
||||
+ Removed methods from PApplet that use doubles. These were only temporarily
|
||||
available in SVN, but that's that.
|
||||
|
||||
+ Use temporary file with saveStrings(File) and saveBytes(File).
|
||||
|
||||
[ updates ]
|
||||
|
||||
+ Updated to Minim 2.0.2. (Thanks Damien!)
|
||||
http://code.compartmental.net/tools/minim
|
||||
|
||||
+ Updated Java on Linux and Windows to 6u16.
|
||||
|
||||
+ Updated Quaqua to 6.2 on Mac OS X.
|
||||
|
||||
|
||||
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
||||
|
||||
|
||||
PROCESSING 1.0.7 (REV 0169) - 4 September 2009
|
||||
|
||||
Bug fixes and updates, also some tweaks for Mac OS X Snow Leopard.
|
||||
|
||||
[ changes ]
|
||||
|
||||
+ Tweaks for Mac OS X Snow Leopard, to force it to run in 32-bit mode.
|
||||
This should bring back the video library (if temporarily), and hopefully
|
||||
fix serial as well, though I didn't have a serial device handy to test.
|
||||
|
||||
+ Fix problem where line highlighting was off in 'static' mode.
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=1263
|
||||
|
||||
+ Auto-format was killing Unicode characters (how did this last so long?)
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=1312
|
||||
|
||||
+ PVector.angleDistance() returning NaN due to precision errors
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=1316
|
||||
|
||||
+ Removed a major try/catch block from PApplet.main(), hopefully
|
||||
this will allow some exception stuff to come through properly.
|
||||
|
||||
|
||||
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
||||
|
||||
|
||||
PROCESSING 1.0.6 (REV 0168) - 12 August 2009
|
||||
|
||||
Bug fixes and minor changes. Most important are replacement JOGL libraries
|
||||
so that OpenGL applets won't present an "expired certificate" error.
|
||||
|
||||
[ bug fixes ]
|
||||
|
||||
+ Replaced the faulty JOGL library that had expired certificates (Sun bug).
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=1271
|
||||
https://jogl.dev.java.net/servlets/ProjectDocumentList?folderID=9260&expandFolder=9260&folderID=0
|
||||
|
||||
+ Updated the Linux launcher script that enables Processing to be run
|
||||
from other directories, symlinks, or from launch items.
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=825
|
||||
Thanks to Ferdinand Kasper for the fix!
|
||||
|
||||
+ strokeWeight() was making lines 2x too thick with P2D
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=1283
|
||||
|
||||
+ PImage.getImage() setting the wrong image type
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=1282
|
||||
|
||||
+ image() not working with P2D, P3D, and OPENGL when noFill() used
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=1299
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=1222
|
||||
|
||||
+ Auto format problem with program deeper then 10 levels
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=1297
|
||||
|
||||
+ Fixed a crash on startup problem (console being null)
|
||||
|
||||
+ Recursive subfolder copy of library folders when exporting application
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=1295
|
||||
|
||||
[ changes ]
|
||||
|
||||
+ PDF member functions set protected instead of private
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=1276
|
||||
|
||||
+ On OS X, update Info.plist to be 32/64 explicit and also updated
|
||||
JavaApplicationStub for update 4.
|
||||
|
||||
+ Clicking the preferences location in the Preferences window will
|
||||
now open the parent folder for the preferences file.
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=1279
|
||||
|
||||
+ Update to Java 6 update 15 for the Windows and Linux releases.
|
||||
|
||||
[ fixed earlier ]
|
||||
|
||||
+ Mangled menu text with Java 6u10.
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=1065
|
||||
|
||||
|
||||
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
||||
|
||||
|
||||
PROCESSING 1.0.5 (REV 0167) - 7 June 2009
|
||||
|
||||
Bug fix release, mostly dealing with regressions from 1.0.4.
|
||||
|
||||
[ bug fixes ]
|
||||
|
||||
+ Make the tab key work again inside the editor
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=1267
|
||||
|
||||
+ Deal with duplicate entries for sketchbook in the file menu
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=1260
|
||||
|
||||
[ changes ]
|
||||
|
||||
+ Support for smooth text in the PDE editor. Set editor.antialias=true
|
||||
inside preferences.txt to enable smooth text.
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=1266
|
||||
|
||||
+ Updated reference files.
|
||||
|
||||
|
||||
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
||||
|
||||
|
||||
PROCESSING 1.0.4 (REV 0166) - 31 May 2009
|
||||
|
||||
Bug fix release.
|
||||
|
||||
[ changes ]
|
||||
|
||||
+ Changed the workaround for Apple's Java bug related to the menus in OS X.
|
||||
Rather than placing the menubar inside the sketch window, File > Sketchbook
|
||||
and File > Examples are simply dimmed out. Instead, use the Open button
|
||||
on the toolbar, which provides access to the same items. The preference
|
||||
to place the menu bar inside the window is still available, in case you
|
||||
prefer the previous workaround.
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=786
|
||||
|
||||
+ Also updated the included runtime on Windows and Linux to Java 6u14.
|
||||
|
||||
[ bug fixes ]
|
||||
|
||||
+ Fixed IDE crash when changing color scheme on windows
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=1237
|
||||
|
||||
+ Typo in the Linux shell script was preventing it from running
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=1250
|
||||
|
||||
+ OS X finder info on application updated to say 1.0.4
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=1226
|
||||
|
||||
+ Removed warning message "Non-String for 8 value in 'Properties'
|
||||
sub-dictionary in 'Java' sub-dictionary of Info.plist" on OS X
|
||||
|
||||
+ Added warning to build script for users on OS X 10.4
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=1179
|
||||
|
||||
+ Disable point() going to set() from PGraphicsJava2D. The set() command
|
||||
doesn't honor alpha consistently, and it also causes problems with PDF
|
||||
|
||||
+ PImage cacheMap problem when using PImage.get()
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=1245
|
||||
|
||||
+ Fix problems with > 512 points and P3D/OPENGL
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=1255
|
||||
Thanks to user DopeShow for the patch
|
||||
|
||||
+ imageMode(CENTER) doesn't work properly with P2D
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=1232
|
||||
|
||||
+ Reset matrices when using beginRecord() with PDF
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=1227
|
||||
|
||||
+ Resizing window no longer distorts OpenGL graphics
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=1176
|
||||
Many thanks to Pablo Funes for the patch
|
||||
|
||||
+ Fix significant point() and set() slowdown on OS X
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=1094
|
||||
|
||||
[ known issues ]
|
||||
|
||||
+ Currently no 64-bit support for any platforms. On some platforms, you'll
|
||||
simply need to replace the Java folder with the distribution with something
|
||||
more suitable for your operating system.
|
||||
|
||||
+ Command line support is currently broken
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=1048
|
||||
|
||||
+ Text of menus/interface elements sometimes mangled (e.g. toolbar repeats
|
||||
several times, other oddness). See bug report for a workaround
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=1065
|
||||
|
||||
+ Video library threading problems with other libraries
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=882
|
||||
|
||||
+ See dev.processing.org/bugs for much, much more!
|
||||
|
||||
|
||||
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
||||
|
||||
|
||||
PROCESSING 1.0.3 (REV 0165) - 24 February 2009
|
||||
|
||||
Bug fix release to repair a couple of regressions caused by changes in 1.0.2,
|
||||
as well as a couple other new problems encountered since.
|
||||
|
||||
[ bug fixes ]
|
||||
|
||||
+ endRecord or endRaw produces a RuntimeException with the PDF library
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=1169
|
||||
|
||||
+ Problem with beginRaw/endRaw and OpenGL
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=1171
|
||||
|
||||
+ Set strokeWeight on points and lines with begin/endRaw
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=1172
|
||||
|
||||
+ Fix strokeWeight quirks with P3D when used with points and lines
|
||||
|
||||
+ ArrayIndexOutOfBoundsException with point()
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=1168
|
||||
|
||||
[ changes ]
|
||||
|
||||
+ Update to iText 2.1.4 for the PDF library
|
||||
|
||||
|
||||
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
||||
|
||||
|
||||
PROCESSING 1.0.2 (REV 0164) - 21 February 2009
|
||||
|
||||
This release fixes many bugs and adds two minor functions to the XML library.
|
||||
|
||||
[ bug fixes ]
|
||||
|
||||
+ Empty "code" folder causing problems with Export
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=1084
|
||||
|
||||
+ Sketches not loading when .pde file is opened from the Windows Explorer
|
||||
on Asian Windows systems.
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=1089
|
||||
|
||||
+ Disable copying of metadata and resource forks in OS X build
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=1098
|
||||
|
||||
+ Suppress goofy Apple error message about JVMArchs
|
||||
|
||||
+ StringIndexOutOfBoundsException caused by import statements with no dots
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=1145
|
||||
|
||||
+ Pressing <Esc> in "Are you sure you want to Quit?" dialog causes quit
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=1134
|
||||
|
||||
+ Fix QUADS and QUAD_STRIP with P2D
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=1162
|
||||
|
||||
+ ArrayIndexOutOfBoundsException when drawing curves in P3D and OPENGL
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=1153
|
||||
|
||||
+ Problems with negatve arc() angles in OpenGL, P3D, other inconsistencies
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=1095
|
||||
|
||||
+ requestImage() causing problems with JAVA2D
|
||||
|
||||
+ Fix minor strokeWeight bug with OpenGL
|
||||
|
||||
+ Minor bug fix to SVG files that weren't being resized properly
|
||||
|
||||
+ OpenGL is rendering darker in 0149+
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=958
|
||||
Thanks to Dave Bollinger for tracking this down and providing a solution
|
||||
|
||||
+ OutOfMemoryError with ellipse() in P3D and OPENGL
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=1086
|
||||
|
||||
+ ArrayIndexOutOfBoundsException with P3D and OPENGL
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=1117
|
||||
|
||||
+ point(x,y) ignores noStroke() in some renderers
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=1090
|
||||
|
||||
+ Fix Windows startup problem when scheme coloring was odd
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=1109
|
||||
Changes to the system theme could cause Processing to not launch
|
||||
|
||||
+ Fix several point() problems with P3D
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=1110
|
||||
|
||||
+ nextPage() not working properly with PDF as the renderer
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=1131
|
||||
|
||||
+ Save style information when nextPage() is called in PDF renderer
|
||||
|
||||
+ beginRaw() broken (no DXF, etc working)
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=1099
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=1144
|
||||
|
||||
+ Fix algorithm for quadratic to cubic curve conversion
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=1122
|
||||
Thanks to user bits.in.shambles for providing a fix.
|
||||
|
||||
+ tint() not working in P2D
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=1132
|
||||
|
||||
+ blend() y coordinates inverted when using OpenGL
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=1137
|
||||
|
||||
+ Fix for getChild() and getChildren() with XML elements that have null names
|
||||
|
||||
[ additions ]
|
||||
|
||||
+ Added listChildren() method to XMLElement
|
||||
|
||||
+ Added optional toString(boolean) parameter to enable/disable indents
|
||||
in XMLElement
|
||||
|
||||
|
||||
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
||||
|
||||
|
||||
PROCESSING 1.0.1 (REV 0163) - 29 November 2008
|
||||
|
||||
Processing 1.0 has arrived! You can read an overview of changes introduced
|
||||
in the last few months here: http://processing.org/reference/changes.html
|
||||
|
||||
Also see the "known issues" section of the troubleshooting page:
|
||||
http://processing.org/reference/troubleshooting/#known
|
||||
|
||||
This release (1.0.1) fixes a handful of issues that only showed up once we
|
||||
had more testing, particularly with the wider audience we've received in the
|
||||
past week following the announcement.
|
||||
|
||||
[ bug fixes ]
|
||||
|
||||
+ ArrayIndexOutOfBoundsException with File > New
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=1067
|
||||
|
||||
+ "CallStaticVoidMethod() threw an exception" on some Mac OS X machines
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=1063
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=1078
|
||||
|
||||
+ "editor.indent" preference setting does not work properly
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=1073
|
||||
|
||||
+ Fixed some "An error occurred while starting the application" problems
|
||||
|
||||
+ Added a note about the Minim library to the changes page.
|
||||
|
||||
+ Disable parsing of regexps with the split() command
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=1060
|
||||
|
||||
+ Fixed ArrayIndexOutOfBoundsException in ellipseImpl().
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=1068
|
||||
|
||||
+ Fixed problem where small ellipses weren't showing up.
|
||||
|
||||
[ changes ]
|
||||
|
||||
+ Implement multi-line tab via tab key (also outdent)
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=1075
|
||||
|
||||
+ Code with 'import' and a space incorrectly parsed as an import statement
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=1064
|
||||
|
||||
|
||||
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
||||
|
||||
|
||||
PROCESSING 1.0 (REV 0162) - 24 November 2008
|
||||
|
||||
Processing 1.0 has arrived! You can read an overview of changes introduced
|
||||
in the last few months here: http://processing.org/reference/changes.html
|
||||
|
||||
[ known issues ]
|
||||
|
||||
+ Sketches that size(w, h, OPENGL) and do not clear the background on each
|
||||
frame can cause major flickering or problems when the screen clears anyway.
|
||||
There are several possible solutions:
|
||||
|
||||
1. You may need to disable the default 2x smoothing by using
|
||||
hint(DISABLE_OPENGL_2X_SMOOTH).
|
||||
ARDUINO 0018 - 2010.01.29
|
||||
|
||||
[core / libraries]
|
||||
|
||||
* Added tone() and noTone() functions for frequency generation.
|
||||
* Added Serial.end() command.
|
||||
* Added precision parameter for printing of floats / doubles.
|
||||
* Incorporated latest version of Firmata.
|
||||
* Fixed bug w/ disabling use of the RW pin in the LiquidCrystal library.
|
||||
* No longer disabling interrupts in delayMicroseconds().
|
||||
* Fixed bug w/ micros() returning incorrect values from within an interrupt.
|
||||
* Fixed bug that broke use of analog inputs 8-15 on the Mega.
|
||||
|
||||
[environment]
|
||||
|
||||
* Synchronized with the Processing 1.0.9 code base, bringing various fixes,
|
||||
including to a bug causing saving to fail when closing the last sketch.
|
||||
|
||||
* Added support for third-party hardware in the SKETCHBOOK/hardware folder,
|
||||
mirroring the current structure of the hardware folder in Arduino.
|
||||
|
||||
* Added Ctrl-Shift-M / Command-Shift-M shortcut for serial monitor.
|
||||
|
||||
* Hold down shift when pressing the Verify / Compile or Upload toolbar
|
||||
buttons to generate verbose output (including command lines).
|
||||
|
||||
* Moving build (on upload) from the applet/ sub-folder of the sketch
|
||||
to a temporary directory (fixing problems with uploading examples from
|
||||
within the Mac OS X disk image or a Linux application directory).
|
||||
|
||||
* Fixed bug the prevented the inclusion of .cpp and .h (or .c and .h) files
|
||||
of the same name in a sketch.
|
||||
|
||||
* Improved the Mac OS X disk image (.dmg): added a shortcut to the
|
||||
Applications folder, a background image with arrow, and new FTDI drivers.
|
||||
|
||||
ARDUINO 0017 - 2009.07.25
|
||||
|
||||
[documentation / examples]
|
||||
* Many new and revised examples from Tom Igoe.
|
||||
|
||||
[core / libraries]
|
||||
* Updated LiquidCrystal library by Limor Fried. See reference for details.
|
||||
* Updated Firmata library to version 2.1 (rev. 25).
|
||||
* Replaced the Servo library with one (MegaServo) by Michael Margolis.
|
||||
Supports up to 12 servos on most Arduino boards and 48 on the Mega.
|
||||
* Improving the accuracy of the baud rate calculations for serial
|
||||
communication (fixing double-speed problems on 8 MHz Arduino boards).
|
||||
Thanks to gabebear.
|
||||
|
||||
[environment]
|
||||
* Synchronized with the Processing 1.0.3 code base (rev. 5503), bringing
|
||||
many improvements (listed below).
|
||||
* New icons and about image by Thomas Glaser (envis precisely).
|
||||
* Support for multiple sketch windows.
|
||||
* The serial monitor now has its own window.
|
||||
* Comment / Uncomment menu item (in Edit) and keyboard shortcut.
|
||||
* Increase and Decrease Indent menu items (in Edit) and keyboard shortcuts.
|
||||
* Support for third-party libraries in the SKETCHBOOK/libraries folder.
|
||||
* Libraries are now compiled with the sketch, eliminating the delay when
|
||||
switching boards and the need to delete .o files when changing library
|
||||
source code.
|
||||
* Arduino now comes as an app file (in a dmg) on the Mac.
|
||||
* Adding the Arduino Nano w/ ATmega328 to the Tools > Board menu.
|
||||
|
||||
ARDUINO 0016 - 2009.05.30
|
||||
|
||||
[documentation / examples]
|
||||
* New communication examples (w/ corresponding Processing and Max/MSP code) by
|
||||
Tom Igoe.
|
||||
|
||||
[core / libraries]
|
||||
* Adding support for the Arduino Pro and Pro Mini 3.3V / 8 MHz w/ ATmega328.
|
||||
* Adding support for the LilyPad Arduino w/ ATmega328.
|
||||
* Adding write(str) and write(buf, size) methods to Print, Serial, and the
|
||||
Ethernet library Client and Server classes. This allows for more efficient
|
||||
(fewer packet) Ethernet communication. (Thanks to mikalhart.)
|
||||
* Improvements to the way the Ethernet library Client class connects and
|
||||
disconnects. Should reduce or eliminate failed connections and long
|
||||
timeouts. (Thanks to Bruce Luckcuck.)
|
||||
* Optimizing the timer0 overflow interrupt handler (used for millis() and
|
||||
micros()). Thanks to westfw and mikalhart.
|
||||
* Fixing bug that limited the bit() macro to 15 bits. Thanks to Paul Badger.
|
||||
* Adding ARDUINO version constant (thanks to prodding from mikalhart).
|
||||
|
||||
2. Update the drivers for your graphics card.
|
||||
[environment]
|
||||
* Ordering the items in the Tools > Board menu.
|
||||
* Adding "Copy as HTML" command to the Tools menu.
|
||||
* Eliminating (maybe) the occasional "Couldn't determine program size" errors.
|
||||
Thanks to the Clever Monkey.
|
||||
* Moving selection of Linux look-and-feel into the arduino script so it can
|
||||
be changed by users. Thanks to Eberhard Fahle.
|
||||
|
||||
[tools]
|
||||
* Adding automatic dependency generation to the Makefile. (Lars Immisch)
|
||||
|
||||
3. Get a decent graphics card -- the OpenGL renderer is for advanced
|
||||
use, we don't support using it with cheaper built-in graphics hardware
|
||||
like the Intel GMA 950.
|
||||
ARDUINO 0015 - 2009.03.26
|
||||
|
||||
4. If you're running Windows Vista, try disabling the Aero theme.
|
||||
[core / libraries]
|
||||
* Adding support for the Arduino Mega (ATmega1280).
|
||||
|
||||
This flickering issue is being tracked here:
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=1056
|
||||
[environment]
|
||||
* Reinstating use of core.a library in the build process, slightly shrinking
|
||||
compiled sketch sizes. (Thanks to William Westfield.)
|
||||
* Fixing bug in copy for forum (thanks to eried).
|
||||
|
||||
+ "An error occurred while starting the application" when launching
|
||||
Processing.exe on Windows. This is a high priority however we cannot
|
||||
reproduce it on any of our test machines, which has delayed a fix.
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=986
|
||||
ARDUINO 0014 - 2009.03.07
|
||||
|
||||
+ With P2D, P3D, and OPENGL, series of connected lines (such as the stroke
|
||||
around a polygon, triangle, or ellipse) produce unattractive results when
|
||||
strokeWeight is set.
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=955
|
||||
[core / libraries]
|
||||
* Fixing bug that prevented multiple outgoing Client connections with the
|
||||
ethernet library.
|
||||
|
||||
[environment]
|
||||
* Clarifying ATmega168 vs. ATmega328 in the Tools > Boards menu.
|
||||
|
||||
+ Unlike most applications, the menu bar is inside the editor window when
|
||||
Processing is used with Mac OS X 10.5. This is a workaround for an Apple
|
||||
bug in Java 1.5 and 1.6 on Mac OS X 10.5 that causes the menu bar to be
|
||||
so excessively slow that the application appears to have crashed.
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=786
|
||||
[tools]
|
||||
* Updating the Mac OS X AVR tools to AVR MacPack 20081213. This includes
|
||||
avr-gcc 4.3.2, which should fix problems with functions called from
|
||||
within interrupts.
|
||||
|
||||
Please file a bug report with Apple at bugreporter.apple.com if you want
|
||||
this fixed. The problem has existed since the spring, and we first filed
|
||||
a bug with them in June, and we have received no indication that it when
|
||||
it will be fixed, or if it will ever be fixed.
|
||||
ARDUINO 0013 - 2009.02.06
|
||||
|
||||
Or if you want to take your chances with the slow menu bar,
|
||||
you can change the default setting in the Preferences window.
|
||||
[documentation / examples]
|
||||
* Adding examples for Parallax Ping Sensor and Memsic 2125 accelerometer.
|
||||
|
||||
+ Sketches that use the video library plus OpenGL have a problem on some
|
||||
OS X machines. The workaround is listed in Comment #16 of this bug:
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=882#c16
|
||||
[core / libraries]
|
||||
* Adding support for the ATmega328. The upload speed is 57600 baud, so you
|
||||
may need to edit boards.txt or reburn your bootloader if you bought an
|
||||
ATmega328 w/ bootloader from adafruit or other supplier.
|
||||
* Adding support for printing floats to Print class (meaning that it works
|
||||
in the Serial, Ethernet, and LiquidCrystal classes too). Includes two
|
||||
decimal places.
|
||||
* Added word, word(), bitRead(), bitWrite(), bitSet(), bitClear(), bit(),
|
||||
lowByte(), and highByte(); see reference for details.
|
||||
* Working around problem that caused PWM output on pins 5 and 6 to never go
|
||||
to 0 (causing, for example, an LED to continue to glow faintly).
|
||||
* Removing cast macros, since function-style casts are a feature of C++. This
|
||||
should fix contributed libraries that broke in Arduino 0012.
|
||||
* Modifying pulseIn() to wait for a transition to start timing (i.e. ignoring
|
||||
any pulse that had already started when the function was called).
|
||||
* Fixing bug in random() that limited the ranges of values generated. Thanks
|
||||
to Mikal Hart.
|
||||
* Modifying delay() to pause for at least the given number of milliseconds.
|
||||
* Fixing bug in Ethernet library that interfered with use of pins 8 and 9.
|
||||
* Originating each outgoing network connection from a different port (in the
|
||||
Client class of the Ethernet library). Thanks to Paul and joquer.
|
||||
* Updating ATmega168 bootloader to work with standard distributions of avrdude
|
||||
(responding to signature requests made with the universal SPI command) and
|
||||
correctly store EEPROM data. Thanks to ladyada.
|
||||
|
||||
[environment]
|
||||
* Omitting unused functions from compiled sketches, reducing their size.
|
||||
* Changing compilation process to allow for use of EEMEM directive (although
|
||||
not yet uploading EEPROM data).
|
||||
|
||||
+ Command line support arrived in a recent release, but is not working yet.
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=1048
|
||||
ARDUINO 0012 - 2008.09.18
|
||||
|
||||
+ OpenGL rendering is more dim/darker in release 0149 and later.
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=958
|
||||
Any help tracking this down would be most appreciated.
|
||||
* Added Arduino Nano to the boards menu.
|
||||
* Arduino Pro or Pro Mini (8 MHz) to the boards menu.
|
||||
* Added Firmata library by Hans Steiner and others. This provides a standard
|
||||
protocol for communicating with software on the computer.
|
||||
* Added an Ethernet library for use with the Arduino Ethernet Shield.
|
||||
* Added a Servo library based on the work of Jim Studt.
|
||||
* Added a LiquidCrystal library based on the work in the playground. It
|
||||
supports both 4- and 8-bit modes.
|
||||
* Improved millis(): it now overflows after 49 days instead of 9 hours, but
|
||||
now uses slightly more processing power.
|
||||
* Fixed reversing direction bug in Stepper library. (Thanks to Wayne Holder.)
|
||||
* Moved insertion of #include <WProgram.h> to after any comments and #include
|
||||
statements in the main sketch file. This means that an #include <stdlib.h>
|
||||
now works.
|
||||
* Upgraded to newer versions of avr-gcc (4.3.0) and avr-libc (1.6). This
|
||||
provides support for newer Atmel chips, but may increase the size
|
||||
of sketches.
|
||||
* Allowing per-board specification of the upload.using preference, allowing
|
||||
upload via bootloader to some boards and via a programmer to others.
|
||||
* Added return values to some functions in the Wire library to allow for
|
||||
better error handling.
|
||||
* Fixed random() to work with long values.
|
||||
* Creation of an abstract Print base-class to allow Serial, SoftwareSerial,
|
||||
and LiquidCrystal to share code for print() and println().
|
||||
* Incorporated ladyada's watchdog timer mods to the bootloader source, but
|
||||
only compiling them in for the Pro and Pro Mini (because they are included
|
||||
in the bootloader being burned on the boards by SparkFun).
|
||||
|
||||
+ The first few frames of OpenGL sketches on Windows run slowly.
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=874
|
||||
ARDUINO 0011 - 2008.03.28
|
||||
|
||||
+ When used with P3D, strokeWeight does not interpolate the Z-coordinates
|
||||
of the lines, which means that when rotated, these flat lines may
|
||||
disappear. (Since, uh, lines are, you know, flat.) The OPENGL renderer
|
||||
setting does not share this problem because it always draws lines
|
||||
perpendicular to the screen (which we hope to do in a future release).
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=956
|
||||
* Fixed Find in Reference.
|
||||
* Added map() function for mapping values from one range to another.
|
||||
* Added analogReference() function.
|
||||
* Added interrupts() and noInterrupts() functions.
|
||||
* Added degrees() and radians() functions.
|
||||
* Added timeout parameter (in microseconds) to pulseIn(); default is 1 second.
|
||||
* Support for uploading sketch using a programmer.
|
||||
* Improved detection of functions that need prototyping.
|
||||
* Placing function prototypes after #include's and #define's.
|
||||
* No longer moving #include statements to the top of the sketch.
|
||||
* Can now drag .pde files onto the Arduino dock icon on Mac OS X.
|
||||
Thanks to Peter Sgouros.
|
||||
* New script for downloading the reference from Tom Pollard. Thanks Tom!
|
||||
* Miscellaneous Mac OS X and other patches from Wim Lewis. Thanks Wim!
|
||||
* Updated Mac OS X FTDI drivers.
|
||||
|
||||
ARDUINO 0010 - 2007.10.11
|
||||
|
||||
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
||||
* Support for the LilyPad Arduino.
|
||||
* Vista support.
|
||||
* Mac OS X universal distribution.
|
||||
* Printing!
|
||||
* Copy for discourse.
|
||||
* New Board menu replaces the Microcontroller menu.
|
||||
* New Burn Bootloader menu offers a choice of programmers.
|
||||
* New and improved keyboard shortcuts.
|
||||
* Fixed some find/replace bugs.
|
||||
* Better auto-format.
|
||||
* Improved error messages when uploading.
|
||||
* Support for COM10 and higher on Windows.
|
||||
* Fixed automatic refresh of the Serial Port menu under Windows.
|
||||
* Quaqua look-and-feel on Mac OS X.
|
||||
* Reorganization of the Arduino application directory.
|
||||
|
||||
ARDUINO 0009 - 2007.08.06
|
||||
|
||||
in spite of their historical feel good campiness, i've removed the
|
||||
notes from earlier releases because this file was getting out of hand.
|
||||
* Added support for the Arduino Diecimila.
|
||||
* Switched to using avrdude (instead of uisp) for uploading sketches.
|
||||
* Added the ability to burn NG and Diecimila bootlaoders (with an AVRISPmkII).
|
||||
* Fixed a bug in SoftwareSerial (a hardware serial function was being called
|
||||
instead of the software serial equivalent). Thanks to brianbr for the
|
||||
report and fix.
|
||||
|
||||
ARDUINO 0008 - 2007.06.09
|
||||
|
||||
* Updated examples (in distribution and on the website).
|
||||
* Added an EEPROM library (see reference for details).
|
||||
* Added a Stepper motor library (see reference).
|
||||
* Patched to reduce binary sketch sizes by building the Arduino core as
|
||||
a library (.a) file - now only the needed parts of the core are linked into
|
||||
a sketch. Originally written by Nicolas Roland, revised by Don Cross.
|
||||
* Fixed bug in Serial.available(). Report and fix by Don Cross.
|
||||
* Now recompiling libraries when switching microcontrollers. Report by
|
||||
Julian Bleecker; fix by Nicholas Zambetti.
|
||||
* Cleaned up core functions: moved pin definitions into program space to save
|
||||
RAM, and other minor improvements. Contributed by Jim Studt.
|
||||
* Lots of reference additions and fixes from Paul Badger.
|
||||
* Changed default microcontroller to ATmega168 from ATmega8.
|
||||
* Removed the delay from analogRead().
|
||||
* Activating TWI/I2C pullup resistors on the ATmega168 (in addition to the
|
||||
ATmega8).
|
||||
|
||||
ARDUINO 0007 - 2006.12.25
|
||||
|
||||
* Smaller core (about 3.5 KB instead of 4.5 KB).
|
||||
* Added a SoftwareSerial library (thanks to Antonio, Heather Dewey-Hagborg, and
|
||||
bigengineer for their help).
|
||||
* Implemented a Serial.flush() routine; see reference for details.
|
||||
* Digital pins 0 and 1 can be used for i/o until a call to Serial.begin().
|
||||
* Replaced avr-lib's uart routines with custom code for handling serial
|
||||
communication and modified C++ serial commands to call the C serial commands;
|
||||
the code may behave slightly differently in border cases (e.g. non-standard
|
||||
speeds, or on overflow).
|
||||
* Added attachInterrupt() and detachInterrupt() functions for handling of
|
||||
external interrupts on pins 2 and 3.
|
||||
* Implemented shiftOut() routine; see reference for details.
|
||||
* Defining binary constants: e.g. B1010 is 6.
|
||||
* Mac versions no longer require running of the macosx_setup.command script.
|
||||
* Windows version comes with the FTDI USB drivers already unzipped.
|
||||
* New Linux binary distribution (still requires some programs to be
|
||||
pre-installed).
|
||||
|
||||
ARDUINO 0006 - 2006.10.21
|
||||
|
||||
* Mac version no longer requires Java 1.5, meaning it should run on 10.3.9.
|
||||
* Added support for analog inputs 6 and 7 and pwm on pins 5 and 6 on the
|
||||
on the ATmega168 used in the Arduino Mini (extra analog inputs not available
|
||||
in DIP ATmega168s).
|
||||
* You now select the baud rate for the serial monitor from within the editor
|
||||
status bar when the serial monitor is running instead of from the Tools menu.
|
||||
* Pressing enter within the serial monitor edit box no longer appends a newline
|
||||
to the message sent to the board.
|
||||
* Included the Wire (TWI) library from Wiring.
|
||||
* Updated the reference.
|
||||
|
||||
ARDUINO 0005 - 2006.09.26
|
||||
|
||||
* Applied patch from Hans Steiner to improve Linux support by searching for avr
|
||||
tools in the user's path instead of expecting them at a fixed location.
|
||||
* Added an upload.verbose preference for help in debugging.
|
||||
* ATmega168 support!
|
||||
* New Wiring-compatible randomSeed(), random(max) and random(min, max) functions
|
||||
(except operating on longs instead of floats).
|
||||
* Fixed bug that sometimes caused uploading of old versions of a sketch.
|
||||
* Serial monitor nows include an interface to send messages to the Arduino
|
||||
board. Pressing return appends a newline, pushing the send button doesn't.
|
||||
* Now displaying "burning bootloader..." and "compiling..." status messages.
|
||||
|
||||
ARDUINO 0004 - 2006.04.26
|
||||
|
||||
* Main sketch is now compiled as C++ (instead of C).
|
||||
* Updated avr toolchain.
|
||||
* printInteger(), printHex(), etc. now handle longs.
|
||||
* millis() fixed (now overflows after days, not minutes)
|
||||
* Fixed path to java in Windows run.bat.
|
||||
* Added Matrix and Sprite libraries (written with Nicholas Zambetti).
|
||||
* PWM now working on pin 11 (in addition to pins 9 and 10).
|
||||
* Slowed PWM frequency (on all three PWM pins) to 1KHz.
|
||||
* Now give an error if compiled sketch is too big.
|
||||
* Fixed abs(), min(), max(), and constrain() macros.
|
||||
* Added menu items to the IDE to burn bootloader.
|
||||
* Now display binary sketch size on upload, and give error if too big.
|
||||
* Added C++ serial library.
|
||||
* Resynced with Processing/Wiring IDE code (improved auto-format, faster logging
|
||||
to serial monitor console, other bug fixes)
|
||||
* New library system.
|
||||
* Updated to latest version of the RXTX serial library; Mac users will need to
|
||||
rerun macosx_setup.command.
|
||||
|
||||
ARDUINO 0003 - 2006.01.16
|
||||
|
||||
API Changes
|
||||
* Reversed the analog input pins to correspond to newer boards. This means
|
||||
a call, for example, to analogRead(0) must be changed to analogRead(5) in
|
||||
order to read the same physical pin.
|
||||
* Added a printNewline() function (which sends '\n' = ASCII 10).
|
||||
|
||||
New Stuff
|
||||
* Reference is included (features native to C not yet documented).
|
||||
* Serial monitor added (click the toolbar button to turn it on or off). Baud
|
||||
rate is controlled by the Serial Monitor Baud Rate Menu, defaults to 9600.
|
||||
Icon and implementation from Wiring.
|
||||
* Serial port menu now automatically refreshes when opened.
|
||||
* New blue color scheme and icons courtesy of Noah Shibley (colors are hardcoded
|
||||
into the source to ensure consistency with image files).
|
||||
* Keyspan and FTDI USB drivers included with Mac and Windows distributions.
|
||||
|
||||
Bug Fixes
|
||||
* millis() now updates every millisecond instead of every second.
|
||||
* Bootloader included with Windows distribution (it was already in the Mac
|
||||
dist).
|
||||
* Updated icon of the Windows executable.
|
||||
* Now flushing the serial port before uploading (should fix some errors).
|
||||
* Improved accuracy of the delayMicroseconds() function.
|
||||
|
||||
Other
|
||||
* Upload rate no longer selectable from a menu within the IDE. Instead, edit
|
||||
the serial.download_rate item in the preferences.txt file.
|
||||
* Created Xcode project for building Arduino on the Mac (doesn't yet regenerate
|
||||
the grammar files or package the distribution); active target should be "App".
|
||||
* Removed unused or unimplemented items from menus.
|
||||
|
||||
ARDUINO 0002 - 2005.10.05
|
||||
|
||||
* New build process no longer uses makefiles; now controlled by preferences.txt.
|
||||
* core/ replaced with targets/; can now link against Wiring libraries.
|
||||
* Replaced print() with printString, printInteger, printHex, printByte, etc.
|
||||
* Added menu for selecting serial port speed.
|
||||
* Updated icon.
|
||||
* Bootloader shrunk to less than 1 KB; fuses updated accordingly.
|
||||
* Added serialRead(), serialAvailable(), and delayMicroseconds().
|
||||
|
||||
ARDUINO 0001 - 2005.08.25
|
||||
|
||||
* This is the first released of the unified IDE + language library
|
||||
it's a terrible hack... but it works. at the moment it's in alpha stage
|
||||
but it can be used to work.
|
||||
* The processing preprocessor is included but not used.
|
||||
|
@ -1,17 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>core</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>processing-core</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
|
@ -1,261 +1,271 @@
|
||||
#Thu Aug 28 17:36:28 EDT 2008
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
|
||||
org.eclipse.jdt.core.compiler.compliance=1.5
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.5
|
||||
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
|
||||
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=18
|
||||
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_assignment=0
|
||||
org.eclipse.jdt.core.formatter.alignment_for_binary_expression=18
|
||||
org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=82
|
||||
org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
|
||||
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=18
|
||||
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=18
|
||||
org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
|
||||
org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
|
||||
org.eclipse.jdt.core.formatter.blank_lines_after_package=1
|
||||
org.eclipse.jdt.core.formatter.blank_lines_before_field=1
|
||||
org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
|
||||
org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
|
||||
org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
|
||||
org.eclipse.jdt.core.formatter.blank_lines_before_method=1
|
||||
org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
|
||||
org.eclipse.jdt.core.formatter.blank_lines_before_package=0
|
||||
org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
|
||||
org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
|
||||
org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
|
||||
org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
|
||||
org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
|
||||
org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
|
||||
org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
|
||||
org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
|
||||
org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
|
||||
org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
|
||||
org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
|
||||
org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
|
||||
org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
|
||||
org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
|
||||
org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
|
||||
org.eclipse.jdt.core.formatter.comment.format_block_comments=true
|
||||
org.eclipse.jdt.core.formatter.comment.format_header=false
|
||||
org.eclipse.jdt.core.formatter.comment.format_html=true
|
||||
org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
|
||||
org.eclipse.jdt.core.formatter.comment.format_line_comments=true
|
||||
org.eclipse.jdt.core.formatter.comment.format_source_code=true
|
||||
org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
|
||||
org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
|
||||
org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
|
||||
org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
|
||||
org.eclipse.jdt.core.formatter.comment.line_length=80
|
||||
org.eclipse.jdt.core.formatter.compact_else_if=true
|
||||
org.eclipse.jdt.core.formatter.continuation_indentation=2
|
||||
org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
|
||||
org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
|
||||
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
|
||||
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
|
||||
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
|
||||
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
|
||||
org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
|
||||
org.eclipse.jdt.core.formatter.indent_empty_lines=false
|
||||
org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
|
||||
org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
|
||||
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
|
||||
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
|
||||
org.eclipse.jdt.core.formatter.indentation.size=2
|
||||
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert
|
||||
org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
|
||||
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
|
||||
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
|
||||
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
|
||||
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
|
||||
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
|
||||
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
|
||||
org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
|
||||
org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
|
||||
org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
|
||||
org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
|
||||
org.eclipse.jdt.core.formatter.lineSplit=80
|
||||
org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
|
||||
org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
|
||||
org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
|
||||
org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
|
||||
org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
|
||||
org.eclipse.jdt.core.formatter.tabulation.char=space
|
||||
org.eclipse.jdt.core.formatter.tabulation.size=2
|
||||
org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
|
||||
org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
|
||||
#Thu Mar 04 09:10:18 EST 2010
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.5
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.5
|
||||
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
|
||||
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=18
|
||||
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=18
|
||||
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=20
|
||||
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_assignment=0
|
||||
org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
|
||||
org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
|
||||
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=36
|
||||
org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=18
|
||||
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=18
|
||||
org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
|
||||
org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
|
||||
org.eclipse.jdt.core.formatter.blank_lines_after_package=1
|
||||
org.eclipse.jdt.core.formatter.blank_lines_before_field=0
|
||||
org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
|
||||
org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
|
||||
org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
|
||||
org.eclipse.jdt.core.formatter.blank_lines_before_method=1
|
||||
org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
|
||||
org.eclipse.jdt.core.formatter.blank_lines_before_package=0
|
||||
org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=0
|
||||
org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
|
||||
org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
|
||||
org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
|
||||
org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
|
||||
org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
|
||||
org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
|
||||
org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
|
||||
org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
|
||||
org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
|
||||
org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
|
||||
org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
|
||||
org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
|
||||
org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
|
||||
org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
|
||||
org.eclipse.jdt.core.formatter.comment.format_block_comments=false
|
||||
org.eclipse.jdt.core.formatter.comment.format_header=false
|
||||
org.eclipse.jdt.core.formatter.comment.format_html=true
|
||||
org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=false
|
||||
org.eclipse.jdt.core.formatter.comment.format_line_comments=false
|
||||
org.eclipse.jdt.core.formatter.comment.format_source_code=true
|
||||
org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
|
||||
org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
|
||||
org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
|
||||
org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
|
||||
org.eclipse.jdt.core.formatter.comment.line_length=80
|
||||
org.eclipse.jdt.core.formatter.compact_else_if=true
|
||||
org.eclipse.jdt.core.formatter.continuation_indentation=2
|
||||
org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
|
||||
org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
|
||||
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
|
||||
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
|
||||
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
|
||||
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
|
||||
org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
|
||||
org.eclipse.jdt.core.formatter.indent_empty_lines=false
|
||||
org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
|
||||
org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
|
||||
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
|
||||
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
|
||||
org.eclipse.jdt.core.formatter.indentation.size=2
|
||||
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert
|
||||
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
|
||||
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert
|
||||
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
|
||||
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
|
||||
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
|
||||
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
|
||||
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
|
||||
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
|
||||
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
|
||||
org.eclipse.jdt.core.formatter.join_lines_in_comments=true
|
||||
org.eclipse.jdt.core.formatter.join_wrapped_lines=true
|
||||
org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
|
||||
org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
|
||||
org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
|
||||
org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
|
||||
org.eclipse.jdt.core.formatter.lineSplit=80
|
||||
org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
|
||||
org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
|
||||
org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
|
||||
org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
|
||||
org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
|
||||
org.eclipse.jdt.core.formatter.tabulation.char=space
|
||||
org.eclipse.jdt.core.formatter.tabulation.size=2
|
||||
org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
|
||||
org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
|
||||
|
@ -1,5 +1,5 @@
|
||||
#Thu Jan 10 10:50:38 PST 2008
|
||||
#Fri Feb 19 16:20:47 EST 2010
|
||||
eclipse.preferences.version=1
|
||||
formatter_profile=_two spaces no tabs
|
||||
formatter_profile=_processing
|
||||
formatter_settings_version=11
|
||||
org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8"?><templates/>
|
||||
|
26
core/build.xml
Normal file
26
core/build.xml
Normal file
@ -0,0 +1,26 @@
|
||||
<?xml version="1.0"?>
|
||||
<project name="Processing Core" default="build">
|
||||
|
||||
<target name="clean" description="Clean out the build directories">
|
||||
<delete dir="bin" />
|
||||
<delete file="core.jar" />
|
||||
</target>
|
||||
|
||||
<target name="compile" description="Compile">
|
||||
<taskdef name="methods"
|
||||
classname="PAppletMethods"
|
||||
classpath="methods/methods.jar" />
|
||||
<methods dir="${basedir}/src/processing/core" />
|
||||
|
||||
<mkdir dir="bin" />
|
||||
<javac target="1.5"
|
||||
encoding="UTF-8"
|
||||
includeAntRuntime="false"
|
||||
srcdir="src" destdir="bin"/>
|
||||
</target>
|
||||
|
||||
<target name="build" depends="compile" description="Build core library">
|
||||
<jar basedir="bin" destfile="core.jar" />
|
||||
</target>
|
||||
|
||||
</project>
|
@ -1,3 +1,58 @@
|
||||
0178 core (private)
|
||||
X filter(DILATE/ERODE)
|
||||
X dilate(boolean) has bug in clamping of top kernel coordinate
|
||||
X http://dev.processing.org/bugs/show_bug.cgi?id=1477
|
||||
X deprecated 'screen', adding screenW and screenH
|
||||
X write implementation for get/set methods inside PImage (w/o pixels[])
|
||||
|
||||
|
||||
0177 core (private)
|
||||
X no changes
|
||||
|
||||
|
||||
0176 core (private)
|
||||
X opengl sketches run at 30fps in present mode on OS X
|
||||
o still having problems w/ full screen non-FSEM
|
||||
X http://dev.processing.org/bugs/show_bug.cgi?id=1425
|
||||
X PFont not working well with lots of characters
|
||||
X only create bitmap chars on the fly when needed (in createFont)
|
||||
X Implement better caching mechanism when creating large fonts
|
||||
X http://dev.processing.org/bugs/show_bug.cgi?id=1111
|
||||
X fix problem with "create font" still showing anti-aliased text
|
||||
X don't make fonts power of 2
|
||||
X PGraphics3D: beginDraw does not release old textures
|
||||
X http://dev.processing.org/bugs/show_bug.cgi?id=1423
|
||||
X fix from taifun_browser
|
||||
X removing camera() and perspective() from setSize() trashes resize
|
||||
X probably regression b/c camera/perspective can't be called then
|
||||
X http://dev.processing.org/bugs/show_bug.cgi?id=1391
|
||||
|
||||
|
||||
0175 core (private)
|
||||
X changed createInputRaw() to only bother checking URLs if : present
|
||||
|
||||
|
||||
0174 core (private)
|
||||
X svg paths that use 'e' (exponent) not handled properly
|
||||
X http://dev.processing.org/bugs/show_bug.cgi?id=1408
|
||||
|
||||
|
||||
0173 core (private)
|
||||
X Re-enabled hack for temporary clipping.
|
||||
X Clipping still needs to be implemented properly, however. Please help!
|
||||
X http://dev.processing.org/bugs/show_bug.cgi?id=1393
|
||||
|
||||
|
||||
0172 core (private)
|
||||
X no changes to the core (or were there?)
|
||||
|
||||
|
||||
0171 core (1.0.9)
|
||||
X Blurred PImages in OPENGL sketches
|
||||
X removed NPOT texture support (for further testing)
|
||||
X http://dev.processing.org/bugs/show_bug.cgi?id=1352
|
||||
|
||||
|
||||
0170 core (1.0.8)
|
||||
X added some min/max functions that work with doubles
|
||||
X not sure if those are staying in or not
|
||||
|
7
core/methods/.classpath
Normal file
7
core/methods/.classpath
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="lib" path="/usr/share/ant/lib/ant.jar"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
17
core/methods/.project
Normal file
17
core/methods/.project
Normal file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>preproc</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
28
core/methods/build.xml
Normal file
28
core/methods/build.xml
Normal file
@ -0,0 +1,28 @@
|
||||
<project name="methods" default="task-lib">
|
||||
|
||||
<target name="compile">
|
||||
<mkdir dir="bin" />
|
||||
<!-- <javac target="1.5" srcdir="src" destdir="bin" classpath="../ant/ant.jar" debug="true"/>-->
|
||||
<!-- <javac target="1.5" srcdir="src" destdir="bin" classpath="/usr/share/ant/ant.jar" debug="true"/>-->
|
||||
<javac target="1.5"
|
||||
srcdir="src" destdir="bin"
|
||||
debug="true"
|
||||
includeantruntime="true" />
|
||||
</target>
|
||||
|
||||
<target name="task-lib" depends="compile">
|
||||
<jar basedir="bin" destfile="methods.jar" />
|
||||
</target>
|
||||
|
||||
<target name="demo">
|
||||
<taskdef name="methods"
|
||||
classname="PAppletMethods"
|
||||
classpath="methods.jar" />
|
||||
<preproc dir="demo"/>
|
||||
</target>
|
||||
|
||||
<target name="clean">
|
||||
<delete dir="bin" />
|
||||
<delete file="methods.jar" />
|
||||
</target>
|
||||
</project>
|
9483
core/methods/demo/PApplet.java
Normal file
9483
core/methods/demo/PApplet.java
Normal file
File diff suppressed because it is too large
Load Diff
5075
core/methods/demo/PGraphics.java
Normal file
5075
core/methods/demo/PGraphics.java
Normal file
File diff suppressed because it is too large
Load Diff
2862
core/methods/demo/PImage.java
Normal file
2862
core/methods/demo/PImage.java
Normal file
File diff suppressed because it is too large
Load Diff
BIN
core/methods/methods.jar
Normal file
BIN
core/methods/methods.jar
Normal file
Binary file not shown.
272
core/methods/src/PAppletMethods.java
Normal file
272
core/methods/src/PAppletMethods.java
Normal file
@ -0,0 +1,272 @@
|
||||
import java.io.BufferedReader;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.PrintStream;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.apache.tools.ant.BuildException;
|
||||
import org.apache.tools.ant.Task;
|
||||
|
||||
|
||||
/**
|
||||
* Ant Task for copying the PImage and PGraphics methods into PApplet.
|
||||
*/
|
||||
public class PAppletMethods extends Task {
|
||||
|
||||
private File baseDir;
|
||||
|
||||
|
||||
public PAppletMethods() {
|
||||
}
|
||||
|
||||
|
||||
public void setDir(String dir) {
|
||||
baseDir = new File(dir);
|
||||
}
|
||||
|
||||
|
||||
public void execute() throws BuildException {
|
||||
// Do a bunch of checks...
|
||||
if (baseDir == null) {
|
||||
throw new BuildException("dir parameter must be set!");
|
||||
}
|
||||
|
||||
//System.out.println("using basedir " + baseDir);
|
||||
File graphicsFile = new File(baseDir, "PGraphics.java");
|
||||
File appletFile = new File(baseDir, "PApplet.java");
|
||||
File imageFile = new File(baseDir, "PImage.java");
|
||||
|
||||
if (!graphicsFile.exists() || !graphicsFile.canRead()) {
|
||||
throw new BuildException("PGraphics file not readable: " +
|
||||
graphicsFile.getAbsolutePath());
|
||||
}
|
||||
|
||||
if (!appletFile.exists() ||
|
||||
!appletFile.canRead() ||
|
||||
!appletFile.canWrite()) {
|
||||
throw new BuildException("PApplet file not read/writeable: " +
|
||||
appletFile.getAbsolutePath());
|
||||
}
|
||||
|
||||
if (!imageFile.exists() || !imageFile.canRead()) {
|
||||
throw new BuildException("PImage file not readable: " +
|
||||
imageFile.getAbsolutePath());
|
||||
}
|
||||
|
||||
// Looking good, let's do this!
|
||||
//ByteArrayOutputStream outBytes = new ByteArrayOutputStream();
|
||||
//PrintStream out = new PrintStream(outBytes, "UTF-8");
|
||||
StringBuffer out = new StringBuffer();
|
||||
StringBuffer content = new StringBuffer();
|
||||
|
||||
try{
|
||||
BufferedReader applet = createReader(appletFile);
|
||||
String line;
|
||||
while ((line = applet.readLine()) != null) {
|
||||
out.append(line);
|
||||
out.append('\n'); // to avoid Windows CRs
|
||||
content.append(line);
|
||||
content.append('\n'); // for efficiency
|
||||
|
||||
if (line.indexOf("public functions for processing.core") >= 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// read the rest of the file and append it to the
|
||||
while ((line = applet.readLine()) != null) {
|
||||
content.append(line);
|
||||
content.append('\n');
|
||||
}
|
||||
|
||||
applet.close();
|
||||
process(out, graphicsFile);
|
||||
process(out, imageFile);
|
||||
|
||||
out.append('}');
|
||||
out.append('\n');
|
||||
|
||||
//} catch (IOException e) {
|
||||
//e.printStackTrace();
|
||||
|
||||
} catch (Exception e) {
|
||||
//ex.printStackTrace();
|
||||
throw new BuildException(e);
|
||||
}
|
||||
//out.flush();
|
||||
|
||||
String outString = out.toString();
|
||||
if (content.toString().equals(outString)) {
|
||||
System.out.println("No changes to PApplet API.");
|
||||
} else {
|
||||
System.out.println("Updating PApplet with API changes " +
|
||||
"from PImage or PGraphics.");
|
||||
try {
|
||||
PrintStream temp = new PrintStream(appletFile, "UTF-8");
|
||||
temp.print(outString);
|
||||
temp.flush();
|
||||
temp.close();
|
||||
} catch (IOException e) {
|
||||
//e.printStackTrace();
|
||||
throw new BuildException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void process(StringBuffer out, File input) throws IOException {
|
||||
BufferedReader in = createReader(input);
|
||||
int comments = 0;
|
||||
String line = null;
|
||||
StringBuffer commentBuffer = new StringBuffer();
|
||||
|
||||
while ((line = in.readLine()) != null) {
|
||||
String decl = "";
|
||||
|
||||
// Keep track of comments
|
||||
//if (line.matches(Pattern.quote("/*"))) {
|
||||
if (line.indexOf("/*") != -1) {
|
||||
comments++;
|
||||
}
|
||||
|
||||
//if (line.matches(Pattern.quote("*/"))) {
|
||||
if (line.indexOf("*/") != -1) {
|
||||
commentBuffer.append(line);
|
||||
commentBuffer.append('\n');
|
||||
//System.out.println("comment is: " + commentBuffer.toString());
|
||||
comments--;
|
||||
// otherwise gotSomething will be false, and nuke the comment
|
||||
continue;
|
||||
}
|
||||
|
||||
// Ignore everything inside comments
|
||||
if (comments > 0) {
|
||||
commentBuffer.append(line);
|
||||
commentBuffer.append('\n');
|
||||
continue;
|
||||
}
|
||||
|
||||
boolean gotSomething = false;
|
||||
boolean gotStatic = false;
|
||||
|
||||
Matcher result;
|
||||
|
||||
if ((result = Pattern.compile("^\\s*public ([\\w\\[\\]]+) [a-zA-z_]+\\(.*$").matcher(line)).matches()) {
|
||||
gotSomething = true;
|
||||
|
||||
} else if ((result = Pattern.compile("^\\s*abstract public ([\\w\\[\\]]+) [a-zA-z_]+\\(.*$").matcher(line)).matches()) {
|
||||
gotSomething = true;
|
||||
|
||||
} else if ((result = Pattern.compile("^\\s*public final ([\\w\\[\\]]+) [a-zA-z_]+\\(.*$").matcher(line)).matches()) {
|
||||
gotSomething = true;
|
||||
|
||||
} else if ((result = Pattern.compile("^\\s*static public ([\\w\\[\\]]+) [a-zA-z_]+\\(.*$").matcher(line)).matches()) {
|
||||
gotSomething = true;
|
||||
gotStatic = true;
|
||||
}
|
||||
|
||||
// if function is marked "// ignore" then, uh, ignore it.
|
||||
if (gotSomething && line.indexOf("// ignore") >= 0) {
|
||||
gotSomething = false;
|
||||
}
|
||||
|
||||
String returns = "";
|
||||
if (gotSomething) {
|
||||
if (result.group(1).equals("void")) {
|
||||
returns = "";
|
||||
} else {
|
||||
returns = "return ";
|
||||
}
|
||||
|
||||
// remove the abstract modifier
|
||||
line = line.replaceFirst(Pattern.quote("abstract"), " ");
|
||||
|
||||
// replace semicolons with a start def
|
||||
line = line.replaceAll(Pattern.quote(";"), " {\n");
|
||||
|
||||
//out.println("\n\n" + line);
|
||||
out.append('\n');
|
||||
out.append('\n');
|
||||
// end has its own newline
|
||||
//out.print(commentBuffer.toString()); // TODO disabled for now XXXX
|
||||
out.append(commentBuffer.toString()); // duplicates all comments
|
||||
commentBuffer.setLength(0);
|
||||
out.append(line);
|
||||
out.append('\n');
|
||||
|
||||
decl += line;
|
||||
while(line.indexOf(')') == -1) {
|
||||
line = in.readLine();
|
||||
decl += line;
|
||||
line = line.replaceAll("\\;\\s*$", " {\n");
|
||||
out.append(line);
|
||||
out.append('\n');
|
||||
}
|
||||
|
||||
result = Pattern.compile(".*?\\s(\\S+)\\(.*?").matcher(decl);
|
||||
// try to match. don't remove this or things will stop working!
|
||||
result.matches();
|
||||
String declName = result.group(1);
|
||||
String gline = "";
|
||||
String rline = "";
|
||||
if (gotStatic) {
|
||||
gline = " " + returns + "PGraphics." + declName + "(";
|
||||
} else {
|
||||
rline = " if (recorder != null) recorder." + declName + "(";
|
||||
gline = " " + returns + "g." + declName + "(";
|
||||
}
|
||||
|
||||
decl = decl.replaceAll("\\s+", " "); // smush onto a single line
|
||||
decl = decl.replaceFirst("^.*\\(", "");
|
||||
decl = decl.replaceFirst("\\).*$", "");
|
||||
|
||||
int prev = 0;
|
||||
String parts[] = decl.split("\\, ");
|
||||
|
||||
for (String part : parts) {
|
||||
if (!part.trim().equals("")) {
|
||||
String blargh[] = part.split(" ");
|
||||
String theArg = blargh[1].replaceAll("[\\[\\]]", "");
|
||||
|
||||
if (prev != 0) {
|
||||
gline += ", ";
|
||||
rline += ", ";
|
||||
}
|
||||
|
||||
gline += theArg;
|
||||
rline += theArg;
|
||||
prev = 1;
|
||||
}
|
||||
}
|
||||
|
||||
gline += ");";
|
||||
rline += ");";
|
||||
|
||||
if (!gotStatic && returns.equals("")) {
|
||||
out.append(rline);
|
||||
out.append('\n');
|
||||
}
|
||||
out.append(gline);
|
||||
out.append('\n');
|
||||
out.append(" }");
|
||||
out.append('\n');
|
||||
|
||||
} else {
|
||||
commentBuffer.setLength(0);
|
||||
}
|
||||
}
|
||||
|
||||
in.close();
|
||||
}
|
||||
|
||||
|
||||
static BufferedReader createReader(File file) throws IOException {
|
||||
FileInputStream fis = new FileInputStream(file);
|
||||
return new BufferedReader(new InputStreamReader(fis, "UTF-8"));
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -34,6 +34,8 @@ import java.awt.event.KeyEvent;
|
||||
* An attempt is made to keep the constants as short/non-verbose
|
||||
* as possible. For instance, the constant is TIFF instead of
|
||||
* FILE_TYPE_TIFF. We'll do this as long as we can get away with it.
|
||||
*
|
||||
* @usage Web & Application
|
||||
*/
|
||||
public interface PConstants {
|
||||
|
||||
@ -158,11 +160,52 @@ public interface PConstants {
|
||||
|
||||
|
||||
// useful goodness
|
||||
|
||||
|
||||
/**
|
||||
* PI is a mathematical constant with the value 3.14159265358979323846.
|
||||
* It is the ratio of the circumference of a circle to its diameter.
|
||||
* It is useful in combination with the trigonometric functions <b>sin()</b> and <b>cos()</b>.
|
||||
*
|
||||
* @webref constants
|
||||
* @see processing.core.PConstants#HALF_PI
|
||||
* @see processing.core.PConstants#TWO_PI
|
||||
* @see processing.core.PConstants#QUARTER_PI
|
||||
*
|
||||
*/
|
||||
static final float PI = (float) Math.PI;
|
||||
/**
|
||||
* HALF_PI is a mathematical constant with the value 1.57079632679489661923.
|
||||
* It is half the ratio of the circumference of a circle to its diameter.
|
||||
* It is useful in combination with the trigonometric functions <b>sin()</b> and <b>cos()</b>.
|
||||
*
|
||||
* @webref constants
|
||||
* @see processing.core.PConstants#PI
|
||||
* @see processing.core.PConstants#TWO_PI
|
||||
* @see processing.core.PConstants#QUARTER_PI
|
||||
*/
|
||||
static final float HALF_PI = PI / 2.0f;
|
||||
static final float THIRD_PI = PI / 3.0f;
|
||||
/**
|
||||
* QUARTER_PI is a mathematical constant with the value 0.7853982.
|
||||
* It is one quarter the ratio of the circumference of a circle to its diameter.
|
||||
* It is useful in combination with the trigonometric functions <b>sin()</b> and <b>cos()</b>.
|
||||
*
|
||||
* @webref constants
|
||||
* @see processing.core.PConstants#PI
|
||||
* @see processing.core.PConstants#TWO_PI
|
||||
* @see processing.core.PConstants#HALF_PI
|
||||
*/
|
||||
static final float QUARTER_PI = PI / 4.0f;
|
||||
/**
|
||||
* TWO_PI is a mathematical constant with the value 6.28318530717958647693.
|
||||
* It is twice the ratio of the circumference of a circle to its diameter.
|
||||
* It is useful in combination with the trigonometric functions <b>sin()</b> and <b>cos()</b>.
|
||||
*
|
||||
* @webref constants
|
||||
* @see processing.core.PConstants#PI
|
||||
* @see processing.core.PConstants#HALF_PI
|
||||
* @see processing.core.PConstants#QUARTER_PI
|
||||
*/
|
||||
static final float TWO_PI = PI * 2.0f;
|
||||
|
||||
static final float DEG_TO_RAD = PI/180.0f;
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -52,9 +52,13 @@ public class PGraphics3D extends PGraphics {
|
||||
/** Inverse modelview matrix, used for lighting. */
|
||||
public PMatrix3D modelviewInv;
|
||||
|
||||
/**
|
||||
* The camera matrix, the modelview will be set to this on beginDraw.
|
||||
/**
|
||||
* Marks when changes to the size have occurred, so that the camera
|
||||
* will be reset in beginDraw().
|
||||
*/
|
||||
protected boolean sizeChanged;
|
||||
|
||||
/** The camera matrix, the modelview will be set to this on beginDraw. */
|
||||
public PMatrix3D camera;
|
||||
|
||||
/** Inverse camera matrix */
|
||||
@ -306,6 +310,9 @@ public class PGraphics3D extends PGraphics {
|
||||
* the pixel buffer for the new size.
|
||||
*
|
||||
* Note that this will nuke any cameraMode() settings.
|
||||
*
|
||||
* No drawing can happen in this function, and no talking to the graphics
|
||||
* context. That is, no glXxxx() calls, or other things that change state.
|
||||
*/
|
||||
public void setSize(int iwidth, int iheight) { // ignore
|
||||
width = iwidth;
|
||||
@ -357,13 +364,8 @@ public class PGraphics3D extends PGraphics {
|
||||
camera = new PMatrix3D();
|
||||
cameraInv = new PMatrix3D();
|
||||
|
||||
// set up the default camera
|
||||
// camera();
|
||||
|
||||
// defaults to perspective, if the user has setup up their
|
||||
// own projection, they'll need to fix it after resize anyway.
|
||||
// this helps the people who haven't set up their own projection.
|
||||
// perspective();
|
||||
// set this flag so that beginDraw() will do an update to the camera.
|
||||
sizeChanged = true;
|
||||
}
|
||||
|
||||
|
||||
@ -409,6 +411,19 @@ public class PGraphics3D extends PGraphics {
|
||||
// beginDraw/endDraw).
|
||||
if (!settingsInited) defaultSettings();
|
||||
|
||||
if (sizeChanged) {
|
||||
// set up the default camera
|
||||
camera();
|
||||
|
||||
// defaults to perspective, if the user has setup up their
|
||||
// own projection, they'll need to fix it after resize anyway.
|
||||
// this helps the people who haven't set up their own projection.
|
||||
perspective();
|
||||
|
||||
// clear the flag
|
||||
sizeChanged = false;
|
||||
}
|
||||
|
||||
resetMatrix(); // reset model matrix
|
||||
|
||||
// reset vertices
|
||||
@ -437,6 +452,7 @@ public class PGraphics3D extends PGraphics {
|
||||
shapeFirst = 0;
|
||||
|
||||
// reset textures
|
||||
Arrays.fill(textures, null);
|
||||
textureIndex = 0;
|
||||
|
||||
normal(0, 0, 1);
|
||||
@ -1350,7 +1366,10 @@ public class PGraphics3D extends PGraphics {
|
||||
boolean bClipped = false;
|
||||
int clippedCount = 0;
|
||||
|
||||
// cameraNear = -8;
|
||||
// This is a hack for temporary clipping. Clipping still needs to
|
||||
// be implemented properly, however. Please help!
|
||||
// http://dev.processing.org/bugs/show_bug.cgi?id=1393
|
||||
cameraNear = -8;
|
||||
if (vertices[a][VZ] > cameraNear) {
|
||||
aClipped = true;
|
||||
clippedCount++;
|
||||
@ -1364,15 +1383,15 @@ public class PGraphics3D extends PGraphics {
|
||||
clippedCount++;
|
||||
}
|
||||
if (clippedCount == 0) {
|
||||
// if (vertices[a][VZ] < cameraFar &&
|
||||
// vertices[b][VZ] < cameraFar &&
|
||||
// if (vertices[a][VZ] < cameraFar &&
|
||||
// vertices[b][VZ] < cameraFar &&
|
||||
// vertices[c][VZ] < cameraFar) {
|
||||
addTriangleWithoutClip(a, b, c);
|
||||
// }
|
||||
|
||||
// } else if (true) {
|
||||
// return;
|
||||
|
||||
|
||||
} else if (clippedCount == 3) {
|
||||
// In this case there is only one visible point. |/|
|
||||
// So we'll have to make two new points on the clip line <| |
|
||||
|
@ -967,6 +967,9 @@ public class PGraphicsJava2D extends PGraphics /*PGraphics2D*/ {
|
||||
|
||||
|
||||
public float textAscent() {
|
||||
if (textFont == null) {
|
||||
defaultFontOrDeath("textAscent");
|
||||
}
|
||||
Font font = textFont.getFont();
|
||||
if (font == null) {
|
||||
return super.textAscent();
|
||||
@ -977,6 +980,9 @@ public class PGraphicsJava2D extends PGraphics /*PGraphics2D*/ {
|
||||
|
||||
|
||||
public float textDescent() {
|
||||
if (textFont == null) {
|
||||
defaultFontOrDeath("textAscent");
|
||||
}
|
||||
Font font = textFont.getFont();
|
||||
if (font == null) {
|
||||
return super.textDescent();
|
||||
@ -1010,6 +1016,10 @@ public class PGraphicsJava2D extends PGraphics /*PGraphics2D*/ {
|
||||
* will get recorded properly.
|
||||
*/
|
||||
public void textSize(float size) {
|
||||
if (textFont == null) {
|
||||
defaultFontOrDeath("textAscent", size);
|
||||
}
|
||||
|
||||
// if a native version available, derive this font
|
||||
// if (textFontNative != null) {
|
||||
// textFontNative = textFontNative.deriveFont(size);
|
||||
|
@ -31,13 +31,31 @@ import java.util.HashMap;
|
||||
import javax.imageio.ImageIO;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Datatype for storing images. Processing can display <b>.gif</b>, <b>.jpg</b>, <b>.tga</b>, and <b>.png</b> images. Images may be displayed in 2D and 3D space.
|
||||
* Before an image is used, it must be loaded with the <b>loadImage()</b> function.
|
||||
* The <b>PImage</b> object contains fields for the <b>width</b> and <b>height</b> of the image,
|
||||
* as well as an array called <b>pixels[]</b> which contains the values for every pixel in the image.
|
||||
* A group of methods, described below, allow easy access to the image's pixels and alpha channel and simplify the process of compositing.
|
||||
* <br><br>Before using the <b>pixels[]</b> array, be sure to use the <b>loadPixels()</b> method on the image to make sure that the pixel data is properly loaded.
|
||||
* <br><br>To create a new image, use the <b>createImage()</b> function (do not use <b>new PImage()</b>).
|
||||
* =advanced
|
||||
*
|
||||
* Storage class for pixel data. This is the base class for most image and
|
||||
* pixel information, such as PGraphics and the video library classes.
|
||||
* <P>
|
||||
* Code for copying, resizing, scaling, and blending contributed
|
||||
* by <A HREF="http://www.toxi.co.uk">toxi</A>.
|
||||
* <P>
|
||||
*
|
||||
* @webref image
|
||||
* @usage Web & Application
|
||||
* @instanceName img any variable of type PImage
|
||||
* @see processing.core.PApplet#loadImage(String)
|
||||
* @see processing.core.PGraphics#imageMode(int)
|
||||
* @see processing.core.PApplet#createImage(int, int)
|
||||
*/
|
||||
public class PImage implements PConstants, Cloneable {
|
||||
|
||||
@ -48,8 +66,32 @@ public class PImage implements PConstants, Cloneable {
|
||||
*/
|
||||
public int format;
|
||||
|
||||
/**
|
||||
* Array containing the values for all the pixels in the image. These values are of the color datatype.
|
||||
* This array is the size of the image, meaning if the image is 100x100 pixels, there will be 10000 values
|
||||
* and if the window is 200x300 pixels, there will be 60000 values.
|
||||
* The <b>index</b> value defines the position of a value within the array.
|
||||
* For example, the statement <b>color b = img.pixels[230]</b> will set the variable <b>b</b> equal to the value at that location in the array.
|
||||
* Before accessing this array, the data must loaded with the <b>loadPixels()</b> method.
|
||||
* After the array data has been modified, the <b>updatePixels()</b> method must be run to update the changes.
|
||||
* Without <b>loadPixels()</b>, running the code may (or will in future releases) result in a NullPointerException.
|
||||
* @webref
|
||||
* @brief Array containing the color of every pixel in the image
|
||||
*/
|
||||
public int[] pixels;
|
||||
public int width, height;
|
||||
|
||||
/**
|
||||
* The width of the image in units of pixels.
|
||||
* @webref
|
||||
* @brief Image width
|
||||
*/
|
||||
public int width;
|
||||
/**
|
||||
* The height of the image in units of pixels.
|
||||
* @webref
|
||||
* @brief Image height
|
||||
*/
|
||||
public int height;
|
||||
|
||||
/**
|
||||
* Path to parent object that will be used with save().
|
||||
@ -125,7 +167,12 @@ public class PImage implements PConstants, Cloneable {
|
||||
// toxi: agreed and same reasons why i left it out ;)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param width image width
|
||||
* @param height image height
|
||||
* @param format Either RGB, ARGB, ALPHA (grayscale alpha channel)
|
||||
*/
|
||||
public PImage(int width, int height, int format) {
|
||||
init(width, height, format);
|
||||
}
|
||||
@ -171,6 +218,8 @@ public class PImage implements PConstants, Cloneable {
|
||||
* Construct a new PImage from a java.awt.Image. This constructor assumes
|
||||
* that you've done the work of making sure a MediaTracker has been used
|
||||
* to fully download the data and that the img is valid.
|
||||
*
|
||||
* @param img assumes a MediaTracker has been used to fully download the data and the img is valid
|
||||
*/
|
||||
public PImage(java.awt.Image img) {
|
||||
if (img instanceof BufferedImage) {
|
||||
@ -275,31 +324,39 @@ public class PImage implements PConstants, Cloneable {
|
||||
|
||||
|
||||
/**
|
||||
* Loads the pixel data for the image into its <b>pixels[]</b> array. This function must always be called before reading from or writing to <b>pixels[]</b>.
|
||||
* <br><br>Certain renderers may or may not seem to require <b>loadPixels()</b> or <b>updatePixels()</b>. However, the rule is that any time you want to manipulate the <b>pixels[]</b> array, you must first call <b>loadPixels()</b>, and after changes have been made, call <b>updatePixels()</b>. Even if the renderer may not seem to use this function in the current Processing release, this will always be subject to change.
|
||||
* =advanced
|
||||
* Call this when you want to mess with the pixels[] array.
|
||||
* <p/>
|
||||
* For subclasses where the pixels[] buffer isn't set by default,
|
||||
* this should copy all data into the pixels[] array
|
||||
*
|
||||
* @webref
|
||||
* @brief Loads the pixel data for the image into its pixels[] array
|
||||
*/
|
||||
public void loadPixels() { // ignore
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Call this when finished messing with the pixels[] array.
|
||||
* <p/>
|
||||
* Mark all pixels as needing update.
|
||||
*/
|
||||
public void updatePixels() { // ignore
|
||||
updatePixelsImpl(0, 0, width, height);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Updates the image with the data in its <b>pixels[]</b> array. Use in conjunction with <b>loadPixels()</b>. If you're only reading pixels from the array, there's no need to call <b>updatePixels()</b>.
|
||||
* <br><br>Certain renderers may or may not seem to require <b>loadPixels()</b> or <b>updatePixels()</b>. However, the rule is that any time you want to manipulate the <b>pixels[]</b> array, you must first call <b>loadPixels()</b>, and after changes have been made, call <b>updatePixels()</b>. Even if the renderer may not seem to use this function in the current Processing release, this will always be subject to change.
|
||||
* <br><br>Currently, none of the renderers use the additional parameters to <b>updatePixels()</b>, however this may be implemented in the future.
|
||||
* =advanced
|
||||
* Mark the pixels in this region as needing an update.
|
||||
* <P>
|
||||
* This is not currently used by any of the renderers, however the api
|
||||
* is structured this way in the hope of being able to use this to
|
||||
* speed things up in the future.
|
||||
* @webref
|
||||
* @brief Updates the image with the data in its pixels[] array
|
||||
* @param x
|
||||
* @param y
|
||||
* @param w
|
||||
* @param h
|
||||
*/
|
||||
public void updatePixels(int x, int y, int w, int h) { // ignore
|
||||
// if (imageMode == CORNER) { // x2, y2 are w/h
|
||||
@ -369,8 +426,14 @@ public class PImage implements PConstants, Cloneable {
|
||||
|
||||
|
||||
/**
|
||||
* Resize this image to a new width and height.
|
||||
* Use 0 for wide or high to make that dimension scale proportionally.
|
||||
* Resize the image to a new width and height. To make the image scale proportionally, use 0 as the value for the <b>wide</b> or <b>high</b> parameter.
|
||||
*
|
||||
* @webref
|
||||
* @brief Changes the size of an image to a new width and height
|
||||
* @param wide the resized image width
|
||||
* @param high the resized image height
|
||||
*
|
||||
* @see processing.core.PImage#get(int, int, int, int)
|
||||
*/
|
||||
public void resize(int wide, int high) { // ignore
|
||||
// Make sure that the pixels[] array is valid
|
||||
@ -442,8 +505,20 @@ public class PImage implements PConstants, Cloneable {
|
||||
|
||||
|
||||
/**
|
||||
* Grab a subsection of a PImage, and copy it into a fresh PImage.
|
||||
* As of release 0149, no longer honors imageMode() for the coordinates.
|
||||
* Reads the color of any pixel or grabs a group of pixels. If no parameters are specified, the entire image is returned. Get the value of one pixel by specifying an x,y coordinate. Get a section of the display window by specifing an additional <b>width</b> and <b>height</b> parameter. If the pixel requested is outside of the image window, black is returned. The numbers returned are scaled according to the current color ranges, but only RGB values are returned by this function. Even though you may have drawn a shape with <b>colorMode(HSB)</b>, the numbers returned will be in RGB.
|
||||
* <br><br>Getting the color of a single pixel with <b>get(x, y)</b> is easy, but not as fast as grabbing the data directly from <b>pixels[]</b>. The equivalent statement to "get(x, y)" using <b>pixels[]</b> is "pixels[y*width+x]". Processing requires calling <b>loadPixels()</b> to load the display window data into the <b>pixels[]</b> array before getting the values.
|
||||
* <br><br>As of release 0149, this function ignores <b>imageMode()</b>.
|
||||
*
|
||||
* @webref
|
||||
* @brief Reads the color of any pixel or grabs a rectangle of pixels
|
||||
* @param x x-coordinate of the pixel
|
||||
* @param y y-coordinate of the pixel
|
||||
* @param w width of pixel rectangle to get
|
||||
* @param h height of pixel rectangle to get
|
||||
*
|
||||
* @see processing.core.PImage#set(int, int, int)
|
||||
* @see processing.core.PImage#pixels
|
||||
* @see processing.core.PImage#copy(PImage, int, int, int, int, int, int, int, int)
|
||||
*/
|
||||
public PImage get(int x, int y, int w, int h) {
|
||||
/*
|
||||
@ -512,7 +587,17 @@ public class PImage implements PConstants, Cloneable {
|
||||
|
||||
|
||||
/**
|
||||
* Set a single pixel to the specified color.
|
||||
* Changes the color of any pixel or writes an image directly into the display window. The <b>x</b> and <b>y</b> parameters specify the pixel to change and the <b>color</b> parameter specifies the color value. The color parameter is affected by the current color mode (the default is RGB values from 0 to 255). When setting an image, the x and y parameters define the coordinates for the upper-left corner of the image.
|
||||
* <br><br>Setting the color of a single pixel with <b>set(x, y)</b> is easy, but not as fast as putting the data directly into <b>pixels[]</b>. The equivalent statement to "set(x, y, #000000)" using <b>pixels[]</b> is "pixels[y*width+x] = #000000". You must call <b>loadPixels()</b> to load the display window data into the <b>pixels[]</b> array before setting the values and calling <b>updatePixels()</b> to update the window with any changes.
|
||||
* <br><br>As of release 1.0, this function ignores <b>imageMode()</b>.
|
||||
* <br><br>Due to what appears to be a bug in Apple's Java implementation, the point() and set() methods are extremely slow in some circumstances when used with the default renderer. Using P2D or P3D will fix the problem. Grouping many calls to point() or set() together can also help. (<a href="http://dev.processing.org/bugs/show_bug.cgi?id=1094">Bug 1094</a>)
|
||||
* =advanced
|
||||
* <br><br>As of release 0149, this function ignores <b>imageMode()</b>.
|
||||
*
|
||||
* @webref image:pixels
|
||||
* @param x x-coordinate of the pixel
|
||||
* @param y y-coordinate of the pixel
|
||||
* @param c any value of the color datatype
|
||||
*/
|
||||
public void set(int x, int y, int c) {
|
||||
if ((x < 0) || (y < 0) || (x >= width) || (y >= height)) return;
|
||||
@ -594,18 +679,20 @@ public class PImage implements PConstants, Cloneable {
|
||||
* used as the alpha color. For a fully grayscale image, this
|
||||
* is correct, but for a color image it's not 100% accurate.
|
||||
* For a more accurate conversion, first use filter(GRAY)
|
||||
* which will make the image into a "correct" grayscake by
|
||||
* which will make the image into a "correct" grayscale by
|
||||
* performing a proper luminance-based conversion.
|
||||
*
|
||||
* @param maskArray any array of Integer numbers used as the alpha channel, needs to be same length as the image's pixel array
|
||||
*/
|
||||
public void mask(int alpha[]) {
|
||||
public void mask(int maskArray[]) {
|
||||
loadPixels();
|
||||
// don't execute if mask image is different size
|
||||
if (alpha.length != pixels.length) {
|
||||
if (maskArray.length != pixels.length) {
|
||||
throw new RuntimeException("The PImage used with mask() must be " +
|
||||
"the same size as the applet.");
|
||||
}
|
||||
for (int i = 0; i < pixels.length; i++) {
|
||||
pixels[i] = ((alpha[i] & 0xff) << 24) | (pixels[i] & 0xffffff);
|
||||
pixels[i] = ((maskArray[i] & 0xff) << 24) | (pixels[i] & 0xffffff);
|
||||
}
|
||||
format = ARGB;
|
||||
updatePixels();
|
||||
@ -613,10 +700,19 @@ public class PImage implements PConstants, Cloneable {
|
||||
|
||||
|
||||
/**
|
||||
* Set alpha channel for an image using another image as the source.
|
||||
* Masks part of an image from displaying by loading another image and using it as an alpha channel.
|
||||
* This mask image should only contain grayscale data, but only the blue color channel is used.
|
||||
* The mask image needs to be the same size as the image to which it is applied.
|
||||
* In addition to using a mask image, an integer array containing the alpha channel data can be specified directly.
|
||||
* This method is useful for creating dynamically generated alpha masks.
|
||||
* This array must be of the same length as the target image's pixels array and should contain only grayscale data of values between 0-255.
|
||||
* @webref
|
||||
* @brief Masks part of the image from displaying
|
||||
* @param maskImg any PImage object used as the alpha channel for "img", needs to be same size as "img"
|
||||
*/
|
||||
public void mask(PImage alpha) {
|
||||
mask(alpha.pixels);
|
||||
public void mask(PImage maskImg) {
|
||||
maskImg.loadPixels();
|
||||
mask(maskImg.pixels);
|
||||
}
|
||||
|
||||
|
||||
@ -624,26 +720,6 @@ public class PImage implements PConstants, Cloneable {
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
// IMAGE FILTERS
|
||||
|
||||
|
||||
/**
|
||||
* Method to apply a variety of basic filters to this image.
|
||||
* <P>
|
||||
* <UL>
|
||||
* <LI>filter(BLUR) provides a basic blur.
|
||||
* <LI>filter(GRAY) converts the image to grayscale based on luminance.
|
||||
* <LI>filter(INVERT) will invert the color components in the image.
|
||||
* <LI>filter(OPAQUE) set all the high bits in the image to opaque
|
||||
* <LI>filter(THRESHOLD) converts the image to black and white.
|
||||
* <LI>filter(DILATE) grow white/light areas
|
||||
* <LI>filter(ERODE) shrink white/light areas
|
||||
* </UL>
|
||||
* Luminance conversion code contributed by
|
||||
* <A HREF="http://www.toxi.co.uk">toxi</A>
|
||||
* <P/>
|
||||
* Gaussian blur code contributed by
|
||||
* <A HREF="http://incubator.quasimondo.com">Mario Klingemann</A>
|
||||
*/
|
||||
public void filter(int kind) {
|
||||
loadPixels();
|
||||
|
||||
@ -716,20 +792,29 @@ public class PImage implements PConstants, Cloneable {
|
||||
|
||||
|
||||
/**
|
||||
* Filters an image as defined by one of the following modes:<br><br>THRESHOLD - converts the image to black and white pixels depending if they are above or below the threshold defined by the level parameter. The level must be between 0.0 (black) and 1.0(white). If no level is specified, 0.5 is used.<br><br>GRAY - converts any colors in the image to grayscale equivalents<br><br>INVERT - sets each pixel to its inverse value<br><br>POSTERIZE - limits each channel of the image to the number of colors specified as the level parameter<br><br>BLUR - executes a Guassian blur with the level parameter specifying the extent of the blurring. If no level parameter is used, the blur is equivalent to Guassian blur of radius 1.<br><br>OPAQUE - sets the alpha channel to entirely opaque.<br><br>ERODE - reduces the light areas with the amount defined by the level parameter.<br><br>DILATE - increases the light areas with the amount defined by the level parameter
|
||||
* =advanced
|
||||
* Method to apply a variety of basic filters to this image.
|
||||
* These filters all take a parameter.
|
||||
* <P>
|
||||
* <UL>
|
||||
* <LI>filter(BLUR, int radius) performs a gaussian blur of the
|
||||
* specified radius.
|
||||
* <LI>filter(POSTERIZE, int levels) will posterize the image to
|
||||
* between 2 and 255 levels.
|
||||
* <LI>filter(THRESHOLD, float center) allows you to set the
|
||||
* center point for the threshold. It takes a value from 0 to 1.0.
|
||||
* <LI>filter(BLUR) provides a basic blur.
|
||||
* <LI>filter(GRAY) converts the image to grayscale based on luminance.
|
||||
* <LI>filter(INVERT) will invert the color components in the image.
|
||||
* <LI>filter(OPAQUE) set all the high bits in the image to opaque
|
||||
* <LI>filter(THRESHOLD) converts the image to black and white.
|
||||
* <LI>filter(DILATE) grow white/light areas
|
||||
* <LI>filter(ERODE) shrink white/light areas
|
||||
* </UL>
|
||||
* Luminance conversion code contributed by
|
||||
* <A HREF="http://www.toxi.co.uk">toxi</A>
|
||||
* <P/>
|
||||
* Gaussian blur code contributed by
|
||||
* <A HREF="http://incubator.quasimondo.com">Mario Klingemann</A>
|
||||
* and later updated by toxi for better speed.
|
||||
*
|
||||
* @webref
|
||||
* @brief Converts the image to grayscale or black and white
|
||||
* @param kind Either THRESHOLD, GRAY, INVERT, POSTERIZE, BLUR, OPAQUE, ERODE, or DILATE
|
||||
* @param param in the range from 0 to 1
|
||||
*/
|
||||
public void filter(int kind, float param) {
|
||||
loadPixels();
|
||||
@ -1093,7 +1178,7 @@ public class PImage implements PConstants, Cloneable {
|
||||
if (idxRight>=maxRowIdx)
|
||||
idxRight=currIdx;
|
||||
if (idxUp<0)
|
||||
idxUp=0;
|
||||
idxUp=currIdx;
|
||||
if (idxDown>=maxIdx)
|
||||
idxDown=currIdx;
|
||||
|
||||
@ -1150,7 +1235,7 @@ public class PImage implements PConstants, Cloneable {
|
||||
if (idxRight>=maxRowIdx)
|
||||
idxRight=currIdx;
|
||||
if (idxUp<0)
|
||||
idxUp=0;
|
||||
idxUp=currIdx;
|
||||
if (idxDown>=maxIdx)
|
||||
idxDown=currIdx;
|
||||
|
||||
@ -1212,7 +1297,23 @@ public class PImage implements PConstants, Cloneable {
|
||||
|
||||
|
||||
/**
|
||||
* Copies area of one image into another PImage object.
|
||||
* Copies a region of pixels from one image into another. If the source and destination regions aren't the same size, it will automatically resize source pixels to fit the specified target region. No alpha information is used in the process, however if the source image has an alpha channel set, it will be copied as well.
|
||||
* <br><br>As of release 0149, this function ignores <b>imageMode()</b>.
|
||||
*
|
||||
* @webref
|
||||
* @brief Copies the entire image
|
||||
* @param sx X coordinate of the source's upper left corner
|
||||
* @param sy Y coordinate of the source's upper left corner
|
||||
* @param sw source image width
|
||||
* @param sh source image height
|
||||
* @param dx X coordinate of the destination's upper left corner
|
||||
* @param dy Y coordinate of the destination's upper left corner
|
||||
* @param dw destination image width
|
||||
* @param dh destination image height
|
||||
* @param src an image variable referring to the source image.
|
||||
*
|
||||
* @see processing.core.PGraphics#alpha(int)
|
||||
* @see processing.core.PImage#blend(PImage, int, int, int, int, int, int, int, int, int)
|
||||
*/
|
||||
public void copy(PImage src,
|
||||
int sx, int sy, int sw, int sh,
|
||||
@ -1321,6 +1422,7 @@ public class PImage implements PConstants, Cloneable {
|
||||
|
||||
/**
|
||||
* Blends one area of this image to another area.
|
||||
*
|
||||
* @see processing.core.PImage#blendColor(int,int,int)
|
||||
*/
|
||||
public void blend(int sx, int sy, int sw, int sh,
|
||||
@ -1330,7 +1432,39 @@ public class PImage implements PConstants, Cloneable {
|
||||
|
||||
|
||||
/**
|
||||
* Copies area of one image into another PImage object.
|
||||
* Blends a region of pixels into the image specified by the <b>img</b> parameter. These copies utilize full alpha channel support and a choice of the following modes to blend the colors of source pixels (A) with the ones of pixels in the destination image (B):<br><br>
|
||||
* BLEND - linear interpolation of colours: C = A*factor + B<br><br>
|
||||
* ADD - additive blending with white clip: C = min(A*factor + B, 255)<br><br>
|
||||
* SUBTRACT - subtractive blending with black clip: C = max(B - A*factor, 0)<br><br>
|
||||
* DARKEST - only the darkest colour succeeds: C = min(A*factor, B)<br><br>
|
||||
* LIGHTEST - only the lightest colour succeeds: C = max(A*factor, B)<br><br>
|
||||
* DIFFERENCE - subtract colors from underlying image.<br><br>
|
||||
* EXCLUSION - similar to DIFFERENCE, but less extreme.<br><br>
|
||||
* MULTIPLY - Multiply the colors, result will always be darker.<br><br>
|
||||
* SCREEN - Opposite multiply, uses inverse values of the colors.<br><br>
|
||||
* OVERLAY - A mix of MULTIPLY and SCREEN. Multiplies dark values, and screens light values.<br><br>
|
||||
* HARD_LIGHT - SCREEN when greater than 50% gray, MULTIPLY when lower.<br><br>
|
||||
* SOFT_LIGHT - Mix of DARKEST and LIGHTEST. Works like OVERLAY, but not as harsh.<br><br>
|
||||
* DODGE - Lightens light tones and increases contrast, ignores darks. Called "Color Dodge" in Illustrator and Photoshop.<br><br>
|
||||
* BURN - Darker areas are applied, increasing contrast, ignores lights. Called "Color Burn" in Illustrator and Photoshop.<br><br>
|
||||
* All modes use the alpha information (highest byte) of source image pixels as the blending factor. If the source and destination regions are different sizes, the image will be automatically resized to match the destination size. If the <b>srcImg</b> parameter is not used, the display window is used as the source image.<br><br>
|
||||
* As of release 0149, this function ignores <b>imageMode()</b>.
|
||||
*
|
||||
* @webref
|
||||
* @brief Copies a pixel or rectangle of pixels using different blending modes
|
||||
* @param src an image variable referring to the source image
|
||||
* @param sx X coordinate of the source's upper left corner
|
||||
* @param sy Y coordinate of the source's upper left corner
|
||||
* @param sw source image width
|
||||
* @param sh source image height
|
||||
* @param dx X coordinate of the destinations's upper left corner
|
||||
* @param dy Y coordinate of the destinations's upper left corner
|
||||
* @param dw destination image width
|
||||
* @param dh destination image height
|
||||
* @param mode Either BLEND, ADD, SUBTRACT, LIGHTEST, DARKEST, DIFFERENCE, EXCLUSION, MULTIPLY, SCREEN, OVERLAY, HARD_LIGHT, SOFT_LIGHT, DODGE, BURN
|
||||
*
|
||||
* @see processing.core.PGraphics#alpha(int)
|
||||
* @see processing.core.PGraphics#copy(PImage, int, int, int, int, int, int, int, int)
|
||||
* @see processing.core.PImage#blendColor(int,int,int)
|
||||
*/
|
||||
public void blend(PImage src,
|
||||
@ -2628,6 +2762,16 @@ public class PImage implements PConstants, Cloneable {
|
||||
protected String[] saveImageFormats;
|
||||
|
||||
/**
|
||||
* Saves the image into a file. Images are saved in TIFF, TARGA, JPEG, and PNG format depending on the extension within the <b>filename</b> parameter.
|
||||
* For example, "image.tif" will have a TIFF image and "image.png" will save a PNG image.
|
||||
* If no extension is included in the filename, the image will save in TIFF format and <b>.tif</b> will be added to the name.
|
||||
* These files are saved to the sketch's folder, which may be opened by selecting "Show sketch folder" from the "Sketch" menu.
|
||||
* It is not possible to use <b>save()</b> while running the program in a web browser.<br><br>
|
||||
* To save an image created within the code, rather than through loading, it's necessary to make the image with the <b>createImage()</b>
|
||||
* function so it is aware of the location of the program and can therefore save the file to the right place.
|
||||
* See the <b>createImage()</b> reference for more information.
|
||||
*
|
||||
* =advanced
|
||||
* Save this image to disk.
|
||||
* <p>
|
||||
* As of revision 0100, this function requires an absolute path,
|
||||
@ -2651,15 +2795,19 @@ public class PImage implements PConstants, Cloneable {
|
||||
* The ImageIO API claims to support wbmp files, however they probably
|
||||
* require a black and white image. Basic testing produced a zero-length
|
||||
* file with no error.
|
||||
*
|
||||
* @webref
|
||||
* @brief Saves the image to a TIFF, TARGA, PNG, or JPEG file
|
||||
* @param filename a sequence of letters and numbers
|
||||
*/
|
||||
public void save(String path) { // ignore
|
||||
public void save(String filename) { // ignore
|
||||
boolean success = false;
|
||||
|
||||
File file = new File(path);
|
||||
File file = new File(filename);
|
||||
if (!file.isAbsolute()) {
|
||||
if (parent != null) {
|
||||
//file = new File(parent.savePath(filename));
|
||||
path = parent.savePath(path);
|
||||
filename = parent.savePath(filename);
|
||||
} else {
|
||||
String msg = "PImage.save() requires an absolute path. " +
|
||||
"Use createImage(), or pass savePath() to save().";
|
||||
@ -2678,24 +2826,24 @@ public class PImage implements PConstants, Cloneable {
|
||||
}
|
||||
if (saveImageFormats != null) {
|
||||
for (int i = 0; i < saveImageFormats.length; i++) {
|
||||
if (path.endsWith("." + saveImageFormats[i])) {
|
||||
saveImageIO(path);
|
||||
if (filename.endsWith("." + saveImageFormats[i])) {
|
||||
saveImageIO(filename);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (path.toLowerCase().endsWith(".tga")) {
|
||||
os = new BufferedOutputStream(new FileOutputStream(path), 32768);
|
||||
if (filename.toLowerCase().endsWith(".tga")) {
|
||||
os = new BufferedOutputStream(new FileOutputStream(filename), 32768);
|
||||
success = saveTGA(os); //, pixels, width, height, format);
|
||||
|
||||
} else {
|
||||
if (!path.toLowerCase().endsWith(".tif") &&
|
||||
!path.toLowerCase().endsWith(".tiff")) {
|
||||
if (!filename.toLowerCase().endsWith(".tif") &&
|
||||
!filename.toLowerCase().endsWith(".tiff")) {
|
||||
// if no .tif extension, add it..
|
||||
path += ".tif";
|
||||
filename += ".tif";
|
||||
}
|
||||
os = new BufferedOutputStream(new FileOutputStream(path), 32768);
|
||||
os = new BufferedOutputStream(new FileOutputStream(filename), 32768);
|
||||
success = saveTIFF(os); //, pixels, width, height);
|
||||
}
|
||||
os.flush();
|
||||
|
@ -419,7 +419,7 @@ public class PPolygon implements PConstants {
|
||||
int tr, tg, tb, ta;
|
||||
|
||||
// System.out.println("P2D interp uv " + interpUV + " " +
|
||||
// vertices[2][U] + " " + vertices[2][V]);
|
||||
// vertices[2][U] + " " + vertices[2][V]);
|
||||
for (int x = lx; x <= rx; x++) {
|
||||
// map texture based on U, V coords in sp[U] and sp[V]
|
||||
if (interpUV) {
|
||||
|
@ -25,8 +25,17 @@ package processing.core;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import processing.core.PApplet;
|
||||
|
||||
|
||||
/**
|
||||
* Datatype for storing shapes. Processing can currently load and display SVG (Scalable Vector Graphics) shapes.
|
||||
* Before a shape is used, it must be loaded with the <b>loadShape()</b> function. The <b>shape()</b> function is used to draw the shape to the display window.
|
||||
* The <b>PShape</b> object contain a group of methods, linked below, that can operate on the shape data.
|
||||
* <br><br>The <b>loadShape()</b> method supports SVG files created with Inkscape and Adobe Illustrator.
|
||||
* It is not a full SVG implementation, but offers some straightforward support for handling vector data.
|
||||
* =advanced
|
||||
*
|
||||
* In-progress class to handle shape data, currently to be considered of
|
||||
* alpha or beta quality. Major structural work may be performed on this class
|
||||
* after the release of Processing 1.0. Such changes may include:
|
||||
@ -51,6 +60,13 @@ import java.util.HashMap;
|
||||
* <p>Library developers are encouraged to create PShape objects when loading
|
||||
* shape data, so that they can eventually hook into the bounty that will be
|
||||
* the PShape interface, and the ease of loadShape() and shape().</p>
|
||||
*
|
||||
* @webref Shape
|
||||
* @usage Web & Application
|
||||
* @see PApplet#shape(PShape)
|
||||
* @see PApplet#loadShape(String)
|
||||
* @see PApplet#shapeMode(int)
|
||||
* @instanceName sh any variable of type PShape
|
||||
*/
|
||||
public class PShape implements PConstants {
|
||||
|
||||
@ -81,7 +97,17 @@ public class PShape implements PConstants {
|
||||
//protected float y;
|
||||
//protected float width;
|
||||
//protected float height;
|
||||
/**
|
||||
* The width of the PShape document.
|
||||
* @webref
|
||||
* @brief Shape document width
|
||||
*/
|
||||
public float width;
|
||||
/**
|
||||
* The width of the PShape document.
|
||||
* @webref
|
||||
* @brief Shape document height
|
||||
*/
|
||||
public float height;
|
||||
|
||||
// set to false if the object is hidden in the layers palette
|
||||
@ -178,21 +204,39 @@ public class PShape implements PConstants {
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns a boolean value "true" if the image is set to be visible, "false" if not. This is modified with the <b>setVisible()</b> parameter.
|
||||
* <br><br>The visibility of a shape is usually controlled by whatever program created the SVG file.
|
||||
* For instance, this parameter is controlled by showing or hiding the shape in the layers palette in Adobe Illustrator.
|
||||
*
|
||||
* @webref
|
||||
* @brief Returns a boolean value "true" if the image is set to be visible, "false" if not
|
||||
*/
|
||||
public boolean isVisible() {
|
||||
return visible;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the shape to be visible or invisible. This is determined by the value of the <b>visible</b> parameter.
|
||||
* <br><br>The visibility of a shape is usually controlled by whatever program created the SVG file.
|
||||
* For instance, this parameter is controlled by showing or hiding the shape in the layers palette in Adobe Illustrator.
|
||||
* @param visible "false" makes the shape invisible and "true" makes it visible
|
||||
* @webref
|
||||
* @brief Sets the shape to be visible or invisible
|
||||
*/
|
||||
public void setVisible(boolean visible) {
|
||||
this.visible = visible;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Disables the shape's style data and uses Processing's current styles. Styles include attributes such as colors, stroke weight, and stroke joints.
|
||||
* =advanced
|
||||
* Overrides this shape's style information and uses PGraphics styles and
|
||||
* colors. Identical to ignoreStyles(true). Also disables styles for all
|
||||
* child shapes.
|
||||
* @webref
|
||||
* @brief Disables the shape's style data and uses Processing styles
|
||||
*/
|
||||
public void disableStyle() {
|
||||
style = false;
|
||||
@ -204,7 +248,9 @@ public class PShape implements PConstants {
|
||||
|
||||
|
||||
/**
|
||||
* Re-enables style information (fill and stroke) set in the shape.
|
||||
* Enables the shape's style data and ignores Processing's current styles. Styles include attributes such as colors, stroke weight, and stroke joints.
|
||||
* @webref
|
||||
* @brief Enables the shape's style data and ignores the Processing styles
|
||||
*/
|
||||
public void enableStyle() {
|
||||
style = true;
|
||||
@ -591,12 +637,21 @@ public class PShape implements PConstants {
|
||||
return childCount;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param index the layer position of the shape to get
|
||||
*/
|
||||
public PShape getChild(int index) {
|
||||
return children[index];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Extracts a child shape from a parent shape. Specify the name of the shape with the <b>target</b> parameter.
|
||||
* The shape is returned as a <b>PShape</b> object, or <b>null</b> is returned if there is an error.
|
||||
* @param target the name of the shape to get
|
||||
* @webref
|
||||
* @brief Returns a child element of a shape as a PShape object
|
||||
*/
|
||||
public PShape getChild(String target) {
|
||||
if (name != null && name.equals(target)) {
|
||||
return this;
|
||||
@ -675,34 +730,78 @@ public class PShape implements PConstants {
|
||||
// if matrix is null when one is called,
|
||||
// it is created and set to identity
|
||||
|
||||
|
||||
public void translate(float tx, float ty) {
|
||||
checkMatrix(2);
|
||||
matrix.translate(tx, ty);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Specifies an amount to displace the shape. The <b>x</b> parameter specifies left/right translation, the <b>y</b> parameter specifies up/down translation, and the <b>z</b> parameter specifies translations toward/away from the screen. Subsequent calls to the method accumulates the effect. For example, calling <b>translate(50, 0)</b> and then <b>translate(20, 0)</b> is the same as <b>translate(70, 0)</b>. This transformation is applied directly to the shape, it's not refreshed each time <b>draw()</b> is run.
|
||||
* <br><br>Using this method with the <b>z</b> parameter requires using the P3D or OPENGL parameter in combination with size.
|
||||
* @webref
|
||||
* @param tx left/right translation
|
||||
* @param ty up/down translation
|
||||
* @param tz forward/back translation
|
||||
* @brief Displaces the shape
|
||||
*/
|
||||
public void translate(float tx, float ty, float tz) {
|
||||
checkMatrix(3);
|
||||
matrix.translate(tx, ty, 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Rotates a shape around the x-axis the amount specified by the <b>angle</b> parameter. Angles should be specified in radians (values from 0 to TWO_PI) or converted to radians with the <b>radians()</b> method.
|
||||
* <br><br>Shapes are always rotated around the upper-left corner of their bounding box. Positive numbers rotate objects in a clockwise direction.
|
||||
* Subsequent calls to the method accumulates the effect. For example, calling <b>rotateX(HALF_PI)</b> and then <b>rotateX(HALF_PI)</b> is the same as <b>rotateX(PI)</b>.
|
||||
* This transformation is applied directly to the shape, it's not refreshed each time <b>draw()</b> is run.
|
||||
* <br><br>This method requires a 3D renderer. You need to pass P3D or OPENGL as a third parameter into the <b>size()</b> method as shown in the example above.
|
||||
* @param angle angle of rotation specified in radians
|
||||
* @webref
|
||||
* @brief Rotates the shape around the x-axis
|
||||
*/
|
||||
public void rotateX(float angle) {
|
||||
rotate(angle, 1, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Rotates a shape around the y-axis the amount specified by the <b>angle</b> parameter. Angles should be specified in radians (values from 0 to TWO_PI) or converted to radians with the <b>radians()</b> method.
|
||||
* <br><br>Shapes are always rotated around the upper-left corner of their bounding box. Positive numbers rotate objects in a clockwise direction.
|
||||
* Subsequent calls to the method accumulates the effect. For example, calling <b>rotateY(HALF_PI)</b> and then <b>rotateY(HALF_PI)</b> is the same as <b>rotateY(PI)</b>.
|
||||
* This transformation is applied directly to the shape, it's not refreshed each time <b>draw()</b> is run.
|
||||
* <br><br>This method requires a 3D renderer. You need to pass P3D or OPENGL as a third parameter into the <b>size()</b> method as shown in the example above.
|
||||
* @param angle angle of rotation specified in radians
|
||||
* @webref
|
||||
* @brief Rotates the shape around the y-axis
|
||||
*/
|
||||
public void rotateY(float angle) {
|
||||
rotate(angle, 0, 1, 0);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Rotates a shape around the z-axis the amount specified by the <b>angle</b> parameter. Angles should be specified in radians (values from 0 to TWO_PI) or converted to radians with the <b>radians()</b> method.
|
||||
* <br><br>Shapes are always rotated around the upper-left corner of their bounding box. Positive numbers rotate objects in a clockwise direction.
|
||||
* Subsequent calls to the method accumulates the effect. For example, calling <b>rotateZ(HALF_PI)</b> and then <b>rotateZ(HALF_PI)</b> is the same as <b>rotateZ(PI)</b>.
|
||||
* This transformation is applied directly to the shape, it's not refreshed each time <b>draw()</b> is run.
|
||||
* <br><br>This method requires a 3D renderer. You need to pass P3D or OPENGL as a third parameter into the <b>size()</b> method as shown in the example above.
|
||||
* @param angle angle of rotation specified in radians
|
||||
* @webref
|
||||
* @brief Rotates the shape around the z-axis
|
||||
*/
|
||||
public void rotateZ(float angle) {
|
||||
rotate(angle, 0, 0, 1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Rotates a shape the amount specified by the <b>angle</b> parameter. Angles should be specified in radians (values from 0 to TWO_PI) or converted to radians with the <b>radians()</b> method.
|
||||
* <br><br>Shapes are always rotated around the upper-left corner of their bounding box. Positive numbers rotate objects in a clockwise direction.
|
||||
* Transformations apply to everything that happens after and subsequent calls to the method accumulates the effect.
|
||||
* For example, calling <b>rotate(HALF_PI)</b> and then <b>rotate(HALF_PI)</b> is the same as <b>rotate(PI)</b>.
|
||||
* This transformation is applied directly to the shape, it's not refreshed each time <b>draw()</b> is run.
|
||||
* @param angle angle of rotation specified in radians
|
||||
* @webref
|
||||
* @brief Rotates the shape
|
||||
*/
|
||||
public void rotate(float angle) {
|
||||
checkMatrix(2); // at least 2...
|
||||
matrix.rotate(angle);
|
||||
@ -716,20 +815,34 @@ public class PShape implements PConstants {
|
||||
|
||||
|
||||
//
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param s percentage to scale the object
|
||||
*/
|
||||
public void scale(float s) {
|
||||
checkMatrix(2); // at least 2...
|
||||
matrix.scale(s);
|
||||
}
|
||||
|
||||
|
||||
public void scale(float sx, float sy) {
|
||||
public void scale(float x, float y) {
|
||||
checkMatrix(2);
|
||||
matrix.scale(sx, sy);
|
||||
matrix.scale(x, y);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Increases or decreases the size of a shape by expanding and contracting vertices. Shapes always scale from the relative origin of their bounding box.
|
||||
* Scale values are specified as decimal percentages. For example, the method call <b>scale(2.0)</b> increases the dimension of a shape by 200%.
|
||||
* Subsequent calls to the method multiply the effect. For example, calling <b>scale(2.0)</b> and then <b>scale(1.5)</b> is the same as <b>scale(3.0)</b>.
|
||||
* This transformation is applied directly to the shape, it's not refreshed each time <b>draw()</b> is run.
|
||||
* <br><br>Using this fuction with the <b>z</b> parameter requires passing P3D or OPENGL into the size() parameter.
|
||||
* @param x percentage to scale the object in the x-axis
|
||||
* @param y percentage to scale the object in the y-axis
|
||||
* @param z percentage to scale the object in the z-axis
|
||||
* @webref
|
||||
* @brief Increases and decreases the size of a shape
|
||||
*/
|
||||
public void scale(float x, float y, float z) {
|
||||
checkMatrix(3);
|
||||
matrix.scale(x, y, z);
|
||||
|
@ -457,7 +457,11 @@ public class PShapeSVG extends PShape {
|
||||
separate = false;
|
||||
}
|
||||
if (c == '-' && !lastSeparate) {
|
||||
pathBuffer.append("|");
|
||||
// allow for 'e' notation in numbers, e.g. 2.10e-9
|
||||
// http://dev.processing.org/bugs/show_bug.cgi?id=1408
|
||||
if (i == 0 || pathDataChars[i-1] != 'e') {
|
||||
pathBuffer.append("|");
|
||||
}
|
||||
}
|
||||
if (c != ',') {
|
||||
pathBuffer.append(c); //"" + pathDataBuffer.charAt(i));
|
||||
|
@ -428,8 +428,8 @@ public class PVector {
|
||||
public float dot(float x, float y, float z) {
|
||||
return this.x*x + this.y*y + this.z*z;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static public float dot(PVector v1, PVector v2) {
|
||||
return v1.x*v2.x + v1.y*v2.y + v1.z*v2.z;
|
||||
}
|
||||
|
@ -31,6 +31,10 @@ import processing.core.PApplet;
|
||||
|
||||
|
||||
/**
|
||||
* XMLElement is a representation of an XML object. The object is able to parse XML code. The methods described here are the most basic. More are documented in the Developer's Reference.
|
||||
* <br><br>
|
||||
* The encoding parameter inside XML files is ignored, only UTF-8 (or plain ASCII) are parsed properly.
|
||||
* =advanced
|
||||
* XMLElement is an XML element. This is the base class used for the
|
||||
* Processing XML library, representing a single node of an XML tree.
|
||||
*
|
||||
@ -38,6 +42,10 @@ import processing.core.PApplet;
|
||||
*
|
||||
* @author Marc De Scheemaecker
|
||||
* @author processing.org
|
||||
*
|
||||
* @webref data:composite
|
||||
* @usage Web & Application
|
||||
* @instanceName xml any variable of type XMLElement
|
||||
*/
|
||||
public class XMLElement implements Serializable {
|
||||
|
||||
@ -103,6 +111,7 @@ public class XMLElement implements Serializable {
|
||||
|
||||
/**
|
||||
* Creates an empty element to be used for #PCDATA content.
|
||||
* @nowebref
|
||||
*/
|
||||
public XMLElement() {
|
||||
this(null, null, null, NO_LINE);
|
||||
@ -173,6 +182,7 @@ public class XMLElement implements Serializable {
|
||||
* @param namespace the namespace URI.
|
||||
* @param systemID the system ID of the XML data where the element starts.
|
||||
* @param lineNr the line in the XML data where the element starts.
|
||||
* @nowebref
|
||||
*/
|
||||
public XMLElement(String fullName,
|
||||
String namespace,
|
||||
@ -204,21 +214,25 @@ public class XMLElement implements Serializable {
|
||||
* wraps exception handling, for more advanced exception handling,
|
||||
* use the constructor that takes a Reader or InputStream.
|
||||
* @author processing.org
|
||||
* @param filename
|
||||
* @param parent
|
||||
* @param filename name of the XML file to load
|
||||
* @param parent typically use "this"
|
||||
*/
|
||||
public XMLElement(PApplet parent, String filename) {
|
||||
this();
|
||||
parseFromReader(parent.createReader(filename));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @nowebref
|
||||
*/
|
||||
public XMLElement(Reader r) {
|
||||
this();
|
||||
parseFromReader(r);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @nowebref
|
||||
*/
|
||||
public XMLElement(String xml) {
|
||||
this();
|
||||
parseFromReader(new StringReader(xml));
|
||||
@ -348,6 +362,8 @@ public class XMLElement implements Serializable {
|
||||
* Returns the full name (i.e. the name including an eventual namespace
|
||||
* prefix) of the element.
|
||||
*
|
||||
* @webref
|
||||
* @brief Returns the name of the element.
|
||||
* @return the name, or null if the element only contains #PCDATA.
|
||||
*/
|
||||
public String getName() {
|
||||
@ -507,9 +523,12 @@ public class XMLElement implements Serializable {
|
||||
|
||||
|
||||
/**
|
||||
* Returns the number of children.
|
||||
* Returns the number of children for the element.
|
||||
*
|
||||
* @return the count.
|
||||
* @webref
|
||||
* @see processing.xml.XMLElement#getChild(int)
|
||||
* @see processing.xml.XMLElement#getChildren(String)
|
||||
*/
|
||||
public int getChildCount() {
|
||||
return this.children.size();
|
||||
@ -554,27 +573,35 @@ public class XMLElement implements Serializable {
|
||||
/**
|
||||
* Quick accessor for an element at a particular index.
|
||||
* @author processing.org
|
||||
* @param index the element
|
||||
*/
|
||||
public XMLElement getChild(int which) {
|
||||
return (XMLElement) children.elementAt(which);
|
||||
public XMLElement getChild(int index) {
|
||||
return (XMLElement) children.elementAt(index);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get a child by its name or path.
|
||||
* @param name element name or path/to/element
|
||||
* Returns the child XMLElement as specified by the <b>index</b> parameter. The value of the <b>index</b> parameter must be less than the total number of children to avoid going out of the array storing the child elements.
|
||||
* When the <b>path</b> parameter is specified, then it will return all children that match that path. The path is a series of elements and sub-elements, separated by slashes.
|
||||
*
|
||||
* @return the element
|
||||
* @author processing.org
|
||||
*
|
||||
* @webref
|
||||
* @see processing.xml.XMLElement#getChildCount()
|
||||
* @see processing.xml.XMLElement#getChildren(String)
|
||||
* @brief Get a child by its name or path.
|
||||
* @param path path to a particular element
|
||||
*/
|
||||
public XMLElement getChild(String name) {
|
||||
if (name.indexOf('/') != -1) {
|
||||
return getChildRecursive(PApplet.split(name, '/'), 0);
|
||||
public XMLElement getChild(String path) {
|
||||
if (path.indexOf('/') != -1) {
|
||||
return getChildRecursive(PApplet.split(path, '/'), 0);
|
||||
}
|
||||
int childCount = getChildCount();
|
||||
for (int i = 0; i < childCount; i++) {
|
||||
XMLElement kid = getChild(i);
|
||||
String kidName = kid.getName();
|
||||
if (kidName != null && kidName.equals(name)) {
|
||||
if (kidName != null && kidName.equals(path)) {
|
||||
return kid;
|
||||
}
|
||||
}
|
||||
@ -681,20 +708,27 @@ public class XMLElement implements Serializable {
|
||||
|
||||
|
||||
/**
|
||||
* Get any children that match this name or path. Similar to getChild(),
|
||||
* but will grab multiple matches rather than only the first.
|
||||
* @param name element name or path/to/element
|
||||
* Returns all of the children as an XMLElement array.
|
||||
* When the <b>path</b> parameter is specified, then it will return all children that match that path.
|
||||
* The path is a series of elements and sub-elements, separated by slashes.
|
||||
*
|
||||
* @param path element name or path/to/element
|
||||
* @return array of child elements that match
|
||||
* @author processing.org
|
||||
*
|
||||
* @webref
|
||||
* @brief Returns all of the children as an XMLElement array.
|
||||
* @see processing.xml.XMLElement#getChildCount()
|
||||
* @see processing.xml.XMLElement#getChild(int)
|
||||
*/
|
||||
public XMLElement[] getChildren(String name) {
|
||||
if (name.indexOf('/') != -1) {
|
||||
return getChildrenRecursive(PApplet.split(name, '/'), 0);
|
||||
public XMLElement[] getChildren(String path) {
|
||||
if (path.indexOf('/') != -1) {
|
||||
return getChildrenRecursive(PApplet.split(path, '/'), 0);
|
||||
}
|
||||
// if it's a number, do an index instead
|
||||
// (returns a single element array, since this will be a single match
|
||||
if (Character.isDigit(name.charAt(0))) {
|
||||
return new XMLElement[] { getChild(Integer.parseInt(name)) };
|
||||
if (Character.isDigit(path.charAt(0))) {
|
||||
return new XMLElement[] { getChild(Integer.parseInt(path)) };
|
||||
}
|
||||
int childCount = getChildCount();
|
||||
XMLElement[] matches = new XMLElement[childCount];
|
||||
@ -702,7 +736,7 @@ public class XMLElement implements Serializable {
|
||||
for (int i = 0; i < childCount; i++) {
|
||||
XMLElement kid = getChild(i);
|
||||
String kidName = kid.getName();
|
||||
if (kidName != null && kidName.equals(name)) {
|
||||
if (kidName != null && kidName.equals(path)) {
|
||||
matches[matchCount++] = kid;
|
||||
}
|
||||
}
|
||||
@ -882,12 +916,22 @@ public class XMLElement implements Serializable {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getStringAttribute(String name) {
|
||||
return getAttribute(name);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns a String attribute of the element.
|
||||
* If the <b>default</b> parameter is used and the attribute doesn't exist, the <b>default</b> value is returned.
|
||||
* When using the version of the method without the <b>default</b> parameter, if the attribute doesn't exist, the value 0 is returned.
|
||||
*
|
||||
* @webref
|
||||
* @param name the name of the attribute
|
||||
* @param default Value value returned if the attribute is not found
|
||||
*
|
||||
* @brief Returns a String attribute of the element.
|
||||
*/
|
||||
public String getStringAttribute(String name, String defaultValue) {
|
||||
return getAttribute(name, defaultValue);
|
||||
}
|
||||
@ -899,18 +943,24 @@ public class XMLElement implements Serializable {
|
||||
return getAttribute(name, namespace, defaultValue);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns an integer attribute of the element.
|
||||
*/
|
||||
public int getIntAttribute(String name) {
|
||||
return getIntAttribute(name, 0);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the value of an attribute.
|
||||
* Returns an integer attribute of the element.
|
||||
* If the <b>default</b> parameter is used and the attribute doesn't exist, the <b>default</b> value is returned.
|
||||
* When using the version of the method without the <b>default</b> parameter, if the attribute doesn't exist, the value 0 is returned.
|
||||
*
|
||||
* @param name the non-null full name of the attribute.
|
||||
* @param defaultValue the default value of the attribute.
|
||||
* @param name the name of the attribute
|
||||
* @param defaultValue value returned if the attribute is not found
|
||||
*
|
||||
* @webref
|
||||
* @brief Returns an integer attribute of the element.
|
||||
* @return the value, or defaultValue if the attribute does not exist.
|
||||
*/
|
||||
public int getIntAttribute(String name,
|
||||
@ -944,12 +994,17 @@ public class XMLElement implements Serializable {
|
||||
|
||||
|
||||
/**
|
||||
* Returns the value of an attribute.
|
||||
* Returns a float attribute of the element.
|
||||
* If the <b>default</b> parameter is used and the attribute doesn't exist, the <b>default</b> value is returned.
|
||||
* When using the version of the method without the <b>default</b> parameter, if the attribute doesn't exist, the value 0 is returned.
|
||||
*
|
||||
* @param name the non-null full name of the attribute.
|
||||
* @param defaultValue the default value of the attribute.
|
||||
* @param name the name of the attribute
|
||||
* @param defaultValue value returned if the attribute is not found
|
||||
*
|
||||
* @return the value, or defaultValue if the attribute does not exist.
|
||||
*
|
||||
* @webref
|
||||
* @brief Returns a float attribute of the element.
|
||||
*/
|
||||
public float getFloatAttribute(String name,
|
||||
float defaultValue) {
|
||||
@ -966,6 +1021,7 @@ public class XMLElement implements Serializable {
|
||||
* @param defaultValue the default value of the attribute.
|
||||
*
|
||||
* @return the value, or defaultValue if the attribute does not exist.
|
||||
* @nowebref
|
||||
*/
|
||||
public float getFloatAttribute(String name,
|
||||
String namespace,
|
||||
@ -1253,11 +1309,15 @@ public class XMLElement implements Serializable {
|
||||
|
||||
|
||||
/**
|
||||
* Returns the content of an element. If there is no such content, <b>null</b> is returned.
|
||||
* =advanced
|
||||
* Return the #PCDATA content of the element. If the element has a
|
||||
* combination of #PCDATA content and child elements, the #PCDATA
|
||||
* sections can be retrieved as unnamed child objects. In this case,
|
||||
* this method returns null.
|
||||
*
|
||||
* @webref
|
||||
* @brief Returns the content of an element
|
||||
* @return the content.
|
||||
*/
|
||||
public String getContent() {
|
||||
|
162
core/todo.txt
162
core/todo.txt
@ -1,10 +1,85 @@
|
||||
0171 core
|
||||
X Blurred PImages in OPENGL sketches
|
||||
X removed NPOT texture support (for further testing)
|
||||
X http://dev.processing.org/bugs/show_bug.cgi?id=1352
|
||||
0179 core
|
||||
X screenWidth/Height instead of screenW/H
|
||||
X open up the pdf library more (philho)
|
||||
X http://dev.processing.org/bugs/show_bug.cgi?id=1343
|
||||
X cache font information for the PDF library to improve setup time
|
||||
X when using createFont("xxxx.ttf"), should use textMode(SHAPE) with PDF
|
||||
X because ttf files will not be installed on the system when opening pdf
|
||||
X added error messages for users
|
||||
X bring back old-style textAscent()
|
||||
X needs to just quickly run characters d and p
|
||||
X only takes a couple ms, so no problem
|
||||
X pdf library
|
||||
X throw an error with the black boxes
|
||||
X throw an error if loading fonts from a file, and not using mode(SHAPE)
|
||||
X implement default font
|
||||
X this can be done to replace the exception handler in PGraphics
|
||||
o however it needs to be a legit font, so that it works w/ pdf
|
||||
o or maybe pdf just has its own default?
|
||||
X create characters on the fly when createFont() is used
|
||||
o memory leak problem with fonts in JAVA2D
|
||||
X can't get this to crash anymore
|
||||
o http://dev.processing.org/bugs/show_bug.cgi?id=1252
|
||||
|
||||
earlier
|
||||
X if no draw() method, and renderer is not displayable, then exit
|
||||
X static mode PDFs shouldn't just hang
|
||||
|
||||
|
||||
big ones
|
||||
_ ortho() behaving differently in P3D vs OPENGL
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=100
|
||||
_ shows a blank canvas
|
||||
_ (was only happening once b/c was drawing first in perspective)
|
||||
_ seems to be mapping to 0, 0 - width/2, height/2
|
||||
_ fix 3D > OrthoVsPerspective example once ortho works properly
|
||||
_ there's a depth problem in addition to the ortho weirdness
|
||||
_ modelx/y/z broken when aiming a camera
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=1074
|
||||
_ opengl + resize window => window content garbled
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=1360
|
||||
_ modify PVector to include better methods for chaining operations
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=1415
|
||||
|
||||
quickies
|
||||
_ img.get() weirdness
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=1198
|
||||
_ copy and blend scale when unnecessary
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=1482
|
||||
_ add a limit to pushStyle() to catch unmatched sets?
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=1368
|
||||
_ P2D transformation bug from ira
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=1175
|
||||
_ resize not working in revision 5707
|
||||
_ camera() and perspective() were commented out in setSize()
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=1391
|
||||
_ chopping out triangles in OpenGL (though it's only 2D drawing)
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=1359
|
||||
_ make sure that get() and set() (for pixels and subsets) work w/ loaded images
|
||||
_ make sure that get() and set() (for pixels and subsets) work w/ P2D
|
||||
_ make sure that get() and set() (for pixels and subsets) work w/ P3D
|
||||
_ consider adding skewX/Y
|
||||
_ do them as shearX/Y
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=1448
|
||||
|
||||
_ add setOutput() method across other renderers?
|
||||
|
||||
_ opengl applet problems
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=1364
|
||||
|
||||
_ method of threading but queue an event to be run when safe
|
||||
_ e.g. queueing items like mouse/keybd, but generic fxns
|
||||
|
||||
_ inconsistent anti-aliasing with OpenGL
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=1413
|
||||
_ modify PVector to include better methods for chaining operations
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=1415
|
||||
|
||||
_ selectInput() fails when called from within keyPressed()
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=1220
|
||||
|
||||
_ add java.io.Reader (and Writer?) to imports
|
||||
|
||||
_ open up the pdf library more (philho)
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=1343
|
||||
_ changing vertex alpha in P3D in a QUAD_STRIP is ignored
|
||||
_ with smoothing, it works fine, but with PTriangle, it's not
|
||||
_ smooth() not working with applets an createGraphics(JAVA2D)
|
||||
@ -12,6 +87,9 @@ _ but works fine with applications
|
||||
_ get() with OPENGL is grabbing the wrong coords
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=1349
|
||||
|
||||
_ gl power of 2 with textures
|
||||
_ P3D also seems to have trouble w/ textures edges.. bad math?
|
||||
|
||||
_ No textures render with hint(ENABLE_ACCURATE_TEXTURES)
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=985
|
||||
_ need to remove the hint from the reference
|
||||
@ -20,11 +98,14 @@ _ deal with issue of single pixel seam at the edge of textures
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=602
|
||||
_ should vertexTexture() divide by width/height or width-1/height-1?
|
||||
|
||||
looping/events
|
||||
_ key and mouse events delivered out of order
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=638
|
||||
_ key/mouse events have concurrency problems with noLoop()
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=1323
|
||||
_ need to say "no drawing inside mouse/key events w/ noLoop"
|
||||
_ redraw() doesn't work from within draw()
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=1363
|
||||
|
||||
_ make the index lookup use numbers up to 256?
|
||||
|
||||
@ -34,8 +115,6 @@ _ public float textWidth(char[] chars, int start, int length)
|
||||
_ textAlign(JUSTIFY) (with implementation)
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=1309
|
||||
|
||||
_ create characters on the fly when createFont() is used
|
||||
|
||||
_ Semitransparent rect drawn over image not rendered correctly
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=1280
|
||||
|
||||
@ -49,8 +128,6 @@ _ http://dev.processing.org/bugs/show_bug.cgi?id=1176
|
||||
_ what's the difference with ascent on loadFont vs. createFont?
|
||||
_ noCursor() doesn't work in present mode
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=1177
|
||||
_ modelx/y/z broken when aiming a camera
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=1074
|
||||
_ in P2D, two vertex() line calls with fill() causes duplicate output
|
||||
_ works fine in other renderers, has to do with tesselation
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=1191
|
||||
@ -67,14 +144,10 @@ _ what other methods should work with doubles? all math functions?
|
||||
_ seems like internal (mostly static) things, but not graphics api
|
||||
_ look into replacing nanoxml
|
||||
_ http://www.exampledepot.com/egs/javax.xml.parsers/pkg.html
|
||||
_ if no draw() method, and renderer is not displayable, then exit
|
||||
_ static mode PDFs shouldn't just hang
|
||||
|
||||
|
||||
[ known problems ]
|
||||
|
||||
_ memory leak problem with fonts in JAVA2D
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=1252
|
||||
_ OPENGL sketches flicker w/ Vista when background() not used inside draw()
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=930
|
||||
_ Disabling Aero scheme sometimes prevents the problem
|
||||
@ -142,16 +215,11 @@ _ make sure that filter, blend, copy, etc say that no loadPixels necessary
|
||||
|
||||
|
||||
rework some text/font code [1.0]
|
||||
_ PFont not working well with lots of characters
|
||||
_ only create bitmap chars on the fly when needed (in createFont)
|
||||
_ text placement is ugly, seems like fractional metrics problem
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=866
|
||||
_ text(char c) with char 0 and undefined should print nothing
|
||||
_ perhaps also DEL or other nonprintables?
|
||||
_ book example 25-03
|
||||
_ when using createFont("xxxx.ttf"), should use textMode(SHAPE) with PDF
|
||||
_ because ttf files will not be installed on the system when opening pdf
|
||||
_ maybe just add this to the reference so that people know
|
||||
_ text position is quantized in JAVA2D
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=806
|
||||
_ accessors inside PFont need a lot of work
|
||||
@ -159,8 +227,6 @@ _ osx 10.5 (not 10.4) performing text width calculation differently
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=972
|
||||
_ Automatically use textMode(SCREEN) with text() when possible
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=1020
|
||||
_ Implement better caching mechanism when creating large fonts
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=1111
|
||||
|
||||
|
||||
P2D, P3D, PPolygon [1.0]
|
||||
@ -200,19 +266,12 @@ _ also needs fix for last edge and the seam
|
||||
|
||||
|
||||
threading and exiting
|
||||
_ pdf sketches exiting before writing has finished
|
||||
_ writing image file (missing a flush() call?) on exit() fails
|
||||
_ lots of zero length files
|
||||
_ saveFrame() at the end of a draw mode program is problematic
|
||||
_ app might exit before the file has finished writing to disk
|
||||
_ need to block other activity inside screenGrab until finished
|
||||
_ http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1081706752
|
||||
_ what's up with stop() vs exit()?
|
||||
_ need to get this straightened for p5 (i.e. bc has this problem)
|
||||
_ make sure the main() doesn't exit until the applet has finished
|
||||
_ i.e. problem with main calling itself multiple times in Alpheus
|
||||
_ if exit() (or stop) is called, then System.exit() gets called,
|
||||
_ even though the main() wants to keep going
|
||||
|
||||
_ for begin/endRecord, use a piggyback mechanism
|
||||
_ that way won't have to pass a PApplet around
|
||||
@ -220,24 +279,32 @@ _ this has a big impact on the SVG library
|
||||
_ in fact, this maybe should be a library that does it
|
||||
_ so that the file size can be much smaller
|
||||
|
||||
_ when closing a sketch via the close box, make sure stop() getting called
|
||||
X found a problem for release 0133
|
||||
_ test to see if it's working
|
||||
|
||||
_ STROKE_WEIGHT field in PGraphics3 is a disaster, because it's an int
|
||||
_ use the SW from vertex instead.. why set stroke in triangle vars at all?
|
||||
_ currently truncating to an int inside add_line_no_clip
|
||||
_ need to clean all this crap up
|
||||
|
||||
stop() mess
|
||||
_ double stop() called with noLoop()
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=1270
|
||||
_ stop() not getting called
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=183
|
||||
_ major problem for libraries
|
||||
_ and start() is supposedly called by the applet viewer
|
||||
_ http://java.sun.com/j2se/1.4.2/docs/api/java/applet/Applet.html#start()
|
||||
_ need to track this stuff down a bit
|
||||
_ when closing a sketch via the close box, make sure stop() getting called
|
||||
X found a problem for release 0133
|
||||
_ test to see if it's working
|
||||
_ what's up with stop() vs exit()?
|
||||
_ need to get this straightened for p5 (i.e. bc has this problem)
|
||||
_ make sure the main() doesn't exit until the applet has finished
|
||||
_ i.e. problem with main calling itself multiple times in Alpheus
|
||||
_ if exit() (or stop) is called, then System.exit() gets called,
|
||||
_ even though the main() wants to keep going
|
||||
_ more chatter with this
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=131
|
||||
|
||||
_ method of threading but queue an event to be run when safe
|
||||
_ e.g. queueing items like mouse/keybd, but generic fxns
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
@ -280,6 +347,8 @@ _ don't bother using a buffering stream, just handle internally. gah!
|
||||
_ remove some of the bloat, how can we make things more compact?
|
||||
_ i.e. if not using 3D, can leave out PGraphics3, PTriangle, PLine
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=127
|
||||
E4 _ add shuffle methods for arrays
|
||||
E4 _ http://dev.processing.org/bugs/show_bug.cgi?id=1462
|
||||
|
||||
|
||||
CORE / PApplet - main()
|
||||
@ -309,7 +378,8 @@ _ or if the sketch window is foremost
|
||||
_ maybe a hack where a new menubar is added?
|
||||
_ --display not working on osx
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=531
|
||||
|
||||
_ "Target VM failed to initialize" when using Present mode on Mac OS X
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=1257
|
||||
|
||||
CORE / PFont and text()
|
||||
|
||||
@ -412,13 +482,6 @@ CORE / PGraphics3D
|
||||
_ make thick lines draw perpendicular to the screen with P3D
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=956
|
||||
_ ewjordan suggests building the quad in screen coords after perspective
|
||||
_ ortho() behaving differently in P3D vs OPENGL
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=100
|
||||
_ shows a blank canvas
|
||||
_ (was only happening once b/c was drawing first in perspective)
|
||||
_ seems to be mapping to 0, 0 - width/2, height/2
|
||||
_ fix 3D > OrthoVsPerspective example once ortho works properly
|
||||
_ there's a depth problem in addition to the ortho weirdness
|
||||
_ improve hint(ENABLE_DEPTH_SORT) to use proper painter's algo
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=176
|
||||
_ polygon z-order depth sorting with alpha in opengl
|
||||
@ -433,11 +496,9 @@ _ images are losing pixels at the edges
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=102
|
||||
_ odd error with some pixels from images not drawing properly
|
||||
_ http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action=display;num=1115681453
|
||||
_ clipping not yet completely implemented
|
||||
_ clipping not implemented
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=1393
|
||||
_ http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action=display;num=1114184516
|
||||
_ Stroking a rect() leaves off the upper right pixel
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=501
|
||||
_ clipping planes
|
||||
_ http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1058491568;start=0
|
||||
_ http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1052313604;start=0
|
||||
_ http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_Software;action=display;num=1095170607;start=0
|
||||
@ -449,6 +510,8 @@ _ or at least that things get ridiculously slow
|
||||
_ clipping issues here.. but also something in scan converter
|
||||
_ not clipping areas from offscreen
|
||||
_ huge geometry slows things way down
|
||||
_ Stroking a rect() leaves off the upper right pixel
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=501
|
||||
_ box is not opaque
|
||||
_ problem is that lines are drawn second
|
||||
_ one pixel lines have no z value.. argh
|
||||
@ -462,6 +525,8 @@ _ box(40);
|
||||
|
||||
CORE / PImage
|
||||
|
||||
_ accuracy problems make alpha channel go to FE with image.copy()
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=1420
|
||||
_ improve blend() accuracy when using ADD
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=1008
|
||||
_ includes code for a slow but more accurate mode
|
||||
@ -603,6 +668,10 @@ LIBRARIES / PGraphicsPDF
|
||||
|
||||
_ pdf not rendering unicode with beginRecord()
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=727
|
||||
_ pdf sketches exiting before writing has finished
|
||||
_ people have to call exit() (so that dispose() is called in particular)
|
||||
_ when using noLoop() and the PDF renderer, sketch should exit gracefully
|
||||
_ because isDisplayable() returns false, there's no coming back from noLoop
|
||||
|
||||
|
||||
|
||||
@ -710,3 +779,4 @@ _ exactly how should pixel filling work with single pixel strokes?
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=1025
|
||||
_ Writing XML files (clean up the API)
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=964
|
||||
_ consider bringing back text/image using cache/names
|
||||
|
@ -101,6 +101,26 @@ bt.build.core=arduino
|
||||
|
||||
##############################################################
|
||||
|
||||
fio.name=Arduino Fio
|
||||
|
||||
fio.upload.protocol=stk500
|
||||
fio.upload.maximum_size=30720
|
||||
fio.upload.speed=57600
|
||||
|
||||
fio.bootloader.low_fuses=0xFF
|
||||
fio.bootloader.high_fuses=0xDA
|
||||
fio.bootloader.extended_fuses=0x05
|
||||
fio.bootloader.path=arduino:atmega
|
||||
fio.bootloader.file=ATmegaBOOT_168_atmega328_pro_8MHz.hex
|
||||
fio.bootloader.unlock_bits=0x3F
|
||||
fio.bootloader.lock_bits=0x0F
|
||||
|
||||
fio.build.mcu=atmega328p
|
||||
fio.build.f_cpu=8000000L
|
||||
fio.build.core=arduino:arduino
|
||||
|
||||
##############################################################
|
||||
|
||||
lilypad328.name=LilyPad Arduino w/ ATmega328
|
||||
|
||||
lilypad328.upload.protocol=stk500
|
||||
@ -179,27 +199,6 @@ pro.build.mcu=atmega168
|
||||
pro.build.f_cpu=8000000L
|
||||
pro.build.core=arduino
|
||||
|
||||
##############################################################
|
||||
|
||||
fio.name=Arduino Fio
|
||||
|
||||
fio.upload.protocol=stk500
|
||||
fio.upload.maximum_size=30720
|
||||
fio.upload.speed=57600
|
||||
|
||||
fio.bootloader.low_fuses=0xFF
|
||||
fio.bootloader.high_fuses=0xDA
|
||||
fio.bootloader.extended_fuses=0x05
|
||||
fio.bootloader.path=arduino:atmega
|
||||
fio.bootloader.file=ATmegaBOOT_168_atmega328_pro_8MHz.hex
|
||||
fio.bootloader.unlock_bits=0x3F
|
||||
fio.bootloader.lock_bits=0x0F
|
||||
|
||||
fio.build.mcu=atmega328p
|
||||
fio.build.f_cpu=8000000L
|
||||
fio.build.core=arduino:arduino
|
||||
|
||||
|
||||
##############################################################
|
||||
|
||||
atmega168.name=Arduino NG or older w/ ATmega168
|
||||
|
367
readme.txt
367
readme.txt
@ -39,370 +39,3 @@ Processing and Wiring.
|
||||
|
||||
Icon Design and Artwork created by Thomas Glaser (envis precisely).
|
||||
|
||||
UPDATES
|
||||
|
||||
0018 - 2010.01.29
|
||||
|
||||
[core / libraries]
|
||||
|
||||
* Added tone() and noTone() functions for frequency generation.
|
||||
* Added Serial.end() command.
|
||||
* Added precision parameter for printing of floats / doubles.
|
||||
* Incorporated latest version of Firmata.
|
||||
* Fixed bug w/ disabling use of the RW pin in the LiquidCrystal library.
|
||||
* No longer disabling interrupts in delayMicroseconds().
|
||||
* Fixed bug w/ micros() returning incorrect values from within an interrupt.
|
||||
* Fixed bug that broke use of analog inputs 8-15 on the Mega.
|
||||
|
||||
[environment]
|
||||
|
||||
* Synchronized with the Processing 1.0.9 code base, bringing various fixes,
|
||||
including to a bug causing saving to fail when closing the last sketch.
|
||||
|
||||
* Added support for third-party hardware in the SKETCHBOOK/hardware folder,
|
||||
mirroring the current structure of the hardware folder in Arduino.
|
||||
|
||||
* Added Ctrl-Shift-M / Command-Shift-M shortcut for serial monitor.
|
||||
|
||||
* Hold down shift when pressing the Verify / Compile or Upload toolbar
|
||||
buttons to generate verbose output (including command lines).
|
||||
|
||||
* Moving build (on upload) from the applet/ sub-folder of the sketch
|
||||
to a temporary directory (fixing problems with uploading examples from
|
||||
within the Mac OS X disk image or a Linux application directory).
|
||||
|
||||
* Fixed bug the prevented the inclusion of .cpp and .h (or .c and .h) files
|
||||
of the same name in a sketch.
|
||||
|
||||
* Improved the Mac OS X disk image (.dmg): added a shortcut to the
|
||||
Applications folder, a background image with arrow, and new FTDI drivers.
|
||||
|
||||
0017 - 2009.07.25
|
||||
|
||||
[documentation / examples]
|
||||
* Many new and revised examples from Tom Igoe.
|
||||
|
||||
[core / libraries]
|
||||
* Updated LiquidCrystal library by Limor Fried. See reference for details.
|
||||
* Updated Firmata library to version 2.1 (rev. 25).
|
||||
* Replaced the Servo library with one (MegaServo) by Michael Margolis.
|
||||
Supports up to 12 servos on most Arduino boards and 48 on the Mega.
|
||||
* Improving the accuracy of the baud rate calculations for serial
|
||||
communication (fixing double-speed problems on 8 MHz Arduino boards).
|
||||
Thanks to gabebear.
|
||||
|
||||
[environment]
|
||||
* Synchronized with the Processing 1.0.3 code base (rev. 5503), bringing
|
||||
many improvements (listed below).
|
||||
* New icons and about image by Thomas Glaser (envis precisely).
|
||||
* Support for multiple sketch windows.
|
||||
* The serial monitor now has its own window.
|
||||
* Comment / Uncomment menu item (in Edit) and keyboard shortcut.
|
||||
* Increase and Decrease Indent menu items (in Edit) and keyboard shortcuts.
|
||||
* Support for third-party libraries in the SKETCHBOOK/libraries folder.
|
||||
* Libraries are now compiled with the sketch, eliminating the delay when
|
||||
switching boards and the need to delete .o files when changing library
|
||||
source code.
|
||||
* Arduino now comes as an app file (in a dmg) on the Mac.
|
||||
* Adding the Arduino Nano w/ ATmega328 to the Tools > Board menu.
|
||||
|
||||
0016 - 2009.05.30
|
||||
|
||||
[documentation / examples]
|
||||
* New communication examples (w/ corresponding Processing and Max/MSP code) by
|
||||
Tom Igoe.
|
||||
|
||||
[core / libraries]
|
||||
* Adding support for the Arduino Pro and Pro Mini 3.3V / 8 MHz w/ ATmega328.
|
||||
* Adding support for the LilyPad Arduino w/ ATmega328.
|
||||
* Adding write(str) and write(buf, size) methods to Print, Serial, and the
|
||||
Ethernet library Client and Server classes. This allows for more efficient
|
||||
(fewer packet) Ethernet communication. (Thanks to mikalhart.)
|
||||
* Improvements to the way the Ethernet library Client class connects and
|
||||
disconnects. Should reduce or eliminate failed connections and long
|
||||
timeouts. (Thanks to Bruce Luckcuck.)
|
||||
* Optimizing the timer0 overflow interrupt handler (used for millis() and
|
||||
micros()). Thanks to westfw and mikalhart.
|
||||
* Fixing bug that limited the bit() macro to 15 bits. Thanks to Paul Badger.
|
||||
* Adding ARDUINO version constant (thanks to prodding from mikalhart).
|
||||
|
||||
[environment]
|
||||
* Ordering the items in the Tools > Board menu.
|
||||
* Adding "Copy as HTML" command to the Tools menu.
|
||||
* Eliminating (maybe) the occasional "Couldn't determine program size" errors.
|
||||
Thanks to the Clever Monkey.
|
||||
* Moving selection of Linux look-and-feel into the arduino script so it can
|
||||
be changed by users. Thanks to Eberhard Fahle.
|
||||
|
||||
[tools]
|
||||
* Adding automatic dependency generation to the Makefile. (Lars Immisch)
|
||||
|
||||
0015 - 2009.03.26
|
||||
|
||||
[core / libraries]
|
||||
* Adding support for the Arduino Mega (ATmega1280).
|
||||
|
||||
[environment]
|
||||
* Reinstating use of core.a library in the build process, slightly shrinking
|
||||
compiled sketch sizes. (Thanks to William Westfield.)
|
||||
* Fixing bug in copy for forum (thanks to eried).
|
||||
|
||||
0014 - 2009.03.07
|
||||
|
||||
[core / libraries]
|
||||
* Fixing bug that prevented multiple outgoing Client connections with the
|
||||
ethernet library.
|
||||
|
||||
[environment]
|
||||
* Clarifying ATmega168 vs. ATmega328 in the Tools > Boards menu.
|
||||
|
||||
[tools]
|
||||
* Updating the Mac OS X AVR tools to AVR MacPack 20081213. This includes
|
||||
avr-gcc 4.3.2, which should fix problems with functions called from
|
||||
within interrupts.
|
||||
|
||||
0013 - 2009.02.06
|
||||
|
||||
[documentation / examples]
|
||||
* Adding examples for Parallax Ping Sensor and Memsic 2125 accelerometer.
|
||||
|
||||
[core / libraries]
|
||||
* Adding support for the ATmega328. The upload speed is 57600 baud, so you
|
||||
may need to edit boards.txt or reburn your bootloader if you bought an
|
||||
ATmega328 w/ bootloader from adafruit or other supplier.
|
||||
* Adding support for printing floats to Print class (meaning that it works
|
||||
in the Serial, Ethernet, and LiquidCrystal classes too). Includes two
|
||||
decimal places.
|
||||
* Added word, word(), bitRead(), bitWrite(), bitSet(), bitClear(), bit(),
|
||||
lowByte(), and highByte(); see reference for details.
|
||||
* Working around problem that caused PWM output on pins 5 and 6 to never go
|
||||
to 0 (causing, for example, an LED to continue to glow faintly).
|
||||
* Removing cast macros, since function-style casts are a feature of C++. This
|
||||
should fix contributed libraries that broke in Arduino 0012.
|
||||
* Modifying pulseIn() to wait for a transition to start timing (i.e. ignoring
|
||||
any pulse that had already started when the function was called).
|
||||
* Fixing bug in random() that limited the ranges of values generated. Thanks
|
||||
to Mikal Hart.
|
||||
* Modifying delay() to pause for at least the given number of milliseconds.
|
||||
* Fixing bug in Ethernet library that interfered with use of pins 8 and 9.
|
||||
* Originating each outgoing network connection from a different port (in the
|
||||
Client class of the Ethernet library). Thanks to Paul and joquer.
|
||||
* Updating ATmega168 bootloader to work with standard distributions of avrdude
|
||||
(responding to signature requests made with the universal SPI command) and
|
||||
correctly store EEPROM data. Thanks to ladyada.
|
||||
|
||||
[environment]
|
||||
* Omitting unused functions from compiled sketches, reducing their size.
|
||||
* Changing compilation process to allow for use of EEMEM directive (although
|
||||
not yet uploading EEPROM data).
|
||||
|
||||
0012 - 2008.09.18
|
||||
|
||||
* Added Arduino Nano to the boards menu.
|
||||
* Arduino Pro or Pro Mini (8 MHz) to the boards menu.
|
||||
* Added Firmata library by Hans Steiner and others. This provides a standard
|
||||
protocol for communicating with software on the computer.
|
||||
* Added an Ethernet library for use with the Arduino Ethernet Shield.
|
||||
* Added a Servo library based on the work of Jim Studt.
|
||||
* Added a LiquidCrystal library based on the work in the playground. It
|
||||
supports both 4- and 8-bit modes.
|
||||
* Improved millis(): it now overflows after 49 days instead of 9 hours, but
|
||||
now uses slightly more processing power.
|
||||
* Fixed reversing direction bug in Stepper library. (Thanks to Wayne Holder.)
|
||||
* Moved insertion of #include <WProgram.h> to after any comments and #include
|
||||
statements in the main sketch file. This means that an #include <stdlib.h>
|
||||
now works.
|
||||
* Upgraded to newer versions of avr-gcc (4.3.0) and avr-libc (1.6). This
|
||||
provides support for newer Atmel chips, but may increase the size
|
||||
of sketches.
|
||||
* Allowing per-board specification of the upload.using preference, allowing
|
||||
upload via bootloader to some boards and via a programmer to others.
|
||||
* Added return values to some functions in the Wire library to allow for
|
||||
better error handling.
|
||||
* Fixed random() to work with long values.
|
||||
* Creation of an abstract Print base-class to allow Serial, SoftwareSerial,
|
||||
and LiquidCrystal to share code for print() and println().
|
||||
* Incorporated ladyada's watchdog timer mods to the bootloader source, but
|
||||
only compiling them in for the Pro and Pro Mini (because they are included
|
||||
in the bootloader being burned on the boards by SparkFun).
|
||||
|
||||
0011 - 2008.03.28
|
||||
|
||||
* Fixed Find in Reference.
|
||||
* Added map() function for mapping values from one range to another.
|
||||
* Added analogReference() function.
|
||||
* Added interrupts() and noInterrupts() functions.
|
||||
* Added degrees() and radians() functions.
|
||||
* Added timeout parameter (in microseconds) to pulseIn(); default is 1 second.
|
||||
* Support for uploading sketch using a programmer.
|
||||
* Improved detection of functions that need prototyping.
|
||||
* Placing function prototypes after #include's and #define's.
|
||||
* No longer moving #include statements to the top of the sketch.
|
||||
* Can now drag .pde files onto the Arduino dock icon on Mac OS X.
|
||||
Thanks to Peter Sgouros.
|
||||
* New script for downloading the reference from Tom Pollard. Thanks Tom!
|
||||
* Miscellaneous Mac OS X and other patches from Wim Lewis. Thanks Wim!
|
||||
* Updated Mac OS X FTDI drivers.
|
||||
|
||||
0010 - 2007.10.11
|
||||
|
||||
* Support for the LilyPad Arduino.
|
||||
* Vista support.
|
||||
* Mac OS X universal distribution.
|
||||
* Printing!
|
||||
* Copy for discourse.
|
||||
* New Board menu replaces the Microcontroller menu.
|
||||
* New Burn Bootloader menu offers a choice of programmers.
|
||||
* New and improved keyboard shortcuts.
|
||||
* Fixed some find/replace bugs.
|
||||
* Better auto-format.
|
||||
* Improved error messages when uploading.
|
||||
* Support for COM10 and higher on Windows.
|
||||
* Fixed automatic refresh of the Serial Port menu under Windows.
|
||||
* Quaqua look-and-feel on Mac OS X.
|
||||
* Reorganization of the Arduino application directory.
|
||||
|
||||
0009 - 2007.08.06
|
||||
|
||||
* Added support for the Arduino Diecimila.
|
||||
* Switched to using avrdude (instead of uisp) for uploading sketches.
|
||||
* Added the ability to burn NG and Diecimila bootlaoders (with an AVRISPmkII).
|
||||
* Fixed a bug in SoftwareSerial (a hardware serial function was being called
|
||||
instead of the software serial equivalent). Thanks to brianbr for the
|
||||
report and fix.
|
||||
|
||||
0008 - 2007.06.09
|
||||
|
||||
* Updated examples (in distribution and on the website).
|
||||
* Added an EEPROM library (see reference for details).
|
||||
* Added a Stepper motor library (see reference).
|
||||
* Patched to reduce binary sketch sizes by building the Arduino core as
|
||||
a library (.a) file - now only the needed parts of the core are linked into
|
||||
a sketch. Originally written by Nicolas Roland, revised by Don Cross.
|
||||
* Fixed bug in Serial.available(). Report and fix by Don Cross.
|
||||
* Now recompiling libraries when switching microcontrollers. Report by
|
||||
Julian Bleecker; fix by Nicholas Zambetti.
|
||||
* Cleaned up core functions: moved pin definitions into program space to save
|
||||
RAM, and other minor improvements. Contributed by Jim Studt.
|
||||
* Lots of reference additions and fixes from Paul Badger.
|
||||
* Changed default microcontroller to ATmega168 from ATmega8.
|
||||
* Removed the delay from analogRead().
|
||||
* Activating TWI/I2C pullup resistors on the ATmega168 (in addition to the
|
||||
ATmega8).
|
||||
|
||||
0007 - 2006.12.25
|
||||
|
||||
* Smaller core (about 3.5 KB instead of 4.5 KB).
|
||||
* Added a SoftwareSerial library (thanks to Antonio, Heather Dewey-Hagborg, and
|
||||
bigengineer for their help).
|
||||
* Implemented a Serial.flush() routine; see reference for details.
|
||||
* Digital pins 0 and 1 can be used for i/o until a call to Serial.begin().
|
||||
* Replaced avr-lib's uart routines with custom code for handling serial
|
||||
communication and modified C++ serial commands to call the C serial commands;
|
||||
the code may behave slightly differently in border cases (e.g. non-standard
|
||||
speeds, or on overflow).
|
||||
* Added attachInterrupt() and detachInterrupt() functions for handling of
|
||||
external interrupts on pins 2 and 3.
|
||||
* Implemented shiftOut() routine; see reference for details.
|
||||
* Defining binary constants: e.g. B1010 is 6.
|
||||
* Mac versions no longer require running of the macosx_setup.command script.
|
||||
* Windows version comes with the FTDI USB drivers already unzipped.
|
||||
* New Linux binary distribution (still requires some programs to be
|
||||
pre-installed).
|
||||
|
||||
0006 - 2006.10.21
|
||||
|
||||
* Mac version no longer requires Java 1.5, meaning it should run on 10.3.9.
|
||||
* Added support for analog inputs 6 and 7 and pwm on pins 5 and 6 on the
|
||||
on the ATmega168 used in the Arduino Mini (extra analog inputs not available
|
||||
in DIP ATmega168s).
|
||||
* You now select the baud rate for the serial monitor from within the editor
|
||||
status bar when the serial monitor is running instead of from the Tools menu.
|
||||
* Pressing enter within the serial monitor edit box no longer appends a newline
|
||||
to the message sent to the board.
|
||||
* Included the Wire (TWI) library from Wiring.
|
||||
* Updated the reference.
|
||||
|
||||
0005 - 2006.09.26
|
||||
|
||||
* Applied patch from Hans Steiner to improve Linux support by searching for avr
|
||||
tools in the user's path instead of expecting them at a fixed location.
|
||||
* Added an upload.verbose preference for help in debugging.
|
||||
* ATmega168 support!
|
||||
* New Wiring-compatible randomSeed(), random(max) and random(min, max) functions
|
||||
(except operating on longs instead of floats).
|
||||
* Fixed bug that sometimes caused uploading of old versions of a sketch.
|
||||
* Serial monitor nows include an interface to send messages to the Arduino
|
||||
board. Pressing return appends a newline, pushing the send button doesn't.
|
||||
* Now displaying "burning bootloader..." and "compiling..." status messages.
|
||||
|
||||
0004 - 2006.04.26
|
||||
|
||||
* Main sketch is now compiled as C++ (instead of C).
|
||||
* Updated avr toolchain.
|
||||
* printInteger(), printHex(), etc. now handle longs.
|
||||
* millis() fixed (now overflows after days, not minutes)
|
||||
* Fixed path to java in Windows run.bat.
|
||||
* Added Matrix and Sprite libraries (written with Nicholas Zambetti).
|
||||
* PWM now working on pin 11 (in addition to pins 9 and 10).
|
||||
* Slowed PWM frequency (on all three PWM pins) to 1KHz.
|
||||
* Now give an error if compiled sketch is too big.
|
||||
* Fixed abs(), min(), max(), and constrain() macros.
|
||||
* Added menu items to the IDE to burn bootloader.
|
||||
* Now display binary sketch size on upload, and give error if too big.
|
||||
* Added C++ serial library.
|
||||
* Resynced with Processing/Wiring IDE code (improved auto-format, faster logging
|
||||
to serial monitor console, other bug fixes)
|
||||
* New library system.
|
||||
* Updated to latest version of the RXTX serial library; Mac users will need to
|
||||
rerun macosx_setup.command.
|
||||
|
||||
0003 - 2006.01.16
|
||||
|
||||
API Changes
|
||||
* Reversed the analog input pins to correspond to newer boards. This means
|
||||
a call, for example, to analogRead(0) must be changed to analogRead(5) in
|
||||
order to read the same physical pin.
|
||||
* Added a printNewline() function (which sends '\n' = ASCII 10).
|
||||
|
||||
New Stuff
|
||||
* Reference is included (features native to C not yet documented).
|
||||
* Serial monitor added (click the toolbar button to turn it on or off). Baud
|
||||
rate is controlled by the Serial Monitor Baud Rate Menu, defaults to 9600.
|
||||
Icon and implementation from Wiring.
|
||||
* Serial port menu now automatically refreshes when opened.
|
||||
* New blue color scheme and icons courtesy of Noah Shibley (colors are hardcoded
|
||||
into the source to ensure consistency with image files).
|
||||
* Keyspan and FTDI USB drivers included with Mac and Windows distributions.
|
||||
|
||||
Bug Fixes
|
||||
* millis() now updates every millisecond instead of every second.
|
||||
* Bootloader included with Windows distribution (it was already in the Mac
|
||||
dist).
|
||||
* Updated icon of the Windows executable.
|
||||
* Now flushing the serial port before uploading (should fix some errors).
|
||||
* Improved accuracy of the delayMicroseconds() function.
|
||||
|
||||
Other
|
||||
* Upload rate no longer selectable from a menu within the IDE. Instead, edit
|
||||
the serial.download_rate item in the preferences.txt file.
|
||||
* Created Xcode project for building Arduino on the Mac (doesn't yet regenerate
|
||||
the grammar files or package the distribution); active target should be "App".
|
||||
* Removed unused or unimplemented items from menus.
|
||||
|
||||
0002 - 2005.10.05
|
||||
|
||||
* New build process no longer uses makefiles; now controlled by preferences.txt.
|
||||
* core/ replaced with targets/; can now link against Wiring libraries.
|
||||
* Replaced print() with printString, printInteger, printHex, printByte, etc.
|
||||
* Added menu for selecting serial port speed.
|
||||
* Updated icon.
|
||||
* Bootloader shrunk to less than 1 KB; fuses updated accordingly.
|
||||
* Added serialRead(), serialAvailable(), and delayMicroseconds().
|
||||
|
||||
0001 - 2005.08.25
|
||||
|
||||
* This is the first released of the unified IDE + language library
|
||||
it's a terrible hack... but it works. at the moment it's in alpha stage
|
||||
but it can be used to work.
|
||||
* The processing preprocessor is included but not used.
|
||||
|
Reference in New Issue
Block a user