Changeset 4201


Ignore:
Timestamp:
Dec 18, 2007, 5:05:49 PM (14 years ago)
Author:
livings124
Message:

simplify group coloring

Location:
trunk/macosx
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/GroupsWindowController.h

    r4194 r4201  
    3939+ (GroupsWindowController *) groupsController;
    4040
    41 - (NSColor *) colorForIndex: (int) index;
     41- (CTGradient *) gradientForIndex: (int) index;
    4242
    4343- (int) orderValueForIndex: (int) index;
  • trunk/macosx/GroupsWindowController.m

    r4200 r4201  
    4141- (void) saveGroups;
    4242
    43 - (CTGradient *) gradientForPreviewColor: (NSColor *) color;
     43- (CTGradient *) gradientForColor: (NSColor *) color;
    4444- (void) changeColor: (id) sender;
    4545
     
    134134}
    135135
    136 - (NSColor *) colorForIndex: (int) index
     136- (CTGradient *) gradientForIndex: (int) index
    137137{
    138138    if (index < 0)
     
    143143    while ((dict = [enumerator nextObject]))
    144144        if ([[dict objectForKey: @"Index"] intValue] == index)
    145             return [dict objectForKey: @"Color"];
     145            return [self gradientForColor: [dict objectForKey: @"Color"]];
    146146   
    147147    return nil;
     
    169169    NSString * identifier = [tableColumn identifier];
    170170    if ([identifier isEqualToString: @"Color"])
    171         return [self gradientForPreviewColor: [[fGroups objectAtIndex: row] objectForKey: @"Color"]];
     171        return [self gradientForColor: [[fGroups objectAtIndex: row] objectForKey: @"Color"]];
    172172    else
    173173        return [[fGroups objectAtIndex: row] objectForKey: @"Name"];
     
    352352       
    353353        [icon lockFocus];
    354         [[self gradientForPreviewColor: [dict objectForKey: @"Color"]] fillBezierPath: bp angle: 270.0];
     354        [[self gradientForColor: [dict objectForKey: @"Color"]] fillBezierPath: bp angle: 270.0];
    355355        [icon unlockFocus];
    356356       
     
    376376}
    377377
    378 - (CTGradient *) gradientForPreviewColor: (NSColor *) color
     378- (CTGradient *) gradientForColor: (NSColor *) color
    379379{
    380380    return [CTGradient gradientWithBeginningColor: [color blendedColorWithFraction: 0.7 ofColor: [NSColor whiteColor]]
  • trunk/macosx/TorrentCell.m

    r4197 r4201  
    208208    BOOL minimal = [fDefaults boolForKey: @"SmallView"];
    209209   
     210    //group coloring
     211    NSRect iconRect = [self iconRectForBounds: cellFrame];
     212   
    210213    int groupValue = [torrent groupValue];
    211214    if (groupValue != -1)
    212     {
    213         NSRect groupRect = cellFrame;
    214         groupRect.size.width = minimal ? WIDTH_GROUP_MIN : WIDTH_GROUP;
    215         groupRect.origin.x -= 1.0;
    216         groupRect.size.height += 1.0;
    217         groupRect.origin.y -= 1.0;
    218        
    219         NSColor * color = [[[GroupsWindowController groupsController] colorForIndex: groupValue]
    220                             blendedColorWithFraction: 0.3 ofColor: [NSColor whiteColor]];
    221         CTGradient * gradient = [CTGradient gradientWithBeginningColor: color endingColor: [color colorWithAlphaComponent: 0.0]];
    222         [gradient fillRect: groupRect angle: 0.0];
    223     }
     215        [[[GroupsWindowController groupsController] gradientForIndex: groupValue] fillBezierPath:
     216            [NSBezierPath bezierPathWithRoundedRect: NSInsetRect(iconRect, -2.0, -2.0) radius: 6.0] angle: 90.0];
    224217   
    225218    //error image
     
    233226    //icon
    234227    NSImage * icon = minimal && error ? fErrorImage : [torrent icon];
    235     NSRect iconRect = [self iconRectForBounds: cellFrame];
    236228    [icon drawInRect: iconRect fromRect: NSZeroRect operation: NSCompositeSourceOver fraction: 1.0];
    237229   
Note: See TracChangeset for help on using the changeset viewer.