diff --git a/OpenRA.Launcher.Mac/Controller.h b/OpenRA.Launcher.Mac/Controller.h index dad2656956..497140b514 100644 --- a/OpenRA.Launcher.Mac/Controller.h +++ b/OpenRA.Launcher.Mac/Controller.h @@ -7,36 +7,16 @@ */ #import -#import -@class Mod; -@class SidebarEntry; -@class GameInstall; -@class JSBridge; -@class Download; + @interface Controller : NSObject { - SidebarEntry *sidebarItems; - GameInstall *game; - NSDictionary *allMods; - NSMutableArray *httpRequests; - NSMutableDictionary *downloads; BOOL hasMono; NSString *monoPath; - + NSString *gamePath; + IBOutlet NSWindow *window; - IBOutlet NSOutlineView *outlineView; - IBOutlet WebView *webView; } -@property(readonly) NSDictionary *allMods; -@property(readonly) WebView *webView; - (void)launchMod:(NSString *)mod; -- (void)populateModInfo; -- (SidebarEntry *)sidebarModsTree; -- (SidebarEntry *)sidebarOtherTree; - -- (void)fetchURL:(NSString *)url withCallback:(NSString *)cb; -- (BOOL)registerDownload:(NSString *)key withURL:(NSString *)url filePath:(NSString *)path; -- (Download *)downloadWithKey:(NSString *)key; - (BOOL)initMono; @end diff --git a/OpenRA.Launcher.Mac/Controller.m b/OpenRA.Launcher.Mac/Controller.m index 04aa5455a9..0f24311b16 100644 --- a/OpenRA.Launcher.Mac/Controller.m +++ b/OpenRA.Launcher.Mac/Controller.m @@ -7,17 +7,8 @@ */ #import "Controller.h" -#import "Mod.h" -#import "SidebarEntry.h" -#import "GameInstall.h" -#import "ImageAndTextCell.h" -#import "JSBridge.h" -#import "Download.h" -#import "HttpRequest.h" @implementation Controller -@synthesize allMods; -@synthesize webView; + (void)initialize { @@ -28,43 +19,11 @@ - (void)awakeFromNib { - NSString *gamePath = [[NSUserDefaults standardUserDefaults] stringForKey:@"gamepath"]; + gamePath = [[NSUserDefaults standardUserDefaults] stringForKey:@"gamepath"]; hasMono = [self initMono]; NSLog(@"%d, %@",hasMono, monoPath); - if (hasMono) - { - game = [[GameInstall alloc] initWithGamePath:gamePath monoPath:monoPath]; - [[JSBridge sharedInstance] setController:self]; - downloads = [[NSMutableDictionary alloc] init]; - httpRequests = [[NSMutableArray alloc] init]; - - NSTableColumn *col = [outlineView tableColumnWithIdentifier:@"mods"]; - ImageAndTextCell *imageAndTextCell = [[[ImageAndTextCell alloc] init] autorelease]; - [col setDataCell:imageAndTextCell]; - - sidebarItems = [[SidebarEntry headerWithTitle:@""] retain]; - [self populateModInfo]; - id modsRoot = [self sidebarModsTree]; - [sidebarItems addChild:modsRoot]; - //id otherRoot = [self sidebarOtherTree]; - //[sidebarItems addChild:otherRoot]; - - - [outlineView reloadData]; - [outlineView expandItem:modsRoot expandChildren:YES]; - - if ([[modsRoot children] count] > 0) - { - id firstMod = [[modsRoot children] objectAtIndex:0]; - int row = [outlineView rowForItem:firstMod]; - [outlineView selectRowIndexes:[NSIndexSet indexSetWithIndex:row] byExtendingSelection:NO]; - [[webView mainFrame] loadRequest:[NSURLRequest requestWithURL: [firstMod url]]]; - } - - //[outlineView expandItem:otherRoot expandChildren:YES]; - } } - (void)applicationDidFinishLaunching:(NSNotification *)aNotification @@ -77,18 +36,17 @@ otherButton:nil informativeTextWithFormat:@"OpenRA requires the Mono Framework version 2.6.7 or later."]; - [alert beginSheetModalForWindow:window modalDelegate:self didEndSelector:@selector(monoAlertEnded:code:context:) contextInfo:NULL]; + + if ([alert runModal] == NSAlertDefaultReturn) + [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"http://www.go-mono.com/mono-downloads/download.html"]]; + + [[NSApplication sharedApplication] terminate:self]; + } + else + { + [self launchMod:@"cnc"]; + [NSApp terminate: nil]; } -} - -- (void)monoAlertEnded:(NSAlert *)alert - code:(int)button - context:(void *)v -{ - if (button == NSAlertDefaultReturn) - [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"http://www.go-mono.com/mono-downloads/download.html"]]; - - [[NSApplication sharedApplication] terminate:self]; } - (BOOL)initMono @@ -143,203 +101,49 @@ - (void)dealloc { - [sidebarItems release]; sidebarItems = nil; - [downloads release]; downloads = nil; - [httpRequests release]; httpRequests = nil; [monoPath release]; monoPath = nil; + [gamePath release]; gamePath = nil; [super dealloc]; } -- (void)populateModInfo -{ - // Get info for all installed mods - [allMods autorelease]; - allMods = [[game infoForMods:[game installedMods]] retain]; -} -- (SidebarEntry *)sidebarModsTree +-(void)launchMod:(NSString *)mod { - SidebarEntry *rootItem = [SidebarEntry headerWithTitle:@"MODS"]; - for (id key in allMods) - { - id aMod = [allMods objectForKey:key]; - if ([aMod standalone]) - { - id path = [[game gamePath] stringByAppendingPathComponent:@"mods"]; - id child = [SidebarEntry entryWithMod:aMod allMods:allMods basePath:path]; - [rootItem addChild:child]; - } - } + // Use LaunchServices because neither NSTask or NSWorkspace support Info.plist _and_ arguments pre-10.6 - return rootItem; -} - -- (SidebarEntry *)sidebarOtherTree -{ - SidebarEntry *rootItem = [SidebarEntry headerWithTitle:@"OTHER"]; - [rootItem addChild:[SidebarEntry entryWithTitle:@"Support" url:nil icon:nil]]; - [rootItem addChild:[SidebarEntry entryWithTitle:@"Credits" url:nil icon:nil]]; + // First argument is the directory to run in + // Second...Nth arguments are passed to OpenRA.Game.exe + // Launcher wrapper sets mono --debug, gl renderer and support dir. + NSArray *args = [NSArray arrayWithObjects:@"--launch", gamePath, monoPath, + [NSString stringWithFormat:@"SupportDir=%@",[@"~/Library/Application Support/OpenRA" stringByExpandingTildeInPath]], + [NSString stringWithFormat:@"Game.Mods=%@",mod], + nil]; - return rootItem; -} - -- (void)launchMod:(NSString *)mod -{ - [game launchMod:mod]; -} - -- (BOOL)registerDownload:(NSString *)key withURL:(NSString *)url filePath:(NSString *)path; -{ - if ([downloads objectForKey:key] != nil) - return NO; + FSRef appRef; + CFURLGetFSRef((CFURLRef)[NSURL URLWithString:[[[NSBundle mainBundle] executablePath] stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding]], &appRef); - [downloads setObject:[Download downloadWithURL:url filename:path key:key game:game] - forKey:key]; - return YES; -} - -- (Download *)downloadWithKey:(NSString *)key -{ - return [downloads objectForKey:key]; -} - -- (void)fetchURL:(NSString *)url withCallback:(NSString *)cb -{ - // Clean up any completed requests - for (int i = [httpRequests count] - 1; i >= 0; i--) - if ([[httpRequests objectAtIndex:i] terminated]) - [httpRequests removeObjectAtIndex:i]; + // Set the launch parameters + LSApplicationParameters params; + params.version = 0; + params.flags = kLSLaunchDefaults | kLSLaunchNewInstance; + params.application = &appRef; + params.asyncLaunchRefCon = NULL; + params.environment = NULL; // CFDictionaryRef of environment variables; could be useful + params.argv = (CFArrayRef)args; + params.initialEvent = NULL; - // Create request - [httpRequests addObject:[HttpRequest requestWithURL:url callback:cb game:game]]; -} - -#pragma mark Sidebar Datasource and Delegate -- (NSInteger)outlineView:(NSOutlineView *)anOutlineView numberOfChildrenOfItem:(id)item -{ - // Can be called before awakeFromNib; return nothing - if (sidebarItems == nil) - return 0; + ProcessSerialNumber psn; + OSStatus err = LSOpenApplication(¶ms, &psn); - // Root item - if (item == nil) - return [[sidebarItems children] count]; - - return [[item children] count]; + // Bring the game window to the front + if (err == noErr) + SetFrontProcess(&psn); } -- (BOOL)outlineView:(NSOutlineView *)outlineView isItemExpandable:(id)item -{ - return (item == nil) ? YES : [[item children] count] != 0; -} - -- (id)outlineView:(NSOutlineView *)outlineView - child:(NSInteger)index - ofItem:(id)item -{ - if (item == nil) - return [[sidebarItems children] objectAtIndex:index]; - - return [[item children] objectAtIndex:index]; -} - --(BOOL)outlineView:(NSOutlineView*)outlineView isGroupItem:(id)item -{ - if (item == nil) - return NO; - - return [item isHeader]; -} - -- (id)outlineView:(NSOutlineView *)outlineView -objectValueForTableColumn:(NSTableColumn *)tableColumn - byItem:(id)item -{ - return [item title]; -} - -- (BOOL)outlineView:(NSOutlineView *)outlineView shouldSelectItem:(id)item; -{ - // don't allow headers to be selected - if ([item isHeader] || [item url] == nil) - return NO; - - [[webView mainFrame] loadRequest:[NSURLRequest requestWithURL:[item url]]]; - - return YES; -} - -- (void)outlineView:(NSOutlineView *)olv willDisplayCell:(NSCell*)cell forTableColumn:(NSTableColumn *)tableColumn item:(id)item -{ - if ([[tableColumn identifier] isEqualToString:@"mods"]) - { - if ([cell isKindOfClass:[ImageAndTextCell class]]) - { - [(ImageAndTextCell*)cell setImage:[item icon]]; - } - } -} - -#pragma mark WebView delegates -- (void)webView:(WebView *)sender didClearWindowObject:(WebScriptObject *)windowObject forFrame:(WebFrame *)frame -{ - // Cancel any in progress http requests - for (HttpRequest *r in httpRequests) - [r cancel]; - - [windowObject setValue:[JSBridge sharedInstance] forKey:@"external"]; -} - -- (void)webView:(WebView *)webView addMessageToConsole:(NSDictionary *)dictionary -{ - NSLog(@"%@",dictionary); -} - - #pragma mark Application delegates - (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)sender { return YES; } -- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender -{ - int count = 0; - for (NSString *key in downloads) - if ([[(Download *)[downloads objectForKey:key] status] isEqualToString:@"DOWNLOADING"]) - count++; - - if (count == 0) - return NSTerminateNow; - - NSString *format = count == 1 ? @"1 download is" : [NSString stringWithFormat:@"%d downloads are",count]; - NSAlert *alert = [NSAlert alertWithMessageText:@"Are you sure you want to quit?" - defaultButton:@"Wait" - alternateButton:@"Quit" - otherButton:nil - informativeTextWithFormat:@"%@ in progress and will be cancelled if you quit.", format]; - - [alert beginSheetModalForWindow:window modalDelegate:self didEndSelector:@selector(quitAlertEnded:code:context:) contextInfo:NULL]; - return NSTerminateLater; -} - -- (void)quitAlertEnded:(NSAlert *)alert - code:(int)button - context:(void *)v -{ - NSApplicationTerminateReply reply = (button == NSAlertDefaultReturn) ? NSTerminateCancel : NSTerminateNow; - [[NSApplication sharedApplication] replyToApplicationShouldTerminate:reply]; -} - -- (void)applicationWillTerminate:(NSNotification *)aNotification -{ - // Cancel all in-progress downloads - for (NSString *key in downloads) - { - Download *d = [downloads objectForKey:key]; - if ([[d status] isEqualToString:@"DOWNLOADING"]) - [d cancel]; - } -} - @end diff --git a/OpenRA.Launcher.Mac/Download.h b/OpenRA.Launcher.Mac/Download.h deleted file mode 100644 index 8ebda59225..0000000000 --- a/OpenRA.Launcher.Mac/Download.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2007-2010 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made - * available to you under the terms of the GNU General Public License - * as published by the Free Software Foundation. For more information, - * see LICENSE. - */ - -#import - -@class GameInstall; -@interface Download : NSObject -{ - NSString *key; - NSString *url; - NSString *filename; - GameInstall *game; - NSTask *task; - NSString *status; - NSString *error; - int bytesCompleted; - int bytesTotal; -} - -@property(readonly) NSString *key; -@property(readonly) NSString *status; -@property(readonly) int bytesCompleted; -@property(readonly) int bytesTotal; -@property(readonly) NSString *error; - -+ (id)downloadWithURL:(NSString *)aURL filename:(NSString *)aFilename key:(NSString *)aKey game:(GameInstall *)aGame; -- (id)initWithURL:(NSString *)aURL filename:(NSString *)aFilename key:(NSString *)aKey game:(GameInstall *)game; -- (BOOL)start; -- (BOOL)cancel; -- (BOOL)extractToPath:(NSString *)aPath; -@end \ No newline at end of file diff --git a/OpenRA.Launcher.Mac/Download.m b/OpenRA.Launcher.Mac/Download.m deleted file mode 100644 index 0c90fe3e8c..0000000000 --- a/OpenRA.Launcher.Mac/Download.m +++ /dev/null @@ -1,196 +0,0 @@ -/* - * Copyright 2007-2010 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made - * available to you under the terms of the GNU General Public License - * as published by the Free Software Foundation. For more information, - * see LICENSE. - */ - -#import "Download.h" -#import "GameInstall.h" -#import "JSBridge.h" - -@implementation Download -@synthesize key; -@synthesize status; -@synthesize bytesCompleted; -@synthesize bytesTotal; -@synthesize error; - -+ (id)downloadWithURL:(NSString *)aURL filename:(NSString *)aFilename key:(NSString *)aKey game:(GameInstall *)aGame -{ - id newObject = [[self alloc] initWithURL:aURL filename:aFilename key:aKey game:aGame]; - [newObject autorelease]; - return newObject; -} - -- (id)initWithURL:(NSString *)aURL filename:(NSString *)aFilename key:(NSString *)aKey game:(GameInstall *)aGame; -{ - self = [super init]; - if (self != nil) - { - url = [aURL retain]; - filename = [aFilename retain]; - key = [aKey retain]; - game = [aGame retain]; - error = @""; - - if ([[NSFileManager defaultManager] fileExistsAtPath:filename]) - { - status = @"DOWNLOADED"; - bytesCompleted = bytesTotal = [[[NSFileManager defaultManager] attributesOfItemAtPath:filename error:NULL] fileSize]; - } - else - { - status = @"AVAILABLE"; - bytesCompleted = bytesTotal = -1; - } - } - return self; -} - - -- (BOOL)start -{ - status = @"DOWNLOADING"; - task = [game runAsyncUtilityWithArg:[NSString stringWithFormat:@"--download-url=%@,%@",url,filename] - delegate:self - responseSelector:@selector(downloadResponded:) - terminatedSelector:@selector(utilityTerminated:)]; - [task retain]; - return YES; -} - -- (BOOL)cancel -{ - status = @"ERROR"; - error = @"Download Cancelled"; - - [[NSFileManager defaultManager] removeItemAtPath:filename error:NULL]; - bytesCompleted = bytesTotal = -1; - - [[JSBridge sharedInstance] runCallback:@"downloadProgressed" withArgument:[self key]]; - [[NSNotificationCenter defaultCenter] removeObserver:self - name:NSFileHandleReadCompletionNotification - object:[[task standardOutput] fileHandleForReading]]; - [task terminate]; - return YES; -} - -- (void)downloadResponded:(NSNotification *)n -{ - NSData *data = [[n userInfo] valueForKey:NSFileHandleNotificationDataItem]; - NSString *response = [[[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding] autorelease]; - - // Response can contain multiple lines, or no lines. Split into lines, and parse each in turn - NSArray *lines = [response componentsSeparatedByString:@"\n"]; - for (NSString *line in lines) - { - NSRange separator = [line rangeOfString:@":"]; - if (separator.location == NSNotFound) - continue; // We only care about messages of the form key: value - - NSString *type = [line substringToIndex:separator.location]; - NSString *message = [[line substringFromIndex:separator.location+1] - stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; - - if ([type isEqualToString:@"Error"]) - { - status = @"ERROR"; - [error autorelease]; - if ([[message substringToIndex:36] isEqualToString:@"The remote server returned an error:"]) - error = [[message substringFromIndex:37] retain]; - else - error = [message retain]; - } - - else if ([type isEqualToString:@"Status"]) - { - if ([message isEqualToString:@"Completed"]) - { - status = @"DOWNLOADED"; - } - - // Parse download status info - int done,total; - if (sscanf([message UTF8String], "%*d%% %d/%d bytes", &done, &total) == 2) - { - bytesCompleted = done; - bytesTotal = total; - } - } - } - [[JSBridge sharedInstance] runCallback:@"downloadProgressed" withArgument:[self key]]; - - // Keep reading - if ([n object] != nil) - [[n object] readInBackgroundAndNotify]; -} - -- (BOOL)extractToPath:(NSString *)aPath -{ - status = @"EXTRACTING"; - task = [game runAsyncUtilityWithArg:[NSString stringWithFormat:@"--extract-zip=%@,%@",filename,aPath] - delegate:self - responseSelector:@selector(extractResponded:) - terminatedSelector:@selector(utilityTerminated:)]; - [task retain]; - return YES; -} - -- (void)extractResponded:(NSNotification *)n -{ - NSData *data = [[n userInfo] valueForKey:NSFileHandleNotificationDataItem]; - NSString *response = [[[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding] autorelease]; - - // Response can contain multiple lines, or no lines. Split into lines, and parse each in turn - NSArray *lines = [response componentsSeparatedByString:@"\n"]; - for (NSString *line in lines) - { - NSLog(@"%@",line); - NSRange separator = [line rangeOfString:@":"]; - if (separator.location == NSNotFound) - continue; // We only care about messages of the form key: value - - NSString *type = [line substringToIndex:separator.location]; - NSString *message = [[line substringFromIndex:separator.location+1] - stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; - - if ([type isEqualToString:@"Error"]) - { - status = @"ERROR"; - [error autorelease]; - error = [message retain]; - } - - else if ([type isEqualToString:@"Status"]) - { - if ([message isEqualToString:@"Completed"]) - { - status = @"EXTRACTED"; - } - } - } - [[JSBridge sharedInstance] runCallback:@"extractProgressed" withArgument:[self key]]; - - // Keep reading - if ([n object] != nil) - [[n object] readInBackgroundAndNotify]; -} - -- (void)utilityTerminated:(NSNotification *)n -{ - NSLog(@"download terminated"); - NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; - [nc removeObserver:self name:NSFileHandleReadCompletionNotification object:[[task standardOutput] fileHandleForReading]]; - [nc removeObserver:self name:NSTaskDidTerminateNotification object:task]; - [task release]; task = nil; - - if (status == @"ERROR") - { - [[NSFileManager defaultManager] removeItemAtPath:filename error:NULL]; - bytesCompleted = bytesTotal = -1; - } -} - -@end diff --git a/OpenRA.Launcher.Mac/English.lproj/MainMenu.xib b/OpenRA.Launcher.Mac/English.lproj/MainMenu.xib index 5826fb609a..dd81d1a4d6 100644 --- a/OpenRA.Launcher.Mac/English.lproj/MainMenu.xib +++ b/OpenRA.Launcher.Mac/English.lproj/MainMenu.xib @@ -1,32 +1,21 @@ - 1060 - 10H574 - 804 + 1050 + 10J567 + 823 1038.35 - 461.00 + 462.00 - YES - - YES - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.WebKitIBPlugin - - - YES - 804 - 804 - + com.apple.InterfaceBuilder.CocoaPlugin + 823 YES - - + YES - com.apple.WebKitIBPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -268,264 +257,6 @@ _NSMainMenu - - 15 - 2 - {{335, 281}, {659, 469}} - 1954021376 - OpenRA Launcher - NSWindow - - {3.40282e+38, 3.40282e+38} - - - 256 - - YES - - - 274 - - YES - - - 256 - - YES - - - 274 - - YES - - - 2304 - - YES - - - 256 - {188, 468} - - YES - - - -2147483392 - {{224, 0}, {16, 17}} - - - YES - - mods - 185 - 16 - 1000 - - 75628096 - 2048 - - - LucidaGrande - 11 - 3100 - - - 3 - MC4zMzMzMzI5ODU2AA - - - 6 - System - headerTextColor - - 3 - MAA - - - - - 337772096 - 2048 - Text Cell - - LucidaGrande - 13 - 1044 - - - - 6 - System - controlBackgroundColor - - 3 - MC42NjY2NjY2ODY1AA - - - - 6 - System - controlTextColor - - - - 3 - YES - YES - - - - 3 - 0.0 - - 6 - System - _sourceListBackgroundColor - - 1 - MC44MzkyMTU2OTU5IDAuODY2NjY2Njc0NiAwLjg5ODAzOTIyMTgAA - - - - 6 - System - gridColor - - 3 - MC41AA - - - 20 - -767557632 - - - 4 - 15 - 0 - YES - 1 - 1 - 14 - - - {{1, 1}, {188, 468}} - - - - - 4 - - - - -2147483392 - {{224, 17}, {15, 102}} - - - _doScroller: - 0.99786323308944702 - - - - -2147483392 - {{1, 453}, {141, 15}} - - 1 - - _doScroller: - 0.99295777082443237 - - - {190, 470} - - - 562 - - - - QSAAAEEgAABBoAAAQaAAAA - - - {189, 469} - - 2 - NSView - - - - 256 - - YES - - - 274 - - YES - - YES - Apple HTML pasteboard type - Apple PDF pasteboard type - Apple PICT pasteboard type - Apple URL pasteboard type - Apple Web Archive pasteboard type - NSColor pasteboard type - NSFilenamesPboardType - NSStringPboardType - NeXT RTFD pasteboard type - NeXT Rich Text Format v1.0 pasteboard type - NeXT TIFF v4.0 pasteboard type - WebURLsWithTitlesPboardType - public.png - public.url - public.url-name - - - {469, 469} - - - - - - - - YES - - YES - WebKitDefaultFixedFontSize - WebKitDefaultFontSize - WebKitMinimumFontSize - - - YES - - - - - - - YES - YES - - - {{190, 0}, {469, 469}} - - 2 - NSView - - - {659, 469} - - 2 - YES - 2 - - - {659, 469} - - 2 - - {{0, 0}, {1920, 1178}} - {3.40282e+38, 3.40282e+38} - Controller @@ -605,46 +336,6 @@ 493 - - - dataSource - - - - 582 - - - - delegate - - - - 583 - - - - outlineView - - - - 585 - - - - webView - - - - 590 - - - - frameLoadDelegate - - - - 591 - delegate @@ -653,14 +344,6 @@ 592 - - - window - - - - 593 - @@ -835,24 +518,6 @@ - - 371 - - - YES - - - - - - 372 - - - YES - - - - 490 @@ -876,88 +541,11 @@ - - 555 - - - YES - - - - - - - 557 - - - YES - - - - - - 556 - - - YES - - - - - - 568 - - - YES - - - - - - - - 569 - - - - - 570 - - - - - 571 - - - YES - - - - - - 573 - - - YES - - - - - - 576 - - - 579 - - 589 - - - @@ -1004,40 +592,21 @@ 29.ImportedFromIB2 29.WindowOrigin 29.editorWindowContentRectSynchronizationRect - 371.IBEditorWindowLastContentRect - 371.IBPluginDependency - 371.IBWindowTemplateEditedContentRect - 371.NSWindowTemplate.visibleAtLaunch - 371.editorWindowContentRectSynchronizationRect - 371.windowTemplate.maxSize - 372.IBPluginDependency 490.IBPluginDependency 491.IBEditorWindowLastContentRect 491.IBPluginDependency 492.IBPluginDependency 5.IBPluginDependency 5.ImportedFromIB2 - 555.IBPluginDependency - 556.IBPluginDependency - 557.IBPluginDependency 56.IBPluginDependency 56.ImportedFromIB2 - 568.IBPluginDependency - 568.IBViewBoundsToFrameTransform - 569.IBPluginDependency 57.IBEditorWindowLastContentRect 57.IBPluginDependency 57.ImportedFromIB2 57.editorWindowContentRectSynchronizationRect - 570.IBPluginDependency - 571.IBPluginDependency - 573.IBPluginDependency - 576.IBPluginDependency 579.IBPluginDependency 58.IBPluginDependency 58.ImportedFromIB2 - 589.IBPluginDependency - 589.IBViewBoundsToFrameTransform 92.IBPluginDependency 92.ImportedFromIB2 @@ -1083,13 +652,6 @@ {74, 862} {{6, 978}, {478, 20}} - {{378, 537}, {659, 469}} - com.apple.InterfaceBuilder.CocoaPlugin - {{378, 537}, {659, 469}} - - {{33, 99}, {480, 360}} - {3.40282e+38, 3.40282e+38} - com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin {{540, 813}, {161, 23}} com.apple.InterfaceBuilder.CocoaPlugin @@ -1097,28 +659,14 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - P4AAAL+AAADBoAAAwy4AAA - - com.apple.InterfaceBuilder.CocoaPlugin {{392, 653}, {190, 183}} com.apple.InterfaceBuilder.CocoaPlugin {{23, 794}, {245, 183}} com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.WebKitIBPlugin - com.apple.InterfaceBuilder.CocoaPlugin @@ -1148,42 +696,14 @@ Controller NSObject - YES - - YES - outlineView - webView - window - - - YES - NSOutlineView - WebView - NSWindow - + window + NSWindow - YES - - YES - outlineView - webView - window - - - YES - - outlineView - NSOutlineView - - - webView - WebView - - - window - NSWindow - + window + + window + NSWindow @@ -1194,14 +714,6 @@ YES - - NSActionCell - NSCell - - IBFrameworkSource - AppKit.framework/Headers/NSActionCell.h - - NSApplication NSResponder @@ -1245,30 +757,6 @@ AppKit.framework/Headers/NSUserInterfaceItemSearching.h - - NSCell - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSCell.h - - - - NSControl - NSView - - IBFrameworkSource - AppKit.framework/Headers/NSControl.h - - - - NSFormatter - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSFormatter.h - - NSMenu NSObject @@ -1306,7 +794,10 @@ NSObject - + + IBFrameworkSource + AppKit.framework/Headers/NSControl.h + NSObject @@ -1356,7 +847,7 @@ NSObject - + IBFrameworkSource AppKit.framework/Headers/NSOutlineView.h @@ -1377,7 +868,7 @@ NSObject - + IBFrameworkSource AppKit.framework/Headers/NSTableView.h @@ -1599,11 +1090,6 @@ WebKit.framework/Headers/WebUIDelegate.h - - NSOutlineView - NSTableView - - NSResponder @@ -1619,51 +1105,6 @@ AppKit.framework/Headers/NSResponder.h - - NSScrollView - NSView - - IBFrameworkSource - AppKit.framework/Headers/NSScrollView.h - - - - NSScroller - NSControl - - IBFrameworkSource - AppKit.framework/Headers/NSScroller.h - - - - NSSplitView - NSView - - IBFrameworkSource - AppKit.framework/Headers/NSSplitView.h - - - - NSTableColumn - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSTableColumn.h - - - - NSTableView - NSControl - - - - NSTextFieldCell - NSActionCell - - IBFrameworkSource - AppKit.framework/Headers/NSTextFieldCell.h - - NSView @@ -1709,116 +1150,13 @@ AppKit.framework/Headers/NSWindowScripting.h - - WebView - NSView - - YES - - YES - goBack: - goForward: - makeTextLarger: - makeTextSmaller: - makeTextStandardSize: - reload: - reloadFromOrigin: - stopLoading: - takeStringURLFrom: - toggleContinuousSpellChecking: - toggleSmartInsertDelete: - - - YES - id - id - id - id - id - id - id - id - id - id - id - - - - YES - - YES - goBack: - goForward: - makeTextLarger: - makeTextSmaller: - makeTextStandardSize: - reload: - reloadFromOrigin: - stopLoading: - takeStringURLFrom: - toggleContinuousSpellChecking: - toggleSmartInsertDelete: - - - YES - - goBack: - id - - - goForward: - id - - - makeTextLarger: - id - - - makeTextSmaller: - id - - - makeTextStandardSize: - id - - - reload: - id - - - reloadFromOrigin: - id - - - stopLoading: - id - - - takeStringURLFrom: - id - - - toggleContinuousSpellChecking: - id - - - toggleSmartInsertDelete: - id - - - - - IBFrameworkSource - WebKit.framework/Headers/WebView.h - - 0 IBCocoaFramework com.apple.InterfaceBuilder.CocoaPlugin.macosx - + com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3 diff --git a/OpenRA.Launcher.Mac/GameInstall.h b/OpenRA.Launcher.Mac/GameInstall.h deleted file mode 100644 index 94b922f5d3..0000000000 --- a/OpenRA.Launcher.Mac/GameInstall.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 2007-2010 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made - * available to you under the terms of the GNU General Public License - * as published by the Free Software Foundation. For more information, - * see LICENSE. - */ - -#import - -@class Mod; -@class Controller; -@interface GameInstall : NSObject { - NSString *gamePath; - NSString *monoPath; - NSMutableDictionary *downloadTasks; -} -@property(readonly) NSString *gamePath; - --(id)initWithGamePath:(NSString *)gamepath monoPath:(NSString *)monopath; --(void)launchMod:(NSString *)mod; -- (NSString *)runUtilityQuery:(NSString *)arg; -- (NSArray *)installedMods; -- (NSDictionary *)infoForMods:(NSArray *)mods; -- (NSTask *)runAsyncUtilityWithArg:(NSString *)arg - delegate:(id)object - responseSelector:(SEL)response - terminatedSelector:(SEL)terminated; -@end diff --git a/OpenRA.Launcher.Mac/GameInstall.m b/OpenRA.Launcher.Mac/GameInstall.m deleted file mode 100644 index 943fa34e5c..0000000000 --- a/OpenRA.Launcher.Mac/GameInstall.m +++ /dev/null @@ -1,180 +0,0 @@ -/* - * Copyright 2007-2010 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made - * available to you under the terms of the GNU General Public License - * as published by the Free Software Foundation. For more information, - * see LICENSE. - */ - -#import "GameInstall.h" -#import "Controller.h" -#import "Mod.h" - -@implementation GameInstall -@synthesize gamePath; - --(id)initWithGamePath:(NSString *)gamepath monoPath:(NSString *)monopath -{ - self = [super init]; - if (self != nil) - { - gamePath = [gamepath retain]; - monoPath = [monopath retain]; - downloadTasks = [[NSMutableDictionary alloc] init]; - } - return self; -} - -- (void)dealloc -{ - [gamePath release]; gamePath = nil; - [monoPath release]; monoPath = nil; - [downloadTasks release]; downloadTasks = nil; - [super dealloc]; -} - -- (NSArray *)installedMods -{ - id raw = [self runUtilityQuery:@"-l"]; - id mods = [raw stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; - return [mods componentsSeparatedByString:@"\n"]; -} - -- (NSDictionary *)infoForMods:(NSArray *)mods -{ - id query = [NSString stringWithFormat:@"-i=%@",[mods componentsJoinedByString:@","]]; - NSArray *lines = [[self runUtilityQuery:query] componentsSeparatedByString:@"\n"]; - - NSMutableDictionary *ret = [NSMutableDictionary dictionary]; - NSMutableDictionary *fields = nil; - NSString *current = nil; - for (id l in lines) - { - NSString *line = [l stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; - if (line == nil || [line length] == 0) - continue; - - id kv = [line componentsSeparatedByString:@":"]; - if ([kv count] < 2) - continue; - - id key = [[kv objectAtIndex:0] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; - id value = [[kv objectAtIndex:1] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; - - if ([key isEqualToString:@"Error"]) - { - NSLog(@"Error: %@",value); - continue; - } - - if ([key isEqualToString:@"Mod"]) - { - // Commit prev mod - if (current != nil) - { - id path = [gamePath stringByAppendingPathComponent:[NSString stringWithFormat:@"mods/%@",current]]; - [ret setObject:[Mod modWithId:current fields:fields path:path] forKey:current]; - } - NSLog(@"Parsing mod `%@`",value); - current = value; - fields = [NSMutableDictionary dictionary]; - } - - if (fields != nil) - [fields setObject:[value stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] - forKey:key]; - } - if (current != nil) - { - id path = [gamePath stringByAppendingPathComponent:[NSString stringWithFormat:@"mods/%@",current]]; - [ret setObject:[Mod modWithId:current fields:fields path:path] forKey:current]; - } - - return ret; -} - --(void)launchMod:(NSString *)mod -{ - // Use LaunchServices because neither NSTask or NSWorkspace support Info.plist _and_ arguments pre-10.6 - - // First argument is the directory to run in - // Second...Nth arguments are passed to OpenRA.Game.exe - // Launcher wrapper sets mono --debug, gl renderer and support dir. - NSArray *args = [NSArray arrayWithObjects:@"--launch", gamePath, monoPath, - [NSString stringWithFormat:@"SupportDir=%@",[@"~/Library/Application Support/OpenRA" stringByExpandingTildeInPath]], - [NSString stringWithFormat:@"Game.Mods=%@",mod], - nil]; - - FSRef appRef; - CFURLGetFSRef((CFURLRef)[NSURL URLWithString:[[[NSBundle mainBundle] executablePath] stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding]], &appRef); - - // Set the launch parameters - LSApplicationParameters params; - params.version = 0; - params.flags = kLSLaunchDefaults | kLSLaunchNewInstance; - params.application = &appRef; - params.asyncLaunchRefCon = NULL; - params.environment = NULL; // CFDictionaryRef of environment variables; could be useful - params.argv = (CFArrayRef)args; - params.initialEvent = NULL; - - ProcessSerialNumber psn; - OSStatus err = LSOpenApplication(¶ms, &psn); - - // Bring the game window to the front - if (err == noErr) - SetFrontProcess(&psn); -} - -- (NSString *)runUtilityQuery:(NSString *)arg -{ - NSPipe *outPipe = [NSPipe pipe]; - NSMutableArray *taskArgs = [NSMutableArray arrayWithObject:@"OpenRA.Utility.exe"]; - [taskArgs addObject:arg]; - - NSTask *task = [[NSTask alloc] init]; - [task setCurrentDirectoryPath:gamePath]; - [task setLaunchPath:monoPath]; - [task setArguments:taskArgs]; - [task setStandardOutput:outPipe]; - [task setStandardError:[task standardOutput]]; - [task launch]; - NSData *data = [[outPipe fileHandleForReading] readDataToEndOfFile]; - [task waitUntilExit]; - [task release]; - - return [[[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding] autorelease]; -} - -- (NSTask *)runAsyncUtilityWithArg:(NSString *)arg - delegate:(id)object - responseSelector:(SEL)response - terminatedSelector:(SEL)terminated -{ - NSTask *task = [[[NSTask alloc] init] autorelease]; - NSPipe *pipe = [NSPipe pipe]; - - NSMutableArray *taskArgs = [NSMutableArray arrayWithObject:@"OpenRA.Utility.exe"]; - [taskArgs addObject:arg]; - - [task setCurrentDirectoryPath:gamePath]; - [task setLaunchPath:monoPath]; - [task setArguments:taskArgs]; - [task setStandardOutput:pipe]; - - NSFileHandle *readHandle = [pipe fileHandleForReading]; - NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; - [nc addObserver:object - selector:response - name:NSFileHandleReadCompletionNotification - object:readHandle]; - [nc addObserver:object - selector:terminated - name:NSTaskDidTerminateNotification - object:task]; - [task launch]; - [readHandle readInBackgroundAndNotify]; - return task; -} - -@end diff --git a/OpenRA.Launcher.Mac/HttpRequest.h b/OpenRA.Launcher.Mac/HttpRequest.h deleted file mode 100644 index a1ad188591..0000000000 --- a/OpenRA.Launcher.Mac/HttpRequest.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 2007-2010 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made - * available to you under the terms of the GNU General Public License - * as published by the Free Software Foundation. For more information, - * see LICENSE. - */ - -#import - -@class WebScriptObject; -@class GameInstall; -@interface HttpRequest : NSObject -{ - NSString *url; - NSString *callback; - GameInstall *game; - NSTask *task; - NSMutableData *response; - BOOL cancelled; -} -@property(readonly) NSString *url; - -+ (id)requestWithURL:(NSString *)aURL callback:(NSString *)aCallback game:(GameInstall *)aGame; -- (id)initWithURL:(NSString *)aURL callback:(NSString *)aCallback game:(GameInstall *)aGame; -- (void)cancel; -- (BOOL)terminated; - -@end diff --git a/OpenRA.Launcher.Mac/HttpRequest.m b/OpenRA.Launcher.Mac/HttpRequest.m deleted file mode 100644 index 27647f1893..0000000000 --- a/OpenRA.Launcher.Mac/HttpRequest.m +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright 2007-2010 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made - * available to you under the terms of the GNU General Public License - * as published by the Free Software Foundation. For more information, - * see LICENSE. - */ - -#import "HttpRequest.h" -#import "JSBridge.h" -#import "GameInstall.h" - -@implementation HttpRequest -@synthesize url; - -+ (id)requestWithURL:(NSString *)aURL callback:(NSString *)aCallback game:(GameInstall *)aGame -{ - id newObject = [[self alloc] initWithURL:aURL callback:aCallback game:aGame]; - [newObject autorelease]; - return newObject; -} - -- (id)initWithURL:(NSString *)aURL callback:(NSString *)aCallback game:(GameInstall *)aGame; -{ - self = [super init]; - if (self != nil) - { - url = [aURL retain]; - callback = [aCallback retain]; - game = [aGame retain]; - response = [[NSMutableData alloc] init]; - - task = [game runAsyncUtilityWithArg:[NSString stringWithFormat:@"--download-url=%@",url] - delegate:self - responseSelector:@selector(utilityResponded:) - terminatedSelector:@selector(utilityTerminated:)]; - [task retain]; - } - return self; -} - -- (void)cancel -{ - cancelled = YES; - [[NSNotificationCenter defaultCenter] removeObserver:self - name:NSFileHandleReadCompletionNotification - object:[[task standardOutput] fileHandleForReading]]; - [task terminate]; -} - -- (void)utilityResponded:(NSNotification *)n -{ - NSData *data = [[n userInfo] valueForKey:NSFileHandleNotificationDataItem]; - [response appendData:data]; - - // Keep reading - if ([n object] != nil) - [[n object] readInBackgroundAndNotify]; -} - -- (void)utilityTerminated:(NSNotification *)n -{ - NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; - [nc removeObserver:self name:NSFileHandleReadCompletionNotification object:[[task standardOutput] fileHandleForReading]]; - [nc removeObserver:self name:NSTaskDidTerminateNotification object:task]; - [task release]; task = nil; - - if (!cancelled) - { - NSString *data = [[[NSString alloc] initWithData:response encoding:NSASCIIStringEncoding] autorelease]; - [[JSBridge sharedInstance] runCallback:callback withArgument:data]; - } -} - -- (BOOL)terminated -{ - return task == nil; -} - -@end diff --git a/OpenRA.Launcher.Mac/ImageAndTextCell.h b/OpenRA.Launcher.Mac/ImageAndTextCell.h deleted file mode 100755 index f75674d6e4..0000000000 --- a/OpenRA.Launcher.Mac/ImageAndTextCell.h +++ /dev/null @@ -1,62 +0,0 @@ -// -// File: ImageAndTextCell.h -// -// Abstract: Subclass of NSTextFieldCell which can display text and an image simultaneously. -// -// Version: 1.0 -// -// Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Inc. ("Apple") -// in consideration of your agreement to the following terms, and your use, -// installation, modification or redistribution of this Apple software -// constitutes acceptance of these terms. If you do not agree with these -// terms, please do not use, install, modify or redistribute this Apple -// software. -// -// In consideration of your agreement to abide by the following terms, and -// subject to these terms, Apple grants you a personal, non - exclusive -// license, under Apple's copyrights in this original Apple software ( the -// "Apple Software" ), to use, reproduce, modify and redistribute the Apple -// Software, with or without modifications, in source and / or binary forms; -// provided that if you redistribute the Apple Software in its entirety and -// without modifications, you must retain this notice and the following text -// and disclaimers in all such redistributions of the Apple Software. Neither -// the name, trademarks, service marks or logos of Apple Inc. may be used to -// endorse or promote products derived from the Apple Software without specific -// prior written permission from Apple. Except as expressly stated in this -// notice, no other rights or licenses, express or implied, are granted by -// Apple herein, including but not limited to any patent rights that may be -// infringed by your derivative works or by other works in which the Apple -// Software may be incorporated. -// -// The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO -// WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED -// WARRANTIES OF NON - INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A -// PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION -// ALONE OR IN COMBINATION WITH YOUR PRODUCTS. -// -// IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR -// CONSEQUENTIAL DAMAGES ( INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION ) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION -// AND / OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER -// UNDER THEORY OF CONTRACT, TORT ( INCLUDING NEGLIGENCE ), STRICT LIABILITY OR -// OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (C) 2007 Apple Inc. All Rights Reserved. -// - -#import - -@interface ImageAndTextCell : NSTextFieldCell -{ -@private - NSImage *image; -} - -- (void)setImage:(NSImage *)anImage; -- (NSImage*)image; - -- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView*)controlView; -- (NSSize)cellSize; - -@end diff --git a/OpenRA.Launcher.Mac/ImageAndTextCell.m b/OpenRA.Launcher.Mac/ImageAndTextCell.m deleted file mode 100755 index 58f28d80df..0000000000 --- a/OpenRA.Launcher.Mac/ImageAndTextCell.m +++ /dev/null @@ -1,252 +0,0 @@ -// -// File: ImageAndTextCell.m -// -// Abstract: Subclass of NSTextFieldCell which can display text and an image simultaneously. -// -// Version: 1.0 -// -// Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Inc. ("Apple") -// in consideration of your agreement to the following terms, and your use, -// installation, modification or redistribution of this Apple software -// constitutes acceptance of these terms. If you do not agree with these -// terms, please do not use, install, modify or redistribute this Apple -// software. -// -// In consideration of your agreement to abide by the following terms, and -// subject to these terms, Apple grants you a personal, non - exclusive -// license, under Apple's copyrights in this original Apple software ( the -// "Apple Software" ), to use, reproduce, modify and redistribute the Apple -// Software, with or without modifications, in source and / or binary forms; -// provided that if you redistribute the Apple Software in its entirety and -// without modifications, you must retain this notice and the following text -// and disclaimers in all such redistributions of the Apple Software. Neither -// the name, trademarks, service marks or logos of Apple Inc. may be used to -// endorse or promote products derived from the Apple Software without specific -// prior written permission from Apple. Except as expressly stated in this -// notice, no other rights or licenses, express or implied, are granted by -// Apple herein, including but not limited to any patent rights that may be -// infringed by your derivative works or by other works in which the Apple -// Software may be incorporated. -// -// The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO -// WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED -// WARRANTIES OF NON - INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A -// PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION -// ALONE OR IN COMBINATION WITH YOUR PRODUCTS. -// -// IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR -// CONSEQUENTIAL DAMAGES ( INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION ) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION -// AND / OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER -// UNDER THEORY OF CONTRACT, TORT ( INCLUDING NEGLIGENCE ), STRICT LIABILITY OR -// OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (C) 2007 Apple Inc. All Rights Reserved. -// - -#import "ImageAndTextCell.h" -//#import "BaseNode.h" - -@implementation ImageAndTextCell - -#define kIconImageSize 16.0 - -#define kImageOriginXOffset 3 -#define kImageOriginYOffset 1 - -#define kTextOriginXOffset 2 -#define kTextOriginYOffset 2 -#define kTextHeightAdjust 4 - -// ------------------------------------------------------------------------------- -// init: -// ------------------------------------------------------------------------------- -- (id)init -{ - self = [super init]; - - // we want a smaller font - [self setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]]; - - return self; -} - -// ------------------------------------------------------------------------------- -// dealloc: -// ------------------------------------------------------------------------------- -- (void)dealloc -{ - [image release]; - image = nil; - [super dealloc]; -} - -// ------------------------------------------------------------------------------- -// copyWithZone:zone -// ------------------------------------------------------------------------------- -- (id)copyWithZone:(NSZone*)zone -{ - ImageAndTextCell *cell = (ImageAndTextCell*)[super copyWithZone:zone]; - cell->image = [image retain]; - return cell; -} - -// ------------------------------------------------------------------------------- -// setImage:anImage -// ------------------------------------------------------------------------------- -- (void)setImage:(NSImage*)anImage -{ - if (anImage != image) - { - [image autorelease]; - image = [anImage retain]; - [image setSize:NSMakeSize(kIconImageSize, kIconImageSize)]; - } -} - -// ------------------------------------------------------------------------------- -// image: -// ------------------------------------------------------------------------------- -- (NSImage*)image -{ - return image; -} - -// ------------------------------------------------------------------------------- -// isGroupCell: -// ------------------------------------------------------------------------------- -- (BOOL)isGroupCell -{ - return ([self image] == nil && [[self title] length] > 0); -} - -// ------------------------------------------------------------------------------- -// titleRectForBounds:cellRect -// -// Returns the proper bound for the cell's title while being edited -// ------------------------------------------------------------------------------- -- (NSRect)titleRectForBounds:(NSRect)cellRect -{ - // the cell has an image: draw the normal item cell - NSSize imageSize; - NSRect imageFrame; - - imageSize = [image size]; - NSDivideRect(cellRect, &imageFrame, &cellRect, 3 + imageSize.width, NSMinXEdge); - - imageFrame.origin.x += kImageOriginXOffset; - imageFrame.origin.y -= kImageOriginYOffset; - imageFrame.size = imageSize; - - imageFrame.origin.y += ceil((cellRect.size.height - imageFrame.size.height) / 2); - - NSRect newFrame = cellRect; - newFrame.origin.x += kTextOriginXOffset; - newFrame.origin.y += kTextOriginYOffset; - newFrame.size.height -= kTextHeightAdjust; - - return newFrame; -} - -// ------------------------------------------------------------------------------- -// editWithFrame:inView:editor:delegate:event -// ------------------------------------------------------------------------------- -- (void)editWithFrame:(NSRect)aRect inView:(NSView*)controlView editor:(NSText*)textObj delegate:(id)anObject event:(NSEvent*)theEvent -{ - NSRect textFrame = [self titleRectForBounds:aRect]; - [super editWithFrame:textFrame inView:controlView editor:textObj delegate:anObject event:theEvent]; -} - -// ------------------------------------------------------------------------------- -// selectWithFrame:inView:editor:delegate:event:start:length -// ------------------------------------------------------------------------------- -- (void)selectWithFrame:(NSRect)aRect inView:(NSView*)controlView editor:(NSText*)textObj delegate:(id)anObject start:(NSInteger)selStart length:(NSInteger)selLength -{ - NSRect textFrame = [self titleRectForBounds:aRect]; - [super selectWithFrame:textFrame inView:controlView editor:textObj delegate:anObject start:selStart length:selLength]; -} - -// ------------------------------------------------------------------------------- -// drawWithFrame:cellFrame:controlView: -// ------------------------------------------------------------------------------- -- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView*)controlView -{ - if (image != nil) - { - // the cell has an image: draw the normal item cell - NSSize imageSize; - NSRect imageFrame; - - imageSize = [image size]; - NSDivideRect(cellFrame, &imageFrame, &cellFrame, 3 + imageSize.width, NSMinXEdge); - - imageFrame.origin.x += kImageOriginXOffset; - imageFrame.origin.y -= kImageOriginYOffset; - imageFrame.size = imageSize; - - if ([controlView isFlipped]) - imageFrame.origin.y += ceil((cellFrame.size.height + imageFrame.size.height) / 2); - else - imageFrame.origin.y += ceil((cellFrame.size.height - imageFrame.size.height) / 2); - [image compositeToPoint:imageFrame.origin operation:NSCompositeSourceOver]; - - NSRect newFrame = cellFrame; - newFrame.origin.x += kTextOriginXOffset; - newFrame.origin.y += kTextOriginYOffset; - newFrame.size.height -= kTextHeightAdjust; - [super drawWithFrame:newFrame inView:controlView]; - } - else - { - if ([self isGroupCell]) - { - // Center the text in the cellFrame, and call super to do thew ork of actually drawing. - CGFloat yOffset = floor((NSHeight(cellFrame) - [[self attributedStringValue] size].height) / 2.0); - cellFrame.origin.y += yOffset; - cellFrame.size.height -= (kTextOriginYOffset*yOffset); - [super drawWithFrame:cellFrame inView:controlView]; - } - } -} - -// ------------------------------------------------------------------------------- -// cellSize: -// ------------------------------------------------------------------------------- -- (NSSize)cellSize -{ - NSSize cellSize = [super cellSize]; - cellSize.width += (image ? [image size].width : 0) + 3; - return cellSize; -} - -// ------------------------------------------------------------------------------- -// hitTestForEvent: -// -// In 10.5, we need you to implement this method for blocking drag and drop of a given cell. -// So NSCell hit testing will determine if a row can be dragged or not. -// -// NSTableView calls this cell method when starting a drag, if the hit cell returns -// NSCellHitTrackableArea, the particular row will be tracked instead of dragged. -// -// ------------------------------------------------------------------------------- -/* -- (NSUInteger)hitTestForEvent:(NSEvent *)event inRect:(NSRect)cellFrame ofView:(NSView *)controlView -{ - NSInteger result = NSCellHitContentArea; - - NSOutlineView* hostingOutlineView = (NSOutlineView*)[self controlView]; - if (hostingOutlineView) - { - NSInteger selectedRow = [hostingOutlineView selectedRow]; - BaseNode* node = [[hostingOutlineView itemAtRow:selectedRow] representedObject]; - - if (![node isDraggable]) // is the node isDraggable (i.e. non-file system based objects) - result = NSCellHitTrackableArea; - } - - return result; -} -*/ -@end - diff --git a/OpenRA.Launcher.Mac/JSBridge.h b/OpenRA.Launcher.Mac/JSBridge.h deleted file mode 100644 index ec31f26bb3..0000000000 --- a/OpenRA.Launcher.Mac/JSBridge.h +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright 2007-2010 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made - * available to you under the terms of the GNU General Public License - * as published by the Free Software Foundation. For more information, - * see LICENSE. - */ - - -#import - -@class Controller; -@class Download; -@interface JSBridge : NSObject { - Controller *controller; - NSDictionary *methods; -} -@property(readonly) NSDictionary *methods; - -+ (JSBridge *)sharedInstance; -- (void)setController:(Controller *)aController; -- (void)runCallback:(NSString *)cb withArgument:(NSString *)arg; -@end diff --git a/OpenRA.Launcher.Mac/JSBridge.m b/OpenRA.Launcher.Mac/JSBridge.m deleted file mode 100644 index 09fa40ed38..0000000000 --- a/OpenRA.Launcher.Mac/JSBridge.m +++ /dev/null @@ -1,236 +0,0 @@ -/* - * Copyright 2007-2010 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made - * available to you under the terms of the GNU General Public License - * as published by the Free Software Foundation. For more information, - * see LICENSE. - */ - -#import "JSBridge.h" -#import "Controller.h" -#import "Download.h" -#import "Mod.h" - -static JSBridge *SharedInstance; - -@implementation JSBridge -@synthesize methods; - -+ (JSBridge *)sharedInstance -{ - if (SharedInstance == nil) - SharedInstance = [[JSBridge alloc] init]; - - return SharedInstance; -} - -+ (NSString *)webScriptNameForSelector:(SEL)sel -{ - return [[[JSBridge sharedInstance] methods] objectForKey:NSStringFromSelector(sel)]; -} - -+ (BOOL)isSelectorExcludedFromWebScript:(SEL)sel -{ - return [[[JSBridge sharedInstance] methods] objectForKey:NSStringFromSelector(sel)] == nil; -} - --(id)init -{ - self = [super init]; - if (self != nil) - { - methods = [[NSDictionary dictionaryWithObjectsAndKeys: - @"launchMod", NSStringFromSelector(@selector(launchMod:)), - @"log", NSStringFromSelector(@selector(log:)), - @"existsInMod", NSStringFromSelector(@selector(fileExists:inMod:)), - @"metadata", NSStringFromSelector(@selector(metadata:forMod:)), - @"httpRequest", NSStringFromSelector(@selector(httpRequest:withCallback:)), - - // File downloading - @"registerDownload", NSStringFromSelector(@selector(registerDownload:withURL:filename:)), - @"startDownload", NSStringFromSelector(@selector(startDownload:)), - @"cancelDownload", NSStringFromSelector(@selector(cancelDownload:)), - @"downloadStatus", NSStringFromSelector(@selector(downloadStatus:)), - @"downloadError", NSStringFromSelector(@selector(downloadError:)), - @"bytesCompleted", NSStringFromSelector(@selector(bytesCompleted:)), - @"bytesTotal", NSStringFromSelector(@selector(bytesTotal:)), - @"extractDownload", NSStringFromSelector(@selector(extractDownload:toPath:inMod:)), - nil] retain]; - } - return self; -} - -- (void)setController:(Controller *)aController -{ - controller = [aController retain]; -} - -- (void)dealloc -{ - [controller release]; controller = nil; - [super dealloc]; -} - -- (void)runCallback:(NSString *)cb withArgument:(NSString *)arg -{ - NSString *cmd = [NSString stringWithFormat:@"%@('%@')", cb, - [arg stringByReplacingOccurrencesOfString:@"\n" withString:@"\\n"]]; - [[[controller webView] windowScriptObject] evaluateWebScript:cmd]; -} - -#pragma mark JS API methods - -- (BOOL)launchMod:(NSString *)aMod -{ - // Build the list of mods to launch - NSMutableArray *mods = [NSMutableArray array]; - NSString *current = aMod; - - // Assemble the mods in the reverse order to work around an engine bug - while (current != nil) - { - Mod *mod = [[controller allMods] objectForKey:current]; - if (mod == nil) - { - NSLog(@"Unknown mod: %@", current); - return NO; - } - [mods addObject:current]; - - if ([mod standalone]) - current = nil; - else - current = [mod requires]; - } - // Todo: Reverse the array ordering once the engine bug is fixed - - [controller launchMod:[mods componentsJoinedByString:@","]]; - return YES; -} - -- (BOOL)registerDownload:(NSString *)key withURL:(NSString *)url filename:(NSString *)filename -{ - // Create the download directory if it doesn't exist - NSString *downloadDir = [@"~/Library/Application Support/OpenRA/Downloads/" stringByExpandingTildeInPath]; - if (![[NSFileManager defaultManager] fileExistsAtPath:downloadDir]) - [[NSFileManager defaultManager] createDirectoryAtPath:downloadDir withIntermediateDirectories:YES attributes:nil error:NULL]; - - // Disallow traversing directories; take only the last component - NSString *path = [downloadDir stringByAppendingPathComponent:[filename lastPathComponent]]; - return [controller registerDownload:key withURL:url filePath:path]; -} - -- (NSString *)downloadStatus:(NSString *)key -{ - Download *d = [controller downloadWithKey:key]; - if (d == nil) - return @"NOT_REGISTERED"; - - return [d status]; -} - -- (NSString *)downloadError:(NSString *)key -{ - Download *d = [controller downloadWithKey:key]; - if (d == nil) - return @""; - - return [d error]; -} - -- (BOOL)startDownload:(NSString *)key -{ - Download *d = [controller downloadWithKey:key]; - return (d == nil) ? NO : [d start]; -} - -- (BOOL)cancelDownload:(NSString *)key -{ - Download *d = [controller downloadWithKey:key]; - return (d == nil) ? NO : [d cancel]; -} - -- (int)bytesCompleted:(NSString *)key -{ - Download *d = [controller downloadWithKey:key]; - return (d == nil) ? -1 : [d bytesCompleted]; -} - -- (int)bytesTotal:(NSString *)key -{ - Download *d = [controller downloadWithKey:key]; - return (d == nil) ? -1 : [d bytesTotal]; -} - -- (BOOL)extractDownload:(NSString *)key toPath:(NSString *)aFile inMod:(NSString *)aMod -{ - Download *d = [controller downloadWithKey:key]; - if (d == nil) - { - NSLog(@"Unknown download"); - return NO; - } - if (![[d status] isEqualToString:@"DOWNLOADED"]) - { - NSLog(@"Invalid download status"); - return NO; - } - - id mod = [[controller allMods] objectForKey:aMod]; - if (mod == nil) - { - NSLog(@"Invalid or unknown mod: %@", aMod); - return NO; - } - - // Disallow traversing up the directory tree - id path = [aMod stringByAppendingPathComponent:[aFile stringByReplacingOccurrencesOfString:@"../" - withString:@""]]; - - [d extractToPath:path]; - return YES; -} - -- (void)log:(NSString *)message -{ - NSLog(@"js: %@",message); -} - -- (BOOL)fileExists:(NSString *)aFile inMod:(NSString *)aMod -{ - id mod = [[controller allMods] objectForKey:aMod]; - if (mod == nil) - { - NSLog(@"Invalid or unknown mod: %@", aMod); - return NO; - } - - // Disallow traversing up the directory tree - id path = [[mod path] stringByAppendingPathComponent:[aFile stringByReplacingOccurrencesOfString:@"../" - withString:@""]]; - - return [[NSFileManager defaultManager] fileExistsAtPath:path]; -} - -- (NSString *)metadata:(NSString *)aField forMod:(NSString *)aMod -{ - id mod = [[controller allMods] objectForKey:aMod]; - if (mod == nil) - { - NSLog(@"Invalid or unknown mod: %@", aMod); - return @""; - } - - if ([aField isEqualToString:@"VERSION"]) - return [mod version]; - - NSLog(@"Invalid or unknown field: %@", aField); - return @""; -} - -- (void)httpRequest:(NSString *)url withCallback:(NSString *)cb -{ - [controller fetchURL:url withCallback:cb]; -} - -@end diff --git a/OpenRA.Launcher.Mac/Mod.h b/OpenRA.Launcher.Mac/Mod.h deleted file mode 100644 index 5c4fb234c8..0000000000 --- a/OpenRA.Launcher.Mac/Mod.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2007-2010 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made - * available to you under the terms of the GNU General Public License - * as published by the Free Software Foundation. For more information, - * see LICENSE. - */ - -#import - -@interface Mod : NSObject { - NSString *path; - NSString *mod; - NSString *title; - NSString *version; - NSString *author; - NSString *requires; - NSString *description; - BOOL standalone; -} - -@property (readonly) NSString *mod; -@property (readonly) NSString *title; -@property (readonly) NSString *version; -@property (readonly) NSString *author; -@property (readonly) NSString *description; -@property (readonly) NSString *requires; -@property (readonly) NSString *path; -@property (readonly) BOOL standalone; - -+ (id)modWithId:(NSString *)mid fields:(id)fields path:(NSString *)path; -- (id)initWithId:(NSString *)anId fields:(NSDictionary *)fields path:(NSString *)path; -@end diff --git a/OpenRA.Launcher.Mac/Mod.m b/OpenRA.Launcher.Mac/Mod.m deleted file mode 100644 index 4dcced95ac..0000000000 --- a/OpenRA.Launcher.Mac/Mod.m +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2007-2010 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made - * available to you under the terms of the GNU General Public License - * as published by the Free Software Foundation. For more information, - * see LICENSE. - */ - -#import "Mod.h" - - -@implementation Mod -@synthesize mod; -@synthesize title; -@synthesize version; -@synthesize author; -@synthesize description; -@synthesize requires; -@synthesize standalone; -@synthesize path; - -+ (id)modWithId:(NSString *)mod fields:(id)fields path:(NSString *)aPath -{ - id newObject = [[self alloc] initWithId:mod fields:fields path:aPath]; - [newObject autorelease]; - return newObject; -} - -- (id)initWithId:(NSString *)anId fields:(NSDictionary *)fields path:(NSString *)aPath -{ - self = [super init]; - if (self) - { - mod = [anId retain]; - path = [aPath retain]; - title = [[fields objectForKey:@"Title"] retain]; - version = [[fields objectForKey:@"Version"] retain]; - author = [[fields objectForKey:@"Author"] retain]; - description = [[fields objectForKey:@"Description"] retain]; - requires = [[fields objectForKey:@"Requires"] retain]; - standalone = ([[fields objectForKey:@"Standalone"] isEqualToString:@"True"]); - } - return self; -} - -- (void) dealloc -{ - [mod release]; mod = nil; - [path release]; path = nil; - [title release]; title = nil; - [version release]; version = nil; - [author release]; author = nil; - [description release]; description = nil; - [requires release]; requires = nil; - [super dealloc]; -} - -@end diff --git a/OpenRA.Launcher.Mac/OpenRA-Info.plist b/OpenRA.Launcher.Mac/OpenRA-Info.plist index 95ace488c8..fa1cb03573 100644 --- a/OpenRA.Launcher.Mac/OpenRA-Info.plist +++ b/OpenRA.Launcher.Mac/OpenRA-Info.plist @@ -9,9 +9,9 @@ CFBundleIconFile OpenRA.icns CFBundleName - OpenRA Launcher + OpenRA CFBundleDisplayName - OpenRA Launcher + OpenRA CFBundleIdentifier org.open-ra.launcher CFBundleInfoDictionaryVersion diff --git a/OpenRA.Launcher.Mac/OpenRA.xcodeproj/project.pbxproj b/OpenRA.Launcher.Mac/OpenRA.xcodeproj/project.pbxproj index 5e6ff11485..878f66cc8a 100644 --- a/OpenRA.Launcher.Mac/OpenRA.xcodeproj/project.pbxproj +++ b/OpenRA.Launcher.Mac/OpenRA.xcodeproj/project.pbxproj @@ -11,16 +11,9 @@ 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; }; 8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; }; 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; }; - DA38212212925344003B0BB5 /* JSBridge.m in Sources */ = {isa = PBXBuildFile; fileRef = DA38212112925344003B0BB5 /* JSBridge.m */; }; - DA7D85671295E92900E58547 /* Download.m in Sources */ = {isa = PBXBuildFile; fileRef = DA7D85661295E92900E58547 /* Download.m */; }; DA81FA821290F5C800C48F2F /* Controller.m in Sources */ = {isa = PBXBuildFile; fileRef = DA81FA811290F5C800C48F2F /* Controller.m */; }; - DA81FAAA1290FA0000C48F2F /* Mod.m in Sources */ = {isa = PBXBuildFile; fileRef = DA81FAA91290FA0000C48F2F /* Mod.m */; }; - DA81FB9312910A8B00C48F2F /* ImageAndTextCell.m in Sources */ = {isa = PBXBuildFile; fileRef = DA81FB9212910A8B00C48F2F /* ImageAndTextCell.m */; }; DA81FBDC12910E4900C48F2F /* OpenRA.icns in Resources */ = {isa = PBXBuildFile; fileRef = DA81FBDB12910E4900C48F2F /* OpenRA.icns */; }; - DA81FC3F12911E2B00C48F2F /* GameInstall.m in Sources */ = {isa = PBXBuildFile; fileRef = DA81FC3E12911E2B00C48F2F /* GameInstall.m */; }; DA9295A712921DF900EDB02E /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DA9295A612921DF900EDB02E /* WebKit.framework */; }; - DA9296901292328200EDB02E /* SidebarEntry.m in Sources */ = {isa = PBXBuildFile; fileRef = DA92968F1292328200EDB02E /* SidebarEntry.m */; }; - DAA3F31C12CBF60D00E214BF /* HttpRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = DAA3F31B12CBF60D00E214BF /* HttpRequest.m */; }; DAB887F5129E5D6C00C99407 /* SDL in Resources */ = {isa = PBXBuildFile; fileRef = DAB887EE129E5D6100C99407 /* SDL */; }; /* End PBXBuildFile section */ @@ -34,24 +27,10 @@ 29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; 8D1107310486CEB800E47090 /* OpenRA-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "OpenRA-Info.plist"; sourceTree = ""; }; 8D1107320486CEB800E47090 /* OpenRA.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = OpenRA.app; sourceTree = BUILT_PRODUCTS_DIR; }; - DA38212012925344003B0BB5 /* JSBridge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSBridge.h; sourceTree = ""; }; - DA38212112925344003B0BB5 /* JSBridge.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSBridge.m; sourceTree = ""; }; - DA7D85651295E92900E58547 /* Download.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Download.h; sourceTree = ""; }; - DA7D85661295E92900E58547 /* Download.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Download.m; sourceTree = ""; }; DA81FA801290F5C800C48F2F /* Controller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Controller.h; sourceTree = ""; }; DA81FA811290F5C800C48F2F /* Controller.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Controller.m; sourceTree = ""; }; - DA81FAA81290FA0000C48F2F /* Mod.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Mod.h; sourceTree = ""; }; - DA81FAA91290FA0000C48F2F /* Mod.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Mod.m; sourceTree = ""; }; - DA81FB9112910A8B00C48F2F /* ImageAndTextCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageAndTextCell.h; sourceTree = ""; }; - DA81FB9212910A8B00C48F2F /* ImageAndTextCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ImageAndTextCell.m; sourceTree = ""; }; DA81FBDB12910E4900C48F2F /* OpenRA.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = OpenRA.icns; sourceTree = ""; }; - DA81FC3D12911E2B00C48F2F /* GameInstall.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GameInstall.h; sourceTree = ""; }; - DA81FC3E12911E2B00C48F2F /* GameInstall.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GameInstall.m; sourceTree = ""; }; DA9295A612921DF900EDB02E /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; }; - DA92968E1292328200EDB02E /* SidebarEntry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SidebarEntry.h; sourceTree = ""; }; - DA92968F1292328200EDB02E /* SidebarEntry.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SidebarEntry.m; sourceTree = ""; }; - DAA3F31A12CBF60D00E214BF /* HttpRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HttpRequest.h; sourceTree = ""; }; - DAA3F31B12CBF60D00E214BF /* HttpRequest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HttpRequest.m; sourceTree = ""; }; DAB887EE129E5D6100C99407 /* SDL */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; path = SDL; sourceTree = ""; }; /* End PBXFileReference section */ @@ -71,22 +50,8 @@ 080E96DDFE201D6D7F000001 /* Classes */ = { isa = PBXGroup; children = ( - DA81FB9112910A8B00C48F2F /* ImageAndTextCell.h */, - DA81FB9212910A8B00C48F2F /* ImageAndTextCell.m */, DA81FA801290F5C800C48F2F /* Controller.h */, DA81FA811290F5C800C48F2F /* Controller.m */, - DA81FAA81290FA0000C48F2F /* Mod.h */, - DA81FAA91290FA0000C48F2F /* Mod.m */, - DA81FC3D12911E2B00C48F2F /* GameInstall.h */, - DA81FC3E12911E2B00C48F2F /* GameInstall.m */, - DA7D85651295E92900E58547 /* Download.h */, - DA7D85661295E92900E58547 /* Download.m */, - DA92968E1292328200EDB02E /* SidebarEntry.h */, - DA92968F1292328200EDB02E /* SidebarEntry.m */, - DA38212112925344003B0BB5 /* JSBridge.m */, - DA38212012925344003B0BB5 /* JSBridge.h */, - DAA3F31A12CBF60D00E214BF /* HttpRequest.h */, - DAA3F31B12CBF60D00E214BF /* HttpRequest.m */, ); name = Classes; sourceTree = ""; @@ -228,13 +193,6 @@ files = ( 8D11072D0486CEB800E47090 /* main.m in Sources */, DA81FA821290F5C800C48F2F /* Controller.m in Sources */, - DA81FAAA1290FA0000C48F2F /* Mod.m in Sources */, - DA81FB9312910A8B00C48F2F /* ImageAndTextCell.m in Sources */, - DA81FC3F12911E2B00C48F2F /* GameInstall.m in Sources */, - DA9296901292328200EDB02E /* SidebarEntry.m in Sources */, - DA38212212925344003B0BB5 /* JSBridge.m in Sources */, - DA7D85671295E92900E58547 /* Download.m in Sources */, - DAA3F31C12CBF60D00E214BF /* HttpRequest.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/OpenRA.Launcher.Mac/SidebarEntry.h b/OpenRA.Launcher.Mac/SidebarEntry.h deleted file mode 100644 index c40864b72e..0000000000 --- a/OpenRA.Launcher.Mac/SidebarEntry.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2007-2010 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made - * available to you under the terms of the GNU General Public License - * as published by the Free Software Foundation. For more information, - * see LICENSE. - */ - -#import - -@class Mod; -@interface SidebarEntry : NSObject -{ - BOOL isHeader; - NSString *title; - NSImage *icon; - NSURL *url; - NSMutableArray *children; -} - -@property (readonly) BOOL isHeader; -@property (readonly) NSString *title; -@property (readonly) NSMutableArray* children; -@property (readonly) NSImage* icon; - -+ (id)headerWithTitle:(NSString *)aTitle; -+ (id)entryWithTitle:(NSString *)aTitle url:(NSURL *)aURL icon:(id)anIcon; -+ (id)entryWithMod:(Mod *)baseMod allMods:(NSDictionary *)allMods basePath:(NSString *)aPath; -- (id)initWithTitle:(NSString *)aTitle url:(NSURL *)aURL icon:(id)anIcon isHeader:(BOOL)aHeader; -- (void)addChild:(id)child; -- (NSURL *)url; -@end diff --git a/OpenRA.Launcher.Mac/SidebarEntry.m b/OpenRA.Launcher.Mac/SidebarEntry.m deleted file mode 100644 index 2410ecc2c9..0000000000 --- a/OpenRA.Launcher.Mac/SidebarEntry.m +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright 2007-2010 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made - * available to you under the terms of the GNU General Public License - * as published by the Free Software Foundation. For more information, - * see LICENSE. - */ - -#import "SidebarEntry.h" -#import "Mod.h" - -@implementation SidebarEntry -@synthesize isHeader; -@synthesize title; -@synthesize children; -@synthesize icon; - -+ (id)headerWithTitle:(NSString *)aTitle; -{ - id newObject = [[self alloc] initWithTitle:aTitle url:nil icon:nil isHeader:YES]; - [newObject autorelease]; - return newObject; -} - -+ (id)entryWithTitle:(NSString *)aTitle url:(NSURL *)aURL icon:(id)anIcon -{ - id newObject = [[self alloc] initWithTitle:aTitle url:aURL icon:anIcon isHeader:NO]; - [newObject autorelease]; - return newObject; -} - -+ (id)entryWithMod:(Mod *)baseMod allMods:(NSDictionary *)allMods basePath:(NSString *)basePath -{ - // TODO: Get the mod icon from the Mod - // Temporary hack until mods define an icon - NSString *imageName = [[NSBundle mainBundle] pathForResource:@"OpenRA" ofType:@"icns"]; - NSImage *icon = [[[NSImage alloc] initWithContentsOfFile:imageName] autorelease]; - NSURL *url = [NSURL URLWithString:[[[baseMod path] stringByAppendingPathComponent:@"mod.html"] stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding]]; - SidebarEntry *ret = [SidebarEntry entryWithTitle:[baseMod title] url:url icon:icon]; - - for (id key in allMods) - { - id aMod = [allMods objectForKey:key]; - if (![[aMod requires] isEqualToString:[baseMod mod]]) - continue; - - id child = [SidebarEntry entryWithMod:aMod allMods:allMods basePath:basePath]; - [ret addChild:child]; - } - return ret; -} - -- (id)initWithTitle:(NSString *)aTitle url:(NSURL *)aURL icon:(id)anIcon isHeader:(BOOL)isaHeader -{ - self = [super init]; - if (self) - { - isHeader = isaHeader; - title = [aTitle retain]; - url = [aURL retain]; - icon = [anIcon retain]; - children = [[NSMutableArray alloc] init]; - } - return self; -} - -- (void)addChild:(Mod *)child -{ - [children addObject:child]; -} - -- (NSURL *)url -{ - return url; -} - -- (void) dealloc -{ - [title release]; title = nil; - [url release]; url = nil; - [icon release]; icon = nil; - [super dealloc]; -} -@end diff --git a/OpenRA.Launcher.Mac/build/Release/OpenRA.app/Contents/Info.plist b/OpenRA.Launcher.Mac/build/Release/OpenRA.app/Contents/Info.plist index 8b9cbfdac4..e87e49f3a1 100644 --- a/OpenRA.Launcher.Mac/build/Release/OpenRA.app/Contents/Info.plist +++ b/OpenRA.Launcher.Mac/build/Release/OpenRA.app/Contents/Info.plist @@ -5,7 +5,7 @@ CFBundleDevelopmentRegion English CFBundleDisplayName - OpenRA Launcher + OpenRA CFBundleExecutable OpenRA CFBundleIconFile @@ -15,7 +15,7 @@ CFBundleInfoDictionaryVersion 6.0 CFBundleName - OpenRA Launcher + OpenRA CFBundlePackageType APPL CFBundleShortVersionString diff --git a/OpenRA.Launcher.Mac/build/Release/OpenRA.app/Contents/MacOS/OpenRA b/OpenRA.Launcher.Mac/build/Release/OpenRA.app/Contents/MacOS/OpenRA index 09b0232c52..4c08b79906 100755 Binary files a/OpenRA.Launcher.Mac/build/Release/OpenRA.app/Contents/MacOS/OpenRA and b/OpenRA.Launcher.Mac/build/Release/OpenRA.app/Contents/MacOS/OpenRA differ diff --git a/OpenRA.Launcher.Mac/build/Release/OpenRA.app/Contents/Resources/English.lproj/MainMenu.nib b/OpenRA.Launcher.Mac/build/Release/OpenRA.app/Contents/Resources/English.lproj/MainMenu.nib index 3adb03f1ea..abd8571929 100644 Binary files a/OpenRA.Launcher.Mac/build/Release/OpenRA.app/Contents/Resources/English.lproj/MainMenu.nib and b/OpenRA.Launcher.Mac/build/Release/OpenRA.app/Contents/Resources/English.lproj/MainMenu.nib differ diff --git a/OpenRA.Launcher.Mac/main.m b/OpenRA.Launcher.Mac/main.m index 854be1b519..f3b367a68e 100644 --- a/OpenRA.Launcher.Mac/main.m +++ b/OpenRA.Launcher.Mac/main.m @@ -44,7 +44,12 @@ int main(int argc, char *argv[]) sprintf(buf,"%s:%s",argv[2], old); setenv("DYLD_LIBRARY_PATH", buf, 1); } - + + // Hide the menubar if we are running fullscreen + // TODO: HACK: Parse the settings.yaml / commandline args for fullscreen options + if (YES) + [NSMenu setMenuBarVisible:NO]; + /* Exec mono */ execve(args[0], args, environ); }