Skip to content

Commit b2eb89d

Browse files
committed
cosmetic fixes and note-taking
1 parent dc637f3 commit b2eb89d

7 files changed

Lines changed: 67 additions & 212 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ Ben Fry, 4 October 2019
1212

1313
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.
1414

15-
(Started writing this section because I thought we had our first break, but found an alternate solution.)
15+
* `Base.defaultFileMenu` is now `protected` instead of `static public`

app/src/processing/app/ui/EditorButton.java

Lines changed: 9 additions & 153 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ abstract public class EditorButton extends JComponent
4343
protected boolean pressed;
4444
protected boolean selected;
4545
protected boolean rollover;
46-
// protected JLabel rolloverLabel;
4746
protected boolean shift;
4847

4948
protected Image enabledImage;
@@ -55,7 +54,6 @@ abstract public class EditorButton extends JComponent
5554
protected Image gradient;
5655

5756
protected EditorToolbar toolbar;
58-
// protected Mode mode;
5957

6058

6159
public EditorButton(EditorToolbar parent, String name, String title) {
@@ -128,50 +126,8 @@ public void paintComponent(Graphics g) {
128126
}
129127

130128

131-
// public String toString() {
132-
// switch (this) {
133-
// case DISABLED: return "disabled";
134-
// case ENABLED: return "enabled";
135-
// case SELECTED: return "selected";
136-
// case ROLLOVER: return "rollover";
137-
// case PRESSED: return "pressed";
138-
//
139-
//// for (State bs : State.values()) {
140-
//// Image image = mode.loadImage(bs.getFilename(name));
141-
//// if (image != null) {
142-
//// imageMap.put(bs, image);
143-
//// }
144-
//// }
145-
////
146-
//// enabled = true;
147-
//// //updateState();
148-
//// setState(State.ENABLED);
149-
// }
150-
151-
152-
// public void setReverse() {
153-
// gradient = mode.makeGradient("reversed", DIM, DIM);
154-
// }
155-
156-
157-
// public void setGradient(Image gradient) {
158-
// this.gradient = gradient;
159-
// }
160-
161-
162-
// public void setRolloverLabel(JLabel label) {
163-
// rolloverLabel = label;
164-
// }
165-
166-
167129
@Override
168-
public void mouseClicked(MouseEvent e) {
169-
// if (isEnabled()) {
170-
// shift = e.isShiftDown();
171-
// actionPerformed(new ActionEvent(this, ActionEvent.ACTION_PERFORMED,
172-
// null, e.getModifiers()));
173-
// }
174-
}
130+
public void mouseClicked(MouseEvent e) { }
175131

176132

177133
public boolean isShiftDown() {
@@ -181,12 +137,17 @@ public boolean isShiftDown() {
181137

182138
@Override
183139
public void mousePressed(MouseEvent e) {
184-
setPressed(true);
185-
186-
// Need to fire here (or on mouse up) because mouseClicked()
140+
// Using mousePressed() (or mouseReleased()) because mouseClicked()
187141
// won't be fired if the user nudges the mouse while clicking.
188142
// https://github.com/processing/processing/issues/3529
143+
setPressed(true);
144+
189145
shift = e.isShiftDown();
146+
147+
// It looks like ActionEvent expects old-style modifiers,
148+
// so the e.getModifiers() call here may be correct.
149+
// TODO Look into how this is getting used in Modes,
150+
// and either update or add ignore to the deprecation [fry 191008]
190151
actionPerformed(new ActionEvent(this, ActionEvent.ACTION_PERFORMED,
191152
null, e.getModifiers()));
192153
}
@@ -211,25 +172,6 @@ public void setSelected(boolean selected) {
211172
}
212173

213174

214-
/*
215-
@Override
216-
public void keyTyped(KeyEvent e) { }
217-
218-
219-
@Override
220-
public void keyReleased(KeyEvent e) {
221-
updateRollover(e);
222-
}
223-
224-
225-
@Override
226-
public void keyPressed(KeyEvent e) {
227-
System.out.println(e);
228-
updateRollover(e);
229-
}
230-
*/
231-
232-
233175
public String getRolloverText(InputEvent e) {
234176
if (e.isShiftDown()) {
235177
return titleShift;
@@ -240,42 +182,15 @@ public String getRolloverText(InputEvent e) {
240182
}
241183

242184

243-
/*
244-
public void updateRollover(InputEvent e) {
245-
if (rolloverLabel != null) {
246-
if (e.isShiftDown()) {
247-
rolloverLabel.setText(titleShift);
248-
} else if (e.isAltDown()) {
249-
rolloverLabel.setText(titleAlt);
250-
} else {
251-
rolloverLabel.setText(title);
252-
}
253-
}
254-
}
255-
*/
256-
257-
258185
@Override
259186
public void mouseEntered(MouseEvent e) {
260187
toolbar.setRollover(this, e);
261-
/*
262-
rollover = true;
263-
updateRollover(e);
264-
repaint();
265-
*/
266188
}
267189

268190

269191
@Override
270192
public void mouseExited(MouseEvent e) {
271193
toolbar.setRollover(null, e);
272-
/*
273-
rollover = false;
274-
if (rolloverLabel != null) {
275-
rolloverLabel.setText("");
276-
}
277-
repaint();
278-
*/
279194
}
280195

281196

@@ -289,11 +204,6 @@ public void mouseMoved(MouseEvent e) { }
289204

290205
abstract public void actionPerformed(ActionEvent e);
291206

292-
// @Override
293-
// public void actionPerformed(ActionEvent e) {
294-
// // To be overridden by all subclasses
295-
// }
296-
297207

298208
@Override
299209
public Dimension getPreferredSize() {
@@ -311,58 +221,4 @@ public Dimension getMinimumSize() {
311221
public Dimension getMaximumSize() {
312222
return getPreferredSize();
313223
}
314-
315-
316-
// public Image getImage() {
317-
// return imageMap.get(state);
318-
// }
319-
//
320-
//
321-
//// protected void updateState() {
322-
//// state = ButtonState.ENABLED;
323-
//// }
324-
//
325-
//
326-
// public void setEnabled(boolean enabled) {
327-
// this.enabled = enabled;
328-
// if (enabled) {
329-
// if (state == State.DISABLED) {
330-
// setState(State.ENABLED);
331-
// }
332-
// } else {
333-
// if (state == State.ENABLED) {
334-
// setState(State.DISABLED);
335-
// }
336-
// }
337-
// }
338-
//
339-
//
340-
// public void setState(State state) {
341-
// this.state = state;
342-
// }
343-
344-
345-
// public enum State {
346-
// DISABLED, ENABLED, SELECTED, ROLLOVER, PRESSED;
347-
//
348-
// /**
349-
// * @param name the root name
350-
// * @return
351-
// */
352-
// public String getFilename(String name) {
353-
// final int res = Toolkit.highResDisplay() ? 2 : 1;
354-
// return name + "-" + toString() + "-" + res + "x.png";
355-
// }
356-
//
357-
// public String toString() {
358-
// switch (this) {
359-
// case DISABLED: return "disabled";
360-
// case ENABLED: return "enabled";
361-
// case SELECTED: return "selected";
362-
// case ROLLOVER: return "rollover";
363-
// case PRESSED: return "pressed";
364-
// }
365-
// return null;
366-
// }
367-
// }
368224
}

java/src/processing/mode/java/Commander.java

Lines changed: 16 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/*
44
Part of the Processing project - http://processing.org
55
6-
Copyright (c) 2012-15 The Processing Foundation
6+
Copyright (c) 2012-19 The Processing Foundation
77
Copyright (c) 2008-12 Ben Fry and Casey Reas
88
99
This program is free software; you can redistribute it and/or modify
@@ -42,8 +42,6 @@
4242

4343
/**
4444
* Class to handle running Processing from the command line.
45-
*
46-
* @author fry
4745
*/
4846
public class Commander implements RunnerListener {
4947
static final String helpArg = "--help";
@@ -65,7 +63,6 @@ public class Commander implements RunnerListener {
6563
static final int BUILD = 1;
6664
static final int RUN = 2;
6765
static final int PRESENT = 3;
68-
// static final int EXPORT_APPLET = 4;
6966
static final int EXPORT = 4;
7067

7168
Sketch sketch;
@@ -74,19 +71,6 @@ public class Commander implements RunnerListener {
7471
PrintStream systemErr;
7572

7673

77-
static public void main(String[] args) {
78-
// Do this early so that error messages go to the console
79-
Base.setCommandLine();
80-
// init the platform so that prefs and other native code is ready to go
81-
Platform.init();
82-
// make sure a full JDK is installed
83-
//Base.initRequirements();
84-
85-
// launch command line handler
86-
new Commander(args);
87-
}
88-
89-
9074
public Commander(String[] args) {
9175
String sketchPath = null;
9276
File sketchFolder = null;
@@ -152,25 +136,13 @@ public Commander(String[] args) {
152136
embedJava = false;
153137

154138
} else if (arg.startsWith(platformArg)) {
155-
// complainAndQuit("The --platform option has been removed from Processing 2.1.", false);
156139
String platformStr = arg.substring(platformArg.length());
157140
platform = Platform.getIndex(platformStr);
158141
if (platform == -1) {
159142
complainAndQuit(platformStr + " should instead be " +
160143
"'windows', 'macosx', or 'linux'.", true);
161144
}
162145

163-
} else if (arg.startsWith(bitsArg)) {
164-
complainAndQuit("The --bits option has been removed.", false);
165-
// String bitsStr = arg.substring(bitsArg.length());
166-
// if (bitsStr.equals("32")) {
167-
// platformBits = 32;
168-
// } else if (bitsStr.equals("64")) {
169-
// platformBits = 64;
170-
// } else {
171-
// complainAndQuit("Bits should be either 32 or 64, not " + bitsStr, true);
172-
// }
173-
174146
} else if (arg.startsWith(sketchArg)) {
175147
sketchPath = arg.substring(sketchArg.length());
176148
sketchFolder = new File(sketchPath);
@@ -199,13 +171,6 @@ public Commander(String[] args) {
199171
}
200172
String[] sketchArgs = PApplet.subset(args, argOffset);
201173

202-
// if ((outputPath == null) &&
203-
// (task == PREPROCESS || task == BUILD ||
204-
// task == RUN || task == PRESENT)) {
205-
// complainAndQuit("An output path must be specified when using " +
206-
// preprocArg + ", " + buildArg + ", " +
207-
// runArg + ", or " + presentArg + ".");
208-
// }
209174
if (task == HELP) {
210175
printCommandLine(systemOut);
211176
System.exit(0);
@@ -256,8 +221,6 @@ public Commander(String[] args) {
256221

257222
boolean success = false;
258223

259-
// JavaMode javaMode =
260-
// new JavaMode(null, Base.getContentFile("modes/java"));
261224
JavaMode javaMode = (JavaMode)
262225
ModeContribution.load(null, Platform.getContentFile("modes/java"),
263226
"processing.mode.java.JavaMode").getMode();
@@ -389,9 +352,6 @@ static void printCommandLine(PrintStream out) {
389352
out.println("--no-java Do not embed Java. Use at your own risk!");
390353
out.println("--platform Specify the platform (export to application only).");
391354
out.println(" Should be one of 'windows', 'macosx', or 'linux'.");
392-
// out.println("--bits Must be specified if libraries are used that are");
393-
// out.println(" 32- or 64-bit specific such as the OpenGL library.");
394-
// out.println(" Otherwise specify 0 or leave it out.");
395355

396356
out.println();
397357
out.println("The --build, --run, --present, or --export must be the final parameter");
@@ -406,22 +366,31 @@ static void printCommandLine(PrintStream out) {
406366

407367

408368
@Override
409-
public void startIndeterminate() {
410-
}
369+
public void startIndeterminate() { }
411370

412371

413372
@Override
414-
public void stopIndeterminate() {
415-
}
373+
public void stopIndeterminate() { }
416374

417375

418376
@Override
419-
public void statusHalt() {
420-
}
377+
public void statusHalt() { }
421378

422379

423380
@Override
424381
public boolean isHalted() {
425382
return false;
426383
}
384+
385+
386+
static public void main(String[] args) {
387+
// Do this early so that error messages go to the console
388+
Base.setCommandLine();
389+
390+
// init the platform so that prefs and other native code is ready to go
391+
Platform.init();
392+
393+
// launch command line handler
394+
new Commander(args);
395+
}
427396
}

java/src/processing/mode/java/Compiler.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@
3131
import java.lang.reflect.Method;
3232
import java.util.HashMap;
3333

34-
//import org.eclipse.jdt.core.compiler.batch.BatchCompiler;
35-
//import org.eclipse.jdt.core.compiler.CompilationProgress;
36-
3734

3835
public class Compiler {
3936

0 commit comments

Comments
 (0)