Skip to content

Commit 94e6ad5

Browse files
author
jdf
committed
Now you can enable/disable the toolbar. Unfortunately, the way the default runner works makes this fact useless.
1 parent e2f12e6 commit 94e6ad5

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

app/src/processing/app/EditorToolbar.java

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ public class EditorToolbar extends JComponent implements MouseInputListener, Key
9494

9595
boolean shiftPressed;
9696

97-
9897
public EditorToolbar(Editor editor, JMenu menu) {
9998
this.editor = editor;
10099
this.menu = menu;
@@ -119,7 +118,6 @@ public EditorToolbar(Editor editor, JMenu menu) {
119118
addMouseListener(this);
120119
addMouseMotionListener(this);
121120
}
122-
123121

124122
protected void loadButtons() {
125123
Image allButtons = Base.getThemeImage("buttons.gif", this);
@@ -137,7 +135,7 @@ protected void loadButtons() {
137135
}
138136
}
139137

140-
138+
@Override
141139
public void paintComponent(Graphics screen) {
142140
// this data is shared by all EditorToolbar instances
143141
if (buttonImages == null) {
@@ -185,6 +183,9 @@ public void paintComponent(Graphics screen) {
185183

186184
/*
187185
// if i ever find the guy who wrote the java2d api, i will hurt him.
186+
*
187+
* whereas I love the Java2D API. --jdf. lol.
188+
*
188189
Graphics2D g2 = (Graphics2D) g;
189190
FontRenderContext frc = g2.getFontRenderContext();
190191
float statusW = (float) statusFont.getStringBounds(status, frc).getWidth();
@@ -198,10 +199,18 @@ public void paintComponent(Graphics screen) {
198199
}
199200

200201
screen.drawImage(offscreen, 0, 0, null);
202+
203+
if (!isEnabled()) {
204+
screen.setColor(new Color(0,0,0,100));
205+
screen.fillRect(0, 0, getWidth(), getHeight());
206+
}
201207
}
202208

203209

204210
public void mouseMoved(MouseEvent e) {
211+
if (!isEnabled())
212+
return;
213+
205214
// mouse events before paint();
206215
if (state == null) return;
207216

@@ -285,6 +294,11 @@ public void mouseExited(MouseEvent e) {
285294

286295

287296
public void mousePressed(MouseEvent e) {
297+
298+
// jdf
299+
if (!isEnabled())
300+
return;
301+
288302
final int x = e.getX();
289303
final int y = e.getY();
290304

0 commit comments

Comments
 (0)