]> granicus.if.org Git - transmission/commitdiff
simplify the drawing of group colors for transfers
authorMitchell Livingston <livings124@transmissionbt.com>
Tue, 27 May 2008 16:07:12 +0000 (16:07 +0000)
committerMitchell Livingston <livings124@transmissionbt.com>
Tue, 27 May 2008 16:07:12 +0000 (16:07 +0000)
macosx/TorrentCell.h
macosx/TorrentCell.m

index efd9e262a9b336ea684ea024dbf54b1d8678e8c7..232f7487cc4268a6acc35a56780fe22a8afbe9a4 100644 (file)
@@ -34,7 +34,7 @@
     BOOL fTracking, fMouseDownControlButton, fMouseDownRevealButton, fMouseDownActionButton,
             fHoverControl, fHoverReveal, fHoverAction;
     
-    NSColor * fBarOverlayColor;
+    NSColor * fBarBorderColor;
     CTGradient * fWhiteGradient, * fGrayGradient, * fLightGrayGradient, * fBlueGradient, * fDarkBlueGradient, 
                 * fGreenGradient, * fLightGreenGradient, * fDarkGreenGradient, * fYellowGradient, * fRedGradient;
     
index 99647888946467b3e609cf7778e0f12e6b09fc4f..192efcdfef2ae72c927c3925bbff22dcf756c75c 100644 (file)
         fBlueColor = [[NSColor colorWithCalibratedRed: 0.0 green: 0.4 blue: 0.8 alpha: 1.0] 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;
 }
     int groupValue = [torrent groupValue];
     if (groupValue != -1)
     {
-        NSRect groupRect = NSInsetRect(iconRect, -2.0, -3.0);
+        NSRect groupRect = NSInsetRect(iconRect, -1.0, -2.0);
         if (!minimal)
         {
             groupRect.size.height--;
             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
-        NSBezierPath * bp = [NSBezierPath bezierPathWithRoundedRect: groupRect radius: 6.0];
-        CTGradient * gradient = [CTGradient gradientWithBeginningColor: [groupColor blendedColorWithFraction: 0.45 ofColor:
-                                [NSColor whiteColor]] endingColor: groupColor];
-        [gradient fillBezierPath: bp angle: 90.0];
+        NSBezierPath * bp = [NSBezierPath bezierPathWithRoundedRect: groupRect radius: radius];
+        [darkGroupColor set];
+        [bp setLineWidth: 1.5];
+        [bp stroke];
         
         //inside
-        bp = [NSBezierPath bezierPathWithRoundedRect: NSInsetRect(groupRect, 1.0, 1.0) radius: 6.0];
-        gradient = [CTGradient gradientWithBeginningColor: [groupColor blendedColorWithFraction: 0.65 ofColor: [NSColor whiteColor]]
-                    endingColor: [groupColor blendedColorWithFraction: 0.2 ofColor: [NSColor whiteColor]]];
+        bp = [NSBezierPath bezierPathWithRoundedRect: groupRect radius: radius];
+        CTGradient * gradient = [CTGradient gradientWithBeginningColor: [groupColor blendedColorWithFraction: 0.7
+                                    ofColor: [NSColor whiteColor]] endingColor: darkGroupColor];
         [gradient fillBezierPath: bp angle: 90.0];
     }
     
         [self drawRegularBar: barRect];
     }
     
-    [fBarOverlayColor set];
+    [fBarBorderColor set];
     [NSBezierPath strokeRect: NSInsetRect(barRect, 0.5, 0.5)];
 }