Skip to content

Commit 5871c04

Browse files
committed
fix OS X default File menu to be the same order as the other File menu
1 parent b844cb1 commit 5871c04

File tree

3 files changed

+36
-31
lines changed

3 files changed

+36
-31
lines changed

app/src/processing/app/Base.java

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ protected void handleActivated(Editor whichEditor) {
517517

518518
// make this the next mode to be loaded
519519
nextMode = whichEditor.getMode();
520-
Preferences.set("last.sketch.mode", nextMode.getIdentifier()); //$NON-NLS-1$
520+
Preferences.set("mode.last", nextMode.getIdentifier()); //$NON-NLS-1$
521521
}
522522

523523

@@ -627,6 +627,12 @@ private void saveModeSettings(final File sketchProps, final Mode mode) {
627627
public Mode getDefaultMode() {
628628
return coreModes[0];
629629
}
630+
631+
632+
/** Used by ThinkDifferent so that it can have a Sketchbook menu. */
633+
public Mode getNextMode() {
634+
return nextMode;
635+
}
630636

631637

632638
/**
@@ -976,12 +982,10 @@ public boolean handleClose(Editor editor, boolean modeSwitch) {
976982
// Since this wasn't an actual Quit event, call System.exit()
977983
System.exit(0);
978984
}
979-
} else {
985+
} else { // on OS X, update the default file menu
980986
editor.setVisible(false);
981987
editor.dispose();
982-
defaultFileMenu.insert(sketchbookMenu, 2);
983-
defaultFileMenu.insert(getRecentMenu(), 3);
984-
// defaultFileMenu.insert(defaultMode.getExamplesMenu(), 3);
988+
defaultFileMenu.insert(getRecentMenu(), 2);
985989
activeEditor = null;
986990
editors.remove(editor);
987991
}
@@ -991,16 +995,6 @@ public boolean handleClose(Editor editor, boolean modeSwitch) {
991995
// proceed with closing the current window.
992996
editor.setVisible(false);
993997
editor.dispose();
994-
// for (int i = 0; i < editorCount; i++) {
995-
// if (editor == editors[i]) {
996-
// for (int j = i; j < editorCount-1; j++) {
997-
// editors[j] = editors[j+1];
998-
// }
999-
// editorCount--;
1000-
// // Set to null so that garbage collection occurs
1001-
// editors[editorCount] = null;
1002-
// }
1003-
// }
1004998
editors.remove(editor);
1005999
}
10061000
return true;
@@ -1132,13 +1126,13 @@ public void populateSketchbookMenu(JMenu menu) {
11321126
}
11331127

11341128

1135-
public JMenu getSketchbookMenu() {
1136-
if (sketchbookMenu == null) {
1137-
sketchbookMenu = new JMenu(Language.text("menu.file.sketchbook"));
1138-
rebuildSketchbookMenu();
1139-
}
1140-
return sketchbookMenu;
1141-
}
1129+
// public JMenu getSketchbookMenu() {
1130+
// if (sketchbookMenu == null) {
1131+
// sketchbookMenu = new JMenu(Language.text("menu.file.sketchbook"));
1132+
// rebuildSketchbookMenu();
1133+
// }
1134+
// return sketchbookMenu;
1135+
// }
11421136

11431137

11441138
// public JMenu getRecentMenu() {

app/src/processing/app/platform/ThinkDifferent.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,14 @@ public void actionPerformed(ActionEvent e) {
135135
});
136136
fileMenu.add(item);
137137

138-
fileMenu.add(base.getSketchbookMenu());
138+
item = Toolkit.newJMenuItemShift(Language.text("menu.file.sketchbook"), 'K');
139+
item.addActionListener(new ActionListener() {
140+
@Override
141+
public void actionPerformed(ActionEvent e) {
142+
base.getNextMode().showSketchbookFrame();
143+
}
144+
});
145+
fileMenu.add(item);
139146

140147
item = Toolkit.newJMenuItemShift(Language.text("menu.file.examples"), 'O');
141148
item.addActionListener(new ActionListener() {

todo.txt

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,23 @@ X add the separate contribs.txt link on download.processing.org
77
X fix inside ContributionListing.java
88
X change default mode handling to use experimental as the default
99
X remove isDefaultMode(), since it was doing the wrong thing
10-
_ make a new preference setting for the default mode
11-
_ this will set folks to the PDE X mode, and prevent conflicts w/ 2.0
12-
_ hide the old Java mode
10+
X make a new preference setting for the default mode
11+
X this will set folks to the PDE X mode, and prevent conflicts w/ 2.0
12+
X change last.sketch.mode to mode.last
13+
X fix OS X default File menu to be the same order as the other File menu
14+
15+
16+
before launch
17+
_ hide the old Java mode (?)
1318

1419

1520
cleaning
1621
X single line of code with no semicolon dies with "unexpected token: null"
1722
X http://code.google.com/p/processing/issues/detail?id=1312
1823
X https://github.com/processing/processing/issues/1350
1924
X closed by Dan post-3.0a3
25+
X move sketchbook into its own window
26+
X move recent into the sketchbook menu
2027

2128

2229
pulls
@@ -33,11 +40,6 @@ _ https://github.com/processing/processing/pull/2825
3340
_ check on pull for mnemonics
3441
_ https://github.com/processing/processing/pull/2382
3542

36-
_ Fix OS X menu to be the same order as the other File menu
37-
_ move sketchbook into its own window
38-
_ move recent into the sketchbook menu
39-
_ needs to recognize the p5 app folder
40-
_ also should recognize the user's home dir
4143

4244
_ remove toolbar menu references and code to rebuild
4345

@@ -91,6 +93,8 @@ _ https://github.com/processing/processing/issues/2199
9193

9294

9395
medium
96+
_ 'recent' menu needs to recognize the p5 app folder
97+
_ also should recognize the user's home dir
9498
_ possibility of libraries folder inside a particular sketch?
9599
_ display "1" is not correct in 2.1.2
96100
_ https://github.com/processing/processing/issues/2502

0 commit comments

Comments
 (0)