aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPCustomQuery.m
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2012-07-26 00:01:10 +0000
committerrowanbeentje <rowan@beent.je>2012-07-26 00:01:10 +0000
commit4cd351c7f3302207103ddfa4374da15cab6840a2 (patch)
tree1203a5ebff162395286402be8031bb757565f359 /Source/SPCustomQuery.m
parent6deec9586fa0057e286f250b86d2e88c409c3181 (diff)
downloadsequelpro-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/SPCustomQuery.m')
-rw-r--r--Source/SPCustomQuery.m64
1 files changed, 14 insertions, 50 deletions
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,7 +2731,7 @@
#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
{
@@ -2750,26 +2739,6 @@
}
/**
- * 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.
*/
- (NSRect)splitView:(NSSplitView *)splitView effectiveRect:(NSRect)proposedEffectiveRect forDrawnRect:(NSRect)drawnRect ofDividerAtIndex:(NSInteger)dividerIndex
@@ -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 -