[vlc-commits] macosx/NSView category: split to a file of its own

Felix Paul Kühne git at videolan.org
Tue May 7 12:38:08 CEST 2019


vlc | branch: master | Felix Paul Kühne <felix at feepk.net> | Tue May  7 11:44:27 2019 +0200| [4a9a7e4bd85248c44f405e13b058e8f98b8d019e] | committer: Felix Paul Kühne

macosx/NSView category: split to a file of its own

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

 .../package/macosx/VLC.xcodeproj/project.pbxproj   |  6 +++
 modules/gui/macosx/Makefile.am                     |  2 +
 .../gui/macosx/extensions/NSView+VLCAdditions.h    | 34 +++++++++++++++
 .../gui/macosx/extensions/NSView+VLCAdditions.m    | 49 ++++++++++++++++++++++
 modules/gui/macosx/extensions/misc.h               |  8 ----
 modules/gui/macosx/extensions/misc.m               | 25 -----------
 .../panels/VLCAudioEffectsWindowController.m       |  1 +
 .../VLCConvertAndSaveWindowController.m            |  2 +-
 po/POTFILES.in                                     |  2 +
 9 files changed, 95 insertions(+), 34 deletions(-)

diff --git a/extras/package/macosx/VLC.xcodeproj/project.pbxproj b/extras/package/macosx/VLC.xcodeproj/project.pbxproj
index 74fa01979c..202e68201c 100644
--- a/extras/package/macosx/VLC.xcodeproj/project.pbxproj
+++ b/extras/package/macosx/VLC.xcodeproj/project.pbxproj
@@ -108,6 +108,7 @@
 		7D2E0EDB20CD204D0033A221 /* VLCWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D2E0ED920CD204D0033A221 /* VLCWindow.m */; };
 		7D2E0EDE20CD206F0033A221 /* VLCVideoWindowCommon.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D2E0EDD20CD206F0033A221 /* VLCVideoWindowCommon.m */; };
 		7D2FFA40227B8A5B0085D649 /* VLCLinearProgressIndicator.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D2FFA3F227B8A5B0085D649 /* VLCLinearProgressIndicator.m */; };
+		7D404ABF2281892C00B28EF4 /* NSView+VLCAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D404ABE2281892C00B28EF4 /* NSView+VLCAdditions.m */; };
 		7D445D812202524000263D34 /* VLCPlaylistController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D445D802202524000263D34 /* VLCPlaylistController.m */; };
 		7D445D842202524D00263D34 /* VLCPlaylistItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D445D832202524D00263D34 /* VLCPlaylistItem.m */; };
 		7D445D872202574B00263D34 /* VLCPlaylistModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D445D862202574B00263D34 /* VLCPlaylistModel.m */; };
@@ -463,6 +464,8 @@
 		7D2E0EDD20CD206F0033A221 /* VLCVideoWindowCommon.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VLCVideoWindowCommon.m; sourceTree = "<group>"; };
 		7D2FFA3E227B8A5B0085D649 /* VLCLinearProgressIndicator.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCLinearProgressIndicator.h; sourceTree = "<group>"; };
 		7D2FFA3F227B8A5B0085D649 /* VLCLinearProgressIndicator.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCLinearProgressIndicator.m; sourceTree = "<group>"; };
+		7D404ABD2281892C00B28EF4 /* NSView+VLCAdditions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSView+VLCAdditions.h"; sourceTree = "<group>"; };
+		7D404ABE2281892C00B28EF4 /* NSView+VLCAdditions.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSView+VLCAdditions.m"; sourceTree = "<group>"; };
 		7D445D7F2202524000263D34 /* VLCPlaylistController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCPlaylistController.h; sourceTree = "<group>"; };
 		7D445D802202524000263D34 /* VLCPlaylistController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCPlaylistController.m; sourceTree = "<group>"; };
 		7D445D822202524D00263D34 /* VLCPlaylistItem.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCPlaylistItem.h; sourceTree = "<group>"; };
@@ -956,6 +959,8 @@
 				7D28E6352275B4820098D30E /* NSColor+VLCAdditions.m */,
 				7D28E6372275B7340098D30E /* NSFont+VLCAdditions.h */,
 				7D28E6382275B7340098D30E /* NSFont+VLCAdditions.m */,
