Skip to content

Commit fc896db

Browse files
Merge pull request #1 from arduino/master
Sync changes from arduino/Arduino:master
2 parents 06e9981 + 465c753 commit fc896db

File tree

469 files changed

+49869
-27420
lines changed

Some content is hidden

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

469 files changed

+49869
-27420
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ build/*.tar.bz2
1818
build/windows/work/
1919
build/windows/*.zip
2020
build/windows/*.tgz
21+
build/windows/*.tar.bz2
2122
build/windows/libastylej*
23+
build/windows/liblistSerials*
2224
build/windows/arduino-*.zip
2325
build/windows/dist/*.tar.gz
2426
build/windows/dist/*.tar.bz2
@@ -49,6 +51,7 @@ build/linux/liblistSerials*
4951
build/shared/reference*.zip
5052
build/shared/Edison*.zip
5153
build/shared/Galileo*.zip
54+
build/shared/WiFi101-Updater-ArduinoIDE-Plugin*.zip
5255
test-bin
5356
*.iml
5457
.idea

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
Arduino
22
========
33

4-
* Arduino is an open-source physical computing platform based on a simple i/o
4+
* Arduino is an open-source physical computing platform based on a simple I/O
55
board and a development environment that implements the Processing/Wiring
66
language. Arduino can be used to develop stand-alone interactive objects or
7-
can be connected to software on your computer (e.g. Flash, Processing, MaxMSP).
7+
can be connected to software on your computer (e.g. Flash, Processing and MaxMSP).
88
The boards can be assembled by hand or purchased preassembled; the open-source
99
IDE can be downloaded for free at http://www.arduino.cc/en/Main/Software
1010

1111
* For more information, see the website at: http://www.arduino.cc/
1212
or the forums at: http://www.arduino.cc/forum/
13-
You can also follow Arduino on twitter at: https://twitter.com/arduino or
13+
You can also follow Arduino on Twitter at: https://twitter.com/arduino or
1414
like Arduino on Facebook at: https://www.facebook.com/official.arduino
1515

1616
* To report a *bug* in the software or to request *a simple enhancement* go to:

app/build.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@
112112
<classpath>
113113
<pathelement location="bin"/>
114114
<pathelement location="test-bin"/>
115+
<pathelement location="${work.dir}/lib/jna-4.2.2.jar"/>
116+
<pathelement location="${work.dir}/lib/jna-platform-4.2.2.jar"/>
115117
<path refid="class.path.test"/>
116118
</classpath>
117119

app/lib/jna-4.1.0.jar

-893 KB
Binary file not shown.

app/lib/jna-platform-4.1.0.jar

-1.4 MB
Binary file not shown.

app/src/cc/arduino/UpdatableBoardsLibsFakeURLsHandler.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,22 +53,26 @@ public void hyperlinkUpdate(HyperlinkEvent event) {
5353
}
5454

5555
URL url = event.getURL();
56+
openBoardLibManager(url);
57+
}
5658

59+
public void openBoardLibManager(URL url) {
5760
if (BOARDSMANAGER.equals(url.getHost())) {
5861
try {
59-
base.openBoardsManager("", "DropdownUpdatableCoresItem");
62+
base.openBoardsManager(url.getRef() == null ? "": url.getRef() , url.getPath() == null ? "" : url.getPath().replace("/", ""));
6063
} catch (Exception e) {
6164
e.printStackTrace();
6265
}
6366
return;
6467
}
6568

6669
if (LIBRARYMANAGER.equals(url.getHost())) {
67-
base.openLibraryManager("DropdownUpdatableLibrariesItem");
70+
base.openLibraryManager(url.getRef() == null ? "": url.getRef() , url.getPath() == null ? "" : url.getPath().replace("/", ""));
6871
return;
6972
}
7073

7174
throw new IllegalArgumentException(url.getHost() + " is invalid");
75+
7276
}
7377

7478
}

app/src/cc/arduino/contributions/ContributionsSelfCheck.java

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,14 @@
3636
import cc.arduino.view.NotificationPopup;
3737
import processing.app.Base;
3838
import processing.app.BaseNoGui;
39+
import processing.app.Editor;
3940
import processing.app.I18n;
4041

4142
import javax.swing.*;
4243
import javax.swing.event.HyperlinkListener;
44+
45+
import java.awt.event.WindowEvent;
46+
import java.awt.event.WindowFocusListener;
4347
import java.util.TimerTask;
4448

4549
import static processing.app.I18n.tr;
@@ -83,20 +87,42 @@ public void run() {
8387

8488
String text;
8589
if (updatableLibraries > 0 && updatablePlatforms <= 0) {
86-
text = I18n.format(tr("Updates available for some of your {0}libraries{1}"), "<a href=\"http://librarymanager\">", "</a>");
90+
text = I18n.format(tr("Updates available for some of your {0}libraries{1}"), "<a href=\"http://librarymanager/DropdownUpdatableLibrariesItem\">", "</a>");
8791
} else if (updatableLibraries <= 0 && updatablePlatforms > 0) {
88-
text = I18n.format(tr("Updates available for some of your {0}boards{1}"), "<a href=\"http://boardsmanager\">", "</a>");
92+
text = I18n.format(tr("Updates available for some of your {0}boards{1}"), "<a href=\"http://boardsmanager/DropdownUpdatableCoresItem\">", "</a>");
8993
} else {
90-
text = I18n.format(tr("Updates available for some of your {0}boards{1} and {2}libraries{3}"), "<a href=\"http://boardsmanager\">", "</a>", "<a href=\"http://librarymanager\">", "</a>");
94+
text = I18n.format(tr("Updates available for some of your {0}boards{1} and {2}libraries{3}"), "<a href=\"http://boardsmanager/DropdownUpdatableCoresItem\">", "</a>", "<a href=\"http://librarymanager/DropdownUpdatableLibrariesItem\">", "</a>");
9195
}
9296

9397
if (cancelled) {
9498
return;
9599
}
96100

97101
SwingUtilities.invokeLater(() -> {
98-
notificationPopup = new NotificationPopup(base.getActiveEditor(), hyperlinkListener, text);
99-
notificationPopup.setVisible(true);
102+
Editor ed = base.getActiveEditor();
103+
notificationPopup = new NotificationPopup(ed, hyperlinkListener, text);
104+
if (ed.isFocused()) {
105+
notificationPopup.begin();
106+
return;
107+
}
108+
109+
// If the IDE is not focused wait until it is focused again to
110+
// display the notification, this avoids the annoying side effect
111+
// to "steal" the focus from another application.
112+
WindowFocusListener wfl = new WindowFocusListener() {
113+
@Override
114+
public void windowLostFocus(WindowEvent evt) {
115+
}
116+
117+
@Override
118+
public void windowGainedFocus(WindowEvent evt) {
119+
notificationPopup.begin();
120+
for (Editor e : base.getEditors())
121+
e.removeWindowFocusListener(this);
122+
}
123+
};
124+
for (Editor e : base.getEditors())
125+
e.addWindowFocusListener(wfl);
100126
});
101127
}
102128

app/src/cc/arduino/contributions/libraries/ui/ContributedLibraryTableCellJPanel.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ private JTextPane makeNewDescription() {
221221
StyleSheet s = html.getStyleSheet();
222222
s.addRule("body { margin: 0; padding: 0;"
223223
+ "font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;"
224+
+ "color: black;"
224225
+ "font-size: " + 10 * Theme.getScale() / 100 + "; }");
225226
}
226227
description.setOpaque(false);

app/src/cc/arduino/contributions/ui/InstallerJDialog.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,10 @@ protected void onFilter(String[] _filters) {
123123
contribTable.getCellEditor().stopCellEditing();
124124
}
125125
updateIndexFilter(filters, categoryFilter);
126+
if (contribModel.getRowCount() == 1) {
127+
// TODO: understand why it doesn't work
128+
//contribTable.addRowSelectionInterval(0, 0);
129+
}
126130
}
127131
};
128132

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ public class Languages {
3838
static {
3939
languages = new Language[]{
4040
new Language(tr("System Default"), "", ""),
41+
new Language(tr("Acoli"), "Lwo", "ach"),
4142
new Language(tr("Afrikaans"), "Afrikaans", "af"),
4243
new Language(tr("Albanian"), "shqip", "sq"),
4344
new Language(tr("Arabic"), "العربية", "ar"),
@@ -52,8 +53,8 @@ public class Languages {
5253
new Language(tr("Canadian French"), "Canadienne-français", "fr_CA"),
5354
new Language(tr("Catalan"), "Català", "ca"),
5455
new Language(tr("Chinese (China)"), "简体中文", "zh_CN"),
55-
new Language(tr("Chinese (Taiwan) (Big5)"), "", "zh_TW.Big5"),
56-
new Language(tr("Chinese (Taiwan)"), "", "zh_TW"),
56+
new Language(tr("Chinese (Taiwan) (Big5)"), "台語 (Big5)", "zh_TW.Big5"),
57+
new Language(tr("Chinese (Taiwan)"), "台語", "zh_TW"),
5758
new Language(tr("Croatian"), "Hrvatski", "hr_HR"),
5859
new Language(tr("Czech (Czech Republic)"), "český (Czech Republic)", "cs_CZ"),
5960
new Language(tr("Danish (Denmark)"), "Dansk (Denmark)", "da_DK"),
@@ -77,6 +78,7 @@ public class Languages {
7778
new Language(tr("Indonesian"), "Bahasa Indonesia", "id"),
7879
new Language(tr("Italian"), "Italiano", "it_IT"),
7980
new Language(tr("Japanese"), "日本語", "ja_JP"),
81+
new Language(tr("Kazakh"), "قازاق ٴتىلى", "kk"),
8082
new Language(tr("Korean"), "한국어", "ko_KR"),
8183
new Language(tr("Latvian"), "Latviešu", "lv_LV"),
8284
new Language(tr("Lithuaninan"), "Lietuvių Kalba", "lt_LT"),
@@ -97,6 +99,7 @@ public class Languages {
9799
new Language(tr("Swedish"), "Svenska", "sv"),
98100
new Language(tr("Talossan"), "Talossan", "tzl"),
99101
new Language(tr("Tamil"), "தமிழ்", "ta"),
102+
new Language(tr("Telugu"), "తెలుగు", "te"),
100103
new Language(tr("Thai"), "ภาษาไทย", "th"),
101104
new Language(tr("Turkish"), "Türk", "tr"),
102105
new Language(tr("Ukrainian"), "Український", "uk"),

app/src/cc/arduino/packages/formatter/AStyle.java

Lines changed: 2 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,8 @@
3333
import processing.app.BaseNoGui;
3434
import processing.app.Editor;
3535
import processing.app.helpers.FileUtils;
36-
import processing.app.syntax.SketchTextArea;
3736
import processing.app.tools.Tool;
3837

39-
import javax.swing.text.BadLocationException;
4038
import java.io.File;
4139
import java.io.IOException;
4240

@@ -78,65 +76,20 @@ public void init(Editor editor) {
7876

7977
@Override
8078
public void run() {
81-
String originalText = editor.getText();
79+
String originalText = editor.getCurrentTab().getText();
8280
String formattedText = aStyleInterface.AStyleMain(originalText, formatterConfiguration);
8381

8482
if (formattedText.equals(originalText)) {
8583
editor.statusNotice(tr("No changes necessary for Auto Format."));
8684
return;
8785
}
8886

89-
SketchTextArea textArea = editor.getTextArea();
90-
91-
int line = getLineOfOffset(textArea);
92-
int lineOffset = getLineOffset(textArea, line);
93-
94-
textArea.getUndoManager().beginInternalAtomicEdit();
95-
editor.removeAllLineHighlights();
96-
editor.setText(formattedText);
97-
editor.getSketch().setModified(true);
98-
textArea.getUndoManager().endInternalAtomicEdit();
99-
100-
if (line != -1 && lineOffset != -1) {
101-
try {
102-
setCaretPosition(textArea, line, lineOffset);
103-
} catch (BadLocationException e) {
104-
e.printStackTrace();
105-
}
106-
}
87+
editor.getCurrentTab().setText(formattedText);
10788

10889
// mark as finished
10990
editor.statusNotice(tr("Auto Format finished."));
11091
}
11192

112-
private void setCaretPosition(SketchTextArea textArea, int line, int lineOffset) throws BadLocationException {
113-
int caretPosition;
114-
if (line < textArea.getLineCount()) {
115-
caretPosition = Math.min(textArea.getLineStartOffset(line) + lineOffset, textArea.getLineEndOffset(line) - 1);
116-
} else {
117-
caretPosition = textArea.getText().length() - 1;
118-
}
119-
textArea.setCaretPosition(caretPosition);
120-
}
121-
122-
private int getLineOffset(SketchTextArea textArea, int line) {
123-
try {
124-
return textArea.getCaretPosition() - textArea.getLineStartOffset(line);
125-
} catch (BadLocationException e) {
126-
e.printStackTrace();
127-
}
128-
return -1;
129-
}
130-
131-
private int getLineOfOffset(SketchTextArea textArea) {
132-
try {
133-
return textArea.getLineOfOffset(textArea.getCaretPosition());
134-
} catch (BadLocationException e) {
135-
e.printStackTrace();
136-
}
137-
return -1;
138-
}
139-
14093
@Override
14194
public String getMenuTitle() {
14295
return tr("Auto Format");

app/src/cc/arduino/view/Event.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public class Event extends ActionEvent {
3939

4040
public Event(Object source, int id, String command) {
4141
super(source, id, command);
42-
this.payload = new HashMap<String, Object>();
42+
this.payload = new HashMap<>();
4343
}
4444

4545
public Map<String, Object> getPayload() {

app/src/cc/arduino/view/GoToLineNumber.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
127127
private void okActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_okActionPerformed
128128
try {
129129
int line = Integer.parseInt(lineNumber.getText());
130-
editor.goToLine(line);
130+
editor.getCurrentTab().goToLine(line);
131131
cancelActionPerformed(evt);
132132
} catch (Exception e) {
133133
// ignore

app/src/cc/arduino/view/NotificationPopup.java

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@
4242
import java.awt.event.MouseEvent;
4343
import java.awt.event.WindowAdapter;
4444
import java.awt.event.WindowEvent;
45+
import java.util.Timer;
46+
import java.util.TimerTask;
4547

4648
import javax.swing.ImageIcon;
4749
import javax.swing.JButton;
@@ -52,16 +54,25 @@
5254
import javax.swing.border.LineBorder;
5355
import javax.swing.event.HyperlinkListener;
5456

57+
import cc.arduino.Constants;
5558
import processing.app.Theme;
5659

5760
public class NotificationPopup extends JDialog {
5861

62+
private Timer autoCloseTimer = new Timer(false);
63+
private boolean autoClose = true;
64+
5965
public NotificationPopup(Frame parent, HyperlinkListener hyperlinkListener,
6066
String message) {
67+
this(parent, hyperlinkListener, message, true);
68+
}
69+
70+
public NotificationPopup(Frame parent, HyperlinkListener hyperlinkListener,
71+
String message, boolean _autoClose) {
6172
super(parent, false);
73+
autoClose = _autoClose;
6274
setLayout(new FlowLayout());
6375
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
64-
setAlwaysOnTop(true);
6576
setUndecorated(true);
6677
setResizable(false);
6778

@@ -131,6 +142,21 @@ private void updateLocation(Frame parent) {
131142
}
132143

133144
public void close() {
145+
if (autoClose) {
146+
autoCloseTimer.cancel();
147+
}
134148
dispatchEvent(new WindowEvent(this, WindowEvent.WINDOW_CLOSING));
135149
}
150+
151+
public void begin() {
152+
if (autoClose) {
153+
autoCloseTimer.schedule(new TimerTask() {
154+
@Override
155+
public void run() {
156+
close();
157+
}
158+
}, Constants.NOTIFICATION_POPUP_AUTOCLOSE_DELAY);
159+
}
160+
setVisible(true);
161+
}
136162
}

app/src/cc/arduino/view/SplashScreenHelper.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,12 @@ public class SplashScreenHelper {
5151

5252
public SplashScreenHelper(SplashScreen splash) {
5353
this.splash = splash;
54-
Toolkit tk = Toolkit.getDefaultToolkit();
55-
desktopHints = (Map) tk.getDesktopProperty("awt.font.desktophints");
54+
if (splash != null) {
55+
Toolkit tk = Toolkit.getDefaultToolkit();
56+
desktopHints = (Map) tk.getDesktopProperty("awt.font.desktophints");
57+
} else {
58+
desktopHints = null;
59+
}
5660
}
5761

5862
public void splashText(String text) {

0 commit comments

Comments
 (0)