From 0b3897a6f34634548b48c838fd50b990f4c2a51d Mon Sep 17 00:00:00 2001 From: Corey Johnson Date: Sun, 4 Sep 2011 18:11:29 -0700 Subject: [PATCH 1/7] Capture key bindings. Subclassesed NSApplication to make this work and moved the AppDelegate into there. --- Cocoa/AtomApp.h | 5 + Cocoa/AtomApp.m | 37 + Cocoa/Atomicity-Info.plist | 2 +- Cocoa/Atomicity.xcodeproj/project.pbxproj | 12 +- Cocoa/Classes/AtomWindowController.h | 2 + Cocoa/Classes/AtomWindowController.m | 5 + Cocoa/Classes/AtomicityAppDelegate.h | 14 - Cocoa/Classes/AtomicityAppDelegate.m | 27 - Cocoa/English.lproj/MainMenu.xib | 955 ++-------------------- 9 files changed, 103 insertions(+), 956 deletions(-) create mode 100644 Cocoa/AtomApp.h create mode 100644 Cocoa/AtomApp.m delete mode 100644 Cocoa/Classes/AtomicityAppDelegate.h delete mode 100644 Cocoa/Classes/AtomicityAppDelegate.m diff --git a/Cocoa/AtomApp.h b/Cocoa/AtomApp.h new file mode 100644 index 000000000..65fa3dd2c --- /dev/null +++ b/Cocoa/AtomApp.h @@ -0,0 +1,5 @@ +#import + +@interface AtomApp : NSApplication + +@end diff --git a/Cocoa/AtomApp.m b/Cocoa/AtomApp.m new file mode 100644 index 000000000..9d9220294 --- /dev/null +++ b/Cocoa/AtomApp.m @@ -0,0 +1,37 @@ +#import "AtomApp.h" +#import "AtomWindowController.h" +#import "JSCocoa.h" + +@implementation AtomApp + +- (void)sendEvent:(NSEvent *)event { + switch ([event type]) { + case NSKeyDown: + case NSFlagsChanged: { + AtomWindowController *controller = (AtomWindowController *)[[self keyWindow] windowController]; + BOOL handeled = [controller handleKeyEvent:event]; + if (!handeled) { + [super sendEvent:event]; + } + } + default: + [super sendEvent:event]; + break; + } +} + +// AppDelegate +- (void)applicationWillFinishLaunching:(NSNotification *)aNotification { + NSDictionary *defaults = [NSDictionary dictionaryWithObjectsAndKeys: + [NSNumber numberWithBool:YES], @"WebKitDeveloperExtras", + nil]; + [[NSUserDefaults standardUserDefaults] registerDefaults:defaults]; +} + +- (void)applicationDidFinishLaunching:(NSNotification *)aNotification { + id c = [[AtomWindowController alloc] initWithWindowNibName:@"AtomWindow"]; + [c window]; +} + + +@end diff --git a/Cocoa/Atomicity-Info.plist b/Cocoa/Atomicity-Info.plist index e59529b7b..b7f901fe2 100644 --- a/Cocoa/Atomicity-Info.plist +++ b/Cocoa/Atomicity-Info.plist @@ -27,6 +27,6 @@ NSMainNibFile MainMenu NSPrincipalClass - NSApplication + AtomApp diff --git a/Cocoa/Atomicity.xcodeproj/project.pbxproj b/Cocoa/Atomicity.xcodeproj/project.pbxproj index 90d7179ba..e7c13b1ec 100644 --- a/Cocoa/Atomicity.xcodeproj/project.pbxproj +++ b/Cocoa/Atomicity.xcodeproj/project.pbxproj @@ -7,9 +7,9 @@ objects = { /* Begin PBXBuildFile section */ + 04C8F31614144CC00041D072 /* AtomApp.m in Sources */ = {isa = PBXBuildFile; fileRef = 04C8F31514144CC00041D072 /* AtomApp.m */; }; 83599F9B13FE0F8400AC37E3 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 83599F9A13FE0F8400AC37E3 /* WebKit.framework */; }; 8359A6EE13FE26DA00AC37E3 /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8359A6ED13FE26DA00AC37E3 /* JavaScriptCore.framework */; }; - 837D8BA81408FAAA009B6DFA /* AtomicityAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 837D8BA51408FAAA009B6DFA /* AtomicityAppDelegate.m */; }; 837D8BA91408FAAA009B6DFA /* AtomWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 837D8BA71408FAAA009B6DFA /* AtomWindowController.m */; }; 837D8BAC1408FAB4009B6DFA /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 837D8BAB1408FAB4009B6DFA /* main.m */; }; 837D8BB41408FAC3009B6DFA /* APPL.icns in Resources */ = {isa = PBXBuildFile; fileRef = 837D8BAD1408FAC3009B6DFA /* APPL.icns */; }; @@ -28,14 +28,14 @@ /* End PBXBuildFile section */ /* Begin PBXFileReference section */ + 04C8F31414144CC00041D072 /* AtomApp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AtomApp.h; sourceTree = ""; }; + 04C8F31514144CC00041D072 /* AtomApp.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AtomApp.m; sourceTree = ""; }; 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; 13E42FB307B3F0F600E4EEF1 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = ""; }; 29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; 29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; 83599F9A13FE0F8400AC37E3 /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; }; 8359A6ED13FE26DA00AC37E3 /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; }; - 837D8BA41408FAAA009B6DFA /* AtomicityAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AtomicityAppDelegate.h; path = ../../Atomicity/Cocoa/Classes/AtomicityAppDelegate.h; sourceTree = SOURCE_ROOT; }; - 837D8BA51408FAAA009B6DFA /* AtomicityAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AtomicityAppDelegate.m; path = ../../Atomicity/Cocoa/Classes/AtomicityAppDelegate.m; sourceTree = SOURCE_ROOT; }; 837D8BA61408FAAA009B6DFA /* AtomWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AtomWindowController.h; path = ../../Atomicity/Cocoa/Classes/AtomWindowController.h; sourceTree = SOURCE_ROOT; }; 837D8BA71408FAAA009B6DFA /* AtomWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AtomWindowController.m; path = ../../Atomicity/Cocoa/Classes/AtomWindowController.m; sourceTree = SOURCE_ROOT; }; 837D8BAA1408FAB4009B6DFA /* Atomicity_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Atomicity_Prefix.pch; path = ../../Atomicity/Cocoa/Atomicity_Prefix.pch; sourceTree = SOURCE_ROOT; }; @@ -80,8 +80,8 @@ 080E96DDFE201D6D7F000001 /* Classes */ = { isa = PBXGroup; children = ( - 837D8BA41408FAAA009B6DFA /* AtomicityAppDelegate.h */, - 837D8BA51408FAAA009B6DFA /* AtomicityAppDelegate.m */, + 04C8F31414144CC00041D072 /* AtomApp.h */, + 04C8F31514144CC00041D072 /* AtomApp.m */, 837D8BA61408FAAA009B6DFA /* AtomWindowController.h */, 837D8BA71408FAAA009B6DFA /* AtomWindowController.m */, 29B97315FDCFA39411CA2CEA /* Other Sources */, @@ -267,7 +267,6 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 837D8BA81408FAAA009B6DFA /* AtomicityAppDelegate.m in Sources */, 837D8BA91408FAAA009B6DFA /* AtomWindowController.m in Sources */, 837D8BAC1408FAB4009B6DFA /* main.m in Sources */, 837D8BD51408FAD4009B6DFA /* BridgeSupportController.m in Sources */, @@ -276,6 +275,7 @@ 837D8BD91408FAD4009B6DFA /* JSCocoaFFIClosure.m in Sources */, 837D8BDA1408FAD4009B6DFA /* JSCocoaLib.m in Sources */, 837D8BDB1408FAD4009B6DFA /* JSCocoaPrivateObject.m in Sources */, + 04C8F31614144CC00041D072 /* AtomApp.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Cocoa/Classes/AtomWindowController.h b/Cocoa/Classes/AtomWindowController.h index 245f923e6..9867839bf 100644 --- a/Cocoa/Classes/AtomWindowController.h +++ b/Cocoa/Classes/AtomWindowController.h @@ -16,4 +16,6 @@ @property (assign) IBOutlet id webView; @property (assign) IBOutlet NSString *URL; +-(BOOL) handleKeyEvent:(NSEvent *)event; + @end diff --git a/Cocoa/Classes/AtomWindowController.m b/Cocoa/Classes/AtomWindowController.m index a679cc677..bc83ead2f 100644 --- a/Cocoa/Classes/AtomWindowController.m +++ b/Cocoa/Classes/AtomWindowController.m @@ -24,6 +24,7 @@ - (void)windowDidLoad { [super windowDidLoad]; + [self setShouldCascadeWindows:YES]; [self setWindowFrameAutosaveName:@"atomWindow"]; @@ -45,5 +46,9 @@ } } +-(BOOL) handleKeyEvent:(NSEvent *)event { + return NO; +} + @end diff --git a/Cocoa/Classes/AtomicityAppDelegate.h b/Cocoa/Classes/AtomicityAppDelegate.h deleted file mode 100644 index 9893feed5..000000000 --- a/Cocoa/Classes/AtomicityAppDelegate.h +++ /dev/null @@ -1,14 +0,0 @@ -// -// AtomicityAppDelegate.h -// Atomicity -// -// Created by Chris Wanstrath on 8/18/11. -// Copyright 2011 GitHub. All rights reserved. -// - -#import - -@interface AtomicityAppDelegate : NSObject { -} - -@end diff --git a/Cocoa/Classes/AtomicityAppDelegate.m b/Cocoa/Classes/AtomicityAppDelegate.m deleted file mode 100644 index e5c40100f..000000000 --- a/Cocoa/Classes/AtomicityAppDelegate.m +++ /dev/null @@ -1,27 +0,0 @@ -// -// AtomicityAppDelegate.m -// Atomicity -// -// Created by Chris Wanstrath on 8/18/11. -// Copyright 2011 GitHub. All rights reserved. -// - -#import "AtomicityAppDelegate.h" -#import "AtomWindowController.h" -#import "JSCocoa.h" - -@implementation AtomicityAppDelegate - -- (void)applicationWillFinishLaunching:(NSNotification *)aNotification { - NSDictionary *defaults = [NSDictionary dictionaryWithObjectsAndKeys: - [NSNumber numberWithBool:YES], @"WebKitDeveloperExtras", - nil]; - [[NSUserDefaults standardUserDefaults] registerDefaults:defaults]; -} - -- (void)applicationDidFinishLaunching:(NSNotification *)aNotification { - id c = [[AtomWindowController alloc] initWithWindowNibName:@"AtomWindow"]; - [c window]; -} - -@end diff --git a/Cocoa/English.lproj/MainMenu.xib b/Cocoa/English.lproj/MainMenu.xib index bd7d3aae7..443a74beb 100644 --- a/Cocoa/English.lproj/MainMenu.xib +++ b/Cocoa/English.lproj/MainMenu.xib @@ -2,36 +2,41 @@ 1060 - 10K549 - 851 - 1038.36 - 461.00 + 11A511 + 1617 + 1138 + 566.00 com.apple.InterfaceBuilder.CocoaPlugin - 851 + 1617 - + YES - + NSMenu + NSMenuItem + NSCustomObject YES com.apple.InterfaceBuilder.CocoaPlugin - PluginDependencyRecalculationVersion - + YES + + YES + + YES - NSApplication + AtomApp FirstResponder - NSApplication + AtomApp AMainMenu @@ -1308,9 +1313,6 @@ _NSMainMenu - - AtomicityAppDelegate - NSFontManager @@ -1878,14 +1880,6 @@ 493 - - - delegate - - - - 495 - alignCenter: @@ -1990,15 +1984,21 @@ 530 + + + delegate + + + + 535 + YES 0 - - YES - + @@ -2871,11 +2871,6 @@ - - 494 - - - 496 @@ -3025,140 +3020,69 @@ YES YES + -1.IBPluginDependency + -2.IBPluginDependency -3.IBPluginDependency 112.IBPluginDependency - 112.ImportedFromIB2 124.IBPluginDependency - 124.ImportedFromIB2 125.IBPluginDependency - 125.ImportedFromIB2 - 125.editorWindowContentRectSynchronizationRect 126.IBPluginDependency - 126.ImportedFromIB2 129.IBPluginDependency - 129.ImportedFromIB2 130.IBPluginDependency - 130.ImportedFromIB2 - 130.editorWindowContentRectSynchronizationRect 131.IBPluginDependency - 131.ImportedFromIB2 134.IBPluginDependency - 134.ImportedFromIB2 136.IBPluginDependency - 136.ImportedFromIB2 143.IBPluginDependency - 143.ImportedFromIB2 144.IBPluginDependency - 144.ImportedFromIB2 145.IBPluginDependency - 145.ImportedFromIB2 149.IBPluginDependency - 149.ImportedFromIB2 150.IBPluginDependency - 150.ImportedFromIB2 19.IBPluginDependency - 19.ImportedFromIB2 195.IBPluginDependency - 195.ImportedFromIB2 196.IBPluginDependency - 196.ImportedFromIB2 197.IBPluginDependency - 197.ImportedFromIB2 198.IBPluginDependency - 198.ImportedFromIB2 199.IBPluginDependency - 199.ImportedFromIB2 - 200.IBEditorWindowLastContentRect 200.IBPluginDependency - 200.ImportedFromIB2 - 200.editorWindowContentRectSynchronizationRect 201.IBPluginDependency - 201.ImportedFromIB2 202.IBPluginDependency - 202.ImportedFromIB2 203.IBPluginDependency - 203.ImportedFromIB2 204.IBPluginDependency - 204.ImportedFromIB2 - 205.IBEditorWindowLastContentRect 205.IBPluginDependency - 205.ImportedFromIB2 - 205.editorWindowContentRectSynchronizationRect 206.IBPluginDependency - 206.ImportedFromIB2 207.IBPluginDependency - 207.ImportedFromIB2 208.IBPluginDependency - 208.ImportedFromIB2 209.IBPluginDependency - 209.ImportedFromIB2 210.IBPluginDependency - 210.ImportedFromIB2 211.IBPluginDependency - 211.ImportedFromIB2 212.IBPluginDependency - 212.ImportedFromIB2 - 212.editorWindowContentRectSynchronizationRect 213.IBPluginDependency - 213.ImportedFromIB2 214.IBPluginDependency - 214.ImportedFromIB2 215.IBPluginDependency - 215.ImportedFromIB2 216.IBPluginDependency - 216.ImportedFromIB2 217.IBPluginDependency - 217.ImportedFromIB2 218.IBPluginDependency - 218.ImportedFromIB2 219.IBPluginDependency - 219.ImportedFromIB2 - 220.IBEditorWindowLastContentRect 220.IBPluginDependency - 220.ImportedFromIB2 - 220.editorWindowContentRectSynchronizationRect 221.IBPluginDependency - 221.ImportedFromIB2 23.IBPluginDependency - 23.ImportedFromIB2 236.IBPluginDependency - 236.ImportedFromIB2 239.IBPluginDependency - 239.ImportedFromIB2 - 24.IBEditorWindowLastContentRect 24.IBPluginDependency - 24.ImportedFromIB2 - 24.editorWindowContentRectSynchronizationRect - 29.IBEditorWindowLastContentRect 29.IBPluginDependency - 29.ImportedFromIB2 - 29.WindowOrigin - 29.editorWindowContentRectSynchronizationRect 295.IBPluginDependency - 296.IBEditorWindowLastContentRect 296.IBPluginDependency - 296.editorWindowContentRectSynchronizationRect 297.IBPluginDependency 298.IBPluginDependency 346.IBPluginDependency - 346.ImportedFromIB2 348.IBPluginDependency - 348.ImportedFromIB2 - 349.IBEditorWindowLastContentRect 349.IBPluginDependency - 349.ImportedFromIB2 - 349.editorWindowContentRectSynchronizationRect 350.IBPluginDependency - 350.ImportedFromIB2 351.IBPluginDependency - 351.ImportedFromIB2 354.IBPluginDependency - 354.ImportedFromIB2 375.IBPluginDependency - 376.IBEditorWindowLastContentRect 376.IBPluginDependency 377.IBPluginDependency - 388.IBEditorWindowLastContentRect 388.IBPluginDependency 389.IBPluginDependency 390.IBPluginDependency @@ -3191,8 +3115,8 @@ 417.IBPluginDependency 418.IBPluginDependency 419.IBPluginDependency + 420.IBPluginDependency 450.IBPluginDependency - 451.IBEditorWindowLastContentRect 451.IBPluginDependency 452.IBPluginDependency 453.IBPluginDependency @@ -3205,16 +3129,13 @@ 466.IBPluginDependency 485.IBPluginDependency 490.IBPluginDependency - 491.IBEditorWindowLastContentRect 491.IBPluginDependency 492.IBPluginDependency 496.IBPluginDependency - 497.IBEditorWindowLastContentRect 497.IBPluginDependency 498.IBPluginDependency 499.IBPluginDependency 5.IBPluginDependency - 5.ImportedFromIB2 500.IBPluginDependency 501.IBPluginDependency 502.IBPluginDependency @@ -3223,7 +3144,6 @@ 505.IBPluginDependency 506.IBPluginDependency 507.IBPluginDependency - 508.IBEditorWindowLastContentRect 508.IBPluginDependency 509.IBPluginDependency 510.IBPluginDependency @@ -3235,176 +3155,84 @@ 516.IBPluginDependency 517.IBPluginDependency 56.IBPluginDependency - 56.ImportedFromIB2 - 57.IBEditorWindowLastContentRect 57.IBPluginDependency - 57.ImportedFromIB2 - 57.editorWindowContentRectSynchronizationRect 58.IBPluginDependency - 58.ImportedFromIB2 72.IBPluginDependency - 72.ImportedFromIB2 73.IBPluginDependency - 73.ImportedFromIB2 74.IBPluginDependency - 74.ImportedFromIB2 75.IBPluginDependency - 75.ImportedFromIB2 77.IBPluginDependency - 77.ImportedFromIB2 78.IBPluginDependency - 78.ImportedFromIB2 79.IBPluginDependency - 79.ImportedFromIB2 80.IBPluginDependency - 80.ImportedFromIB2 - 81.IBEditorWindowLastContentRect 81.IBPluginDependency - 81.ImportedFromIB2 - 81.editorWindowContentRectSynchronizationRect 82.IBPluginDependency - 82.ImportedFromIB2 83.IBPluginDependency - 83.ImportedFromIB2 92.IBPluginDependency - 92.ImportedFromIB2 YES com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - {{522, 812}, {146, 23}} com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - {{436, 809}, {64, 6}} 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.InterfaceBuilder.CocoaPlugin - 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.InterfaceBuilder.CocoaPlugin - - {{753, 187}, {275, 113}} com.apple.InterfaceBuilder.CocoaPlugin - - {{608, 612}, {275, 83}} com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - {{547, 180}, {254, 283}} com.apple.InterfaceBuilder.CocoaPlugin - - {{187, 434}, {243, 243}} 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.InterfaceBuilder.CocoaPlugin - - {{608, 612}, {167, 43}} 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.InterfaceBuilder.CocoaPlugin - - {{753, 217}, {238, 103}} com.apple.InterfaceBuilder.CocoaPlugin - - {{608, 612}, {241, 103}} com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - {{654, 239}, {194, 73}} com.apple.InterfaceBuilder.CocoaPlugin - - {{525, 802}, {197, 73}} - {{689, 796}, {433, 20}} com.apple.InterfaceBuilder.CocoaPlugin - - {74, 862} - {{6, 978}, {478, 20}} com.apple.InterfaceBuilder.CocoaPlugin - {{604, 269}, {231, 43}} com.apple.InterfaceBuilder.CocoaPlugin - {{475, 832}, {234, 43}} com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - {{746, 287}, {220, 133}} com.apple.InterfaceBuilder.CocoaPlugin - - {{608, 612}, {215, 63}} com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - {{591, 420}, {83, 43}} com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - {{523, 2}, {178, 283}} com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -3438,7 +3266,6 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - {{753, 197}, {170, 63}} com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -3451,16 +3278,13 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - {{725, 289}, {246, 23}} com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - {{674, 260}, {204, 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.InterfaceBuilder.CocoaPlugin @@ -3469,7 +3293,6 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - {{878, 180}, {164, 173}} com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -3481,149 +3304,52 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - - {{286, 129}, {275, 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.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - {{788, 593}, {195, 203}} com.apple.InterfaceBuilder.CocoaPlugin - - {{145, 474}, {199, 203}} com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin YES - - YES - + YES - - YES - + - 534 + 535 YES - AtomicityAppDelegate - NSObject + AtomApp + NSApplication IBProjectSource - ../Atomicity/Classes/AtomicityAppDelegate.h - - - - NSObject - - IBProjectSource - JSCocoa/JSCocoaController.h - - - - NSObject - - IBProjectSource - JSCocoa/JSCocoaLib.h - - - - - YES - - NSApplication - NSResponder - - IBFrameworkSource - AppKit.framework/Headers/NSApplication.h - - - - NSApplication - - IBFrameworkSource - AppKit.framework/Headers/NSApplicationScripting.h - - - - NSApplication - - IBFrameworkSource - AppKit.framework/Headers/NSColorPanel.h - - - - NSApplication - - IBFrameworkSource - AppKit.framework/Headers/NSHelpManager.h - - - - NSApplication - - IBFrameworkSource - AppKit.framework/Headers/NSPageLayout.h - - - - NSApplication - - IBFrameworkSource - AppKit.framework/Headers/NSUserInterfaceItemSearching.h - - - - NSBrowser - NSControl - - IBFrameworkSource - AppKit.framework/Headers/NSBrowser.h - - - - NSControl - NSView - - IBFrameworkSource - AppKit.framework/Headers/NSControl.h + ./Classes/AtomApp.h NSDocument - NSObject YES @@ -3685,612 +3411,26 @@ - IBFrameworkSource - AppKit.framework/Headers/NSDocument.h - - - - NSDocument - - IBFrameworkSource - AppKit.framework/Headers/NSDocumentScripting.h - - - - NSDocumentController - NSObject - - YES - - YES - clearRecentDocuments: - newDocument: - openDocument: - saveAllDocuments: - - - YES - id - id - id - id - - - - YES - - YES - clearRecentDocuments: - newDocument: - openDocument: - saveAllDocuments: - - - YES - - clearRecentDocuments: - id - - - newDocument: - id - - - openDocument: - id - - - saveAllDocuments: - id - - - - - IBFrameworkSource - AppKit.framework/Headers/NSDocumentController.h - - - - NSFontManager - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSFontManager.h - - - - NSFormatter - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSFormatter.h - - - - NSMatrix - NSControl - - IBFrameworkSource - AppKit.framework/Headers/NSMatrix.h - - - - NSMenu - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSMenu.h - - - - NSMenuItem - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSMenuItem.h - - - - NSMovieView - NSView - - IBFrameworkSource - AppKit.framework/Headers/NSMovieView.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSAccessibility.h - - - - NSObject - - - - NSObject - - - - NSObject - - - - NSObject - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSDictionaryController.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSDragging.h - - - - NSObject - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSFontPanel.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSKeyValueBinding.h - - - - NSObject - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSNibLoading.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSOutlineView.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSPasteboard.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSSavePanel.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSTableView.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSToolbarItem.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSView.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSArchiver.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSClassDescription.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSError.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSFileManager.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueCoding.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueObserving.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyedArchiver.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSObject.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSObjectScripting.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSPortCoder.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSRunLoop.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSScriptClassDescription.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSScriptKeyValueCoding.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSScriptObjectSpecifiers.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSScriptWhoseTests.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSThread.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURL.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURLConnection.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURLDownload.h - - - - NSObject - - IBFrameworkSource - WebKit.framework/Headers/WebDownload.h - - - - NSObject - - IBFrameworkSource - WebKit.framework/Headers/WebEditingDelegate.h - - - - NSObject - - IBFrameworkSource - WebKit.framework/Headers/WebFrameLoadDelegate.h - - - - NSObject - - IBFrameworkSource - WebKit.framework/Headers/WebJavaPlugIn.h - - - - NSObject - - IBFrameworkSource - WebKit.framework/Headers/WebPlugin.h - - - - NSObject - - IBFrameworkSource - WebKit.framework/Headers/WebPluginContainer.h - - - - NSObject - - IBFrameworkSource - WebKit.framework/Headers/WebPolicyDelegate.h - - - - NSObject - - IBFrameworkSource - WebKit.framework/Headers/WebResourceLoadDelegate.h - - - - NSObject - - IBFrameworkSource - WebKit.framework/Headers/WebScriptObject.h - - - - NSObject - - IBFrameworkSource - WebKit.framework/Headers/WebUIDelegate.h - - - - NSResponder - - IBFrameworkSource - AppKit.framework/Headers/NSInterfaceStyle.h - - - - NSResponder - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSResponder.h - - - - NSTableView - NSControl - - - - NSText - NSView - - IBFrameworkSource - AppKit.framework/Headers/NSText.h - - - - NSTextView - NSText - - IBFrameworkSource - AppKit.framework/Headers/NSTextView.h - - - - NSView - - IBFrameworkSource - AppKit.framework/Headers/NSClipView.h - - - - NSView - - - - NSView - - IBFrameworkSource - AppKit.framework/Headers/NSRulerView.h - - - - NSView - NSResponder - - - - NSWindow - - IBFrameworkSource - AppKit.framework/Headers/NSDrawer.h - - - - NSWindow - NSResponder - - IBFrameworkSource - AppKit.framework/Headers/NSWindow.h - - - - NSWindow - - IBFrameworkSource - AppKit.framework/Headers/NSWindowScripting.h + IBProjectSource + ./Classes/NSDocument.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 - + reloadFromOrigin: + 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 - + reloadFromOrigin: + + reloadFromOrigin: + id - IBFrameworkSource - WebKit.framework/Headers/WebView.h + IBProjectSource + ./Classes/WebView.h @@ -4306,7 +3446,6 @@ YES - ../Atomicity.xcodeproj 3 YES From a8625f30560ad755d9ff7c983937f7aa62e49780 Mon Sep 17 00:00:00 2001 From: Corey Johnson Date: Sun, 4 Sep 2011 18:13:49 -0700 Subject: [PATCH 2/7] No longer bootstrap path --- Cocoa/Classes/AtomWindowController.m | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Cocoa/Classes/AtomWindowController.m b/Cocoa/Classes/AtomWindowController.m index bc83ead2f..4c7ef4ab4 100644 --- a/Cocoa/Classes/AtomWindowController.m +++ b/Cocoa/Classes/AtomWindowController.m @@ -32,11 +32,12 @@ [webView setMainFrameURL:self.URL]; } else { - NSString *resourcePath = [[NSBundle mainBundle] resourcePath]; - NSString *bootstrapPath = [resourcePath stringByAppendingString:@"/src/require.js"]; JSCocoa* jsc = [[JSCocoa alloc] initWithGlobalContext:[[webView mainFrame] globalContext]]; [jsc setObject:self withName:@"WindowController"]; - [jsc evalJSFile:bootstrapPath]; + + NSString *resourcePath = [[NSBundle mainBundle] resourcePath]; + NSString *requirePath = [resourcePath stringByAppendingString:@"/src/require.js"]; + [jsc evalJSFile:requirePath]; NSURL *resourceURL = [[NSBundle mainBundle] resourceURL]; NSURL *htmlURL = [resourceURL URLByAppendingPathComponent:@"static"]; From 819ec44e989bf5bda46d33fa452be051de74eaff Mon Sep 17 00:00:00 2001 From: Corey Johnson Date: Sun, 4 Sep 2011 18:14:34 -0700 Subject: [PATCH 3/7] me too --- src/require.coffee | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/require.coffee b/src/require.coffee index c93c61ef2..6592b3349 100644 --- a/src/require.coffee +++ b/src/require.coffee @@ -4,6 +4,9 @@ paths = [ "/Users/chris/Code/Atomicity/src", "/Users/chris/Code/Atomicity/plugins", + "/Users/corey/code/mine/Atomicity/src", + "/Users/corey/code/mine/Atomicity/plugins", + "#{resourcePath}/src", "#{resourcePath}/plugins", "#{resourcePath}/vendor" From 094434776d9cfa7dcb48e7eb9acef512567ffd16 Mon Sep 17 00:00:00 2001 From: Corey Johnson Date: Sun, 4 Sep 2011 18:16:46 -0700 Subject: [PATCH 4/7] whitespace and Xcode project cleanup --- Cocoa/Atomicity.xcodeproj/project.pbxproj | 12 ++++++------ Cocoa/{ => Classes}/AtomApp.h | 0 Cocoa/{ => Classes}/AtomApp.m | 10 +++++----- Cocoa/Classes/AtomWindowController.m | 11 +++++------ 4 files changed, 16 insertions(+), 17 deletions(-) rename Cocoa/{ => Classes}/AtomApp.h (100%) rename Cocoa/{ => Classes}/AtomApp.m (92%) diff --git a/Cocoa/Atomicity.xcodeproj/project.pbxproj b/Cocoa/Atomicity.xcodeproj/project.pbxproj index e7c13b1ec..d5b0755f4 100644 --- a/Cocoa/Atomicity.xcodeproj/project.pbxproj +++ b/Cocoa/Atomicity.xcodeproj/project.pbxproj @@ -7,7 +7,7 @@ objects = { /* Begin PBXBuildFile section */ - 04C8F31614144CC00041D072 /* AtomApp.m in Sources */ = {isa = PBXBuildFile; fileRef = 04C8F31514144CC00041D072 /* AtomApp.m */; }; + 046973A414145A9500415518 /* AtomApp.m in Sources */ = {isa = PBXBuildFile; fileRef = 046973A314145A9500415518 /* AtomApp.m */; }; 83599F9B13FE0F8400AC37E3 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 83599F9A13FE0F8400AC37E3 /* WebKit.framework */; }; 8359A6EE13FE26DA00AC37E3 /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8359A6ED13FE26DA00AC37E3 /* JavaScriptCore.framework */; }; 837D8BA91408FAAA009B6DFA /* AtomWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 837D8BA71408FAAA009B6DFA /* AtomWindowController.m */; }; @@ -28,8 +28,8 @@ /* End PBXBuildFile section */ /* Begin PBXFileReference section */ - 04C8F31414144CC00041D072 /* AtomApp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AtomApp.h; sourceTree = ""; }; - 04C8F31514144CC00041D072 /* AtomApp.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AtomApp.m; sourceTree = ""; }; + 046973A214145A9500415518 /* AtomApp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AtomApp.h; path = Classes/AtomApp.h; sourceTree = ""; }; + 046973A314145A9500415518 /* AtomApp.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AtomApp.m; path = Classes/AtomApp.m; sourceTree = ""; }; 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; 13E42FB307B3F0F600E4EEF1 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = ""; }; 29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; @@ -80,8 +80,8 @@ 080E96DDFE201D6D7F000001 /* Classes */ = { isa = PBXGroup; children = ( - 04C8F31414144CC00041D072 /* AtomApp.h */, - 04C8F31514144CC00041D072 /* AtomApp.m */, + 046973A214145A9500415518 /* AtomApp.h */, + 046973A314145A9500415518 /* AtomApp.m */, 837D8BA61408FAAA009B6DFA /* AtomWindowController.h */, 837D8BA71408FAAA009B6DFA /* AtomWindowController.m */, 29B97315FDCFA39411CA2CEA /* Other Sources */, @@ -275,7 +275,7 @@ 837D8BD91408FAD4009B6DFA /* JSCocoaFFIClosure.m in Sources */, 837D8BDA1408FAD4009B6DFA /* JSCocoaLib.m in Sources */, 837D8BDB1408FAD4009B6DFA /* JSCocoaPrivateObject.m in Sources */, - 04C8F31614144CC00041D072 /* AtomApp.m in Sources */, + 046973A414145A9500415518 /* AtomApp.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Cocoa/AtomApp.h b/Cocoa/Classes/AtomApp.h similarity index 100% rename from Cocoa/AtomApp.h rename to Cocoa/Classes/AtomApp.h diff --git a/Cocoa/AtomApp.m b/Cocoa/Classes/AtomApp.m similarity index 92% rename from Cocoa/AtomApp.m rename to Cocoa/Classes/AtomApp.m index 9d9220294..b332dbfd8 100644 --- a/Cocoa/AtomApp.m +++ b/Cocoa/Classes/AtomApp.m @@ -5,8 +5,8 @@ @implementation AtomApp - (void)sendEvent:(NSEvent *)event { - switch ([event type]) { - case NSKeyDown: + switch ([event type]) { + case NSKeyDown: case NSFlagsChanged: { AtomWindowController *controller = (AtomWindowController *)[[self keyWindow] windowController]; BOOL handeled = [controller handleKeyEvent:event]; @@ -14,10 +14,10 @@ [super sendEvent:event]; } } - default: + default: [super sendEvent:event]; - break; - } + break; + } } // AppDelegate diff --git a/Cocoa/Classes/AtomWindowController.m b/Cocoa/Classes/AtomWindowController.m index 4c7ef4ab4..6926ab9b1 100644 --- a/Cocoa/Classes/AtomWindowController.m +++ b/Cocoa/Classes/AtomWindowController.m @@ -23,18 +23,18 @@ - (void)windowDidLoad { [super windowDidLoad]; - + [self setShouldCascadeWindows:YES]; [self setWindowFrameAutosaveName:@"atomWindow"]; - + if (self.URL) { [webView setMainFrameURL:self.URL]; - } + } else { JSCocoa* jsc = [[JSCocoa alloc] initWithGlobalContext:[[webView mainFrame] globalContext]]; [jsc setObject:self withName:@"WindowController"]; - + NSString *resourcePath = [[NSBundle mainBundle] resourcePath]; NSString *requirePath = [resourcePath stringByAppendingString:@"/src/require.js"]; [jsc evalJSFile:requirePath]; @@ -43,7 +43,7 @@ NSURL *htmlURL = [resourceURL URLByAppendingPathComponent:@"static"]; NSURL *indexURL = [htmlURL URLByAppendingPathComponent:@"index.html"]; NSString *html = [NSString stringWithContentsOfURL:indexURL encoding:NSUTF8StringEncoding error:nil]; - [[webView mainFrame] loadHTMLString:html baseURL:htmlURL]; + [[webView mainFrame] loadHTMLString:html baseURL:htmlURL]; } } @@ -51,5 +51,4 @@ return NO; } - @end From e79d1eb752234eda665716256305b493b92daab9 Mon Sep 17 00:00:00 2001 From: Corey Johnson Date: Mon, 5 Sep 2011 10:26:30 -0700 Subject: [PATCH 5/7] add the break to the switch --- Cocoa/Classes/AtomApp.m | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Cocoa/Classes/AtomApp.m b/Cocoa/Classes/AtomApp.m index b332dbfd8..e74e8d6a9 100644 --- a/Cocoa/Classes/AtomApp.m +++ b/Cocoa/Classes/AtomApp.m @@ -7,13 +7,15 @@ - (void)sendEvent:(NSEvent *)event { switch ([event type]) { case NSKeyDown: - case NSFlagsChanged: { - AtomWindowController *controller = (AtomWindowController *)[[self keyWindow] windowController]; - BOOL handeled = [controller handleKeyEvent:event]; - if (!handeled) { - [super sendEvent:event]; + case NSFlagsChanged: + { + AtomWindowController *controller = (AtomWindowController *)[[self keyWindow] windowController]; + BOOL handeled = [controller handleKeyEvent:event]; + if (!handeled) { + [super sendEvent:event]; + } } - } + break; default: [super sendEvent:event]; break; From df24e48c63f52c7905346ecbb1d70488c86eb922 Mon Sep 17 00:00:00 2001 From: Corey Johnson Date: Mon, 5 Sep 2011 10:26:51 -0700 Subject: [PATCH 6/7] remember the jscocoa instance! --- Cocoa/Classes/AtomWindowController.h | 3 +++ Cocoa/Classes/AtomWindowController.m | 10 ++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Cocoa/Classes/AtomWindowController.h b/Cocoa/Classes/AtomWindowController.h index 9867839bf..238d07f6c 100644 --- a/Cocoa/Classes/AtomWindowController.h +++ b/Cocoa/Classes/AtomWindowController.h @@ -8,9 +8,12 @@ #import +@class JSCocoa; + @interface AtomWindowController : NSWindowController { IBOutlet id webView; NSString *URL; + JSCocoa* jscocoa; } @property (assign) IBOutlet id webView; diff --git a/Cocoa/Classes/AtomWindowController.m b/Cocoa/Classes/AtomWindowController.m index 6926ab9b1..1efb70362 100644 --- a/Cocoa/Classes/AtomWindowController.m +++ b/Cocoa/Classes/AtomWindowController.m @@ -32,12 +32,12 @@ [webView setMainFrameURL:self.URL]; } else { - JSCocoa* jsc = [[JSCocoa alloc] initWithGlobalContext:[[webView mainFrame] globalContext]]; - [jsc setObject:self withName:@"WindowController"]; + jscocoa = [[JSCocoa alloc] initWithGlobalContext:[[webView mainFrame] globalContext]]; + [jscocoa setObject:self withName:@"WindowController"]; NSString *resourcePath = [[NSBundle mainBundle] resourcePath]; NSString *requirePath = [resourcePath stringByAppendingString:@"/src/require.js"]; - [jsc evalJSFile:requirePath]; + [jscocoa evalJSFile:requirePath]; NSURL *resourceURL = [[NSBundle mainBundle] resourceURL]; NSURL *htmlURL = [resourceURL URLByAppendingPathComponent:@"static"]; @@ -48,7 +48,9 @@ } -(BOOL) handleKeyEvent:(NSEvent *)event { - return NO; + // ICKY: Using a global function defined in App.js to deal with key events + JSValueRef returnValue = [jscocoa callJSFunctionNamed:@"handleKeyEvent" withArguments:event, nil]; + return [jscocoa toBool:returnValue]; } @end From 18df46bbde334ec33815911d39fecd231c9f6879 Mon Sep 17 00:00:00 2001 From: Corey Johnson Date: Mon, 5 Sep 2011 10:27:07 -0700 Subject: [PATCH 7/7] eat the key bindings we want. --- src/startup.coffee | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/startup.coffee b/src/startup.coffee index 336a4c129..527d3465e 100644 --- a/src/startup.coffee +++ b/src/startup.coffee @@ -2,5 +2,16 @@ App = require 'app' Window = require 'window' App.setActiveWindow new Window controller: WindowController +window.handleKeyEvent = (event) -> + if event.keyCode == 50 + console.log("Got `") + true + else if (event.modifierFlags & OSX.NSCommandKeyMask) and event.keyCode == 12 # cmd and q pushed + console.log("Cmd-Q") + true + else + console.log(event.keyCode) + false + require 'editor' -require 'plugins' \ No newline at end of file +require 'plugins'