aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2009-10-27 02:10:26 +0000
committerrowanbeentje <rowan@beent.je>2009-10-27 02:10:26 +0000
commitf90186c282f37878f9c80b41a478bcde4af74502 (patch)
tree66851f80f1c74ca5f9668f35ae2487e336b8dc8a /Source
parenta99b0940d264ffbc4c525c5f17049f64e391ccc3 (diff)
downloadsequelpro-f90186c282f37878f9c80b41a478bcde4af74502.tar.gz
sequelpro-f90186c282f37878f9c80b41a478bcde4af74502.tar.bz2
sequelpro-f90186c282f37878f9c80b41a478bcde4af74502.zip
- When performing threaded data loads, no longer disable the tables and instead prevent selection/editing/sorting in code; this prevents the tableviews from going grey during the load and minimises flicker and loss of focussed elements.
Diffstat (limited to 'Source')
-rw-r--r--Source/CustomQuery.m17
-rw-r--r--Source/SPTableView.m6
-rw-r--r--Source/TableContent.m17
-rw-r--r--Source/TableDocument.m2
-rw-r--r--Source/TablesList.m18
5 files changed, 49 insertions, 11 deletions
diff --git a/Source/CustomQuery.m b/Source/CustomQuery.m
index 2df3227e..00201015 100644
--- a/Source/CustomQuery.m
+++ b/Source/CustomQuery.m
@@ -1442,6 +1442,9 @@
- (void)tableView:(NSTableView*)tableView didClickTableColumn:(NSTableColumn *)tableColumn
{
+ // Prevent sorting while a query is running
+ if ([tableDocumentInstance isWorking]) return;
+
NSMutableString *queryString = [NSMutableString stringWithString:lastExecutedQuery];
//sets order descending if a header is clicked twice
@@ -1671,6 +1674,9 @@
- (BOOL)tableView:(NSTableView *)aTableView shouldEditTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex
{
+ // Only allow editing if a task is not active
+ if ([tableDocumentInstance isWorking]) return NO;
+
// Check if the field can identified bijectively
if ( aTableView == customQueryView ) {
@@ -1760,6 +1766,14 @@
}
}
+/**
+ * Prevent the selection of rows while the table is still loading
+ */
+- (BOOL)tableView:(NSTableView *)aTableView shouldSelectRow:(NSInteger)rowIndex
+{
+ return ![tableDocumentInstance isWorking];
+}
+
#pragma mark -
#pragma mark TableView notifications
@@ -2554,7 +2568,6 @@
|| ![[[aNotification object] selectedToolbarItemIdentifier] isEqualToString:@"SwitchToRunQueryToolbarItemIdentifier"])
return;
- [customQueryView setEnabled:NO];
[runSelectionButton setEnabled:NO];
[runSelectionMenuItem setEnabled:NO];
[runAllButton setEnabled:NO];
@@ -2579,8 +2592,6 @@
}
[runAllButton setEnabled:YES];
[runAllMenuItem setEnabled:YES];
- [customQueryView setEnabled:YES];
- [customQueryView displayIfNeeded];
}
#pragma mark -
diff --git a/Source/SPTableView.m b/Source/SPTableView.m
index 6e9ccd65..a2e0c713 100644
--- a/Source/SPTableView.m
+++ b/Source/SPTableView.m
@@ -76,6 +76,12 @@
{
if (![[[[self delegate] class] description] isEqualToString:@"CustomQuery"] &&
![[[[self delegate] class] description] isEqualToString:@"SPQueryFavoriteManager"]){
+
+ // Ensure that editing is permitted
+ if (![[self delegate] tableView:self shouldEditTableColumn:[[self tableColumns] objectAtIndex:0] row:[self selectedRow]])
+ return;
+
+ // Trigger a cell edit
[self editColumn:0 row:[self selectedRow] withEvent:nil select:YES];
return;
}
diff --git a/Source/TableContent.m b/Source/TableContent.m
index 156b46ab..b8626866 100644
--- a/Source/TableContent.m
+++ b/Source/TableContent.m
@@ -2426,12 +2426,15 @@
if clicked twice, order is descending
*/
{
-
+
if ( [selectedTable isEqualToString:@""] || !selectedTable )
return;
// Check whether a save of the current row is required.
if ( ![self saveRowOnDeselect] ) return;
+
+ // Prevent sorting while the table is still loading
+ if ([tableDocumentInstance isWorking]) return;
//sets order descending if a header is clicked twice
if ( [[tableColumn identifier] isEqualTo:sortCol] ) {
@@ -2531,6 +2534,7 @@
*/
- (BOOL)tableView:(NSTableView *)aTableView shouldEditTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex
{
+ if ([tableDocumentInstance isWorking]) return NO;
// Ensure that row is editable since it could contain "(not loaded)" columns together with
// issue that the table has no primary key
@@ -2630,6 +2634,14 @@
return NO;
}
+/**
+ * Disable row selection while the document is working.
+ */
+- (BOOL)tableView:(NSTableView *)aTableView shouldSelectRow:(NSInteger)rowIndex
+{
+ return ![tableDocumentInstance isWorking];
+}
+
#pragma mark -
#pragma mark SplitView delegate methods
@@ -2663,7 +2675,6 @@
|| ![[[aNotification object] selectedToolbarItemIdentifier] isEqualToString:@"SwitchToTableContentToolbarItemIdentifier"])
return;
- [tableContentView setEnabled:NO];
[addButton setEnabled:NO];
[removeButton setEnabled:NO];
[copyButton setEnabled:NO];
@@ -2690,8 +2701,6 @@
}
[reloadButton setEnabled:YES];
[filterButton setEnabled:[fieldField isEnabled]];
- [tableContentView setEnabled:YES];
- [tableContentView displayIfNeeded];
}
#pragma mark -
diff --git a/Source/TableDocument.m b/Source/TableDocument.m
index 40428e53..21e12919 100644
--- a/Source/TableDocument.m
+++ b/Source/TableDocument.m
@@ -1130,7 +1130,6 @@
// Set flags and prevent further UI interaction in this window
_isWorking = YES;
- [dbTablesTableView setEnabled:NO];
[historyControl setEnabled:NO];
[[NSNotificationCenter defaultCenter] postNotificationName:SPDocumentTaskStartNotification object:self];
@@ -1207,7 +1206,6 @@
// Re-enable window interface
_isWorking = NO;
- [dbTablesTableView setEnabled:YES];
[historyControl setEnabled:YES];
[[NSNotificationCenter defaultCenter] postNotificationName:SPDocumentTaskEndNotification object:self];
}
diff --git a/Source/TablesList.m b/Source/TablesList.m
index 5be863fd..bb5f80ec 100644
--- a/Source/TablesList.m
+++ b/Source/TablesList.m
@@ -1114,6 +1114,14 @@
}
/**
+ * Prevent table renames while tasks are active
+ */
+- (BOOL)tableView:(NSTableView *)aTableView shouldEditTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex
+{
+ return ![tableDocumentInstance isWorking];
+}
+
+/**
* Renames a table (in tables-array and mysql-db).
*/
- (void)tableView:(NSTableView *)aTableView setObjectValue:(id)anObject forTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex
@@ -1261,6 +1269,10 @@
*/
- (BOOL)selectionShouldChangeInTableView:(NSTableView *)aTableView
{
+
+ // Don't allow selection changes while performing a task
+ if ([tableDocumentInstance isWorking]) return NO;
+
// End editing (otherwise problems when user hits reload button)
[tableWindow endEditingFor:nil];
@@ -1302,6 +1314,10 @@
*/
- (BOOL)tableView:(NSTableView *)aTableView shouldSelectRow:(int)rowIndex
{
+
+ // Disallow selection while the document is working on a task
+ if ([tableDocumentInstance isWorking]) return NO;
+
//return (rowIndex != 0);
if( [filteredTableTypes count] == 0 )
return (rowIndex != 0 );
@@ -1545,7 +1561,6 @@
// Only proceed if the notification was received from the current document.
if ([aNotification object] != tableDocumentInstance) return;
- [tablesListView setEnabled:NO];
[toolbarAddButton setEnabled:NO];
[toolbarActionsButton setEnabled:NO];
[toolbarReloadButton setEnabled:NO];
@@ -1558,7 +1573,6 @@
{
if ([aNotification object] != tableDocumentInstance) return;
- [tablesListView setEnabled:YES];
[toolbarAddButton setEnabled:YES];
[toolbarActionsButton setEnabled:YES];
[toolbarReloadButton setEnabled:YES];