Changeset 4226


Ignore:
Timestamp:
Dec 19, 2007, 8:50:56 PM (15 years ago)
Author:
livings124
Message:

get rid of a warning

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/GroupsWindowController.m

    r4225 r4226  
    4646- (CTGradient *) gradientForColor: (NSColor *) color;
    4747- (void) changeColor: (id) sender;
     48- (NSImage *) imageForGroup: (NSDictionary *) dict isSmall: (BOOL) small;
    4849
    4950@end
     
    163164- (NSImage *) imageForIndex: (int) index isSmall: (BOOL) small
    164165{
    165     CTGradient * gradient;
    166     if (!(gradient = [self gradientForIndex: index]))
     166    int orderIndex = [self orderValueForIndex: index];
     167    if (orderIndex == -1)
    167168        return nil;
    168169   
    169     float width = small ? ICON_WIDTH_SMALL : ICON_WIDTH;
    170     NSBezierPath * bp = [NSBezierPath bezierPathWithRoundedRect: NSMakeRect(0.0, 0.0, width, width) radius: 4.0];
    171     NSImage * icon = [[NSImage alloc] initWithSize: [bp bounds].size];
    172    
    173     [icon lockFocus];
    174     [gradient fillBezierPath: bp angle: 270.0];
    175     [icon unlockFocus];
    176    
    177     return [icon autorelease];
     170    return [self imageForGroup: [fGroups objectAtIndex: orderIndex] isSmall: small];
    178171}
    179172
     
    366359        [item setTarget: target];
    367360       
    368         int index = [[dict objectForKey: @"Index"] intValue];
    369        
    370         #warning use dict
    371         [item setImage: [self imageForIndex: index isSmall: small]];
    372         [item setTag: index];
     361        [item setImage: [self imageForGroup: dict isSmall: small]];
     362        [item setTag: [[dict objectForKey: @"Index"] intValue]];
    373363       
    374364        [menu addItem: item];
     
    404394}
    405395
     396- (NSImage *) imageForGroup: (NSDictionary *) dict isSmall: (BOOL) small
     397{
     398    float width = small ? ICON_WIDTH_SMALL : ICON_WIDTH;
     399    NSBezierPath * bp = [NSBezierPath bezierPathWithRoundedRect: NSMakeRect(0.0, 0.0, width, width) radius: 4.0];
     400    NSImage * icon = [[NSImage alloc] initWithSize: [bp bounds].size];
     401   
     402    [icon lockFocus];
     403    [[self gradientForColor: [dict objectForKey: @"Color"]] fillBezierPath: bp angle: 270.0];
     404    [icon unlockFocus];
     405   
     406    return [icon autorelease];
     407}
     408
    406409@end
Note: See TracChangeset for help on using the changeset viewer.