Commit d152a621 authored by Marvin Scholz's avatar Marvin Scholz

macOS: Move VLCTimeField out of misc

This moves the VLCTimeField class in their own files, out of misc.
parent 46b71ee2
......@@ -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 */,
......
......@@ -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
......
......@@ -25,6 +25,8 @@
#import <Cocoa/Cocoa.h>
#import "misc.h"
#import "VLCTimeField.h"
@class VLCResizeControl;
/*****************************************************************************
......
......@@ -26,9 +26,9 @@
#import <Cocoa/Cocoa.h>
#import "misc.h"
#import "Windows.h"
#import "VLCDefaultValueSlider.h"
#import "VLCTimeField.h"
@interface VLCFSPanelController : NSWindowController
......
/*****************************************************************************
* VLCTimeField.h: NSTextField subclass for playback time fields
*****************************************************************************
* Copyright (C) 2003-2017 VLC authors and VideoLAN
* $Id$
*
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
* 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
/*****************************************************************************
* VLCTimeField.m: NSTextField subclass for playback time fields
*****************************************************************************
* Copyright (C) 2003-2017 VLC authors and VideoLAN
* $Id$
*
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
* 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
......@@ -108,20 +108,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
*****************************************************************************/
......
......@@ -464,66 +464,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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment