From 2dbae24c7735ead0524bd9847af6ea99d8654ec6 Mon Sep 17 00:00:00 2001 From: stuconnolly Date: Sat, 14 May 2011 17:26:18 +0000 Subject: Bring outline view branch up to date with trunk (r3279:r3306). --- Source/SPIndexesController.m | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'Source/SPIndexesController.m') 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 #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; -- cgit v1.2.3