X lib/pde.properties should be read using getResource
X   otherwise path issues cause trouble (likely under win98)
X take state information out of Header
X cleanup lastFile/lastDirectory
X save (just) last program run in sketch.properties
X coloring of error, message, etc changed in pde.properties
X finish save changes stuff

0031b
X editorlistener shouldn't track menu commands as changes to file
X   ctrl keys bksp/del/enter/return/tab then space on up
X   indicator for changes?
X   need to implement code for whether changes have been made
X   check for key events in textarea or something
X     if key events, compare contents against the existing file
X userName not getting set before sketchbook menu is built
X add 'refresh list' item to the sketchbook menu

0031c
X ability to set directory for compiling in kjcengine

0031d
X make sure compiling into build directory
X   and once compiled there, read all classes for export
This commit is contained in:
benfry
2002-07-05 09:52:58 +00:00
parent 42a5888538
commit 6d42bca5f1
9 changed files with 312 additions and 162 deletions
+30 -12
View File
@@ -16,6 +16,7 @@ public class PdeBase implements ActionListener {
WindowAdapter windowListener;
Menu sketchbookMenu;
File sketchbookFolder;
String sketchbookPath;
@@ -87,16 +88,16 @@ public class PdeBase implements ActionListener {
menu = new Menu("File");
menu.add(new MenuItem("New", new MenuShortcut('N')));
Menu openMenu = new Menu("Open");
rebuildSketchbookMenu(openMenu);
menu.add(openMenu);
sketchbookMenu = new Menu("Open");
//rebuildSketchbookMenu(openMenu);
menu.add(sketchbookMenu);
menu.add(new MenuItem("Save", new MenuShortcut('S')));
menu.add(new MenuItem("Duplicate", new MenuShortcut('D')));
menu.add(new MenuItem("Export to Web", new MenuShortcut('E')));
menu.add(new MenuItem("Export Application", new MenuShortcut('E', true)));
menu.addSeparator();
menu.add(new MenuItem("Proce55ing.net", new MenuShortcut('5')));
menu.add(new MenuItem("Reference", new MenuShortcut('R')));
menu.add(new MenuItem("Reference", new MenuShortcut('F')));
menu.addSeparator();
menu.add(new MenuItem("Quit", new MenuShortcut('Q')));
menu.addActionListener(this);
@@ -117,8 +118,8 @@ public class PdeBase implements ActionListener {
menubar.add(menu);
menu = new Menu("Sketch");
menu.add(new MenuItem("Play", new MenuShortcut('P')));
menu.add(new MenuItem("Present", new MenuShortcut('P', true)));
menu.add(new MenuItem("Run", new MenuShortcut('R')));
menu.add(new MenuItem("Present", new MenuShortcut('P')));
menu.add(new MenuItem("Stop"));
menu.addSeparator();
menu.add(new MenuItem("Beautify", new MenuShortcut('B')));
@@ -127,7 +128,6 @@ public class PdeBase implements ActionListener {
frame.setMenuBar(menubar);
/*
Menu fileMenu = new Menu("File");
MenuItem mi;
@@ -138,7 +138,6 @@ public class PdeBase implements ActionListener {
frame.setMenuBar(menubar);
*/
Insets insets = frame.getInsets();
Toolkit tk = Toolkit.getDefaultToolkit();
Dimension screen = tk.getScreenSize();
@@ -160,6 +159,7 @@ public class PdeBase implements ActionListener {
editor.frame = frame; // no longer really used
editor.init();
rebuildSketchbookMenu(sketchbookMenu);
frame.show(); // added back in for pde
}
@@ -184,7 +184,8 @@ public class PdeBase implements ActionListener {
//editor.sketchbookOpen(path + File.separator + e.getActionCommand());
//}
String name = e.getActionCommand();
editor.skOpen(path, name); // + File.separator + name +
editor.skOpen(path, name);
//editor.skOpen(path, name); // + File.separator + name +
//File.separator + name + ".pde");
}
}
@@ -225,24 +226,33 @@ public class PdeBase implements ActionListener {
new SketchbookMenuListener(userPath);
String entries[] = new File(userPath).list();
boolean added = false;
for (int j = 0; j < entries.length; j++) {
if ((entries[j].equals(".")) ||
(entries[j].equals(".."))) continue;
added = true;
MenuItem item = new MenuItem(entries[j]);
item.addActionListener(userMenuListener);
menu.add(item);
//submenu.add(entries[j]);
}
if (!added) {
MenuItem item = new MenuItem("No sketches");
item.setEnabled(false);
menu.add(item);
}
menu.addSeparator();
// other available subdirectories
String toplevel[] = sketchbookFolder.list();
added = false;
for (int i = 0; i < toplevel.length; i++) {
if ((toplevel[i].equals(editor.userName)) ||
(toplevel[i].equals(".")) ||
(toplevel[i].equals(".."))) continue;
added = true;
Menu subMenu = new Menu(toplevel[i]);
File subFolder = new File(sketchbookFolder, toplevel[i]);
String subPath = subFolder.getCanonicalPath();
@@ -261,7 +271,11 @@ public class PdeBase implements ActionListener {
menu.add(subMenu);
}
//menu.addSeparator();
if (added) menu.addSeparator();
MenuItem item = new MenuItem("Refresh");
item.addActionListener(this);
menu.add(item);
} catch (IOException e) {
e.printStackTrace();
@@ -275,6 +289,7 @@ public class PdeBase implements ActionListener {
if (command.equals("New")) {
editor.skNew();
//editor.initiate(Editor.NEW);
} else if (command.equals("Save")) {
editor.doSave();
@@ -300,10 +315,11 @@ public class PdeBase implements ActionListener {
} else if (command.equals("Quit")) {
editor.doQuit();
//editor.initiate(Editor.QUIT);
} else if (command.equals("Play")) {
editor.doPlay();
} else if (command.equals("Run")) {
editor.doRun();
} else if (command.equals("Present")) {
//editor.doPresent();
@@ -311,6 +327,8 @@ public class PdeBase implements ActionListener {
} else if (command.equals("Stop")) {
editor.doStop();
} else if (command.equals("Refresh")) {
rebuildSketchbookMenu(sketchbookMenu);
}
//if (command.equals("Save QuickTime movie...")) {
// ((PdeEditor)environment).doRecord();
+113 -83
View File
@@ -19,7 +19,14 @@ public class PdeEditor extends Panel {
// otherwise, if the window is resized with the message label
// set to blank, it's preferredSize() will be fukered
static final String EMPTY = " ";
//PdeBase app;
static final int SK_NEW = 1;
static final int SK_OPEN = 2;
static final int DO_OPEN = 3;
static final int DO_QUIT = 4;
int checking;
String openingPath;
String openingName;
PdeEditorButtons buttons;
PdeEditorHeader header;
@@ -32,6 +39,7 @@ public class PdeEditor extends Panel {
String sketchName; // name of the file (w/o pde if a sketch)
File sketchFile; // the .pde file itself
File sketchDir; // if a sketchbook project, the parent dir
boolean sketchModified;
//String lastDirectory;
//String lastFile;
@@ -44,7 +52,7 @@ public class PdeEditor extends Panel {
static final int GRID_SIZE = 33;
static final int INSET_SIZE = 5;
boolean playing;
boolean running;
public PdeEditor(/*PdeBase app,*/ /*String program*/) {
@@ -97,12 +105,12 @@ public class PdeEditor extends Panel {
add("Center", rightPanel);
if (!PdeBase.isMacintosh()) { // this still relevant?
PdeEditorListener listener = new PdeEditorListener();
textarea.addKeyListener(listener);
textarea.addFocusListener(listener);
//textarea.addKeyListener(new PdeKeyListener(this));
}
//if (!PdeBase.isMacintosh()) { // this still relevant?
PdeEditorListener listener = new PdeEditorListener(this);
textarea.addKeyListener(listener);
textarea.addFocusListener(listener);
//textarea.addKeyListener(new PdeKeyListener(this));
//}
runner = new PdeRunner(this);
}
@@ -138,7 +146,7 @@ public class PdeEditor extends Panel {
String user = skprops.getProperty("user.name");
String what = path + File.separator + name + ".pde";
System.out.println(what);
//System.out.println(what);
if (new File(what).exists()) {
userName = user;
@@ -159,14 +167,16 @@ public class PdeEditor extends Panel {
// doesn't exist, not available, make my own
skNew();
}
//rebuildSketchbookMenu(PdeBase.sketchbookMenu);
}
public void doPlay() {
public void doRun() {
//doStop();
doClose();
playing = true;
buttons.play();
running = true;
buttons.run();
runner.setProgram(textarea.getText());
runner.start();
@@ -181,24 +191,26 @@ public class PdeEditor extends Panel {
//doStop();
doClose();
PdeRecorder.start(this, graphics.width, graphics.height);
doPlay();
doRun();
}
#endif
public void doStop() {
#ifdef RECORDER
if (!playing) return;
if (!running) return;
#endif
terminate();
buttons.clear();
playing = false;
running = false;
}
// this is the former 'kill' function
// may just roll this in with the other code
public void doClose() {
if (playing) {
//System.out.println("was playing, will call doStop()");
if (running) {
//System.out.println("was running, will call doStop()");
doStop();
}
@@ -214,68 +226,61 @@ public class PdeEditor extends Panel {
}
/*
public void doOpen(Component comp, int compX, int compY) {
// first get users/top-level entries in sketchbook
try {
File sketchbookDir = new File("sketchbook");
String toplevel[] = sketchbookDir.list();
PopupMenu menu = new PopupMenu();
menu.add(NEW_SKETCH_ITEM);
menu.addSeparator();
// header knows what the current user is
for (int i = 0; i < toplevel; i++) {
if ((toplevel[i].equals(header.user)) ||
(toplevel[i].equals(".")) ||
(toplevel[i].equals(".."))) continue;
Menu submenu = new Menu(toplevel[i]);
File subdir = new File(sketchbookDir, toplevel[i]);
String path = subdir.getCanonicalPath();
submenu.addActionListener(new OpenMenuListener(this, path));
//submenu.addActionListener(new ActionAdapter() {
//});
String entries[] = subdir.list();
for (int j = 0; j < entries.length; j++) {
if ((entries[j].equals(".")) ||
(entries[j].equals(".."))) continue;
submenu.add(entries[j]);
}
menu.add(submenu);
}
menu.addSeparator();
// this might trigger even if a submenu isn't selected,
// but hopefully not
String mypath = path + File.separator + header.user;
menu.addActionListener(new OpenMenuListener(this, mypath));
String entries[] = new File(mypath).list();
for (int j = 0; j < entries.length; j++) {
if ((entries[j].equals(".")) ||
(entries[j].equals(".."))) continue;
submenu.add(entries[j]);
}
// show the feller and get psyched for a selection
menu.show(comp, compX, compY);
} catch (IOException e) {
e.printStackTrace();
}
buttons.clear();
public void setSketchModified(boolean what) {
header.sketchModified = what;
header.update();
sketchModified = what;
}
// check to see if there have been changes
// if so, prompt user whether or not to save first
// if the user cancels, return false to abort parent operation
protected void checkModified(int checking) {
checkModified(checking, null, null);
}
protected void checkModified(int checking, String path, String name) {
this.checking = checking;
openingPath = path;
openingName = name;
if (sketchModified) {
status.prompt("Save changes to " + sketchName + "?");
} else {
checkModified2();
}
/*
while (status.response == 0) {
System.out.println("waiting for a response " +
System.currentTimeMillis());
//try {
//Thread.sleep(100);
//} catch (InterruptedException e) { }
}
*/
//return true;
}
public void checkModified2() {
//System.out.println("checkmodified2");
switch (checking) {
case SK_NEW: skNew2(); break;
case SK_OPEN: skOpen2(openingPath, openingName); break;
case DO_OPEN: doOpen2(); break;
case DO_QUIT: doQuit2(); break;
}
checking = 0;
}
*/
// local vars prevent sketchName from being set
public void skNew() {
checkModified(SK_NEW);
}
protected void skNew2() {
try {
// does all the plumbing to create a new project
// then calls handleOpen to load it up
@@ -328,6 +333,11 @@ public class PdeEditor extends Panel {
*/
public void skOpen(String path, String name) {
checkModified(SK_OPEN, path, name);
}
protected void skOpen2(String path, String name) {
//System.out.println("skOpen2 " + path + " " + name);
//header.isProject = true;
//header.project = name;
//System.out.println("skopen " + path + " " + name);
@@ -345,6 +355,10 @@ public class PdeEditor extends Panel {
public void doOpen() {
checkModified(DO_OPEN);
}
protected void doOpen2() {
FileDialog fd = new FileDialog(new Frame(),
"Open a PDE program...",
FileDialog.LOAD);
@@ -366,14 +380,19 @@ public class PdeEditor extends Panel {
protected void handleOpen(String isketchName,
File isketchFile, File isketchDir) {
//System.out.println("handleOpen " + isketchName + " " +
//System.err.println("i'm here!");
//System.err.println(isketchName);
//System.err.println(isketchFile);
//System.err.println(isketchDir);
//System.err.println("handleOpen " + isketchName + " " +
// isketchFile + " " + isketchDir);
//System.err.println("made it");
try {
//if (true) throw new IOException("blah");
FileInputStream input = new FileInputStream(isketchFile);
int length = (int) isketchFile.length();
if (length == 0) {
if (length != 0) {
byte data[] = new byte[length];
int count = 0;
@@ -391,12 +410,18 @@ public class PdeEditor extends Panel {
// what the hell was i thinking when i wrote this code
//if (app.encoding == null)
textarea.setText(new String(data));
//System.out.println(" loading program = " + new String(data));
//else
//textarea.setText(new String(data, app.encoding));
} else {
textarea.setText("");
}
sketchName = isketchName;
sketchFile = isketchFile;
sketchDir = isketchDir;
setSketchModified(false);
//header.setProject(file.getName(), projectDir);
header.reset();
@@ -425,7 +450,7 @@ public class PdeEditor extends Panel {
message("Saving file...");
String s = textarea.getText();
String directory = sketchFile.getPath(); //lastDirectory;
String directory = sketchFile.getParent(); //lastDirectory;
String filename = sketchFile.getName(); //lastFile;
if (promptUser) {
@@ -445,7 +470,6 @@ public class PdeEditor extends Panel {
}
}
File file = new File(directory, filename);
try {
FileWriter writer = new FileWriter(file);
writer.write(s);
@@ -455,6 +479,7 @@ public class PdeEditor extends Panel {
//lastDirectory = directory;
//lastFile = filename;
sketchFile = file;
setSketchModified(false);
message("Done saving " + filename + ".");
} catch (IOException e) {
@@ -511,7 +536,7 @@ public class PdeEditor extends Panel {
String program = textarea.getText();
// create the project directory
KjcEngine engine = new KjcEngine(program, this);
KjcEngine engine = new KjcEngine(program, appletDir.getPath(), this);
//File projectDir = new File(appletDir, projectName);
//projectDir.mkdirs();
appletDir.mkdirs();
@@ -666,6 +691,11 @@ public class PdeEditor extends Panel {
public void doQuit() {
//if (!checkModified()) return;
checkModified(DO_QUIT);
}
protected void doQuit2() {
// write sketch.properties
try {
URL url = getClass().getResource("buttons.gif");
@@ -929,14 +959,14 @@ public class PdeEditor extends Panel {
public void error(PdeException e) { // part of PdeEnvironment
if (e.line >= 0) highlightLine(e.line);
//dbcp.repaint(); // button should go back to 'play'
//dbcp.repaint(); // button should go back to 'run'
//System.err.println(e.getMessage());
//message("Problem: " + e.getMessage());
status.error(e.getMessage());
//message(e.getMessage());
buttons.clearPlay();
buttons.clearRun();
//showStatus(e.getMessage());
}
@@ -946,8 +976,8 @@ public class PdeEditor extends Panel {
#ifdef RECORDER
PdeRecorder.stop();
#endif
playing = false;
buttons.clearPlay();
running = false;
buttons.clearRun();
message("Done.");
}
+12 -12
View File
@@ -7,12 +7,12 @@ import java.awt.*;
public class PdeEditorButtons extends Panel {
static final String EMPTY_STATUS = " ";
// play, stop, save, export, open
// run, stop, save, export, open
static final String title[] = {
"", "play", "stop", "save", "open", "export"
//"", "Play", "Stop", "Save", "Open", "Export"
//"Play", "Stop", "Close",
"", "run", "stop", "save", "open", "export"
//"", "Run", "Stop", "Save", "Open", "Export"
//"Run", "Stop", "Close",
//"Open", "Save", "Export Applet", "Print", "Beautify",
//"Disable Full Screen", "Full Screen"
};
@@ -22,7 +22,7 @@ public class PdeEditorButtons extends Panel {
static final int BUTTON_HEIGHT = PdeEditor.GRID_SIZE; //33;
static final int NOTHING = 0;
static final int PLAY = 1;
static final int RUN = 1;
static final int STOP = 2;
static final int SAVE = 3;
@@ -70,7 +70,7 @@ public class PdeEditorButtons extends Panel {
which = new int[BUTTON_COUNT];
which[buttonCount++] = NOTHING;
which[buttonCount++] = PLAY;
which[buttonCount++] = RUN;
which[buttonCount++] = STOP;
which[buttonCount++] = SAVE;
which[buttonCount++] = OPEN;
@@ -319,8 +319,8 @@ public class PdeEditorButtons extends Panel {
//switch (which[sel]) {
switch (currentSelection) {
case PLAY: editor.doPlay(); break;
case STOP: setState(PLAY, INACTIVE, true); editor.doStop(); break;
case RUN: editor.doRun(); break;
case STOP: setState(RUN, INACTIVE, true); editor.doStop(); break;
//case CLOSE: editor.doClose(); break;
case OPEN: editor.doOpen(); break;
@@ -354,7 +354,7 @@ public class PdeEditorButtons extends Panel {
if (inactive == null) return;
//setState(button, INACTIVE);
// skip the play button, do the others
// skip the run button, do the others
for (int i = 1; i < buttonCount; i++) {
//state[i] = INACTIVE;
//stateImage[i] = inactive[which[i]];
@@ -363,13 +363,13 @@ public class PdeEditorButtons extends Panel {
update();
}
public void play() {
public void run() {
if (inactive == null) return;
clear();
setState(0, ACTIVE, true);
}
public void clearPlay() {
public void clearRun() {
if (inactive == null) return;
setState(0, INACTIVE, true);
}
@@ -377,7 +377,7 @@ public class PdeEditorButtons extends Panel {
/*
public boolean mouseUp(Event e, int x, int y) {
if (wasDown == -1) return true;
if (which[wasDown] == PLAY) return true;
if (which[wasDown] == RUN) return true;
setState(wasDown, INACTIVE);
wasDown = -1;
+2 -2
View File
@@ -44,8 +44,8 @@ public class PdeEditorConsole extends Component {
static PrintStream systemOut;
static PrintStream systemErr;
PrintStream consoleOut;
PrintStream consoleErr;
static PrintStream consoleOut;
static PrintStream consoleErr;
public PdeEditorConsole(PdeEditor editor) {
+6 -1
View File
@@ -31,6 +31,7 @@ public class PdeEditorHeader extends Panel /* implements ActionListener*/ {
int sketchRight;
int sketchTitleLeft;
//File sketchDir;
boolean sketchModified;
//private String user;
int userLeft;
@@ -160,7 +161,11 @@ public class PdeEditorHeader extends Panel /* implements ActionListener*/ {
g.setColor(primaryColor);
//g.drawString(sketch, sketchLeft, baseline);
g.drawString(editor.sketchName, sketchLeft, baseline);
//String additional = sketchModified ? " \u2020" : "";
//String additional = sketchModified ? " \u00A4" : "";
String additional = sketchModified ? " \u00A7" : "";
//String additional = sketchModified ? " \u2022" : "";
g.drawString(editor.sketchName + additional, sketchLeft, baseline);
//if (!boringUser) g.drawString(user, userLeft, baseline);
if (!boringUser) g.drawString(editor.userName, userLeft, baseline);
+17 -8
View File
@@ -1,6 +1,3 @@
#ifdef EDITOR
import java.awt.*;
import java.awt.event.*;
@@ -10,6 +7,8 @@ public class PdeEditorListener extends KeyAdapter implements FocusListener {
String tabString;
String newline = System.getProperty("line.separator");
PdeEditor editor;
boolean expandTabs;
int tabSize;
boolean autoIndent;
@@ -21,7 +20,9 @@ public class PdeEditorListener extends KeyAdapter implements FocusListener {
int position;
public PdeEditorListener() {
public PdeEditorListener(PdeEditor editor) {
this.editor = editor;
expandTabs = PdeBase.getBoolean("editor.expandTabs", false);
tabSize = PdeBase.getInteger("editor.tabSize", 2);
tabString = spaces.substring(0, tabSize);
@@ -36,7 +37,17 @@ public class PdeEditorListener extends KeyAdapter implements FocusListener {
tc = (TextArea) event.getSource();
deselect();
char c = event.getKeyChar();
//System.err.println((int) c + " " + event.getKeyCode());
if (!editor.sketchModified) {
int code = event.getKeyCode();
if ((code == KeyEvent.VK_BACK_SPACE) || (code == KeyEvent.VK_TAB) ||
(code == KeyEvent.VK_ENTER) || ((c >= 32) && (c < 128))) {
//editor.sketchModified = true;
editor.setSketchModified(true);
}
}
//System.err.println((int)c);
switch ((int) c) {
case ')':
@@ -89,6 +100,7 @@ public class PdeEditorListener extends KeyAdapter implements FocusListener {
break;
case 10: // auto-indent
case 13:
if (autoIndent) {
//System.err.println("auto indenting");
char contents[] = tc.getText().toCharArray();
@@ -143,6 +155,3 @@ public class PdeEditorListener extends KeyAdapter implements FocusListener {
deselect();
}
}
#endif
+68 -9
View File
@@ -2,7 +2,8 @@ import java.awt.*;
import java.awt.event.*;
public class PdeEditorStatus extends Panel implements ActionListener {
public class PdeEditorStatus extends Panel
implements ActionListener /*, Runnable*/ {
static Color bgColor[];
static Color fgColor[];
@@ -11,9 +12,14 @@ public class PdeEditorStatus extends Panel implements ActionListener {
static final int ERROR = 1;
static final int PROMPT = 2;
static final String PROMPT_YES = "yes";
static final String PROMPT_NO = "no";
static final String NO_MESSAGE = "";
static final int YES = 1;
static final int NO = 2;
static final int CANCEL = 3;
static final String PROMPT_YES = "yes";
static final String PROMPT_NO = "no";
static final String PROMPT_CANCEL = "cancel";
static final String NO_MESSAGE = "";
static final int BUTTON_WIDTH = 66;
static final int BUTTON_HEIGHT = 20;
@@ -33,6 +39,9 @@ public class PdeEditorStatus extends Panel implements ActionListener {
Button yesButton;
Button noButton;
Button cancelButton;
//Thread promptThread;
int response;
public PdeEditorStatus(PdeEditor editor) {
@@ -82,20 +91,50 @@ public class PdeEditorStatus extends Panel implements ActionListener {
update();
}
/*
public void run() {
while (Thread.currentThread() == promptThread) {
if (response != 0) {
//System.out.println("stopping prompt thread");
//promptThread.stop();
//System.out.println("exiting prompt loop");
unprompt();
break;
} else {
try {
//System.out.println("inside prompt thread " +
//System.currentTimeMillis());
Thread.sleep(100);
} catch (InterruptedException e) { }
}
}
}
*/
public void prompt(String message) {
mode = PROMPT;
this.message = message;
response = 0;
yesButton.setVisible(true);
noButton.setVisible(true);
cancelButton.setVisible(true);
yesButton.requestFocus();
update();
//promptThread = new Thread(this);
//promptThread.start();
}
// prompt has been handled, re-hide the buttons
public void unprompt() {
yesButton.setVisible(false);
noButton.setVisible(false);
noButton.setVisible(false);
cancelButton.setVisible(false);
//promptThread = null;
empty();
}
@@ -114,16 +153,20 @@ public class PdeEditorStatus extends Panel implements ActionListener {
if (yesButton == null) {
yesButton = new Button(PROMPT_YES);
noButton = new Button(PROMPT_NO);
cancelButton = new Button(PROMPT_CANCEL);
setLayout(null);
yesButton.addActionListener(this);
noButton.addActionListener(this);
cancelButton.addActionListener(this);
add(yesButton);
add(noButton);
add(cancelButton);
yesButton.setVisible(false);
noButton.setVisible(false);
cancelButton.setVisible(false);
}
Dimension size = getSize();
@@ -173,11 +216,14 @@ public class PdeEditorStatus extends Panel implements ActionListener {
protected void setButtonBounds() {
int top = (sizeH - BUTTON_HEIGHT) / 2;
int noLeft = sizeW - PdeEditor.INSET_SIZE - BUTTON_WIDTH;
int cancelLeft = sizeW - PdeEditor.INSET_SIZE - BUTTON_WIDTH;
int noLeft = cancelLeft - PdeEditor.INSET_SIZE - BUTTON_WIDTH;
int yesLeft = noLeft - PdeEditor.INSET_SIZE - BUTTON_WIDTH;
noButton.setBounds(noLeft, top, BUTTON_WIDTH, BUTTON_HEIGHT);
yesButton.setBounds(yesLeft, top, BUTTON_WIDTH, BUTTON_HEIGHT);
noButton.setBounds(noLeft, top, BUTTON_WIDTH, BUTTON_HEIGHT);
cancelButton.setBounds(cancelLeft, top, BUTTON_WIDTH, BUTTON_HEIGHT);
}
@@ -188,10 +234,23 @@ public class PdeEditorStatus extends Panel implements ActionListener {
public void actionPerformed(ActionEvent e) {
if (e.getSource() == noButton) {
System.out.println("clicked no");
//System.out.println("clicked no");
//response = 2;
// shut everything down, clear status, and return
unprompt();
editor.checkModified2();
} else if (e.getSource() == yesButton) {
System.out.println("clicked yes");
//System.out.println("clicked yes");
//response = 1;
// shutdown/clear status, and call checkModified2
unprompt();
editor.doSave(); // assuming that something is set? hmm
//System.out.println("calling checkmodified2");
editor.checkModified2();
} else if (e.getSource() == cancelButton) {
unprompt();
}
}
}
+20 -22
View File
@@ -1,3 +1,7 @@
import java.io.*;
//import java.util.*;
public class PdeRunner implements Runnable {
//DbnGraphics graphics;
//PdeEnvironment env;
@@ -86,27 +90,6 @@ public class PdeRunner implements Runnable {
// throw new Exception("javac support not included");
//#endif
} else if (program.indexOf("// dbn") == 0) {
#ifdef DBN
String pre = "set red 0; set green 1; set blue 2; " +
"set quicktime 0; set tiff 1; set illustrator 2; ";
DbnParser parser =
new DbnParser(DbnPreprocessor.process(pre + program));
DbnToken root = parser.getRoot();
//root.print();
if (!root.findToken(DbnToken.SIZE)) {
graphics.size(101, 101, 1);
}
if (root.findToken(DbnToken.REFRESH)) {
graphics.aiRefresh = false;
}
engine = new DbnEngine(root, graphics);
engine.start();
#else
throw new Exception("dbn support not included");
#endif
} else {
/*
forceStop = true;
@@ -115,7 +98,22 @@ public class PdeRunner implements Runnable {
forceStop = false;
*/
engine = new KjcEngine(program, editor);
//engine = new KjcEngine(program, "lib", editor);
String buildPath =
editor.sketchFile.getParent() + File.separator + "build";
/*
Properties props = System.getProperties();
String cp = props.getProperty("java.class.path");
System.out.println("in: " + cp);
props.put("java.class.path",
cp + File.pathSeparator + buildPath);
String cp2 = props.getProperty("java.class.path");
System.out.println("out: " + cp2);
System.setProperties(props);
*/
engine = new KjcEngine(program, buildPath, editor);
engine.start();
/*
+44 -13
View File
@@ -1,29 +1,60 @@
0031
0031a
X lib/pde.properties should be read using getResource
X otherwise path issues cause trouble (likely under win98)
X take state information out of Header
X cleanup lastFile/lastDirectory
X save (just) last program run in sketch.properties
X coloring of error, message, etc changed in pde.properties
X finish save changes stuff
0031b
X editorlistener shouldn't track menu commands as changes to file
X ctrl keys bksp/del/enter/return/tab then space on up
X indicator for changes?
X need to implement code for whether changes have been made
X check for key events in textarea or something
X if key events, compare contents against the existing file
X userName not getting set before sketchbook menu is built
X add 'refresh list' item to the sketchbook menu
0031c
X ability to set directory for compiling in kjcengine
0031d
X make sure compiling into build directory
X and once compiled there, read all classes for export
_ do backup
_ write class loader or figure out how to change classpath
_ might be able to load classes using forInstance on each file
_ using byte array version of constructor
_ remove everything from build when starting a new build
_ (don't do this until it's clear that it's working well!)
_ userName not getting set before sketchbook menu is built
_ add 'refresh list' item to the sketchbook menu
_ renaming projects
_ sketch: sketch-000 is dumb
_ make sure compiling into build directory
_ remove everything from build when starting a new build
_ and once compiled there, read all classes for export
_ implement popup menu
_ move structure of app/application dirs around a bit
_ renaming projects
_ write message to people who signed up for p5 alpha
_ saving to gzipped 'versions' file
_ autosave every few minutes, also on each compile
_ remove Editor's frame instance, replace refs with PdeBase.frame
_ remove projects if created but nothing happens to them
_ small script to remove CVS directories from a tree
_ remove projects if created but nothing happens to them
_ need to implement code for whether changes have been made
_ check for key events in textarea or something
_ if key events, compare contents against the existing file
casey bugs
a _ mousePressed() not working, also mouseReleased
a _ also has to be public void mousePressed() for kjc
a _ translate is disabling color
a _ (probably because of lighting)
a _ keypressed is not persistent
a _ key repeat in os vs. how java handles it
a _ search java faq for info about getting around it
a X you should be able to create methods in drawing mode
a X this shouldn't work, make void draw() {} to allow
b _ remove Editor's frame instance, replace refs with PdeBase.frame
b _ sketch: sketch-000 is dumb
pdebase simple
_ remove 'encoding' crap from PdeBase