Add weapon cycling bindings for mouse and joystick buttons. Add weapon cycling bindi...
[chocolate-doom.git] / pkg / osx / AppController.m
bloba26a7c9e850374b88f2f931c2134999472bbbe27
1 /* ... */
2 //-----------------------------------------------------------------------------
3 //
4 // Copyright(C) 2009 Simon Howard
5 //
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
19 // 02111-1307, USA.
21 //-----------------------------------------------------------------------------
23 #include "AppController.h"
25 #include "config.h"
27 @implementation AppController
29 + (void)initialize
31     NSMutableDictionary *defaults = [NSMutableDictionary dictionary];
33     /*
34      * Register your app's defaults here by adding objects to the
35      * dictionary, eg
36      *
37      * [defaults setObject:anObject forKey:keyForThatObject];
38      *
39      */
41     [[NSUserDefaults standardUserDefaults] registerDefaults:defaults];
42     [[NSUserDefaults standardUserDefaults] synchronize];
45 - (id)init
47     if ((self = [super init]))
48     {
49     }
51     self->filesAdded = NO;
53     return self;
56 - (void)dealloc
58     [super dealloc];
61 - (void)awakeFromNib
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
74     return YES;
77 - (void)applicationWillTerminate:(NSNotification *)aNotif
81 - (BOOL) application:(NSApplication *) application
82          openFile:(NSString *) fileName
84     NSString *extension;
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)
91     {
92         [self->launcherManager clearCommandLine];
93     }
95     // Add file with appropriate command line option based on extension:
97     extension = [fileName pathExtension];
99     if (![extension caseInsensitiveCompare: @"wad"])
100     {
101         [self->launcherManager addFileToCommandLine: fileName
102                                forArgument: @"-merge"];
103     }
104     else if (![extension caseInsensitiveCompare: @"deh"])
105     {
106         [self->launcherManager addFileToCommandLine: fileName
107                                forArgument: @"-deh"];
108     }
109     else
110     {
111         return NO;
112     }
114     self->filesAdded = YES;
116     return YES;
119 - (void)showPrefPanel:(id)sender
123 @end