From ff756796eafb3a12eedc22119dcfeeaf5d9a0186 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Paul=20K=C3=BChne?= <felix@feepk.net> Date: Sun, 28 Apr 2019 12:35:31 +0200 Subject: [PATCH] macosx: add template classes for colors and fonts --- .../macosx/VLC.xcodeproj/project.pbxproj | 12 ++++ modules/gui/macosx/Makefile.am | 4 ++ .../macosx/extensions/NSColor+VLCAdditions.h | 38 ++++++++++++ .../macosx/extensions/NSColor+VLCAdditions.m | 57 +++++++++++++++++ .../macosx/extensions/NSFont+VLCAdditions.h | 39 ++++++++++++ .../macosx/extensions/NSFont+VLCAdditions.m | 62 +++++++++++++++++++ po/POTFILES.in | 4 ++ 7 files changed, 216 insertions(+) create mode 100644 modules/gui/macosx/extensions/NSColor+VLCAdditions.h create mode 100644 modules/gui/macosx/extensions/NSColor+VLCAdditions.m create mode 100644 modules/gui/macosx/extensions/NSFont+VLCAdditions.h create mode 100644 modules/gui/macosx/extensions/NSFont+VLCAdditions.m diff --git a/extras/package/macosx/VLC.xcodeproj/project.pbxproj b/extras/package/macosx/VLC.xcodeproj/project.pbxproj index 8907b37bf25e..d9c698f77837 100644 --- a/extras/package/macosx/VLC.xcodeproj/project.pbxproj +++ b/extras/package/macosx/VLC.xcodeproj/project.pbxproj @@ -103,6 +103,8 @@ 7D0F63FF2201F63400FDB91F /* VLCPlaylistTableCellView.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D0F63FE2201F63400FDB91F /* VLCPlaylistTableCellView.m */; }; 7D0F64062202047900FDB91F /* VLCLibraryCollectionViewItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D0F64042202047900FDB91F /* VLCLibraryCollectionViewItem.m */; }; 7D0F640C2202163E00FDB91F /* VLCPlaylistDataSource.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D0F640B2202163E00FDB91F /* VLCPlaylistDataSource.m */; }; + 7D28E6362275B4820098D30E /* NSColor+VLCAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D28E6352275B4820098D30E /* NSColor+VLCAdditions.m */; }; + 7D28E6392275B7340098D30E /* NSFont+VLCAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D28E6382275B7340098D30E /* NSFont+VLCAdditions.m */; }; 7D2E0EDB20CD204D0033A221 /* VLCWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D2E0ED920CD204D0033A221 /* VLCWindow.m */; }; 7D2E0EDE20CD206F0033A221 /* VLCVideoWindowCommon.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D2E0EDD20CD206F0033A221 /* VLCVideoWindowCommon.m */; }; 7D445D812202524000263D34 /* VLCPlaylistController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D445D802202524000263D34 /* VLCPlaylistController.m */; }; @@ -441,6 +443,10 @@ 7D0F64092202058700FDB91F /* libraryCellGradient@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "libraryCellGradient@2x.png"; path = "../librarywindow/libraryCellGradient@2x.png"; sourceTree = "<group>"; }; 7D0F640A2202163E00FDB91F /* VLCPlaylistDataSource.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCPlaylistDataSource.h; sourceTree = "<group>"; }; 7D0F640B2202163E00FDB91F /* VLCPlaylistDataSource.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCPlaylistDataSource.m; sourceTree = "<group>"; }; + 7D28E6342275B4820098D30E /* NSColor+VLCAdditions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSColor+VLCAdditions.h"; sourceTree = "<group>"; }; + 7D28E6352275B4820098D30E /* NSColor+VLCAdditions.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSColor+VLCAdditions.m"; sourceTree = "<group>"; }; + 7D28E6372275B7340098D30E /* NSFont+VLCAdditions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSFont+VLCAdditions.h"; sourceTree = "<group>"; }; + 7D28E6382275B7340098D30E /* NSFont+VLCAdditions.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSFont+VLCAdditions.m"; sourceTree = "<group>"; }; 7D2E0ED920CD204D0033A221 /* VLCWindow.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VLCWindow.m; sourceTree = "<group>"; }; 7D2E0EDA20CD204D0033A221 /* VLCWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VLCWindow.h; sourceTree = "<group>"; }; 7D2E0EDC20CD206F0033A221 /* VLCVideoWindowCommon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VLCVideoWindowCommon.h; sourceTree = "<group>"; }; @@ -930,6 +936,10 @@ 6B397C4E216C8EB200403ED0 /* NSString+Helpers.m */, 6B7F1FDD1F07DA920002BDD8 /* VLCHexNumberFormatter.h */, 6B7F1FDE1F07DA920002BDD8 /* VLCHexNumberFormatter.m */, + 7D28E6342275B4820098D30E /* NSColor+VLCAdditions.h */, + 7D28E6352275B4820098D30E /* NSColor+VLCAdditions.m */, + 7D28E6372275B7340098D30E /* NSFont+VLCAdditions.h */, + 7D28E6382275B7340098D30E /* NSFont+VLCAdditions.m */, ); path = extensions; sourceTree = "<group>"; @@ -1618,6 +1628,7 @@ 7D445D8E2203375100263D34 /* VLCPlaylistMenuController.m in Sources */, 1C31139A1E508C6900D4DD76 /* VLCBookmarksWindowController.m in Sources */, 6B0AB0F01F1AC8B3003A1B4E /* VLCSlider.m in Sources */, + 7D28E6362275B4820098D30E /* NSColor+VLCAdditions.m in Sources */, 6BF5C5041EFE66EF008A9C12 /* VLCHUDTableView.m in Sources */, 6BBB05E01EEFF165003A1019 /* VLCHUDTableCornerView.m in Sources */, 1C31139D1E508C6900D4DD76 /* VLCControlsBarCommon.m in Sources */, @@ -1637,6 +1648,7 @@ 7D66D4362200BC340040D04A /* VLCClickerManager.m in Sources */, 1C3113B11E508C6900D4DD76 /* VLCFSPanelDraggableView.m in Sources */, 1C3113B41E508C6900D4DD76 /* VLCPlaybackContinuityController.m in Sources */, + 7D28E6392275B7340098D30E /* NSFont+VLCAdditions.m in Sources */, 1C3113B61E508C6900D4DD76 /* VLCMain+OldPrefs.m in Sources */, 1C3113B81E508C6900D4DD76 /* VLCMain.m in Sources */, 1CAC3EE820CD1B3B00613DB2 /* VLCVideoOutputProvider.m in Sources */, diff --git a/modules/gui/macosx/Makefile.am b/modules/gui/macosx/Makefile.am index 425fc14523b3..658215ceb480 100644 --- a/modules/gui/macosx/Makefile.am +++ b/modules/gui/macosx/Makefile.am @@ -30,6 +30,10 @@ libmacosx_plugin_la_SOURCES = \ gui/macosx/coreinteraction/VLCHotkeysController.m \ gui/macosx/coreinteraction/VLCVideoFilterHelper.h \ gui/macosx/coreinteraction/VLCVideoFilterHelper.m \ + gui/macosx/extensions/NSColor+VLCAdditions.h \ + gui/macosx/extensions/NSColor+VLCAdditions.m \ + gui/macosx/extensions/NSFont+VLCAdditions.h \ + gui/macosx/extensions/NSFont+VLCAdditions.m \ gui/macosx/extensions/NSScreen+VLCAdditions.h \ gui/macosx/extensions/NSScreen+VLCAdditions.m \ gui/macosx/extensions/NSSound+VLCAdditions.h \ diff --git a/modules/gui/macosx/extensions/NSColor+VLCAdditions.h b/modules/gui/macosx/extensions/NSColor+VLCAdditions.h new file mode 100644 index 000000000000..0c46aff91a7b --- /dev/null +++ b/modules/gui/macosx/extensions/NSColor+VLCAdditions.h @@ -0,0 +1,38 @@ +/***************************************************************************** + * NSColor+VLCAdditions.h: MacOS X interface module + ***************************************************************************** + * Copyright (C) 2019 VLC authors and VideoLAN + * + * Authors: Felix Paul Kühne <fkuehne # videolan -dot- org> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. + *****************************************************************************/ + +#import <Cocoa/Cocoa.h> + +NS_ASSUME_NONNULL_BEGIN + +@interface NSColor (VLCAdditions) + ++ (instancetype)VLClibraryHighlightColor; ++ (instancetype)VLClibraryLightTitleColor; ++ (instancetype)VLClibraryDarkTitleColor; ++ (instancetype)VLClibrarySubtitleColor; ++ (instancetype)VLClibrarySeparatorLightColor; ++ (instancetype)VLClibrarySeparatorDarkColor; + +@end + +NS_ASSUME_NONNULL_END diff --git a/modules/gui/macosx/extensions/NSColor+VLCAdditions.m b/modules/gui/macosx/extensions/NSColor+VLCAdditions.m new file mode 100644 index 000000000000..33b3723fa176 --- /dev/null +++ b/modules/gui/macosx/extensions/NSColor+VLCAdditions.m @@ -0,0 +1,57 @@ +/***************************************************************************** + * NSColor+VLCAdditions.m: MacOS X interface module + ***************************************************************************** + * Copyright (C) 2019 VLC authors and VideoLAN + * + * Authors: Felix Paul Kühne <fkuehne # videolan -dot- org> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. + *****************************************************************************/ + +#import "NSColor+VLCAdditions.h" + +@implementation NSColor (VLCAdditions) + ++ (instancetype)VLClibraryHighlightColor +{ + return [NSColor colorWithRed:0.96 green:0.5 blue:.0 alpha:1.]; +} + ++ (instancetype)VLClibraryLightTitleColor +{ + return [NSColor colorWithRed:0.15 green:0.16 blue:0.17 alpha:1.]; +} + ++ (instancetype)VLClibraryDarkTitleColor +{ + return [NSColor colorWithRed:0.85 green:0.84 blue:0.83 alpha:1.]; +} + ++ (instancetype)VLClibrarySubtitleColor +{ + return [NSColor colorWithRed:0.52 green:0.57 blue:0.61 alpha:1.]; +} + ++ (instancetype)VLClibrarySeparatorLightColor +{ + return [NSColor colorWithRed:0.89 green:0.91 blue:0.93 alpha:1.]; +} + ++ (instancetype)VLClibrarySeparatorDarkColor +{ + return [NSColor colorWithRed:0.11 green:0.09 blue:0.07 alpha:1.]; +} + +@end diff --git a/modules/gui/macosx/extensions/NSFont+VLCAdditions.h b/modules/gui/macosx/extensions/NSFont+VLCAdditions.h new file mode 100644 index 000000000000..d7821528a65e --- /dev/null +++ b/modules/gui/macosx/extensions/NSFont+VLCAdditions.h @@ -0,0 +1,39 @@ +/***************************************************************************** + * NSFont+VLCAdditions.h: MacOS X interface module + ***************************************************************************** + * Copyright (C) 2019 VLC authors and VideoLAN + * + * Authors: Felix Paul Kühne <fkuehne # videolan -dot- org> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. + *****************************************************************************/ + +#import <Cocoa/Cocoa.h> + +NS_ASSUME_NONNULL_BEGIN + +@interface NSFont (VLCAdditions) + ++ (instancetype)VLClibrarySectionHeaderFont; ++ (instancetype)VLClibraryHighlightCellTitleFont; ++ (instancetype)VLClibraryHighlightCellSubtitleFont; ++ (instancetype)VLClibraryHighlightCellHighlightLabelFont; ++ (instancetype)VLClibraryCellTitleFont; ++ (instancetype)VLClibraryCellSubtitleFont; ++ (instancetype)VLClibraryCellAnnotationFont; + +@end + +NS_ASSUME_NONNULL_END diff --git a/modules/gui/macosx/extensions/NSFont+VLCAdditions.m b/modules/gui/macosx/extensions/NSFont+VLCAdditions.m new file mode 100644 index 000000000000..ad81f37ef77d --- /dev/null +++ b/modules/gui/macosx/extensions/NSFont+VLCAdditions.m @@ -0,0 +1,62 @@ +/***************************************************************************** + * NSFont+VLCAdditions.m: MacOS X interface module + ***************************************************************************** + * Copyright (C) 2019 VLC authors and VideoLAN + * + * Authors: Felix Paul Kühne <fkuehne # videolan -dot- org> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. + *****************************************************************************/ + +#import "NSFont+VLCAdditions.h" + +@implementation NSFont (VLCAdditions) + ++ (instancetype)VLClibrarySectionHeaderFont +{ + return [NSFont systemFontOfSize:24. weight:NSFontWeightBold]; +} + ++ (instancetype)VLClibraryHighlightCellTitleFont +{ + return [NSFont systemFontOfSize:21. weight:NSFontWeightMedium]; +} + ++ (instancetype)VLClibraryHighlightCellSubtitleFont +{ + return [NSFont systemFontOfSize:13. weight:NSFontWeightSemibold]; +} + ++ (instancetype)VLClibraryHighlightCellHighlightLabelFont +{ + return [NSFont systemFontOfSize:11. weight:NSFontWeightBold]; +} + ++ (instancetype)VLClibraryCellTitleFont +{ + return [NSFont systemFontOfSize:17. weight:NSFontWeightMedium]; +} + ++ (instancetype)VLClibraryCellSubtitleFont +{ + return [NSFont systemFontOfSize:13. weight:NSFontWeightSemibold]; +} + ++ (instancetype)VLClibraryCellAnnotationFont +{ + return [NSFont systemFontOfSize:15. weight:NSFontWeightBold]; +} + +@end diff --git a/po/POTFILES.in b/po/POTFILES.in index 532066fed128..3e9fdaf746d2 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -452,6 +452,10 @@ modules/gui/macosx/coreinteraction/VLCHotkeysController.h modules/gui/macosx/coreinteraction/VLCHotkeysController.m modules/gui/macosx/coreinteraction/VLCVideoFilterHelper.h modules/gui/macosx/coreinteraction/VLCVideoFilterHelper.m +modules/gui/macosx/extensions/NSColor+VLCAdditions.h +modules/gui/macosx/extensions/NSColor+VLCAdditions.m +modules/gui/macosx/extensions/NSFont+VLCAdditions.h +modules/gui/macosx/extensions/NSFont+VLCAdditions.m modules/gui/macosx/extensions/NSScreen+VLCAdditions.h modules/gui/macosx/extensions/NSScreen+VLCAdditions.m modules/gui/macosx/extensions/NSSound+VLCAdditions.h -- GitLab