aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPTableContent.m
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2010-08-27 10:56:07 +0000
committerBibiko <bibiko@eva.mpg.de>2010-08-27 10:56:07 +0000
commitd0bc1e5c852eb5ccaf99d48d7c6fad82ece2bdf1 (patch)
tree8558bf14d2aef96b9f5fac1eb41e64e157538de7 /Source/SPTableContent.m
parent71d55a599ac4c19f88de9fede09d138bfc24b1b5 (diff)
downloadsequelpro-d0bc1e5c852eb5ccaf99d48d7c6fad82ece2bdf1.tar.gz
sequelpro-d0bc1e5c852eb5ccaf99d48d7c6fad82ece2bdf1.tar.bz2
sequelpro-d0bc1e5c852eb5ccaf99d48d7c6fad82ece2bdf1.zip
• further improvements for in cell editing in CustomQuery tables
- simplified code - reduced number of queries for edit status - WHERE argument to identify first try to avoid using blob data for speed, if field is not identified with ignoring blob data then use blob data as well • for TableContent fixed tooltip display - note: improvements as for CustomQuery follow soon
Diffstat (limited to 'Source/SPTableContent.m')
-rw-r--r--Source/SPTableContent.m33
1 files changed, 15 insertions, 18 deletions
diff --git a/Source/SPTableContent.m b/Source/SPTableContent.m
index ffa9d8fb..b95abf48 100644
--- a/Source/SPTableContent.m
+++ b/Source/SPTableContent.m
@@ -3462,47 +3462,42 @@
// If a data come from a view check if the clicked table field is editable
if([tablesListInstance tableType] == SPTableTypeView) {
+ // Show tooltips only here if edit request came from mouse event
+ BOOL requestCameFromMouse = ([[NSApp currentEvent] type] == NSKeyDown) ? NO : YES;
+
NSInteger numberOfPossibleUpdateRows = [self fieldEditStatusForRow:rowIndex andColumn:[aTableColumn identifier]];
isFieldEditable = (numberOfPossibleUpdateRows == 1) ? YES : NO;
NSPoint pos = [NSEvent mouseLocation];
pos.y -= 20;
switch(numberOfPossibleUpdateRows) {
case -1:
- [SPTooltip showWithObject:kCellEditorErrorNoMultiTabDb
+ if(requestCameFromMouse)
+ [SPTooltip showWithObject:kCellEditorErrorNoMultiTabDb
atLocation:pos
ofType:@"text"];
isFieldEditable = NO;
- // Allow to display blobs even it's not editable
- if(!isBlob && [multipleLineEditingButton state] == NSOffState)
- return NO;
break;
case 0:
- [SPTooltip showWithObject:[NSString stringWithFormat:kCellEditorErrorNoMatch, selectedTable]
+ if(requestCameFromMouse)
+ [SPTooltip showWithObject:[NSString stringWithFormat:kCellEditorErrorNoMatch, selectedTable]
atLocation:pos
ofType:@"text"];
isFieldEditable = NO;
- // Allow to display blobs even it's not editable
- if(!isBlob && [multipleLineEditingButton state] == NSOffState)
- return NO;
break;
case 1:
isFieldEditable = YES;
- if(!isBlob && [multipleLineEditingButton state] == NSOffState)
- return YES;
break;
default:
- [SPTooltip showWithObject:[NSString stringWithFormat:kCellEditorErrorTooManyMatches, (long)numberOfPossibleUpdateRows, (numberOfPossibleUpdateRows>1)?NSLocalizedString(@"es", @"Plural suffix for row count, eg 4 match*es*"):@""]
+ if(requestCameFromMouse)
+ [SPTooltip showWithObject:[NSString stringWithFormat:kCellEditorErrorTooManyMatches, (long)numberOfPossibleUpdateRows, (numberOfPossibleUpdateRows>1)?NSLocalizedString(@"es", @"Plural suffix for row count, eg 4 match*es*"):@""]
atLocation:pos
ofType:@"text"];
isFieldEditable = NO;
- // Allow to display blobs even it's not editable
- if(!isBlob && [multipleLineEditingButton state] == NSOffState)
- return NO;
}
@@ -3720,6 +3715,7 @@
{
NSUInteger row, column;
+ BOOL shouldBeginEditing = YES;
row = [tableContentView editedRow];
column = [tableContentView editedColumn];
@@ -3736,25 +3732,26 @@
[SPTooltip showWithObject:kCellEditorErrorNoMultiTabDb
atLocation:pos
ofType:@"text"];
+ shouldBeginEditing = NO;
break;
case 0:
[SPTooltip showWithObject:[NSString stringWithFormat:kCellEditorErrorNoMatch, selectedTable]
atLocation:pos
ofType:@"text"];
+ shouldBeginEditing = NO;
break;
case 1:
- return YES;
+ shouldBeginEditing = YES;
break;
default:
[SPTooltip showWithObject:[NSString stringWithFormat:kCellEditorErrorTooManyMatches, (long)numberOfPossibleUpdateRows, (numberOfPossibleUpdateRows>1)?NSLocalizedString(@"es", @"Plural suffix for row count, eg 4 match*es*"):@""]
atLocation:pos
ofType:@"text"];
+ shouldBeginEditing = NO;
}
- return NO;
-
}
NSString *fieldType;
@@ -3776,7 +3773,7 @@
}
- return YES;
+ return shouldBeginEditing;
}