2017-05-27 10:43:27 -07:00
|
|
|
//
|
|
|
|
// TimelineCellAppearance.swift
|
2018-08-28 22:18:24 -07:00
|
|
|
// NetNewsWire
|
2017-05-27 10:43:27 -07:00
|
|
|
//
|
|
|
|
// Created by Brent Simmons on 2/6/16.
|
|
|
|
// Copyright © 2016 Ranchero Software, LLC. All rights reserved.
|
|
|
|
//
|
|
|
|
|
2018-02-02 22:51:32 -08:00
|
|
|
import AppKit
|
2017-05-27 10:43:27 -07:00
|
|
|
|
2018-01-04 21:20:09 -08:00
|
|
|
struct TimelineCellAppearance: Equatable {
|
2017-05-27 10:43:27 -07:00
|
|
|
|
2019-11-05 18:05:57 -06:00
|
|
|
let showIcon: Bool
|
2019-02-07 22:01:31 -08:00
|
|
|
|
2019-04-13 11:48:40 -07:00
|
|
|
let cellPadding = NSEdgeInsets(top: 8.0, left: 18.0, bottom: 10.0, right: 18.0)
|
2017-05-27 10:43:27 -07:00
|
|
|
|
|
|
|
let feedNameFont: NSFont
|
2018-01-04 21:20:09 -08:00
|
|
|
|
2017-05-27 10:43:27 -07:00
|
|
|
let dateFont: NSFont
|
2020-03-23 21:43:54 -05:00
|
|
|
let dateMarginLeft: CGFloat = 8.0
|
2019-04-13 11:48:40 -07:00
|
|
|
|
2017-05-27 10:43:27 -07:00
|
|
|
let titleFont: NSFont
|
2019-04-13 11:48:40 -07:00
|
|
|
let titleBottomMargin: CGFloat = 1.0
|
2020-03-23 21:43:54 -05:00
|
|
|
let titleNumberOfLines = 3
|
2017-05-27 10:43:27 -07:00
|
|
|
|
|
|
|
let textFont: NSFont
|
2018-02-18 16:13:58 -08:00
|
|
|
|
|
|
|
let textOnlyFont: NSFont
|
|
|
|
|
2019-04-13 11:48:40 -07:00
|
|
|
let unreadCircleDimension: CGFloat = 8.0
|
|
|
|
let unreadCircleMarginRight: CGFloat = 8.0
|
2018-02-17 21:46:19 -08:00
|
|
|
|
2019-04-13 11:48:40 -07:00
|
|
|
let starDimension: CGFloat = 13.0
|
2018-02-17 21:46:19 -08:00
|
|
|
|
2019-04-13 11:48:40 -07:00
|
|
|
let drawsGrid = false
|
2017-11-28 21:39:09 -08:00
|
|
|
|
2019-11-05 18:05:57 -06:00
|
|
|
let iconSize = NSSize(width: 48, height: 48)
|
|
|
|
let iconMarginLeft: CGFloat = 8.0
|
|
|
|
let iconMarginRight: CGFloat = 8.0
|
|
|
|
let iconAdjustmentTop: CGFloat = 4.0
|
|
|
|
let iconCornerRadius: CGFloat = 4.0
|
2018-01-04 21:20:09 -08:00
|
|
|
|
|
|
|
let boxLeftMargin: CGFloat
|
|
|
|
|
2019-11-05 18:05:57 -06:00
|
|
|
init(showIcon: Bool, fontSize: FontSize) {
|
2017-05-27 10:43:27 -07:00
|
|
|
|
2020-07-02 11:17:38 +08:00
|
|
|
let actualFontSize = AppDefaults.shared.actualFontSize(for: fontSize)
|
2020-03-23 21:43:54 -05:00
|
|
|
let smallItemFontSize = floor(actualFontSize * 0.90)
|
|
|
|
let largeItemFontSize = actualFontSize
|
2018-02-18 20:28:31 -08:00
|
|
|
|
2020-08-23 19:18:02 -07:00
|
|
|
self.feedNameFont = NSFont.systemFont(ofSize: smallItemFontSize, weight: NSFont.Weight.bold)
|
2020-08-19 11:56:14 -05:00
|
|
|
self.dateFont = NSFont.systemFont(ofSize: smallItemFontSize, weight: NSFont.Weight.bold)
|
2020-03-23 21:58:35 -05:00
|
|
|
self.titleFont = NSFont.systemFont(ofSize: largeItemFontSize, weight: NSFont.Weight.semibold)
|
2020-08-23 21:24:52 -07:00
|
|
|
self.textFont = NSFont.systemFont(ofSize: largeItemFontSize)
|
2018-02-18 20:28:31 -08:00
|
|
|
self.textOnlyFont = NSFont.systemFont(ofSize: largeItemFontSize)
|
|
|
|
|
2019-11-05 18:05:57 -06:00
|
|
|
self.showIcon = showIcon
|
2018-01-04 21:20:09 -08:00
|
|
|
|
2018-02-18 15:13:47 -08:00
|
|
|
let margin = self.cellPadding.left + self.unreadCircleDimension + self.unreadCircleMarginRight
|
2018-01-04 21:20:09 -08:00
|
|
|
self.boxLeftMargin = margin
|
|
|
|
}
|
2017-05-27 10:43:27 -07:00
|
|
|
}
|
|
|
|
|
2018-01-04 21:20:09 -08:00
|
|
|
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
|
|
|
|
}
|
|
|
|
}
|