add arduino-0018-linux (32 bit)
This commit is contained in:
parent
7fa52a235a
commit
297de2a227
425 changed files with 64818 additions and 0 deletions
11
arduino-0018-linux/tools/Mangler/make.sh
Executable file
11
arduino-0018-linux/tools/Mangler/make.sh
Executable file
|
@ -0,0 +1,11 @@
|
|||
#!/bin/sh
|
||||
|
||||
# The pde.jar file may be buried inside the .app file on Mac OS X.
|
||||
PDE=`find ../.. -name pde.jar`
|
||||
|
||||
javac -target 1.5 \
|
||||
-cp "../../lib/core.jar:$PDE" \
|
||||
-d bin \
|
||||
src/Mangler.java
|
||||
|
||||
cd bin && zip -r ../tool/mangler.jar * && cd ..
|
94
arduino-0018-linux/tools/Mangler/src/Mangler.java
Normal file
94
arduino-0018-linux/tools/Mangler/src/Mangler.java
Normal file
|
@ -0,0 +1,94 @@
|
|||
/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
|
||||
|
||||
/*
|
||||
Part of the Processing project - http://processing.org
|
||||
|
||||
Copyright (c) 2008 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
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
package com.transformers.supermangletron;
|
||||
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
import processing.app.Editor;
|
||||
import processing.app.tools.Tool;
|
||||
|
||||
|
||||
/**
|
||||
* Example Tools menu entry.
|
||||
*/
|
||||
public class Mangler implements Tool {
|
||||
Editor editor;
|
||||
|
||||
|
||||
public void init(Editor editor) {
|
||||
this.editor = editor;
|
||||
}
|
||||
|
||||
|
||||
public String getMenuTitle() {
|
||||
return "Mangle Selection";
|
||||
}
|
||||
|
||||
|
||||
public void run() {
|
||||
String sketchName = editor.getSketch().getName();
|
||||
|
||||
Object[] options = { "Yes, please", "No, thanks" };
|
||||
int result = JOptionPane.showOptionDialog(editor,
|
||||
"Is " + sketchName +
|
||||
" ready for destruction?",
|
||||
"Super Mangle Tron",
|
||||
JOptionPane.YES_NO_OPTION,
|
||||
JOptionPane.QUESTION_MESSAGE,
|
||||
null,
|
||||
options,
|
||||
options[1]);
|
||||
if (result == JOptionPane.YES_OPTION) {
|
||||
mangleSelection();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected void mangleSelection() {
|
||||
if (editor.isSelectionActive()) {
|
||||
String selection = editor.getSelectedText();
|
||||
char[] stuff = selection.toCharArray();
|
||||
// Randomly swap a bunch of characters in the text
|
||||
for (int i = 0; i < stuff.length / 10; i++) {
|
||||
int a = (int) (Math.random() * stuff.length);
|
||||
int b = (int) (Math.random() * stuff.length);
|
||||
if (stuff[a] == '\n' || stuff[b] == '\n') {
|
||||
continue; // skip newline characters
|
||||
}
|
||||
stuff[a] = selection.charAt(b);
|
||||
stuff[b] = selection.charAt(a);
|
||||
}
|
||||
editor.startCompoundEdit();
|
||||
editor.setSelectedText(new String(stuff));
|
||||
editor.stopCompoundEdit();
|
||||
editor.statusNotice("Now that feels better, doesn't it?");
|
||||
|
||||
} else {
|
||||
editor.statusError("No selection, no dice.");
|
||||
}
|
||||
}
|
||||
}
|
143
arduino-0018-linux/tools/howto.txt
Normal file
143
arduino-0018-linux/tools/howto.txt
Normal file
|
@ -0,0 +1,143 @@
|
|||
TOOLS IN PROCESSING
|
||||
|
||||
With initial help from code contributed by fjen, Processing release 0147 and
|
||||
later have a dynamically loading tools menu, which can be used to expand the
|
||||
environment in fun and fantastic ways.
|
||||
|
||||
A Tool is a chunk of code that runs from the Tools menu. Tools are a means
|
||||
of building onto the Processing Development Environment without needing to
|
||||
rebuild the beast from source.
|
||||
|
||||
The interface (at least for now) is extremely simple:
|
||||
|
||||
|
||||
package processing.app.tools.Tool;
|
||||
|
||||
public interface Tool extends Runnable {
|
||||
|
||||
public void init(Editor editor);
|
||||
|
||||
public void run();
|
||||
|
||||
public String getMenuTitle();
|
||||
}
|
||||
|
||||
|
||||
The init() method is called when an Editor window first opens. This means
|
||||
you won't have access to a sketch object, or a GUI, and should only do minimal
|
||||
setup. (However it'd be a good idea to stash the "Editor" object for later.)
|
||||
|
||||
The run() method will be called by the main application when the tool is
|
||||
selected from the menu. This is called using invokeLater(), so that the tool
|
||||
can safely use Swing and any other GUI yackety yack. If you're using a Frame,
|
||||
you'll need to detect whether the Frame is already open (and bring it to the
|
||||
front) or whether to create a new window.
|
||||
|
||||
Faceless tools also use the run() method. You should avail yourselves of the
|
||||
statusNotice() and statusError() methods in Editor, to let the user know what's
|
||||
happened. (As per p. 107 of the Processing Development Environment Tools
|
||||
Reference User Interface Guide.)
|
||||
|
||||
The getMenuTitle() method just returns the title for what should appear in the
|
||||
Tools menu. Not doing shortcuts for now, because resolving them between tools
|
||||
(and the rest of the interface) is fugly. We would also need additional
|
||||
modifiers for shift and alt. It just gets messy quick. Ordering in the Tools
|
||||
menu is alphabetical.
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
Where to put Tools
|
||||
|
||||
Core tools live inside the "tools" subfolder of the Processing distribution,
|
||||
however users should install "contributed" tools in their sketchbook folder,
|
||||
inside a subfolder named "tools".
|
||||
|
||||
If a tool works only with a particular release of Processing, then it may make
|
||||
sense for the user to put things into the Processing tools folder, however we'd
|
||||
like to keep users out of there as much as possible. In fact, it may not be
|
||||
visible in future releases of Processing (for instance, on Mac OS X, the tools
|
||||
folder is hidden inside the .app bundle).
|
||||
|
||||
Tools should be laid out similar to libraries, though the structure is a little
|
||||
more flexible. The tool folder should be the name of the main class (without
|
||||
its package name but using the same capitalization), and have a subfolder named
|
||||
"tool" that contains the .jar and .zip files it uses. I'll use the included
|
||||
"Mangler" tool as an example.
|
||||
|
||||
(This Tool is not built by default, due to a lack of non-dubious arguments
|
||||
regarding the usefulness of including (by default) a Tool that mangles code.)
|
||||
|
||||
The folder should be called Mangler (note the capitalization), and contain:
|
||||
|
||||
sketchbook/Mangler -> tool folder
|
||||
sketchbook/Mangler/tool -> location for code
|
||||
sketchbook/Mangler/tool/mangle.jar -> jar with one or more classes
|
||||
|
||||
The naming of jar and zip files in the tool/* directory doesn't matter.
|
||||
|
||||
When Processing loads, the jar and zip files will be searched for
|
||||
Mangler.class. Even though this tool is found in package poos.shoe,
|
||||
it will be sussed out. Package names are required.
|
||||
|
||||
Loose .class files are not supported, use only jar and zip files.
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
What You Can and Cannot Do
|
||||
|
||||
The only API methods that are officially scrubbed and sanctioned by the
|
||||
Commissioner on Fair API and Proper Manners for use by the Tools classes
|
||||
are found in:
|
||||
|
||||
processing.app.Base
|
||||
processing.app.Editor
|
||||
processing.app.Preferences
|
||||
processing.app.Sketch
|
||||
processing.app.SketchCode
|
||||
|
||||
In fact, most of the API you should be talking to is inside Editor.
|
||||
Full API documentation can be found on dev.processing.org:
|
||||
http://dev.processing.org/reference/everything/
|
||||
(Keep in mind that this is not always perfectly up to date, but we'll try.)
|
||||
|
||||
Of course, you're welcome to go spelunking through the rest of the API
|
||||
(that's where all the fun stuff is anyway), but don't be upset when something
|
||||
changes and breaks your tool and makes your users sad.
|
||||
|
||||
Currently, native code is not supported with tools. This might be possible,
|
||||
but it's another potentially messy thing to dynamically add native library
|
||||
paths to running code. (See "Future Releases" below.)
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
Future Releases
|
||||
|
||||
In future releases, we are considering the following features:
|
||||
|
||||
1. How shortcut keys are handled.
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=140
|
||||
|
||||
2. Whether to allow tools to dock into the Preferences panel.
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=883
|
||||
|
||||
3. A means to run native code from the Tools menu.
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=884
|
||||
|
||||
4. Methods for reorganizing the Tools menu, or placing contributed
|
||||
Tools inside other menus (such as Edit or Sketch).
|
||||
http://dev.processing.org/bugs/show_bug.cgi?id=885
|
||||
|
||||
This is the first round of documentation for the Tools menu, we reserve the
|
||||
right to update, clarify, and change our mind in future releases.
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
Ben Fry, last updated 19 August 2008
|
Reference in a new issue