The addition of a `Copy' menu item on OS X was really beginning to

strain my unconventional menu organisation, so I've reverted to
having `File' and `Edit' menus like everyone else.

[originally from svn r5727]
This commit is contained in:
Simon Tatham
2005-05-01 14:05:03 +00:00
parent 850a70a03c
commit 28f655c821
2 changed files with 35 additions and 27 deletions

37
osx.m
View File

@ -60,13 +60,9 @@
* nested sheet. On the other hand I think there are good * nested sheet. On the other hand I think there are good
* practical reasons for wanting it that way. Uncertain. * practical reasons for wanting it that way. Uncertain.
* *
* - User feedback suggests we should have `File' and `Edit' menus * - User feedback dislikes nothing happening when you start the
* like everyone else, so some menu reorg is probably required, * app; they suggest a finder-like window containing an icon for
* along with some documentation rewording. * each puzzle type, enabling you to start one easily. Needs
*
* - User feedback also dislikes nothing happening when you start
* the app; they suggest a finder-like window containing an icon
* for each puzzle type, enabling you to start one easily. Needs
* thought. * thought.
* *
* Grotty implementation details that could probably be improved: * Grotty implementation details that could probably be improved:
@ -1151,12 +1147,12 @@ void status_bar(frontend *fe, char *text)
@interface AppController : NSObject @interface AppController : NSObject
{ {
} }
- (void)newGame:(id)sender; - (void)newGameWindow:(id)sender;
@end @end
@implementation AppController @implementation AppController
- (void)newGame:(id)sender - (void)newGameWindow:(id)sender
{ {
const game *g = [sender getPayload]; const game *g = [sender getPayload];
id win; id win;
@ -1175,7 +1171,7 @@ void status_bar(frontend *fe, char *text)
id item = id item =
initnewitem([DataMenuItem allocWithZone:[NSMenu menuZone]], initnewitem([DataMenuItem allocWithZone:[NSMenu menuZone]],
menu, gamelist[i]->name, "", self, menu, gamelist[i]->name, "", self,
@selector(newGame:)); @selector(newGameWindow:));
[item setPayload:(void *)gamelist[i]]; [item setPayload:(void *)gamelist[i]];
} }
} }
@ -1216,30 +1212,31 @@ int main(int argc, char **argv)
item = newitem(menu, "Quit", "q", NSApp, @selector(terminate:)); item = newitem(menu, "Quit", "q", NSApp, @selector(terminate:));
[NSApp setAppleMenu: menu]; [NSApp setAppleMenu: menu];
menu = newsubmenu([NSApp mainMenu], "Open"); menu = newsubmenu([NSApp mainMenu], "File");
item = newitem(menu, "New Game", "n", NULL, @selector(newGame:));
item = newitem(menu, "Restart Game", "r", NULL, @selector(restartGame:));
item = newitem(menu, "Specific Game", "", NULL, @selector(specificGame:));
[menu addItem:[NSMenuItem separatorItem]];
{ {
NSMenu *submenu = newsubmenu(menu, "New Window");
int i; int i;
for (i = 0; i < gamecount; i++) { for (i = 0; i < gamecount; i++) {
id item = id item =
initnewitem([DataMenuItem allocWithZone:[NSMenu menuZone]], initnewitem([DataMenuItem allocWithZone:[NSMenu menuZone]],
menu, gamelist[i]->name, "", controller, submenu, gamelist[i]->name, "", controller,
@selector(newGame:)); @selector(newGameWindow:));
[item setPayload:(void *)gamelist[i]]; [item setPayload:(void *)gamelist[i]];
} }
} }
menu = newsubmenu([NSApp mainMenu], "Game");
item = newitem(menu, "New", "n", NULL, @selector(newGame:));
item = newitem(menu, "Restart", "r", NULL, @selector(restartGame:));
item = newitem(menu, "Specific", "", NULL, @selector(specificGame:));
[menu addItem:[NSMenuItem separatorItem]]; [menu addItem:[NSMenuItem separatorItem]];
item = newitem(menu, "Close", "w", NULL, @selector(performClose:));
menu = newsubmenu([NSApp mainMenu], "Edit");
item = newitem(menu, "Undo", "z", NULL, @selector(undoMove:)); item = newitem(menu, "Undo", "z", NULL, @selector(undoMove:));
item = newitem(menu, "Redo", "S-z", NULL, @selector(redoMove:)); item = newitem(menu, "Redo", "S-z", NULL, @selector(redoMove:));
[menu addItem:[NSMenuItem separatorItem]]; [menu addItem:[NSMenuItem separatorItem]];
item = newitem(menu, "Copy", "c", NULL, @selector(copy:)); item = newitem(menu, "Copy", "c", NULL, @selector(copy:));
[menu addItem:[NSMenuItem separatorItem]];
item = newitem(menu, "Close", "w", NULL, @selector(performClose:));
menu = newsubmenu([NSApp mainMenu], "Type"); menu = newsubmenu([NSApp mainMenu], "Type");
typemenu = menu; typemenu = menu;

