don't prompt for quit on close with windows/linux (bug #1076)

This commit is contained in:
benfry
2008-11-28 14:57:24 +00:00
parent 3206fc4de0
commit 00ff6407ed
2 changed files with 37 additions and 35 deletions

View File

@@ -26,7 +26,6 @@ package processing.app;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.text.SimpleDateFormat;
import java.util.*;
import javax.swing.*;
@@ -543,7 +542,7 @@ public class Base {
//SimpleDateFormat formatter = new SimpleDateFormat("yyMMdd");
//SimpleDateFormat formatter = new SimpleDateFormat("MMMdd");
//String purty = formatter.format(new Date()).toLowerCase();
Calendar cal = Calendar.getInstance();
Calendar cal = Calendar.getInstance();
int day = cal.get(Calendar.DAY_OF_MONTH); // 1..31
int month = cal.get(Calendar.MONTH); // 0..11
String purty = months[month] + PApplet.nf(day, 2);
@@ -763,46 +762,45 @@ public class Base {
// Close the running window, avoid window boogers with multiple sketches
editor.internalCloseRunner();
//if (editorCount == 1) {
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())) {
Object[] options = { "OK", "Cancel" };
String prompt = Base.isMacOS() ?
"<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 Processing." :
"Are you sure you want to Quit?";
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 Processing.";
int result = JOptionPane.showOptionDialog(editor,
prompt,
"Quit",
JOptionPane.YES_NO_OPTION,
JOptionPane.QUESTION_MESSAGE,
null,
options,
options[0]);
if (result == JOptionPane.YES_OPTION) {
// This will store the sketch count as zero
editors.remove(editor);
storeSketches();
// Save out the current prefs state
Preferences.save();
// Since this wasn't an actual Quit event, call System.exit()
System.exit(0);
// } else {
// return handleNewReplaceImpl();
int result = JOptionPane.showOptionDialog(editor,
prompt,
"Quit",
JOptionPane.YES_NO_OPTION,
JOptionPane.QUESTION_MESSAGE,
null,
options,
options[0]);
if (result == JOptionPane.NO_OPTION) {
return false;
}
}
// This will store the sketch count as zero
editors.remove(editor);
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,
// proceed with closing the current window.

View File

@@ -7,6 +7,10 @@ _ check if libraries folder does not exist
_ check to see if other libraries are installed
_ warn user about moving libraries and restarting
_ implement multi-line tab via tab key (also outdent)
_ add preference for indent size
_ http://dev.processing.org/bugs/show_bug.cgi?id=1075
1 _ "An error occurred while starting the application" with Processing 0154+
1 _ Maybe provide the old exe or another alternative?
1 _ Have someone try this on lab machines until we can find one that breaks