[vlc-commits] macosx/playlist: iterate on cell dimensions, font size and have it respect the large-text setting
Felix Paul Kühne
git at videolan.org
Sat Jun 1 11:49:19 CEST 2019
vlc | branch: master | Felix Paul Kühne <felix at feepk.net> | Sat Jun 1 11:24:28 2019 +0200| [bf7c59034f2c5845717c3c9c1eacdbd272ddc136] | committer: Felix Paul Kühne
macosx/playlist: iterate on cell dimensions, font size and have it respect the large-text setting
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=bf7c59034f2c5845717c3c9c1eacdbd272ddc136
---
modules/gui/macosx/UI/VLCLibraryWindow.xib | 14 +++++------
modules/gui/macosx/UI/VLCPlaylistTableCellView.xib | 14 +++++------
.../gui/macosx/extensions/NSFont+VLCAdditions.h | 2 ++
.../gui/macosx/extensions/NSFont+VLCAdditions.m | 11 ++++++++
modules/gui/macosx/library/VLCLibraryWindow.m | 5 ++--
.../gui/macosx/playlist/VLCPlaylistTableCellView.m | 29 +++++++++++++++++++++-
6 files changed, 58 insertions(+), 17 deletions(-)
diff --git a/modules/gui/macosx/UI/VLCLibraryWindow.xib b/modules/gui/macosx/UI/VLCLibraryWindow.xib
index 05a1187a45..646999ac2c 100644
--- a/modules/gui/macosx/UI/VLCLibraryWindow.xib
+++ b/modules/gui/macosx/UI/VLCLibraryWindow.xib
@@ -64,19 +64,19 @@
<rect key="frame" x="20" y="220" 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="151"/>
+ <rect key="frame" x="0.0" y="63" width="237" height="151"/>
<clipView key="contentView" drawsBackground="NO" copiesOnScroll="NO" id="Vdr-bg-tuS">
- <rect key="frame" x="0.0" y="0.0" width="217" height="151"/>
+ <rect key="frame" x="0.0" y="0.0" width="237" height="151"/>
<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="151"/>
+ <rect key="frame" x="0.0" y="0.0" width="237" height="151"/>
<autoresizingMask key="autoresizingMask"/>
<size key="intercellSpacing" width="3" height="2"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
<tableColumns>
- <tableColumn width="214" minWidth="40" maxWidth="1000" id="gkH-E7-Nn4">
+ <tableColumn width="234" minWidth="40" maxWidth="1000" id="gkH-E7-Nn4">
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
@@ -90,11 +90,11 @@
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<prototypeCellViews>
<tableCellView id="3Pj-5C-4K4">
- <rect key="frame" x="1" y="1" width="214" height="17"/>
+ <rect key="frame" x="1" y="1" width="234" height="17"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="dY4-Im-HRr">
- <rect key="frame" x="0.0" y="0.0" width="214" height="17"/>
+ <rect key="frame" x="0.0" y="0.0" width="234" height="17"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="vlq-wz-y8v">
<font key="font" metaFont="system"/>
@@ -205,7 +205,7 @@
<constraint firstItem="nAW-KH-ipk" firstAttribute="leading" secondItem="dus-WQ-AmE" secondAttribute="leading" constant="20" id="EUp-9J-Fid"/>
<constraint firstItem="qmL-Ar-cj1" firstAttribute="top" secondItem="dus-WQ-AmE" secondAttribute="top" constant="34" id="FfM-yJ-qCy"/>
<constraint firstItem="Z7y-D0-11Q" firstAttribute="top" secondItem="qmL-Ar-cj1" secondAttribute="bottom" constant="8" id="GIh-g3-rqJ"/>
- <constraint firstItem="Z7y-D0-11Q" firstAttribute="leading" secondItem="dus-WQ-AmE" secondAttribute="leading" constant="20" id="J3s-se-6bL"/>
+ <constraint firstItem="Z7y-D0-11Q" firstAttribute="leading" secondItem="dus-WQ-AmE" secondAttribute="leading" id="J3s-se-6bL"/>
<constraint firstItem="VFI-oW-dMZ" firstAttribute="top" secondItem="qmL-Ar-cj1" secondAttribute="bottom" id="JzJ-oS-dIb"/>
<constraint firstItem="8zF-Wo-H79" firstAttribute="centerY" secondItem="jg5-33-vH0" secondAttribute="centerY" id="Qdp-7K-RkD"/>
<constraint firstItem="244-FS-P3T" firstAttribute="centerY" secondItem="cih-xp-HmY" secondAttribute="centerY" id="XB9-iZ-mQY"/>
diff --git a/modules/gui/macosx/UI/VLCPlaylistTableCellView.xib b/modules/gui/macosx/UI/VLCPlaylistTableCellView.xib
index 3deb69a965..202d885689 100644
--- a/modules/gui/macosx/UI/VLCPlaylistTableCellView.xib
+++ b/modules/gui/macosx/UI/VLCPlaylistTableCellView.xib
@@ -13,7 +13,7 @@
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="ohB-P0-nCv">
- <rect key="frame" x="131" y="32" width="37" height="17"/>
+ <rect key="frame" x="142" y="32" width="37" height="17"/>
<textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="ZPw-XO-XD1">
<font key="font" usesAppearanceFont="YES"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
@@ -21,7 +21,7 @@
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="xJW-ps-ycn">
- <rect key="frame" x="131" y="46" width="37" height="17"/>
+ <rect key="frame" x="142" y="46" width="37" height="17"/>
<textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="aCe-ia-0Ww">
<font key="font" usesAppearanceFont="YES"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
@@ -29,17 +29,17 @@
</textFieldCell>
</textField>
<customView translatesAutoresizingMaskIntoConstraints="NO" id="Ydb-7n-5Cd" customClass="VLCImageView">
- <rect key="frame" x="3" y="3" width="120" height="75"/>
+ <rect key="frame" x="14" y="3" width="120" height="75"/>
<constraints>
<constraint firstAttribute="width" secondItem="Ydb-7n-5Cd" secondAttribute="height" multiplier="16:10" id="4aB-rs-m22"/>
</constraints>
</customView>
<imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="xnT-RR-pOf">
- <rect key="frame" x="3" y="28" width="24" height="24"/>
+ <rect key="frame" x="14" y="28" width="24" height="24"/>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="note" id="UzG-df-K2K"/>
</imageView>
<customView translatesAutoresizingMaskIntoConstraints="NO" id="97z-d7-S3D" customClass="VLCImageView">
- <rect key="frame" x="48" y="3" width="75" height="75"/>
+ <rect key="frame" x="59" y="3" width="75" height="75"/>
<constraints>
<constraint firstAttribute="width" secondItem="97z-d7-S3D" secondAttribute="height" multiplier="1:1" id="YBL-j9-anm"/>
</constraints>
@@ -56,7 +56,7 @@
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="TPv-k2-6XS">
- <rect key="frame" x="131" y="18" width="37" height="17"/>
+ <rect key="frame" x="142" y="18" width="37" height="17"/>
<textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="jZ4-pa-K3T">
<font key="font" usesAppearanceFont="YES"/>
<color key="textColor" name="secondaryLabelColor" catalog="System" colorSpace="catalog"/>
@@ -67,7 +67,7 @@
<constraints>
<constraint firstItem="ohB-P0-nCv" firstAttribute="leading" secondItem="Ydb-7n-5Cd" secondAttribute="trailing" constant="10" id="3wD-FP-vka"/>
<constraint firstItem="TPv-k2-6XS" firstAttribute="leading" secondItem="ohB-P0-nCv" secondAttribute="leading" id="4qb-9H-TVg"/>
- <constraint firstItem="Ydb-7n-5Cd" firstAttribute="leading" secondItem="c22-O7-iKe" secondAttribute="leading" constant="3" id="8hv-Qt-uAI"/>
+ <constraint firstItem="Ydb-7n-5Cd" firstAttribute="leading" secondItem="c22-O7-iKe" secondAttribute="leading" constant="14" id="8hv-Qt-uAI"/>
<constraint firstItem="xJW-ps-ycn" firstAttribute="leading" secondItem="ohB-P0-nCv" secondAttribute="leading" id="DYk-9g-adD"/>
<constraint firstItem="ohB-P0-nCv" firstAttribute="top" secondItem="xJW-ps-ycn" secondAttribute="bottom" constant="-3" id="Epo-on-wpL"/>
<constraint firstItem="97z-d7-S3D" firstAttribute="top" secondItem="c22-O7-iKe" secondAttribute="top" constant="3" id="FbP-R4-bAA"/>
diff --git a/modules/gui/macosx/extensions/NSFont+VLCAdditions.h b/modules/gui/macosx/extensions/NSFont+VLCAdditions.h
index 0d74b79c7c..f797317b5f 100644
--- a/modules/gui/macosx/extensions/NSFont+VLCAdditions.h
+++ b/modules/gui/macosx/extensions/NSFont+VLCAdditions.h
@@ -36,6 +36,8 @@ NS_ASSUME_NONNULL_BEGIN
+ (instancetype)VLClibraryButtonFont;
+ (instancetype)VLCplaylistLabelFont;
+ (instancetype)VLCplaylistSelectedItemLabelFont;
++ (instancetype)VLCsmallPlaylistLabelFont;
++ (instancetype)VLCsmallPlaylistSelectedItemLabelFont;
@end
diff --git a/modules/gui/macosx/extensions/NSFont+VLCAdditions.m b/modules/gui/macosx/extensions/NSFont+VLCAdditions.m
index 2a61bd649d..2da703aa1c 100644
--- a/modules/gui/macosx/extensions/NSFont+VLCAdditions.m
+++ b/modules/gui/macosx/extensions/NSFont+VLCAdditions.m
@@ -74,4 +74,15 @@
return [NSFont systemFontOfSize:13. weight:NSFontWeightBold];
}
++ (instancetype)VLCsmallPlaylistLabelFont
+{
+ return [NSFont systemFontOfSize:10. weight:NSFontWeightRegular];
+}
+
++ (instancetype)VLCsmallPlaylistSelectedItemLabelFont
+{
+ return [NSFont systemFontOfSize:10. weight:NSFontWeightBold];
+}
+
+
@end
diff --git a/modules/gui/macosx/library/VLCLibraryWindow.m b/modules/gui/macosx/library/VLCLibraryWindow.m
index 24bff720a5..9142868f07 100644
--- a/modules/gui/macosx/library/VLCLibraryWindow.m
+++ b/modules/gui/macosx/library/VLCLibraryWindow.m
@@ -56,7 +56,8 @@
const CGFloat VLCLibraryWindowMinimalWidth = 604.;
const CGFloat VLCLibraryWindowMinimalHeight = 307.;
-const CGFloat VLCLibraryWindowPlaylistRowHeight = 72.;
+const CGFloat VLCLibraryWindowLargePlaylistRowHeight = 60.;
+const CGFloat VLCLibraryWindowSmallPlaylistRowHeight = 45.;
const CGFloat VLCLibraryWindowSmallRowHeight = 24.;
const CGFloat VLCLibraryWindowLargeRowHeight = 50.;
const CGFloat VLCLibraryWindowDefaultPlaylistWidth = 340.;
@@ -158,7 +159,7 @@ const CGFloat VLCLibraryWindowDefaultPlaylistWidth = 340.;
_playlistTableView.dataSource = _playlistDataSource;
_playlistTableView.delegate = _playlistDataSource;
- _playlistTableView.rowHeight = VLCLibraryWindowPlaylistRowHeight;
+ _playlistTableView.rowHeight = config_GetInt("macosx-large-text") ? VLCLibraryWindowLargePlaylistRowHeight : VLCLibraryWindowSmallPlaylistRowHeight;
[_playlistTableView reloadData];
_libraryVideoDataSource = [[VLCLibraryVideoDataSource alloc] init];
diff --git a/modules/gui/macosx/playlist/VLCPlaylistTableCellView.m b/modules/gui/macosx/playlist/VLCPlaylistTableCellView.m
index 7e4e215237..bd635b4c63 100644
--- a/modules/gui/macosx/playlist/VLCPlaylistTableCellView.m
+++ b/modules/gui/macosx/playlist/VLCPlaylistTableCellView.m
@@ -26,14 +26,28 @@
#import "playlist/VLCPlaylistItem.h"
#import "views/VLCImageView.h"
+ at interface VLCPlaylistTableCellView ()
+{
+ NSFont *_displayedFont;
+ NSFont *_displayedBoldFont;
+}
+ at end
+
@implementation VLCPlaylistTableCellView
+- (void)awakeFromNib
+{
+ [self updateFontsBasedOnSetting];
+}
+
- (void)setRepresentsCurrentPlaylistItem:(BOOL)representsCurrentPlaylistItem
{
_representsCurrentPlaylistItem = representsCurrentPlaylistItem;
- NSFont *displayedFont = _representsCurrentPlaylistItem ? [NSFont VLCplaylistSelectedItemLabelFont] : [NSFont VLCplaylistLabelFont];
+ NSFont *displayedFont = _representsCurrentPlaylistItem ? _displayedBoldFont : _displayedFont;
self.mediaTitleTextField.font = displayedFont;
self.secondaryMediaTitleTextField.font = displayedFont;
+ self.artistTextField.font = _displayedFont;
+ self.durationTextField.font = _displayedFont;
}
- (void)setRepresentedPlaylistItem:(VLCPlaylistItem *)item
@@ -63,4 +77,17 @@
_representedPlaylistItem = item;
}
+- (void)updateFontsBasedOnSetting
+{
+ BOOL largeText = config_GetInt("macosx-large-text");
+ if (largeText) {
+ _displayedFont = [NSFont VLCplaylistLabelFont];
+ _displayedBoldFont = [NSFont VLCplaylistSelectedItemLabelFont];
+ } else {
+ _displayedFont = [NSFont VLCsmallPlaylistLabelFont];
+ _displayedBoldFont = [NSFont VLCsmallPlaylistSelectedItemLabelFont];
+ }
+ [self setRepresentsCurrentPlaylistItem:_representsCurrentPlaylistItem];
+}
+
@end
More information about the vlc-commits
mailing list