From 04293edb6799dd041d211833857688aa840baffc Mon Sep 17 00:00:00 2001 From: Eric Petit Date: Thu, 12 Jan 2006 18:53:05 +0000 Subject: [PATCH] Update 2005-12-14 --- AUTHORS | 3 +++ macosx/Controller.m | 7 +++++-- macosx/NameCell.h | 4 +++- macosx/NameCell.m | 13 +++++++++---- macosx/ProgressCell.h | 3 ++- macosx/ProgressCell.m | 13 +++++++++---- 6 files changed, 31 insertions(+), 12 deletions(-) diff --git a/AUTHORS b/AUTHORS index 7c59c99a8..1a248b275 100644 --- a/AUTHORS +++ b/AUTHORS @@ -15,6 +15,9 @@ Michael Demars + Growl notifications + AppleScript support +Bryan Varner + + BeOS interface + Thanks to: diff --git a/macosx/Controller.m b/macosx/Controller.m index c9ae3eded..3fa47b0fd 100644 --- a/macosx/Controller.m +++ b/macosx/Controller.m @@ -620,13 +620,16 @@ static void sleepCallBack( void * controller, io_service_t y, - (void) tableView: (NSTableView *) t willDisplayCell: (id) cell forTableColumn: (NSTableColumn *) tableColumn row: (int) rowIndex { + BOOL w; + + w = [fWindow isKeyWindow] && rowIndex == [fTableView selectedRow]; if( [[tableColumn identifier] isEqualToString: @"Name"] ) { - [(NameCell *) cell setStat: &fStat[rowIndex]]; + [(NameCell *) cell setStat: &fStat[rowIndex] whiteText: w]; } else if( [[tableColumn identifier] isEqualToString: @"Progress"] ) { - [(ProgressCell *) cell setStat: &fStat[rowIndex]]; + [(ProgressCell *) cell setStat: &fStat[rowIndex] whiteText: w]; } } diff --git a/macosx/NameCell.h b/macosx/NameCell.h index fafd61d77..bbccbcf69 100644 --- a/macosx/NameCell.h +++ b/macosx/NameCell.h @@ -29,12 +29,14 @@ @interface NameCell : NSCell { + BOOL fWhiteText; + NSString * fNameString; NSString * fSizeString; NSString * fTimeString; NSString * fPeersString; } -- (void) setStat: (tr_stat_t *) stat; +- (void) setStat: (tr_stat_t *) stat whiteText: (BOOL) w; @end #endif diff --git a/macosx/NameCell.m b/macosx/NameCell.m index 39ee72cfb..8bcabb470 100644 --- a/macosx/NameCell.m +++ b/macosx/NameCell.m @@ -25,8 +25,10 @@ @implementation NameCell -- (void) setStat: (tr_stat_t *) stat +- (void) setStat: (tr_stat_t *) stat whiteText: (BOOL) w { + fWhiteText = w; + fNameString = [NSString stringWithUTF8String: stat->info.name]; fSizeString = [NSString stringWithFormat: @" (%@)", stringForFileSize( stat->info.totalSize )]; @@ -95,8 +97,11 @@ pen = cellFrame.origin; - attributes = [NSMutableDictionary dictionaryWithCapacity: 1]; - [attributes setObject: [NSFont messageFontOfSize:12.0] + attributes = [NSMutableDictionary dictionaryWithCapacity: 2]; + [attributes setObject: fWhiteText ? [NSColor whiteColor] : + [NSColor blackColor] forKey: NSForegroundColorAttributeName]; + + [attributes setObject: [NSFont messageFontOfSize: 12.0] forKey: NSFontAttributeName]; pen.x += 5; pen.y += 5; @@ -105,7 +110,7 @@ 35 - widthForString( fSizeString, 12 ), 12 ), fSizeString]; [string drawAtPoint: pen withAttributes: attributes]; - [attributes setObject: [NSFont messageFontOfSize:10.0] + [attributes setObject: [NSFont messageFontOfSize: 10.0] forKey: NSFontAttributeName]; pen.x += 5; pen.y += 20; diff --git a/macosx/ProgressCell.h b/macosx/ProgressCell.h index 12a5a0891..77854ec57 100644 --- a/macosx/ProgressCell.h +++ b/macosx/ProgressCell.h @@ -29,6 +29,7 @@ @interface ProgressCell : NSCell { tr_stat_t * fStat; + BOOL fWhiteText; NSString * fDlString; NSString * fUlString; @@ -37,7 +38,7 @@ NSBitmapImageRep * fProgressBmp; } - (id) init; -- (void) setStat: (tr_stat_t *) stat; +- (void) setStat: (tr_stat_t *) stat whiteText: (BOOL) w; - (void) buildSimpleBar; - (void) buildAdvancedBar; - (void) drawWithFrame: (NSRect) cellFrame inView: (NSView *) view; diff --git a/macosx/ProgressCell.m b/macosx/ProgressCell.m index 952d6ed56..2d1e4fc28 100644 --- a/macosx/ProgressCell.m +++ b/macosx/ProgressCell.m @@ -112,12 +112,13 @@ static uint32_t kGreen[] = *********************************************************************** * Readies ourselves to draw updated info. **********************************************************************/ -- (void) setStat: (tr_stat_t *) stat +- (void) setStat: (tr_stat_t *) stat whiteText: (BOOL) w { int i; uint8_t * in, * out; - fStat = stat; + fStat = stat; + fWhiteText = w; /* Update the strings to be displayed */ fDlString = [NSString stringWithFormat: @@ -283,8 +284,12 @@ static uint32_t kGreen[] = [img release]; /* Draw the strings with font 10 */ - attributes = [NSDictionary dictionaryWithObject: - [NSFont messageFontOfSize: 10.0] forKey: NSFontAttributeName]; + attributes = [NSDictionary dictionaryWithObjectsAndKeys: + [NSFont messageFontOfSize: 10.0], + NSFontAttributeName, + fWhiteText ? [NSColor whiteColor] : [NSColor blackColor], + NSForegroundColorAttributeName, + NULL]; pen.x += 5; pen.y += 20; [fDlString drawAtPoint: pen withAttributes: attributes]; pen.x += 0; pen.y += 15;