diff --git a/nvox.xcodeproj/project.pbxproj b/nvox.xcodeproj/project.pbxproj index 1a0b067c..63148ce9 100644 --- a/nvox.xcodeproj/project.pbxproj +++ b/nvox.xcodeproj/project.pbxproj @@ -31,6 +31,7 @@ 4B570DC21D303CAF006EDC21 /* NeoVimAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B570DC01D303CAF006EDC21 /* NeoVimAgent.h */; settings = {ATTRIBUTES = (Public, ); }; }; 4B570DC31D303CAF006EDC21 /* NeoVimAgent.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B570DC11D303CAF006EDC21 /* NeoVimAgent.m */; }; 4B854A1D1D31447C00E08DE1 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B854A1C1D31447C00E08DE1 /* main.m */; }; + 4B97E2CC1D33F53D00FC0660 /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4B97E2CE1D33F53D00FC0660 /* MainWindow.xib */; }; 4B9A15241D2993DA009F9F67 /* Nimble.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 4B56F29B1D29926600C1F92E /* Nimble.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 4B9A15251D2993DA009F9F67 /* Quick.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 4B56F29C1D29926600C1F92E /* Quick.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 4B9A15261D2993DF009F9F67 /* SwiftNeoVim.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 4B2A2BF71D0351810074CE9A /* SwiftNeoVim.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; @@ -179,6 +180,7 @@ 4B7BD3321D32530900AAA45E /* Logging.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Logging.h; sourceTree = ""; }; 4B854A1A1D31447C00E08DE1 /* NeoVimServer */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = NeoVimServer; sourceTree = BUILT_PRODUCTS_DIR; }; 4B854A1C1D31447C00E08DE1 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + 4B97E2CD1D33F53D00FC0660 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainWindow.xib; sourceTree = ""; }; 4BCADE071D11ED12004DAD0F /* CocoaExtensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CocoaExtensions.swift; sourceTree = ""; }; 4BCF638F1D323CFD00F15CE4 /* nvim */ = {isa = PBXFileReference; lastKnownFileType = folder; name = nvim; path = neovim/src/nvim; sourceTree = SOURCE_ROOT; }; 4BD3BF921D32A95800082605 /* MainWindowController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MainWindowController.swift; sourceTree = ""; }; @@ -337,6 +339,17 @@ path = NeoVimServer; sourceTree = ""; }; + 4B97E2CF1D33F92200FC0660 /* resources */ = { + isa = PBXGroup; + children = ( + 4BEBA50C1CFF374B00673FDF /* MainMenu.xib */, + 4B97E2CE1D33F53D00FC0660 /* MainWindow.xib */, + 4BEBA50A1CFF374B00673FDF /* Assets.xcassets */, + 4BEBA50F1CFF374B00673FDF /* Info.plist */, + ); + name = resources; + sourceTree = ""; + }; 4BDCFADC1D3145EA00F62670 /* lib */ = { isa = PBXGroup; children = ( @@ -383,9 +396,7 @@ 4BEBA5081CFF374B00673FDF /* AppDelegate.swift */, 4BD3BF961D32B0DB00082605 /* MainWindowManager.swift */, 4BD3BF921D32A95800082605 /* MainWindowController.swift */, - 4BEBA50A1CFF374B00673FDF /* Assets.xcassets */, - 4BEBA50C1CFF374B00673FDF /* MainMenu.xib */, - 4BEBA50F1CFF374B00673FDF /* Info.plist */, + 4B97E2CF1D33F92200FC0660 /* resources */, 4B2A2C0D1D0353750074CE9A /* Bridge.h */, ); path = nvox; @@ -602,6 +613,7 @@ files = ( 4BEBA50B1CFF374B00673FDF /* Assets.xcassets in Resources */, 4BEBA50E1CFF374B00673FDF /* MainMenu.xib in Resources */, + 4B97E2CC1D33F53D00FC0660 /* MainWindow.xib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -715,6 +727,14 @@ /* End PBXTargetDependency section */ /* Begin PBXVariantGroup section */ + 4B97E2CE1D33F53D00FC0660 /* MainWindow.xib */ = { + isa = PBXVariantGroup; + children = ( + 4B97E2CD1D33F53D00FC0660 /* Base */, + ); + name = MainWindow.xib; + sourceTree = ""; + }; 4BEBA50C1CFF374B00673FDF /* MainMenu.xib */ = { isa = PBXVariantGroup; children = ( diff --git a/nvox/Base.lproj/MainMenu.xib b/nvox/Base.lproj/MainMenu.xib index af4bb8f2..60e872d3 100644 --- a/nvox/Base.lproj/MainMenu.xib +++ b/nvox/Base.lproj/MainMenu.xib @@ -687,17 +687,27 @@ - + - + - + + + + + + + + + + + - + diff --git a/nvox/Base.lproj/MainWindow.xib b/nvox/Base.lproj/MainWindow.xib new file mode 100644 index 00000000..3340f5eb --- /dev/null +++ b/nvox/Base.lproj/MainWindow.xib @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/nvox/MainWindowController.swift b/nvox/MainWindowController.swift index e94f975b..638b85ca 100644 --- a/nvox/MainWindowController.swift +++ b/nvox/MainWindowController.swift @@ -12,30 +12,17 @@ class MainWindowController: NSWindowController, NSWindowDelegate { return self.neoVimView.uuid } - weak var mainWindowManager: MainWindowManager? + private weak var mainWindowManager: MainWindowManager? private let neoVimView = NeoVimView(forAutoLayout: ()) - init(contentRect: CGRect, manager: MainWindowManager) { + func setup(manager manager: MainWindowManager) { self.mainWindowManager = manager - - let style = NSTitledWindowMask | NSUnifiedTitleAndToolbarWindowMask | NSTexturedBackgroundWindowMask | - NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask - let window = NSWindow(contentRect: contentRect, styleMask: style, backing: .Buffered, defer: true) - - super.init(window: window) - - window.delegate = self - window.hasShadow = true - window.title = "nvox" - window.opaque = false - window.animationBehavior = .DocumentWindow - self.addViews() - + self.window?.makeFirstResponder(self.neoVimView) } - + func windowWillClose(notification: NSNotification) { self.neoVimView.cleanUp() self.mainWindowManager?.closeMainWindow(self) @@ -45,8 +32,4 @@ class MainWindowController: NSWindowController, NSWindowDelegate { self.window?.contentView?.addSubview(self.neoVimView) self.neoVimView.autoPinEdgesToSuperviewEdges() } - - required init?(coder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } } diff --git a/nvox/MainWindowManager.swift b/nvox/MainWindowManager.swift index 2e947428..b9c57ff2 100644 --- a/nvox/MainWindowManager.swift +++ b/nvox/MainWindowManager.swift @@ -10,11 +10,11 @@ class MainWindowManager { private var mainWindowControllers: [String: MainWindowController] = [:] func newMainWindow() { - let mainWindowController = MainWindowController(contentRect: CGRect(x: 100, y: 100, width: 320, height: 240), - manager: self) - mainWindowController.showWindow(self) - + let mainWindowController = MainWindowController(windowNibName: "MainWindow") self.mainWindowControllers[mainWindowController.uuid] = mainWindowController + + mainWindowController.setup(manager: self) + mainWindowController.showWindow(self) } func closeMainWindow(mainWindowController: MainWindowController) {