From 4cd351c7f3302207103ddfa4374da15cab6840a2 Mon Sep 17 00:00:00 2001 From: rowanbeentje Date: Thu, 26 Jul 2012 00:01:10 +0000 Subject: - 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 --- Source/SPCustomQuery.m | 64 +++++++++++--------------------------------------- 1 file changed, 14 insertions(+), 50 deletions(-) (limited to 'Source/SPCustomQuery.m') diff --git a/Source/SPCustomQuery.m b/Source/SPCustomQuery.m index 1d92c88b..ef4faa17 100644 --- a/Source/SPCustomQuery.m +++ b/Source/SPCustomQuery.m @@ -54,6 +54,7 @@ #import "SPAlertSheets.h" #import "SPCopyTable.h" #import "SPGeometryDataView.h" +#import "SPSplitView.h" #import "SPTextView.h" #import "RegexKitLite.h" #ifndef SP_REFACTOR /* headers */ @@ -522,16 +523,6 @@ return (NSFontPanelSizeModeMask|NSFontPanelCollectionModeMask); } -/** - * Toggle whether the query info pane is visible. - */ -- (IBAction)toggleQueryInfoPaneCollapse:(NSButton *)sender -{ - [queryInfoPaneSplitView toggleCollapse:sender]; - - [sender setToolTip:([sender state] == NSOffState) ? NSLocalizedString(@"Show Query Information", @"Show Query Information") : NSLocalizedString(@"Hide Query Information", @"Hide Query Information")]; -} - #pragma mark - #pragma mark Query actions @@ -1349,12 +1340,10 @@ #ifndef SP_REFACTOR /* show/hide errror view */ // Show or hide the error area if necessary - if ([errorsString length] && [queryInfoPaneSplitView collapsibleSubviewCollapsed]) { - [queryInfoButton setState:NSOnState]; - [self toggleQueryInfoPaneCollapse:queryInfoButton]; - } else if (![errorsString length] && ![queryInfoPaneSplitView collapsibleSubviewCollapsed]) { - [queryInfoButton setState:NSOffState]; - [self toggleQueryInfoPaneCollapse:queryInfoButton]; + if ([errorsString length] && [queryInfoPaneSplitView isCollapsibleSubviewCollapsed]) { + [queryInfoPaneSplitView toggleCollapse:self]; + } else if (![errorsString length] && ![queryInfoPaneSplitView isCollapsibleSubviewCollapsed]) { + [queryInfoPaneSplitView toggleCollapse:self]; } #else if ( [errorsString length] > 0 ) @@ -2742,33 +2731,13 @@ #ifndef SP_REFACTOR /* splitview delegate methods */ /** - * Tells the splitView that it can collapse views + * Tells the split views that they can collapse views */ - (BOOL)splitView:(NSSplitView *)sender canCollapseSubview:(NSView *)subview { return YES; } -/** - * Defines max position of splitView - */ -- (CGFloat)splitView:(NSSplitView *)sender constrainMaxCoordinate:(CGFloat)proposedMax ofSubviewAt:(NSInteger)offset -{ - if (sender != queryInfoPaneSplitView) return (offset == 0) ? (proposedMax - 100) : (proposedMax - 73); - - return proposedMax; -} - -/** - * Defines min position of splitView - */ -- (CGFloat)splitView:(NSSplitView *)sender constrainMinCoordinate:(CGFloat)proposedMin ofSubviewAt:(NSInteger)offset -{ - if (sender != queryInfoPaneSplitView) return proposedMin + 100; - - return proposedMin; -} - /** * The query information pane cannot be resized. */ @@ -3902,6 +3871,14 @@ [queryFavoritesSaveAsMenuItem setTag:SP_SAVE_SELECTION_FAVORTITE_MENUITEM_TAG]; [queryFavoritesSaveAllMenuItem setTag:SP_SAVE_ALL_FAVORTITE_MENUITEM_TAG]; + // Set up the split views + [queryEditorSplitView setMinSize:100 ofSubviewAtIndex:0]; + [queryEditorSplitView setMinSize:100 ofSubviewAtIndex:1]; + + [queryInfoPaneSplitView setCollapsibleSubviewIndex:1]; + [queryInfoPaneSplitView setCollapsibleSubviewCollapsed:YES animate:NO]; + + #ifndef SP_REFACTOR // Set the structure and index view's vertical gridlines if required [customQueryView setGridStyleMask:([prefs boolForKey:SPDisplayTableViewVerticalGridlines]) ? NSTableViewSolidVerticalGridLineMask : NSTableViewGridNone]; @@ -3921,19 +3898,6 @@ [prefs addObserver:self forKeyPath:SPGlobalResultTableFont options:NSKeyValueObservingOptionNew context:NULL]; #endif - // Collapse the query information pane - if ([queryInfoPaneSplitView collapsibleSubview]) { - queryInfoPanePaddingHeight = [[queryInfoPaneSplitView collapsibleSubview] frame].size.height - [errorTextScrollView frame].size.height; - - [queryInfoButton setNextState]; - [queryInfoButton setToolTip:NSLocalizedString(@"Show Query Information", @"Show Query Information")]; - - [queryInfoPaneSplitView setValue:[NSNumber numberWithFloat:[queryInfoPaneSplitView collapsibleSubview].frame.size.height] forKey:@"uncollapsedSize"]; - [[queryInfoPaneSplitView collapsibleSubview] setAutoresizesSubviews:NO]; - [[queryInfoPaneSplitView collapsibleSubview] setFrameSize:NSMakeSize([queryInfoPaneSplitView collapsibleSubview].frame.size.width, 0)]; - [queryInfoPaneSplitView setCollapsibleSubviewCollapsed:YES]; - [[queryInfoPaneSplitView collapsibleSubview] setAutoresizesSubviews:YES]; - } } #pragma mark - -- cgit v1.2.3