[vlc-commits] [Git][videolan/vlc][master] 4 commits: macosx: Simplify VLCLibraryTwoPaneSplitView constrainMaxCoordinate

Steve Lhomme (@robUx4) gitlab at videolan.org
Tue Jun 11 06:59:52 UTC 2024



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
8e579854 by Claudio Cambra at 2024-06-11T06:45:56+00:00
macosx: Simplify VLCLibraryTwoPaneSplitView constrainMaxCoordinate

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
5f35c3d9 by Claudio Cambra at 2024-06-11T06:45:56+00:00
macosx: Add method to reset split view selection pane width for library views in two pane delegate

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
5085b770 by Claudio Cambra at 2024-06-11T06:45:56+00:00
macosx: Reset split view pane widths in audio and video split views

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
45005675 by Claudio Cambra at 2024-06-11T06:45:56+00:00
macosx: Replace selection two pane view magin width number with named variable

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -


6 changed files:

- modules/gui/macosx/library/VLCLibraryTwoPaneSplitViewDelegate.h
- modules/gui/macosx/library/VLCLibraryTwoPaneSplitViewDelegate.m
- modules/gui/macosx/library/VLCLibraryUIUnits.h
- modules/gui/macosx/library/VLCLibraryUIUnits.m
- modules/gui/macosx/library/audio-library/VLCLibraryAudioViewController.m
- modules/gui/macosx/library/video-library/VLCLibraryVideoViewController.m


Changes:

=====================================
modules/gui/macosx/library/VLCLibraryTwoPaneSplitViewDelegate.h
=====================================
@@ -26,6 +26,8 @@ NS_ASSUME_NONNULL_BEGIN
 
 @interface VLCLibraryTwoPaneSplitViewDelegate : NSObject<NSSplitViewDelegate>
 
+- (void)resetDefaultSplitForSplitView:(NSSplitView *)splitView;
+
 @end
 
 NS_ASSUME_NONNULL_END


=====================================
modules/gui/macosx/library/VLCLibraryTwoPaneSplitViewDelegate.m
=====================================
@@ -29,6 +29,14 @@
 
 @implementation VLCLibraryTwoPaneSplitViewDelegate
 
+- (void)resetDefaultSplitForSplitView:(NSSplitView *)splitView
+{
+    VLCLibraryWindow * const libraryWindow = VLCMain.sharedInstance.libraryWindow;
+    const CGFloat libraryWindowWidth = libraryWindow.frame.size.width;
+    [splitView setPosition:VLCLibraryUIUnits.librarySplitViewSelectionViewDefaultWidth
+          ofDividerAtIndex:0];
+}
+
 - (CGFloat)splitView:(NSSplitView *)splitView
 constrainMaxCoordinate:(CGFloat)proposedMinimumPosition
          ofSubviewAt:(NSInteger)dividerIndex
@@ -39,11 +47,7 @@ constrainMaxCoordinate:(CGFloat)proposedMinimumPosition
 
     VLCLibraryWindow * const libraryWindow = VLCMain.sharedInstance.libraryWindow;
     const CGFloat libraryWindowWidth = libraryWindow.frame.size.width;
-
-    NSNumber * const leftPaneIndex = [NSNumber numberWithLong:0];
-    NSNumber * const leftPaneMaxWidth = [NSNumber numberWithDouble:libraryWindowWidth - VLCLibraryUIUnits.librarySplitViewMainViewMinimumWidth];
-
-    return leftPaneMaxWidth.floatValue;
+    return libraryWindowWidth - VLCLibraryUIUnits.librarySplitViewMainViewMinimumWidth;
 }
 
 @end


=====================================
modules/gui/macosx/library/VLCLibraryUIUnits.h
=====================================
@@ -66,6 +66,7 @@ NS_ASSUME_NONNULL_BEGIN
 
 @property (class, readonly) const CGFloat libraryWindowControlsBarHeight;
 
+ at property (class, readonly) const CGFloat librarySplitViewSelectionViewDefaultWidth;
 @property (class, readonly) const CGFloat librarySplitViewMainViewMinimumWidth;
 @property (class, readonly) const CGFloat libraryWindowNavSidebarMaxWidth;
 @property (class, readonly) const CGFloat libraryWindowPlaylistSidebarMaxWidth;


=====================================
modules/gui/macosx/library/VLCLibraryUIUnits.m
=====================================
@@ -206,6 +206,11 @@
     return 0.4f;
 }
 
++ (const CGFloat)librarySplitViewSelectionViewDefaultWidth
+{
+    return 180.;
+}
+
 + (const CGFloat)librarySplitViewMainViewMinimumWidth
 {
     return 400.;


=====================================
modules/gui/macosx/library/audio-library/VLCLibraryAudioViewController.m
=====================================
@@ -194,6 +194,7 @@ NSString *VLCLibraryPlaceholderAudioViewIdentifier = @"VLCLibraryPlaceholderAudi
 - (void)setupAudioTableViews
 {
     _audioLibrarySplitView.delegate = _splitViewDelegate;
+    [_splitViewDelegate resetDefaultSplitForSplitView:self.audioLibrarySplitView];
 
     _audioCollectionSelectionTableView.dataSource = _audioDataSource;
     _audioCollectionSelectionTableView.delegate = _audioLibraryTableViewDelegate;
@@ -212,6 +213,7 @@ NSString *VLCLibraryPlaceholderAudioViewIdentifier = @"VLCLibraryPlaceholderAudi
 - (void)setupGridModeSplitView
 {
     _audioLibraryGridModeSplitView.delegate = _splitViewDelegate;
+    [_splitViewDelegate resetDefaultSplitForSplitView:self.audioLibraryGridModeSplitView];
 
     _audioLibraryGridModeSplitViewListTableView.dataSource = _audioDataSource;
     _audioLibraryGridModeSplitViewListTableView.delegate = _audioLibraryTableViewDelegate;


=====================================
modules/gui/macosx/library/video-library/VLCLibraryVideoViewController.m
=====================================
@@ -140,6 +140,8 @@
 - (void)setupDataSource
 {
     _videoLibrarySplitView.delegate = _splitViewDelegate;
+    [_splitViewDelegate resetDefaultSplitForSplitView:self.videoLibrarySplitView];
+
     _libraryVideoDataSource = [[VLCLibraryVideoDataSource alloc] init];
     _libraryVideoDataSource.libraryModel = VLCMain.sharedInstance.libraryController.libraryModel;
     _libraryVideoDataSource.groupsTableView = _videoLibraryGroupsTableView;



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/94f7f48cc722326901f182408a5e2adb4995d761...45005675ce57d341b19cc56a9169dc1ee886a06c

-- 
This project does not include diff previews in email notifications.
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/94f7f48cc722326901f182408a5e2adb4995d761...45005675ce57d341b19cc56a9169dc1ee886a06c
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list