diff options
Diffstat (limited to 'Source')
-rw-r--r-- | Source/SPDatabaseDocument.m | 7 | ||||
-rw-r--r-- | Source/SPSplitView.m | 33 | ||||
-rw-r--r-- | Source/SPTableContentDelegate.m | 2 |
3 files changed, 35 insertions, 7 deletions
diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m index b8d6dd83..505164c3 100644 --- a/Source/SPDatabaseDocument.m +++ b/Source/SPDatabaseDocument.m @@ -4314,7 +4314,8 @@ static NSString *SPAlterDatabaseAction = @"SPAlterDatabase"; */ - (void)tabDidResize { - + // Coax the main split view into actually checking its constraints + [contentViewSplitter setPosition:[[[contentViewSplitter subviews] objectAtIndex:0] bounds].size.width ofDividerAtIndex:0]; // If the task interface is visible, and this tab is frontmost, re-center the task child window if (_isWorkingLevel && [parentWindowController selectedTableDocument] == self) [self centerTaskWindow]; } @@ -5766,6 +5767,10 @@ static NSString *SPAlterDatabaseAction = @"SPAlterDatabase"; - (CGFloat)splitView:(NSSplitView *)splitView constrainMaxCoordinate:(CGFloat)proposedMaximumPosition ofSubviewAt:(NSInteger)dividerIndex { + //the right side of the SP window must be at least 505px wide or the UI will break! + if(dividerIndex == 0) { + return proposedMaximumPosition - 505; + } return proposedMaximumPosition; } diff --git a/Source/SPSplitView.m b/Source/SPSplitView.m index b946496e..9d5b59d8 100644 --- a/Source/SPSplitView.m +++ b/Source/SPSplitView.m @@ -365,6 +365,27 @@ [super adjustSubviews]; return; } + + + // Imagine width=9,viewCount=2 and suggestedSizes would return {4.5, 4.5} + // If we did a roundf() we would exceed the size limit (because we'd get {5,5}). + // However if we don't round, we might get two float values which don't add up anyway + // because of a precision issue. + // So let's do the following instead: round alernating between DOWN and UP. + // Finnally give the remainder to the last subview. + // Example with width=11,viewCount=3 -> 3 ; 4 ; 3 + (11 - 10) = 3;4;4 + CGFloat *viewSizesRaw = calloc(sizeof(CGFloat), viewCount); + CGFloat spaceRemaining = totalAvailableSize; + for (i = 0; i < viewCount; i++) { + //recalculate value + CGFloat floatVal = [[viewSizes objectAtIndex:i] floatValue]; + CGFloat rounded = viewSizesRaw[i] = ((i % 2) == 0)? floorf(floatVal) : ceilf(floatVal); + spaceRemaining -= rounded; + } + //last one gets the remainder + if(spaceRemaining) { + viewSizesRaw[i-1] += spaceRemaining; + } CGFloat splitViewBreadth; if ([self isVertical]) { @@ -377,17 +398,17 @@ CGFloat originPosition = 0; for (i = 0; i < viewCount; i++) { NSView *eachSubview = [[self subviews] objectAtIndex:i]; - CGFloat viewSize = [[viewSizes objectAtIndex:i] floatValue]; + CGFloat viewSize = viewSizesRaw[i]; NSRect viewFrame = [eachSubview frame]; if ([self isVertical]) { - viewFrame.origin.x = roundf(originPosition); - viewFrame.size.width = roundf(viewSize); + viewFrame.origin.x = originPosition; + viewFrame.size.width = viewSize; viewFrame.size.height = splitViewBreadth; } else { - viewFrame.origin.y = roundf(originPosition); + viewFrame.origin.y = originPosition; viewFrame.size.width = splitViewBreadth; - viewFrame.size.height = roundf(viewSize); + viewFrame.size.height = viewSize; } [eachSubview setFrame:viewFrame]; @@ -398,6 +419,8 @@ originPosition += [self dividerThickness]; } } + + free(viewSizesRaw); // Invalidate the cursor rects [[self window] invalidateCursorRectsForView:self]; diff --git a/Source/SPTableContentDelegate.m b/Source/SPTableContentDelegate.m index 23cbfb6c..f6b933f7 100644 --- a/Source/SPTableContentDelegate.m +++ b/Source/SPTableContentDelegate.m @@ -641,7 +641,7 @@ */ - (CGFloat)splitView:(NSSplitView *)sender constrainMinCoordinate:(CGFloat)proposedMin ofSubviewAt:(NSInteger)offset { - return proposedMin + 200; + return proposedMin + 225; } /** |