From b97fa092707a148b851dc88b9ccb32d7132e583e Mon Sep 17 00:00:00 2001 From: Mitchell Livingston Date: Fri, 2 Jan 2009 01:10:54 +0000 Subject: [PATCH] clean up the table text coloring code; trivial cleanup --- macosx/BadgeView.h | 2 +- macosx/BadgeView.m | 6 +++--- macosx/Badger.m | 8 +++----- macosx/FileNameCell.m | 21 ++++++++++++--------- macosx/GroupsController.m | 2 +- macosx/TorrentCell.m | 3 +-- 6 files changed, 21 insertions(+), 21 deletions(-) diff --git a/macosx/BadgeView.h b/macosx/BadgeView.h index 716ac768b..31139db8a 100644 --- a/macosx/BadgeView.h +++ b/macosx/BadgeView.h @@ -37,7 +37,7 @@ - (id) initWithFrame: (NSRect) frame lib: (tr_session *) lib; -- (BOOL) setRatesWithDownload: (CGFloat) downloadRate upload: (CGFloat) uploadRate; +- (void) displayRatesWithDownload: (CGFloat) downloadRate upload: (CGFloat) uploadRate; - (void) setQuitting; @end diff --git a/macosx/BadgeView.m b/macosx/BadgeView.m index 9fe5dd9fc..0953d4372 100644 --- a/macosx/BadgeView.m +++ b/macosx/BadgeView.m @@ -54,15 +54,15 @@ [super dealloc]; } -- (BOOL) setRatesWithDownload: (CGFloat) downloadRate upload: (CGFloat) uploadRate +- (void) displayRatesWithDownload: (CGFloat) downloadRate upload: (CGFloat) uploadRate { //only needs update if the badges were displayed or are displayed now if (fDownloadRate == downloadRate && fUploadRate == uploadRate) - return NO; + return; fDownloadRate = downloadRate; fUploadRate = uploadRate; - return YES; + [self display]; } - (void) setQuitting diff --git a/macosx/Badger.m b/macosx/Badger.m index a6a01c1f7..8d2ae415e 100644 --- a/macosx/Badger.m +++ b/macosx/Badger.m @@ -56,13 +56,11 @@ - (void) updateBadge { float downloadRate = [[NSUserDefaults standardUserDefaults] boolForKey: @"BadgeDownloadRate"] - ? tr_sessionGetPieceSpeed(fLib, TR_DOWN) : 0.0f; + ? tr_sessionGetPieceSpeed(fLib, TR_DOWN) : 0.0; float uploadRate = [[NSUserDefaults standardUserDefaults] boolForKey: @"BadgeUploadRate"] - ? tr_sessionGetPieceSpeed(fLib, TR_UP) : 0.0f; + ? tr_sessionGetPieceSpeed(fLib, TR_UP) : 0.0; - //only update if the badged values change - if ([(BadgeView *)[[NSApp dockTile] contentView] setRatesWithDownload: downloadRate upload: uploadRate]) - [[NSApp dockTile] display]; + [(BadgeView *)[[NSApp dockTile] contentView] displayRatesWithDownload: downloadRate upload: uploadRate]; } - (void) incrementCompleted diff --git a/macosx/FileNameCell.m b/macosx/FileNameCell.m index ed96cbec0..78b8a8f2e 100644 --- a/macosx/FileNameCell.m +++ b/macosx/FileNameCell.m @@ -139,21 +139,24 @@ //icon [[self image] drawInRect: [self imageRectForBounds: cellFrame] fromRect: NSZeroRect operation: NSCompositeSourceOver fraction: 1.0]; - //title - NSColor * specialColor = nil; - if ([self isHighlighted] - && [[self highlightColorWithFrame: cellFrame inView: controlView] isEqual: [NSColor alternateSelectedControlColor]]) - specialColor = [NSColor whiteColor]; + NSColor * titleColor, * statusColor; + if ([self backgroundStyle] == NSBackgroundStyleDark) + titleColor = statusColor = [NSColor whiteColor]; else if ([[(FileOutlineView *)[self controlView] torrent] checkForFiles: [(FileListNode *)[self objectValue] indexes]] == NSOffState) - specialColor = [NSColor disabledControlTextColor]; - else; + titleColor = statusColor = [NSColor disabledControlTextColor]; + else + { + titleColor = [NSColor controlTextColor]; + statusColor = [NSColor darkGrayColor]; + } - NSAttributedString * titleString = [self attributedTitleWithColor: specialColor ? specialColor : [NSColor controlTextColor]]; + //title + NSAttributedString * titleString = [self attributedTitleWithColor: titleColor]; NSRect titleRect = [self rectForTitleWithString: titleString inBounds: cellFrame]; [titleString drawInRect: titleRect]; //status - NSAttributedString * statusString = [self attributedStatusWithColor: specialColor ? specialColor : [NSColor darkGrayColor]]; + NSAttributedString * statusString = [self attributedStatusWithColor: statusColor]; NSRect statusRect = [self rectForStatusWithString: statusString withTitleRect: titleRect inBounds: cellFrame]; [statusString drawInRect: statusRect]; } diff --git a/macosx/GroupsController.m b/macosx/GroupsController.m index 0184cbe7d..75a2ba100 100644 --- a/macosx/GroupsController.m +++ b/macosx/GroupsController.m @@ -366,7 +366,7 @@ GroupsController * fGroupsInstance = nil; if ([self torrent: torrent doesMatchRulesForGroupAtIndex: row]) return row; } - return -1; // Default to no group + return -1; } @end diff --git a/macosx/TorrentCell.m b/macosx/TorrentCell.m index a66cc7ec3..6765bb58b 100644 --- a/macosx/TorrentCell.m +++ b/macosx/TorrentCell.m @@ -432,8 +432,7 @@ //text color NSColor * titleColor, * statusColor; - if ([self isHighlighted] - && [[self highlightColorWithFrame: cellFrame inView: controlView] isEqual: [NSColor alternateSelectedControlColor]]) + if ([self backgroundStyle] == NSBackgroundStyleDark) { titleColor = [NSColor whiteColor]; statusColor = [NSColor whiteColor];