Skip to content

Commit d3e0fda

Browse files
authored
Merge pull request #2 from arduino/master
update
2 parents 7c27d09 + 0175a4e commit d3e0fda

File tree

144 files changed

+829
-695
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

144 files changed

+829
-695
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ https://groups.google.com/a/arduino.cc/forum/#!forum/developers
2929
Installation
3030
------------
3131
Detailed instructions for installation in popular operating systems.
32-
For Linux: https://www.arduino.cc/en/Guide/Linux (see also the Arduino playground page http://www.arduino.cc/playground/Learning/Linux)
32+
For Linux: https://www.arduino.cc/en/Guide/Linux (see also the Arduino playground page https://playground.arduino.cc/Learning/Linux)
3333
For macOS X: https://www.arduino.cc/en/Guide/MacOSX
3434
For Windows: https://www.arduino.cc/en/Guide/Windows
3535

@@ -47,7 +47,7 @@ Arduino uses
4747
[avrdude](http://www.nongnu.org/avrdude/),
4848
[bossac](http://www.shumatech.com/web/products/bossa),
4949
[openOCD](http://openocd.org/)
50-
and code from [Processing](http://www.processing.org)
50+
and code from [Processing](https://www.processing.org)
5151
and [Wiring](http://wiring.org.co).
5252

5353
Icon and about image designed by [ToDo](https://www.todo.to.it/)

app/src/cc/arduino/i18n/Languages.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public class Languages {
102102
new Language(tr("Telugu"), "తెలుగు", "te"),
103103
new Language(tr("Thai"), "ภาษาไทย", "th"),
104104
new Language(tr("Turkish"), "Türk", "tr"),
105-
new Language(tr("Ukrainian"), "Український", "uk"),
105+
new Language(tr("Ukrainian"), "Українська", "uk"),
106106
new Language(tr("Vietnamese"), "Tiếng Việt", "vi"),
107107
new Language(tr("Western Frisian"), "Western Frisian", "fy")
108108
};

app/src/cc/arduino/view/preferences/Preferences.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,8 @@ private void initComponents() {
174174
jTabbedPane1.setRequestFocusEnabled(false);
175175

176176
sketchbookLocationLabel.setText(tr("Sketchbook location:"));
177-
177+
sketchbookLocationLabel.setLabelFor(sketchbookLocationField);
178+
178179
sketchbookLocationField.setColumns(40);
179180

180181
browseButton.setText(I18n.PROMPT_BROWSE);
@@ -187,21 +188,28 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
187188
comboLanguageLabel.setText(tr("Editor language: "));
188189

189190
requiresRestartLabel.setText(tr(" (requires restart of Arduino)"));
191+
192+
comboLanguage.getAccessibleContext().setAccessibleName("Editor language (requires restart of Arduino)");
190193

191194
fontSizeLabel.setText(tr("Editor font size: "));
195+
fontSizeLabel.setLabelFor(fontSizeField);
192196

193197
fontSizeField.setColumns(4);
194198

195199
showVerboseLabel.setText(tr("Show verbose output during: "));
196200

197201
verboseCompilationBox.setText(tr("compilation "));
202+
verboseCompilationBox.getAccessibleContext().setAccessibleName("Show verbose output during compilation");
198203

199204
verboseUploadBox.setText(tr("upload"));
205+
verboseUploadBox.getAccessibleContext().setAccessibleName("Show verbose output during upload");
200206

201207
comboWarningsLabel.setText(tr("Compiler warnings: "));
208+
comboWarningsLabel.setLabelFor(comboWarnings);
202209

203210
additionalBoardsManagerLabel.setText(tr("Additional Boards Manager URLs: "));
204211
additionalBoardsManagerLabel.setToolTipText(tr("Enter a comma separated list of urls"));
212+
additionalBoardsManagerLabel.setLabelFor(additionalBoardsManagerField);
205213

206214
additionalBoardsManagerField.setToolTipText(tr("Enter a comma separated list of urls"));
207215

@@ -212,6 +220,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
212220
extendedAdditionalUrlFieldWindowActionPerformed(evt);
213221
}
214222
});
223+
extendedAdditionalUrlFieldWindow.getAccessibleContext().setAccessibleName("New Window");
215224

216225
morePreferencesLabel.setForeground(Color.GRAY);
217226
morePreferencesLabel.setText(tr("More preferences can be edited directly in the file"));
@@ -229,6 +238,7 @@ public void mouseEntered(java.awt.event.MouseEvent evt) {
229238
preferencesFileLabelMouseEntered(evt);
230239
}
231240
});
241+
preferencesFileLabel.setFocusable(true);
232242

233243
arduinoNotRunningLabel.setForeground(Color.GRAY);
234244
arduinoNotRunningLabel.setText(tr("(edit only when Arduino is not running)"));
@@ -280,6 +290,7 @@ public void mouseEntered(java.awt.event.MouseEvent evt) {
280290

281291
scaleSpinner.setModel(new javax.swing.SpinnerNumberModel(100, 100, 400, 5));
282292
scaleSpinner.setEnabled(false);
293+
scaleSpinner.getAccessibleContext().setAccessibleName("Interface scale (requires restart of Arduino)");
283294

284295
autoScaleCheckBox.setSelected(true);
285296
autoScaleCheckBox.setText(tr("Automatic"));
@@ -288,6 +299,7 @@ public void itemStateChanged(java.awt.event.ItemEvent evt) {
288299
autoScaleCheckBoxItemStateChanged(evt);
289300
}
290301
});
302+
autoScaleCheckBox.getAccessibleContext().setAccessibleName("Automatic interface scale (requires restart of Arduino");
291303

292304
jLabel3.setText("%");
293305

app/src/processing/app/Base.java

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,10 @@ static public void main(String args[]) throws Exception {
133133
System.setProperty("java.net.useSystemProxies", "true");
134134

135135
if (OSUtils.isMacOS()) {
136+
System.setProperty("apple.laf.useScreenMenuBar",
137+
String.valueOf(!System.getProperty("os.version").startsWith("10.13")
138+
|| com.apple.eawt.Application.getApplication().isAboutMenuItemPresent()));
139+
136140
ThinkDifferent.init();
137141
}
138142

@@ -388,6 +392,7 @@ public Base(String[] args) throws Exception {
388392
outputFile = new Compiler(sketch).build(progress -> {}, false);
389393
} catch (Exception e) {
390394
// Error during build
395+
e.printStackTrace();
391396
System.exit(1);
392397
}
393398

@@ -967,7 +972,7 @@ public boolean handleQuit() {
967972
// Save out the current prefs state
968973
PreferencesData.save();
969974

970-
if (!OSUtils.isMacOS()) {
975+
if (!OSUtils.hasMacOSStyleMenus()) {
971976
// If this was fired from the menu or an AppleEvent (the Finder),
972977
// then Mac OS X will send the terminate signal itself.
973978
System.exit(0);
@@ -1070,6 +1075,10 @@ public void rebuildImportMenu(JMenu importMenu) {
10701075
importMenu.removeAll();
10711076

10721077
JMenuItem menu = new JMenuItem(tr("Manage Libraries..."));
1078+
// Ctrl+Shift+I on Windows and Linux, Command+Shift+I on macOS
1079+
menu.setAccelerator(KeyStroke.getKeyStroke('I',
1080+
Toolkit.getDefaultToolkit().getMenuShortcutKeyMask() |
1081+
ActionEvent.SHIFT_MASK));
10731082
menu.addActionListener(e -> openLibraryManager("", ""));
10741083
importMenu.add(menu);
10751084
importMenu.addSeparator();
@@ -1093,12 +1102,13 @@ public void actionPerformed(ActionEvent e) {
10931102
List<ContributedLibrary> libs = getSortedLibraries();
10941103
String lastLibType = null;
10951104
for (ContributedLibrary lib : libs) {
1096-
if (lastLibType == null || !lastLibType.equals(lib.getTypes().get(0))) {
1105+
String libType = lib.getTypes().get(0);
1106+
if (!libType.equals(lastLibType)) {
10971107
if (lastLibType != null) {
10981108
importMenu.addSeparator();
10991109
}
1100-
lastLibType = lib.getTypes().get(0);
1101-
JMenuItem platformItem = new JMenuItem(I18n.format(tr("{0} libraries"), lastLibType));
1110+
lastLibType = libType;
1111+
JMenuItem platformItem = new JMenuItem(I18n.format(tr("{0} libraries"), tr(lastLibType)));
11021112
platformItem.setEnabled(false);
11031113
importMenu.add(platformItem);
11041114
}
@@ -1168,7 +1178,7 @@ public void rebuildExamplesMenu(JMenu menu) {
11681178
// any incompatible sketchbook libs further divided into their own list.
11691179
// The 7th list of "other" libraries should always be empty, but serves
11701180
// as a safety feature to prevent any library from vanishing.
1171-
LibraryList allLibraries = new LibraryList(BaseNoGui.librariesIndexer.getInstalledLibraries());
1181+
LibraryList allLibraries = BaseNoGui.librariesIndexer.getInstalledLibraries();
11721182
LibraryList ideLibs = new LibraryList();
11731183
LibraryList retiredIdeLibs = new LibraryList();
11741184
LibraryList platformLibs = new LibraryList();
@@ -1399,7 +1409,7 @@ public void rebuildBoardsMenu() throws Exception {
13991409
// The first custom menu is the "Board" selection submenu
14001410
JMenu boardMenu = new JMenu(tr("Board"));
14011411
boardMenu.putClientProperty("removeOnWindowDeactivation", true);
1402-
MenuScroller.setScrollerFor(boardMenu);
1412+
MenuScroller.setScrollerFor(boardMenu).setTopFixedCount(1);
14031413

14041414
boardMenu.add(new JMenuItem(new AbstractAction(tr("Boards Manager...")) {
14051415
public void actionPerformed(ActionEvent actionevent) {
@@ -1868,11 +1878,6 @@ public void handleFontSizeChange(int change) {
18681878
getEditors().forEach(Editor::applyPreferences);
18691879
}
18701880

1871-
// XXX: Remove this method and make librariesIndexer non-static
1872-
static public LibraryList getLibraries() {
1873-
return BaseNoGui.librariesIndexer.getInstalledLibraries();
1874-
}
1875-
18761881
public List<JMenu> getBoardsCustomMenus() {
18771882
return boardsCustomMenus;
18781883
}

app/src/processing/app/Editor.java

Lines changed: 39 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ public boolean test(SketchController sketch) {
158158

159159
static volatile AbstractMonitor serialMonitor;
160160
static AbstractMonitor serialPlotter;
161-
161+
162162
final EditorHeader header;
163163
EditorStatus status;
164164
EditorConsole console;
@@ -248,7 +248,7 @@ public void windowDeactivated(WindowEvent e) {
248248

249249
//PdeKeywords keywords = new PdeKeywords();
250250
//sketchbook = new Sketchbook(this);
251-
251+
252252
buildMenuBar();
253253

254254
// For rev 0120, placing things inside a JPanel
@@ -399,8 +399,7 @@ public boolean importData(JComponent src, Transferable transferable) {
399399
statusNotice(tr("One file added to the sketch."));
400400

401401
} else {
402-
statusNotice(
403-
I18n.format(tr("{0} files added to the sketch."), successful));
402+
statusNotice(I18n.format(tr("{0} files added to the sketch."), successful));
404403
}
405404
return true;
406405
}
@@ -619,7 +618,7 @@ public void actionPerformed(ActionEvent e) {
619618
fileMenu.add(item);
620619

621620
// macosx already has its own preferences and quit menu
622-
if (!OSUtils.isMacOS()) {
621+
if (!OSUtils.hasMacOSStyleMenus()) {
623622
fileMenu.addSeparator();
624623

625624
item = newJMenuItem(tr("Preferences"), ',');
@@ -732,16 +731,16 @@ private JMenu buildToolsMenu() {
732731

733732
addInternalTools(toolsMenu);
734733

735-
JMenuItem item = newJMenuItemShift(tr("Serial Monitor"), 'M');
734+
JMenuItem item = newJMenuItemShift(tr("Manage Libraries..."), 'I');
735+
item.addActionListener(e -> base.openLibraryManager("", ""));
736+
toolsMenu.add(item);
737+
738+
item = newJMenuItemShift(tr("Serial Monitor"), 'M');
736739
item.addActionListener(e -> handleSerial());
737740
toolsMenu.add(item);
738741

739742
item = newJMenuItemShift(tr("Serial Plotter"), 'L');
740-
item.addActionListener(new ActionListener() {
741-
public void actionPerformed(ActionEvent e) {
742-
handlePlotter();
743-
}
744-
});
743+
item.addActionListener(e -> handlePlotter());
745744
toolsMenu.add(item);
746745

747746
addTools(toolsMenu, BaseNoGui.getToolsFolder());
@@ -769,6 +768,7 @@ public void actionPerformed(ActionEvent e) {
769768

770769
base.rebuildProgrammerMenu();
771770
programmersMenu = new JMenu(tr("Programmer"));
771+
MenuScroller.setScrollerFor(programmersMenu);
772772
base.getProgrammerMenus().stream().forEach(programmersMenu::add);
773773
toolsMenu.add(programmersMenu);
774774

@@ -947,14 +947,14 @@ private String findClassInZipFile(String base, File file) {
947947
} finally {
948948
if (zipFile != null) {
949949
try {
950-
zipFile.close();
951-
} catch (IOException e) {
952-
// noop
953-
}
954-
}
955-
}
956-
return null;
957-
}
950+
zipFile.close();
951+
} catch (IOException e) {
952+
// noop
953+
}
954+
}
955+
}
956+
return null;
957+
}
958958

959959
public void updateKeywords(PdeKeywords keywords) {
960960
for (EditorTab tab : tabs)
@@ -1252,7 +1252,7 @@ public void actionPerformed(ActionEvent e) {
12521252
menu.add(item);
12531253

12541254
// macosx already has its own about menu
1255-
if (!OSUtils.isMacOS()) {
1255+
if (!OSUtils.hasMacOSStyleMenus()) {
12561256
menu.addSeparator();
12571257
item = new JMenuItem(tr("About Arduino"));
12581258
item.addActionListener(new ActionListener() {
@@ -1476,6 +1476,7 @@ static public JMenuItem newJMenuItem(String title, int what) {
14761476
/**
14771477
* Like newJMenuItem() but adds shift as a modifier for the key command.
14781478
*/
1479+
// Control + Shift + K seems to not be working on linux (Xubuntu 17.04, 2017-08-19)
14791480
static public JMenuItem newJMenuItemShift(String title, int what) {
14801481
JMenuItem menuItem = new JMenuItem(title);
14811482
menuItem.setAccelerator(KeyStroke.getKeyStroke(what, SHORTCUT_KEY_MASK | ActionEvent.SHIFT_MASK));
@@ -1812,7 +1813,7 @@ protected boolean checkModified() {
18121813
String prompt = I18n.format(tr("Save changes to \"{0}\"? "),
18131814
sketch.getName());
18141815

1815-
if (!OSUtils.isMacOS()) {
1816+
if (!OSUtils.hasMacOSStyleMenus()) {
18161817
int result =
18171818
JOptionPane.showConfirmDialog(this, prompt, tr("Close"),
18181819
JOptionPane.YES_NO_CANCEL_OPTION,
@@ -2096,18 +2097,19 @@ private boolean serialPrompt() {
20962097
names[i] = portMenu.getItem(i).getText();
20972098
}
20982099

2100+
// FIXME: This is horribly unreadable
20992101
String result = (String)
2100-
JOptionPane.showInputDialog(this,
2101-
I18n.format(
2102-
tr("Serial port {0} not found.\n" +
2103-
"Retry the upload with another serial port?"),
2104-
PreferencesData.get("serial.port")
2105-
),
2106-
"Serial port not found",
2107-
JOptionPane.PLAIN_MESSAGE,
2108-
null,
2109-
names,
2110-
0);
2102+
JOptionPane.showInputDialog(this,
2103+
I18n.format(
2104+
tr("Serial port {0} not found.\n" +
2105+
"Retry the upload with another serial port?"),
2106+
PreferencesData.get("serial.port")
2107+
),
2108+
"Serial port not found",
2109+
JOptionPane.PLAIN_MESSAGE,
2110+
null,
2111+
names,
2112+
0);
21112113
if (result == null) return false;
21122114
selectSerialPort(result);
21132115
base.onBoardOrPortChange();
@@ -2321,7 +2323,7 @@ public void handleSerial() {
23212323
return;
23222324
}
23232325
}
2324-
2326+
23252327
if (serialMonitor != null) {
23262328
// The serial monitor already exists
23272329

@@ -2351,14 +2353,14 @@ public void handleSerial() {
23512353
}
23522354

23532355
serialMonitor = new MonitorFactory().newMonitor(port);
2354-
2356+
23552357
if (serialMonitor == null) {
23562358
String board = port.getPrefs().get("board");
23572359
String boardName = BaseNoGui.getPlatform().resolveDeviceByBoardID(BaseNoGui.packages, board);
23582360
statusError(I18n.format(tr("Serial monitor is not supported on network ports such as {0} for the {1} in this release"), PreferencesData.get("serial.port"), boardName));
23592361
return;
23602362
}
2361-
2363+
23622364
Base.setIcon(serialMonitor);
23632365

23642366
// If currently uploading, disable the monitor (it will be later
@@ -2418,7 +2420,7 @@ public void handleSerial() {
24182420
} while (serialMonitor.requiresAuthorization() && !success);
24192421

24202422
}
2421-
2423+
24222424
public void handlePlotter() {
24232425
if(serialMonitor != null) {
24242426
if(serialMonitor.isClosed()) {
@@ -2428,7 +2430,7 @@ public void handlePlotter() {
24282430
return;
24292431
}
24302432
}
2431-
2433+
24322434
if (serialPlotter != null) {
24332435
// The serial plotter already exists
24342436

app/src/processing/app/helpers/Keys.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ public static KeyStroke ctrlShift(int keyCode) {
220220
}
221221

222222
/**
223-
* Creates a KeyCode for the "menu shortcut" + shift + the key passed in. By
223+
* Creates a KeyCode for the "menu shortcut" + alt + the key passed in. By
224224
* default, the menu shortcut is the ctrl key (hence the method name), but
225225
* platforms might use a different key (like the Apple key on OSX).
226226
*

0 commit comments

Comments
 (0)