mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
clean up random tidbits of api
This commit is contained in:
@@ -47,7 +47,7 @@ import processing.core.*;
|
||||
* files and images, etc) that comes from that.
|
||||
*/
|
||||
public class PdeBase {
|
||||
static final String VERSION = "0081 Alpha";
|
||||
static final String VERSION = "0082 Alpha";
|
||||
|
||||
/**
|
||||
* Path of filename opened on the command line,
|
||||
@@ -62,7 +62,7 @@ public class PdeBase {
|
||||
|
||||
// make sure that this is running on java 1.4
|
||||
|
||||
if (PApplet.JDK_VERSION < 1.4) {
|
||||
if (PApplet.javaVersion < 1.4) {
|
||||
//System.err.println("no way man");
|
||||
PdeBase.showError("Need to install Java 1.4",
|
||||
"This version of Processing requires \n" +
|
||||
|
||||
@@ -146,8 +146,6 @@ public class PdeEditor extends JFrame
|
||||
});
|
||||
|
||||
PdeKeywords keywords = new PdeKeywords();
|
||||
// TODO re-enable history
|
||||
//history = new PdeHistory(this);
|
||||
sketchbook = new PdeSketchbook(this);
|
||||
|
||||
JMenuBar menubar = new JMenuBar();
|
||||
@@ -155,8 +153,7 @@ public class PdeEditor extends JFrame
|
||||
menubar.add(buildEditMenu());
|
||||
menubar.add(buildSketchMenu());
|
||||
menubar.add(buildToolsMenu());
|
||||
// what platform has their help menu way on the right?
|
||||
//if ((PdeBase.platform == PdeBase.WINDOWS) ||
|
||||
// what platform has their help menu way on the right? motif?
|
||||
//menubar.add(Box.createHorizontalGlue());
|
||||
menubar.add(buildHelpMenu());
|
||||
|
||||
@@ -169,37 +166,21 @@ public class PdeEditor extends JFrame
|
||||
pain.setLayout(new BorderLayout());
|
||||
|
||||
Box box = Box.createVerticalBox();
|
||||
|
||||
Box upper = Box.createVerticalBox();
|
||||
//JPanel box = new JPanel();
|
||||
//box.setLayout(new FlowLayout(FlowLayout.VERTICAL));
|
||||
|
||||
buttons = new PdeEditorButtons(this);
|
||||
//pain.add("West", buttons);
|
||||
//box.add(buttons);
|
||||
upper.add(buttons);
|
||||
|
||||
//JPanel rightPanel = new JPanel();
|
||||
//rightPanel.setLayout(new BorderLayout());
|
||||
|
||||
header = new PdeEditorHeader(this);
|
||||
//rightPanel.add(header, BorderLayout.NORTH);
|
||||
//box.add(header);
|
||||
upper.add(header);
|
||||
|
||||
textarea = new JEditTextArea(new PdeTextAreaDefaults());
|
||||
textarea.setRightClickPopup(new TextAreaPopup());
|
||||
textarea.setTokenMarker(new PdeKeywords());
|
||||
|
||||
textarea.setHorizontalOffset(6);
|
||||
//textarea.setBorder(new EmptyBorder(0, 20, 0, 0));
|
||||
//textarea.setBackground(Color.white);
|
||||
|
||||
//textarea.setMaximumSize(new Dimension(3000, 3000));
|
||||
|
||||
// assemble console panel, consisting of status area and the console itself
|
||||
consolePanel = new JPanel();
|
||||
//System.out.println(consolePanel.getInsets());
|
||||
consolePanel.setLayout(new BorderLayout());
|
||||
|
||||
status = new PdeEditorStatus(this);
|
||||
@@ -208,16 +189,8 @@ public class PdeEditor extends JFrame
|
||||
console = new PdeEditorConsole(this);
|
||||
consolePanel.add(console, BorderLayout.CENTER);
|
||||
|
||||
/*
|
||||
lineNumberComponent = new JLabel(" 1234"); //, JLabel.LEFT);
|
||||
lineNumberComponent.setBackground(Color.BLACK);
|
||||
lineNumberComponent.setForeground(Color.WHITE);
|
||||
lineNumberComponent.setFont(new Font("SansSerif", Font.PLAIN, 10));
|
||||
box.add(lineNumberComponent);
|
||||
*/
|
||||
lineStatus = new PdeEditorLineStatus(textarea);
|
||||
consolePanel.add(lineStatus, BorderLayout.SOUTH);
|
||||
//box.add(lineStatus);
|
||||
|
||||
upper.add(textarea);
|
||||
splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT,
|
||||
@@ -244,104 +217,16 @@ public class PdeEditor extends JFrame
|
||||
}
|
||||
|
||||
splitPane.setMinimumSize(new Dimension(600, 600));
|
||||
//splitPane.setBackground(Color.RED);
|
||||
//splitPane.setMaximumSize(new Dimension(3000, 3000));
|
||||
///rightPanel.add(splitPane, BorderLayout.CENTER);
|
||||
box.add(splitPane);
|
||||
|
||||
//setBackground(Color.green);
|
||||
//box.add(textarea);
|
||||
//box.add(consolePanel);
|
||||
|
||||
//pain.add("Center", rightPanel);
|
||||
|
||||
// hopefully these are no longer needed w/ swing
|
||||
// (har har har.. that was wishful thinking)
|
||||
listener = new PdeEditorListener(this, textarea);
|
||||
//textarea.editorListener = listener;
|
||||
|
||||
//pain.add("West", box);
|
||||
pain.add(box);
|
||||
|
||||
// set the undo stuff for this feller
|
||||
Document document = textarea.getDocument();
|
||||
document.addUndoableEditListener(new PdeUndoableEditListener());
|
||||
|
||||
/*
|
||||
Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
|
||||
if (PdeBase.isMacOS()) {
|
||||
presentationWindow = new Frame();
|
||||
|
||||
// mrj is still (with version 2.2.x) a piece of shit,
|
||||
// and doesn't return valid insets for frames
|
||||
//presentationWindow.pack(); // make a peer so insets are valid
|
||||
//Insets insets = presentationWindow.getInsets();
|
||||
// the extra +20 is because the resize boxes intrude
|
||||
Insets insets = new Insets(21, 5, 5 + 20, 5);
|
||||
|
||||
presentationWindow.setBounds(-insets.left, -insets.top,
|
||||
screen.width + insets.left + insets.right,
|
||||
screen.height + insets.top + insets.bottom);
|
||||
} else {
|
||||
presentationWindow = new Frame();
|
||||
((Frame)presentationWindow).setUndecorated(true);
|
||||
presentationWindow.setBounds(0, 0, screen.width, screen.height);
|
||||
}
|
||||
|
||||
Label label = new Label("stop");
|
||||
label.addMouseListener(new MouseAdapter() {
|
||||
public void mousePressed(MouseEvent e) {
|
||||
setVisible(true);
|
||||
doClose();
|
||||
}});
|
||||
|
||||
Dimension labelSize = new Dimension(60, 20);
|
||||
presentationWindow.setLayout(null);
|
||||
presentationWindow.add(label);
|
||||
label.setBounds(5, screen.height - 5 - labelSize.height,
|
||||
labelSize.width, labelSize.height);
|
||||
|
||||
Color presentationBgColor =
|
||||
PdePreferences.getColor("run.present.bgcolor");
|
||||
presentationWindow.setBackground(presentationBgColor);
|
||||
|
||||
textarea.addFocusListener(new FocusAdapter() {
|
||||
public void focusGained(FocusEvent e) {
|
||||
if (presenting == true) {
|
||||
try {
|
||||
presentationWindow.toFront();
|
||||
runtime.applet.requestFocus();
|
||||
} catch (Exception ex) { }
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
this.addFocusListener(new FocusAdapter() {
|
||||
public void focusGained(FocusEvent e) {
|
||||
if (presenting == true) {
|
||||
try {
|
||||
presentationWindow.toFront();
|
||||
runtime.applet.requestFocus();
|
||||
} catch (Exception ex) { }
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// moved from the PdeRuntime window to the main presentation window
|
||||
// [toxi 030903]
|
||||
presentationWindow.addKeyListener(new KeyAdapter() {
|
||||
public void keyPressed(KeyEvent e) {
|
||||
//System.out.println("window got " + e);
|
||||
if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
|
||||
runtime.stop();
|
||||
doClose();
|
||||
} else {
|
||||
// pass on the event to the applet [toxi 030903]
|
||||
runtime.applet.keyPressed(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
@@ -349,7 +234,8 @@ public class PdeEditor extends JFrame
|
||||
* Hack for #@#)$(* Mac OS X.
|
||||
*/
|
||||
public Dimension getMinimumSize() {
|
||||
return new Dimension(500, 500);
|
||||
System.out.println("getting minimum size");
|
||||
return new Dimension(500, 550);
|
||||
}
|
||||
|
||||
|
||||
@@ -547,28 +433,6 @@ public class PdeEditor extends JFrame
|
||||
});
|
||||
menu.add(item);
|
||||
}
|
||||
|
||||
/*
|
||||
item = newJMenuItem("New code", 'N', true);
|
||||
item.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
handleNewCode();
|
||||
}
|
||||
});
|
||||
menu.add(item);
|
||||
*/
|
||||
|
||||
/*
|
||||
item = newJMenuItem("Open", 'O');
|
||||
item.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
handleOpen(null);
|
||||
}
|
||||
});
|
||||
menu.add(item);
|
||||
menu.add(sketchbook.rebuildMenu());
|
||||
menu.add(sketchbook.getExamplesMenu());
|
||||
*/
|
||||
menu.add(sketchbook.getOpenMenu());
|
||||
|
||||
saveMenuItem = newJMenuItem("Save", 'S');
|
||||
@@ -667,47 +531,8 @@ public class PdeEditor extends JFrame
|
||||
});
|
||||
menu.add(item);
|
||||
|
||||
/*
|
||||
JMenu rendererMenu = new JMenu("Renderer");
|
||||
menu.add(rendererMenu);
|
||||
|
||||
coreRendererItem = new JRadioButtonMenuItem("Processing");
|
||||
rendererMenu.add(coreRendererItem);
|
||||
coreRendererItem.addItemListener(new ItemListener() {
|
||||
public void itemStateChanged(ItemEvent e) {
|
||||
//System.out.println("setting renderer");
|
||||
//openglRendererItem.setState(false);
|
||||
//coreRendererItem.setState(true);
|
||||
PdePreferences.set("renderer", "core");
|
||||
}
|
||||
});
|
||||
|
||||
openglRendererItem = new JRadioButtonMenuItem("OpenGL");
|
||||
rendererMenu.add(openglRendererItem);
|
||||
openglRendererItem.addItemListener(new ItemListener() {
|
||||
public void itemStateChanged(ItemEvent e) {
|
||||
//System.out.println("setting renderer");
|
||||
//openglRendererItem.setState(true);
|
||||
//coreRendererItem.setState(false);
|
||||
PdePreferences.set("renderer", "opengl");
|
||||
}
|
||||
});
|
||||
|
||||
ButtonGroup rendererGroup = new ButtonGroup();
|
||||
rendererGroup.add(coreRendererItem);
|
||||
rendererGroup.add(openglRendererItem);
|
||||
|
||||
boolean useOpenGL = PdePreferences.get("renderer").equals("opengl");
|
||||
coreRendererItem.setSelected(!useOpenGL);
|
||||
openglRendererItem.setSelected(useOpenGL);
|
||||
*/
|
||||
|
||||
//
|
||||
|
||||
menu.addSeparator();
|
||||
|
||||
//
|
||||
|
||||
item = new JMenuItem("Add File...");
|
||||
item.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
@@ -760,7 +585,6 @@ public class PdeEditor extends JFrame
|
||||
item = new JMenuItem("Archive Sketch");
|
||||
item.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
//new PdeFontBuilder().show(sketch.dataFolder);
|
||||
Archiver archiver = new Archiver();
|
||||
archiver.setup(PdeEditor.this);
|
||||
archiver.show();
|
||||
@@ -1021,7 +845,6 @@ public class PdeEditor extends JFrame
|
||||
// so used internally for everything else
|
||||
|
||||
public void handleAbout() {
|
||||
//System.out.println("the about box will now be shown");
|
||||
final Image image = PdeBase.getImage("about.jpg", this);
|
||||
int w = image.getWidth(this);
|
||||
int h = image.getHeight(this);
|
||||
@@ -1029,12 +852,9 @@ public class PdeEditor extends JFrame
|
||||
public void paint(Graphics g) {
|
||||
g.drawImage(image, 0, 0, null);
|
||||
|
||||
/*
|
||||
// does nothing..
|
||||
Graphics2D g2 = (Graphics2D) g;
|
||||
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
|
||||
RenderingHints.VALUE_ANTIALIAS_OFF);
|
||||
*/
|
||||
g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
|
||||
RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);
|
||||
|
||||
g.setFont(new Font("SansSerif", Font.PLAIN, 11));
|
||||
g.setColor(Color.white);
|
||||
|
||||
@@ -32,6 +32,8 @@ public class PdeEditorLineStatus extends JComponent {
|
||||
JEditTextArea textarea;
|
||||
int start = -1, stop;
|
||||
|
||||
Image resize;
|
||||
|
||||
Color foreground;
|
||||
Color background;
|
||||
Font font;
|
||||
@@ -49,6 +51,9 @@ public class PdeEditorLineStatus extends JComponent {
|
||||
foreground = PdePreferences.getColor("linestatus.color");
|
||||
high = PdePreferences.getInteger("linestatus.height");
|
||||
|
||||
if (PdeBase.isMacOS()) {
|
||||
resize = PdeBase.getImage("resize.gif", this);
|
||||
}
|
||||
//linestatus.bgcolor = #000000
|
||||
//linestatus.font = SansSerif,plain,10
|
||||
//linestatus.color = #FFFFFF
|
||||
@@ -87,6 +92,10 @@ public class PdeEditorLineStatus extends JComponent {
|
||||
g.setColor(foreground);
|
||||
int baseline = (high + g.getFontMetrics().getAscent()) / 2;
|
||||
g.drawString(text, 6, baseline);
|
||||
|
||||
if (PdeBase.isMacOS()) {
|
||||
g.drawImage(resize, size.width - 20, 0, this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -274,13 +274,26 @@ serial.. this release uses rxtx-2.1_6 (just like macosx). if you're
|
||||
having trouble getting things to run, i.e. the port menu stays grayed
|
||||
out or you get error message spew to the console when starting the
|
||||
application saying "Permission denied" and "No permission to create
|
||||
lock file" and to read "INSTALL". this is because you need to add
|
||||
yourself to either the uucp or lock group so that processing can write
|
||||
to /var/lock so it doesn't get in a fight with other applications
|
||||
talking on the serial port. supposedly, adding yourself to one of
|
||||
these groups will work (didn't for me, but i'm a little clueless)
|
||||
or running processing as root will often get rid of the errors
|
||||
(obviously not a great solution).
|
||||
lock file" and to read "INSTALL". this is because you probably need
|
||||
to add yourself to both the uucp or lock groups so that processing
|
||||
can write to /var/lock so it doesn't get in a fight with other
|
||||
applications talking on the serial port.
|
||||
|
||||
alan kilian contributes this description:
|
||||
|
||||
1. I did an ls -l /dev/ttyS0 and saw that the group was set to uucp.
|
||||
2. Then I edited /etc/groups, I found the uucp group, and I added my
|
||||
login ID to the uucp line.
|
||||
3. I logged out, and logged back in again.
|
||||
4. The "groups" command now showed I was in group uucp, and when I
|
||||
started processing, the serial port menu item was not greyed-out.
|
||||
|
||||
it's important that you're in both groups, and that you completely
|
||||
log out and log back in again.
|
||||
|
||||
running processing as root will often get rid of the errors, but
|
||||
that's obviously not a good solution for a million reasons (among
|
||||
them: alpha code that runs as root and handles files? yeah great...)
|
||||
|
||||
|
||||
. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
||||
|
||||
@@ -44,15 +44,17 @@ public class PApplet extends Applet
|
||||
/**
|
||||
* "1.3" or "1.1" or whatever (just the first three chars)
|
||||
*/
|
||||
public static final String JDK_VERSION_STRING =
|
||||
public static final String javaVersionName =
|
||||
System.getProperty("java.version").substring(0,3);
|
||||
|
||||
/**
|
||||
* Version of Java that's in use, whether 1.1 or 1.3 or whatever,
|
||||
* stored as a double.
|
||||
*/
|
||||
public static final double JDK_VERSION =
|
||||
new Double(JDK_VERSION_STRING).doubleValue();
|
||||
//public static final double javaVersion =
|
||||
//new Double(jdkVersionName).doubleValue();
|
||||
public static final float javaVersion =
|
||||
new Float(javaVersionName).floatValue();
|
||||
|
||||
|
||||
/**
|
||||
@@ -61,12 +63,20 @@ public class PApplet extends Applet
|
||||
*/
|
||||
static public int platform;
|
||||
|
||||
/**
|
||||
* Current platform in use.
|
||||
* <P>
|
||||
* Equivalent to System.getProperty("os.name"), just used internally.
|
||||
*/
|
||||
static public String platformName =
|
||||
System.getProperty("os.name");
|
||||
|
||||
static {
|
||||
// figure out which operating system
|
||||
// this has to be first, since editor needs to know
|
||||
|
||||
if (System.getProperty("mrj.version") != null) { // running on a mac
|
||||
platform = (System.getProperty("os.name").equals("Mac OS X")) ?
|
||||
platform = (platformName.equals("Mac OS X")) ?
|
||||
MACOSX : MACOS9;
|
||||
|
||||
} else {
|
||||
@@ -78,22 +88,27 @@ public class PApplet extends Applet
|
||||
} else if (osname.equals("Linux")) { // true for the ibm vm
|
||||
platform = LINUX;
|
||||
|
||||
//} else if (osname.equals("Irix")) {
|
||||
//platform = IRIX;
|
||||
|
||||
} else {
|
||||
platform = OTHER;
|
||||
//System.out.println("unhandled osname: \"" + osname + "\"");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** The PGraphics renderer associated with this PApplet */
|
||||
public PGraphics g;
|
||||
|
||||
protected Object glock = new Object(); // for sync
|
||||
|
||||
/** The frame containing this applet (if any) */
|
||||
public Frame frame;
|
||||
|
||||
/**
|
||||
* Message of the Exception thrown when size() is called the first time.
|
||||
* <P>
|
||||
* This is used internally so that setup() is forced to run twice
|
||||
* when the renderer is changed. Reason being that the
|
||||
*/
|
||||
static final String NEW_RENDERER = "new renderer";
|
||||
|
||||
/**
|
||||
@@ -102,13 +117,24 @@ public class PApplet extends Applet
|
||||
* Access this via screen.width and screen.height. To make an applet
|
||||
* run at full screen, use size(screen.width, screen.height).
|
||||
* <P>
|
||||
* This won't update if you change the resolution of your screen
|
||||
* once the the applet is running.
|
||||
* If you have multiple displays, this will be the size of the main
|
||||
* display. Running full screen across multiple displays isn't
|
||||
* particularly supported, and requires more monkeying with the values.
|
||||
* This probably can't/won't be fixed until/unless I get a dual head
|
||||
* system.
|
||||
* <P>
|
||||
* Note that this won't update if you change the resolution
|
||||
* of your screen once the the applet is running.
|
||||
*/
|
||||
static public Dimension screen =
|
||||
public Dimension screen =
|
||||
Toolkit.getDefaultToolkit().getScreenSize();
|
||||
|
||||
//protected PMethods recorder;
|
||||
//DisplayMode dm = device.getDisplayMode();
|
||||
//if ((dm.getWidth() == 1024) && (dm.getHeight() == 768)) {
|
||||
|
||||
/**
|
||||
* A leech graphics object that is echoing all events.
|
||||
*/
|
||||
public PGraphics recorder;
|
||||
|
||||
/**
|
||||
@@ -127,9 +153,6 @@ public class PApplet extends Applet
|
||||
static public final int DEFAULT_WIDTH = 100;
|
||||
static public final int DEFAULT_HEIGHT = 100;
|
||||
|
||||
//protected int INITIAL_WIDTH = DEFAULT_WIDTH;
|
||||
//protected int INITIAL_HEIGHT = DEFAULT_HEIGHT;
|
||||
|
||||
/**
|
||||
* Pixel buffer from this applet's PGraphics.
|
||||
* <P>
|
||||
@@ -343,12 +366,9 @@ public class PApplet extends Applet
|
||||
|
||||
|
||||
public void init() {
|
||||
|
||||
//initGraphics();
|
||||
|
||||
// send tab keys through to the PApplet
|
||||
try {
|
||||
if (JDK_VERSION >= 1.4) {
|
||||
if (javaVersion >= 1.4) {
|
||||
//setFocusTraversalKeysEnabled(false); // 1.4-only function
|
||||
Method defocus =
|
||||
Component.class.getMethod("setFocusTraversalKeysEnabled",
|
||||
@@ -392,58 +412,6 @@ public class PApplet extends Applet
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
// override for subclasses (i.e. opengl)
|
||||
// so that init() doesn't have to be replicated
|
||||
public void initGraphics() {
|
||||
// 0073: moved here so that can be overridden for PAppletGL
|
||||
addMouseListener(this);
|
||||
addMouseMotionListener(this);
|
||||
addKeyListener(this);
|
||||
addFocusListener(this);
|
||||
}
|
||||
|
||||
|
||||
public void createGraphics() {
|
||||
Dimension size = getSize();
|
||||
|
||||
if (PApplet.JDK_VERSION >= 1.3) {
|
||||
g = new PGraphics2(INITIAL_WIDTH, INITIAL_HEIGHT);
|
||||
//g = new PGraphics2(size.width, size.height);
|
||||
//DEFAULT_WIDTH, DEFAULT_HEIGHT);
|
||||
} else {
|
||||
g = new PGraphics(INITIAL_WIDTH, INITIAL_HEIGHT);
|
||||
//g = new PGraphics(size.width, size.height);
|
||||
//g = new PGraphics(DEFAULT_WIDTH, DEFAULT_HEIGHT);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void depth() {
|
||||
if (g.textFont != null) {
|
||||
die("textFont() cannot be used before calling depth()");
|
||||
}
|
||||
|
||||
// OPT if PGraphics already exists, pass in its pixels[]
|
||||
// buffer so as not to re-allocate all that memory again
|
||||
if (g.width != 0) {
|
||||
g = new PGraphics3(g.width, g.height);
|
||||
|
||||
} else {
|
||||
Dimension size = getSize();
|
||||
g = new PGraphics3(size.width, size.height);
|
||||
}
|
||||
// re-call the beginframe with the new graphics
|
||||
g.beginFrame();
|
||||
|
||||
// it's ok to call this, because depth() is only getting called
|
||||
// at least inside of setup, so things can be drawn just
|
||||
// fine since it's post-beginFrame.
|
||||
g.defaults();
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Called via the first call to PApplet.paint(),
|
||||
* because PAppletGL needs to have a usable screen
|
||||
@@ -655,6 +623,9 @@ public class PApplet extends Applet
|
||||
/**
|
||||
* Starts up and creates a two-dimensional drawing surface.
|
||||
* <P>
|
||||
* To ensure no strangeness, this should be the first thing
|
||||
* called inside of setup().
|
||||
* <P>
|
||||
* If using Java 1.3 or later, this will default to using
|
||||
* PGraphics2, the Java2D-based renderer. If using Java 1.1,
|
||||
* or if PGraphics2 is not available, then PGraphics will be used.
|
||||
@@ -670,7 +641,7 @@ public class PApplet extends Applet
|
||||
size(iwidth, iheight, g.getClass().getName());
|
||||
|
||||
} else {
|
||||
if (PApplet.JDK_VERSION >= 1.3) {
|
||||
if (PApplet.javaVersion >= 1.3) {
|
||||
try {
|
||||
Class c = Class.forName(JAVA2D);
|
||||
size(iwidth, iheight, JAVA2D);
|
||||
@@ -1731,9 +1702,9 @@ public class PApplet extends Applet
|
||||
*/
|
||||
public void cursor(PImage image, int hotspotX, int hotspotY) {
|
||||
//if (!isOneTwoOrBetter()) {
|
||||
if (JDK_VERSION < 1.2) {
|
||||
if (javaVersion < 1.2) {
|
||||
System.err.println("Java 1.2 or higher is required to use cursor()");
|
||||
System.err.println("(You're using version " + JDK_VERSION_STRING + ")");
|
||||
System.err.println("(You're using version " + javaVersionName + ")");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1762,7 +1733,7 @@ public class PApplet extends Applet
|
||||
|
||||
} catch (NoSuchMethodError e) {
|
||||
System.err.println("cursor() is not available on " +
|
||||
nf((float)JDK_VERSION, 1, 1));
|
||||
nf(javaVersion, 1, 1));
|
||||
} catch (IndexOutOfBoundsException e) {
|
||||
System.err.println("cursor() error: the hotspot " + hotspot +
|
||||
" is out of bounds for the given image.");
|
||||
@@ -2319,7 +2290,7 @@ public class PApplet extends Applet
|
||||
|
||||
|
||||
public PSound loadSound(String filename) {
|
||||
if (PApplet.JDK_VERSION >= 1.3) {
|
||||
if (PApplet.javaVersion >= 1.3) {
|
||||
return new PSound2(this, openStream(filename));
|
||||
}
|
||||
return new PSound(this, openStream(filename));
|
||||
@@ -4728,6 +4699,9 @@ v PApplet.this.stop();
|
||||
frame = new Frame();
|
||||
}
|
||||
|
||||
Dimension screen =
|
||||
Toolkit.getDefaultToolkit().getScreenSize();
|
||||
|
||||
frame.setResizable(false); // remove the grow box
|
||||
//frame.pack(); // get insets. get more.
|
||||
Class c = Class.forName(name);
|
||||
@@ -4751,19 +4725,11 @@ v PApplet.this.stop();
|
||||
|
||||
if (present) {
|
||||
frame.setUndecorated(true);
|
||||
//frame.setResizable(false);
|
||||
|
||||
//DisplayMode dm = device.getDisplayMode();
|
||||
//if ((dm.getWidth() == 1024) && (dm.getHeight() == 768)) {
|
||||
|
||||
//if (presentColor != null) {
|
||||
frame.setBackground(presentColor);
|
||||
//}
|
||||
displayDevice.setFullScreenWindow(frame);
|
||||
|
||||
frame.add(applet);
|
||||
Dimension fullscreen = frame.getSize();
|
||||
//System.out.println("screen size is " + screen);
|
||||
applet.setBounds((fullscreen.width - applet.width) / 2,
|
||||
(fullscreen.height - applet.height) / 2,
|
||||
applet.width, applet.height);
|
||||
@@ -4778,8 +4744,9 @@ v PApplet.this.stop();
|
||||
});
|
||||
frame.add(label);
|
||||
Dimension labelSize = label.getPreferredSize();
|
||||
// sometimes shows up truncated on mac
|
||||
labelSize = new Dimension(labelSize.width * 2, labelSize.height);
|
||||
label.setSize(labelSize);
|
||||
//label.setLocation(20, 40);
|
||||
label.setLocation(20, fullscreen.height - labelSize.height - 20);
|
||||
applet.setupExternal(frame);
|
||||
}
|
||||
|
||||
@@ -726,7 +726,7 @@ public class PFont implements PConstants {
|
||||
* @param smooth true to enable smoothing/anti-aliasing
|
||||
*/
|
||||
public PFont(Font font, boolean all, boolean smooth) {
|
||||
if (PApplet.JDK_VERSION < 1.3) {
|
||||
if (PApplet.javaVersion < 1.3) {
|
||||
throw new RuntimeException("Can only create fonts with " +
|
||||
"Java 1.3 or higher");
|
||||
}
|
||||
|
||||
+10
-37
@@ -4,7 +4,7 @@
|
||||
PSound - java 1.1 audio loader and player
|
||||
Part of the Processing project - http://processing.org
|
||||
|
||||
Copyright (c) 2004 Ben Fry and Casey Reas
|
||||
Copyright (c) 2004-05 Ben Fry and Casey Reas
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
@@ -28,13 +28,12 @@ import java.io.*;
|
||||
import java.lang.reflect.*;
|
||||
import sun.audio.*;
|
||||
|
||||
// add check for reflection in host applet for sound completion
|
||||
// also needs to register for stop events with applet
|
||||
|
||||
|
||||
/**
|
||||
* This is the crappy 8 khz mono ulaw version that's compatible
|
||||
* with Java 1.1 and 1.2. For Java 1.3 and higher, PSound2 is used.
|
||||
* <P>
|
||||
* This code currently does not work, but PSound2 sort of does.
|
||||
*/
|
||||
public class PSound {
|
||||
// supposedly this is actually 8012.8210513 according to spec
|
||||
@@ -58,42 +57,16 @@ public class PSound {
|
||||
public PSound(PApplet parent, InputStream input) {
|
||||
this.parent = parent;
|
||||
|
||||
/*
|
||||
parent.registerDispose(this);
|
||||
|
||||
try {
|
||||
|
||||
} catch (Exception e) {
|
||||
error("<init>", e);
|
||||
}
|
||||
*/
|
||||
|
||||
parent.registerDispose(this);
|
||||
|
||||
try {
|
||||
soundEventMethod =
|
||||
parent.getClass().getMethod("soundEvent",
|
||||
soundEventMethod =
|
||||
parent.getClass().getMethod("soundEvent",
|
||||
new Class[] { PSound.class });
|
||||
|
||||
// if we're here, then it means that there's a method for it
|
||||
/*
|
||||
clip.addLineListener(new LineListener() {
|
||||
public void update(LineEvent event) {
|
||||
if (event.getType() == LineEvent.Type.STOP) {
|
||||
try {
|
||||
soundEventMethod.invoke(parent,
|
||||
new Object[] { PSound.this });
|
||||
} catch (Exception e) {
|
||||
System.err.println("error, disabling soundEvent()");
|
||||
e.printStackTrace();
|
||||
soundEventMethod = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
*/
|
||||
|
||||
} catch (Exception e) {
|
||||
// no such method, or an error.. which is fine, just ignore
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// no such method, or an error.. which is fine, just ignore
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
PSound2 - java 1.3 audio loader and player
|
||||
Part of the Processing project - http://processing.org
|
||||
|
||||
Copyright (c) 2004 Ben Fry and Casey Reas
|
||||
Copyright (c) 2004-05 Ben Fry and Casey Reas
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
@@ -29,12 +29,18 @@ import java.lang.reflect.*;
|
||||
import javax.sound.sampled.*;
|
||||
|
||||
|
||||
// useful info about how to do all this stuff, munged together
|
||||
// for this class: http://javaalmanac.com/egs/javax.sound.sampled/pkg.html
|
||||
|
||||
/**
|
||||
* Java 1.3 audio loader and player.
|
||||
* <P>
|
||||
* This will eventually be merged back into PSound, so you shouldn't
|
||||
* create new PSound2 objects from scratch, only open them directly
|
||||
* from a PApplet using loadSound().
|
||||
* <PRE>
|
||||
* useful info about how to do all this stuff, munged together
|
||||
* for this class: http://javaalmanac.com/egs/javax.sound.sampled/pkg.html
|
||||
* </PRE>
|
||||
*/
|
||||
public class PSound2 extends PSound {
|
||||
//PApplet parent;
|
||||
|
||||
Clip clip;
|
||||
FloatControl gainControl;
|
||||
|
||||
@@ -195,29 +201,15 @@ public class PSound2 extends PSound {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the volume with a value from 0 (off) to 1 (loudest).
|
||||
*/
|
||||
public void volume(float v) { // ranges 0..1
|
||||
float dB = (float)(Math.log(v)/Math.log(10.0)*20.0);
|
||||
gainControl.setValue(dB);
|
||||
}
|
||||
|
||||
|
||||
/** mute */
|
||||
/*
|
||||
public void noVolume() {
|
||||
BooleanControl muteControl =
|
||||
(BooleanControl)clip.getControl(BooleanControl.Type.MUTE);
|
||||
muteControl.setValue(true);
|
||||
}
|
||||
*/
|
||||
|
||||
/** disable mute */
|
||||
/*
|
||||
public void volume() {
|
||||
muteControl.setValue(false);
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* General error reporting, all corraled here just in case
|
||||
* I think of something slightly more intelligent to do.
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
#C:\jdk-1.4.2_05\bin
|
||||
#/cygdrive/c/jdk-1.4.2_05/bin/javadoc -d doc processing.core *.java
|
||||
#/cygdrive/c/jdk-1.4.2_05/bin/javadoc -d doc *.java
|
||||
javadoc -public -d doc *.java
|
||||
/cygdrive/c/jdk-1.4.2_05/bin/javadoc -d doc *.java
|
||||
#javadoc -public -d doc *.java
|
||||
jikes -d . +D *.java
|
||||
#jikes -d . +D PApplet.java
|
||||
|
||||
@@ -1,8 +1,16 @@
|
||||
0082 core
|
||||
X make jdkVersion, jdkVersionName, platform, platformName variables
|
||||
X additional note about screen sizes and displays
|
||||
X sto instead of stop in present mode
|
||||
|
||||
GraphicsDevice theDevice =
|
||||
frame.getGraphicsConfiguration().getDevice();
|
||||
|
||||
_ fix the flicker in java2d mode
|
||||
X is it because the lock was taken off (g) in PApplet?
|
||||
|
||||
_ don't let users on < 1.3 load JAVA2D, or < 1.4 load OPENGL
|
||||
|
||||
_ apply tint() to textures as well
|
||||
_ otherwise no good way to color textures
|
||||
|
||||
@@ -21,6 +29,8 @@ _ needs to get the size of the main screen
|
||||
|
||||
_ make illustrator lib
|
||||
|
||||
_ move really general things out of PConstants (X, Y, Z..)
|
||||
|
||||
|
||||
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
||||
|
||||
|
||||
+24
-5
@@ -1,6 +1,18 @@
|
||||
0082 pde
|
||||
X shut off text anti-aliasing in the about box
|
||||
X implemented ryan alexander's grow box design
|
||||
|
||||
monday evening
|
||||
_ make a linux version of this release
|
||||
|
||||
_ saved window positions.. if displays has changed, becomes a problem
|
||||
_ record the display that it was on?
|
||||
_ make sure that the applet is within the bounds of the current display?
|
||||
_ (from 0, 0 to width, height)
|
||||
|
||||
_ make note that changing screen config requires restart of processing
|
||||
_ static { checkScreens(); }
|
||||
_ static void PApplet.checkScreens() { }
|
||||
_ to run explicitly later
|
||||
|
||||
_ when centering applet on-screen, needs to check for multiple screens
|
||||
_ this is both for PApplet and PdeRuntime
|
||||
@@ -13,6 +25,13 @@ _ if it's working, make it all reflection-based in PApplet
|
||||
_ first pass on full screen
|
||||
_ exceptions in full screen mode will quit the app completely
|
||||
_ (can't keep window open because things are hosed)
|
||||
_ default is that full screen app doesn't cover multiple displays
|
||||
_ this is fine since opengl can't usually go across both
|
||||
_ but include an example for how to use full in gl
|
||||
_ (use toolkit.getscreensize)
|
||||
|
||||
_ move everything to packages, and start auto-javadoc
|
||||
_ remove PdeXxx prefixes on names, make PdeBase into just "Processing"
|
||||
|
||||
|
||||
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
||||
@@ -20,7 +39,6 @@ _ (can't keep window open because things are hosed)
|
||||
|
||||
MUST BE COMPLETE FOR BETA
|
||||
|
||||
|
||||
non-coding tasks (for beta)
|
||||
_ new bboard? archive the old one, remove bugs sections
|
||||
_ environment reference
|
||||
@@ -34,6 +52,7 @@ _ nope, libraries can handle that themselves,
|
||||
_ and queue events by registering for draw or whatever they'd like
|
||||
_ lib could call queueEvent with the args
|
||||
_ then call them inside post()
|
||||
_ scrubbing all the code to include proper license and copyright info
|
||||
|
||||
_ update checker (can be turned off in prefs)
|
||||
_ send unique id, and information about person's java vm/platform
|
||||
@@ -41,9 +60,6 @@ _ using timezone would be an interesting method for tracking location
|
||||
|
||||
_ border weirdness in PdeEditor panels on windows
|
||||
|
||||
_ move everything to packages, and start auto-javadoc
|
||||
_ remove PdeXxx prefixes on names, make PdeBase into just "Processing"
|
||||
|
||||
_ stop() not working very well
|
||||
_ doesn't seem to actually be stopping things
|
||||
_ closing window w/o first hitting stop() causes freak out
|
||||
@@ -97,6 +113,9 @@ NOT NECESSARY BEFORE BETA
|
||||
|
||||
_ split Preferences and PreferencesFrame ?
|
||||
|
||||
_ lock the minimum size for the main processing editor frame
|
||||
_ if it's made too small, stuff from the bottom disappears
|
||||
|
||||
_ properly handle ENTER, Ctrl-W and ESC on all dialogs
|
||||
_ there must be a proper "swing" way of doing this that doesn't
|
||||
_ involve adding key listeners to every friggin component
|
||||
|
||||
Reference in New Issue
Block a user