[vlc-commits] macosx/library window: generate vout view i code instead of IB

Felix Paul Kühne git at videolan.org
Tue May 7 11:32:33 CEST 2019


vlc | branch: master | Felix Paul Kühne <felix at feepk.net> | Tue May  7 11:32:04 2019 +0200| [76657bad0a129320e4edb28b2e06319e83a875a2] | committer: Felix Paul Kühne

macosx/library window: generate vout view i code instead of IB

This way, the UI elements are a lot more accessible when working with the visual editor.

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

 modules/gui/macosx/UI/VLCLibraryWindow.xib         | 35 +++++++++-------------
 modules/gui/macosx/library/VLCLibraryWindow.h      |  1 +
 modules/gui/macosx/library/VLCLibraryWindow.m      |  9 ++++++
 .../macosx/windows/video/VLCVideoWindowCommon.h    |  2 +-
 4 files changed, 25 insertions(+), 22 deletions(-)

diff --git a/modules/gui/macosx/UI/VLCLibraryWindow.xib b/modules/gui/macosx/UI/VLCLibraryWindow.xib
index 947e6b96c1..76965f6c1c 100644
--- a/modules/gui/macosx/UI/VLCLibraryWindow.xib
+++ b/modules/gui/macosx/UI/VLCLibraryWindow.xib
@@ -17,13 +17,13 @@
             <windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES" fullSizeContentView="YES"/>
             <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
             <rect key="contentRect" x="196" y="240" width="480" height="363"/>
-            <rect key="screenRect" x="0.0" y="0.0" width="1280" height="800"/>
+            <rect key="screenRect" x="0.0" y="0.0" width="1920" height="1177"/>
             <view key="contentView" wantsLayer="YES" id="EiT-Mj-1SZ">
                 <rect key="frame" x="0.0" y="0.0" width="480" height="363"/>
                 <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                 <subviews>
                     <segmentedControl verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="W1M-0o-qYG">
-                        <rect key="frame" x="88" y="332" width="304" height="25"/>
+                        <rect key="frame" x="88" y="333" width="304" height="24"/>
                         <constraints>
                             <constraint firstAttribute="width" relation="greaterThanOrEqual" constant="300" id="Wg7-mn-ahw"/>
                         </constraints>
@@ -37,18 +37,18 @@
                         </segmentedCell>
                     </segmentedControl>
                     <splitView autosaveName="librarywindowsplitview" dividerStyle="thin" vertical="YES" translatesAutoresizingMaskIntoConstraints="NO" id="u8g-jy-S4e">
-                        <rect key="frame" x="0.0" y="36" width="480" height="291"/>
+                        <rect key="frame" x="0.0" y="36" width="480" height="292"/>
                         <subviews>
                             <customView fixedFrame="YES" id="iSp-bV-w6B">
-                                <rect key="frame" x="0.0" y="0.0" width="242" height="291"/>
+                                <rect key="frame" x="0.0" y="0.0" width="242" height="292"/>
                                 <autoresizingMask key="autoresizingMask"/>
                             </customView>
                             <customView id="dus-WQ-AmE">
-                                <rect key="frame" x="243" y="0.0" width="237" height="291"/>
+                                <rect key="frame" x="243" y="0.0" width="237" height="292"/>
                                 <autoresizingMask key="autoresizingMask"/>
                                 <subviews>
                                     <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Vry-OZ-ySI">
-                                        <rect key="frame" x="18" y="274" width="51" height="17"/>
+                                        <rect key="frame" x="18" y="275" width="51" height="17"/>
                                         <textFieldCell key="cell" lineBreakMode="clipping" title="Up next" id="7PB-pT-1Xp">
                                             <font key="font" usesAppearanceFont="YES"/>
                                             <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
@@ -56,16 +56,16 @@
                                         </textFieldCell>
                                     </textField>
                                     <box verticalHuggingPriority="750" boxType="separator" translatesAutoresizingMaskIntoConstraints="NO" id="qmL-Ar-cj1">
