macOS: Move some classes to their own files

Put VLCSimplePrefsWindow and VLCHotkeyChangeWindow in their own files
as they do not belong inside the VLCSimplePrefsController and makes
it easier to find these classes.
This commit is contained in:
Marvin Scholz 2017-03-15 14:43:32 +01:00
parent ad63b98e0e
commit 4a22637a34
11 changed files with 258 additions and 150 deletions

View File

@ -162,6 +162,8 @@
1C31142A1E508D1B00D4DD76 /* VLCStatusBarIconMainMenu.xib in Sources */ = {isa = PBXBuildFile; fileRef = 6B82241A1E4D2A9000833BE1 /* VLCStatusBarIconMainMenu.xib */; };
6B3BE42C1E6217CB008D098A /* VLCHUDImageButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B3BE42B1E6217CB008D098A /* VLCHUDImageButton.m */; };
6B3BE4321E621F24008D098A /* VLCHUDToggleButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B3BE4311E621F24008D098A /* VLCHUDToggleButton.m */; };
6B4D50901E79781F004479B5 /* VLCHotkeyChangeWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B4D508F1E79781F004479B5 /* VLCHotkeyChangeWindow.m */; };
6B4D50931E7979CB004479B5 /* VLCSimplePrefsWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B4D50921E7979CB004479B5 /* VLCSimplePrefsWindow.m */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
@ -196,6 +198,10 @@
6B3BE42B1E6217CB008D098A /* VLCHUDImageButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VLCHUDImageButton.m; sourceTree = "<group>"; };
6B3BE4301E621F24008D098A /* VLCHUDToggleButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VLCHUDToggleButton.h; sourceTree = "<group>"; };
6B3BE4311E621F24008D098A /* VLCHUDToggleButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VLCHUDToggleButton.m; sourceTree = "<group>"; };
6B4D508E1E79781F004479B5 /* VLCHotkeyChangeWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VLCHotkeyChangeWindow.h; sourceTree = "<group>"; };
6B4D508F1E79781F004479B5 /* VLCHotkeyChangeWindow.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VLCHotkeyChangeWindow.m; sourceTree = "<group>"; };
6B4D50911E7979CB004479B5 /* VLCSimplePrefsWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VLCSimplePrefsWindow.h; sourceTree = "<group>"; };
6B4D50921E7979CB004479B5 /* VLCSimplePrefsWindow.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VLCSimplePrefsWindow.m; sourceTree = "<group>"; };
6B6A499A1DFD9B23009128AC /* VLCDefaultValueSlider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VLCDefaultValueSlider.h; sourceTree = "<group>"; };
6B6A499B1DFD9B23009128AC /* VLCDefaultValueSlider.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VLCDefaultValueSlider.m; sourceTree = "<group>"; };
6B6A499C1DFD9B23009128AC /* VLCDefaultValueSliderCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VLCDefaultValueSliderCell.h; sourceTree = "<group>"; };
@ -999,6 +1005,10 @@
1C7CB91B1D787E7600388902 /* VLCPopupPanelController.m */,
CCB24D5E0D54BBAE004D780C /* VLCSimplePrefsController.h */,
CCB24D5D0D54BBAE004D780C /* VLCSimplePrefsController.m */,
6B4D50911E7979CB004479B5 /* VLCSimplePrefsWindow.h */,
6B4D50921E7979CB004479B5 /* VLCSimplePrefsWindow.m */,
6B4D508E1E79781F004479B5 /* VLCHotkeyChangeWindow.h */,
6B4D508F1E79781F004479B5 /* VLCHotkeyChangeWindow.m */,
CC269A4615E7947F00F2FDC9 /* VLCStringUtility.h */,
CC269A4715E7947F00F2FDC9 /* VLCStringUtility.m */,
CC707EC3137464CD0003010A /* VLCTrackSynchronizationWindowController.h */,
@ -1896,6 +1906,7 @@
1C31140F1E508D1B00D4DD76 /* AddonManager.xib in Sources */,
1C3114101E508D1B00D4DD76 /* AudioEffects.xib in Sources */,
1C3114111E508D1B00D4DD76 /* Bookmarks.xib in Sources */,
6B4D50901E79781F004479B5 /* VLCHotkeyChangeWindow.m in Sources */,
1C3114131E508D1B00D4DD76 /* ConvertAndSave.xib in Sources */,
1C3114141E508D1B00D4DD76 /* CoreDialogs.xib in Sources */,
1C3114151E508D1B00D4DD76 /* DetachedVideoWindow.xib in Sources */,
@ -1944,6 +1955,7 @@
1C3113F61E508C7600D4DD76 /* VLCHUDButtonCell.h in Sources */,
1C3113F71E508C7600D4DD76 /* VLCHUDButtonCell.m in Sources */,
1C3113F81E508C7600D4DD76 /* VLCHUDCheckboxCell.h in Sources */,
6B4D50931E7979CB004479B5 /* VLCSimplePrefsWindow.m in Sources */,
1C3113F91E508C7600D4DD76 /* VLCHUDCheckboxCell.m in Sources */,
1C3113FA1E508C7600D4DD76 /* VLCHUDRadiobuttonCell.h in Sources */,
1C3113FB1E508C7600D4DD76 /* VLCHUDRadiobuttonCell.m in Sources */,

