aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPTooltip.m
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2011-01-05 18:49:19 +0000
committerBibiko <bibiko@eva.mpg.de>2011-01-05 18:49:19 +0000
commita6bff16b6f7e65cf74376e92d8d60d4572a20e3c (patch)
tree52515725dfd045416822e58b7a797535945c8618 /Source/SPTooltip.m
parentd9874d3a3188897a9e898ca5cb3aa3c94e2d765a (diff)
downloadsequelpro-a6bff16b6f7e65cf74376e92d8d60d4572a20e3c.tar.gz
sequelpro-a6bff16b6f7e65cf74376e92d8d60d4572a20e3c.tar.bz2
sequelpro-a6bff16b6f7e65cf74376e92d8d60d4572a20e3c.zip
• improved Default Bundle management for installation, updating, undeletion
• if current NSTextView is not set to NSLeftTextAlignment show a SPTooltip at mouse location until we found a way the calculate the caret position correctly since [NSLayoutManager glyphRangeForCharacterRange:] returns a wrong NSRect
Diffstat (limited to 'Source/SPTooltip.m')
-rw-r--r--Source/SPTooltip.m12
1 files changed, 4 insertions, 8 deletions
diff --git a/Source/SPTooltip.m b/Source/SPTooltip.m
index e1cccbf9..09929fc2 100644
--- a/Source/SPTooltip.m
+++ b/Source/SPTooltip.m
@@ -257,24 +257,20 @@ static CGFloat slow_in_out (CGFloat t)
id fr = [[NSApp keyWindow] firstResponder];
//If first responder is a textview return the caret position
- if([fr respondsToSelector:@selector(getRangeForCurrentWord)] ) {
+ if([fr respondsToSelector:@selector(getRangeForCurrentWord)] && [fr alignment] == NSLeftTextAlignment) {
NSRange range = NSMakeRange([fr selectedRange].location,0);
NSRange glyphRange = [[fr layoutManager] glyphRangeForCharacterRange:range actualCharacterRange:NULL];
NSRect boundingRect = [[fr layoutManager] boundingRectForGlyphRange:glyphRange inTextContainer:[fr textContainer]];
- boundingRect = [fr convertRect: boundingRect toView: NULL];
+ boundingRect = [fr convertRect: boundingRect toView:NULL];
pos = [[fr window] convertBaseToScreen: NSMakePoint(boundingRect.origin.x + boundingRect.size.width,boundingRect.origin.y + boundingRect.size.height)];
NSFont* font = [fr font];
- pos.y -= [font pointSize]*1.3;
+ if(font) pos.y -= [font pointSize]*1.3;
return pos;
- // Otherwise return the upper left corner of the current keyWindow
+ // Otherwise return mouse location
} else {
pos = [NSEvent mouseLocation];
pos.y -= 16;
return pos;
- // pos = [[NSApp keyWindow] frame].origin;
- // pos.x += 5;
- // pos.y += [[NSApp keyWindow] frame].size.height - 23;
- // return pos;
}
}