cosmetic fixes and note-taking

This commit is contained in:
Ben Fry
2019-10-08 18:28:16 -04:00
parent dc637f39a7
commit b2eb89d72f
7 changed files with 67 additions and 212 deletions
+1 -1
View File
@@ -12,4 +12,4 @@ Ben Fry, 4 October 2019
As with all releases, I'll do everything possible to avoid breaking API. However, there will still be tweaks that have to be made. We'll try to keep them minor.
(Started writing this section because I thought we had our first break, but found an alternate solution.)
* `Base.defaultFileMenu` is now `protected` instead of `static public`
+9 -153
View File
@@ -43,7 +43,6 @@ implements MouseListener, MouseMotionListener, ActionListener {
protected boolean pressed;
protected boolean selected;
protected boolean rollover;
// protected JLabel rolloverLabel;
protected boolean shift;
protected Image enabledImage;
@@ -55,7 +54,6 @@ implements MouseListener, MouseMotionListener, ActionListener {
protected Image gradient;
protected EditorToolbar toolbar;
// protected Mode mode;
public EditorButton(EditorToolbar parent, String name, String title) {
@@ -128,50 +126,8 @@ implements MouseListener, MouseMotionListener, ActionListener {
}
// public String toString() {
// switch (this) {
// case DISABLED: return "disabled";
// case ENABLED: return "enabled";
// case SELECTED: return "selected";
// case ROLLOVER: return "rollover";
// case PRESSED: return "pressed";
//
//// for (State bs : State.values()) {
//// Image image = mode.loadImage(bs.getFilename(name));
//// if (image != null) {
//// imageMap.put(bs, image);
//// }
//// }
////
//// enabled = true;
//// //updateState();
//// setState(State.ENABLED);
// }
// public void setReverse() {
// gradient = mode.makeGradient("reversed", DIM, DIM);
// }
// public void setGradient(Image gradient) {
// this.gradient = gradient;
// }
// public void setRolloverLabel(JLabel label) {
// rolloverLabel = label;
// }
@Override
public void mouseClicked(MouseEvent e) {
// if (isEnabled()) {
// shift = e.isShiftDown();
// actionPerformed(new ActionEvent(this, ActionEvent.ACTION_PERFORMED,
// null, e.getModifiers()));
// }
}
public void mouseClicked(MouseEvent e) { }
public boolean isShiftDown() {
@@ -181,12 +137,17 @@ implements MouseListener, MouseMotionListener, ActionListener {
@Override
public void mousePressed(MouseEvent e) {
setPressed(true);
// Need to fire here (or on mouse up) because mouseClicked()
// Using mousePressed() (or mouseReleased()) because mouseClicked()
// won't be fired if the user nudges the mouse while clicking.
// https://github.com/processing/processing/issues/3529
setPressed(true);
shift = e.isShiftDown();
// It looks like ActionEvent expects old-style modifiers,
// so the e.getModifiers() call here may be correct.
// TODO Look into how this is getting used in Modes,
// and either update or add ignore to the deprecation [fry 191008]
actionPerformed(new ActionEvent(this, ActionEvent.ACTION_PERFORMED,
null, e.getModifiers()));
}
@@ -211,25 +172,6 @@ implements MouseListener, MouseMotionListener, ActionListener {
}
/*
@Override
public void keyTyped(KeyEvent e) { }
@Override
public void keyReleased(KeyEvent e) {
updateRollover(e);
}
@Override
public void keyPressed(KeyEvent e) {
System.out.println(e);
updateRollover(e);
}
*/
public String getRolloverText(InputEvent e) {
if (e.isShiftDown()) {
return titleShift;
@@ -240,42 +182,15 @@ implements MouseListener, MouseMotionListener, ActionListener {
}
/*
public void updateRollover(InputEvent e) {
if (rolloverLabel != null) {
if (e.isShiftDown()) {
rolloverLabel.setText(titleShift);
} else if (e.isAltDown()) {
rolloverLabel.setText(titleAlt);
} else {
rolloverLabel.setText(title);
}
}
}
*/
@Override
public void mouseEntered(MouseEvent e) {
toolbar.setRollover(this, e);
/*
rollover = true;
updateRollover(e);
repaint();
*/
}
@Override
public void mouseExited(MouseEvent e) {
toolbar.setRollover(null, e);
/*
rollover = false;
if (rolloverLabel != null) {
rolloverLabel.setText("");
}
repaint();
*/
}
@@ -289,11 +204,6 @@ implements MouseListener, MouseMotionListener, ActionListener {
abstract public void actionPerformed(ActionEvent e);
// @Override
// public void actionPerformed(ActionEvent e) {
// // To be overridden by all subclasses
// }
@Override
public Dimension getPreferredSize() {
@@ -311,58 +221,4 @@ implements MouseListener, MouseMotionListener, ActionListener {
public Dimension getMaximumSize() {
return getPreferredSize();
}
// public Image getImage() {
// return imageMap.get(state);
// }
//
//
//// protected void updateState() {
//// state = ButtonState.ENABLED;
//// }
//
//
// public void setEnabled(boolean enabled) {
// this.enabled = enabled;
// if (enabled) {
// if (state == State.DISABLED) {
// setState(State.ENABLED);
// }
// } else {
// if (state == State.ENABLED) {
// setState(State.DISABLED);
// }
// }
// }
//
//
// public void setState(State state) {
// this.state = state;
// }
// public enum State {
// DISABLED, ENABLED, SELECTED, ROLLOVER, PRESSED;
//
// /**
// * @param name the root name
// * @return
// */
// public String getFilename(String name) {
// final int res = Toolkit.highResDisplay() ? 2 : 1;
// return name + "-" + toString() + "-" + res + "x.png";
// }
//
// public String toString() {
// switch (this) {
// case DISABLED: return "disabled";
// case ENABLED: return "enabled";
// case SELECTED: return "selected";
// case ROLLOVER: return "rollover";
// case PRESSED: return "pressed";
// }
// return null;
// }
// }
}
+16 -47
View File
@@ -3,7 +3,7 @@
/*
Part of the Processing project - http://processing.org
Copyright (c) 2012-15 The Processing Foundation
Copyright (c) 2012-19 The Processing Foundation
Copyright (c) 2008-12 Ben Fry and Casey Reas
This program is free software; you can redistribute it and/or modify
@@ -42,8 +42,6 @@ import processing.mode.java.runner.Runner;
/**
* Class to handle running Processing from the command line.
*
* @author fry
*/
public class Commander implements RunnerListener {
static final String helpArg = "--help";
@@ -65,7 +63,6 @@ public class Commander implements RunnerListener {
static final int BUILD = 1;
static final int RUN = 2;
static final int PRESENT = 3;
// static final int EXPORT_APPLET = 4;
static final int EXPORT = 4;
Sketch sketch;
@@ -74,19 +71,6 @@ public class Commander implements RunnerListener {
PrintStream systemErr;
static public void main(String[] args) {
// Do this early so that error messages go to the console
Base.setCommandLine();
// init the platform so that prefs and other native code is ready to go
Platform.init();
// make sure a full JDK is installed
//Base.initRequirements();
// launch command line handler
new Commander(args);
}
public Commander(String[] args) {
String sketchPath = null;
File sketchFolder = null;
@@ -152,7 +136,6 @@ public class Commander implements RunnerListener {
embedJava = false;
} else if (arg.startsWith(platformArg)) {
// complainAndQuit("The --platform option has been removed from Processing 2.1.", false);
String platformStr = arg.substring(platformArg.length());
platform = Platform.getIndex(platformStr);
if (platform == -1) {
@@ -160,17 +143,6 @@ public class Commander implements RunnerListener {
"'windows', 'macosx', or 'linux'.", true);
}
} else if (arg.startsWith(bitsArg)) {
complainAndQuit("The --bits option has been removed.", false);
// String bitsStr = arg.substring(bitsArg.length());
// if (bitsStr.equals("32")) {
// platformBits = 32;
// } else if (bitsStr.equals("64")) {
// platformBits = 64;
// } else {
// complainAndQuit("Bits should be either 32 or 64, not " + bitsStr, true);
// }
} else if (arg.startsWith(sketchArg)) {
sketchPath = arg.substring(sketchArg.length());
sketchFolder = new File(sketchPath);
@@ -199,13 +171,6 @@ public class Commander implements RunnerListener {
}
String[] sketchArgs = PApplet.subset(args, argOffset);
// if ((outputPath == null) &&
// (task == PREPROCESS || task == BUILD ||
// task == RUN || task == PRESENT)) {
// complainAndQuit("An output path must be specified when using " +
// preprocArg + ", " + buildArg + ", " +
// runArg + ", or " + presentArg + ".");
// }
if (task == HELP) {
printCommandLine(systemOut);
System.exit(0);
@@ -256,8 +221,6 @@ public class Commander implements RunnerListener {
boolean success = false;
// JavaMode javaMode =
// new JavaMode(null, Base.getContentFile("modes/java"));
JavaMode javaMode = (JavaMode)
ModeContribution.load(null, Platform.getContentFile("modes/java"),
"processing.mode.java.JavaMode").getMode();
@@ -389,9 +352,6 @@ public class Commander implements RunnerListener {
out.println("--no-java Do not embed Java. Use at your own risk!");
out.println("--platform Specify the platform (export to application only).");
out.println(" Should be one of 'windows', 'macosx', or 'linux'.");
// out.println("--bits Must be specified if libraries are used that are");
// out.println(" 32- or 64-bit specific such as the OpenGL library.");
// out.println(" Otherwise specify 0 or leave it out.");
out.println();
out.println("The --build, --run, --present, or --export must be the final parameter");
@@ -406,22 +366,31 @@ public class Commander implements RunnerListener {
@Override
public void startIndeterminate() {
}
public void startIndeterminate() { }
@Override
public void stopIndeterminate() {
}
public void stopIndeterminate() { }
@Override
public void statusHalt() {
}
public void statusHalt() { }
@Override
public boolean isHalted() {
return false;
}
static public void main(String[] args) {
// Do this early so that error messages go to the console
Base.setCommandLine();
// init the platform so that prefs and other native code is ready to go
Platform.init();
// launch command line handler
new Commander(args);
}
}
@@ -31,9 +31,6 @@ import java.io.*;
import java.lang.reflect.Method;
import java.util.HashMap;
//import org.eclipse.jdt.core.compiler.batch.BatchCompiler;
//import org.eclipse.jdt.core.compiler.CompilationProgress;
public class Compiler {
@@ -1,3 +1,26 @@
/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
/*
Part of the Processing project - http://processing.org
Copyright (c) 2012-19 The Processing Foundation
Copyright (c) 2004-12 Ben Fry and Casey Reas
Copyright (c) 2001-04 Massachusetts Institute of Technology
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package processing.mode.java;
import java.awt.*;
+2 -1
View File
@@ -4,7 +4,7 @@
Part of the Processing project - http://processing.org
Copyright (c) 2010-11 Ben Fry and Casey Reas
Copyright (c) 2012-15 The Processing Foundation
Copyright (c) 2012-19 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
@@ -37,6 +37,7 @@ import processing.app.*;
import processing.app.ui.Editor;
import processing.app.ui.EditorException;
import processing.app.ui.EditorState;
import processing.mode.java.runner.Runner;
import processing.mode.java.tweak.SketchParser;
@@ -20,22 +20,31 @@ along with this program; if not, write to the Free Software Foundation, Inc.
package processing.mode.java.pdex.util;
import com.google.classpath.ClassPathFactory;
import processing.app.*;
import processing.mode.java.JavaMode;
import processing.mode.java.pdex.ImportStatement;
import processing.mode.java.pdex.PreprocessedSketch;
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
import java.nio.file.Paths;
import java.util.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.StringJoiner;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import com.google.classpath.ClassPathFactory;
import processing.app.Library;
import processing.app.Messages;
import processing.app.Sketch;
import processing.app.SketchException;
import processing.app.Util;
import processing.mode.java.JavaMode;
import processing.mode.java.pdex.ImportStatement;
import processing.mode.java.pdex.PreprocessedSketch;
/**
* Builder which generates runtime paths using a series of caches.