Commits

Anonymous committed f164b18

Split view - Fixed issue where min / max sizes were ignored when Anchored Button Bar was present

Comments (0)

Files changed (1)

 //
 
 #import "BWSplitView.h"
+#import "BWAnchoredButtonBar.h"
 #import "NSColor+BWAdditions.h"
 #import "NSEvent+BWAdditions.h"
 
 
 - (BOOL)splitView:(NSSplitView *)splitView shouldHideDividerAtIndex:(NSInteger)dividerIndex
 {
-	if ([secondaryDelegate respondsToSelector:@selector(splitView:shouldHideDividerAtIndex:)])
+	if ([secondaryDelegate respondsToSelector:@selector(splitView:shouldHideDividerAtIndex:)] &&
+		[secondaryDelegate isKindOfClass:[BWAnchoredButtonBar class]] == NO)
 		return [secondaryDelegate splitView:splitView shouldHideDividerAtIndex:dividerIndex];
 	
 	if ([self respondsToSelector:@selector(ibDidAddToDesignableDocument:)] == NO)
 
 - (BOOL)splitView:(NSSplitView *)sender canCollapseSubview:(NSView *)subview
 {
-	if ([secondaryDelegate respondsToSelector:@selector(splitView:canCollapseSubview:)])
+	if ([secondaryDelegate respondsToSelector:@selector(splitView:canCollapseSubview:)] &&
+		[secondaryDelegate isKindOfClass:[BWAnchoredButtonBar class]] == NO)
 		return [secondaryDelegate splitView:sender canCollapseSubview:subview];
 	
 	int subviewIndex = [[self subviews] indexOfObject:subview];
 
 - (BOOL)splitView:(NSSplitView *)splitView shouldCollapseSubview:(NSView *)subview forDoubleClickOnDividerAtIndex:(NSInteger)dividerIndex
 {
-	if ([secondaryDelegate respondsToSelector:@selector(splitView:shouldCollapseSubview:forDoubleClickOnDividerAtIndex:)])
+	if ([secondaryDelegate respondsToSelector:@selector(splitView:shouldCollapseSubview:forDoubleClickOnDividerAtIndex:)] &&
+		[secondaryDelegate isKindOfClass:[BWAnchoredButtonBar class]] == NO)
 		return [secondaryDelegate splitView:splitView shouldCollapseSubview:subview forDoubleClickOnDividerAtIndex:dividerIndex];
 	
 	int subviewIndex = [[self subviews] indexOfObject:subview];
 
 - (CGFloat)splitView:(NSSplitView *)sender constrainMaxCoordinate:(CGFloat)proposedMax ofSubviewAt:(NSInteger)offset
 {
-	if ([secondaryDelegate respondsToSelector:@selector(splitView:constrainMaxCoordinate:ofSubviewAt:)])
+	if ([secondaryDelegate respondsToSelector:@selector(splitView:constrainMaxCoordinate:ofSubviewAt:)] &&
+		[secondaryDelegate isKindOfClass:[BWAnchoredButtonBar class]] == NO)
 		return [secondaryDelegate splitView:sender constrainMaxCoordinate:proposedMax ofSubviewAt:offset];
 	
 	// Max coordinate depends on max of subview offset, and the min of subview offset + 1
 
 - (CGFloat)splitView:(NSSplitView *)sender constrainMinCoordinate:(CGFloat)proposedMin ofSubviewAt:(NSInteger)offset
 {
-	if ([secondaryDelegate respondsToSelector:@selector(splitView:constrainMinCoordinate:ofSubviewAt:)])
+	if ([secondaryDelegate respondsToSelector:@selector(splitView:constrainMinCoordinate:ofSubviewAt:)] &&
+		[secondaryDelegate isKindOfClass:[BWAnchoredButtonBar class]] == NO)
 		return [secondaryDelegate splitView:sender constrainMinCoordinate:proposedMin ofSubviewAt:offset];
 	
 	// Min coordinate depends on min of subview offset and the max of subview offset + 1
 	if ([self respondsToSelector:@selector(ibDidAddToDesignableDocument:)])
 		return proposedPosition;	
 	
-	if ([secondaryDelegate respondsToSelector:@selector(splitView:constrainSplitPosition:ofSubviewAt:)])
+	if ([secondaryDelegate respondsToSelector:@selector(splitView:constrainSplitPosition:ofSubviewAt:)] &&
+		[secondaryDelegate isKindOfClass:[BWAnchoredButtonBar class]] == NO)
 		return [secondaryDelegate splitView:sender constrainSplitPosition:proposedPosition ofSubviewAt:offset];
 	
 	return proposedPosition;
 }
 
 - (void)splitView:(NSSplitView *)sender resizeSubviewsWithOldSize:(NSSize)oldSize
-{
-	if ([secondaryDelegate isKindOfClass:NSClassFromString(@"BWAnchoredButtonBar")])
+{	
+	if ([secondaryDelegate isKindOfClass:[BWAnchoredButtonBar class]])
 	{
 		[self resizeAndAdjustSubviews];
 	}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.