+				7D404ABD2281892C00B28EF4 /* NSView+VLCAdditions.h */,
+				7D404ABE2281892C00B28EF4 /* NSView+VLCAdditions.m */,
 			);
 			path = extensions;
 			sourceTree = "<group>";
@@ -1645,6 +1650,7 @@
 				1C3113901E508C6900D4DD76 /* VLCHelpWindowController.m in Sources */,
 				1C3113921E508C6900D4DD76 /* VLCAddonListItem.m in Sources */,
 				7DFBDCB7226CDFD600B700A5 /* VLCImageView.m in Sources */,
+				7D404ABF2281892C00B28EF4 /* NSView+VLCAdditions.m in Sources */,
 				7DE9C7DD220728420089108F /* VLCPlayerController.m in Sources */,
 				1C3113941E508C6900D4DD76 /* VLCAddonsWindowController.m in Sources */,
 				7D2E0EDE20CD206F0033A221 /* VLCVideoWindowCommon.m in Sources */,
diff --git a/modules/gui/macosx/Makefile.am b/modules/gui/macosx/Makefile.am
index 84c887b340..499d0bf620 100644
--- a/modules/gui/macosx/Makefile.am
+++ b/modules/gui/macosx/Makefile.am
@@ -40,6 +40,8 @@ libmacosx_plugin_la_SOURCES = \
 	gui/macosx/extensions/NSSound+VLCAdditions.m \
 	gui/macosx/extensions/NSString+Helpers.h \
 	gui/macosx/extensions/NSString+Helpers.m \
+	gui/macosx/extensions/NSView+VLCAdditions.h \
+	gui/macosx/extensions/NSView+VLCAdditions.m \
 	gui/macosx/extensions/VLCHexNumberFormatter.h \
 	gui/macosx/extensions/VLCHexNumberFormatter.m \
 	gui/macosx/extensions/misc.h \
diff --git a/modules/gui/macosx/extensions/NSView+VLCAdditions.h b/modules/gui/macosx/extensions/NSView+VLCAdditions.h
new file mode 100644
index 0000000000..a97ad3c76f
--- /dev/null
+++ b/modules/gui/macosx/extensions/NSView+VLCAdditions.h
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * NSView+VLCAdditions.h: MacOS X interface module
+ *****************************************************************************
+ * Copyright (C) 2013-2019 VLC authors and VideoLAN
+ *
+ * Authors: David Fuhrmann <dfuhrmann # videolan.org>
+ *          Felix Paul Kühne <fkuehne at 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
+
+ at interface NSView (VLCAdditions)
+
+- (void)enableSubviews:(BOOL)enabled;
+
+ at end
+
+NS_ASSUME_NONNULL_END
diff --git a/modules/gui/macosx/extensions/NSView+VLCAdditions.m b/modules/gui/macosx/extensions/NSView+VLCAdditions.m
new file mode 100644
index 0000000000..2609f0bd4f
--- /dev/null
+++ b/modules/gui/macosx/extensions/NSView+VLCAdditions.m
@@ -0,0 +1,49 @@
+/*****************************************************************************
+ * NSView+VLCAdditions.m: MacOS X interface module
+ *****************************************************************************
+ * Copyright (C) 2013-2019 VLC authors and VideoLAN
+ *
+ * Authors: David Fuhrmann <dfuhrmann # videolan.org>
+ *          Felix Paul Kühne <fkuehne at 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 "NSView+VLCAdditions.h"
+
+ at implementation NSView (VLCAdditions)
+
+- (void)enableSubviews:(BOOL)enabled
+{
+    for (NSView *view in [self subviews]) {
+        [view enableSubviews:enabled];
+
+        // enable NSControl
+        if ([view respondsToSelector:@selector(setEnabled:)]) {
+            [(NSControl *)view setEnabled:enabled];
+        }
+        // also "enable / disable" text views
+        if ([view respondsToSelector:@selector(setTextColor:)]) {
+            if (enabled == NO) {
+                [(NSTextField *)view setTextColor:[NSColor disabledControlTextColor]];
+            } else {
+                [(NSTextField *)view setTextColor:[NSColor controlTextColor]];
+            }
+        }
+
+    }
+}
+
+ at end
diff --git a/modules/gui/macosx/extensions/misc.h b/modules/gui/macosx/extensions/misc.h
index 531e889b66..afe4fdfe9b 100644
--- a/modules/gui/macosx/extensions/misc.h
+++ b/modules/gui/macosx/extensions/misc.h
@@ -68,14 +68,6 @@
 @end
 
 /*****************************************************************************
- * NSView addition
- *****************************************************************************/
-
- at interface NSView (EnableSubviews)
-- (void)enableSubviews:(BOOL)b_enable;
- at end
-
-/*****************************************************************************
  * VLCByteCountFormatter addition
  *****************************************************************************/
 
