mirror of
https://github.com/processing/processing4.git
synced 2026-02-23 23:35:41 +01:00
add "do you want to quit", also menubar toggle pref
This commit is contained in:
@@ -133,15 +133,15 @@ public class Base {
|
||||
|
||||
initPlatform();
|
||||
|
||||
// Set the look and feel before opening the window
|
||||
try {
|
||||
platform.setLookAndFeel();
|
||||
} catch (Exception e) {
|
||||
System.err.println("Non-fatal error while setting the Look & Feel.");
|
||||
System.err.println("The error message follows, however Processing should run fine.");
|
||||
System.err.println(e.getMessage());
|
||||
//e.printStackTrace();
|
||||
}
|
||||
// // Set the look and feel before opening the window
|
||||
// try {
|
||||
// platform.setLookAndFeel();
|
||||
// } catch (Exception e) {
|
||||
// System.err.println("Non-fatal error while setting the Look & Feel.");
|
||||
// System.err.println("The error message follows, however Processing should run fine.");
|
||||
// System.err.println(e.getMessage());
|
||||
// //e.printStackTrace();
|
||||
// }
|
||||
|
||||
// Use native popups so they don't look so crappy on osx
|
||||
JPopupMenu.setDefaultLightWeightPopupEnabled(false);
|
||||
@@ -153,11 +153,7 @@ public class Base {
|
||||
initRequirements();
|
||||
|
||||
// run static initialization that grabs all the prefs
|
||||
// try {
|
||||
Preferences.init(null);
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
|
||||
if (Base.isMacOS()) {
|
||||
String fiasco = "apple.laf.useScreenMenuBar";
|
||||
@@ -175,7 +171,8 @@ public class Base {
|
||||
"<p>Due to an Apple bug, the Processing menu bar is " +
|
||||
"unusable when run on Mac OS X 10.5 (Leopard). " +
|
||||
"As a workaround, the menu bar will be placed inside " +
|
||||
"the editor window.</p>" +
|
||||
"the editor window. This setting can be changed in the " +
|
||||
"Preferences window.</p>" +
|
||||
"</html>";
|
||||
// String warning =
|
||||
// "Due to an Apple bug, the Processing menu bar is\n" +
|
||||
@@ -205,6 +202,17 @@ public class Base {
|
||||
System.setProperty("apple.laf.useScreenMenuBar", menubar);
|
||||
}
|
||||
|
||||
// Set the look and feel before opening the window
|
||||
// For 0158, moving it lower so that the apple.laf.useScreenMenuBar stuff works
|
||||
try {
|
||||
platform.setLookAndFeel();
|
||||
} catch (Exception e) {
|
||||
System.err.println("Non-fatal error while setting the Look & Feel.");
|
||||
System.err.println("The error message follows, however Processing should run fine.");
|
||||
System.err.println(e.getMessage());
|
||||
//e.printStackTrace();
|
||||
}
|
||||
|
||||
// Create a location for untitled sketches
|
||||
untitledFolder = createTempFolder("untitled");
|
||||
untitledFolder.deleteOnExit();
|
||||
@@ -698,11 +706,31 @@ public class Base {
|
||||
|
||||
//if (editorCount == 1) {
|
||||
if (editors.size() == 1) {
|
||||
System.out.println("editor count is 1, " + editor.untitled);
|
||||
// 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 (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?";
|
||||
|
||||
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();
|
||||
@@ -713,19 +741,8 @@ public class Base {
|
||||
// Since this wasn't an actual Quit event, call System.exit()
|
||||
System.exit(0);
|
||||
|
||||
} else {
|
||||
return handleNewReplaceImpl();
|
||||
// try {
|
||||
// // open an untitled document in the last remaining window
|
||||
// String path = createNewUntitled();
|
||||
// editor.handleOpenInternal(path);
|
||||
// editor.untitled = true;
|
||||
// return true; // or false?
|
||||
//
|
||||
// } catch (IOException e) {
|
||||
// e.printStackTrace();
|
||||
// return false;
|
||||
// }
|
||||
// } else {
|
||||
// return handleNewReplaceImpl();
|
||||
}
|
||||
} else {
|
||||
// More than one editor window open,
|
||||
|
||||
@@ -133,6 +133,7 @@ public class Preferences {
|
||||
JCheckBox checkUpdatesBox;
|
||||
JTextField fontSizeField;
|
||||
JCheckBox autoAssociateBox;
|
||||
JCheckBox menubarWorkaroundBox;
|
||||
|
||||
|
||||
// the calling editor, so updates can be applied
|
||||
@@ -403,6 +404,23 @@ public class Preferences {
|
||||
right = Math.max(right, left + d.width);
|
||||
top += d.height + GUI_BETWEEN;
|
||||
}
|
||||
|
||||
|
||||
// [ ] Place menu bar inside
|
||||
|
||||
if (Base.isMacOS()) {
|
||||
if (System.getProperty("os.version").startsWith("10.5")) {
|
||||
menubarWorkaroundBox =
|
||||
new JCheckBox("Place menus inside editor window to avoid " +
|
||||
"Apple Java bug (requires restart)");
|
||||
pain.add(menubarWorkaroundBox);
|
||||
d = menubarWorkaroundBox.getPreferredSize();
|
||||
menubarWorkaroundBox.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 ...
|
||||
|
||||
@@ -607,6 +625,11 @@ public class Preferences {
|
||||
autoAssociateBox.isSelected());
|
||||
}
|
||||
|
||||
if (menubarWorkaroundBox != null) {
|
||||
setBoolean("apple.laf.useScreenMenuBar",
|
||||
!menubarWorkaroundBox.isSelected());
|
||||
}
|
||||
|
||||
editor.applyPreferences();
|
||||
}
|
||||
|
||||
@@ -639,6 +662,11 @@ public class Preferences {
|
||||
setSelected(getBoolean("platform.auto_file_type_associations"));
|
||||
}
|
||||
|
||||
if (menubarWorkaroundBox != null) {
|
||||
menubarWorkaroundBox.
|
||||
setSelected(!getBoolean("apple.laf.useScreenMenuBar"));
|
||||
}
|
||||
|
||||
dialog.setVisible(true);
|
||||
}
|
||||
|
||||
|
||||
45
todo.txt
45
todo.txt
@@ -1,20 +1,37 @@
|
||||
0158 pde
|
||||
X missing semicolons - better error message
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=12
|
||||
_ need to highlight the previous line as well (or instead)
|
||||
o http://dev.processing.org/bugs/show_bug.cgi?id=12
|
||||
o need to highlight the previous line as well (or instead)
|
||||
X clean up some of the new/open code internally
|
||||
X export to application options dialog
|
||||
X implement error message regarding the apple menu bug on leopard
|
||||
X add a preference to toggle the menubar on osx
|
||||
X confirm "Do you want to Quit?"
|
||||
X remove the preference for auto-quit
|
||||
o tarbell substrate to P2D
|
||||
_ change sketch naming with the dates
|
||||
|
||||
_ confirm "Do you want to Quit?"
|
||||
_ remove the preference for auto-quit
|
||||
|
||||
_ coloring for CENTER and DIAMETER, turn off coloring for deprecated
|
||||
_ export to application options dialog
|
||||
_ rewrite preferences window to use proper layout?
|
||||
_ is there already a bug for this?
|
||||
|
||||
_ overlapping editor windows caused by activeEditor not being called in time
|
||||
_ see handleActivated in Base, and do placement differently
|
||||
_ may also need to deal w/ sync problems
|
||||
_ also make sure that it'll start at the top again when done
|
||||
|
||||
_ fix up mkdmg script to work with leopard properly
|
||||
_ even though the error suggests on thing, seems to be something earlier
|
||||
_ need to also detect whether running 10.4 or 10.5
|
||||
|
||||
_ if untitled, and not modified, and closing on macosx (only)
|
||||
_ don't close the sketch and create a new one
|
||||
_ put up dialog box telling the user to use 'quit' or change the preference
|
||||
_ or just automatically quit at that point?
|
||||
|
||||
. . .
|
||||
|
||||
_ coloring for CENTER and DIAMETER, turn off coloring for deprecated
|
||||
|
||||
_ add bug voting to the bugs db before 1.0 release?
|
||||
|
||||
_ "An error occurred while starting the application" with Processing 0154+
|
||||
@@ -22,10 +39,6 @@ _ Maybe provide the old exe or another alternative?
|
||||
_ Have someone try this on lab machines until we can find one that breaks
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=986
|
||||
|
||||
_ fix up mkdmg script to work with leopard properly
|
||||
_ even though the error suggests on thing, seems to be something earlier
|
||||
_ need to also detect whether running 10.4 or 10.5
|
||||
|
||||
_ go through other sketch-opening menus to check for disappearing sketches
|
||||
|
||||
_ check if platform is MACOSX and font is monospaced (?)
|
||||
@@ -36,11 +49,9 @@ _ update applet.html to point at java 6u10 with the new auto-update stuff
|
||||
_ also update applet on the home page to do the same
|
||||
|
||||
_ disallow add file to sketch if it's an example or read-only
|
||||
|
||||
_ if untitled, and not modified, and closing on macosx (only)
|
||||
_ don't close the sketch and create a new one
|
||||
_ put up dialog box telling the user to use 'quit' or change the preference
|
||||
_ or just automatically quit at that point?
|
||||
_ export as well
|
||||
_ pretty much anything inside the sketch?
|
||||
_ but don't do this with untitled, cuz it kinda stinks
|
||||
|
||||
_ opengl broken on vista laptop with articulate
|
||||
_ when background() is not called to clear the buffers, causes flashing
|
||||
@@ -602,6 +613,8 @@ _ but right now there's a hack to add a CR in PdePreprocessor
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=5
|
||||
_ Parsing error when using char literals
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=281
|
||||
_ Improve detection and handling of missing semicolons
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=1036
|
||||
|
||||
|
||||
PDE / Editor
|
||||
|
||||
Reference in New Issue
Block a user