diff options
author | stuconnolly <stuart02@gmail.com> | 2009-11-15 00:43:03 +0000 |
---|---|---|
committer | stuconnolly <stuart02@gmail.com> | 2009-11-15 00:43:03 +0000 |
commit | 043cc9df062d7167934401fd0b41b0ff6c22defc (patch) | |
tree | 586f34558bbd2c2329d68d5f93ea948f0d7c633a /Source | |
parent | 9752bb1ba25a17a0fec38ef186d950f573be6c42 (diff) | |
download | sequelpro-043cc9df062d7167934401fd0b41b0ff6c22defc.tar.gz sequelpro-043cc9df062d7167934401fd0b41b0ff6c22defc.tar.bz2 sequelpro-043cc9df062d7167934401fd0b41b0ff6c22defc.zip |
Make the relations table view observe the use monospaced font preference.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/SPTableRelations.m | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/Source/SPTableRelations.m b/Source/SPTableRelations.m index d16838be..d0ebb11b 100644 --- a/Source/SPTableRelations.m +++ b/Source/SPTableRelations.m @@ -61,6 +61,17 @@ // Set the table relation view's vertical gridlines if required [relationsTableView setGridStyleMask:([[NSUserDefaults standardUserDefaults] boolForKey:SPDisplayTableViewVerticalGridlines]) ? NSTableViewSolidVerticalGridLineMask : NSTableViewGridNone]; + // Set the strutcture and index view's font + BOOL useMonospacedFont = [[NSUserDefaults standardUserDefaults] boolForKey:SPUseMonospacedFonts]; + + for (NSTableColumn *column in [relationsTableView tableColumns]) + { + [[column dataCell] setFont:(useMonospacedFont) ? [NSFont fontWithName:SPDefaultMonospacedFontName size:[NSFont smallSystemFontSize]] : [NSFont systemFontOfSize:[NSFont smallSystemFontSize]]]; + } + + // Register as an observer for the when the UseMonospacedFonts preference changes + [[NSUserDefaults standardUserDefaults] addObserver:self forKeyPath:SPUseMonospacedFonts options:NSKeyValueObservingOptionNew context:NULL]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(tableSelectionChanged:) name:SPTableChangedNotification @@ -377,9 +388,22 @@ */ - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { + // Display table veiew vertical gridlines preference changed if ([keyPath isEqualToString:SPDisplayTableViewVerticalGridlines]) { [relationsTableView setGridStyleMask:([[change objectForKey:NSKeyValueChangeNewKey] boolValue]) ? NSTableViewSolidVerticalGridLineMask : NSTableViewGridNone]; } + // Use monospaced fonts preference changed + else if ([keyPath isEqualToString:SPUseMonospacedFonts]) { + + BOOL useMonospacedFont = [[change objectForKey:NSKeyValueChangeNewKey] boolValue]; + + for (NSTableColumn *column in [relationsTableView tableColumns]) + { + [[column dataCell] setFont:(useMonospacedFont) ? [NSFont fontWithName:SPDefaultMonospacedFontName size:[NSFont smallSystemFontSize]] : [NSFont systemFontOfSize:[NSFont smallSystemFontSize]]]; + } + + [relationsTableView reloadData]; + } } /** @@ -397,6 +421,8 @@ return YES; } +#pragma mark - + /* * Dealloc. */ |