Skip to content

Commit 285a03a

Browse files
committed
Merge branch 'autosave' into HEAD
2 parents e52b4ed + 9a9fef8 commit 285a03a

File tree

4 files changed

+29
-2
lines changed

4 files changed

+29
-2
lines changed

app/src/processing/app/Editor.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1887,6 +1887,11 @@ protected void handleFindReference() {
18871887
*/
18881888
public void handleRun(final boolean verbose) {
18891889
internalCloseRunner();
1890+
if (Preferences.getBoolean("editor.save_on_verify")) {
1891+
if (sketch.isModified() && !sketch.isReadOnly()) {
1892+
handleSave(true);
1893+
}
1894+
}
18901895
running = true;
18911896
toolbar.activate(EditorToolbar.RUN);
18921897
status.progress(_("Compiling sketch..."));
@@ -2369,7 +2374,11 @@ public boolean serialPrompt() {
23692374
* hitting export twice, quickly, and horking things up.
23702375
*/
23712376
synchronized public void handleExport(final boolean usingProgrammer) {
2372-
//if (!handleExportCheckModified()) return;
2377+
if (Preferences.getBoolean("editor.save_on_verify")) {
2378+
if (sketch.isModified() && !sketch.isReadOnly()) {
2379+
handleSave(true);
2380+
}
2381+
}
23732382
toolbar.activate(EditorToolbar.EXPORT);
23742383
console.clear();
23752384
status.progress(_("Uploading to I/O Board..."));

app/src/processing/app/Preferences.java

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ public String toString() {
208208
JCheckBox updateExtensionBox;
209209
JCheckBox autoAssociateBox;
210210
JComboBox comboLanguage;
211+
JCheckBox saveVerifyUploadBox;
211212

212213

213214
// the calling editor, so updates can be applied
@@ -478,6 +479,15 @@ public void actionPerformed(ActionEvent e) {
478479
autoAssociateBox.setEnabled(false);
479480
}
480481

482+
// [ ] save when verifying or uploading
483+
484+
saveVerifyUploadBox = new JCheckBox(_("Save when verifying or uploading"));
485+
pain.add(saveVerifyUploadBox);
486+
d = saveVerifyUploadBox.getPreferredSize();
487+
saveVerifyUploadBox.setBounds(left, top, d.width + 10, d.height);
488+
right = Math.max(right, left + d.width);
489+
top += d.height + GUI_BETWEEN;
490+
481491
// More preferences are in the ...
482492

483493
label = new JLabel(_("More preferences can be edited directly in the file"));
@@ -620,7 +630,8 @@ protected void applyFrame() {
620630
setBoolean("upload.verbose", verboseUploadBox.isSelected());
621631
setBoolean("editor.linenumbers", displayLineNumbersBox.isSelected());
622632
setBoolean("upload.verify", verifyUploadBox.isSelected());
623-
633+
setBoolean("editor.save_on_verify", saveVerifyUploadBox.isSelected());
634+
624635
// setBoolean("sketchbook.closing_last_window_quits",
625636
// closingLastQuitsBox.isSelected());
626637
//setBoolean("sketchbook.prompt", sketchPromptBox.isSelected());
@@ -642,6 +653,7 @@ protected void applyFrame() {
642653

643654
setBoolean("editor.external", externalEditorBox.isSelected());
644655
setBoolean("update.check", checkUpdatesBox.isSelected());
656+
setBoolean("editor.save_on_verify", saveVerifyUploadBox.isSelected());
645657

646658
/*
647659
// was gonna use this to check memory settings,
@@ -703,6 +715,8 @@ protected void showFrame(Editor editor) {
703715
setSelected(getBoolean("editor.external"));
704716
checkUpdatesBox.
705717
setSelected(getBoolean("update.check"));
718+
saveVerifyUploadBox.
719+
setSelected(getBoolean("editor.save_on_verify"));
706720

707721
if (autoAssociateBox != null) {
708722
autoAssociateBox.

build/shared/lib/preferences.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,9 @@ editor.divider.size = 0
149149
# but keeps it from being annoyingly obtrusive
150150
editor.divider.size.windows = 2
151151

152+
# automatically save sketch when verifying or uploading
153+
editor.save_on_verify = true
154+
152155
# any additional java options when running externally
153156
# (for applets that are run external to the environment...
154157
# those with a code folder, or using any libraries)

build/shared/revisions.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
ARDUINO 1.5.9
33

44
[ide]
5+
* Autosave on sketch Upload/Verify (Fulvio Ieva)
56
* Sketch build process: fixed full rebuild on windows even if not needed
67
* Sketch build process: core.a rebuild only if needed (Matthijs Kooijman)
78
* Updated AStyle formatter to v2.04: http://astyle.sourceforge.net/notes.html

0 commit comments

Comments
 (0)