2017-05-27 19:43:27 +02:00
|
|
|
//
|
|
|
|
// TimelineCellAppearance.swift
|
2018-08-29 07:18:24 +02:00
|
|
|
// NetNewsWire
|
2017-05-27 19:43:27 +02:00
|
|
|
//
|
|
|
|
// Created by Brent Simmons on 2/6/16.
|
|
|
|
// Copyright © 2016 Ranchero Software, LLC. All rights reserved.
|
|
|
|
//
|
|
|
|
|
2018-02-03 07:51:32 +01:00
|
|
|
import AppKit
|
2017-05-27 19:43:27 +02:00
|
|
|
|
2018-01-05 06:20:09 +01:00
|
|
|
struct TimelineCellAppearance: Equatable {
|
2017-05-27 19:43:27 +02:00
|
|
|
|
2019-02-08 07:01:31 +01:00
|
|
|
let showAvatar: Bool
|
|
|
|
|
2019-04-13 20:48:40 +02:00
|
|
|
let cellPadding = NSEdgeInsets(top: 8.0, left: 18.0, bottom: 10.0, right: 18.0)
|
2017-05-27 19:43:27 +02:00
|
|
|
|
|
|
|
let feedNameFont: NSFont
|
2018-01-05 06:20:09 +01:00
|
|
|
|
2017-05-27 19:43:27 +02:00
|
|
|
let dateFont: NSFont
|
2019-04-13 20:48:40 +02:00
|
|
|
let dateMarginLeft: CGFloat = 10.0
|
|
|
|
let dateMarginBottom: CGFloat = 1.0
|
|
|
|
|
2017-05-27 19:43:27 +02:00
|
|
|
let titleFont: NSFont
|
2019-04-13 20:48:40 +02:00
|
|
|
let titleBottomMargin: CGFloat = 1.0
|
|
|
|
let titleNumberOfLines = 2
|
2017-05-27 19:43:27 +02:00
|
|
|
|
|
|
|
let textFont: NSFont
|
2018-02-19 01:13:58 +01:00
|
|
|
|
|
|
|
let textOnlyFont: NSFont
|
|
|
|
|
2019-04-13 20:48:40 +02:00
|
|
|
let unreadCircleDimension: CGFloat = 8.0
|
|
|
|
let unreadCircleMarginRight: CGFloat = 8.0
|
2018-02-18 06:46:19 +01:00
|
|
|
|
2019-04-13 20:48:40 +02:00
|
|
|
let starDimension: CGFloat = 13.0
|
2018-02-18 06:46:19 +01:00
|
|
|
|
2019-04-13 20:48:40 +02:00
|
|
|
let drawsGrid = false
|
2017-11-29 06:39:09 +01:00
|
|
|
|
2019-04-13 20:48:40 +02:00
|
|
|
let avatarSize = NSSize(width: 48, height: 48)
|
|
|
|
let avatarMarginLeft: CGFloat = 8.0
|
2019-05-13 05:42:52 +02:00
|
|
|
let avatarMarginRight: CGFloat = 8.0
|
2019-04-13 20:48:40 +02:00
|
|
|
let avatarAdjustmentTop: CGFloat = 4.0
|
|
|
|
let avatarCornerRadius: CGFloat = 4.0
|
2018-01-05 06:20:09 +01:00
|
|
|
|
|
|
|
let boxLeftMargin: CGFloat
|
|
|
|
|
2019-04-13 20:48:40 +02:00
|
|
|
init(showAvatar: Bool, fontSize: FontSize) {
|
2017-05-27 19:43:27 +02:00
|
|
|
|
2017-11-25 06:39:59 +01:00
|
|
|
let actualFontSize = AppDefaults.actualFontSize(for: fontSize)
|
2019-01-30 07:33:27 +01:00
|
|
|
let smallItemFontSize = actualFontSize //floor(actualFontSize * 0.95)
|
|
|
|
let largeItemFontSize = actualFontSize //floor(actualFontSize * 1.1)
|
2018-02-19 05:28:31 +01:00
|
|
|
|
|
|
|
self.feedNameFont = NSFont.systemFont(ofSize: smallItemFontSize)
|
2018-02-24 08:03:01 +01:00
|
|
|
self.dateFont = NSFont.systemFont(ofSize: smallItemFontSize, weight: NSFont.Weight.bold)
|
2018-02-19 05:28:31 +01:00
|
|
|
self.titleFont = NSFont.systemFont(ofSize: largeItemFontSize, weight: NSFont.Weight.semibold)
|
|
|
|
self.textFont = NSFont.systemFont(ofSize: largeItemFontSize)
|
|
|
|
self.textOnlyFont = NSFont.systemFont(ofSize: largeItemFontSize)
|
|
|
|
|
2018-01-05 06:20:09 +01:00
|
|
|
self.showAvatar = showAvatar
|
|
|
|
|
2018-02-19 00:13:47 +01:00
|
|
|
let margin = self.cellPadding.left + self.unreadCircleDimension + self.unreadCircleMarginRight
|
2018-01-05 06:20:09 +01:00
|
|
|
self.boxLeftMargin = margin
|
|
|
|
}
|
2017-05-27 19:43:27 +02:00
|
|
|
}
|
|
|
|
|
2018-01-05 06:20:09 +01: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
|
|
|
|
}
|
|
|
|
}
|