diff options
author | rowanbeentje <rowan@beent.je> | 2011-04-25 23:57:57 +0000 |
---|---|---|
committer | rowanbeentje <rowan@beent.je> | 2011-04-25 23:57:57 +0000 |
commit | 75e4e58eecf4ae1b8f25751b0bc7d457edcf57e8 (patch) | |
tree | 964b60108a9f41ba1adba08f82846911fd676ea8 /Source/SPTableContent.m | |
parent | 25268f100c5f1b90ed5944b0123748d8a152b040 (diff) | |
download | sequelpro-75e4e58eecf4ae1b8f25751b0bc7d457edcf57e8.tar.gz sequelpro-75e4e58eecf4ae1b8f25751b0bc7d457edcf57e8.tar.bz2 sequelpro-75e4e58eecf4ae1b8f25751b0bc7d457edcf57e8.zip |
- Add the ability to double-click in empty areas of the main tableviews to add new rows/records
Diffstat (limited to 'Source/SPTableContent.m')
-rw-r--r-- | Source/SPTableContent.m | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Source/SPTableContent.m b/Source/SPTableContent.m index c9b8c145..ddc58670 100644 --- a/Source/SPTableContent.m +++ b/Source/SPTableContent.m @@ -163,6 +163,9 @@ [tableContentView setGridStyleMask:([prefs boolForKey:SPDisplayTableViewVerticalGridlines]) ? NSTableViewSolidVerticalGridLineMask : NSTableViewGridNone]; #endif + // 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]]; @@ -1655,6 +1658,9 @@ NSMutableArray *newRow = [NSMutableArray array]; NSUInteger i; + // Check whether table editing is permitted (necessary as some actions - eg table double-click - bypass validation) + if ([tableDocumentInstance isWorking] || [tablesListInstance tableType] != SPTableTypeTable) return; + // Check whether a save of the current row is required. if ( ![self saveRowOnDeselect] ) return; |