diff -r c11abf387a7d -r d5b30d6373fc hedgewars/SDLMain.m --- a/hedgewars/SDLMain.m Sat Jul 31 10:52:43 2010 +0200 +++ b/hedgewars/SDLMain.m Sat Jul 31 11:24:53 2010 +0200 @@ -50,7 +50,7 @@ dict = (const NSDictionary *)CFBundleGetInfoDictionary(CFBundleGetMainBundle()); if (dict) appName = [dict objectForKey: @"CFBundleName"]; - + if (![appName length]) appName = [[NSProcessInfo processInfo] processName]; @@ -131,10 +131,10 @@ NSMenuItem *menuItem; NSString *title; NSString *appName; - + appName = getApplicationName(); appleMenu = [[NSMenu alloc] initWithTitle:@""]; - + /* Add menu items */ title = [@"About " stringByAppendingString:appName]; [appleMenu addItemWithTitle:title action:@selector(orderFrontStandardAboutPanel:) keyEquivalent:@""]; @@ -154,7 +154,7 @@ title = [@"Quit " stringByAppendingString:appName]; [appleMenu addItemWithTitle:title action:@selector(terminate:) keyEquivalent:@"q"]; - + /* Put menu into the menubar */ menuItem = [[NSMenuItem alloc] initWithTitle:@"" action:nil keyEquivalent:@""]; [menuItem setSubmenu:appleMenu]; @@ -176,17 +176,17 @@ NSMenuItem *menuItem; windowMenu = [[NSMenu alloc] initWithTitle:@"Window"]; - + /* "Minimize" item */ menuItem = [[NSMenuItem alloc] initWithTitle:@"Minimize" action:@selector(performMiniaturize:) keyEquivalent:@"m"]; [windowMenu addItem:menuItem]; [menuItem release]; - + /* Put menu into the menubar */ windowMenuItem = [[NSMenuItem alloc] initWithTitle:@"Window" action:nil keyEquivalent:@""]; [windowMenuItem setSubmenu:windowMenu]; [[NSApp mainMenu] addItem:windowMenuItem]; - + /* Tell the application object that this is now the window menu */ [NSApp setWindowsMenu:windowMenu]; @@ -203,7 +203,7 @@ /* Ensure the application object is initialised */ [SDLApplication sharedApplication]; - + #ifdef SDL_USE_CPS { CPSProcessSerNum PSN; @@ -223,10 +223,10 @@ /* Create SDLMain and make it the app delegate */ sdlMain = [[SDLMain alloc] init]; [NSApp setDelegate:sdlMain]; - + /* Start the main event loop */ [NSApp run]; - + [sdlMain release]; [pool release]; } @@ -319,27 +319,27 @@ bufferSize = selfLen + aStringLen - aRange.length; buffer = (unichar *)NSAllocateMemoryPages(bufferSize*sizeof(unichar)); - + /* Get first part into buffer */ localRange.location = 0; localRange.length = aRange.location; [self getCharacters:buffer range:localRange]; - + /* Get middle part into buffer */ localRange.location = 0; localRange.length = aStringLen; [aString getCharacters:(buffer+aRange.location) range:localRange]; - + /* Get last part into buffer */ localRange.location = aRange.location + aRange.length; localRange.length = selfLen - localRange.location; [self getCharacters:(buffer+aRange.location+aStringLen) range:localRange]; - + /* Build output string */ result = [NSString stringWithCharacters:buffer length:bufferSize]; - + NSDeallocateMemoryPages(buffer, bufferSize); - + return result; }