Files
atom/Atom/Classes/AtomApp.m
Corey Johnson 003effe5fd Kind of starting from scratch.
Recreated the project as an xcode 4 project.
Key Bindings are working and reloading.
Got rid of everything that wasn't being used right now.
2011-10-26 11:12:18 -07:00

49 lines
1.3 KiB
Objective-C

#import "AtomApp.h"
#import "AtomController.h"
#import "JSCocoa.h"
@implementation AtomApp
@synthesize controllers;
- (AtomController *)createController {
AtomController *controller = [[AtomController alloc] initWithWindowNibName:@"AtomWindow"];
[controllers addObject:controller];
return controller;
}
- (void)removeController:(AtomController *)controller {
[controllers removeObject:controller];
}
// Overridden
- (void)sendEvent:(NSEvent *)event {
if ([event type] == NSKeyDown) {
BOOL handeled = NO;
id controller = [[self keyWindow] windowController];
// The keyWindow could be a Cocoa Dialog or something, ignore that.
if ([controller isKindOfClass:[AtomController class]]) {
handeled = [controller handleKeyEvent:event];
}
if (!handeled) [super sendEvent:event];
}
else {
[super sendEvent:event];
}
}
// AppDelegate
- (void)applicationWillFinishLaunching:(NSNotification *)aNotification {
NSDictionary *defaults = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:YES], @"WebKitDeveloperExtras", nil];
[[NSUserDefaults standardUserDefaults] registerDefaults:defaults];
}
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
AtomController *controller = [self createController];
[controller window];
}
@end