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

more adjustments to the pieces view

This commit is contained in:
Mitchell Livingston 2008-06-09 22:44:08 +00:00
parent 09db9d7f0c
commit 41ff271f20

View file

@ -24,6 +24,7 @@
#import "PiecesView.h" #import "PiecesView.h"
#import "InfoWindowController.h" #import "InfoWindowController.h"
#import "CTGradient.h"
#define MAX_ACROSS 18 #define MAX_ACROSS 18
#define BETWEEN 1.0 #define BETWEEN 1.0
@ -32,14 +33,13 @@
- (void) awakeFromNib - (void) awakeFromNib
{ {
NSBezierPath * bp = [NSBezierPath bezierPathWithRect: [self bounds]];
//back image //back image
fBack = [[NSImage alloc] initWithSize: [self bounds].size]; fBack = [[NSImage alloc] initWithSize: [self bounds].size];
[fBack lockFocus]; [fBack lockFocus];
[[NSColor colorWithCalibratedWhite: 0.0 alpha: 0.4] set]; CTGradient * gradient = [CTGradient gradientWithBeginningColor: [NSColor colorWithCalibratedWhite: 0.0 alpha: 0.4]
[bp fill]; endingColor: [NSColor colorWithCalibratedWhite: 0.25 alpha: 0.4]];
[gradient fillRect: [self bounds] angle: 90.0];
[fBack unlockFocus]; [fBack unlockFocus];
//store box colors //store box colors
@ -143,8 +143,7 @@
[fTorrent getAmountFinished: piecesPercent size: fNumPieces]; [fTorrent getAmountFinished: piecesPercent size: fNumPieces];
} }
int i, j, piece, index = -1; int i, j, index = -1;
float piecePercent;
NSRect rect = NSMakeRect(0, 0, fWidth, fWidth); NSRect rect = NSMakeRect(0, 0, fWidth, fWidth);
BOOL change = NO; BOOL change = NO;
@ -162,9 +161,9 @@
NSColor * pieceColor = nil; NSColor * pieceColor = nil;
if (showAvailablity) if (showAvailablity)
{ {if (index==0) NSLog(@"%d", pieces[index]);
piece = pieces[index]; int piece = pieces[index];
if (piece < 0) if (piece == -1)
{ {
if (first || fPieces[index] == -2) if (first || fPieces[index] == -2)
{ {
@ -212,8 +211,8 @@
} }
} }
else else
{ {if (index==0) NSLog(@"%f", piecesPercent[index]);
piecePercent = piecesPercent[index]; float piecePercent = piecesPercent[index];
if (piecePercent >= 1.0) if (piecePercent >= 1.0)
{ {
if (first || fPieces[index] == -2) if (first || fPieces[index] == -2)
@ -228,7 +227,7 @@
} }
else; else;
} }
else if (piecePercent <= 0.0) else if (piecePercent == 0.0)
{ {
if (first || fPieces[index] != 0) if (first || fPieces[index] != 0)
{ {