From beaa865fb87b62d54f147a8bcc467441bd4722bd Mon Sep 17 00:00:00 2001 From: Mitchell Livingston Date: Sat, 7 Nov 2009 04:08:42 +0000 Subject: [PATCH] the red unavailable bar wasn't showing if none of the desired data was available --- macosx/TorrentCell.m | 40 +++++++++++++++++++--------------------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/macosx/TorrentCell.m b/macosx/TorrentCell.m index 9819b8981..7d8f51542 100644 --- a/macosx/TorrentCell.m +++ b/macosx/TorrentCell.m @@ -629,33 +629,31 @@ } } - if (!NSIsEmptyRect(missingRect)) + if (![torrent allDownloaded]) { - if (![torrent allDownloaded]) + const CGFloat widthRemaining = floorf(NSWidth(barRect) * [torrent progressLeft]); + + NSRect wantedRect; + NSDivideRect(missingRect, &wantedRect, &missingRect, widthRemaining, NSMinXEdge); + + //not-available section + if ([torrent isActive] && ![torrent isChecking] && [fDefaults boolForKey: @"DisplayProgressBarAvailable"] + && [torrent availableDesired] < 1.0) { - const CGFloat widthRemaining = floorf(NSWidth(barRect) * [torrent progressLeft]); - - NSRect wantedRect; - NSDivideRect(missingRect, &wantedRect, &missingRect, widthRemaining, NSMinXEdge); + NSRect unavailableRect; + NSDivideRect(wantedRect, &wantedRect, &unavailableRect, floorf(NSWidth(wantedRect) * [torrent availableDesired]), + NSMinXEdge); - //not-available section - if ([torrent isActive] && ![torrent isChecking] && [fDefaults boolForKey: @"DisplayProgressBarAvailable"] - && [torrent availableDesired] > 0.0) - { - NSRect unavailableRect; - NSDivideRect(wantedRect, &wantedRect, &unavailableRect, floorf([torrent availableDesired] * NSWidth(wantedRect)), - NSMinXEdge); - - [[ProgressGradients progressRedGradient] drawInRect: unavailableRect angle: 90]; - } - - //remaining section - [[ProgressGradients progressWhiteGradient] drawInRect: wantedRect angle: 90]; + [[ProgressGradients progressRedGradient] drawInRect: unavailableRect angle: 90]; } - //unwanted section - [[ProgressGradients progressLightGrayGradient] drawInRect: missingRect angle: 90]; + //remaining section + [[ProgressGradients progressWhiteGradient] drawInRect: wantedRect angle: 90]; } + + //unwanted section + if (!NSIsEmptyRect(missingRect)) + [[ProgressGradients progressLightGrayGradient] drawInRect: missingRect angle: 90]; } - (void) drawPiecesBar: (NSRect) barRect -- 2.40.0