Search
lxdream.org :: lxdream/src/cocoaui/cocoaui.m :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/cocoaui/cocoaui.m
changeset 1040:9e3e41eab2db
prev1036:af7b0c5905dd
next1041:5fcc39857c5c
author nkeynes
date Thu Jun 25 21:21:18 2009 +0000 (11 years ago)
permissions -rw-r--r--
last change Add quick state bits to the menus
file annotate diff log raw
1.1 --- a/src/cocoaui/cocoaui.m Wed Jun 24 06:06:40 2009 +0000
1.2 +++ b/src/cocoaui/cocoaui.m Thu Jun 25 21:21:18 2009 +0000
1.3 @@ -90,6 +90,7 @@
1.4
1.5 static void cocoa_gui_create_menu(void)
1.6 {
1.7 + int i;
1.8 NSMenu *appleMenu, *services;
1.9 NSMenuItem *menuItem;
1.10 NSString *title;
1.11 @@ -137,6 +138,19 @@
1.12
1.13 NSMenu *gdromMenu = cocoa_gdrom_menu_new();
1.14
1.15 + NSMenu *quickStateMenu = [[NSMenu alloc] initWithTitle:NSMENU_("_Quick State")];
1.16 + int quickState = dreamcast_get_quick_state();
1.17 + for( i=0; i<=MAX_QUICK_STATE; i++ ) {
1.18 + NSString *label = [NSString stringWithFormat: NSMENU_("State _%d"), i];
1.19 + NSString *keyEquiv = [NSString stringWithFormat: @"%d", i];
1.20 + menuItem = [[NSMenuItem alloc] initWithTitle: label action: @selector(quick_state_action:) keyEquivalent: keyEquiv];
1.21 + [menuItem setTag: i];
1.22 + if( i == quickState ) {
1.23 + [menuItem setState:NSOnState];
1.24 + }
1.25 + [quickStateMenu addItem: menuItem];
1.26 + }
1.27 +
1.28 NSMenu *fileMenu = [[NSMenu alloc] initWithTitle: NSMENU_("_File")];
1.29 [fileMenu addItemWithTitle: NSMENU_("Load _Binary...") action: @selector(load_binary_action:) keyEquivalent: @"b"];
1.30 [[fileMenu addItemWithTitle: NSMENU_("_GD-Rom") action: nil keyEquivalent: @""]
1.31 @@ -147,8 +161,14 @@
1.32 [fileMenu addItemWithTitle: NSMENU_("_Pause") action: @selector(pause_action:) keyEquivalent: @"p"];
1.33 [fileMenu addItemWithTitle: NS_("Resume") action: @selector(run_action:) keyEquivalent: @"r"];
1.34 [fileMenu addItem: [NSMenuItem separatorItem]];
1.35 - [fileMenu addItemWithTitle: NSMENU_("_Load State...") action: @selector(load_action:) keyEquivalent: @"o"];
1.36 - [fileMenu addItemWithTitle: NSMENU_("_Save State...") action: @selector(save_action:) keyEquivalent: @"s"];
1.37 + [fileMenu addItemWithTitle: NSMENU_("L_oad State...") action: @selector(load_action:) keyEquivalent: @"o"];
1.38 + [fileMenu addItemWithTitle: NSMENU_("S_ave State...") action: @selector(save_action:) keyEquivalent: @"a"];
1.39 + menuItem = [[NSMenuItem alloc] initWithTitle:NSMENU_("Select _Quick State") action: nil keyEquivalent: @""];
1.40 + [fileMenu addItem: [NSMenuItem separatorItem]];
1.41 + [fileMenu addItemWithTitle: NSMENU_("_Load Quick State") action: @selector(quick_load_action:) keyEquivalent: @"l"];
1.42 + [fileMenu addItemWithTitle: NSMENU_("_Save Quick State") action: @selector(quick_save_action:) keyEquivalent: @"s"];
1.43 + [menuItem setSubmenu: quickStateMenu];
1.44 + [fileMenu addItem: menuItem];
1.45 [fileMenu addItem: [NSMenuItem separatorItem]];
1.46 [fileMenu addItemWithTitle: NSMENU_("_Full Screen...") action: @selector(fullscreen_action:) keyEquivalent: @"\r"];
1.47
1.48 @@ -286,6 +306,20 @@
1.49 {
1.50 [mainWindow setFullscreen: ![mainWindow isFullscreen]];
1.51 }
1.52 +- (void) quick_state_action: (id)sender
1.53 +{
1.54 + [[[sender menu] itemWithTag: dreamcast_get_quick_state()] setState: NSOffState ];
1.55 + [sender setState: NSOnState ];
1.56 + dreamcast_set_quick_state( [sender tag] );
1.57 +}
1.58 +- (void) quick_save_action: (id)sender
1.59 +{
1.60 + dreamcast_quick_save();
1.61 +}
1.62 +- (void) quick_load_action: (id)sender
1.63 +{
1.64 + dreamcast_quick_load();
1.65 +}
1.66 @end
1.67
1.68
.