1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-03-10 06:02:57 +00:00

Make the right end blue if the whole bar is blue.

This commit is contained in:
Mitchell Livingston 2006-06-14 01:53:24 +00:00
parent a3e1af9717
commit 4c9421cfa4

View file

@ -137,31 +137,37 @@ static uint32_t kRed = 0xFF6450FF, //255, 100, 80
float completedWidth = [fTorrent progress] * width, float completedWidth = [fTorrent progress] * width,
remainingWidth = width - completedWidth; remainingWidth = width - completedWidth;
NSImage * barActiveEnd, * barActive; NSImage * barLeftEnd, * barRightEnd;
if ([fTorrent isActive]) BOOL isActive = [fTorrent isActive];
{
barActiveEnd = fProgressEndBlue; //left end
barActive = fProgressBlue; if (remainingWidth == width)
} barLeftEnd = fProgressEndWhite;
else if (isActive)
barLeftEnd = fProgressEndBlue;
else else
{ barLeftEnd = fProgressEndGray;
barActiveEnd = fProgressEndGray;
barActive = fProgressGray;
}
if (completedWidth < 1.0)
barActiveEnd = fProgressEndWhite;
[barActiveEnd compositeToPoint: point operation: NSCompositeSourceOver]; [barLeftEnd compositeToPoint: point operation: NSCompositeSourceOver];
//active bar
point.x += 1.0; point.x += 1.0;
[self placeBar: barActive width: completedWidth point: point]; [self placeBar: isActive ? fProgressBlue : fProgressGray width: completedWidth point: point];
//remaining bar
point.x += completedWidth; point.x += completedWidth;
[self placeBar: fProgressWhite width: remainingWidth point: point]; [self placeBar: fProgressWhite width: remainingWidth point: point];
//right end
if (completedWidth < width)
barRightEnd = fProgressEndWhite;
else if (isActive)
barRightEnd = fProgressEndBlue;
else
barRightEnd = fProgressEndGray;
point.x += remainingWidth; point.x += remainingWidth;
[[fTorrent progress] < 1.0 ? fProgressEndWhite : fProgressEndGray [barRightEnd compositeToPoint: point operation: NSCompositeSourceOver];
compositeToPoint: point operation: NSCompositeSourceOver];
} }
} }