blowing up EditorToolbar a bit

This commit is contained in:
Ben Fry
2015-01-28 19:33:56 -05:00
parent 603fd5364a
commit efbe2d6d5a
6 changed files with 603 additions and 579 deletions
+1 -1
View File
@@ -306,7 +306,7 @@ public abstract class Editor extends JFrame implements RunnerListener {
contentPain.add(box);
// get shift down/up events so we can show the alt version of toolbar buttons
textarea.addKeyListener(toolbar);
//textarea.addKeyListener(toolbar);
// end an undo-chunk any time the caret moves unless it's when text is edited
textarea.addCaretListener(new CaretListener() {
File diff suppressed because it is too large Load Diff
+20 -12
View File
@@ -153,7 +153,7 @@ public class JavaEditor extends Editor {
public EditorToolbar createToolbar() {
return new JavaToolbar(this, base);
return new JavaToolbar(this);
}
@@ -188,7 +188,7 @@ public class JavaEditor extends Editor {
public JMenu buildSketchMenu() {
JMenuItem runItem = Toolkit.newJMenuItem(JavaToolbar.getTitle(JavaToolbar.RUN, false), 'R');
JMenuItem runItem = Toolkit.newJMenuItem(Language.text("toolbar.run"), 'R');
runItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (isDebuggerEnabled()) {
@@ -200,14 +200,14 @@ public class JavaEditor extends Editor {
}
});
JMenuItem presentItem = Toolkit.newJMenuItemShift(JavaToolbar.getTitle(JavaToolbar.RUN, true), 'R');
JMenuItem presentItem = Toolkit.newJMenuItemShift(Language.text("toolbar.present"), 'R');
presentItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
handlePresent();
}
});
JMenuItem stopItem = new JMenuItem(JavaToolbar.getTitle(JavaToolbar.STOP, false));
JMenuItem stopItem = new JMenuItem(Language.text("toolbar.stop"));
stopItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (isDebuggerEnabled()) {
@@ -1017,7 +1017,8 @@ public class JavaEditor extends Editor {
public void run() {
prepareRun();
try {
toolbar.activate(JavaToolbar.RUN);
// toolbar.activate(JavaToolbar.RUN);
toolbar.activateRun();
runtime = jmode.handleRun(sketch, JavaEditor.this);
// System.out.println("runtime now " + runtime);
} catch (Exception e) {
@@ -1033,7 +1034,8 @@ public class JavaEditor extends Editor {
public void run() {
prepareRun();
try {
toolbar.activate(JavaToolbar.RUN);
// toolbar.activate(JavaToolbar.RUN);
toolbar.activateRun();
runtime = jmode.handlePresent(sketch, JavaEditor.this);
} catch (Exception e) {
statusError(e);
@@ -1052,7 +1054,8 @@ public class JavaEditor extends Editor {
debugger.stopDebug();
} else {
toolbar.activate(JavaToolbar.STOP);
// toolbar.activate(JavaToolbar.STOP);
toolbar.activateStop();
try {
//jmode.handleStop();
@@ -1066,8 +1069,10 @@ public class JavaEditor extends Editor {
statusError(e);
}
toolbar.deactivate(JavaToolbar.RUN);
toolbar.deactivate(JavaToolbar.STOP);
// toolbar.deactivate(JavaToolbar.RUN);
// toolbar.deactivate(JavaToolbar.STOP);
toolbar.deactivateStop();
toolbar.deactivateRun();
// focus the PDE again after quitting presentation mode [toxi 030903]
toFront();
@@ -1161,7 +1166,8 @@ public class JavaEditor extends Editor {
public void statusError(String what) {
super.statusError(what);
// new Exception("deactivating RUN").printStackTrace();
toolbar.deactivate(JavaToolbar.RUN);
// toolbar.deactivate(JavaToolbar.RUN);
toolbar.deactivateRun();
}
@@ -1946,7 +1952,8 @@ public class JavaEditor extends Editor {
protected void activateRun() {
enableDebug.setEnabled(false);
toolbar.activate(JavaToolbar.RUN);
// toolbar.activate(JavaToolbar.RUN);
toolbar.activateRun();
}
@@ -1960,7 +1967,8 @@ public class JavaEditor extends Editor {
// if (toolbar instanceof DebugToolbar){
// toolbar.deactivate(DebugToolbar.RUN);
// } else {
toolbar.deactivate(JavaToolbar.RUN);
// toolbar.deactivate(JavaToolbar.RUN);
toolbar.deactivateRun();
enableDebug.setEnabled(true);
// }
}
+14 -1
View File
@@ -24,12 +24,24 @@ import java.awt.event.MouseEvent;
//import javax.swing.JPopupMenu;
import javax.swing.JPanel;
import processing.app.Base;
import processing.app.Editor;
import processing.app.EditorToolbar;
import processing.app.Language;
public class JavaToolbar extends EditorToolbar {
public JavaToolbar(Editor editor) {
super(editor);
}
}
/*
public class JavaToolbar extends EditorToolbar {
static protected final int RUN = 0;
static protected final int STOP = 1;
@@ -75,4 +87,5 @@ public class JavaToolbar extends EditorToolbar {
break;
}
}
}
}
*/
@@ -1,40 +0,0 @@
/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
/*
Part of the Processing project - http://processing.org
Copyright (c) 2012-15 The Processing Foundation
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License version 2
as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package processing.mode.java.tweak;
import processing.app.Base;
import processing.app.Editor;
import processing.mode.java.JavaToolbar;
public class TweakToolbar extends JavaToolbar {
static protected final int RUN = 0;
static protected final int STOP = 1;
static protected final int NEW = 2;
static protected final int OPEN = 3;
static protected final int SAVE = 4;
static protected final int EXPORT = 5;
public TweakToolbar(Editor editor, Base base) {
super(editor, base);
}
}
+10 -3
View File
@@ -10,6 +10,10 @@ X https://github.com/processing/processing/issues/3014
X add more bulletproofing to the save process
X https://github.com/processing/processing/issues/2923
X serious text improvements (at least on retina)
_ finish adding 'examples' contribs
_ https://github.com/processing/processing/issues/2953
_ don't return here, allow contrib types to fail:
_ https://github.com/processing/processing/blob/master/app/src/processing/app/contrib/ContributionListing.java#L509
update components
X moving to Java 8 because Java 7 will be discontinued
@@ -20,6 +24,8 @@ X requires ECJ update (using 4.4.1)
X http://download.eclipse.org/eclipse/downloads/drops4/R-4.4.1-201409250400/
X update to launch4j 3.6
X http://sourceforge.net/projects/launch4j/files/launch4j-3/3.6/
o update ld and windres: https://github.com/processing/processing/tree/master/java/application/launch4j/bin
o also xstream.jar https://github.com/processing/processing/tree/master/java/application/launch4j/lib
earlier
X any problems with new code signing crap?
@@ -95,9 +101,6 @@ X this whole setup is really gross at the moment
X finish Ant task to download JRE and JDK from Oracle
X remove public 'ta' object in DebugEditor, also dmode
update ld and windres: https://github.com/processing/processing/tree/master/java/application/launch4j/bin
also xstream.jar https://github.com/processing/processing/tree/master/java/application/launch4j/lib
_ fix hasJavaTabs() function
_ almost always used as a negative, or tied to a 'return' from fxn
_ name isn't tied to its function, but the symptom
@@ -115,6 +118,10 @@ _ can we animate its appearance?
_ do the right thing on passing around List vs ArrayList and others
breakage
_ break out a gui package (get class count down in .app)
_ remove deprecated methods
gui
_ need 'actively pressed' version of 'play' and 'stop'
_ could do rollover as well, but do other apps use them?