Commit ef59ca53 authored by Felix Paul Kühne's avatar Felix Paul Kühne Committed by Jean-Baptiste Kempf

macosx: further improve splitview resizing

(cherry picked from commit 4c9c15ce9d0ac8ace102dba6e5adcae922b689d0)
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 10134097
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
</object> </object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> <object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool> <bool key="EncodedWithXMLCoder">YES</bool>
<integer value="4714"/> <integer value="4680"/>
<integer value="915"/> <integer value="915"/>
<integer value="4758"/> <integer value="4758"/>
<integer value="1617"/> <integer value="1617"/>
...@@ -622,7 +622,7 @@ ...@@ -622,7 +622,7 @@
<int key="NSvFlags">290</int> <int key="NSvFlags">290</int>
<object class="NSMutableArray" key="NSSubviews"> <object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool> <bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSImageView" id="869668783"> <object class="NSImageView" id="884724451">
<reference key="NSNextResponder" ref="129808516"/> <reference key="NSNextResponder" ref="129808516"/>
<int key="NSvFlags">289</int> <int key="NSvFlags">289</int>
<object class="NSMutableSet" key="NSDragTypes"> <object class="NSMutableSet" key="NSDragTypes">
...@@ -641,7 +641,7 @@ ...@@ -641,7 +641,7 @@
<reference key="NSSuperview" ref="129808516"/> <reference key="NSSuperview" ref="129808516"/>
<string key="NSReuseIdentifierKey">_NS:2165</string> <string key="NSReuseIdentifierKey">_NS:2165</string>
<bool key="NSEnabled">YES</bool> <bool key="NSEnabled">YES</bool>
<object class="NSImageCell" key="NSCell" id="686558362"> <object class="NSImageCell" key="NSCell" id="655520031">
<int key="NSCellFlags">654848</int> <int key="NSCellFlags">654848</int>
<int key="NSCellFlags2">33554432</int> <int key="NSCellFlags2">33554432</int>
<object class="NSCustomResource" key="NSContents"> <object class="NSCustomResource" key="NSContents">
...@@ -7410,10 +7410,18 @@ LCAuLi4</string> ...@@ -7410,10 +7410,18 @@ LCAuLi4</string>
<object class="IBOutletConnection" key="connection"> <object class="IBOutletConnection" key="connection">
<string key="label">o_resize_view</string> <string key="label">o_resize_view</string>
<reference key="source" ref="498338108"/> <reference key="source" ref="498338108"/>
<reference key="destination" ref="869668783"/> <reference key="destination" ref="884724451"/>
</object> </object>
<int key="connectionID">4841</int> <int key="connectionID">4841</int>
</object> </object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">delegate</string>
<reference key="source" ref="302568132"/>
<reference key="destination" ref="498338108"/>
</object>
<int key="connectionID">4842</int>
</object>
</object> </object>
<object class="IBMutableOrderedSet" key="objectRecords"> <object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects"> <object class="NSArray" key="orderedObjects">
...@@ -9922,7 +9930,7 @@ LCAuLi4</string> ...@@ -9922,7 +9930,7 @@ LCAuLi4</string>
<reference ref="291209196"/> <reference ref="291209196"/>
<reference ref="354459361"/> <reference ref="354459361"/>
<reference ref="707945673"/> <reference ref="707945673"/>
<reference ref="869668783"/> <reference ref="884724451"/>
</object> </object>
<reference key="parent" ref="429932428"/> <reference key="parent" ref="429932428"/>
</object> </object>
...@@ -10193,17 +10201,17 @@ LCAuLi4</string> ...@@ -10193,17 +10201,17 @@ LCAuLi4</string>
</object> </object>
<object class="IBObjectRecord"> <object class="IBObjectRecord">
<int key="objectID">4839</int> <int key="objectID">4839</int>
<reference key="object" ref="869668783"/> <reference key="object" ref="884724451"/>
<object class="NSMutableArray" key="children"> <object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool> <bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="686558362"/> <reference ref="655520031"/>
</object> </object>
<reference key="parent" ref="129808516"/> <reference key="parent" ref="129808516"/>
</object> </object>
<object class="IBObjectRecord"> <object class="IBObjectRecord">
<int key="objectID">4840</int> <int key="objectID">4840</int>
<reference key="object" ref="686558362"/> <reference key="object" ref="655520031"/>
<reference key="parent" ref="869668783"/> <reference key="parent" ref="884724451"/>
</object> </object>
</object> </object>
</object> </object>
...@@ -11844,7 +11852,7 @@ LCAuLi4</string> ...@@ -11844,7 +11852,7 @@ LCAuLi4</string>
</object> </object>
</object> </object>
<nil key="sourceID"/> <nil key="sourceID"/>
<int key="maxID">4841</int> <int key="maxID">4842</int>
</object> </object>
<object class="IBClassDescriber" key="IBDocument.Classes"> <object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions"> <object class="NSMutableArray" key="referencedPartialClassDescriptions">
......
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
@protocol NSOutlineViewDelegate <NSObject> @end @protocol NSOutlineViewDelegate <NSObject> @end
@protocol NSOutlineViewDataSource <NSObject> @end @protocol NSOutlineViewDataSource <NSObject> @end
@protocol NSToolbarDelegate <NSObject> @end @protocol NSToolbarDelegate <NSObject> @end
@protocol NSSplitViewDelegate <NSObject> @end
enum { enum {
NSApplicationPresentationDefault = 0, NSApplicationPresentationDefault = 0,
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
#import "misc.h" #import "misc.h"
#import "fspanel.h" #import "fspanel.h"
@interface VLCMainWindow : NSWindow <PXSourceListDataSource, PXSourceListDelegate, NSWindowDelegate, NSAnimationDelegate> { @interface VLCMainWindow : NSWindow <PXSourceListDataSource, PXSourceListDelegate, NSWindowDelegate, NSAnimationDelegate, NSSplitViewDelegate> {
IBOutlet id o_play_btn; IBOutlet id o_play_btn;
IBOutlet id o_bwd_btn; IBOutlet id o_bwd_btn;
IBOutlet id o_fwd_btn; IBOutlet id o_fwd_btn;
......
...@@ -1656,6 +1656,24 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -1656,6 +1656,24 @@ static VLCMainWindow *_o_sharedInstance = nil;
} }
} }
#pragma mark -
#pragma mark split view delegate
- (CGFloat)splitView:(NSSplitView *)splitView constrainMinCoordinate:(CGFloat)proposedMin ofSubviewAt:(NSInteger)dividerIndex
{
if (dividerIndex == 0)
return 200.0;
else
return proposedMin;
}
- (CGFloat)splitView:(NSSplitView *)splitView constrainMaxCoordinate:(CGFloat)proposedMax ofSubviewAt:(NSInteger)dividerIndex
{
if (dividerIndex == 0)
return ([self frame].size.width - 300.0);
else
return proposedMax;
}
#pragma mark - #pragma mark -
#pragma mark Side Bar Data handling #pragma mark Side Bar Data handling
/* taken under BSD-new from the PXSourceList sample project, adapted for VLC */ /* taken under BSD-new from the PXSourceList sample project, adapted for VLC */
......
...@@ -698,7 +698,7 @@ void _drawFrameInRect(NSRect frameRect) ...@@ -698,7 +698,7 @@ void _drawFrameInRect(NSRect frameRect)
/***************************************************************************** /*****************************************************************************
* VLCMainWindowSplitView implementation * VLCMainWindowSplitView implementation
* comments taken from NSSplitView.h (10.7 SDK) * comment 1 + 2 taken from NSSplitView.h (10.7 SDK)
*****************************************************************************/ *****************************************************************************/
@implementation VLCMainWindowSplitView : NSSplitView @implementation VLCMainWindowSplitView : NSSplitView
/* Return the color of the dividers that the split view is drawing between subviews. The default implementation of this method returns [NSColor clearColor] for the thick divider style. It will also return [NSColor clearColor] for the thin divider style when the split view is in a textured window. All other thin dividers are drawn with a color that looks good between two white panes. You can override this method to change the color of dividers. /* Return the color of the dividers that the split view is drawing between subviews. The default implementation of this method returns [NSColor clearColor] for the thick divider style. It will also return [NSColor clearColor] for the thin divider style when the split view is in a textured window. All other thin dividers are drawn with a color that looks good between two white panes. You can override this method to change the color of dividers.
...@@ -712,6 +712,23 @@ void _drawFrameInRect(NSRect frameRect) ...@@ -712,6 +712,23 @@ void _drawFrameInRect(NSRect frameRect)
*/ */
- (CGFloat)dividerThickness - (CGFloat)dividerThickness
{ {
return .01; return 1.0;
}
- (void)adjustSubviews
{
NSArray *o_subviews = [self subviews];
NSRect viewDimensions = [self frame];
NSRect leftViewDimensions = [[o_subviews objectAtIndex:0] frame];
NSRect rightViewDimensions = [[o_subviews objectAtIndex:1] frame];
CGFloat f_dividerThickness = [self dividerThickness];
leftViewDimensions.size.height = viewDimensions.size.height;
[[o_subviews objectAtIndex:0] setFrame: leftViewDimensions];
rightViewDimensions.size.width = viewDimensions.size.width - leftViewDimensions.size.width - f_dividerThickness;
rightViewDimensions.size.height = viewDimensions.size.height;
rightViewDimensions.origin.x = leftViewDimensions.size.width + f_dividerThickness;
[[o_subviews objectAtIndex:1] setFrame: rightViewDimensions];
} }
@end @end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment