Properly constrain window proportions

This commit is contained in:
Matthias Neeracher 2011-08-14 01:35:07 +02:00
parent d1cd18c57b
commit 1159ba793a
2 changed files with 37 additions and 7 deletions

View File

@ -188,6 +188,24 @@ static NSTimeInterval sLastSkip = 0.0;
}
}
#pragma mark Split management
-(CGFloat)splitView:(NSSplitView *)splitView constrainMaxCoordinate:(CGFloat)proposedMax ofSubviewAt:(NSInteger)dividerIndex
{
return splitView.frame.size.height-108.0;
}
-(CGFloat)splitView:(NSSplitView *)splitView constrainMinCoordinate:(CGFloat)proposedMin ofSubviewAt:(NSInteger)dividerIndex
{
return 80.0;
}
// This only prevents resizing the topView in cases where the user does not use the divider (resizing the window primarily).
-(BOOL)splitView:(NSSplitView *)splitView shouldAdjustSizeOfSubview:(NSView *)subview
{
return subview != [[splitView subviews] objectAtIndex:0];
}
@end
@implementation MADocumentWindow

View File

@ -114,13 +114,13 @@
<object class="NSWindowTemplate" id="275939982">
<int key="NSWindowStyleMask">15</int>
<int key="NSWindowBacking">2</int>
<string key="NSWindowRect">{{133, 235}, {1280, 809}}</string>
<string key="NSWindowRect">{{200, 400}, {1280, 809}}</string>
<int key="NSWTFlags">1886912512</int>
<string key="NSWindowTitle">Window</string>
<string key="NSWindowClass">MADocumentWindow</string>
<string key="NSViewClass">View</string>
<nil key="NSUserInterfaceItemIdentifier"/>
<string key="NSWindowContentMinSize">{94, 86}</string>
<string key="NSWindowContentMinSize">{450, 400}</string>
<object class="NSView" key="NSWindowView" id="568628114">
<reference key="NSNextResponder"/>
<int key="NSvFlags">256</int>
@ -397,7 +397,7 @@
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="QTMovieView" id="56699403">
<reference key="NSNextResponder" ref="1058980817"/>
<int key="NSvFlags">298</int>
<int key="NSvFlags">266</int>
<object class="NSMutableSet" key="NSDragTypes">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="set.sortedObjects">
@ -421,7 +421,7 @@
</object>
<object class="NSScrollView" id="1054473103">
<reference key="NSNextResponder" ref="1058980817"/>
<int key="NSvFlags">310</int>
<int key="NSvFlags">274</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSClipView" id="51131752">
@ -644,7 +644,7 @@
</object>
<reference key="NSContentView" ref="1058980817"/>
<int key="NSBorderType">0</int>
<int key="NSBoxType">4</int>
<int key="NSBoxType">0</int>
<int key="NSTitlePosition">0</int>
<bool key="NSTransparent">NO</bool>
<real value="0.0" key="NSBorderWidth2"/>
@ -663,7 +663,7 @@
<reference key="NSNextKeyView" ref="196617426"/>
</object>
<string key="NSScreenRect">{{0, 0}, {2560, 1418}}</string>
<string key="NSMinSize">{94, 108}</string>
<string key="NSMinSize">{450, 422}</string>
<string key="NSMaxSize">{10000000000000, 10000000000000}</string>
<int key="NSWindowCollectionBehavior">128</int>
<bool key="NSWindowIsRestorable">YES</bool>
@ -1069,6 +1069,14 @@
</object>
<int key="connectionID">100179</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">delegate</string>
<reference key="source" ref="196617426"/>
<reference key="destination" ref="512844837"/>
</object>
<int key="connectionID">100180</int>
</object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
@ -1395,6 +1403,8 @@
<string>100148.IBPluginDependency</string>
<string>100161.IBPluginDependency</string>
<string>100162.IBPluginDependency</string>
<string>5.IBNSWindowAutoPositionCentersHorizontal</string>
<string>5.IBNSWindowAutoPositionCentersVertical</string>
<string>5.IBPluginDependency</string>
<string>5.IBWindowTemplateEditedContentRect</string>
<string>6.IBPluginDependency</string>
@ -1439,6 +1449,8 @@
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="NO"/>
<boolean value="NO"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>{{133, 170}, {507, 413}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@ -1456,7 +1468,7 @@
<reference key="dict.values" ref="0"/>
</object>
<nil key="sourceID"/>
<int key="maxID">100179</int>
<int key="maxID">100180</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">