1
0
mirror of https://github.com/arduino/Arduino.git synced 2024-11-29 10:24:12 +01:00

More cleanup:

- fixing import library
- changing compilation to only look for source files in the root and utility/ folders of a library; also adding utility/ sub-folder to the include path
- removing export to application
- renaming run to verify / compile and export to upload
This commit is contained in:
David A. Mellis 2009-06-01 18:11:25 +00:00
parent df4f1629c4
commit 89139d1f77
5 changed files with 24 additions and 60 deletions

View File

@ -984,7 +984,11 @@ public class Base {
try {
menu.removeAll();
addSketches(menu, examplesFolder, false);
boolean found = addSketches(menu, examplesFolder, false);
if (found) menu.addSeparator();
found = addSketches(menu, getSketchbookLibrariesFolder(), false);
if (found) menu.addSeparator();
addSketches(menu, librariesFolder, false);
} catch (IOException e) {
e.printStackTrace();
}
@ -1141,7 +1145,7 @@ public class Base {
JMenuItem item = new JMenuItem(libraryName);
item.addActionListener(listener);
// item.setActionCommand(libraryJar.getAbsolutePath());
item.setActionCommand(subfolder.getAbsolutePath());
menu.add(item);
ifound = true;

View File

@ -488,7 +488,7 @@ public class Editor extends JFrame implements RunnerListener {
});
fileMenu.add(saveAsMenuItem);
item = newJMenuItem("Export", 'E');
item = newJMenuItem("Upload to I/O Board", 'U');
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
handleExport();
@ -496,18 +496,6 @@ public class Editor extends JFrame implements RunnerListener {
});
fileMenu.add(item);
exportAppItem = newJMenuItemShift("Export Application", 'E');
exportAppItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
//buttons.activate(EditorButtons.EXPORT);
//SwingUtilities.invokeLater(new Runnable() {
//public void run() {
handleExportApplication();
//}});
}
});
fileMenu.add(exportAppItem);
fileMenu.addSeparator();
item = newJMenuItemShift("Page Setup", 'P');
@ -556,7 +544,7 @@ public class Editor extends JFrame implements RunnerListener {
JMenuItem item;
sketchMenu = new JMenu("Sketch");
item = newJMenuItem("Run", 'R');
item = newJMenuItem("Verify / Compile", 'R');
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
handleRun(false);
@ -564,13 +552,13 @@ public class Editor extends JFrame implements RunnerListener {
});
sketchMenu.add(item);
item = newJMenuItemShift("Present", 'R');
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
handleRun(true);
}
});
sketchMenu.add(item);
// item = newJMenuItemShift("Present", 'R');
// item.addActionListener(new ActionListener() {
// public void actionPerformed(ActionEvent e) {
// handleRun(true);
// }
// });
// sketchMenu.add(item);
item = new JMenuItem("Stop");
item.addActionListener(new ActionListener() {
@ -2167,35 +2155,6 @@ public class Editor extends JFrame implements RunnerListener {
}
/**
* Handler for Sketch → Export Application
*/
synchronized public void handleExportApplication() {
if (!handleExportCheckModified()) return;
toolbar.activate(EditorToolbar.EXPORT);
//SwingUtilities.invokeLater(new Runnable() {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
statusNotice("Exporting application...");
try {
if (sketch.exportApplicationPrompt()) {
Base.openFolder(sketch.getFolder());
statusNotice("Done exporting.");
} else {
// error message will already be visible
// or there was no error, in which case it was canceled.
}
} catch (Exception e) {
statusNotice("Error during export.");
e.printStackTrace();
}
//toolbar.clear();
toolbar.deactivate(EditorToolbar.EXPORT);
}});
}
/**
* Checks to see if the sketch has been modified, and if so,
* asks the user to save the sketch or cancel the export.

View File

@ -337,11 +337,7 @@ public class EditorToolbar extends JComponent implements MouseInputListener {
break;
case EXPORT:
if (e.isShiftDown()) {
editor.handleExportApplication();
} else {
editor.handleExport();
}
editor.handleExport();
break;
}
}

View File

@ -1315,7 +1315,7 @@ public class Sketch {
for (String item : preprocessor.getExtraImports()) {
File libFolder = (File) Base.importToLibraryTable.get(item);
if (libFolder != null) {
if (libFolder != null && !importedLibraries.contains(libFolder)) {
importedLibraries.add(libFolder);
classPath += Compiler.contentsToClassPath(libFolder);
libraryPath += File.pathSeparator + libFolder.getAbsolutePath();

View File

@ -76,6 +76,7 @@ public class Compiler implements MessageConsumer {
// use lib directories as include paths
for (File file : sketch.getImportedLibraries()) {
includePaths.add(file.getPath());
includePaths.add(file.getPath() + File.separator + "utility");
}
List baseCommandLinker = new ArrayList(Arrays.asList(new String[] {
@ -111,8 +112,10 @@ public class Compiler implements MessageConsumer {
sourceFilesCPP.addAll(findFilesInPath(target.getPath(), "cpp", true));
for (File file : sketch.getImportedLibraries()) {
sourceFiles.addAll(findFilesInFolder(file, "c", true));
sourceFilesCPP.addAll(findFilesInFolder(file, "cpp", true));
sourceFiles.addAll(findFilesInFolder(file, "c", false));
sourceFiles.addAll(findFilesInFolder(new File(file, "utility"), "c", false));
sourceFilesCPP.addAll(findFilesInFolder(file, "cpp", false));
sourceFilesCPP.addAll(findFilesInFolder(new File(file, "utility"), "cpp", false));
}
firstErrorFound = false; // haven't found any errors yet
@ -485,6 +488,8 @@ public class Compiler implements MessageConsumer {
boolean recurse) {
ArrayList<File> files = new ArrayList<File>();
if (folder.listFiles() == null) return files;
for (File file : folder.listFiles()) {
if (file.getName().equals(".") || file.getName().equals("..")) continue;