View File

@ -59,6 +59,8 @@ libmacosx_plugin_la_SOURCES = \
VLCPopupPanelController.h VLCPopupPanelController.m \
VLCTextfieldPanelController.h VLCTextfieldPanelController.m \
VLCSimplePrefsController.h VLCSimplePrefsController.m \
VLCSimplePrefsWindow.h VLCSimplePrefsWindow.m \
VLCHotkeyChangeWindow.h VLCHotkeyChangeWindow.m \
SPInvocationGrabbing.h SPInvocationGrabbing.m \
SPMediaKeyTap.h SPMediaKeyTap.m \
Spotify.h \

View File

@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11542" systemVersion="15G1217" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11762" systemVersion="16D32" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment identifier="macosx"/>
<development version="7000" identifier="xcode"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11542"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11762"/>
<capability name="box content view" minToolsVersion="7.0"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="VLCSimplePrefs">
<customObject id="-2" userLabel="File's Owner" customClass="VLCSimplePrefsController">
<connections>
<outlet property="audioView" destination="2330" id="gZc-yc-OH9"/>
<outlet property="audio_autosavevolMatrix" destination="3664" id="qcu-Km-dKV"/>
@ -714,8 +714,8 @@ Gw
<rect key="frame" x="2" y="2" width="531" height="167"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<slider verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="2335">
<rect key="frame" x="250" y="82" width="209" height="20"/>
<slider verticalHuggingPriority="750" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="2335">
<rect key="frame" x="250" y="82" width="209" height="19"/>
<sliderCell key="cell" continuous="YES" alignment="left" maxValue="200" doubleValue="100" tickMarkPosition="above" sliderType="linear" id="3459">
<font key="font" size="12" name="Helvetica"/>
</sliderCell>
@ -723,7 +723,7 @@ Gw
<action selector="audioSettingChanged:" target="-2" id="5xq-tt-Vti"/>
</connections>
</slider>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="2336">
<textField verticalHuggingPriority="750" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="2336">
<rect key="frame" x="465" y="81" width="46" height="22"/>
<constraints>
<constraint firstAttribute="width" constant="46" id="96N-ME-SLD"/>
@ -752,7 +752,7 @@ Gw
<outlet property="nextKeyView" destination="2346" id="3424"/>
</connections>
</textField>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="2339">
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="2339">
<rect key="frame" x="9" y="56" width="239" height="17"/>
<textFieldCell key="cell" sendsActionOnEndEditing="YES" title="Force detection of Dolby Surround" id="3462">
<font key="font" metaFont="system"/>
@ -760,7 +760,7 @@ Gw
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="2340">
<popUpButton verticalHuggingPriority="750" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="2340">
<rect key="frame" x="250" y="51" width="185" height="26"/>
<constraints>
<constraint firstAttribute="width" constant="180" id="m4P-Bj-cCf"/>
@ -780,7 +780,7 @@ Gw
<action selector="audioSettingChanged:" target="-2" id="vXp-SU-H1J"/>
</connections>
</popUpButton>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="2345">
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="2345">
<rect key="frame" x="9" y="22" width="239" height="17"/>
<textFieldCell key="cell" sendsActionOnEndEditing="YES" title="Preferred Audio language" id="3464">
<font key="font" metaFont="system"/>
@ -788,7 +788,7 @@ Gw
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="2346">
<textField verticalHuggingPriority="750" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="2346">
<rect key="frame" x="252" y="20" width="259" height="22"/>
<constraints>
<constraint firstAttribute="width" constant="259" id="8Te-oS-vOQ"/>
@ -1672,7 +1672,7 @@ Gw
</textFieldCell>
</textField>
<slider verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="3569">
<rect key="frame" x="140" y="77" width="194" height="20"/>
<rect key="frame" x="140" y="77" width="194" height="19"/>
<sliderCell key="cell" continuous="YES" alignment="left" maxValue="100" doubleValue="100" tickMarkPosition="above" sliderType="linear" id="3573">
<font key="font" size="12" name="Helvetica"/>
</sliderCell>

