From 8d94fb63ec1c7bef420b213421c944a7b66864fe Mon Sep 17 00:00:00 2001 From: Jakub Suder Date: Sun, 29 Mar 2015 23:40:04 +0200 Subject: [PATCH] [#449] removed NSColor#hiNativeColor --- Hive/Categories/NSColor+Hive.h | 2 -- Hive/Categories/NSColor+Hive.m | 10 ---------- Hive/Controllers/HIContactTabBarController.m | 6 +++--- Hive/Controllers/HIContactViewController.m | 2 +- Hive/Controllers/HIContactsViewController.m | 2 +- Hive/Controllers/HIMainWindowController.m | 2 +- Hive/Controllers/HINewContactViewController.m | 6 +++--- Hive/Controllers/HIProfileViewController.m | 4 ++-- Hive/Controllers/HIQRCodeWindowController.m | 2 +- Hive/Controllers/HISendBitcoinsWindowController.m | 10 +++++----- Hive/Controllers/HITransactionsViewController.m | 2 +- Hive/Views/HIAddressesBox.m | 2 +- Hive/Views/HIBox.m | 4 ++-- Hive/Views/HIButtonCell.m | 4 ++-- Hive/Views/HICopyView.m | 2 +- Hive/Views/HIDeleteButtonCell.m | 4 ++-- Hive/Views/HIGradientButtonCell.m | 6 +++--- Hive/Views/HIRightPointingArrowView.m | 2 +- Hive/Views/HISeparatorView.m | 2 +- Hive/Views/HITextField.m | 6 +++--- 20 files changed, 34 insertions(+), 46 deletions(-) diff --git a/Hive/Categories/NSColor+Hive.h b/Hive/Categories/NSColor+Hive.h index 804c2eaa..9b7c469f 100644 --- a/Hive/Categories/NSColor+Hive.h +++ b/Hive/Categories/NSColor+Hive.h @@ -10,6 +10,4 @@ + (NSColor *)hiWindowBackgroundColor; -- (CGColorRef)hiNativeColor; - @end diff --git a/Hive/Categories/NSColor+Hive.m b/Hive/Categories/NSColor+Hive.m index fed4754f..2b0d38d5 100644 --- a/Hive/Categories/NSColor+Hive.m +++ b/Hive/Categories/NSColor+Hive.m @@ -14,14 +14,4 @@ + (NSColor *)hiWindowBackgroundColor { return [NSColor colorWithCalibratedWhite:0.94 alpha:1.0]; } -- (CGColorRef)hiNativeColor { - const NSInteger numberOfComponents = [self numberOfComponents]; - CGFloat components[numberOfComponents]; - CGColorSpaceRef colorSpace = [[self colorSpace] CGColorSpace]; - - [self getComponents:(CGFloat *)&components]; - - return (__bridge CGColorRef) CFBridgingRelease(CGColorCreate(colorSpace, components)); -} - @end diff --git a/Hive/Controllers/HIContactTabBarController.m b/Hive/Controllers/HIContactTabBarController.m index be8215e9..774c4658 100644 --- a/Hive/Controllers/HIContactTabBarController.m +++ b/Hive/Controllers/HIContactTabBarController.m @@ -69,7 +69,7 @@ - (NSView *)horizontalLineAtPosition:(CGFloat)position color:(NSColor *)color { NSRect frame = NSMakeRect(0, position, self.view.frame.size.width, 1); NSView *line = [[NSView alloc] initWithFrame:frame]; line.wantsLayer = YES; - line.layer.backgroundColor = [color hiNativeColor]; + line.layer.backgroundColor = [color CGColor]; line.autoresizingMask = NSViewMinYMargin | NSViewMaxYMargin | NSViewWidthSizable; return line; } @@ -78,8 +78,8 @@ - (NSView *)verticalSeparatorAtPosition:(CGFloat)position color:(NSColor *)color NSRect frame = NSMakeRect(position, 10, 1, self.view.frame.size.height - 20); NSView *line = [[NSView alloc] initWithFrame:frame]; line.wantsLayer = YES; - line.layer.backgroundColor = [color hiNativeColor]; - line.layer.shadowColor = [[NSColor whiteColor] hiNativeColor]; + line.layer.backgroundColor = [color CGColor]; + line.layer.shadowColor = [[NSColor whiteColor] CGColor]; line.layer.shadowOffset = NSMakeSize(1.0, 0.0); line.layer.shadowOpacity = 1.0; line.layer.shadowRadius = 0.0; diff --git a/Hive/Controllers/HIContactViewController.m b/Hive/Controllers/HIContactViewController.m index 52d95afe..6c46d04b 100644 --- a/Hive/Controllers/HIContactViewController.m +++ b/Hive/Controllers/HIContactViewController.m @@ -51,7 +51,7 @@ - (void)loadView { [super loadView]; [_infoPanel loadView]; - self.view.layer.backgroundColor = [[NSColor hiWindowBackgroundColor] hiNativeColor]; + self.view.layer.backgroundColor = [[NSColor hiWindowBackgroundColor] CGColor]; [self.tabBarController selectTabAtIndex:0]; } diff --git a/Hive/Controllers/HIContactsViewController.m b/Hive/Controllers/HIContactsViewController.m index f74b9850..87354a73 100644 --- a/Hive/Controllers/HIContactsViewController.m +++ b/Hive/Controllers/HIContactsViewController.m @@ -53,7 +53,7 @@ - (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibB - (void)awakeFromNib { [self.foreverAloneScreen setFrame:self.view.bounds]; [self.foreverAloneScreen setHidden:YES]; - [self.foreverAloneScreen.layer setBackgroundColor:[[NSColor hiWindowBackgroundColor] hiNativeColor]]; + [self.foreverAloneScreen.layer setBackgroundColor:[[NSColor hiWindowBackgroundColor] CGColor]]; [self.view addSubview:self.foreverAloneScreen]; [[NSUserDefaults standardUserDefaults] registerDefaults:@{ SortByLastNamePreferencesKey: @1 }]; diff --git a/Hive/Controllers/HIMainWindowController.m b/Hive/Controllers/HIMainWindowController.m index 7a8e26e6..4c94892d 100644 --- a/Hive/Controllers/HIMainWindowController.m +++ b/Hive/Controllers/HIMainWindowController.m @@ -210,7 +210,7 @@ - (void)slideControllerIntoView:(HIViewController *)newController slideOut:(HIVi newTitleView.alphaValue = 0.0; [self.appStoreWindow.titleBarView addSubview:newTitleView]; - newController.view.layer.shadowColor = [[NSColor blackColor] hiNativeColor]; + newController.view.layer.shadowColor = [[NSColor blackColor] CGColor]; newController.view.layer.shadowOffset = CGSizeMake(50.0, 0.0); newController.view.layer.shadowRadius = 50.0; newController.view.layer.shadowOpacity = 0.25; diff --git a/Hive/Controllers/HINewContactViewController.m b/Hive/Controllers/HINewContactViewController.m index a37aee9b..036e6d97 100644 --- a/Hive/Controllers/HINewContactViewController.m +++ b/Hive/Controllers/HINewContactViewController.m @@ -77,7 +77,7 @@ - (void)loadView { [super loadView]; [self setUpQrCodeButton]; - _avatarView.layer.backgroundColor = [[NSColor whiteColor] hiNativeColor]; + _avatarView.layer.backgroundColor = [[NSColor whiteColor] CGColor]; // Hide some buttons if necessary @@ -230,7 +230,7 @@ - (void)addAddressPlaceholderWithHash:(NSString *)address name:(NSString *)name NSMakeRect(1, AddressCellHeight, self.walletsView.bounds.size.width - 2, 1)]; separator.wantsLayer = YES; - separator.layer.backgroundColor = [[NSColor colorWithCalibratedWhite:0.5 alpha:0.5] hiNativeColor]; + separator.layer.backgroundColor = [[NSColor colorWithCalibratedWhite:0.5 alpha:0.5] CGColor]; separator.autoresizingMask = NSViewMinYMargin | NSViewWidthSizable; [self.walletsView addSubview:separator]; @@ -239,7 +239,7 @@ - (void)addAddressPlaceholderWithHash:(NSString *)address name:(NSString *)name NSView *fieldContentView = [[NSView alloc] initWithFrame: NSMakeRect(0, 0, self.walletsView.bounds.size.width - 40, AddressCellHeight)]; - fieldContentView.layer.backgroundColor = [[NSColor clearColor] hiNativeColor]; + fieldContentView.layer.backgroundColor = [[NSColor clearColor] CGColor]; fieldContentView.autoresizingMask = NSViewMinYMargin | NSViewWidthSizable; [self.walletsView addSubview:fieldContentView]; parts[ContentsView] = fieldContentView; diff --git a/Hive/Controllers/HIProfileViewController.m b/Hive/Controllers/HIProfileViewController.m index ba17282f..a87004e7 100644 --- a/Hive/Controllers/HIProfileViewController.m +++ b/Hive/Controllers/HIProfileViewController.m @@ -93,10 +93,10 @@ - (void)loadView { [super loadView]; [_infoPanel loadView]; - self.view.layer.backgroundColor = [[NSColor hiWindowBackgroundColor] hiNativeColor]; + self.view.layer.backgroundColor = [[NSColor hiWindowBackgroundColor] CGColor]; self.photoView.layer.borderWidth = 1.0; - self.photoView.layer.borderColor = [[NSColor colorWithCalibratedWhite:0.88 alpha:1.0] hiNativeColor]; + self.photoView.layer.borderColor = [[NSColor colorWithCalibratedWhite:0.88 alpha:1.0] CGColor]; [self setupBitcoinFormatLists]; [self setupCurrencyLists]; diff --git a/Hive/Controllers/HIQRCodeWindowController.m b/Hive/Controllers/HIQRCodeWindowController.m index 092d3d21..3f36f021 100644 --- a/Hive/Controllers/HIQRCodeWindowController.m +++ b/Hive/Controllers/HIQRCodeWindowController.m @@ -44,7 +44,7 @@ - (void)windowDidLoad { [super windowDidLoad]; [self.window.contentView setWantsLayer:YES]; - [self.window.contentView layer].backgroundColor = [NSColor whiteColor].hiNativeColor; + [self.window.contentView layer].backgroundColor = [[NSColor whiteColor] CGColor]; } diff --git a/Hive/Controllers/HISendBitcoinsWindowController.m b/Hive/Controllers/HISendBitcoinsWindowController.m index 7128456b..78aef3d3 100644 --- a/Hive/Controllers/HISendBitcoinsWindowController.m +++ b/Hive/Controllers/HISendBitcoinsWindowController.m @@ -149,12 +149,12 @@ - (void)windowDidLoad { NSView *wrapperContents = self.wrapper.contentView; wrapperContents.layer.borderWidth = 1.0; - wrapperContents.layer.borderColor = [[NSColor colorWithCalibratedWhite:0.8 alpha:1.0] hiNativeColor]; - wrapperContents.layer.backgroundColor = [[NSColor whiteColor] hiNativeColor]; + wrapperContents.layer.borderColor = [[NSColor colorWithCalibratedWhite:0.8 alpha:1.0] CGColor]; + wrapperContents.layer.backgroundColor = [[NSColor whiteColor] CGColor]; wrapperContents.layer.cornerRadius = 5.0; self.detailsBox.layer.borderWidth = 1.0; - self.detailsBox.layer.borderColor = [[NSColor colorWithCalibratedWhite:0.85 alpha:1.0] hiNativeColor]; + self.detailsBox.layer.borderColor = [[NSColor colorWithCalibratedWhite:0.85 alpha:1.0] CGColor]; [[self.detailsBox documentView] setTextContainerInset:NSMakeSize(1.0, 5.0)]; [self setupQRCodeButton]; @@ -895,8 +895,8 @@ - (void)showPaymentConfirmation:(NSDictionary *)data { NSColor *borderColor = [NSColor colorWithCalibratedHue:95.0/360 saturation:0.5 brightness:0.8 alpha:1.0]; NSView *ackBarContents = self.ackBar.contentView; - ackBarContents.layer.backgroundColor = [fillColor hiNativeColor]; - ackBarContents.layer.borderColor = [borderColor hiNativeColor]; + ackBarContents.layer.backgroundColor = [fillColor CGColor]; + ackBarContents.layer.borderColor = [borderColor CGColor]; ackBarContents.layer.borderWidth = 1.0; ackBarContents.layer.cornerRadius = 5.0; diff --git a/Hive/Controllers/HITransactionsViewController.m b/Hive/Controllers/HITransactionsViewController.m index 23e4cd98..c11ed5bf 100644 --- a/Hive/Controllers/HITransactionsViewController.m +++ b/Hive/Controllers/HITransactionsViewController.m @@ -94,7 +94,7 @@ - (void)loadView { [self.noTransactionsView setFrame:self.view.bounds]; [self.noTransactionsView setHidden:YES]; - [self.noTransactionsView.layer setBackgroundColor:[[NSColor hiWindowBackgroundColor] hiNativeColor]]; + [self.noTransactionsView.layer setBackgroundColor:[[NSColor hiWindowBackgroundColor] CGColor]]; [self.view addSubview:self.noTransactionsView]; [self.arrayController addObserver:self diff --git a/Hive/Views/HIAddressesBox.m b/Hive/Views/HIAddressesBox.m index c9d9a58c..0a508751 100644 --- a/Hive/Views/HIAddressesBox.m +++ b/Hive/Views/HIAddressesBox.m @@ -109,7 +109,7 @@ - (NSView *)addressSeparatorViewAtIndex:(NSInteger)index { NSView *separator = [[NSView alloc] initWithFrame:frame]; separator.wantsLayer = YES; - separator.layer.backgroundColor = [[NSColor colorWithCalibratedWhite:0.5 alpha:0.3] hiNativeColor]; + separator.layer.backgroundColor = [[NSColor colorWithCalibratedWhite:0.5 alpha:0.3] CGColor]; separator.autoresizingMask = NSViewMaxYMargin | NSViewWidthSizable; return separator; diff --git a/Hive/Views/HIBox.m b/Hive/Views/HIBox.m index 9ae21127..15abe1dc 100644 --- a/Hive/Views/HIBox.m +++ b/Hive/Views/HIBox.m @@ -33,8 +33,8 @@ - (void)setUpBox { self.layer.borderWidth = 1.0; self.layer.cornerRadius = 5.0; - self.layer.borderColor = RGB(195,195,195).hiNativeColor; - self.layer.backgroundColor = [NSColor whiteColor].hiNativeColor; + self.layer.borderColor = [RGB(195,195,195) CGColor]; + self.layer.backgroundColor = [[NSColor whiteColor] CGColor]; } @end diff --git a/Hive/Views/HIButtonCell.m b/Hive/Views/HIButtonCell.m index 1135decf..f34e345b 100644 --- a/Hive/Views/HIButtonCell.m +++ b/Hive/Views/HIButtonCell.m @@ -40,11 +40,11 @@ - (void)drawBezelWithFrame:(NSRect)frame inView:(NSView *)controlView { [p fill]; [sP stroke]; - controlView.layer.shadowColor = [[NSColor whiteColor] hiNativeColor]; + controlView.layer.shadowColor = [[NSColor whiteColor] CGColor]; } else { NSGradient *g = [[NSGradient alloc] initWithColors:@[RGB(250,250,250), RGB(237, 237, 237)]]; [g drawInBezierPath:p angle:90]; - controlView.layer.shadowColor = [[NSColor blackColor] hiNativeColor]; + controlView.layer.shadowColor = [[NSColor blackColor] CGColor]; if (!self.isEnabled) { strokeColor = RGB(184, 203, 230); diff --git a/Hive/Views/HICopyView.m b/Hive/Views/HICopyView.m index 8f2663e9..7f79e4ae 100644 --- a/Hive/Views/HICopyView.m +++ b/Hive/Views/HICopyView.m @@ -34,7 +34,7 @@ - (instancetype)initWithFrame:(NSRect)frame { _selectionView = [[NSView alloc] initWithFrame:self.bounds]; _selectionView.autoresizingMask = NSViewWidthSizable | NSViewMinYMargin; _selectionView.wantsLayer = YES; - _selectionView.layer.backgroundColor = [RGB(42, 140, 244) hiNativeColor]; + _selectionView.layer.backgroundColor = [RGB(42, 140, 244) CGColor]; _selectionView.alphaValue = 0.0; [self addSubview:_selectionView]; diff --git a/Hive/Views/HIDeleteButtonCell.m b/Hive/Views/HIDeleteButtonCell.m index 3ba0ac73..d98e58d6 100644 --- a/Hive/Views/HIDeleteButtonCell.m +++ b/Hive/Views/HIDeleteButtonCell.m @@ -29,12 +29,12 @@ - (void)drawBezelWithFrame:(NSRect)frame inView:(NSView *)controlView { [RGB(167, 31, 39) setFill]; [p fill]; [[NSColor colorWithCalibratedWhite:0 alpha:0.35] set]; - controlView.layer.shadowColor = [[NSColor whiteColor] hiNativeColor]; + controlView.layer.shadowColor = [[NSColor whiteColor] CGColor]; } else { NSGradient *g = [[NSGradient alloc] initWithColors:@[RGB(248,85,94), RGB(167, 31, 39)]]; [g drawInBezierPath:p angle:90]; [RGB(255, 255, 255) set]; - controlView.layer.shadowColor = [[NSColor blackColor] hiNativeColor]; + controlView.layer.shadowColor = [[NSColor blackColor] CGColor]; } [sP stroke]; diff --git a/Hive/Views/HIGradientButtonCell.m b/Hive/Views/HIGradientButtonCell.m index 8d1f7eaf..cf84929e 100644 --- a/Hive/Views/HIGradientButtonCell.m +++ b/Hive/Views/HIGradientButtonCell.m @@ -31,18 +31,18 @@ - (void)drawBezelWithFrame:(NSRect)frame inView:(NSView *)controlView { [RGB(35, 116, 238) setFill]; [p fill]; [[NSColor colorWithCalibratedWhite:0 alpha:0.35] set]; - controlView.layer.shadowColor = [[NSColor whiteColor] hiNativeColor]; + controlView.layer.shadowColor = [[NSColor whiteColor] CGColor]; } else if (self.isEnabled) { NSGradient *g = [[NSGradient alloc] initWithColors:@[RGB(54,185,251), RGB(35, 116, 238)]]; [g drawInBezierPath:p angle:90]; [RGB(255, 255, 255) set]; - controlView.layer.shadowColor = [[NSColor blackColor] hiNativeColor]; + controlView.layer.shadowColor = [[NSColor blackColor] CGColor]; } else { strokeColor = RGB(184, 203, 230); NSGradient *g = [[NSGradient alloc] initWithColors:@[RGB(204,238,255), RGB(190, 209, 238)]]; [g drawInBezierPath:p angle:90]; [RGB(255, 255, 255) set]; - controlView.layer.shadowColor = [[NSColor grayColor] hiNativeColor]; + controlView.layer.shadowColor = [[NSColor grayColor] CGColor]; } if (self.hasShadow) { [sP stroke]; diff --git a/Hive/Views/HIRightPointingArrowView.m b/Hive/Views/HIRightPointingArrowView.m index 6dc987a5..156f8934 100644 --- a/Hive/Views/HIRightPointingArrowView.m +++ b/Hive/Views/HIRightPointingArrowView.m @@ -18,7 +18,7 @@ - (instancetype)initWithFrame:(NSRect)frame { _strokeColor = [NSColor colorWithCalibratedWhite:0.0 alpha:0.75]; _strokeWidth = 0.5; - self.layer.shadowColor = [[NSColor whiteColor] hiNativeColor]; + self.layer.shadowColor = [[NSColor whiteColor] CGColor]; self.layer.shadowOffset = NSMakeSize(1, -1); self.layer.shadowOpacity = 1.0; self.layer.shadowRadius = 0.0; diff --git a/Hive/Views/HISeparatorView.m b/Hive/Views/HISeparatorView.m index 4b9122a3..dcbf4f94 100644 --- a/Hive/Views/HISeparatorView.m +++ b/Hive/Views/HISeparatorView.m @@ -13,7 +13,7 @@ @implementation HISeparatorView - (void)awakeFromNib { self.wantsLayer = YES; - self.layer.backgroundColor = [RGB(211,211,211) hiNativeColor]; + self.layer.backgroundColor = [RGB(211,211,211) CGColor]; } diff --git a/Hive/Views/HITextField.m b/Hive/Views/HITextField.m index 1fdd191f..644000e2 100644 --- a/Hive/Views/HITextField.m +++ b/Hive/Views/HITextField.m @@ -33,11 +33,11 @@ - (void)awakeFromNib { self.frame.size.width + 2, self.frame.size.height + 2)]; _bgView.wantsLayer = YES; - _bgView.layer.backgroundColor = [[NSColor whiteColor] hiNativeColor]; + _bgView.layer.backgroundColor = [[NSColor whiteColor] CGColor]; _bgView.layer.borderWidth = 1.0; - _bgView.layer.borderColor = [[NSColor blackColor] hiNativeColor]; + _bgView.layer.borderColor = [[NSColor blackColor] CGColor]; _bgView.autoresizingMask = NSViewMaxYMargin | NSViewMinXMargin; - _bgView.layer.shadowColor = [[NSColor colorWithCalibratedWhite:0.3 alpha:1.0] hiNativeColor]; + _bgView.layer.shadowColor = [[NSColor colorWithCalibratedWhite:0.3 alpha:1.0] CGColor]; _bgView.layer.shadowOffset = NSMakeSize(-2, -2); _bgView.layer.shadowOpacity = 0.8; _bgView.layer.shadowRadius = 2.0;