- (void)keyDown:(NSEvent *)ev;
- (void)activateTimer;
- (void)deactivateTimer;
-- (void)setStatusLine:(NSString *)text;
+- (void)setStatusLine:(char *)text;
@end
@implementation MyImageView
frame.origin.y = 0;
frame.origin.x = 0;
- midend_size(me, &w, &h);
+ w = h = INT_MAX;
+ midend_size(me, &w, &h, FALSE);
frame.size.width = w;
frame.size.height = h;
* initWithGame: simply call that one and pass it NULL.
*/
midend_new_game(me);
- midend_size(me, &w, &h);
+ w = h = INT_MAX;
+ midend_size(me, &w, &h, FALSE);
rect.size.width = w;
rect.size.height = h;
* function key codes.
*/
if (c >= 0x80) {
+ int mods = FALSE;
switch (c) {
case NSUpArrowFunctionKey:
c = CURSOR_UP;
+ mods = TRUE;
break;
case NSDownArrowFunctionKey:
c = CURSOR_DOWN;
+ mods = TRUE;
break;
case NSLeftArrowFunctionKey:
c = CURSOR_LEFT;
+ mods = TRUE;
break;
case NSRightArrowFunctionKey:
c = CURSOR_RIGHT;
+ mods = TRUE;
break;
default:
continue;
}
+
+ if (mods) {
+ if ([ev modifierFlags] & NSShiftKeyMask)
+ c |= MOD_SHFT;
+ if ([ev modifierFlags] & NSControlKeyMask)
+ c |= MOD_CTRL;
+ }
}
if (c >= '0' && c <= '9' && ([ev modifierFlags] & NSNumericPadKeyMask))
}
- (void)restartGame:(id)sender
{
- [self processButton:'r' x:-1 y:-1];
+ midend_restart_game(me);
}
- (void)undoMove:(id)sender
{
NSSize size = {0,0};
int w, h;
- midend_size(me, &w, &h);
+ w = h = INT_MAX;
+ midend_size(me, &w, &h, FALSE);
size.width = w;
size.height = h;
- (void)specificGame:(id)sender
{
+ [self startConfigureSheet:CFG_DESC];
+}
+
+- (void)specificRandomGame:(id)sender
+{
[self startConfigureSheet:CFG_SEED];
}
[self sheetEndWithStatus:NO];
}
-- (void)setStatusLine:(NSString *)text
+- (void)setStatusLine:(char *)text
{
- [[status cell] setTitle:text];
+ char *rewritten = midend_rewrite_statusbar(me, text);
+ [[status cell] setTitle:[NSString stringWithCString:rewritten]];
+ sfree(rewritten);
}
@end
void status_bar(frontend *fe, char *text)
{
- [fe->window setStatusLine:[NSString stringWithCString:text]];
+ [fe->window setStatusLine:text];
}
/* ----------------------------------------------------------------------
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:));
+ item = newitem(menu, "Specific Random Seed", "", NULL,
+ @selector(specificRandomGame:));
[menu addItem:[NSMenuItem separatorItem]];
{
NSMenu *submenu = newsubmenu(menu, "New Window");