-                                        <rect key="frame" x="20" y="247" width="197" height="5"/>
+                                        <rect key="frame" x="20" y="248" width="197" height="5"/>
                                     </box>
                                     <scrollView borderType="none" autohidesScrollers="YES" horizontalLineScroll="19" horizontalPageScroll="10" verticalLineScroll="19" verticalPageScroll="10" hasHorizontalScroller="NO" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Z7y-D0-11Q">
-                                        <rect key="frame" x="20" y="63" width="217" height="178"/>
+                                        <rect key="frame" x="20" y="63" width="217" height="179"/>
                                         <clipView key="contentView" drawsBackground="NO" copiesOnScroll="NO" id="Vdr-bg-tuS">
-                                            <rect key="frame" x="0.0" y="0.0" width="217" height="178"/>
+                                            <rect key="frame" x="0.0" y="0.0" width="217" height="179"/>
                                             <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                             <subviews>
                                                 <tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" autosaveColumns="NO" rowSizeStyle="automatic" viewBased="YES" id="Fr1-af-8gb" customClass="VLCPlaylistTableView">
-                                                    <rect key="frame" x="0.0" y="0.0" width="217" height="178"/>
+                                                    <rect key="frame" x="0.0" y="0.0" width="217" height="179"/>
                                                     <autoresizingMask key="autoresizingMask"/>
                                                     <size key="intercellSpacing" width="3" height="2"/>
                                                     <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
@@ -158,7 +158,7 @@
                                 </subviews>
                                 <constraints>
                                     <constraint firstItem="Vry-OZ-ySI" firstAttribute="leading" secondItem="dus-WQ-AmE" secondAttribute="leading" constant="20" id="6iz-2G-xXO"/>
-                                    <constraint firstItem="cih-xp-HmY" firstAttribute="leading" secondItem="8zF-Wo-H79" secondAttribute="trailing" constant="45" id="8Dc-DN-myV"/>
+                                    <constraint firstItem="cih-xp-HmY" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="8zF-Wo-H79" secondAttribute="trailing" constant="45" id="8Dc-DN-myV"/>
                                     <constraint firstItem="qmL-Ar-cj1" firstAttribute="top" secondItem="Vry-OZ-ySI" secondAttribute="bottom" constant="24" id="De2-Wf-QsC"/>
                                     <constraint firstItem="nAW-KH-ipk" firstAttribute="leading" secondItem="dus-WQ-AmE" secondAttribute="leading" constant="20" id="EUp-9J-Fid"/>
                                     <constraint firstItem="Z7y-D0-11Q" firstAttribute="top" secondItem="qmL-Ar-cj1" secondAttribute="bottom" constant="8" id="GIh-g3-rqJ"/>
@@ -298,22 +298,14 @@
                             <constraint firstAttribute="bottom" secondItem="MQH-bI-Zdh" secondAttribute="bottom" id="lBe-S3-sJr"/>
                         </constraints>
                     </customView>
-                    <customView hidden="YES" translatesAutoresizingMaskIntoConstraints="NO" id="12s-0J-Uvj" customClass="VLCVoutView">
-                        <rect key="frame" x="0.0" y="36" width="480" height="291"/>
-                    </customView>
                 </subviews>
                 <constraints>
                     <constraint firstItem="W1M-0o-qYG" firstAttribute="centerX" secondItem="EiT-Mj-1SZ" secondAttribute="centerX" id="4k0-zs-btE"/>
