aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPFavoritesOutlineView.m
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2013-01-25 01:18:15 +0000
committerrowanbeentje <rowan@beent.je>2013-01-25 01:18:15 +0000
commitdfd3414cbcfc025caa23285c7d1a8f108b09b5f1 (patch)
tree81fb358fd64d2a15902c539349c3735d833d2ce7 /Source/SPFavoritesOutlineView.m
parent8f00c5e94947e7ec7c7a9d6a00e20fc9b180cb6a (diff)
downloadsequelpro-dfd3414cbcfc025caa23285c7d1a8f108b09b5f1.tar.gz
sequelpro-dfd3414cbcfc025caa23285c7d1a8f108b09b5f1.tar.bz2
sequelpro-dfd3414cbcfc025caa23285c7d1a8f108b09b5f1.zip
- Fix connection view favourites outline view layout issues on 10.7+ following the move to the 10.6 SDK
Diffstat (limited to 'Source/SPFavoritesOutlineView.m')
-rw-r--r--Source/SPFavoritesOutlineView.m22
1 files changed, 15 insertions, 7 deletions
diff --git a/Source/SPFavoritesOutlineView.m b/Source/SPFavoritesOutlineView.m
index 3688f769..f4fc3a7a 100644
--- a/Source/SPFavoritesOutlineView.m
+++ b/Source/SPFavoritesOutlineView.m
@@ -33,7 +33,7 @@
#import "SPFavoritesOutlineView.h"
#import "SPConnectionControllerDelegate.h"
-static NSUInteger SPFavoritesOutlineViewUnindent = 14;
+static NSUInteger SPFavoritesOutlineViewUnindent = 6;
@implementation SPFavoritesOutlineView
@@ -98,8 +98,9 @@ static NSUInteger SPFavoritesOutlineViewUnindent = 14;
}
/**
- * Don't reserve a gap for the disclosure triangles for top-level items. This involves reducing the
- * padding - and increasing the width - of all rows to compensate.
+ * Disclosure triangles for the top-level items hae been removed, and similarly other
+ * paddings need altering. This involves increasing the padding - and reducing the width -
+ * of all rows to compensate.
*/
- (NSRect)frameOfCellAtColumn:(NSInteger)columnIndex row:(NSInteger)rowIndex
{
@@ -110,11 +111,18 @@ static NSUInteger SPFavoritesOutlineViewUnindent = 14;
return superFrame;
}
- return NSMakeRect(superFrame.origin.x - SPFavoritesOutlineViewUnindent, superFrame.origin.y, superFrame.size.width + SPFavoritesOutlineViewUnindent, superFrame.size.height);
+ // Don't alter padding for the top-level items
+ if ([[self delegate] respondsToSelector:@selector(outlineView:isGroupItem:)]) {
+ if ([[self delegate] outlineView:self isGroupItem:[self itemAtRow:rowIndex]]) {
+ return superFrame;
+ }
+ }
+
+ return NSMakeRect(superFrame.origin.x + SPFavoritesOutlineViewUnindent, superFrame.origin.y, superFrame.size.width - SPFavoritesOutlineViewUnindent, superFrame.size.height);
}
/**
- * As no gap is reserved for the disclosure triangles at the top level, the frames for other
+ * Disclosure triangles for the top-level items have been removed, the frames for other
* disclosure items need to be similarly moved.
*/
- (NSRect)frameOfOutlineCellAtRow:(NSInteger)rowIndex
@@ -129,8 +137,8 @@ static NSUInteger SPFavoritesOutlineViewUnindent = 14;
}
// On versions of Lion or above, amend the padding appropriately
- if (systemVersion >= 0x1070 && superFrame.origin.x > SPFavoritesOutlineViewUnindent) {
- return NSMakeRect(superFrame.origin.x - SPFavoritesOutlineViewUnindent, superFrame.origin.y, superFrame.size.width, superFrame.size.height);
+ if (systemVersion >= 0x1070) {
+ return NSMakeRect(superFrame.origin.x + SPFavoritesOutlineViewUnindent, superFrame.origin.y, superFrame.size.width, superFrame.size.height);
}
return superFrame;