bug fixing, get things compiling again

This commit is contained in:
benfry
2007-07-16 14:02:05 +00:00
parent e59e3e00a9
commit 2034d22bbc
11 changed files with 153 additions and 84 deletions

View File

@@ -8,9 +8,9 @@ package antlr;
*/
import java.io.*;
import antlr.*;
//import antlr.*;
import antlr.collections.*;
import antlr.collections.impl.*;
//import antlr.collections.impl.*;
/** A CommonAST whose initialization copies hidden token
* information from the Token used to create a node.

View File

@@ -27,14 +27,14 @@ import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.lang.reflect.*;
import java.net.*;
//import java.net.*;
import java.util.*;
import java.util.zip.*;
//import java.util.zip.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.text.*;
import javax.swing.undo.*;
//import javax.swing.event.*;
//import javax.swing.text.*;
//import javax.swing.undo.*;
import com.apple.mrj.*;
import com.ice.jni.registry.*;
@@ -174,7 +174,7 @@ public class Base {
if (PApplet.platform == PConstants.MACOSX) {
MRJOpenDocumentHandler startupOpen = new MRJOpenDocumentHandler() {
public void handleOpenFile(File file) {
handleOpen(file.getAbsolutePath());
handleOpen(file);
// this will only get set once.. later will be handled
// by the Editor version of this fella
//if (Base.openedAtStartup == null) {
@@ -188,13 +188,13 @@ public class Base {
// #@$*(@#$ apple.. always gotta think different
MRJApplicationUtils.registerAboutHandler(new MRJAboutHandler() {
public void handleAbout() {
Editor.handleAbout();
activeEditor.handleAbout();
}
});
MRJApplicationUtils.registerPrefsHandler(new MRJPrefsHandler() {
public void handlePrefs() {
Editor.handlePrefs();
activeEditor.handlePrefs();
}
});
@@ -276,7 +276,7 @@ public class Base {
// get the frontmost window frame for placing file dialog
//static public void handleOpen(Frame frame) {
FileDialog od = new FileDialog(frame,
FileDialog od = new FileDialog(activeEditor,
"Select a file:",
FileDialog.LOAD);
//od.setDirectory(new File("../2005/").getAbsolutePath());
@@ -286,10 +286,15 @@ public class Base {
String filename = od.getFile();
if (filename == null) return;
File inputFile = new File(directory, filename);
handleOpen(inputFile);
handleOpen(inputFile.getAbsolutePath());
}
public void handleOpen(File file) {
handleOpen(file.getAbsolutePath());
}
public void handleOpen(String path) {
new Editor(this, path);
}
@@ -804,7 +809,7 @@ public class Base {
//fd.setFile(folder.getName());
}
System.setProperty("apple.awt.fileDialogForDirectories", "true");
fd.show();
fd.setVisible(true);
System.setProperty("apple.awt.fileDialogForDirectories", "false");
if (fd.getFile() == null) {
return null;
@@ -1042,7 +1047,7 @@ public class Base {
// Attempt to use gnome-open
try {
Process p = Runtime.getRuntime().exec(new String[] { "gnome-open" });
int result = p.waitFor();
/*int result =*/ p.waitFor();
// Not installed will throw an IOException (JDK 1.4.2, Ubuntu 7.04)
Preferences.set("launcher.linux", "gnome-open");
return true;
@@ -1051,7 +1056,7 @@ public class Base {
// Attempt with kde-open
try {
Process p = Runtime.getRuntime().exec(new String[] { "kde-open" });
int result = p.waitFor();
/*int result =*/ p.waitFor();
Preferences.set("launcher.linux", "kde-open");
return true;
} catch (Exception e) { }

View File

@@ -30,23 +30,23 @@ import processing.core.*;
import java.awt.*;
import java.awt.datatransfer.*;
import java.awt.dnd.*;
//import java.awt.dnd.*;
import java.awt.event.*;
import java.awt.print.*;
import java.io.*;
import java.lang.reflect.*;
import java.net.*;
import java.util.*;
import java.util.zip.*;
//import java.lang.reflect.*;
//import java.net.*;
//import java.util.*;
//import java.util.zip.*;
import javax.swing.*;
import javax.swing.border.*;
//import javax.swing.border.*;
import javax.swing.event.*;
import javax.swing.text.*;
import javax.swing.undo.*;
import com.apple.mrj.*;
import com.oroinc.text.regex.*;
//import com.apple.mrj.*;
//import com.oroinc.text.regex.*;
//import de.hunsicker.jalopy.*;
@@ -129,11 +129,9 @@ public class Editor extends JFrame {
FindReplace find;
public Editor(Base base, String path) {
public Editor(Base ibase, String path) {
super(WINDOW_TITLE);
this.base = base;
this.base = ibase;
// set the window icon
if (icon == null) {
@@ -159,7 +157,7 @@ public class Editor extends JFrame {
// When bringing a window to front, let the Base know
addWindowListener(new WindowAdapter() {
public void windowActivated(WindowEvent e) {
base.setFrontEditor(this);
base.handleActivated(Editor.this);
}
});
@@ -270,7 +268,7 @@ public class Editor extends JFrame {
String name = filename.substring(0, filename.length() - 4);
File parent = file.getParentFile();
if (name.equals(parent.getName())) {
Base.handleOpenFile(file);
base.handleOpen(file);
return true;
}
}
@@ -307,7 +305,7 @@ public class Editor extends JFrame {
// Open the document that was passed in
handleOpen(path);
// show the window
show();
setVisible(true);
}
@@ -1356,19 +1354,19 @@ public class Editor extends JFrame {
// @return false if canceling the close/quit operation
protected boolean checkModified() {
if (!modified) return true;
protected boolean checkModified(boolean quitting) {
if (!sketch.modified) return true;
String prompt = "Save changes to " + file.getName() + "? ";
String prompt = "Save changes to " + sketch.name + "? ";
if (PApplet.platform != PConstants.MACOSX || PApplet.javaVersion < 1.5f) {
int result =
JOptionPane.showConfirmDialog(frame, prompt, "Close",
JOptionPane.showConfirmDialog(this, prompt, "Close",
JOptionPane.YES_NO_CANCEL_OPTION,
JOptionPane.QUESTION_MESSAGE);
if (result == JOptionPane.YES_OPTION) {
return handleSave();
return handleSave(quitting);
} else if (result == JOptionPane.NO_OPTION) {
return true; // ok to continue
@@ -1414,12 +1412,12 @@ public class Editor extends JFrame {
pane.putClientProperty("Quaqua.OptionPane.destructiveOption",
new Integer(2));
JDialog dialog = pane.createDialog(frame, null);
JDialog dialog = pane.createDialog(this, null);
dialog.setVisible(true);
Object result = pane.getValue();
if (result == options[0]) { // save (and close/quit)
return handleSave();
return handleSave(quitting);
} else if (result == options[2]) { // don't save (still close/quit)
return true;
@@ -1570,14 +1568,19 @@ public class Editor extends JFrame {
// a way to get started. shite. now i hate myself.
//if (disablePrompt) prompt = false;
String path = null;
if (prompt) {
path = sketchbook.handleNewPrompt();
} else {
path = sketchbook.handleNewUntitled();
}
if (filename != null) {
base.handleOpen(path);
try {
String path = null;
if (prompt) {
path = sketchbook.handleNewPrompt();
} else {
path = sketchbook.handleNewUntitled();
}
if (path != null) {
base.handleOpen(path);
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
@@ -1788,6 +1791,17 @@ public class Editor extends JFrame {
error(e);
}
}
/*
public boolean handleClose() {
}
*/
public void handleClose2() {
base.handleClose(this);
}
/**
@@ -1799,9 +1813,12 @@ public class Editor extends JFrame {
* won't run properly while a quit is happening. This fixes
* <A HREF="http://dev.processing.org/bugs/show_bug.cgi?id=276">Bug 276</A>.
*/
public void handleSave(boolean immediately) {
public boolean handleSave(boolean immediately) {
doStop();
buttons.activate(EditorButtons.SAVE);
if (sketch.untitled) {
// need to get the name, user might also cancel here
}
if (immediately) {
handleSave2();
@@ -1812,10 +1829,12 @@ public class Editor extends JFrame {
}
});
}
return true;
}
protected void handleSave2() {
buttons.activate(EditorButtons.SAVE);
message("Saving...");
try {
if (sketch.save()) {
@@ -2013,7 +2032,7 @@ public class Editor extends JFrame {
// instead use doClose() which will kill the external vm
doClose();
checkModified(HANDLE_QUIT);
checkModified(true);
}

View File

@@ -31,7 +31,7 @@ import javax.swing.*;
/**
* Panel just below the editing area that contains status messages.
*/
public class EditorStatus extends JPanel implements ActionListener {
public class EditorStatus extends JPanel /*implements ActionListener*/ {
static Color bgcolor[];
static Color fgcolor[];
@@ -117,6 +117,7 @@ public class EditorStatus extends JPanel implements ActionListener {
}
/*
public void prompt(String message) {
mode = PROMPT;
this.message = message;
@@ -138,6 +139,7 @@ public class EditorStatus extends JPanel implements ActionListener {
cancelButton.setVisible(false);
empty();
}
*/
public void edit(String message, String dflt) {
@@ -238,6 +240,26 @@ public class EditorStatus extends JPanel implements ActionListener {
cancelButton = new JButton(Preferences.PROMPT_CANCEL);
okButton = new JButton(Preferences.PROMPT_OK);
cancelButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (mode == EDIT) {
unedit();
editor.buttons.clear();
}
}
});
okButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
// answering to rename/new code question
if (mode == EDIT) { // this if() isn't (shouldn't be?) necessary
String answer = editField.getText();
editor.sketch.nameCode(answer);
unedit();
}
}
});
// !@#(* aqua ui #($*(( that turtle-neck wearing #(** (#$@)(
// os9 seems to work if bg of component is set, but x still a bastard
if (Base.isMacOS()) {
@@ -248,10 +270,12 @@ public class EditorStatus extends JPanel implements ActionListener {
}
setLayout(null);
/*
yesButton.addActionListener(this);
noButton.addActionListener(this);
cancelButton.addActionListener(this);
okButton.addActionListener(this);
*/
add(yesButton);
add(noButton);
@@ -264,7 +288,8 @@ public class EditorStatus extends JPanel implements ActionListener {
okButton.setVisible(false);
editField = new JTextField();
editField.addActionListener(this);
// disabling, was not in use
//editField.addActionListener(this);
//if (Base.platform != Base.MACOSX) {
editField.addKeyListener(new KeyAdapter() {
@@ -407,6 +432,20 @@ public class EditorStatus extends JPanel implements ActionListener {
public void actionPerformed(ActionEvent e) {
if (e.getSource() == cancelButton) {
if (mode == EDIT) unedit();
editor.buttons.clear();
} else if (e.getSource() == okButton) {
// answering to rename/new code question
if (mode == EDIT) { // this if() isn't (shouldn't be?) necessary
String answer = editField.getText();
editor.sketch.nameCode(answer);
unedit();
}
}
/*
if (e.getSource() == noButton) {
// shut everything down, clear status, and return
unprompt();
@@ -432,5 +471,6 @@ public class EditorStatus extends JPanel implements ActionListener {
editor.sketch.nameCode(answer);
unedit();
}
*/
}
}

View File

@@ -248,8 +248,8 @@ public class Runner implements MessageConsumer {
window = new Frame(sketch.name); // use ugly window
((Frame)window).setResizable(false);
if (editor.icon != null) {
((Frame)window).setIconImage(editor.icon);
if (Editor.icon != null) {
((Frame)window).setIconImage(Editor.icon);
}
window.pack(); // to get a peer, size set later, need for insets

View File

@@ -27,6 +27,7 @@ import processing.app.preproc.*;
import processing.core.*;
import java.awt.*;
import java.awt.event.WindowEvent;
import java.io.*;
import java.util.*;
import java.util.zip.*;
@@ -59,6 +60,11 @@ public class Sketch {
* true if any of the files have been modified.
*/
boolean modified;
/**
* true if this file has not yet been given a name by the user
*/
boolean untitled;
public File folder;
public File dataFolder;
@@ -587,7 +593,8 @@ public class Sketch {
//sketchbook.rebuildMenus();
// make a new sketch, and i think this will rebuild the sketch menu
editor.handleNewUnchecked();
//editor.handleNewUnchecked();
editor.handleClose2();
} else {
// delete the file
@@ -730,8 +737,12 @@ public class Sketch {
//new Exception().printStackTrace();
current.modified = state;
calcModified();
Object modifiedParam = modified ? Boolean.TRUE : Boolean.FALSE;
getRootPane().putClientProperty(WINDOW_MODIFIED, modifiedParam);
if (PApplet.platform == PConstants.MACOSX) {
// http://developer.apple.com/qa/qa2001/qa1146.html
Object modifiedParam = modified ? Boolean.TRUE : Boolean.FALSE;
editor.getRootPane().putClientProperty("windowModified", modifiedParam);
}
}
@@ -948,7 +959,7 @@ public class Sketch {
"Select an image or other data file to copy to your sketch";
//FileDialog fd = new FileDialog(new Frame(), prompt, FileDialog.LOAD);
FileDialog fd = new FileDialog(editor, prompt, FileDialog.LOAD);
fd.show();
fd.setVisible(true);
String directory = fd.getDirectory();
String filename = fd.getFile();

View File

@@ -26,17 +26,17 @@ package processing.app;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.net.*;
//import java.net.*;
import java.text.*;
import java.util.*;
import java.util.zip.*;
//import java.util.zip.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.text.*;
import javax.swing.undo.*;
//import javax.swing.event.*;
//import javax.swing.text.*;
//import javax.swing.undo.*;
import com.apple.mrj.*;
//import com.apple.mrj.*;
/**
@@ -155,7 +155,7 @@ public class Sketchbook {
"Create sketch folder named:",
FileDialog.SAVE);
//fd.setDirectory(getSketchbookPath());
fd.show();
fd.setVisible(true);
String newbieParentDir = fd.getDirectory();
newbieName = fd.getFile();
@@ -163,7 +163,7 @@ public class Sketchbook {
newbieName = sanitizeName(newbieName);
newbieDir = new File(newbieParentDir, newbieName);
handleNewInternal(newbieDir, newbieName);
return handleNewInternal(newbieDir, newbieName);
}
@@ -188,11 +188,11 @@ public class Sketchbook {
newbieDir = new File(newbieParentDir, newbieName);
index++;
} while (newbieDir.exists());
handleNewInternal(newbieDir, newbieName);
return handleNewInternal(newbieDir, newbieName);
}
protected String handleNewImpl(File newbieDir, String newbieName) {
protected String handleNewInternal(File newbieDir, String newbieName) throws FileNotFoundException {
// make the directory for the new sketch
newbieDir.mkdirs();

View File

@@ -22,23 +22,16 @@
package processing.app;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.lang.reflect.*;
import java.net.*;
import java.util.*;
import java.util.zip.*;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLEncoder;
import java.util.Random;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.text.*;
import javax.swing.undo.*;
import javax.swing.JOptionPane;
import com.apple.mrj.*;
import com.ice.jni.registry.*;
import processing.core.*;
import processing.core.PApplet;
/**

View File

@@ -28,7 +28,7 @@ public class PdeEmitter implements PdeTokenTypes
{
private PrintStream out = System.out;
private PrintStream debug = System.err;
private static int ALL = -1;
//private static int ALL = -1;
private java.util.Stack stack = new java.util.Stack();
private static String[] tokenNames;
private final static int ROOT_ID = 0;

View File

@@ -34,7 +34,7 @@ import java.io.*;
import antlr.*;
import antlr.collections.*;
import antlr.collections.impl.*;
//import antlr.collections.impl.*;
import com.oroinc.text.regex.*;

View File

@@ -117,7 +117,8 @@ echo Building the PDE...
# compile the code as java 1.3, so that the application will run and
# show the user an error, rather than crapping out with some strange
# "class not found" crap
../build/macosx/work/jikes -target 1.3 +D -classpath ../build/macosx/work/classes:../build/macosx/work/lib/core.jar:../build/macosx/work/lib/antlr.jar:../build/macosx/work/lib/oro.jar:../build/macosx/work/lib/registry.jar:$CLASSPATH -d ../build/macosx/work/classes *.java syntax/*.java preproc/*.java tools/*.java
../build/macosx/work/jikes -target 1.3 +D -classpath ../build/macosx/work/classes:../build/macosx/work/lib/core.jar:../build/macosx/work/lib/antlr.jar:../build/macosx/work/lib/oro.jar:../build/macosx/work/lib/registry.jar:$CLASSPATH -d ../build/macosx/work/classes src/processing/app/*.java src/processing/app/syntax/*.java src/processing/app/preproc/*.java src/processing/app/tools/*.java src/antlr/*.java src/antlr/java/*.java
#../build/macosx/work/jikes -target 1.3 +D -classpath ../build/macosx/work/classes:../build/macosx/work/lib/core.jar:../build/macosx/work/lib/antlr.jar:../build/macosx/work/lib/oro.jar:../build/macosx/work/lib/registry.jar:$CLASSPATH -d ../build/macosx/work/classes *.java syntax/*.java preproc/*.java tools/*.java
#javac -source 1.3 -target 1.3 -classpath ../build/macosx/work/classes:../build/macosx/work/lib/core.jar:../build/macosx/work/lib/antlr.jar:../build/macosx/work/lib/oro.jar:../build/macosx/work/lib/registry.jar:$CLASSPATH -d ../build/macosx/work/classes *.java syntax/*.java preproc/*.java tools/*.java
# version that follows includes jalopy.jar and log4j.jar
#../build/macosx/work/jikes -target 1.3 +D -classpath ../build/macosx/work/classes:../build/macosx/work/lib/core.jar:../build/macosx/work/lib/antlr.jar:../build/macosx/work/lib/oro.jar:../build/macosx/work/lib/registry.jar:../build/macosx/work/lib/jalopy.jar:../build/macosx/work/lib/log4j.jar:$CLASSPATH -d ../build/macosx/work/classes tools/*.java preproc/*.java syntax/*.java *.java