diff options
Diffstat (limited to 'Source')
-rw-r--r-- | Source/SPDatabaseDocument.h | 5 | ||||
-rw-r--r-- | Source/SPDatabaseDocument.m | 24 | ||||
-rw-r--r-- | Source/SPSplitView.m | 13 |
3 files changed, 26 insertions, 16 deletions
diff --git a/Source/SPDatabaseDocument.h b/Source/SPDatabaseDocument.h index 0dd389b8..1f5d16c7 100644 --- a/Source/SPDatabaseDocument.h +++ b/Source/SPDatabaseDocument.h @@ -31,7 +31,7 @@ @class SPConnectionController, #ifndef SP_REFACTOR /* class forward decls */ -SPProcessListController, SPServerVariablesController, SPUserManager, SPWindowController, +SPProcessListController, SPServerVariablesController, SPUserManager, SPWindowController, SPSplitView, #endif SPDatabaseData, SPTablesList, SPTableStructure, SPTableContent, SPTableData, SPServerSupport, SPCustomQuery, SPDatabaseStructure, SPMySQLConnection; @@ -123,8 +123,7 @@ SPDatabaseData, SPTablesList, SPTableStructure, SPTableContent, SPTableData, SPS IBOutlet NSTabView *tableTabView; IBOutlet NSTableView *tableInfoTable; - IBOutlet NSSplitView *contentViewSplitter; - IBOutlet id sidebarGrabber; + IBOutlet SPSplitView *contentViewSplitter; IBOutlet NSPopUpButton *encodingPopUp; #endif diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m index 0cfec364..059e784c 100644 --- a/Source/SPDatabaseDocument.m +++ b/Source/SPDatabaseDocument.m @@ -48,6 +48,7 @@ enum { #import "ImageAndTextCell.h" #import "SPGrowlController.h" #import "SPExportController.h" +#import "SPSplitView.h" #endif #import "SPQueryController.h" #import "SPQueryDocumentsController.h" @@ -273,6 +274,9 @@ static NSString *SPRenameDatabaseAction = @"SPRenameDatabase"; // Set up the toolbar [self setupToolbar]; + // Set collapsible behaviour on the table list so collapsing behaviour handles resize issus + [contentViewSplitter setCollapsibleSubviewIndex:0]; + // Set up the connection controller connectionController = [[SPConnectionController alloc] initWithDocument:self]; @@ -358,8 +362,6 @@ static NSString *SPRenameDatabaseAction = @"SPRenameDatabase"; [taskProgressWindow setAlphaValue:0.0f]; [taskProgressWindow setContentView:taskProgressLayer]; - [contentViewSplitter setDelegate:self]; - [self updateTitlebarStatusVisibilityForcingHide:NO]; #endif } @@ -5575,20 +5577,20 @@ static NSString *SPRenameDatabaseAction = @"SPRenameDatabase"; - (void)splitViewDidResizeSubviews:(NSNotification *)notification { - // Fix tablesList search field frame after collapsing the tablesList - [listFilterField setFrameSize:NSMakeSize([[[contentViewSplitter subviews] objectAtIndex:0] frame].size.width - 8, [listFilterField frame].size.height)]; - [self updateChooseDatabaseToolbarItemWidth]; - } -- (NSRect)splitView:(NSSplitView *)splitView additionalEffectiveRectOfDividerAtIndex:(NSInteger)dividerIndex +- (CGFloat)splitView:(NSSplitView *)splitView constrainMinCoordinate:(CGFloat)proposedMinimumPosition ofSubviewAt:(NSInteger)dividerIndex { - if (splitView == contentViewSplitter && sidebarGrabber != nil) { - return [sidebarGrabber splitView:splitView additionalEffectiveRectOfDividerAtIndex:dividerIndex]; - } else { - return NSZeroRect; + if (dividerIndex == 0 && proposedMinimumPosition < 40) { + return 40; } + return proposedMinimumPosition; +} + +- (CGFloat)splitView:(NSSplitView *)splitView constrainMaxCoordinate:(CGFloat)proposedMaximumPosition ofSubviewAt:(NSInteger)dividerIndex +{ + return proposedMaximumPosition; } - (void)updateChooseDatabaseToolbarItemWidth diff --git a/Source/SPSplitView.m b/Source/SPSplitView.m index 51e3eb79..8d25167e 100644 --- a/Source/SPSplitView.m +++ b/Source/SPSplitView.m @@ -92,7 +92,7 @@ - (void)awakeFromNib { - if ([super respondsToSelector:@selector(awakeFromNib)]) { + if ([NSSplitView instancesRespondToSelector:@selector(awakeFromNib)]) { [super awakeFromNib]; } @@ -598,6 +598,9 @@ if (additionalDragHandleView) { NSRect dragRect = [additionalDragHandleView frame]; dragRect.origin = [self convertPoint:dragRect.origin fromView:[additionalDragHandleView superview]]; + if ([additionalDragHandleView isFlipped] != [self isFlipped]) { + dragRect.origin.y -= dragRect.size.height; + } return dragRect; } @@ -761,7 +764,7 @@ if (i == collapsibleSubviewIndex && collapsibleSubviewCollapsed && !viewIsAnimating) { minSizes[i] = 0.f; maxSizes[i] = 0.f; - } else if (i == collapsibleSubviewIndex && !viewLength && animationTargetSize && [eachSubview isKindOfClass:[SPSplitViewHelperView class]]) { + } else if (i == collapsibleSubviewIndex && !viewLength && animationTargetSize && !viewIsAnimating && [eachSubview isKindOfClass:[SPSplitViewHelperView class]]) { minSizes[i] = animationTargetSize; maxSizes[i] = animationTargetSize; } else if (respectStruts && ![self _isViewResizable:eachSubview]) { @@ -778,6 +781,12 @@ // If this isn't the collapsible subview, or if there's no collapse animation, measure // the view and continue. if (!viewIsAnimating) { + + // Restore the original view if necessary + if ([eachSubview isKindOfClass:[SPSplitViewHelperView class]] && !collapsibleSubviewCollapsed && (viewLength || animationTargetSize)) { + [(SPSplitViewHelperView *)eachSubview restoreOriginalView]; + } + originalSizes[i] = viewLength; totalCurrentSize += viewLength; [outputSizes addObject:[NSNumber numberWithFloat:viewLength]]; |