Flesh out the menus a bit.

[originally from svn r5175]
This commit is contained in:
Simon Tatham
2005-01-23 08:36:24 +00:00
parent 84a73c30ac
commit d85a505463

View File

@ -30,21 +30,19 @@
* *
* - is there a better approach to frontend_default_colour? * - is there a better approach to frontend_default_colour?
* *
* - some options in the Window menu! Close and Minimise, I think, * - do we need any more options in the Window menu?
* at least.
* *
* - more Mac-ish key bindings. I suspect, for example, that Undo * - see if we can do anything to one-button-ise the multi-button
* should be Command-Z as well as (or even instead of?) Ctrl-Z. * dependent puzzle UIs:
* * - Pattern is a _little_ unwieldy but not too bad (since
* - Which reminds me, commands like Undo and Redo also ought to * generally you never need the middle button unless you've
* be available from the menus. Actually, the sensible thing is * made a mistake, so it's just click versus command-click).
* probably to go and look at the menus on Unix and make sure * - Net is utterly vile; having normal click be one rotate and
* everything is there. * command-click be the other introduces a horrid asymmetry,
* * and yet requiring a shift key for _each_ click would be
* - see if we can do anything to one-button-ise the puzzle UIs. * even worse because rotation feels as if it ought to be the
* Some are fine as is (Sixteen, Fifteen, Rectangles, Netslide, * default action. I fear this is why the Flash Net had the
* Cube), some are a little unwieldy with Command-clicking * UI it did...
* (Pattern), and some are utterly horrid (Net).
* *
* - Find out how to do help, and do some. We have a help file; at * - Find out how to do help, and do some. We have a help file; at
* _worst_ this should involve a new Halibut back end, but I * _worst_ this should involve a new Halibut back end, but I
@ -360,6 +358,23 @@ struct frontend {
last_time = now; last_time = now;
} }
- (void)newGame:(id)sender
{
[self processButton:'n' x:-1 y:-1];
}
- (void)restartGame:(id)sender
{
[self processButton:'r' x:-1 y:-1];
}
- (void)undoMove:(id)sender
{
[self processButton:'u' x:-1 y:-1];
}
- (void)redoMove:(id)sender
{
[self processButton:'r'&0x1F x:-1 y:-1];
}
@end @end
/* /*
@ -492,7 +507,7 @@ void activate_timer(frontend *fe)
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
* Utility routines for constructing OS X menus. * Utility routines for constructing OS X menus.
~|~ */ */
NSMenu *newmenu(const char *title) NSMenu *newmenu(const char *title)
{ {
@ -634,7 +649,7 @@ 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], "Game"); menu = newsubmenu([NSApp mainMenu], "Open");
{ {
int i; int i;
@ -647,8 +662,22 @@ int main(int argc, char **argv)
} }
} }
menu = newsubmenu([NSApp mainMenu], "Windows"); 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]];
item = newitem(menu, "Undo", "z", NULL, @selector(undoMove:));
item = newitem(menu, "Redo", "S-z", NULL, @selector(redoMove:));
[menu addItem:[NSMenuItem separatorItem]];
item = newitem(menu, "Close", "w", NULL, @selector(performClose:));
menu = newsubmenu([NSApp mainMenu], "Type");
item = newitem(menu, "Custom", "", NULL, @selector(customGameType:));
menu = newsubmenu([NSApp mainMenu], "Window");
[NSApp setWindowsMenu: menu]; [NSApp setWindowsMenu: menu];
item = newitem(menu, "Minimise Window", "m", NULL, @selector(performMiniaturize:));
[NSApp run]; [NSApp run];
[pool release]; [pool release];