diff options
author | stuconnolly <stuart02@gmail.com> | 2009-11-14 22:21:13 +0000 |
---|---|---|
committer | stuconnolly <stuart02@gmail.com> | 2009-11-14 22:21:13 +0000 |
commit | 694e5a55fe9f2579fdef121e3da9d300ed372f89 (patch) | |
tree | 6a3e033bc5437ef157a225d2cdf7975ea4cfb9af /Source/SPProcessListController.m | |
parent | 1ac04adbfe9ad64a9aaa35780301309718ff85d9 (diff) | |
download | sequelpro-694e5a55fe9f2579fdef121e3da9d300ed372f89.tar.gz sequelpro-694e5a55fe9f2579fdef121e3da9d300ed372f89.tar.bz2 sequelpro-694e5a55fe9f2579fdef121e3da9d300ed372f89.zip |
Updates to the 'use monospaced font' preference, making it a lot more consistent across all table views. Also includes live updating when the preference is changed as well as its implementation in the query console, process list and variables table views.
Diffstat (limited to 'Source/SPProcessListController.m')
-rw-r--r-- | Source/SPProcessListController.m | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/Source/SPProcessListController.m b/Source/SPProcessListController.m index 864bccc3..5087ef2a 100644 --- a/Source/SPProcessListController.m +++ b/Source/SPProcessListController.m @@ -60,8 +60,21 @@ */ - (void)awakeFromNib { + NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults]; + // Set the process table view's vertical gridlines if required - [processListTableView setGridStyleMask:([[NSUserDefaults standardUserDefaults] boolForKey:SPDisplayTableViewVerticalGridlines]) ? NSTableViewSolidVerticalGridLineMask : NSTableViewGridNone]; + [processListTableView setGridStyleMask:([prefs boolForKey:SPDisplayTableViewVerticalGridlines]) ? NSTableViewSolidVerticalGridLineMask : NSTableViewGridNone]; + + // Set the strutcture and index view's font + BOOL useMonospacedFont = [prefs boolForKey:SPUseMonospacedFonts]; + + for (NSTableColumn *column in [processListTableView 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 + [prefs addObserver:self forKeyPath:SPUseMonospacedFonts options:NSKeyValueObservingOptionNew context:NULL]; } #pragma mark - @@ -326,9 +339,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]) { [processListTableView 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 [processListTableView tableColumns]) + { + [[column dataCell] setFont:(useMonospacedFont) ? [NSFont fontWithName:SPDefaultMonospacedFontName size:[NSFont smallSystemFontSize]] : [NSFont systemFontOfSize:[NSFont smallSystemFontSize]]]; + } + + [processListTableView reloadData]; + } } #pragma mark - |