[vlc-commits] macosx: further improve splitview resizing
Felix Paul Kühne
git at videolan.org
Wed Dec 28 01:29:19 CET 2011
vlc | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Wed Dec 28 01:19:54 2011 +0100| [4c9c15ce9d0ac8ace102dba6e5adcae922b689d0] | committer: Felix Paul Kühne
macosx: further improve splitview resizing
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=4c9c15ce9d0ac8ace102dba6e5adcae922b689d0
---
.../macosx/Resources/English.lproj/MainMenu.xib | 28 ++++++++++++-------
modules/gui/macosx/CompatibilityFixes.h | 1 +
modules/gui/macosx/MainWindow.h | 2 +-
modules/gui/macosx/MainWindow.m | 18 ++++++++++++
modules/gui/macosx/misc.m | 21 +++++++++++++-
5 files changed, 57 insertions(+), 13 deletions(-)
diff --git a/extras/package/macosx/Resources/English.lproj/MainMenu.xib b/extras/package/macosx/Resources/English.lproj/MainMenu.xib
index 6438443..d540d7e 100644
--- a/extras/package/macosx/Resources/English.lproj/MainMenu.xib
+++ b/extras/package/macosx/Resources/English.lproj/MainMenu.xib
@@ -21,7 +21,7 @@
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="4714"/>
+ <integer value="4680"/>
<integer value="915"/>
<integer value="4758"/>
<integer value="1617"/>
@@ -622,7 +622,7 @@
<int key="NSvFlags">290</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSImageView" id="869668783">
+ <object class="NSImageView" id="884724451">
<reference key="NSNextResponder" ref="129808516"/>
<int key="NSvFlags">289</int>
<object class="NSMutableSet" key="NSDragTypes">
@@ -641,7 +641,7 @@
<reference key="NSSuperview" ref="129808516"/>
<string key="NSReuseIdentifierKey">_NS:2165</string>
<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="NSCellFlags2">33554432</int>
<object class="NSCustomResource" key="NSContents">
@@ -7410,10 +7410,18 @@ LCAuLi4</string>
<object class="IBOutletConnection" key="connection">
<string key="label">o_resize_view</string>
<reference key="source" ref="498338108"/>
- <reference key="destination" ref="869668783"/>
+ <reference key="destination" ref="884724451"/>
</object>
<int key="connectionID">4841</int>
</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 class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
@@ -9922,7 +9930,7 @@ LCAuLi4</string>
<reference ref="291209196"/>
<reference ref="354459361"/>
<reference ref="707945673"/>
- <reference ref="869668783"/>
+ <reference ref="884724451"/>
</object>
<reference key="parent" ref="429932428"/>
</object>
@@ -10193,17 +10201,17 @@ LCAuLi4</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">4839</int>
- <reference key="object" ref="869668783"/>
+ <reference key="object" ref="884724451"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="686558362"/>
+ <reference ref="655520031"/>
</object>
<reference key="parent" ref="129808516"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">4840</int>
- <reference key="object" ref="686558362"/>
- <reference key="parent" ref="869668783"/>
+ <reference key="object" ref="655520031"/>
+ <reference key="parent" ref="884724451"/>
</object>
</object>
</object>
@@ -11844,7 +11852,7 @@ LCAuLi4</string>
</object>
</object>
<nil key="sourceID"/>
- <int key="maxID">4841</int>
+ <int key="maxID">4842</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
diff --git a/modules/gui/macosx/CompatibilityFixes.h b/modules/gui/macosx/CompatibilityFixes.h
index 0ddd517..3ff6bb8 100644
--- a/modules/gui/macosx/CompatibilityFixes.h
+++ b/modules/gui/macosx/CompatibilityFixes.h
@@ -42,6 +42,7 @@
@protocol NSOutlineViewDelegate <NSObject> @end
@protocol NSOutlineViewDataSource <NSObject> @end
@protocol NSToolbarDelegate <NSObject> @end
+ at protocol NSSplitViewDelegate <NSObject> @end
enum {
NSApplicationPresentationDefault = 0,
diff --git a/modules/gui/macosx/MainWindow.h b/modules/gui/macosx/MainWindow.h
index 449fa4e..1d06f41 100644
--- a/modules/gui/macosx/MainWindow.h
+++ b/modules/gui/macosx/MainWindow.h
@@ -31,7 +31,7 @@
#import "misc.h"
#import "fspanel.h"
- at interface VLCMainWindow : NSWindow <PXSourceListDataSource, PXSourceListDelegate, NSWindowDelegate, NSAnimationDelegate> {
+ at interface VLCMainWindow : NSWindow <PXSourceListDataSource, PXSourceListDelegate, NSWindowDelegate, NSAnimationDelegate, NSSplitViewDelegate> {
IBOutlet id o_play_btn;
IBOutlet id o_bwd_btn;
IBOutlet id o_fwd_btn;
diff --git a/modules/gui/macosx/MainWindow.m b/modules/gui/macosx/MainWindow.m
index f8dd3db..e1853b8 100644
--- a/modules/gui/macosx/MainWindow.m
+++ b/modules/gui/macosx/MainWindow.m
@@ -1657,6 +1657,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 Side Bar Data handling
/* taken under BSD-new from the PXSourceList sample project, adapted for VLC */
- (NSUInteger)sourceList:(PXSourceList*)sourceList numberOfChildrenOfItem:(id)item
diff --git a/modules/gui/macosx/misc.m b/modules/gui/macosx/misc.m
index 7001eb9..884610e 100644
--- a/modules/gui/macosx/misc.m
+++ b/modules/gui/macosx/misc.m
@@ -698,7 +698,7 @@ void _drawFrameInRect(NSRect frameRect)
/*****************************************************************************
* VLCMainWindowSplitView implementation
- * comments taken from NSSplitView.h (10.7 SDK)
+ * comment 1 + 2 taken from NSSplitView.h (10.7 SDK)
*****************************************************************************/
@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.
@@ -712,6 +712,23 @@ void _drawFrameInRect(NSRect frameRect)
*/
- (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
More information about the vlc-commits
mailing list