vlc | branch: master | Marvin Scholz <[email protected]> | Thu Jun 1 11:59:51 2017 +0200| [d152a621f17901968af7d5bf7cfd03e842ad6651] | committer: Marvin Scholz
macOS: Move VLCTimeField out of misc This moves the VLCTimeField class in their own files, out of misc. > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d152a621f17901968af7d5bf7cfd03e842ad6651 --- .../package/macosx/VLC.xcodeproj/project.pbxproj | 6 ++ modules/gui/macosx/Makefile.am | 3 +- modules/gui/macosx/VLCControlsBarCommon.h | 2 + modules/gui/macosx/VLCFSPanelController.h | 2 +- modules/gui/macosx/VLCTimeField.h | 40 +++++++++++ modules/gui/macosx/VLCTimeField.m | 83 ++++++++++++++++++++++ modules/gui/macosx/misc.h | 14 ---- modules/gui/macosx/misc.m | 60 ---------------- 8 files changed, 134 insertions(+), 76 deletions(-) diff --git a/extras/package/macosx/VLC.xcodeproj/project.pbxproj b/extras/package/macosx/VLC.xcodeproj/project.pbxproj index 3a5021bb32..8b2e32b7bd 100644 --- a/extras/package/macosx/VLC.xcodeproj/project.pbxproj +++ b/extras/package/macosx/VLC.xcodeproj/project.pbxproj @@ -80,6 +80,7 @@ 6B81662A1EBFC34300C26F1B /* VLCDefaultValueSliderCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6A499D1DFD9B23009128AC /* VLCDefaultValueSliderCell.m */; }; 6B81662B1EBFC35D00C26F1B /* VLCVoutWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = E0C2583F161B593D00185AAD /* VLCVoutWindowController.m */; }; 6B81662C1EBFC38100C26F1B /* VLCUIWidgets.m in Sources */ = {isa = PBXBuildFile; fileRef = 5CCED71514C0D4A90057F8D1 /* VLCUIWidgets.m */; }; + 6BF093F91EE0182B0049D8B0 /* VLCTimeField.m in Sources */ = {isa = PBXBuildFile; fileRef = 6BF093F81EE0182B0049D8B0 /* VLCTimeField.m */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -688,6 +689,8 @@ 6BBBB8B61D114628001BD9BA /* VLCRendererDiscovery.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VLCRendererDiscovery.m; sourceTree = "<group>"; }; 6BCB59091DA247CD009BCA66 /* VLCFSPanelController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VLCFSPanelController.h; sourceTree = "<group>"; }; 6BCB590A1DA247CD009BCA66 /* VLCFSPanelController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VLCFSPanelController.m; sourceTree = "<group>"; }; + 6BF093F71EE0182B0049D8B0 /* VLCTimeField.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VLCTimeField.h; sourceTree = "<group>"; }; + 6BF093F81EE0182B0049D8B0 /* VLCTimeField.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VLCTimeField.m; sourceTree = "<group>"; }; 6BF557CF1E4E0E2500C03C9D /* VLCPauseTemplate.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; name = VLCPauseTemplate.pdf; path = "Button-Icons/VLCPauseTemplate.pdf"; sourceTree = "<group>"; }; 7D5678EB1D5BA1DC002698F3 /* VLCApplication.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VLCApplication.h; sourceTree = "<group>"; }; 7D5678EC1D5BA1DC002698F3 /* VLCApplication.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VLCApplication.m; sourceTree = "<group>"; }; @@ -910,6 +913,8 @@ CC017A0C14A4C8AF00C09A4F /* VLCMainWindowTitleView.m */, 8ED6C27F03E2EB1C0059A3A7 /* misc.h */, 8ED6C28003E2EB1C0059A3A7 /* misc.m */, + 6BF093F71EE0182B0049D8B0 /* VLCTimeField.h */, + 6BF093F81EE0182B0049D8B0 /* VLCTimeField.m */, 6B4D50A51E7AB52C004479B5 /* NSScreen+VLCAdditions.h */, 6B4D50A61E7AB52C004479B5 /* NSScreen+VLCAdditions.m */, 6B4D50941E7A7D16004479B5 /* NSSound+VLCAdditions.h */, @@ -1842,6 +1847,7 @@ 1CFE8D591EA0D42A00E94451 /* VLCErrorWindowController.m in Sources */, 1C3114051E508C8800D4DD76 /* SideBarItem.m in Sources */, 6B4D50961E7A7D16004479B5 /* NSSound+VLCAdditions.m in Sources */, + 6BF093F91EE0182B0049D8B0 /* VLCTimeField.m in Sources */, 1C3114071E508C8800D4DD76 /* PXSourceList.m in Sources */, 1C31140B1E508C8800D4DD76 /* SPInvocationGrabbing.m in Sources */, 1C31140D1E508C8800D4DD76 /* SPMediaKeyTap.m in Sources */, diff --git a/modules/gui/macosx/Makefile.am b/modules/gui/macosx/Makefile.am index 30852650dc..3c718afa94 100644 --- a/modules/gui/macosx/Makefile.am +++ b/modules/gui/macosx/Makefile.am @@ -90,7 +90,8 @@ libmacosx_plugin_la_SOURCES = \ gui/macosx/VLCDefaultValueSlider.h gui/macosx/VLCDefaultValueSlider.m \ gui/macosx/VLCDefaultValueSliderCell.h gui/macosx/VLCDefaultValueSliderCell.m \ gui/macosx/VLCHUDImageButton.h gui/macosx/VLCHUDImageButton.m \ - gui/macosx/VLCHUDToggleButton.h gui/macosx/VLCHUDToggleButton.m + gui/macosx/VLCHUDToggleButton.h gui/macosx/VLCHUDToggleButton.m \ + gui/macosx/VLCTimeField.h gui/macosx/VLCTimeField.m # User interface compilation diff --git a/modules/gui/macosx/VLCControlsBarCommon.h b/modules/gui/macosx/VLCControlsBarCommon.h index e28601245e..e2d863912a 100644 --- a/modules/gui/macosx/VLCControlsBarCommon.h +++ b/modules/gui/macosx/VLCControlsBarCommon.h @@ -25,6 +25,8 @@ #import <Cocoa/Cocoa.h> #import "misc.h" +#import "VLCTimeField.h" + @class VLCResizeControl; /***************************************************************************** diff --git a/modules/gui/macosx/VLCFSPanelController.h b/modules/gui/macosx/VLCFSPanelController.h index e1f61947c1..5b86759b0b 100644 --- a/modules/gui/macosx/VLCFSPanelController.h +++ b/modules/gui/macosx/VLCFSPanelController.h @@ -26,9 +26,9 @@ #import <Cocoa/Cocoa.h> -#import "misc.h" #import "Windows.h" #import "VLCDefaultValueSlider.h" +#import "VLCTimeField.h" @interface VLCFSPanelController : NSWindowController diff --git a/modules/gui/macosx/VLCTimeField.h b/modules/gui/macosx/VLCTimeField.h new file mode 100644 index 0000000000..c6d81e6d6a --- /dev/null +++ b/modules/gui/macosx/VLCTimeField.h @@ -0,0 +1,40 @@ +/***************************************************************************** + * VLCTimeField.h: NSTextField subclass for playback time fields + ***************************************************************************** + * Copyright (C) 2003-2017 VLC authors and VideoLAN + * $Id$ + * + * Authors: Jon Lech Johansen <[email protected]> + * Felix Paul Kühne <fkuehne at videolan dot org> + * Marvin Scholz <epirat07 at gmail dot com> + * + * 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> + +/***************************************************************************** + * VLCTimeField interface + ***************************************************************************** + * we need the implementation to catch our click-event in the controller window + *****************************************************************************/ + +@interface VLCTimeField : NSTextField + +@property (readonly) BOOL timeRemaining; + +- (void)setRemainingIdentifier:(NSString *)o_string; + +@end diff --git a/modules/gui/macosx/VLCTimeField.m b/modules/gui/macosx/VLCTimeField.m new file mode 100644 index 0000000000..91d515a3c6 --- /dev/null +++ b/modules/gui/macosx/VLCTimeField.m @@ -0,0 +1,83 @@ +/***************************************************************************** + * VLCTimeField.m: NSTextField subclass for playback time fields + ***************************************************************************** + * Copyright (C) 2003-2017 VLC authors and VideoLAN + * $Id$ + * + * Authors: Jon Lech Johansen <[email protected]> + * Felix Paul Kühne <fkuehne at videolan dot org> + * Marvin Scholz <epirat07 at gmail dot com> + * + * 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 "VLCTimeField.h" + +#import "VLCMain.h" +#import "VLCMainMenu.h" + +@interface VLCTimeField () +{ + NSString *o_remaining_identifier; + BOOL b_time_remaining; +} +@end + +@implementation VLCTimeField ++ (void)initialize +{ + NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; + NSDictionary *appDefaults = [NSDictionary dictionaryWithObjectsAndKeys: + @"NO", @"DisplayTimeAsTimeRemaining", + @"YES", @"DisplayFullscreenTimeAsTimeRemaining", + nil]; + + [defaults registerDefaults:appDefaults]; +} + + +- (void)setRemainingIdentifier:(NSString *)o_string +{ + o_remaining_identifier = o_string; + b_time_remaining = [[NSUserDefaults standardUserDefaults] boolForKey:o_remaining_identifier]; +} + +- (void)mouseDown: (NSEvent *)ourEvent +{ + if ( [ourEvent clickCount] > 1 ) + [[[VLCMain sharedInstance] mainMenu] goToSpecificTime: nil]; + else + { + if (o_remaining_identifier) { + b_time_remaining = [[NSUserDefaults standardUserDefaults] boolForKey:o_remaining_identifier]; + b_time_remaining = !b_time_remaining; + [[NSUserDefaults standardUserDefaults] setObject:(b_time_remaining ? @"YES" : @"NO") forKey:o_remaining_identifier]; + } else { + b_time_remaining = !b_time_remaining; + } + } + + [[self nextResponder] mouseDown:ourEvent]; +} + +- (BOOL)timeRemaining +{ + if (o_remaining_identifier) + return [[NSUserDefaults standardUserDefaults] boolForKey:o_remaining_identifier]; + else + return b_time_remaining; +} + +@end diff --git a/modules/gui/macosx/misc.h b/modules/gui/macosx/misc.h index 80b6fcfe0d..5c566eb15e 100644 --- a/modules/gui/macosx/misc.h +++ b/modules/gui/macosx/misc.h @@ -109,20 +109,6 @@ @end /***************************************************************************** - * VLCTimeField interface - ***************************************************************************** - * we need the implementation to catch our click-event in the controller window - *****************************************************************************/ - -@interface VLCTimeField : NSTextField - -@property (readonly) BOOL timeRemaining; - -- (void)setRemainingIdentifier:(NSString *)o_string; - -@end - -/***************************************************************************** * VLCMainWindowSplitView interface *****************************************************************************/ @interface VLCMainWindowSplitView : NSSplitView diff --git a/modules/gui/macosx/misc.m b/modules/gui/macosx/misc.m index 3b659a9294..65dc17e8e7 100644 --- a/modules/gui/macosx/misc.m +++ b/modules/gui/macosx/misc.m @@ -465,66 +465,6 @@ void _drawFrameInRect(NSRect frameRect) @end /***************************************************************************** - * VLCTimeField implementation - ***************************************************************************** - * we need this to catch our click-event in the controller window - *****************************************************************************/ - -@interface VLCTimeField () -{ - NSString *o_remaining_identifier; - BOOL b_time_remaining; -} -@end - -@implementation VLCTimeField -+ (void)initialize -{ - NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; - NSDictionary *appDefaults = [NSDictionary dictionaryWithObjectsAndKeys: - @"NO", @"DisplayTimeAsTimeRemaining", - @"YES", @"DisplayFullscreenTimeAsTimeRemaining", - nil]; - - [defaults registerDefaults:appDefaults]; -} - - -- (void)setRemainingIdentifier:(NSString *)o_string -{ - o_remaining_identifier = o_string; - b_time_remaining = [[NSUserDefaults standardUserDefaults] boolForKey:o_remaining_identifier]; -} - -- (void)mouseDown: (NSEvent *)ourEvent -{ - if ( [ourEvent clickCount] > 1 ) - [[[VLCMain sharedInstance] mainMenu] goToSpecificTime: nil]; - else - { - if (o_remaining_identifier) { - b_time_remaining = [[NSUserDefaults standardUserDefaults] boolForKey:o_remaining_identifier]; - b_time_remaining = !b_time_remaining; - [[NSUserDefaults standardUserDefaults] setObject:(b_time_remaining ? @"YES" : @"NO") forKey:o_remaining_identifier]; - } else { - b_time_remaining = !b_time_remaining; - } - } - - [[self nextResponder] mouseDown:ourEvent]; -} - -- (BOOL)timeRemaining -{ - if (o_remaining_identifier) - return [[NSUserDefaults standardUserDefaults] boolForKey:o_remaining_identifier]; - else - return b_time_remaining; -} - -@end - -/***************************************************************************** * VLCMainWindowSplitView implementation * comment 1 + 2 taken from NSSplitView.h (10.7 SDK) *****************************************************************************/ _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
