diff options
author | rowanbeentje <rowan@beent.je> | 2012-07-26 00:01:10 +0000 |
---|---|---|
committer | rowanbeentje <rowan@beent.je> | 2012-07-26 00:01:10 +0000 |
commit | 4cd351c7f3302207103ddfa4374da15cab6840a2 (patch) | |
tree | 1203a5ebff162395286402be8031bb757565f359 /Source/SPSplitView.m | |
parent | 6deec9586fa0057e286f250b86d2e88c409c3181 (diff) | |
download | sequelpro-4cd351c7f3302207103ddfa4374da15cab6840a2.tar.gz sequelpro-4cd351c7f3302207103ddfa4374da15cab6840a2.tar.bz2 sequelpro-4cd351c7f3302207103ddfa4374da15cab6840a2.zip |
- Replace the collapsible BWSplitView on the Query pane with a SPSplitView configured from code
- Replace the other NSSplitView on the Query pane with an equivalent SPSplitView to allow easier constraint management
- Fix SPSplitView collapsible subview resizing to only amend the collapsible subview's autoresizing mask along the axis of the split view, leaving the other axis untouched to avoid problems with subviews not correctly picking up window resize changes when they were collapsed
Diffstat (limited to 'Source/SPSplitView.m')
-rw-r--r-- | Source/SPSplitView.m | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/Source/SPSplitView.m b/Source/SPSplitView.m index f3c9b175..d86a259e 100644 --- a/Source/SPSplitView.m +++ b/Source/SPSplitView.m @@ -53,7 +53,7 @@ NSView *wrappedView; } -- (id)initReplacingView:(NSView *)aView; +- (id)initReplacingView:(NSView *)aView inVerticalSplitView:(BOOL)verticalSplitView; - (void)restoreOriginalView; @end @@ -211,7 +211,7 @@ // If collapsing, ensure the original view is wrapped in a helper view to avoid // animation resizes of the contained view. (Uncollapses will already be wrapped.) if (![viewToAnimate isMemberOfClass:[SPSplitViewHelperView class]]) { - [[[SPSplitViewHelperView alloc] initReplacingView:viewToAnimate] autorelease]; + [[[SPSplitViewHelperView alloc] initReplacingView:viewToAnimate inVerticalSplitView:[self isVertical]] autorelease]; viewToAnimate = [[self subviews] objectAtIndex:collapsibleSubviewIndex]; } @@ -1008,24 +1008,34 @@ * specified view, adding it as a subview to maintain the same appearance, and then * can be animated without affecting the contained view. */ -- (id)initReplacingView:(NSView *)aView +- (id)initReplacingView:(NSView *)aView inVerticalSplitView:(BOOL)verticalSplitView { self = [super initWithFrame:[aView frame]]; if (!self) return nil; + NSUInteger wrappedResizeMask = [wrappedView autoresizingMask]; + // Retain the wrapped view while this view exists wrappedView = [aView retain]; // Copy over the autoresizing mask from the wrapped view to this view, to keep the same // draw appearance during the resize. - [self setAutoresizingMask:[wrappedView autoresizingMask]]; - - // Set the wrapped view to flexible margin, edge dependent on view ordering - if ([[[wrappedView superview] subviews] indexOfObject:wrappedView]) { - [wrappedView setAutoresizingMask:NSViewMinXMargin | NSViewMinYMargin]; + [self setAutoresizingMask:wrappedResizeMask]; + + // Amend the wrapped view's autoresize mask. Keep the autosizing across the breadth of + // the split view, but amend the autosizing along the lengthwise axis of the split view + // so that no sizing occurs, only a flexible margin to allow resizing + if (verticalSplitView) { + wrappedResizeMask &= ~NSViewMinXMargin; + wrappedResizeMask &= ~NSViewWidthSizable; + wrappedResizeMask |= NSViewMaxXMargin; } else { - [wrappedView setAutoresizingMask:NSViewMaxXMargin | NSViewMaxYMargin]; + wrappedResizeMask &= ~NSViewMaxYMargin; + wrappedResizeMask &= ~NSViewHeightSizable; + wrappedResizeMask |= NSViewMinYMargin; + } + [wrappedView setAutoresizingMask:wrappedResizeMask]; // Swap the views [[wrappedView superview] replaceSubview:wrappedView with:self]; |