commit
5677780a82
|
@ -16,3 +16,6 @@
|
||||||
[submodule "Frameworks/libatrac9/libatrac9"]
|
[submodule "Frameworks/libatrac9/libatrac9"]
|
||||||
path = Frameworks/libatrac9/libatrac9
|
path = Frameworks/libatrac9/libatrac9
|
||||||
url = https://github.com/Thealexbarney/LibAtrac9.git
|
url = https://github.com/Thealexbarney/LibAtrac9.git
|
||||||
|
[submodule "Frameworks/shpakovski/MASShortcut"]
|
||||||
|
path = Frameworks/shpakovski/MASShortcut
|
||||||
|
url = https://github.com/shpakovski/MASShortcut.git
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
#import <Cocoa/Cocoa.h>
|
#import <Cocoa/Cocoa.h>
|
||||||
|
|
||||||
#import <NDHotKey/NDHotKeyEvent.h>
|
|
||||||
#import "NowPlayingBarController.h"
|
#import "NowPlayingBarController.h"
|
||||||
|
|
||||||
@class FileTreeViewController;
|
@class FileTreeViewController;
|
||||||
|
@ -48,11 +47,6 @@
|
||||||
IBOutlet NSWindowController *spotlightWindowController;
|
IBOutlet NSWindowController *spotlightWindowController;
|
||||||
|
|
||||||
IBOutlet FileTreeViewController *fileTreeViewController;
|
IBOutlet FileTreeViewController *fileTreeViewController;
|
||||||
|
|
||||||
NDHotKeyEvent *playHotKey;
|
|
||||||
NDHotKeyEvent *prevHotKey;
|
|
||||||
NDHotKeyEvent *nextHotKey;
|
|
||||||
NDHotKeyEvent *spamHotKey;
|
|
||||||
|
|
||||||
NowPlayingBarController *nowPlaying;
|
NowPlayingBarController *nowPlaying;
|
||||||
|
|
||||||
|
@ -88,8 +82,6 @@
|
||||||
- (void)application:(NSApplication *)theApplication openFiles:(NSArray *)filenames;
|
- (void)application:(NSApplication *)theApplication openFiles:(NSArray *)filenames;
|
||||||
|
|
||||||
- (void)registerHotKeys;
|
- (void)registerHotKeys;
|
||||||
OSStatus handleHotKey(EventHandlerCallRef nextHandler,EventRef theEvent,void *userData);
|
|
||||||
|
|
||||||
|
|
||||||
- (void)clickPlay;
|
- (void)clickPlay;
|
||||||
- (void)clickPause;
|
- (void)clickPause;
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
#import "PlaylistController.h"
|
#import "PlaylistController.h"
|
||||||
#import "PlaylistView.h"
|
#import "PlaylistView.h"
|
||||||
#import "PlaylistEntry.h"
|
#import "PlaylistEntry.h"
|
||||||
#import <NDHotKey/NDHotKeyEvent.h>
|
|
||||||
#import "PlaylistLoader.h"
|
#import "PlaylistLoader.h"
|
||||||
#import "OpenURLPanel.h"
|
#import "OpenURLPanel.h"
|
||||||
#import "SpotlightWindowController.h"
|
#import "SpotlightWindowController.h"
|
||||||
|
@ -20,6 +19,9 @@
|
||||||
#import "MiniModeMenuTitleTransformer.h"
|
#import "MiniModeMenuTitleTransformer.h"
|
||||||
#import "DualWindow.h"
|
#import "DualWindow.h"
|
||||||
|
|
||||||
|
#import <MASShortcut/Shortcut.h>
|
||||||
|
#import "Shortcuts.h"
|
||||||
|
|
||||||
@implementation AppController
|
@implementation AppController
|
||||||
|
|
||||||
+ (void)initialize
|
+ (void)initialize
|
||||||
|
@ -359,18 +361,6 @@
|
||||||
float fFontSize = [NSFont systemFontSizeForControlSize:NSControlSizeSmall];
|
float fFontSize = [NSFont systemFontSizeForControlSize:NSControlSizeSmall];
|
||||||
NSNumber *fontSize = [NSNumber numberWithFloat:fFontSize];
|
NSNumber *fontSize = [NSNumber numberWithFloat:fFontSize];
|
||||||
[userDefaultsValuesDict setObject:fontSize forKey:@"fontSize"];
|
[userDefaultsValuesDict setObject:fontSize forKey:@"fontSize"];
|
||||||
|
|
||||||
[userDefaultsValuesDict setObject:[NSNumber numberWithInt:35] forKey:@"hotKeyPlayKeyCode"];
|
|
||||||
[userDefaultsValuesDict setObject:[NSNumber numberWithInt:(NSEventModifierFlagControl|NSEventModifierFlagCommand)] forKey:@"hotKeyPlayModifiers"];
|
|
||||||
|
|
||||||
[userDefaultsValuesDict setObject:[NSNumber numberWithInt:45] forKey:@"hotKeyNextKeyCode"];
|
|
||||||
[userDefaultsValuesDict setObject:[NSNumber numberWithInt:(NSEventModifierFlagControl|NSEventModifierFlagCommand)] forKey:@"hotKeyNextModifiers"];
|
|
||||||
|
|
||||||
[userDefaultsValuesDict setObject:[NSNumber numberWithInt:15] forKey:@"hotKeyPreviousKeyCode"];
|
|
||||||
[userDefaultsValuesDict setObject:[NSNumber numberWithInt:(NSEventModifierFlagControl|NSEventModifierFlagCommand)] forKey:@"hotKeyPreviousModifiers"];
|
|
||||||
|
|
||||||
[userDefaultsValuesDict setObject:[NSNumber numberWithInt:8] forKey:@"hotKeySpamKeyCode"];
|
|
||||||
[userDefaultsValuesDict setObject:[NSNumber numberWithInt:(NSEventModifierFlagControl|NSEventModifierFlagCommand)] forKey:@"hotKeySpamModifiers"];
|
|
||||||
|
|
||||||
NSString *feedURLdefault = @"https://f.losno.co/cog/mercury.xml";
|
NSString *feedURLdefault = @"https://f.losno.co/cog/mercury.xml";
|
||||||
[userDefaultsValuesDict setObject:feedURLdefault forKey:@"SUFeedURL"];
|
[userDefaultsValuesDict setObject:feedURLdefault forKey:@"SUFeedURL"];
|
||||||
|
@ -406,76 +396,27 @@
|
||||||
if ([brokenFeedURLs containsObject:feedURL]) {
|
if ([brokenFeedURLs containsObject:feedURL]) {
|
||||||
[[NSUserDefaults standardUserDefaults] setValue:feedURLdefault forKey:@"SUFeedURL"];
|
[[NSUserDefaults standardUserDefaults] setValue:feedURLdefault forKey:@"SUFeedURL"];
|
||||||
}
|
}
|
||||||
|
|
||||||
//Add observers
|
|
||||||
[[NSUserDefaultsController sharedUserDefaultsController] addObserver:self forKeyPath:@"values.hotKeyPlayKeyCode" options:0 context:nil];
|
|
||||||
[[NSUserDefaultsController sharedUserDefaultsController] addObserver:self forKeyPath:@"values.hotKeyPreviousKeyCode" options:0 context:nil];
|
|
||||||
[[NSUserDefaultsController sharedUserDefaultsController] addObserver:self forKeyPath:@"values.hotKeyNextKeyCode" options:0 context:nil];
|
|
||||||
[[NSUserDefaultsController sharedUserDefaultsController] addObserver:self
|
|
||||||
forKeyPath:@"values.hotKeySpamKeyCode" options:0 context:nil];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) observeValueForKeyPath:(NSString *)keyPath
|
|
||||||
ofObject:(id)object
|
|
||||||
change:(NSDictionary *)change
|
|
||||||
context:(void *)context
|
|
||||||
{
|
|
||||||
if ([keyPath isEqualToString:@"values.hotKeyPlayKeyCode"]) {
|
|
||||||
[self registerHotKeys];
|
|
||||||
}
|
|
||||||
else if ([keyPath isEqualToString:@"values.hotKeyPreviousKeyCode"]) {
|
|
||||||
[self registerHotKeys];
|
|
||||||
}
|
|
||||||
else if ([keyPath isEqualToString:@"values.hotKeyNextKeyCode"]) {
|
|
||||||
[self registerHotKeys];
|
|
||||||
}
|
|
||||||
else if ([keyPath isEqualToString:@"values.hotKeySpamKeyCode"]) {
|
|
||||||
[self registerHotKeys];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Unassign previous handler first, so dealloc can unregister it from the global map before the new instances are assigned */
|
/* Unassign previous handler first, so dealloc can unregister it from the global map before the new instances are assigned */
|
||||||
- (void)registerHotKeys
|
- (void)registerHotKeys
|
||||||
{
|
{
|
||||||
if ([[[[NSUserDefaultsController sharedUserDefaultsController] defaults] objectForKey:@"hotKeyPlayModifiers"] intValue]) {
|
MASShortcutBinder *binder = [MASShortcutBinder sharedBinder];
|
||||||
playHotKey = nil;
|
[binder bindShortcutWithDefaultsKey:CogPlayShortcutKey toAction:^{
|
||||||
playHotKey = [[NDHotKeyEvent alloc]
|
[self clickPlay];
|
||||||
initWithKeyCode: [[[[NSUserDefaultsController sharedUserDefaultsController] defaults] objectForKey:@"hotKeyPlayKeyCode"] intValue]
|
}];
|
||||||
modifierFlags: [[[[NSUserDefaultsController sharedUserDefaultsController] defaults] objectForKey:@"hotKeyPlayModifiers"] intValue]
|
|
||||||
];
|
|
||||||
[playHotKey setTarget:self selector:@selector(clickPlay)];
|
|
||||||
[playHotKey setEnabled:YES];
|
|
||||||
}
|
|
||||||
|
|
||||||
if ([[[[NSUserDefaultsController sharedUserDefaultsController] defaults] objectForKey:@"hotKeyPreviousModifiers"] intValue]) {
|
|
||||||
prevHotKey = nil;
|
|
||||||
prevHotKey = [[NDHotKeyEvent alloc]
|
|
||||||
initWithKeyCode: [[NSUserDefaults standardUserDefaults] integerForKey:@"hotKeyPreviousKeyCode"]
|
|
||||||
modifierFlags: [[NSUserDefaults standardUserDefaults] integerForKey:@"hotKeyPreviousModifiers"]
|
|
||||||
];
|
|
||||||
[prevHotKey setTarget:self selector:@selector(clickPrev)];
|
|
||||||
[prevHotKey setEnabled:YES];
|
|
||||||
}
|
|
||||||
|
|
||||||
if ([[[[NSUserDefaultsController sharedUserDefaultsController] defaults] objectForKey:@"hotKeyNextModifiers"] intValue]) {
|
|
||||||
nextHotKey = nil;
|
|
||||||
nextHotKey = [[NDHotKeyEvent alloc]
|
|
||||||
initWithKeyCode: [[NSUserDefaults standardUserDefaults] integerForKey:@"hotKeyNextKeyCode"]
|
|
||||||
modifierFlags: [[NSUserDefaults standardUserDefaults] integerForKey:@"hotKeyNextModifiers"]
|
|
||||||
];
|
|
||||||
[nextHotKey setTarget:self selector:@selector(clickNext)];
|
|
||||||
[nextHotKey setEnabled:YES];
|
|
||||||
}
|
|
||||||
|
|
||||||
if ([[[[NSUserDefaultsController sharedUserDefaultsController] defaults] objectForKey:@"hotKeySpamModifiers"] intValue]) {
|
[binder bindShortcutWithDefaultsKey:CogNextShortcutKey toAction:^{
|
||||||
spamHotKey = nil;
|
[self clickNext];
|
||||||
spamHotKey = [[NDHotKeyEvent alloc]
|
}];
|
||||||
initWithKeyCode: [[NSUserDefaults standardUserDefaults] integerForKey:@"hotKeySpamKeyCode"]
|
|
||||||
modifierFlags: [[NSUserDefaults standardUserDefaults] integerForKey:@"hotKeySpamModifiers"]
|
[binder bindShortcutWithDefaultsKey:CogPrevShortcutKey toAction:^{
|
||||||
];
|
[self clickPrev];
|
||||||
[spamHotKey setTarget:self selector:@selector(clickSpam)];
|
}];
|
||||||
[spamHotKey setEnabled:YES];
|
|
||||||
}
|
[binder bindShortcutWithDefaultsKey:CogSpamShortcutKey toAction:^{
|
||||||
|
[self clickSpam];
|
||||||
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)windowDidEnterFullScreen:(NSNotification *)notification
|
- (void)windowDidEnterFullScreen:(NSNotification *)notification
|
||||||
|
|
|
@ -163,8 +163,6 @@
|
||||||
83849172180843B200E7332D /* pauseDockBadgeColorful.png in Resources */ = {isa = PBXBuildFile; fileRef = 8384916F180843B200E7332D /* pauseDockBadgeColorful.png */; };
|
83849172180843B200E7332D /* pauseDockBadgeColorful.png in Resources */ = {isa = PBXBuildFile; fileRef = 8384916F180843B200E7332D /* pauseDockBadgeColorful.png */; };
|
||||||
83849173180843B200E7332D /* playDockBadgeColorful.png in Resources */ = {isa = PBXBuildFile; fileRef = 83849170180843B200E7332D /* playDockBadgeColorful.png */; };
|
83849173180843B200E7332D /* playDockBadgeColorful.png in Resources */ = {isa = PBXBuildFile; fileRef = 83849170180843B200E7332D /* playDockBadgeColorful.png */; };
|
||||||
83849174180843B200E7332D /* stopDockBadgeColorful.png in Resources */ = {isa = PBXBuildFile; fileRef = 83849171180843B200E7332D /* stopDockBadgeColorful.png */; };
|
83849174180843B200E7332D /* stopDockBadgeColorful.png in Resources */ = {isa = PBXBuildFile; fileRef = 83849171180843B200E7332D /* stopDockBadgeColorful.png */; };
|
||||||
838491871808591F00E7332D /* NDHotKey.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8384917E1808585D00E7332D /* NDHotKey.framework */; };
|
|
||||||
838491881808593200E7332D /* NDHotKey.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 8384917E1808585D00E7332D /* NDHotKey.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
|
|
||||||
838F850125687C5C00C3E614 /* PlaybackStatusToHiddenTransformer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 838F850025687C5C00C3E614 /* PlaybackStatusToHiddenTransformer.swift */; };
|
838F850125687C5C00C3E614 /* PlaybackStatusToHiddenTransformer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 838F850025687C5C00C3E614 /* PlaybackStatusToHiddenTransformer.swift */; };
|
||||||
838F851C256B4AC400C3E614 /* icon_blank.icns in Resources */ = {isa = PBXBuildFile; fileRef = 838F851B256B4AC400C3E614 /* icon_blank.icns */; };
|
838F851C256B4AC400C3E614 /* icon_blank.icns in Resources */ = {isa = PBXBuildFile; fileRef = 838F851B256B4AC400C3E614 /* icon_blank.icns */; };
|
||||||
838F851E256B4E5E00C3E614 /* Sparkle.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 838F851D256B4E5E00C3E614 /* Sparkle.framework */; };
|
838F851E256B4E5E00C3E614 /* Sparkle.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 838F851D256B4E5E00C3E614 /* Sparkle.framework */; };
|
||||||
|
@ -203,6 +201,8 @@
|
||||||
99EAACA80DD1BB7A00423C38 /* APL.bundle in CopyFiles */ = {isa = PBXBuildFile; fileRef = 566D321B0D538550004466A5 /* APL.bundle */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
|
99EAACA80DD1BB7A00423C38 /* APL.bundle in CopyFiles */ = {isa = PBXBuildFile; fileRef = 566D321B0D538550004466A5 /* APL.bundle */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
|
||||||
B09E96630D74A7BC0064F138 /* stop_current.png in Resources */ = {isa = PBXBuildFile; fileRef = B09E96620D74A7BC0064F138 /* stop_current.png */; };
|
B09E96630D74A7BC0064F138 /* stop_current.png in Resources */ = {isa = PBXBuildFile; fileRef = B09E96620D74A7BC0064F138 /* stop_current.png */; };
|
||||||
ED69CA3B25BE2A390090B90D /* Preferences.preferencePane in CopyFiles */ = {isa = PBXBuildFile; fileRef = 17F5622E0C3BD8FB0019975C /* Preferences.preferencePane */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
ED69CA3B25BE2A390090B90D /* Preferences.preferencePane in CopyFiles */ = {isa = PBXBuildFile; fileRef = 17F5622E0C3BD8FB0019975C /* Preferences.preferencePane */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||||
|
ED69CBC725BE32C00090B90D /* MASShortcut.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ED69CBBF25BE328C0090B90D /* MASShortcut.framework */; };
|
||||||
|
ED69CBCA25BE32E80090B90D /* MASShortcut.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = ED69CBBF25BE328C0090B90D /* MASShortcut.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||||
EDAAA41F25A665C000731773 /* PositionSliderToolbarItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = EDAAA41E25A665C000731773 /* PositionSliderToolbarItem.swift */; };
|
EDAAA41F25A665C000731773 /* PositionSliderToolbarItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = EDAAA41E25A665C000731773 /* PositionSliderToolbarItem.swift */; };
|
||||||
F6F96719102C709000D2C9B4 /* NSString+FinderCompare.m in Sources */ = {isa = PBXBuildFile; fileRef = F6F96718102C709000D2C9B4 /* NSString+FinderCompare.m */; };
|
F6F96719102C709000D2C9B4 /* NSString+FinderCompare.m in Sources */ = {isa = PBXBuildFile; fileRef = F6F96718102C709000D2C9B4 /* NSString+FinderCompare.m */; };
|
||||||
/* End PBXBuildFile section */
|
/* End PBXBuildFile section */
|
||||||
|
@ -488,20 +488,6 @@
|
||||||
remoteGlobalIDString = 8359FF1617FEF35C0060F3ED;
|
remoteGlobalIDString = 8359FF1617FEF35C0060F3ED;
|
||||||
remoteInfo = ArchiveSource;
|
remoteInfo = ArchiveSource;
|
||||||
};
|
};
|
||||||
8384917D1808585D00E7332D /* PBXContainerItemProxy */ = {
|
|
||||||
isa = PBXContainerItemProxy;
|
|
||||||
containerPortal = 838491791808585C00E7332D /* NDHotKey.xcodeproj */;
|
|
||||||
proxyType = 2;
|
|
||||||
remoteGlobalIDString = 32F1615614E6BB3B00D6AB2F;
|
|
||||||
remoteInfo = NDHotKey;
|
|
||||||
};
|
|
||||||
838491851808591400E7332D /* PBXContainerItemProxy */ = {
|
|
||||||
isa = PBXContainerItemProxy;
|
|
||||||
containerPortal = 838491791808585C00E7332D /* NDHotKey.xcodeproj */;
|
|
||||||
proxyType = 1;
|
|
||||||
remoteGlobalIDString = 32F1615514E6BB3B00D6AB2F;
|
|
||||||
remoteInfo = NDHotKey;
|
|
||||||
};
|
|
||||||
83B066A0180D5669008E3612 /* PBXContainerItemProxy */ = {
|
83B066A0180D5669008E3612 /* PBXContainerItemProxy */ = {
|
||||||
isa = PBXContainerItemProxy;
|
isa = PBXContainerItemProxy;
|
||||||
containerPortal = 83B0669C180D5668008E3612 /* MIDI.xcodeproj */;
|
containerPortal = 83B0669C180D5668008E3612 /* MIDI.xcodeproj */;
|
||||||
|
@ -614,6 +600,34 @@
|
||||||
remoteGlobalIDString = 8D5B49B6048680CD000E48DA;
|
remoteGlobalIDString = 8D5B49B6048680CD000E48DA;
|
||||||
remoteInfo = FFMPEG;
|
remoteInfo = FFMPEG;
|
||||||
};
|
};
|
||||||
|
ED69CBBE25BE328C0090B90D /* PBXContainerItemProxy */ = {
|
||||||
|
isa = PBXContainerItemProxy;
|
||||||
|
containerPortal = ED69CBB825BE328C0090B90D /* MASShortcut.xcodeproj */;
|
||||||
|
proxyType = 2;
|
||||||
|
remoteGlobalIDString = 0D827CD31990D4420010B8EF;
|
||||||
|
remoteInfo = MASShortcut;
|
||||||
|
};
|
||||||
|
ED69CBC025BE328C0090B90D /* PBXContainerItemProxy */ = {
|
||||||
|
isa = PBXContainerItemProxy;
|
||||||
|
containerPortal = ED69CBB825BE328C0090B90D /* MASShortcut.xcodeproj */;
|
||||||
|
proxyType = 2;
|
||||||
|
remoteGlobalIDString = 0D827D8319910AFF0010B8EF;
|
||||||
|
remoteInfo = MASShortcutTests;
|
||||||
|
};
|
||||||
|
ED69CBC225BE328C0090B90D /* PBXContainerItemProxy */ = {
|
||||||
|
isa = PBXContainerItemProxy;
|
||||||
|
containerPortal = ED69CBB825BE328C0090B90D /* MASShortcut.xcodeproj */;
|
||||||
|
proxyType = 2;
|
||||||
|
remoteGlobalIDString = 0D827D371990D5E70010B8EF;
|
||||||
|
remoteInfo = Demo;
|
||||||
|
};
|
||||||
|
ED69CBC525BE32B40090B90D /* PBXContainerItemProxy */ = {
|
||||||
|
isa = PBXContainerItemProxy;
|
||||||
|
containerPortal = ED69CBB825BE328C0090B90D /* MASShortcut.xcodeproj */;
|
||||||
|
proxyType = 1;
|
||||||
|
remoteGlobalIDString = 0D827CD21990D4420010B8EF;
|
||||||
|
remoteInfo = MASShortcut;
|
||||||
|
};
|
||||||
/* End PBXContainerItemProxy section */
|
/* End PBXContainerItemProxy section */
|
||||||
|
|
||||||
/* Begin PBXCopyFilesBuildPhase section */
|
/* Begin PBXCopyFilesBuildPhase section */
|
||||||
|
@ -668,8 +682,8 @@
|
||||||
dstPath = "";
|
dstPath = "";
|
||||||
dstSubfolderSpec = 10;
|
dstSubfolderSpec = 10;
|
||||||
files = (
|
files = (
|
||||||
|
ED69CBCA25BE32E80090B90D /* MASShortcut.framework in CopyFiles */,
|
||||||
838F851F256B4E8B00C3E614 /* Sparkle.framework in CopyFiles */,
|
838F851F256B4E8B00C3E614 /* Sparkle.framework in CopyFiles */,
|
||||||
838491881808593200E7332D /* NDHotKey.framework in CopyFiles */,
|
|
||||||
17F561400C3BD4F30019975C /* CogAudio.framework in CopyFiles */,
|
17F561400C3BD4F30019975C /* CogAudio.framework in CopyFiles */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
@ -911,7 +925,6 @@
|
||||||
8384916F180843B200E7332D /* pauseDockBadgeColorful.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = pauseDockBadgeColorful.png; path = Images/pauseDockBadgeColorful.png; sourceTree = "<group>"; };
|
8384916F180843B200E7332D /* pauseDockBadgeColorful.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = pauseDockBadgeColorful.png; path = Images/pauseDockBadgeColorful.png; sourceTree = "<group>"; };
|
||||||
83849170180843B200E7332D /* playDockBadgeColorful.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = playDockBadgeColorful.png; path = Images/playDockBadgeColorful.png; sourceTree = "<group>"; };
|
83849170180843B200E7332D /* playDockBadgeColorful.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = playDockBadgeColorful.png; path = Images/playDockBadgeColorful.png; sourceTree = "<group>"; };
|
||||||
83849171180843B200E7332D /* stopDockBadgeColorful.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = stopDockBadgeColorful.png; path = Images/stopDockBadgeColorful.png; sourceTree = "<group>"; };
|
83849171180843B200E7332D /* stopDockBadgeColorful.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = stopDockBadgeColorful.png; path = Images/stopDockBadgeColorful.png; sourceTree = "<group>"; };
|
||||||
838491791808585C00E7332D /* NDHotKey.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = NDHotKey.xcodeproj; path = Frameworks/NDHotKey/NDHotKey.xcodeproj; sourceTree = "<group>"; };
|
|
||||||
83859520234FEB35004E9946 /* Cog.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Cog.entitlements; sourceTree = "<group>"; };
|
83859520234FEB35004E9946 /* Cog.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Cog.entitlements; sourceTree = "<group>"; };
|
||||||
838F84FF25687C5C00C3E614 /* Cog-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Cog-Bridging-Header.h"; sourceTree = "<group>"; };
|
838F84FF25687C5C00C3E614 /* Cog-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Cog-Bridging-Header.h"; sourceTree = "<group>"; };
|
||||||
838F850025687C5C00C3E614 /* PlaybackStatusToHiddenTransformer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = PlaybackStatusToHiddenTransformer.swift; path = Transformers/PlaybackStatusToHiddenTransformer.swift; sourceTree = "<group>"; };
|
838F850025687C5C00C3E614 /* PlaybackStatusToHiddenTransformer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = PlaybackStatusToHiddenTransformer.swift; path = Transformers/PlaybackStatusToHiddenTransformer.swift; sourceTree = "<group>"; };
|
||||||
|
@ -970,6 +983,8 @@
|
||||||
8E9A30140BA792DC0091081B /* NSFileHandle+CreateFile.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSFileHandle+CreateFile.m"; sourceTree = "<group>"; };
|
8E9A30140BA792DC0091081B /* NSFileHandle+CreateFile.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSFileHandle+CreateFile.m"; sourceTree = "<group>"; };
|
||||||
B09E94300D747F7B0064F138 /* FFMPEG.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = FFMPEG.xcodeproj; path = Plugins/FFMPEG/FFMPEG.xcodeproj; sourceTree = "<group>"; };
|
B09E94300D747F7B0064F138 /* FFMPEG.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = FFMPEG.xcodeproj; path = Plugins/FFMPEG/FFMPEG.xcodeproj; sourceTree = "<group>"; };
|
||||||
B09E96620D74A7BC0064F138 /* stop_current.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = stop_current.png; path = Images/stop_current.png; sourceTree = "<group>"; };
|
B09E96620D74A7BC0064F138 /* stop_current.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = stop_current.png; path = Images/stop_current.png; sourceTree = "<group>"; };
|
||||||
|
ED69CBB825BE328C0090B90D /* MASShortcut.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = MASShortcut.xcodeproj; path = Frameworks/shpakovski/MASShortcut/MASShortcut.xcodeproj; sourceTree = "<group>"; };
|
||||||
|
ED69CF0925BE74BB0090B90D /* Shortcuts.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Shortcuts.h; path = Preferences/Shortcuts.h; sourceTree = "<group>"; };
|
||||||
EDAAA41E25A665C000731773 /* PositionSliderToolbarItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = PositionSliderToolbarItem.swift; path = Window/PositionSliderToolbarItem.swift; sourceTree = "<group>"; };
|
EDAAA41E25A665C000731773 /* PositionSliderToolbarItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = PositionSliderToolbarItem.swift; path = Window/PositionSliderToolbarItem.swift; sourceTree = "<group>"; };
|
||||||
F6F96718102C709000D2C9B4 /* NSString+FinderCompare.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+FinderCompare.m"; sourceTree = "<group>"; };
|
F6F96718102C709000D2C9B4 /* NSString+FinderCompare.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+FinderCompare.m"; sourceTree = "<group>"; };
|
||||||
F6F9671A102C70C800D2C9B4 /* NSString+FinderCompare.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+FinderCompare.h"; sourceTree = "<group>"; };
|
F6F9671A102C70C800D2C9B4 /* NSString+FinderCompare.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+FinderCompare.h"; sourceTree = "<group>"; };
|
||||||
|
@ -980,7 +995,7 @@
|
||||||
isa = PBXFrameworksBuildPhase;
|
isa = PBXFrameworksBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
838491871808591F00E7332D /* NDHotKey.framework in Frameworks */,
|
ED69CBC725BE32C00090B90D /* MASShortcut.framework in Frameworks */,
|
||||||
8355D6B8180613FB00D05687 /* Security.framework in Frameworks */,
|
8355D6B8180613FB00D05687 /* Security.framework in Frameworks */,
|
||||||
8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */,
|
8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */,
|
||||||
8E6889240AAA403C00AD3950 /* Carbon.framework in Frameworks */,
|
8E6889240AAA403C00AD3950 /* Carbon.framework in Frameworks */,
|
||||||
|
@ -1028,8 +1043,8 @@
|
||||||
1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */ = {
|
1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
ED69CBB825BE328C0090B90D /* MASShortcut.xcodeproj */,
|
||||||
838F851D256B4E5E00C3E614 /* Sparkle.framework */,
|
838F851D256B4E5E00C3E614 /* Sparkle.framework */,
|
||||||
838491791808585C00E7332D /* NDHotKey.xcodeproj */,
|
|
||||||
17F5612A0C3BD4DC0019975C /* CogAudio.xcodeproj */,
|
17F5612A0C3BD4DC0019975C /* CogAudio.xcodeproj */,
|
||||||
8E6889230AAA403C00AD3950 /* Carbon.framework */,
|
8E6889230AAA403C00AD3950 /* Carbon.framework */,
|
||||||
1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */,
|
1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */,
|
||||||
|
@ -1600,14 +1615,6 @@
|
||||||
path = SPInvocationGrabbing;
|
path = SPInvocationGrabbing;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
8384917A1808585C00E7332D /* Products */ = {
|
|
||||||
isa = PBXGroup;
|
|
||||||
children = (
|
|
||||||
8384917E1808585D00E7332D /* NDHotKey.framework */,
|
|
||||||
);
|
|
||||||
name = Products;
|
|
||||||
sourceTree = "<group>";
|
|
||||||
};
|
|
||||||
83B0669D180D5668008E3612 /* Products */ = {
|
83B0669D180D5668008E3612 /* Products */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
@ -1659,6 +1666,7 @@
|
||||||
8E07AAEA0AAC90DC00A4B32F /* Preferences */ = {
|
8E07AAEA0AAC90DC00A4B32F /* Preferences */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
ED69CF0925BE74BB0090B90D /* Shortcuts.h */,
|
||||||
17D1B2610F633D2C00694C57 /* PreferencePanePlugin.h */,
|
17D1B2610F633D2C00694C57 /* PreferencePanePlugin.h */,
|
||||||
17D1B25B0F633A4F00694C57 /* PreferencePluginController.h */,
|
17D1B25B0F633A4F00694C57 /* PreferencePluginController.h */,
|
||||||
17D1B25C0F633A4F00694C57 /* PreferencePluginController.m */,
|
17D1B25C0F633A4F00694C57 /* PreferencePluginController.m */,
|
||||||
|
@ -1756,6 +1764,16 @@
|
||||||
name = Products;
|
name = Products;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
|
ED69CBB925BE328C0090B90D /* Products */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
ED69CBBF25BE328C0090B90D /* MASShortcut.framework */,
|
||||||
|
ED69CBC125BE328C0090B90D /* MASShortcutTests.xctest */,
|
||||||
|
ED69CBC325BE328C0090B90D /* Demo.app */,
|
||||||
|
);
|
||||||
|
name = Products;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
/* End PBXGroup section */
|
/* End PBXGroup section */
|
||||||
|
|
||||||
/* Begin PBXNativeTarget section */
|
/* Begin PBXNativeTarget section */
|
||||||
|
@ -1774,6 +1792,7 @@
|
||||||
buildRules = (
|
buildRules = (
|
||||||
);
|
);
|
||||||
dependencies = (
|
dependencies = (
|
||||||
|
ED69CBC625BE32B40090B90D /* PBXTargetDependency */,
|
||||||
834D793E20E4EFD200C4A5CC /* PBXTargetDependency */,
|
834D793E20E4EFD200C4A5CC /* PBXTargetDependency */,
|
||||||
834D793020E4EFCC00C4A5CC /* PBXTargetDependency */,
|
834D793020E4EFCC00C4A5CC /* PBXTargetDependency */,
|
||||||
834F7F4220E4E4CD00228DAB /* PBXTargetDependency */,
|
834F7F4220E4E4CD00228DAB /* PBXTargetDependency */,
|
||||||
|
@ -1788,7 +1807,6 @@
|
||||||
836F5BEE1A3579F5002730CC /* PBXTargetDependency */,
|
836F5BEE1A3579F5002730CC /* PBXTargetDependency */,
|
||||||
836FB5A618206F1500B3AD2D /* PBXTargetDependency */,
|
836FB5A618206F1500B3AD2D /* PBXTargetDependency */,
|
||||||
83B06703180D5776008E3612 /* PBXTargetDependency */,
|
83B06703180D5776008E3612 /* PBXTargetDependency */,
|
||||||
838491861808591400E7332D /* PBXTargetDependency */,
|
|
||||||
8375B36217FFEF010092A79F /* PBXTargetDependency */,
|
8375B36217FFEF010092A79F /* PBXTargetDependency */,
|
||||||
83BCB8DD17FC96FC00760340 /* PBXTargetDependency */,
|
83BCB8DD17FC96FC00760340 /* PBXTargetDependency */,
|
||||||
83BCB8D917FC96F800760340 /* PBXTargetDependency */,
|
83BCB8D917FC96F800760340 /* PBXTargetDependency */,
|
||||||
|
@ -1900,6 +1918,10 @@
|
||||||
ProductGroup = 8E8D40830CBB036600135C1B /* Products */;
|
ProductGroup = 8E8D40830CBB036600135C1B /* Products */;
|
||||||
ProjectRef = 8E8D40820CBB036600135C1B /* M3u.xcodeproj */;
|
ProjectRef = 8E8D40820CBB036600135C1B /* M3u.xcodeproj */;
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
ProductGroup = ED69CBB925BE328C0090B90D /* Products */;
|
||||||
|
ProjectRef = ED69CBB825BE328C0090B90D /* MASShortcut.xcodeproj */;
|
||||||
|
},
|
||||||
{
|
{
|
||||||
ProductGroup = 83B0669D180D5668008E3612 /* Products */;
|
ProductGroup = 83B0669D180D5668008E3612 /* Products */;
|
||||||
ProjectRef = 83B0669C180D5668008E3612 /* MIDI.xcodeproj */;
|
ProjectRef = 83B0669C180D5668008E3612 /* MIDI.xcodeproj */;
|
||||||
|
@ -1908,10 +1930,6 @@
|
||||||
ProductGroup = 17C8089F0C3BD1AB005707C4 /* Products */;
|
ProductGroup = 17C8089F0C3BD1AB005707C4 /* Products */;
|
||||||
ProjectRef = 17C8089E0C3BD1AB005707C4 /* Musepack.xcodeproj */;
|
ProjectRef = 17C8089E0C3BD1AB005707C4 /* Musepack.xcodeproj */;
|
||||||
},
|
},
|
||||||
{
|
|
||||||
ProductGroup = 8384917A1808585C00E7332D /* Products */;
|
|
||||||
ProjectRef = 838491791808585C00E7332D /* NDHotKey.xcodeproj */;
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
ProductGroup = 83CA5AF820E4E394003E463A /* Products */;
|
ProductGroup = 83CA5AF820E4E394003E463A /* Products */;
|
||||||
ProjectRef = 83E5EFAC1FFEF78100659F0F /* OpenMPT.xcodeproj */;
|
ProjectRef = 83E5EFAC1FFEF78100659F0F /* OpenMPT.xcodeproj */;
|
||||||
|
@ -2102,13 +2120,6 @@
|
||||||
remoteRef = 836FB5461820538800B3AD2D /* PBXContainerItemProxy */;
|
remoteRef = 836FB5461820538800B3AD2D /* PBXContainerItemProxy */;
|
||||||
sourceTree = BUILT_PRODUCTS_DIR;
|
sourceTree = BUILT_PRODUCTS_DIR;
|
||||||
};
|
};
|
||||||
8384917E1808585D00E7332D /* NDHotKey.framework */ = {
|
|
||||||
isa = PBXReferenceProxy;
|
|
||||||
fileType = wrapper.framework;
|
|
||||||
path = NDHotKey.framework;
|
|
||||||
remoteRef = 8384917D1808585D00E7332D /* PBXContainerItemProxy */;
|
|
||||||
sourceTree = BUILT_PRODUCTS_DIR;
|
|
||||||
};
|
|
||||||
83B066A1180D5669008E3612 /* MIDI.bundle */ = {
|
83B066A1180D5669008E3612 /* MIDI.bundle */ = {
|
||||||
isa = PBXReferenceProxy;
|
isa = PBXReferenceProxy;
|
||||||
fileType = wrapper.cfbundle;
|
fileType = wrapper.cfbundle;
|
||||||
|
@ -2172,6 +2183,27 @@
|
||||||
remoteRef = B09E94340D747F7B0064F138 /* PBXContainerItemProxy */;
|
remoteRef = B09E94340D747F7B0064F138 /* PBXContainerItemProxy */;
|
||||||
sourceTree = BUILT_PRODUCTS_DIR;
|
sourceTree = BUILT_PRODUCTS_DIR;
|
||||||
};
|
};
|
||||||
|
ED69CBBF25BE328C0090B90D /* MASShortcut.framework */ = {
|
||||||
|
isa = PBXReferenceProxy;
|
||||||
|
fileType = wrapper.framework;
|
||||||
|
path = MASShortcut.framework;
|
||||||
|
remoteRef = ED69CBBE25BE328C0090B90D /* PBXContainerItemProxy */;
|
||||||
|
sourceTree = BUILT_PRODUCTS_DIR;
|
||||||
|
};
|
||||||
|
ED69CBC125BE328C0090B90D /* MASShortcutTests.xctest */ = {
|
||||||
|
isa = PBXReferenceProxy;
|
||||||
|
fileType = wrapper.cfbundle;
|
||||||
|
path = MASShortcutTests.xctest;
|
||||||
|
remoteRef = ED69CBC025BE328C0090B90D /* PBXContainerItemProxy */;
|
||||||
|
sourceTree = BUILT_PRODUCTS_DIR;
|
||||||
|
};
|
||||||
|
ED69CBC325BE328C0090B90D /* Demo.app */ = {
|
||||||
|
isa = PBXReferenceProxy;
|
||||||
|
fileType = wrapper.application;
|
||||||
|
path = Demo.app;
|
||||||
|
remoteRef = ED69CBC225BE328C0090B90D /* PBXContainerItemProxy */;
|
||||||
|
sourceTree = BUILT_PRODUCTS_DIR;
|
||||||
|
};
|
||||||
/* End PBXReferenceProxy section */
|
/* End PBXReferenceProxy section */
|
||||||
|
|
||||||
/* Begin PBXResourcesBuildPhase section */
|
/* Begin PBXResourcesBuildPhase section */
|
||||||
|
@ -2474,11 +2506,6 @@
|
||||||
name = ArchiveSource;
|
name = ArchiveSource;
|
||||||
targetProxy = 8375B36117FFEF010092A79F /* PBXContainerItemProxy */;
|
targetProxy = 8375B36117FFEF010092A79F /* PBXContainerItemProxy */;
|
||||||
};
|
};
|
||||||
838491861808591400E7332D /* PBXTargetDependency */ = {
|
|
||||||
isa = PBXTargetDependency;
|
|
||||||
name = NDHotKey;
|
|
||||||
targetProxy = 838491851808591400E7332D /* PBXContainerItemProxy */;
|
|
||||||
};
|
|
||||||
83B06703180D5776008E3612 /* PBXTargetDependency */ = {
|
83B06703180D5776008E3612 /* PBXTargetDependency */ = {
|
||||||
isa = PBXTargetDependency;
|
isa = PBXTargetDependency;
|
||||||
name = MIDI;
|
name = MIDI;
|
||||||
|
@ -2514,6 +2541,11 @@
|
||||||
name = Pls;
|
name = Pls;
|
||||||
targetProxy = 8E8D41CB0CBB0DD200135C1B /* PBXContainerItemProxy */;
|
targetProxy = 8E8D41CB0CBB0DD200135C1B /* PBXContainerItemProxy */;
|
||||||
};
|
};
|
||||||
|
ED69CBC625BE32B40090B90D /* PBXTargetDependency */ = {
|
||||||
|
isa = PBXTargetDependency;
|
||||||
|
name = MASShortcut;
|
||||||
|
targetProxy = ED69CBC525BE32B40090B90D /* PBXContainerItemProxy */;
|
||||||
|
};
|
||||||
/* End PBXTargetDependency section */
|
/* End PBXTargetDependency section */
|
||||||
|
|
||||||
/* Begin PBXVariantGroup section */
|
/* Begin PBXVariantGroup section */
|
||||||
|
@ -2619,11 +2651,7 @@
|
||||||
COMBINE_HIDPI_IMAGES = YES;
|
COMBINE_HIDPI_IMAGES = YES;
|
||||||
COPY_PHASE_STRIP = NO;
|
COPY_PHASE_STRIP = NO;
|
||||||
ENABLE_HARDENED_RUNTIME = YES;
|
ENABLE_HARDENED_RUNTIME = YES;
|
||||||
FRAMEWORK_SEARCH_PATHS = (
|
FRAMEWORK_SEARCH_PATHS = "$(PROJECT_DIR)/ThirdParty/Frameworks";
|
||||||
ThirdParty/Frameworks,
|
|
||||||
"$(PROJECT_DIR)/ThirdParty/Frameworks",
|
|
||||||
"$(PROJECT_DIR)/ThirdParty/Sparkle",
|
|
||||||
);
|
|
||||||
GCC_DYNAMIC_NO_PIC = NO;
|
GCC_DYNAMIC_NO_PIC = NO;
|
||||||
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
|
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
|
||||||
GCC_OPTIMIZATION_LEVEL = 0;
|
GCC_OPTIMIZATION_LEVEL = 0;
|
||||||
|
@ -2669,11 +2697,7 @@
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
COMBINE_HIDPI_IMAGES = YES;
|
COMBINE_HIDPI_IMAGES = YES;
|
||||||
ENABLE_HARDENED_RUNTIME = YES;
|
ENABLE_HARDENED_RUNTIME = YES;
|
||||||
FRAMEWORK_SEARCH_PATHS = (
|
FRAMEWORK_SEARCH_PATHS = "$(PROJECT_DIR)/ThirdParty/Frameworks";
|
||||||
ThirdParty/Frameworks,
|
|
||||||
"$(PROJECT_DIR)/ThirdParty/Frameworks",
|
|
||||||
"$(PROJECT_DIR)/ThirdParty/Sparkle",
|
|
||||||
);
|
|
||||||
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
|
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
|
||||||
INFOPLIST_FILE = Info.plist;
|
INFOPLIST_FILE = Info.plist;
|
||||||
INSTALL_PATH = "$(HOME)/Applications";
|
INSTALL_PATH = "$(HOME)/Applications";
|
||||||
|
|
|
@ -1,382 +0,0 @@
|
||||||
// !$*UTF8*$!
|
|
||||||
{
|
|
||||||
archiveVersion = 1;
|
|
||||||
classes = {
|
|
||||||
};
|
|
||||||
objectVersion = 46;
|
|
||||||
objects = {
|
|
||||||
|
|
||||||
/* Begin PBXBuildFile section */
|
|
||||||
32F1615A14E6BB3B00D6AB2F /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 32F1615914E6BB3B00D6AB2F /* Cocoa.framework */; };
|
|
||||||
32F1616414E6BB3B00D6AB2F /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 32F1616214E6BB3B00D6AB2F /* InfoPlist.strings */; };
|
|
||||||
32F1617A14E6BBFC00D6AB2F /* NDHotKeyControl.h in Headers */ = {isa = PBXBuildFile; fileRef = 32F1617414E6BBFC00D6AB2F /* NDHotKeyControl.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
|
||||||
32F1617B14E6BBFC00D6AB2F /* NDHotKeyControl.m in Sources */ = {isa = PBXBuildFile; fileRef = 32F1617514E6BBFC00D6AB2F /* NDHotKeyControl.m */; };
|
|
||||||
32F1617C14E6BBFC00D6AB2F /* NDHotKeyEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 32F1617614E6BBFC00D6AB2F /* NDHotKeyEvent.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
|
||||||
32F1617D14E6BBFC00D6AB2F /* NDHotKeyEvent.m in Sources */ = {isa = PBXBuildFile; fileRef = 32F1617714E6BBFC00D6AB2F /* NDHotKeyEvent.m */; };
|
|
||||||
32F1617E14E6BBFC00D6AB2F /* NDKeyboardLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = 32F1617814E6BBFC00D6AB2F /* NDKeyboardLayout.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
|
||||||
32F1617F14E6BBFC00D6AB2F /* NDKeyboardLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = 32F1617914E6BBFC00D6AB2F /* NDKeyboardLayout.m */; };
|
|
||||||
32F1618E14E6BE7300D6AB2F /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 32F1618D14E6BE7300D6AB2F /* Carbon.framework */; };
|
|
||||||
/* End PBXBuildFile section */
|
|
||||||
|
|
||||||
/* Begin PBXFileReference section */
|
|
||||||
32F1615614E6BB3B00D6AB2F /* NDHotKey.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = NDHotKey.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
|
||||||
32F1615914E6BB3B00D6AB2F /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
|
|
||||||
32F1615C14E6BB3B00D6AB2F /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; };
|
|
||||||
32F1615D14E6BB3B00D6AB2F /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; };
|
|
||||||
32F1615E14E6BB3B00D6AB2F /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
|
|
||||||
32F1616114E6BB3B00D6AB2F /* NDHotKey-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "NDHotKey-Info.plist"; sourceTree = "<group>"; };
|
|
||||||
32F1616314E6BB3B00D6AB2F /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
|
|
||||||
32F1616514E6BB3B00D6AB2F /* NDHotKey-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NDHotKey-Prefix.pch"; sourceTree = "<group>"; };
|
|
||||||
32F1617414E6BBFC00D6AB2F /* NDHotKeyControl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NDHotKeyControl.h; sourceTree = "<group>"; };
|
|
||||||
32F1617514E6BBFC00D6AB2F /* NDHotKeyControl.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NDHotKeyControl.m; sourceTree = "<group>"; };
|
|
||||||
32F1617614E6BBFC00D6AB2F /* NDHotKeyEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NDHotKeyEvent.h; sourceTree = "<group>"; };
|
|
||||||
32F1617714E6BBFC00D6AB2F /* NDHotKeyEvent.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NDHotKeyEvent.m; sourceTree = "<group>"; };
|
|
||||||
32F1617814E6BBFC00D6AB2F /* NDKeyboardLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NDKeyboardLayout.h; sourceTree = "<group>"; };
|
|
||||||
32F1617914E6BBFC00D6AB2F /* NDKeyboardLayout.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NDKeyboardLayout.m; sourceTree = "<group>"; };
|
|
||||||
32F1618D14E6BE7300D6AB2F /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = System/Library/Frameworks/Carbon.framework; sourceTree = SDKROOT; };
|
|
||||||
833F681D1CDBCAA700AFB9F0 /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = es.lproj/InfoPlist.strings; sourceTree = "<group>"; };
|
|
||||||
/* End PBXFileReference section */
|
|
||||||
|
|
||||||
/* Begin PBXFrameworksBuildPhase section */
|
|
||||||
32F1615214E6BB3B00D6AB2F /* Frameworks */ = {
|
|
||||||
isa = PBXFrameworksBuildPhase;
|
|
||||||
buildActionMask = 2147483647;
|
|
||||||
files = (
|
|
||||||
32F1618E14E6BE7300D6AB2F /* Carbon.framework in Frameworks */,
|
|
||||||
32F1615A14E6BB3B00D6AB2F /* Cocoa.framework in Frameworks */,
|
|
||||||
);
|
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
|
||||||
};
|
|
||||||
/* End PBXFrameworksBuildPhase section */
|
|
||||||
|
|
||||||
/* Begin PBXGroup section */
|
|
||||||
32F1614A14E6BB3B00D6AB2F = {
|
|
||||||
isa = PBXGroup;
|
|
||||||
children = (
|
|
||||||
32F1618D14E6BE7300D6AB2F /* Carbon.framework */,
|
|
||||||
32F1615F14E6BB3B00D6AB2F /* NDHotKey */,
|
|
||||||
32F1615814E6BB3B00D6AB2F /* Frameworks */,
|
|
||||||
32F1615714E6BB3B00D6AB2F /* Products */,
|
|
||||||
);
|
|
||||||
sourceTree = "<group>";
|
|
||||||
};
|
|
||||||
32F1615714E6BB3B00D6AB2F /* Products */ = {
|
|
||||||
isa = PBXGroup;
|
|
||||||
children = (
|
|
||||||
32F1615614E6BB3B00D6AB2F /* NDHotKey.framework */,
|
|
||||||
);
|
|
||||||
name = Products;
|
|
||||||
sourceTree = "<group>";
|
|
||||||
};
|
|
||||||
32F1615814E6BB3B00D6AB2F /* Frameworks */ = {
|
|
||||||
isa = PBXGroup;
|
|
||||||
children = (
|
|
||||||
32F1615914E6BB3B00D6AB2F /* Cocoa.framework */,
|
|
||||||
32F1615B14E6BB3B00D6AB2F /* Other Frameworks */,
|
|
||||||
);
|
|
||||||
name = Frameworks;
|
|
||||||
sourceTree = "<group>";
|
|
||||||
};
|
|
||||||
32F1615B14E6BB3B00D6AB2F /* Other Frameworks */ = {
|
|
||||||
isa = PBXGroup;
|
|
||||||
children = (
|
|
||||||
32F1615C14E6BB3B00D6AB2F /* AppKit.framework */,
|
|
||||||
32F1615D14E6BB3B00D6AB2F /* CoreData.framework */,
|
|
||||||
32F1615E14E6BB3B00D6AB2F /* Foundation.framework */,
|
|
||||||
);
|
|
||||||
name = "Other Frameworks";
|
|
||||||
sourceTree = "<group>";
|
|
||||||
};
|
|
||||||
32F1615F14E6BB3B00D6AB2F /* NDHotKey */ = {
|
|
||||||
isa = PBXGroup;
|
|
||||||
children = (
|
|
||||||
32F1617414E6BBFC00D6AB2F /* NDHotKeyControl.h */,
|
|
||||||
32F1617514E6BBFC00D6AB2F /* NDHotKeyControl.m */,
|
|
||||||
32F1617614E6BBFC00D6AB2F /* NDHotKeyEvent.h */,
|
|
||||||
32F1617714E6BBFC00D6AB2F /* NDHotKeyEvent.m */,
|
|
||||||
32F1617814E6BBFC00D6AB2F /* NDKeyboardLayout.h */,
|
|
||||||
32F1617914E6BBFC00D6AB2F /* NDKeyboardLayout.m */,
|
|
||||||
32F1616014E6BB3B00D6AB2F /* Supporting Files */,
|
|
||||||
);
|
|
||||||
path = NDHotKey;
|
|
||||||
sourceTree = "<group>";
|
|
||||||
};
|
|
||||||
32F1616014E6BB3B00D6AB2F /* Supporting Files */ = {
|
|
||||||
isa = PBXGroup;
|
|
||||||
children = (
|
|
||||||
32F1616114E6BB3B00D6AB2F /* NDHotKey-Info.plist */,
|
|
||||||
32F1616214E6BB3B00D6AB2F /* InfoPlist.strings */,
|
|
||||||
32F1616514E6BB3B00D6AB2F /* NDHotKey-Prefix.pch */,
|
|
||||||
);
|
|
||||||
name = "Supporting Files";
|
|
||||||
sourceTree = "<group>";
|
|
||||||
};
|
|
||||||
/* End PBXGroup section */
|
|
||||||
|
|
||||||
/* Begin PBXHeadersBuildPhase section */
|
|
||||||
32F1615314E6BB3B00D6AB2F /* Headers */ = {
|
|
||||||
isa = PBXHeadersBuildPhase;
|
|
||||||
buildActionMask = 2147483647;
|
|
||||||
files = (
|
|
||||||
32F1617A14E6BBFC00D6AB2F /* NDHotKeyControl.h in Headers */,
|
|
||||||
32F1617C14E6BBFC00D6AB2F /* NDHotKeyEvent.h in Headers */,
|
|
||||||
32F1617E14E6BBFC00D6AB2F /* NDKeyboardLayout.h in Headers */,
|
|
||||||
);
|
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
|
||||||
};
|
|
||||||
/* End PBXHeadersBuildPhase section */
|
|
||||||
|
|
||||||
/* Begin PBXNativeTarget section */
|
|
||||||
32F1615514E6BB3B00D6AB2F /* NDHotKey */ = {
|
|
||||||
isa = PBXNativeTarget;
|
|
||||||
buildConfigurationList = 32F1616B14E6BB3B00D6AB2F /* Build configuration list for PBXNativeTarget "NDHotKey" */;
|
|
||||||
buildPhases = (
|
|
||||||
32F1615114E6BB3B00D6AB2F /* Sources */,
|
|
||||||
32F1615214E6BB3B00D6AB2F /* Frameworks */,
|
|
||||||
32F1615314E6BB3B00D6AB2F /* Headers */,
|
|
||||||
32F1615414E6BB3B00D6AB2F /* Resources */,
|
|
||||||
);
|
|
||||||
buildRules = (
|
|
||||||
);
|
|
||||||
dependencies = (
|
|
||||||
);
|
|
||||||
name = NDHotKey;
|
|
||||||
productName = NDHotKey;
|
|
||||||
productReference = 32F1615614E6BB3B00D6AB2F /* NDHotKey.framework */;
|
|
||||||
productType = "com.apple.product-type.framework";
|
|
||||||
};
|
|
||||||
/* End PBXNativeTarget section */
|
|
||||||
|
|
||||||
/* Begin PBXProject section */
|
|
||||||
32F1614C14E6BB3B00D6AB2F /* Project object */ = {
|
|
||||||
isa = PBXProject;
|
|
||||||
attributes = {
|
|
||||||
LastUpgradeCheck = 0940;
|
|
||||||
ORGANIZATIONNAME = "dmitry.promsky@gmail.com";
|
|
||||||
TargetAttributes = {
|
|
||||||
32F1615514E6BB3B00D6AB2F = {
|
|
||||||
DevelopmentTeam = "";
|
|
||||||
ProvisioningStyle = Automatic;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
buildConfigurationList = 32F1614F14E6BB3B00D6AB2F /* Build configuration list for PBXProject "NDHotKey" */;
|
|
||||||
compatibilityVersion = "Xcode 3.2";
|
|
||||||
developmentRegion = en;
|
|
||||||
hasScannedForEncodings = 0;
|
|
||||||
knownRegions = (
|
|
||||||
en,
|
|
||||||
es,
|
|
||||||
Base,
|
|
||||||
);
|
|
||||||
mainGroup = 32F1614A14E6BB3B00D6AB2F;
|
|
||||||
productRefGroup = 32F1615714E6BB3B00D6AB2F /* Products */;
|
|
||||||
projectDirPath = "";
|
|
||||||
projectRoot = "";
|
|
||||||
targets = (
|
|
||||||
32F1615514E6BB3B00D6AB2F /* NDHotKey */,
|
|
||||||
);
|
|
||||||
};
|
|
||||||
/* End PBXProject section */
|
|
||||||
|
|
||||||
/* Begin PBXResourcesBuildPhase section */
|
|
||||||
32F1615414E6BB3B00D6AB2F /* Resources */ = {
|
|
||||||
isa = PBXResourcesBuildPhase;
|
|
||||||
buildActionMask = 2147483647;
|
|
||||||
files = (
|
|
||||||
32F1616414E6BB3B00D6AB2F /* InfoPlist.strings in Resources */,
|
|
||||||
);
|
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
|
||||||
};
|
|
||||||
/* End PBXResourcesBuildPhase section */
|
|
||||||
|
|
||||||
/* Begin PBXSourcesBuildPhase section */
|
|
||||||
32F1615114E6BB3B00D6AB2F /* Sources */ = {
|
|
||||||
isa = PBXSourcesBuildPhase;
|
|
||||||
buildActionMask = 2147483647;
|
|
||||||
files = (
|
|
||||||
32F1617B14E6BBFC00D6AB2F /* NDHotKeyControl.m in Sources */,
|
|
||||||
32F1617D14E6BBFC00D6AB2F /* NDHotKeyEvent.m in Sources */,
|
|
||||||
32F1617F14E6BBFC00D6AB2F /* NDKeyboardLayout.m in Sources */,
|
|
||||||
);
|
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
|
||||||
};
|
|
||||||
/* End PBXSourcesBuildPhase section */
|
|
||||||
|
|
||||||
/* Begin PBXVariantGroup section */
|
|
||||||
32F1616214E6BB3B00D6AB2F /* InfoPlist.strings */ = {
|
|
||||||
isa = PBXVariantGroup;
|
|
||||||
children = (
|
|
||||||
32F1616314E6BB3B00D6AB2F /* en */,
|
|
||||||
833F681D1CDBCAA700AFB9F0 /* es */,
|
|
||||||
);
|
|
||||||
name = InfoPlist.strings;
|
|
||||||
sourceTree = "<group>";
|
|
||||||
};
|
|
||||||
/* End PBXVariantGroup section */
|
|
||||||
|
|
||||||
/* Begin XCBuildConfiguration section */
|
|
||||||
32F1616914E6BB3B00D6AB2F /* Debug */ = {
|
|
||||||
isa = XCBuildConfiguration;
|
|
||||||
buildSettings = {
|
|
||||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
|
||||||
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
|
|
||||||
CLANG_ENABLE_OBJC_ARC = YES;
|
|
||||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
|
||||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
|
||||||
CLANG_WARN_COMMA = YES;
|
|
||||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
|
||||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
|
||||||
CLANG_WARN_EMPTY_BODY = YES;
|
|
||||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
|
||||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
|
||||||
CLANG_WARN_INT_CONVERSION = YES;
|
|
||||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
|
||||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
|
||||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
|
||||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
|
||||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
|
||||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
|
||||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
|
||||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
|
||||||
COPY_PHASE_STRIP = NO;
|
|
||||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
|
||||||
ENABLE_TESTABILITY = YES;
|
|
||||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
|
||||||
GCC_DYNAMIC_NO_PIC = NO;
|
|
||||||
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
|
|
||||||
GCC_NO_COMMON_BLOCKS = YES;
|
|
||||||
GCC_OPTIMIZATION_LEVEL = 0;
|
|
||||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
|
||||||
"DEBUG=1",
|
|
||||||
"$(inherited)",
|
|
||||||
);
|
|
||||||
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
|
||||||
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
|
|
||||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
|
||||||
GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
|
|
||||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
|
||||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
|
||||||
GCC_WARN_UNINITIALIZED_AUTOS = YES;
|
|
||||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
|
||||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
|
||||||
MACOSX_DEPLOYMENT_TARGET = 10.13;
|
|
||||||
ONLY_ACTIVE_ARCH = YES;
|
|
||||||
SDKROOT = macosx;
|
|
||||||
SYMROOT = ../../build;
|
|
||||||
};
|
|
||||||
name = Debug;
|
|
||||||
};
|
|
||||||
32F1616A14E6BB3B00D6AB2F /* Release */ = {
|
|
||||||
isa = XCBuildConfiguration;
|
|
||||||
buildSettings = {
|
|
||||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
|
||||||
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
|
|
||||||
CLANG_ENABLE_OBJC_ARC = YES;
|
|
||||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
|
||||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
|
||||||
CLANG_WARN_COMMA = YES;
|
|
||||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
|
||||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
|
||||||
CLANG_WARN_EMPTY_BODY = YES;
|
|
||||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
|
||||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
|
||||||
CLANG_WARN_INT_CONVERSION = YES;
|
|
||||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
|
||||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
|
||||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
|
||||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
|
||||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
|
||||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
|
||||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
|
||||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
|
||||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
|
||||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
|
||||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
|
||||||
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
|
|
||||||
GCC_NO_COMMON_BLOCKS = YES;
|
|
||||||
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
|
|
||||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
|
||||||
GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
|
|
||||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
|
||||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
|
||||||
GCC_WARN_UNINITIALIZED_AUTOS = YES;
|
|
||||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
|
||||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
|
||||||
MACOSX_DEPLOYMENT_TARGET = 10.13;
|
|
||||||
SDKROOT = macosx;
|
|
||||||
SYMROOT = ../../build;
|
|
||||||
};
|
|
||||||
name = Release;
|
|
||||||
};
|
|
||||||
32F1616C14E6BB3B00D6AB2F /* Debug */ = {
|
|
||||||
isa = XCBuildConfiguration;
|
|
||||||
buildSettings = {
|
|
||||||
CODE_SIGN_IDENTITY = "";
|
|
||||||
CODE_SIGN_STYLE = Automatic;
|
|
||||||
COMBINE_HIDPI_IMAGES = YES;
|
|
||||||
DEVELOPMENT_TEAM = "";
|
|
||||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
|
||||||
DYLIB_CURRENT_VERSION = 1;
|
|
||||||
FRAMEWORK_VERSION = A;
|
|
||||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
|
||||||
GCC_PREFIX_HEADER = "NDHotKey/NDHotKey-Prefix.pch";
|
|
||||||
INFOPLIST_FILE = "NDHotKey/NDHotKey-Info.plist";
|
|
||||||
INSTALL_PATH = "@loader_path/../Frameworks";
|
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = "ND.${PRODUCT_NAME:rfc1034identifier}";
|
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
|
||||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
|
||||||
SDKROOT = macosx;
|
|
||||||
SKIP_INSTALL = YES;
|
|
||||||
WRAPPER_EXTENSION = framework;
|
|
||||||
};
|
|
||||||
name = Debug;
|
|
||||||
};
|
|
||||||
32F1616D14E6BB3B00D6AB2F /* Release */ = {
|
|
||||||
isa = XCBuildConfiguration;
|
|
||||||
buildSettings = {
|
|
||||||
CODE_SIGN_IDENTITY = "";
|
|
||||||
CODE_SIGN_STYLE = Automatic;
|
|
||||||
COMBINE_HIDPI_IMAGES = YES;
|
|
||||||
DEVELOPMENT_TEAM = "";
|
|
||||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
|
||||||
DYLIB_CURRENT_VERSION = 1;
|
|
||||||
FRAMEWORK_VERSION = A;
|
|
||||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
|
||||||
GCC_PREFIX_HEADER = "NDHotKey/NDHotKey-Prefix.pch";
|
|
||||||
INFOPLIST_FILE = "NDHotKey/NDHotKey-Info.plist";
|
|
||||||
INSTALL_PATH = "@loader_path/../Frameworks";
|
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = "ND.${PRODUCT_NAME:rfc1034identifier}";
|
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
|
||||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
|
||||||
SDKROOT = macosx;
|
|
||||||
SKIP_INSTALL = YES;
|
|
||||||
WRAPPER_EXTENSION = framework;
|
|
||||||
};
|
|
||||||
name = Release;
|
|
||||||
};
|
|
||||||
/* End XCBuildConfiguration section */
|
|
||||||
|
|
||||||
/* Begin XCConfigurationList section */
|
|
||||||
32F1614F14E6BB3B00D6AB2F /* Build configuration list for PBXProject "NDHotKey" */ = {
|
|
||||||
isa = XCConfigurationList;
|
|
||||||
buildConfigurations = (
|
|
||||||
32F1616914E6BB3B00D6AB2F /* Debug */,
|
|
||||||
32F1616A14E6BB3B00D6AB2F /* Release */,
|
|
||||||
);
|
|
||||||
defaultConfigurationIsVisible = 0;
|
|
||||||
defaultConfigurationName = Release;
|
|
||||||
};
|
|
||||||
32F1616B14E6BB3B00D6AB2F /* Build configuration list for PBXNativeTarget "NDHotKey" */ = {
|
|
||||||
isa = XCConfigurationList;
|
|
||||||
buildConfigurations = (
|
|
||||||
32F1616C14E6BB3B00D6AB2F /* Debug */,
|
|
||||||
32F1616D14E6BB3B00D6AB2F /* Release */,
|
|
||||||
);
|
|
||||||
defaultConfigurationIsVisible = 0;
|
|
||||||
defaultConfigurationName = Release;
|
|
||||||
};
|
|
||||||
/* End XCConfigurationList section */
|
|
||||||
};
|
|
||||||
rootObject = 32F1614C14E6BB3B00D6AB2F /* Project object */;
|
|
||||||
}
|
|
|
@ -1,76 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<Scheme
|
|
||||||
LastUpgradeVersion = "1150"
|
|
||||||
version = "1.3">
|
|
||||||
<BuildAction
|
|
||||||
parallelizeBuildables = "YES"
|
|
||||||
buildImplicitDependencies = "YES">
|
|
||||||
<BuildActionEntries>
|
|
||||||
<BuildActionEntry
|
|
||||||
buildForTesting = "YES"
|
|
||||||
buildForRunning = "YES"
|
|
||||||
buildForProfiling = "YES"
|
|
||||||
buildForArchiving = "YES"
|
|
||||||
buildForAnalyzing = "YES">
|
|
||||||
<BuildableReference
|
|
||||||
BuildableIdentifier = "primary"
|
|
||||||
BlueprintIdentifier = "32F1615514E6BB3B00D6AB2F"
|
|
||||||
BuildableName = "NDHotKey.framework"
|
|
||||||
BlueprintName = "NDHotKey"
|
|
||||||
ReferencedContainer = "container:NDHotKey.xcodeproj">
|
|
||||||
</BuildableReference>
|
|
||||||
</BuildActionEntry>
|
|
||||||
</BuildActionEntries>
|
|
||||||
</BuildAction>
|
|
||||||
<TestAction
|
|
||||||
buildConfiguration = "Debug"
|
|
||||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
|
||||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
|
||||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
|
||||||
<Testables>
|
|
||||||
</Testables>
|
|
||||||
</TestAction>
|
|
||||||
<LaunchAction
|
|
||||||
buildConfiguration = "Debug"
|
|
||||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
|
||||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
|
||||||
launchStyle = "0"
|
|
||||||
useCustomWorkingDirectory = "NO"
|
|
||||||
ignoresPersistentStateOnLaunch = "NO"
|
|
||||||
debugDocumentVersioning = "YES"
|
|
||||||
debugServiceExtension = "internal"
|
|
||||||
allowLocationSimulation = "YES">
|
|
||||||
<MacroExpansion>
|
|
||||||
<BuildableReference
|
|
||||||
BuildableIdentifier = "primary"
|
|
||||||
BlueprintIdentifier = "32F1615514E6BB3B00D6AB2F"
|
|
||||||
BuildableName = "NDHotKey.framework"
|
|
||||||
BlueprintName = "NDHotKey"
|
|
||||||
ReferencedContainer = "container:NDHotKey.xcodeproj">
|
|
||||||
</BuildableReference>
|
|
||||||
</MacroExpansion>
|
|
||||||
</LaunchAction>
|
|
||||||
<ProfileAction
|
|
||||||
buildConfiguration = "Release"
|
|
||||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
|
||||||
savedToolIdentifier = ""
|
|
||||||
useCustomWorkingDirectory = "NO"
|
|
||||||
debugDocumentVersioning = "YES">
|
|
||||||
<MacroExpansion>
|
|
||||||
<BuildableReference
|
|
||||||
BuildableIdentifier = "primary"
|
|
||||||
BlueprintIdentifier = "32F1615514E6BB3B00D6AB2F"
|
|
||||||
BuildableName = "NDHotKey.framework"
|
|
||||||
BlueprintName = "NDHotKey"
|
|
||||||
ReferencedContainer = "container:NDHotKey.xcodeproj">
|
|
||||||
</BuildableReference>
|
|
||||||
</MacroExpansion>
|
|
||||||
</ProfileAction>
|
|
||||||
<AnalyzeAction
|
|
||||||
buildConfiguration = "Debug">
|
|
||||||
</AnalyzeAction>
|
|
||||||
<ArchiveAction
|
|
||||||
buildConfiguration = "Release"
|
|
||||||
revealArchiveInOrganizer = "YES">
|
|
||||||
</ArchiveAction>
|
|
||||||
</Scheme>
|
|
|
@ -1,30 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
||||||
<plist version="1.0">
|
|
||||||
<dict>
|
|
||||||
<key>CFBundleDevelopmentRegion</key>
|
|
||||||
<string>English</string>
|
|
||||||
<key>CFBundleExecutable</key>
|
|
||||||
<string>${EXECUTABLE_NAME}</string>
|
|
||||||
<key>CFBundleIconFile</key>
|
|
||||||
<string></string>
|
|
||||||
<key>CFBundleIdentifier</key>
|
|
||||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
|
||||||
<key>CFBundleInfoDictionaryVersion</key>
|
|
||||||
<string>6.0</string>
|
|
||||||
<key>CFBundleName</key>
|
|
||||||
<string>${PRODUCT_NAME}</string>
|
|
||||||
<key>CFBundlePackageType</key>
|
|
||||||
<string>FMWK</string>
|
|
||||||
<key>CFBundleShortVersionString</key>
|
|
||||||
<string>1.0</string>
|
|
||||||
<key>CFBundleSignature</key>
|
|
||||||
<string>????</string>
|
|
||||||
<key>CFBundleVersion</key>
|
|
||||||
<string>1</string>
|
|
||||||
<key>NSHumanReadableCopyright</key>
|
|
||||||
<string>Copyright © 2012 dmitry.promsky@gmail.com. All rights reserved.</string>
|
|
||||||
<key>NSPrincipalClass</key>
|
|
||||||
<string></string>
|
|
||||||
</dict>
|
|
||||||
</plist>
|
|
|
@ -1,7 +0,0 @@
|
||||||
//
|
|
||||||
// Prefix header for all source files of the 'NDHotKey' target in the 'NDHotKey' project
|
|
||||||
//
|
|
||||||
|
|
||||||
#ifdef __OBJC__
|
|
||||||
#import <Cocoa/Cocoa.h>
|
|
||||||
#endif
|
|
|
@ -1,128 +0,0 @@
|
||||||
/*
|
|
||||||
NDHotKeyControl.h
|
|
||||||
|
|
||||||
Created by Nathan Day on 29.03.08 under a MIT-style license.
|
|
||||||
Copyright (c) 2008 Nathan Day
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in
|
|
||||||
all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
THE SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
@header NDHotKeyControl.h
|
|
||||||
@abstract Header file for a subclass of NSTextField for getting hot key combinations from the user.
|
|
||||||
@discussion The <tt>NDHotKeyControl</tt> can be used to get a <tt>NDHotKeyEvent</tt> for the last key combination pressed by the user.
|
|
||||||
@updated 2010-01-18
|
|
||||||
*/
|
|
||||||
|
|
||||||
#import <AppKit/AppKit.h>
|
|
||||||
|
|
||||||
@class NDHotKeyEvent;
|
|
||||||
|
|
||||||
/*!
|
|
||||||
@class NDHotKeyControl
|
|
||||||
@abstract Subclass of NSTextField for getting hot key combinations from the user.
|
|
||||||
@discussion The <tt>NDHotKeyControl</tt> can be used to get a <tt>NDHotKeyEvent</tt> for the last key combination pressed by the user.
|
|
||||||
*/
|
|
||||||
@interface NDHotKeyControl : NSTextField
|
|
||||||
{
|
|
||||||
@private
|
|
||||||
UInt16 keyCode;
|
|
||||||
NSUInteger modifierFlags;
|
|
||||||
BOOL requiresModifierKeys,
|
|
||||||
readyForEvent,
|
|
||||||
stayReadyForEvent;
|
|
||||||
id lastReadyForEventSender;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (IBAction)readyForHotKeyEventChanged:(id)sender;
|
|
||||||
/*!
|
|
||||||
@method keyCode
|
|
||||||
@abstract Get key code.
|
|
||||||
@discussion Returns the key code for the last key combination the user pressed while the reciever was active.
|
|
||||||
@result A <tt>UInt16</tt> containing key code.
|
|
||||||
*/
|
|
||||||
- (UInt16)keyCode;
|
|
||||||
|
|
||||||
/*!
|
|
||||||
@method keyCharacter
|
|
||||||
@abstract Get unicode character.
|
|
||||||
@discussion Returns the unicode character for the last key combination the user pressed while the reciever was active.
|
|
||||||
@result A <tt>unichar</tt> containing character.
|
|
||||||
*/
|
|
||||||
- (unichar)keyCharacter;
|
|
||||||
|
|
||||||
/*!
|
|
||||||
@method modifierFlags
|
|
||||||
@abstract Get modifer flags.
|
|
||||||
@discussion Returns the modifer flags for the last key combination the user pressed while the reciever was active.
|
|
||||||
@result A <tt>unsigned long</tt> containing modifer flags.
|
|
||||||
*/
|
|
||||||
- (NSUInteger)modifierFlags;
|
|
||||||
|
|
||||||
/*!
|
|
||||||
@method hotKeyEvent
|
|
||||||
@abstract Get <tt>NDHotKeyEvent</tt>
|
|
||||||
@discussion Returns the <tt>NDHotKeyEvent</tt> instance for the last key combination the user pressed while the reciever was active. The <tt>NDHotKeyEvent</tt> returned will either be one that has already been created or a newly created one otherwise.
|
|
||||||
@result A <tt>NDHotKeyEvent</tt> for the hot key event.
|
|
||||||
*/
|
|
||||||
- (NDHotKeyEvent *)hotKeyEvent;
|
|
||||||
|
|
||||||
/*!
|
|
||||||
@method setRequiresModifierKeys:
|
|
||||||
@abstract Set whether hot keys entered need modifiers keys.
|
|
||||||
@discussion This does not include function key which do not require modifier keys no matter what the value you pass for the argument <tt><i>flag</i></tt>
|
|
||||||
@param flag If <tt>NO</tt> then the reciever only accepts hot keys combination containing modifer keys.
|
|
||||||
*/
|
|
||||||
- (void)setRequiresModifierKeys:(BOOL)flag;
|
|
||||||
/*!
|
|
||||||
@method requiresModifierKeys
|
|
||||||
@abstract Returns whether hot keys entered need modifiers keys.
|
|
||||||
@discussion This does not include key which do not require modifier keys no matter what the value is returned.
|
|
||||||
@result If <tt>NO</tt> then the reciever only accepts hot keys combination containing modifer keys.
|
|
||||||
*/
|
|
||||||
- (BOOL)requiresModifierKeys;
|
|
||||||
|
|
||||||
/*!
|
|
||||||
@method setReadyForHotKeyEvent:
|
|
||||||
@abstract Set up the control to accept input
|
|
||||||
@discussion Setting <tt>readyForHotKeyEvent</tt> to <tt>YES</tt> will disable all Hot Key Events and then prepare <tt>NDHotKeyControl</tt> for keyboard input. Setting <tt>readyForHotKeyEvent</tt> to <tt>NO</tt> will re-enables all Hot Key Events and then stops <tt>NDHotKeyControl</tt> for accepting keyboard input.
|
|
||||||
@param flag <#description#>
|
|
||||||
*/
|
|
||||||
- (void)setReadyForHotKeyEvent:(BOOL)flag;
|
|
||||||
/*!
|
|
||||||
@method readyForHotKeyEvent
|
|
||||||
@abstract Is the control set up to accept input
|
|
||||||
@discussion Returns the current state of <tt>readyForHotKeyEvent</tt> as set by the method <tt>setReadyForHotKeyEvent:</tt>.
|
|
||||||
*/
|
|
||||||
- (BOOL)readyForHotKeyEvent;
|
|
||||||
/*!
|
|
||||||
@method setStayReadyForEvent:
|
|
||||||
@abstract Will the control remain continually active.
|
|
||||||
@discussion By default <tt>NDHotKeyControl</tt> will accept one key and then call <tt>[self setReadyForHotKeyEvent:NO]</tt>, <tt>setStayReadyForEvent:</tt> allows you to change this behaviour so that <tt>NDHotKeyControl</tt> will continue accepting keys until it is manually deactivated.
|
|
||||||
*/
|
|
||||||
- (void)setStayReadyForEvent:(BOOL)flag;
|
|
||||||
/*!
|
|
||||||
@method stayReadyForEvent
|
|
||||||
@abstract Will the control remain continually active.
|
|
||||||
@discussion By default <tt>NDHotKeyControl</tt> will accept one key and then call <tt>[self setReadyForHotKeyEvent:NO]</tt>, if <tt>stayReadyForEvent</tt> returns <tt>YES</tt>, <tt>NDHotKeyControl</tt> will continue accepting keys until it is manually deactivated.
|
|
||||||
*/
|
|
||||||
- (BOOL)stayReadyForEvent;
|
|
||||||
|
|
||||||
|
|
||||||
@end
|
|
|
@ -1,145 +0,0 @@
|
||||||
/*
|
|
||||||
NDHotKeyControl.m
|
|
||||||
|
|
||||||
Created by Nathan Day on 21.06.06 under a MIT-style license.
|
|
||||||
Copyright (c) 2008 Nathan Day
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in
|
|
||||||
all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
THE SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#import "NDHotKeyControl.h"
|
|
||||||
#import "NDHotKeyEvent.h"
|
|
||||||
#import "NDKeyboardLayout.h"
|
|
||||||
|
|
||||||
@interface NDHotKeyControl ()
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
/*
|
|
||||||
* class implementation NDHotKeyControl
|
|
||||||
*/
|
|
||||||
@implementation NDHotKeyControl
|
|
||||||
|
|
||||||
- (id)initWithFrame:(NSRect)aFrame
|
|
||||||
{
|
|
||||||
if( (self = [super initWithFrame:aFrame]) != nil )
|
|
||||||
{
|
|
||||||
[self setEditable:NO];
|
|
||||||
requiresModifierKeys = YES;
|
|
||||||
readyForEvent = NO;
|
|
||||||
stayReadyForEvent = NO;
|
|
||||||
}
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (id)initWithCoder:(NSCoder *)aCoder
|
|
||||||
{
|
|
||||||
if( (self = [super initWithCoder:aCoder]) != nil )
|
|
||||||
{
|
|
||||||
[self setEditable:NO];
|
|
||||||
requiresModifierKeys = YES;
|
|
||||||
readyForEvent = NO;
|
|
||||||
stayReadyForEvent = NO;
|
|
||||||
}
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (IBAction)readyForHotKeyEventChanged:(id)aSender
|
|
||||||
{
|
|
||||||
if( [aSender isKindOfClass:[NSMatrix class]] )
|
|
||||||
aSender = [aSender selectedCell];
|
|
||||||
|
|
||||||
if( [aSender isKindOfClass:[NSButton class]] || [aSender isKindOfClass:[NSButtonCell class]] )
|
|
||||||
{
|
|
||||||
if( [aSender state] == NSOnState )
|
|
||||||
{
|
|
||||||
[self setReadyForHotKeyEvent:YES];
|
|
||||||
lastReadyForEventSender = aSender;
|
|
||||||
[self setStringValue:@""];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
[self setReadyForHotKeyEvent:NO];
|
|
||||||
lastReadyForEventSender = nil;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- (unsigned short)keyCode { return keyCode; }
|
|
||||||
- (unichar)keyCharacter { return [[NDKeyboardLayout keyboardLayout] characterForKeyCode:[self keyCode]]; }
|
|
||||||
- (NSUInteger)modifierFlags { return modifierFlags; }
|
|
||||||
|
|
||||||
- (BOOL)performKeyEquivalent:(NSEvent*)anEvent
|
|
||||||
{
|
|
||||||
BOOL theResult = NO;
|
|
||||||
if( [self readyForHotKeyEvent] )
|
|
||||||
{
|
|
||||||
[self keyDown:anEvent];
|
|
||||||
theResult = YES;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
theResult = [super performKeyEquivalent:anEvent];
|
|
||||||
return theResult;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)keyDown:(NSEvent *)anEvent
|
|
||||||
{
|
|
||||||
NSUInteger theModifierFlags = [anEvent modifierFlags];
|
|
||||||
unichar theChar = [[anEvent charactersIgnoringModifiers] characterAtIndex:0];
|
|
||||||
theModifierFlags &= (NSShiftKeyMask|NSControlKeyMask|NSAlternateKeyMask|NSCommandKeyMask);
|
|
||||||
|
|
||||||
if( (theModifierFlags != 0 || !requiresModifierKeys || theChar > 255) && theChar != 0 )
|
|
||||||
{
|
|
||||||
NDKeyboardLayout * theKeyboardLayout = [NDKeyboardLayout keyboardLayout];
|
|
||||||
|
|
||||||
NSParameterAssert( theKeyboardLayout != nil );
|
|
||||||
|
|
||||||
keyCode = [anEvent keyCode];
|
|
||||||
modifierFlags = theModifierFlags;
|
|
||||||
|
|
||||||
[self setStringValue:[theKeyboardLayout stringForKeyCode:keyCode modifierFlags:(UInt32)modifierFlags]];
|
|
||||||
[self performClick:self];
|
|
||||||
if( ![self stayReadyForEvent] )
|
|
||||||
[self setReadyForHotKeyEvent:NO];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- (NDHotKeyEvent *)hotKeyEvent { return [NDHotKeyEvent getHotKeyForKeyCode:[self keyCode] modifierFlags:[self modifierFlags]]; }
|
|
||||||
- (void)setRequiresModifierKeys:(BOOL)aFlag { requiresModifierKeys = aFlag; }
|
|
||||||
- (BOOL)requiresModifierKeys { return requiresModifierKeys; }
|
|
||||||
|
|
||||||
- (void)setReadyForHotKeyEvent:(BOOL)aFlag
|
|
||||||
{
|
|
||||||
readyForEvent = aFlag;
|
|
||||||
|
|
||||||
[NDHotKeyEvent setAllEnabled:!readyForEvent];
|
|
||||||
if( readyForEvent == NO && lastReadyForEventSender )
|
|
||||||
{
|
|
||||||
[lastReadyForEventSender setState:NSOffState];
|
|
||||||
lastReadyForEventSender = nil;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- (BOOL)readyForHotKeyEvent { return readyForEvent; }
|
|
||||||
- (void)setStayReadyForEvent:(BOOL)aFlag { stayReadyForEvent = aFlag; }
|
|
||||||
- (BOOL)stayReadyForEvent { return stayReadyForEvent; }
|
|
||||||
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
|
@ -1,600 +0,0 @@
|
||||||
/*
|
|
||||||
NDHotKeyEvent.h
|
|
||||||
|
|
||||||
Created by Nathan Day on 12.06.04 under a MIT-style license.
|
|
||||||
Copyright (c) 2008 Nathan Day
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in
|
|
||||||
all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
THE SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
@header NDHotKeyEvent.h
|
|
||||||
@abstract Header file for the class <tt>NDHotKeyEvent</tt>
|
|
||||||
@discussion <p><tt>NDHotKeyEvent</tt> provides a thread safe Objective-C interface to HotKey events as well as some additional feature to key track of all the hot keys in your application.</p>
|
|
||||||
|
|
||||||
<p><h4>Thread Saftey</h4>By default the class object <tt>NDHotKeyEvent</tt> is not thread safe as the underlying functions that it relies on are not thread safe and the mechanism for keeping track of all of the <tt>NDHotKeyEvent</tt> instances is not thread safe either. Thread saftey can be enable be defining the flag <tt>NDHotKeyEventThreadSafe</tt> before compiling.</p>
|
|
||||||
<p>Even with the flag <tt>NDHotKeyEventThreadSafe</tt> defined instances of <tt>NDHotKeyEvent</tt> will still not be thread safe, that is, it is safe to invoke methods of different instance with different threads as well as class methods, but it is not safe to invoke methods of the same instance with different threads.</p>
|
|
||||||
<p>The functions <tt>stringForKeyCodeAndModifierFlags</tt> and <tt>unicharForKeyCode</tt> are never thread safe.</p>
|
|
||||||
@updated 2010-01-18
|
|
||||||
@version 1.1.0
|
|
||||||
*/
|
|
||||||
|
|
||||||
#import <Cocoa/Cocoa.h>
|
|
||||||
#import <Carbon/Carbon.h>
|
|
||||||
|
|
||||||
/*
|
|
||||||
using NDHashTable clas instead of the NDHashTable functions that existed prior to 10.5 we can support garabage collection easier
|
|
||||||
*/
|
|
||||||
#if MAC_OS_X_VERSION_10_5 <= MAC_OS_X_VERSION_MAX_ALLOWED
|
|
||||||
#define NDMapTableClassDefined
|
|
||||||
#else
|
|
||||||
#warning Support for 10.4 and earily has been depreciated
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*!
|
|
||||||
@defined NDHotKeyEventThreadSafe
|
|
||||||
@abstract A flag to enable thread safety.
|
|
||||||
@discussion By default the class object <tt>NDHotKeyEvent</tt> is not thread safe. Defining the this flag will make th class methods of <tt>NDHotKeyEvent</tt> thread safe, see introduction for more details..
|
|
||||||
*/
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
/*!
|
|
||||||
@const NDHotKeyNoEvent
|
|
||||||
@abstract A value returned from the method <tt>-[NDHotKeyEvent currentEventType]</tt>
|
|
||||||
@discussion This value is returned if the hot key has not been pressed yet.
|
|
||||||
*/
|
|
||||||
NDHotKeyNoEvent = 0,
|
|
||||||
/*!
|
|
||||||
@const NDHotKeyPressedEvent
|
|
||||||
@abstract A value returned from the method <tt>-[NDHotKeyEvent currentEventType]</tt>
|
|
||||||
@discussion This value is returned if hot key was pressed last.
|
|
||||||
*/
|
|
||||||
NDHotKeyPressedEvent,
|
|
||||||
/*!
|
|
||||||
@const NDHotKeyReleasedEvent
|
|
||||||
@abstract A value returned from the method <tt>-[NDHotKeyEvent currentEventType]</tt>
|
|
||||||
@discussion This value is returned if hot key was released last.
|
|
||||||
*/
|
|
||||||
NDHotKeyReleasedEvent
|
|
||||||
};
|
|
||||||
|
|
||||||
/*!
|
|
||||||
@const NDHotKeyDefaultSignature
|
|
||||||
@abstract The default signature
|
|
||||||
@discussion This is the default signature that will be used if you start using <tt>NDHotKeyEvent</tt> without setting the signature first.
|
|
||||||
*/
|
|
||||||
extern const OSType NDHotKeyDefaultSignature;
|
|
||||||
|
|
||||||
@class NDHotKeyEvent;
|
|
||||||
/*!
|
|
||||||
@class NDHotKeyEvent
|
|
||||||
@abstract Class to represent a HotKey
|
|
||||||
@discussion <p>This class is a wrapper for Carbon Event HotKeys and provides some feature to key track of all the hot keys in your application. It can be used to be notified of key down as well as key up evernts and when a hot key is being taken by another object (see the protocol <tt>NDHotKeyEventTragetWillChange</tt>)</p>
|
|
||||||
|
|
||||||
*/
|
|
||||||
@interface NDHotKeyEvent : NSObject <NSCoding>
|
|
||||||
{
|
|
||||||
@private
|
|
||||||
EventHotKeyRef reference;
|
|
||||||
// UInt16 keyCode;
|
|
||||||
unichar keyCharacter;
|
|
||||||
BOOL keyPad;
|
|
||||||
NSUInteger modifierFlags;
|
|
||||||
int currentEventType;
|
|
||||||
id target;
|
|
||||||
SEL selectorReleased,
|
|
||||||
selectorPressed;
|
|
||||||
#ifdef NS_BLOCKS_AVAILABLE
|
|
||||||
void (^releasedBlock)(NDHotKeyEvent * e);
|
|
||||||
void (^pressedBlock)(NDHotKeyEvent * e);
|
|
||||||
#endif
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
unsigned individual : 1;
|
|
||||||
unsigned collective : 1;
|
|
||||||
} isEnabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
@method install
|
|
||||||
@abstract Install the event key handler
|
|
||||||
@discussion <tt>install</tt> is called before hot keys can be used. You normally don't need to invoke this method your self but in a multithreaded you might want to invoke this method before creating any threads. <tt>install</tt> is designed to be thread safe but the effects of calling Apples <tt>InstallEventHandler()</tt> funtion from anything other than the main thread is unknown.
|
|
||||||
@result Returns true if <tt>install</tt> succeeded.
|
|
||||||
*/
|
|
||||||
+ (BOOL)install;
|
|
||||||
|
|
||||||
/*!
|
|
||||||
@method uninstall
|
|
||||||
@abstract Unistall the evenr key handler.
|
|
||||||
@discussion This method can be called if you want to remove all hot key permanently, without you application having to quit, you do not need to call this method if you application is about to quite.
|
|
||||||
*/
|
|
||||||
+ (void)uninstall;
|
|
||||||
|
|
||||||
/*!
|
|
||||||
@method setSignature:
|
|
||||||
@abstract Set the hot key signature for this application
|
|
||||||
@discussion This should only be called once, before trying to enable any hot keys.
|
|
||||||
@param signature The four char code signature to identify all hot keys for this application, could your applications signature.
|
|
||||||
*/
|
|
||||||
+ (void)setSignature:(OSType)signature;
|
|
||||||
|
|
||||||
/*!
|
|
||||||
@method signature
|
|
||||||
@abstract Get the hot key signature for this application
|
|
||||||
@discussion Used to identify the hot key handler for this application.
|
|
||||||
@result The four char code signature.
|
|
||||||
*/
|
|
||||||
+ (OSType)signature;
|
|
||||||
|
|
||||||
/*!
|
|
||||||
@method setAllEnabled:
|
|
||||||
@abstract Set enabled for all instances of <tt>NDHotKeyEvent</tt>
|
|
||||||
@discussion Used to enable or disable all hot keys. This method is not the same as sending the message <tt>setEnabled:</tt> to every single <tt>NDHotKeyEvent</tt> instance. Enabling with this method only enables the hot keys that where enable prior to using this method to disable all hot keys.
|
|
||||||
@param flag <tt>YES</tt> to enable, <tt>NO</tt> to disable.
|
|
||||||
@result Returns <tt>YES</tt> if succesful.
|
|
||||||
*/
|
|
||||||
+ (BOOL)setAllEnabled:(BOOL)flag;
|
|
||||||
|
|
||||||
/*!
|
|
||||||
@method isEnabledKeyCharacter:modifierFlags:
|
|
||||||
@abstract Is hot key combination enabled.
|
|
||||||
@abstract Test to see if a key code and modifier flaf combination are enabled.
|
|
||||||
@param keyCharacter The key character used by the keyboard.
|
|
||||||
@param modifierFlags The modifer flags, ( <tt>NSCommandKeyMask</tt>, <tt>NSControlKeyMask</tt>, <tt>NSAlternateKeyMask</tt>, <tt>NSShiftKeyMask</tt>, <tt>NSNumericPadKeyMask</tt> ).
|
|
||||||
@result Returns <tt>YES</tt> if enabled.
|
|
||||||
*/
|
|
||||||
+ (BOOL)isEnabledKeyCharacter:(unichar)keyCharacter modifierFlags:(NSUInteger)modifierFlags;
|
|
||||||
/*!
|
|
||||||
@method isEnabledKeyCode:modifierFlags:
|
|
||||||
@abstract Is hot key combination enabled.
|
|
||||||
@abstract Test to see if a key code and modifier flaf combination are enabled.
|
|
||||||
@param keyCode The key code used by the keyboard, can vary across hardware.
|
|
||||||
@param modifierFlags The modifer flags, ( <tt>NSCommandKeyMask</tt>, <tt>NSControlKeyMask</tt>, <tt>NSAlternateKeyMask</tt>, <tt>NSShiftKeyMask</tt> ).
|
|
||||||
@result Returns <tt>YES</tt> if enabled.
|
|
||||||
*/
|
|
||||||
+ (BOOL)isEnabledKeyCode:(UInt16)keyCode modifierFlags:(NSUInteger)modifierFlags;
|
|
||||||
|
|
||||||
/*!
|
|
||||||
@method getHotKeyForKeyCharacter:modifierFlags:
|
|
||||||
@abstract Get an <tt>NDHotKeyEvent</tt>
|
|
||||||
@discussion Gets a <tt>NDHotKeyEvent</tt> for the supplied key code and modifer flags by either finding one that has already been created or by creating a new one..
|
|
||||||
@param keyCharacter The key character used by the keyboard.
|
|
||||||
@param modifierFlags The modifer flags, ( <tt>NSCommandKeyMask</tt>, <tt>NSControlKeyMask</tt>, <tt>NSAlternateKeyMask</tt>, <tt>NSShiftKeyMask</tt>, <tt>NSNumericPadKeyMask</tt> ).
|
|
||||||
@result The <tt>NDHotKeyEvent</tt> obejct or nil if failure.
|
|
||||||
*/
|
|
||||||
+ (NDHotKeyEvent *)getHotKeyForKeyCharacter:(unichar)keyCharacter modifierFlags:(NSUInteger)modifierFlags;
|
|
||||||
/*!
|
|
||||||
@method getHotKeyForKeyCode:modifierFlags:
|
|
||||||
@abstract Get an <tt>NDHotKeyEvent</tt>
|
|
||||||
@discussion Gets a <tt>NDHotKeyEvent</tt> for the supplied key code and modifer flags by either finding one that has already been created or by creating a new one..
|
|
||||||
@param keyCode The key code used by the keyboard, can vary across hardware.
|
|
||||||
@param modifierFlags The modifer flags, ( <tt>NSCommandKeyMask</tt>, <tt>NSControlKeyMask</tt>, <tt>NSAlternateKeyMask</tt>, <tt>NSShiftKeyMask</tt> ).
|
|
||||||
@result The <tt>NDHotKeyEvent</tt> obejct or nil if failure.
|
|
||||||
*/
|
|
||||||
+ (NDHotKeyEvent *)getHotKeyForKeyCode:(UInt16)keyCode modifierFlags:(NSUInteger)modifierFlags;
|
|
||||||
/*!
|
|
||||||
@method findHotKeyForKeyCharacter:modifierFlags:
|
|
||||||
@abstract Find an <tt>NDHotKeyEvent</tt>
|
|
||||||
@discussion Finds the <tt>NDHotKeyEvent</tt> for the supplied key code and modifer flags.
|
|
||||||
@param keyCharacter The key character used by the keyboard.
|
|
||||||
@param modifierFlags The modifer flags, ( <tt>NSCommandKeyMask</tt>, <tt>NSControlKeyMask</tt>, <tt>NSAlternateKeyMask</tt>, <tt>NSShiftKeyMask</tt>, <tt>NSNumericPadKeyMask</tt> ).
|
|
||||||
@result The <tt>NDHotKeyEvent</tt> obejct or nil if none found.
|
|
||||||
*/
|
|
||||||
+ (NDHotKeyEvent *)findHotKeyForKeyCharacter:(unichar)keyCharacter modifierFlags:(NSUInteger)modifierFlags;
|
|
||||||
/*!
|
|
||||||
@method findHotKeyForKeyCode:modifierFlags:
|
|
||||||
@abstract Find an <tt>NDHotKeyEvent</tt>
|
|
||||||
@discussion Finds the <tt>NDHotKeyEvent</tt> for the supplied key code and modifer flags.
|
|
||||||
@param keyCode The key code used by the keyboard, can vary across hardware.
|
|
||||||
@param modifierFlags The modifer flags, ( <tt>NSCommandKeyMask</tt>, <tt>NSControlKeyMask</tt>, <tt>NSAlternateKeyMask</tt>, <tt>NSShiftKeyMask</tt> ).
|
|
||||||
@result The <tt>NDHotKeyEvent</tt> obejct or nil if none found.
|
|
||||||
*/
|
|
||||||
+ (NDHotKeyEvent *)findHotKeyForKeyCode:(UInt16)keyCode modifierFlags:(NSUInteger)modifierFlags;
|
|
||||||
|
|
||||||
/*!
|
|
||||||
@method findHotKeyForId:
|
|
||||||
@abstract Find an <tt>NDHotKeyEvent</tt>
|
|
||||||
@discussion Finds the <tt>NDHotKeyEvent</tt> for the with the given ID, you can find an already created <tt>NDHotKeyEvent</tt> but there is currently now way to create a new <tt>NDHotKeyEvent</tt> from a HotKey you create with Apple API's.
|
|
||||||
@param ID The hot key id as returned by <tt>hotKeyId</tt>
|
|
||||||
@result The <tt>NDHotKeyEvent</tt> obejct or nil if none found.
|
|
||||||
*/
|
|
||||||
+ (NDHotKeyEvent *)findHotKeyForId:(UInt32)ID;
|
|
||||||
|
|
||||||
/*!
|
|
||||||
@method hotKeyWithEvent:
|
|
||||||
@abstract Get a <tt>NDHotKeyEvent</tt> object.
|
|
||||||
@discussion Returns a new hot key for the supplied event, if there is already a hot key for the supplied key code and modifer flags then nil is returned.
|
|
||||||
@param event The event generated from the user presssing the desired hot key combination.
|
|
||||||
@result An new <tt>NDHotKeyEvent</tt> or nil if failure.
|
|
||||||
*/
|
|
||||||
+ (id)hotKeyWithEvent:(NSEvent *)event;
|
|
||||||
/*!
|
|
||||||
@method hotKeyWithEvent:target:selector:
|
|
||||||
@abstract Get a <tt>NDHotKeyEvent</tt> object.
|
|
||||||
@discussion Returns a new hot key for the supplied event, if there is already a hot key for the supplied key code and modifer flags then nil is returned.
|
|
||||||
@param event The event generated from the user presssing the desired hot key combination.
|
|
||||||
@param target The target of hot key event.
|
|
||||||
@param selector The selector sent when hot key is released
|
|
||||||
@result An new <tt>NDHotKeyEvent</tt> or nil if failure.
|
|
||||||
*/
|
|
||||||
+ (id)hotKeyWithEvent:(NSEvent *)event target:(id)target selector:(SEL)selector;
|
|
||||||
/*!
|
|
||||||
@method hotKeyWithKeyCharacter:modifierFlags:
|
|
||||||
@abstract Get a <tt>NDHotKeyEvent</tt> object.
|
|
||||||
@discussion Returns a new hot key for the supplied hot key combination, if there is already a hot key for the supplied key code and modifer flags then nil is returned.
|
|
||||||
@param keyCharacter The key character used by the keyboard.
|
|
||||||
@param modifierFlags The modifer flags, ( <tt>NSCommandKeyMask</tt>, <tt>NSControlKeyMask</tt>, <tt>NSAlternateKeyMask</tt>, <tt>NSShiftKeyMask</tt>, <tt>NSNumericPadKeyMask</tt> ).
|
|
||||||
@result An new <tt>NDHotKeyEvent</tt> or nil if failure.
|
|
||||||
*/
|
|
||||||
+ (id)hotKeyWithKeyCharacter:(unichar)keyCharacter modifierFlags:(NSUInteger)modifer;
|
|
||||||
/*!
|
|
||||||
@method hotKeyWithKeyCode:modifierFlags:
|
|
||||||
@abstract Get a <tt>NDHotKeyEvent</tt> object.
|
|
||||||
@discussion Returns a new hot key for the supplied hot key combination, if there is already a hot key for the supplied key code and modifer flags then nil is returned.
|
|
||||||
@param keyCode The key code used by the keyboard, can vary across hardware.
|
|
||||||
@param modifierFlags The modifer flags, ( <tt>NSCommandKeyMask</tt>, <tt>NSControlKeyMask</tt>, <tt>NSAlternateKeyMask</tt>, <tt>NSShiftKeyMask</tt> ).
|
|
||||||
@result An new <tt>NDHotKeyEvent</tt> or nil if failure.
|
|
||||||
*/
|
|
||||||
+ (id)hotKeyWithKeyCode:(UInt16)keyCode modifierFlags:(NSUInteger)modifer;
|
|
||||||
|
|
||||||
/*!
|
|
||||||
@method hotKeyWithKeyCharacter:modifierFlags:target:selector:
|
|
||||||
@abstract Get a <tt>NDHotKeyEvent</tt> object.
|
|
||||||
@discussion Returns a new hot key for the supplied hot key combination and target object and selector, if there is already a hot key for the supplied key code and modifer flags then nil is returned.
|
|
||||||
@param keyCharacter The key character used by the keyboard.
|
|
||||||
@param modifierFlags The modifer flags, ( <tt>NSCommandKeyMask</tt>, <tt>NSControlKeyMask</tt>, <tt>NSAlternateKeyMask</tt>, <tt>NSShiftKeyMask</tt>, <tt>NSNumericPadKeyMask</tt> ).
|
|
||||||
@param target The target of hot key event.
|
|
||||||
@param selector The selector sent when hot key is released
|
|
||||||
@result A new <tt>NDHotKeyEvent</tt>
|
|
||||||
*/
|
|
||||||
+ (id)hotKeyWithKeyCharacter:(unichar)keyCharacter modifierFlags:(NSUInteger)modifer target:(id)target selector:(SEL)selector;
|
|
||||||
/*!
|
|
||||||
@method hotKeyWithKeyCode:modifierFlags:target:selector:
|
|
||||||
@abstract Get a <tt>NDHotKeyEvent</tt> object.
|
|
||||||
@discussion Returns a new hot key for the supplied hot key combination and target object and selector, if there is already a hot key for the supplied key code and modifer flags then nil is returned.
|
|
||||||
@param keyCode The key code used by the keyboard, can vary across hardware.
|
|
||||||
@param modifierFlags The modifer flags, ( <tt>NSCommandKeyMask</tt>, <tt>NSControlKeyMask</tt>, <tt>NSAlternateKeyMask</tt>, <tt>NSShiftKeyMask</tt> ).
|
|
||||||
@param target The target of hot key event.
|
|
||||||
@param selector The selector sent when hot key is released
|
|
||||||
@result A new <tt>NDHotKeyEvent</tt>
|
|
||||||
*/
|
|
||||||
+ (id)hotKeyWithKeyCode:(UInt16)keyCode modifierFlags:(NSUInteger)modifer target:(id)target selector:(SEL)selector;
|
|
||||||
|
|
||||||
/*!
|
|
||||||
@method initWithPropertyList:
|
|
||||||
@abstract creates a <tt>NDHotKeyEvent</tt> with a property list.
|
|
||||||
@discussion This can be used for archiving purposes, but it is possible that it will not work if the users keyboard is changed, ie between machines.
|
|
||||||
@param propertyList A property list object
|
|
||||||
@result A initialized <tt>NDHotKeyEvent</tt>
|
|
||||||
*/
|
|
||||||
+ (id)hotKeyWithWithPropertyList:(id)propertyList;
|
|
||||||
/*!
|
|
||||||
@method initWithEvent:
|
|
||||||
@abstract Initialize a <tt>NDHotKeyEvent</tt> object.
|
|
||||||
@discussion Initialize the reciever with the supplied hot key combination contained with the event <tt>event</tt> and target object and selector, if there is already a hot key for the supplied event then nil is returned.
|
|
||||||
@param event The key code used by the keyboard, can vary across hardware.
|
|
||||||
@result A initialized <tt>NDHotKeyEvent</tt>
|
|
||||||
*/
|
|
||||||
- (id)initWithEvent:(NSEvent *)event;
|
|
||||||
/*!
|
|
||||||
@method initWithEvent:target:selector:
|
|
||||||
@abstract Initialize a <tt>NDHotKeyEvent</tt> object.
|
|
||||||
@discussion Initialize the reciever with the supplied hot key combination contained with the event <tt>event</tt> and target object and selector, if there is already a hot key for the supplied event then nil is returned.
|
|
||||||
@param event An event used to create a hot key from.
|
|
||||||
@param target The target of hot key event.
|
|
||||||
@param selector The selector sent when hot key is released
|
|
||||||
@result A initialized <tt>NDHotKeyEvent</tt>
|
|
||||||
*/
|
|
||||||
- (id)initWithEvent:(NSEvent *)event target:(id)target selector:(SEL)selector;
|
|
||||||
|
|
||||||
/*!
|
|
||||||
@method initWithKeyCode:character:modifierFlags:target:selector:
|
|
||||||
@abstract Initialize a <tt>NDHotKeyEvent</tt> object.
|
|
||||||
@discussion Initialize the reciever with the supplied hot key combination and target object and selector, if there is already a hot key for the supplied key code and modifer flags then nil is returned.
|
|
||||||
@param keyCharacter The key character used by the keyboard.
|
|
||||||
@param modifierFlags The modifer flags, ( <tt>NSCommandKeyMask</tt>, <tt>NSControlKeyMask</tt>, <tt>NSAlternateKeyMask</tt>, <tt>NSShiftKeyMask</tt>, <tt>NSNumericPadKeyMask</tt>, <tt>NSNumericPadKeyMask</tt> ).
|
|
||||||
@param target The target of hot key event.
|
|
||||||
@param selector The selector sent when hot key is released
|
|
||||||
@result A initialized <tt>NDHotKeyEvent</tt>
|
|
||||||
*/
|
|
||||||
- (id)initWithKeyCharacter:(unichar)keyCharacter modifierFlags:(NSUInteger)modifer target:(id)target selector:(SEL)selector;
|
|
||||||
/*!
|
|
||||||
@method initWithKeyCode:character:modifierFlags:target:selector:
|
|
||||||
@abstract Initialize a <tt>NDHotKeyEvent</tt> object.
|
|
||||||
@discussion Initialize the reciever with the supplied hot key combination and target object and selector, if there is already a hot key for the supplied key code and modifer flags then nil is returned.
|
|
||||||
@param keyCode The key code used by the keyboard, can vary across hardware.
|
|
||||||
@param modifierFlags The modifer flags, ( <tt>NSCommandKeyMask</tt>, <tt>NSControlKeyMask</tt>, <tt>NSAlternateKeyMask</tt>, <tt>NSShiftKeyMask</tt> ).
|
|
||||||
@param target The target of hot key event.
|
|
||||||
@param selector The selector sent when hot key is released
|
|
||||||
@result A initialized <tt>NDHotKeyEvent</tt>
|
|
||||||
*/
|
|
||||||
- (id)initWithKeyCode:(UInt16)keyCode modifierFlags:(NSUInteger)modifer target:(id)target selector:(SEL)selector;
|
|
||||||
|
|
||||||
/*!
|
|
||||||
@method initWithKeyCode:character:modifierFlags
|
|
||||||
@abstract Initialize a <tt>NDHotKeyEvent</tt> object.
|
|
||||||
@discussion Initialize the reciever with the supplied hot key combination, if there is already a hot key for the supplied key code and modifer flags then nil is returned.
|
|
||||||
@param keyCharacter The key character used by the keyboard.
|
|
||||||
@param modifierFlags The modifer flags, ( <tt>NSCommandKeyMask</tt>, <tt>NSControlKeyMask</tt>, <tt>NSAlternateKeyMask</tt>, <tt>NSShiftKeyMask</tt>, <tt>NSNumericPadKeyMask</tt> ).
|
|
||||||
@result A initialized <tt>NDHotKeyEvent</tt>
|
|
||||||
*/
|
|
||||||
- (id)initWithKeyCharacter:(unichar)keyCharacter modifierFlags:(NSUInteger)modifer;
|
|
||||||
/*!
|
|
||||||
@method initWithKeyCode:character:modifierFlags
|
|
||||||
@abstract Initialize a <tt>NDHotKeyEvent</tt> object.
|
|
||||||
@discussion Initialize the reciever with the supplied hot key combination, if there is already a hot key for the supplied key code and modifer flags then nil is returned.
|
|
||||||
@param keyCode The key code used by the keyboard, can vary across hardware.
|
|
||||||
@param modifierFlags The modifer flags, ( <tt>NSCommandKeyMask</tt>, <tt>NSControlKeyMask</tt>, <tt>NSAlternateKeyMask</tt>, <tt>NSShiftKeyMask</tt> ).
|
|
||||||
@result A initialized <tt>NDHotKeyEvent</tt>
|
|
||||||
*/
|
|
||||||
- (id)initWithKeyCode:(UInt16)keyCode modifierFlags:(NSUInteger)modifer;
|
|
||||||
|
|
||||||
/*!
|
|
||||||
@method initWithPropertyList:
|
|
||||||
@abstract Initializes the reciever with a property list.
|
|
||||||
@discussion This can be used for archiving purposes, but it is possible that it will not work if the users keyboard is changed, ie between machines. The following properties are initialised
|
|
||||||
<ul>
|
|
||||||
<li>Key Code</li>
|
|
||||||
<li>Character</li>
|
|
||||||
<li>Modifier Flags</li>
|
|
||||||
<li>Selector Pressed</li>
|
|
||||||
<li>Selector Released</li>
|
|
||||||
</ul>
|
|
||||||
@param propertyList A property list object
|
|
||||||
@result A initialized <tt>NDHotKeyEvent</tt>
|
|
||||||
*/
|
|
||||||
- (id)initWithPropertyList:(id)propertyList;
|
|
||||||
/*!
|
|
||||||
@method propertyList
|
|
||||||
@abstract Returns a property list for the reciever.
|
|
||||||
@discussion This can be used for archiving purposes, but it is possible that it will not work if the users keyboard is changed, ie between machines. The property list returned contains the following properties;
|
|
||||||
<ul>
|
|
||||||
<li>Key Code</li>
|
|
||||||
<li>Character</li>
|
|
||||||
<li>Modifier Flags</li>
|
|
||||||
<li>Selector Pressed</li>
|
|
||||||
<li>Selector Released</li>
|
|
||||||
</ul>
|
|
||||||
@result The property list object.
|
|
||||||
*/
|
|
||||||
- (id)propertyList;
|
|
||||||
|
|
||||||
/*!
|
|
||||||
@method initWithCoder:
|
|
||||||
@abstract Initializes a newly allocated instance from data in <tt>decoder</tt>.
|
|
||||||
@discussion Decodes the following properties of a <tt>NDHotKeyEvent</tt>;
|
|
||||||
<ul>
|
|
||||||
<li>Key Code</li>
|
|
||||||
<li>Character</li>
|
|
||||||
<li>Modifier Flags</li>
|
|
||||||
<li>Selector Pressed</li>
|
|
||||||
<li>Selector Released</li>
|
|
||||||
</ul>
|
|
||||||
Will use Keyed Coding if <code>[<i>decoder</i> allowsKeyedCoding] == YES</code>.
|
|
||||||
@param decoder A subclass of <tt>NSCoder</tt>
|
|
||||||
@result A initialized <tt>NDHotKeyEvent</tt>
|
|
||||||
*/
|
|
||||||
- (id)initWithCoder:(NSCoder *)decoder;
|
|
||||||
|
|
||||||
/*!
|
|
||||||
@method encodeWithCoder:
|
|
||||||
@abstract Encodes the receiver using <tt>encoder</tt>
|
|
||||||
@discussion Encodes the following properties of a <tt>NDHotKeyEvent</tt>;
|
|
||||||
<ul>
|
|
||||||
<li>Key Code</li>
|
|
||||||
<li>Character</li>
|
|
||||||
<li>Modifier Flags</li>
|
|
||||||
<li>Selector Pressed</li>
|
|
||||||
<li>Selector Released</li>
|
|
||||||
</ul>
|
|
||||||
Will use Keyed Coding if <code>[<i>encoder</i> allowsKeyedCoding] == YES</code>.
|
|
||||||
@param encoder A subclass of <tt>NSCoder</tt>.
|
|
||||||
*/
|
|
||||||
- (void)encodeWithCoder:(NSCoder *)encoder;
|
|
||||||
|
|
||||||
- (BOOL)setEnabled:(BOOL)flag;
|
|
||||||
/*!
|
|
||||||
@method setIsEnabled:
|
|
||||||
@abstract Set the hot key enabled or disable.
|
|
||||||
@discussion <tt>setEnabled:</tt> registers or unregisters the recievers hot key combination.
|
|
||||||
@param flag <tt>YES</tt> to enable, <tt>NO</tt> to disable.
|
|
||||||
*/
|
|
||||||
- (void)setIsEnabled:(BOOL)flag;
|
|
||||||
|
|
||||||
/*!
|
|
||||||
@method isEnabled
|
|
||||||
@abstract Find out if a hot key is enabled.
|
|
||||||
@discussion Returns <tt>YES</tt> if the hot key is registered.
|
|
||||||
@result <tt>YES</tt> if enabled.
|
|
||||||
*/
|
|
||||||
- (BOOL)isEnabled;
|
|
||||||
|
|
||||||
/*!
|
|
||||||
@method target
|
|
||||||
@abstract Get the hot key event target.
|
|
||||||
@discussion Returns the object that is sent the key pressed and key released hot key events, see the methods <tt>-selector</tt>, <tt>-selectorReleased</tt> and <tt>selectorPressed</tt>.
|
|
||||||
@result The target object.
|
|
||||||
*/
|
|
||||||
- (id)target;
|
|
||||||
|
|
||||||
/*!
|
|
||||||
@method selector
|
|
||||||
@abstract The selector for a key released event.
|
|
||||||
@discussion This is the selector sent when the hot key combination for the reciever is released. This is the same selector has returned from the method <tt>[NDHotKeyEvent selectorReleased]</tt>
|
|
||||||
@result The method selector.
|
|
||||||
*/
|
|
||||||
- (SEL)selector;
|
|
||||||
|
|
||||||
/*!
|
|
||||||
@method selectorReleased
|
|
||||||
@abstract The selector for a key released event.
|
|
||||||
@discussion This is the selector sent when the hot key combination for the reciever is released. This is the same selector has returned from the method <tt>[NDHotKeyEvent selector]</tt>
|
|
||||||
@result The method selector.
|
|
||||||
*/
|
|
||||||
- (SEL)selectorReleased;
|
|
||||||
|
|
||||||
/*!
|
|
||||||
@method selectorPressed
|
|
||||||
@abstract The selector for a key pressed event.
|
|
||||||
@discussion This is the selector sent when the hot key combination for the reciever is pressed.
|
|
||||||
@result The method selector.
|
|
||||||
*/
|
|
||||||
- (SEL)selectorPressed;
|
|
||||||
|
|
||||||
/*!
|
|
||||||
@method currentEventType
|
|
||||||
@abstract Get the current hot key event type.
|
|
||||||
@discussion This value returns what event last occured. Can be used in your target when it is sent a event message to find out what event occured, possible values are
|
|
||||||
<blockquote>
|
|
||||||
<table border = "1" width = "90%">
|
|
||||||
<thead><tr><th>Value</th><th>Description</th></tr></thead>
|
|
||||||
<tr><td align = "center"><tt>NDHotKeyNoEvent</tt></td><td>The hot key has not been pressed yet.</td></tr>
|
|
||||||
<tr><td align = "center"><tt>NDHotKeyPressedEvent</tt></td><td>The hot key was pressed last.</td></tr>
|
|
||||||
<tr><td align = "center"><tt>NDHotKeyReleasedEvent</tt></td><td>The hot key was released last.</td></tr>
|
|
||||||
</table>
|
|
||||||
</blockquote>
|
|
||||||
@result The last event type.
|
|
||||||
*/
|
|
||||||
- (int)currentEventType;
|
|
||||||
|
|
||||||
/*!
|
|
||||||
@method setTarget:selector:
|
|
||||||
@abstract Set the hot key target.
|
|
||||||
@discussion Set the target object and selector to be sent when the hot key is released. The target needs to either respond to the method represented by the selector <tt>selector</tt> or to the method <tt>makeObjectsPerformSelector:withObject:</tt> in which case the method <tt>makeObjectsPerformSelector:withObject:</tt> is invoked with the selector <tt>selector</tt>, for example <tt>NSArray</tt>
|
|
||||||
@param target The traget object or a collection (for example <tt>NSArray</tt>) of target.
|
|
||||||
@param selector The selector.
|
|
||||||
@result returns <tt>YES</tt> if successful.
|
|
||||||
*/
|
|
||||||
- (BOOL)setTarget:(id)target selector:(SEL)selector;
|
|
||||||
|
|
||||||
#ifdef NS_BLOCKS_AVAILABLE
|
|
||||||
/*!
|
|
||||||
@method setBlock:
|
|
||||||
@abstract Set the hot key block called when the hot key is released.
|
|
||||||
@discussion Sets a block to be executed on hot key release.
|
|
||||||
@param block The block executed on key release, the block is passed the <tt>NDHotKeyEvent</tt> that represents the event.
|
|
||||||
@result returns <tt>YES</tt> if successful.
|
|
||||||
*/
|
|
||||||
- (BOOL)setBlock:(void(^)(NDHotKeyEvent*))block;
|
|
||||||
#endif
|
|
||||||
/*!
|
|
||||||
@method setTarget:selectorReleased:selectorPressed:
|
|
||||||
@abstract Set the hot key target.
|
|
||||||
@discussion Set the target object and selector to be sent when the hot key is pressed and wehn it is released. The target needs to either respond to the method represented by the selector <tt>selector</tt> or to the method <tt>makeObjectsPerformSelector:withObject:</tt> in which case the method <tt>makeObjectsPerformSelector:withObject:</tt> is invoked with the selector <tt>selector</tt>, for example <tt>NSArray</tt>
|
|
||||||
@param target The traget object or a collection (for example <tt>NSArray</tt>) of target.
|
|
||||||
@param selectorReleased The key released selector.
|
|
||||||
@param selectorPressed The key pressed selector.
|
|
||||||
@result returns <tt>YES</tt> if successful.
|
|
||||||
*/
|
|
||||||
- (BOOL)setTarget:(id)target selectorReleased:(SEL)selectorReleased selectorPressed:(SEL)selectorPressed;
|
|
||||||
|
|
||||||
#ifdef NS_BLOCKS_AVAILABLE
|
|
||||||
/*!
|
|
||||||
@method setReleasedBlock:pressedBlock:
|
|
||||||
@abstract Set the hot key blocks called when the hot key is pressed and released.
|
|
||||||
@discussion Sets blocks to be executed on hot key released and pressed.
|
|
||||||
@param releasedBlock The block executed on key release, the block is passed the <tt>NDHotKeyEvent</tt> that represents the event.
|
|
||||||
@param pressedBlock The block executed on key pressed, the block is passed the <tt>NDHotKeyEvent</tt> that represents the event.
|
|
||||||
@result returns <tt>YES</tt> if successful.
|
|
||||||
*/
|
|
||||||
- (BOOL)setReleasedBlock:(void(^)(NDHotKeyEvent*))releasedBlock pressedBlock:(void(^)(NDHotKeyEvent*))pressedBlock;
|
|
||||||
#endif
|
|
||||||
/*!
|
|
||||||
@method performHotKeyReleased
|
|
||||||
@abstract Invoke the target with the release selector.
|
|
||||||
@discussion Use to send the selector for a release event, though this method can be called by you.
|
|
||||||
*/
|
|
||||||
- (void)performHotKeyReleased;
|
|
||||||
|
|
||||||
/*!
|
|
||||||
@method performHotKeyPressed
|
|
||||||
@abstract Invoke the target with the press selector.
|
|
||||||
@discussion Use to send the selector for a presse event, though this method can be called by you.
|
|
||||||
*/
|
|
||||||
- (void)performHotKeyPressed;
|
|
||||||
|
|
||||||
/*!
|
|
||||||
@method keyCode
|
|
||||||
@abstract Get the hot key key code.
|
|
||||||
@discussion The key code for the hot key, this is hardware specific.
|
|
||||||
@result The key code.
|
|
||||||
*/
|
|
||||||
- (UInt16)keyCode;
|
|
||||||
|
|
||||||
/*!
|
|
||||||
@method keyCharacter
|
|
||||||
@abstract Get the hot key character.
|
|
||||||
@discussion This is the character for the key code, without modifier keys. The character is for display purposes only and dose not determine the key code.
|
|
||||||
@result A uni code character.
|
|
||||||
*/
|
|
||||||
- (unichar)keyCharacter;
|
|
||||||
|
|
||||||
/*!
|
|
||||||
@method modifierFlags
|
|
||||||
@abstract Get the hot key modifer key flags.
|
|
||||||
@discussion The <tt>modifierFlags</tt> can be a bitwise and combination of <tt>NSControlKeyMask</tt>, <tt>NSAlternateKeyMask</tt>, <tt>NSShiftKeyMask</tt>, and <tt>NSCommandKeyMask</tt>.
|
|
||||||
@result The modifer key flags.
|
|
||||||
*/
|
|
||||||
- (NSUInteger)modifierFlags;
|
|
||||||
|
|
||||||
/*!
|
|
||||||
@method hotKeyId
|
|
||||||
@abstract Get the hot key id.
|
|
||||||
@discussion The id is how Apples 'Carbon Event Manager' keeps track of hot keys, if you want to use apples Hot Key function directly with <tt>NDHotKeyEvent</tt> then you can use the value returned from this method.
|
|
||||||
*/
|
|
||||||
- (UInt32)hotKeyId;
|
|
||||||
|
|
||||||
/*!
|
|
||||||
@method stringValue
|
|
||||||
@abstract Get a string got the hot keys.
|
|
||||||
@discussion This is a string that can be used for display purposes.
|
|
||||||
@result A <tt>NSString</tt>
|
|
||||||
*/
|
|
||||||
- (NSString *)stringValue;
|
|
||||||
|
|
||||||
/*!
|
|
||||||
@methodgroup Deprecated Methods
|
|
||||||
*/
|
|
||||||
|
|
||||||
+ (NDHotKeyEvent *)getHotKeyForKeyCode:(UInt16)keyCode character:(unichar)aChar modifierFlags:(NSUInteger)modifierFlags DEPRECATED_ATTRIBUTE;
|
|
||||||
+ (id)hotKeyWithKeyCode:(UInt16)keyCode character:(unichar)aChar modifierFlags:(NSUInteger)modifer DEPRECATED_ATTRIBUTE;
|
|
||||||
+ (id)hotKeyWithKeyCode:(UInt16)keyCode character:(unichar)aChar modifierFlags:(NSUInteger)modifer target:(id)target selector:(SEL)selector DEPRECATED_ATTRIBUTE;
|
|
||||||
- (id)initWithKeyCode:(UInt16)keyCode character:(unichar)aChar modifierFlags:(NSUInteger)modifer target:(id)target selector:(SEL)selector DEPRECATED_ATTRIBUTE;
|
|
||||||
- (id)initWithKeyCode:(UInt16)keyCode character:(unichar)aChar modifierFlags:(NSUInteger)modifer DEPRECATED_ATTRIBUTE;
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
/*!
|
|
||||||
@protocol NSObject(NDHotKeyEventTragetWillChange)
|
|
||||||
@abstract Informal protocol used to inform a <tt>NDHotKeyEvent</tt> target of events.
|
|
||||||
@discussion The informal protocol <tt>NDHotKeyEventTragetWillChange</tt> defines a method used to notify a <tt>NDHotKeyEvent</tt> target that the target will change.
|
|
||||||
*/
|
|
||||||
@interface NSObject (NDHotKeyEventTragetWillChange)
|
|
||||||
|
|
||||||
/*!
|
|
||||||
@method targetWillChangeToObject:forHotKeyEvent:
|
|
||||||
@abstract Message sent to a target object to inform it that the target is going to change.
|
|
||||||
@discussion This method can be used to notify the receiver that it will no longer be the target for a <tt>NDHotKeyEvent</tt> or used to prevent the target from changing by returning <tt>NO</tt>
|
|
||||||
@param target The new target for the <tt>NDHotKeyEvent</tt> or a collection (for example <tt>NSArray</tt>) of target.
|
|
||||||
@param hotKeyEvent The <tt>NDHotKeyEvent</tt> for which the target is changing.
|
|
||||||
@result Return <tt>NO</tt> to prevent the target from changing, otherwise return <tt>YES</tt>.
|
|
||||||
*/
|
|
||||||
- (BOOL)targetWillChangeToObject:(id)target forHotKeyEvent:(NDHotKeyEvent *)hotKeyEvent;
|
|
||||||
|
|
||||||
@end
|
|
|
@ -1,906 +0,0 @@
|
||||||
/*
|
|
||||||
NDHotKeyEvent.m
|
|
||||||
|
|
||||||
Created by Nathan Day on 21.06.06 under a MIT-style license.
|
|
||||||
Copyright (c) 2008 Nathan Day
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in
|
|
||||||
all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
THE SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#import "NDHotKeyEvent.h"
|
|
||||||
#import "NDKeyboardLayout.h"
|
|
||||||
|
|
||||||
static const NSUInteger kNDHotKeyEventVersion = 2;
|
|
||||||
|
|
||||||
@interface NDHotKeyEvent ()
|
|
||||||
#ifdef NDMapTableClassDefined
|
|
||||||
+ (NSMapTable *)allHotKeyEvents;
|
|
||||||
#else
|
|
||||||
+ (NSHashTable *)allHotKeyEvents;
|
|
||||||
#endif
|
|
||||||
- (void)addHotKey;
|
|
||||||
- (void)removeHotKey;
|
|
||||||
- (BOOL)setCollectiveEnabled:(BOOL)aFlag;
|
|
||||||
- (BOOL)collectiveEnable;
|
|
||||||
@end
|
|
||||||
|
|
||||||
static NSString * kArchivingKeyCodeKey = @"KeyCodeKey",
|
|
||||||
* kArchivingKeyCharacterKey = @"KeyCharacterKey",
|
|
||||||
* kArchivingModifierFlagsKey = @"ModifierFlagsKey",
|
|
||||||
* kArchivingSelectorReleasedCodeKey = @"SelectorReleasedCodeKey",
|
|
||||||
* kArchivingSelectorPressedCodeKey = @"SelectorPressedCodeKey";
|
|
||||||
const OSType NDHotKeyDefaultSignature = 'NDHK';
|
|
||||||
|
|
||||||
static OSStatus switchHotKey( NDHotKeyEvent * self, BOOL aFlag );
|
|
||||||
|
|
||||||
@interface NDHotKeyEvent ()
|
|
||||||
@end
|
|
||||||
/*
|
|
||||||
* class implementation NDHotKeyEvent
|
|
||||||
*/
|
|
||||||
@implementation NDHotKeyEvent
|
|
||||||
|
|
||||||
#ifdef NDHotKeyEventThreadSafe
|
|
||||||
#warning Thread saftey has been enabled for NDHotKeyEvent class methods
|
|
||||||
#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_4
|
|
||||||
#define NDHotKeyEventLock @synchronized([self class]) {
|
|
||||||
#define NDHotKeyEventUnlock }
|
|
||||||
#else
|
|
||||||
static NSLock * hotKeysLock = nil;
|
|
||||||
#define NDHotKeyEventLock [hotKeysLock lock]
|
|
||||||
#define NDHotKeyEventUnlock [hotKeysLock unlock]
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
#define NDHotKeyEventLock // lock
|
|
||||||
#define NDHotKeyEventUnlock // unlock
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef NDMapTableClassDefined
|
|
||||||
static NSMapTable * allHotKeyEvents = nil;
|
|
||||||
#else
|
|
||||||
static NSHashTable * allHotKeyEvents = NULL;
|
|
||||||
#endif
|
|
||||||
static EventHandlerRef hotKeysEventHandler = NULL;
|
|
||||||
static OSType signature = 0;
|
|
||||||
|
|
||||||
static OSStatus eventHandlerCallback( EventHandlerCallRef anInHandlerCallRef, EventRef anInEvent, void * self );
|
|
||||||
|
|
||||||
#ifndef NDMapTableClassDefined
|
|
||||||
static NSUInteger hashValueHashFunction( NSHashTable * aTable, const void * aHotKeyEvent );
|
|
||||||
static BOOL isEqualHashFunction( NSHashTable * aTable, const void * aFirstHotKeyEvent, const void * aSecondHotKeyEvent);
|
|
||||||
static NSString * describeHashFunction( NSHashTable * aTable, const void * aHotKeyEvent );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static UInt32 _idForCharacterAndModifer( unichar aCharacter, NSUInteger aModFlags ) { return (UInt32)aCharacter | (UInt32)(aModFlags); }
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
static void _getCharacterAndModiferForId( UInt32 anId, unichar *aCharacter, NSUInteger *aModFlags )
|
|
||||||
{
|
|
||||||
*aModFlags = anId>>16;
|
|
||||||
*aCharacter = anId&0xFFFF;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef NDMapTableClassDefined
|
|
||||||
struct HotKeyMappingEntry
|
|
||||||
{
|
|
||||||
UInt32 hotKeyId;
|
|
||||||
NDHotKeyEvent * hotKeyEvent;
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
+ (BOOL)install
|
|
||||||
{
|
|
||||||
if( hotKeysEventHandler == NULL )
|
|
||||||
{
|
|
||||||
id theHotKeyEvents = [self allHotKeyEvents];
|
|
||||||
EventTypeSpec theTypeSpec[] =
|
|
||||||
{
|
|
||||||
{ kEventClassKeyboard, kEventHotKeyPressed },
|
|
||||||
{ kEventClassKeyboard, kEventHotKeyReleased }
|
|
||||||
};
|
|
||||||
|
|
||||||
NDHotKeyEventLock;
|
|
||||||
if( theHotKeyEvents != nil && hotKeysEventHandler == NULL )
|
|
||||||
{
|
|
||||||
if( InstallEventHandler( GetEventDispatcherTarget(), (EventHandlerProcPtr)eventHandlerCallback, 2, theTypeSpec, (__bridge void *)(theHotKeyEvents), &hotKeysEventHandler ) != noErr )
|
|
||||||
NSLog(@"Could not install Event handler");
|
|
||||||
}
|
|
||||||
NDHotKeyEventUnlock;
|
|
||||||
}
|
|
||||||
|
|
||||||
return hotKeysEventHandler != NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
+ (void)uninstall
|
|
||||||
{
|
|
||||||
if( hotKeysEventHandler != NULL )
|
|
||||||
RemoveEventHandler( hotKeysEventHandler );
|
|
||||||
}
|
|
||||||
|
|
||||||
+ (void)initialize
|
|
||||||
{
|
|
||||||
[NDHotKeyEvent setVersion:kNDHotKeyEventVersion]; // the character attribute has been removed
|
|
||||||
#ifdef NDHotKeyEventThreadSafe
|
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_4
|
|
||||||
if( hotKeysLock == nil )
|
|
||||||
{
|
|
||||||
NSLock * theInstance = [[NSLock alloc] init];
|
|
||||||
|
|
||||||
if( !CompareAndSwap( nil, (unsigned long int)theInstance, (unsigned long int*)&hotKeysLock) )
|
|
||||||
[theInstance release]; // did not use instance
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
+ (void)setSignature:(OSType)aSignature
|
|
||||||
{
|
|
||||||
NSAssert( signature == 0 || aSignature == signature, @"The signature used by NDHotKeyEvent can only be set once safely" );
|
|
||||||
signature = aSignature;
|
|
||||||
}
|
|
||||||
|
|
||||||
+ (OSType)signature
|
|
||||||
{
|
|
||||||
signature = signature ? signature : NDHotKeyDefaultSignature;
|
|
||||||
return signature;
|
|
||||||
}
|
|
||||||
|
|
||||||
+ (BOOL)setAllEnabled:(BOOL)aFlag
|
|
||||||
{
|
|
||||||
BOOL theAllSucceeded = YES;
|
|
||||||
#ifdef NDMapTableClassDefined
|
|
||||||
NSMapTable * theAllHotKeyEvents = [NDHotKeyEvent allHotKeyEvents];
|
|
||||||
#else
|
|
||||||
NSHashTable * theAllHotKeyEvents = [NDHotKeyEvent allHotKeyEvents];
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
* need to install before to make sure the method 'setCollectiveEnabled:'
|
|
||||||
* doesn't try install since install tries to aquire the lock 'hotKeysLock'
|
|
||||||
*/
|
|
||||||
if( theAllHotKeyEvents && [NDHotKeyEvent install] )
|
|
||||||
{
|
|
||||||
#ifdef NDMapTableClassDefined
|
|
||||||
NDHotKeyEventLock;
|
|
||||||
for( NDHotKeyEvent * theHotEvent in [theAllHotKeyEvents objectEnumerator] )
|
|
||||||
{
|
|
||||||
if( ![theHotEvent setCollectiveEnabled:aFlag] )
|
|
||||||
theAllSucceeded = NO;
|
|
||||||
}
|
|
||||||
NDHotKeyEventUnlock;
|
|
||||||
#else
|
|
||||||
NSHashEnumerator theEnumerator;
|
|
||||||
struct HotKeyMappingEntry * theHotKeyMapEntry;
|
|
||||||
NDHotKeyEventLock;
|
|
||||||
theEnumerator = NSEnumerateHashTable( theAllHotKeyEvents );
|
|
||||||
|
|
||||||
while( (theHotKeyMapEntry = (struct HotKeyMappingEntry*)NSNextHashEnumeratorItem(&theEnumerator) ) )
|
|
||||||
{
|
|
||||||
if( ![theHotKeyMapEntry->hotKeyEvent setCollectiveEnabled:aFlag] )
|
|
||||||
theAllSucceeded = NO;
|
|
||||||
}
|
|
||||||
|
|
||||||
NSEndHashTableEnumeration( &theEnumerator );
|
|
||||||
NDHotKeyEventUnlock;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
return theAllSucceeded;
|
|
||||||
}
|
|
||||||
|
|
||||||
+ (BOOL)isEnabledKeyCharacter:(unichar)aKeyCharacter modifierFlags:(NSUInteger)aModifierFlags
|
|
||||||
{
|
|
||||||
return [[self findHotKeyForKeyCode:[[NDKeyboardLayout keyboardLayout] keyCodeForCharacter:aKeyCharacter numericPad:(aModifierFlags&NSNumericPadKeyMask) != 0] modifierFlags:aModifierFlags] isEnabled];
|
|
||||||
}
|
|
||||||
|
|
||||||
+ (BOOL)isEnabledKeyCode:(UInt16)aKeyCode modifierFlags:(NSUInteger)aModifierFlags
|
|
||||||
{
|
|
||||||
return [[self findHotKeyForKeyCode:aKeyCode modifierFlags:aModifierFlags] isEnabled];
|
|
||||||
}
|
|
||||||
|
|
||||||
+ (NDHotKeyEvent *)getHotKeyForKeyCode:(UInt16)aKeyCode modifierFlags:(NSUInteger)aModifierFlags
|
|
||||||
{
|
|
||||||
return [self getHotKeyForKeyCharacter:[[NDKeyboardLayout keyboardLayout] characterForKeyCode:aKeyCode] modifierFlags:aModifierFlags];
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma mark - finding hot key event objects
|
|
||||||
+ (NDHotKeyEvent *)getHotKeyForKeyCharacter:(unichar)aKeyCharacter modifierFlags:(NSUInteger)aModifierFlags
|
|
||||||
{
|
|
||||||
NDHotKeyEvent * theHotKey = nil;
|
|
||||||
|
|
||||||
theHotKey = [self findHotKeyForKeyCharacter:aKeyCharacter modifierFlags:aModifierFlags];
|
|
||||||
return theHotKey ? theHotKey : [self hotKeyWithKeyCharacter:aKeyCharacter modifierFlags:aModifierFlags];
|
|
||||||
}
|
|
||||||
|
|
||||||
+ (NDHotKeyEvent *)findHotKeyForKeyCode:(UInt16)aKeyCode modifierFlags:(NSUInteger)aModifierFlags
|
|
||||||
{
|
|
||||||
return [self findHotKeyForKeyCharacter:[[NDKeyboardLayout keyboardLayout] characterForKeyCode:aKeyCode] modifierFlags:aModifierFlags];
|
|
||||||
}
|
|
||||||
|
|
||||||
+ (NDHotKeyEvent *)findHotKeyForKeyCharacter:(unichar)aKeyCharacter modifierFlags:(NSUInteger)aModifierFlags
|
|
||||||
{
|
|
||||||
return [self findHotKeyForId:_idForCharacterAndModifer(aKeyCharacter, aModifierFlags)];
|
|
||||||
}
|
|
||||||
|
|
||||||
+ (NDHotKeyEvent *)findHotKeyForId:(UInt32)anID
|
|
||||||
{
|
|
||||||
NDHotKeyEvent * theResult = nil;
|
|
||||||
#ifdef NDMapTableClassDefined
|
|
||||||
NSMapTable * theAllHotKeyEvents = [NDHotKeyEvent allHotKeyEvents];
|
|
||||||
#else
|
|
||||||
NSHashTable * theAllHotKeyEvents = [NDHotKeyEvent allHotKeyEvents];
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if( theAllHotKeyEvents )
|
|
||||||
{
|
|
||||||
#ifdef NDMapTableClassDefined
|
|
||||||
NDHotKeyEventLock;
|
|
||||||
theResult = [theAllHotKeyEvents objectForKey:[NSNumber numberWithUnsignedInt:anID]];
|
|
||||||
NDHotKeyEventUnlock;
|
|
||||||
#else
|
|
||||||
struct HotKeyMappingEntry * theFoundEntry = NULL;
|
|
||||||
struct HotKeyMappingEntry theDummyEntry = {anID,nil};
|
|
||||||
|
|
||||||
NDHotKeyEventLock;
|
|
||||||
theFoundEntry = NSHashGet( theAllHotKeyEvents, (void*)&theDummyEntry);
|
|
||||||
if( theFoundEntry != NULL )
|
|
||||||
[[theFoundEntry->hotKeyEvent retain] autorelease];
|
|
||||||
NDHotKeyEventUnlock;
|
|
||||||
theResult = (theFoundEntry) ? theFoundEntry->hotKeyEvent : nil;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
return theResult;
|
|
||||||
}
|
|
||||||
|
|
||||||
+ (id)hotKeyWithEvent:(NSEvent *)anEvent
|
|
||||||
{
|
|
||||||
return [[self alloc] initWithEvent:anEvent];
|
|
||||||
}
|
|
||||||
|
|
||||||
+ (id)hotKeyWithEvent:(NSEvent *)anEvent target:(id)aTarget selector:(SEL)aSelector
|
|
||||||
{
|
|
||||||
return [[self alloc] initWithEvent:anEvent target:aTarget selector:aSelector];
|
|
||||||
}
|
|
||||||
|
|
||||||
+ (id)hotKeyWithKeyCharacter:(unichar)aKeyCharacter modifierFlags:(NSUInteger)aModifierFlags
|
|
||||||
{
|
|
||||||
return [[self alloc] initWithKeyCharacter:aKeyCharacter modifierFlags:aModifierFlags target:nil selector:(SEL)0];
|
|
||||||
}
|
|
||||||
|
|
||||||
+ (id)hotKeyWithKeyCode:(UInt16)aKeyCode modifierFlags:(NSUInteger)aModifierFlags
|
|
||||||
{
|
|
||||||
return [[self alloc] initWithKeyCode:aKeyCode modifierFlags:aModifierFlags target:nil selector:(SEL)0];
|
|
||||||
}
|
|
||||||
|
|
||||||
+ (id)hotKeyWithKeyCharacter:(unichar)aKeyCharacter modifierFlags:(NSUInteger)aModifierFlags target:(id)aTarget selector:(SEL)aSelector
|
|
||||||
{
|
|
||||||
return [[self alloc] initWithKeyCharacter:aKeyCharacter modifierFlags:aModifierFlags target:aTarget selector:aSelector];
|
|
||||||
}
|
|
||||||
|
|
||||||
+ (id)hotKeyWithKeyCode:(UInt16)aKeyCode modifierFlags:(NSUInteger)aModifierFlags target:(id)aTarget selector:(SEL)aSelector
|
|
||||||
{
|
|
||||||
return [[self alloc] initWithKeyCode:aKeyCode modifierFlags:aModifierFlags target:aTarget selector:aSelector];
|
|
||||||
}
|
|
||||||
|
|
||||||
+ (id)hotKeyWithWithPropertyList:(id)aPropertyList
|
|
||||||
{
|
|
||||||
return [[self alloc] initWithPropertyList:aPropertyList];
|
|
||||||
}
|
|
||||||
|
|
||||||
+ (NSString *)description
|
|
||||||
{
|
|
||||||
#ifdef NDMapTableClassDefined
|
|
||||||
NSMapTable * theAllHotKeyEvents = [NDHotKeyEvent allHotKeyEvents];
|
|
||||||
#else
|
|
||||||
NSHashTable * theAllHotKeyEvents = [NDHotKeyEvent allHotKeyEvents];
|
|
||||||
#endif
|
|
||||||
NSString * theDescription = nil;
|
|
||||||
if( theAllHotKeyEvents )
|
|
||||||
{
|
|
||||||
NDHotKeyEventLock;
|
|
||||||
#ifdef NDMapTableClassDefined
|
|
||||||
theDescription = [theAllHotKeyEvents description];
|
|
||||||
#else
|
|
||||||
theDescription = NSStringFromHashTable(theAllHotKeyEvents);
|
|
||||||
#endif
|
|
||||||
NDHotKeyEventUnlock;
|
|
||||||
}
|
|
||||||
return theDescription;
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma mark - creation and destruction
|
|
||||||
- (id)init
|
|
||||||
{
|
|
||||||
self = nil;
|
|
||||||
NSAssert( NO, @"You can not initialize a Hot Key with the init method" );
|
|
||||||
return nil;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (id)initWithEvent:(NSEvent *)anEvent
|
|
||||||
{
|
|
||||||
return [self initWithEvent:anEvent target:nil selector:NULL];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (id)initWithEvent:(NSEvent *)anEvent target:(id)aTarget selector:(SEL)aSelector
|
|
||||||
{
|
|
||||||
unsigned long theModifierFlags = [anEvent modifierFlags] & (NSShiftKeyMask|NSControlKeyMask|NSAlternateKeyMask|NSCommandKeyMask);
|
|
||||||
|
|
||||||
return [self initWithKeyCode:[anEvent keyCode]
|
|
||||||
modifierFlags:theModifierFlags
|
|
||||||
target:aTarget
|
|
||||||
selector:aSelector];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (id)initWithKeyCharacter:(unichar)aKeyCharacter modifierFlags:(NSUInteger)aModifierFlags
|
|
||||||
{
|
|
||||||
return [self initWithKeyCode:[[NDKeyboardLayout keyboardLayout] keyCodeForCharacter:aKeyCharacter numericPad:(aModifierFlags&NSNumericPadKeyMask) != 0] modifierFlags:aModifierFlags target:nil selector:NULL];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (id)initWithKeyCode:(UInt16)aKeyCode modifierFlags:(NSUInteger)aModifierFlags
|
|
||||||
{
|
|
||||||
return [self initWithKeyCode:aKeyCode modifierFlags:aModifierFlags target:nil selector:NULL];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (id)initWithKeyCode:(UInt16)aKeyCode modifierFlags:(NSUInteger)aModifierFlags target:(id)aTarget selector:(SEL)aSelector
|
|
||||||
{
|
|
||||||
return [self initWithKeyCharacter:[[NDKeyboardLayout keyboardLayout] characterForKeyCode:aKeyCode] modifierFlags:aModifierFlags target:aTarget selector:aSelector];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (id)initWithKeyCharacter:(unichar)aKeyCharacter modifierFlags:(NSUInteger)aModifierFlags target:(id)aTarget selector:(SEL)aSelector
|
|
||||||
{
|
|
||||||
if( (self = [super init]) != nil )
|
|
||||||
{
|
|
||||||
keyCharacter = aKeyCharacter;
|
|
||||||
modifierFlags = aModifierFlags;
|
|
||||||
target = aTarget;
|
|
||||||
selectorReleased = aSelector;
|
|
||||||
currentEventType = NDHotKeyNoEvent;
|
|
||||||
isEnabled.collective = YES;
|
|
||||||
[self addHotKey];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
self = nil;
|
|
||||||
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (id)initWithCoder:(NSCoder *)aDecoder
|
|
||||||
{
|
|
||||||
if( (self = [super init]) != nil)
|
|
||||||
{
|
|
||||||
if( [aDecoder allowsKeyedCoding] )
|
|
||||||
{
|
|
||||||
NSNumber * theValue = [aDecoder decodeObjectForKey:kArchivingKeyCharacterKey];
|
|
||||||
if( theValue == nil )
|
|
||||||
{
|
|
||||||
theValue = [aDecoder decodeObjectForKey:kArchivingKeyCodeKey];
|
|
||||||
keyCharacter = [[NDKeyboardLayout keyboardLayout] characterForKeyCode:[theValue unsignedShortValue]];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
keyCharacter = [theValue unsignedShortValue];
|
|
||||||
modifierFlags = [[aDecoder decodeObjectForKey:kArchivingModifierFlagsKey] unsignedIntegerValue];
|
|
||||||
|
|
||||||
selectorReleased = NSSelectorFromString( [aDecoder decodeObjectForKey:kArchivingSelectorReleasedCodeKey] );
|
|
||||||
selectorPressed = NSSelectorFromString( [aDecoder decodeObjectForKey:kArchivingSelectorPressedCodeKey] );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if( [aDecoder versionForClassName:@"NDHotKeyNoEvent"] == 1 )
|
|
||||||
{
|
|
||||||
unsigned short theKeyCode;
|
|
||||||
[aDecoder decodeValueOfObjCType:@encode(UInt16) at:&theKeyCode];
|
|
||||||
keyCharacter = [[NDKeyboardLayout keyboardLayout] characterForKeyCode:theKeyCode];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
[aDecoder decodeValueOfObjCType:@encode(unichar) at:&keyCharacter];
|
|
||||||
[aDecoder decodeValueOfObjCType:@encode(NSUInteger) at:&modifierFlags];
|
|
||||||
|
|
||||||
selectorReleased = NSSelectorFromString( [aDecoder decodeObject] );
|
|
||||||
selectorPressed = NSSelectorFromString( [aDecoder decodeObject] );
|
|
||||||
}
|
|
||||||
|
|
||||||
[self addHotKey];
|
|
||||||
}
|
|
||||||
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)encodeWithCoder:(NSCoder *)anEncoder
|
|
||||||
{
|
|
||||||
if( [anEncoder allowsKeyedCoding] )
|
|
||||||
{
|
|
||||||
[anEncoder encodeObject:[NSNumber numberWithUnsignedShort:keyCharacter] forKey:kArchivingKeyCharacterKey];
|
|
||||||
[anEncoder encodeObject:[NSNumber numberWithUnsignedInteger:modifierFlags] forKey:kArchivingModifierFlagsKey];
|
|
||||||
|
|
||||||
[anEncoder encodeObject:NSStringFromSelector( selectorReleased ) forKey:kArchivingSelectorReleasedCodeKey];
|
|
||||||
[anEncoder encodeObject:NSStringFromSelector( selectorPressed ) forKey:kArchivingSelectorPressedCodeKey];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
[anEncoder encodeValueOfObjCType:@encode(unichar) at:&keyCharacter];
|
|
||||||
[anEncoder encodeValueOfObjCType:@encode(NSUInteger) at:&modifierFlags];
|
|
||||||
|
|
||||||
[anEncoder encodeObject:NSStringFromSelector( selectorReleased )];
|
|
||||||
[anEncoder encodeObject:NSStringFromSelector( selectorPressed )];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- (id)initWithPropertyList:(id)aPropertyList
|
|
||||||
{
|
|
||||||
if( aPropertyList )
|
|
||||||
{
|
|
||||||
NSNumber * theKeyCode,
|
|
||||||
* theModiferFlag;
|
|
||||||
|
|
||||||
theKeyCode = [aPropertyList objectForKey:kArchivingKeyCodeKey];
|
|
||||||
theModiferFlag = [aPropertyList objectForKey:kArchivingModifierFlagsKey];
|
|
||||||
|
|
||||||
if( (self = [self initWithKeyCode:[theKeyCode unsignedShortValue] modifierFlags:[theModiferFlag unsignedIntValue]]) != nil )
|
|
||||||
{
|
|
||||||
selectorPressed = NSSelectorFromString([aPropertyList objectForKey:kArchivingSelectorPressedCodeKey]);
|
|
||||||
selectorReleased = NSSelectorFromString([aPropertyList objectForKey:kArchivingSelectorReleasedCodeKey]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
self = nil;
|
|
||||||
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (id)propertyList
|
|
||||||
{
|
|
||||||
return [NSDictionary dictionaryWithObjectsAndKeys:
|
|
||||||
[NSNumber numberWithUnsignedShort:[self keyCode]], kArchivingKeyCodeKey,
|
|
||||||
[NSNumber numberWithUnsignedLong:[self modifierFlags]], kArchivingModifierFlagsKey,
|
|
||||||
NSStringFromSelector( selectorPressed ), kArchivingSelectorPressedCodeKey,
|
|
||||||
NSStringFromSelector( selectorReleased ), kArchivingSelectorReleasedCodeKey,
|
|
||||||
nil];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)dealloc
|
|
||||||
{
|
|
||||||
#ifdef NDMapTableClassDefined
|
|
||||||
NSMapTable * theAllHotKeyEvents = [NDHotKeyEvent allHotKeyEvents];
|
|
||||||
#else
|
|
||||||
NSHashTable * theAllHotKeyEvents = [NDHotKeyEvent allHotKeyEvents];
|
|
||||||
#endif
|
|
||||||
if( theAllHotKeyEvents )
|
|
||||||
{
|
|
||||||
#ifndef NDMapTableClassDefined
|
|
||||||
struct HotKeyMappingEntry theDummyEntry = {[self hotKeyId],nil};
|
|
||||||
#endif
|
|
||||||
NDHotKeyEventLock;
|
|
||||||
switchHotKey( self, NO );
|
|
||||||
#ifdef NDMapTableClassDefined
|
|
||||||
[theAllHotKeyEvents removeObjectForKey:[NSNumber numberWithUnsignedInt:[self hotKeyId]]];
|
|
||||||
#else
|
|
||||||
id theHotKeyEvent = NSHashGet( theAllHotKeyEvents, (void*)&theDummyEntry );
|
|
||||||
if( theHotKeyEvent )
|
|
||||||
NSHashRemove( theAllHotKeyEvents, theHotKeyEvent );
|
|
||||||
#endif
|
|
||||||
NDHotKeyEventUnlock;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- (BOOL)setEnabled:(BOOL)aFlag
|
|
||||||
{
|
|
||||||
BOOL theResult = YES;
|
|
||||||
|
|
||||||
if( [NDHotKeyEvent install] )
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* if individual and collective YES then currently ON, otherwise currently off
|
|
||||||
*/
|
|
||||||
NDHotKeyEventLock;
|
|
||||||
if( aFlag == YES && isEnabled.collective == YES && isEnabled.individual == NO )
|
|
||||||
theResult = (switchHotKey( self, YES ) == noErr);
|
|
||||||
else if( aFlag == NO && isEnabled.collective == YES && isEnabled.individual == YES )
|
|
||||||
theResult = (switchHotKey( self, NO ) == noErr);
|
|
||||||
NDHotKeyEventUnlock;
|
|
||||||
|
|
||||||
if( theResult )
|
|
||||||
isEnabled.individual = aFlag;
|
|
||||||
else
|
|
||||||
NSLog(@"%s failed ", aFlag ? "enable" : "disable" );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
theResult = NO;
|
|
||||||
|
|
||||||
return theResult;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)setIsEnabled:(BOOL)aFlag { [self setEnabled:aFlag]; }
|
|
||||||
|
|
||||||
- (BOOL)isEnabled { return isEnabled.individual && isEnabled.collective; }
|
|
||||||
- (id)target { return target; }
|
|
||||||
- (SEL)selector { return selectorReleased; }
|
|
||||||
- (SEL)selectorReleased { return selectorReleased; }
|
|
||||||
- (SEL)selectorPressed { return selectorPressed; }
|
|
||||||
- (int)currentEventType { return currentEventType; } // (NDHotKeyNoEvent | NDHotKeyPressedEvent | NDHotKeyReleasedEvent)
|
|
||||||
- (BOOL)setTarget:(id)aTarget selector:(SEL)aSelector { return [self setTarget:aTarget selectorReleased:aSelector selectorPressed:(SEL)0]; }
|
|
||||||
|
|
||||||
#ifdef NS_BLOCKS_AVAILABLE
|
|
||||||
- (BOOL)setBlock:(void(^)(NDHotKeyEvent*))aBlock { return [self setReleasedBlock:aBlock pressedBlock:nil]; }
|
|
||||||
#endif
|
|
||||||
|
|
||||||
- (BOOL)setTarget:(id)aTarget selectorReleased:(SEL)aSelectorReleased selectorPressed:(SEL)aSelectorPressed
|
|
||||||
{
|
|
||||||
BOOL theResult = NO;
|
|
||||||
[self setEnabled:NO];
|
|
||||||
if( target != nil && target != aTarget )
|
|
||||||
{
|
|
||||||
if( ![target respondsToSelector:@selector(targetWillChangeToObject:forHotKeyEvent:)] || [target targetWillChangeToObject:aTarget forHotKeyEvent:self] )
|
|
||||||
{
|
|
||||||
target = aTarget;
|
|
||||||
theResult = YES;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
target = aTarget;
|
|
||||||
theResult = YES;
|
|
||||||
}
|
|
||||||
|
|
||||||
selectorReleased = aSelectorReleased;
|
|
||||||
selectorPressed = aSelectorPressed;
|
|
||||||
|
|
||||||
#ifdef NS_BLOCKS_AVAILABLE
|
|
||||||
releasedBlock = nil;
|
|
||||||
pressedBlock = nil;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return theResult; // was change succesful
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef NS_BLOCKS_AVAILABLE
|
|
||||||
- (BOOL)setReleasedBlock:(void(^)(NDHotKeyEvent*))aReleasedBlock pressedBlock:(void(^)(NDHotKeyEvent*))aPressedBlock
|
|
||||||
{
|
|
||||||
BOOL theResult = NO;
|
|
||||||
[self setEnabled:NO];
|
|
||||||
if( ![target respondsToSelector:@selector(targetWillChangeToObject:forHotKeyEvent:)] || [target targetWillChangeToObject:nil forHotKeyEvent:self] )
|
|
||||||
{
|
|
||||||
if( releasedBlock != aReleasedBlock )
|
|
||||||
releasedBlock = [aReleasedBlock copy];
|
|
||||||
|
|
||||||
if( pressedBlock != aPressedBlock )
|
|
||||||
pressedBlock = [aPressedBlock copy];
|
|
||||||
|
|
||||||
selectorReleased = (SEL)0;
|
|
||||||
selectorPressed = (SEL)0;
|
|
||||||
theResult = YES;
|
|
||||||
}
|
|
||||||
|
|
||||||
return theResult; // was change succesful
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
- (void)performHotKeyReleased
|
|
||||||
{
|
|
||||||
NSAssert( target != nil || releasedBlock != nil, @"Release hot key fired without target or release block" );
|
|
||||||
|
|
||||||
currentEventType = NDHotKeyReleasedEvent;
|
|
||||||
if( selectorReleased )
|
|
||||||
{
|
|
||||||
if([target respondsToSelector:selectorReleased])
|
|
||||||
[target performSelector:selectorReleased withObject:self];
|
|
||||||
else if( [target respondsToSelector:@selector(makeObjectsPerformSelector:withObject:)] )
|
|
||||||
[target makeObjectsPerformSelector:selectorReleased withObject:self];
|
|
||||||
}
|
|
||||||
#ifdef NS_BLOCKS_AVAILABLE
|
|
||||||
else if( releasedBlock )
|
|
||||||
releasedBlock(self);
|
|
||||||
#endif
|
|
||||||
currentEventType = NDHotKeyNoEvent;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)performHotKeyPressed
|
|
||||||
{
|
|
||||||
NSAssert( target != nil || pressedBlock != nil, @"Release hot key fired without target or pressed block" );
|
|
||||||
|
|
||||||
currentEventType = NDHotKeyPressedEvent;
|
|
||||||
if( selectorPressed )
|
|
||||||
{
|
|
||||||
if([target respondsToSelector:selectorPressed])
|
|
||||||
[target performSelector:selectorPressed withObject:self];
|
|
||||||
else if( [target respondsToSelector:@selector(makeObjectsPerformSelector:withObject:)] )
|
|
||||||
[target makeObjectsPerformSelector:selectorPressed withObject:self];
|
|
||||||
}
|
|
||||||
#ifdef NS_BLOCKS_AVAILABLE
|
|
||||||
else if( pressedBlock )
|
|
||||||
pressedBlock(self);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
currentEventType = NDHotKeyNoEvent;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (unichar)keyCharacter { return keyCharacter; }
|
|
||||||
- (BOOL)keyPad { return keyPad; }
|
|
||||||
- (UInt16)keyCode { return [[NDKeyboardLayout keyboardLayout] keyCodeForCharacter:self.keyCharacter numericPad:self.keyPad]; }
|
|
||||||
- (NSUInteger)modifierFlags { return modifierFlags; }
|
|
||||||
- (UInt32)hotKeyId { return _idForCharacterAndModifer( self.keyCharacter, self.modifierFlags ); }
|
|
||||||
- (NSString *)stringValue { return [[NDKeyboardLayout keyboardLayout] stringForKeyCode:[self keyCode] modifierFlags:(UInt32)[self modifierFlags]]; }
|
|
||||||
|
|
||||||
- (BOOL)isEqual:(id)anObject
|
|
||||||
{
|
|
||||||
return [super isEqual:anObject] || ([anObject isKindOfClass:[self class]] == YES && [self keyCode] == [(NDHotKeyEvent*)anObject keyCode] && [self modifierFlags] == [anObject modifierFlags]);
|
|
||||||
}
|
|
||||||
|
|
||||||
- (NSUInteger)hash { return (NSUInteger)self.keyCharacter | (self.modifierFlags); }
|
|
||||||
|
|
||||||
- (NSString *)description
|
|
||||||
{
|
|
||||||
return [NSString stringWithFormat:@"{\n\tKey Combination: %@,\n\tEnabled: %s\n\tKey Press Selector: %@\n\tKey Release Selector: %@\n}\n",
|
|
||||||
[self stringValue],
|
|
||||||
[self isEnabled] ? "yes" : "no",
|
|
||||||
NSStringFromSelector([self selectorPressed]),
|
|
||||||
NSStringFromSelector([self selectorReleased])];
|
|
||||||
}
|
|
||||||
|
|
||||||
OSStatus eventHandlerCallback( EventHandlerCallRef anInHandlerCallRef, EventRef anInEvent, void * anInUserData )
|
|
||||||
{
|
|
||||||
// NSHashTable * allHotKeyEvents = (NSHashTable *)anInUserData;
|
|
||||||
EventHotKeyID theHotKeyID;
|
|
||||||
OSStatus theError;
|
|
||||||
|
|
||||||
NSCAssert( GetEventClass( anInEvent ) == kEventClassKeyboard, @"Got event that is not a hot key event" );
|
|
||||||
|
|
||||||
theError = GetEventParameter( anInEvent, kEventParamDirectObject, typeEventHotKeyID, NULL, sizeof(EventHotKeyID), NULL, &theHotKeyID );
|
|
||||||
|
|
||||||
if( theError == noErr )
|
|
||||||
{
|
|
||||||
NDHotKeyEvent * theHotKeyEvent;
|
|
||||||
UInt32 theEventKind;
|
|
||||||
|
|
||||||
NSCAssert( [NDHotKeyEvent signature] == theHotKeyID.signature, @"Got hot key event with wrong signature" );
|
|
||||||
|
|
||||||
theHotKeyEvent = [NDHotKeyEvent findHotKeyForId:theHotKeyID.id];
|
|
||||||
|
|
||||||
theEventKind = GetEventKind( anInEvent );
|
|
||||||
if( kEventHotKeyPressed == theEventKind )
|
|
||||||
[theHotKeyEvent performHotKeyPressed];
|
|
||||||
else if( kEventHotKeyReleased == theEventKind )
|
|
||||||
[theHotKeyEvent performHotKeyReleased];
|
|
||||||
}
|
|
||||||
|
|
||||||
return theError;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifndef NDMapTableClassDefined
|
|
||||||
|
|
||||||
NSUInteger hashValueHashFunction( NSHashTable * aTable, const void * aHotKeyEntry )
|
|
||||||
{
|
|
||||||
struct HotKeyMappingEntry * theHotKeyEntry = (struct HotKeyMappingEntry*)aHotKeyEntry;
|
|
||||||
return theHotKeyEntry->hotKeyId;
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOL isEqualHashFunction( NSHashTable * aTable, const void * aFirstHotKeyEntry, const void * aSecondHotKeyEntry)
|
|
||||||
{
|
|
||||||
struct HotKeyMappingEntry * theFirst = (struct HotKeyMappingEntry*)aFirstHotKeyEntry,
|
|
||||||
* theSecond = (struct HotKeyMappingEntry*)aSecondHotKeyEntry;
|
|
||||||
return theFirst->hotKeyId == theSecond->hotKeyId;
|
|
||||||
}
|
|
||||||
|
|
||||||
NSString * describeHashFunction( NSHashTable * aTable, const void * aHotKeyEntry )
|
|
||||||
{
|
|
||||||
NDHotKeyEvent * theHotKey;
|
|
||||||
|
|
||||||
theHotKey = ((struct HotKeyMappingEntry*)aHotKeyEntry)->hotKeyEvent;
|
|
||||||
return [theHotKey description];
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#pragma mark Private methods
|
|
||||||
|
|
||||||
#ifdef NDMapTableClassDefined
|
|
||||||
+ (NSMapTable *)allHotKeyEvents
|
|
||||||
{
|
|
||||||
if( allHotKeyEvents == NULL )
|
|
||||||
{
|
|
||||||
NDHotKeyEventLock;
|
|
||||||
if( allHotKeyEvents == NULL )
|
|
||||||
allHotKeyEvents = [[NSMapTable alloc] initWithKeyOptions:NSMapTableStrongMemory valueOptions:NSMapTableZeroingWeakMemory capacity:0];
|
|
||||||
NDHotKeyEventUnlock;
|
|
||||||
}
|
|
||||||
return allHotKeyEvents;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
|
|
||||||
+ (NSHashTable *)allHotKeyEvents
|
|
||||||
{
|
|
||||||
if( allHotKeyEvents == NULL )
|
|
||||||
{
|
|
||||||
NSHashTableCallBacks theHashCallBacks;
|
|
||||||
|
|
||||||
theHashCallBacks.hash = hashValueHashFunction;
|
|
||||||
theHashCallBacks.isEqual = isEqualHashFunction;
|
|
||||||
theHashCallBacks.retain = NULL;
|
|
||||||
theHashCallBacks.release = NULL;
|
|
||||||
theHashCallBacks.describe = describeHashFunction;
|
|
||||||
|
|
||||||
NDHotKeyEventLock;
|
|
||||||
if( allHotKeyEvents == NULL )
|
|
||||||
allHotKeyEvents = NSCreateHashTableWithZone( theHashCallBacks, 0, NULL);
|
|
||||||
NDHotKeyEventUnlock;
|
|
||||||
}
|
|
||||||
|
|
||||||
return allHotKeyEvents;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
- (void)addHotKey
|
|
||||||
{
|
|
||||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardLayoutSelectedKeyboardInputSourceChangedNotification:) name:NDKeyboardLayoutSelectedKeyboardInputSourceChangedNotification object:nil];
|
|
||||||
#ifdef NDMapTableClassDefined
|
|
||||||
NSMapTable * theAllHotKeyEvents = [NDHotKeyEvent allHotKeyEvents];
|
|
||||||
#else
|
|
||||||
NSHashTable * theAllHotKeyEvents = [NDHotKeyEvent allHotKeyEvents];
|
|
||||||
#endif
|
|
||||||
if( theAllHotKeyEvents )
|
|
||||||
{
|
|
||||||
NDHotKeyEventLock;
|
|
||||||
#ifdef NDMapTableClassDefined
|
|
||||||
[theAllHotKeyEvents setObject:self forKey:[NSNumber numberWithUnsignedInt:[self hotKeyId]]];
|
|
||||||
#else
|
|
||||||
struct HotKeyMappingEntry * theEntry = (struct HotKeyMappingEntry *)malloc(sizeof(struct HotKeyMappingEntry));
|
|
||||||
theEntry->hotKeyId = [self hotKeyId];
|
|
||||||
theEntry->hotKeyEvent = self;
|
|
||||||
|
|
||||||
NSParameterAssert( NSHashInsertIfAbsent( theAllHotKeyEvents, (void*)theEntry ) == NULL );
|
|
||||||
#endif
|
|
||||||
NDHotKeyEventUnlock;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)keyboardLayoutSelectedKeyboardInputSourceChangedNotification:(NSNotification*)aNotification
|
|
||||||
{
|
|
||||||
if( self.isEnabled ) // if enable re-eable using new keyCode
|
|
||||||
switchHotKey( self, YES );
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)removeHotKey
|
|
||||||
{
|
|
||||||
[self setEnabled:NO];
|
|
||||||
|
|
||||||
#ifdef NDMapTableClassDefined
|
|
||||||
NSMapTable * theAllHotKeyEvents = [NDHotKeyEvent allHotKeyEvents];
|
|
||||||
#else
|
|
||||||
NSHashTable * theAllHotKeyEvents = [NDHotKeyEvent allHotKeyEvents];
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if( theAllHotKeyEvents )
|
|
||||||
{
|
|
||||||
#ifndef NDMapTableClassDefined
|
|
||||||
struct HotKeyMappingEntry theDummyEntry = {[self hotKeyId],nil};
|
|
||||||
struct HotKeyMappingEntry * theEntry = NULL;
|
|
||||||
#endif
|
|
||||||
NDHotKeyEventLock;
|
|
||||||
#ifdef NDMapTableClassDefined
|
|
||||||
[theAllHotKeyEvents removeObjectForKey:[NSNumber numberWithUnsignedInt:[self hotKeyId]]];
|
|
||||||
#else
|
|
||||||
theEntry = (struct HotKeyMappingEntry*)NSHashGet( theAllHotKeyEvents, (void*)&theDummyEntry);
|
|
||||||
if( theEntry )
|
|
||||||
{
|
|
||||||
NSParameterAssert( theEntry->hotKeyEvent == self );
|
|
||||||
NSHashRemove( theAllHotKeyEvents, theEntry );
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
NDHotKeyEventUnlock;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- (BOOL)setCollectiveEnabled:(BOOL)aFlag
|
|
||||||
{
|
|
||||||
BOOL theResult = YES;
|
|
||||||
|
|
||||||
if( [NDHotKeyEvent install] )
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* if individual and collective YES then currently ON, otherwise currently off
|
|
||||||
*/
|
|
||||||
NDHotKeyEventLock;
|
|
||||||
if( aFlag == YES && isEnabled.collective == NO && isEnabled.individual == YES )
|
|
||||||
theResult = (switchHotKey( self, YES ) == noErr);
|
|
||||||
else if( aFlag == NO && isEnabled.collective == YES && isEnabled.individual == YES )
|
|
||||||
theResult = (switchHotKey( self, NO ) == noErr);
|
|
||||||
NDHotKeyEventUnlock;
|
|
||||||
|
|
||||||
if( theResult )
|
|
||||||
isEnabled.collective = aFlag;
|
|
||||||
else
|
|
||||||
NSLog(@"%s failed", aFlag ? "enable" : "disable" );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
theResult = NO;
|
|
||||||
|
|
||||||
return theResult;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (BOOL)collectiveEnable { return isEnabled.collective; }
|
|
||||||
|
|
||||||
static OSStatus switchHotKey( NDHotKeyEvent * self, BOOL aFlag )
|
|
||||||
{
|
|
||||||
OSStatus theError = noErr;
|
|
||||||
if( aFlag )
|
|
||||||
{
|
|
||||||
EventHotKeyID theHotKeyID;
|
|
||||||
|
|
||||||
if( self->reference )
|
|
||||||
theError = UnregisterEventHotKey( self->reference );
|
|
||||||
if( theError == noErr )
|
|
||||||
{
|
|
||||||
theHotKeyID.signature = [NDHotKeyEvent signature];
|
|
||||||
theHotKeyID.id = [self hotKeyId];
|
|
||||||
|
|
||||||
NSCAssert( theHotKeyID.signature, @"HotKeyEvent signature has not been set yet" );
|
|
||||||
NSCParameterAssert(sizeof(unsigned long) >= sizeof(id) );
|
|
||||||
|
|
||||||
theError = RegisterEventHotKey( self.keyCode, (UInt32)NDCarbonModifierFlagsForCocoaModifierFlags(self->modifierFlags), theHotKeyID, GetEventDispatcherTarget(), 0, &self->reference );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
theError = UnregisterEventHotKey( self->reference );
|
|
||||||
self->reference = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return theError;
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma mark - Deprecated Methods
|
|
||||||
|
|
||||||
+ (NDHotKeyEvent *)getHotKeyForKeyCode:(UInt16)aKeyCode character:(unichar)aChar modifierFlags:(NSUInteger)aModifierFlags
|
|
||||||
{
|
|
||||||
return [self getHotKeyForKeyCode:aKeyCode modifierFlags:aModifierFlags];
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* +hotKeyWithKeyCode:character:modifierFlags:
|
|
||||||
*/
|
|
||||||
+ (id)hotKeyWithKeyCode:(UInt16)aKeyCode character:(unichar)aChar modifierFlags:(NSUInteger)aModifierFlags
|
|
||||||
{
|
|
||||||
return [self hotKeyWithKeyCode:aKeyCode modifierFlags:aModifierFlags target:nil selector:NULL];
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* +hotKeyWithKeyCode:character:modifierFlags:target:selector:
|
|
||||||
*/
|
|
||||||
+ (id)hotKeyWithKeyCode:(UInt16)aKeyCode character:(unichar)aChar modifierFlags:(NSUInteger)aModifierFlags target:(id)aTarget selector:(SEL)aSelector
|
|
||||||
{
|
|
||||||
return [[self alloc] initWithKeyCode:aKeyCode modifierFlags:aModifierFlags target:aTarget selector:aSelector];
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* -initWithKeyCode:character:modifierFlags:
|
|
||||||
*/
|
|
||||||
- (id)initWithKeyCode:(UInt16)aKeyCode character:(unichar)aChar modifierFlags:(NSUInteger)aModifierFlags
|
|
||||||
{
|
|
||||||
return [self initWithKeyCode:aKeyCode modifierFlags:aModifierFlags target:nil selector:NULL];
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* -initWithKeyCode:character:modifierFlags:target:selector:
|
|
||||||
*/
|
|
||||||
- (id)initWithKeyCode:(UInt16)aKeyCode character:(unichar)aChar modifierFlags:(NSUInteger)aModifierFlags target:(id)aTarget selector:(SEL)aSelector
|
|
||||||
{
|
|
||||||
return [self initWithKeyCode:aKeyCode modifierFlags:aModifierFlags target:aTarget selector:aSelector];
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
|
@ -1,135 +0,0 @@
|
||||||
/*
|
|
||||||
NDKeyboardLayout.h
|
|
||||||
|
|
||||||
Created by Nathan Day on 01.18.10 under a MIT-style license.
|
|
||||||
Copyright (c) 2010 Nathan Day
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in
|
|
||||||
all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
THE SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
@header NDKeyboardLayout.h
|
|
||||||
@abstract Header file for NDKeyboardLayout
|
|
||||||
@author Nathan Day
|
|
||||||
*/
|
|
||||||
|
|
||||||
#import <Cocoa/Cocoa.h>
|
|
||||||
#import <CoreServices/CoreServices.h>
|
|
||||||
#import <Carbon/Carbon.h>
|
|
||||||
|
|
||||||
struct ReverseMappingEntry;
|
|
||||||
|
|
||||||
extern NSString * const NDKeyboardLayoutSelectedKeyboardInputSourceChangedNotification;
|
|
||||||
extern NSString * const NDKeyboardLayoutPreviousKeyboardLayoutUserInfoKey;
|
|
||||||
|
|
||||||
/*!
|
|
||||||
@function NDCocoaModifierFlagsForCarbonModifierFlags
|
|
||||||
Convert Carbon modifer flags to Cocoa modifier flags.
|
|
||||||
@param modifierFlags one or more of the flags <tt>shiftKey</tt>, <tt>controlKey</tt>, <tt>optionKey</tt>, <tt>cmdKey</tt>
|
|
||||||
*/
|
|
||||||
NSUInteger NDCocoaModifierFlagsForCarbonModifierFlags( NSUInteger modifierFlags );
|
|
||||||
/*!
|
|
||||||
@function NDCarbonModifierFlagsForCocoaModifierFlags
|
|
||||||
Convert Cocoa modifer flags to Carbon modifier flags.
|
|
||||||
@param modifierFlags one or more of the flags <tt>NSShiftKeyMask</tt>, <tt>NSControlKeyMask</tt>, <tt>NSAlternateKeyMask</tt>, <tt>NSCommandKeyMask</tt>
|
|
||||||
*/
|
|
||||||
NSUInteger NDCarbonModifierFlagsForCocoaModifierFlags( NSUInteger modifierFlags );
|
|
||||||
|
|
||||||
/*!
|
|
||||||
@class NDKeyboardLayout
|
|
||||||
@abstract Class for translating between key codes and key characters.
|
|
||||||
@discussion The key code for each key character can change between hardware and with localisation, <tt>NDKeyboardLayout</tt> handles translation between key codes and key characters as well as for generating strings for display purposes.
|
|
||||||
@helps Used by <tt>NDHotKeyEvent</tt>.
|
|
||||||
*/
|
|
||||||
@interface NDKeyboardLayout : NSObject
|
|
||||||
{
|
|
||||||
@private
|
|
||||||
CFDataRef keyboardLayoutData;
|
|
||||||
struct ReverseMappingEntry * mappings;
|
|
||||||
NSUInteger numberOfMappings;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
@method keyboardLayout
|
|
||||||
Get a keyboard layout for the current keyboard
|
|
||||||
*/
|
|
||||||
+ (id)keyboardLayout;
|
|
||||||
|
|
||||||
/*!
|
|
||||||
@method init
|
|
||||||
initialise a keyboard layout for the current keyboard, if that fails a keyboard layout for one of the languages
|
|
||||||
returned from <tt>[NSLocale preferredLanguages]</tt> is attempted and if finally if that fails a keyboard layout
|
|
||||||
for the most recently used ASCII-capable keyboard is created. If that fails then this method returns <tt>nil</tt>.
|
|
||||||
*/
|
|
||||||
- (id)init;
|
|
||||||
/*!
|
|
||||||
@method initWithLanguage:
|
|
||||||
@abstract initialise a keyboard layout.
|
|
||||||
@discussion Initialises a KeyboardLayout with an <tt>TISInputSourceRef</tt> for the supplied language.
|
|
||||||
*/
|
|
||||||
- (id)initWithLanguage:(NSString *)langauge;
|
|
||||||
/*!
|
|
||||||
@method initWithInputSource:
|
|
||||||
@abstract initialise a keyboard layout.
|
|
||||||
@discussion Initialises a KeyboardLayout with an <tt>TISInputSourceRef</tt>, this method is called with the result from <tt>initWithInputSource:TISCopyCurrentKeyboardInputSource()</tt>.
|
|
||||||
*/
|
|
||||||
- (id)initWithInputSource:(TISInputSourceRef)source;
|
|
||||||
|
|
||||||
/*!
|
|
||||||
@method stringForCharacter:modifierFlags:
|
|
||||||
@abstract Get a string for display purposes.
|
|
||||||
@discussion <tt>stringForCharacter:modifierFlags:</tt> returns a string that can be displayed to the user, For example command-z would produce ⌘Z, shift-T would produce ⇧T.
|
|
||||||
@param character The unmodified character on the keyboard.
|
|
||||||
@param modifierFlags Modifier flags <tt>NSControlKeyMask</tt>, <tt>NSAlternateKeyMask</tt>, <tt>NSShiftKeyMask</tt>, <tt>NSCommandKeyMask</tt> and <tt>NSNumericPadKeyMask</tt>.
|
|
||||||
*/
|
|
||||||
- (NSString*)stringForCharacter:(unichar)character modifierFlags:(UInt32)modifierFlags;
|
|
||||||
/*!
|
|
||||||
@method stringForKeyCode:modifierFlags:
|
|
||||||
@abstract Get a string for display purposes.
|
|
||||||
@discussion <tt>stringForKeyCode:modifierFlags:</tt> returns a string that can be displayed to the user. This method is called by <tt>stringForCharacter::modifierFlags</tt> and is problem more useful most of the time.
|
|
||||||
@param keyCode A value specifying the virtual key code that is to be translated. For ADB keyboards, virtual key codes are in the range from 0 to 127.
|
|
||||||
@param modifierFlags Modifier flags <tt>NSControlKeyMask</tt>, <tt>NSAlternateKeyMask</tt>, <tt>NSShiftKeyMask</tt>, <tt>NSCommandKeyMask</tt> and <tt>NSNumericPadKeyMask</tt>.
|
|
||||||
*/
|
|
||||||
- (NSString*)stringForKeyCode:(UInt16)keyCode modifierFlags:(UInt32)modifierFlags;
|
|
||||||
/*!
|
|
||||||
@method characterForKeyCode:
|
|
||||||
@abstract Get the key character for a given key code.
|
|
||||||
@discussion The character returned is the unmodified version on the keyboard.
|
|
||||||
@param keyCode A value specifying the virtual key code that is to be translated. For ADB keyboards, virtual key codes are in the range from 0 to 127.
|
|
||||||
@result The character for the unmodified version of the key.
|
|
||||||
*/
|
|
||||||
- (unichar)characterForKeyCode:(UInt16)keyCode;
|
|
||||||
/*!
|
|
||||||
@method keyCodeForCharacter:numericPad:
|
|
||||||
@abstract Get the key code for a given key character.
|
|
||||||
@discussion The character pass in must be the unshifter character for the key, for example to get the key code for the '?' on keyboards where you type shift-/ to get '?' you should pass in the character '/"
|
|
||||||
@param character The unmodified character on the keyboard.
|
|
||||||
@param numericPad For the keycode of a key on the keypad where the same character is also on the main keyboard this flag needs to be <tt>YES</tt>.
|
|
||||||
*/
|
|
||||||
- (UInt16)keyCodeForCharacter:(unichar)character numericPad:(BOOL)numericPad;
|
|
||||||
/*!
|
|
||||||
@method keyCodeForCharacter:
|
|
||||||
@abstract Get the key code for a given key character.
|
|
||||||
@discussion Calls <tt>keyCodeForCharacter:numericPad:</tt> with the keypad flag set to <tt>NO</tt>
|
|
||||||
@param character The unmodified character on the keyboard.
|
|
||||||
@result A value specifying the virtual key code that is to be translated. For ADB keyboards, virtual key codes are in the range from 0 to 127.
|
|
||||||
*/
|
|
||||||
- (UInt16)keyCodeForCharacter:(unichar)character;
|
|
||||||
|
|
||||||
@end
|
|
|
@ -1,483 +0,0 @@
|
||||||
/*
|
|
||||||
NDKeyboardLayout.m
|
|
||||||
|
|
||||||
Created by Nathan Day on 01.18.10 under a MIT-style license.
|
|
||||||
Copyright (c) 2010 Nathan Day
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in
|
|
||||||
all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
THE SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#import "NDKeyboardLayout.h"
|
|
||||||
#include <libkern/OSAtomic.h>
|
|
||||||
|
|
||||||
NSString * const NDKeyboardLayoutSelectedKeyboardInputSourceChangedNotification = @"NDKeyboardLayoutSelectedKeyboardInputSourceChanged";
|
|
||||||
NSString * const NDKeyboardLayoutPreviousKeyboardLayoutUserInfoKey = @"NDKeyboardLayoutPreviousKeyboardLayout";
|
|
||||||
|
|
||||||
struct ReverseMappingEntry
|
|
||||||
{
|
|
||||||
UniChar character;
|
|
||||||
BOOL keypad;
|
|
||||||
UInt16 keyCode;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct UnmappedEntry
|
|
||||||
{
|
|
||||||
UniChar character;
|
|
||||||
UInt16 keyCode;
|
|
||||||
unichar description[4];
|
|
||||||
};
|
|
||||||
|
|
||||||
struct UnmappedEntry unmappedKeys[] =
|
|
||||||
{
|
|
||||||
{NSDeleteFunctionKey, 0x33, {0x232B,'\0','\0','\0'}},
|
|
||||||
{NSF17FunctionKey, 0x40, {'F','1','7','\0'}},
|
|
||||||
{NSClearDisplayFunctionKey, 0x47, {0x2327,'\0','\0','\0'}},
|
|
||||||
{NSF18FunctionKey, 0x4F, {'F','1','8','\0'}},
|
|
||||||
{NSF19FunctionKey, 0x50, {'F','1','9','\0'}},
|
|
||||||
{NSF5FunctionKey, 0x60, {'F','5','\0','\0'}},
|
|
||||||
{NSF6FunctionKey, 0x61, {'F','6','\0','\0'}},
|
|
||||||
{NSF7FunctionKey, 0x62, {'F','7','\0','\0'}},
|
|
||||||
{NSF3FunctionKey, 0x63, {'F','3','\0','\0'}},
|
|
||||||
{NSF8FunctionKey, 0x64, {'F','8','\0','\0'}},
|
|
||||||
{NSF9FunctionKey, 0x65, {'F','9','\0','\0'}},
|
|
||||||
{NSF11FunctionKey, 0x67, {'F','1','1','\0'}},
|
|
||||||
{NSF14FunctionKey, 0x68, {'F','1','4','\0'}},
|
|
||||||
{NSF13FunctionKey, 0x69, {'F','1','3','\0'}},
|
|
||||||
{NSF16FunctionKey, 0x6A, {'F','1','6','\0'}},
|
|
||||||
{NSF10FunctionKey, 0x6D, {'F','1','0','\0'}},
|
|
||||||
{NSF12FunctionKey, 0x6F, {'F','1','2','\0'}},
|
|
||||||
{NSF15FunctionKey, 0x71, {'F','1','5','\0'}},
|
|
||||||
{NSHomeFunctionKey, 0x73, {0x21F1,'\0','\0','\0'}},
|
|
||||||
{NSPageUpFunctionKey, 0x74, {0x21DE,'\0','\0','\0'}},
|
|
||||||
{NSDeleteCharFunctionKey, 0x75, {0x2326,'\0','\0','\0'}},
|
|
||||||
{NSF4FunctionKey, 0x76, {'F','4','\0','\0'}},
|
|
||||||
{NSEndFunctionKey, 0x77, {0x21F2,'\0','\0','\0'}},
|
|
||||||
{NSF2FunctionKey, 0x78, {'F','2','\0','\0'}},
|
|
||||||
{NSPageDownFunctionKey, 0x79, {0x21DF,'\0','\0','\0'}},
|
|
||||||
{NSF1FunctionKey, 0x7A, {'F','1','\0','\0'}},
|
|
||||||
{NSLeftArrowFunctionKey, 0x7B, {0x2190,'\0','\0','\0'}},
|
|
||||||
{NSRightArrowFunctionKey, 0x7C, {0x2192,'\0','\0','\0'}},
|
|
||||||
{NSDownArrowFunctionKey, 0x7D, {0x2193,'\0','\0','\0'}},
|
|
||||||
{NSUpArrowFunctionKey, 0x7E, {0x2191,'\0','\0','\0'}}
|
|
||||||
// {NSF20FunctionKey, 0xXXXX},
|
|
||||||
// {NSF21FunctionKey, 0xXXXX},
|
|
||||||
// {NSF22FunctionKey, 0xXXXX},
|
|
||||||
// {NSF23FunctionKey, 0xXXXX},
|
|
||||||
// {NSF24FunctionKey, 0xXXXX},
|
|
||||||
// {NSF25FunctionKey, 0xXXXX},
|
|
||||||
// {NSF26FunctionKey, 0xXXXX},
|
|
||||||
// {NSF27FunctionKey, 0xXXXX},
|
|
||||||
// {NSF28FunctionKey, 0xXXXX},
|
|
||||||
// {NSF29FunctionKey, 0xXXXX},
|
|
||||||
// {NSF30FunctionKey, 0xXXXX},
|
|
||||||
// {NSF31FunctionKey, 0xXXXX},
|
|
||||||
// {NSF32FunctionKey, 0xXXXX},
|
|
||||||
// {NSF33FunctionKey, 0xXXXX},
|
|
||||||
// {NSF34FunctionKey, 0xXXXX},
|
|
||||||
// {NSF35FunctionKey, 0xXXXX},
|
|
||||||
// {NSInsertFunctionKey, 0xXXXX},
|
|
||||||
// {NSBeginFunctionKey, 0xXXXX},
|
|
||||||
// {NSPrintScreenFunctionKey, 0xXXXX},
|
|
||||||
// {NSScrollLockFunctionKey, 0xXXXX},
|
|
||||||
// {NSPauseFunctionKey, 0xXXXX},
|
|
||||||
// {NSSysReqFunctionKey, 0xXXXX},
|
|
||||||
// {NSBreakFunctionKey, 0xXXXX},
|
|
||||||
// {NSResetFunctionKey, 0xXXXX},
|
|
||||||
// {NSStopFunctionKey, 0xXXXX},
|
|
||||||
// {NSMenuFunctionKey, 0xXXXX},
|
|
||||||
// {NSUserFunctionKey, 0xXXXX},
|
|
||||||
// {NSSystemFunctionKey, 0xXXXX},
|
|
||||||
// {NSPrintFunctionKey, 0xXXXX},
|
|
||||||
// {NSClearLineFunctionKey, 0xXXXX},
|
|
||||||
// {NSInsertLineFunctionKey, 0xXXXX},
|
|
||||||
// {NSDeleteLineFunctionKey, 0xXXXX},
|
|
||||||
// {NSInsertCharFunctionKey, 0xXXXX},
|
|
||||||
// {NSPrevFunctionKey, 0xXXXX},
|
|
||||||
// {NSNextFunctionKey, 0xXXXX},
|
|
||||||
// {NSSelectFunctionKey, 0xXXXX},
|
|
||||||
// {NSExecuteFunctionKey, 0xXXXX},
|
|
||||||
// {NSUndoFunctionKey, 0xXXXX},
|
|
||||||
// {NSRedoFunctionKey, 0xXXXX},
|
|
||||||
// {NSFindFunctionKey, 0xXXXX},
|
|
||||||
// {NSHelpFunctionKey, 0xXXXX},
|
|
||||||
// {NSModeSwitchFunctionKey, 0xXXXX}
|
|
||||||
};
|
|
||||||
|
|
||||||
@interface NDKeyboardLayout ()
|
|
||||||
|
|
||||||
@property(readonly,nonatomic) const UCKeyboardLayout * keyboardLayoutPtr;
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
static int _reverseMappingEntryCmpFunc( const void * a, const void * b )
|
|
||||||
{
|
|
||||||
struct ReverseMappingEntry * theA = (struct ReverseMappingEntry*)a,
|
|
||||||
* theB = (struct ReverseMappingEntry*)b;
|
|
||||||
return theA->character != theB->character ? theA->character - theB->character : theA->keypad - theB->keypad;
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct ReverseMappingEntry * _searchreverseMapping( struct ReverseMappingEntry * aMapping, NSUInteger aLength, struct ReverseMappingEntry * aSearchValue )
|
|
||||||
{
|
|
||||||
NSInteger low = 0,
|
|
||||||
high = aLength - 1,
|
|
||||||
mid,
|
|
||||||
result;
|
|
||||||
|
|
||||||
while( low <= high )
|
|
||||||
{
|
|
||||||
mid = (low + high)>>1;
|
|
||||||
result = _reverseMappingEntryCmpFunc( &aMapping[mid], aSearchValue );
|
|
||||||
if( result > 0 )
|
|
||||||
high = mid - 1;
|
|
||||||
else if( result < 0 )
|
|
||||||
low = mid + 1;
|
|
||||||
else
|
|
||||||
return &aMapping[mid];
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct UnmappedEntry * _unmappedEntryForKeyCode( UInt16 aKeyCode )
|
|
||||||
{
|
|
||||||
NSInteger low = 0,
|
|
||||||
high = sizeof(unmappedKeys)/sizeof(*unmappedKeys) - 1,
|
|
||||||
mid,
|
|
||||||
result;
|
|
||||||
|
|
||||||
while( low <= high )
|
|
||||||
{
|
|
||||||
mid = (low + high)>>1;
|
|
||||||
result = unmappedKeys[mid].keyCode - aKeyCode;
|
|
||||||
if( result > 0 )
|
|
||||||
high = mid - 1;
|
|
||||||
else if( result < 0 )
|
|
||||||
low = mid + 1;
|
|
||||||
else
|
|
||||||
return &unmappedKeys[mid];
|
|
||||||
}
|
|
||||||
return '\0';
|
|
||||||
}
|
|
||||||
|
|
||||||
static const size_t kBufferSize = 4;
|
|
||||||
static NSUInteger _characterForModifierFlags( unichar aBuff[kBufferSize], UInt32 aModifierFlags )
|
|
||||||
{
|
|
||||||
NSUInteger thePos = 0;
|
|
||||||
memset( aBuff, 0, kBufferSize );
|
|
||||||
if(aModifierFlags & NSEventModifierFlagControl)
|
|
||||||
aBuff[thePos++] = kControlUnicode;
|
|
||||||
|
|
||||||
if(aModifierFlags & NSEventModifierFlagOption)
|
|
||||||
aBuff[thePos++] = kOptionUnicode;
|
|
||||||
|
|
||||||
if(aModifierFlags & NSEventModifierFlagShift)
|
|
||||||
aBuff[thePos++] = kShiftUnicode;
|
|
||||||
|
|
||||||
if(aModifierFlags & NSEventModifierFlagCommand)
|
|
||||||
aBuff[thePos++] = kCommandUnicode;
|
|
||||||
return thePos;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* NDCocoaModifierFlagsForCarbonModifierFlags()
|
|
||||||
*/
|
|
||||||
NSUInteger NDCocoaModifierFlagsForCarbonModifierFlags( NSUInteger aModifierFlags )
|
|
||||||
{
|
|
||||||
NSUInteger theCocoaModifierFlags = 0;
|
|
||||||
|
|
||||||
if(aModifierFlags & shiftKey)
|
|
||||||
theCocoaModifierFlags |= NSEventModifierFlagShift;
|
|
||||||
|
|
||||||
if(aModifierFlags & controlKey)
|
|
||||||
theCocoaModifierFlags |= NSEventModifierFlagControl;
|
|
||||||
|
|
||||||
if(aModifierFlags & optionKey)
|
|
||||||
theCocoaModifierFlags |= NSEventModifierFlagOption;
|
|
||||||
|
|
||||||
if(aModifierFlags & cmdKey)
|
|
||||||
theCocoaModifierFlags |= NSEventModifierFlagCommand;
|
|
||||||
|
|
||||||
return theCocoaModifierFlags;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* NDCarbonModifierFlagsForCocoaModifierFlags()
|
|
||||||
*/
|
|
||||||
NSUInteger NDCarbonModifierFlagsForCocoaModifierFlags( NSUInteger aModifierFlags )
|
|
||||||
{
|
|
||||||
NSUInteger theCarbonModifierFlags = 0;
|
|
||||||
|
|
||||||
if(aModifierFlags & NSShiftKeyMask)
|
|
||||||
theCarbonModifierFlags |= shiftKey;
|
|
||||||
|
|
||||||
if(aModifierFlags & NSControlKeyMask)
|
|
||||||
theCarbonModifierFlags |= controlKey;
|
|
||||||
|
|
||||||
if(aModifierFlags & NSAlternateKeyMask)
|
|
||||||
theCarbonModifierFlags |= optionKey;
|
|
||||||
|
|
||||||
if(aModifierFlags & NSCommandKeyMask)
|
|
||||||
theCarbonModifierFlags |= cmdKey;
|
|
||||||
|
|
||||||
return theCarbonModifierFlags;
|
|
||||||
}
|
|
||||||
|
|
||||||
@implementation NDKeyboardLayout
|
|
||||||
|
|
||||||
#pragma mark Utility Methods
|
|
||||||
|
|
||||||
- (void)generateMappings
|
|
||||||
{
|
|
||||||
mappings = (struct ReverseMappingEntry*)calloc( 128 + sizeof(unmappedKeys)/sizeof(*unmappedKeys), sizeof(struct ReverseMappingEntry) );
|
|
||||||
|
|
||||||
numberOfMappings = 0;
|
|
||||||
|
|
||||||
for( NSUInteger i = 0; i < 128; i++ )
|
|
||||||
{
|
|
||||||
UInt32 theDeadKeyState = 0;
|
|
||||||
UniCharCount theLength = 0;
|
|
||||||
|
|
||||||
if( UCKeyTranslate( self.keyboardLayoutPtr,
|
|
||||||
i,
|
|
||||||
kUCKeyActionDisplay,
|
|
||||||
0,
|
|
||||||
LMGetKbdType(),
|
|
||||||
kUCKeyTranslateNoDeadKeysBit,
|
|
||||||
&theDeadKeyState,
|
|
||||||
1,
|
|
||||||
&theLength,
|
|
||||||
&mappings[numberOfMappings].character ) == noErr && theLength > 0 && isprint(mappings[numberOfMappings].character) )
|
|
||||||
{
|
|
||||||
mappings[numberOfMappings].keyCode = i;
|
|
||||||
numberOfMappings++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* add unmapped keys */
|
|
||||||
for( NSUInteger i = 0; i < sizeof(unmappedKeys)/sizeof(*unmappedKeys); i++ )
|
|
||||||
{
|
|
||||||
mappings[numberOfMappings].character = unmappedKeys[i].character;
|
|
||||||
mappings[numberOfMappings].keyCode = unmappedKeys[i].keyCode;
|
|
||||||
numberOfMappings++;
|
|
||||||
}
|
|
||||||
|
|
||||||
mappings = (struct ReverseMappingEntry*)realloc( (void*)mappings, numberOfMappings*sizeof(struct ReverseMappingEntry) );
|
|
||||||
|
|
||||||
// sort so we can perform binary searches
|
|
||||||
qsort( (void *)mappings, numberOfMappings, sizeof(struct ReverseMappingEntry), _reverseMappingEntryCmpFunc );
|
|
||||||
|
|
||||||
/* find keypad keys and set the keypad flag */
|
|
||||||
for( NSUInteger i = 1; i < numberOfMappings; i++ )
|
|
||||||
{
|
|
||||||
NSParameterAssert( mappings[i-1].keyCode != mappings[i].keyCode );
|
|
||||||
if( mappings[i-1].character == mappings[i].character ) // assume large keycode is a keypad
|
|
||||||
{
|
|
||||||
if( mappings[i-1].keyCode > mappings[i].keyCode ) // make the keypad entry is second
|
|
||||||
{
|
|
||||||
UInt16 theTemp = mappings[i-1].keyCode;
|
|
||||||
mappings[i-1].keyCode = mappings[i].keyCode;
|
|
||||||
mappings[i].keyCode = theTemp;
|
|
||||||
}
|
|
||||||
mappings[i].keypad = YES;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef DEBUGGING_CODE
|
|
||||||
for( NSUInteger i = 1; i < numberOfMappings; i++ )
|
|
||||||
{
|
|
||||||
fprintf( stderr, "%d -> %c[%d]%s\n",
|
|
||||||
mappings[i].keyCode,
|
|
||||||
(char)mappings[i].character,
|
|
||||||
mappings[i].character,
|
|
||||||
mappings[i].keypad ? " keypad" : ""
|
|
||||||
);
|
|
||||||
NSAssert3( mappings[i-1].character <= mappings[i].character, @"[%d] %d <= %d", i, mappings[i-1].character, mappings[i].character );
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma mark Constructor Methods
|
|
||||||
|
|
||||||
static volatile NDKeyboardLayout * kCurrentKeyboardLayout = nil;
|
|
||||||
|
|
||||||
static void NDKeyboardLayoutNotificationCallback( CFNotificationCenterRef aCenter, void * self, CFStringRef aName, const void * anObj, CFDictionaryRef aUserInfo )
|
|
||||||
{
|
|
||||||
NSDictionary * theUserInfo = [NSDictionary dictionaryWithObject:kCurrentKeyboardLayout forKey:NDKeyboardLayoutPreviousKeyboardLayoutUserInfoKey];
|
|
||||||
@synchronized(self) { kCurrentKeyboardLayout = nil; }
|
|
||||||
[[NSNotificationCenter defaultCenter] postNotificationName:NDKeyboardLayoutSelectedKeyboardInputSourceChangedNotification object:(__bridge id _Nullable)(self) userInfo:theUserInfo];
|
|
||||||
}
|
|
||||||
|
|
||||||
+ (void)initialize
|
|
||||||
{
|
|
||||||
CFNotificationCenterAddObserver( CFNotificationCenterGetLocalCenter(),
|
|
||||||
(const void *)self,
|
|
||||||
NDKeyboardLayoutNotificationCallback,
|
|
||||||
kTISNotifySelectedKeyboardInputSourceChanged,
|
|
||||||
NULL,
|
|
||||||
CFNotificationSuspensionBehaviorDeliverImmediately
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
+ (id)keyboardLayout
|
|
||||||
{
|
|
||||||
if( kCurrentKeyboardLayout == nil )
|
|
||||||
{
|
|
||||||
@synchronized(self)
|
|
||||||
{ /*
|
|
||||||
Try different method until we succeed.
|
|
||||||
*/
|
|
||||||
TISInputSourceRef (*theInputSourceFunctions[])() = {
|
|
||||||
TISCopyInputMethodKeyboardLayoutOverride,
|
|
||||||
TISCopyCurrentKeyboardLayoutInputSource,
|
|
||||||
TISCopyCurrentASCIICapableKeyboardLayoutInputSource
|
|
||||||
};
|
|
||||||
|
|
||||||
for( NSUInteger i = 0; i < sizeof(theInputSourceFunctions)/sizeof(*theInputSourceFunctions) && kCurrentKeyboardLayout == nil; i++ )
|
|
||||||
{
|
|
||||||
TISInputSourceRef theInputSource = theInputSourceFunctions[i]();
|
|
||||||
if( theInputSource != NULL )
|
|
||||||
{
|
|
||||||
kCurrentKeyboardLayout = [[self alloc] initWithInputSource:theInputSource];
|
|
||||||
CFRelease(theInputSource);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return kCurrentKeyboardLayout;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (id)init
|
|
||||||
{
|
|
||||||
return [NDKeyboardLayout keyboardLayout];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (id)initWithLanguage:(NSString *)aLangauge { return [self initWithInputSource:TISCopyInputSourceForLanguage((__bridge CFStringRef)aLangauge)]; }
|
|
||||||
|
|
||||||
- (id)initWithInputSource:(TISInputSourceRef)aSource
|
|
||||||
{
|
|
||||||
if( (self = [super init]) != nil )
|
|
||||||
{
|
|
||||||
if( aSource != NULL && (keyboardLayoutData = (CFDataRef)TISGetInputSourceProperty(aSource, kTISPropertyUnicodeKeyLayoutData)) != nil )
|
|
||||||
{
|
|
||||||
CFRetain( keyboardLayoutData );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
self = nil;
|
|
||||||
}
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)dealloc
|
|
||||||
{
|
|
||||||
if( mappings != NULL )
|
|
||||||
free( (void*)mappings );
|
|
||||||
if( keyboardLayoutData != NULL )
|
|
||||||
CFRelease( keyboardLayoutData );
|
|
||||||
}
|
|
||||||
|
|
||||||
- (NSString*)stringForCharacter:(unichar)aCharacter modifierFlags:(UInt32)aModifierFlags
|
|
||||||
{
|
|
||||||
return [self stringForKeyCode:[self keyCodeForCharacter:aCharacter numericPad:(aModifierFlags&NSNumericPadKeyMask) != 0] modifierFlags:aModifierFlags];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (NSString*)stringForKeyCode:(UInt16)aKeyCode modifierFlags:(UInt32)aModifierFlags
|
|
||||||
{
|
|
||||||
NSString * theResult = nil;
|
|
||||||
struct UnmappedEntry * theEntry = _unmappedEntryForKeyCode( aKeyCode ); // is it one of the unmapped values
|
|
||||||
|
|
||||||
if( theEntry != NULL )
|
|
||||||
{
|
|
||||||
unichar theCharacter[sizeof(theEntry->description)/sizeof(*theEntry->description)+4+1];
|
|
||||||
memset( theCharacter, 0, sizeof(theCharacter) );
|
|
||||||
NSUInteger thePos = _characterForModifierFlags(theCharacter,aModifierFlags);
|
|
||||||
memcpy( theCharacter+thePos, theEntry->description, sizeof(theEntry->description) );
|
|
||||||
theResult = [NSString stringWithCharacters:theCharacter length:sizeof(theEntry->description)/sizeof(*theEntry->description)+thePos];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
UInt32 theDeadKeyState = 0;
|
|
||||||
UniCharCount theLength = 0;
|
|
||||||
UniChar theCharacter[260];
|
|
||||||
|
|
||||||
NSUInteger thePos = _characterForModifierFlags(theCharacter,aModifierFlags);
|
|
||||||
|
|
||||||
if( UCKeyTranslate( self.keyboardLayoutPtr, aKeyCode,
|
|
||||||
kUCKeyActionDisplay,
|
|
||||||
(UInt32)NDCarbonModifierFlagsForCocoaModifierFlags(aModifierFlags),
|
|
||||||
LMGetKbdType(),
|
|
||||||
kUCKeyTranslateNoDeadKeysBit,
|
|
||||||
&theDeadKeyState,
|
|
||||||
sizeof(theCharacter)/sizeof(*theCharacter)-thePos,
|
|
||||||
&theLength,
|
|
||||||
theCharacter+thePos ) == noErr )
|
|
||||||
{
|
|
||||||
|
|
||||||
theResult = [[NSString stringWithCharacters:theCharacter length:theLength+thePos] uppercaseString];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return theResult;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (unichar)characterForKeyCode:(UInt16)aKeyCode
|
|
||||||
{
|
|
||||||
unichar theChar = 0;
|
|
||||||
struct UnmappedEntry * theEntry = _unmappedEntryForKeyCode( aKeyCode );
|
|
||||||
|
|
||||||
if( theEntry == NULL ) // is it one of the unmapped values
|
|
||||||
{
|
|
||||||
UInt32 theDeadKeyState = 0;
|
|
||||||
UniCharCount theLength = 0;
|
|
||||||
UniChar theCharacter[256];
|
|
||||||
|
|
||||||
if( UCKeyTranslate( self.keyboardLayoutPtr, aKeyCode,
|
|
||||||
kUCKeyActionDisplay,
|
|
||||||
0,
|
|
||||||
LMGetKbdType(),
|
|
||||||
kUCKeyTranslateNoDeadKeysBit,
|
|
||||||
&theDeadKeyState,
|
|
||||||
sizeof(theCharacter)/sizeof(*theCharacter),
|
|
||||||
&theLength,
|
|
||||||
theCharacter ) == noErr )
|
|
||||||
{
|
|
||||||
theChar = theCharacter[0];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
theChar = theEntry->character;
|
|
||||||
return toupper(theChar);
|
|
||||||
}
|
|
||||||
|
|
||||||
- (UInt16)keyCodeForCharacter:(unichar)aCharacter { return [self keyCodeForCharacter:aCharacter numericPad:NO]; }
|
|
||||||
|
|
||||||
- (UInt16)keyCodeForCharacter:(unichar)aCharacter numericPad:(BOOL)aNumericPad
|
|
||||||
{
|
|
||||||
struct ReverseMappingEntry theSearchValue = { tolower(aCharacter), aNumericPad, 0 };
|
|
||||||
struct ReverseMappingEntry * theEntry = NULL;
|
|
||||||
if( mappings == NULL )
|
|
||||||
[self generateMappings];
|
|
||||||
theEntry = _searchreverseMapping( mappings, numberOfMappings, &theSearchValue );
|
|
||||||
return theEntry ? theEntry->keyCode : '\0';
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma mark - private
|
|
||||||
|
|
||||||
- (const UCKeyboardLayout *)keyboardLayoutPtr { return (const UCKeyboardLayout *)CFDataGetBytePtr(keyboardLayoutData); }
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
/* Localized versions of Info.plist keys */
|
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
/* Localized versions of Info.plist keys */
|
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 1d8629c8d8e64462a88dac5c0a050c380c93a311
|
|
@ -111,10 +111,10 @@
|
||||||
</customView>
|
</customView>
|
||||||
<customObject id="6" userLabel="HotKeyPane" customClass="HotKeyPane">
|
<customObject id="6" userLabel="HotKeyPane" customClass="HotKeyPane">
|
||||||
<connections>
|
<connections>
|
||||||
<outlet property="nextHotKeyControl" destination="28" id="36"/>
|
<outlet property="nextShortcutView" destination="Dse-4d-oBd" id="mYF-gy-OEU"/>
|
||||||
<outlet property="playHotKeyControl" destination="16" id="34"/>
|
<outlet property="playShortcutView" destination="OBW-Zy-nz0" id="OkD-1k-vay"/>
|
||||||
<outlet property="prevHotKeyControl" destination="27" id="35"/>
|
<outlet property="prevShortcutView" destination="Ujw-ux-fCg" id="oOW-gF-QBo"/>
|
||||||
<outlet property="spamHotKeyControl" destination="2Eh-AY-mzV" id="B2t-Ar-T97"/>
|
<outlet property="spamShortcutView" destination="80X-iX-vxp" id="3P3-KR-8Ih"/>
|
||||||
<outlet property="view" destination="11" id="12"/>
|
<outlet property="view" destination="11" id="12"/>
|
||||||
</connections>
|
</connections>
|
||||||
</customObject>
|
</customObject>
|
||||||
|
@ -122,46 +122,10 @@
|
||||||
<rect key="frame" x="0.0" y="0.0" width="530" height="131"/>
|
<rect key="frame" x="0.0" y="0.0" width="530" height="131"/>
|
||||||
<autoresizingMask key="autoresizingMask"/>
|
<autoresizingMask key="autoresizingMask"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<textField verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="28" customClass="HotKeyControl">
|
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="24">
|
||||||
<rect key="frame" x="91" y="42" width="82" height="19"/>
|
<rect key="frame" x="47" y="94" width="39" height="17"/>
|
||||||
<autoresizingMask key="autoresizingMask"/>
|
<autoresizingMask key="autoresizingMask"/>
|
||||||
<textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" alignment="left" drawsBackground="YES" id="202">
|
<textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="right" title="Play:" id="198">
|
||||||
<font key="font" metaFont="label" size="11"/>
|
|
||||||
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
|
|
||||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
|
||||||
</textFieldCell>
|
|
||||||
<connections>
|
|
||||||
<action selector="hotKeyChanged:" target="6" id="38"/>
|
|
||||||
</connections>
|
|
||||||
</textField>
|
|
||||||
<textField verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="2Eh-AY-mzV" customClass="HotKeyControl">
|
|
||||||
<rect key="frame" x="91" y="17" width="82" height="19"/>
|
|
||||||
<autoresizingMask key="autoresizingMask"/>
|
|
||||||
<textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" alignment="left" drawsBackground="YES" id="A8w-Tx-TAd">
|
|
||||||
<font key="font" metaFont="label" size="11"/>
|
|
||||||
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
|
|
||||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
|
||||||
</textFieldCell>
|
|
||||||
<connections>
|
|
||||||
<action selector="hotKeyChanged:" target="6" id="WrA-Jp-1SV"/>
|
|
||||||
</connections>
|
|
||||||
</textField>
|
|
||||||
<textField verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="27" customClass="HotKeyControl">
|
|
||||||
<rect key="frame" x="91" y="67" width="82" height="19"/>
|
|
||||||
<autoresizingMask key="autoresizingMask"/>
|
|
||||||
<textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" alignment="left" drawsBackground="YES" id="201">
|
|
||||||
<font key="font" metaFont="label" size="11"/>
|
|
||||||
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
|
|
||||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
|
||||||
</textFieldCell>
|
|
||||||
<connections>
|
|
||||||
<action selector="hotKeyChanged:" target="6" id="37"/>
|
|
||||||
</connections>
|
|
||||||
</textField>
|
|
||||||
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="26">
|
|
||||||
<rect key="frame" x="42" y="44" width="44" height="17"/>
|
|
||||||
<autoresizingMask key="autoresizingMask"/>
|
|
||||||
<textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="right" title="Next:" id="200">
|
|
||||||
<font key="font" metaFont="system"/>
|
<font key="font" metaFont="system"/>
|
||||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||||
|
@ -176,27 +140,15 @@
|
||||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||||
</textFieldCell>
|
</textFieldCell>
|
||||||
</textField>
|
</textField>
|
||||||
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="24">
|
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="26">
|
||||||
<rect key="frame" x="47" y="94" width="39" height="17"/>
|
<rect key="frame" x="42" y="44" width="44" height="17"/>
|
||||||
<autoresizingMask key="autoresizingMask"/>
|
<autoresizingMask key="autoresizingMask"/>
|
||||||
<textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="right" title="Play:" id="198">
|
<textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="right" title="Next:" id="200">
|
||||||
<font key="font" metaFont="system"/>
|
<font key="font" metaFont="system"/>
|
||||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||||
</textFieldCell>
|
</textFieldCell>
|
||||||
</textField>
|
</textField>
|
||||||
<textField verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="16" customClass="HotKeyControl">
|
|
||||||
<rect key="frame" x="91" y="92" width="82" height="19"/>
|
|
||||||
<autoresizingMask key="autoresizingMask"/>
|
|
||||||
<textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" alignment="left" drawsBackground="YES" id="196">
|
|
||||||
<font key="font" metaFont="label" size="11"/>
|
|
||||||
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
|
|
||||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
|
||||||
</textFieldCell>
|
|
||||||
<connections>
|
|
||||||
<action selector="hotKeyChanged:" target="6" id="20"/>
|
|
||||||
</connections>
|
|
||||||
</textField>
|
|
||||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="eid-M4-6Cs">
|
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="eid-M4-6Cs">
|
||||||
<rect key="frame" x="24" y="19" width="62" height="17"/>
|
<rect key="frame" x="24" y="19" width="62" height="17"/>
|
||||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||||
|
@ -206,6 +158,33 @@
|
||||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||||
</textFieldCell>
|
</textFieldCell>
|
||||||
</textField>
|
</textField>
|
||||||
|
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="OBW-Zy-nz0" userLabel="Play Shortcut" customClass="MASShortcutView">
|
||||||
|
<rect key="frame" x="92" y="93" width="163" height="19"/>
|
||||||
|
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||||
|
</customView>
|
||||||
|
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Ujw-ux-fCg" userLabel="Previous Shortcut" customClass="MASShortcutView">
|
||||||
|
<rect key="frame" x="92" y="68" width="163" height="19"/>
|
||||||
|
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||||
|
</customView>
|
||||||
|
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Dse-4d-oBd" userLabel="Next Shortcut" customClass="MASShortcutView">
|
||||||
|
<rect key="frame" x="92" y="43" width="163" height="19"/>
|
||||||
|
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||||
|
</customView>
|
||||||
|
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="80X-iX-vxp" userLabel="Spam Shortcut" customClass="MASShortcutView">
|
||||||
|
<rect key="frame" x="92" y="18" width="163" height="19"/>
|
||||||
|
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||||
|
</customView>
|
||||||
|
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="YtT-gE-hX3">
|
||||||
|
<rect key="frame" x="380" y="10" width="137" height="32"/>
|
||||||
|
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxY="YES"/>
|
||||||
|
<buttonCell key="cell" type="push" title="Reset to defaults" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="1y7-iZ-BhE">
|
||||||
|
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||||
|
<font key="font" metaFont="system"/>
|
||||||
|
</buttonCell>
|
||||||
|
<connections>
|
||||||
|
<action selector="resetToDefaultShortcuts:" target="6" id="SSH-OG-OHD"/>
|
||||||
|
</connections>
|
||||||
|
</button>
|
||||||
</subviews>
|
</subviews>
|
||||||
<point key="canvasLocation" x="-151" y="-33"/>
|
<point key="canvasLocation" x="-151" y="-33"/>
|
||||||
</customView>
|
</customView>
|
||||||
|
|
|
@ -1,15 +0,0 @@
|
||||||
//
|
|
||||||
// HotKeyControl.h
|
|
||||||
// General
|
|
||||||
//
|
|
||||||
// Created by Zaphod Beeblebrox on 9/4/06.
|
|
||||||
// Copyright 2006 __MyCompanyName__. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
#import <Cocoa/Cocoa.h>
|
|
||||||
#import <NDHotKey/NDHotKeyControl.h>
|
|
||||||
|
|
||||||
@interface HotKeyControl : NDHotKeyControl {
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
|
@ -1,21 +0,0 @@
|
||||||
//
|
|
||||||
// HotKeyControl.m
|
|
||||||
// General
|
|
||||||
//
|
|
||||||
// Created by Zaphod Beeblebrox on 9/4/06.
|
|
||||||
// Copyright 2006 __MyCompanyName__. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
#import "HotKeyControl.h"
|
|
||||||
#import <NDHotKey/NDHotKeyEvent.h>
|
|
||||||
|
|
||||||
@implementation HotKeyControl
|
|
||||||
|
|
||||||
- (void)mouseDown:(NSEvent *)theEvent
|
|
||||||
{
|
|
||||||
[self setStringValue:NSLocalizedStringFromTableInBundle(@"Press Key...", nil, [NSBundle bundleForClass:[self class]], @"")];
|
|
||||||
[self setRequiresModifierKeys:YES];
|
|
||||||
[self setReadyForHotKeyEvent:YES];
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
|
@ -8,15 +8,15 @@
|
||||||
|
|
||||||
#import <Cocoa/Cocoa.h>
|
#import <Cocoa/Cocoa.h>
|
||||||
#import "GeneralPreferencePane.h"
|
#import "GeneralPreferencePane.h"
|
||||||
#import "HotKeyControl.h"
|
#import <MASShortcut/Shortcut.h>
|
||||||
|
|
||||||
@interface HotKeyPane : GeneralPreferencePane {
|
@interface HotKeyPane : GeneralPreferencePane
|
||||||
IBOutlet HotKeyControl *playHotKeyControl;
|
|
||||||
IBOutlet HotKeyControl *prevHotKeyControl;
|
|
||||||
IBOutlet HotKeyControl *nextHotKeyControl;
|
|
||||||
IBOutlet HotKeyControl *spamHotKeyControl;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (IBAction) hotKeyChanged:(id)sender;
|
@property(strong) IBOutlet MASShortcutView *playShortcutView;
|
||||||
|
@property(strong) IBOutlet MASShortcutView *nextShortcutView;
|
||||||
|
@property(strong) IBOutlet MASShortcutView *prevShortcutView;
|
||||||
|
@property(strong) IBOutlet MASShortcutView *spamShortcutView;
|
||||||
|
|
||||||
|
- (IBAction)resetToDefaultShortcuts:(id)sender;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -7,26 +7,70 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
#import "HotKeyPane.h"
|
#import "HotKeyPane.h"
|
||||||
#import "NDHotKey/NDHotKeyEvent.h"
|
#import "Shortcuts.h"
|
||||||
#import "NDHotKey/NDKeyboardLayout.h"
|
|
||||||
#import "HotKeyControl.h"
|
|
||||||
|
|
||||||
@implementation HotKeyPane
|
MASShortcut * shortcutWithMigration(NSString *oldKeyCodePrefName,
|
||||||
|
NSString *oldKeyModifierPrefName,
|
||||||
|
NSString *newShortcutPrefName,
|
||||||
|
NSInteger newDefaultKeyCode) {
|
||||||
|
NSEventModifierFlags defaultModifiers = NSEventModifierFlagControl | NSEventModifierFlagCommand;
|
||||||
|
NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
|
||||||
|
if ([defaults objectForKey:oldKeyCodePrefName]) {
|
||||||
|
NSInteger oldKeyCode = [defaults integerForKey:oldKeyCodePrefName];
|
||||||
|
NSEventModifierFlags oldKeyModifiers = [defaults integerForKey:oldKeyModifierPrefName];
|
||||||
|
// Should we consider temporarily save these values for further migration?
|
||||||
|
[defaults removeObjectForKey:oldKeyCodePrefName];
|
||||||
|
[defaults removeObjectForKey:oldKeyModifierPrefName];
|
||||||
|
return [MASShortcut shortcutWithKeyCode:oldKeyCode modifierFlags:oldKeyModifiers];
|
||||||
|
} else {
|
||||||
|
return [MASShortcut shortcutWithKeyCode:newDefaultKeyCode modifierFlags:defaultModifiers];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void setControlText(HotKeyControl* control, NSString* kcprop, NSString* mprop)
|
@implementation HotKeyPane {
|
||||||
{
|
NSUserDefaultsController *defaultsController;
|
||||||
UInt16 keyCode = [[NSUserDefaults standardUserDefaults] integerForKey:kcprop];
|
|
||||||
NSUInteger modifiers = [[NSUserDefaults standardUserDefaults] integerForKey:mprop];
|
|
||||||
NSString *str = [[NDKeyboardLayout keyboardLayout] stringForKeyCode:keyCode modifierFlags:(UInt32)modifiers];
|
|
||||||
[control setStringValue:str];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)awakeFromNib
|
- (void)awakeFromNib
|
||||||
{
|
{
|
||||||
setControlText(prevHotKeyControl, @"hotKeyPreviousKeyCode", @"hotKeyPreviousModifiers");
|
MASShortcut *playShortcut = shortcutWithMigration(@"hotKeyPlayKeyCode",
|
||||||
setControlText(nextHotKeyControl, @"hotKeyNextKeyCode", @"hotKeyNextModifiers");
|
@"hotKeyPlayModifiers",
|
||||||
setControlText(playHotKeyControl, @"hotKeyPlayKeyCode", @"hotKeyPlayModifiers");
|
CogPlayShortcutKey,
|
||||||
setControlText(spamHotKeyControl, @"hotKeySpamKeyCode", @"hotKeySpamModifiers");
|
kVK_ANSI_P);
|
||||||
|
MASShortcut *nextShortcut = shortcutWithMigration(@"hotKeyNextKeyCode",
|
||||||
|
@"hotKeyNextModifiers",
|
||||||
|
CogNextShortcutKey,
|
||||||
|
kVK_ANSI_N);
|
||||||
|
MASShortcut *prevShortcut = shortcutWithMigration(@"hotKeyPreviousKeyCode",
|
||||||
|
@"hotKeyPreviousModifiers",
|
||||||
|
CogPrevShortcutKey,
|
||||||
|
kVK_ANSI_R);
|
||||||
|
MASShortcut *spamShortcut = shortcutWithMigration(@"hotKeySpamKeyCode",
|
||||||
|
@"hotKeySpamModifiers",
|
||||||
|
CogSpamShortcutKey,
|
||||||
|
kVK_ANSI_C);
|
||||||
|
|
||||||
|
NSData *playShortcutData = [NSKeyedArchiver archivedDataWithRootObject:playShortcut];
|
||||||
|
NSData *nextShortcutData = [NSKeyedArchiver archivedDataWithRootObject:nextShortcut];
|
||||||
|
NSData *prevShortcutData = [NSKeyedArchiver archivedDataWithRootObject:prevShortcut];
|
||||||
|
NSData *spamShortcutData = [NSKeyedArchiver archivedDataWithRootObject:spamShortcut];
|
||||||
|
|
||||||
|
// Register default values to be used for the first app start
|
||||||
|
NSDictionary<NSString *, NSData *> *defaultShortcuts = @{
|
||||||
|
CogPlayShortcutKey : playShortcutData,
|
||||||
|
CogNextShortcutKey : nextShortcutData,
|
||||||
|
CogPrevShortcutKey : prevShortcutData,
|
||||||
|
CogSpamShortcutKey : spamShortcutData
|
||||||
|
};
|
||||||
|
|
||||||
|
defaultsController =
|
||||||
|
[[NSUserDefaultsController sharedUserDefaultsController] initWithDefaults:nil
|
||||||
|
initialValues:defaultShortcuts];
|
||||||
|
|
||||||
|
_playShortcutView.associatedUserDefaultsKey = CogPlayShortcutKey;
|
||||||
|
_nextShortcutView.associatedUserDefaultsKey = CogNextShortcutKey;
|
||||||
|
_prevShortcutView.associatedUserDefaultsKey = CogPrevShortcutKey;
|
||||||
|
_spamShortcutView.associatedUserDefaultsKey = CogSpamShortcutKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSString *)title
|
- (NSString *)title
|
||||||
|
@ -41,24 +85,8 @@ static void setControlText(HotKeyControl* control, NSString* kcprop, NSString* m
|
||||||
return [[NSImage alloc] initWithContentsOfFile:[[NSBundle bundleForClass:[self class]] pathForImageResource:@"hot_keys"]];
|
return [[NSImage alloc] initWithContentsOfFile:[[NSBundle bundleForClass:[self class]] pathForImageResource:@"hot_keys"]];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction) hotKeyChanged:(id)sender
|
- (IBAction)resetToDefaultShortcuts:(id)sender {
|
||||||
{
|
[defaultsController revertToInitialValues:sender];
|
||||||
if (sender == playHotKeyControl) {
|
|
||||||
[[NSUserDefaults standardUserDefaults] setInteger:[playHotKeyControl modifierFlags] forKey:@"hotKeyPlayModifiers"];
|
|
||||||
[[NSUserDefaults standardUserDefaults] setInteger:[playHotKeyControl keyCode] forKey:@"hotKeyPlayKeyCode"];
|
|
||||||
}
|
|
||||||
else if (sender == prevHotKeyControl) {
|
|
||||||
[[NSUserDefaults standardUserDefaults] setInteger:[prevHotKeyControl modifierFlags] forKey:@"hotKeyPreviousModifiers"];
|
|
||||||
[[NSUserDefaults standardUserDefaults] setInteger:[prevHotKeyControl keyCode] forKey:@"hotKeyPreviousKeyCode"];
|
|
||||||
}
|
|
||||||
else if (sender == nextHotKeyControl) {
|
|
||||||
[[NSUserDefaults standardUserDefaults] setInteger:[nextHotKeyControl modifierFlags] forKey:@"hotKeyNextModifiers"];
|
|
||||||
[[NSUserDefaults standardUserDefaults] setInteger:[nextHotKeyControl keyCode] forKey:@"hotKeyNextKeyCode"];
|
|
||||||
}
|
|
||||||
else if (sender == spamHotKeyControl) {
|
|
||||||
[[NSUserDefaults standardUserDefaults] setInteger:[spamHotKeyControl modifierFlags] forKey:@"hotKeySpamModifiers"];
|
|
||||||
[[NSUserDefaults standardUserDefaults] setInteger:[spamHotKeyControl keyCode] forKey:@"hotKeySpamKeyCode"];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
837C0D401C50954000CAE18F /* MIDIPluginBehaviorArrayController.m in Sources */ = {isa = PBXBuildFile; fileRef = 837C0D3F1C50954000CAE18F /* MIDIPluginBehaviorArrayController.m */; };
|
837C0D401C50954000CAE18F /* MIDIPluginBehaviorArrayController.m in Sources */ = {isa = PBXBuildFile; fileRef = 837C0D3F1C50954000CAE18F /* MIDIPluginBehaviorArrayController.m */; };
|
||||||
8384917718084D9F00E7332D /* appearance.png in Resources */ = {isa = PBXBuildFile; fileRef = 8384917518084D9F00E7332D /* appearance.png */; };
|
8384917718084D9F00E7332D /* appearance.png in Resources */ = {isa = PBXBuildFile; fileRef = 8384917518084D9F00E7332D /* appearance.png */; };
|
||||||
8384917818084D9F00E7332D /* growl.png in Resources */ = {isa = PBXBuildFile; fileRef = 8384917618084D9F00E7332D /* growl.png */; };
|
8384917818084D9F00E7332D /* growl.png in Resources */ = {isa = PBXBuildFile; fileRef = 8384917618084D9F00E7332D /* growl.png */; };
|
||||||
8384918C1808596A00E7332D /* NDHotKey.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 838491841808588D00E7332D /* NDHotKey.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
|
|
||||||
83B06729180D85B8008E3612 /* MIDIPane.m in Sources */ = {isa = PBXBuildFile; fileRef = 83B06728180D85B8008E3612 /* MIDIPane.m */; };
|
83B06729180D85B8008E3612 /* MIDIPane.m in Sources */ = {isa = PBXBuildFile; fileRef = 83B06728180D85B8008E3612 /* MIDIPane.m */; };
|
||||||
83B0672B180D8B39008E3612 /* midi.png in Resources */ = {isa = PBXBuildFile; fileRef = 83B0672A180D8B39008E3612 /* midi.png */; };
|
83B0672B180D8B39008E3612 /* midi.png in Resources */ = {isa = PBXBuildFile; fileRef = 83B0672A180D8B39008E3612 /* midi.png */; };
|
||||||
83DFEA0B1CBC94DE00BCC565 /* MIDIFlavorBehaviorArrayController.m in Sources */ = {isa = PBXBuildFile; fileRef = 83DFEA0A1CBC94DE00BCC565 /* MIDIFlavorBehaviorArrayController.m */; };
|
83DFEA0B1CBC94DE00BCC565 /* MIDIFlavorBehaviorArrayController.m in Sources */ = {isa = PBXBuildFile; fileRef = 83DFEA0A1CBC94DE00BCC565 /* MIDIFlavorBehaviorArrayController.m */; };
|
||||||
|
@ -43,24 +42,38 @@
|
||||||
8E07ABDD0AAC95BC00A4B32F /* hot_keys.png in Resources */ = {isa = PBXBuildFile; fileRef = 8E07ABDB0AAC95BC00A4B32F /* hot_keys.png */; };
|
8E07ABDD0AAC95BC00A4B32F /* hot_keys.png in Resources */ = {isa = PBXBuildFile; fileRef = 8E07ABDB0AAC95BC00A4B32F /* hot_keys.png */; };
|
||||||
8E15A86C0B894768006DC802 /* updates.png in Resources */ = {isa = PBXBuildFile; fileRef = 8E15A86B0B894768006DC802 /* updates.png */; };
|
8E15A86C0B894768006DC802 /* updates.png in Resources */ = {isa = PBXBuildFile; fileRef = 8E15A86B0B894768006DC802 /* updates.png */; };
|
||||||
8E6C123A0AACAEF200819171 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8E6C12390AACAEF200819171 /* Carbon.framework */; };
|
8E6C123A0AACAEF200819171 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8E6C12390AACAEF200819171 /* Carbon.framework */; };
|
||||||
8E6C13A00AACBAB500819171 /* HotKeyControl.m in Sources */ = {isa = PBXBuildFile; fileRef = 8E6C139F0AACBAB500819171 /* HotKeyControl.m */; };
|
|
||||||
99F1813F0DE01D7A00FD5FFB /* PlaylistBehaviorArrayController.m in Sources */ = {isa = PBXBuildFile; fileRef = 99F1813E0DE01D7A00FD5FFB /* PlaylistBehaviorArrayController.m */; };
|
99F1813F0DE01D7A00FD5FFB /* PlaylistBehaviorArrayController.m in Sources */ = {isa = PBXBuildFile; fileRef = 99F1813E0DE01D7A00FD5FFB /* PlaylistBehaviorArrayController.m */; };
|
||||||
|
ED69CBC425BE329D0090B90D /* MASShortcut.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = ED69CBAE25BE32500090B90D /* MASShortcut.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||||
/* End PBXBuildFile section */
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
/* Begin PBXContainerItemProxy section */
|
/* Begin PBXContainerItemProxy section */
|
||||||
838491831808588D00E7332D /* PBXContainerItemProxy */ = {
|
ED69CBAD25BE32500090B90D /* PBXContainerItemProxy */ = {
|
||||||
isa = PBXContainerItemProxy;
|
isa = PBXContainerItemProxy;
|
||||||
containerPortal = 8384917F1808588D00E7332D /* NDHotKey.xcodeproj */;
|
containerPortal = ED69CBA725BE32500090B90D /* MASShortcut.xcodeproj */;
|
||||||
proxyType = 2;
|
proxyType = 2;
|
||||||
remoteGlobalIDString = 32F1615614E6BB3B00D6AB2F;
|
remoteGlobalIDString = 0D827CD31990D4420010B8EF;
|
||||||
remoteInfo = NDHotKey;
|
remoteInfo = MASShortcut;
|
||||||
};
|
};
|
||||||
838491891808594800E7332D /* PBXContainerItemProxy */ = {
|
ED69CBAF25BE32500090B90D /* PBXContainerItemProxy */ = {
|
||||||
isa = PBXContainerItemProxy;
|
isa = PBXContainerItemProxy;
|
||||||
containerPortal = 8384917F1808588D00E7332D /* NDHotKey.xcodeproj */;
|
containerPortal = ED69CBA725BE32500090B90D /* MASShortcut.xcodeproj */;
|
||||||
|
proxyType = 2;
|
||||||
|
remoteGlobalIDString = 0D827D8319910AFF0010B8EF;
|
||||||
|
remoteInfo = MASShortcutTests;
|
||||||
|
};
|
||||||
|
ED69CBB125BE32500090B90D /* PBXContainerItemProxy */ = {
|
||||||
|
isa = PBXContainerItemProxy;
|
||||||
|
containerPortal = ED69CBA725BE32500090B90D /* MASShortcut.xcodeproj */;
|
||||||
|
proxyType = 2;
|
||||||
|
remoteGlobalIDString = 0D827D371990D5E70010B8EF;
|
||||||
|
remoteInfo = Demo;
|
||||||
|
};
|
||||||
|
ED69CBB525BE325A0090B90D /* PBXContainerItemProxy */ = {
|
||||||
|
isa = PBXContainerItemProxy;
|
||||||
|
containerPortal = ED69CBA725BE32500090B90D /* MASShortcut.xcodeproj */;
|
||||||
proxyType = 1;
|
proxyType = 1;
|
||||||
remoteGlobalIDString = 32F1615514E6BB3B00D6AB2F;
|
remoteGlobalIDString = 0D827CD21990D4420010B8EF;
|
||||||
remoteInfo = NDHotKey;
|
remoteInfo = MASShortcut;
|
||||||
};
|
};
|
||||||
/* End PBXContainerItemProxy section */
|
/* End PBXContainerItemProxy section */
|
||||||
|
|
||||||
|
@ -71,7 +84,7 @@
|
||||||
dstPath = "";
|
dstPath = "";
|
||||||
dstSubfolderSpec = 10;
|
dstSubfolderSpec = 10;
|
||||||
files = (
|
files = (
|
||||||
8384918C1808596A00E7332D /* NDHotKey.framework in CopyFiles */,
|
ED69CBC425BE329D0090B90D /* MASShortcut.framework in CopyFiles */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
|
@ -110,7 +123,6 @@
|
||||||
8384913618081ECB00E7332D /* Logging.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Logging.h; path = ../../Utils/Logging.h; sourceTree = "<group>"; };
|
8384913618081ECB00E7332D /* Logging.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Logging.h; path = ../../Utils/Logging.h; sourceTree = "<group>"; };
|
||||||
8384917518084D9F00E7332D /* appearance.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = appearance.png; path = Icons/appearance.png; sourceTree = "<group>"; };
|
8384917518084D9F00E7332D /* appearance.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = appearance.png; path = Icons/appearance.png; sourceTree = "<group>"; };
|
||||||
8384917618084D9F00E7332D /* growl.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = growl.png; path = Icons/growl.png; sourceTree = "<group>"; };
|
8384917618084D9F00E7332D /* growl.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = growl.png; path = Icons/growl.png; sourceTree = "<group>"; };
|
||||||
8384917F1808588D00E7332D /* NDHotKey.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = NDHotKey.xcodeproj; path = ../../Frameworks/NDHotKey/NDHotKey.xcodeproj; sourceTree = "<group>"; };
|
|
||||||
83B06727180D85B8008E3612 /* MIDIPane.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MIDIPane.h; sourceTree = "<group>"; };
|
83B06727180D85B8008E3612 /* MIDIPane.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MIDIPane.h; sourceTree = "<group>"; };
|
||||||
83B06728180D85B8008E3612 /* MIDIPane.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MIDIPane.m; sourceTree = "<group>"; };
|
83B06728180D85B8008E3612 /* MIDIPane.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MIDIPane.m; sourceTree = "<group>"; };
|
||||||
83B0672A180D8B39008E3612 /* midi.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = midi.png; path = Icons/midi.png; sourceTree = "<group>"; };
|
83B0672A180D8B39008E3612 /* midi.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = midi.png; path = Icons/midi.png; sourceTree = "<group>"; };
|
||||||
|
@ -140,10 +152,10 @@
|
||||||
8E07ABDB0AAC95BC00A4B32F /* hot_keys.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = hot_keys.png; path = Icons/hot_keys.png; sourceTree = "<group>"; };
|
8E07ABDB0AAC95BC00A4B32F /* hot_keys.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = hot_keys.png; path = Icons/hot_keys.png; sourceTree = "<group>"; };
|
||||||
8E15A86B0B894768006DC802 /* updates.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = updates.png; path = Icons/updates.png; sourceTree = "<group>"; };
|
8E15A86B0B894768006DC802 /* updates.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = updates.png; path = Icons/updates.png; sourceTree = "<group>"; };
|
||||||
8E6C12390AACAEF200819171 /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /System/Library/Frameworks/Carbon.framework; sourceTree = "<absolute>"; };
|
8E6C12390AACAEF200819171 /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /System/Library/Frameworks/Carbon.framework; sourceTree = "<absolute>"; };
|
||||||
8E6C139E0AACBAB500819171 /* HotKeyControl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HotKeyControl.h; sourceTree = "<group>"; };
|
|
||||||
8E6C139F0AACBAB500819171 /* HotKeyControl.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HotKeyControl.m; sourceTree = "<group>"; };
|
|
||||||
99F1813D0DE01D7A00FD5FFB /* PlaylistBehaviorArrayController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlaylistBehaviorArrayController.h; sourceTree = "<group>"; };
|
99F1813D0DE01D7A00FD5FFB /* PlaylistBehaviorArrayController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlaylistBehaviorArrayController.h; sourceTree = "<group>"; };
|
||||||
99F1813E0DE01D7A00FD5FFB /* PlaylistBehaviorArrayController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PlaylistBehaviorArrayController.m; sourceTree = "<group>"; };
|
99F1813E0DE01D7A00FD5FFB /* PlaylistBehaviorArrayController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PlaylistBehaviorArrayController.m; sourceTree = "<group>"; };
|
||||||
|
ED69CBA725BE32500090B90D /* MASShortcut.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = MASShortcut.xcodeproj; path = ../../Frameworks/shpakovski/MASShortcut/MASShortcut.xcodeproj; sourceTree = "<group>"; };
|
||||||
|
ED69CF0B25BE75330090B90D /* Shortcuts.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = Shortcuts.h; path = ../Shortcuts.h; sourceTree = "<group>"; };
|
||||||
/* End PBXFileReference section */
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
/* Begin PBXFrameworksBuildPhase section */
|
/* Begin PBXFrameworksBuildPhase section */
|
||||||
|
@ -211,7 +223,7 @@
|
||||||
1058C7ACFEA557BF11CA2CBB /* Linked Frameworks */ = {
|
1058C7ACFEA557BF11CA2CBB /* Linked Frameworks */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
8384917F1808588D00E7332D /* NDHotKey.xcodeproj */,
|
ED69CBA725BE32500090B90D /* MASShortcut.xcodeproj */,
|
||||||
8E6C12390AACAEF200819171 /* Carbon.framework */,
|
8E6C12390AACAEF200819171 /* Carbon.framework */,
|
||||||
1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */,
|
1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */,
|
||||||
);
|
);
|
||||||
|
@ -254,8 +266,6 @@
|
||||||
8372053618E3DEAF007EFAD4 /* ResamplerBehaviorArrayController.m */,
|
8372053618E3DEAF007EFAD4 /* ResamplerBehaviorArrayController.m */,
|
||||||
170744AB0BFF3938002475C9 /* AppcastArrayController.h */,
|
170744AB0BFF3938002475C9 /* AppcastArrayController.h */,
|
||||||
170744AC0BFF3938002475C9 /* AppcastArrayController.m */,
|
170744AC0BFF3938002475C9 /* AppcastArrayController.m */,
|
||||||
8E6C139E0AACBAB500819171 /* HotKeyControl.h */,
|
|
||||||
8E6C139F0AACBAB500819171 /* HotKeyControl.m */,
|
|
||||||
17C643370B8A77CC00C53518 /* OutputsArrayController.h */,
|
17C643370B8A77CC00C53518 /* OutputsArrayController.h */,
|
||||||
17C643360B8A77CC00C53518 /* OutputsArrayController.m */,
|
17C643360B8A77CC00C53518 /* OutputsArrayController.m */,
|
||||||
99F1813D0DE01D7A00FD5FFB /* PlaylistBehaviorArrayController.h */,
|
99F1813D0DE01D7A00FD5FFB /* PlaylistBehaviorArrayController.h */,
|
||||||
|
@ -277,6 +287,7 @@
|
||||||
32C88E010371C26100C91783 /* Other Sources */ = {
|
32C88E010371C26100C91783 /* Other Sources */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
ED69CF0B25BE75330090B90D /* Shortcuts.h */,
|
||||||
32DBCF630370AF2F00C91783 /* Preferences_Prefix.pch */,
|
32DBCF630370AF2F00C91783 /* Preferences_Prefix.pch */,
|
||||||
);
|
);
|
||||||
name = "Other Sources";
|
name = "Other Sources";
|
||||||
|
@ -292,14 +303,6 @@
|
||||||
path = "../../Xcode-config";
|
path = "../../Xcode-config";
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
838491801808588D00E7332D /* Products */ = {
|
|
||||||
isa = PBXGroup;
|
|
||||||
children = (
|
|
||||||
838491841808588D00E7332D /* NDHotKey.framework */,
|
|
||||||
);
|
|
||||||
name = Products;
|
|
||||||
sourceTree = "<group>";
|
|
||||||
};
|
|
||||||
83F27E711810E41A00CEF538 /* Transformers */ = {
|
83F27E711810E41A00CEF538 /* Transformers */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
@ -334,6 +337,16 @@
|
||||||
name = Icons;
|
name = Icons;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
|
ED69CBA825BE32500090B90D /* Products */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
ED69CBAE25BE32500090B90D /* MASShortcut.framework */,
|
||||||
|
ED69CBB025BE32500090B90D /* MASShortcutTests.xctest */,
|
||||||
|
ED69CBB225BE32500090B90D /* Demo.app */,
|
||||||
|
);
|
||||||
|
name = Products;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
/* End PBXGroup section */
|
/* End PBXGroup section */
|
||||||
|
|
||||||
/* Begin PBXNativeTarget section */
|
/* Begin PBXNativeTarget section */
|
||||||
|
@ -349,7 +362,7 @@
|
||||||
buildRules = (
|
buildRules = (
|
||||||
);
|
);
|
||||||
dependencies = (
|
dependencies = (
|
||||||
8384918A1808594800E7332D /* PBXTargetDependency */,
|
ED69CBB625BE325A0090B90D /* PBXTargetDependency */,
|
||||||
);
|
);
|
||||||
name = Preferences;
|
name = Preferences;
|
||||||
productInstallPath = "$(HOME)/Library/Bundles";
|
productInstallPath = "$(HOME)/Library/Bundles";
|
||||||
|
@ -391,8 +404,8 @@
|
||||||
projectDirPath = "";
|
projectDirPath = "";
|
||||||
projectReferences = (
|
projectReferences = (
|
||||||
{
|
{
|
||||||
ProductGroup = 838491801808588D00E7332D /* Products */;
|
ProductGroup = ED69CBA825BE32500090B90D /* Products */;
|
||||||
ProjectRef = 8384917F1808588D00E7332D /* NDHotKey.xcodeproj */;
|
ProjectRef = ED69CBA725BE32500090B90D /* MASShortcut.xcodeproj */;
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
projectRoot = "";
|
projectRoot = "";
|
||||||
|
@ -403,11 +416,25 @@
|
||||||
/* End PBXProject section */
|
/* End PBXProject section */
|
||||||
|
|
||||||
/* Begin PBXReferenceProxy section */
|
/* Begin PBXReferenceProxy section */
|
||||||
838491841808588D00E7332D /* NDHotKey.framework */ = {
|
ED69CBAE25BE32500090B90D /* MASShortcut.framework */ = {
|
||||||
isa = PBXReferenceProxy;
|
isa = PBXReferenceProxy;
|
||||||
fileType = wrapper.framework;
|
fileType = wrapper.framework;
|
||||||
path = NDHotKey.framework;
|
path = MASShortcut.framework;
|
||||||
remoteRef = 838491831808588D00E7332D /* PBXContainerItemProxy */;
|
remoteRef = ED69CBAD25BE32500090B90D /* PBXContainerItemProxy */;
|
||||||
|
sourceTree = BUILT_PRODUCTS_DIR;
|
||||||
|
};
|
||||||
|
ED69CBB025BE32500090B90D /* MASShortcutTests.xctest */ = {
|
||||||
|
isa = PBXReferenceProxy;
|
||||||
|
fileType = wrapper.cfbundle;
|
||||||
|
path = MASShortcutTests.xctest;
|
||||||
|
remoteRef = ED69CBAF25BE32500090B90D /* PBXContainerItemProxy */;
|
||||||
|
sourceTree = BUILT_PRODUCTS_DIR;
|
||||||
|
};
|
||||||
|
ED69CBB225BE32500090B90D /* Demo.app */ = {
|
||||||
|
isa = PBXReferenceProxy;
|
||||||
|
fileType = wrapper.application;
|
||||||
|
path = Demo.app;
|
||||||
|
remoteRef = ED69CBB125BE32500090B90D /* PBXContainerItemProxy */;
|
||||||
sourceTree = BUILT_PRODUCTS_DIR;
|
sourceTree = BUILT_PRODUCTS_DIR;
|
||||||
};
|
};
|
||||||
/* End PBXReferenceProxy section */
|
/* End PBXReferenceProxy section */
|
||||||
|
@ -451,7 +478,6 @@
|
||||||
83F27E741810E45D00CEF538 /* PathToFileTransformer.m in Sources */,
|
83F27E741810E45D00CEF538 /* PathToFileTransformer.m in Sources */,
|
||||||
8E07AA890AAC8EA200A4B32F /* GeneralPreferencePane.m in Sources */,
|
8E07AA890AAC8EA200A4B32F /* GeneralPreferencePane.m in Sources */,
|
||||||
8E07AA8A0AAC8EA200A4B32F /* GeneralPreferencesPlugin.m in Sources */,
|
8E07AA8A0AAC8EA200A4B32F /* GeneralPreferencesPlugin.m in Sources */,
|
||||||
8E6C13A00AACBAB500819171 /* HotKeyControl.m in Sources */,
|
|
||||||
83DFEA0B1CBC94DE00BCC565 /* MIDIFlavorBehaviorArrayController.m in Sources */,
|
83DFEA0B1CBC94DE00BCC565 /* MIDIFlavorBehaviorArrayController.m in Sources */,
|
||||||
83EF495F17FBC96A00642E3C /* VolumeBehaviorArrayController.m in Sources */,
|
83EF495F17FBC96A00642E3C /* VolumeBehaviorArrayController.m in Sources */,
|
||||||
17C643380B8A77CC00C53518 /* OutputsArrayController.m in Sources */,
|
17C643380B8A77CC00C53518 /* OutputsArrayController.m in Sources */,
|
||||||
|
@ -467,10 +493,10 @@
|
||||||
/* End PBXSourcesBuildPhase section */
|
/* End PBXSourcesBuildPhase section */
|
||||||
|
|
||||||
/* Begin PBXTargetDependency section */
|
/* Begin PBXTargetDependency section */
|
||||||
8384918A1808594800E7332D /* PBXTargetDependency */ = {
|
ED69CBB625BE325A0090B90D /* PBXTargetDependency */ = {
|
||||||
isa = PBXTargetDependency;
|
isa = PBXTargetDependency;
|
||||||
name = NDHotKey;
|
name = MASShortcut;
|
||||||
targetProxy = 838491891808594800E7332D /* PBXContainerItemProxy */;
|
targetProxy = ED69CBB525BE325A0090B90D /* PBXContainerItemProxy */;
|
||||||
};
|
};
|
||||||
/* End PBXTargetDependency section */
|
/* End PBXTargetDependency section */
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
//
|
||||||
|
// Shortcuts.h
|
||||||
|
// Preferences
|
||||||
|
//
|
||||||
|
// Created by Dzmitry Neviadomski on 25.01.21.
|
||||||
|
//
|
||||||
|
|
||||||
|
static NSString *const CogPlayShortcutKey = @"cogPlayShortcut";
|
||||||
|
static NSString *const CogNextShortcutKey = @"cogNextShortcut";
|
||||||
|
static NSString *const CogPrevShortcutKey = @"cogPrevShortcut";
|
||||||
|
static NSString *const CogSpamShortcutKey = @"cogSpamShortcut";
|
Loading…
Reference in New Issue