From fcce52b8abfa042c49ca7a083f58f9eb26f9e349 Mon Sep 17 00:00:00 2001 From: Chris Wanstrath Date: Mon, 22 Aug 2011 23:33:52 -0700 Subject: [PATCH] window controller for Command+N --- AtomWindow.xib | 843 ++++++++++++++++++++++++++++ AtomWindowController.h | 18 + AtomWindowController.m | 33 ++ Atomicity.xcodeproj/project.pbxproj | 10 + AtomicityAppDelegate.h | 5 - AtomicityAppDelegate.m | 16 +- English.lproj/MainMenu.xib | 177 +----- HTML/atomicity.coffee | 10 +- HTML/osx.coffee | 20 +- 9 files changed, 921 insertions(+), 211 deletions(-) create mode 100644 AtomWindow.xib create mode 100644 AtomWindowController.h create mode 100644 AtomWindowController.m diff --git a/AtomWindow.xib b/AtomWindow.xib new file mode 100644 index 000000000..be0496077 --- /dev/null +++ b/AtomWindow.xib @@ -0,0 +1,843 @@ + + + + 1060 + 10J869 + 851 + 1038.35 + 461.00 + + YES + + YES + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.WebKitIBPlugin + + + YES + 851 + 851 + + + + YES + + + + YES + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.WebKitIBPlugin + + + YES + + YES + + + YES + + + + YES + + AtomWindowController + + + FirstResponder + + + NSApplication + + + 15 + 2 + {{288, 20}, {725, 723}} + 1954021376 + untitled + NSWindow + + {1.79769e+308, 1.79769e+308} + + + 256 + + YES + + + 274 + + YES + + YES + Apple HTML pasteboard type + Apple PDF pasteboard type + Apple PICT pasteboard type + Apple URL pasteboard type + Apple Web Archive pasteboard type + NSColor pasteboard type + NSFilenamesPboardType + NSStringPboardType + NeXT RTFD pasteboard type + NeXT Rich Text Format v1.0 pasteboard type + NeXT TIFF v4.0 pasteboard type + WebURLsWithTitlesPboardType + public.png + public.url + public.url-name + + + {725, 723} + + + + + + + + YES + + YES + WebKitDefaultFixedFontSize + WebKitDefaultFontSize + WebKitMinimumFontSize + + + YES + + + + + + + YES + YES + + + {725, 723} + + + {{0, 0}, {1440, 878}} + {1.79769e+308, 1.79769e+308} + Atomicity + + + + + YES + + + webView + + + + 6 + + + + + YES + + 0 + + + + + + -2 + + + File's Owner + + + -1 + + + First Responder + + + -3 + + + Application + + + 3 + + + YES + + + + + + 4 + + + YES + + + + + + 5 + + + + + + + YES + + YES + 3.IBEditorWindowLastContentRect + 3.IBPluginDependency + 3.IBWindowTemplateEditedContentRect + 3.NSWindowTemplate.visibleAtLaunch + 3.editorWindowContentRectSynchronizationRect + 3.windowTemplate.maxSize + 4.IBPluginDependency + 5.IBPluginDependency + 5.IBViewBoundsToFrameTransform + + + YES + {{324, 121}, {725, 723}} + com.apple.InterfaceBuilder.CocoaPlugin + {{324, 121}, {725, 723}} + + {{33, 99}, {480, 360}} + {3.40282e+38, 3.40282e+38} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.WebKitIBPlugin + + AcNUAABDpoAAA + + + + + YES + + + YES + + + + + YES + + + YES + + + + 6 + + + + YES + + AtomWindowController + NSWindowController + + webView + id + + + webView + + webView + id + + + + IBProjectSource + AtomWindowController.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 + + + + NSMenu + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSMenu.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSAccessibility.h + + + + NSObject + + + + NSObject + + + + NSObject + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSControl.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSDictionaryController.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSDragging.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSFontManager.h + + + + 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 + + + + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSClipView.h + + + + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSMenuItem.h + + + + 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 + + + + NSWindowController + NSResponder + + showWindow: + id + + + showWindow: + + showWindow: + id + + + + IBFrameworkSource + AppKit.framework/Headers/NSWindowController.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 + + + + 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 + + + + + IBFrameworkSource + WebKit.framework/Headers/WebView.h + + + + + 0 + IBCocoaFramework + + com.apple.InterfaceBuilder.CocoaPlugin.macosx + + + + com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3 + + + YES + Atomicity.xcodeproj + 3 + + diff --git a/AtomWindowController.h b/AtomWindowController.h new file mode 100644 index 000000000..aebb35236 --- /dev/null +++ b/AtomWindowController.h @@ -0,0 +1,18 @@ +// +// AtomWindowController.h +// Atomicity +// +// Created by Chris Wanstrath on 8/22/11. +// Copyright 2011 GitHub. All rights reserved. +// + +#import + + +@interface AtomWindowController : NSWindowController { + IBOutlet id webView; +} + +@property (assign) IBOutlet id webView; + +@end diff --git a/AtomWindowController.m b/AtomWindowController.m new file mode 100644 index 000000000..ab2890b9e --- /dev/null +++ b/AtomWindowController.m @@ -0,0 +1,33 @@ +// +// AtomWindowController.m +// Atomicity +// +// Created by Chris Wanstrath on 8/22/11. +// Copyright 2011 GitHub. All rights reserved. +// + +#import "AtomWindowController.h" + +#import +#import "JSCocoa.h" + +@implementation AtomWindowController + +@synthesize webView; + +- (void)windowDidLoad { + [super windowDidLoad]; + + [self setShouldCascadeWindows:NO]; + [self setWindowFrameAutosaveName:@"atomWindow"]; + + id path = [[NSBundle mainBundle] URLForResource:@"index" withExtension:@"html"]; + id html = [[NSString alloc] initWithContentsOfURL:path]; + [[webView mainFrame] loadHTMLString:html baseURL:[[NSBundle mainBundle] resourceURL]]; + + // https://github.com/parmanoir/jscocoa#readme + JSCocoa* jsc = [[JSCocoa alloc] initWithGlobalContext:[[webView mainFrame] globalContext]]; + [jsc setObject:self withName:@"App"]; +} + +@end diff --git a/Atomicity.xcodeproj/project.pbxproj b/Atomicity.xcodeproj/project.pbxproj index 0012772a9..e4d1226c2 100644 --- a/Atomicity.xcodeproj/project.pbxproj +++ b/Atomicity.xcodeproj/project.pbxproj @@ -9,6 +9,7 @@ /* Begin PBXBuildFile section */ 1DDD58160DA1D0A300B32029 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1DDD58140DA1D0A300B32029 /* MainMenu.xib */; }; 256AC3DA0F4B6AC300CF3369 /* AtomicityAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 256AC3D90F4B6AC300CF3369 /* AtomicityAppDelegate.m */; }; + 831162FC14036C33004532EB /* AtomWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 831162FB14036C33004532EB /* AtomWindow.xib */; }; 832BA38413FE674C00516BD7 /* APPL.icns in Resources */ = {isa = PBXBuildFile; fileRef = 832BA38313FE674C00516BD7 /* APPL.icns */; }; 83599F9B13FE0F8400AC37E3 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 83599F9A13FE0F8400AC37E3 /* WebKit.framework */; }; 83599FEE13FE15F800AC37E3 /* index.html in Resources */ = {isa = PBXBuildFile; fileRef = 83599FED13FE15F800AC37E3 /* index.html */; }; @@ -55,6 +56,7 @@ 8359A73213FE270F00AC37E3 /* JSCocoaLib.m in Sources */ = {isa = PBXBuildFile; fileRef = 8359A71E13FE270F00AC37E3 /* JSCocoaLib.m */; }; 8359A73313FE270F00AC37E3 /* JSCocoaPrivateObject.m in Sources */ = {isa = PBXBuildFile; fileRef = 8359A72013FE270F00AC37E3 /* JSCocoaPrivateObject.m */; }; 8393431313FE39E100EF93FB /* underscore.js in Resources */ = {isa = PBXBuildFile; fileRef = 8393431113FE39D800EF93FB /* underscore.js */; }; + 83E83D94140374480043D7EA /* AtomWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 83E83D93140374480043D7EA /* AtomWindowController.m */; }; 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; }; 8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; }; 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; }; @@ -71,6 +73,7 @@ 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; 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 = ""; }; + 831162FB14036C33004532EB /* AtomWindow.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = AtomWindow.xib; sourceTree = ""; }; 832BA38313FE674C00516BD7 /* APPL.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = APPL.icns; sourceTree = ""; }; 83599F9A13FE0F8400AC37E3 /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; }; 83599FED13FE15F800AC37E3 /* index.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = index.html; path = HTML/index.html; sourceTree = ""; }; @@ -126,6 +129,8 @@ 8359A72013FE270F00AC37E3 /* JSCocoaPrivateObject.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSCocoaPrivateObject.m; sourceTree = ""; }; 8359A72113FE270F00AC37E3 /* jslint-jscocoa.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = "jslint-jscocoa.js"; sourceTree = ""; }; 8393431113FE39D800EF93FB /* underscore.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; name = underscore.js; path = HTML/underscore.js; sourceTree = ""; }; + 83E83D92140374480043D7EA /* AtomWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AtomWindowController.h; sourceTree = ""; }; + 83E83D93140374480043D7EA /* AtomWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AtomWindowController.m; sourceTree = ""; }; 8D1107310486CEB800E47090 /* Atomicity-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "Atomicity-Info.plist"; sourceTree = ""; }; 8D1107320486CEB800E47090 /* Atomicity.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Atomicity.app; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ @@ -149,6 +154,8 @@ children = ( 256AC3D80F4B6AC300CF3369 /* AtomicityAppDelegate.h */, 256AC3D90F4B6AC300CF3369 /* AtomicityAppDelegate.m */, + 83E83D92140374480043D7EA /* AtomWindowController.h */, + 83E83D93140374480043D7EA /* AtomWindowController.m */, ); name = Classes; sourceTree = ""; @@ -211,6 +218,7 @@ 8D1107310486CEB800E47090 /* Atomicity-Info.plist */, 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */, 1DDD58140DA1D0A300B32029 /* MainMenu.xib */, + 831162FB14036C33004532EB /* AtomWindow.xib */, ); name = Resources; sourceTree = ""; @@ -389,6 +397,7 @@ 8359A69113FE1FE900AC37E3 /* worker-css.js in Resources */, 8359A69213FE1FE900AC37E3 /* worker-javascript.js in Resources */, 832BA38413FE674C00516BD7 /* APPL.icns in Resources */, + 831162FC14036C33004532EB /* AtomWindow.xib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -425,6 +434,7 @@ 8359A73113FE270F00AC37E3 /* JSCocoaFFIClosure.m in Sources */, 8359A73213FE270F00AC37E3 /* JSCocoaLib.m in Sources */, 8359A73313FE270F00AC37E3 /* JSCocoaPrivateObject.m in Sources */, + 83E83D94140374480043D7EA /* AtomWindowController.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/AtomicityAppDelegate.h b/AtomicityAppDelegate.h index 375e8d6df..9893feed5 100644 --- a/AtomicityAppDelegate.h +++ b/AtomicityAppDelegate.h @@ -9,11 +9,6 @@ #import @interface AtomicityAppDelegate : NSObject { - IBOutlet id webView; - NSWindow *window; } -@property (assign) IBOutlet id webView; -@property (assign) IBOutlet NSWindow *window; - @end diff --git a/AtomicityAppDelegate.m b/AtomicityAppDelegate.m index ca5e6507b..7328aeb63 100644 --- a/AtomicityAppDelegate.m +++ b/AtomicityAppDelegate.m @@ -7,14 +7,10 @@ // #import "AtomicityAppDelegate.h" - -#import -#import "JSCocoa.h" +#import "AtomWindowController.h" @implementation AtomicityAppDelegate -@synthesize window, webView; - - (void)applicationWillFinishLaunching:(NSNotification *)aNotification { NSDictionary *defaults = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithBool:YES], @"WebKitDeveloperExtras", @@ -23,14 +19,8 @@ } - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { - id path = [[NSBundle mainBundle] URLForResource:@"index" withExtension:@"html"]; - id html = [[NSString alloc] initWithContentsOfURL:path]; - - [[webView mainFrame] loadHTMLString:html baseURL:[[NSBundle mainBundle] resourceURL]]; - - // https://github.com/parmanoir/jscocoa#readme - JSCocoa* jsc = [[JSCocoa alloc] initWithGlobalContext:[[webView mainFrame] globalContext]]; - [jsc setObject:self withName:@"App"]; + AtomWindowController* ctrl = [[AtomWindowController alloc] initWithWindowNibName:@"AtomWindow"]; + [ctrl window]; } @end diff --git a/English.lproj/MainMenu.xib b/English.lproj/MainMenu.xib index 11ba8cdd7..8815a66d7 100644 --- a/English.lproj/MainMenu.xib +++ b/English.lproj/MainMenu.xib @@ -7,27 +7,16 @@ 1038.35 461.00 - YES - - YES - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.WebKitIBPlugin - - - YES - 851 - 851 - + com.apple.InterfaceBuilder.CocoaPlugin + 851 YES - YES com.apple.InterfaceBuilder.CocoaPlugin - com.apple.WebKitIBPlugin PluginDependencyRecalculationVersion @@ -1320,77 +1309,6 @@ _NSMainMenu - - 15 - 2 - {{277, 165}, {861, 602}} - 1954021376 - Atomicity - NSWindow - - {1.79769e+308, 1.79769e+308} - - - 256 - - YES - - - 274 - - YES - - YES - Apple HTML pasteboard type - Apple PDF pasteboard type - Apple PICT pasteboard type - Apple URL pasteboard type - Apple Web Archive pasteboard type - NSColor pasteboard type - NSFilenamesPboardType - NSStringPboardType - NeXT RTFD pasteboard type - NeXT Rich Text Format v1.0 pasteboard type - NeXT TIFF v4.0 pasteboard type - WebURLsWithTitlesPboardType - public.png - public.url - public.url-name - - - {861, 602} - - - - - - - - YES - - YES - WebKitDefaultFixedFontSize - WebKitDefaultFontSize - WebKitMinimumFontSize - - - YES - - - - - - - YES - YES - - - {861, 602} - - - {{0, 0}, {1440, 878}} - {1.79769e+308, 1.79769e+308} - AtomicityAppDelegate @@ -2073,22 +1991,6 @@ 530 - - - window - - - - 532 - - - - webView - - - - 534 - @@ -2632,24 +2534,6 @@ - - 371 - - - YES - - - - - - 372 - - - YES - - - - 375 @@ -3136,11 +3020,6 @@ - - 533 - - - @@ -3276,13 +3155,6 @@ 351.ImportedFromIB2 354.IBPluginDependency 354.ImportedFromIB2 - 371.IBEditorWindowLastContentRect - 371.IBPluginDependency - 371.IBWindowTemplateEditedContentRect - 371.NSWindowTemplate.visibleAtLaunch - 371.editorWindowContentRectSynchronizationRect - 371.windowTemplate.maxSize - 372.IBPluginDependency 375.IBPluginDependency 376.IBEditorWindowLastContentRect 376.IBPluginDependency @@ -3363,8 +3235,6 @@ 515.IBPluginDependency 516.IBPluginDependency 517.IBPluginDependency - 533.IBPluginDependency - 533.IBViewBoundsToFrameTransform 56.IBPluginDependency 56.ImportedFromIB2 57.IBEditorWindowLastContentRect @@ -3531,13 +3401,6 @@ com.apple.InterfaceBuilder.CocoaPlugin - {{336, 206}, {861, 602}} - com.apple.InterfaceBuilder.CocoaPlugin - {{336, 206}, {861, 602}} - - {{33, 99}, {480, 360}} - {3.40282e+38, 3.40282e+38} - com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin {{591, 420}, {83, 43}} com.apple.InterfaceBuilder.CocoaPlugin @@ -3618,10 +3481,6 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - com.apple.WebKitIBPlugin - - AULkAABDKwAAA - com.apple.InterfaceBuilder.CocoaPlugin {{286, 129}, {275, 183}} @@ -3682,38 +3541,6 @@ AtomicityAppDelegate NSObject - - YES - - YES - webView - window - - - YES - id - NSWindow - - - - YES - - YES - webView - window - - - YES - - webView - id - - - window - NSWindow - - - IBProjectSource AtomicityAppDelegate.h diff --git a/HTML/atomicity.coffee b/HTML/atomicity.coffee index 428ea6505..9d6c39797 100644 --- a/HTML/atomicity.coffee +++ b/HTML/atomicity.coffee @@ -32,8 +32,11 @@ saveAs = -> Chrome.bindKey 'open', 'Command-O', (env, args, request) -> if file = Chrome.openPanel() - filename = file - open() + if filename + Chrome.createWindow file + else + filename = file + open() Chrome.bindKey 'saveAs', 'Command-Shift-S', (env, args, request) -> saveAs() @@ -41,6 +44,9 @@ Chrome.bindKey 'saveAs', 'Command-Shift-S', (env, args, request) -> Chrome.bindKey 'save', 'Command-S', (env, args, request) -> if filename then save() else saveAs() +Chrome.bindKey 'new', 'Command-N', (env, args, request) -> + Chrome.createWindow() + Chrome.bindKey 'copy', 'Command-C', (env, args, request) -> text = editor.getSession().doc.getTextRange editor.getSelectionRange() Chrome.writeToPasteboard text diff --git a/HTML/osx.coffee b/HTML/osx.coffee index 857196d14..6e22c9cb9 100644 --- a/HTML/osx.coffee +++ b/HTML/osx.coffee @@ -1,5 +1,6 @@ # This is the CoffeeScript API that wraps all of Cocoa. +# leak canon = require 'pilot/canon' # Handles the UI chrome @@ -9,21 +10,8 @@ Chrome = # path - Optional. The String path to the file to base it on. createWindow: (path) -> - activeWindow = Chrome.activeWindow() - frame = activeWindow.frame - styleMask = OSX.NSBorderlessWindowMask - backing = OSX.NSBackingStoreBuffered - window = OSX.NSWindow.alloc. - initWithContentRect_styleMask_backing_defer_screen( - frame, - styleMask, - backing, - false, - activeWindow.screen) - - window.setContentView activeWindow.contentView - window.makeFirstResponder null - window.makeKeyAndOrderFront null + c = OSX.AtomWindowController.alloc.initWithWindowNibName "AtomWindow" + c.window # Set the active window's dirty status. setDirty: (bool) -> @@ -74,7 +62,7 @@ Chrome = sender: 'editor' title: (text) -> - App.window.title = text +# App.title = text toggleFullscreen: -> if Chrome.fullscreen?