Skip to content

Persistant application on Mac OS X #1324

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
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
49 changes: 15 additions & 34 deletions app/src/processing/app/Base.java
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ public Base(String[] args) {
* The complement to "storePreferences", this is called when the
* application is first launched.
*/
protected boolean restoreSketches() {
protected boolean restoreSketches() {
// figure out window placement

Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
Expand Down Expand Up @@ -764,40 +764,21 @@ public boolean handleClose(Editor editor) {
// if (Preferences.getBoolean("sketchbook.closing_last_window_quits") ||
// (editor.untitled && !editor.getSketch().isModified())) {
if (Base.isMacOS()) {
Object[] options = { "OK", "Cancel" };
String prompt =
_("<html> " +
"<head> <style type=\"text/css\">"+
"b { font: 13pt \"Lucida Grande\" }"+
"p { font: 11pt \"Lucida Grande\"; margin-top: 8px }"+
"</style> </head>" +
"<b>Are you sure you want to Quit?</b>" +
"<p>Closing the last open sketch will quit Arduino.");

int result = JOptionPane.showOptionDialog(editor,
prompt,
_("Quit"),
JOptionPane.YES_NO_OPTION,
JOptionPane.QUESTION_MESSAGE,
null,
options,
options[0]);
if (result == JOptionPane.NO_OPTION ||
result == JOptionPane.CLOSED_OPTION) {
return false;
}
editors.remove(editor);
editor.setVisible(false);
}
else {
// This will store the sketch count as zero
editors.remove(editor);
Editor.serialMonitor.closeSerialPort();
storeSketches();

// Save out the current prefs state
Preferences.save();

// Since this wasn't an actual Quit event, call System.exit()
System.exit(0);
}

// This will store the sketch count as zero
editors.remove(editor);
Editor.serialMonitor.closeSerialPort();
storeSketches();

// Save out the current prefs state
Preferences.save();

// Since this wasn't an actual Quit event, call System.exit()
System.exit(0);

} else {
// More than one editor window open,
Expand Down