-                    <constraint firstItem="12s-0J-Uvj" firstAttribute="bottom" secondItem="u8g-jy-S4e" secondAttribute="bottom" id="8Ud-SJ-kVA"/>
-                    <constraint firstItem="12s-0J-Uvj" firstAttribute="centerY" secondItem="EiT-Mj-1SZ" secondAttribute="centerY" id="NBJ-Md-zDU"/>
                     <constraint firstItem="vUy-jt-gjY" firstAttribute="top" secondItem="u8g-jy-S4e" secondAttribute="bottom" id="QH8-mU-6ZP"/>
                     <constraint firstItem="u8g-jy-S4e" firstAttribute="top" secondItem="W1M-0o-qYG" secondAttribute="bottom" constant="7" id="QVr-jj-gZM"/>
                     <constraint firstItem="vUy-jt-gjY" firstAttribute="leading" secondItem="EiT-Mj-1SZ" secondAttribute="leading" id="Sse-bx-ewr"/>
-                    <constraint firstItem="12s-0J-Uvj" firstAttribute="leading" secondItem="u8g-jy-S4e" secondAttribute="leading" id="XsM-T2-tAm"/>
-                    <constraint firstItem="12s-0J-Uvj" firstAttribute="top" secondItem="u8g-jy-S4e" secondAttribute="top" id="Y9L-U1-u7U"/>
                     <constraint firstAttribute="trailing" secondItem="vUy-jt-gjY" secondAttribute="trailing" id="amK-mR-Fvr"/>
                     <constraint firstAttribute="trailing" secondItem="u8g-jy-S4e" secondAttribute="trailing" id="lEc-Vr-8M9"/>
-                    <constraint firstItem="12s-0J-Uvj" firstAttribute="trailing" secondItem="u8g-jy-S4e" secondAttribute="trailing" id="ool-G0-oZB"/>
                     <constraint firstItem="u8g-jy-S4e" firstAttribute="leading" secondItem="EiT-Mj-1SZ" secondAttribute="leading" id="s58-Wr-5SV"/>
                     <constraint firstAttribute="bottom" secondItem="vUy-jt-gjY" secondAttribute="bottom" id="vMr-VQ-r4P"/>
                     <constraint firstItem="W1M-0o-qYG" firstAttribute="top" secondItem="EiT-Mj-1SZ" secondAttribute="top" constant="7" id="y9h-yj-Ufq"/>
@@ -322,7 +314,9 @@
             <connections>
                 <outlet property="clearPlaylistButton" destination="cih-xp-HmY" id="PoU-co-0kn"/>
                 <outlet property="clearPlaylistSeparator" destination="nAW-KH-ipk" id="Af9-fg-u7m"/>
+                <outlet property="controlsBar" destination="Uzf-Tf-H8x" id="n0G-92-F2Q"/>
                 <outlet property="libraryTargetView" destination="iSp-bV-w6B" id="a94-ux-wUc"/>
+                <outlet property="mainSplitView" destination="u8g-jy-S4e" id="lI5-wR-kef"/>
                 <outlet property="mediaSourceCollectionView" destination="r7v-GI-W1U" id="3JJ-GU-o5o"/>
                 <outlet property="mediaSourceScrollView" destination="cFG-c9-cI9" id="gRO-Y7-kdb"/>
                 <outlet property="playlistTableView" destination="Fr1-af-8gb" id="yaB-Ab-jrx"/>
@@ -334,7 +328,6 @@
                 <outlet property="upNextSeparator" destination="qmL-Ar-cj1" id="GRX-ZE-2UG"/>
                 <outlet property="videoLibraryCollectionView" destination="B8x-e8-7zp" id="u1I-gn-IU1"/>
                 <outlet property="videoLibraryStackView" destination="vak-Gp-ljo" id="ulu-pc-ctF"/>
-                <outlet property="videoView" destination="12s-0J-Uvj" id="zTg-s0-qZ5"/>
             </connections>
             <point key="canvasLocation" x="139" y="204.5"/>
         </window>
@@ -435,7 +428,7 @@
             <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
             <clipView key="contentView" id="tI4-x3-55j">
                 <rect key="frame" x="0.0" y="0.0" width="242" height="291"/>
-                <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                <autoresizingMask key="autoresizingMask"/>
                 <subviews>
                     <collectionView id="r7v-GI-W1U">
                         <rect key="frame" x="0.0" y="0.0" width="242" height="291"/>