View File

@ -0,0 +1,28 @@
/*****************************************************************************
* VLCHotkeyChangeWindow.m: Preferences Hotkey Window subclass for Mac OS X
*****************************************************************************
* Copyright (C) 2008-2014 VLC authors and VideoLAN
* $Id$
*
* Authors: 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>
@interface VLCHotkeyChangeWindow : NSWindow
@end

View File

@ -0,0 +1,130 @@
/*****************************************************************************
* VLCHotkeyChangeWindow.m: Preferences Hotkey Window subclass for Mac OS X
*****************************************************************************
* Copyright (C) 2008-2014 VLC authors and VideoLAN
* $Id$
*
* Authors: 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 "VLCHotkeyChangeWindow.h"
#import "VLCSimplePrefsController.h"
@implementation VLCHotkeyChangeWindow
- (BOOL)acceptsFirstResponder
{
return YES;
}
- (BOOL)becomeFirstResponder
{
return YES;
}
- (BOOL)resignFirstResponder
{
/* We need to stay the first responder or we'll miss the user's input */
return NO;
}
- (BOOL)performKeyEquivalent:(NSEvent *)theEvent
{
NSMutableString *tempString = [[NSMutableString alloc] init];
NSString *keyString = [theEvent characters];
unichar key = [keyString characterAtIndex:0];
NSUInteger i_modifiers = [theEvent modifierFlags];
/* modifiers */
if (i_modifiers & NSCommandKeyMask)
[tempString appendString:@"Command-"];
if (i_modifiers & NSControlKeyMask)
[tempString appendString:@"Ctrl-"];
if (i_modifiers & NSShiftKeyMask)
[tempString appendString:@"Shift-"];
if (i_modifiers & NSAlternateKeyMask)
[tempString appendString:@"Alt-"];
/* non character keys */
if (key == NSUpArrowFunctionKey)
[tempString appendString:@"Up"];
else if (key == NSDownArrowFunctionKey)
[tempString appendString:@"Down"];
else if (key == NSLeftArrowFunctionKey)
[tempString appendString:@"Left"];
else if (key == NSRightArrowFunctionKey)
[tempString appendString:@"Right"];
else if (key == NSF1FunctionKey)
[tempString appendString:@"F1"];
else if (key == NSF2FunctionKey)
[tempString appendString:@"F2"];
else if (key == NSF3FunctionKey)
[tempString appendString:@"F3"];
else if (key == NSF4FunctionKey)
[tempString appendString:@"F4"];
else if (key == NSF5FunctionKey)
[tempString appendString:@"F5"];
else if (key == NSF6FunctionKey)
[tempString appendString:@"F6"];
else if (key == NSF7FunctionKey)
[tempString appendString:@"F7"];
else if (key == NSF8FunctionKey)
[tempString appendString:@"F8"];
else if (key == NSF9FunctionKey)
[tempString appendString:@"F9"];
else if (key == NSF10FunctionKey)
[tempString appendString:@"F10"];
else if (key == NSF11FunctionKey)
[tempString appendString:@"F11"];
else if (key == NSF12FunctionKey)
[tempString appendString:@"F12"];
else if (key == NSInsertFunctionKey)
[tempString appendString:@"Insert"];
else if (key == NSHomeFunctionKey)
[tempString appendString:@"Home"];
else if (key == NSEndFunctionKey)
[tempString appendString:@"End"];
else if (key == NSPageUpFunctionKey)
[tempString appendString:@"Page Up"];
else if (key == NSPageDownFunctionKey)
[tempString appendString:@"Page Down"];
else if (key == NSMenuFunctionKey)
[tempString appendString:@"Menu"];
else if (key == NSTabCharacter)
[tempString appendString:@"Tab"];
else if (key == NSCarriageReturnCharacter)
[tempString appendString:@"Enter"];
else if (key == NSEnterCharacter)
[tempString appendString:@"Enter"];
else if (key == NSDeleteCharacter)
[tempString appendString:@"Delete"];
else if (key == NSBackspaceCharacter)
[tempString appendString:@"Backspace"];
else if (key == 0x001B)
[tempString appendString:@"Esc"];
else if (key == ' ')
[tempString appendString:@"Space"];
else if (![[[theEvent charactersIgnoringModifiers] lowercaseString] isEqualToString:@""]) //plain characters
[tempString appendString:[[theEvent charactersIgnoringModifiers] lowercaseString]];
else
return NO;
return [[[VLCMain sharedInstance] simplePreferences] changeHotkeyTo: tempString];
}
@end

