diff options
author | stuconnolly <stuart02@gmail.com> | 2012-08-14 10:30:24 +0000 |
---|---|---|
committer | stuconnolly <stuart02@gmail.com> | 2012-08-14 10:30:24 +0000 |
commit | bd475802f1cea9690bad0a46459fdf8120b51df4 (patch) | |
tree | 70bf7745c0654f2f575d1336b5ed517b5605bb50 | |
parent | f342cbb6c42aa92b4f2224c1158ad242475bdcb9 (diff) | |
download | sequelpro-bd475802f1cea9690bad0a46459fdf8120b51df4.tar.gz sequelpro-bd475802f1cea9690bad0a46459fdf8120b51df4.tar.bz2 sequelpro-bd475802f1cea9690bad0a46459fdf8120b51df4.zip |
Filter window should observe use table view gridlines preference.
-rw-r--r-- | Source/SPTableContent.m | 33 | ||||
-rw-r--r-- | Source/SPTableStructure.m | 1 |
2 files changed, 23 insertions, 11 deletions
diff --git a/Source/SPTableContent.m b/Source/SPTableContent.m index efb7e771..e7f9a5be 100644 --- a/Source/SPTableContent.m +++ b/Source/SPTableContent.m @@ -96,6 +96,8 @@ @synthesize tablesListInstance; #endif +#pragma mark - + /** * Standard init method. Initialize various ivars. */ @@ -207,18 +209,22 @@ #ifndef SP_REFACTOR /* ui manipulation */ // Set the table content view's vertical gridlines if required [tableContentView setGridStyleMask:([prefs boolForKey:SPDisplayTableViewVerticalGridlines]) ? NSTableViewSolidVerticalGridLineMask : NSTableViewGridNone]; - + [filterTableView setGridStyleMask:([prefs boolForKey:SPDisplayTableViewVerticalGridlines]) ? NSTableViewSolidVerticalGridLineMask : NSTableViewGridNone]; + // Set the double-click action in blank areas of the table to create new rows [tableContentView setEmptyDoubleClickAction:@selector(addRow:)]; // Load the pagination view, keeping references to the top-level objects for later release NSArray *paginationViewTopLevelObjects = nil; NSNib *nibLoader = [[NSNib alloc] initWithNibNamed:@"ContentPaginationView" bundle:[NSBundle mainBundle]]; + if (![nibLoader instantiateNibWithOwner:self topLevelObjects:&paginationViewTopLevelObjects]) { NSLog(@"Content pagination nib could not be loaded; pagination will not function correctly."); - } else { + } + else { [nibObjectsToRelease addObjectsFromArray:paginationViewTopLevelObjects]; } + [nibLoader release]; // Add the pagination view to the content area @@ -3001,10 +3007,12 @@ [tableContentView selectRowIndexes:[NSIndexSet indexSetWithIndex:currentlyEditingRow] byExtendingSelection:NO]; [tableContentView performSelector:@selector(keyDown:) withObject:[NSEvent keyEventWithType:NSKeyDown location:NSMakePoint(0,0) modifierFlags:0 timestamp:0 windowNumber:[[tableContentView window] windowNumber] context:[NSGraphicsContext currentContext] characters:nil charactersIgnoringModifiers:nil isARepeat:NO keyCode:0x24] afterDelay:0.0]; - // Discard changes selected - } else { + } + else { + // Discard changes selected [self cancelRowEditing]; } + [tableContentView reloadData]; } @@ -3023,9 +3031,11 @@ // Save any edits which have been made but not saved to the table yet; // but not for any NSSearchFields which could cause a crash for undo, redo. - if([[[tableContentView window] firstResponder] respondsToSelector:@selector(delegate)] - && ![[(id)[[tableContentView window] firstResponder] delegate] isKindOfClass:[NSSearchField class]]) + if ([[[tableContentView window] firstResponder] respondsToSelector:@selector(delegate)] && + ![[(id)[[tableContentView window] firstResponder] delegate] isKindOfClass:[NSSearchField class]]) { + [[tableContentView window] endEditingFor:nil]; + } // If no rows are currently being edited, or a save is in progress, return success at once. if (!isEditingRow || isSavingRow) return YES; @@ -3051,7 +3061,6 @@ */ - (BOOL)cancelRowEditing { - [[tableContentView window] makeFirstResponder:tableContentView]; if (!isEditingRow) return NO; @@ -4172,7 +4181,7 @@ } #pragma mark - -#pragma mark Other methods +#pragma mark KVO methods /** * This method is called as part of Key Value Observing which is used to watch for prefernce changes which effect the interface. @@ -4182,18 +4191,22 @@ #ifndef SP_REFACTOR /* observe pref changes */ // Display table veiew vertical gridlines preference changed if ([keyPath isEqualToString:SPDisplayTableViewVerticalGridlines]) { - [tableContentView setGridStyleMask:([[change objectForKey:NSKeyValueChangeNewKey] boolValue]) ? NSTableViewSolidVerticalGridLineMask : NSTableViewGridNone]; + [tableContentView setGridStyleMask:([[change objectForKey:NSKeyValueChangeNewKey] boolValue]) ? NSTableViewSolidVerticalGridLineMask : NSTableViewGridNone]; + [filterTableView setGridStyleMask:([[change objectForKey:NSKeyValueChangeNewKey] boolValue]) ? NSTableViewSolidVerticalGridLineMask : NSTableViewGridNone]; } // Table font preference changed else if ([keyPath isEqualToString:SPGlobalResultTableFont]) { NSFont *tableFont = [NSUnarchiver unarchiveObjectWithData:[change objectForKey:NSKeyValueChangeNewKey]]; - [tableContentView setRowHeight:2.0f+NSSizeToCGSize([[NSString stringWithString:@"{ǞṶḹÜ∑zgyf"] sizeWithAttributes:[NSDictionary dictionaryWithObject:tableFont forKey:NSFontAttributeName]]).height]; + [tableContentView setRowHeight:2.0f + NSSizeToCGSize([[NSString stringWithString:@"{ǞṶḹÜ∑zgyf"] sizeWithAttributes:[NSDictionary dictionaryWithObject:tableFont forKey:NSFontAttributeName]]).height]; [tableContentView setFont:tableFont]; [tableContentView reloadData]; } #endif } +#pragma mark - +#pragma mark Other methods + /** * Menu validation */ diff --git a/Source/SPTableStructure.m b/Source/SPTableStructure.m index deaa4107..baf2a6f4 100644 --- a/Source/SPTableStructure.m +++ b/Source/SPTableStructure.m @@ -241,7 +241,6 @@ */ - (IBAction)addField:(id)sender { - // Check whether table editing is permitted (necessary as some actions - eg table double-click - bypass validation) if ([tableDocumentInstance isWorking] || [tablesListInstance tableType] != SPTableTypeTable) return; |