Skip to content

Commit 83636fc

Browse files
committed
Merge pull request #1 from arduino/master
#1
2 parents bd24067 + 4a10c1c commit 83636fc

File tree

449 files changed

+29160
-15367
lines changed

Some content is hidden

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

449 files changed

+29160
-15367
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,6 @@ build/linux/dist/*.tar.gz
1919
build/linux/*.tgz
2020
test-bin
2121
*.iml
22+
build/windows/launch4j-*
23+
build/windows/launcher/launch4j
24+
build/windows/WinAVR-*.zip

README.md

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
Arduino
2+
========
3+
4+
* Arduino is an open-source physical computing platform based on a simple i/o
5+
board and a development environment that implements the Processing/Wiring
6+
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).
8+
The boards can be assembled by hand or purchased preassembled; the open-source
9+
IDE can be downloaded for free.
10+
11+
* For more information, see the website at: http://www.arduino.cc/
12+
or the forums at: http://arduino.cc/forum/
13+
14+
* To report a *bug* in the software or to request *a simple enhancement* go to:
15+
http://github.com/arduino/Arduino/issues
16+
17+
* More complex requests and technical discussion should go on the Arduino Developers
18+
mailing list:
19+
https://groups.google.com/a/arduino.cc/forum/#!forum/developers
20+
21+
* If you're interested in modifying or extending the Arduino software, we strongly
22+
suggest discussing your ideas on the Developers mailing list *before* starting
23+
to work on them. That way you can coordinate with the Arduino Team and others,
24+
giving your work a higher chance of being integrated into the official release
25+
https://groups.google.com/a/arduino.cc/forum/#!forum/developers
26+
27+
Installation
28+
------------
29+
Detailed instructions are in reference/Guide_Windows.html and
30+
reference/Guide_MacOSX.html. For Linux, see the Arduino playground:
31+
http://www.arduino.cc/playground/Learning/Linux
32+
33+
Credits
34+
--------
35+
Arduino is an open source project, supported by many.
36+
37+
The Arduino team is composed of Massimo Banzi, David Cuartielles, Tom Igoe,
38+
Gianluca Martino, Daniela Antonietti, and David A. Mellis.
39+
40+
Arduino uses the [GNU avr-gcc toolchain](http://gcc.gnu.org/wiki/avr-gcc), [avrdude](http://www.nongnu.org/avrdude/), [avr-libc](http://www.nongnu.org/avr-libc/), and code from
41+
[Processing](http://www.processing.org) and [Wiring](http://wiring.org.co).
42+
43+
Icon and about image designed by [ToDo](http://www.todo.to.it/)
44+

app/src/processing/app/Base.java

+45-52
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@
2828
import java.util.*;
2929

3030
import javax.swing.*;
31-
import javax.swing.filechooser.FileNameExtensionFilter;
3231

3332
import processing.app.debug.Compiler;
3433
import processing.app.debug.Target;
3534
import processing.app.helpers.FileUtils;
3635
import processing.app.helpers.filefilters.OnlyDirs;
36+
import processing.app.javax.swing.filechooser.FileNameExtensionFilter;
3737
import processing.app.tools.ZipDeflater;
3838
import processing.core.*;
3939
import static processing.app.I18n._;
@@ -120,7 +120,7 @@ static public void main(String args[]) {
120120
File versionFile = getContentFile("lib/version.txt");
121121
if (versionFile.exists()) {
122122
String version = PApplet.loadStrings(versionFile)[0];
123-
if (!version.equals(VERSION_NAME)) {
123+
if (!version.equals(VERSION_NAME) && !version.equals("${version}")) {
124124
VERSION_NAME = version;
125125
RELEASE = true;
126126
}
@@ -129,6 +129,10 @@ static public void main(String args[]) {
129129
e.printStackTrace();
130130
}
131131

132+
// help 3rd party installers find the correct hardware path
133+
Preferences.set("last.ide." + VERSION_NAME + ".hardwarepath", getHardwarePath());
134+
Preferences.set("last.ide." + VERSION_NAME + ".daterun", "" + (new Date()).getTime() / 1000);
135+
132136
// if (System.getProperty("mrj.version") != null) {
133137
// //String jv = System.getProperty("java.version");
134138
// String ov = System.getProperty("os.version");
@@ -1207,62 +1211,51 @@ public void actionPerformed(ActionEvent event) {
12071211
boolean ifound = false;
12081212

12091213
for (String potentialName : list) {
1210-
File subfolder = new File(folder, potentialName);
1211-
// File libraryFolder = new File(subfolder, "library");
1212-
// File libraryJar = new File(libraryFolder, potentialName + ".jar");
1213-
// // If a .jar file of the same prefix as the folder exists
1214-
// // inside the 'library' subfolder of the sketch
1215-
// if (libraryJar.exists()) {
1216-
String sanityCheck = Sketch.sanitizeName(potentialName);
1217-
if (!sanityCheck.equals(potentialName)) {
1218-
String mess = I18n.format(
1219-
_("The library \"{0}\" cannot be used.\n" +
1220-
"Library names must contain only basic letters and numbers.\n" +
1221-
"(ASCII only and no spaces, and it cannot start with a number)"),
1222-
potentialName
1223-
);
1224-
Base.showMessage(_("Ignoring bad library name"), mess);
1225-
continue;
1226-
}
1214+
File libFolder = new File(folder, potentialName);
1215+
String sanityCheck = Sketch.sanitizeName(potentialName);
1216+
if (!sanityCheck.equals(potentialName)) {
1217+
String mess = I18n.format(_("The library \"{0}\" cannot be used.\n"
1218+
+ "Library names must contain only basic letters and numbers.\n"
1219+
+ "(ASCII only and no spaces, and it cannot start with a number)"),
1220+
potentialName);
1221+
Base.showMessage(_("Ignoring bad library name"), mess);
1222+
continue;
1223+
}
12271224

1228-
String libraryName = potentialName;
1229-
// // get the path for all .jar files in this code folder
1230-
// String libraryClassPath =
1231-
// Compiler.contentsToClassPath(libraryFolder);
1232-
// // grab all jars and classes from this folder,
1233-
// // and append them to the library classpath
1234-
// librariesClassPath +=
1235-
// File.pathSeparatorChar + libraryClassPath;
1236-
// // need to associate each import with a library folder
1237-
// String packages[] =
1238-
// Compiler.packageListFromClassPath(libraryClassPath);
1239-
libraries.add(subfolder);
1225+
String libraryName = potentialName;
1226+
libraries.add(libFolder);
1227+
String libFolderPath = libFolder.getAbsolutePath();
12401228
try {
1241-
String packages[] =
1242-
Compiler.headerListFromIncludePath(subfolder.getAbsolutePath());
1243-
for (String pkg : packages) {
1244-
importToLibraryTable.put(pkg, subfolder);
1229+
String headers[] = Compiler.headerListFromIncludePath(libFolderPath);
1230+
for (String header : headers) {
1231+
// Extract file name (without extension ".h")
1232+
String name = header.substring(0, header.length() - 2);
1233+
1234+
// If the header name equals to the current library folder use it
1235+
if (libFolderPath.endsWith(name)) {
1236+
importToLibraryTable.put(header, libFolder);
1237+
continue;
1238+
}
1239+
1240+
// If a library was already found with this header, keep it if
1241+
// the library's directory name matches the header name.
1242+
File old = importToLibraryTable.get(header);
1243+
if (old != null) {
1244+
if (old.getPath().endsWith(name))
1245+
continue;
1246+
}
1247+
importToLibraryTable.put(header, libFolder);
12451248
}
12461249
} catch (IOException e) {
1247-
showWarning(_("Error"), I18n.format("Unable to list header files in {0}", subfolder), e);
1250+
showWarning(_("Error"), I18n.format(
1251+
"Unable to list header files in {0}", libFolder), e);
12481252
}
12491253

1250-
JMenuItem item = new JMenuItem(libraryName);
1251-
item.addActionListener(listener);
1252-
item.setActionCommand(subfolder.getAbsolutePath());
1253-
menu.add(item);
1254-
ifound = true;
1255-
1256-
// XXX: DAM: should recurse here so that library folders can be nested
1257-
// } else { // not a library, but is still a folder, so recurse
1258-
// JMenu submenu = new JMenu(libraryName);
1259-
// // needs to be separate var, otherwise would set ifound to false
1260-
// boolean found = addLibraries(submenu, subfolder);
1261-
// if (found) {
1262-
// menu.add(submenu);
1263-
// ifound = true;
1264-
// }
1265-
// }
1254+
JMenuItem item = new JMenuItem(libraryName);
1255+
item.addActionListener(listener);
1256+
item.setActionCommand(libFolderPath);
1257+
menu.add(item);
1258+
ifound = true;
12661259
}
12671260
return ifound;
12681261
}

app/src/processing/app/Editor.java

+2
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,8 @@ protected void applyPreferences() {
430430
textarea.setEditable(!external);
431431
saveMenuItem.setEnabled(!external);
432432
saveAsMenuItem.setEnabled(!external);
433+
434+
textarea.setDisplayLineNumbers(Preferences.getBoolean("editor.linenumbers"));
433435

434436
TextAreaPainter painter = textarea.getPainter();
435437
if (external) {

app/src/processing/app/Preferences.java

+12
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ public class Preferences {
177177
JCheckBox exportSeparateBox;
178178
JCheckBox verboseCompilationBox;
179179
JCheckBox verboseUploadBox;
180+
JCheckBox displayLineNumbersBox;
180181
JCheckBox verifyUploadBox;
181182
JCheckBox externalEditorBox;
182183
JCheckBox memoryOverrideBox;
@@ -382,6 +383,15 @@ public void actionPerformed(ActionEvent e) {
382383
box.setBounds(left, top, d.width, d.height);
383384
top += d.height + GUI_BETWEEN;
384385

386+
// [ ] Display line numbers
387+
388+
displayLineNumbersBox = new JCheckBox(_("Display line numbers"));
389+
pain.add(displayLineNumbersBox);
390+
d = displayLineNumbersBox.getPreferredSize();
391+
displayLineNumbersBox.setBounds(left, top, d.width + 10, d.height);
392+
right = Math.max(right, left + d.width);
393+
top += d.height + GUI_BETWEEN;
394+
385395
// [ ] Verify code after upload
386396

387397
verifyUploadBox = new JCheckBox(_("Verify code after upload"));
@@ -571,6 +581,7 @@ protected void applyFrame() {
571581
// put each of the settings into the table
572582
setBoolean("build.verbose", verboseCompilationBox.isSelected());
573583
setBoolean("upload.verbose", verboseUploadBox.isSelected());
584+
setBoolean("editor.linenumbers", displayLineNumbersBox.isSelected());
574585
setBoolean("upload.verify", verifyUploadBox.isSelected());
575586

576587
// setBoolean("sketchbook.closing_last_window_quits",
@@ -634,6 +645,7 @@ protected void showFrame(Editor editor) {
634645
// set all settings entry boxes to their actual status
635646
verboseCompilationBox.setSelected(getBoolean("build.verbose"));
636647
verboseUploadBox.setSelected(getBoolean("upload.verbose"));
648+
displayLineNumbersBox.setSelected(getBoolean("editor.linenumbers"));
637649
verifyUploadBox.setSelected(getBoolean("upload.verify"));
638650

639651
//closingLastQuitsBox.

app/src/processing/app/Sketch.java

+4-8
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,11 @@
3333
import static processing.app.I18n._;
3434

3535
import java.awt.*;
36-
import java.awt.event.*;
37-
import java.beans.*;
3836
import java.io.*;
3937
import java.util.*;
4038
import java.util.List;
41-
import java.util.zip.*;
4239

4340
import javax.swing.*;
44-
import javax.swing.border.EmptyBorder;
45-
import javax.swing.border.TitledBorder;
4641

4742

4843
/**
@@ -2024,7 +2019,7 @@ static public String checkName(String origName) {
20242019
String msg =
20252020
_("The sketch name had to be modified. Sketch names can only consist\n" +
20262021
"of ASCII characters and numbers (but cannot start with a number).\n" +
2027-
"They should also be less less than 64 characters long.");
2022+
"They should also be less than 64 characters long.");
20282023
System.out.println(msg);
20292024
}
20302025
return newName;
@@ -2063,9 +2058,10 @@ static public String sanitizeName(String origName) {
20632058
for (int i = 0; i < c.length; i++) {
20642059
if (((c[i] >= '0') && (c[i] <= '9')) ||
20652060
((c[i] >= 'a') && (c[i] <= 'z')) ||
2066-
((c[i] >= 'A') && (c[i] <= 'Z'))) {
2061+
((c[i] >= 'A') && (c[i] <= 'Z')) ||
2062+
((i > 0) && (c[i] == '-')) ||
2063+
((i > 0) && (c[i] == '.'))) {
20672064
buffer.append(c[i]);
2068-
20692065
} else {
20702066
buffer.append('_');
20712067
}

app/src/processing/app/SketchCode.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public SketchCode(File file, String extension) {
8787

8888
protected void makePrettyName() {
8989
prettyName = file.getName();
90-
int dot = prettyName.indexOf('.');
90+
int dot = prettyName.lastIndexOf('.');
9191
prettyName = prettyName.substring(0, dot);
9292
}
9393

app/src/processing/app/debug/AvrdudeUploader.java

+2
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ private boolean uploadViaBootloader(String buildPath, String className)
8787
// sketch.
8888
if (boardPreferences.get("bootloader.path") != null &&
8989
(boardPreferences.get("bootloader.path").equals("caterina") ||
90+
boardPreferences.get("bootloader.path").equals("caterina-Arduino_Robot") ||
9091
boardPreferences.get("bootloader.path").equals("caterina-LilyPadUSB"))) {
9192
String caterinaUploadPort = null;
9293
try {
@@ -182,6 +183,7 @@ private boolean uploadViaBootloader(String buildPath, String className)
182183
// bootloader port.
183184
if (true == avrdudeResult && boardPreferences.get("bootloader.path") != null &&
184185
(boardPreferences.get("bootloader.path").equals("caterina") ||
186+
boardPreferences.get("bootloader.path").equals("caterina-Arduino_Robot") ||
185187
boardPreferences.get("bootloader.path").equals("caterina-LilyPadUSB"))) {
186188
try {
187189
Thread.sleep(500);

0 commit comments

Comments
 (0)