Icon drawing finished and refactored
This commit is contained in:
@@ -22,41 +22,73 @@
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -35,135 +35,14 @@
|
||||
</connections>
|
||||
</button>
|
||||
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="4Z4-ko-oj2">
|
||||
<rect key="frame" x="18" y="271" width="284" height="18"/>
|
||||
<rect key="frame" x="70" y="124" width="22" height="18"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
|
||||
<buttonCell key="cell" type="check" title="Show tick mark for unread entries" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="3cL-4f-90v">
|
||||
<buttonCell key="cell" type="check" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="3cL-4f-90v">
|
||||
<behavior key="behavior" pushIn="YES" changeContents="YES" lightByContents="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<binding destination="iU7-KA-nY5" name="value" keyPath="values.markEntries" id="44f-w7-faP">
|
||||
<dictionary key="options">
|
||||
<bool key="NSAllowsEditingMultipleValuesSelection" value="NO"/>
|
||||
<integer key="NSNullPlaceholder" value="1"/>
|
||||
</dictionary>
|
||||
</binding>
|
||||
</connections>
|
||||
</button>
|
||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="yAR-77-YL8">
|
||||
<rect key="frame" x="18" y="248" width="284" height="17"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
|
||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Show number of unread items:" id="3jA-g1-5aG">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="QYu-9A-RSx">
|
||||
<rect key="frame" x="28" y="224" width="274" height="18"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
|
||||
<buttonCell key="cell" type="check" title="in menu bar" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="NHd-8Y-lgR">
|
||||
<behavior key="behavior" pushIn="YES" changeContents="YES" lightByContents="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<binding destination="iU7-KA-nY5" name="value" keyPath="values.unreadCountInMenuBar" id="DJz-7q-FEI">
|
||||
<dictionary key="options">
|
||||
<bool key="NSAllowsEditingMultipleValuesSelection" value="NO"/>
|
||||
<integer key="NSNullPlaceholder" value="1"/>
|
||||
</dictionary>
|
||||
</binding>
|
||||
</connections>
|
||||
</button>
|
||||
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="iGf-ZI-o6t">
|
||||
<rect key="frame" x="28" y="204" width="274" height="18"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
|
||||
<buttonCell key="cell" type="check" title="in groups" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="fhA-hO-eSv">
|
||||
<behavior key="behavior" pushIn="YES" changeContents="YES" lightByContents="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<binding destination="iU7-KA-nY5" name="value" keyPath="values.unreadCountInGroups" id="8R1-go-abo">
|
||||
<dictionary key="options">
|
||||
<bool key="NSAllowsEditingMultipleValuesSelection" value="NO"/>
|
||||
<integer key="NSNullPlaceholder" value="1"/>
|
||||
</dictionary>
|
||||
</binding>
|
||||
</connections>
|
||||
</button>
|
||||
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="ezY-pZ-WN7">
|
||||
<rect key="frame" x="28" y="184" width="274" height="18"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
|
||||
<buttonCell key="cell" type="check" title="in feeds" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="PgG-Pm-s9M">
|
||||
<behavior key="behavior" pushIn="YES" changeContents="YES" lightByContents="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<binding destination="iU7-KA-nY5" name="value" keyPath="values.unreadCountInFeeds" id="7bx-Th-0os">
|
||||
<dictionary key="options">
|
||||
<bool key="NSAllowsEditingMultipleValuesSelection" value="NO"/>
|
||||
<integer key="NSNullPlaceholder" value="1"/>
|
||||
</dictionary>
|
||||
</binding>
|
||||
</connections>
|
||||
</button>
|
||||
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Xbr-a8-v9X">
|
||||
<rect key="frame" x="18" y="117" width="22" height="18"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<buttonCell key="cell" type="check" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="FT6-me-ACu">
|
||||
<behavior key="behavior" pushIn="YES" changeContents="YES" lightByContents="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<binding destination="iU7-KA-nY5" name="value" keyPath="values.globalOpenUnread" id="c20-0p-cPb">
|
||||
<dictionary key="options">
|
||||
<bool key="NSAllowsEditingMultipleValuesSelection" value="NO"/>
|
||||
<integer key="NSNullPlaceholder" value="1"/>
|
||||
</dictionary>
|
||||
</binding>
|
||||
</connections>
|
||||
</button>
|
||||
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Eyy-w7-79K">
|
||||
<rect key="frame" x="18" y="137" width="22" height="18"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<buttonCell key="cell" type="check" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="Z56-ik-iHk">
|
||||
<behavior key="behavior" pushIn="YES" changeContents="YES" lightByContents="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<binding destination="iU7-KA-nY5" name="value" keyPath="values.globalUpdateAll" id="FrQ-u0-lFo">
|
||||
<dictionary key="options">
|
||||
<bool key="NSAllowsEditingMultipleValuesSelection" value="NO"/>
|
||||
<integer key="NSNullPlaceholder" value="1"/>
|
||||
</dictionary>
|
||||
</binding>
|
||||
</connections>
|
||||
</button>
|
||||
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="lAu-qx-vWl">
|
||||
<rect key="frame" x="18" y="97" width="22" height="18"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<buttonCell key="cell" type="check" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="8Ko-Cq-fCy">
|
||||
<behavior key="behavior" pushIn="YES" changeContents="YES" lightByContents="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<binding destination="iU7-KA-nY5" name="value" keyPath="values.globalMarkRead" id="uiO-3M-xfT">
|
||||
<dictionary key="options">
|
||||
<bool key="NSAllowsEditingMultipleValuesSelection" value="NO"/>
|
||||
<integer key="NSNullPlaceholder" value="1"/>
|
||||
</dictionary>
|
||||
</binding>
|
||||
</connections>
|
||||
</button>
|
||||
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="eKg-IL-v85">
|
||||
<rect key="frame" x="18" y="77" width="22" height="18"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<buttonCell key="cell" type="check" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="K4h-ul-R6b">
|
||||
<behavior key="behavior" pushIn="YES" changeContents="YES" lightByContents="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<binding destination="iU7-KA-nY5" name="value" keyPath="values.globalMarkUnread" id="drp-87-kfY">
|
||||
<binding destination="iU7-KA-nY5" name="value" keyPath="values.feedTickMark" id="xKL-Lh-tBL">
|
||||
<dictionary key="options">
|
||||
<bool key="NSAllowsEditingMultipleValuesSelection" value="NO"/>
|
||||
<integer key="NSNullPlaceholder" value="1"/>
|
||||
@@ -209,9 +88,217 @@
|
||||
</menu>
|
||||
</popUpButtonCell>
|
||||
</popUpButton>
|
||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Fey-RP-7wF">
|
||||
<rect key="frame" x="128" y="138" width="133" height="17"/>
|
||||
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="QYu-9A-RSx">
|
||||
<rect key="frame" x="18" y="146" width="22" height="18"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
|
||||
<buttonCell key="cell" type="check" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="NHd-8Y-lgR">
|
||||
<behavior key="behavior" pushIn="YES" changeContents="YES" lightByContents="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<binding destination="iU7-KA-nY5" name="value" keyPath="values.globalUnreadCount" id="dyl-pE-j2k">
|
||||
<dictionary key="options">
|
||||
<bool key="NSAllowsEditingMultipleValuesSelection" value="NO"/>
|
||||
<integer key="NSNullPlaceholder" value="1"/>
|
||||
</dictionary>
|
||||
</binding>
|
||||
</connections>
|
||||
</button>
|
||||
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="iGf-ZI-o6t">
|
||||
<rect key="frame" x="44" y="146" width="22" height="18"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
|
||||
<buttonCell key="cell" type="check" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="fhA-hO-eSv">
|
||||
<behavior key="behavior" pushIn="YES" changeContents="YES" lightByContents="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<binding destination="iU7-KA-nY5" name="value" keyPath="values.groupUnreadCount" id="Mg5-xJ-L3n">
|
||||
<dictionary key="options">
|
||||
<bool key="NSAllowsEditingMultipleValuesSelection" value="NO"/>
|
||||
<integer key="NSNullPlaceholder" value="1"/>
|
||||
</dictionary>
|
||||
</binding>
|
||||
</connections>
|
||||
</button>
|
||||
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="ezY-pZ-WN7">
|
||||
<rect key="frame" x="70" y="146" width="22" height="18"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
|
||||
<buttonCell key="cell" type="check" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="PgG-Pm-s9M">
|
||||
<behavior key="behavior" pushIn="YES" changeContents="YES" lightByContents="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<binding destination="iU7-KA-nY5" name="value" keyPath="values.feedUnreadCount" id="hnm-Q2-kbs">
|
||||
<dictionary key="options">
|
||||
<bool key="NSAllowsEditingMultipleValuesSelection" value="NO"/>
|
||||
<integer key="NSNullPlaceholder" value="1"/>
|
||||
</dictionary>
|
||||
</binding>
|
||||
</connections>
|
||||
</button>
|
||||
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Xbr-a8-v9X">
|
||||
<rect key="frame" x="18" y="212" width="22" height="18"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<buttonCell key="cell" type="check" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="FT6-me-ACu">
|
||||
<behavior key="behavior" pushIn="YES" changeContents="YES" lightByContents="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<binding destination="iU7-KA-nY5" name="value" keyPath="values.globalOpenUnread" id="c20-0p-cPb">
|
||||
<dictionary key="options">
|
||||
<bool key="NSAllowsEditingMultipleValuesSelection" value="NO"/>
|
||||
<integer key="NSNullPlaceholder" value="1"/>
|
||||
</dictionary>
|
||||
</binding>
|
||||
</connections>
|
||||
</button>
|
||||
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="kO5-iF-mZX">
|
||||
<rect key="frame" x="44" y="212" width="22" height="18"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<buttonCell key="cell" type="check" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="4uj-0i-drs">
|
||||
<behavior key="behavior" pushIn="YES" changeContents="YES" lightByContents="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<binding destination="iU7-KA-nY5" name="value" keyPath="values.groupOpenUnread" id="mCn-aE-DwT">
|
||||
<dictionary key="options">
|
||||
<bool key="NSAllowsEditingMultipleValuesSelection" value="NO"/>
|
||||
<integer key="NSNullPlaceholder" value="1"/>
|
||||
</dictionary>
|
||||
</binding>
|
||||
</connections>
|
||||
</button>
|
||||
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="ZVR-xf-ZeB">
|
||||
<rect key="frame" x="70" y="212" width="22" height="18"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<buttonCell key="cell" type="check" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="tQ4-MK-ghd">
|
||||
<behavior key="behavior" pushIn="YES" changeContents="YES" lightByContents="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<binding destination="iU7-KA-nY5" name="value" keyPath="values.feedOpenUnread" id="Qyh-BN-P74">
|
||||
<dictionary key="options">
|
||||
<bool key="NSAllowsEditingMultipleValuesSelection" value="NO"/>
|
||||
<integer key="NSNullPlaceholder" value="1"/>
|
||||
</dictionary>
|
||||
</binding>
|
||||
</connections>
|
||||
</button>
|
||||
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Eyy-w7-79K">
|
||||
<rect key="frame" x="18" y="234" width="22" height="18"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<buttonCell key="cell" type="check" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="Z56-ik-iHk">
|
||||
<behavior key="behavior" pushIn="YES" changeContents="YES" lightByContents="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<binding destination="iU7-KA-nY5" name="value" keyPath="values.globalUpdateAll" id="FrQ-u0-lFo">
|
||||
<dictionary key="options">
|
||||
<bool key="NSAllowsEditingMultipleValuesSelection" value="NO"/>
|
||||
<integer key="NSNullPlaceholder" value="1"/>
|
||||
</dictionary>
|
||||
</binding>
|
||||
</connections>
|
||||
</button>
|
||||
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="lAu-qx-vWl">
|
||||
<rect key="frame" x="18" y="190" width="22" height="18"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<buttonCell key="cell" type="check" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="8Ko-Cq-fCy">
|
||||
<behavior key="behavior" pushIn="YES" changeContents="YES" lightByContents="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<binding destination="iU7-KA-nY5" name="value" keyPath="values.globalMarkRead" id="uiO-3M-xfT">
|
||||
<dictionary key="options">
|
||||
<bool key="NSAllowsEditingMultipleValuesSelection" value="NO"/>
|
||||
<integer key="NSNullPlaceholder" value="1"/>
|
||||
</dictionary>
|
||||
</binding>
|
||||
</connections>
|
||||
</button>
|
||||
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="hAY-eb-Ygs">
|
||||
<rect key="frame" x="44" y="190" width="22" height="18"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<buttonCell key="cell" type="check" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="vBc-4I-hsa">
|
||||
<behavior key="behavior" pushIn="YES" changeContents="YES" lightByContents="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<binding destination="iU7-KA-nY5" name="value" keyPath="values.groupMarkRead" id="YLZ-t8-Jbk">
|
||||
<dictionary key="options">
|
||||
<bool key="NSAllowsEditingMultipleValuesSelection" value="NO"/>
|
||||
<integer key="NSNullPlaceholder" value="1"/>
|
||||
</dictionary>
|
||||
</binding>
|
||||
</connections>
|
||||
</button>
|
||||
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="TfV-CA-pjd">
|
||||
<rect key="frame" x="70" y="190" width="22" height="18"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<buttonCell key="cell" type="check" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="OPa-de-9M3">
|
||||
<behavior key="behavior" pushIn="YES" changeContents="YES" lightByContents="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<binding destination="iU7-KA-nY5" name="value" keyPath="values.feedMarkRead" id="mYj-26-0OV">
|
||||
<dictionary key="options">
|
||||
<bool key="NSAllowsEditingMultipleValuesSelection" value="NO"/>
|
||||
<integer key="NSNullPlaceholder" value="1"/>
|
||||
</dictionary>
|
||||
</binding>
|
||||
</connections>
|
||||
</button>
|
||||
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="eKg-IL-v85">
|
||||
<rect key="frame" x="18" y="168" width="22" height="18"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<buttonCell key="cell" type="check" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="K4h-ul-R6b">
|
||||
<behavior key="behavior" pushIn="YES" changeContents="YES" lightByContents="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<binding destination="iU7-KA-nY5" name="value" keyPath="values.globalMarkUnread" id="drp-87-kfY">
|
||||
<dictionary key="options">
|
||||
<bool key="NSAllowsEditingMultipleValuesSelection" value="NO"/>
|
||||
<integer key="NSNullPlaceholder" value="1"/>
|
||||
</dictionary>
|
||||
</binding>
|
||||
</connections>
|
||||
</button>
|
||||
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="z97-Z3-YRK">
|
||||
<rect key="frame" x="44" y="168" width="22" height="18"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<buttonCell key="cell" type="check" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="bYm-jJ-lA7">
|
||||
<behavior key="behavior" pushIn="YES" changeContents="YES" lightByContents="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<binding destination="iU7-KA-nY5" name="value" keyPath="values.groupMarkUnread" id="bJP-0I-l7t">
|
||||
<dictionary key="options">
|
||||
<bool key="NSAllowsEditingMultipleValuesSelection" value="NO"/>
|
||||
<integer key="NSNullPlaceholder" value="1"/>
|
||||
</dictionary>
|
||||
</binding>
|
||||
</connections>
|
||||
</button>
|
||||
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="yGm-6r-8xg">
|
||||
<rect key="frame" x="70" y="168" width="22" height="18"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<buttonCell key="cell" type="check" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="KHI-ra-F11">
|
||||
<behavior key="behavior" pushIn="YES" changeContents="YES" lightByContents="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<binding destination="iU7-KA-nY5" name="value" keyPath="values.feedMarkUnread" id="mRu-7M-3bu">
|
||||
<dictionary key="options">
|
||||
<bool key="NSAllowsEditingMultipleValuesSelection" value="NO"/>
|
||||
<integer key="NSNullPlaceholder" value="1"/>
|
||||
</dictionary>
|
||||
</binding>
|
||||
</connections>
|
||||
</button>
|
||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Fey-RP-7wF">
|
||||
<rect key="frame" x="96" y="235" width="206" height="17"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
|
||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Update all feeds" id="Yy6-xr-m0l">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
|
||||
@@ -219,8 +306,8 @@
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="VhY-mw-Rej">
|
||||
<rect key="frame" x="128" y="118" width="133" height="17"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<rect key="frame" x="96" y="213" width="206" height="17"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
|
||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Open all unread" id="lVL-bb-uA6">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
|
||||
@@ -228,8 +315,8 @@
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="qFU-En-OSw">
|
||||
<rect key="frame" x="128" y="98" width="133" height="17"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<rect key="frame" x="96" y="191" width="206" height="17"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
|
||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Mark all read" id="XD8-5a-Hlg">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
|
||||
@@ -237,55 +324,73 @@
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="oFG-IQ-p9b">
|
||||
<rect key="frame" x="128" y="78" width="133" height="17"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<rect key="frame" x="96" y="169" width="206" height="17"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
|
||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Mark all unread" id="PJI-mv-AnH">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="ZCI-pL-I3q">
|
||||
<rect key="frame" x="56" y="162" width="18" height="18"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="NSFolder" id="r1h-PL-XrL"/>
|
||||
</imageView>
|
||||
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="SKf-Y7-8xS" customClass="SettingsIconGroup">
|
||||
<rect key="frame" x="114" y="168" width="18" height="18"/>
|
||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="K4q-A1-Fi9">
|
||||
<rect key="frame" x="96" y="125" width="206" height="17"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
|
||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Tick mark unread items" id="a7h-dX-8Vg">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<customView toolTip="Show in menu bar" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="P4Y-i1-MGE" customClass="SettingsIconGlobal">
|
||||
<rect key="frame" x="20" y="260" width="18" height="18"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="color" keyPath="color">
|
||||
<color key="value" white="0.0" alpha="1" colorSpace="calibratedWhite"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</customView>
|
||||
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="P4Y-i1-MGE" customClass="SettingsIconGlobal">
|
||||
<rect key="frame" x="20" y="162" width="18" height="18"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="color" keyPath="color">
|
||||
<color key="value" white="0.0" alpha="1" colorSpace="calibratedWhite"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</customView>
|
||||
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Q3s-d8-Nlf" customClass="SettingsIconGroup">
|
||||
<rect key="frame" x="174" y="119" width="121" height="121"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="color" keyPath="color">
|
||||
<color key="value" red="1" green="0.077124427349073099" blue="0.07612364338405142" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<color key="value" name="labelColor" catalog="System" colorSpace="catalog"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="roundness">
|
||||
<real key="value" value="40"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</customView>
|
||||
<customView toolTip="Show in group menu" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="SKf-Y7-8xS" customClass="SettingsIconGroup">
|
||||
<rect key="frame" x="46" y="260" width="18" height="18"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="color" keyPath="color">
|
||||
<color key="value" name="labelColor" catalog="System" colorSpace="catalog"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="roundness">
|
||||
<real key="value" value="40"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</customView>
|
||||
<customView toolTip="Show in feed menu" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="18m-2g-bqW" customClass="RSSIcon">
|
||||
<rect key="frame" x="72" y="260" width="18" height="18"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="roundness">
|
||||
<real key="value" value="40"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
<userDefinedRuntimeAttribute type="color" keyPath="color">
|
||||
<color key="value" name="labelColor" catalog="System" colorSpace="catalog"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</customView>
|
||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="tjr-Of-qZE">
|
||||
<rect key="frame" x="96" y="147" width="206" height="17"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
|
||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Number of unread items" id="JZc-eZ-uTe">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
</subviews>
|
||||
<point key="canvasLocation" x="140" y="-155.5"/>
|
||||
</customView>
|
||||
</objects>
|
||||
<resources>
|
||||
<image name="NSBookmarksTemplate" width="17" height="18"/>
|
||||
<image name="NSFolder" width="32" height="32"/>
|
||||
</resources>
|
||||
</document>
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user