View File

@ -82,6 +82,10 @@ These actions are all available from the \I{Game menu}\q{Game} menu
and via \I{keys}keyboard shortcuts, in addition to any game-specific and via \I{keys}keyboard shortcuts, in addition to any game-specific
actions. actions.
(On Mac OS X, to conform with local user interface standards, these
actions are situated on the \I{File menu}\q{File} and \q{Edit
menu}\q{Edit} menus instead.)
\dt \ii\e{New game} (\q{N}, Ctrl+\q{N}) \dt \ii\e{New game} (\q{N}, Ctrl+\q{N})
\dd Starts a new game, with a random initial state. \dd Starts a new game, with a random initial state.
@ -99,6 +103,13 @@ game.)
\dd Redoes a previous undone move. \dd Redoes a previous undone move.
\dt \ii\e{Copy}
\dd Copies the current state of your game to the clipboard in text
format, so that you can paste it into (say) an e-mail client or a
web message board if you're discussing the game with someone else.
(Not all games support this feature.)
\dt \I{exit}\ii\e{Quit} (\q{Q}, Ctrl+\q{Q}) \dt \I{exit}\ii\e{Quit} (\q{Q}, Ctrl+\q{Q})
\dd Closes the application entirely. \dd Closes the application entirely.
@ -106,8 +117,8 @@ game.)
\H{common-id} Recreating games with the \ii{game ID} \H{common-id} Recreating games with the \ii{game ID}
The \q{\i{Specific...}} option from the \I{Game menu}\q{Game} menu The \q{\i{Specific...}} option from the \I{Game menu}\q{Game} menu
lets you see a short string (the \q{game ID}) that captures the (or the \q{File} menu, on Mac OS X) lets you see a short string (the
initial state of the current game. \q{game ID}) that captures the initial state of the current game.
The precise \I{ID format}format of the ID is specific to each game. The precise \I{ID format}format of the ID is specific to each game.
It consists of two parts delimited by a colon (e.g., \c{c4x4:4F01,0}); It consists of two parts delimited by a colon (e.g., \c{c4x4:4F01,0});
@ -151,11 +162,11 @@ command line.
The easiest way to do this is to set up the parameters you want The easiest way to do this is to set up the parameters you want
using the \q{Type} menu (see \k{common-type}), and then to select using the \q{Type} menu (see \k{common-type}), and then to select
\q{Specific} from the \q{Game} menu (see \k{common-id}). The text in \q{Specific} from the \q{Game} or \q{File} menu (see \k{common-id}).
the \q{Game ID} box will be composed of two parts, separated by a The text in the \q{Game ID} box will be composed of two parts,
colon. The first of these parts represents the game parameters (the separated by a colon. The first of these parts represents the game
size of the playing area, for example, and anything else you set parameters (the size of the playing area, for example, and anything
using the \q{Type} menu). else you set using the \q{Type} menu).
If you run the game with just that parameter text on the command If you run the game with just that parameter text on the command
line, it will start up with the settings you specified. line, it will start up with the settings you specified.