Minimal view status toggle now works only when on actual status text, and even if the row isn't already selected.

This commit is contained in:
Mitchell Livingston
2006-07-26 02:42:07 +00:00
parent 44dd48fa52
commit d5943321f4
2 changed files with 12 additions and 5 deletions

View File

@@ -1113,7 +1113,7 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
[indexSet release];
}
//set status bar torrents
//set status bar torrent count text
NSMutableString * totalTorrentsString = [NSMutableString stringWithString: @""];
if (filtering)
[totalTorrentsString appendFormat: @"%d/", [fFilteredTorrents count]];

View File

@@ -284,13 +284,20 @@
- (BOOL) pointInMinimalStatusRect: (NSPoint) point
{
int row = [self rowAtPoint: point];
if (row < 0 || ![self isRowSelected: row] || ![fDefaults boolForKey: @"SmallView"])
if (row < 0 || ![fDefaults boolForKey: @"SmallView"])
return NO;
const STATUS_WIDTH = 130.0;
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;
NSRect cellRect = [self frameOfCellAtColumn: [self columnWithIdentifier: @"Torrent"] row: row];
NSRect statusRect = NSMakeRect(NSMaxX(cellRect) - STATUS_WIDTH, cellRect.origin.y,
STATUS_WIDTH, cellRect.size.height - BUTTON_WIDTH);
NSRect statusRect = NSMakeRect(NSMaxX(cellRect) - statusWidth, cellRect.origin.y,
statusWidth, cellRect.size.height - BUTTON_WIDTH);
return NSPointInRect(point, statusRect);
}