Skip to content

Commit

Permalink
Fix compiler compatibility issue with older Xcode versions
Browse files Browse the repository at this point in the history
  • Loading branch information
dmoagx committed Feb 15, 2015
1 parent 3fce697 commit 3d18994
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions Source/SPFavoriteTextFieldCell.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
@interface SPFavoriteTextFieldCell : ImageAndTextCell
{
BOOL drawsDividerUnderCell;
NSColor *labelColor;
}

- (BOOL)drawsDividerUnderCell;
Expand Down
10 changes: 5 additions & 5 deletions Source/SPFavoriteTextFieldCell.m
Original file line number Diff line number Diff line change
Expand Up @@ -78,22 +78,22 @@ - (void)setDrawsDividerUnderCell:(BOOL)drawsDivider

- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView
{
if([self labelColor]) {
if(labelColor) {
CGFloat round = (cellFrame.size.height/2);
NSBezierPath *bg = [NSBezierPath bezierPathWithRoundedRect:cellFrame xRadius:round yRadius:round];

if(isOSAtLeast10_10_0()) {
CGFloat h,s,b,a;
[[self labelColor] getHue:&h saturation:&s brightness:&b alpha:&a];
[labelColor getHue:&h saturation:&s brightness:&b alpha:&a];

[[NSColor colorWithCalibratedHue:h saturation:s*1.21 brightness:b*1.1 alpha:a] set];
[bg fill];
}
else {
NSGradient * gradient = [[NSGradient alloc] initWithColorsAndLocations:
[[self labelColor] highlightWithLevel:0.33], 0.0,
[self labelColor], 0.5,
[[self labelColor] shadowWithLevel:0.15], 1.0, nil];
[labelColor highlightWithLevel:0.33], 0.0,
labelColor, 0.5,
[labelColor shadowWithLevel:0.15], 1.0, nil];
[gradient drawInBezierPath:bg angle:90.0];
[gradient release];
}
Expand Down

0 comments on commit 3d18994

Please sign in to comment.