aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPIndexesController.m
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2011-04-25 23:57:57 +0000
committerrowanbeentje <rowan@beent.je>2011-04-25 23:57:57 +0000
commit75e4e58eecf4ae1b8f25751b0bc7d457edcf57e8 (patch)
tree964b60108a9f41ba1adba08f82846911fd676ea8 /Source/SPIndexesController.m
parent25268f100c5f1b90ed5944b0123748d8a152b040 (diff)
downloadsequelpro-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/SPIndexesController.m')
-rw-r--r--Source/SPIndexesController.m8
1 files changed, 8 insertions, 0 deletions
diff --git a/Source/SPIndexesController.m b/Source/SPIndexesController.m
index 9c0c03a6..989ec02c 100644
--- a/Source/SPIndexesController.m
+++ b/Source/SPIndexesController.m
@@ -31,6 +31,7 @@
#import <MCPKit/MCPKit.h>
#import "SPDatabaseDocument.h"
#import "SPTablesList.h"
+#import "SPTableView.h"
#import "SPDatabaseViewController.h"
#import "SPTableStructure.h"
@@ -111,6 +112,9 @@ static const NSString *SPNewIndexKeyBlockSize = @"IndexKeyBlockSize";
BOOL useMonospacedFont = NO;
#endif
+ // Set the double-click action in blank areas of the table to create new rows
+ [indexesTableView setEmptyDoubleClickAction:@selector(addIndex:)];
+
for (NSTableColumn *indexColumn in [indexesTableView tableColumns])
{
[[indexColumn dataCell] setFont:(useMonospacedFont) ? [NSFont fontWithName:SPDefaultMonospacedFontName size:[NSFont smallSystemFontSize]] : [NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
@@ -134,6 +138,10 @@ static const NSString *SPNewIndexKeyBlockSize = @"IndexKeyBlockSize";
*/
- (IBAction)addIndex:(id)sender
{
+
+ // Check whether table editing is permitted (necessary as some actions - eg table double-click - bypass validation)
+ if ([dbDocument isWorking] || [tablesList tableType] != SPTableTypeTable) return;
+
// Check whether a save of the current field row is required.
if (![tableStructure saveRowOnDeselect]) return;