aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPTableContent.m
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2010-10-08 12:31:32 +0000
committerBibiko <bibiko@eva.mpg.de>2010-10-08 12:31:32 +0000
commit271b47b558c0fdbf23c68d29163185127ac5d4f3 (patch)
treebf937b5c6990ddc8a4f50fd19267408210846d2e /Source/SPTableContent.m
parent73dca377472fe466ac5b2b2d0ba13ae109863f59 (diff)
downloadsequelpro-271b47b558c0fdbf23c68d29163185127ac5d4f3.tar.gz
sequelpro-271b47b558c0fdbf23c68d29163185127ac5d4f3.tar.bz2
sequelpro-271b47b558c0fdbf23c68d29163185127ac5d4f3.zip
• improved issues for tooltip in Content and Custom tables
- added not yet supported MCPGeometryData view - removed @try clauses, instead make usage of pthread_mutex_lock etc. approach • adjusted autodetectWidthForColumnDefinition: for SPCopyTable to calculate the width by taking the WKT string of MCPGeometryData • added SPGeometryDataView class which will be used for displaying GEOMETRY data as image (for tooltips, inside field editor sheet) [not yet implemented]
Diffstat (limited to 'Source/SPTableContent.m')
-rw-r--r--Source/SPTableContent.m31
1 files changed, 21 insertions, 10 deletions
diff --git a/Source/SPTableContent.m b/Source/SPTableContent.m
index a69ad5e2..50ce0617 100644
--- a/Source/SPTableContent.m
+++ b/Source/SPTableContent.m
@@ -3321,18 +3321,26 @@
NSPoint pos = [NSEvent mouseLocation];
pos.y -= 20;
- // Try to get the original data. If not possible return nil.
- // @try clause is used due to the multifarious cases of
- // possible exceptions (eg for reloading tables etc.)
- id theValue;
- @try{
- theValue = [tableValues cellDataAtRow:row column:[[aTableColumn identifier] integerValue]];
- }
- @catch(id ae) {
- return nil;
+ id theValue = nil;
+
+ // While the table is being loaded, additional validation is required - data
+ // locks must be used to avoid crashes, and indexes higher than the available
+ // rows or columns may be requested. Return "..." to indicate loading in these
+ // cases.
+ if (isWorking) {
+ pthread_mutex_lock(&tableValuesLock);
+ if (row < tableRowsCount && [[aTableColumn identifier] integerValue] < [tableValues columnCount]) {
+ theValue = [[SPDataStorageObjectAtRowAndColumn(tableValues, row, [[aTableColumn identifier] integerValue]) copy] autorelease];
+ }
+ pthread_mutex_unlock(&tableValuesLock);
+
+ if (!theValue) theValue = @"...";
+ } else {
+ theValue = SPDataStorageObjectAtRowAndColumn(tableValues, row, [[aTableColumn identifier] integerValue]);
}
- // Get the original data for trying to display the blob data as an image
+ if(theValue == nil) return nil;
+
if ([theValue isKindOfClass:[NSData class]]) {
image = [[[NSImage alloc] initWithData:theValue] autorelease];
if(image) {
@@ -3340,6 +3348,9 @@
return nil;
}
}
+ else if ([theValue isKindOfClass:[MCPGeometryData class]]) {
+ ; // TODO
+ }
// Show the cell string value as tooltip (including line breaks and tabs)
// by using the cell's font