Fix disclosure triangle padding in the Feed Directory. Implement the Open Home Page command.

This commit is contained in:
Brent Simmons 2018-02-11 17:14:09 -08:00
parent ddf57944be
commit f72da562e0
4 changed files with 56 additions and 12 deletions

View File

@ -28,6 +28,7 @@
842E45E31ED8C681000A8B52 /* KeyboardDelegateProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 842E45E21ED8C681000A8B52 /* KeyboardDelegateProtocol.swift */; };
842E45E51ED8C6B7000A8B52 /* MainWindowSplitView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 842E45E41ED8C6B7000A8B52 /* MainWindowSplitView.swift */; };
842E45E71ED8C747000A8B52 /* DB5.plist in Resources */ = {isa = PBXBuildFile; fileRef = 842E45E61ED8C747000A8B52 /* DB5.plist */; };
843A3B5620311E7700BF76EC /* FeedListOutlineView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 843A3B5520311E7700BF76EC /* FeedListOutlineView.swift */; };
84411E711FE5FBFA004B527F /* SmallIconProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84411E701FE5FBFA004B527F /* SmallIconProvider.swift */; };
8444C8F21FED81840051386C /* OPMLExporter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8444C8F11FED81840051386C /* OPMLExporter.swift */; };
844B5B591FE9FE4F00C7C76A /* SidebarKeyboardDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 844B5B581FE9FE4F00C7C76A /* SidebarKeyboardDelegate.swift */; };
@ -540,6 +541,7 @@
842E45E21ED8C681000A8B52 /* KeyboardDelegateProtocol.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KeyboardDelegateProtocol.swift; sourceTree = "<group>"; };
842E45E41ED8C6B7000A8B52 /* MainWindowSplitView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MainWindowSplitView.swift; sourceTree = "<group>"; };
842E45E61ED8C747000A8B52 /* DB5.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = DB5.plist; path = Evergreen/Resources/DB5.plist; sourceTree = "<group>"; };
843A3B5520311E7700BF76EC /* FeedListOutlineView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FeedListOutlineView.swift; sourceTree = "<group>"; };
84411E701FE5FBFA004B527F /* SmallIconProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SmallIconProvider.swift; sourceTree = "<group>"; };
8444C8F11FED81840051386C /* OPMLExporter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OPMLExporter.swift; sourceTree = "<group>"; };
844B5B581FE9FE4F00C7C76A /* SidebarKeyboardDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SidebarKeyboardDelegate.swift; sourceTree = "<group>"; };
@ -1020,6 +1022,7 @@
84C12A141FF5B0080009A267 /* FeedList.storyboard */,
849A978C1ED9EE4D007D329B /* FeedListWindowController.swift */,
84F204CD1FAACB660076E152 /* FeedListViewController.swift */,
843A3B5520311E7700BF76EC /* FeedListOutlineView.swift */,
84B99C661FAE35E600ECDEDB /* FeedListTreeControllerDelegate.swift */,
84B99C681FAE36B800ECDEDB /* FeedListFolder.swift */,
84B99C6A1FAE370B00ECDEDB /* FeedListFeed.swift */,
@ -1920,6 +1923,7 @@
849A978A1ED9ECEF007D329B /* ArticleStylesManager.swift in Sources */,
84E8E0DB202EC49300562D8F /* TimelineViewController+ContextualMenus.swift in Sources */,
849A97791ED9EC04007D329B /* TimelineStringUtilities.swift in Sources */,
843A3B5620311E7700BF76EC /* FeedListOutlineView.swift in Sources */,
8472058120142E8900AD578B /* FeedInspectorViewController.swift in Sources */,
84F204CE1FAACB660076E152 /* FeedListViewController.swift in Sources */,
845A29241FC9255E007B49E3 /* SidebarCellAppearance.swift in Sources */,

View File

