Skip to content

Commit cd5ecff

Browse files
committed
Merge https://github.com/arduino/32U4 into new-extension
2 parents 667da69 + 3cce113 commit cd5ecff

File tree

3 files changed

+71
-33
lines changed

3 files changed

+71
-33
lines changed

app/src/processing/app/Preferences.java

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ public class Preferences {
121121
JTextField memoryField;
122122
JCheckBox checkUpdatesBox;
123123
JTextField fontSizeField;
124+
JCheckBox updateExtensionBox;
124125
JCheckBox autoAssociateBox;
125126

126127

@@ -325,7 +326,15 @@ public void actionPerformed(ActionEvent e) {
325326
checkUpdatesBox.setBounds(left, top, d.width + 10, d.height);
326327
right = Math.max(right, left + d.width);
327328
top += d.height + GUI_BETWEEN;
328-
329+
330+
// [ ] Update sketch files to new extension on save (.pde -> .ino)
331+
332+
updateExtensionBox = new JCheckBox("Update sketch files to new extension on save (.pde -> .ino)");
333+
pain.add(updateExtensionBox);
334+
d = updateExtensionBox.getPreferredSize();
335+
updateExtensionBox.setBounds(left, top, d.width + 10, d.height);
336+
right = Math.max(right, left + d.width);
337+
top += d.height + GUI_BETWEEN;
329338

330339
// [ ] Automatically associate .pde files with Processing
331340

@@ -526,6 +535,8 @@ protected void applyFrame() {
526535
setBoolean("platform.auto_file_type_associations",
527536
autoAssociateBox.isSelected());
528537
}
538+
539+
setBoolean("editor.update_extension", updateExtensionBox.isSelected());
529540

530541
editor.applyPreferences();
531542
}
@@ -558,6 +569,9 @@ protected void showFrame(Editor editor) {
558569
autoAssociateBox.
559570
setSelected(getBoolean("platform.auto_file_type_associations"));
560571
}
572+
573+
updateExtensionBox.setSelected(get("editor.update_extension") == null ||
574+
getBoolean("editor.update_extension"));
561575

562576
dialog.setVisible(true);
563577
}

app/src/processing/app/Sketch.java

Lines changed: 38 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -707,21 +707,45 @@ public boolean save() throws IOException {
707707
"need to re-save this sketch to another location.");
708708
// if the user cancels, give up on the save()
709709
if (!saveAs()) return false;
710-
}
711-
712-
// rename .pde files to .ino
713-
File mainFile = new File(getMainFilePath());
714-
File mainFolder = mainFile.getParentFile();
715-
File[] pdeFiles = mainFolder.listFiles(new FilenameFilter() {
716-
public boolean accept(File dir, String name) {
717-
return name.toLowerCase().endsWith(".pde");
710+
} else {
711+
// rename .pde files to .ino
712+
File mainFile = new File(getMainFilePath());
713+
File mainFolder = mainFile.getParentFile();
714+
File[] pdeFiles = mainFolder.listFiles(new FilenameFilter() {
715+
public boolean accept(File dir, String name) {
716+
return name.toLowerCase().endsWith(".pde");
717+
}
718+
});
719+
720+
if (pdeFiles != null && pdeFiles.length > 0) {
721+
if (Preferences.get("editor.update_extension") == null) {
722+
Object[] options = { "OK", "Cancel" };
723+
int result = JOptionPane.showOptionDialog(editor,
724+
"In Arduino 1.0, the default file extension has changed\n" +
725+
"from .pde to .ino. New sketches (including those created\n" +
726+
"by \"Save-As\" will use the new extension. The extension\n" +
727+
"of existing sketches will be updated on save, but you can\n" +
728+
"disable this in the Preferences dialog.\n" +
729+
"\n" +
730+
"Save sketch and update its extension?",
731+
".pde -> .ino",
732+
JOptionPane.OK_CANCEL_OPTION,
733+
JOptionPane.QUESTION_MESSAGE,
734+
null,
735+
options,
736+
options[0]);
737+
738+
if (result != JOptionPane.OK_OPTION) return false; // save cancelled
739+
740+
Preferences.setBoolean("editor.update_extension", true);
741+
}
742+
743+
if (Preferences.getBoolean("editor.update_extension")) {
744+
// Do rename of all .pde files to new .ino extension
745+
for (File pdeFile : pdeFiles)
746+
renameCodeToInoExtension(pdeFile);
747+
}
718748
}
719-
});
720-
721-
if (pdeFiles != null && pdeFiles.length > 0) {
722-
// Do rename of all .pde files to new .ino extension
723-
for (File pdeFile : pdeFiles)
724-
renameCodeToInoExtension(pdeFile);
725749
}
726750

727751
for (int i = 0; i < codeCount; i++) {

hardware/arduino/boards.txt

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,5 @@
11
##############################################################
22

3-
leonardo.name=Arduino Leonardo
4-
leonardo.upload.protocol=arduino
5-
leonardo.upload.maximum_size=30720
6-
leonardo.upload.speed=1200
7-
leonardo.bootloader.low_fuses=0xde
8-
leonardo.bootloader.high_fuses=0xda
9-
leonardo.bootloader.extended_fuses=0xcb
10-
leonardo.bootloader.path=diskloader
11-
leonardo.bootloader.file=DiskLoader.hex
12-
leonardo.bootloader.unlock_bits=0x3F
13-
leonardo.bootloader.lock_bits=0x2F
14-
leonardo.build.mcu=atmega32u4
15-
leonardo.build.f_cpu=16000000L
16-
leonardo.build.core=arduino
17-
leonardo.build.variant=leonardo
18-
19-
##############################################################
20-
213
uno.name=Arduino Uno
224
uno.upload.protocol=arduino
235
uno.upload.maximum_size=32256
@@ -36,6 +18,24 @@ uno.build.variant=standard
3618

3719
##############################################################
3820

21+
leonardo.name=Arduino Leonardo
22+
leonardo.upload.protocol=arduino
23+
leonardo.upload.maximum_size=30720
24+
leonardo.upload.speed=1200
25+
leonardo.bootloader.low_fuses=0xde
26+
leonardo.bootloader.high_fuses=0xda
27+
leonardo.bootloader.extended_fuses=0xcb
28+
leonardo.bootloader.path=diskloader
29+
leonardo.bootloader.file=DiskLoader.hex
30+
leonardo.bootloader.unlock_bits=0x3F
31+
leonardo.bootloader.lock_bits=0x2F
32+
leonardo.build.mcu=atmega32u4
33+
leonardo.build.f_cpu=16000000L
34+
leonardo.build.core=arduino
35+
leonardo.build.variant=leonardo
36+
37+
##############################################################
38+
3939
atmega328.name=Arduino Duemilanove w/ ATmega328
4040

4141
atmega328.upload.protocol=arduino

0 commit comments

Comments
 (0)