diff options
Diffstat (limited to 'Source')
-rw-r--r-- | Source/SPTableRelations.m | 14 | ||||
-rw-r--r-- | Source/TableDocument.m | 1 |
2 files changed, 15 insertions, 0 deletions
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 @@ -311,6 +315,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 */ - (BOOL)validateMenuItem:(NSMenuItem *)menuItem 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]; |