aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2009-10-12 10:25:07 +0000
committerBibiko <bibiko@eva.mpg.de>2009-10-12 10:25:07 +0000
commit29c40c62b9afa5eb3c61b8904b5213750bed558a (patch)
tree48001c67a67b1fe2d6db029b146cc50e59fa7a16 /Source
parent31ddc7c313db56bd817c95e5ea9c7310f0b21ae7 (diff)
downloadsequelpro-29c40c62b9afa5eb3c61b8904b5213750bed558a.tar.gz
sequelpro-29c40c62b9afa5eb3c61b8904b5213750bed558a.tar.bz2
sequelpro-29c40c62b9afa5eb3c61b8904b5213750bed558a.zip
• fixed truncating issue of Pref's Favorite List table view
- now favorite name/host will be truncated correctly - added tooltip for truncated favorites
Diffstat (limited to 'Source')
-rw-r--r--Source/SPFavoriteTextFieldCell.m11
-rw-r--r--Source/SPPreferenceController.h2
-rw-r--r--Source/SPPreferenceController.m17
3 files changed, 26 insertions, 4 deletions
diff --git a/Source/SPFavoriteTextFieldCell.m b/Source/SPFavoriteTextFieldCell.m
index 6011af7f..af65d28e 100644
--- a/Source/SPFavoriteTextFieldCell.m
+++ b/Source/SPFavoriteTextFieldCell.m
@@ -142,7 +142,10 @@
float maxWidth = cellFrame.size.width;
float mainStringWidth = [mainString size].width;
float subStringWidth = [subString size].width;
-
+
+ // Set a right-padding
+ maxWidth -= 10;
+
if (maxWidth < mainStringWidth) {
for (i = 0; i <= [mainString length]; i++) {
if ([[mainString attributedSubstringFromRange:NSMakeRange(0, i)] size].width >= maxWidth) {
@@ -163,6 +166,12 @@
[subString drawInRect:subFrame];
}
+// Suppress built-in tooltips
+- (NSRect)expansionFrameWithFrame:(NSRect)cellFrame inView:(NSView *)view
+{
+ return NSMakeRect(0,0,0,0);
+}
+
// -------------------------------------------------------------------------------
// invertFontColors
//
diff --git a/Source/SPPreferenceController.h b/Source/SPPreferenceController.h
index 4e4eed5a..47ad0dd8 100644
--- a/Source/SPPreferenceController.h
+++ b/Source/SPPreferenceController.h
@@ -56,6 +56,8 @@
IBOutlet NSTextField *favoriteUserTextFieldSSH;
IBOutlet NSTextField *favoriteHostTextFieldSSH;
+ IBOutlet id tableCell;
+
SPKeychain *keychain;
NSDictionary *currentFavorite;
diff --git a/Source/SPPreferenceController.m b/Source/SPPreferenceController.m
index 74ea244d..aed79610 100644
--- a/Source/SPPreferenceController.m
+++ b/Source/SPPreferenceController.m
@@ -29,6 +29,7 @@
#import "SPKeychain.h"
#import "TableDocument.h"
#import "SPConnectionController.h"
+#import "SPTooltip.h"
#define FAVORITES_PB_DRAG_TYPE @"SequelProPreferencesPasteboard"
@@ -81,8 +82,6 @@
keychain = [[SPKeychain alloc] init];
- SPFavoriteTextFieldCell *tableCell = [[[SPFavoriteTextFieldCell alloc] init] autorelease];
-
[tableCell setImage:[NSImage imageNamed:@"database"]];
// Replace column's NSTextFieldCell with custom SWProfileTextFieldCell
@@ -670,6 +669,18 @@
favoriteNameFieldWasTouched = YES;
}
+- (NSString *)tableView:(NSTableView *)aTableView toolTipForCell:(SPFavoriteTextFieldCell *)aCell rect:(NSRectPointer)rect tableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)row mouseLocation:(NSPoint)mouseLocation
+{
+ NSRect r = *rect;
+ // No tooltip if cellSize < controlSize
+ if([aCell cellSize].width < r.size.width-20) return nil;
+
+ NSPoint pos = [NSEvent mouseLocation];
+ pos.y -= 20;
+ [SPTooltip showWithObject:[NSString stringWithFormat:@"<span style='font-size:larger;'>%@</span><br><font color='darkgrey'>%@</font>", [aCell favoriteName], [aCell favoriteHost]] atLocation:pos ofType:@"html"];
+ return nil;
+}
+
#pragma mark -
#pragma mark Toolbar delegate methods
@@ -746,7 +757,7 @@
// -------------------------------------------------------------------------------
- (float)splitView:(NSSplitView *)sender constrainMinCoordinate:(float)proposedMin ofSubviewAt:(int)offset
{
- return (proposedMin + 100);
+ return (proposedMin + 94);
}
#pragma mark -