Search
lxdream.org :: lxdream/src/cocoaui/cocoaui.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/cocoaui/cocoaui.c
changeset 773:146c3210768b
prev770:429ff505c450
next780:4e4ea322cb84
author nkeynes
date Mon Jul 28 04:47:28 2008 +0000 (11 years ago)
permissions -rw-r--r--
last change Fix some consistency issues between the cocoa + gtk menus
file annotate diff log raw
1.1 --- a/src/cocoaui/cocoaui.c Mon Jul 28 03:41:25 2008 +0000
1.2 +++ b/src/cocoaui/cocoaui.c Mon Jul 28 04:47:28 2008 +0000
1.3 @@ -55,6 +55,15 @@
1.4 - (void) setAppleMenu:(NSMenu *)aMenu;
1.5 @end
1.6
1.7 +/**
1.8 + * Produces the menu title by looking the text up in gettext, removing any
1.9 + * underscores, and returning the result as an NSString.
1.10 + */
1.11 +static NSString *NSMENU_( const char *text )
1.12 +{
1.13 + return [[NSString stringWithUTF8String: gettext(text)] stringByReplacingOccurrencesOfString: @"_" withString: @""];
1.14 +}
1.15 +
1.16 static void cocoa_gui_create_menu(void)
1.17 {
1.18 NSMenu *appleMenu, *services;
1.19 @@ -70,12 +79,12 @@
1.20 [appleMenu addItemWithTitle:title action:@selector(about_action:) keyEquivalent:@""];
1.21
1.22 [appleMenu addItem:[NSMenuItem separatorItem]];
1.23 - [appleMenu addItemWithTitle: NS_("Preferences...") action:@selector(preferences_action:) keyEquivalent:@","];
1.24 + [appleMenu addItemWithTitle: NSMENU_("_Preferences...") action:@selector(preferences_action:) keyEquivalent:@","];
1.25
1.26 // Services Menu
1.27 [appleMenu addItem:[NSMenuItem separatorItem]];
1.28 services = [[[NSMenu alloc] init] autorelease];
1.29 - [appleMenu addItemWithTitle:@"Services" action:nil keyEquivalent:@""];
1.30 + [appleMenu addItemWithTitle: NS_("Services") action:nil keyEquivalent:@""];
1.31 [appleMenu setSubmenu: services forItem: [appleMenu itemWithTitle: @"Services"]];
1.32
1.33 // Hide AppName
1.34 @@ -104,20 +113,20 @@
1.35
1.36 NSMenu *gdromMenu = cocoa_gdrom_menu_new();
1.37
1.38 - NSMenu *fileMenu = [[NSMenu alloc] initWithTitle: NS_("File")];
1.39 - [fileMenu addItemWithTitle: NS_("Load Binary") action: @selector(load_binary_action:) keyEquivalent: @"b"];
1.40 - [[fileMenu addItemWithTitle: NS_("GD-Rom") action: nil keyEquivalent: @""]
1.41 + NSMenu *fileMenu = [[NSMenu alloc] initWithTitle: NSMENU_("_File")];
1.42 + [fileMenu addItemWithTitle: NSMENU_("Load _Binary...") action: @selector(load_binary_action:) keyEquivalent: @"b"];
1.43 + [[fileMenu addItemWithTitle: NSMENU_("_GD-Rom") action: nil keyEquivalent: @""]
1.44 setSubmenu: gdromMenu];
1.45 [fileMenu addItem: [NSMenuItem separatorItem]];
1.46 - [[fileMenu addItemWithTitle: NS_("Reset") action: @selector(reset_action:) keyEquivalent: @"r"]
1.47 + [[fileMenu addItemWithTitle: NSMENU_("_Reset") action: @selector(reset_action:) keyEquivalent: @"r"]
1.48 setKeyEquivalentModifierMask:(NSAlternateKeyMask|NSCommandKeyMask)];
1.49 - [fileMenu addItemWithTitle: NS_("Pause") action: @selector(pause_action:) keyEquivalent: @"p"];
1.50 + [fileMenu addItemWithTitle: NSMENU_("_Pause") action: @selector(pause_action:) keyEquivalent: @"p"];
1.51 [fileMenu addItemWithTitle: NS_("Resume") action: @selector(run_action:) keyEquivalent: @"r"];
1.52 [fileMenu addItem: [NSMenuItem separatorItem]];
1.53 - [fileMenu addItemWithTitle: NS_("Load State") action: @selector(load_action:) keyEquivalent: @"o"];
1.54 - [fileMenu addItemWithTitle: NS_("Save State") action: @selector(save_action:) keyEquivalent: @"s"];
1.55 + [fileMenu addItemWithTitle: NSMENU_("_Load State...") action: @selector(load_action:) keyEquivalent: @"o"];
1.56 + [fileMenu addItemWithTitle: NSMENU_("_Save State...") action: @selector(save_action:) keyEquivalent: @"s"];
1.57
1.58 - menuItem = [[NSMenuItem alloc] initWithTitle:NS_("File") action: nil keyEquivalent: @""];
1.59 + menuItem = [[NSMenuItem alloc] initWithTitle:NSMENU_("_File") action: nil keyEquivalent: @""];
1.60 [menuItem setSubmenu: fileMenu];
1.61 [menu addItem: menuItem];
1.62
1.63 @@ -287,7 +296,7 @@
1.64 va_list args;
1.65 va_start(args, msg);
1.66 error_string = [[NSString alloc] initWithFormat: [NSString stringWithCString: msg] arguments: args];
1.67 - NSRunAlertPanel(@"Error in lxdream", error_string, nil, nil, nil);
1.68 + NSRunAlertPanel(NS_("Error in Lxdream"), error_string, nil, nil, nil);
1.69 va_end(args);
1.70 return TRUE;
1.71 } else {
.