1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-03-01 23:29:28 +01:00

Merge branch 'autosave' into HEAD

This commit is contained in:
Cristian Maglie 2014-11-13 11:51:46 +01:00
commit 285a03a655
4 changed files with 29 additions and 2 deletions

View File

@ -1887,6 +1887,11 @@ public class Editor extends JFrame implements RunnerListener {
*/ */
public void handleRun(final boolean verbose) { public void handleRun(final boolean verbose) {
internalCloseRunner(); internalCloseRunner();
if (Preferences.getBoolean("editor.save_on_verify")) {
if (sketch.isModified() && !sketch.isReadOnly()) {
handleSave(true);
}
}
running = true; running = true;
toolbar.activate(EditorToolbar.RUN); toolbar.activate(EditorToolbar.RUN);
status.progress(_("Compiling sketch...")); status.progress(_("Compiling sketch..."));
@ -2369,7 +2374,11 @@ public class Editor extends JFrame implements RunnerListener {
* hitting export twice, quickly, and horking things up. * hitting export twice, quickly, and horking things up.
*/ */
synchronized public void handleExport(final boolean usingProgrammer) { synchronized public void handleExport(final boolean usingProgrammer) {
//if (!handleExportCheckModified()) return; if (Preferences.getBoolean("editor.save_on_verify")) {
if (sketch.isModified() && !sketch.isReadOnly()) {
handleSave(true);
}
}
toolbar.activate(EditorToolbar.EXPORT); toolbar.activate(EditorToolbar.EXPORT);
console.clear(); console.clear();
status.progress(_("Uploading to I/O Board...")); status.progress(_("Uploading to I/O Board..."));

View File

@ -208,6 +208,7 @@ public class Preferences {
JCheckBox updateExtensionBox; JCheckBox updateExtensionBox;
JCheckBox autoAssociateBox; JCheckBox autoAssociateBox;
JComboBox comboLanguage; JComboBox comboLanguage;
JCheckBox saveVerifyUploadBox;
// the calling editor, so updates can be applied // the calling editor, so updates can be applied
@ -478,6 +479,15 @@ public class Preferences {
autoAssociateBox.setEnabled(false); autoAssociateBox.setEnabled(false);
} }
// [ ] save when verifying or uploading
saveVerifyUploadBox = new JCheckBox(_("Save when verifying or uploading"));
pain.add(saveVerifyUploadBox);
d = saveVerifyUploadBox.getPreferredSize();
saveVerifyUploadBox.setBounds(left, top, d.width + 10, d.height);
right = Math.max(right, left + d.width);
top += d.height + GUI_BETWEEN;
// More preferences are in the ... // More preferences are in the ...
label = new JLabel(_("More preferences can be edited directly in the file")); label = new JLabel(_("More preferences can be edited directly in the file"));
@ -620,7 +630,8 @@ public class Preferences {
setBoolean("upload.verbose", verboseUploadBox.isSelected()); setBoolean("upload.verbose", verboseUploadBox.isSelected());
setBoolean("editor.linenumbers", displayLineNumbersBox.isSelected()); setBoolean("editor.linenumbers", displayLineNumbersBox.isSelected());
setBoolean("upload.verify", verifyUploadBox.isSelected()); setBoolean("upload.verify", verifyUploadBox.isSelected());
setBoolean("editor.save_on_verify", saveVerifyUploadBox.isSelected());
// setBoolean("sketchbook.closing_last_window_quits", // setBoolean("sketchbook.closing_last_window_quits",
// closingLastQuitsBox.isSelected()); // closingLastQuitsBox.isSelected());
//setBoolean("sketchbook.prompt", sketchPromptBox.isSelected()); //setBoolean("sketchbook.prompt", sketchPromptBox.isSelected());
@ -642,6 +653,7 @@ public class Preferences {
setBoolean("editor.external", externalEditorBox.isSelected()); setBoolean("editor.external", externalEditorBox.isSelected());
setBoolean("update.check", checkUpdatesBox.isSelected()); setBoolean("update.check", checkUpdatesBox.isSelected());
setBoolean("editor.save_on_verify", saveVerifyUploadBox.isSelected());
/* /*
// was gonna use this to check memory settings, // was gonna use this to check memory settings,
@ -703,6 +715,8 @@ public class Preferences {
setSelected(getBoolean("editor.external")); setSelected(getBoolean("editor.external"));
checkUpdatesBox. checkUpdatesBox.
setSelected(getBoolean("update.check")); setSelected(getBoolean("update.check"));
saveVerifyUploadBox.
setSelected(getBoolean("editor.save_on_verify"));
if (autoAssociateBox != null) { if (autoAssociateBox != null) {
autoAssociateBox. autoAssociateBox.

View File

@ -149,6 +149,9 @@ editor.divider.size = 0
# but keeps it from being annoyingly obtrusive # but keeps it from being annoyingly obtrusive
editor.divider.size.windows = 2 editor.divider.size.windows = 2
# automatically save sketch when verifying or uploading
editor.save_on_verify = true
# any additional java options when running externally # any additional java options when running externally
# (for applets that are run external to the environment... # (for applets that are run external to the environment...
# those with a code folder, or using any libraries) # those with a code folder, or using any libraries)

View File

@ -2,6 +2,7 @@
ARDUINO 1.5.9 ARDUINO 1.5.9
[ide] [ide]
* Autosave on sketch Upload/Verify (Fulvio Ieva)
* Sketch build process: fixed full rebuild on windows even if not needed * Sketch build process: fixed full rebuild on windows even if not needed
* Sketch build process: core.a rebuild only if needed (Matthijs Kooijman) * Sketch build process: core.a rebuild only if needed (Matthijs Kooijman)
* Updated AStyle formatter to v2.04: http://astyle.sourceforge.net/notes.html * Updated AStyle formatter to v2.04: http://astyle.sourceforge.net/notes.html