From dfd3414cbcfc025caa23285c7d1a8f108b09b5f1 Mon Sep 17 00:00:00 2001 From: rowanbeentje Date: Fri, 25 Jan 2013 01:18:15 +0000 Subject: - Fix connection view favourites outline view layout issues on 10.7+ following the move to the 10.6 SDK --- Source/SPFavoritesOutlineView.m | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'Source') 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; -- cgit v1.2.3