View File

@ -63,7 +63,7 @@ static NSString * VLCMediaKeySupportSettingChangedNotification = @"VLCMediaKeySu
@class VLCPlaylist;
@class VLCInputManager;
@class VLCResumeDialogController;
@class VLCSimplePrefs;
@class VLCSimplePrefsController;
@class VLCPrefs;
@class VLCCoreDialogProvider;
@class VLCBookmarksWindowController;
@ -90,7 +90,7 @@ static NSString * VLCMediaKeySupportSettingChangedNotification = @"VLCMediaKeySu
- (VLCMainWindow *)mainWindow;
- (VLCBookmarksWindowController *)bookmarks;
- (VLCOpenWindowController *)open;
- (VLCSimplePrefs *)simplePreferences;
- (VLCSimplePrefsController *)simplePreferences;
- (VLCPrefs *)preferences;
- (VLCPlaylist *)playlist;
- (VLCCoreDialogProvider *)coreDialogProvider;

View File

@ -166,7 +166,7 @@ static int ShowController(vlc_object_t *p_this, const char *psz_variable,
NSWindowController *_mainWindowController;
VLCMainMenu *_mainmenu;
VLCPrefs *_prefs;
VLCSimplePrefs *_sprefs;
VLCSimplePrefsController *_sprefs;
VLCOpenWindowController *_open;
VLCCoreDialogProvider *_coredialogs;
VLCBookmarksWindowController *_bookmarks;
@ -560,10 +560,10 @@ static VLCMain *sharedInstance = nil;
return _convertAndSaveWindow;
}
- (VLCSimplePrefs *)simplePreferences
- (VLCSimplePrefsController *)simplePreferences
{
if (!_sprefs)
_sprefs = [[VLCSimplePrefs alloc] init];
_sprefs = [[VLCSimplePrefsController alloc] init];
return _sprefs;
}

View File

@ -25,7 +25,7 @@
#import "VLCMain.h"
#import <vlc_common.h>
@interface VLCSimplePrefs : NSWindowController
@interface VLCSimplePrefsController : NSWindowController
// Audio pane
@property (readwrite, weak) IBOutlet NSPopUpButton *audio_dolbyPopup;
@ -240,11 +240,3 @@
- (BOOL)changeHotkeyTo: (NSString *)theKey;
@end
@interface VLCHotkeyChangeWindow : NSWindow
@end
@interface VLCSimplePrefsWindow : NSWindow
@end

View File

