Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion app/src/processing/app/Editor.java
Original file line number Diff line number Diff line change
Expand Up @@ -1887,6 +1887,11 @@ protected void handleFindReference() {
*/
public void handleRun(final boolean verbose) {
internalCloseRunner();
if (Preferences.getBoolean("editor.save_on_verify")) {
if (sketch.isModified() && !sketch.isReadOnly()) {
handleSave(true);
}
}
running = true;
toolbar.activate(EditorToolbar.RUN);
status.progress(_("Compiling sketch..."));
Expand Down Expand Up @@ -2369,7 +2374,11 @@ public boolean serialPrompt() {
* hitting export twice, quickly, and horking things up.
*/
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);
console.clear();
status.progress(_("Uploading to I/O Board..."));
Expand Down
16 changes: 15 additions & 1 deletion app/src/processing/app/Preferences.java
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ public String toString() {
JCheckBox updateExtensionBox;
JCheckBox autoAssociateBox;
JComboBox comboLanguage;
JCheckBox saveVerifyUploadBox;


// the calling editor, so updates can be applied
Expand Down Expand Up @@ -478,6 +479,15 @@ public void actionPerformed(ActionEvent e) {
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 ...

label = new JLabel(_("More preferences can be edited directly in the file"));
Expand Down Expand Up @@ -620,7 +630,8 @@ protected void applyFrame() {
setBoolean("upload.verbose", verboseUploadBox.isSelected());
setBoolean("editor.linenumbers", displayLineNumbersBox.isSelected());
setBoolean("upload.verify", verifyUploadBox.isSelected());

setBoolean("editor.save_on_verify", saveVerifyUploadBox.isSelected());

// setBoolean("sketchbook.closing_last_window_quits",
// closingLastQuitsBox.isSelected());
//setBoolean("sketchbook.prompt", sketchPromptBox.isSelected());
Expand All @@ -642,6 +653,7 @@ protected void applyFrame() {

setBoolean("editor.external", externalEditorBox.isSelected());
setBoolean("update.check", checkUpdatesBox.isSelected());
setBoolean("editor.save_on_verify", saveVerifyUploadBox.isSelected());

/*
// was gonna use this to check memory settings,
Expand Down Expand Up @@ -703,6 +715,8 @@ protected void showFrame(Editor editor) {
setSelected(getBoolean("editor.external"));
checkUpdatesBox.
setSelected(getBoolean("update.check"));
saveVerifyUploadBox.
setSelected(getBoolean("editor.save_on_verify"));

if (autoAssociateBox != null) {
autoAssociateBox.
Expand Down
3 changes: 3 additions & 0 deletions build/shared/lib/preferences.txt
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,9 @@ editor.divider.size = 0
# but keeps it from being annoyingly obtrusive
editor.divider.size.windows = 2

# automatically save sketch when verifying or uploading
editor.save_on_verify = true

# any additional java options when running externally
# (for applets that are run external to the environment...
# those with a code folder, or using any libraries)
Expand Down