[vlc-commits] macosx: make sure that the main window' s split view is correctly resized on relaunch (close #6597)

Felix Paul Kühne git at videolan.org
Tue Apr 10 18:20:47 CEST 2012


vlc | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Tue Apr 10 18:15:51 2012 +0200| [e908f36fd20d67465af399507ad0a898e86c678b] | committer: Felix Paul Kühne

macosx: make sure that the main window's split view is correctly resized on relaunch (close #6597)

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e908f36fd20d67465af399507ad0a898e86c678b
---

 .../macosx/Resources/English.lproj/MainMenu.xib    |   19 +++++++++----------
 modules/gui/macosx/MainWindow.m                    |    9 +++++++--
 modules/gui/macosx/misc.m                          |   17 -----------------
 3 files changed, 16 insertions(+), 29 deletions(-)

diff --git a/extras/package/macosx/Resources/English.lproj/MainMenu.xib b/extras/package/macosx/Resources/English.lproj/MainMenu.xib
index 0fb0474..7d6ebc9 100644
--- a/extras/package/macosx/Resources/English.lproj/MainMenu.xib
+++ b/extras/package/macosx/Resources/English.lproj/MainMenu.xib
@@ -21,16 +21,16 @@
     </object>
     <object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
       <bool key="EncodedWithXMLCoder">YES</bool>
-      <integer value="4850"/>
-      <integer value="29"/>
-      <integer value="4948"/>
-      <integer value="915"/>
-      <integer value="2770"/>
-      <integer value="2730"/>
       <integer value="4722"/>
       <integer value="4596"/>
+      <integer value="2"/>
+      <integer value="29"/>
+      <integer value="2730"/>
+      <integer value="915"/>
+      <integer value="4948"/>
       <integer value="1617"/>
-      <integer value="4713"/>
+      <integer value="4850"/>
+      <integer value="2770"/>
     </object>
     <object class="NSArray" key="IBDocument.PluginDependencies">
       <bool key="EncodedWithXMLCoder">YES</bool>
@@ -604,7 +604,6 @@
               <int key="NSViewLayerContentsRedrawPolicy">2</int>
               <bool key="NSIsVertical">YES</bool>
               <int key="NSDividerStyle">2</int>
-              <string key="NSAutosaveName">10thanniversary-splitview</string>
             </object>
             <object class="NSCustomView" id="515305233">
               <reference key="NSNextResponder" ref="429932428"/>
@@ -12064,9 +12063,9 @@ LCAuLi4</string>
           <string>{{430, 565}, {137, 103}}</string>
           <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
           <boolean value="YES"/>
-          <string>{{364, 446}, {604, 310}}</string>
+          <string>{{363, 446}, {604, 310}}</string>
           <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
-          <string>{{364, 446}, {604, 310}}</string>
+          <string>{{363, 446}, {604, 310}}</string>
           <boolean value="YES"/>
           <boolean value="NO"/>
           <boolean value="NO"/>
diff --git a/modules/gui/macosx/MainWindow.m b/modules/gui/macosx/MainWindow.m
index 8abb82b..0e4a1db 100644
--- a/modules/gui/macosx/MainWindow.m
+++ b/modules/gui/macosx/MainWindow.m
@@ -546,6 +546,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
     [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(applicationWillTerminate:) name: NSApplicationWillTerminateNotification object: nil];
     [[VLCMain sharedInstance] playbackModeUpdated];
 
+    [o_split_view setAutosaveName:@"10thanniversary-splitview"];
     if (b_splitviewShouldBeHidden)
     {
         i_lastSplitViewHeight = [o_split_view frame].size.height;
@@ -1091,7 +1092,6 @@ static VLCMainWindow *_o_sharedInstance = nil;
     return proposedFrameSize;
 }
 
-
 #pragma mark -
 #pragma mark Update interface and respond to foreign events
 - (void)showDropZone
@@ -2070,11 +2070,16 @@ static VLCMainWindow *_o_sharedInstance = nil;
 - (CGFloat)splitView:(NSSplitView *)splitView constrainMaxCoordinate:(CGFloat)proposedMax ofSubviewAt:(NSInteger)dividerIndex
 {
     if (dividerIndex == 0)
-        return ([self frame].size.width - 400.0);
+        return 300.;
     else
         return proposedMax;
 }
 
+- (BOOL)splitView:(NSSplitView *)splitView canCollapseSubview:(NSView *)subview
+{
+    return ([subview isEqual:o_left_split_view]);
+}
+
 #pragma mark -
 #pragma mark Side Bar Data handling
 /* taken under BSD-new from the PXSourceList sample project, adapted for VLC */
diff --git a/modules/gui/macosx/misc.m b/modules/gui/macosx/misc.m
index 3261d8b..6bcc488 100644
--- a/modules/gui/macosx/misc.m
+++ b/modules/gui/macosx/misc.m
@@ -686,23 +686,6 @@ void _drawFrameInRect(NSRect frameRect)
 {
     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.origin.x = leftViewDimensions.size.width + f_dividerThickness;
-    rightViewDimensions.size.width = viewDimensions.size.width - leftViewDimensions.size.width - f_dividerThickness;
-    rightViewDimensions.size.height = viewDimensions.size.height;
-    [[o_subviews objectAtIndex:1] setFrame: rightViewDimensions];
-}
 @end
 
 /*****************************************************************************



More information about the vlc-commits mailing list