Respect Sidebar size preferences from General preferences Issue #2321
This commit is contained in:
parent
314d425c49
commit
c5ec93e8b5
@ -1,7 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="16097" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="B8D-0N-5wS">
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="17147" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="B8D-0N-5wS">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="16097"/>
|
||||
<deployment identifier="macosx"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="17147"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
@ -314,20 +315,20 @@
|
||||
<constraint firstItem="eZS-8K-qiN" firstAttribute="top" secondItem="977-L4-4ey" secondAttribute="top" constant="5" id="M0q-C7-z10"/>
|
||||
</constraints>
|
||||
</visualEffectView>
|
||||
<scrollView borderType="none" autohidesScrollers="YES" horizontalLineScroll="26" horizontalPageScroll="10" verticalLineScroll="26" verticalPageScroll="10" hasHorizontalScroller="NO" horizontalScrollElasticity="none" translatesAutoresizingMaskIntoConstraints="NO" id="cJj-Wv-9ep">
|
||||
<scrollView borderType="none" autohidesScrollers="YES" horizontalLineScroll="28" horizontalPageScroll="10" verticalLineScroll="28" verticalPageScroll="10" hasHorizontalScroller="NO" horizontalScrollElasticity="none" translatesAutoresizingMaskIntoConstraints="NO" id="cJj-Wv-9ep">
|
||||
<rect key="frame" x="0.0" y="0.0" width="166" height="283"/>
|
||||
<clipView key="contentView" drawsBackground="NO" copiesOnScroll="NO" id="2eU-Wz-F9g">
|
||||
<rect key="frame" x="0.0" y="0.0" width="166" height="283"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<outlineView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="firstColumnOnly" selectionHighlightStyle="sourceList" columnReordering="NO" columnResizing="NO" autosaveColumns="NO" typeSelect="NO" rowHeight="26" viewBased="YES" floatsGroupRows="NO" indentationPerLevel="23" outlineTableColumn="ih9-mJ-EA7" id="cnV-kg-Dn2" customClass="SidebarOutlineView" customModule="NetNewsWire" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="167" height="283"/>
|
||||
<outlineView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="firstColumnOnly" tableStyle="sourceList" selectionHighlightStyle="sourceList" columnReordering="NO" columnResizing="NO" autosaveColumns="NO" typeSelect="NO" rowHeight="28" rowSizeStyle="systemDefault" viewBased="YES" floatsGroupRows="NO" indentationPerLevel="13" outlineTableColumn="ih9-mJ-EA7" id="cnV-kg-Dn2" customClass="SidebarOutlineView" customModule="NetNewsWire" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="166" height="283"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<size key="intercellSpacing" width="3" height="0.0"/>
|
||||
<color key="backgroundColor" name="_sourceListBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
|
||||
<tableColumns>
|
||||
<tableColumn width="164" minWidth="23" maxWidth="1000" id="ih9-mJ-EA7">
|
||||
<tableColumn width="134" minWidth="23" maxWidth="1000" id="ih9-mJ-EA7">
|
||||
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border">
|
||||
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="headerColor" catalog="System" colorSpace="catalog"/>
|
||||
@ -340,7 +341,7 @@
|
||||
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES"/>
|
||||
<prototypeCellViews>
|
||||
<tableCellView identifier="HeaderCell" id="qkt-WA-5tB">
|
||||
<rect key="frame" x="1" y="0.0" width="164" height="17"/>
|
||||
<rect key="frame" x="11" y="0.0" width="143" height="17"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<textField verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="fNJ-z1-0Up">
|
||||
@ -358,7 +359,7 @@
|
||||
</connections>
|
||||
</tableCellView>
|
||||
<tableCellView identifier="DataCell" id="HJn-Tm-YNO" customClass="SidebarCell" customModule="NetNewsWire" customModuleProvider="target">
|
||||
<rect key="frame" x="1" y="17" width="164" height="17"/>
|
||||
<rect key="frame" x="11" y="17" width="143" height="17"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
</tableCellView>
|
||||
</prototypeCellViews>
|
||||
@ -616,9 +617,9 @@
|
||||
</scene>
|
||||
</scenes>
|
||||
<resources>
|
||||
<image name="NSAddTemplate" width="11" height="11"/>
|
||||
<image name="NSRefreshTemplate" width="11" height="15"/>
|
||||
<image name="NSShareTemplate" width="11" height="16"/>
|
||||
<image name="NSAddTemplate" width="15" height="13"/>
|
||||
<image name="NSRefreshTemplate" width="14" height="16"/>
|
||||
<image name="NSShareTemplate" width="16" height="17"/>
|
||||
<image name="cleanUp" width="149" height="113"/>
|
||||
<image name="filterInactive" width="100" height="101"/>
|
||||
<image name="markAllRead" width="22" height="19"/>
|
||||
|
@ -10,14 +10,29 @@ import AppKit
|
||||
|
||||
struct SidebarCellAppearance: Equatable {
|
||||
|
||||
let imageSize = CGSize(width: 16, height: 16)
|
||||
let imageSize: CGSize
|
||||
let imageMarginRight: CGFloat = 4.0
|
||||
let unreadCountMarginLeft: CGFloat = 10.0
|
||||
let textFieldFontSize: CGFloat
|
||||
let textFieldFont: NSFont
|
||||
|
||||
init(fontSize: FontSize) {
|
||||
self.textFieldFontSize = AppDefaults.shared.actualFontSize(for: fontSize)
|
||||
init(rowSizeStyle: NSTableView.RowSizeStyle) {
|
||||
switch rowSizeStyle {
|
||||
case .small:
|
||||
imageSize = CGSize(width: 16, height: 16)
|
||||
textFieldFontSize = 11
|
||||
case .large:
|
||||
imageSize = CGSize(width: 24, height: 24)
|
||||
if #available(macOS 10.16, *) {
|
||||
textFieldFontSize = 15
|
||||
} else {
|
||||
textFieldFontSize = 13
|
||||
}
|
||||
default:
|
||||
imageSize = CGSize(width: 20, height: 20)
|
||||
textFieldFontSize = 13
|
||||
}
|
||||
|
||||
self.textFieldFont = NSFont.systemFont(ofSize: textFieldFontSize)
|
||||
}
|
||||
}
|
||||
|
@ -12,6 +12,10 @@ import Articles
|
||||
import Account
|
||||
import RSCore
|
||||
|
||||
extension Notification.Name {
|
||||
static let appleSideBarDefaultIconSizeChanged = Notification.Name("AppleSideBarDefaultIconSizeChanged")
|
||||
}
|
||||
|
||||
protocol SidebarDelegate: class {
|
||||
func sidebarSelectionDidChange(_: SidebarViewController, selectedObjects: [AnyObject]?)
|
||||
func unreadCount(for: AnyObject) -> Int
|
||||
@ -46,7 +50,6 @@ protocol SidebarDelegate: class {
|
||||
|
||||
var undoableCommands = [UndoableCommand]()
|
||||
private var animatingChanges = false
|
||||
private var sidebarCellAppearance: SidebarCellAppearance!
|
||||
|
||||
var renameWindowController: RenameWindowController?
|
||||
|
||||
@ -57,8 +60,6 @@ protocol SidebarDelegate: class {
|
||||
// MARK: - NSViewController
|
||||
|
||||
override func viewDidLoad() {
|
||||
sidebarCellAppearance = SidebarCellAppearance(fontSize: AppDefaults.shared.sidebarFontSize)
|
||||
|
||||
outlineView.dataSource = dataSource
|
||||
outlineView.doubleAction = #selector(doubleClickedSidebar(_:))
|
||||
outlineView.setDraggingSourceOperationMask([.move, .copy], forLocal: true)
|
||||
@ -76,6 +77,7 @@ protocol SidebarDelegate: class {
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(webFeedIconDidBecomeAvailable(_:)), name: .WebFeedIconDidBecomeAvailable, object: nil)
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(webFeedSettingDidChange(_:)), name: .WebFeedSettingDidChange, object: nil)
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(displayNameDidChange(_:)), name: .DisplayNameDidChange, object: nil)
|
||||
DistributedNotificationCenter.default().addObserver(self, selector: #selector(appleSideBarDefaultIconSizeChanged(_:)), name: .appleSideBarDefaultIconSizeChanged, object: nil)
|
||||
|
||||
outlineView.reloadData()
|
||||
|
||||
@ -216,11 +218,14 @@ protocol SidebarDelegate: class {
|
||||
restoreSelection(to: savedSelection, sendNotificationIfChanged: true)
|
||||
}
|
||||
|
||||
@objc func userDidRequestSidebarSelection(_ note: Notification) {
|
||||
guard let feed = note.userInfo?[UserInfoKey.webFeed] else {
|
||||
return
|
||||
@objc func appleSideBarDefaultIconSizeChanged(_ note: Notification) {
|
||||
// The outline view doesn't have the new row style size set yet when we get
|
||||
// this notification, so give it half a second to catch up.
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
|
||||
let savedSelection = self.selectedNodes
|
||||
self.outlineView.reloadData()
|
||||
self.restoreSelection(to: savedSelection, sendNotificationIfChanged: true)
|
||||
}
|
||||
revealAndSelectRepresentedObject(feed as AnyObject)
|
||||
}
|
||||
|
||||
// MARK: - Actions
|
||||
@ -727,7 +732,7 @@ private extension SidebarViewController {
|
||||
}
|
||||
|
||||
func configure(_ cell: SidebarCell, _ node: Node) {
|
||||
cell.cellAppearance = sidebarCellAppearance
|
||||
cell.cellAppearance = SidebarCellAppearance(rowSizeStyle: outlineView.effectiveRowSizeStyle)
|
||||
cell.name = nameFor(node)
|
||||
configureUnreadCount(cell, node)
|
||||
configureFavicon(cell, node)
|
||||
|
Loading…
x
Reference in New Issue
Block a user