clean up the table text coloring code; trivial cleanup

This commit is contained in:
Mitchell Livingston 2009-01-02 01:10:54 +00:00
parent 2eb2dacd50
commit b97fa09270
6 changed files with 21 additions and 21 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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];
}

View File

@ -366,7 +366,7 @@ GroupsController * fGroupsInstance = nil;
if ([self torrent: torrent doesMatchRulesForGroupAtIndex: row])
return row;
}
return -1; // Default to no group
return -1;
}
@end

View File

@ -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];