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/SPTableStructure.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/SPTableStructure.m')
-rw-r--r-- | Source/SPTableStructure.m | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Source/SPTableStructure.m b/Source/SPTableStructure.m index 1af8bc62..ebbb9f7e 100644 --- a/Source/SPTableStructure.m +++ b/Source/SPTableStructure.m @@ -29,6 +29,7 @@ #import "SPTableInfo.h" #import "SPTablesList.h" #import "SPTableData.h" +#import "SPTableView.h" #import "SPDatabaseData.h" #import "SPSQLParser.h" #import "SPAlertSheets.h" @@ -83,6 +84,10 @@ // Set the structure and index view's vertical gridlines if required [tableSourceView setGridStyleMask:([prefs boolForKey:SPDisplayTableViewVerticalGridlines]) ? NSTableViewSolidVerticalGridLineMask : NSTableViewGridNone]; #endif + + // Set the double-click action in blank areas of the table to create new rows + [tableSourceView setEmptyDoubleClickAction:@selector(addField:)]; + #ifndef SP_REFACTOR /* set font from prefs */ // Set the strutcture and index view's font [tableSourceView setFont:([prefs boolForKey:SPUseMonospacedFonts]) ? [NSFont fontWithName:SPDefaultMonospacedFontName size:[NSFont smallSystemFontSize]] : [NSFont systemFontOfSize:[NSFont smallSystemFontSize]]]; @@ -474,6 +479,10 @@ */ - (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; + // Check whether a save of the current row is required. if ( ![self saveRowOnDeselect] ) return; |