@ -180,7 +180,7 @@ static NSString* VLCOSDSettingToolbarIdentifier = @"Subtitles Settings Item Iden
static NSString* VLCInputSettingToolbarIdentifier = @"Input Settings Item Identifier";
static NSString* VLCHotkeysSettingToolbarIdentifier = @"Hotkeys Settings Item Identifier";
@interface VLCSimplePrefs() <NSToolbarDelegate, NSWindowDelegate>
@interface VLCSimplePrefsController() <NSToolbarDelegate, NSWindowDelegate>
{
BOOL _audioSettingChanged;
BOOL _intfSettingChanged;
@ -201,7 +201,7 @@ static NSString* VLCHotkeysSettingToolbarIdentifier = @"Hotkeys Settings Item Id
}
@end
@implementation VLCSimplePrefs
@implementation VLCSimplePrefsController
#pragma mark Initialisation
@ -1514,125 +1514,3 @@ static inline void save_string_list(intf_thread_t * p_intf, id object, const cha
}
@end
/********************
* hotkeys settings *
********************/
@implementation VLCHotkeyChangeWindow
- (BOOL)acceptsFirstResponder
{
return YES;
}
- (BOOL)becomeFirstResponder
{
return YES;
}
- (BOOL)resignFirstResponder
{
/* We need to stay the first responder or we'll miss the user's input */
return NO;
}
- (BOOL)performKeyEquivalent:(NSEvent *)theEvent
{
NSMutableString *tempString = [[NSMutableString alloc] init];
NSString *keyString = [theEvent characters];
unichar key = [keyString characterAtIndex:0];
NSUInteger i_modifiers = [theEvent modifierFlags];
/* modifiers */
if (i_modifiers & NSCommandKeyMask)
[tempString appendString:@"Command-"];
if (i_modifiers & NSControlKeyMask)
[tempString appendString:@"Ctrl-"];
if (i_modifiers & NSShiftKeyMask)
[tempString appendString:@"Shift-"];
if (i_modifiers & NSAlternateKeyMask)
[tempString appendString:@"Alt-"];
/* non character keys */
if (key == NSUpArrowFunctionKey)
[tempString appendString:@"Up"];
else if (key == NSDownArrowFunctionKey)
[tempString appendString:@"Down"];
else if (key == NSLeftArrowFunctionKey)
[tempString appendString:@"Left"];
else if (key == NSRightArrowFunctionKey)
[tempString appendString:@"Right"];
else if (key == NSF1FunctionKey)
[tempString appendString:@"F1"];
else if (key == NSF2FunctionKey)
[tempString appendString:@"F2"];
else if (key == NSF3FunctionKey)
[tempString appendString:@"F3"];
else if (key == NSF4FunctionKey)
[tempString appendString:@"F4"];
else if (key == NSF5FunctionKey)
[tempString appendString:@"F5"];
else if (key == NSF6FunctionKey)
[tempString appendString:@"F6"];
else if (key == NSF7FunctionKey)
[tempString appendString:@"F7"];
else if (key == NSF8FunctionKey)
[tempString appendString:@"F8"];
else if (key == NSF9FunctionKey)
[tempString appendString:@"F9"];
else if (key == NSF10FunctionKey)
[tempString appendString:@"F10"];
else if (key == NSF11FunctionKey)
[tempString appendString:@"F11"];
else if (key == NSF12FunctionKey)
[tempString appendString:@"F12"];
else if (key == NSInsertFunctionKey)
[tempString appendString:@"Insert"];
else if (key == NSHomeFunctionKey)
[tempString appendString:@"Home"];
else if (key == NSEndFunctionKey)
[tempString appendString:@"End"];
else if (key == NSPageUpFunctionKey)
[tempString appendString:@"Page Up"];
else if (key == NSPageDownFunctionKey)
[tempString appendString:@"Page Down"];
else if (key == NSMenuFunctionKey)
[tempString appendString:@"Menu"];
else if (key == NSTabCharacter)
[tempString appendString:@"Tab"];
else if (key == NSCarriageReturnCharacter)
[tempString appendString:@"Enter"];
else if (key == NSEnterCharacter)
[tempString appendString:@"Enter"];
else if (key == NSDeleteCharacter)
[tempString appendString:@"Delete"];
else if (key == NSBackspaceCharacter)
[tempString appendString:@"Backspace"];
else if (key == 0x001B)
[tempString appendString:@"Esc"];
else if (key == ' ')
[tempString appendString:@"Space"];
else if (![[[theEvent charactersIgnoringModifiers] lowercaseString] isEqualToString:@""]) //plain characters
[tempString appendString:[[theEvent charactersIgnoringModifiers] lowercaseString]];
else
return NO;
return [[[VLCMain sharedInstance] simplePreferences] changeHotkeyTo: tempString];
}
@end
@implementation VLCSimplePrefsWindow
- (BOOL)acceptsFirstResponder
{
return YES;
}
- (void)changeFont:(id)sender
{
[[[VLCMain sharedInstance] simplePreferences] changeFont: sender];
}
@end

View File

@ -0,0 +1,28 @@
/*****************************************************************************
* VLCSimplePrefsWindow.h: Simple Preferences Window subclass for Mac OS X
*****************************************************************************
* Copyright (C) 2008-2014 VLC authors and VideoLAN
* $Id$
*
* Authors: 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>
@interface VLCSimplePrefsWindow : NSWindow
@end

View File

@ -0,0 +1,38 @@
/*****************************************************************************
* VLCSimplePrefsWindow.m: Simple Preferences Window subclass for Mac OS X
*****************************************************************************
* Copyright (C) 2008-2014 VLC authors and VideoLAN
* $Id$
*
* Authors: 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 "VLCSimplePrefsWindow.h"
#import "VLCSimplePrefsController.h"
@implementation VLCSimplePrefsWindow
- (BOOL)acceptsFirstResponder
{
return YES;
}
- (void)changeFont:(id)sender
{
[[[VLCMain sharedInstance] simplePreferences] changeFont: sender];
}
@end