From eccb164175d7846b45493aa3000ba6bf14901754 Mon Sep 17 00:00:00 2001 From: benfry Date: Mon, 8 Jul 2002 03:28:46 +0000 Subject: [PATCH] lots of mega-changes for 32 and heading towards 33.. see done.txt for full details. --- processing/app/PdeBase.java | 48 ++- processing/app/PdeEditor.java | 378 ++++++++++++++----- processing/app/PdeEditorButtons.java | 75 +++- processing/app/PdeEditorHeader.java | 8 +- processing/app/PdeEditorStatus.java | 142 ++++++- processing/app/PdeRunner.java | 11 +- processing/app/PdeSketchbook.java | 66 ---- processing/app/notes.txt | 35 ++ processing/done.txt | 112 ++++++ processing/todo.txt | 534 +++++++++++---------------- 10 files changed, 880 insertions(+), 529 deletions(-) delete mode 100644 processing/app/PdeSketchbook.java diff --git a/processing/app/PdeBase.java b/processing/app/PdeBase.java index 5fb8c9bc2..2b707a169 100644 --- a/processing/app/PdeBase.java +++ b/processing/app/PdeBase.java @@ -78,7 +78,7 @@ public class PdeBase implements ActionListener { } */ - editor = new PdeEditor(/*this,*/ /*program*/); + editor = new PdeEditor(this); frame.setLayout(new BorderLayout()); frame.add("Center", editor); @@ -92,9 +92,13 @@ public class PdeBase implements ActionListener { //rebuildSketchbookMenu(openMenu); menu.add(sketchbookMenu); menu.add(new MenuItem("Save", new MenuShortcut('S'))); + menu.add(new MenuItem("Rename", new MenuShortcut('S', true))); 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))); + item = new MenuItem("Export Application", new MenuShortcut('E', true)); + item.setEnabled(false); + menu.add(item); + //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('F'))); @@ -183,14 +187,20 @@ public class PdeBase implements ActionListener { //} else { //editor.sketchbookOpen(path + File.separator + e.getActionCommand()); //} + //System.out.println("got action in skbkmenulistener " + e); String name = e.getActionCommand(); - editor.skOpen(path, name); - //editor.skOpen(path, name); // + File.separator + name + + //System.out.println("calling editor.skOpen on " + path + " " + name); + //editor.skOpen(path, name); + editor.skOpen(path + File.separator + name, name); //File.separator + name + ".pde"); } } + public void rebuildSketchbookMenu() { + rebuildSketchbookMenu(sketchbookMenu); + } + public void rebuildSketchbookMenu(Menu menu) { menu.removeAll(); @@ -294,24 +304,29 @@ public class PdeBase implements ActionListener { } else if (command.equals("Save")) { editor.doSave(); - } else if (command.equals("Duplicate")) { - editor.skDuplicate(); + } else if (command.equals("Rename")) { + editor.skDuplicateRename(true); - } else if (command.equals("Export")) { + } else if (command.equals("Duplicate")) { + editor.skDuplicateRename(false); + + } else if (command.equals("Export to Web")) { editor.skExport(); } else if (command.equals("Proce55ing.net")) { - // same thing here with runtime - - } else if (command.equals("Reference")) { - /* try { - // need to get the stream from here - Runtime.getRuntime().exec("cmd /c d:\\fry\\processing\\app\\application\\reference\\Transform.html"); + Runtime.getRuntime().exec("c:\\progra~1\\intern~1\\iexplore http://Proce55ing.net"); + //Runtime.getRuntime().exec("start http://Proce55ing.net"); + } catch (IOException e) { + e.printStackTrace(); + } + + } else if (command.equals("Reference")) { + try { + Runtime.getRuntime().exec("cmd /c reference\\environment.html"); } catch (IOException e) { e.printStackTrace(); } - */ } else if (command.equals("Quit")) { editor.doQuit(); @@ -319,15 +334,16 @@ public class PdeBase implements ActionListener { } else if (command.equals("Run")) { - editor.doRun(); + editor.doRun(false); } else if (command.equals("Present")) { - //editor.doPresent(); + editor.doPresent(); } else if (command.equals("Stop")) { editor.doStop(); } else if (command.equals("Refresh")) { + //System.err.println("got refresh"); rebuildSketchbookMenu(sketchbookMenu); } //if (command.equals("Save QuickTime movie...")) { diff --git a/processing/app/PdeEditor.java b/processing/app/PdeEditor.java index f373015bb..f51909f0e 100644 --- a/processing/app/PdeEditor.java +++ b/processing/app/PdeEditor.java @@ -1,5 +1,3 @@ -#ifdef EDITOR - import java.awt.*; import java.awt.event.*; import java.io.*; @@ -47,16 +45,18 @@ public class PdeEditor extends Panel { PdeRunner runner; Frame frame; - Window fullScreenWindow; + Window presentationWindow; static final int GRID_SIZE = 33; static final int INSET_SIZE = 5; boolean running; + boolean presenting; + PdeBase base; - public PdeEditor(/*PdeBase app,*/ /*String program*/) { - //this.app = app; + public PdeEditor(PdeBase base /*String program*/) { + this.base = base; setLayout(new BorderLayout()); @@ -172,7 +172,7 @@ public class PdeEditor extends Panel { } - public void doRun() { + public void doRun(boolean presentation) { //doStop(); doClose(); running = true; @@ -186,6 +186,95 @@ public class PdeEditor extends Panel { } + public void doPresent() { + // full screen, but also no frame on the launched window + + if (presentationWindow == null) { + Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); + if (PdeBase.isMacintosh()) { + 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); + //System.out.println(insets); + + presentationWindow.setBounds(-insets.left, -insets.top, + screen.width + insets.left + insets.right, + screen.height + insets.top + insets.bottom); + } else { + presentationWindow = new Window(new Frame()); + presentationWindow.setBounds(0, 0, screen.width, screen.height); + } + + // full screen window needs to have method to stop + // for now, click on small 'stop' text in lower-lefthand corner + // will a label catch mouse events? + Label label = new Label("stop"); + presentationWindow.setLayout(null); + presentationWindow.add(label); + Dimension labelSize = label.getPreferredSize(); + label.setBounds(5, screen.height - 5 - labelSize.height, + labelSize.width, labelSize.height); + + Color presentationBgColor = + PdeBase.getColor("run.present.bgcolor", new Color(102, 102, 102)); + presentationWindow.setBackground(presentationBgColor); + + /* + presentationWindow.addWindowListener(new WindowAdapter() { + public void windowActivated(WindowEvent e) { + System.out.println("activated"); + } + } + ); + */ + presentationWindow.addFocusListener(new FocusAdapter() { + public void focusGained(FocusEvent e) { + //System.out.println("activated"); + /*PdeApplication.*/ + if (frame != null) frame.toFront(); + } + } + ); + } + presentationWindow.show(); + presentationWindow.toFront(); + + // not sure what to do with applet.. + // (since i can't bring the browser window to the front) + // unless there's a method in AppletContext + //if (frame != null) frame.toFront(); + + /* + try { + //System.out.println("my parent is " + getParent()); + ((PdeApplication)getParent()).frame.toFront(); + } catch (Exception e) { } + */ + + try { + ((KjcEngine)(runner.engine)).window.toFront(); + } catch (Exception e) { + // rather than writing code to check all the posible + // errors with the above statement, just fail quietly + //System.out.println("couldn't bring kjc engine window forward"); + } + //if (runner.engine != null) { + //if (runner.engine instanceof KjcEngine) { + //} + //} + + //buttons.clear(); + + presenting = true; + doRun(true); + } + + #ifdef RECORDER public void doRecord() { //doStop(); @@ -203,6 +292,11 @@ public class PdeEditor extends Panel { terminate(); buttons.clear(); running = false; + + if (presenting) { + presentationWindow.hide(); + presenting = false; + } } @@ -291,14 +385,14 @@ public class PdeEditor extends Panel { do { int index = (int) (Math.random() * 1000); - sketchName = "sketch-" + pad3(index); + sketchName = "sketch_" + pad3(index); sketchDir = new File(sketchbookDir, sketchName); } while (sketchDir.exists()); // mkdir for new project name sketchDir.mkdirs(); new File(sketchDir, "data").mkdirs(); - new File(sketchDir, "build").mkdirs(); + //new File(sketchDir, "build").mkdirs(); // make empty pde file File sketchFile = new File(sketchDir, sketchName + ".pde"); @@ -307,6 +401,9 @@ public class PdeEditor extends Panel { // make 'data' 'applet' dirs inside that // actually, don't, that way can avoid too much extra mess + // rebuild the menu here + base.rebuildSketchbookMenu(); + // now open it up //skOpen(sketchFile, sketchDir); handleOpen(sketchName, sketchFile, sketchDir); @@ -318,8 +415,8 @@ public class PdeEditor extends Panel { } static String pad3(int what) { - if (what < 10) return "000" + what; - else if (what < 100) return "00" + what; + if (what < 10) return "00" + what; + else if (what < 100) return "0" + what; else return String.valueOf(what); } @@ -380,6 +477,10 @@ public class PdeEditor extends Panel { protected void handleOpen(String isketchName, File isketchFile, File isketchDir) { + if (!isketchFile.exists()) { + status.error("no file named " + isketchName); + return; + } //System.err.println("i'm here!"); //System.err.println(isketchName); //System.err.println(isketchFile); @@ -417,7 +518,7 @@ public class PdeEditor extends Panel { } else { textarea.setText(""); } - + //System.out.println("should be done opening"); sketchName = isketchName; sketchFile = isketchFile; sketchDir = isketchDir; @@ -491,18 +592,110 @@ public class PdeEditor extends Panel { } - public void skDuplicate() { - System.err.println("sketch duplicate not yet implemented"); + public void skDuplicateRename(boolean rename) { + status.edit(rename ? "Rename to?" : "Duplicate title?", + sketchName, rename); + } + + public void skDuplicateRename2(String newSketchName, boolean rename) { + if (newSketchName.equals(sketchName)) { + // explain to the user that they're lame + System.err.println("what kind of a loser " + + (rename ? "renames the directory" : + "creates a duplicate") + + " using the same name?"); + return; + } + //System.out.println("rename to " + newname); + doSave(); // save changes before renaming.. risky but oh well + // call skOpen2("sketchbook/default/example1", "example1"); + // which is sketchDir, sketchName + File newSketchDir = new File(sketchDir.getParent() + + File.separator + newSketchName); + File newSketchFile = new File(newSketchDir, newSketchName + ".pde"); + //System.out.println("new shite:"); + //System.out.println(newSketchName); + //System.out.println(newSketchDir); + //System.out.println(newSketchFile); + //boolean result = sketchDir.renameTo(newSketchDir); + //System.out.println(result); + + /* + System.out.println("move \"" + sketchFile.getPath() + "\" " + + newSketchName + ".pde"); + System.out.println("move \"" + sketchDir.getPath() + "\" " + + newSketchName); + */ + + // make new dir + newSketchDir.mkdirs(); + // copy the sketch file itself with new name + copyFile(sketchFile, newSketchFile); + + // copy everything from the old dir to the new one + copyDir(sketchDir, newSketchDir); + + // remove the old sketch file from the new dir + new File(newSketchDir, sketchName + ".pde").delete(); + + // remove the old dir (!) + if (rename) removeDir(sketchDir); + // oops.. has to be done before opening, otherwise the new + // dir is set to sketchDir.. duh.. + + base.rebuildSketchbookMenu(); + + // open the new guy + if (rename) handleOpen(newSketchName, newSketchFile, newSketchDir); + + /* + try { + Runtime rt = Runtime.getRuntime(); + System.err.println("22"); + Process process = + rt.exec("cmd /c move \"" + sketchFile.getPath() + "\" " + + newSketchName + ".pde"); + System.err.println("1"); + InputStream errors = process.getErrorStream(); + System.err.println("33"); + while (errors.available() > 0) { + System.err.println("reading errors"); + System.out.print((char)errors.read()); + } + System.err.println("waiting for"); + try { + process.waitFor(); + } catch (InterruptedException e) { } + System.err.println("done maybe"); + //Runtime.getRuntime().exec("move \"" + sketchDir.getPath() + "\" " + + // newSketchName); + } catch (IOException e) { + e.printStackTrace(); + } + */ + + //if (result) { + //if (sketchDir.renameTo(newSketchDir)) { + //} else { + //System.err.println("couldn't rename " + sketchDir + " to " + + // newSketchDir); + //} } + //public void skDuplicate() { + //System.err.println("sketch duplicate not yet implemented"); + //} + + public void skExport() { + message("Exporting for the web..."); File appletDir = new File(sketchDir, "applet"); handleExport(appletDir, sketchName, new File(sketchDir, "data")); } public void doExport() { - message("Exporting to applet..."); + message("Exporting for the web..."); String s = textarea.getText(); FileDialog fd = new FileDialog(new Frame(), "Create applet project named...", @@ -536,7 +729,11 @@ public class PdeEditor extends Panel { String program = textarea.getText(); // create the project directory - KjcEngine engine = new KjcEngine(program, appletDir.getPath(), this); + // pass null for datapath because the files shouldn't be + // copied to the build dir.. that's only for the temp stuff + KjcEngine engine = new KjcEngine(program, appletDir.getPath(), + null, this); + //dataDir.getPath(), this); //File projectDir = new File(appletDir, projectName); //projectDir.mkdirs(); appletDir.mkdirs(); @@ -549,10 +746,12 @@ public class PdeEditor extends Panel { return; } + // not necessary, now compiles into applet dir + //System.out.println("exportskname = " + exportSketchName); // copy .java to project dir - String javaName = exportSketchName + ".java"; + //String javaName = exportSketchName + ".java"; //copyFile(new File(javaName), new File(projectDir, javaName)); - copyFile(new File(javaName), new File(appletDir, javaName)); + //copyFile(new File(javaName), new File(appletDir, javaName)); // remove temporary .java and .class files //engine.cleanup(); @@ -634,17 +833,34 @@ public class PdeEditor extends Panel { // add the project's .class to the jar // actually, these should grab everything from the build directory // since there may be some inner classes + /* entry = new ZipEntry(exportSketchName + ".class"); zos.putNextEntry(entry); zos.write(grabFile(new File("lib", exportSketchName + ".class"))); zos.closeEntry(); + */ + // add any .class files from the applet dir, then delete them + String classfiles[] = appletDir.list(); + for (int i = 0; i < classfiles.length; i++) { + if (classfiles[i].endsWith(".class")) { + entry = new ZipEntry(classfiles[i]); + zos.putNextEntry(entry); + zos.write(grabFile(new File(appletDir, classfiles[i]))); + zos.closeEntry(); + } + } + for (int i = 0; i < classfiles.length; i++) { + if (classfiles[i].endsWith(".class")) { + new File(appletDir, classfiles[i]).delete(); // not yet + } + } // close up the jar file zos.flush(); zos.close(); //zipOutputFile.close(); - engine.cleanup(); + //engine.cleanup(); // no! buildPath is applet! message("Done exporting."); @@ -696,6 +912,8 @@ public class PdeEditor extends Panel { } protected void doQuit2() { + doStop(); + // write sketch.properties try { URL url = getClass().getResource("buttons.gif"); @@ -829,84 +1047,6 @@ public class PdeEditor extends Panel { } - public void enableFullScreen() { - if (fullScreenWindow == null) { - Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); - if (PdeBase.isMacintosh()) { - fullScreenWindow = new Frame(); - - // mrj is still (with version 2.2.x) a piece of shit, - // and doesn't return valid insets for frames - //fullScreenWindow.pack(); // make a peer so insets are valid - //Insets insets = fullScreenWindow.getInsets(); - // the extra +20 is because the resize boxes intrude - Insets insets = new Insets(21, 5, 5 + 20, 5); - //System.out.println(insets); - - fullScreenWindow.setBounds(-insets.left, -insets.top, - screen.width + insets.left + insets.right, - screen.height + insets.top + insets.bottom); - } else { - fullScreenWindow = new Window(new Frame()); - fullScreenWindow.setBounds(0, 0, screen.width, screen.height); - } - Color fullScreenBgColor = - PdeBase.getColor("fullscreen.bgcolor", new Color(102, 102, 102)); - fullScreenWindow.setBackground(fullScreenBgColor); - - /* - fullScreenWindow.addWindowListener(new WindowAdapter() { - public void windowActivated(WindowEvent e) { - System.out.println("activated"); - } - } - ); - */ - fullScreenWindow.addFocusListener(new FocusAdapter() { - public void focusGained(FocusEvent e) { - //System.out.println("activated"); - /*PdeApplication.*/ - if (frame != null) frame.toFront(); - } - } - ); - } - fullScreenWindow.show(); - fullScreenWindow.toFront(); - - // not sure what to do with applet.. - // (since i can't bring the browser window to the front) - // unless there's a method in AppletContext - //if (frame != null) frame.toFront(); - - /* - try { - //System.out.println("my parent is " + getParent()); - ((PdeApplication)getParent()).frame.toFront(); - } catch (Exception e) { } - */ - - try { - ((KjcEngine)(runner.engine)).window.toFront(); - } catch (Exception e) { - // rather than writing code to check all the posible - // errors with the above statement, just fail quietly - //System.out.println("couldn't bring kjc engine window forward"); - } - //if (runner.engine != null) { - //if (runner.engine instanceof KjcEngine) { - //} - //} - - buttons.clear(); - } - - public void disableFullScreen() { - fullScreenWindow.hide(); - buttons.clear(); - } - - public void terminate() { // part of PdeEnvironment runner.stop(); message(EMPTY); @@ -1021,12 +1161,52 @@ public class PdeEditor extends Panel { while ((bytesRead = from.read(buffer)) != -1) { to.write(buffer, 0, bytesRead); } + to.flush(); + from.close(); // ?? + to.close(); // ?? + + bfile.setLastModified(afile.lastModified()); // jdk13 required + } catch (IOException e) { e.printStackTrace(); } } + + static protected void copyDir(File sourceDir, File targetDir) { + System.out.println("dir " + sourceDir); + System.out.println(" -> " + targetDir); + System.out.println(); + + String files[] = sourceDir.list(); + for (int i = 0; i < files.length; i++) { + if (files[i].equals(".") || files[i].equals("..")) continue; + File source = new File(sourceDir, files[i]); + File target = new File(targetDir, files[i]); + if (source.isDirectory()) { + target.mkdirs(); + copyDir(source, target); + target.setLastModified(source.lastModified()); + } else { + copyFile(source, target); + } + } + } + + static protected void removeDir(File dir) { + System.out.println("removing " + dir); + + String files[] = dir.list(); + for (int i = 0; i < files.length; i++) { + if (files[i].equals(".") || files[i].equals("..")) continue; + File dead = new File(dir, files[i]); + if (!dead.isDirectory()) { + if (!dead.delete()) System.err.println("couldn't delete " + dead); + } else { + removeDir(dead); + //dead.delete(); + } + } + dir.delete(); + } } - -#endif - diff --git a/processing/app/PdeEditorButtons.java b/processing/app/PdeEditorButtons.java index 2724eaee3..17013e952 100644 --- a/processing/app/PdeEditorButtons.java +++ b/processing/app/PdeEditorButtons.java @@ -1,16 +1,14 @@ -#ifdef EDITOR - - import java.awt.*; +import java.awt.event.*; -public class PdeEditorButtons extends Panel { +public class PdeEditorButtons extends Panel /*implements ActionListener*/ { static final String EMPTY_STATUS = " "; // run, stop, save, export, open static final String title[] = { - "", "run", "stop", "save", "open", "export" + "", "run", "stop", "new", "open", "save", "export" //"", "Run", "Stop", "Save", "Open", "Export" //"Run", "Stop", "Close", //"Open", "Save", "Export Applet", "Print", "Beautify", @@ -21,13 +19,14 @@ public class PdeEditorButtons extends Panel { static final int BUTTON_WIDTH = PdeEditor.GRID_SIZE; //33; static final int BUTTON_HEIGHT = PdeEditor.GRID_SIZE; //33; - static final int NOTHING = 0; - static final int RUN = 1; - static final int STOP = 2; + static final int NOTHING = 0; + static final int RUN = 1; + static final int STOP = 2; - static final int SAVE = 3; + static final int NEW = 3; static final int OPEN = 4; - static final int EXPORT = 5; + static final int SAVE = 5; + static final int EXPORT = 6; //static final int PRINT = 6; //static final int BEAUTIFY = 7; @@ -51,6 +50,8 @@ public class PdeEditorButtons extends Panel { int currentRollover; int currentSelection; + PopupMenu popup; + int buttonCount; int state[]; Image stateImage[]; @@ -72,8 +73,9 @@ public class PdeEditorButtons extends Panel { which[buttonCount++] = NOTHING; which[buttonCount++] = RUN; which[buttonCount++] = STOP; - which[buttonCount++] = SAVE; + which[buttonCount++] = NEW; which[buttonCount++] = OPEN; + which[buttonCount++] = SAVE; which[buttonCount++] = EXPORT; currentRollover = -1; @@ -311,23 +313,64 @@ public class PdeEditorButtons extends Panel { currentSelection = sel; setState(sel, ACTIVE, true); + if (currentSelection == OPEN) { + if (popup == null) { + popup = new PopupMenu(); + add(popup); + } + //popup.addActionListener(this); + editor.base.rebuildSketchbookMenu(popup); + popup.show(this, x, y); + } return true; } + /* + public void actionPerformed(ActionEvent e) { + System.err.println(e); + if (e.getSource() == popup) { + System.err.println("posting bogus mouseup"); + mouseUp(null, 0, 0); + } + } + */ + + public boolean mouseUp(Event e, int x, int y) { //switch (which[sel]) { switch (currentSelection) { - case RUN: editor.doRun(); break; + case RUN: + if (e.shiftDown()) { + editor.doPresent(); + } else { + editor.doRun(false); + } + break; + case STOP: setState(RUN, INACTIVE, true); editor.doStop(); break; //case CLOSE: editor.doClose(); break; - case OPEN: editor.doOpen(); break; + //case OPEN: editor.doOpen(); break; + /* + case OPEN: + System.err.println("popup mouseup"); + //popup.setVisible(false); + remove(popup); + // kill the popup? + //PopupMenu popup = new PopupMenu(); + //editor.base.rebuildSketchbookMenu(popup); + //popup.show(this, x, y); + break; + */ //editor.doOpen(this, BUTTON_WIDTH, OPEN * BUTTON_HEIGHT); - case SAVE: editor.doSaveAs(); break; - case EXPORT: editor.doExport(); break; + case NEW: editor.skNew(); break; + + //case SAVE: editor.doSaveAs(); break; + case SAVE: editor.doSave(); break; + case EXPORT: editor.skExport(); break; //case PRINT: editor.doPrint(); break; //case BEAUTIFY: editor.doBeautify(); break; @@ -399,5 +442,3 @@ public class PdeEditorButtons extends Panel { return new Dimension(BUTTON_WIDTH, (BUTTON_COUNT + 1)*BUTTON_HEIGHT); } } - -#endif diff --git a/processing/app/PdeEditorHeader.java b/processing/app/PdeEditorHeader.java index 89ba4feb4..86daabfdb 100644 --- a/processing/app/PdeEditorHeader.java +++ b/processing/app/PdeEditorHeader.java @@ -135,6 +135,9 @@ public class PdeEditorHeader extends Panel /* implements ActionListener*/ { sketchLeft = sketchTitleLeft + metrics.stringWidth(SKETCH_TITLER) + PdeEditor.INSET_SIZE; + int modifiedLeft = sketchLeft + + metrics.stringWidth(editor.sketchName) + PdeEditor.INSET_SIZE; + //sketch = editor.sketchName; //if (sketch == null) sketch = ""; //} @@ -157,15 +160,16 @@ public class PdeEditorHeader extends Panel /* implements ActionListener*/ { g.setColor(secondaryColor); g.drawString(SKETCH_TITLER, sketchTitleLeft, baseline); + if (sketchModified) g.drawString("\u00A7", modifiedLeft, baseline); if (!boringUser) g.drawString(USER_TITLER, userTitleLeft, baseline); g.setColor(primaryColor); //g.drawString(sketch, 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); + g.drawString(editor.sketchName, sketchLeft, baseline); + //if (!boringUser) g.drawString(user, userLeft, baseline); if (!boringUser) g.drawString(editor.userName, userLeft, baseline); diff --git a/processing/app/PdeEditorStatus.java b/processing/app/PdeEditorStatus.java index 0b5cfad25..c2e8f448d 100644 --- a/processing/app/PdeEditorStatus.java +++ b/processing/app/PdeEditorStatus.java @@ -7,18 +7,20 @@ public class PdeEditorStatus extends Panel static Color bgColor[]; static Color fgColor[]; - static final int NOTICE = 0; static final int ERROR = 1; static final int PROMPT = 2; + static final int EDIT = 3; static final int YES = 1; static final int NO = 2; static final int CANCEL = 3; + static final int OK = 4; static final String PROMPT_YES = "yes"; static final String PROMPT_NO = "no"; static final String PROMPT_CANCEL = "cancel"; + static final String PROMPT_OK = "ok"; static final String NO_MESSAGE = ""; static final int BUTTON_WIDTH = 66; @@ -40,6 +42,9 @@ public class PdeEditorStatus extends Panel Button yesButton; Button noButton; Button cancelButton; + Button okButton; + TextField editField; + boolean editRename; //Thread promptThread; int response; @@ -49,20 +54,24 @@ public class PdeEditorStatus extends Panel empty(); if (bgColor == null) { - bgColor = new Color[3]; + bgColor = new Color[4]; bgColor[0] = PdeBase.getColor("editor.status.notice.bgcolor", - new Color(102, 102, 102)); + new Color(102, 102, 102)); bgColor[1] = PdeBase.getColor("editor.status.error.bgcolor", - new Color(102, 26, 0)); + new Color(102, 26, 0)); bgColor[2] = PdeBase.getColor("editor.status.prompt.bgcolor", - new Color(204, 153, 0)); - fgColor = new Color[3]; + new Color(204, 153, 0)); + bgColor[3] = PdeBase.getColor("editor.status.prompt.bgcolor", + new Color(204, 153, 0)); + fgColor = new Color[4]; fgColor[0] = PdeBase.getColor("editor.status.notice.fgcolor", - new Color(255, 255, 255)); + new Color(255, 255, 255)); fgColor[1] = PdeBase.getColor("editor.status.error.fgcolor", - new Color(255, 255, 255)); + new Color(255, 255, 255)); fgColor[2] = PdeBase.getColor("editor.status.prompt.fgcolor", - new Color(0, 0, 0)); + new Color(0, 0, 0)); + fgColor[3] = PdeBase.getColor("editor.status.prompt.fgcolor", + new Color(0, 0, 0)); } } @@ -139,6 +148,28 @@ public class PdeEditorStatus extends Panel } + public void edit(String message, String dflt, boolean rename) { + mode = EDIT; + this.message = message; + this.editRename = rename; + + response = 0; + okButton.setVisible(true); + cancelButton.setVisible(true); + editField.setText(dflt); + editField.setVisible(true); + editField.requestFocus(); + + update(); + } + + public void unedit() { + okButton.setVisible(false); + cancelButton.setVisible(false); + editField.setVisible(false); + empty(); + } + public void update() { Graphics g = this.getGraphics(); if (g != null) paint(g); @@ -154,19 +185,97 @@ public class PdeEditorStatus extends Panel yesButton = new Button(PROMPT_YES); noButton = new Button(PROMPT_NO); cancelButton = new Button(PROMPT_CANCEL); + okButton = new Button(PROMPT_OK); setLayout(null); yesButton.addActionListener(this); noButton.addActionListener(this); cancelButton.addActionListener(this); + okButton.addActionListener(this); add(yesButton); add(noButton); add(cancelButton); + add(okButton); yesButton.setVisible(false); noButton.setVisible(false); cancelButton.setVisible(false); + okButton.setVisible(false); + + editField = new TextField(); + editField.addActionListener(this); + editField.addKeyListener(new KeyAdapter() { + public void keyPressed(KeyEvent event) { + int c = event.getKeyChar(); + int code = event.getKeyCode(); + + if (code == KeyEvent.VK_ENTER) { + // accept the input + editor.skDuplicateRename2(editField.getText(), editRename); + unedit(); + event.consume(); + + } else if ((code == KeyEvent.VK_BACK_SPACE) || + (code == KeyEvent.VK_DELETE) || + (code == KeyEvent.VK_RIGHT) || + (code == KeyEvent.VK_LEFT) || + (code == KeyEvent.VK_UP) || + (code == KeyEvent.VK_DOWN) || + (code == KeyEvent.VK_HOME) || + (code == KeyEvent.VK_END) || + (code == KeyEvent.VK_SHIFT)) { + + } else if (code == KeyEvent.VK_ESCAPE) { + unedit(); + editor.buttons.clear(); + event.consume(); + + } else if (c == ' ') { + // if a space, insert an underscore + //editField.insert("_", editField.getCaretPosition()); + /* tried to play nice and see where it got me + editField.dispatchEvent(new KeyEvent(editField, + KeyEvent.KEY_PRESSED, + System.currentTimeMillis(), + 0, 45, '_')); + */ + //System.out.println("start/end = " + + // editField.getSelectionStart() + " " + + // editField.getSelectionEnd()); + String t = editField.getText(); + //int p = editField.getCaretPosition(); + //editField.setText(t.substring(0, p) + "_" + t.substring(p)); + //editField.setCaretPosition(p+1); + int start = editField.getSelectionStart(); + int end = editField.getSelectionEnd(); + editField.setText(t.substring(0, start) + "_" + + t.substring(end)); + event.consume(); + + } else if (c == '_') { + // everything fine + + } else if (((code >= 'A') && (code <= 'Z')) && + (((c >= 'A') && (c <= 'Z')) || + ((c >= 'a') && (c <= 'z')))) { + // everything fine, catches upper and lower + + } else if ((c >= '0') && (c <= '9')) { + if (editField.getCaretPosition() == 0) { + // number not allowed as first digit + //System.out.println("bad number bad"); + event.consume(); + } + } else { + event.consume(); + //System.out.println("code is " + code + " char = " + c); + } + //System.out.println("code is " + code + " char = " + c); + } + }); + add(editField); + editField.setVisible(false); } Dimension size = getSize(); @@ -224,6 +333,10 @@ public class PdeEditorStatus extends Panel yesButton.setBounds(yesLeft, top, BUTTON_WIDTH, BUTTON_HEIGHT); noButton.setBounds(noLeft, top, BUTTON_WIDTH, BUTTON_HEIGHT); cancelButton.setBounds(cancelLeft, top, BUTTON_WIDTH, BUTTON_HEIGHT); + + editField.setBounds(yesLeft-BUTTON_WIDTH, top, + BUTTON_WIDTH*2, BUTTON_HEIGHT); + okButton.setBounds(noLeft, top, BUTTON_WIDTH, BUTTON_HEIGHT); } @@ -250,7 +363,16 @@ public class PdeEditorStatus extends Panel editor.checkModified2(); } else if (e.getSource() == cancelButton) { - unprompt(); + if (mode == PROMPT) unprompt(); + if (mode == EDIT) unedit(); + editor.buttons.clear(); + + } else if (e.getSource() == okButton) { + editor.skDuplicateRename2(editField.getText(), editRename); + unedit(); + + } else if (e.getSource() == editField) { + System.out.println("editfield: " + e); } } } diff --git a/processing/app/PdeRunner.java b/processing/app/PdeRunner.java index 1184808b9..7ef4272bb 100644 --- a/processing/app/PdeRunner.java +++ b/processing/app/PdeRunner.java @@ -99,8 +99,12 @@ public class PdeRunner implements Runnable { */ //engine = new KjcEngine(program, "lib", editor); - String buildPath = - editor.sketchFile.getParent() + File.separator + "build"; + //this.buildPath = "lib" + File.separator + "build"; // TEMPORARY + //String buildPath = + //editor.sketchFile.getParent() + File.separator + "build"; + String buildPath = "lib" + File.separator + "build"; // TEMPORARY + String dataPath = + editor.sketchFile.getParent() + File.separator + "data"; /* Properties props = System.getProperties(); @@ -113,7 +117,7 @@ public class PdeRunner implements Runnable { System.setProperties(props); */ - engine = new KjcEngine(program, buildPath, editor); + engine = new KjcEngine(program, buildPath, dataPath, editor); engine.start(); /* @@ -161,6 +165,7 @@ public class PdeRunner implements Runnable { public void stop() { if (engine != null) { engine.stop(); + ((KjcEngine)engine).cleanup(); /* if (forceStop) { thread.stop(); diff --git a/processing/app/PdeSketchbook.java b/processing/app/PdeSketchbook.java deleted file mode 100644 index a8de00ef8..000000000 --- a/processing/app/PdeSketchbook.java +++ /dev/null @@ -1,66 +0,0 @@ -#ifdef HELL_HAS_FROZEN_OVER - - -//import at.dms.kjc.*; - - -public class PdeSketchbook { - int fileCount; - String files[] = new String[100]; - long lastCompile[]; - boolean shouldCompile[]; - - at.dms.kjc.Main compiler; - - - public PdeSketchbook() { - compiler = new at.dms.kjc.Main(); - } - - - public void compile() { - buildFileList(); - shouldCompile = new boolean[fileCount]; - - // read cache that lists when all the last compiles were - int cacheCount = 0; - try { - DataInputStream dis = - new DataInputStream(new FileInputStream("lib/sketchbook/cache")); - lastUpdate = dis.readLong(); - } catch (IOException e) { } - - // search through sketchbook directory - // and compile everything that's new since last run - - } - - - public void buildFileList() { - buildFileList("sketchbook"); - fileCount = 0; - } - - public void buildFileList(String base) { - File dir = new File(base); - String listing[] = dir.list(); - for (int i = 0; i < listing.length; i++) { - String fullname = base + File.separator + listing[i]; - - if (listing[i].endsWith(".java")) { - if (files.length == fileCount) { - String temp[] = new String[fileCount<<1]; - System.arraycopy(files, 0, temp, 0, fileCount); - files = temp; - } - files[fileCount++] = fullname; - - } else if (new File(fullname).isDirectory) { - buildFileList(fullname); - } - } - } -} - - -#endif diff --git a/processing/app/notes.txt b/processing/app/notes.txt index a95e24f0e..a9125a9e0 100644 --- a/processing/app/notes.txt +++ b/processing/app/notes.txt @@ -1,3 +1,38 @@ +ABOUT REV 0032 + +- another major release that irons out issues of export and + the toolbar. a button for a new project is included, and + the toolbar items properly open/load/save entries to/from + the sketchbook. export should be working, as should external + files accessed via getImage/getStream/etc. + + +ABOUT REV 0031 + +- this is a major release, representing several victories. + most important: sketchbook is finally in there. every piece + of work is a 'sketch', a very lightweight project setup. + +- export has not been tested and has a good bit of new code + so that may be problematic. + +- menubar with all available options--note that these relate to + sketchbook, and that the toolbar buttons may not work as well. + use menus/key commands where possible(!) + +- generally more application-like with prompts for the user + for saving changes when closing a sketch or quitting. + editor now keeps track of changes made. window positions and + the last sketch opened are saved. + +- concept of a user name associated with the app, right now + just set to 'default' but in beta will be able to change + the name for workshops and general use. + +- current items in sketchbook (serial/dbn) aren't in correct format, + and won't work if you switch to them + + ABOUT REV 0030 - fix bug where comments were being removed from exported files diff --git a/processing/done.txt b/processing/done.txt index 4ea47892c..799fbdcff 100644 --- a/processing/done.txt +++ b/processing/done.txt @@ -1,3 +1,115 @@ +0032 +already finished +X need to update PdeKeyListener for new ui.. +X remove open, add d for duplicate, r for rename, others ? +X 'open' button is a switch-to button +X pops up list of everything in the sketchbook +o first item is 'new sketch', followed by delimeter +X next is list of subdirs other than current user, then delim +X the rest are the items in the current user's folder +X need 'new' button on the toolbar (or first sketch menuitem?) +o the zero looking one might be good (instead of export) +o export could be three circles in a row, overlapping +X everything is a project.. what about short snippets of code? +X this version won't be able to access everything from scrapbook +X (that requires a more robust class loader) +X sketch.properties contains the last program run +X also the window positions, etc +X saves screen size, so if screen size changed, window pos reset +X if it doesn't exist, starts with a new project +X for a new project, name it untitled-0001 or as appropriate +X so that previous projects aren't written over +X verify save when +X closing p5 window +X moving to other sketch +X NullPointerException on startup in pde editor buttons +X shows up on slower machines, probably images not loaded yet +X use a vm that won't destroy the screen like sun/ibm does +X this means msft or newer version of jdk +X if default user, don't show the 'user' string in pde window +X item in pde.properties to set the name of the current user +X exporting +X exporting applets that have custom name problems: +X if extends processingapplet, the name user types must be same +X gets confused about paths and puts boogers in weird places +X doesn't compile correctly (must first compile with play) +X doesn't include additional (private) classes +X when exporting 'name of folder for export...' +X default name should be from public class +X because otherwise errors are happening +X or name from user only determines folder name +X if extends ProcessingApplet [more compatible] +X make sure export is compiling first +X right now have to hit play and then hit export (?) +X file structure for export +X need to set project name for files +X include other .class files built besides the main one +X compile into 'classes' folder +X include referenced image and font files (can't do if numbered) +X make close() work to kill applet in kjc +X save window x, y, width, height to pde.properties on exit +X stderr in red color +X 'data' directory for all media +X make included media part of the .jar file +X it's really a pain to use external files in processing +X getStream sucks (zach rewrote) +X should be able to work for application or applets +X may want to use getResource() (to get things from .jar files) +X remove .java and .class files for compiled classes +X (just clean up the boogers afterwards) +X compiling .java files leaves the .class files next to the .java +X make sure all the dirs in sketchbook added to classpath on startup +o if new dir added, must restart processing (this is acceptable) +X importing images doesn't work (?) +0032a +X put 'modified' indicator in the darker color +X fix bug with opening sketches from the menu (grr) +X need to check if file.exists() when opening +X otherwise the exception doesn't get caught and app hangs +X switch to using a 'build' directory in lib for everything +X lib\build can be added to the classpath at startup +X cleanout build directory on each run (delete .class/.java) +X temporary until classloader issues worked out +X implement popup menu +0032b +X add 'new' button (and complete ui) +X make toolbars work with sk +X make 'data' dir work with build +X empty contents and change bagel to use getResource +X also use getResource("data" + ) +X make export work again +0032c +X getData -> gets contents of stream, puts into byte array +X remove everything from build when starting a new build +X (don't do this until it's clear that it's working well!) + + +0031 +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 +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 +X ability to set directory for compiling in kjcengine +X make sure compiling into build directory +X and once compiled there, read all classes for export +X write class loader or figure out how to change classpath +X might be able to load classes using forInstance on each file +X using byte array version of constructor +X you should be able to create methods in drawing mode +X this shouldn't work, make void draw() {} to allow + + 0030 X attempt to fold serial into bapplet, but mostly fail X convert color -> int diff --git a/processing/todo.txt b/processing/todo.txt index 2830ec8b5..68b5fb475 100644 --- a/processing/todo.txt +++ b/processing/todo.txt @@ -1,70 +1,28 @@ -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 +0033a +X implement 'duplicate' +X implement renaming of projects +X renaming projects +X make sure people don't use - or other illegal chars +X on export or naming sketches--no spaces(!) +o changed by clicking on the name and typing +X new/duplicate/rename should rebuild skopen menu +X item to launch proce55ing.net +X item to launch reference in browser -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 +0033b +X check all menus to make sure they all work/make sense +X disable the ones that aren't implemented +X in progress working on presentation mode -0031c -X ability to set directory for compiling in kjcengine +0033c -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!) - -_ 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 projects if created but nothing happens to them -_ small script to remove CVS directories from a tree - -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 -_ only existed b/c of reading as bytes and not using jdk11 methods -_ cleanup program/inline_program crap.. take out scheme stuff -_ better readFile/loadImage inside PdeBase -_ temp array should be resizable inside readFile -_ use getresource for loading image +a _ write message to people who signed up for p5 alpha +a _ collapse pdeengine/pderunner/kjcengine to some extent play +a _ implement presentation mode +_ editor frame doesn't have to be in front +_ include button in present mode to bring editor back up a _ add frame to launched window a X add maximize event catcher to make fullscreen a o doesn't work, because of screen sizing stupidity @@ -73,236 +31,55 @@ a _ make all windows 120x120? a _ default program should be large, 300x200 or so a _ what if it's smaller? boundary of color 51, 51, 51 around it -bagel-related -_ background(), fill(), stroke() using color datatype -_ check 0xff high bits to see if it's an int gray value or a color -_ fix curve()/bezier() -_ also make curve() work as 6 point with doubled endpoints -_ noClear -- implement with noBackground -_ need to set bg color even if updated -_ update/noUpdate() could also be done to force explicit updates only -_ for ui-type applications that don't need to continually redraw +bagel +a _ mousePressed() not working, also mouseReleased +a _ also has to be public void mousePressed() for kjc +a _ background(), fill(), stroke() using color datatype +a _ check 0xff high bits to see if it's an int gray value or a color +a _ fix curve()/bezier() +a _ also make curve() work as 6 point with doubled endpoints +a _ translate is disabling color +a _ (probably because of lighting) + +macos +a _ implement menuitem to load ref and to launch p5.net +a _ need fxns to test platform and java version +a _ how to make double-clickable version for osx +a _ crashes when people click on help in top bar (same in DBN) [macos9] +a _ dataInputStream, setUseCaches on the url to false +a _ URLConnection.setUseCaches(false) +a _ parent.obj.close() on the url +a _ serial port code needs to be implemented +a _ something that docks better to java serial api +a _ need double-clickable application version for the mac +a _ if os9, this is a no-brainer.. for osx may take a little time ui -a _ 'open' button is a switch-to button -a _ pops up list of everything in the sketchbook -a o first item is 'new sketch', followed by delimeter -a _ next is list of subdirs other than current user, then delim -a _ the rest are the items in the current user's folder -a _ need 'new' button on the toolbar (or first sketch menuitem?) -a _ the zero looking one might be good (instead of export) -a _ export could be three circles in a row, overlapping -a _ everything is a project.. what about short snippets of code? -a _ this version won't be able to access everything from scrapbook -a _ (that requires a more robust class loader) -a _ sketch.properties contains the last program run -a _ also the window positions, etc -a _ saves screen size, so if screen size changed, window pos reset -a _ if it doesn't exist, starts with a new project -a _ for a new project, name it untitled-0001 or as appropriate -a _ so that previous projects aren't written over -a _ need to update PdeKeyListener for new ui.. -a _ remove open, add d for duplicate, r for rename, others ? -a _ verify save when -a _ closing p5 window -a _ moving to other sketch -_ project name is changed by clicking on the name and typing -_ user name is changed by clicking and typing -_ after user hits 'enter', checks to see if user exists -_ if not, pops up message asking if they want to change -_ message goes in same spot as error/status label (turns yellow?) -_ if user says 'no', then +a _ saving to gzipped 'versions' file +a _ autosave every few minutes, also on each compile, also on save +a _ mark each as 'save', 'autosave', 'failed' or 'successful' compile +a _ also include a timestamp +a _ remove projects if created but nothing happens to them -users -a _ if default user, don't show the 'user' string in pde window -a _ item in pde.properties to set the name of the current user -_ menu option to change username/login -_ if new user, offer to rename 'default' if it contains things +cvs +a _ move structure of app/application dirs around a bit +a _ small script to remove CVS directories from a tree -export -a _ exporting applets that have custom name problems: -a _ if extends processingapplet, the name user types must be same -a _ gets confused about paths and puts boogers in weird places -a _ doesn't compile correctly (must first compile with play) -a _ doesn't include additional (private) classes -a _ when exporting 'name of folder for export...' -a _ default name should be from public class -a _ because otherwise errors are happening -a _ or name from user only determines folder name -a _ if extends ProcessingApplet [more compatible] -a _ make sure export is compiling first -a _ right now have to hit play and then hit export (?) -a _ include main class info for executable jar file with jdk > 1.2 -a _ file structure for export -a _ need to set project name for files -a _ include other .class files built besides the main one -a _ compile into 'classes' folder -a _ include referenced image and font files (can't do if numbered) -a _ difference between exporting an applet and an application -a _ application can still do serial (qt, other stuff?) -a _ applet runs in browser, though applet on cbagel is everything.. - -included files -a _ 'data' directory for all media -a _ make included media part of the .jar file -a _ it's really a pain to use external files in processing -a _ getStream sucks (zach rewrote) -a _ should be able to work for application or applets -a _ may want to use getResource() (to get things from .jar files) - -compiling -a _ remove .java and .class files for compiled classes -a _ (just clean up the boogers afterwards) -a _ compiling .java files leaves the .class files next to the .java -a _ make sure all the dirs in sketchbook added to classpath on startup -a _ if new dir added, must restart processing (this is acceptable) -a _ kjc is really frustrating about some of its error/warning msgs -a _ erroneous errors from kjc regarding 'var not inited' -a _ is there any way to disable this message? -a _ talk to simon about error streams and kjc -a _ better piping of output from kjc -a _ modify kjc to take a PrintWriter, instead of current hacks -a _ might be able to set default values for vars using perl5subst - -running -a _ ability to include other code from sketchbook directory -a _ compile entire sketchbook on startup, check for new files on compile? - -is this true? -a _ lines being highlighted for errors are off +a _ lines being highlighted for errors are off (?) a _ test this on other platforms as well -a _ importing images doesn't work (?) -a _ Compiler.disable() message is weird and doesn't always work -a _ probably just remove it for now - -other mess -_ make a new 'dist' function for building -_ exceptions in draw() apps aren't caught -_ the program resize(200, 200); just does nothing (doesn't complain) -_ fold simpleserial into BApplet -_ sprint an sprintln functions -_ make i/o work just like mouse (event driven, with dflt behavior) -_ need to have function to enable it in setup -_ console work -_ make scrollbar for console -_ convert tabs to 8 spaces -_ line wrapping (but save info for resize? noo..) +a _ make a new 'dist' function for building +a _ easier to build on mac for pc than vice-versa.. +a _ fold simpleserial into BApplet +a _ sprint an sprintln functions +a _ make i/o work just like mouse (event driven, with dflt behavior) +a _ need to have function to enable it in setup +a _ console work +a _ make scrollbar for console +a _ convert tabs to 8 spaces +a o line wrapping (but save info for resize? noo..) -JAVA BUGS -_ cursor disappears in textarea and doesn't reappear until re-entry -_ windows: jre 1.3.1_03 through 1.4.0_01 - - -UNSORTED -_ pde.properties_osx, pde.properties_os9, pde.properties,win ? -_ work towards alpha release -_ alpha transparency -_ line drawing problems -_ need 3d version of bresenham -_ image caching.. to be used as texture memory on accel platforms -_ make processing useful/usable -_ start working on writing pdf files -_ loading images/files from same dir as .pde file -_ option to use jikes -_ use external editor or write a usable one -_ write simple class for lcd panel -_ build adapter to plug directly into db9 serial port -_ figure out characters used on screen by default (check web) -_ make unicode converter from unicode char -> lcd screen bytes -_ hook up lcd screen to power/serial port to test -_ code to reprogram lcd screen -_ look through rabbit api -_ look into integration of cmd line compiler -_ check out flash for its text editor -_ write function to swap different names for Proce55ing -_ use for window title -_ simple app that does swapping of letters as an animation - - -BUILDING P5 --> where to install jikes, jre, others? - jre may need to be back in cvs, but annoying for dist - because of all the CVS directories that it makes -cvs co processing -cd processing -cvs co bagel -cd bagel -rm -rf jgl -rm -rf cpp -cd .. -rm -rf web (optional, if you're only doing java dev) -cvs update -P (prune empty directories) - - -(C)BAGEL WORK -_ try screengrab using malloc and/or gobs of extra memory -_ debug the version inside bagel b/c it's simpler -_ bagel needs to be able to resize itself -_ also to address screen as if it's another size -_ is that simply a matter of changing the viewport? -_ letterboxing as appropriate -_ build windows app for testing bagel c++ ... -lgdi32 for cygwin -_ updates from p5 api changes -_ triangle() 6 parameters -_ quad() 8 parameters -_ rect/rectMode again -_ new color solution -_ color() -> uses colorMode -_ red/green/blue() hue/saturation/value() functions -_ getPixel/setPixel -_ swap in 'color' as an int -_ color c = #67aa78 -_ keyDown(), mouseDown(), lastMouseX, lastMouseY -_ degrees(), radians() - - -teaching 3D -_ expectation for 3D objects is that they begin in the center -_ rather than a translate(W/2, H/2) then draw rotating cube - -things noticed while casey watched him using the software -_ if no 0 before decimal place in a number it breaks -_ display window should have separate close box -_ save window positions on closing (due to crashing) -_ title of the file should be shown -_ needs to be a menubar -_ text editor is quite bad (hiding cursor thing) - -bagel/cbagel stuff -_ try screengrab using malloc and/or gobs of extra memory -_ debug the version inside bagel b/c it's simpler -_ bagel needs to be able to resize itself -_ also to address screen as if it's another size -_ is that simply a matter of changing the viewport? -_ letterboxing as appropriate - -things noticed while casey watched him using the software -_ if no 0 before decimal place in a number it breaks -_ display window should have separate close box -_ save window positions on closing (due to crashing) -_ title of the file should be shown -_ needs to be a menubar -_ text editor is quite bad (hiding cursor thing) - -biggest problems from french workshop -_ syntax more difficult than expected: semicolons and braces -_ part is translation issue--wasn't a quick fix -_ curly braces weren't on the keyboard -_ encouraging people to indent their code for clarity -_ slow to understand 'blocks' -_ translation issue but could be aided by visual cues in editor -_ might be better to use braces on separate lines to reinforce -_ couldn't enforce people working on specific exercises -_ too many cubes.. people playing with 3d before understanding it -_ would be nice to have examples for all concepts on site -_ or in a small printed book that serves as a reference -_ courseware not complete--difficult to collect assignments - -questions to resolve -_ is it necessary to have fullscreen option on toolbar anymore? -_ what's better than POLYGON_CONVEX and POLYGON_CONCAVE? -_ should we use jdk 1.3 or msft vm? +//////////////////////////////////////////////////////////////////// BAGEL / high @@ -336,6 +113,13 @@ b _ huge geometry slows things way down b _ adaptive sizing of circle segmenting based on rendered size b _ make size() available throughout b _ stroked version of sphere is just a circle +b _ noClear -- implement with noBackground +b _ need to set bg color even if updated +b _ update/noUpdate() could also be done to force explicit updates only +b _ for ui-type applications that don't need to continually redraw +b _ keypressed is not persistent +b _ key repeat in os vs. how java handles it +b _ search java faq for info about getting around it BAGEL / medium & time consuming @@ -351,12 +135,11 @@ b _ sorting of polygons/lines on simple painters algorithm b _ better lighting model to show darkness at various depths b _ maybe just ultra-high res bitmaps from gl b _ version of ProcessingApplet that replaces g. with ai. or pdf. - -_ picking -_ ability to write data other than image into the buffer -_ user can introduce new kinds of buffers at will (!) -_ lists of names of objects, or the 'line number' buffer -_ but how to determine *where* on object the hit occurs? +b _ picking +b _ ability to write data other than image into the buffer +b _ user can introduce new kinds of buffers at will (!) +b _ lists of names of objects, or the 'line number' buffer +b _ but how to determine *where* on object the hit occurs? BAGEL / lower @@ -404,15 +187,36 @@ _ or maybe image.setColor or setTone to mix a specific color in _ live video editing, wanting things more procedural +(C)BAGEL WORK +_ try screengrab using malloc and/or gobs of extra memory +_ debug the version inside bagel b/c it's simpler +_ bagel needs to be able to resize itself +_ also to address screen as if it's another size +_ is that simply a matter of changing the viewport? +_ letterboxing as appropriate +_ build windows app for testing bagel c++ ... -lgdi32 for cygwin +_ updates from p5 api changes +_ triangle() 6 parameters +_ quad() 8 parameters +_ rect/rectMode again +_ new color solution +_ color() -> uses colorMode +_ red/green/blue() hue/saturation/value() functions +_ getPixel/setPixel +_ swap in 'color' as an int +_ color c = #67aa78 +_ keyDown(), mouseDown(), lastMouseX, lastMouseY +_ degrees(), radians() + + +//////////////////////////////////////////////////////////////////// + + PDE / high b _ serial.messageReceived extra long crap in demo.pde (clean up?) b _ improve simpleserial and clean up a bit b _ document a bit more regarding its use b _ should serial be an event like mouse/key -b _ NullPointerException on startup in pde editor buttons -b _ shows up on slower machines, probably images not loaded yet -b _ use a vm that won't destroy the screen like sun/ibm does -b _ this means msft or newer version of jdk PDE / high & time consuming @@ -427,6 +231,7 @@ b _ or figure out how to unload old classes.. grr PDE / medium +b _ sketch: sketch-000 is dumb b _ check logs to see where we're getting traffic from b _ event to explorer to open 'parts' directory of project b _ option to toggle console on/off (not just in properties, but realtime) @@ -447,26 +252,61 @@ b _ java freetype? jni freetype to build texmap fonts? b _ look at flash file format? (does it have kerning?) b _ example: multi-user server app (shared whiteboard) b _ example: basic network app -b _ work out getStream b _ file i/o utility classes b _ read as set of lines, read as cells in grid, read num sequence b _ then methods for writing all of the same +b _ exceptions in draw() apps aren't caught +b _ the program resize(200, 200); just does nothing (doesn't complain) +b _ menu option to change username/login +b _ if new user, offer to rename 'default' if it contains things +b _ user name is changed by clicking and typing +b _ after user hits 'enter', checks to see if user exists +b _ if not, pops up message asking if they want to change +b _ message goes in same spot as error/status label (turns yellow?) +b _ if user says 'no', then +b _ ability to export 'applications' (not just applets) +b _ application can still do serial (qt, other stuff?) +b _ applet runs in browser, though applet on cbagel is everything.. +b _ include main class info for executable jar file with jdk > 1.2 +b _ not difficult to do, just some tweaking once applet export works +b _ wrapper that invokes the applet using a copy of the jre +b _ main() method needs to set layout manager if jexegen is to be used +b _ (msft vm defaults to null layout manager) +b _ also make sure pack() is happening +b _ kjc is really frustrating about some of its error/warning msgs +b _ erroneous errors from kjc regarding 'var not inited' +b _ is there any way to disable this message? +b _ talk to simon about error streams and kjc +b _ better piping of output from kjc +b _ modify kjc to take a PrintWriter, instead of current hacks +b _ might be able to set default values for vars using perl5subst +b _ ability to include other code from sketchbook directory +b _ compile entire sketchbook on startup, check for new files on compile? +b _ Compiler.disable() message is weird and doesn't always work +b _ probably just remove it for now +cosmetic [lower priority] +b _ only copy data files into build when there are changes +b _ make sure the still relevant files aren't removed +b _ setLastModified on the files after copying (jdk13) +b _ editorbuttons: if nothing selected on popup, need to deselect +b _ editorbuttons: if export fails (compile error) need deselect +b _ may want to throw exceptions from bagel +b _ but catch them inside bapplet--as part of making things easier -PDE / macos -a _ how to make double-clickable version for osx -a _ crashes when people click on help in top bar (same in DBN) [macos9] -a _ dataInputStream, setUseCaches on the url to false -a _ URLConnection.setUseCaches(false) -a _ parent.obj.close() on the url -b _ serial port code needs to be implemented -b _ something that docks better to java serial api -b _ need double-clickable application version for the mac -a _ if os9, this is a no-brainer.. for osx may take a little time +pdebase cleanup [lower priority] +b _ remove 'encoding' crap from PdeBase +b _ only existed b/c of reading as bytes and not using jdk11 methods +b _ cleanup program/inline_program crap.. take out scheme stuff +b _ better readFile/loadImage inside PdeBase +b _ temp array should be resizable inside readFile +b _ might just use ByteArray streams +b _ use getresource for loading image +b _ remove Editor's frame instance, replace refs with PdeBase.frame PDE / low -_ beautify is slightly broken +_ beautify is (slightly?) broken _ if 'void' left out before loop or setup, cryptic message about _ 'constructor loop must be named Temporary_23498_2343' _ add a better handler for this specific thing? @@ -478,17 +318,8 @@ _ fairly quick--just use code from dbn _ bug in paren balancing _ paren problems comes from overusing parens (too many closing) _ image[first[i], 0, 0) hitting last paren causes jump to top -_ export as application -_ not difficult to do, just some tweaking once applet export works -_ wrapper that invokes the applet using a copy of the jre -_ main() method needs to set layout manager if jexegen is to be used -_ (msft vm defaults to null layout manager) -_ also make sure pack() is happening _ stop() method in applet should stop kjc environment _ should be able to call stop() to 'quit' an applet -_ make close() work to kill applet in kjc -_ save window x, y, width, height to pde.properties on exit -_ stderr in red color _ run java code besides processing applets _ if not processing applet, look for a main(), no main give an error @@ -654,3 +485,74 @@ _ what if one short or one too many vertices? _ transforms are affecting geometry _ i.e. are line and point working in 3D? _ why did i think that z was backwards from gl? + +things noticed while casey watched him using the software +_ if no 0 before decimal place in a number it breaks +_ display window should have separate close box +_ save window positions on closing (due to crashing) +_ title of the file should be shown +_ needs to be a menubar +_ text editor is quite bad (hiding cursor thing) + +biggest problems from french workshop +_ syntax more difficult than expected: semicolons and braces +_ part is translation issue--wasn't a quick fix +_ curly braces weren't on the keyboard +_ encouraging people to indent their code for clarity +_ slow to understand 'blocks' +_ translation issue but could be aided by visual cues in editor +_ might be better to use braces on separate lines to reinforce +_ couldn't enforce people working on specific exercises +_ too many cubes.. people playing with 3d before understanding it +_ would be nice to have examples for all concepts on site +_ or in a small printed book that serves as a reference +_ courseware not complete--difficult to collect assignments + +questions to resolve +_ is it necessary to have fullscreen option on toolbar anymore? +_ what's better than POLYGON_CONVEX and POLYGON_CONCAVE? +_ should we use jdk 1.3 or msft vm? + +teaching 3D +_ expectation for 3D objects is that they begin in the center +_ rather than a translate(W/2, H/2) then draw rotating cube + +JAVA BUGS +_ cursor disappears in textarea and doesn't reappear until re-entry +_ windows: jre 1.3.1_03 through 1.4.0_01 + + +UNSORTED +_ pde.properties_osx, pde.properties_os9, pde.properties,win ? +_ make processing useful/usable +_ start working on writing pdf files +_ loading images/files from same dir as .pde file +_ option to use jikes +_ use external editor or write a usable one +_ write simple class for lcd panel +_ build adapter to plug directly into db9 serial port +_ figure out characters used on screen by default (check web) +_ make unicode converter from unicode char -> lcd screen bytes +_ hook up lcd screen to power/serial port to test +_ code to reprogram lcd screen +_ look through rabbit api +_ look into integration of cmd line compiler +_ check out flash for its text editor +_ write function to swap different names for Proce55ing +_ use for window title +_ simple app that does swapping of letters as an animation + + +BUILDING P5 +-> where to install jikes, jre, others? + jre may need to be back in cvs, but annoying for dist + because of all the CVS directories that it makes +cvs co processing +cd processing +cvs co bagel +cd bagel +rm -rf jgl +rm -rf cpp +cd .. +rm -rf web (optional, if you're only doing java dev) +cvs update -P (prune empty directories)