Changeset 4192


Ignore:
Timestamp:
Dec 18, 2007, 1:44:37 AM (14 years ago)
Author:
livings124
Message:

experiment with moving the label from over the text to the left edge

Location:
trunk/macosx
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/GroupsWindowController.h

    r4189 r4192  
    3434    IBOutlet NSSegmentedControl * fAddRemoveControl;
    3535   
    36     NSMutableDictionary * fCurrentColorDict, * fGroupGradients;
     36    NSMutableDictionary * fCurrentColorDict;
    3737}
    3838
  • trunk/macosx/GroupsWindowController.m

    r4190 r4192  
    375375- (CTGradient *) gradientForColor: (NSColor *) color
    376376{
    377     return [CTGradient gradientWithBeginningColor: [color blendedColorWithFraction: 0.7 ofColor: [NSColor whiteColor]]
    378             endingColor: [color blendedColorWithFraction: 0.4 ofColor: [NSColor whiteColor]]];
     377    return [CTGradient gradientWithBeginningColor: [color blendedColorWithFraction: 0.2 ofColor: [NSColor whiteColor]]
     378            endingColor: [color blendedColorWithFraction: 0.7 ofColor: [NSColor whiteColor]]];
    379379}
    380380
  • trunk/macosx/TorrentCell.m

    r4191 r4192  
    5252#define PADDING_BETWEEN_BAR_AND_STATUS 2.0
    5353
    54 #define GROUP_BORDER_X 4.0
    55 #define GROUP_BORDER_Y 1.0
    56 
    5754#define MAX_PIECES 324
    5855#define BLANK_PIECE -99
     
    200197}
    201198
    202 - (void) drawInteriorWithFrame: (NSRect) cellFrame inView: (NSView *) controlView
    203 {
    204     [super drawInteriorWithFrame: cellFrame inView: controlView];
     199- (void) drawWithFrame: (NSRect) cellFrame inView: (NSView *) controlView
     200{
     201    [super drawWithFrame: cellFrame inView: controlView];
    205202   
    206203    Torrent * torrent = [self representedObject];
    207204   
    208205    BOOL minimal = [fDefaults boolForKey: @"SmallView"];
     206   
     207    int groupValue = [torrent groupValue];
     208    if (groupValue != -1)
     209    {
     210        NSRect groupRect = cellFrame;
     211        groupRect.size.width = 38.0;
     212        groupRect.origin.x -= 1.0;
     213        groupRect.size.height += 1.0;
     214        groupRect.origin.y -= 1.0;
     215       
     216        [[[GroupsWindowController groupsController] gradientForIndex: groupValue] fillRect: groupRect angle: 270];
     217    }
    209218   
    210219    //error image
     
    229238   
    230239    //text color
     240    NSColor * titleColor, * statusColor;
    231241    BOOL selected = [NSApp isOnLeopardOrBetter] ? [self backgroundStyle] == NSBackgroundStyleDark : [self isHighlighted]
    232242                    && [[self highlightColorWithFrame: cellFrame inView: controlView] isEqual: [NSColor alternateSelectedControlColor]];
    233     int groupIndex = [torrent groupValue];
    234    
    235     NSColor * titleColor = selected && groupIndex == -1 ? [NSColor whiteColor] : [NSColor controlTextColor],
    236             * statusColor = selected ? [NSColor whiteColor] : [NSColor darkGrayColor];
     243    if ([NSApp isOnLeopardOrBetter] ? [self backgroundStyle] == NSBackgroundStyleDark : [self isHighlighted]
     244        && [[self highlightColorWithFrame: cellFrame inView: controlView] isEqual: [NSColor alternateSelectedControlColor]])
     245    {
     246        titleColor = [NSColor whiteColor];
     247        statusColor = [NSColor whiteColor];
     248    }
     249    else
     250    {
     251        titleColor = [NSColor controlTextColor];
     252        statusColor = [NSColor darkGrayColor];
     253    }
    237254   
    238255    //minimal status
     
    251268    NSAttributedString * titleString = [self attributedTitleWithColor: titleColor];
    252269    NSRect titleRect = [self rectForTitleWithString: titleString basedOnMinimalStatusRect: minimalStatusRect inBounds: cellFrame];
    253    
    254     if (groupIndex != -1)
    255         [[[GroupsWindowController groupsController] gradientForIndex: [torrent groupValue]] fillBezierPath:
    256             [NSBezierPath bezierPathWithRoundedRect: NSInsetRect(titleRect, -GROUP_BORDER_X, -GROUP_BORDER_Y) radius: 7.0] angle: 90];
    257    
    258270    [titleString drawInRect: titleRect];
    259271   
     
    561573    result.size = [string size];
    562574    result.size.width = MIN(result.size.width, NSMaxX(bounds) - result.origin.x - PADDING_HORIZONAL
    563                             - ([[self representedObject] groupValue] != -1 ? GROUP_BORDER_X : 0)
    564575                            - (minimal ? PADDING_BETWEEN_TITLE_AND_MIN_STATUS + statusRect.size.width : 0));
    565576   
Note: See TracChangeset for help on using the changeset viewer.