Window reloading is handled completely by objective-c now.

This should be a never-do-this-again thing. It's just so we can reload when the app crashes instead of having to use Xcode.
This commit is contained in:
Corey Johnson
2011-11-29 10:58:34 -05:00
parent 2de76e35f1
commit 55e0f72aa2
4 changed files with 18 additions and 19 deletions

View File

@@ -50,21 +50,28 @@
// Overridden
- (void)sendEvent:(NSEvent *)event {
if ([event type] == NSKeyDown) {
BOOL handeled = NO;
AtomController *controller = [[self keyWindow] windowController];
// The keyWindow could be a Cocoa Dialog or something, ignore those.
if ([controller isKindOfClass:[AtomController class]]) {
if ([event type] != NSKeyDown) {
[super sendEvent:event];
return;
}
BOOL handeled = NO;
AtomController *controller = [[self keyWindow] windowController];
// The keyWindow could be a Cocoa Dialog or something, ignore those.
if ([controller isKindOfClass:[AtomController class]]) {
// cmd-r should always reload the current controller, so it needs to be here
if ([event modifierFlags] & NSCommandKeyMask && [[event charactersIgnoringModifiers] hasPrefix:@"r"]) {
[self reloadController:controller];
handeled = YES;
}
else {
JSValueRef value = [controller.jscocoa callJSFunctionNamed:@"handleKeyEvent" withArguments:event, nil];
handeled = [controller.jscocoa toBool:value];
}
if (!handeled) [super sendEvent:event];
}
else {
[super sendEvent:event];
}
if (!handeled) [super sendEvent:event];
}
- (void)terminate:(id)sender {

View File

@@ -49,10 +49,6 @@
[[webView mainFrame] loadRequest:request];
}
- (void)reload {
[(AtomApp *)NSApp reloadController:self];
}
// WebUIDelegate
- (NSArray *)webView:(WebView *)sender contextMenuItemsForElement:(NSDictionary *)element defaultMenuItems:(NSArray *)defaultMenuItems {
return defaultMenuItems;

View File

@@ -4,7 +4,6 @@ app:
window:
'cmd-shift-I': (window) -> window.showConsole()
'cmd-r': (window) -> window.reload()
'cmd-w': (window) -> window.close()
'cmd-o': (window) -> window.open()
'cmd-O': (window) -> window.open window.prompt "Open URL:"

View File

@@ -24,9 +24,6 @@ windowAdditions =
setTitle: (title) ->
$atomController.window.title = title
reload: ->
$atomController.reload
open: (url) ->
url = atom.native.openPanel() unless url
(@resource.open url) or atom.app.open url