aboutsummaryrefslogtreecommitdiffstats
path: root/Source/TableSource.m
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2009-05-19 19:57:34 +0000
committerstuconnolly <stuart02@gmail.com>2009-05-19 19:57:34 +0000
commitdad2c2af5af18890fa927d171f1ff58530a1a810 (patch)
tree3ec05044742bdad1a6e963fe19b2d5057e5fdafe /Source/TableSource.m
parent641eeff363a2864456a985b246576bfd5d41b144 (diff)
downloadsequelpro-dad2c2af5af18890fa927d171f1ff58530a1a810.tar.gz
sequelpro-dad2c2af5af18890fa927d171f1ff58530a1a810.tar.bz2
sequelpro-dad2c2af5af18890fa927d171f1ff58530a1a810.zip
New preference to allow the displaying of vertical grid lines in table views.
Diffstat (limited to 'Source/TableSource.m')
-rw-r--r--Source/TableSource.m40
1 files changed, 28 insertions, 12 deletions
diff --git a/Source/TableSource.m b/Source/TableSource.m
index 8267afb5..7ac9212e 100644
--- a/Source/TableSource.m
+++ b/Source/TableSource.m
@@ -508,8 +508,6 @@ sets the connection (received from TableDocument) and makes things that have to
mySQLConnection = theConnection;
- prefs = [[NSUserDefaults standardUserDefaults] retain];
-
//set up tableView
[tableSourceView registerForDraggedTypes:[NSArray arrayWithObjects:@"SequelProPasteboard", nil]];
@@ -816,6 +814,16 @@ fetches the result as an array with a dictionary for each row in it
}
}
+/**
+ * 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:@"DisplayTableViewVerticalGridlines"]) {
+ [tableSourceView setGridStyleMask:([[change objectForKey:NSKeyValueChangeNewKey] boolValue]) ? NSTableViewSolidVerticalGridLineMask : NSTableViewGridNone];
+ [indexView setGridStyleMask:([[change objectForKey:NSKeyValueChangeNewKey] boolValue]) ? NSTableViewSolidVerticalGridLineMask : NSTableViewGridNone];
+ }
+}
#pragma mark Getter methods
@@ -1194,28 +1202,36 @@ traps enter and esc and make/cancel editing without entering next row
return [structureGrabber convertRect:[structureGrabber bounds] toView:splitView];
}
-//last but not least
+// Last but not least
- (id)init
{
- self = [super init];
-
- tableFields = [[NSMutableArray alloc] init];
- indexes = [[NSMutableArray alloc] init];
- oldRow = [[NSMutableDictionary alloc] init];
- enumFields = [[NSMutableDictionary alloc] init];
-
- currentlyEditingRow = -1;
+ if ((self = [super init])) {
+ tableFields = [[NSMutableArray alloc] init];
+ indexes = [[NSMutableArray alloc] init];
+ oldRow = [[NSMutableDictionary alloc] init];
+ enumFields = [[NSMutableDictionary alloc] init];
+
+ currentlyEditingRow = -1;
+
+ prefs = [NSUserDefaults standardUserDefaults];
+ }
return self;
}
+- (void)awakeFromNib
+{
+ // Set the structure and index view's vertical gridlines if required
+ [tableSourceView setGridStyleMask:([prefs boolForKey:@"DisplayTableViewVerticalGridlines"]) ? NSTableViewSolidVerticalGridLineMask : NSTableViewGridNone];
+ [indexView setGridStyleMask:([prefs boolForKey:@"DisplayTableViewVerticalGridlines"]) ? NSTableViewSolidVerticalGridLineMask : NSTableViewGridNone];
+}
+
- (void)dealloc
{
[tableFields release];
[indexes release];
[oldRow release];
[defaultValues release];
- [prefs release];
[enumFields release];
[super dealloc];