diff --git a/Evergreen.xcodeproj/project.pbxproj b/Evergreen.xcodeproj/project.pbxproj index d9beffcd8..8e85b9f37 100644 --- a/Evergreen.xcodeproj/project.pbxproj +++ b/Evergreen.xcodeproj/project.pbxproj @@ -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; diff --git a/Evergreen/MainWindow/Timeline/Cell/TimelineCellAppearance.swift b/Evergreen/MainWindow/Timeline/Cell/TimelineCellAppearance.swift index 875ff7c10..2d4fc481a 100644 --- a/Evergreen/MainWindow/Timeline/Cell/TimelineCellAppearance.swift +++ b/Evergreen/MainWindow/Timeline/Cell/TimelineCellAppearance.swift @@ -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") diff --git a/Evergreen/MainWindow/Timeline/Cell/TimelineCellLayout.swift b/Evergreen/MainWindow/Timeline/Cell/TimelineCellLayout.swift index decf3dffc..9f08dba9d 100644 --- a/Evergreen/MainWindow/Timeline/Cell/TimelineCellLayout.swift +++ b/Evergreen/MainWindow/Timeline/Cell/TimelineCellLayout.swift @@ -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 { diff --git a/Evergreen/Resources/DB5.plist b/Evergreen/Resources/DB5.plist index 8a8a06706..196dc661c 100644 --- a/Evergreen/Resources/DB5.plist +++ b/Evergreen/Resources/DB5.plist @@ -113,6 +113,8 @@ 4 avatarCornerRadius 7 + starDimension + 19 Detail diff --git a/Evergreen/MainWindow/Sidebar/SmartFeedPasteboardWriter.swift b/Evergreen/SmartFeeds/SmartFeedPasteboardWriter.swift similarity index 100% rename from Evergreen/MainWindow/Sidebar/SmartFeedPasteboardWriter.swift rename to Evergreen/SmartFeeds/SmartFeedPasteboardWriter.swift