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?
*
* - some options in the Window menu! Close and Minimise, I think,
* at least.
* - do we need any more options in the Window menu?
*
* - more Mac-ish key bindings. I suspect, for example, that Undo
* should be Command-Z as well as (or even instead of?) Ctrl-Z.
*
* - Which reminds me, commands like Undo and Redo also ought to
* be available from the menus. Actually, the sensible thing is
* probably to go and look at the menus on Unix and make sure
* everything is there.
*
* - see if we can do anything to one-button-ise the puzzle UIs.
* Some are fine as is (Sixteen, Fifteen, Rectangles, Netslide,
* Cube), some are a little unwieldy with Command-clicking
* (Pattern), and some are utterly horrid (Net).
* - see if we can do anything to one-button-ise the multi-button
* dependent puzzle UIs:
* - Pattern is a _little_ unwieldy but not too bad (since
* generally you never need the middle button unless you've
* made a mistake, so it's just click versus command-click).
* - Net is utterly vile; having normal click be one rotate and
* command-click be the other introduces a horrid asymmetry,
* and yet requiring a shift key for _each_ click would be
* even worse because rotation feels as if it ought to be the
* default action. I fear this is why the Flash Net had the
* UI it did...
*
* - 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
@ -360,6 +358,23 @@ struct frontend {
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
/*
@ -492,7 +507,7 @@ void activate_timer(frontend *fe)
/* ----------------------------------------------------------------------
* Utility routines for constructing OS X menus.
~|~ */
*/
NSMenu *newmenu(const char *title)
{
@ -634,7 +649,7 @@ int main(int argc, char **argv)
item = newitem(menu, "Quit", "q", NSApp, @selector(terminate:));
[NSApp setAppleMenu: menu];
menu = newsubmenu([NSApp mainMenu], "Game");
menu = newsubmenu([NSApp mainMenu], "Open");
{
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];
item = newitem(menu, "Minimise Window", "m", NULL, @selector(performMiniaturize:));
[NSApp run];
[pool release];