From 99ddc3164f3e7da15bf65e663a939e9d7009fcd4 Mon Sep 17 00:00:00 2001 From: stuconnolly Date: Sun, 1 Nov 2009 01:26:24 +0000 Subject: Enable the display of vertical grid lines in the table relations table view. --- Source/SPTableRelations.m | 14 ++++++++++++++ Source/TableDocument.m | 1 + 2 files changed, 15 insertions(+) diff --git a/Source/SPTableRelations.m b/Source/SPTableRelations.m index 5c51fcbc..92eebfaf 100644 --- a/Source/SPTableRelations.m +++ b/Source/SPTableRelations.m @@ -28,6 +28,7 @@ #import "TablesList.h" #import "SPTableData.h" #import "SPStringAdditions.h" +#import "SPConstants.h" @interface SPTableRelations (PrivateAPI) @@ -57,6 +58,9 @@ */ - (void)awakeFromNib { + // Set the table relation view's vertical gridlines if required + [relationsTableView setGridStyleMask:([[NSUserDefaults standardUserDefaults] boolForKey:SPDisplayTableViewVerticalGridlines]) ? NSTableViewSolidVerticalGridLineMask : NSTableViewGridNone]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(tableSelectionChanged:) name:NSTableViewSelectionDidChangeNotification @@ -310,6 +314,16 @@ } } +/** + * This method is called as part of Key Value Observing which is used to watch for prefernce changes which effect the interface. + */ +- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context +{ + if ([keyPath isEqualToString:SPDisplayTableViewVerticalGridlines]) { + [relationsTableView setGridStyleMask:([[change objectForKey:NSKeyValueChangeNewKey] boolValue]) ? NSTableViewSolidVerticalGridLineMask : NSTableViewGridNone]; + } +} + /** * Menu validation */ diff --git a/Source/TableDocument.m b/Source/TableDocument.m index 6cbccd60..83b68bd4 100644 --- a/Source/TableDocument.m +++ b/Source/TableDocument.m @@ -165,6 +165,7 @@ [prefs addObserver:tableSourceInstance forKeyPath:SPDisplayTableViewVerticalGridlines options:NSKeyValueObservingOptionNew context:NULL]; [prefs addObserver:tableContentInstance forKeyPath:SPDisplayTableViewVerticalGridlines options:NSKeyValueObservingOptionNew context:NULL]; [prefs addObserver:customQueryInstance forKeyPath:SPDisplayTableViewVerticalGridlines options:NSKeyValueObservingOptionNew context:NULL]; + [prefs addObserver:tableRelationsInstance forKeyPath:SPDisplayTableViewVerticalGridlines options:NSKeyValueObservingOptionNew context:NULL]; // Register observers for when the logging preference changes [prefs addObserver:[SPQueryController sharedQueryController] forKeyPath:SPConsoleEnableLogging options:NSKeyValueObservingOptionNew context:NULL]; -- cgit v1.2.3