mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Start work on laying out the star in the timeline cell.
This commit is contained in:
@@ -974,7 +974,6 @@
|
||||
849A97631ED9EB96007D329B /* UnreadCountView.swift */,
|
||||
845F52EC1FB2B9FC00C10BF0 /* FeedPasteboardWriter.swift */,
|
||||
84AD1EA92031617300BC20B7 /* FolderPasteboardWriter.swift */,
|
||||
84AD1EB92031649C00BC20B7 /* SmartFeedPasteboardWriter.swift */,
|
||||
849A97821ED9EC63007D329B /* SidebarStatusBarView.swift */,
|
||||
84D5BA1F201E8FB6009092BD /* SidebarGearMenuDelegate.swift */,
|
||||
847FA120202BA34100BB56C8 /* SidebarContextualMenuDelegate.swift */,
|
||||
@@ -1317,6 +1316,7 @@
|
||||
845EE7C01FC2488C00854A1F /* SmartFeed.swift */,
|
||||
84F2D5361FC22FCB00998D64 /* TodayFeedDelegate.swift */,
|
||||
845EE7B01FC2366500854A1F /* StarredFeedDelegate.swift */,
|
||||
84AD1EB92031649C00BC20B7 /* SmartFeedPasteboardWriter.swift */,
|
||||
);
|
||||
name = SmartFeeds;
|
||||
path = Evergreen/SmartFeeds;
|
||||
|
||||
@@ -30,7 +30,9 @@ struct TimelineCellAppearance: Equatable {
|
||||
let unreadCircleColor: NSColor
|
||||
let unreadCircleDimension: CGFloat
|
||||
let unreadCircleMarginRight: CGFloat
|
||||
|
||||
|
||||
let starDimension: CGFloat
|
||||
|
||||
let gridColor: NSColor
|
||||
|
||||
let avatarSize: NSSize
|
||||
@@ -65,6 +67,8 @@ struct TimelineCellAppearance: Equatable {
|
||||
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")
|
||||
|
||||
|
||||
@@ -18,16 +18,18 @@ struct TimelineCellLayout {
|
||||
let dateRect: NSRect
|
||||
let titleRect: NSRect
|
||||
let unreadIndicatorRect: NSRect
|
||||
let starRect: NSRect
|
||||
let avatarImageRect: NSRect
|
||||
let paddingBottom: CGFloat
|
||||
|
||||
init(width: CGFloat, feedNameRect: NSRect, dateRect: NSRect, titleRect: NSRect, unreadIndicatorRect: NSRect, avatarImageRect: NSRect, paddingBottom: CGFloat) {
|
||||
init(width: CGFloat, feedNameRect: NSRect, dateRect: NSRect, titleRect: NSRect, unreadIndicatorRect: NSRect, starRect: NSRect, avatarImageRect: NSRect, paddingBottom: CGFloat) {
|
||||
|
||||
self.width = width
|
||||
self.feedNameRect = feedNameRect
|
||||
self.dateRect = dateRect
|
||||
self.titleRect = titleRect
|
||||
self.unreadIndicatorRect = unreadIndicatorRect
|
||||
self.starRect = starRect
|
||||
self.avatarImageRect = avatarImageRect
|
||||
self.paddingBottom = paddingBottom
|
||||
|
||||
@@ -113,10 +115,21 @@ private func rectForUnreadIndicator(_ cellData: TimelineCellData, _ appearance:
|
||||
r.size = NSSize(width: appearance.unreadCircleDimension, height: appearance.unreadCircleDimension)
|
||||
r.origin.x = appearance.cellPadding.left
|
||||
r = RSRectCenteredVerticallyInRect(r, titleLine1Rect)
|
||||
r.origin.y += 1
|
||||
|
||||
return r
|
||||
}
|
||||
|
||||
private func rectForStar(_ cellData: TimelineCellData, _ appearance: TimelineCellAppearance, _ unreadIndicatorRect: NSRect) -> NSRect {
|
||||
|
||||
var r = NSRect.zero
|
||||
r.size.width = appearance.starDimension
|
||||
r.size.height = appearance.starDimension
|
||||
r.origin.x = floor(unreadIndicatorRect.origin.x - ((appearance.starDimension - appearance.unreadCircleDimension) / 2.0))
|
||||
r.origin.y = unreadIndicatorRect.origin.y
|
||||
return r
|
||||
}
|
||||
|
||||
private func rectForAvatar(_ cellData: TimelineCellData, _ appearance: TimelineCellAppearance, _ titleLine1Rect: NSRect) -> NSRect {
|
||||
|
||||
var r = NSRect.zero
|
||||
@@ -136,10 +149,11 @@ func timelineCellLayout(_ width: CGFloat, cellData: TimelineCellData, appearance
|
||||
let dateRect = rectForDate(cellData, width, appearance, titleRect)
|
||||
let feedNameRect = rectForFeedName(cellData, width, appearance, dateRect)
|
||||
let unreadIndicatorRect = rectForUnreadIndicator(cellData, appearance, titleLine1Rect)
|
||||
let starRect = rectForStar(cellData, appearance, unreadIndicatorRect)
|
||||
// let faviconRect = rectForFavicon(cellData, appearance, feedNameRect, unreadIndicatorRect)
|
||||
let avatarImageRect = rectForAvatar(cellData, appearance, titleLine1Rect)
|
||||
|
||||
return TimelineCellLayout(width: width, feedNameRect: feedNameRect, dateRect: dateRect, titleRect: titleRect, unreadIndicatorRect: unreadIndicatorRect, avatarImageRect: avatarImageRect, paddingBottom: appearance.cellPadding.bottom)
|
||||
return TimelineCellLayout(width: width, feedNameRect: feedNameRect, dateRect: dateRect, titleRect: titleRect, unreadIndicatorRect: unreadIndicatorRect, starRect: starRect, avatarImageRect: avatarImageRect, paddingBottom: appearance.cellPadding.bottom)
|
||||
}
|
||||
|
||||
func timelineCellHeight(_ width: CGFloat, cellData: TimelineCellData, appearance: TimelineCellAppearance) -> CGFloat {
|
||||
|
||||
@@ -113,6 +113,8 @@
|
||||
<integer>4</integer>
|
||||
<key>avatarCornerRadius</key>
|
||||
<integer>7</integer>
|
||||
<key>starDimension</key>
|
||||
<integer>19</integer>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>Detail</key>
|
||||
|
||||
Reference in New Issue
Block a user