diff --git a/NetNewsWire/MainWindow/Timeline/Cell/TimelineCellAppearance.swift b/NetNewsWire/MainWindow/Timeline/Cell/TimelineCellAppearance.swift index 2dabdd0ca..61e7caa4d 100644 --- a/NetNewsWire/MainWindow/Timeline/Cell/TimelineCellAppearance.swift +++ b/NetNewsWire/MainWindow/Timeline/Cell/TimelineCellAppearance.swift @@ -7,89 +7,53 @@ // import AppKit -import DB5 struct TimelineCellAppearance: Equatable { let showAvatar: Bool - let cellPadding: NSEdgeInsets + let cellPadding = NSEdgeInsets(top: 8.0, left: 18.0, bottom: 10.0, right: 18.0) - let feedNameColor: NSColor let feedNameFont: NSFont - let dateColor: NSColor - let dateMarginLeft: CGFloat - let dateMarginBottom: CGFloat let dateFont: NSFont - - let titleColor: NSColor + let dateMarginLeft: CGFloat = 10.0 + let dateMarginBottom: CGFloat = 1.0 + let titleFont: NSFont - let titleBottomMargin: CGFloat - let titleNumberOfLines: Int + let titleBottomMargin: CGFloat = 1.0 + let titleNumberOfLines = 2 - let textColor: NSColor let textFont: NSFont - let textOnlyColor: NSColor let textOnlyFont: NSFont - let unreadCircleColor: NSColor - let unreadCircleDimension: CGFloat - let unreadCircleMarginRight: CGFloat + let unreadCircleDimension: CGFloat = 8.0 + let unreadCircleMarginRight: CGFloat = 8.0 - let starDimension: CGFloat + let starDimension: CGFloat = 13.0 - let gridColor: NSColor - let drawsGrid: Bool + let drawsGrid = false - let avatarSize: NSSize - let avatarMarginLeft: CGFloat - let avatarAdjustmentTop: CGFloat - let avatarCornerRadius: CGFloat + let avatarSize = NSSize(width: 48, height: 48) + let avatarMarginLeft: CGFloat = 8.0 + let avatarAdjustmentTop: CGFloat = 4.0 + let avatarCornerRadius: CGFloat = 4.0 let boxLeftMargin: CGFloat - init(theme: VSTheme, showAvatar: Bool, fontSize: FontSize) { + init(showAvatar: Bool, fontSize: FontSize) { let actualFontSize = AppDefaults.actualFontSize(for: fontSize) let smallItemFontSize = actualFontSize //floor(actualFontSize * 0.95) let largeItemFontSize = actualFontSize //floor(actualFontSize * 1.1) - self.cellPadding = theme.edgeInsets(forKey: "MainWindow.Timeline.cell.padding") - - self.feedNameColor = theme.color(forKey: "MainWindow.Timeline.cell.feedNameColor") self.feedNameFont = NSFont.systemFont(ofSize: smallItemFontSize) - - self.dateColor = theme.color(forKey: "MainWindow.Timeline.cell.dateColor") self.dateFont = NSFont.systemFont(ofSize: smallItemFontSize, weight: NSFont.Weight.bold) - self.dateMarginLeft = theme.float(forKey: "MainWindow.Timeline.cell.dateMarginLeft") - self.dateMarginBottom = theme.float(forKey: "MainWindow.Timeline.cell.dateMarginBottom") - - self.titleColor = theme.color(forKey: "MainWindow.Timeline.cell.titleColor") self.titleFont = NSFont.systemFont(ofSize: largeItemFontSize, weight: NSFont.Weight.semibold) - self.titleBottomMargin = theme.float(forKey: "MainWindow.Timeline.cell.titleMarginBottom") - self.titleNumberOfLines = theme.integer(forKey: "MainWindow.Timeline.cell.titleMaximumLines") - - self.textColor = theme.color(forKey: "MainWindow.Timeline.cell.textColor") self.textFont = NSFont.systemFont(ofSize: largeItemFontSize) - - self.textOnlyColor = theme.color(forKey: "MainWindow.Timeline.cell.textOnlyColor") self.textOnlyFont = NSFont.systemFont(ofSize: largeItemFontSize) - self.unreadCircleColor = theme.color(forKey: "MainWindow.Timeline.cell.unreadCircleColor") - self.unreadCircleDimension = theme.float(forKey: "MainWindow.Timeline.cell.unreadCircleDimension") - self.unreadCircleMarginRight = theme.float(forKey: "MainWindow.Timeline.cell.unreadCircleMarginRight") - - self.starDimension = theme.float(forKey: "MainWindow.Timeline.cell.starDimension") - - self.gridColor = theme.colorWithAlpha(forKey: "MainWindow.Timeline.gridColor") - self.drawsGrid = theme.bool(forKey: "MainWindow.Timeline.drawsGrid") - - self.avatarSize = theme.size(forKey: "MainWindow.Timeline.cell.avatar") - self.avatarMarginLeft = theme.float(forKey: "MainWindow.Timeline.cell.avatarMarginLeft") - self.avatarAdjustmentTop = theme.float(forKey: "MainWindow.Timeline.cell.avatarAdjustmentTop") - self.avatarCornerRadius = theme.float(forKey: "MainWindow.Timeline.cell.avatarCornerRadius") self.showAvatar = showAvatar let margin = self.cellPadding.left + self.unreadCircleDimension + self.unreadCircleMarginRight @@ -100,7 +64,6 @@ struct TimelineCellAppearance: Equatable { extension NSEdgeInsets: Equatable { public static func ==(lhs: NSEdgeInsets, rhs: NSEdgeInsets) -> Bool { - return lhs.left == rhs.left && lhs.top == rhs.top && lhs.right == rhs.right && lhs.bottom == rhs.bottom } } diff --git a/NetNewsWire/MainWindow/Timeline/TimelineViewController.swift b/NetNewsWire/MainWindow/Timeline/TimelineViewController.swift index b402f3675..048d2b1de 100644 --- a/NetNewsWire/MainWindow/Timeline/TimelineViewController.swift +++ b/NetNewsWire/MainWindow/Timeline/TimelineViewController.swift @@ -126,8 +126,8 @@ final class TimelineViewController: NSViewController, UndoableCommandRunner { override func viewDidLoad() { - cellAppearance = TimelineCellAppearance(theme: appDelegate.currentTheme, showAvatar: false, fontSize: fontSize) - cellAppearanceWithAvatar = TimelineCellAppearance(theme: appDelegate.currentTheme, showAvatar: true, fontSize: fontSize) + cellAppearance = TimelineCellAppearance(showAvatar: false, fontSize: fontSize) + cellAppearanceWithAvatar = TimelineCellAppearance(showAvatar: true, fontSize: fontSize) updateRowHeights() tableView.rowHeight = currentRowHeight @@ -178,8 +178,8 @@ final class TimelineViewController: NSViewController, UndoableCommandRunner { private func fontSizeDidChange() { - cellAppearance = TimelineCellAppearance(theme: appDelegate.currentTheme, showAvatar: false, fontSize: fontSize) - cellAppearanceWithAvatar = TimelineCellAppearance(theme: appDelegate.currentTheme, showAvatar: true, fontSize: fontSize) + cellAppearance = TimelineCellAppearance(showAvatar: false, fontSize: fontSize) + cellAppearanceWithAvatar = TimelineCellAppearance(showAvatar: true, fontSize: fontSize) updateRowHeights() performBlockAndRestoreSelection { tableView.reloadData()