@ -9,7 +9,7 @@
<scene sceneID="joN-Oe-nep">
<objects>
<windowController showSeguePresentationStyle="single" id="z5E-aV-xMb" customClass="FeedListWindowController" customModule="Evergreen" customModuleProvider="target" sceneMemberID="viewController">
<window key="window" identifier="feedDirectoryWindow" title="Feed Directory" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" releasedWhenClosed="NO" showsToolbarButton="NO" visibleAtLaunch="NO" frameAutosaveName="FeedDirectoryWindow" animationBehavior="default" titlebarAppearsTransparent="YES" id="Ty3-Oi-cUp">
<window key="window" identifier="feedDirectoryWindow" title="Feed Directory" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" releasedWhenClosed="NO" showsToolbarButton="NO" visibleAtLaunch="NO" frameAutosaveName="" animationBehavior="default" tabbingMode="disallowed" id="Ty3-Oi-cUp">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="425" y="461" width="300" height="600"/>
@ -33,20 +33,20 @@
<scene sceneID="TKm-CD-zMs">
<objects>
<viewController id="QX3-Wg-cdZ" customClass="FeedListViewController" customModule="Evergreen" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" wantsLayer="YES" id="vp3-VV-Mzw">
<view key="view" id="vp3-VV-Mzw">
<rect key="frame" x="0.0" y="0.0" width="288" height="300"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<scrollView borderType="none" autohidesScrollers="YES" horizontalLineScroll="26" horizontalPageScroll="10" verticalLineScroll="26" verticalPageScroll="10" hasHorizontalScroller="NO" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="rir-se-YCO">
<scrollView borderType="none" autohidesScrollers="YES" horizontalLineScroll="27" horizontalPageScroll="10" verticalLineScroll="27" verticalPageScroll="10" hasHorizontalScroller="NO" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="rir-se-YCO">
<rect key="frame" x="0.0" y="32" width="288" height="268"/>
<clipView key="contentView" drawsBackground="NO" id="vli-sv-HLg">
<rect key="frame" x="0.0" y="0.0" width="288" height="268"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<outlineView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" columnReordering="NO" multipleSelection="NO" autosaveColumns="NO" rowHeight="24" rowSizeStyle="medium" viewBased="YES" floatsGroupRows="NO" indentationPerLevel="23" outlineTableColumn="Ytm-dS-0WJ" id="Hxu-8i-6rp">
<outlineView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" columnReordering="NO" autosaveColumns="NO" rowHeight="24" rowSizeStyle="medium" viewBased="YES" floatsGroupRows="NO" indentationPerLevel="27" outlineTableColumn="Ytm-dS-0WJ" id="Hxu-8i-6rp" customClass="FeedListOutlineView" customModule="Evergreen" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="288" height="268"/>
<autoresizingMask key="autoresizingMask"/>
<size key="intercellSpacing" width="3" height="2"/>
<size key="intercellSpacing" width="2" height="3"/>
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
<color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
<tableColumns>
@ -82,7 +82,7 @@
</connections>
</tableCellView>
<tableCellView identifier="FeedListCell" id="M2x-Bb-n1x" customClass="SidebarCell" customModule="Evergreen" customModuleProvider="target">
<rect key="frame" x="1" y="20" width="285" height="17"/>
<rect key="frame" x="1" y="21" width="285" height="17"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="iAS-DV-SKL">
@ -138,6 +138,9 @@
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="addToFeeds:" target="MKk-xD-0Fh" id="43Z-VU-PTO"/>
</connections>
</button>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Ohy-a3-XkT">
<rect key="frame" x="148" y="3" width="120" height="25"/>
@ -145,6 +148,9 @@
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="openHomePage:" target="MKk-xD-0Fh" id="vJr-gf-SMd"/>
</connections>
</button>
</subviews>
<constraints>

View File

@ -0,0 +1,30 @@
//
// FeedListOutlineView.swift
// Evergreen
//
// Created by Brent Simmons on 2/11/18.
// Copyright © 2018 Ranchero Software. All rights reserved.
//
import AppKit
import RSTree
final class FeedListOutlineView: NSOutlineView {
override func frameOfCell(atColumn column: Int, row: Int) -> NSRect {
// Adjust top-level cells  they were too close to the disclosure indicator.
var frame = super.frameOfCell(atColumn: column, row: row)
let node = item(atRow: row) as! Node
guard let parentNode = node.parent, parentNode.isRoot else {
return frame
}
let adjustment: CGFloat = 4.0
frame.origin.x += adjustment
frame.size.width -= adjustment
return frame
}
}

View File

@ -67,11 +67,15 @@ final class FeedListViewController: NSViewController {
extension FeedListViewController {
func openHomePage(_ sender: Any?) {
@IBAction func openHomePage(_ sender: Any?) {
guard let homePageURL = singleSelectedHomePageURL() else {
return
}
Browser.open(homePageURL, inBackground: false)
}
func addToFeeds(_ sender: Any?) {
@IBAction func addToFeeds(_ sender: Any?) {
}
}
@ -133,8 +137,11 @@ extension FeedListViewController: NSOutlineViewDelegate {
postSidebarSelectionDidChangeNotification(selectedNode.representedObject)
}
}
}
private func configure(_ cell: SidebarCell, _ node: Node) {
private extension FeedListViewController {
func configure(_ cell: SidebarCell, _ node: Node) {
cell.cellAppearance = sidebarCellAppearance
cell.objectValue = node
@ -164,9 +171,6 @@ extension FeedListViewController: NSOutlineViewDelegate {
}
return ""
}
}
private extension FeedListViewController {
func nodeForRow(_ row: Int) -> Node? {