Improve the looks a bit on Yosemite. The app must now be compiled with the 10.10 SDK.
This commit is contained in:
parent
82cc420214
commit
953780f38e
|
@ -3321,7 +3321,7 @@
|
|||
LIBRARY_SEARCH_PATHS = "third-party/curl/lib";
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.6;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = macosx10.8;
|
||||
SDKROOT = macosx10.10;
|
||||
STRIP_INSTALLED_PRODUCT = NO;
|
||||
};
|
||||
name = Debug;
|
||||
|
@ -3438,7 +3438,7 @@
|
|||
LIBRARY_SEARCH_PATHS = "third-party/curl/lib";
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.6;
|
||||
OTHER_CFLAGS = "-DNDEBUG";
|
||||
SDKROOT = macosx10.8;
|
||||
SDKROOT = macosx10.10;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
|
@ -3496,7 +3496,7 @@
|
|||
INFOPLIST_PREPROCESS = YES;
|
||||
LIBRARY_SEARCH_PATHS = "third-party/curl/lib";
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.6;
|
||||
SDKROOT = macosx10.8;
|
||||
SDKROOT = macosx10.10;
|
||||
STRIP_INSTALLED_PRODUCT = NO;
|
||||
};
|
||||
name = "Release - Debug";
|
||||
|
@ -3595,9 +3595,7 @@
|
|||
A2E384CF130DFB1D001F501B /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
POSIX,
|
||||
);
|
||||
GCC_PREPROCESSOR_DEFINITIONS = POSIX;
|
||||
PRODUCT_NAME = utp;
|
||||
};
|
||||
name = Debug;
|
||||
|
@ -3605,9 +3603,7 @@
|
|||
A2E384D0130DFB1D001F501B /* Release - Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
POSIX,
|
||||
);
|
||||
GCC_PREPROCESSOR_DEFINITIONS = POSIX;
|
||||
PRODUCT_NAME = utp;
|
||||
};
|
||||
name = "Release - Debug";
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
#import "FilterBarView.h"
|
||||
#import "NSApplicationAdditions.h"
|
||||
|
||||
@implementation FilterBarView
|
||||
|
||||
|
@ -30,9 +31,11 @@
|
|||
{
|
||||
if ((self = [super initWithFrame: rect]))
|
||||
{
|
||||
NSColor * lightColor = [NSColor colorWithCalibratedRed: 235.0/255.0 green: 235.0/255.0 blue: 235.0/255.0 alpha: 1.0];
|
||||
NSColor * darkColor = [NSColor colorWithCalibratedRed: 205.0/255.0 green: 205.0/255.0 blue: 205.0/255.0 alpha: 1.0];
|
||||
fGradient = [[NSGradient alloc] initWithStartingColor: lightColor endingColor: darkColor];
|
||||
if (![NSApp isOnYosemiteOrBetter]) {
|
||||
NSColor * lightColor = [NSColor colorWithCalibratedRed: 235.0/255.0 green: 235.0/255.0 blue: 235.0/255.0 alpha: 1.0];
|
||||
NSColor * darkColor = [NSColor colorWithCalibratedRed: 205.0/255.0 green: 205.0/255.0 blue: 205.0/255.0 alpha: 1.0];
|
||||
fGradient = [[NSGradient alloc] initWithStartingColor: lightColor endingColor: darkColor];
|
||||
}
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
@ -55,38 +58,51 @@
|
|||
|
||||
- (void) drawRect: (NSRect) rect
|
||||
{
|
||||
NSInteger count = 0;
|
||||
NSRect gridRects[2];
|
||||
NSColor * colorRects[2];
|
||||
|
||||
NSRect lineBorderRect = NSMakeRect(NSMinX(rect), NSHeight([self bounds]) - 1.0, NSWidth(rect), 1.0);
|
||||
if (NSIntersectsRect(lineBorderRect, rect))
|
||||
{
|
||||
gridRects[count] = lineBorderRect;
|
||||
colorRects[count] = [NSColor whiteColor];
|
||||
++count;
|
||||
if ([NSApp isOnYosemiteOrBetter]) {
|
||||
[[NSColor windowBackgroundColor] setFill];
|
||||
NSRectFill(rect);
|
||||
|
||||
rect.size.height -= 1.0;
|
||||
const NSRect lineBorderRect = NSMakeRect(NSMinX(rect), 0.0, NSWidth(rect), 1.0);
|
||||
if (NSIntersectsRect(lineBorderRect, rect))
|
||||
{
|
||||
[[NSColor lightGrayColor] setFill];
|
||||
NSRectFill(lineBorderRect);
|
||||
}
|
||||
}
|
||||
|
||||
lineBorderRect.origin.y = 0.0;
|
||||
if (NSIntersectsRect(lineBorderRect, rect))
|
||||
{
|
||||
gridRects[count] = lineBorderRect;
|
||||
colorRects[count] = [NSColor colorWithCalibratedWhite: 0.65 alpha: 1.0];
|
||||
++count;
|
||||
else {
|
||||
NSInteger count = 0;
|
||||
NSRect gridRects[2];
|
||||
NSColor * colorRects[2];
|
||||
|
||||
rect.origin.y += 1.0;
|
||||
rect.size.height -= 1.0;
|
||||
NSRect lineBorderRect = NSMakeRect(NSMinX(rect), NSHeight([self bounds]) - 1.0, NSWidth(rect), 1.0);
|
||||
if (NSIntersectsRect(lineBorderRect, rect))
|
||||
{
|
||||
gridRects[count] = lineBorderRect;
|
||||
colorRects[count] = [NSColor whiteColor];
|
||||
++count;
|
||||
|
||||
rect.size.height -= 1.0;
|
||||
}
|
||||
|
||||
lineBorderRect.origin.y = 0.0;
|
||||
if (NSIntersectsRect(lineBorderRect, rect))
|
||||
{
|
||||
gridRects[count] = lineBorderRect;
|
||||
colorRects[count] = [NSColor colorWithCalibratedWhite: 0.65 alpha: 1.0];
|
||||
++count;
|
||||
|
||||
rect.origin.y += 1.0;
|
||||
rect.size.height -= 1.0;
|
||||
}
|
||||
|
||||
if (!NSIsEmptyRect(rect))
|
||||
{
|
||||
const NSRect gradientRect = NSMakeRect(NSMinX(rect), 1.0, NSWidth(rect), NSHeight([self bounds]) - 1.0 - 1.0); //proper gradient requires the full height of the bar
|
||||
[fGradient drawInRect: gradientRect angle: 270.0];
|
||||
}
|
||||
|
||||
NSRectFillListWithColors(gridRects, colorRects, count);
|
||||
}
|
||||
|
||||
if (!NSIsEmptyRect(rect))
|
||||
{
|
||||
const NSRect gradientRect = NSMakeRect(NSMinX(rect), 1.0, NSWidth(rect), NSHeight([self bounds]) - 1.0 - 1.0); //proper gradient requires the full height of the bar
|
||||
[fGradient drawInRect: gradientRect angle: 270.0];
|
||||
}
|
||||
|
||||
NSRectFillListWithColors(gridRects, colorRects, count);
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -32,5 +32,6 @@
|
|||
|
||||
- (BOOL) isOnLionOrBetter;
|
||||
- (BOOL) isOnMountainLionOrBetter;
|
||||
- (BOOL) isOnYosemiteOrBetter;
|
||||
|
||||
@end
|
||||
|
|
|
@ -33,7 +33,12 @@
|
|||
|
||||
- (BOOL) isOnMountainLionOrBetter
|
||||
{
|
||||
return floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_7;
|
||||
return floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_7;
|
||||
}
|
||||
|
||||
- (BOOL) isOnYosemiteOrBetter
|
||||
{
|
||||
return floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_9;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
NSColor * darkColor = [NSColor colorWithCalibratedRed: 155.0/255.0 green: 155.0/255.0 blue: 155.0/255.0 alpha: 1.0];
|
||||
fGradient = [[NSGradient alloc] initWithStartingColor: lightColor endingColor: darkColor];
|
||||
|
||||
if([NSApp isOnLionOrBetter])
|
||||
if([NSApp isOnLionOrBetter] && ![NSApp isOnYosemiteOrBetter])
|
||||
{
|
||||
CIFilter * randomFilter = [CIFilter filterWithName: @"CIRandomGenerator"];
|
||||
[randomFilter setDefaults];
|
||||
|
@ -85,65 +85,78 @@
|
|||
|
||||
- (void) drawRect: (NSRect) rect
|
||||
{
|
||||
const BOOL active = [[self window] isMainWindow];
|
||||
|
||||
NSInteger count = 0;
|
||||
NSRect gridRects[active ? 2 : 3];
|
||||
NSColor * colorRects[active ? 2 : 3];
|
||||
|
||||
//bottom line
|
||||
NSRect lineBorderRect = NSMakeRect(NSMinX(rect), 0.0, NSWidth(rect), 1.0);
|
||||
NSRect intersectLineBorderRect = NSIntersectionRect(lineBorderRect, rect);
|
||||
if (!NSIsEmptyRect(intersectLineBorderRect))
|
||||
{
|
||||
gridRects[count] = intersectLineBorderRect;
|
||||
colorRects[count] = active ? [NSColor colorWithCalibratedWhite: 0.25 alpha: 1.0]
|
||||
: [NSColor colorWithCalibratedWhite: 0.5 alpha: 1.0];
|
||||
++count;
|
||||
if ([NSApp isOnYosemiteOrBetter]) {
|
||||
[[NSColor windowBackgroundColor] setFill];
|
||||
NSRectFill(rect);
|
||||
|
||||
rect.origin.y += intersectLineBorderRect.size.height;
|
||||
rect.size.height -= intersectLineBorderRect.size.height;
|
||||
const NSRect lineBorderRect = NSMakeRect(NSMinX(rect), 0.0, NSWidth(rect), 1.0);
|
||||
if (NSIntersectsRect(lineBorderRect, rect))
|
||||
{
|
||||
[[NSColor lightGrayColor] setFill];
|
||||
NSRectFill(lineBorderRect);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//top line
|
||||
if (active)
|
||||
{
|
||||
lineBorderRect.origin.y = NSHeight([self bounds]) - 1.0;
|
||||
intersectLineBorderRect = NSIntersectionRect(lineBorderRect, rect);
|
||||
else {
|
||||
const BOOL active = [[self window] isMainWindow];
|
||||
|
||||
NSInteger count = 0;
|
||||
NSRect gridRects[active ? 2 : 3];
|
||||
NSColor * colorRects[active ? 2 : 3];
|
||||
|
||||
//bottom line
|
||||
NSRect lineBorderRect = NSMakeRect(NSMinX(rect), 0.0, NSWidth(rect), 1.0);
|
||||
NSRect intersectLineBorderRect = NSIntersectionRect(lineBorderRect, rect);
|
||||
if (!NSIsEmptyRect(intersectLineBorderRect))
|
||||
{
|
||||
gridRects[count] = intersectLineBorderRect;
|
||||
colorRects[count] = [NSColor colorWithCalibratedWhite: 0.75 alpha: 1.0];
|
||||
colorRects[count] = active ? [NSColor colorWithCalibratedWhite: 0.25 alpha: 1.0]
|
||||
: [NSColor colorWithCalibratedWhite: 0.5 alpha: 1.0];
|
||||
++count;
|
||||
|
||||
rect.origin.y += intersectLineBorderRect.size.height;
|
||||
rect.size.height -= intersectLineBorderRect.size.height;
|
||||
}
|
||||
}
|
||||
|
||||
if (!NSIsEmptyRect(rect))
|
||||
{
|
||||
|
||||
|
||||
//top line
|
||||
if (active)
|
||||
{
|
||||
const NSRect gradientRect = NSMakeRect(NSMinX(rect), 1.0, NSWidth(rect), NSHeight([self bounds]) - 1.0 - 1.0); //proper gradient requires the full height of the bar
|
||||
[fGradient drawInRect: gradientRect angle: 270.0];
|
||||
lineBorderRect.origin.y = NSHeight([self bounds]) - 1.0;
|
||||
intersectLineBorderRect = NSIntersectionRect(lineBorderRect, rect);
|
||||
if (!NSIsEmptyRect(intersectLineBorderRect))
|
||||
{
|
||||
gridRects[count] = intersectLineBorderRect;
|
||||
colorRects[count] = [NSColor colorWithCalibratedWhite: 0.75 alpha: 1.0];
|
||||
++count;
|
||||
|
||||
rect.size.height -= intersectLineBorderRect.size.height;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
if (!NSIsEmptyRect(rect))
|
||||
{
|
||||
gridRects[count] = rect;
|
||||
colorRects[count] = [NSColor colorWithCalibratedWhite: 0.85 alpha: 1.0];
|
||||
++count;
|
||||
if (active)
|
||||
{
|
||||
const NSRect gradientRect = NSMakeRect(NSMinX(rect), 1.0, NSWidth(rect), NSHeight([self bounds]) - 1.0 - 1.0); //proper gradient requires the full height of the bar
|
||||
[fGradient drawInRect: gradientRect angle: 270.0];
|
||||
}
|
||||
else
|
||||
{
|
||||
gridRects[count] = rect;
|
||||
colorRects[count] = [NSColor colorWithCalibratedWhite: 0.85 alpha: 1.0];
|
||||
++count;
|
||||
}
|
||||
}
|
||||
|
||||
NSRectFillListWithColors(gridRects, colorRects, count);
|
||||
|
||||
if (fNoiseImage) {
|
||||
NSAssert([NSApp isOnLionOrBetter], @"we have a noise image, but we're on 10.6"); //https://trac.transmissionbt.com/ticket/5053
|
||||
[fNoiseImage drawInRect: rect
|
||||
fromRect: [self convertRectToBacking: rect]
|
||||
operation: NSCompositeSourceOver
|
||||
fraction: 0.12];
|
||||
}
|
||||
}
|
||||
|
||||
NSRectFillListWithColors(gridRects, colorRects, count);
|
||||
|
||||
if (fNoiseImage) {
|
||||
NSAssert([NSApp isOnLionOrBetter], @"we have a noise image, but we're on 10.6"); //https://trac.transmissionbt.com/ticket/5053
|
||||
[fNoiseImage drawInRect: rect
|
||||
fromRect: [self convertRectToBacking: rect]
|
||||
operation: NSCompositeSourceOver
|
||||
fraction: 0.12];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue