Small efficiency change.

This commit is contained in:
Mitchell Livingston 2006-07-26 02:54:36 +00:00
parent d5943321f4
commit e6a7986231
2 changed files with 7 additions and 3 deletions

View File

@ -43,6 +43,8 @@
* fRevealOnIcon, * fRevealOffIcon;
NSMutableArray * fKeyStrokes;
NSDictionary * fSmallStatusAttributes;
}
- (void) setTorrents: (NSArray *) torrents;

View File

@ -63,6 +63,9 @@
fKeyStrokes = [[NSMutableArray alloc] init];
fSmallStatusAttributes = [[NSDictionary alloc] initWithObjectsAndKeys:
[NSFont messageFontOfSize: 9.0], NSFontAttributeName, nil];
fDefaults = [NSUserDefaults standardUserDefaults];
}
@ -78,6 +81,7 @@
- (void) dealloc
{
[fKeyStrokes release];
[fSmallStatusAttributes release];
[super dealloc];
}
@ -287,13 +291,11 @@
if (row < 0 || ![fDefaults boolForKey: @"SmallView"])
return NO;
NSDictionary * statusAttributes = [NSDictionary dictionaryWithObjectsAndKeys:
[NSFont messageFontOfSize: 9.0], NSFontAttributeName, nil];
Torrent * torrent = [fTorrents objectAtIndex: row];
NSString * statusString = ![fDefaults boolForKey: @"SmallStatusRegular"] && [torrent isActive]
&& [torrent progress] < 1.0 ? [torrent remainingTimeString] : [torrent shortStatusString];
float statusWidth = [statusString sizeWithAttributes: statusAttributes].width + 3.0;
float statusWidth = [statusString sizeWithAttributes: fSmallStatusAttributes].width + 3.0;
NSRect cellRect = [self frameOfCellAtColumn: [self columnWithIdentifier: @"Torrent"] row: row];
NSRect statusRect = NSMakeRect(NSMaxX(cellRect) - statusWidth, cellRect.origin.y,