Skip to content
Browse files

foobar

  • Loading branch information...
1 parent 45dd321 commit 2f8079f42c345466e8a2382b14b0e40a2a661262 @ccgus committed Aug 3, 2008
Showing with 6,162 additions and 0 deletions.
  1. BIN khord/English.lproj/InfoPlist.strings
  2. +3,610 −0 khord/English.lproj/MainMenu.xib
  3. +28 −0 khord/Info.plist
  4. +96 −0 khord/PTHotKeysLib/res/English.lproj/PTKeyCodes.plist
  5. +111 −0 khord/PTHotKeysLib/res/English.lproj/PTKeyComboPanel.nib/classes.nib
  6. +20 −0 khord/PTHotKeysLib/res/English.lproj/PTKeyComboPanel.nib/info.nib
  7. BIN khord/PTHotKeysLib/res/English.lproj/PTKeyComboPanel.nib/keyedobjects.nib
  8. +103 −0 khord/PTHotKeysLib/res/French.lproj/PTKeyCodes.plist
  9. +18 −0 khord/PTHotKeysLib/res/French.lproj/PTKeyComboPanel.nib/classes.nib
  10. +26 −0 khord/PTHotKeysLib/res/French.lproj/PTKeyComboPanel.nib/info.nib
  11. BIN khord/PTHotKeysLib/res/French.lproj/PTKeyComboPanel.nib/keyedobjects.nib
  12. +103 −0 khord/PTHotKeysLib/res/German.lproj/PTKeyCodes.plist
  13. +18 −0 khord/PTHotKeysLib/res/German.lproj/PTKeyComboPanel.nib/classes.nib
  14. +26 −0 khord/PTHotKeysLib/res/German.lproj/PTKeyComboPanel.nib/info.nib
  15. BIN khord/PTHotKeysLib/res/German.lproj/PTKeyComboPanel.nib/objects.nib
  16. +103 −0 khord/PTHotKeysLib/res/Japanese.lproj/PTKeyCodes.plist
  17. +18 −0 khord/PTHotKeysLib/res/Japanese.lproj/PTKeyComboPanel.nib/classes.nib
  18. +26 −0 khord/PTHotKeysLib/res/Japanese.lproj/PTKeyComboPanel.nib/info.nib
  19. BIN khord/PTHotKeysLib/res/Japanese.lproj/PTKeyComboPanel.nib/objects.nib
  20. BIN khord/PTHotKeysLib/res/PTKeyboardIcon.tiff
  21. +41 −0 khord/PTHotKeysLib/src/PTHotKey.h
  22. +115 −0 khord/PTHotKeysLib/src/PTHotKey.m
  23. +33 −0 khord/PTHotKeysLib/src/PTHotKeyCenter.h
  24. +284 −0 khord/PTHotKeysLib/src/PTHotKeyCenter.m
  25. +24 −0 khord/PTHotKeysLib/src/PTKeyBroadcaster.h
  26. +74 −0 khord/PTHotKeysLib/src/PTKeyBroadcaster.m
  27. +29 −0 khord/PTHotKeysLib/src/PTKeyCodeTranslator.h
  28. +60 −0 khord/PTHotKeysLib/src/PTKeyCodeTranslator.m
  29. +45 −0 khord/PTHotKeysLib/src/PTKeyCombo.h
  30. +261 −0 khord/PTHotKeysLib/src/PTKeyCombo.m
  31. +44 −0 khord/PTHotKeysLib/src/PTKeyComboPanel.h
  32. +203 −0 khord/PTHotKeysLib/src/PTKeyComboPanel.m
  33. +395 −0 khord/khord.xcodeproj/project.pbxproj
  34. +16 −0 khord/khord_Prefix.pch
  35. +14 −0 khord/main.m
  36. +29 −0 khord/src/KHAppDelegate.h
  37. +80 −0 khord/src/KHAppDelegate.m
  38. +21 −0 khord/src/KHKeyCatcherView.h
  39. +88 −0 khord/src/KHKeyCatcherView.m
