Skip to content

Commit

Permalink
Merge pull request #1 from arduino/master
Browse files Browse the repository at this point in the history
  • Loading branch information
Akheon23 committed Apr 4, 2014
2 parents bd24067 + 4a10c1c commit 83636fc
Show file tree
Hide file tree
Showing 449 changed files with 29,160 additions and 15,367 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@ build/linux/dist/*.tar.gz
build/linux/*.tgz
test-bin
*.iml
build/windows/launch4j-*
build/windows/launcher/launch4j
build/windows/WinAVR-*.zip
44 changes: 44 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
Arduino
========

* Arduino is an open-source physical computing platform based on a simple i/o
board and a development environment that implements the Processing/Wiring
language. Arduino can be used to develop stand-alone interactive objects or
can be connected to software on your computer (e.g. Flash, Processing, MaxMSP).
The boards can be assembled by hand or purchased preassembled; the open-source
IDE can be downloaded for free.

* For more information, see the website at: http://www.arduino.cc/
or the forums at: http://arduino.cc/forum/

* To report a *bug* in the software or to request *a simple enhancement* go to:
http://github.com/arduino/Arduino/issues

* More complex requests and technical discussion should go on the Arduino Developers
mailing list:
https://groups.google.com/a/arduino.cc/forum/#!forum/developers

* If you're interested in modifying or extending the Arduino software, we strongly
suggest discussing your ideas on the Developers mailing list *before* starting
to work on them. That way you can coordinate with the Arduino Team and others,
giving your work a higher chance of being integrated into the official release
https://groups.google.com/a/arduino.cc/forum/#!forum/developers

Installation
------------
Detailed instructions are in reference/Guide_Windows.html and
reference/Guide_MacOSX.html. For Linux, see the Arduino playground:
http://www.arduino.cc/playground/Learning/Linux

Credits
--------
Arduino is an open source project, supported by many.

The Arduino team is composed of Massimo Banzi, David Cuartielles, Tom Igoe,
Gianluca Martino, Daniela Antonietti, and David A. Mellis.

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
[Processing](http://www.processing.org) and [Wiring](http://wiring.org.co).

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

97 changes: 45 additions & 52 deletions app/src/processing/app/Base.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@
import java.util.*;

import javax.swing.*;
import javax.swing.filechooser.FileNameExtensionFilter;

import processing.app.debug.Compiler;
import processing.app.debug.Target;
import processing.app.helpers.FileUtils;
import processing.app.helpers.filefilters.OnlyDirs;
import processing.app.javax.swing.filechooser.FileNameExtensionFilter;
import processing.app.tools.ZipDeflater;
import processing.core.*;
import static processing.app.I18n._;
Expand Down Expand Up @@ -120,7 +120,7 @@ static public void main(String args[]) {
File versionFile = getContentFile("lib/version.txt");
if (versionFile.exists()) {
String version = PApplet.loadStrings(versionFile)[0];
if (!version.equals(VERSION_NAME)) {
if (!version.equals(VERSION_NAME) && !version.equals("${version}")) {
VERSION_NAME = version;
RELEASE = true;
}
Expand All @@ -129,6 +129,10 @@ static public void main(String args[]) {
e.printStackTrace();
}

// help 3rd party installers find the correct hardware path
Preferences.set("last.ide." + VERSION_NAME + ".hardwarepath", getHardwarePath());
Preferences.set("last.ide." + VERSION_NAME + ".daterun", "" + (new Date()).getTime() / 1000);

// if (System.getProperty("mrj.version") != null) {
// //String jv = System.getProperty("java.version");
// String ov = System.getProperty("os.version");
Expand Down Expand Up @@ -1207,62 +1211,51 @@ public void actionPerformed(ActionEvent event) {
boolean ifound = false;

for (String potentialName : list) {
File subfolder = new File(folder, potentialName);
// File libraryFolder = new File(subfolder, "library");
// File libraryJar = new File(libraryFolder, potentialName + ".jar");
// // If a .jar file of the same prefix as the folder exists
// // inside the 'library' subfolder of the sketch
// if (libraryJar.exists()) {
String sanityCheck = Sketch.sanitizeName(potentialName);
if (!sanityCheck.equals(potentialName)) {
String mess = I18n.format(
_("The library \"{0}\" cannot be used.\n" +
"Library names must contain only basic letters and numbers.\n" +
"(ASCII only and no spaces, and it cannot start with a number)"),
potentialName
);
Base.showMessage(_("Ignoring bad library name"), mess);
continue;
}
File libFolder = new File(folder, potentialName);
String sanityCheck = Sketch.sanitizeName(potentialName);
if (!sanityCheck.equals(potentialName)) {
String mess = I18n.format(_("The library \"{0}\" cannot be used.\n"
+ "Library names must contain only basic letters and numbers.\n"
+ "(ASCII only and no spaces, and it cannot start with a number)"),
potentialName);
Base.showMessage(_("Ignoring bad library name"), mess);
continue;
}

String libraryName = potentialName;
// // get the path for all .jar files in this code folder
// String libraryClassPath =
// Compiler.contentsToClassPath(libraryFolder);
// // grab all jars and classes from this folder,
// // and append them to the library classpath
// librariesClassPath +=
// File.pathSeparatorChar + libraryClassPath;
// // need to associate each import with a library folder
// String packages[] =
// Compiler.packageListFromClassPath(libraryClassPath);
libraries.add(subfolder);
String libraryName = potentialName;
libraries.add(libFolder);
String libFolderPath = libFolder.getAbsolutePath();
try {
String packages[] =
Compiler.headerListFromIncludePath(subfolder.getAbsolutePath());
for (String pkg : packages) {
importToLibraryTable.put(pkg, subfolder);
String headers[] = Compiler.headerListFromIncludePath(libFolderPath);
for (String header : headers) {
// Extract file name (without extension ".h")
String name = header.substring(0, header.length() - 2);

// If the header name equals to the current library folder use it
if (libFolderPath.endsWith(name)) {
importToLibraryTable.put(header, libFolder);
continue;
}

// If a library was already found with this header, keep it if
// the library's directory name matches the header name.
File old = importToLibraryTable.get(header);
if (old != null) {
if (old.getPath().endsWith(name))
continue;
}
importToLibraryTable.put(header, libFolder);
}
} catch (IOException e) {
showWarning(_("Error"), I18n.format("Unable to list header files in {0}", subfolder), e);
showWarning(_("Error"), I18n.format(
"Unable to list header files in {0}", libFolder), e);
}

JMenuItem item = new JMenuItem(libraryName);
item.addActionListener(listener);
item.setActionCommand(subfolder.getAbsolutePath());
menu.add(item);
ifound = true;

// XXX: DAM: should recurse here so that library folders can be nested
// } else { // not a library, but is still a folder, so recurse
// JMenu submenu = new JMenu(libraryName);
// // needs to be separate var, otherwise would set ifound to false
// boolean found = addLibraries(submenu, subfolder);
// if (found) {
// menu.add(submenu);
// ifound = true;
// }
// }
JMenuItem item = new JMenuItem(libraryName);
item.addActionListener(listener);
item.setActionCommand(libFolderPath);
menu.add(item);
ifound = true;
}
return ifound;
}
Expand Down
2 changes: 2 additions & 0 deletions app/src/processing/app/Editor.java
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,8 @@ protected void applyPreferences() {
textarea.setEditable(!external);
saveMenuItem.setEnabled(!external);
saveAsMenuItem.setEnabled(!external);

textarea.setDisplayLineNumbers(Preferences.getBoolean("editor.linenumbers"));

TextAreaPainter painter = textarea.getPainter();
if (external) {
Expand Down
12 changes: 12 additions & 0 deletions app/src/processing/app/Preferences.java
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ public class Preferences {
JCheckBox exportSeparateBox;
JCheckBox verboseCompilationBox;
JCheckBox verboseUploadBox;
JCheckBox displayLineNumbersBox;
JCheckBox verifyUploadBox;
JCheckBox externalEditorBox;
JCheckBox memoryOverrideBox;
Expand Down Expand Up @@ -382,6 +383,15 @@ public void actionPerformed(ActionEvent e) {
box.setBounds(left, top, d.width, d.height);
top += d.height + GUI_BETWEEN;

// [ ] Display line numbers

displayLineNumbersBox = new JCheckBox(_("Display line numbers"));
pain.add(displayLineNumbersBox);
d = displayLineNumbersBox.getPreferredSize();
displayLineNumbersBox.setBounds(left, top, d.width + 10, d.height);
right = Math.max(right, left + d.width);
top += d.height + GUI_BETWEEN;

// [ ] Verify code after upload

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

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

//closingLastQuitsBox.
Expand Down
12 changes: 4 additions & 8 deletions app/src/processing/app/Sketch.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,11 @@
import static processing.app.I18n._;

import java.awt.*;
import java.awt.event.*;
import java.beans.*;
import java.io.*;
import java.util.*;
import java.util.List;
import java.util.zip.*;

import javax.swing.*;
import javax.swing.border.EmptyBorder;
import javax.swing.border.TitledBorder;


/**
Expand Down Expand Up @@ -2024,7 +2019,7 @@ static public String checkName(String origName) {
String msg =
_("The sketch name had to be modified. Sketch names can only consist\n" +
"of ASCII characters and numbers (but cannot start with a number).\n" +
"They should also be less less than 64 characters long.");
"They should also be less than 64 characters long.");
System.out.println(msg);
}
return newName;
Expand Down Expand Up @@ -2063,9 +2058,10 @@ static public String sanitizeName(String origName) {
for (int i = 0; i < c.length; i++) {
if (((c[i] >= '0') && (c[i] <= '9')) ||
((c[i] >= 'a') && (c[i] <= 'z')) ||
((c[i] >= 'A') && (c[i] <= 'Z'))) {
((c[i] >= 'A') && (c[i] <= 'Z')) ||
((i > 0) && (c[i] == '-')) ||
((i > 0) && (c[i] == '.'))) {
buffer.append(c[i]);

} else {
buffer.append('_');
}
Expand Down
2 changes: 1 addition & 1 deletion app/src/processing/app/SketchCode.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public SketchCode(File file, String extension) {

protected void makePrettyName() {
prettyName = file.getName();
int dot = prettyName.indexOf('.');
int dot = prettyName.lastIndexOf('.');
prettyName = prettyName.substring(0, dot);
}

Expand Down
2 changes: 2 additions & 0 deletions app/src/processing/app/debug/AvrdudeUploader.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ private boolean uploadViaBootloader(String buildPath, String className)
// sketch.
if (boardPreferences.get("bootloader.path") != null &&
(boardPreferences.get("bootloader.path").equals("caterina") ||
boardPreferences.get("bootloader.path").equals("caterina-Arduino_Robot") ||
boardPreferences.get("bootloader.path").equals("caterina-LilyPadUSB"))) {
String caterinaUploadPort = null;
try {
Expand Down Expand Up @@ -182,6 +183,7 @@ private boolean uploadViaBootloader(String buildPath, String className)
// bootloader port.
if (true == avrdudeResult && boardPreferences.get("bootloader.path") != null &&
(boardPreferences.get("bootloader.path").equals("caterina") ||
boardPreferences.get("bootloader.path").equals("caterina-Arduino_Robot") ||
boardPreferences.get("bootloader.path").equals("caterina-LilyPadUSB"))) {
try {
Thread.sleep(500);
Expand Down
Loading

0 comments on commit 83636fc

Please sign in to comment.