1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-03-15 16:29:34 +00:00

Show green in top part of advanced bar to represent available but not-yet downloaded (patch from denisx on irc).

Make filter bar font larger.
This commit is contained in:
Mitchell Livingston 2006-07-16 03:45:55 +00:00
parent 6996e44e0f
commit 0f851c5fd1
2 changed files with 32 additions and 23 deletions

View file

@ -128,11 +128,11 @@
NSDictionary * normalAttributes = [[NSDictionary alloc] initWithObjectsAndKeys:
[NSColor blackColor], NSForegroundColorAttributeName,
[NSFont messageFontOfSize: 11.0], NSFontAttributeName,
[NSFont messageFontOfSize: 12.0], NSFontAttributeName,
stringShadow, NSShadowAttributeName, nil];
NSDictionary * highlightedAttributes = [[NSDictionary alloc] initWithObjectsAndKeys:
[NSColor whiteColor], NSForegroundColorAttributeName,
[NSFont messageFontOfSize: 11.0], NSFontAttributeName,
[NSFont messageFontOfSize: 12.0], NSFontAttributeName,
stringShadow, NSShadowAttributeName, nil];
[stringShadow release];

View file

@ -185,47 +185,56 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
int width = widthFloat; //integers for bars
NSBitmapImageRep * bitmap = [[NSBitmapImageRep alloc]
initWithBitmapDataPlanes: nil pixelsWide: width
pixelsHigh: BAR_HEIGHT bitsPerSample: 8 samplesPerPixel: 4
hasAlpha: YES isPlanar: NO colorSpaceName:
NSCalibratedRGBColorSpace bytesPerRow: 0 bitsPerPixel: 0];
NSBitmapImageRep * bitmap = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes: nil
pixelsWide: width pixelsHigh: BAR_HEIGHT bitsPerSample: 8 samplesPerPixel: 4 hasAlpha: YES
isPlanar: NO colorSpaceName: NSCalibratedRGBColorSpace bytesPerRow: 0 bitsPerPixel: 0];
int h, w;
uint32_t * p;
uint8_t * bitmapData = [bitmap bitmapData];
int bytesPerRow = [bitmap bytesPerRow];
/* Left and right borders */
//left and right borders
p = (uint32_t *) bitmapData;
for( h = 0; h < BAR_HEIGHT; h++ )
for(h = 0; h < BAR_HEIGHT; h++)
{
p[0] = kBorder[h];
p[width - 1] = kBorder[h];
p += bytesPerRow / 4;
}
int8_t * pieces = malloc( width );
int8_t * pieces = malloc(width);
[fTorrent getAvailability: pieces size: width];
int avail = 0;
for (w = 0; w < width; w++)
if (pieces[w] != 0)
avail++;
/* First two lines: dark blue to show progression */
int end = lrintf( floor( [fTorrent progress] * ( width - 2 ) ) );
for( h = 0; h < 2; h++ )
//first two lines: dark blue to show progression, green to show available
int end = lrintf(floor([fTorrent progress] * (width - 2)));
p = (uint32_t *) (bitmapData) + 1;
for (w = 0; w < end; w++)
{
p = (uint32_t *) ( bitmapData + h * bytesPerRow ) + 1;
for( w = 0; w < end; w++ )
p[w] = kBlue4;
for( w = end; w < width - 2; w++ )
p[w] = kBack[h];
p[w] = kBlue4;
p[w + bytesPerRow / 4] = kBlue4;
}
/* Lines 2 to 14: blue or grey depending on whether
we have the piece or not */
for (; w < avail; w++)
{
p[w] = kGreen;
p[w + bytesPerRow / 4] = kGreen;
}
for (; w < width - 2; w++)
{
p[w] = kBack[0];
p[w + bytesPerRow / 4] = kBack[1];
}
//lines 2 to 14: blue or grey depending on whether we have the piece or not
uint32_t color;
for( w = 0; w < width - 2; w++ )
{
/* Point to pixel ( 2 + w, 2 ). We will then draw
"vertically" */
//point to pixel ( 2 + w, 2 ). We will then draw "vertically"
p = (uint32_t *) ( bitmapData + 2 * bytesPerRow ) + 1 + w;
if (pieces[w] < 0)