aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2012-07-30 20:04:10 +0000
committerrowanbeentje <rowan@beent.je>2012-07-30 20:04:10 +0000
commited16bf078249b4b474a231ba487702f4f7d9a13b (patch)
tree52a6b0bb364acca7cc62904bdfbe771b5978242d /Source
parent62621d6fde334a8b61f43925d65c754860db9a5a (diff)
downloadsequelpro-ed16bf078249b4b474a231ba487702f4f7d9a13b.tar.gz
sequelpro-ed16bf078249b4b474a231ba487702f4f7d9a13b.tar.bz2
sequelpro-ed16bf078249b4b474a231ba487702f4f7d9a13b.zip
- Tweak SPSplitView to no longer treat non-resizable split view children as max/min constraints when dragging the splitview divider. This improves default behaviour and also allow use of the non-resizable split view children to control relative autoresizing when resizing a parent view
- Tweak Bundle Editor to no longer require split view delegate controls to control resizing, instead making the first split view child non-resizable in IB
Diffstat (limited to 'Source')
-rw-r--r--Source/SPBundleEditorController.m15
-rw-r--r--Source/SPSplitView.m64
2 files changed, 20 insertions, 59 deletions
diff --git a/Source/SPBundleEditorController.m b/Source/SPBundleEditorController.m
index e94303fb..a23c3183 100644
--- a/Source/SPBundleEditorController.m
+++ b/Source/SPBundleEditorController.m
@@ -1213,21 +1213,6 @@
}
#pragma mark -
-#pragma mark Split view delegates
-
-- (void)splitView:(NSSplitView *)theSplitView resizeSubviewsWithOldSize:(NSSize)oldSize
-{
- NSView *nonResizableSubview = [[theSplitView subviews] objectAtIndex:0];
- NSView *resizableSubview = [[theSplitView subviews] objectAtIndex:1];
-
- CGFloat nonResizableSubviewTotal = [nonResizableSubview frame].size.width;
- nonResizableSubviewTotal += [theSplitView dividerThickness];
-
- [nonResizableSubview setFrameSize:NSMakeSize([nonResizableSubview frame].size.width, [splitView frame].size.height)];
- [resizableSubview setFrameSize:NSMakeSize([theSplitView frame].size.width - nonResizableSubviewTotal, [splitView frame].size.height)];
-}
-
-#pragma mark -
#pragma mark TableView delegates
- (NSInteger)numberOfRowsInTableView:(NSTableView *)aTableView
diff --git a/Source/SPSplitView.m b/Source/SPSplitView.m
index d86a259e..b3c067d5 100644
--- a/Source/SPSplitView.m
+++ b/Source/SPSplitView.m
@@ -494,30 +494,18 @@
[self _ensureDefaultSubviewSizesToIndex:(dividerIndex + 1)];
- // If the preceeding view is not resizable, treat it as fixed position
- aView = [[self subviews] objectAtIndex:dividerIndex];
- if (![self _isViewResizable:aView]) {
- preMinPosition = [self _startPositionOfView:aView] + [self _lengthOfView:aView];
- } else {
-
- // Check the minimum size of the preceeding view
- CGFloat preMinSize = [[viewMinimumSizes objectAtIndex:dividerIndex] floatValue];
- if (preMinSize) {
- preMinPosition = [self _startPositionOfView:aView] + preMinSize;
- }
+ // Check the minimum size of the preceeding view
+ CGFloat preMinSize = [[viewMinimumSizes objectAtIndex:dividerIndex] floatValue];
+ if (preMinSize) {
+ aView = [[self subviews] objectAtIndex:dividerIndex];
+ preMinPosition = [self _startPositionOfView:aView] + preMinSize;
}
- // If the following view is not resizable, treat it as fixed position
- aView = [[self subviews] objectAtIndex:(dividerIndex + 1)];
- if (![self _isViewResizable:aView]) {
- postMaxPosition = [self _startPositionOfView:aView] - [self dividerThickness];
- } else {
-
- // Check the maximum size of the following view
- CGFloat postMaxSize = [[viewMaximumSizes objectAtIndex:(dividerIndex + 1)] floatValue];
- if (postMaxSize != FLT_MAX) {
- postMaxPosition = [self _startPositionOfView:aView] + [self _lengthOfView:aView] - postMaxSize - [self dividerThickness];
- }
+ // Check the maximum size of the following view
+ CGFloat postMaxSize = [[viewMaximumSizes objectAtIndex:(dividerIndex + 1)] floatValue];
+ if (postMaxSize != FLT_MAX) {
+ aView = [[self subviews] objectAtIndex:(dividerIndex + 1)];
+ postMaxPosition = [self _startPositionOfView:aView] + [self _lengthOfView:aView] - postMaxSize - [self dividerThickness];
}
CGFloat suggestedMinimum = fmaxf(preMinPosition, postMaxPosition);
@@ -548,30 +536,18 @@
[self _ensureDefaultSubviewSizesToIndex:(dividerIndex + 1)];
- // If the preceeding view is not resizable, treat it as fixed position
- aView = [[self subviews] objectAtIndex:dividerIndex];
- if (![self _isViewResizable:aView]) {
- preMaxPosition = [self _startPositionOfView:aView] + [self _lengthOfView:aView];
- } else {
-
- // Check the maximum size of the preceeding view
- CGFloat preMaxSize = [[viewMaximumSizes objectAtIndex:dividerIndex] floatValue];
- if (preMaxSize != FLT_MAX) {
- preMaxPosition = [self _startPositionOfView:aView] + preMaxSize;
- }
+ // Check the maximum size of the preceeding view
+ CGFloat preMaxSize = [[viewMaximumSizes objectAtIndex:dividerIndex] floatValue];
+ if (preMaxSize != FLT_MAX) {
+ aView = [[self subviews] objectAtIndex:dividerIndex];
+ preMaxPosition = [self _startPositionOfView:aView] + preMaxSize;
}
- // If the following view is not resizable, treat it as fixed position
- aView = [[self subviews] objectAtIndex:(dividerIndex + 1)];
- if (![self _isViewResizable:aView]) {
- postMinPosition = [self _startPositionOfView:aView] - [self dividerThickness];
- } else {
-
- // Check the minimum size of the following view
- CGFloat postMinSize = [[viewMinimumSizes objectAtIndex:(dividerIndex + 1)] floatValue];
- if (postMinSize) {
- postMinPosition = [self _startPositionOfView:aView] + [self _lengthOfView:aView] - postMinSize - [self dividerThickness];
- }
+ // Check the minimum size of the following view
+ CGFloat postMinSize = [[viewMinimumSizes objectAtIndex:(dividerIndex + 1)] floatValue];
+ if (postMinSize) {
+ aView = [[self subviews] objectAtIndex:(dividerIndex + 1)];
+ postMinPosition = [self _startPositionOfView:aView] + [self _lengthOfView:aView] - postMinSize - [self dividerThickness];
}
CGFloat suggestedMaximum = fminf(preMaxPosition, postMinPosition);