combine some of the code from the last commit
This commit is contained in:
parent
a896093804
commit
6a0038f146
|
@ -33,8 +33,8 @@
|
|||
|
||||
#define PIECE_NONE 0
|
||||
#define PIECE_MIXED 1
|
||||
#define PIECE_FINISHED 2
|
||||
#define PIECE_HIGH_PEERS 3
|
||||
#define PIECE_HIGH_PEERS 2
|
||||
#define PIECE_FINISHED 3
|
||||
#define PIECE_FLASHING 4
|
||||
|
||||
@implementation PiecesView
|
||||
|
@ -145,9 +145,8 @@
|
|||
}
|
||||
|
||||
NSColor * pieceColor = nil;
|
||||
if (showAvailablity)
|
||||
{
|
||||
if (pieces[index] == -1)
|
||||
|
||||
if (showAvailablity ? pieces[index] == -1 : piecesPercent[index] == 1.0)
|
||||
{
|
||||
if (first || fPieces[index] != PIECE_FINISHED)
|
||||
{
|
||||
|
@ -163,7 +162,7 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
else if (pieces[index] == 0)
|
||||
else if (showAvailablity ? pieces[index] == 0 : piecesPercent[index] == 0.0)
|
||||
{
|
||||
if (first || fPieces[index] != PIECE_NONE)
|
||||
{
|
||||
|
@ -171,7 +170,7 @@
|
|||
fPieces[index] = PIECE_NONE;
|
||||
}
|
||||
}
|
||||
else if (pieces[index] >= HIGH_PEERS)
|
||||
else if (showAvailablity && pieces[index] >= HIGH_PEERS)
|
||||
{
|
||||
if (first || fPieces[index] != PIECE_HIGH_PEERS)
|
||||
{
|
||||
|
@ -181,49 +180,12 @@
|
|||
}
|
||||
else
|
||||
{
|
||||
if (first || fPieces[index] != PIECE_MIXED)
|
||||
{
|
||||
float percent = (float)pieces[index]/HIGH_PEERS;
|
||||
pieceColor = [[NSColor whiteColor] blendedColorWithFraction: percent ofColor: fGreenAvailabilityColor];
|
||||
//always redraw "mixed"
|
||||
float percent = showAvailablity ? (float)pieces[index]/HIGH_PEERS : piecesPercent[index];
|
||||
NSColor * fullColor = showAvailablity ? fGreenAvailabilityColor : fBluePieceColor;
|
||||
pieceColor = [[NSColor whiteColor] blendedColorWithFraction: percent ofColor: fullColor];
|
||||
fPieces[index] = PIECE_MIXED;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (piecesPercent[index] == 1.0)
|
||||
{
|
||||
if (first || fPieces[index] != PIECE_FINISHED)
|
||||
{
|
||||
if (!first && fPieces[index] != PIECE_FLASHING)
|
||||
{
|
||||
pieceColor = [NSColor orangeColor];
|
||||
fPieces[index] = PIECE_FLASHING;
|
||||
}
|
||||
else
|
||||
{
|
||||
pieceColor = fBluePieceColor;
|
||||
fPieces[index] = PIECE_FINISHED;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (piecesPercent[index] == 0.0)
|
||||
{
|
||||
if (first || fPieces[index] != PIECE_NONE)
|
||||
{
|
||||
pieceColor = [NSColor whiteColor];
|
||||
fPieces[index] = PIECE_NONE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (first || fPieces[index] != PIECE_MIXED)
|
||||
{
|
||||
pieceColor = [[NSColor whiteColor] blendedColorWithFraction: piecesPercent[index] ofColor: fBluePieceColor];
|
||||
fPieces[index] = PIECE_MIXED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (pieceColor)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue