1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-17 22:23:10 +03:00

add save when verifyng and uploading #1934

This commit is contained in:
Fulvio Ieva
2014-07-24 16:31:06 +02:00
committed by Cristian Maglie
parent 8815806540
commit 5a6af2cf02
2 changed files with 25 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("save.verifyUpload")) {
if (sketch.isModified()) {
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("save.verifyUpload")) {
if (sketch.isModified()) {
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("save.verifyUpload", 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("save.verifyUpload", 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("save.verifyUpload"));
if (autoAssociateBox != null) { if (autoAssociateBox != null) {
autoAssociateBox. autoAssociateBox.