Add New Window command to File menu — it creates a new reader window.

This commit is contained in:
Brent Simmons 2017-11-14 13:18:25 -08:00
parent 0000e403df
commit c228c34b00
2 changed files with 21 additions and 1 deletions

View File

@ -24,6 +24,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations {
let windowControllers = NSMutableArray()
var preferencesWindowController: NSWindowController?
var mainWindowController: NSWindowController?
var readerWindows = [NSWindowController]()
var feedListWindowController: NSWindowController?
var dinosaursWindowController: DinosaursWindowController?
var addFeedController: AddFeedController?
@ -131,7 +132,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations {
func createAndShowMainWindow() {
if mainWindowController == nil {
mainWindowController = windowControllerWithName("MainWindow")
mainWindowController = createReaderWindow()
}
mainWindowController!.showWindow(self)
@ -162,6 +163,13 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations {
// MARK: - Actions
@IBAction func newReaderWindow(_ sender: Any?) {
let readerWindow = createReaderWindow()
readerWindows += [readerWindow]
readerWindow.showWindow(self)
}
@IBAction func showPreferences(_ sender: AnyObject) {
if preferencesWindowController == nil {
@ -304,4 +312,10 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations {
}
}
private extension AppDelegate {
func createReaderWindow() -> NSWindowController {
return windowControllerWithName("MainWindow")
}
}

View File

@ -78,6 +78,12 @@
<action selector="showAddFolderWindow:" target="Ady-hI-5gd" id="GIi-wc-uYk"/>
</connections>
</menuItem>
<menuItem title="New Window" keyEquivalent="n" id="J9a-dk-nAT">
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
<connections>
<action selector="newReaderWindow:" target="Ady-hI-5gd" id="XtC-K9-1Np"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="m54-Is-iLE"/>
<menuItem title="Refresh" keyEquivalent="r" id="Veh-SV-KWy">
<connections>