mirror of
https://github.com/arduino/Arduino.git
synced 2025-01-29 18:52:13 +01:00
MacOSX: when closing, no confirmation is displayed any more, unless at least one sketch is modified. In essence: now mac behaves just like the other OSs. Fixes #3093
This commit is contained in:
parent
5ada9fae71
commit
2afdb8a6c3
@ -910,35 +910,6 @@ public class Base {
|
||||
editor.internalCloseRunner();
|
||||
|
||||
if (editors.size() == 1) {
|
||||
// For 0158, when closing the last window /and/ it was already an
|
||||
// untitled sketch, just give up and let the user quit.
|
||||
// if (Preferences.getBoolean("sketchbook.closing_last_window_quits") ||
|
||||
// (editor.untitled && !editor.getSketch().isModified())) {
|
||||
if (OSUtils.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;
|
||||
}
|
||||
}
|
||||
|
||||
// This will store the sketch count as zero
|
||||
editors.remove(editor);
|
||||
try {
|
||||
|
@ -83,7 +83,7 @@ public class ThinkDifferent {
|
||||
@Override
|
||||
public void handleQuitRequestWith(AppEvent.QuitEvent quitEvent, QuitResponse quitResponse) {
|
||||
if (waitForBase()) {
|
||||
if (Base.INSTANCE.handleClose(Base.INSTANCE.getActiveEditor())) {
|
||||
if (Base.INSTANCE.handleQuit()) {
|
||||
quitResponse.performQuit();
|
||||
} else {
|
||||
quitResponse.cancelQuit();
|
||||
@ -113,4 +113,4 @@ public class ThinkDifferent {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user