diff --git a/baRSS/DrawImage.h b/baRSS/DrawImage.h index af7b563..2b90e70 100644 --- a/baRSS/DrawImage.h +++ b/baRSS/DrawImage.h @@ -22,41 +22,73 @@ #import -@interface RSSIcon : NSObject -@property (strong) NSColor *barsColor; -@property (strong) NSColor *squareColor; -@property (strong) NSColor *squareGradientColor; -@property (assign) NSSize size; -@property (assign) bool isTemplate; - -+ (instancetype)iconWithSize:(NSSize)size; -+ (instancetype)templateIcon:(CGFloat)size tint:(nullable NSColor*)color; -- (instancetype)autoGradient; - +@interface NSColor (RandomColor) +/// just for testing purposes ++ (NSColor*)randomColor; +/// RGB color with (251, 163, 58) + (NSColor*)rssOrange; -- (NSImage*)image; @end - -IB_DESIGNABLE -@interface DrawSeparator : NSView -@end +// --------------------------------------------------------------- +// | +// | DrawImage +// | +// --------------------------------------------------------------- IB_DESIGNABLE @interface DrawImage : NSView @property (strong) IBInspectable NSColor *color; +@property (assign) IBInspectable BOOL showBackground; /** percentage value between 0 - 100 */ -@property (assign) IBInspectable CGFloat roundness; +@property (assign, nonatomic) IBInspectable CGFloat roundness; +@property (assign, nonatomic) IBInspectable CGFloat contentScale; @property (strong, readonly) NSImageView *imageView; - (NSImage*)drawnImage; @end +// --------------------------------------------------------------- +// | +// | RSSIcon +// | +// --------------------------------------------------------------- + +IB_DESIGNABLE +@interface RSSIcon : DrawImage +@property (strong) IBInspectable NSColor *barsColor; +@property (strong) IBInspectable NSColor *gradientColor; + ++ (NSImage*)iconWithSize:(CGFloat)size; ++ (NSImage*)templateIcon:(CGFloat)size tint:(NSColor*)color; +@end + +// --------------------------------------------------------------- +// | +// | SettingsIconGlobal +// | +// --------------------------------------------------------------- + IB_DESIGNABLE @interface SettingsIconGlobal : DrawImage @end +// --------------------------------------------------------------- +// | +// | SettingsIconGroup +// | +// --------------------------------------------------------------- + IB_DESIGNABLE @interface SettingsIconGroup : DrawImage @end +// --------------------------------------------------------------- +// | +// | DrawSeparator +// | +// --------------------------------------------------------------- + +IB_DESIGNABLE +@interface DrawSeparator : NSView +@end + diff --git a/baRSS/DrawImage.m b/baRSS/DrawImage.m index 2ab87db..03ce0d1 100644 --- a/baRSS/DrawImage.m +++ b/baRSS/DrawImage.m @@ -23,106 +23,275 @@ #import "DrawImage.h" @implementation NSColor (RandomColor) -+ (NSColor*)randomColor { // just for testing purposes ++ (NSColor*)randomColor { return [NSColor colorWithRed:(arc4random()%50+20)/100.0 green:(arc4random()%50+20)/100.0 blue:(arc4random()%50+20)/100.0 alpha:1]; } -@end - - -@implementation RSSIcon - + (NSColor*)rssOrange { return [NSColor colorWithCalibratedRed:0.984 green:0.639 blue:0.227 alpha:1.0]; } +@end -+ (instancetype)iconWithSize:(NSSize)size { - RSSIcon *icon = [[super alloc] init]; - icon.size = size; - icon.barsColor = [NSColor whiteColor]; - icon.squareColor = [RSSIcon rssOrange]; - return icon; +// ################################################################ +// # +// # DrawImage +// # +// ################################################################ + +@implementation DrawImage +@synthesize roundness = _roundness, contentScale = _contentScale; + +-(id)init{self=[super init];if(self)[self initialize];return self;} +-(id)initWithFrame:(CGRect)f{self=[super initWithFrame:f];if(self)[self initialize];return self;} +-(id)initWithCoder:(NSCoder*)c{self=[super initWithCoder:c];if(self)[self initialize];return self;} + +//#if !TARGET_INTERFACE_BUILDER #endif +- (void)initialize { + _contentScale = 1.0; + _imageView = [NSImageView imageViewWithImage:[self drawnImage]]; + [_imageView setFrameSize:self.frame.size]; + _imageView.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable; + [self addSubview:_imageView]; } -+ (instancetype)templateIcon:(CGFloat)s tint:(NSColor*)color { - RSSIcon *icon = [[super alloc] init]; - icon.size = NSMakeSize(s, s); - icon.squareColor = (color ? color : [NSColor blackColor]); - icon.isTemplate = YES; - return icon; -} - -- (instancetype)autoGradient { - const CGFloat h = self.squareColor.hueComponent; - const CGFloat s = self.squareColor.saturationComponent; - const CGFloat b = self.squareColor.brightnessComponent; - const CGFloat a = self.squareColor.alphaComponent; - static const CGFloat impact = 0.3; - self.squareGradientColor = [NSColor colorWithHue:h saturation:(s - impact < 0 ? 0 : s - impact) brightness:b alpha:a]; - self.squareColor = [NSColor colorWithHue:h saturation:(s + impact > 1 ? 1 : s + impact) brightness:b alpha:a]; +- (instancetype)initWithSize:(CGFloat)w scale:(CGFloat)s { + self = [super initWithFrame:NSMakeRect(0, 0, w, w)]; + self.roundness = 40; + self.contentScale = s; + self.showBackground = YES; return self; } -- (NSImage*)image { - return [NSImage imageWithSize:self.size flipped:NO drawingHandler:^BOOL(NSRect rect) { - CGFloat s = (self.size.height < self.size.width ? self.size.height : self.size.width); - CGFloat corner = s * 0.2; - - CGMutablePathRef square = CGPathCreateMutable(); // the brackground - CGPathAddRoundedRect(square, NULL, rect, corner, corner); - - CGMutablePathRef bars = CGPathCreateMutable(); // the rss bars - CGAffineTransform at = CGAffineTransformMake(0.75, 0, 0, 0.75, s * 0.15, s * 0.15); // scale 0.75, translate 0.15 - // circle - CGPathAddEllipseInRect(bars, &at, CGRectMake(0, 0, s * 0.25, s * 0.25)); - // 1st bar - CGPathMoveToPoint(bars, &at, 0, s * 0.65); - CGPathAddArc(bars, &at, 0, 0, s * 0.65, M_PI_2, 0, YES); - CGPathAddLineToPoint(bars, &at, s * 0.45, 0); - CGPathAddArc(bars, &at, 0, 0, s * 0.45, 0, M_PI_2, NO); - CGPathCloseSubpath(bars); - // 2nd bar - CGPathMoveToPoint(bars, &at, 0, s); - CGPathAddArc(bars, &at, 0, 0, s, M_PI_2, 0, YES); - CGPathAddLineToPoint(bars, &at, s * 0.8, 0); - CGPathAddArc(bars, &at, 0, 0, s * 0.8, 0, M_PI_2, NO); - CGPathCloseSubpath(bars); - - CGContextRef c = [[NSGraphicsContext currentContext] CGContext]; - CGContextSetFillColorWithColor(c, [self.squareColor CGColor]); - CGContextAddPath(c, square); - if (!self.isTemplate) { - if (self.squareGradientColor) { - CGContextClip(c); - const void* cgColors[] = { - [self.squareColor CGColor], - [self.squareGradientColor CGColor], - [self.squareColor CGColor] - }; - CFArrayRef colors = CFArrayCreate(NULL, cgColors, 3, NULL); - CGGradientRef gradient = CGGradientCreateWithColors(NULL, colors, NULL); - CGContextDrawLinearGradient(c, gradient, CGPointMake(0, s), CGPointMake(s, 0), 0); - CGGradientRelease(gradient); - CFRelease(colors); - } else { - CGContextFillPath(c); - } - CGContextSetFillColorWithColor(c, [self.barsColor CGColor]); - } - CGContextAddPath(c, bars); - CGContextEOFillPath(c); - - CGPathRelease(square); - CGPathRelease(bars); +- (NSImage*)drawnImage { + return [NSImage imageWithSize:self.frame.size flipped:NO drawingHandler:^BOOL(NSRect rect) { + [self drawImageInRect:rect]; return YES; }]; } +- (void)setRoundness:(CGFloat)r { + _roundness = 0.5 * (r < 0 ? 0 : r > 100 ? 100 : r); +} + +- (CGFloat)shorterSide { + if (self.frame.size.width < self.frame.size.height) + return self.frame.size.width; + return self.frame.size.height; +} + +- (void)drawImageInRect:(NSRect)r { + const CGFloat s = [self shorterSide]; + CGContextRef c = [[NSGraphicsContext currentContext] CGContext]; + + if (_showBackground) { + CGMutablePathRef pth = CGPathCreateMutable(); + const CGFloat corner = s * (_roundness / 100.0); + if (corner > 0) { + CGPathAddRoundedRect(pth, NULL, r, corner, corner); + } else { + CGPathAddRect(pth, NULL, r); + } + CGContextSetFillColorWithColor(c, [_color CGColor]); + CGContextAddPath(c, pth); + CGPathRelease(pth); + if ([self isMemberOfClass:[DrawImage class]]) + CGContextFillPath(c); // fill only if not a subclass + } + if (_contentScale != 1.0) { + CGFloat offset = s * (1 - _contentScale) / 2; + CGContextTranslateCTM(c, offset, offset); + CGContextScaleCTM(c, _contentScale, _contentScale); + } +} @end +// ################################################################ +// # +// # RSSIcon +// # +// ################################################################ +@implementation RSSIcon // content scale 0.75 works fine ++ (NSImage*)iconWithSize:(CGFloat)s { + RSSIcon *icon = [[RSSIcon alloc] initWithSize:s scale:0.7]; + icon.barsColor = [NSColor whiteColor]; + icon.gradientColor = [NSColor rssOrange]; + return [icon drawnImage]; +} + ++ (NSImage*)templateIcon:(CGFloat)s tint:(NSColor*)color { + RSSIcon *icon = [[RSSIcon alloc] initWithSize:s scale:0.7]; + icon.color = (color ? color : [NSColor blackColor]); + return [icon drawnImage]; +} + +- (void)drawImageInRect:(NSRect)r { + [super drawImageInRect:r]; + + const CGFloat s = [self shorterSide]; + CGContextRef c = [[NSGraphicsContext currentContext] CGContext]; + CGContextSetFillColorWithColor(c, [self.color CGColor]); + + CGMutablePathRef bars = CGPathCreateMutable(); // the rss bars + // circle + const CGFloat r1 = s * 0.125; // circle radius + CGPathAddArc(bars, NULL, r1, r1, r1, 0, M_PI * 2, YES); + // 1st bar + CGPathMoveToPoint(bars, NULL, 0, s * 0.65); + CGPathAddArc(bars, NULL, 0, 0, s * 0.65, M_PI_2, 0, YES); + CGPathAddLineToPoint(bars, NULL, s * 0.45, 0); + CGPathAddArc(bars, NULL, 0, 0, s * 0.45, 0, M_PI_2, NO); + CGPathCloseSubpath(bars); + // 2nd bar + CGPathMoveToPoint(bars, NULL, 0, s); + CGPathAddArc(bars, NULL, 0, 0, s, M_PI_2, 0, YES); + CGPathAddLineToPoint(bars, NULL, s * 0.8, 0); + CGPathAddArc(bars, NULL, 0, 0, s * 0.8, 0, M_PI_2, NO); + CGPathCloseSubpath(bars); + + CGContextAddPath(c, bars); + + if (_gradientColor) { + CGContextSaveGState(c); + CGContextClip(c); + [self drawGradient:c side:s / self.contentScale]; + CGContextRestoreGState(c); + } else { + CGContextEOFillPath(c); + } + + if (_barsColor) { + CGContextSetFillColorWithColor(c, [_barsColor CGColor]); + CGContextAddPath(c, bars); + CGContextEOFillPath(c); + } + CGPathRelease(bars); +} + +- (void)drawGradient:(CGContextRef)c side:(CGFloat)w { + CGFloat h = 0, s = 1, b = 1, a = 1; + @try { + NSColor *rgbColor = [_gradientColor colorUsingColorSpace:[NSColorSpace deviceRGBColorSpace]]; + [rgbColor getHue:&h saturation:&s brightness:&b alpha:&a]; + } @catch (NSException *e) {} + + static const CGFloat impact = 0.3; + NSColor *darker = [NSColor colorWithHue:h saturation:(s + impact > 1 ? 1 : s + impact) brightness:b alpha:a]; + NSColor *lighter = [NSColor colorWithHue:h saturation:(s - impact < 0 ? 0 : s - impact) brightness:b alpha:a]; + const void* cgColors[] = { + [darker CGColor], + [lighter CGColor], + [darker CGColor] + }; + CFArrayRef colors = CFArrayCreate(NULL, cgColors, 3, NULL); + CGGradientRef gradient = CGGradientCreateWithColors(NULL, colors, NULL); + + CGContextDrawLinearGradient(c, gradient, CGPointMake(0, w), CGPointMake(w, 0), kCGGradientDrawsBeforeStartLocation | kCGGradientDrawsAfterEndLocation); + CGGradientRelease(gradient); + CFRelease(colors); +} +@end + +// ################################################################ +// # +// # SettingsIconGlobal +// # +// ################################################################ + +@implementation SettingsIconGlobal // content scale 0.7 works fine +- (void)drawImageInRect:(NSRect)r { + [super drawImageInRect:r]; // add path of rounded rect + + const CGFloat w = r.size.width; + const CGFloat h = r.size.height; + + CGMutablePathRef menu = CGPathCreateMutable(); + CGPathAddRect(menu, NULL, CGRectMake(0, 0.8 * h, w, 0.2 * h)); + CGPathAddRect(menu, NULL, CGRectMake(0.3 * w, 0, 0.55 * w, 0.75 * h)); + CGPathAddRect(menu, NULL, CGRectMake(0.35 * w, 0.05 * h, 0.45 * w, 0.75 * h)); + + CGFloat entryHeight = 0.1 * h; // 0.075 + for (int i = 0; i < 3; i++) { // 4 + //CGPathAddRect(menu, NULL, CGRectMake(0.37 * w, (2 * i + 1) * entryHeight, 0.42 * w, entryHeight)); // uncomment path above + CGPathAddRect(menu, NULL, CGRectMake(0.35 * w, (2 * i + 1.5) * entryHeight, 0.4 * w, entryHeight * 0.8)); + } + + CGContextRef c = [[NSGraphicsContext currentContext] CGContext]; + CGContextSetFillColorWithColor(c, [self.color CGColor]); + + CGContextAddPath(c, menu); + CGContextEOFillPath(c); + CGPathRelease(menu); +} +@end + +// ################################################################ +// # +// # SettingsIconGroup +// # +// ################################################################ + +@implementation SettingsIconGroup // content scale 0.8 works fine +- (void)drawImageInRect:(NSRect)r { + [super drawImageInRect:r]; + + const CGFloat w = r.size.width; + const CGFloat h = r.size.height; + const CGFloat s = (w < h ? w : h); // shorter side + const CGFloat l = s * 0.04; // line width (half size) + const CGFloat r1 = s * 0.05; // corners + const CGFloat r2 = s * 0.08; // upper part, name tag + const CGFloat r3 = s * 0.15; // lower part, corners inside + const CGFloat posTop = 0.85 * h - l; + const CGFloat posMiddle = 0.6 * h - l - r3; + const CGFloat posBottom = 0.15 * h + l + r1; + const CGFloat posNameTag = 0.3 * w - l; + + CGMutablePathRef upper = CGPathCreateMutable(); + CGPathMoveToPoint(upper, NULL, l, 0.5 * h); + CGPathAddLineToPoint(upper, NULL, l, posTop - r1); + CGPathAddArc(upper, NULL, l + r1, posTop - r1, r1, M_PI, M_PI_2, YES); + CGPathAddArc(upper, NULL, posNameTag, posTop - r2, r2, M_PI_2, M_PI_4, YES); + CGPathAddArc(upper, NULL, posNameTag + 2 * r2, posTop, r2, M_PI + M_PI_4, -M_PI_2, NO); + CGPathAddArc(upper, NULL, w - l - r1, posTop - r1 - r2, r1, M_PI_2, 0, YES); + CGPathAddArc(upper, NULL, w - l - r1, posBottom, r1, 0, -M_PI_2, YES); + CGPathAddArc(upper, NULL, l + r1, posBottom, r1, -M_PI_2, M_PI, YES); + CGPathCloseSubpath(upper); + + CGMutablePathRef lower = CGPathCreateMutable(); + CGPathMoveToPoint(lower, NULL, l, 0.5 * h); + CGPathAddArc(lower, NULL, l + r3, posMiddle, r3, M_PI, M_PI_2, YES); + CGPathAddArc(lower, NULL, w - l - r3, posMiddle, r3, M_PI_2, 0, YES); + CGPathAddArc(lower, NULL, w - l - r1, posBottom, r1, 0, -M_PI_2, YES); + CGPathAddArc(lower, NULL, l + r1, posBottom, r1, -M_PI_2, M_PI, YES); + CGPathCloseSubpath(lower); + + CGContextRef c = [[NSGraphicsContext currentContext] CGContext]; + CGContextSetFillColorWithColor(c, [self.color CGColor]); + CGContextSetStrokeColorWithColor(c, [self.color CGColor]); + CGContextSetLineWidth(c, l * 2); + + CGContextAddPath(c, upper); + CGContextAddPath(c, lower); + if (self.showBackground) { + CGContextAddPath(c, lower); + CGContextEOFillPath(c); + CGContextSetLineWidth(c, l); // thinner line + CGContextAddPath(c, lower); + } + CGContextStrokePath(c); + CGPathRelease(upper); + CGPathRelease(lower); +} +@end + +// ################################################################ +// # +// # DrawSeparator +// # +// ################################################################ @implementation DrawSeparator - (void)drawRect:(NSRect)dirtyRect { @@ -134,131 +303,3 @@ @end - -@implementation DrawImage -@synthesize roundness = _roundness; - -//#if !TARGET_INTERFACE_BUILDER #endif -- (instancetype)initWithCoder:(NSCoder *)decoder { - self = [super initWithCoder:decoder]; - _imageView = [NSImageView imageViewWithImage:[self drawnImage]]; - [_imageView setFrameSize:self.frame.size]; - _imageView.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable; - [self addSubview:_imageView]; - return self; -} - -- (NSImage*)drawnImage { - return [NSImage imageWithSize:self.frame.size flipped:NO drawingHandler:^BOOL(NSRect rect) { - [self drawImageInRect:rect]; - return YES; - }]; -} - -- (CGFloat)roundness { return _roundness; } -- (void)setRoundness:(CGFloat)roundness { - if (roundness < 0) roundness = 0; - else if (roundness > 100) roundness = 100; - _roundness = roundness / 2; -} - -- (CGFloat)shorterSide { - if (self.frame.size.width < self.frame.size.height) - return self.frame.size.width; - return self.frame.size.height; -} - -- (void)drawImageInRect:(NSRect)r { - CGMutablePathRef pth = CGPathCreateMutable(); - CGFloat corner = (_roundness / 100.0); - if (corner > 0) { - corner *= [self shorterSide]; - CGPathAddRoundedRect(pth, NULL, r, corner, corner); - } else { - CGPathAddRect(pth, NULL, r); - } - CGContextRef c = [[NSGraphicsContext currentContext] CGContext]; - CGContextSetFillColorWithColor(c, [_color CGColor]); - CGContextAddPath(c, pth); - CGPathRelease(pth); - if ([self isMemberOfClass:[DrawImage class]]) - CGContextFillPath(c); // fill only if not a subclass -} -@end - - -@implementation SettingsIconGlobal -- (void)drawImageInRect:(NSRect)r { - CGFloat w = r.size.width; - CGFloat h = r.size.height; - - CGMutablePathRef menu = CGPathCreateMutable(); -// CGFloat s = (w < h ? w : h); - CGAffineTransform at = CGAffineTransformIdentity;//CGAffineTransformMake(0.7, 0, 0, 0.7, s * 0.15, s * 0.15); // scale 0.7, translate 0.15 - CGPathAddRect(menu, &at, CGRectMake(0, 0.8 * h, w, 0.2 * h)); - CGPathAddRect(menu, &at, CGRectMake(0.3 * w, 0, 0.55 * w, 0.75 * h)); - CGPathAddRect(menu, &at, CGRectMake(0.35 * w, 0.05 * h, 0.45 * w, 0.75 * h)); - - CGFloat entryHeight = 0.1 * h; // 0.075 - for (int i = 0; i < 3; i++) { // 4 - //CGPathAddRect(menu, &at, CGRectMake(0.37 * w, (2 * i + 1) * entryHeight, 0.42 * w, entryHeight)); // uncomment path above - CGPathAddRect(menu, &at, CGRectMake(0.35 * w, (2 * i + 1.5) * entryHeight, 0.4 * w, entryHeight * 0.8)); - } - - CGContextRef c = [[NSGraphicsContext currentContext] CGContext]; - CGContextSetFillColorWithColor(c, [self.color CGColor]); - -// [super drawImageInRect:r]; // add path of rounded rect - CGContextAddPath(c, menu); - CGPathRelease(menu); - CGContextEOFillPath(c); -} -@end - - -@implementation SettingsIconGroup -- (void)drawImageInRect:(NSRect)r { - CGFloat w = r.size.width; - CGFloat h = r.size.height; - CGFloat s = (w < h ? w : h); // shorter side - CGFloat l = s * 0.04; // line size (half) - CGFloat r1 = s * 0.05; // corners - CGFloat r2 = s * 0.08; // upper part, name tag - CGFloat r3 = s * 0.15; // lower part, corners inside - CGFloat posTop = 0.85 * h - l; - CGFloat posMiddle = 0.6 * h - l - r3; - CGFloat posBottom = 0.15 * h + l + r1; - CGFloat posNameTag = 0.3 * w - l; - - CGContextRef c = [[NSGraphicsContext currentContext] CGContext]; - CGAffineTransform at = CGAffineTransformIdentity;//CGAffineTransformMake(0.7, 0, 0, 0.7, s * 0.15, s * 0.15); // scale 0.7, translate 0.15 - CGContextSetFillColorWithColor(c, [self.color CGColor]); - CGContextSetStrokeColorWithColor(c, [self.color CGColor]); - CGContextSetLineWidth(c, l * 2); - - CGMutablePathRef upper = CGPathCreateMutable(); - CGPathMoveToPoint(upper, &at, l, 0.5 * h); - CGPathAddLineToPoint(upper, &at, l, posTop - r1); - CGPathAddArc(upper, &at, l + r1, posTop - r1, r1, M_PI, M_PI_2, YES); - CGPathAddArc(upper, &at, posNameTag, posTop - r2, r2, M_PI_2, M_PI_4, YES); - CGPathAddArc(upper, &at, posNameTag + 2 * r2, posTop, r2, M_PI + M_PI_4, -M_PI_2, NO); - CGPathAddArc(upper, &at, w - l - r1, posTop - r1 - r2, r1, M_PI_2, 0, YES); - CGPathAddArc(upper, &at, w - l - r1, posBottom, r1, 0, -M_PI_2, YES); - CGPathAddArc(upper, &at, l + r1, posBottom, r1, -M_PI_2, M_PI, YES); - CGPathCloseSubpath(upper); - - CGMutablePathRef lower = CGPathCreateMutable(); - CGPathMoveToPoint(lower, &at, l, 0.5 * h); - CGPathAddArc(lower, &at, l + r3, posMiddle, r3, M_PI, M_PI_2, YES); - CGPathAddArc(lower, &at, w - l - r3, posMiddle, r3, M_PI_2, 0, YES); - CGPathAddArc(lower, &at, w - l - r1, posBottom, r1, 0, -M_PI_2, YES); - CGPathAddArc(lower, &at, l + r1, posBottom, r1, -M_PI_2, M_PI, YES); - CGPathCloseSubpath(lower); - - CGContextAddPath(c, upper); - CGContextAddPath(c, lower); - CGContextStrokePath(c); - CGPathRelease(upper); - CGPathRelease(lower); -} -@end diff --git a/baRSS/Preferences/Feeds Tab/SettingsFeeds.m b/baRSS/Preferences/Feeds Tab/SettingsFeeds.m index 734d006..ae546ad 100644 --- a/baRSS/Preferences/Feeds Tab/SettingsFeeds.m +++ b/baRSS/Preferences/Feeds Tab/SettingsFeeds.m @@ -290,7 +290,7 @@ static NSString *dragNodeType = @"baRSS-feed-drag"; // TODO: load icon static NSImage *defaultRSSIcon; if (!defaultRSSIcon) - defaultRSSIcon = [[[RSSIcon iconWithSize:cellView.imageView.frame.size] autoGradient] image]; + defaultRSSIcon = [RSSIcon iconWithSize:cellView.imageView.frame.size.height]; cellView.imageView.image = defaultRSSIcon; } diff --git a/baRSS/Preferences/General Tab/SettingsGeneral.xib b/baRSS/Preferences/General Tab/SettingsGeneral.xib index a7fa828..32b617c 100644 --- a/baRSS/Preferences/General Tab/SettingsGeneral.xib +++ b/baRSS/Preferences/General Tab/SettingsGeneral.xib @@ -35,135 +35,14 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + @@ -219,8 +306,8 @@ - - + + @@ -228,8 +315,8 @@ - - + + @@ -237,55 +324,73 @@ - - + + - - - - - - - + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - diff --git a/baRSS/Status Bar Menu/BarMenu.m b/baRSS/Status Bar Menu/BarMenu.m index b5a1b02..2550037 100644 --- a/baRSS/Status Bar Menu/BarMenu.m +++ b/baRSS/Status Bar Menu/BarMenu.m @@ -97,10 +97,10 @@ typedef NS_OPTIONS(NSInteger, MenuItemTag) { // TODO: Option: unread count in menubar, Option: highlight color, Option: icon choice if (self.unreadCountTotal > 0) { self.barItem.title = [NSString stringWithFormat:@"%d", self.unreadCountTotal]; - self.barItem.image = [[RSSIcon templateIcon:16 tint:[RSSIcon rssOrange]] image]; + self.barItem.image = [RSSIcon templateIcon:16 tint:[NSColor rssOrange]]; } else { self.barItem.title = @""; - self.barItem.image = [[RSSIcon templateIcon:16 tint:nil] image]; + self.barItem.image = [RSSIcon templateIcon:16 tint:nil]; self.barItem.image.template = YES; } // NSLog(@"==> %d", self.unreadCountTotal); @@ -173,7 +173,7 @@ typedef NS_OPTIONS(NSInteger, MenuItemTag) { - (NSMenuItem*)feedItem:(FeedConfig*)config unread:(int*)unread { static NSImage *defaultRSSIcon; if (!defaultRSSIcon) - defaultRSSIcon = [[[RSSIcon iconWithSize:NSMakeSize(16, 16)] autoGradient] image]; + defaultRSSIcon = [RSSIcon iconWithSize:16]; NSMenuItem *item = [[NSMenuItem alloc] initWithTitle:config.name action:@selector(openFeedURL:) keyEquivalent:@""]; item.target = self;