Skip to content

Commit 896b1a4

Browse files
committed
Revert "Merge branch 'new-extension' of git@github.com:arduino/Arduino"
This reverts commit 42fa932, reversing changes made to a7352b8. See: http://www.kernel.org/pub/software/scm/git/docs/howto/revert-a-faulty-merge.txt for information on how to merge the branch in later.
1 parent b4f2bd9 commit 896b1a4

30 files changed

+397
-1005
lines changed

app/src/processing/app/Base.java

+9-19
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ protected String createNewUntitled() throws IOException {
545545
newbieDir.mkdirs();
546546

547547
// Make an empty pde file
548-
File newbieFile = new File(newbieDir, newbieName + ".ino");
548+
File newbieFile = new File(newbieDir, newbieName + ".pde");
549549
new FileOutputStream(newbieFile); // create the file
550550
return newbieFile.getAbsolutePath();
551551
}
@@ -637,8 +637,7 @@ public void handleOpenPrompt() {
637637
public boolean accept(File dir, String name) {
638638
// TODO this doesn't seem to ever be used. AWESOME.
639639
//System.out.println("check filter on " + dir + " " + name);
640-
return name.toLowerCase().endsWith(".ino")
641-
|| name.toLowerCase().endsWith(".pde");
640+
return name.toLowerCase().endsWith(".pde");
642641
}
643642
});
644643

@@ -1017,28 +1016,22 @@ public void actionPerformed(ActionEvent actionevent) {
10171016
}
10181017

10191018

1020-
public void rebuildProgrammerMenu(JMenu menu) {
1021-
//System.out.println("rebuilding programmer menu");
1019+
public void rebuildBurnBootloaderMenu(JMenu menu) {
1020+
//System.out.println("rebuilding burn bootloader menu");
10221021
menu.removeAll();
1023-
ButtonGroup group = new ButtonGroup();
10241022
for (Target target : targetsTable.values()) {
10251023
for (String programmer : target.getProgrammers().keySet()) {
10261024
AbstractAction action =
10271025
new AbstractAction(
1028-
target.getProgrammers().get(programmer).get("name")) {
1026+
"w/ " + target.getProgrammers().get(programmer).get("name")) {
10291027
public void actionPerformed(ActionEvent actionevent) {
1030-
Preferences.set("programmer", getValue("target") + ":" +
1031-
getValue("programmer"));
1028+
activeEditor.handleBurnBootloader((String) getValue("target"),
1029+
(String) getValue("programmer"));
10321030
}
10331031
};
10341032
action.putValue("target", target.getName());
10351033
action.putValue("programmer", programmer);
1036-
JMenuItem item = new JRadioButtonMenuItem(action);
1037-
if (Preferences.get("programmer").equals(target.getName() + ":" +
1038-
programmer)) {
1039-
item.setSelected(true);
1040-
}
1041-
group.add(item);
1034+
JMenuItem item = new JMenuItem(action);
10421035
menu.add(item);
10431036
}
10441037
}
@@ -1098,10 +1091,7 @@ public void actionPerformed(ActionEvent e) {
10981091
File subfolder = new File(folder, list[i]);
10991092
if (!subfolder.isDirectory()) continue;
11001093

1101-
File entry = new File(subfolder, list[i] + ".ino");
1102-
if (!entry.exists() && (new File(subfolder, list[i] + ".pde")).exists()) {
1103-
entry = new File(subfolder, list[i] + ".pde");
1104-
}
1094+
File entry = new File(subfolder, list[i] + ".pde");
11051095
// if a .pde file of the same prefix as the folder exists..
11061096
if (entry.exists()) {
11071097
//String sanityCheck = sanitizedName(list[i]);

app/src/processing/app/Editor.java

+31-90
Original file line numberDiff line numberDiff line change
@@ -538,21 +538,21 @@ public void actionPerformed(ActionEvent e) {
538538
});
539539
fileMenu.add(saveAsMenuItem);
540540

541-
item = newJMenuItem("Upload", 'U');
541+
item = newJMenuItem("Upload to I/O Board", 'U');
542542
item.addActionListener(new ActionListener() {
543543
public void actionPerformed(ActionEvent e) {
544544
handleExport(false);
545545
}
546546
});
547547
fileMenu.add(item);
548548

549-
item = newJMenuItemShift("Upload Using Programmer", 'U');
550-
item.addActionListener(new ActionListener() {
551-
public void actionPerformed(ActionEvent e) {
552-
handleExport(true);
553-
}
554-
});
555-
fileMenu.add(item);
549+
// item = newJMenuItemShift("Upload to I/O Board (verbose)", 'U');
550+
// item.addActionListener(new ActionListener() {
551+
// public void actionPerformed(ActionEvent e) {
552+
// handleExport(true);
553+
// }
554+
// });
555+
// fileMenu.add(item);
556556

557557
fileMenu.addSeparator();
558558

@@ -618,13 +618,13 @@ public void actionPerformed(ActionEvent e) {
618618
// });
619619
// sketchMenu.add(item);
620620

621-
// item = new JMenuItem("Stop");
622-
// item.addActionListener(new ActionListener() {
623-
// public void actionPerformed(ActionEvent e) {
624-
// handleStop();
625-
// }
626-
// });
627-
// sketchMenu.add(item);
621+
item = new JMenuItem("Stop");
622+
item.addActionListener(new ActionListener() {
623+
public void actionPerformed(ActionEvent e) {
624+
handleStop();
625+
}
626+
});
627+
sketchMenu.add(item);
628628

629629
sketchMenu.addSeparator();
630630

@@ -693,20 +693,12 @@ public void actionPerformed(ActionEvent e) {
693693
serialMenu = new JMenu("Serial Port");
694694
populateSerialMenu();
695695
menu.add(serialMenu);
696-
696+
697697
menu.addSeparator();
698-
699-
JMenu programmerMenu = new JMenu("Programmer");
700-
base.rebuildProgrammerMenu(programmerMenu);
701-
menu.add(programmerMenu);
702698

703-
item = new JMenuItem("Burn Bootloader");
704-
item.addActionListener(new ActionListener() {
705-
public void actionPerformed(ActionEvent e) {
706-
handleBurnBootloader();
707-
}
708-
});
709-
menu.add(item);
699+
JMenu bootloaderMenu = new JMenu("Burn Bootloader");
700+
base.rebuildBurnBootloaderMenu(bootloaderMenu);
701+
menu.add(bootloaderMenu);
710702

711703
menu.addMenuListener(new MenuListener() {
712704
public void menuCanceled(MenuEvent e) {}
@@ -997,8 +989,8 @@ protected void populateSerialMenu() {
997989
//serialMenu.addSeparator();
998990
//serialMenu.add(item);
999991
}
1000-
1001-
992+
993+
1002994
protected JMenu buildHelpMenu() {
1003995
// To deal with a Mac OS X 10.5 bug, add an extra space after the name
1004996
// so that the OS doesn't try to insert its slow help menu.
@@ -1895,12 +1887,12 @@ public Point getSketchLocation() {
18951887
* Implements Sketch → Stop, or pressing Stop on the toolbar.
18961888
*/
18971889
public void handleStop() { // called by menu or buttons
1898-
// toolbar.activate(EditorToolbar.STOP);
1890+
toolbar.activate(EditorToolbar.STOP);
18991891

19001892
internalCloseRunner();
19011893

19021894
toolbar.deactivate(EditorToolbar.RUN);
1903-
// toolbar.deactivate(EditorToolbar.STOP);
1895+
toolbar.deactivate(EditorToolbar.STOP);
19041896

19051897
// focus the PDE again after quitting presentation mode [toxi 030903]
19061898
toFront();
@@ -2040,65 +2032,14 @@ protected void handleOpenUnchecked(String path, int codeIndex,
20402032
* modifications (if any) to the previous sketch need to be saved.
20412033
*/
20422034
protected boolean handleOpenInternal(String path) {
2043-
// rename .pde files to .ino
2044-
File[] oldFiles = (new File(path)).getParentFile().listFiles(new FilenameFilter() {
2045-
public boolean accept(File dir, String name) {
2046-
return (name.toLowerCase().endsWith(".pde"));
2047-
}
2048-
});
2049-
2050-
if (oldFiles != null && oldFiles.length > 0) {
2051-
if (!Preferences.getBoolean("editor.update_extension")) {
2052-
Object[] options = { "OK", "Cancel" };
2053-
String prompt =
2054-
"In Arduino 1.0, the file extension for sketches changed\n" +
2055-
"from \".pde\" to \".ino\". This version of the software only\n" +
2056-
"supports the new extension. Rename the files in this sketch\n" +
2057-
"(and future sketches) and continue?";
2058-
2059-
int result = JOptionPane.showOptionDialog(this,
2060-
prompt,
2061-
"New extension",
2062-
JOptionPane.YES_NO_OPTION,
2063-
JOptionPane.QUESTION_MESSAGE,
2064-
null,
2065-
options,
2066-
options[0]);
2067-
if (result != JOptionPane.YES_OPTION) {
2068-
return false;
2069-
}
2070-
2071-
Preferences.setBoolean("editor.update_extension", true);
2072-
}
2073-
2074-
for (int i = 0; i < oldFiles.length; i++) {
2075-
String oldPath = oldFiles[i].getPath();
2076-
File newFile = new File(oldPath.substring(0, oldPath.length() - 4) + ".ino");
2077-
try {
2078-
Base.copyFile(oldFiles[i], newFile);
2079-
} catch (IOException e) {
2080-
Base.showWarning("Error", "Could not copy to a proper location.", e);
2081-
return false;
2082-
}
2083-
2084-
// remove the original file, so user doesn't get confused
2085-
oldFiles[i].delete();
2086-
2087-
// update with the new path
2088-
if (oldFiles[i].compareTo(new File(path)) == 0) {
2089-
path = newFile.getAbsolutePath();
2090-
}
2091-
}
2092-
}
2093-
20942035
// check to make sure that this .pde file is
20952036
// in a folder of the same name
20962037
File file = new File(path);
20972038
File parentFile = new File(file.getParent());
20982039
String parentName = parentFile.getName();
2099-
String pdeName = parentName + ".ino";
2040+
String pdeName = parentName + ".pde";
21002041
File altFile = new File(file.getParent(), pdeName);
2101-
2042+
21022043
if (pdeName.equals(file.getName())) {
21032044
// no beef with this guy
21042045

@@ -2108,10 +2049,10 @@ public boolean accept(File dir, String name) {
21082049
path = altFile.getAbsolutePath();
21092050
//System.out.println("found alt file in same folder");
21102051

2111-
} else if (!path.endsWith(".ino")) {
2052+
} else if (!path.endsWith(".pde")) {
21122053
Base.showWarning("Bad file selected",
21132054
"Processing can only open its own sketches\n" +
2114-
"and other files ending in .ino", null);
2055+
"and other files ending in .pde", null);
21152056
return false;
21162057

21172058
} else {
@@ -2330,13 +2271,13 @@ public boolean serialPrompt() {
23302271
* Made synchronized to (hopefully) avoid problems of people
23312272
* hitting export twice, quickly, and horking things up.
23322273
*/
2333-
synchronized public void handleExport(final boolean usingProgrammer) {
2274+
synchronized public void handleExport(final boolean verbose) {
23342275
//if (!handleExportCheckModified()) return;
23352276
toolbar.activate(EditorToolbar.EXPORT);
23362277
console.clear();
23372278
statusNotice("Uploading to I/O Board...");
23382279

2339-
new Thread(usingProgrammer ? exportAppHandler : exportHandler).start();
2280+
new Thread(verbose ? exportAppHandler : exportHandler).start();
23402281
}
23412282

23422283
// DAM: in Arduino, this is upload
@@ -2454,14 +2395,14 @@ public void handleSerial() {
24542395
}
24552396

24562397

2457-
protected void handleBurnBootloader() {
2398+
protected void handleBurnBootloader(final String target, final String programmer) {
24582399
console.clear();
24592400
statusNotice("Burning bootloader to I/O Board (this may take a minute)...");
24602401
SwingUtilities.invokeLater(new Runnable() {
24612402
public void run() {
24622403
try {
24632404
Uploader uploader = new AvrdudeUploader();
2464-
if (uploader.burnBootloader()) {
2405+
if (uploader.burnBootloader(target, programmer)) {
24652406
statusNotice("Done burning bootloader.");
24662407
} else {
24672408
statusError("Error while burning bootloader.");

app/src/processing/app/EditorToolbar.java

+12-10
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ public class EditorToolbar extends JComponent implements MouseInputListener, Key
3737

3838
/** Rollover titles for each button. */
3939
static final String title[] = {
40-
"Verify", "Upload", "New", "Open", "Save", "Serial Monitor"
40+
"Verify", "Stop", "New", "Open", "Save", "Upload", "Serial Monitor"
4141
};
4242

4343
/** Titles for each button when the shift key is pressed. */
4444
static final String titleShift[] = {
45-
"Verify", "Upload Using Programmer", "New Editor Window", "Open in Another Window", "Save", "Serial Monitor"
45+
"Verify (w/ Verbose Output)", "Stop", "New Editor Window", "Open in Another Window", "Save", "Upload (w/ Verbose Output)", "Serial Monitor"
4646
};
4747

4848
static final int BUTTON_COUNT = title.length;
@@ -57,13 +57,14 @@ public class EditorToolbar extends JComponent implements MouseInputListener, Key
5757

5858

5959
static final int RUN = 0;
60-
static final int EXPORT = 1;
60+
static final int STOP = 1;
6161

6262
static final int NEW = 2;
6363
static final int OPEN = 3;
6464
static final int SAVE = 4;
65+
static final int EXPORT = 5;
6566

66-
static final int SERIAL = 5;
67+
static final int SERIAL = 6;
6768

6869
static final int INACTIVE = 0;
6970
static final int ROLLOVER = 1;
@@ -104,10 +105,11 @@ public EditorToolbar(Editor editor, JMenu menu) {
104105

105106
//which[buttonCount++] = NOTHING;
106107
which[buttonCount++] = RUN;
107-
which[buttonCount++] = EXPORT;
108+
which[buttonCount++] = STOP;
108109
which[buttonCount++] = NEW;
109110
which[buttonCount++] = OPEN;
110111
which[buttonCount++] = SAVE;
112+
which[buttonCount++] = EXPORT;
111113
which[buttonCount++] = SERIAL;
112114

113115
currentRollover = -1;
@@ -310,13 +312,13 @@ public void mousePressed(MouseEvent e) {
310312

311313
switch (sel) {
312314
case RUN:
313-
editor.handleRun(false);
315+
editor.handleRun(e.isShiftDown());
316+
break;
317+
318+
case STOP:
319+
editor.handleStop();
314320
break;
315321

316-
// case STOP:
317-
// editor.handleStop();
318-
// break;
319-
//
320322
case OPEN:
321323
popup = menu.getPopupMenu();
322324
popup.show(EditorToolbar.this, x, y);

app/src/processing/app/Preferences.java

-21
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,6 @@ public class Preferences {
113113

114114
JTextField sketchbookLocationField;
115115
JCheckBox exportSeparateBox;
116-
JCheckBox verboseCompilationBox;
117-
JCheckBox verboseUploadBox;
118116
JCheckBox deletePreviousBox;
119117
JCheckBox externalEditorBox;
120118
JCheckBox memoryOverrideBox;
@@ -281,21 +279,6 @@ public void actionPerformed(ActionEvent e) {
281279
top += d.height + GUI_BETWEEN;
282280

283281

284-
// Show verbose output during: [ ] compilation [ ] upload
285-
286-
box = Box.createHorizontalBox();
287-
label = new JLabel("Show verbose output during: ");
288-
box.add(label);
289-
verboseCompilationBox = new JCheckBox("compilation ");
290-
box.add(verboseCompilationBox);
291-
verboseUploadBox = new JCheckBox("upload");
292-
box.add(verboseUploadBox);
293-
pain.add(box);
294-
d = box.getPreferredSize();
295-
box.setBounds(left, top, d.width, d.height);
296-
top += d.height + GUI_BETWEEN;
297-
298-
299282
// [ ] Delete previous applet or application folder on export
300283

301284
deletePreviousBox =
@@ -478,8 +461,6 @@ protected void disposeFrame() {
478461
*/
479462
protected void applyFrame() {
480463
// put each of the settings into the table
481-
setBoolean("build.verbose", verboseCompilationBox.isSelected());
482-
setBoolean("upload.verbose", verboseUploadBox.isSelected());
483464
setBoolean("export.delete_target_folder",
484465
deletePreviousBox.isSelected());
485466

@@ -535,8 +516,6 @@ protected void showFrame(Editor editor) {
535516
this.editor = editor;
536517

537518
// set all settings entry boxes to their actual status
538-
verboseCompilationBox.setSelected(getBoolean("build.verbose"));
539-
verboseUploadBox.setSelected(getBoolean("upload.verbose"));
540519
deletePreviousBox.
541520
setSelected(getBoolean("export.delete_target_folder"));
542521

0 commit comments

Comments
 (0)