mirror of
https://github.com/transmission/transmission
synced 2024-12-24 00:34:04 +00:00
simplify the drawing of group colors for transfers
This commit is contained in:
parent
131a79c702
commit
3a1c463fee
2 changed files with 14 additions and 12 deletions
|
@ -34,7 +34,7 @@
|
||||||
BOOL fTracking, fMouseDownControlButton, fMouseDownRevealButton, fMouseDownActionButton,
|
BOOL fTracking, fMouseDownControlButton, fMouseDownRevealButton, fMouseDownActionButton,
|
||||||
fHoverControl, fHoverReveal, fHoverAction;
|
fHoverControl, fHoverReveal, fHoverAction;
|
||||||
|
|
||||||
NSColor * fBarOverlayColor;
|
NSColor * fBarBorderColor;
|
||||||
CTGradient * fWhiteGradient, * fGrayGradient, * fLightGrayGradient, * fBlueGradient, * fDarkBlueGradient,
|
CTGradient * fWhiteGradient, * fGrayGradient, * fLightGrayGradient, * fBlueGradient, * fDarkBlueGradient,
|
||||||
* fGreenGradient, * fLightGreenGradient, * fDarkGreenGradient, * fYellowGradient, * fRedGradient;
|
* fGreenGradient, * fLightGreenGradient, * fDarkGreenGradient, * fYellowGradient, * fRedGradient;
|
||||||
|
|
||||||
|
|
|
@ -106,7 +106,7 @@
|
||||||
fBlueColor = [[NSColor colorWithCalibratedRed: 0.0 green: 0.4 blue: 0.8 alpha: 1.0] retain];
|
fBlueColor = [[NSColor colorWithCalibratedRed: 0.0 green: 0.4 blue: 0.8 alpha: 1.0] retain];
|
||||||
fOrangeColor = [[NSColor orangeColor] retain];
|
fOrangeColor = [[NSColor orangeColor] retain];
|
||||||
|
|
||||||
fBarOverlayColor = [[NSColor colorWithDeviceWhite: 0.0 alpha: 0.2] retain];
|
fBarBorderColor = [[NSColor colorWithDeviceWhite: 0.0 alpha: 0.2] retain];
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
@ -425,25 +425,27 @@
|
||||||
int groupValue = [torrent groupValue];
|
int groupValue = [torrent groupValue];
|
||||||
if (groupValue != -1)
|
if (groupValue != -1)
|
||||||
{
|
{
|
||||||
NSRect groupRect = NSInsetRect(iconRect, -2.0, -3.0);
|
NSRect groupRect = NSInsetRect(iconRect, -1.0, -2.0);
|
||||||
if (!minimal)
|
if (!minimal)
|
||||||
{
|
{
|
||||||
groupRect.size.height--;
|
groupRect.size.height--;
|
||||||
groupRect.origin.y--;
|
groupRect.origin.y--;
|
||||||
}
|
}
|
||||||
|
float radius = minimal ? 3.0 : 6.0;
|
||||||
|
|
||||||
NSColor * groupColor = [[GroupsController groups] colorForIndex: groupValue];
|
NSColor * groupColor = [[GroupsController groups] colorForIndex: groupValue],
|
||||||
|
* darkGroupColor = [groupColor blendedColorWithFraction: 0.2 ofColor: [NSColor whiteColor]];
|
||||||
|
|
||||||
//border
|
//border
|
||||||
NSBezierPath * bp = [NSBezierPath bezierPathWithRoundedRect: groupRect radius: 6.0];
|
NSBezierPath * bp = [NSBezierPath bezierPathWithRoundedRect: groupRect radius: radius];
|
||||||
CTGradient * gradient = [CTGradient gradientWithBeginningColor: [groupColor blendedColorWithFraction: 0.45 ofColor:
|
[darkGroupColor set];
|
||||||
[NSColor whiteColor]] endingColor: groupColor];
|
[bp setLineWidth: 1.5];
|
||||||
[gradient fillBezierPath: bp angle: 90.0];
|
[bp stroke];
|
||||||
|
|
||||||
//inside
|
//inside
|
||||||
bp = [NSBezierPath bezierPathWithRoundedRect: NSInsetRect(groupRect, 1.0, 1.0) radius: 6.0];
|
bp = [NSBezierPath bezierPathWithRoundedRect: groupRect radius: radius];
|
||||||
gradient = [CTGradient gradientWithBeginningColor: [groupColor blendedColorWithFraction: 0.65 ofColor: [NSColor whiteColor]]
|
CTGradient * gradient = [CTGradient gradientWithBeginningColor: [groupColor blendedColorWithFraction: 0.7
|
||||||
endingColor: [groupColor blendedColorWithFraction: 0.2 ofColor: [NSColor whiteColor]]];
|
ofColor: [NSColor whiteColor]] endingColor: darkGroupColor];
|
||||||
[gradient fillBezierPath: bp angle: 90.0];
|
[gradient fillBezierPath: bp angle: 90.0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -599,7 +601,7 @@
|
||||||
[self drawRegularBar: barRect];
|
[self drawRegularBar: barRect];
|
||||||
}
|
}
|
||||||
|
|
||||||
[fBarOverlayColor set];
|
[fBarBorderColor set];
|
||||||
[NSBezierPath strokeRect: NSInsetRect(barRect, 0.5, 0.5)];
|
[NSBezierPath strokeRect: NSInsetRect(barRect, 0.5, 0.5)];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue