added url to virtual key

This commit is contained in:
Jeena Paradies 2010-05-01 15:16:51 +02:00
parent 543e4e99eb
commit 457a08ea91
8 changed files with 254 additions and 211 deletions

View file

@ -37,8 +37,8 @@
- (void)initHotKeys {
NSInteger newTweetKey = kVK_ANSI_T; // HIToolbox/Events.h
NSInteger newTweetModifierKey = controlKey + cmdKey + optionKey; // controlKey 4096, cmdKey 256, optionKey 2048
NSInteger newTweetKey = kVK_ANSI_T; // http://boredzo.org/blog/archives/2007-05-22/virtual-key-codes
NSInteger newTweetModifierKey = controlKey + cmdKey + optionKey; // cmdKey 256, shitfKey 512, optionKey 2048, controlKey 4096
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSInteger defaultsNewTweetKey = (NSInteger)[defaults integerForKey:@"newTweetKey"];
@ -61,7 +61,7 @@
if (newTweetModifierKey & controlKey) cocoaModifiers = cocoaModifiers | NSControlKeyMask;
if (newTweetModifierKey & cmdKey) cocoaModifiers = cocoaModifiers | NSCommandKeyMask;
NSLog(@"%i", NSShiftKeyMask);
NSLog(@"%i", shiftKey);
NSInteger theNumber = cocoaModifiers;
NSMutableString *str = [NSMutableString string];
NSInteger numberCopy = theNumber; // so you won't change your original value
@ -75,7 +75,7 @@
NSLog(@"%c", kVK_ANSI_T);
[globalHotkeyMenuItem setKeyEquivalent:[Controller stringFromVirtualKeyCode:newTweetKey]];
[globalHotkeyMenuItem setKeyEquivalent:[Constants stringFromVirtualKeyCode:newTweetKey]];
[globalHotkeyMenuItem setKeyEquivalentModifierMask:cocoaModifiers];
@ -181,211 +181,6 @@
}
}
+ (NSString *)stringFromVirtualKeyCode:(NSInteger)code {
NSString *string;
switch (code) {
case kVK_ANSI_A:
string = @"A";
break;
case kVK_ANSI_S:
string = @"S";
break;
case kVK_ANSI_D:
string = @"D";
break;
case kVK_ANSI_F:
string = @"F";
break;
case kVK_ANSI_H:
string = @"H";
break;
case kVK_ANSI_G:
string = @"G";
break;
case kVK_ANSI_Z:
string = @"Z";
break;
case kVK_ANSI_X:
string = @"X";
break;
case kVK_ANSI_C:
string = @"C";
break;
case kVK_ANSI_V:
string = @"V";
break;
case kVK_ANSI_B:
string = @"B";
break;
case kVK_ANSI_Q:
string = @"Q";
break;
case kVK_ANSI_W:
string = @"W";
break;
case kVK_ANSI_E:
string = @"E";
break;
case kVK_ANSI_R:
string = @"R";
break;
case kVK_ANSI_Y:
string = @"Y";
break;
case kVK_ANSI_T:
string = @"T";
break;
case kVK_ANSI_1:
string = @"1";
break;
case kVK_ANSI_2:
string = @"2";
break;
case kVK_ANSI_3:
string = @"3";
break;
case kVK_ANSI_4:
string = @"4";
break;
case kVK_ANSI_6:
string = @"6";
break;
case kVK_ANSI_5:
string = @"5";
break;
case kVK_ANSI_Equal:
string = @"=";
break;
case kVK_ANSI_9:
string = @"9";
break;
case kVK_ANSI_7:
string = @"7";
break;
case kVK_ANSI_Minus:
string = @"-";
break;
case kVK_ANSI_8:
string = @"8";
break;
case kVK_ANSI_0:
string = @"0";
break;
case kVK_ANSI_RightBracket:
string = @")";
break;
case kVK_ANSI_O:
string = @"0";
break;
case kVK_ANSI_U:
string = @"U";
break;
case kVK_ANSI_LeftBracket:
string = @"(";
break;
case kVK_ANSI_I:
string = @"I";
break;
case kVK_ANSI_P:
string = @"P";
break;
case kVK_ANSI_L:
string = @"L";
break;
case kVK_ANSI_J:
string = @"J";
break;
case kVK_ANSI_Quote:
string = @"\"";
break;
case kVK_ANSI_K:
string = @"K";
break;
case kVK_ANSI_Semicolon:
string = @";";
break;
case kVK_ANSI_Backslash:
string = @"\\";
break;
case kVK_ANSI_Comma:
string = @",";
break;
case kVK_ANSI_Slash:
string = @"/";
break;
case kVK_ANSI_N:
string = @"N";
break;
case kVK_ANSI_M:
string = @"M";
break;
case kVK_ANSI_Period:
string = @".";
break;
case kVK_ANSI_Grave:
string = @"`";
break;
case kVK_ANSI_KeypadDecimal:
string = @".";
break;
case kVK_ANSI_KeypadMultiply:
string = @"*";
break;
case kVK_ANSI_KeypadPlus:
string = @"+";
break;
case kVK_ANSI_KeypadClear:
string = @"";
break;
case kVK_ANSI_KeypadDivide:
string = @"/";
break;
case kVK_ANSI_KeypadEnter:
string = @"⎆";
break;
case kVK_ANSI_KeypadMinus:
string = @"-";
break;
case kVK_ANSI_KeypadEquals:
string = @"=";
break;
case kVK_ANSI_Keypad0:
string = @"0";
break;
case kVK_ANSI_Keypad1:
string = @"1";
break;
case kVK_ANSI_Keypad2:
string = @"2";
break;
case kVK_ANSI_Keypad3:
string = @"3";
break;
case kVK_ANSI_Keypad4:
string = @"4";
break;
case kVK_ANSI_Keypad5:
string = @"5";
break;
case kVK_ANSI_Keypad6:
string = @"6";
break;
case kVK_ANSI_Keypad7:
string = @"7";
break;
case kVK_ANSI_Keypad8:
string = @"8";
break;
case kVK_ANSI_Keypad9:
string = @"9";
break;
default:
break;
}
return string;
}
/* CARBON */