2 //-----------------------------------------------------------------------------
4 // Copyright(C) 2009 Simon Howard
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License
8 // as published by the Free Software Foundation; either version 2
9 // of the License, or (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
21 //-----------------------------------------------------------------------------
23 #include "AppController.h"
27 @implementation AppController
31 NSMutableDictionary *defaults = [NSMutableDictionary dictionary];
34 * Register your app's defaults here by adding objects to the
37 * [defaults setObject:anObject forKey:keyForThatObject];
41 [[NSUserDefaults standardUserDefaults] registerDefaults:defaults];
42 [[NSUserDefaults standardUserDefaults] synchronize];
47 if ((self = [super init]))
51 self->filesAdded = NO;
63 [[NSApp mainMenu] setTitle:@PACKAGE_NAME];
66 - (void)applicationDidFinishLaunching:(NSNotification *)aNotif
68 // Uncomment if your application is Renaissance-based
69 // [NSBundle loadGSMarkupNamed:@"Main" owner:self];
72 - (BOOL)applicationShouldTerminate:(id)sender
77 - (void)applicationWillTerminate:(NSNotification *)aNotif
81 - (BOOL) application:(NSApplication *) application
82 openFile:(NSString *) fileName
86 // If this is the first file added, clear out the existing
87 // command line. This allows us to select multiple files
88 // in the finder and open them all together (for TCs, etc).
90 if (!self->filesAdded)
92 [self->launcherManager clearCommandLine];
95 // Add file with appropriate command line option based on extension:
97 extension = [fileName pathExtension];
99 if (![extension caseInsensitiveCompare: @"wad"])
101 [self->launcherManager addFileToCommandLine: fileName
102 forArgument: @"-merge"];
104 else if (![extension caseInsensitiveCompare: @"deh"])
106 [self->launcherManager addFileToCommandLine: fileName
107 forArgument: @"-deh"];
114 self->filesAdded = YES;
119 - (void)showPrefPanel:(id)sender