diff --git a/modules/gui/macosx/extensions/misc.m b/modules/gui/macosx/extensions/misc.m
index 24abc60fec..793346e956 100644
--- a/modules/gui/macosx/extensions/misc.m
+++ b/modules/gui/macosx/extensions/misc.m
@@ -195,31 +195,6 @@
 
 @end
 
- at implementation NSView (EnableSubviews)
-
-- (void)enableSubviews:(BOOL)b_enable
-{
-    for (NSView *o_view in [self subviews]) {
-        [o_view enableSubviews:b_enable];
-
-        // enable NSControl
-        if ([o_view respondsToSelector:@selector(setEnabled:)]) {
-            [(NSControl *)o_view setEnabled:b_enable];
-        }
-        // also "enable / disable" text views
-        if ([o_view respondsToSelector:@selector(setTextColor:)]) {
-            if (b_enable == NO) {
-                [(NSTextField *)o_view setTextColor:[NSColor disabledControlTextColor]];
-            } else {
-                [(NSTextField *)o_view setTextColor:[NSColor controlTextColor]];
-            }
-        }
-
-    }
-}
-
- at end
-
 /*****************************************************************************
  * VLCByteCountFormatter addition
  *****************************************************************************/
diff --git a/modules/gui/macosx/panels/VLCAudioEffectsWindowController.m b/modules/gui/macosx/panels/VLCAudioEffectsWindowController.m
index 8dd78e2518..7bf2f0f6ef 100644
--- a/modules/gui/macosx/panels/VLCAudioEffectsWindowController.m
+++ b/modules/gui/macosx/panels/VLCAudioEffectsWindowController.m
@@ -34,6 +34,7 @@
 #import "../../../audio_filter/equalizer_presets.h"
 
 #import "extensions/NSString+Helpers.h"
+#import "extensions/NSView+VLCAdditions.h"
 #import "main/VLCMain.h"
 #import "main/CompatibilityFixes.h"
 #import "panels/dialogs/VLCPopupPanelController.h"
diff --git a/modules/gui/macosx/windows/convertandsave/VLCConvertAndSaveWindowController.m b/modules/gui/macosx/windows/convertandsave/VLCConvertAndSaveWindowController.m
index 223d92bb5a..4c13a4c48e 100644
--- a/modules/gui/macosx/windows/convertandsave/VLCConvertAndSaveWindowController.m
+++ b/modules/gui/macosx/windows/convertandsave/VLCConvertAndSaveWindowController.m
@@ -22,7 +22,7 @@
 
 #import "VLCConvertAndSaveWindowController.h"
 
-#import "extensions/misc.h"
+#import "extensions/NSView+VLCAdditions.h"
 #import "main/VLCMain.h"
 #import "panels/dialogs/VLCPopupPanelController.h"
 #import "panels/dialogs/VLCTextfieldPanelController.h"
diff --git a/po/POTFILES.in b/po/POTFILES.in
index a665fbd8d4..b7dbe7f1a6 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -462,6 +462,8 @@ modules/gui/macosx/extensions/NSSound+VLCAdditions.h
 modules/gui/macosx/extensions/NSSound+VLCAdditions.m
 modules/gui/macosx/extensions/NSString+Helpers.h
 modules/gui/macosx/extensions/NSString+Helpers.m
+modules/gui/macosx/extensions/NSView+VLCAdditions.h
+modules/gui/macosx/extensions/NSView+VLCAdditions.m
 modules/gui/macosx/extensions/VLCHexNumberFormatter.h
 modules/gui/macosx/extensions/VLCHexNumberFormatter.m
 modules/gui/macosx/extensions/misc.h



More information about the vlc-commits mailing list