You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
69 lines
2.6 KiB
69 lines
2.6 KiB
// |
|
// CLTimezoneCellView.m |
|
// Clocker |
|
// |
|
// Created by Abhishek Banthia on 12/13/15. |
|
// |
|
// |
|
|
|
#import "CLTimezoneCellView.h" |
|
#import "PanelController.h" |
|
#import "CommonStrings.h" |
|
|
|
@implementation CLTimezoneCellView |
|
|
|
- (void)drawRect:(NSRect)dirtyRect { |
|
[super drawRect:dirtyRect]; |
|
|
|
// Drawing code here. |
|
} |
|
|
|
- (IBAction)labelDidChange:(id)sender |
|
{ |
|
NSTextField *customLabelCell = (NSTextField*) sender; |
|
PanelController *panelController = (PanelController *)[[[NSApplication sharedApplication] mainWindow] windowController]; |
|
|
|
NSString *originalValue = customLabelCell.stringValue; |
|
NSString *customLabelValue = [originalValue stringByTrimmingCharactersInSet: |
|
[NSCharacterSet whitespaceCharacterSet]]; |
|
|
|
|
|
if ([[sender superview] isKindOfClass:[self class]]) { |
|
CLTimezoneCellView *cellView = (CLTimezoneCellView *)[sender superview]; |
|
NSDictionary *timezoneDictionary = panelController.defaultPreferences[cellView.rowNumber]; |
|
NSDictionary *mutableTimeZoneDict = [timezoneDictionary mutableCopy]; |
|
|
|
(customLabelValue.length > 0) ? [mutableTimeZoneDict setValue:customLabelValue forKey:CLCustomLabel] : [mutableTimeZoneDict setValue:CLEmptyString forKey:CLCustomLabel] ; |
|
[panelController.defaultPreferences replaceObjectAtIndex:cellView.rowNumber withObject:mutableTimeZoneDict]; |
|
[[NSUserDefaults standardUserDefaults] setObject:panelController.defaultPreferences forKey:CLDefaultPreferenceKey]; |
|
|
|
[panelController updateDefaultPreferences]; |
|
[panelController.mainTableview reloadData]; |
|
|
|
[[NSNotificationCenter defaultCenter] postNotificationName:CLCustomLabelChangedNotification object:nil]; |
|
|
|
} |
|
} |
|
|
|
- (void)updateFontFamilyWithFontName:(NSString *)fontName andCell:(CLTimezoneCellView*)cell |
|
{ |
|
cell.relativeDate.font = [NSFont fontWithName:fontName size:13]; |
|
cell.customName.font = [NSFont fontWithName:fontName size:15]; |
|
cell.time.font = [NSFont fontWithName:fontName size:29]; |
|
} |
|
|
|
- (void)updateTextColorWithColor:(NSColor *)color andCell:(CLTimezoneCellView*)cell |
|
{ |
|
cell.relativeDate.textColor = color; |
|
cell.customName.textColor = color; |
|
cell.time.textColor = color; |
|
} |
|
|
|
- (void)setDefaultThemeForCell:(CLTimezoneCellView *)cell |
|
{ |
|
cell.relativeDate.font = [NSFont fontWithName:@"Helvetica-Bold" size:13]; |
|
cell.customName.font = [NSFont fontWithName:@"Helvetica-Light" size:15]; |
|
cell.time.font = [NSFont fontWithName:@"Helvetica-Light" size:29]; |
|
} |
|
|
|
@end
|
|
|