fix OS X default File menu to be the same order as the other File menu

This commit is contained in:
Ben Fry
2014-09-10 16:14:20 -04:00
parent 6e5a938a99
commit 265b0ac4d4
3 changed files with 36 additions and 31 deletions

View File

@@ -517,7 +517,7 @@ public class Base {
// make this the next mode to be loaded
nextMode = whichEditor.getMode();
Preferences.set("last.sketch.mode", nextMode.getIdentifier()); //$NON-NLS-1$
Preferences.set("mode.last", nextMode.getIdentifier()); //$NON-NLS-1$
}
@@ -627,6 +627,12 @@ public class Base {
public Mode getDefaultMode() {
return coreModes[0];
}
/** Used by ThinkDifferent so that it can have a Sketchbook menu. */
public Mode getNextMode() {
return nextMode;
}
/**
@@ -976,12 +982,10 @@ public class Base {
// Since this wasn't an actual Quit event, call System.exit()
System.exit(0);
}
} else {
} else { // on OS X, update the default file menu
editor.setVisible(false);
editor.dispose();
defaultFileMenu.insert(sketchbookMenu, 2);
defaultFileMenu.insert(getRecentMenu(), 3);
// defaultFileMenu.insert(defaultMode.getExamplesMenu(), 3);
defaultFileMenu.insert(getRecentMenu(), 2);
activeEditor = null;
editors.remove(editor);
}
@@ -991,16 +995,6 @@ public class Base {
// proceed with closing the current window.
editor.setVisible(false);
editor.dispose();
// for (int i = 0; i < editorCount; i++) {
// if (editor == editors[i]) {
// for (int j = i; j < editorCount-1; j++) {
// editors[j] = editors[j+1];
// }
// editorCount--;
// // Set to null so that garbage collection occurs
// editors[editorCount] = null;
// }
// }
editors.remove(editor);
}
return true;
@@ -1132,13 +1126,13 @@ public class Base {
}
public JMenu getSketchbookMenu() {
if (sketchbookMenu == null) {
sketchbookMenu = new JMenu(Language.text("menu.file.sketchbook"));
rebuildSketchbookMenu();
}
return sketchbookMenu;
}
// public JMenu getSketchbookMenu() {
// if (sketchbookMenu == null) {
// sketchbookMenu = new JMenu(Language.text("menu.file.sketchbook"));
// rebuildSketchbookMenu();
// }
// return sketchbookMenu;
// }
// public JMenu getRecentMenu() {

View File

@@ -135,7 +135,14 @@ public class ThinkDifferent implements ApplicationListener {
});
fileMenu.add(item);
fileMenu.add(base.getSketchbookMenu());
item = Toolkit.newJMenuItemShift(Language.text("menu.file.sketchbook"), 'K');
item.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
base.getNextMode().showSketchbookFrame();
}
});
fileMenu.add(item);
item = Toolkit.newJMenuItemShift(Language.text("menu.file.examples"), 'O');
item.addActionListener(new ActionListener() {

View File

@@ -7,9 +7,14 @@ X add the separate contribs.txt link on download.processing.org
X fix inside ContributionListing.java
X change default mode handling to use experimental as the default
X remove isDefaultMode(), since it was doing the wrong thing
_ make a new preference setting for the default mode
_ this will set folks to the PDE X mode, and prevent conflicts w/ 2.0
_ hide the old Java mode
X make a new preference setting for the default mode
X this will set folks to the PDE X mode, and prevent conflicts w/ 2.0
X change last.sketch.mode to mode.last
X fix OS X default File menu to be the same order as the other File menu
before launch
_ hide the old Java mode (?)
cleaning
@@ -17,6 +22,8 @@ X single line of code with no semicolon dies with "unexpected token: null"
X http://code.google.com/p/processing/issues/detail?id=1312
X https://github.com/processing/processing/issues/1350
X closed by Dan post-3.0a3
X move sketchbook into its own window
X move recent into the sketchbook menu
pulls
@@ -33,11 +40,6 @@ _ https://github.com/processing/processing/pull/2825
_ check on pull for mnemonics
_ https://github.com/processing/processing/pull/2382
_ Fix OS X menu to be the same order as the other File menu
_ move sketchbook into its own window
_ move recent into the sketchbook menu
_ needs to recognize the p5 app folder
_ also should recognize the user's home dir
_ remove toolbar menu references and code to rebuild
@@ -91,6 +93,8 @@ _ https://github.com/processing/processing/issues/2199
medium
_ 'recent' menu needs to recognize the p5 app folder
_ also should recognize the user's home dir
_ possibility of libraries folder inside a particular sketch?
_ display "1" is not correct in 2.1.2
_ https://github.com/processing/processing/issues/2502