From dcd012a12c0ed9097c8e516790f1e55b6ac14d3b Mon Sep 17 00:00:00 2001 From: Mitchell Livingston Date: Fri, 6 Apr 2007 15:15:53 +0000 Subject: [PATCH] don't draw for ratio < 0 --- macosx/TorrentCell.m | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/macosx/TorrentCell.m b/macosx/TorrentCell.m index 29632c4a2..161b23eec 100644 --- a/macosx/TorrentCell.m +++ b/macosx/TorrentCell.m @@ -97,19 +97,20 @@ NSDictionary * info = [self objectValue]; width -= 2.0; - - BOOL seeding = [[info objectForKey: @"Seeding"] boolValue], - isActive = [[info objectForKey: @"Active"] boolValue]; float completedWidth, remainingWidth; //bar images and widths NSImage * barLeftEnd, * barRightEnd, * barComplete, * barRemaining; - if (seeding) + if ([[info objectForKey: @"Seeding"] boolValue]) { float stopRatio, ratio; if ((stopRatio = [[info objectForKey: @"StopRatio"] floatValue]) != INVALID && (ratio = [[info objectForKey: @"Ratio"] floatValue]) < stopRatio) + { + if (ratio < 0) + ratio = 0; completedWidth = width * ratio / stopRatio; + } else completedWidth = width; remainingWidth = width - completedWidth; @@ -124,6 +125,8 @@ completedWidth = [[info objectForKey: @"Progress"] floatValue] * width; remainingWidth = width - completedWidth; + BOOL isActive = [[info objectForKey: @"Active"] boolValue]; + if (remainingWidth == width) barLeftEnd = fProgressEndWhite; else if (isActive)