Make progress on swapping timeline views.
This commit is contained in:
parent
8d79827346
commit
3408a4c725
|
@ -416,84 +416,16 @@
|
||||||
<!--Timeline View Controller-->
|
<!--Timeline View Controller-->
|
||||||
<scene sceneID="zUD-i8-QYC">
|
<scene sceneID="zUD-i8-QYC">
|
||||||
<objects>
|
<objects>
|
||||||
<viewController id="36G-bQ-b96" userLabel="Timeline View Controller" customClass="TimelineContainerViewController" customModule="NetNewsWire" customModuleProvider="target" sceneMemberID="viewController">
|
<viewController id="36G-bQ-b96" customClass="TimelineContainerViewController" customModule="NetNewsWire" customModuleProvider="target" sceneMemberID="viewController">
|
||||||
<view key="view" id="Dnl-L5-xFP">
|
<view key="view" id="Dnl-L5-xFP" customClass="TimelineContainerView" customModule="NetNewsWire" customModuleProvider="target">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="450" height="198"/>
|
<rect key="frame" x="0.0" y="0.0" width="450" height="198"/>
|
||||||
<autoresizingMask key="autoresizingMask"/>
|
<autoresizingMask key="autoresizingMask"/>
|
||||||
<subviews>
|
|
||||||
<scrollView borderType="none" autohidesScrollers="YES" horizontalLineScroll="96" horizontalPageScroll="10" verticalLineScroll="96" verticalPageScroll="10" hasHorizontalScroller="NO" horizontalScrollElasticity="none" translatesAutoresizingMaskIntoConstraints="NO" id="Kfs-n2-RYk">
|
|
||||||
<rect key="frame" x="0.0" y="0.0" width="450" height="198"/>
|
|
||||||
<clipView key="contentView" copiesOnScroll="NO" id="yAN-Ex-RC7">
|
|
||||||
<rect key="frame" x="0.0" y="0.0" width="450" height="198"/>
|
|
||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
|
||||||
<subviews>
|
|
||||||
<tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" columnReordering="NO" columnResizing="NO" autosaveColumns="NO" typeSelect="NO" rowHeight="96" viewBased="YES" id="DRs-j8-R9a" customClass="TimelineTableView" customModule="NetNewsWire" customModuleProvider="target">
|
|
||||||
<rect key="frame" x="0.0" y="0.0" width="450" height="198"/>
|
|
||||||
<autoresizingMask key="autoresizingMask"/>
|
|
||||||
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
|
|
||||||
<color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
|
|
||||||
<tableColumns>
|
|
||||||
<tableColumn width="447" minWidth="40" maxWidth="1000" id="5h5-G1-xGq">
|
|
||||||
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border">
|
|
||||||
<font key="font" metaFont="smallSystem"/>
|
|
||||||
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
|
|
||||||
<color key="backgroundColor" name="headerColor" catalog="System" colorSpace="catalog"/>
|
|
||||||
</tableHeaderCell>
|
|
||||||
<textFieldCell key="dataCell" lineBreakMode="truncatingTail" selectable="YES" editable="YES" title="Text Cell" id="smc-tO-NIc">
|
|
||||||
<font key="font" metaFont="system"/>
|
|
||||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
|
||||||
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
|
|
||||||
</textFieldCell>
|
|
||||||
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
|
|
||||||
</tableColumn>
|
|
||||||
</tableColumns>
|
|
||||||
<connections>
|
|
||||||
<outlet property="dataSource" destination="36G-bQ-b96" id="bnC-R1-BcT"/>
|
|
||||||
<outlet property="delegate" destination="36G-bQ-b96" id="s1m-42-GQ4"/>
|
|
||||||
<outlet property="keyboardDelegate" destination="ZOV-xh-WJE" id="HiG-Bz-vD0"/>
|
|
||||||
<outlet property="menu" destination="gb5-z4-YPr" id="pey-0u-ogu"/>
|
|
||||||
</connections>
|
|
||||||
</tableView>
|
|
||||||
</subviews>
|
|
||||||
</clipView>
|
|
||||||
<scroller key="horizontalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="YES" id="9r2-h4-K46">
|
|
||||||
<rect key="frame" x="-100" y="-100" width="223" height="15"/>
|
|
||||||
<autoresizingMask key="autoresizingMask"/>
|
|
||||||
</scroller>
|
|
||||||
<scroller key="verticalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="NO" id="hSI-DO-hVu">
|
|
||||||
<rect key="frame" x="224" y="17" width="15" height="102"/>
|
|
||||||
<autoresizingMask key="autoresizingMask"/>
|
|
||||||
</scroller>
|
|
||||||
</scrollView>
|
|
||||||
</subviews>
|
|
||||||
<constraints>
|
|
||||||
<constraint firstAttribute="trailing" secondItem="Kfs-n2-RYk" secondAttribute="trailing" id="F6K-ec-Sge"/>
|
|
||||||
<constraint firstItem="Kfs-n2-RYk" firstAttribute="leading" secondItem="Dnl-L5-xFP" secondAttribute="leading" id="Leg-dK-IeP"/>
|
|
||||||
<constraint firstAttribute="bottom" secondItem="Kfs-n2-RYk" secondAttribute="bottom" id="Xc2-9H-WP5"/>
|
|
||||||
<constraint firstItem="Kfs-n2-RYk" firstAttribute="top" secondItem="Dnl-L5-xFP" secondAttribute="top" id="hdo-Qf-B6h"/>
|
|
||||||
</constraints>
|
|
||||||
</view>
|
</view>
|
||||||
<connections>
|
<connections>
|
||||||
<outlet property="tableView" destination="DRs-j8-R9a" id="2AG-SP-7n2"/>
|
<outlet property="containerView" destination="Dnl-L5-xFP" id="kYD-K2-FOj"/>
|
||||||
</connections>
|
</connections>
|
||||||
</viewController>
|
</viewController>
|
||||||
<customObject id="Ebq-4s-EwK" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
|
<customObject id="Ebq-4s-EwK" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
|
||||||
<menu id="gb5-z4-YPr">
|
|
||||||
<items>
|
|
||||||
<menuItem title="Item 1" id="Ikx-w7-cua">
|
|
||||||
<modifierMask key="keyEquivalentModifierMask"/>
|
|
||||||
</menuItem>
|
|
||||||
<menuItem title="Item 2" id="QX3-hL-Dqh">
|
|
||||||
<modifierMask key="keyEquivalentModifierMask"/>
|
|
||||||
</menuItem>
|
|
||||||
<menuItem title="Item 3" id="IsQ-j7-Njb">
|
|
||||||
<modifierMask key="keyEquivalentModifierMask"/>
|
|
||||||
</menuItem>
|
|
||||||
</items>
|
|
||||||
<connections>
|
|
||||||
<outlet property="delegate" destination="36G-bQ-b96" id="mno-4b-OJB"/>
|
|
||||||
</connections>
|
|
||||||
</menu>
|
|
||||||
<customObject id="ZOV-xh-WJE" customClass="TimelineKeyboardDelegate" customModule="NetNewsWire" customModuleProvider="target">
|
<customObject id="ZOV-xh-WJE" customClass="TimelineKeyboardDelegate" customModule="NetNewsWire" customModuleProvider="target">
|
||||||
<connections>
|
<connections>
|
||||||
<outlet property="timelineViewController" destination="36G-bQ-b96" id="rED-2Z-kh6"/>
|
<outlet property="timelineViewController" destination="36G-bQ-b96" id="rED-2Z-kh6"/>
|
||||||
|
|
|
@ -48,7 +48,7 @@ final class DetailViewController: NSViewController, WKUIDelegate {
|
||||||
|
|
||||||
// MARK: - API
|
// MARK: - API
|
||||||
|
|
||||||
func showState(_ state: DetailState, mode: TimelineSourceMode) {
|
func setState(_ state: DetailState, mode: TimelineSourceMode) {
|
||||||
// TODO: also to-do is caller
|
// TODO: also to-do is caller
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,11 +10,7 @@ import AppKit
|
||||||
|
|
||||||
final class TimelineContainerView: NSView {
|
final class TimelineContainerView: NSView {
|
||||||
|
|
||||||
override var isOpaque: Bool {
|
private var contentViewConstraints: [NSLayoutConstraint]?
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
var contentViewConstraints: [NSLayoutConstraint]?
|
|
||||||
|
|
||||||
var contentView: NSView? {
|
var contentView: NSView? {
|
||||||
didSet {
|
didSet {
|
||||||
|
@ -38,8 +34,13 @@ final class TimelineContainerView: NSView {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override var isOpaque: Bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
override func draw(_ dirtyRect: NSRect) {
|
override func draw(_ dirtyRect: NSRect) {
|
||||||
NSColor.textBackgroundColor.setFill()
|
NSColor.textBackgroundColor.setFill()
|
||||||
dirtyRect.fill()
|
dirtyRect.fill()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,11 +8,56 @@
|
||||||
|
|
||||||
import Cocoa
|
import Cocoa
|
||||||
|
|
||||||
class TimelineContainerViewController: NSViewController {
|
enum TimelineState {
|
||||||
|
case empty
|
||||||
|
case representedObjects([AnyObject])
|
||||||
|
}
|
||||||
|
|
||||||
|
final class TimelineContainerViewController: NSViewController {
|
||||||
|
|
||||||
|
@IBOutlet var containerView: TimelineContainerView!
|
||||||
|
|
||||||
|
private var states: [TimelineSourceMode: TimelineState] = [.regular: .empty, .search: .empty]
|
||||||
|
|
||||||
|
private lazy var regularTimelineViewController = {
|
||||||
|
return TimelineViewController(delegate: self)
|
||||||
|
}()
|
||||||
|
private lazy var searchTimelineViewController = {
|
||||||
|
return TimelineViewController(delegate: self)
|
||||||
|
}()
|
||||||
|
|
||||||
override func viewDidLoad() {
|
override func viewDidLoad() {
|
||||||
super.viewDidLoad()
|
super.viewDidLoad()
|
||||||
// Do view setup here.
|
setState(.empty, mode: .regular)
|
||||||
|
showTimeline(for: .regular)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MARK: - API
|
||||||
|
|
||||||
|
func setState(_ state: TimelineState, mode: TimelineSourceMode) {
|
||||||
|
timelineViewController(for: mode).state = state
|
||||||
|
}
|
||||||
|
|
||||||
|
func showTimeline(for mode: TimelineSourceMode) {
|
||||||
|
containerView.contentView = timelineViewController(for: mode).view
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension TimelineContainerViewController: TimelineDelegate {
|
||||||
|
|
||||||
|
func selectionDidChange(in: TimelineViewController) {
|
||||||
|
// TODO: notify MainWindowController
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private extension TimelineContainerViewController {
|
||||||
|
|
||||||
|
func timelineViewController(for mode: TimelineSourceMode) -> TimelineViewController {
|
||||||
|
switch mode {
|
||||||
|
case .regular:
|
||||||
|
return regularTimelineViewController
|
||||||
|
case .search:
|
||||||
|
return searchTimelineViewController
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,6 +40,9 @@
|
||||||
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
|
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
|
||||||
</tableColumn>
|
</tableColumn>
|
||||||
</tableColumns>
|
</tableColumns>
|
||||||
|
<connections>
|
||||||
|
<outlet property="menu" destination="zCu-LD-kHw" id="nNl-iz-nVl"/>
|
||||||
|
</connections>
|
||||||
</tableView>
|
</tableView>
|
||||||
</subviews>
|
</subviews>
|
||||||
</clipView>
|
</clipView>
|
||||||
|
@ -52,5 +55,21 @@
|
||||||
<autoresizingMask key="autoresizingMask"/>
|
<autoresizingMask key="autoresizingMask"/>
|
||||||
</scroller>
|
</scroller>
|
||||||
</scrollView>
|
</scrollView>
|
||||||
|
<menu id="zCu-LD-kHw">
|
||||||
|
<items>
|
||||||
|
<menuItem title="Item 1" id="AJc-Qw-NnP">
|
||||||
|
<modifierMask key="keyEquivalentModifierMask"/>
|
||||||
|
</menuItem>
|
||||||
|
<menuItem title="Item 2" id="YKj-q3-QDG">
|
||||||
|
<modifierMask key="keyEquivalentModifierMask"/>
|
||||||
|
</menuItem>
|
||||||
|
<menuItem title="Item 3" id="IJ0-IS-a6R">
|
||||||
|
<modifierMask key="keyEquivalentModifierMask"/>
|
||||||
|
</menuItem>
|
||||||
|
</items>
|
||||||
|
<connections>
|
||||||
|
<outlet property="delegate" destination="opA-RM-DKR" id="QpK-G8-xCm"/>
|
||||||
|
</connections>
|
||||||
|
</menu>
|
||||||
</objects>
|
</objects>
|
||||||
</document>
|
</document>
|
||||||
|
|
|
@ -12,13 +12,20 @@ import Articles
|
||||||
import Account
|
import Account
|
||||||
|
|
||||||
protocol TimelineDelegate: class {
|
protocol TimelineDelegate: class {
|
||||||
func selectionDidChange(in: TimelineViewController, mode: TimelineSourceMode)
|
func selectionDidChange(in: TimelineViewController)
|
||||||
}
|
}
|
||||||
|
|
||||||
class TimelineViewController: NSViewController, UndoableCommandRunner {
|
final class TimelineViewController: NSViewController, UndoableCommandRunner {
|
||||||
|
|
||||||
@IBOutlet var tableView: TimelineTableView!
|
@IBOutlet var tableView: TimelineTableView!
|
||||||
|
|
||||||
|
var state: TimelineState = .empty {
|
||||||
|
didSet {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private weak var delegate: TimelineDelegate?
|
||||||
var sharingServiceDelegate: NSSharingServiceDelegate?
|
var sharingServiceDelegate: NSSharingServiceDelegate?
|
||||||
|
|
||||||
var selectedArticles: [Article] {
|
var selectedArticles: [Article] {
|
||||||
|
@ -117,6 +124,11 @@ class TimelineViewController: NSViewController, UndoableCommandRunner {
|
||||||
return selectedArticles.count == 1 ? selectedArticles.first : nil
|
return selectedArticles.count == 1 ? selectedArticles.first : nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
convenience init(delegate: TimelineDelegate) {
|
||||||
|
self.init(nibName: "TimelineTableView", bundle: nil)
|
||||||
|
self.delegate = delegate
|
||||||
|
}
|
||||||
|
|
||||||
override func viewDidLoad() {
|
override func viewDidLoad() {
|
||||||
|
|
||||||
cellAppearance = TimelineCellAppearance(theme: appDelegate.currentTheme, showAvatar: false, fontSize: fontSize)
|
cellAppearance = TimelineCellAppearance(theme: appDelegate.currentTheme, showAvatar: false, fontSize: fontSize)
|
||||||
|
|
Loading…
Reference in New Issue