View
BIN khord/English.lproj/InfoPlist.strings
Binary file not shown.
View
3,610 khord/English.lproj/MainMenu.xib
3,610 additions, 0 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
28 khord/Info.plist
@@ -0,0 +1,28 @@
+<?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>com.flyingmeat.${PRODUCT_NAME:identifier}</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>${PRODUCT_NAME}</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>1.0</string>
+ <key>NSMainNibFile</key>
+ <string>MainMenu</string>
+ <key>NSPrincipalClass</key>
+ <string>NSApplication</string>
+</dict>
+</plist>
View
96 khord/PTHotKeysLib/res/English.lproj/PTKeyCodes.plist
@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>padKeyString</key>
+ <string>Pad</string>
+ <key>padKeys</key>
+ <array>
+ <string>65</string>
+ <string>67</string>
+ <string>69</string>
+ <string>75</string>
+ <string>78</string>
+ <string>81</string>
+ <string>82</string>
+ <string>83</string>
+ <string>84</string>
+ <string>85</string>
+ <string>86</string>
+ <string>87</string>
+ <string>88</string>
+ <string>89</string>
+ <string>91</string>
+ <string>92</string>
+ </array>
+ <key>unmappedKeys</key>
+ <dict>
+ <key>100</key>
+ <string>F8</string>
+ <key>101</key>
+ <string>F9</string>
+ <key>103</key>
+ <string>F11</string>
+ <key>105</key>
+ <string>F13</string>
+ <key>107</key>
+ <string>F14</string>
+ <key>109</key>
+ <string>F10</string>
+ <key>111</key>
+ <string>F12</string>
+ <key>113</key>
+ <string>F15</string>
+ <key>114</key>
+ <string>Ins</string>
+ <key>115</key>
+ <string>Home</string>
+ <key>116</key>
+ <string>Page Up</string>
+ <key>117</key>
+ <string>Del</string>
+ <key>118</key>
+ <string>F4</string>
+ <key>119</key>
+ <string>End</string>
+ <key>120</key>
+ <string>F2</string>
+ <key>121</key>
+ <string>Page Down</string>
+ <key>122</key>
+ <string>F1</string>
+ <key>123</key>
+ <string>Left Arrow</string>
+ <key>124</key>
+ <string>Right Arrow</string>
+ <key>125</key>
+ <string>Down Arrow</string>
+ <key>126</key>
+ <string>Up Arrow</string>
+ <key>36</key>
+ <string>Return</string>
+ <key>48</key>
+ <string>Tab</string>
+ <key>49</key>
+ <string>Space</string>
+ <key>51</key>
+ <string>Backspace</string>
+ <key>53</key>
+ <string>ESC</string>
+ <key>71</key>
+ <string>Clear</string>
+ <key>76</key>
+ <string>Pad Enter</string>
+ <key>96</key>
+ <string>F5</string>
+ <key>97</key>
+ <string>F6</string>
+ <key>98</key>
+ <string>F7</string>
+ <key>99</key>
+ <string>F3</string>
+ </dict>
+ <key>version</key>
+ <integer>1</integer>
+</dict>
+</plist>
View
111 khord/PTHotKeysLib/res/English.lproj/PTKeyComboPanel.nib/classes.nib
@@ -0,0 +1,111 @@
+<?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>IBClasses</key>
+ <array>
+ <dict>
+ <key>CLASS</key>
+ <string>PTKeyBroadcaster</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ <key>SUPERCLASS</key>
+ <string>NSButton</string>
+ </dict>
+ <dict>
+ <key>CLASS</key>
+ <string>NSView</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ <key>SUPERCLASS</key>
+ <string>NSResponder</string>
+ </dict>
+ <dict>
+ <key>CLASS</key>
+ <string>RBSplitView</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ <key>OUTLETS</key>
+ <dict>
+ <key>delegate</key>
+ <string>id</string>
+ </dict>
+ <key>SUPERCLASS</key>
+ <string>RBSplitSubview</string>
+ </dict>
+ <dict>
+ <key>CLASS</key>
+ <string>RBSplitSubview</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ <key>SUPERCLASS</key>
+ <string>NSView</string>
+ </dict>
+ <dict>
+ <key>CLASS</key>
+ <string>NSMenu</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ <key>SUPERCLASS</key>
+ <string>NSObject</string>
+ </dict>
+ <dict>
+ <key>CLASS</key>
+ <string>FirstResponder</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ <key>SUPERCLASS</key>
+ <string>NSObject</string>
+ </dict>
+ <dict>
+ <key>ACTIONS</key>
+ <dict>
+ <key>didAdjustSubviews</key>
+ <string>RBSplitView</string>
+ <key>willAdjustSubviews</key>
+ <string>RBSplitView</string>
+ </dict>
+ <key>CLASS</key>
+ <string>NSObject</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ </dict>
+ <dict>
+ <key>ACTIONS</key>
+ <dict>
+ <key>cancel</key>
+ <string>id</string>
+ <key>clear</key>
+ <string>id</string>
+ <key>ok</key>
+ <string>id</string>
+ </dict>
+ <key>CLASS</key>
+ <string>PTKeyComboPanel</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ <key>OUTLETS</key>
+ <dict>
+ <key>mComboField</key>
+ <string>NSTextField</string>
+ <key>mKeyBcaster</key>
+ <string>PTKeyBroadcaster</string>
+ <key>mTitleField</key>
+ <string>NSTextField</string>
+ </dict>
+ <key>SUPERCLASS</key>
+ <string>NSWindowController</string>
+ </dict>
+ <dict>
+ <key>CLASS</key>
+ <string>NSWindow</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ <key>SUPERCLASS</key>
+ <string>NSResponder</string>
+ </dict>
+ </array>
+ <key>IBVersion</key>
+ <string>1</string>
+</dict>
+</plist>
View
20 khord/PTHotKeysLib/res/English.lproj/PTKeyComboPanel.nib/info.nib
@@ -0,0 +1,20 @@
+<?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>IBFramework Version</key>
+ <string>670</string>
+ <key>IBLastKnownRelativeProjectPath</key>
+ <string>../../../../fmkit.xcodeproj</string>
+ <key>IBOldestOS</key>
+ <integer>5</integer>
+ <key>IBOpenObjects</key>
+ <array>
+ <integer>20</integer>
+ </array>
+ <key>IBSystem Version</key>
+ <string>9E17</string>
+ <key>targetFramework</key>
+ <string>IBCocoaFramework</string>
+</dict>
+</plist>
View
BIN khord/PTHotKeysLib/res/English.lproj/PTKeyComboPanel.nib/keyedobjects.nib
Binary file not shown.
View
103 khord/PTHotKeysLib/res/French.lproj/PTKeyCodes.plist
@@ -0,0 +1,103 @@
+{
+ 0 = "A";
+ 1 = "S";
+ 2 = "D";
+ 3 = "F";
+ 4 = "H";
+ 5 = "G";
+ 6 = "Z";
+ 7 = "X";
+ 8 = "C";
+ 9 = "V";
+ 10 = "$";
+ 11 = "B";
+ 12 = "Q";
+ 13 = "W";
+ 14 = "E";
+ 15 = "R";
+ 16 = "Y";
+ 17 = "T";
+ 18 = "1";
+ 19 = "2";
+ 20 = "3";
+ 21 = "4";
+ 22 = "6";
+ 23 = "5";
+ 24 = "=";
+ 25 = "9";
+ 26 = "7";
+ 27 = "-";
+ 28 = "8";
+ 29 = "0";
+ 30 = "\]";
+ 31 = "O";
+ 32 = "U";
+ 33 = "\[";
+ 34 = "I";
+ 35 = "P";
+ 36 = "Return";
+ 37 = "L";
+ 38 = "J";
+ 39 = "\'";
+ 40 = "K";
+ 41 = ";";
+ 42 = "\\";
+ 43 = ",";
+ 44 = "\/";
+ 45 = "N";
+ 46 = "M";
+ 47 = ".";
+ 48 = "Tab";
+ 49 = "Space";
+ 50 = "\`";
+ 51 = "Delete";
+ 53 = "ESC";
+ 55 = "Command";
+ 56 = "Shift";
+ 57 = "Caps Lock";
+ 58 = "Option";
+ 59 = "Control";
+ 65 = "Pad .";
+ 67 = "Pad *";
+ 69 = "Pad +";
+ 71 = "Clear";
+ 75 = "Pad /";
+ 76 = "Pad Enter";
+ 78 = "Pad -";
+ 81 = "Pad =";
+ 82 = "Pad 0";
+ 83 = "Pad 1";
+ 84 = "Pad 2";
+ 85 = "Pad 3";
+ 86 = "Pad 4";
+ 87 = "Pad 5";
+ 88 = "Pad 6";
+ 89 = "Pad 7";
+ 91 = "Pad 8";
+ 92 = "Pad 9";
+ 96 = "F5";
+ 97 = "F6";
+ 98 = "F7";
+ 99 = "F3";
+ 100 = "F8";
+ 101 = "F9";
+ 103 = "F11";
+ 105 = "F13";
+ 107 = "F14";
+ 109 = "F10";
+ 111 = "F12";
+ 113 = "F15";
+ 114 = "Ins";
+ 115 = "Home";
+ 116 = "Page Up";
+ 117 = "Del";
+ 118 = "F4";
+ 119 = "End";
+ 120 = "F2";
+ 121 = "Page Down";
+ 122 = "F1";
+ 123 = "Left Arrow";
+ 124 = "Right Arrow";
+ 125 = "Down Arrow";
+ 126 = "Up Arrow";
+}
View
18 khord/PTHotKeysLib/res/French.lproj/PTKeyComboPanel.nib/classes.nib
@@ -0,0 +1,18 @@
+{
+ IBClasses = (
+ {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; },
+ {CLASS = PTKeyBroadcaster; LANGUAGE = ObjC; SUPERCLASS = NSButton; },
+ {
+ ACTIONS = {cancel = id; clear = id; ok = id; };
+ CLASS = PTKeyComboPanel;
+ LANGUAGE = ObjC;
+ OUTLETS = {
+ mComboField = NSTextField;
+ mKeyBcaster = PTKeyBroadcaster;
+ mTitleField = NSTextField;
+ };
+ SUPERCLASS = NSWindowController;
+ }
+ );
+ IBVersion = 1;
+}
View
26 khord/PTHotKeysLib/res/French.lproj/PTKeyComboPanel.nib/info.nib
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>IBDocumentLocation</key>
+ <string>109 47 356 240 0 0 1280 1002 </string>
+ <key>IBFramework Version</key>
+ <string>291.0</string>
+ <key>IBGroupedObjects</key>
+ <dict>
+ <key>11</key>
+ <array>
+ <string>22</string>
+ <string>27</string>
+ </array>
+ </dict>
+ <key>IBLastGroupID</key>
+ <string>12</string>
+ <key>IBOpenObjects</key>
+ <array>
+ <integer>19</integer>
+ </array>
+ <key>IBSystem Version</key>
+ <string>6L60</string>
+</dict>
+</plist>
View
BIN khord/PTHotKeysLib/res/French.lproj/PTKeyComboPanel.nib/keyedobjects.nib
Binary file not shown.
View
103 khord/PTHotKeysLib/res/German.lproj/PTKeyCodes.plist
@@ -0,0 +1,103 @@
+{
+ 0 = "A";
+ 1 = "S";
+ 2 = "D";
+ 3 = "F";
+ 4 = "H";
+ 5 = "G";
+ 6 = "Z";
+ 7 = "X";
+ 8 = "C";
+ 9 = "V";
+ 10 = "$";
+ 11 = "B";
+ 12 = "Q";
+ 13 = "W";
+ 14 = "E";
+ 15 = "R";
+ 16 = "Y";
+ 17 = "T";
+ 18 = "1";
+ 19 = "2";
+ 20 = "3";
+ 21 = "4";
+ 22 = "6";
+ 23 = "5";
+ 24 = "=";
+ 25 = "9";
+ 26 = "7";
+ 27 = "-";
+ 28 = "8";
+ 29 = "0";
+ 30 = "\]";
+ 31 = "O";
+ 32 = "U";
+ 33 = "\[";
+ 34 = "I";
+ 35 = "P";
+ 36 = "Return";
+ 37 = "L";
+ 38 = "J";
+ 39 = "\'";
+ 40 = "K";
+ 41 = ";";
+ 42 = "\\";
+ 43 = ",";
+ 44 = "\/";
+ 45 = "N";
+ 46 = "M";
+ 47 = ".";
+ 48 = "Tab";
+ 49 = "Space";
+ 50 = "\`";
+ 51 = "Delete";
+ 53 = "ESC";
+ 55 = "Command";
+ 56 = "Shift";
+ 57 = "Caps Lock";
+ 58 = "Option";
+ 59 = "Control";
+ 65 = "Pad .";
+ 67 = "Pad *";
+ 69 = "Pad +";
+ 71 = "Clear";
+ 75 = "Pad /";
+ 76 = "Pad Enter";
+ 78 = "Pad -";
+ 81 = "Pad =";
+ 82 = "Pad 0";
+ 83 = "Pad 1";
+ 84 = "Pad 2";
+ 85 = "Pad 3";
+ 86 = "Pad 4";
+ 87 = "Pad 5";
+ 88 = "Pad 6";
+ 89 = "Pad 7";
+ 91 = "Pad 8";
+ 92 = "Pad 9";
+ 96 = "F5";
+ 97 = "F6";
+ 98 = "F7";
+ 99 = "F3";
+ 100 = "F8";
+ 101 = "F9";
+ 103 = "F11";
+ 105 = "F13";
+ 107 = "F14";
+ 109 = "F10";
+ 111 = "F12";
+ 113 = "F15";
+ 114 = "Ins";
+ 115 = "Home";
+ 116 = "Page Up";
+ 117 = "Del";
+ 118 = "F4";
+ 119 = "End";
+ 120 = "F2";
+ 121 = "Page Down";
+ 122 = "F1";
+ 123 = "Left Arrow";
+ 124 = "Right Arrow";
+ 125 = "Down Arrow";
+ 126 = "Up Arrow";
+}
View
18 khord/PTHotKeysLib/res/German.lproj/PTKeyComboPanel.nib/classes.nib
@@ -0,0 +1,18 @@
+{
+ IBClasses = (
+ {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; },
+ {CLASS = PTKeyBroadcaster; LANGUAGE = ObjC; SUPERCLASS = NSButton; },
+ {
+ ACTIONS = {cancel = id; clear = id; ok = id; };
+ CLASS = PTKeyComboPanel;
+ LANGUAGE = ObjC;
+ OUTLETS = {
+ mComboField = NSTextField;
+ mKeyBcaster = PTKeyBroadcaster;
+ mTitleField = NSTextField;
+ };
+ SUPERCLASS = NSWindowController;
+ }
+ );
+ IBVersion = 1;
+}
View
26 khord/PTHotKeysLib/res/German.lproj/PTKeyComboPanel.nib/info.nib
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>IBDocumentLocation</key>
+ <string>79 31 356 240 0 0 1024 746 </string>
+ <key>IBFramework Version</key>
+ <string>313.0</string>
+ <key>IBGroupedObjects</key>
+ <dict>
+ <key>10</key>
+ <array>
+ <string>22</string>
+ <string>27</string>
+ </array>
+ </dict>
+ <key>IBLastGroupID</key>
+ <string>11</string>
+ <key>IBOpenObjects</key>
+ <array>
+ <integer>19</integer>
+ </array>
+ <key>IBSystem Version</key>
+ <string>6L60</string>
+</dict>
+</plist>
View
BIN khord/PTHotKeysLib/res/German.lproj/PTKeyComboPanel.nib/objects.nib
Binary file not shown.
View
103 khord/PTHotKeysLib/res/Japanese.lproj/PTKeyCodes.plist
@@ -0,0 +1,103 @@
+{
+ 0 = "A";
+ 1 = "S";
+ 2 = "D";
+ 3 = "F";
+ 4 = "H";
+ 5 = "G";
+ 6 = "Z";
+ 7 = "X";
+ 8 = "C";
+ 9 = "V";
+ 10 = "$";
+ 11 = "B";
+ 12 = "Q";
+ 13 = "W";
+ 14 = "E";
+ 15 = "R";
+ 16 = "Y";
+ 17 = "T";
+ 18 = "1";
+ 19 = "2";
+ 20 = "3";
+ 21 = "4";
+ 22 = "6";
+ 23 = "5";
+ 24 = "=";
+ 25 = "9";
+ 26 = "7";
+ 27 = "-";
+ 28 = "8";
+ 29 = "0";
+ 30 = "\]";
+ 31 = "O";
+ 32 = "U";
+ 33 = "\[";
+ 34 = "I";
+ 35 = "P";
+ 36 = "Return";
+ 37 = "L";
+ 38 = "J";
+ 39 = "\'";
+ 40 = "K";
+ 41 = ";";
+ 42 = "\\";
+ 43 = ",";
+ 44 = "\/";
+ 45 = "N";
+ 46 = "M";
+ 47 = ".";
+ 48 = "Tab";
+ 49 = "Space";
+ 50 = "\`";
+ 51 = "Delete";
+ 53 = "ESC";
+ 55 = "Command";
+ 56 = "Shift";
+ 57 = "Caps Lock";
+ 58 = "Option";
+ 59 = "Control";
+ 65 = "Pad .";
+ 67 = "Pad *";
+ 69 = "Pad +";
+ 71 = "Clear";
+ 75 = "Pad /";
+ 76 = "Pad Enter";
+ 78 = "Pad -";
+ 81 = "Pad =";
+ 82 = "Pad 0";
+ 83 = "Pad 1";
+ 84 = "Pad 2";
+ 85 = "Pad 3";
+ 86 = "Pad 4";
+ 87 = "Pad 5";
+ 88 = "Pad 6";
+ 89 = "Pad 7";
+ 91 = "Pad 8";
+ 92 = "Pad 9";
+ 96 = "F5";
+ 97 = "F6";
+ 98 = "F7";
+ 99 = "F3";
+ 100 = "F8";
+ 101 = "F9";
+ 103 = "F11";
+ 105 = "F13";
+ 107 = "F14";
+ 109 = "F10";
+ 111 = "F12";
+ 113 = "F15";
+ 114 = "Ins";
+ 115 = "Home";
+ 116 = "Page Up";
+ 117 = "Del";
+ 118 = "F4";
+ 119 = "End";
+ 120 = "F2";
+ 121 = "Page Down";
+ 122 = "F1";
+ 123 = "Left Arrow";
+ 124 = "Right Arrow";
+ 125 = "Down Arrow";
+ 126 = "Up Arrow";
+}
View
18 khord/PTHotKeysLib/res/Japanese.lproj/PTKeyComboPanel.nib/classes.nib
@@ -0,0 +1,18 @@
+{
+ IBClasses = (
+ {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; },
+ {CLASS = PTKeyBroadcaster; LANGUAGE = ObjC; SUPERCLASS = NSButton; },
+ {
+ ACTIONS = {cancel = id; clear = id; ok = id; };
+ CLASS = PTKeyComboPanel;
+ LANGUAGE = ObjC;
+ OUTLETS = {
+ mComboField = NSTextField;
+ mKeyBcaster = PTKeyBroadcaster;
+ mTitleField = NSTextField;
+ };
+ SUPERCLASS = NSWindowController;
+ }
+ );
+ IBVersion = 1;
+}
View
26 khord/PTHotKeysLib/res/Japanese.lproj/PTKeyComboPanel.nib/info.nib
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>IBDocumentLocation</key>
+ <string>109 47 356 240 0 0 1280 1002 </string>
+ <key>IBFramework Version</key>
+ <string>291.0</string>
+ <key>IBGroupedObjects</key>
+ <dict>
+ <key>10</key>
+ <array>
+ <string>22</string>
+ <string>27</string>
+ </array>
+ </dict>
+ <key>IBLastGroupID</key>
+ <string>11</string>
+ <key>IBOpenObjects</key>
+ <array>
+ <integer>19</integer>
+ </array>
+ <key>IBSystem Version</key>
+ <string>6L60</string>
+</dict>
+</plist>
View
BIN khord/PTHotKeysLib/res/Japanese.lproj/PTKeyComboPanel.nib/objects.nib
Binary file not shown.
View
BIN khord/PTHotKeysLib/res/PTKeyboardIcon.tiff
Binary file not shown.
View
41 khord/PTHotKeysLib/src/PTHotKey.h
@@ -0,0 +1,41 @@
+//
+// PTHotKey.h
+// Protein
+//
+// Created by Quentin Carnicelli on Sat Aug 02 2003.
+// Copyright (c) 2003 Quentin D. Carnicelli. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+
+#import "PTKeyCombo.h"
+
+@interface PTHotKey : NSObject
+{
+ NSString* mIdentifier;
+ NSString* mName;
+ PTKeyCombo* mKeyCombo;
+ id mTarget;
+ SEL mAction;
+}
+
+- (id)initWithIdentifier: (id)identifier keyCombo: (PTKeyCombo*)combo;
+- (id)init;
+
+- (void)setIdentifier: (id)ident;
+- (id)identifier;
+
+- (void)setName: (NSString*)name;
+- (NSString*)name;
+
+- (void)setKeyCombo: (PTKeyCombo*)combo;
+- (PTKeyCombo*)keyCombo;
+
+- (void)setTarget: (id)target;
+- (id)target;
+- (void)setAction: (SEL)action;
+- (SEL)action;
+
+- (void)invoke;
+
+@end
View
115 khord/PTHotKeysLib/src/PTHotKey.m
@@ -0,0 +1,115 @@
+//
+// PTHotKey.m
+// Protein
+//
+// Created by Quentin Carnicelli on Sat Aug 02 2003.
+// Copyright (c) 2003 Quentin D. Carnicelli. All rights reserved.
+//
+
+#import "PTHotKey.h"
+
+#import "PTHotKeyCenter.h"
+#import "PTKeyCombo.h"
+
+@implementation PTHotKey
+
+- (id)init
+{
+ return [self initWithIdentifier: nil keyCombo: nil];
+}
+
+
+- (id)initWithIdentifier: (id)identifier keyCombo: (PTKeyCombo*)combo
+{
+ self = [super init];
+
+ if( self )
+ {
+ [self setIdentifier: identifier];
+ [self setKeyCombo: combo];
+ }
+
+ return self;
+}
+
+- (void)dealloc
+{
+ [mIdentifier release];
+ [mName release];
+ [mKeyCombo release];
+
+ [super dealloc];
+}
+
+- (NSString*)description
+{
+ return [NSString stringWithFormat: @"<%@: %@, %@>", NSStringFromClass( [self class] ), [self identifier], [self keyCombo]];
+}
+
+#pragma mark -
+
+- (void)setIdentifier: (id)ident
+{
+ [ident retain];
+ [mIdentifier release];
+ mIdentifier = ident;
+}
+
+- (id)identifier
+{
+ return mIdentifier;
+}
+
+- (void)setKeyCombo: (PTKeyCombo*)combo
+{
+ if( combo == nil )
+ combo = [PTKeyCombo clearKeyCombo];
+
+ [combo retain];
+ [mKeyCombo release];
+ mKeyCombo = combo;
+}
+
+- (PTKeyCombo*)keyCombo
+{
+ return mKeyCombo;
+}
+
+- (void)setName: (NSString*)name
+{
+ [name retain];
+ [mName release];
+ mName = name;
+}
+
+- (NSString*)name
+{
+ return mName;
+}
+
+- (void)setTarget: (id)target
+{
+ mTarget = target;
+}
+
+- (id)target
+{
+ return mTarget;
+}
+
+- (void)setAction: (SEL)action
+{
+ mAction = action;
+}
+
+- (SEL)action
+{
+ return mAction;
+}
+
+- (void)invoke
+{
+ [mTarget performSelector: mAction withObject: self];
+}
+
+@end
View
33 khord/PTHotKeysLib/src/PTHotKeyCenter.h
@@ -0,0 +1,33 @@
+//
+// PTHotKeyCenter.h
+// Protein
+//
+// Created by Quentin Carnicelli on Sat Aug 02 2003.
+// Copyright (c) 2003 Quentin D. Carnicelli. All rights reserved.
+//
+// Contributers:
+// Quentin D. Carnicelli
+// Finlay Dobbie
+// Vincent Pottier
+
+#import <AppKit/AppKit.h>
+
+@class PTHotKey;
+
+@interface PTHotKeyCenter : NSObject
+{
+ NSMutableDictionary* mHotKeys; //Keys are NSValue of EventHotKeyRef
+ BOOL mEventHandlerInstalled;
+}
+
++ (PTHotKeyCenter*)sharedCenter;
+
+- (BOOL)registerHotKey: (PTHotKey*)hotKey;
+- (void)unregisterHotKey: (PTHotKey*)hotKey;
+
+- (NSArray*)allHotKeys;
+- (PTHotKey*)hotKeyWithIdentifier: (id)ident;
+
+- (void)sendEvent: (NSEvent*)event;
+
+@end
View
284 khord/PTHotKeysLib/src/PTHotKeyCenter.m
@@ -0,0 +1,284 @@
+//
+// PTHotKeyCenter.m
+// Protein
+//
+// Created by Quentin Carnicelli on Sat Aug 02 2003.
+// Copyright (c) 2003 Quentin D. Carnicelli. All rights reserved.
+//
+
+#import "PTHotKeyCenter.h"
+#import "PTHotKey.h"
+#import "PTKeyCombo.h"
+#import <Carbon/Carbon.h>
+
+#if __PROTEIN__
+#import "PTNSObjectAdditions.h"
+#endif
+
+@interface PTHotKeyCenter (Private)
+- (BOOL)_hasCarbonEventSupport;
+
+- (PTHotKey*)_hotKeyForCarbonHotKey: (EventHotKeyRef)carbonHotKey;
+- (EventHotKeyRef)_carbonHotKeyForHotKey: (PTHotKey*)hotKey;
+
+- (void)_updateEventHandler;
+- (void)_hotKeyDown: (PTHotKey*)hotKey;
+- (void)_hotKeyUp: (PTHotKey*)hotKey;
+static OSStatus hotKeyEventHandler(EventHandlerCallRef inHandlerRef, EventRef inEvent, void* refCon );
+@end
+
+@implementation PTHotKeyCenter
+
+static PTHotKeyCenter* _sharedHotKeyCenter = nil;
+
++ (PTHotKeyCenter*)sharedCenter
+{
+ if( _sharedHotKeyCenter == nil )
+ {
+ _sharedHotKeyCenter = [[self alloc] init];
+ #if __PROTEIN__
+ [_sharedHotKeyCenter releaseOnTerminate];
+ #endif
+ }
+
+ return _sharedHotKeyCenter;
+}
+
+- (id)init
+{
+ self = [super init];
+
+ if( self )
+ {
+ mHotKeys = [[NSMutableDictionary alloc] init];
+ }
+
+ return self;
+}
+
+- (void)dealloc
+{
+ [mHotKeys release];
+ [super dealloc];
+}
+
+#pragma mark -
+
+- (BOOL)registerHotKey: (PTHotKey*)hotKey
+{
+ OSStatus err;
+ EventHotKeyID hotKeyID;
+ EventHotKeyRef carbonHotKey;
+ NSValue* key;
+
+ if( [[self allHotKeys] containsObject: hotKey] == YES )
+ [self unregisterHotKey: hotKey];
+
+ if( [[hotKey keyCombo] isValidHotKeyCombo] == NO )
+ return YES;
+
+ hotKeyID.signature = 'PTHk';
+ hotKeyID.id = (long)hotKey;
+
+ err = RegisterEventHotKey( [[hotKey keyCombo] keyCode],
+ [[hotKey keyCombo] modifiers],
+ hotKeyID,
+ GetEventDispatcherTarget(),
+ 0,
+ &carbonHotKey );
+
+ if( err )
+ return NO;
+
+ key = [NSValue valueWithPointer: carbonHotKey];
+ if( hotKey && key )
+ [mHotKeys setObject: hotKey forKey: key];
+
+ [self _updateEventHandler];
+
+ return YES;
+}
+
+- (void)unregisterHotKey: (PTHotKey*)hotKey
+{
+ OSStatus err;
+ EventHotKeyRef carbonHotKey;
+ NSValue* key;
+
+ if( [[self allHotKeys] containsObject: hotKey] == NO )
+ return;
+
+ carbonHotKey = [self _carbonHotKeyForHotKey: hotKey];
+ NSAssert( carbonHotKey != nil, @"" );
+
+ err = UnregisterEventHotKey( carbonHotKey );
+ //Watch as we ignore 'err':
+
+ key = [NSValue valueWithPointer: carbonHotKey];
+ [mHotKeys removeObjectForKey: key];
+
+ [self _updateEventHandler];
+
+ //See that? Completely ignored
+}
+
+- (NSArray*)allHotKeys
+{
+ return [mHotKeys allValues];
+}
+
+- (PTHotKey*)hotKeyWithIdentifier: (id)ident
+{
+ NSEnumerator* hotKeysEnum = [[self allHotKeys] objectEnumerator];
+ PTHotKey* hotKey;
+
+ if( !ident )
+ return nil;
+
+ while( (hotKey = [hotKeysEnum nextObject]) != nil )
+ {
+ if( [[hotKey identifier] isEqual: ident] )
+ return hotKey;
+ }
+
+ return nil;
+}
+
+#pragma mark -
+
+- (BOOL)_hasCarbonEventSupport
+{
+ return floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_1;
+}
+
+- (PTHotKey*)_hotKeyForCarbonHotKey: (EventHotKeyRef)carbonHotKey
+{
+ NSValue* key = [NSValue valueWithPointer: carbonHotKey];
+ return [mHotKeys objectForKey: key];
+}
+
+- (EventHotKeyRef)_carbonHotKeyForHotKey: (PTHotKey*)hotKey
+{
+ NSArray* values;
+ NSValue* value;
+
+ values = [mHotKeys allKeysForObject: hotKey];
+ NSAssert( [values count] == 1, @"Failed to find Carbon Hotkey for PTHotKey" );
+
+ value = [values lastObject];
+
+ return (EventHotKeyRef)[value pointerValue];
+}
+
+- (void)_updateEventHandler
+{
+ if( [self _hasCarbonEventSupport] == NO ) //Don't use event handler on these systems
+ return;
+
+ if( [mHotKeys count] && mEventHandlerInstalled == NO )
+ {
+ EventTypeSpec eventSpec[2] = {
+ { kEventClassKeyboard, kEventHotKeyPressed },
+ { kEventClassKeyboard, kEventHotKeyReleased }
+ };
+
+ InstallEventHandler( GetEventDispatcherTarget(),
+ (EventHandlerProcPtr)hotKeyEventHandler,
+ 2, eventSpec, nil, nil);
+
+ mEventHandlerInstalled = YES;
+ }
+}
+
+- (void)_hotKeyDown: (PTHotKey*)hotKey
+{
+ [hotKey invoke];
+}
+
+- (void)_hotKeyUp: (PTHotKey*)hotKey
+{
+}
+
+- (void)sendEvent: (NSEvent*)event
+{
+ long subType;
+ EventHotKeyRef carbonHotKey;
+
+ //We only have to intercept sendEvent to do hot keys on old system versions
+ if( [self _hasCarbonEventSupport] )
+ return;
+
+ if( [event type] == NSSystemDefined )
+ {
+ subType = [event subtype];
+
+ if( subType == 6 ) //6 is hot key down
+ {
+ carbonHotKey= (EventHotKeyRef)[event data1]; //data1 is our hot key ref
+ if( carbonHotKey != nil )
+ {
+ PTHotKey* hotKey = [self _hotKeyForCarbonHotKey: carbonHotKey];
+ [self _hotKeyDown: hotKey];
+ }
+ }
+ else if( subType == 9 ) //9 is hot key up
+ {
+ carbonHotKey= (EventHotKeyRef)[event data1];
+ if( carbonHotKey != nil )
+ {
+ PTHotKey* hotKey = [self _hotKeyForCarbonHotKey: carbonHotKey];
+ [self _hotKeyUp: hotKey];
+ }
+ }
+ }
+}
+
+- (OSStatus)sendCarbonEvent: (EventRef)event
+{
+ OSStatus err;
+ EventHotKeyID hotKeyID;
+ PTHotKey* hotKey;
+
+ NSAssert( [self _hasCarbonEventSupport], @"" );
+ NSAssert( GetEventClass( event ) == kEventClassKeyboard, @"Unknown event class" );
+
+ err = GetEventParameter( event,
+ kEventParamDirectObject,
+ typeEventHotKeyID,
+ nil,
+ sizeof(EventHotKeyID),
+ nil,
+ &hotKeyID );
+ if( err )
+ return err;
+
+
+ NSAssert( hotKeyID.signature == 'PTHk', @"Invalid hot key id" );
+ NSAssert( hotKeyID.id != 0, @"Invalid hot key id" );
+
+ hotKey = (PTHotKey*)hotKeyID.id;
+
+ switch( GetEventKind( event ) )
+ {
+ case kEventHotKeyPressed:
+ [self _hotKeyDown: hotKey];
+ break;
+
+ case kEventHotKeyReleased:
+ [self _hotKeyUp: hotKey];
+ break;
+
+ default:
+ NSAssert( 0, @"Unknown event kind" );
+ break;
+ }
+
+ return noErr;
+}
+
+static OSStatus hotKeyEventHandler(EventHandlerCallRef inHandlerRef, EventRef inEvent, void* refCon )
+{
+ return [[PTHotKeyCenter sharedCenter] sendCarbonEvent: inEvent];
+}
+
+@end
View
24 khord/PTHotKeysLib/src/PTKeyBroadcaster.h
@@ -0,0 +1,24 @@
+//
+// PTKeyBroadcaster.h
+// Protein
+//
+// Created by Quentin Carnicelli on Sun Aug 03 2003.
+// Copyright (c) 2003 Quentin D. Carnicelli. All rights reserved.
+//
+
+#import <AppKit/AppKit.h>
+#if __PROTEIN__
+#import "ProteinDefines.h"
+#else
+#define PROTEIN_EXPORT __private_extern__
+#endif
+
+@interface PTKeyBroadcaster : NSButton
+{
+}
+
++ (long)cocoaModifiersAsCarbonModifiers: (long)cocoaModifiers;
+
+@end
+
+PROTEIN_EXPORT NSString* PTKeyBroadcasterKeyEvent; //keys: keyCombo as PTKeyCombo
View
74 khord/PTHotKeysLib/src/PTKeyBroadcaster.m
@@ -0,0 +1,74 @@
+//
+// PTKeyBroadcaster.m
+// Protein
+//
+// Created by Quentin Carnicelli on Sun Aug 03 2003.
+// Copyright (c) 2003 Quentin D. Carnicelli. All rights reserved.
+//
+
+#import "PTKeyBroadcaster.h"
+#import "PTKeyCombo.h"
+#import <Carbon/Carbon.h>
+
+NSString* PTKeyBroadcasterKeyEvent = @"PTKeyBroadcasterKeyEvent";
+
+@implementation PTKeyBroadcaster
+
+- (void)_bcastKeyCode: (short)keyCode modifiers: (long)modifiers
+{
+ PTKeyCombo* keyCombo = [PTKeyCombo keyComboWithKeyCode: keyCode modifiers: modifiers];
+ NSDictionary* userInfo = [NSDictionary dictionaryWithObject: keyCombo forKey:@"keyCombo"];
+
+ [[NSNotificationCenter defaultCenter]
+ postNotificationName: PTKeyBroadcasterKeyEvent
+ object: self
+ userInfo: userInfo];
+}
+
+- (void)_bcastEvent: (NSEvent*)event
+{
+ short keyCode;
+ long modifiers;
+
+ keyCode = [event keyCode];
+ modifiers = [event modifierFlags];
+ modifiers = [[self class] cocoaModifiersAsCarbonModifiers: modifiers];
+
+ [self _bcastKeyCode: keyCode modifiers: modifiers];
+}
+
+- (void)keyDown: (NSEvent*)event
+{
+ [self _bcastEvent: event];
+}
+
+- (BOOL)performKeyEquivalent: (NSEvent*)event
+{
+ [self _bcastEvent: event];
+ return YES;
+}
+
++ (long)cocoaModifiersAsCarbonModifiers: (long)cocoaModifiers
+{
+ static long cocoaToCarbon[6][2] =
+ {
+ { NSCommandKeyMask, cmdKey},
+ { NSAlternateKeyMask, optionKey},
+ { NSControlKeyMask, controlKey},
+ { NSShiftKeyMask, shiftKey},
+ { NSFunctionKeyMask, rightControlKey},
+ //{ NSAlphaShiftKeyMask, alphaLock }, //Ignore this?
+ };
+
+ long carbonModifiers = 0;
+ int i;
+
+ for( i = 0 ; i < 6; i++ )
+ if( cocoaModifiers & cocoaToCarbon[i][0] )
+ carbonModifiers += cocoaToCarbon[i][1];
+
+ return carbonModifiers;
+}
+
+
+@end
View
29 khord/PTHotKeysLib/src/PTKeyCodeTranslator.h
@@ -0,0 +1,29 @@
+//
+// PTKeyCodeTranslator.h
+// Chercher
+//
+// Created by Finlay Dobbie on Sat Oct 11 2003.
+// Copyright (c) 2003 Cliché Software. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+#include <Carbon/Carbon.h>
+#include <CoreServices/CoreServices.h>
+
+@interface PTKeyCodeTranslator : NSObject
+{
+ TISInputSourceRef keyboardLayout;
+ const UCKeyboardLayout *uchrData;
+
+ UInt32 keyTranslateState;
+ UInt32 deadKeyState;
+}
+
++ (id)currentTranslator;
+
+- (id)initWithKeyboardLayout:(TISInputSourceRef)aLayout;
+- (NSString *)translateKeyCode:(short)keyCode;
+
+- (TISInputSourceRef)keyboardLayout;
+
+@end
View
60 khord/PTHotKeysLib/src/PTKeyCodeTranslator.m
@@ -0,0 +1,60 @@
+//
+// PTKeyCodeTranslator.m
+// Chercher
+//
+// Created by Finlay Dobbie on Sat Oct 11 2003.
+// Copyright (c) 2003 Cliché Software. All rights reserved.
+//
+
+#import "PTKeyCodeTranslator.h"
+
+
+@implementation PTKeyCodeTranslator
+
++ (id)currentTranslator
+{
+ static PTKeyCodeTranslator *current = nil;
+ TISInputSourceRef currentLayout = TISCopyCurrentKeyboardLayoutInputSource();
+
+ if (current == nil) {
+ current = [[PTKeyCodeTranslator alloc] initWithKeyboardLayout:currentLayout];
+ } else if ([current keyboardLayout] != currentLayout) {
+ [current release];
+ current = [[PTKeyCodeTranslator alloc] initWithKeyboardLayout:currentLayout];
+ }
+ return current;
+}
+
+- (id)initWithKeyboardLayout:(TISInputSourceRef)aLayout
+{
+ if ((self = [super init]) != nil) {
+
+ keyboardLayout = aLayout;
+ CFDataRef uchr = TISGetInputSourceProperty( keyboardLayout , kTISPropertyUnicodeKeyLayoutData );
+ uchrData = ( const UCKeyboardLayout* )CFDataGetBytePtr(uchr);
+
+ }
+
+ return self;
+}
+
+- (NSString *)translateKeyCode:(short)keyCode {
+ UniCharCount maxStringLength = 4, actualStringLength;
+ UniChar unicodeString[4];
+ OSStatus err;
+ err = UCKeyTranslate( uchrData, keyCode, kUCKeyActionDisplay, 0, LMGetKbdType(), kUCKeyTranslateNoDeadKeysBit, &deadKeyState, maxStringLength, &actualStringLength, unicodeString );
+ return [NSString stringWithCharacters:unicodeString length:1];
+}
+
+- (TISInputSourceRef)keyboardLayout {
+ return keyboardLayout;
+}
+
+- (NSString *)description {
+ NSString *kind = @"uchr";
+
+ NSString *layoutName = TISGetInputSourceProperty( keyboardLayout, kTISPropertyLocalizedName );
+ return [NSString stringWithFormat:@"PTKeyCodeTranslator layout=%@ (%@)", layoutName, kind];
+}
+
+@end
View
45 khord/PTHotKeysLib/src/PTKeyCombo.h
@@ -0,0 +1,45 @@
+//
+// PTKeyCombo.h
+// Protein
+//
+// Created by Quentin Carnicelli on Sat Aug 02 2003.
+// Copyright (c) 2003 Quentin D. Carnicelli. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+
+#if __PROTEIN__
+#else
+#define _PTLocalizedString NSLocalizedString
+#endif
+
+@interface PTKeyCombo : NSObject <NSCopying>
+{
+ int mKeyCode;
+ int mModifiers;
+}
+
++ (id)clearKeyCombo;
++ (id)keyComboWithKeyCode: (int)keyCode modifiers: (int)modifiers;
+- (id)initWithKeyCode: (int)keyCode modifiers: (int)modifiers;
+
+- (id)initWithPlistRepresentation: (id)plist;
+- (id)plistRepresentation;
+
+- (BOOL)isEqual: (PTKeyCombo*)combo;
+
+- (int)keyCode;
+- (int)modifiers;
+
+- (BOOL)isClearCombo;
+- (BOOL)isValidHotKeyCombo;
+
+@end
+
+@interface PTKeyCombo (UserDisplayAdditions)
+
+- (NSString*)description;
+- (NSString*)keyCodeString;
+- (NSUInteger)modifierMask;
+
+@end
View
261 khord/PTHotKeysLib/src/PTKeyCombo.m
@@ -0,0 +1,261 @@
+//
+// PTKeyCombo.m
+// Protein
+//
+// Created by Quentin Carnicelli on Sat Aug 02 2003.
+// Copyright (c) 2003 Quentin D. Carnicelli. All rights reserved.
+//
+
+#import "PTKeyCombo.h"
+
+#import "PTKeyCodeTranslator.h"
+
+#import <Carbon/Carbon.h>
+
+@implementation PTKeyCombo
+
++ (id)clearKeyCombo
+{
+ return [self keyComboWithKeyCode: -1 modifiers: -1];
+}
+
++ (id)keyComboWithKeyCode: (int)keyCode modifiers: (int)modifiers
+{
+ return [[[self alloc] initWithKeyCode: keyCode modifiers: modifiers] autorelease];
+}
+
+- (id)initWithKeyCode: (int)keyCode modifiers: (int)modifiers
+{
+ self = [super init];
+
+ if( self )
+ {
+ mKeyCode = keyCode;
+ mModifiers = modifiers;
+ }
+
+ return self;
+}
+
+- (id)initWithPlistRepresentation: (id)plist
+{
+ int keyCode, modifiers;
+
+ if( !plist || ![plist count] )
+ {
+ keyCode = -1;
+ modifiers = -1;
+ }
+ else
+ {
+ keyCode = [[plist objectForKey: @"keyCode"] intValue];
+ if( keyCode <= 0 ) keyCode = -1;
+
+ modifiers = [[plist objectForKey: @"modifiers"] intValue];
+ if( modifiers <= 0 ) modifiers = -1;
+ }
+
+ return [self initWithKeyCode: keyCode modifiers: modifiers];
+}
+
+- (id)plistRepresentation
+{
+ return [NSDictionary dictionaryWithObjectsAndKeys:
+ [NSNumber numberWithInt: [self keyCode]], @"keyCode",
+ [NSNumber numberWithInt: [self modifiers]], @"modifiers",
+ nil];
+}
+
+- (id)copyWithZone:(NSZone*)zone;
+{
+ return [self retain];
+}
+
+- (BOOL)isEqual: (PTKeyCombo*)combo
+{
+ return [self keyCode] == [combo keyCode] &&
+ [self modifiers] == [combo modifiers];
+}
+
+#pragma mark -
+
+- (int)keyCode
+{
+ return mKeyCode;
+}
+
+- (int)modifiers
+{
+ return mModifiers;
+}
+
+- (BOOL)isValidHotKeyCombo
+{
+ return mKeyCode >= 0 && mModifiers > 0;
+}
+
+- (BOOL)isClearCombo
+{
+ return mKeyCode == -1 && mModifiers == -1;
+}
+
+@end
+
+#pragma mark -
+
+@implementation PTKeyCombo (UserDisplayAdditions)
+
++ (NSString*)_stringForModifiers: (long)modifiers
+{
+ static unichar modToChar[4][2] =
+ {
+ { cmdKey, kCommandUnicode },
+ { optionKey, kOptionUnicode },
+ { controlKey, kControlUnicode },
+ { shiftKey, kShiftUnicode }
+ };
+
+ NSString* str = [NSString string];
+ long i;
+
+ for( i = 0; i < 4; i++ )
+ {
+ if( modifiers & modToChar[i][0] )
+ str = [str stringByAppendingString: [NSString stringWithCharacters: &modToChar[i][1] length: 1]];
+ }
+
+ return str;
+}
+
++ (NSDictionary*)_keyCodesDictionary
+{
+ static NSDictionary* keyCodes = nil;
+
+ if( keyCodes == nil )
+ {
+ NSString* path;
+ NSString* contents;
+
+ path = [[NSBundle bundleForClass: self] pathForResource: @"PTKeyCodes" ofType: @"plist"];
+ contents = [NSString stringWithContentsOfFile: path];
+ keyCodes = [[contents propertyList] retain];
+ }
+
+ return keyCodes;
+}
+
++ (NSString*)_stringForKeyCode: (short)keyCode legacyKeyCodeMap: (NSDictionary*)dict
+{
+ id key;
+ NSString* str;
+
+ key = [NSString stringWithFormat: @"%d", keyCode];
+ str = [dict objectForKey: key];
+
+ if( !str )
+ str = [NSString stringWithFormat: @"%X", keyCode];
+
+ return str;
+}
+
++ (NSString*)_stringForKeyCode: (short)keyCode newKeyCodeMap: (NSDictionary*)dict
+{
+ NSString* result;
+ NSString* keyCodeStr;
+ NSDictionary* unmappedKeys;
+ NSArray* padKeys;
+
+ keyCodeStr = [NSString stringWithFormat: @"%d", keyCode];
+
+ //Handled if its not handled by translator
+ unmappedKeys = [dict objectForKey:@"unmappedKeys"];
+ result = [unmappedKeys objectForKey: keyCodeStr];
+ if( result )
+ return result;
+
+ //Translate it
+ result = [[[PTKeyCodeTranslator currentTranslator] translateKeyCode:keyCode] uppercaseString];
+
+ //Handle if its a key-pad key
+ padKeys = [dict objectForKey:@"padKeys"];
+ if( [padKeys indexOfObject: keyCodeStr] != NSNotFound )
+ {
+ result = [NSString stringWithFormat:@"%@ %@", [dict objectForKey:@"padKeyString"], result];
+ }
+
+ return result;
+}
+
++ (NSString*)_stringForKeyCode: (short)keyCode
+{
+ NSDictionary* dict;
+
+ dict = [self _keyCodesDictionary];
+ if( [[dict objectForKey: @"version"] intValue] <= 0 )
+ return [self _stringForKeyCode: keyCode legacyKeyCodeMap: dict];
+
+ return [self _stringForKeyCode: keyCode newKeyCodeMap: dict];
+}
+
+
+- (NSString*)keyCodeString
+{
+ // special case: the modifiers for the "clear" key are 0x0
+ if ( [self isClearCombo] ) return @"";
+
+ return [[self class] _stringForKeyCode:[self keyCode]];
+}
+
+- (NSUInteger)modifierMask
+{
+ // special case: the modifiers for the "clear" key are 0x0
+ if ( [self isClearCombo] ) return 0;
+
+ static NSUInteger modToChar[4][2] =
+ {
+ { cmdKey, NSCommandKeyMask },
+ { optionKey, NSAlternateKeyMask },
+ { controlKey, NSControlKeyMask },
+ { shiftKey, NSShiftKeyMask }
+ };
+
+ NSUInteger i, ret = 0;
+
+ for ( i = 0; i < 4; i++ )
+ {
+ if ( [self modifiers] & modToChar[i][0] ) {
+ ret |= modToChar[i][1];
+ }
+ }
+
+ return ret;
+}
+
+
+
+
+
+
+- (NSString*)description
+{
+ NSString* desc;
+
+ if( [self isValidHotKeyCombo] ) //This might have to change
+ {
+ desc = [NSString stringWithFormat: @"%@%@",
+ [[self class] _stringForModifiers: [self modifiers]],
+ [[self class] _stringForKeyCode: [self keyCode]]];
+ }
+ else
+ {
+ #if __PROTEIN__
+ desc = _PTLocalizedString( @"(None)", @"Hot Keys: Key Combo text for 'empty' combo" );
+ #else
+ desc = NSLocalizedString( @"(None)", @"Hot Keys: Key Combo text for 'empty' combo" );
+ #endif
+ }
+
+ return desc;
+}
+
+@end
View
44 khord/PTHotKeysLib/src/PTKeyComboPanel.h
@@ -0,0 +1,44 @@
+//
+// PTKeyComboPanel.h
+// Protein
+//
+// Created by Quentin Carnicelli on Sun Aug 03 2003.
+// Copyright (c) 2003 Quentin D. Carnicelli. All rights reserved.
+//
+
+#import <AppKit/AppKit.h>
+
+@class PTKeyBroadcaster;
+@class PTKeyCombo;
+@class PTHotKey;
+
+@interface PTKeyComboPanel : NSWindowController
+{
+ IBOutlet NSTextField* mTitleField;
+ IBOutlet NSTextField* mComboField;
+ IBOutlet PTKeyBroadcaster* mKeyBcaster;
+
+ NSString* mTitleFormat;
+ NSString* mKeyName;
+ PTKeyCombo* mKeyCombo;
+
+}
+
++ (PTKeyComboPanel*)sharedPanel;
+
+- (int)runModal;
+- (void)runModalForHotKey: (PTHotKey*)hotKey;
+
+- (void)runSheeetForModalWindow: (NSWindow*)wind target: (id)obj;
+ //Calls hotKeySheetDidEndWithReturnCode: (NSNumber*) on target object
+
+- (void)setKeyCombo: (PTKeyCombo*)combo;
+- (PTKeyCombo*)keyCombo;
+
+- (void)setKeyBindingName: (NSString*)name;
+- (NSString*)keyBindingName;
+
+- (IBAction)ok: (id)sender;
+- (IBAction)cancel: (id)sender;
+- (IBAction)clear: (id)sender;
+@end
View
203 khord/PTHotKeysLib/src/PTKeyComboPanel.m
@@ -0,0 +1,203 @@
+//
+// PTKeyComboPanel.m
+// Protein
+//
+// Created by Quentin Carnicelli on Sun Aug 03 2003.
+// Copyright (c) 2003 Quentin D. Carnicelli. All rights reserved.
+//
+
+#import "PTKeyComboPanel.h"
+
+#import "PTHotKey.h"
+#import "PTKeyCombo.h"
+#import "PTKeyBroadcaster.h"
+#import "PTHotKeyCenter.h"
+
+#if __PROTEIN__
+#import "PTNSObjectAdditions.h"
+#endif
+
+@implementation PTKeyComboPanel
+
+static PTKeyComboPanel* _sharedKeyComboPanel = nil;
+
++ (PTKeyComboPanel*)sharedPanel
+{
+ if( _sharedKeyComboPanel == nil )
+ {
+ //NSString *nibPath = [[NSBundle bundleForClass:self] pathForResource:@"PTKeyComboPanel" ofType:@"nib"];
+
+ _sharedKeyComboPanel = [[self alloc] init];
+
+ #if __PROTEIN__
+ [_sharedKeyComboPanel releaseOnTerminate];
+ #endif
+ }
+
+ return _sharedKeyComboPanel;
+}
+
+- (id)init
+{
+ return [self initWithWindowNibName: @"PTKeyComboPanel"];
+}
+
+- (void)dealloc
+{
+ [[NSNotificationCenter defaultCenter] removeObserver: self];
+ [mKeyName release];
+ [mTitleFormat release];
+
+ [super dealloc];
+}
+
+- (void)windowDidLoad
+{
+ [super windowDidLoad];
+
+ mTitleFormat = [[mTitleField stringValue] retain];
+
+ [[NSNotificationCenter defaultCenter]
+ addObserver: self
+ selector: @selector( noteKeyBroadcast: )
+ name: PTKeyBroadcasterKeyEvent
+ object: mKeyBcaster];
+}
+
+- (void)_refreshContents
+{
+ if( mComboField )
+ [mComboField setStringValue: [mKeyCombo description]];
+
+ if( mTitleField )
+ [mTitleField setStringValue: [NSString stringWithFormat: mTitleFormat, mKeyName]];
+}
+
+#pragma mark -
+
+- (int)runModal
+{
+ int resultCode;
+
+ [self window]; //Force us to load
+
+ [self _refreshContents];
+ [[self window] center];
+ [self showWindow: self];
+ resultCode = [[NSApplication sharedApplication] runModalForWindow: [self window]];
+ [self close];
+
+ return resultCode;
+}
+
+- (void)runModalForHotKey: (PTHotKey*)hotKey
+{
+ int resultCode;
+
+ [self setKeyBindingName: [hotKey name]];
+ [self setKeyCombo: [hotKey keyCombo]];
+
+ resultCode = [self runModal];
+
+ if( resultCode == NSOKButton )
+ {
+ [hotKey setKeyCombo: [self keyCombo]];
+ [[PTHotKeyCenter sharedCenter] registerHotKey: hotKey];
+ }
+}
+
+#pragma mark -
+
+- (void)_sheetDidEnd:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo
+{
+ id delegate = (id)contextInfo;
+
+ [sheet orderOut: nil];
+ [self close];
+
+ if( delegate )
+ {
+ NSNumber* returnObj = [NSNumber numberWithInt: returnCode];
+ [delegate performSelector: @selector( hotKeySheetDidEndWithReturnCode: ) withObject: returnObj];
+ [delegate release];
+ }
+}
+
+- (void)runSheeetForModalWindow: (NSWindow*)wind target: (id)obj
+{
+ [[self window] center]; //Force us to load
+ [self _refreshContents];
+
+ [[NSApplication sharedApplication] beginSheet: [self window]
+ modalForWindow: wind
+ modalDelegate: self
+ didEndSelector: @selector(_sheetDidEnd:returnCode:contextInfo:)
+ contextInfo: [obj retain]];
+}
+
+#pragma mark -
+
+- (void)setKeyCombo: (PTKeyCombo*)combo
+{
+ [combo retain];
+ [mKeyCombo release];
+ mKeyCombo = combo;
+ [self _refreshContents];
+}
+
+- (PTKeyCombo*)keyCombo
+{
+ return mKeyCombo;
+}
+
+- (void)setKeyBindingName: (NSString*)name
+{
+ [name retain];
+ [mKeyName release];
+ mKeyName = name;
+ [self _refreshContents];
+}
+
+- (NSString*)keyBindingName
+{
+ return mKeyName;
+}
+
+#pragma mark -
+
+- (IBAction)ok: (id)sender
+{
+ if( [[self window] isSheet] )
+ [[NSApplication sharedApplication] endSheet: [self window] returnCode: NSOKButton];
+ else
+ [[NSApplication sharedApplication] stopModalWithCode: NSOKButton];
+}
+
+- (IBAction)cancel: (id)sender
+{
+ if( [[self window] isSheet] )
+ [[NSApplication sharedApplication] endSheet: [self window] returnCode: NSCancelButton];
+ else
+ [[NSApplication sharedApplication] stopModalWithCode: NSCancelButton];
+}
+
+- (IBAction)clear: (id)sender
+{
+ [self setKeyCombo: [PTKeyCombo clearKeyCombo]];
+
+ if( [[self window] isSheet] )
+ [[NSApplication sharedApplication] endSheet: [self window] returnCode: NSOKButton];
+ else
+ [[NSApplication sharedApplication] stopModalWithCode: NSOKButton];
+}
+
+- (void)noteKeyBroadcast: (NSNotification*)note
+{
+ PTKeyCombo* keyCombo;
+
+ keyCombo = [[note userInfo] objectForKey: @"keyCombo"];
+
+ [self setKeyCombo: keyCombo];
+}
+
+@end
View
395 khord/khord.xcodeproj/project.pbxproj
@@ -0,0 +1,395 @@
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 45;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ 1DDD58160DA1D0A300B32029 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1DDD58140DA1D0A300B32029 /* MainMenu.xib */; };
+ 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; };
+ 8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; };
+ 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; };
+ CCBC88BB0E465A2D0083B197 /* PTKeyCodes.plist in Resources */ = {isa = PBXBuildFile; fileRef = CCBC88A30E465A2D0083B197 /* PTKeyCodes.plist */; };
+ CCBC88BC0E465A2D0083B197 /* PTKeyComboPanel.nib in Resources */ = {isa = PBXBuildFile; fileRef = CCBC88A50E465A2D0083B197 /* PTKeyComboPanel.nib */; };
+ CCBC88BD0E465A2D0083B197 /* PTKeyboardIcon.tiff in Resources */ = {isa = PBXBuildFile; fileRef = CCBC88AD0E465A2D0083B197 /* PTKeyboardIcon.tiff */; };
+ CCBC88BE0E465A2D0083B197 /* PTHotKey.m in Sources */ = {isa = PBXBuildFile; fileRef = CCBC88B00E465A2D0083B197 /* PTHotKey.m */; };
+ CCBC88BF0E465A2D0083B197 /* PTHotKeyCenter.m in Sources */ = {isa = PBXBuildFile; fileRef = CCBC88B20E465A2D0083B197 /* PTHotKeyCenter.m */; };
+ CCBC88C00E465A2D0083B197 /* PTKeyBroadcaster.m in Sources */ = {isa = PBXBuildFile; fileRef = CCBC88B40E465A2D0083B197 /* PTKeyBroadcaster.m */; };
+ CCBC88C10E465A2D0083B197 /* PTKeyCodeTranslator.m in Sources */ = {isa = PBXBuildFile; fileRef = CCBC88B60E465A2D0083B197 /* PTKeyCodeTranslator.m */; };
+ CCBC88C20E465A2D0083B197 /* PTKeyCombo.m in Sources */ = {isa = PBXBuildFile; fileRef = CCBC88B80E465A2D0083B197 /* PTKeyCombo.m */; };
+ CCBC88C30E465A2D0083B197 /* PTKeyComboPanel.m in Sources */ = {isa = PBXBuildFile; fileRef = CCBC88BA0E465A2D0083B197 /* PTKeyComboPanel.m */; };
+ CCBC88C90E465A430083B197 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CCBC88C80E465A430083B197 /* Carbon.framework */; };
+ CCBC89940E465ACD0083B197 /* KHAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = CCBC89930E465ACD0083B197 /* KHAppDelegate.m */; };
+ CCBC8A060E46609E0083B197 /* KHKeyCatcherView.m in Sources */ = {isa = PBXBuildFile; fileRef = CCBC8A050E46609E0083B197 /* KHKeyCatcherView.m */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXFileReference section */
+ 089C165DFE840E0CC02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
+ 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
+ 13E42FB307B3F0F600E4EEF1 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = "<absolute>"; };
+ 1DDD58150DA1D0A300B32029 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/MainMenu.xib; sourceTree = "<group>"; };
+ 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
+ 29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; };
+ 29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
+ 32CA4F630368D1EE00C91783 /* khord_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = khord_Prefix.pch; sourceTree = "<group>"; };
+ 8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
+ 8D1107320486CEB800E47090 /* Khord.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Khord.app; sourceTree = BUILT_PRODUCTS_DIR; };
+ CCBC88A40E465A2D0083B197 /* English */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = English; path = English.lproj/PTKeyCodes.plist; sourceTree = "<group>"; };
+ CCBC88A60E465A2D0083B197 /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/PTKeyComboPanel.nib; sourceTree = "<group>"; };
+ CCBC88A70E465A2D0083B197 /* French */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; name = French; path = French.lproj/PTKeyCodes.plist; sourceTree = "<group>"; };
+ CCBC88A80E465A2D0083B197 /* French */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = French; path = French.lproj/PTKeyComboPanel.nib; sourceTree = "<group>"; };
+ CCBC88A90E465A2D0083B197 /* German */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; name = German; path = German.lproj/PTKeyCodes.plist; sourceTree = "<group>"; };
+ CCBC88AA0E465A2D0083B197 /* German */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = German; path = German.lproj/PTKeyComboPanel.nib; sourceTree = "<group>"; };
+ CCBC88AB0E465A2D0083B197 /* Japanese */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; name = Japanese; path = Japanese.lproj/PTKeyCodes.plist; sourceTree = "<group>"; };
+ CCBC88AC0E465A2D0083B197 /* Japanese */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = Japanese; path = Japanese.lproj/PTKeyComboPanel.nib; sourceTree = "<group>"; };
+ CCBC88AD0E465A2D0083B197 /* PTKeyboardIcon.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = PTKeyboardIcon.tiff; sourceTree = "<group>"; };
+ CCBC88AF0E465A2D0083B197 /* PTHotKey.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PTHotKey.h; sourceTree = "<group>"; };
+ CCBC88B00E465A2D0083B197 /* PTHotKey.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PTHotKey.m; sourceTree = "<group>"; };
+ CCBC88B10E465A2D0083B197 /* PTHotKeyCenter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PTHotKeyCenter.h; sourceTree = "<group>"; };
+ CCBC88B20E465A2D0083B197 /* PTHotKeyCenter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PTHotKeyCenter.m; sourceTree = "<group>"; };
+ CCBC88B30E465A2D0083B197 /* PTKeyBroadcaster.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PTKeyBroadcaster.h; sourceTree = "<group>"; };
+ CCBC88B40E465A2D0083B197 /* PTKeyBroadcaster.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PTKeyBroadcaster.m; sourceTree = "<group>"; };
+ CCBC88B50E465A2D0083B197 /* PTKeyCodeTranslator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PTKeyCodeTranslator.h; sourceTree = "<group>"; };
+ CCBC88B60E465A2D0083B197 /* PTKeyCodeTranslator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PTKeyCodeTranslator.m; sourceTree = "<group>"; };
+ CCBC88B70E465A2D0083B197 /* PTKeyCombo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PTKeyCombo.h; sourceTree = "<group>"; };
+ CCBC88B80E465A2D0083B197 /* PTKeyCombo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PTKeyCombo.m; sourceTree = "<group>"; };
+ CCBC88B90E465A2D0083B197 /* PTKeyComboPanel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PTKeyComboPanel.h; sourceTree = "<group>"; };
+ CCBC88BA0E465A2D0083B197 /* PTKeyComboPanel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PTKeyComboPanel.m; sourceTree = "<group>"; };
+ CCBC88C80E465A430083B197 /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /System/Library/Frameworks/Carbon.framework; sourceTree = "<absolute>"; };
+ CCBC89920E465ACD0083B197 /* KHAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = KHAppDelegate.h; path = src/KHAppDelegate.h; sourceTree = "<group>"; };
+ CCBC89930E465ACD0083B197 /* KHAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = KHAppDelegate.m; path = src/KHAppDelegate.m; sourceTree = "<group>"; };
+ CCBC8A040E46609E0083B197 /* KHKeyCatcherView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = KHKeyCatcherView.h; path = src/KHKeyCatcherView.h; sourceTree = "<group>"; };
+ CCBC8A050E46609E0083B197 /* KHKeyCatcherView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = KHKeyCatcherView.m; path = src/KHKeyCatcherView.m; sourceTree = "<group>"; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ 8D11072E0486CEB800E47090 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */,
+ CCBC88C90E465A430083B197 /* Carbon.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ 080E96DDFE201D6D7F000001 /* Classes */ = {
+ isa = PBXGroup;
+ children = (
+ CCBC89920E465ACD0083B197 /* KHAppDelegate.h */,
+ CCBC89930E465ACD0083B197 /* KHAppDelegate.m */,
+ CCBC8A040E46609E0083B197 /* KHKeyCatcherView.h */,
+ CCBC8A050E46609E0083B197 /* KHKeyCatcherView.m */,
+ );
+ name = Classes;
+ sourceTree = "<group>";
+ };
+ 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */ = {
+ isa = PBXGroup;
+ children = (
+ CCBC88C80E465A430083B197 /* Carbon.framework */,
+ 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */,
+ );
+ name = "Linked Frameworks";
+ sourceTree = "<group>";
+ };
+ 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */ = {
+ isa = PBXGroup;
+ children = (
+ 29B97324FDCFA39411CA2CEA /* AppKit.framework */,
+ 13E42FB307B3F0F600E4EEF1 /* CoreData.framework */,
+ 29B97325FDCFA39411CA2CEA /* Foundation.framework */,
+ );
+ name = "Other Frameworks";
+ sourceTree = "<group>";
+ };
+ 19C28FACFE9D520D11CA2CBB /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 8D1107320486CEB800E47090 /* Khord.app */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+ 29B97314FDCFA39411CA2CEA /* khord */ = {
+ isa = PBXGroup;
+ children = (
+ CCBC88A10E465A2D0083B197 /* PTHotKeysLib */,
+ 080E96DDFE201D6D7F000001 /* Classes */,
+ 29B97315FDCFA39411CA2CEA /* Other Sources */,
+ 29B97317FDCFA39411CA2CEA /* Resources */,
+ 29B97323FDCFA39411CA2CEA /* Frameworks */,
+ 19C28FACFE9D520D11CA2CBB /* Products */,
+ );
+ name = khord;
+ sourceTree = "<group>";
+ };
+ 29B97315FDCFA39411CA2CEA /* Other Sources */ = {
+ isa = PBXGroup;
+ children = (
+ 32CA4F630368D1EE00C91783 /* khord_Prefix.pch */,
+ 29B97316FDCFA39411CA2CEA /* main.m */,
+ );
+ name = "Other Sources";
+ sourceTree = "<group>";
+ };
+ 29B97317FDCFA39411CA2CEA /* Resources */ = {
+ isa = PBXGroup;
+ children = (
+ 8D1107310486CEB800E47090 /* Info.plist */,
+ 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */,
+ 1DDD58140DA1D0A300B32029 /* MainMenu.xib */,
+ );
+ name = Resources;
+ sourceTree = "<group>";
+ };
+ 29B97323FDCFA39411CA2CEA /* Frameworks */ = {
+ isa = PBXGroup;
+ children = (
+ 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */,
+ 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */,
+ );
+ name = Frameworks;
+ sourceTree = "<group>";
+ };
+ CCBC88A10E465A2D0083B197 /* PTHotKeysLib */ = {
+ isa = PBXGroup;
+ children = (
+ CCBC88A20E465A2D0083B197 /* res */,
+ CCBC88AE0E465A2D0083B197 /* src */,
+ );
+ path = PTHotKeysLib;
+ sourceTree = "<group>";
+ };
+ CCBC88A20E465A2D0083B197 /* res */ = {
+ isa = PBXGroup;
+ children = (
+ CCBC88A30E465A2D0083B197 /* PTKeyCodes.plist */,
+ CCBC88A50E465A2D0083B197 /* PTKeyComboPanel.nib */,
+ CCBC88AD0E465A2D0083B197 /* PTKeyboardIcon.tiff */,
+ );
+ path = res;
+ sourceTree = "<group>";
+ };
+ CCBC88AE0E465A2D0083B197 /* src */ = {
+ isa = PBXGroup;
+ children = (
+ CCBC88AF0E465A2D0083B197 /* PTHotKey.h */,
+ CCBC88B00E465A2D0083B197 /* PTHotKey.m */,
+ CCBC88B10E465A2D0083B197 /* PTHotKeyCenter.h */,
+ CCBC88B20E465A2D0083B197 /* PTHotKeyCenter.m */,
+ CCBC88B30E465A2D0083B197 /* PTKeyBroadcaster.h */,
+ CCBC88B40E465A2D0083B197 /* PTKeyBroadcaster.m */,
+ CCBC88B50E465A2D0083B197 /* PTKeyCodeTranslator.h */,
+ CCBC88B60E465A2D0083B197 /* PTKeyCodeTranslator.m */,
+ CCBC88B70E465A2D0083B197 /* PTKeyCombo.h */,
+ CCBC88B80E465A2D0083B197 /* PTKeyCombo.m */,
+ CCBC88B90E465A2D0083B197 /* PTKeyComboPanel.h */,
+ CCBC88BA0E465A2D0083B197 /* PTKeyComboPanel.m */,
+ );
+ path = src;
+ sourceTree = "<group>";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+ 8D1107260486CEB800E47090 /* Khord */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "Khord" */;
+ buildPhases = (
+ 8D1107290486CEB800E47090 /* Resources */,
+ 8D11072C0486CEB800E47090 /* Sources */,
+ 8D11072E0486CEB800E47090 /* Frameworks */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = Khord;
+ productInstallPath = "$(HOME)/Applications";
+ productName = khord;
+ productReference = 8D1107320486CEB800E47090 /* Khord.app */;
+ productType = "com.apple.product-type.application";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ 29B97313FDCFA39411CA2CEA /* Project object */ = {
+ isa = PBXProject;
+ buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "khord" */;
+ compatibilityVersion = "Xcode 3.1";
+ hasScannedForEncodings = 1;
+ mainGroup = 29B97314FDCFA39411CA2CEA /* khord */;
+ projectDirPath = "";
+ projectRoot = "";
+ targets = (
+ 8D1107260486CEB800E47090 /* Khord */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXResourcesBuildPhase section */
+ 8D1107290486CEB800E47090 /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */,
+ 1DDD58160DA1D0A300B32029 /* MainMenu.xib in Resources */,
+ CCBC88BB0E465A2D0083B197 /* PTKeyCodes.plist in Resources */,
+ CCBC88BC0E465A2D0083B197 /* PTKeyComboPanel.nib in Resources */,
+ CCBC88BD0E465A2D0083B197 /* PTKeyboardIcon.tiff in Resources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+ 8D11072C0486CEB800E47090 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 8D11072D0486CEB800E47090 /* main.m in Sources */,
+ CCBC88BE0E465A2D0083B197 /* PTHotKey.m in Sources */,
+ CCBC88BF0E465A2D0083B197 /* PTHotKeyCenter.m in Sources */,
+ CCBC88C00E465A2D0083B197 /* PTKeyBroadcaster.m in Sources */,
+ CCBC88C10E465A2D0083B197 /* PTKeyCodeTranslator.m in Sources */,
+ CCBC88C20E465A2D0083B197 /* PTKeyCombo.m in Sources */,
+ CCBC88C30E465A2D0083B197 /* PTKeyComboPanel.m in Sources */,
+ CCBC89940E465ACD0083B197 /* KHAppDelegate.m in Sources */,
+ CCBC8A060E46609E0083B197 /* KHKeyCatcherView.m in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXVariantGroup section */
+ 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 089C165DFE840E0CC02AAC07 /* English */,
+ );
+ name = InfoPlist.strings;
+ sourceTree = "<group>";
+ };
+ 1DDD58140DA1D0A300B32029 /* MainMenu.xib */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 1DDD58150DA1D0A300B32029 /* English */,
+ );
+ name = MainMenu.xib;
+ sourceTree = "<group>";
+ };
+ CCBC88A30E465A2D0083B197 /* PTKeyCodes.plist */ = {
+ isa = PBXVariantGroup;
+ children = (
+ CCBC88A40E465A2D0083B197 /* English */,
+ CCBC88A70E465A2D0083B197 /* French */,
+ CCBC88A90E465A2D0083B197 /* German */,
+ CCBC88AB0E465A2D0083B197 /* Japanese */,
+ );
+ name = PTKeyCodes.plist;
+ sourceTree = "<group>";
+ };
+ CCBC88A50E465A2D0083B197 /* PTKeyComboPanel.nib */ = {
+ isa = PBXVariantGroup;
+ children = (
+ CCBC88A60E465A2D0083B197 /* English */,
+ CCBC88A80E465A2D0083B197 /* French */,
+ CCBC88AA0E465A2D0083B197 /* German */,
+ CCBC88AC0E465A2D0083B197 /* Japanese */,
+ );
+ name = PTKeyComboPanel.nib;
+ sourceTree = "<group>";
+ };
+/* End PBXVariantGroup section */
+
+/* Begin XCBuildConfiguration section */
+ C01FCF4B08A954540054247B /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ ARCHS = "$(NATIVE_ARCH)";
+ COPY_PHASE_STRIP = NO;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_ENABLE_FIX_AND_CONTINUE = YES;
+ GCC_MODEL_TUNING = G5;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = khord_Prefix.pch;
+ INFOPLIST_FILE = Info.plist;
+ INSTALL_PATH = "$(HOME)/Applications";
+ OTHER_CFLAGS = "-DDEBUG";
+ PRODUCT_NAME = Khord;
+ };
+ name = Debug;
+ };
+ C01FCF4C08A954540054247B /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+ GCC_MODEL_TUNING = G5;
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = khord_Prefix.pch;
+ INFOPLIST_FILE = Info.plist;
+ INSTALL_PATH = "$(HOME)/Applications";
+ PRODUCT_NAME = Khord;
+ };
+ name = Release;
+ };
+ C01FCF4F08A954540054247B /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+ GCC_C_LANGUAGE_STANDARD = c99;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ ONLY_ACTIVE_ARCH = YES;
+ PREBINDING = NO;
+ SDKROOT = macosx10.5;
+ };
+ name = Debug;
+ };
+ C01FCF5008A954540054247B /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+ GCC_C_LANGUAGE_STANDARD = c99;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ PREBINDING = NO;
+ SDKROOT = macosx10.5;
+ };
+ name = Release;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "Khord" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ C01FCF4B08A954540054247B /* Debug */,
+ C01FCF4C08A954540054247B /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ C01FCF4E08A954540054247B /* Build configuration list for PBXProject "khord" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ C01FCF4F08A954540054247B /* Debug */,
+ C01FCF5008A954540054247B /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = 29B97313FDCFA39411CA2CEA /* Project object */;
+}
View
16 khord/khord_Prefix.pch
@@ -0,0 +1,16 @@
+//
+// Prefix header for all source files of the 'khord' target in the 'khord' project
+//
+
+#ifdef __OBJC__
+ #import <Cocoa/Cocoa.h>
+#endif
+
+
+
+#ifdef DEBUG
+#define debug(...) NSLog(__VA_ARGS__)
+#else
+#define debug(...)
+#endif
+
View
14 khord/main.m
@@ -0,0 +1,14 @@
+//
+// main.m
+// khord
+//
+// Created by August Mueller on 8/3/08.
+// Copyright Flying Meat Inc 2008. All rights reserved.
+//
+
+#import <Cocoa/Cocoa.h>
+
+int main(int argc, char *argv[])
+{
+ return NSApplicationMain(argc, (const char **) argv);
+}
View
29 khord/src/KHAppDelegate.h
@@ -0,0 +1,29 @@
+//
+// KHAppDelegate.h
+// khord
+//
+// Created by August Mueller on 8/3/08.
+// Copyright 2008 Flying Meat Inc. All rights reserved.
+//
+
+#import <Cocoa/Cocoa.h>
+#import "PTKeyComboPanel.h"
+#import "PTHotKey.h"
+#import "PTHotKeyCenter.h"
+#import "KHKeyCatcherView.h"
+
+@interface KHAppDelegate : NSObject {
+ IBOutlet NSWindow *hotkeyWindow;
+ IBOutlet NSWindow *popupWindow;
+ IBOutlet NSTextField *hotkeyField;
+
+ IBOutlet KHKeyCatcherView *catcherView;
+
+ PTHotKey *_hotKey;
+}
+
+@property (retain) PTHotKey *hotKey;
+
+- (void) setHotkey:(id)sender;
+
+@end
View
80 khord/src/KHAppDelegate.m
@@ -0,0 +1,80 @@
+//
+// KHAppDelegate.m
+// khord
+//
+// Created by August Mueller on 8/3/08.
+// Copyright 2008 Flying Meat Inc. All rights reserved.
+//
+
+#import "KHAppDelegate.h"
+
+@implementation KHAppDelegate
+
+@synthesize hotKey=_hotKey;
+
+- (void)awakeFromNib {
+
+ id keyComboPlist;
+ PTKeyCombo* keyCombo = nil;
+
+ // Full Screen hot key
+ keyComboPlist = [[NSUserDefaults standardUserDefaults] objectForKey: @"KhordHotKey"];
+ keyCombo = [[[PTKeyCombo alloc] initWithPlistRepresentation: keyComboPlist] autorelease];
+
+ //Create our hot key
+ _hotKey = [[PTHotKey alloc] initWithIdentifier:@"KhordHotKey" keyCombo:keyCombo];
+ [_hotKey setName:@"Khord"]; //This is typically used by PTKeyComboPanel
+ [_hotKey setTarget:self];
+ [_hotKey setAction:@selector( hotKeyHit: ) ];
+ //Register it
+ [[PTHotKeyCenter sharedCenter] registerHotKey:_hotKey];
+
+
+
+ NSString *desc = [keyCombo description];
+ [hotkeyField setStringValue:desc];
+
+}
+
+
+- (void)hotKeySheetDidEndWithReturnCode: (NSNumber*)resultCode {
+
+ if ([resultCode intValue] == NSOKButton) {
+
+ //Update our hotkey with the new keycombo
+ [_hotKey setKeyCombo: [[PTKeyComboPanel sharedPanel] keyCombo]];
+
+ //Re-register it (required)
+ [[PTHotKeyCenter sharedCenter] registerHotKey: _hotKey];
+
+ [[NSUserDefaults standardUserDefaults] setObject: [[[PTKeyComboPanel sharedPanel] keyCombo] plistRepresentation] forKey: @"KhordHotKey"];
+
+
+ NSString *desc = [[_hotKey keyCombo] description];
+ [hotkeyField setStringValue:desc];
+ }
+}
+
+- (void) setHotkey:(id)sender {
+ debug(@"%s:%d", __FUNCTION__, __LINE__);
+