2017-05-27 19:43:27 +02:00
|
|
|
//
|
|
|
|
// MainWindowController.swift
|
2018-08-29 07:18:24 +02:00
|
|
|
// NetNewsWire
|
2017-05-27 19:43:27 +02:00
|
|
|
//
|
|
|
|
// Created by Brent Simmons on 8/1/15.
|
|
|
|
// Copyright © 2015 Ranchero Software, LLC. All rights reserved.
|
|
|
|
//
|
|
|
|
|
2018-02-03 07:51:32 +01:00
|
|
|
import AppKit
|
2018-07-24 03:29:08 +02:00
|
|
|
import Articles
|
2017-10-07 23:40:14 +02:00
|
|
|
import Account
|
2018-02-18 02:45:05 +01:00
|
|
|
import RSCore
|
2017-05-27 19:43:27 +02:00
|
|
|
|
2019-02-14 06:33:50 +01:00
|
|
|
enum TimelineSourceMode {
|
|
|
|
case regular, search
|
|
|
|
}
|
|
|
|
|
2019-02-26 07:25:29 +01:00
|
|
|
class MainWindowController : NSWindowController, NSUserInterfaceValidations {
|
2018-02-08 06:42:33 +01:00
|
|
|
|
2018-09-08 03:22:13 +02:00
|
|
|
private var sharingServicePickerDelegate: NSSharingServicePickerDelegate?
|
2017-05-27 19:43:27 +02:00
|
|
|
|
2019-02-26 07:25:29 +01:00
|
|
|
private let windowAutosaveName = NSWindow.FrameAutosaveName("MainWindow")
|
2018-02-18 05:45:15 +01:00
|
|
|
static var didPositionWindowOnFirstRun = false
|
|
|
|
|
2019-02-18 03:46:28 +01:00
|
|
|
private var currentFeedOrFolder: AnyObject? {
|
|
|
|
// Nil for none or multiple selection.
|
|
|
|
guard let selectedObjects = selectedObjectsInSidebar(), selectedObjects.count == 1 else {
|
|
|
|
return nil
|
2017-10-19 06:53:45 +02:00
|
|
|
}
|
2019-02-18 03:46:28 +01:00
|
|
|
return selectedObjects.first
|
2017-10-19 06:53:45 +02:00
|
|
|
}
|
2018-09-19 04:57:38 +02:00
|
|
|
|
2018-02-18 05:45:15 +01:00
|
|
|
private var shareToolbarItem: NSToolbarItem? {
|
|
|
|
return window?.toolbar?.existingItem(withIdentifier: .Share)
|
|
|
|
}
|
2018-02-18 05:33:30 +01:00
|
|
|
|
2018-02-27 07:31:07 +01:00
|
|
|
private static var detailViewMinimumThickness = 384
|
2019-02-18 22:10:16 +01:00
|
|
|
private var sidebarViewController: SidebarViewController?
|
|
|
|
private var timelineContainerViewController: TimelineContainerViewController?
|
|
|
|
private var detailViewController: DetailViewController?
|
2019-02-25 07:39:57 +01:00
|
|
|
private var currentSearchField: NSSearchField? = nil
|
|
|
|
private var searchString: String? = nil
|
|
|
|
private var lastSentSearchString: String? = nil
|
|
|
|
private var timelineSourceMode: TimelineSourceMode = .regular {
|
|
|
|
didSet {
|
|
|
|
timelineContainerViewController?.showTimeline(for: timelineSourceMode)
|
|
|
|
detailViewController?.showDetail(for: timelineSourceMode)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
private var searchSmartFeed: SmartFeed? = nil
|
2018-02-27 07:31:07 +01:00
|
|
|
|
2018-02-18 05:45:15 +01:00
|
|
|
// MARK: - NSWindowController
|
2017-12-21 23:47:12 +01:00
|
|
|
|
2018-02-08 06:42:33 +01:00
|
|
|
override func windowDidLoad() {
|
|
|
|
|
|
|
|
super.windowDidLoad()
|
2018-02-18 05:45:15 +01:00
|
|
|
|
2018-09-08 03:22:13 +02:00
|
|
|
sharingServicePickerDelegate = SharingServicePickerDelegate(self.window)
|
|
|
|
|
2018-12-28 06:34:21 +01:00
|
|
|
if !AppDefaults.showTitleOnMainWindow {
|
2017-12-02 23:54:12 +01:00
|
|
|
window?.titleVisibility = .hidden
|
|
|
|
}
|
2017-12-21 23:43:29 +01:00
|
|
|
|
2019-02-26 07:25:29 +01:00
|
|
|
window?.setFrameUsingName(windowAutosaveName, force: true)
|
2018-12-28 06:34:21 +01:00
|
|
|
if AppDefaults.isFirstRun && !MainWindowController.didPositionWindowOnFirstRun {
|
2017-12-21 23:43:29 +01:00
|
|
|
|
2017-12-24 19:28:34 +01:00
|
|
|
if let window = window {
|
|
|
|
let point = NSPoint(x: 128, y: 64)
|
|
|
|
let size = NSSize(width: 1000, height: 700)
|
|
|
|
let minSize = NSSize(width: 600, height: 600)
|
|
|
|
window.setPointAndSizeAdjustingForScreen(point: point, size: size, minimumSize: minSize)
|
2017-12-21 23:47:12 +01:00
|
|
|
MainWindowController.didPositionWindowOnFirstRun = true
|
2017-12-21 23:43:29 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-02-27 07:31:07 +01:00
|
|
|
detailSplitViewItem?.minimumThickness = CGFloat(MainWindowController.detailViewMinimumThickness)
|
2019-02-26 07:25:29 +01:00
|
|
|
restoreSplitViewState()
|
|
|
|
|
|
|
|
NotificationCenter.default.addObserver(self, selector: #selector(applicationWillTerminate(_:)), name: NSApplication.willTerminateNotification, object: nil)
|
2019-02-18 04:38:17 +01:00
|
|
|
|
2019-02-18 03:46:28 +01:00
|
|
|
sidebarViewController = splitViewController?.splitViewItems[0].viewController as? SidebarViewController
|
2019-02-18 22:10:16 +01:00
|
|
|
sidebarViewController!.delegate = self
|
2018-02-27 07:31:07 +01:00
|
|
|
|
2019-02-18 04:38:17 +01:00
|
|
|
timelineContainerViewController = splitViewController?.splitViewItems[1].viewController as? TimelineContainerViewController
|
2019-02-18 22:10:16 +01:00
|
|
|
timelineContainerViewController!.delegate = self
|
2019-02-18 04:38:17 +01:00
|
|
|
|
2019-02-18 07:00:04 +01:00
|
|
|
detailViewController = splitViewController?.splitViewItems[2].viewController as? DetailViewController
|
|
|
|
|
2017-10-07 23:40:14 +02:00
|
|
|
NotificationCenter.default.addObserver(self, selector: #selector(refreshProgressDidChange(_:)), name: .AccountRefreshDidBegin, object: nil)
|
|
|
|
NotificationCenter.default.addObserver(self, selector: #selector(refreshProgressDidChange(_:)), name: .AccountRefreshDidFinish, object: nil)
|
2017-10-08 02:43:10 +02:00
|
|
|
NotificationCenter.default.addObserver(self, selector: #selector(refreshProgressDidChange(_:)), name: .AccountRefreshProgressDidChange, object: nil)
|
2017-10-19 06:53:45 +02:00
|
|
|
|
|
|
|
NotificationCenter.default.addObserver(self, selector: #selector(unreadCountDidChange(_:)), name: .UnreadCountDidChange, object: nil)
|
2018-09-19 04:57:38 +02:00
|
|
|
NotificationCenter.default.addObserver(self, selector: #selector(displayNameDidChange(_:)), name: .DisplayNameDidChange, object: nil)
|
2017-10-19 06:53:45 +02:00
|
|
|
|
|
|
|
DispatchQueue.main.async {
|
|
|
|
self.updateWindowTitle()
|
2017-05-27 19:43:27 +02:00
|
|
|
}
|
2017-10-19 06:53:45 +02:00
|
|
|
}
|
2018-01-21 20:35:50 +01:00
|
|
|
|
2018-02-18 05:58:30 +01:00
|
|
|
// MARK: - API
|
|
|
|
|
2019-02-26 07:25:29 +01:00
|
|
|
func saveState() {
|
|
|
|
|
|
|
|
saveSplitViewState()
|
|
|
|
}
|
|
|
|
|
2018-01-21 20:35:50 +01:00
|
|
|
func selectedObjectsInSidebar() -> [AnyObject]? {
|
|
|
|
|
|
|
|
return sidebarViewController?.selectedObjects
|
|
|
|
}
|
|
|
|
|
2018-02-18 05:58:30 +01:00
|
|
|
// MARK: - Notifications
|
2018-02-08 06:42:33 +01:00
|
|
|
|
2019-02-26 07:25:29 +01:00
|
|
|
// func window(_ window: NSWindow, willEncodeRestorableState state: NSCoder) {
|
|
|
|
//
|
|
|
|
// saveSplitViewState(to: state)
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// func window(_ window: NSWindow, didDecodeRestorableState state: NSCoder) {
|
|
|
|
//
|
|
|
|
// restoreSplitViewState(from: state)
|
|
|
|
//
|
|
|
|
// // Make sure the timeline view is first responder if possible, to start out viewing
|
|
|
|
// // whatever preserved selection might have been restored
|
|
|
|
// makeTimelineViewFirstResponder()
|
|
|
|
// }
|
2018-02-08 06:42:33 +01:00
|
|
|
|
2019-02-26 07:25:29 +01:00
|
|
|
@objc func applicationWillTerminate(_ note: Notification) {
|
|
|
|
saveState()
|
|
|
|
window?.saveFrame(usingName: windowAutosaveName)
|
2018-02-08 06:42:33 +01:00
|
|
|
}
|
2017-05-27 19:43:27 +02:00
|
|
|
|
2017-09-17 21:54:08 +02:00
|
|
|
@objc func refreshProgressDidChange(_ note: Notification) {
|
2018-02-18 00:20:07 +01:00
|
|
|
|
2018-02-18 02:45:05 +01:00
|
|
|
CoalescingQueue.standard.add(self, #selector(makeToolbarValidate))
|
2017-05-27 19:43:27 +02:00
|
|
|
}
|
2017-10-19 06:53:45 +02:00
|
|
|
|
|
|
|
@objc func unreadCountDidChange(_ note: Notification) {
|
2018-09-19 04:57:38 +02:00
|
|
|
updateWindowTitleIfNecessary(note.object)
|
|
|
|
}
|
|
|
|
|
|
|
|
@objc func displayNameDidChange(_ note: Notification) {
|
|
|
|
updateWindowTitleIfNecessary(note.object)
|
|
|
|
}
|
2017-10-19 06:53:45 +02:00
|
|
|
|
2018-09-19 18:15:04 +02:00
|
|
|
private func updateWindowTitleIfNecessary(_ noteObject: Any?) {
|
2018-09-19 04:57:38 +02:00
|
|
|
|
2018-09-19 18:15:04 +02:00
|
|
|
if let folder = currentFeedOrFolder as? Folder, let noteObject = noteObject as? Folder {
|
2018-09-19 06:10:11 +02:00
|
|
|
if folder == noteObject {
|
2018-09-19 04:57:38 +02:00
|
|
|
updateWindowTitle()
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-09-19 18:15:04 +02:00
|
|
|
if let feed = currentFeedOrFolder as? Feed, let noteObject = noteObject as? Feed {
|
2018-09-19 06:10:11 +02:00
|
|
|
if feed == noteObject {
|
2018-09-19 04:57:38 +02:00
|
|
|
updateWindowTitle()
|
2018-09-19 06:10:11 +02:00
|
|
|
return
|
2018-09-19 04:57:38 +02:00
|
|
|
}
|
2017-10-19 06:53:45 +02:00
|
|
|
}
|
2018-09-19 04:57:38 +02:00
|
|
|
|
2018-09-19 18:15:04 +02:00
|
|
|
// If we don't recognize the changed object, we will test it for identity instead
|
2018-09-19 18:26:19 +02:00
|
|
|
// of equality. This works well for us if the window title is displaying a
|
2018-09-19 18:15:04 +02:00
|
|
|
// PsuedoFeed object.
|
|
|
|
if let currentObject = currentFeedOrFolder, let noteObject = noteObject {
|
|
|
|
if currentObject === noteObject as AnyObject {
|
|
|
|
updateWindowTitle()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-10-19 06:53:45 +02:00
|
|
|
}
|
2018-09-19 04:57:38 +02:00
|
|
|
|
2018-02-18 05:58:30 +01:00
|
|
|
// MARK: - Toolbar
|
2017-05-27 19:43:27 +02:00
|
|
|
|
2018-02-18 00:29:55 +01:00
|
|
|
@objc func makeToolbarValidate() {
|
2017-05-27 19:43:27 +02:00
|
|
|
|
|
|
|
window?.toolbar?.validateVisibleItems()
|
|
|
|
}
|
2017-12-20 00:24:38 +01:00
|
|
|
|
2018-02-18 05:58:30 +01:00
|
|
|
// MARK: - NSUserInterfaceValidations
|
2017-05-27 19:43:27 +02:00
|
|
|
|
|
|
|
public func validateUserInterfaceItem(_ item: NSValidatedUserInterfaceItem) -> Bool {
|
|
|
|
|
|
|
|
if item.action == #selector(openArticleInBrowser(_:)) {
|
|
|
|
return currentLink != nil
|
|
|
|
}
|
|
|
|
|
|
|
|
if item.action == #selector(nextUnread(_:)) {
|
|
|
|
return canGoToNextUnread()
|
|
|
|
}
|
|
|
|
|
|
|
|
if item.action == #selector(markAllAsRead(_:)) {
|
|
|
|
return canMarkAllAsRead()
|
|
|
|
}
|
2017-11-06 06:27:34 +01:00
|
|
|
|
2018-09-13 22:00:33 +02:00
|
|
|
if item.action == #selector(toggleRead(_:)) {
|
|
|
|
return validateToggleRead(item)
|
2017-11-06 06:27:34 +01:00
|
|
|
}
|
|
|
|
|
2018-02-17 07:35:04 +01:00
|
|
|
if item.action == #selector(toggleStarred(_:)) {
|
|
|
|
return validateToggleStarred(item)
|
|
|
|
}
|
|
|
|
|
2017-12-25 21:21:44 +01:00
|
|
|
if item.action == #selector(markOlderArticlesAsRead(_:)) {
|
|
|
|
return canMarkOlderArticlesAsRead()
|
|
|
|
}
|
2017-12-26 21:50:34 +01:00
|
|
|
|
|
|
|
if item.action == #selector(toolbarShowShareMenu(_:)) {
|
|
|
|
return canShowShareMenu()
|
|
|
|
}
|
2018-02-08 06:42:33 +01:00
|
|
|
|
2019-02-25 08:03:32 +01:00
|
|
|
if item.action == #selector(moveFocusToSearchField(_:)) {
|
|
|
|
return currentSearchField != nil
|
|
|
|
}
|
2018-02-08 06:42:33 +01:00
|
|
|
|
2019-02-25 08:03:32 +01:00
|
|
|
if item.action == #selector(toggleSidebar(_:)) {
|
2018-02-08 06:42:33 +01:00
|
|
|
guard let splitViewItem = sidebarSplitViewItem else {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
|
|
|
let sidebarIsShowing = !splitViewItem.isCollapsed
|
|
|
|
if let menuItem = item as? NSMenuItem {
|
|
|
|
let title = sidebarIsShowing ? NSLocalizedString("Hide Sidebar", comment: "Menu item") : NSLocalizedString("Show Sidebar", comment: "Menu item")
|
|
|
|
menuItem.title = title
|
|
|
|
}
|
|
|
|
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
2017-05-27 19:43:27 +02:00
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
2017-12-20 21:59:31 +01:00
|
|
|
// MARK: - Actions
|
|
|
|
|
|
|
|
@IBAction func scrollOrGoToNextUnread(_ sender: Any?) {
|
2019-02-18 22:10:16 +01:00
|
|
|
guard let detailViewController = detailViewController else {
|
|
|
|
return
|
|
|
|
}
|
2017-12-20 22:39:31 +01:00
|
|
|
detailViewController.canScrollDown { (canScroll) in
|
2018-09-02 02:25:29 +02:00
|
|
|
NSCursor.setHiddenUntilMouseMoves(true)
|
2019-02-18 22:10:16 +01:00
|
|
|
canScroll ? detailViewController.scrollPageDown(sender) : self.nextUnread(sender)
|
2017-12-20 22:39:31 +01:00
|
|
|
}
|
2017-12-20 21:59:31 +01:00
|
|
|
}
|
|
|
|
|
2018-02-12 03:58:50 +01:00
|
|
|
@IBAction func showAddFolderWindow(_ sender: Any?) {
|
2018-02-08 06:42:33 +01:00
|
|
|
appDelegate.showAddFolderSheetOnWindow(window!)
|
|
|
|
}
|
2018-02-04 06:30:30 +01:00
|
|
|
|
2018-02-12 03:58:50 +01:00
|
|
|
@IBAction func showAddFeedWindow(_ sender: Any?) {
|
2018-09-22 21:46:24 +02:00
|
|
|
appDelegate.showAddFeedSheetOnWindow(window!, urlString: nil, name: nil, folder: nil)
|
2018-02-04 06:30:30 +01:00
|
|
|
}
|
|
|
|
|
2017-12-20 21:59:31 +01:00
|
|
|
@IBAction func openArticleInBrowser(_ sender: Any?) {
|
2017-05-27 19:43:27 +02:00
|
|
|
if let link = currentLink {
|
2017-10-06 03:12:58 +02:00
|
|
|
Browser.open(link)
|
2017-05-27 19:43:27 +02:00
|
|
|
}
|
|
|
|
}
|
2017-12-20 21:59:31 +01:00
|
|
|
|
|
|
|
@IBAction func openInBrowser(_ sender: Any?) {
|
|
|
|
openArticleInBrowser(sender)
|
|
|
|
}
|
|
|
|
|
|
|
|
@IBAction func nextUnread(_ sender: Any?) {
|
2019-02-18 22:10:16 +01:00
|
|
|
guard let timelineViewController = currentTimelineViewController, let sidebarViewController = sidebarViewController else {
|
2017-05-27 19:43:27 +02:00
|
|
|
return
|
|
|
|
}
|
2018-09-05 06:18:59 +02:00
|
|
|
|
|
|
|
NSCursor.setHiddenUntilMouseMoves(true)
|
2019-02-18 22:10:16 +01:00
|
|
|
|
|
|
|
// TODO: handle search mode
|
2017-05-27 19:43:27 +02:00
|
|
|
if timelineViewController.canGoToNextUnread() {
|
2017-12-24 07:18:42 +01:00
|
|
|
goToNextUnreadInTimeline()
|
2017-05-27 19:43:27 +02:00
|
|
|
}
|
|
|
|
else if sidebarViewController.canGoToNextUnread() {
|
|
|
|
sidebarViewController.goToNextUnread()
|
2017-12-24 07:18:42 +01:00
|
|
|
if timelineViewController.canGoToNextUnread() {
|
|
|
|
goToNextUnreadInTimeline()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-12-20 21:59:31 +01:00
|
|
|
@IBAction func markAllAsRead(_ sender: Any?) {
|
2019-02-18 22:10:16 +01:00
|
|
|
currentTimelineViewController?.markAllAsRead()
|
2017-05-27 19:43:27 +02:00
|
|
|
}
|
2017-11-06 06:27:34 +01:00
|
|
|
|
2018-09-13 22:00:33 +02:00
|
|
|
@IBAction func toggleRead(_ sender: Any?) {
|
2019-02-18 22:10:16 +01:00
|
|
|
currentTimelineViewController?.toggleReadStatusForSelectedArticles()
|
|
|
|
}
|
2017-11-06 06:27:34 +01:00
|
|
|
|
2019-02-18 22:10:16 +01:00
|
|
|
@IBAction func markRead(_ sender: Any?) {
|
|
|
|
currentTimelineViewController?.markSelectedArticlesAsRead(sender)
|
2017-11-06 06:27:34 +01:00
|
|
|
}
|
2017-12-20 21:59:31 +01:00
|
|
|
|
|
|
|
@IBAction func markUnread(_ sender: Any?) {
|
2019-02-18 22:10:16 +01:00
|
|
|
currentTimelineViewController?.markSelectedArticlesAsUnread(sender)
|
2017-12-20 21:59:31 +01:00
|
|
|
}
|
|
|
|
|
2018-02-17 07:35:04 +01:00
|
|
|
@IBAction func toggleStarred(_ sender: Any?) {
|
2019-02-18 22:10:16 +01:00
|
|
|
currentTimelineViewController?.toggleStarredStatusForSelectedArticles()
|
2018-02-17 07:35:04 +01:00
|
|
|
}
|
|
|
|
|
2017-12-21 06:23:48 +01:00
|
|
|
@IBAction func markAllAsReadAndGoToNextUnread(_ sender: Any?) {
|
|
|
|
markAllAsRead(sender)
|
|
|
|
nextUnread(sender)
|
|
|
|
}
|
|
|
|
|
2017-12-20 21:59:31 +01:00
|
|
|
@IBAction func markUnreadAndGoToNextUnread(_ sender: Any?) {
|
|
|
|
markUnread(sender)
|
|
|
|
nextUnread(sender)
|
|
|
|
}
|
|
|
|
|
2017-12-21 05:51:17 +01:00
|
|
|
@IBAction func markReadAndGoToNextUnread(_ sender: Any?) {
|
|
|
|
markUnread(sender)
|
|
|
|
nextUnread(sender)
|
|
|
|
}
|
|
|
|
|
2017-12-20 21:59:31 +01:00
|
|
|
@IBAction func toggleSidebar(_ sender: Any?) {
|
2017-05-27 19:43:27 +02:00
|
|
|
splitViewController!.toggleSidebar(sender)
|
|
|
|
}
|
2017-11-17 03:23:07 +01:00
|
|
|
|
2017-11-20 00:45:20 +01:00
|
|
|
@IBAction func markOlderArticlesAsRead(_ sender: Any?) {
|
2019-02-18 22:10:16 +01:00
|
|
|
currentTimelineViewController?.markOlderArticlesRead()
|
2017-11-20 01:28:26 +01:00
|
|
|
}
|
2017-12-21 06:23:48 +01:00
|
|
|
|
|
|
|
@IBAction func navigateToTimeline(_ sender: Any?) {
|
2019-02-18 22:10:16 +01:00
|
|
|
currentTimelineViewController?.focus()
|
2017-12-21 06:23:48 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@IBAction func navigateToSidebar(_ sender: Any?) {
|
|
|
|
sidebarViewController?.focus()
|
|
|
|
}
|
2017-12-21 23:43:29 +01:00
|
|
|
|
2019-03-01 23:56:40 +01:00
|
|
|
@IBAction func navigateToDetail(_ sender: Any?) {
|
|
|
|
detailViewController?.focus()
|
|
|
|
}
|
|
|
|
|
2017-12-21 23:43:29 +01:00
|
|
|
@IBAction func goToPreviousSubscription(_ sender: Any?) {
|
|
|
|
sidebarViewController?.outlineView.selectPreviousRow(sender)
|
|
|
|
}
|
|
|
|
|
|
|
|
@IBAction func goToNextSubscription(_ sender: Any?) {
|
|
|
|
sidebarViewController?.outlineView.selectNextRow(sender)
|
|
|
|
}
|
2017-12-26 21:50:34 +01:00
|
|
|
|
2018-01-27 21:39:07 +01:00
|
|
|
@IBAction func gotoToday(_ sender: Any?) {
|
|
|
|
sidebarViewController?.gotoToday(sender)
|
|
|
|
}
|
|
|
|
|
|
|
|
@IBAction func gotoAllUnread(_ sender: Any?) {
|
|
|
|
sidebarViewController?.gotoAllUnread(sender)
|
|
|
|
}
|
|
|
|
|
|
|
|
@IBAction func gotoStarred(_ sender: Any?) {
|
|
|
|
sidebarViewController?.gotoStarred(sender)
|
|
|
|
}
|
2018-01-28 00:04:45 +01:00
|
|
|
|
2017-12-26 21:50:34 +01:00
|
|
|
@IBAction func toolbarShowShareMenu(_ sender: Any?) {
|
|
|
|
guard let selectedArticles = selectedArticles, !selectedArticles.isEmpty else {
|
|
|
|
assertionFailure("Expected toolbarShowShareMenu to be called only when there are selected articles.")
|
|
|
|
return
|
|
|
|
}
|
|
|
|
guard let shareToolbarItem = shareToolbarItem else {
|
|
|
|
assertionFailure("Expected toolbarShowShareMenu to be called only by the Share item in the toolbar.")
|
|
|
|
return
|
|
|
|
}
|
|
|
|
guard let view = shareToolbarItem.view else {
|
|
|
|
// TODO: handle menu form representation
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2018-09-26 05:20:59 +02:00
|
|
|
let sortedArticles = selectedArticles.sortedByDate(.orderedAscending)
|
|
|
|
let items = sortedArticles.map { ArticlePasteboardWriter(article: $0) }
|
2017-12-26 21:50:34 +01:00
|
|
|
let sharingServicePicker = NSSharingServicePicker(items: items)
|
2018-02-18 05:33:30 +01:00
|
|
|
sharingServicePicker.delegate = sharingServicePickerDelegate
|
2017-12-26 21:50:34 +01:00
|
|
|
sharingServicePicker.show(relativeTo: view.bounds, of: view, preferredEdge: .minY)
|
|
|
|
}
|
|
|
|
|
2019-02-25 08:03:32 +01:00
|
|
|
@IBAction func moveFocusToSearchField(_ sender: Any?) {
|
|
|
|
guard let searchField = currentSearchField else {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
window?.makeFirstResponder(searchField)
|
|
|
|
}
|
2017-12-26 21:50:34 +01:00
|
|
|
}
|
|
|
|
|
2019-02-18 03:46:28 +01:00
|
|
|
// MARK: - SidebarDelegate
|
|
|
|
|
|
|
|
extension MainWindowController: SidebarDelegate {
|
|
|
|
|
2019-02-18 06:43:51 +01:00
|
|
|
func sidebarSelectionDidChange(_: SidebarViewController, selectedObjects: [AnyObject]?) {
|
2019-02-18 04:38:17 +01:00
|
|
|
// TODO: if searching, cancel search
|
2019-02-18 22:10:16 +01:00
|
|
|
timelineContainerViewController?.setRepresentedObjects(selectedObjects, mode: .regular)
|
2019-02-25 07:39:57 +01:00
|
|
|
forceSearchToEnd()
|
2019-02-18 03:46:28 +01:00
|
|
|
updateWindowTitle()
|
|
|
|
NotificationCenter.default.post(name: .InspectableObjectsDidChange, object: nil)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-02-18 06:43:51 +01:00
|
|
|
// MARK: - TimelineContainerViewControllerDelegate
|
|
|
|
|
|
|
|
extension MainWindowController: TimelineContainerViewControllerDelegate {
|
|
|
|
|
|
|
|
func timelineSelectionDidChange(_: TimelineContainerViewController, articles: [Article]?, mode: TimelineSourceMode) {
|
|
|
|
let detailState: DetailState
|
|
|
|
if let articles = articles {
|
|
|
|
detailState = articles.count == 1 ? .article(articles.first!) : .multipleSelection
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
detailState = .noSelection
|
|
|
|
}
|
|
|
|
detailViewController?.setState(detailState, mode: mode)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-02-19 04:02:40 +01:00
|
|
|
// MARK: - NSSearchFieldDelegate
|
|
|
|
|
|
|
|
extension MainWindowController: NSSearchFieldDelegate {
|
|
|
|
|
|
|
|
func searchFieldDidStartSearching(_ sender: NSSearchField) {
|
2019-02-25 07:39:57 +01:00
|
|
|
startSearchingIfNeeded()
|
2019-02-19 04:02:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func searchFieldDidEndSearching(_ sender: NSSearchField) {
|
2019-02-25 07:39:57 +01:00
|
|
|
stopSearchingIfNeeded()
|
|
|
|
}
|
|
|
|
|
|
|
|
@IBAction func runSearch(_ sender: NSSearchField) {
|
|
|
|
if sender.stringValue == "" {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
startSearchingIfNeeded()
|
|
|
|
handleSearchFieldTextChange(sender)
|
|
|
|
}
|
|
|
|
|
|
|
|
private func handleSearchFieldTextChange(_ searchField: NSSearchField) {
|
|
|
|
let s = searchField.stringValue
|
|
|
|
if s == searchString {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
searchString = s
|
|
|
|
updateSmartFeed()
|
|
|
|
}
|
|
|
|
|
|
|
|
func updateSmartFeed() {
|
|
|
|
guard timelineSourceMode == .search, let searchString = searchString else {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
if searchString == lastSentSearchString {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
lastSentSearchString = searchString
|
|
|
|
let smartFeed = SmartFeed(delegate: SearchFeedDelegate(searchString: searchString))
|
|
|
|
timelineContainerViewController?.setRepresentedObjects([smartFeed], mode: .search)
|
|
|
|
searchSmartFeed = smartFeed
|
|
|
|
}
|
|
|
|
|
|
|
|
func forceSearchToEnd() {
|
|
|
|
timelineSourceMode = .regular
|
|
|
|
searchString = nil
|
|
|
|
lastSentSearchString = nil
|
|
|
|
if let searchField = currentSearchField {
|
|
|
|
searchField.stringValue = ""
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private func startSearchingIfNeeded() {
|
|
|
|
timelineSourceMode = .search
|
|
|
|
}
|
|
|
|
|
|
|
|
private func stopSearchingIfNeeded() {
|
|
|
|
searchString = nil
|
|
|
|
lastSentSearchString = nil
|
|
|
|
timelineSourceMode = .regular
|
|
|
|
timelineContainerViewController?.setRepresentedObjects(nil, mode: .search)
|
2019-02-19 04:02:40 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-02-08 09:11:52 +01:00
|
|
|
// MARK: - Scripting Access
|
|
|
|
|
|
|
|
/*
|
|
|
|
the ScriptingMainWindowController protocol exposes a narrow set of accessors with
|
|
|
|
internal visibility which are very similar to some private vars.
|
|
|
|
|
|
|
|
These would be unnecessary if the similar accessors were marked internal rather than private,
|
|
|
|
but for now, we'll keep the stratification of visibility
|
|
|
|
*/
|
|
|
|
|
|
|
|
extension MainWindowController : ScriptingMainWindowController {
|
|
|
|
|
|
|
|
internal var scriptingCurrentArticle: Article? {
|
|
|
|
return self.oneSelectedArticle
|
|
|
|
}
|
|
|
|
|
|
|
|
internal var scriptingSelectedArticles: [Article] {
|
|
|
|
return self.selectedArticles ?? []
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-02-25 07:39:57 +01:00
|
|
|
// MARK: - NSToolbarDelegate
|
|
|
|
|
|
|
|
extension NSToolbarItem.Identifier {
|
|
|
|
static let Share = NSToolbarItem.Identifier("share")
|
|
|
|
static let Search = NSToolbarItem.Identifier("search")
|
|
|
|
}
|
|
|
|
|
|
|
|
extension MainWindowController: NSToolbarDelegate {
|
|
|
|
|
|
|
|
func toolbarWillAddItem(_ notification: Notification) {
|
|
|
|
guard let item = notification.userInfo?["item"] as? NSToolbarItem else {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
if item.itemIdentifier == .Share, let button = item.view as? NSButton {
|
|
|
|
// The share button should send its action on mouse down, not mouse up.
|
|
|
|
button.sendAction(on: .leftMouseDown)
|
|
|
|
}
|
|
|
|
|
|
|
|
if item.itemIdentifier == .Search, let searchField = item.view as? NSSearchField {
|
|
|
|
searchField.delegate = self
|
|
|
|
searchField.target = self
|
|
|
|
searchField.action = #selector(runSearch(_:))
|
|
|
|
currentSearchField = searchField
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func toolbarDidRemoveItem(_ notification: Notification) {
|
|
|
|
guard let item = notification.userInfo?["item"] as? NSToolbarItem else {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
if item.itemIdentifier == .Search, let searchField = item.view as? NSSearchField {
|
|
|
|
searchField.delegate = nil
|
|
|
|
searchField.target = nil
|
|
|
|
searchField.action = nil
|
|
|
|
currentSearchField = nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-10-06 05:03:35 +02:00
|
|
|
// MARK: - Private
|
|
|
|
|
2017-05-27 19:43:27 +02:00
|
|
|
private extension MainWindowController {
|
2019-02-15 17:16:38 +01:00
|
|
|
|
2017-05-27 19:43:27 +02:00
|
|
|
var splitViewController: NSSplitViewController? {
|
2018-02-08 06:42:33 +01:00
|
|
|
guard let viewController = contentViewController else {
|
|
|
|
return nil
|
2017-05-27 19:43:27 +02:00
|
|
|
}
|
2018-12-09 21:32:33 +01:00
|
|
|
return viewController.children.first as? NSSplitViewController
|
2017-05-27 19:43:27 +02:00
|
|
|
}
|
|
|
|
|
2019-02-18 22:10:16 +01:00
|
|
|
var currentTimelineViewController: TimelineViewController? {
|
|
|
|
return timelineContainerViewController?.currentTimelineViewController
|
2017-05-27 19:43:27 +02:00
|
|
|
}
|
2018-02-08 06:42:33 +01:00
|
|
|
|
|
|
|
var sidebarSplitViewItem: NSSplitViewItem? {
|
|
|
|
return splitViewController?.splitViewItems[0]
|
|
|
|
}
|
|
|
|
|
2017-05-27 19:43:27 +02:00
|
|
|
var detailSplitViewItem: NSSplitViewItem? {
|
2018-02-08 06:42:33 +01:00
|
|
|
return splitViewController?.splitViewItems[2]
|
2017-05-27 19:43:27 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
var selectedArticles: [Article]? {
|
2019-02-18 22:10:16 +01:00
|
|
|
return currentTimelineViewController?.selectedArticles
|
2017-05-27 19:43:27 +02:00
|
|
|
}
|
2018-02-08 06:42:33 +01:00
|
|
|
|
2017-05-27 19:43:27 +02:00
|
|
|
var oneSelectedArticle: Article? {
|
2018-02-08 06:42:33 +01:00
|
|
|
if let articles = selectedArticles {
|
|
|
|
return articles.count == 1 ? articles[0] : nil
|
2017-05-27 19:43:27 +02:00
|
|
|
}
|
2018-02-08 06:42:33 +01:00
|
|
|
return nil
|
2017-05-27 19:43:27 +02:00
|
|
|
}
|
2018-02-08 06:42:33 +01:00
|
|
|
|
2017-05-27 19:43:27 +02:00
|
|
|
var currentLink: String? {
|
2018-02-08 06:42:33 +01:00
|
|
|
return oneSelectedArticle?.preferredLink
|
2017-05-27 19:43:27 +02:00
|
|
|
}
|
2018-02-08 06:42:33 +01:00
|
|
|
|
2018-02-18 05:58:30 +01:00
|
|
|
// MARK: - Command Validation
|
|
|
|
|
2017-05-27 19:43:27 +02:00
|
|
|
func canGoToNextUnread() -> Bool {
|
|
|
|
|
2019-02-18 22:10:16 +01:00
|
|
|
guard let timelineViewController = currentTimelineViewController, let sidebarViewController = sidebarViewController else {
|
2017-05-27 19:43:27 +02:00
|
|
|
return false
|
|
|
|
}
|
2019-02-18 22:10:16 +01:00
|
|
|
// TODO: handle search mode
|
2017-05-27 19:43:27 +02:00
|
|
|
return timelineViewController.canGoToNextUnread() || sidebarViewController.canGoToNextUnread()
|
|
|
|
}
|
|
|
|
|
|
|
|
func canMarkAllAsRead() -> Bool {
|
|
|
|
|
2019-02-18 22:10:16 +01:00
|
|
|
return currentTimelineViewController?.canMarkAllAsRead() ?? false
|
2017-05-27 19:43:27 +02:00
|
|
|
}
|
2017-10-19 06:53:45 +02:00
|
|
|
|
2018-09-13 22:00:33 +02:00
|
|
|
func validateToggleRead(_ item: NSValidatedUserInterfaceItem) -> Bool {
|
2017-11-06 06:27:34 +01:00
|
|
|
|
2019-02-18 22:10:16 +01:00
|
|
|
let validationStatus = currentTimelineViewController?.markReadCommandStatus() ?? .canDoNothing
|
2018-09-13 22:00:33 +02:00
|
|
|
let markingRead: Bool
|
|
|
|
let result: Bool
|
|
|
|
|
|
|
|
switch validationStatus {
|
|
|
|
case .canMark:
|
|
|
|
markingRead = true
|
|
|
|
result = true
|
|
|
|
case .canUnmark:
|
|
|
|
markingRead = false
|
|
|
|
result = true
|
|
|
|
case .canDoNothing:
|
|
|
|
markingRead = true
|
|
|
|
result = false
|
|
|
|
}
|
|
|
|
|
|
|
|
let commandName = markingRead ? NSLocalizedString("Mark as Read", comment: "Command") : NSLocalizedString("Mark as Unread", comment: "Command")
|
|
|
|
|
|
|
|
if let toolbarItem = item as? NSToolbarItem {
|
|
|
|
toolbarItem.toolTip = commandName
|
|
|
|
}
|
|
|
|
|
|
|
|
if let menuItem = item as? NSMenuItem {
|
|
|
|
menuItem.title = commandName
|
|
|
|
}
|
|
|
|
|
|
|
|
return result
|
2017-11-06 06:27:34 +01:00
|
|
|
}
|
2017-12-25 21:21:44 +01:00
|
|
|
|
|
|
|
func canMarkOlderArticlesAsRead() -> Bool {
|
|
|
|
|
2019-02-18 22:10:16 +01:00
|
|
|
return currentTimelineViewController?.canMarkOlderArticlesAsRead() ?? false
|
2017-12-25 21:21:44 +01:00
|
|
|
}
|
|
|
|
|
2018-02-18 05:58:30 +01:00
|
|
|
func canShowShareMenu() -> Bool {
|
|
|
|
|
|
|
|
guard let selectedArticles = selectedArticles else {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
return !selectedArticles.isEmpty
|
|
|
|
}
|
|
|
|
|
|
|
|
func validateToggleStarred(_ item: NSValidatedUserInterfaceItem) -> Bool {
|
|
|
|
|
2019-02-18 22:10:16 +01:00
|
|
|
let validationStatus = currentTimelineViewController?.markStarredCommandStatus() ?? .canDoNothing
|
2018-02-18 05:58:30 +01:00
|
|
|
let starring: Bool
|
|
|
|
let result: Bool
|
|
|
|
|
|
|
|
switch validationStatus {
|
|
|
|
case .canMark:
|
|
|
|
starring = true
|
|
|
|
result = true
|
|
|
|
case .canUnmark:
|
|
|
|
starring = false
|
|
|
|
result = true
|
|
|
|
case .canDoNothing:
|
|
|
|
starring = true
|
|
|
|
result = false
|
|
|
|
}
|
|
|
|
|
|
|
|
let commandName = starring ? NSLocalizedString("Mark as Starred", comment: "Command") : NSLocalizedString("Mark as Unstarred", comment: "Command")
|
|
|
|
|
|
|
|
if let toolbarItem = item as? NSToolbarItem {
|
|
|
|
toolbarItem.toolTip = commandName
|
2018-12-06 06:31:06 +01:00
|
|
|
// if let button = toolbarItem.view as? NSButton {
|
|
|
|
// button.image = NSImage(named: starring ? .star : .unstar)
|
|
|
|
// }
|
2018-02-18 05:58:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if let menuItem = item as? NSMenuItem {
|
|
|
|
menuItem.title = commandName
|
|
|
|
}
|
|
|
|
|
|
|
|
return result
|
|
|
|
}
|
|
|
|
|
|
|
|
// MARK: - Misc.
|
|
|
|
|
|
|
|
func goToNextUnreadInTimeline() {
|
|
|
|
|
2019-02-18 22:10:16 +01:00
|
|
|
guard let timelineViewController = currentTimelineViewController else {
|
2018-02-18 05:58:30 +01:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
if timelineViewController.canGoToNextUnread() {
|
|
|
|
timelineViewController.goToNextUnread()
|
|
|
|
makeTimelineViewFirstResponder()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func makeTimelineViewFirstResponder() {
|
|
|
|
|
2019-02-18 22:10:16 +01:00
|
|
|
guard let window = window, let timelineViewController = currentTimelineViewController else {
|
2018-02-18 05:58:30 +01:00
|
|
|
return
|
|
|
|
}
|
|
|
|
window.makeFirstResponderUnlessDescendantIsFirstResponder(timelineViewController.tableView)
|
|
|
|
}
|
|
|
|
|
2017-10-19 06:53:45 +02:00
|
|
|
func updateWindowTitle() {
|
|
|
|
|
2018-09-19 06:10:11 +02:00
|
|
|
var displayName: String? = nil
|
|
|
|
var unreadCount: Int? = nil
|
|
|
|
|
|
|
|
if let displayNameProvider = currentFeedOrFolder as? DisplayNameProvider {
|
|
|
|
displayName = displayNameProvider.nameForDisplay
|
2017-10-19 06:53:45 +02:00
|
|
|
}
|
2018-09-19 04:57:38 +02:00
|
|
|
|
2018-09-19 06:10:11 +02:00
|
|
|
if let unreadCountProvider = currentFeedOrFolder as? UnreadCountProvider {
|
|
|
|
unreadCount = unreadCountProvider.unreadCount
|
2017-10-19 06:53:45 +02:00
|
|
|
}
|
2018-09-19 04:57:38 +02:00
|
|
|
|
2018-09-19 06:10:11 +02:00
|
|
|
if displayName != nil {
|
|
|
|
if unreadCount ?? 0 > 0 {
|
|
|
|
window?.title = "\(displayName!) (\(unreadCount!))"
|
2018-09-19 04:57:38 +02:00
|
|
|
}
|
|
|
|
else {
|
2018-09-19 06:10:11 +02:00
|
|
|
window?.title = "\(displayName!)"
|
2018-09-19 04:57:38 +02:00
|
|
|
}
|
2018-09-19 06:10:11 +02:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
window?.title = appDelegate.appName!
|
2018-09-19 04:57:38 +02:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2017-10-19 06:53:45 +02:00
|
|
|
}
|
2018-02-27 07:31:07 +01:00
|
|
|
|
2019-02-26 07:25:29 +01:00
|
|
|
func saveSplitViewState() {
|
2018-02-27 07:31:07 +01:00
|
|
|
// TODO: Update this for multiple windows.
|
2019-02-26 07:25:29 +01:00
|
|
|
// Also: use standard state restoration mechanism.
|
2018-02-27 07:31:07 +01:00
|
|
|
guard let splitView = splitViewController?.splitView else {
|
|
|
|
return
|
2019-02-26 07:25:29 +01:00
|
|
|
}
|
2018-02-27 07:31:07 +01:00
|
|
|
let widths = splitView.arrangedSubviews.map{ Int(floor($0.frame.width)) }
|
2019-02-26 07:25:29 +01:00
|
|
|
if AppDefaults.mainWindowWidths != widths {
|
|
|
|
AppDefaults.mainWindowWidths = widths
|
2019-01-28 03:00:09 +01:00
|
|
|
}
|
2018-02-27 07:31:07 +01:00
|
|
|
}
|
|
|
|
|
2019-02-26 07:25:29 +01:00
|
|
|
func restoreSplitViewState() {
|
2018-02-27 07:31:07 +01:00
|
|
|
// TODO: Update this for multiple windows.
|
2019-02-26 07:25:29 +01:00
|
|
|
// Also: use standard state restoration mechanism.
|
|
|
|
guard let splitView = splitViewController?.splitView, let widths = AppDefaults.mainWindowWidths, widths.count == 3, let window = window else {
|
2018-02-27 07:31:07 +01:00
|
|
|
return
|
|
|
|
}
|
|
|
|
let windowWidth = Int(floor(window.frame.width))
|
|
|
|
let dividerThickness: Int = Int(splitView.dividerThickness)
|
|
|
|
let sidebarWidth: Int = widths[0]
|
|
|
|
let timelineWidth: Int = widths[1]
|
|
|
|
|
|
|
|
// Make sure the detail view has its mimimum thickness, at least.
|
|
|
|
if windowWidth < sidebarWidth + dividerThickness + timelineWidth + dividerThickness + MainWindowController.detailViewMinimumThickness {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
splitView.setPosition(CGFloat(sidebarWidth), ofDividerAt: 0)
|
|
|
|
splitView.setPosition(CGFloat(sidebarWidth + dividerThickness + timelineWidth), ofDividerAt: 1)
|
|
|
|
}
|
2019-02-18 22:33:01 +01:00
|
|
|
|
2019-02-26 07:25:29 +01:00
|
|
|
// func saveSplitViewState(to coder: NSCoder) {
|
|
|
|
//
|
|
|
|
// // TODO: Update this for multiple windows.
|
|
|
|
//
|
|
|
|
// guard let splitView = splitViewController?.splitView else {
|
|
|
|
// return
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// let widths = splitView.arrangedSubviews.map{ Int(floor($0.frame.width)) }
|
|
|
|
// coder.encode(widths, forKey: MainWindowController.mainWindowWidthsStateKey)
|
|
|
|
//
|
|
|
|
// }
|
|
|
|
|
|
|
|
// func arrayOfIntFromCoder(_ coder: NSCoder, withKey: String) -> [Int]? {
|
|
|
|
// let decodedFloats: [Int]?
|
|
|
|
// do {
|
|
|
|
// decodedFloats = try coder.decodeTopLevelObject(forKey: MainWindowController.mainWindowWidthsStateKey) as? [Int]? ?? nil
|
|
|
|
// }
|
|
|
|
// catch {
|
|
|
|
// decodedFloats = nil
|
|
|
|
// }
|
|
|
|
// return decodedFloats
|
|
|
|
// }
|
|
|
|
|
|
|
|
// func restoreSplitViewState(from coder: NSCoder) {
|
|
|
|
//
|
|
|
|
// // TODO: Update this for multiple windows.
|
|
|
|
// guard let splitView = splitViewController?.splitView, let widths = arrayOfIntFromCoder(coder, withKey: MainWindowController.mainWindowWidthsStateKey), widths.count == 3, let window = window else {
|
|
|
|
// return
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// let windowWidth = Int(floor(window.frame.width))
|
|
|
|
// let dividerThickness: Int = Int(splitView.dividerThickness)
|
|
|
|
// let sidebarWidth: Int = widths[0]
|
|
|
|
// let timelineWidth: Int = widths[1]
|
|
|
|
//
|
|
|
|
// // Make sure the detail view has its mimimum thickness, at least.
|
|
|
|
// if windowWidth < sidebarWidth + dividerThickness + timelineWidth + dividerThickness + MainWindowController.detailViewMinimumThickness {
|
|
|
|
// return
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// splitView.setPosition(CGFloat(sidebarWidth), ofDividerAt: 0)
|
|
|
|
// splitView.setPosition(CGFloat(sidebarWidth + dividerThickness + timelineWidth), ofDividerAt: 1)
|
|
|
|
// }
|
2017-05-27 19:43:27 +02:00
|
|
|
}
|
|
|
|
|