aboutsummaryrefslogtreecommitdiffstats
path: root/Source/CustomQuery.m
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2009-08-18 09:54:33 +0000
committerBibiko <bibiko@eva.mpg.de>2009-08-18 09:54:33 +0000
commit59cbcc38ab2b4ec3b4a69ab4e6896a1b7c118dae (patch)
tree30079acc5775e5054aeeef69758e12fa95d59484 /Source/CustomQuery.m
parent70461b72df8b088b5a6a42b3ee99b2305e2be1d5 (diff)
downloadsequelpro-59cbcc38ab2b4ec3b4a69ab4e6896a1b7c118dae.tar.gz
sequelpro-59cbcc38ab2b4ec3b4a69ab4e6896a1b7c118dae.tar.bz2
sequelpro-59cbcc38ab2b4ec3b4a69ab4e6896a1b7c118dae.zip
• SPTooltip: added type "image"
- show images directly as a NSImage in a NSImageView (this decreases the memory usage enormously) • applied new tooltip invocation for image blob data in Content Pane and Custom Query table
Diffstat (limited to 'Source/CustomQuery.m')
-rw-r--r--Source/CustomQuery.m22
1 files changed, 10 insertions, 12 deletions
diff --git a/Source/CustomQuery.m b/Source/CustomQuery.m
index 6bdfe191..891cb38e 100644
--- a/Source/CustomQuery.m
+++ b/Source/CustomQuery.m
@@ -1695,6 +1695,9 @@
- (NSString *)tableView:(NSTableView *)aTableView toolTipForCell:(SPTextAndLinkCell *)aCell rect:(NSRectPointer)rect tableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)row mouseLocation:(NSPoint)mouseLocation
{
+
+ NSImage *image;
+
if([[aCell stringValue] length] < 1) return nil;
NSPoint pos = [NSEvent mouseLocation];
@@ -1703,22 +1706,17 @@
// Get the original data for trying to display the blob data as an image
id theValue = NSArrayObjectAtIndex(NSArrayObjectAtIndex(fullResult, row), [[aTableColumn identifier] intValue]);
if ([theValue isKindOfClass:[NSData class]]) {
- NSImage *image = [[NSImage alloc] initWithData:theValue];
+ image = [[NSImage alloc] initWithData:theValue];
if(image) {
- int imageWidth = [image size].width;
- if (imageWidth > 100) imageWidth = 100;
- [SPTooltip showWithObject:[NSString stringWithFormat:
- @"<IMG WIDTH='%d' SRC=\"data:image/auto;base64,%@\">",
- imageWidth,
- [[image TIFFRepresentationUsingCompression:NSTIFFCompressionJPEG factor:0.01] base64EncodingWithLineLength:0]]
- atLocation:pos
- ofType:@"html"
- displayOptions:[NSDictionary dictionaryWithObjectsAndKeys:@"transparent", @"transparent", nil]];
+ [SPTooltip showWithObject:image atLocation:pos ofType:@"image"];
+ [image release];
+ theValue = nil;
+ return nil;
}
- [image release];
- return nil;
}
+ if(image) [image release];
+
// Show the cell string value as tooltip (including line breaks and tabs)
if([[aCell stringValue] length] > 1)
[SPTooltip showWithObject:[aCell stringValue] atLocation:pos];