diff options
author | stuconnolly <stuart02@gmail.com> | 2011-01-27 20:38:23 +0000 |
---|---|---|
committer | stuconnolly <stuart02@gmail.com> | 2011-01-27 20:38:23 +0000 |
commit | 8db2f78294982e89fce5a162d92b2be6d9291aa1 (patch) | |
tree | b8dc7736f4af896aa3ed3fa9a96d1f3c4bfd0e59 /Source/SPTooltip.m | |
parent | fa7cff57548edc51420693e6909fe2adb3c18951 (diff) | |
parent | 7cc062247ff23496dd0390cf07b5d45d6bc49777 (diff) | |
download | sequelpro-8db2f78294982e89fce5a162d92b2be6d9291aa1.tar.gz sequelpro-8db2f78294982e89fce5a162d92b2be6d9291aa1.tar.bz2 sequelpro-8db2f78294982e89fce5a162d92b2be6d9291aa1.zip |
Bring outline view branch up to date with trunk (r3056:r3162).
Diffstat (limited to 'Source/SPTooltip.m')
-rw-r--r-- | Source/SPTooltip.m | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/Source/SPTooltip.m b/Source/SPTooltip.m index e1cccbf9..b0344d52 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)] ) { - NSRange range = NSMakeRange([fr selectedRange].location,0); + if(([fr isMemberOfClass:[NSTextView class]] && [fr alignment] == NSLeftTextAlignment) || [[[fr class] description] isEqualToString:@"SPTextView"]) { + NSRange range = NSMakeRange([fr selectedRange].location,1); 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; } } |