diff --git a/modules/gui/macosx/library/VLCLibraryWindow.h b/modules/gui/macosx/library/VLCLibraryWindow.h
index 0ff1edea0f..480e84e182 100644
--- a/modules/gui/macosx/library/VLCLibraryWindow.h
+++ b/modules/gui/macosx/library/VLCLibraryWindow.h
@@ -33,6 +33,7 @@ NS_ASSUME_NONNULL_BEGIN
 @interface VLCLibraryWindow : VLCVideoWindowCommon
 
 @property (readwrite, weak) IBOutlet NSSegmentedControl *segmentedTitleControl;
+ at property (readwrite, weak) IBOutlet NSSplitView *mainSplitView;
 @property (readwrite, weak) IBOutlet NSStackView *videoLibraryStackView;
 @property (readwrite, weak) IBOutlet NSCollectionView *videoLibraryCollectionView;
 @property (readwrite, weak) IBOutlet NSCollectionView *recentVideoLibraryCollectionView;
diff --git a/modules/gui/macosx/library/VLCLibraryWindow.m b/modules/gui/macosx/library/VLCLibraryWindow.m
index c711bcb8ff..c3ba1d461b 100644
--- a/modules/gui/macosx/library/VLCLibraryWindow.m
+++ b/modules/gui/macosx/library/VLCLibraryWindow.m
@@ -69,6 +69,15 @@ static const float f_playlist_row_height = 72.;
     VLCMain *mainInstance = [VLCMain sharedInstance];
     _playlistController = [mainInstance playlistController];
 
+    self.videoView = [[VLCVoutView alloc] initWithFrame:self.mainSplitView.frame];
+    self.videoView.hidden = YES;
+    self.videoView.translatesAutoresizingMaskIntoConstraints = NO;
+    [self.contentView addSubview:self.videoView];
+    [self.contentView addConstraint:[NSLayoutConstraint constraintWithItem:self.videoView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:self.mainSplitView attribute:NSLayoutAttributeWidth multiplier:1. constant:1.]];
+    [self.contentView addConstraint:[NSLayoutConstraint constraintWithItem:self.videoView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:self.mainSplitView attribute:NSLayoutAttributeHeight multiplier:1. constant:1.]];
+    [self.contentView addConstraint:[NSLayoutConstraint constraintWithItem:self.videoView attribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual toItem:self.mainSplitView attribute:NSLayoutAttributeCenterX multiplier:1. constant:1.]];
+    [self.contentView addConstraint:[NSLayoutConstraint constraintWithItem:self.videoView attribute:NSLayoutAttributeCenterY relatedBy:NSLayoutRelationEqual toItem:self.mainSplitView attribute:NSLayoutAttributeCenterY multiplier:1. constant:1.]];
+
     NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
     [notificationCenter addObserver:self
                            selector:@selector(shouldShowFullscreenController:)
diff --git a/modules/gui/macosx/windows/video/VLCVideoWindowCommon.h b/modules/gui/macosx/windows/video/VLCVideoWindowCommon.h
index b66bc41e25..83e05966f1 100644
--- a/modules/gui/macosx/windows/video/VLCVideoWindowCommon.h
+++ b/modules/gui/macosx/windows/video/VLCVideoWindowCommon.h
@@ -44,7 +44,7 @@ static const float f_min_video_height = 70.0;
 
 @property (weak) IBOutlet NSLayoutConstraint *videoViewBottomConstraint;
 
- at property (nonatomic, weak) IBOutlet VLCVoutView* videoView;
+ at property (nonatomic, strong) IBOutlet VLCVoutView* videoView;
 @property (nonatomic, weak) IBOutlet VLCControlsBarCommon* controlsBar;
 @property (readonly) BOOL inFullscreenTransition;
 @property (readonly) BOOL windowShouldExitFullscreenWhenFinished;



More information about the vlc-commits mailing list