From eae67bdb9b3ce3b5f3acc533ea1ebc57cee06f95 Mon Sep 17 00:00:00 2001 From: benfry Date: Fri, 2 Aug 2002 16:27:14 +0000 Subject: [PATCH] X added icon to replace the coffee cup X see if play being highlighted can be implemented again X especially important because of speed issues --- processing/app/KjcEngine.java | 3 ++ processing/app/PdeBase.java | 6 ++++ processing/app/PdeEditor.java | 42 ++++++++++++++++++++++++++- processing/app/PdeEditorButtons.java | 10 +++++-- processing/build/shared/lib/icon.gif | Bin 0 -> 115 bytes processing/todo.txt | 31 +++++++++++--------- 6 files changed, 75 insertions(+), 17 deletions(-) create mode 100644 processing/build/shared/lib/icon.gif diff --git a/processing/app/KjcEngine.java b/processing/app/KjcEngine.java index 2be9d724b..4acd5d958 100644 --- a/processing/app/KjcEngine.java +++ b/processing/app/KjcEngine.java @@ -673,6 +673,7 @@ public class KjcEngine extends PdeEngine { } else { window = new Frame(); // gonna use ugly windows instead ((Frame)window).setResizable(false); + if (PdeBase.icon != null) ((Frame)window).setIconImage(PdeBase.icon); window.pack(); // to get a peer, size set later, need for insets window.addWindowListener(new WindowAdapter() { @@ -749,6 +750,7 @@ public class KjcEngine extends PdeEngine { window.show(); applet.requestFocus(); // necessary for key events } + //System.out.println("KJC RUNNING"); running = true; //need to parse this code to give a decent error message @@ -803,6 +805,7 @@ public class KjcEngine extends PdeEngine { public void stop() { // part of PdeEngine //System.out.println("PdeEngine.stop"); + //System.out.println("KJC NOT RUNNING"); running = false; //System.out.println(); diff --git a/processing/app/PdeBase.java b/processing/app/PdeBase.java index 9fd13fa9f..30c4fe68c 100644 --- a/processing/app/PdeBase.java +++ b/processing/app/PdeBase.java @@ -12,6 +12,7 @@ public class PdeBase implements ActionListener { static Properties properties; static Frame frame; static String encoding; + static Image icon; boolean errorState; PdeEditor editor; @@ -82,6 +83,11 @@ public class PdeBase implements ActionListener { public PdeBase() { frame = new Frame(WINDOW_TITLE); + try { + icon = Toolkit.getDefaultToolkit().getImage("lib/icon.gif"); + frame.setIconImage(icon); + } catch (Exception e) { } // fail silently + windowListener = new WindowAdapter() { public void windowClosing(WindowEvent e) { //System.exit(0); diff --git a/processing/app/PdeEditor.java b/processing/app/PdeEditor.java index c21155919..b21a86002 100644 --- a/processing/app/PdeEditor.java +++ b/processing/app/PdeEditor.java @@ -63,6 +63,8 @@ public class PdeEditor extends Panel { Frame frame; Window presentationWindow; + RunButtonWatcher watcher; + static final int GRID_SIZE = 33; static final int INSET_SIZE = 5; @@ -395,6 +397,7 @@ public class PdeEditor extends Panel { //doStop(); doClose(); running = true; + //System.out.println("RUNNING"); buttons.run(); presenting = present; @@ -430,6 +433,8 @@ public class PdeEditor extends Panel { //System.out.println("done iwth engine.start()"); //} + watcher = new RunButtonWatcher(); + } catch (PdeException e) { //state = RUNNER_ERROR; //forceStop = false; @@ -450,6 +455,33 @@ public class PdeEditor extends Panel { //graphics.requestFocus(); // removed for pde } + class RunButtonWatcher implements Runnable { + Thread thread; + + public RunButtonWatcher() { + thread = new Thread(this); + thread.start(); + } + + public void run() { + while (Thread.currentThread() == thread) { + KjcEngine eng = (KjcEngine)engine; + if ((engine != null) && (eng.applet != null)) { + //System.out.println(eng.applet.finished); + buttons.running(!eng.applet.finished); + //} else { + //System.out.println("still pooping"); + } + try { + Thread.sleep(250); + } catch (InterruptedException e) { } + } + } + + public void stop() { + thread.stop(); + } + } public void doStop() { /* @@ -463,12 +495,14 @@ public class PdeEditor extends Panel { //System.out.println("stop1"); if (engine != null) engine.stop(); + if (watcher != null) watcher.stop(); //System.out.println("stop2"); message(EMPTY); //System.out.println("stop3"); buttons.clear(); //System.out.println("stop4"); running = false; + //System.out.println("NOT RUNNING"); //System.out.println("stop5"); } @@ -557,6 +591,7 @@ public class PdeEditor extends Panel { // local vars prevent sketchName from being set public void skNew() { + doStop(); checkModified(SK_NEW); } @@ -625,6 +660,7 @@ public class PdeEditor extends Panel { */ public void skOpen(String path, String name) { + doStop(); checkModified(SK_OPEN, path, name); } @@ -807,6 +843,7 @@ public class PdeEditor extends Panel { public void skSaveAs() { + doStop(); status.edit("Save sketch as...", sketchName); } @@ -944,6 +981,7 @@ public class PdeEditor extends Panel { public void skExport() { + doStop(); message("Exporting for the web..."); File appletDir = new File(sketchDir, "applet"); handleExport(appletDir, sketchName, new File(sketchDir, "data")); @@ -1172,12 +1210,13 @@ public class PdeEditor extends Panel { public void doQuit() { + doStop(); //if (!checkModified()) return; checkModified(DO_QUIT); } protected void doQuit2() { - doStop(); + //doStop(); // clear out projects that are empty if (PdeBase.getBoolean("sketchbook.auto_clean", true)) { @@ -1420,6 +1459,7 @@ public class PdeEditor extends Panel { // PdeRecorder.stop(); //#endif running = false; + //System.out.println("NOT RUNNING"); buttons.clearRun(); message("Done."); } diff --git a/processing/app/PdeEditorButtons.java b/processing/app/PdeEditorButtons.java index 3164ccea2..d607d8441 100644 --- a/processing/app/PdeEditorButtons.java +++ b/processing/app/PdeEditorButtons.java @@ -417,12 +417,18 @@ public class PdeEditorButtons extends Panel /*implements ActionListener*/ { public void run() { if (inactive == null) return; clear(); - setState(0, ACTIVE, true); + //setState(0, ACTIVE, true); + setState(RUN, ACTIVE, true); + } + + public void running(boolean yesno) { + setState(RUN, yesno ? ACTIVE : INACTIVE, true); } public void clearRun() { if (inactive == null) return; - setState(0, INACTIVE, true); + //setState(0, INACTIVE, true); + setState(RUN, INACTIVE, true); } /* diff --git a/processing/build/shared/lib/icon.gif b/processing/build/shared/lib/icon.gif new file mode 100644 index 0000000000000000000000000000000000000000..411363e5e49c3b4903fac1e741ee6aad93a99153 GIT binary patch literal 115 zcmZ?wbhEHb6krfwSi}GV|NsA=$-rQ2Yz$<81we%2PZmZ71{MY#5C^1|f!RW0*Bv3H zQ<{exO!of{D-mn4eIhdL$&bRtFLKvS>Rj{f;EUS%T3+48lIPMM320AmD>4*dn0H}? I2_u6w0E`YM-2eap literal 0 HcmV?d00001 diff --git a/processing/todo.txt b/processing/todo.txt index 198e37e6c..df26bc02c 100644 --- a/processing/todo.txt +++ b/processing/todo.txt @@ -1,10 +1,23 @@ 0042 X fixed ArrayIndexOutOfBoundsException in texture use +X added icon to replace the coffee cup +X see if play being highlighted can be implemented again +X especially important because of speed issues +0042 BUGS +X this code is not performing correctly (triangle strip) +X (see example in reference for expected output) +X -> turns out it's correct, but not great +beginShape(TRIANGLE_STRIP); +vertex(30, 75); +vertex(40, 20); +vertex(50, 75); +vertex(60, 20); +vertex(70, 75); +vertex(80, 20); +vertex(90, 75); +endShape(); -pde -a _ see if play being highlighted can be implemented again -a _ especially important because of speed issues macosx a _ arrow keys don't work in the textarea @@ -17,17 +30,6 @@ a _ document serial a bit more in release notes a _ how do we encourage/point to updates? a _ auto updater? check for releases page in menu? -a _ this code is not performing correctly -a _ (see example in reference for expected output) -beginShape(TRIANGLE_STRIP); -vertex(30, 75); -vertex(40, 20); -vertex(50, 75); -vertex(60, 20); -vertex(70, 75); -vertex(80, 20); -vertex(90, 75); -endShape(); @@ -203,6 +205,7 @@ b _ queue for people reporting things externally b _ bugzilla but simpler b _ would also be nice for people to be able to vote on features b _ save serial port on close +b _ probably should doClose() on new/open instead of doStop() PDE / medium