Skip to content

Commit 52dccc6

Browse files
authored
Merge branch 'processing:master' into master
2 parents 4de9d85 + 7d41a70 commit 52dccc6

22 files changed

+276
-238
lines changed

app/src/processing/app/Base.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@
5252
public class Base {
5353
// Added accessors for 0218 because the UpdateCheck class was not properly
5454
// updating the values, due to javac inlining the static final values.
55-
static private final int REVISION = 1276;
55+
static private final int REVISION = 1277;
5656
/** This might be replaced by main() if there's a lib/version.txt file. */
57-
static private String VERSION_NAME = "1276"; //$NON-NLS-1$
57+
static private String VERSION_NAME = "1277"; //$NON-NLS-1$
5858

5959
static final public String SKETCH_BUNDLE_EXT = ".pdez";
6060
static final public String CONTRIB_BUNDLE_EXT = ".pdex";

app/src/processing/app/syntax/DefaultInputHandler.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ public InputHandler copy() {
129129
*/
130130
public void keyPressed(KeyEvent evt) {
131131
int keyCode = evt.getKeyCode();
132-
int modifiers = evt.getModifiers();
132+
int modifiers = evt.getModifiersEx();
133133

134134
// moved this earlier so it doesn't get random meta clicks
135135
if (keyCode == KeyEvent.VK_CONTROL ||
@@ -141,14 +141,14 @@ public void keyPressed(KeyEvent evt) {
141141

142142
// Don't get command-s or other menu key equivalents on macOS
143143
// unless it's something that's specifically bound (cmd-left or right)
144-
if ((modifiers & InputEvent.META_MASK) != 0) {
144+
if ((modifiers & InputEvent.META_DOWN_MASK) != 0) {
145145
KeyStroke keyStroke = KeyStroke.getKeyStroke(keyCode, modifiers);
146146
if (bindings.get(keyStroke) == null) {
147147
return;
148148
}
149149
}
150150

151-
if ((modifiers & ~InputEvent.SHIFT_MASK) != 0
151+
if ((modifiers & ~InputEvent.SHIFT_DOWN_MASK) != 0
152152
|| evt.isActionKey()
153153
|| keyCode == KeyEvent.VK_BACK_SPACE
154154
|| keyCode == KeyEvent.VK_DELETE
@@ -174,16 +174,16 @@ public void keyPressed(KeyEvent evt) {
174174
* Handle a key typed event. This inserts the key into the text area.
175175
*/
176176
public void keyTyped(KeyEvent evt) {
177-
int modifiers = evt.getModifiers();
177+
int modifiers = evt.getModifiersEx();
178178
char c = evt.getKeyChar();
179179

180180
// This is the cmd key on macOS. Added this because
181181
// menu shortcuts were being passed through as legit keys.
182-
if ((modifiers & InputEvent.META_MASK) != 0) return;
182+
if ((modifiers & InputEvent.META_DOWN_MASK) != 0) return;
183183

184184
// Prevent CTRL-/ from going through as a typed '/' character
185185
// http://code.google.com/p/processing/issues/detail?id=596
186-
if ((modifiers & InputEvent.CTRL_MASK) != 0 && c == '/') return;
186+
if ((modifiers & InputEvent.CTRL_DOWN_MASK) != 0 && c == '/') return;
187187

188188
if (c != KeyEvent.CHAR_UNDEFINED) {
189189
if (c >= 0x20 && c != 0x7f) {
@@ -236,16 +236,16 @@ static public KeyStroke parseKeyStroke(String keyStroke) {
236236
for (int i = 0; i < index; i++) {
237237
switch (Character.toUpperCase(keyStroke.charAt(i))) {
238238
case 'A':
239-
modifiers |= InputEvent.ALT_MASK;
239+
modifiers |= InputEvent.ALT_DOWN_MASK;
240240
break;
241241
case 'C':
242-
modifiers |= InputEvent.CTRL_MASK;
242+
modifiers |= InputEvent.CTRL_DOWN_MASK;
243243
break;
244244
case 'M':
245-
modifiers |= InputEvent.META_MASK;
245+
modifiers |= InputEvent.META_DOWN_MASK;
246246
break;
247247
case 'S':
248-
modifiers |= InputEvent.SHIFT_MASK;
248+
modifiers |= InputEvent.SHIFT_DOWN_MASK;
249249
break;
250250
}
251251
}

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

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,15 @@ public void mousePressed(MouseEvent e) {
145145
shift = e.isShiftDown();
146146

147147
// 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, and either
150-
// update or add ignore to the deprecation [fry 191008]
151-
// https://github.com/processing/processing4/issues/67
148+
// so the e.getModifiers() call is actually correct.
149+
// There's an open JDK bug for this, but it remains unresolved:
150+
// https://bugs.openjdk.java.net/browse/JDK-8186024
151+
152+
// Mostly this is only used for shift, but some modes also make use of
153+
// alt as a way to control debug stepping and whatnot. [fry 210813]
154+
// https://github.com/processing/processing4/issues/67
155+
156+
//noinspection deprecation
152157
actionPerformed(new ActionEvent(this, ActionEvent.ACTION_PERFORMED,
153158
null, e.getModifiers()));
154159
}

app/src/processing/app/ui/EditorToolbar.java

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343

4444
import processing.app.Base;
4545
import processing.app.Language;
46+
import processing.app.Messages;
4647
import processing.app.Mode;
4748

4849

@@ -321,8 +322,9 @@ public void updateTheme() {
321322
titleFont = Theme.getFont("mode.title.font");
322323
titleColor = Theme.getColor("mode.title.color");
323324

324-
// getGraphics() is null and no offscreen yet
325-
titleWidth = getToolkit().getFontMetrics(titleFont).stringWidth(title);
325+
// getGraphics() is null (even for editor) and no offscreen yet
326+
//titleWidth = getToolkit().getFontMetrics(titleFont).stringWidth(title);
327+
//titleWidth = editor.getGraphics().getFontMetrics(titleFont).stringWidth(title);
326328

327329
backgroundColor = Theme.getColor("mode.background.color");
328330
outlineColor = Theme.getColor("mode.outline.color");
@@ -372,7 +374,17 @@ public void paintComponent(Graphics screen) {
372374

373375
@Override
374376
public Dimension getPreferredSize() {
375-
return new Dimension(MODE_GAP_WIDTH + titleWidth +
377+
int tempWidth = titleWidth; // with any luck, this is set
378+
if (tempWidth == 0) {
379+
Graphics g = getGraphics();
380+
// the Graphics object may not be ready yet, being careful
381+
if (g != null) {
382+
tempWidth = getFontMetrics(titleFont).stringWidth(title);
383+
} else {
384+
Messages.err("null Graphics in EditorToolbar.getPreferredSize()");
385+
}
386+
}
387+
return new Dimension(MODE_GAP_WIDTH + tempWidth +
376388
ARROW_GAP_WIDTH + ARROW_WIDTH + MODE_GAP_WIDTH,
377389
EditorButton.DIM);
378390
}

build/shared/lib/languages/PDE.properties

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,11 @@ menu.help.libraries_reference = Libraries Reference
136136
menu.help.tools_reference = Tools Reference
137137
menu.help.empty = (empty)
138138
menu.help.online = Online
139+
140+
# Only include the .url lines in the translation file if there
141+
# is an official translated version of the link that can be used.
142+
# Otherwise any change here will have to be copied to all languages.
143+
# https://github.com/processing/processing4/issues/250
139144
menu.help.getting_started = Getting Started
140145
menu.help.getting_started.url = https://processing.org/tutorials/gettingstarted/
141146
menu.help.troubleshooting = Troubleshooting

build/shared/lib/languages/PDE_ar.properties

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,15 +116,15 @@ menu.help.tools_reference = مرجع الأدوات
116116
menu.help.empty = (فارغ)
117117
menu.help.online = متصل
118118
menu.help.getting_started = البدء
119-
menu.help.getting_started.url = http://processing.org/learning/gettingstarted/
119+
# menu.help.getting_started.url = http://processing.org/learning/gettingstarted/
120120
menu.help.troubleshooting = اكتشاف الأخطاء وإصلاحها
121-
menu.help.troubleshooting.url = http://wiki.processing.org/w/Troubleshooting
121+
# menu.help.troubleshooting.url = http://wiki.processing.org/w/Troubleshooting
122122
menu.help.faq = الأسئلة الشائعة
123-
menu.help.faq.url = http://wiki.processing.org/w/FAQ
123+
# menu.help.faq.url = http://wiki.processing.org/w/FAQ
124124
menu.help.foundation = Processing مؤسسة
125-
menu.help.foundation.url = http://processing.org/foundation/
125+
# menu.help.foundation.url = http://processing.org/foundation/
126126
menu.help.visit = Processing.org زيارة
127-
menu.help.visit.url = http://processing.org/
127+
# menu.help.visit.url = http://processing.org/
128128

129129

130130
# ---------------------------------------

build/shared/lib/languages/PDE_el.properties

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -115,15 +115,15 @@ menu.help.tools_reference = Αναφορά Εργαλείων
115115
menu.help.empty = (άδεια)
116116
menu.help.online = Online
117117
menu.help.getting_started = Ξεκινώντας
118-
menu.help.getting_started.url = http://processing.org/learning/gettingstarted/
118+
# menu.help.getting_started.url = http://processing.org/learning/gettingstarted/
119119
menu.help.troubleshooting = Αντιμετώπιση Προβλημάτων
120-
menu.help.troubleshooting.url = http://wiki.processing.org/w/Troubleshooting
120+
# menu.help.troubleshooting.url = http://wiki.processing.org/w/Troubleshooting
121121
menu.help.faq = Συχνές Ερωτήσεις
122-
menu.help.faq.url = http://wiki.processing.org/w/FAQ
122+
# menu.help.faq.url = http://wiki.processing.org/w/FAQ
123123
menu.help.foundation = Το Ίδρυμα Processing
124-
menu.help.foundation.url = http://processing.org/foundation/
124+
# menu.help.foundation.url = http://processing.org/foundation/
125125
menu.help.visit = Επισκευθείτε την Processing.org
126-
menu.help.visit.url = http://processing.org/
126+
# menu.help.visit.url = http://processing.org/
127127

128128

129129
# ---------------------------------------

build/shared/lib/languages/PDE_es.properties

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,15 +114,15 @@ menu.help.tools_reference = Referencia de Herramientas
114114
menu.help.empty = (vacío)
115115
menu.help.online = Online
116116
menu.help.getting_started = Primeros Pasos
117-
menu.help.getting_started.url = http://processing.org/learning/gettingstarted/
117+
# menu.help.getting_started.url = http://processing.org/learning/gettingstarted/
118118
menu.help.troubleshooting = Resolución de problemas
119-
menu.help.troubleshooting.url = http://wiki.processing.org/w/Troubleshooting
119+
# menu.help.troubleshooting.url = http://wiki.processing.org/w/Troubleshooting
120120
menu.help.faq = Preguntas Frecuentes
121-
menu.help.faq.url = http://wiki.processing.org/w/FAQ
121+
# menu.help.faq.url = http://wiki.processing.org/w/FAQ
122122
menu.help.foundation = The Processing Foundation
123-
menu.help.foundation.url = http://processing.org/foundation/
123+
# menu.help.foundation.url = http://processing.org/foundation/
124124
menu.help.visit = Visitar Processing.org
125-
menu.help.visit.url = http://processing.org/
125+
# menu.help.visit.url = http://processing.org/
126126

127127

128128
# ---------------------------------------

build/shared/lib/languages/PDE_it.properties

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,15 +116,15 @@ menu.help.tools_reference = Guida degli Strumenti
116116
menu.help.empty = (vuoto)
117117
menu.help.online = Online
118118
menu.help.getting_started = Primi Passi
119-
menu.help.getting_started.url = http://processing.org/learning/gettingstarted/
119+
# menu.help.getting_started.url = http://processing.org/learning/gettingstarted/
120120
menu.help.troubleshooting = Risoluzione dei Problemi
121-
menu.help.troubleshooting.url = http://wiki.processing.org/w/Troubleshooting
121+
# menu.help.troubleshooting.url = http://wiki.processing.org/w/Troubleshooting
122122
menu.help.faq = Domande Frequenti
123-
menu.help.faq.url = http://wiki.processing.org/w/FAQ
123+
# menu.help.faq.url = http://wiki.processing.org/w/FAQ
124124
menu.help.foundation = La Processing Foundation
125-
menu.help.foundation.url = http://processing.org/foundation/
125+
# menu.help.foundation.url = http://processing.org/foundation/
126126
menu.help.visit = Visita Processing.org
127-
menu.help.visit.url = http://processing.org/
127+
# menu.help.visit.url = http://processing.org/
128128

129129

130130
# ---------------------------------------

build/shared/lib/languages/PDE_ja.properties

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,15 +116,15 @@ menu.help.tools_reference = ツール・リファレンス
116116
menu.help.empty = (空)
117117
menu.help.online = オンライン
118118
menu.help.getting_started = はじめの一歩
119-
menu.help.getting_started.url = http://processing.org/learning/gettingstarted/
119+
# menu.help.getting_started.url = http://processing.org/learning/gettingstarted/
120120
menu.help.troubleshooting = 問題解決
121-
menu.help.troubleshooting.url = http://wiki.processing.org/w/Troubleshooting
121+
# menu.help.troubleshooting.url = http://wiki.processing.org/w/Troubleshooting
122122
menu.help.faq = よくある質問
123-
menu.help.faq.url = http://wiki.processing.org/w/FAQ
123+
# menu.help.faq.url = http://wiki.processing.org/w/FAQ
124124
menu.help.foundation = Processing Foundation
125-
menu.help.foundation.url = http://processing.org/foundation/
125+
# menu.help.foundation.url = http://processing.org/foundation/
126126
menu.help.visit = Processing.org にアクセスする
127-
menu.help.visit.url = http://processing.org/
127+
# menu.help.visit.url = http://processing.org/
128128

129129

130130
# ---------------------------------------

0 commit comments

Comments
 (0)