From cd7df2a3f35315e96a391aa555a7e82a651e5b2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=84=EC=88=98=EC=97=B4?= Date: Sat, 14 Sep 2013 01:18:04 +0900 Subject: [PATCH 01/11] Check update in background. --- .../xcshareddata/Allkdic.xccheckout | 41 + Allkdic/Allkdic-Info.plist | 4 +- Allkdic/AppDelegate.m | 2 +- Allkdic/Views/AboutWindow.xib | 2115 ++--------------- Allkdic/Views/AlldicContentView.xib | 837 +------ 5 files changed, 348 insertions(+), 2651 deletions(-) create mode 100644 Allkdic.xcodeproj/project.xcworkspace/xcshareddata/Allkdic.xccheckout diff --git a/Allkdic.xcodeproj/project.xcworkspace/xcshareddata/Allkdic.xccheckout b/Allkdic.xcodeproj/project.xcworkspace/xcshareddata/Allkdic.xccheckout new file mode 100644 index 0000000..73b1b73 --- /dev/null +++ b/Allkdic.xcodeproj/project.xcworkspace/xcshareddata/Allkdic.xccheckout @@ -0,0 +1,41 @@ + + + + + IDESourceControlProjectFavoriteDictionaryKey + + IDESourceControlProjectIdentifier + 7CFEC5D0-E6D1-46EE-B710-E7656A13BFC1 + IDESourceControlProjectName + Allkdic + IDESourceControlProjectOriginsDictionary + + 35B85E91-3C33-4BB1-9FC1-BE18E7D738ED + https://github.com/devxoul/Allkdic.git + + IDESourceControlProjectPath + Allkdic.xcodeproj/project.xcworkspace + IDESourceControlProjectRelativeInstallPathDictionary + + 35B85E91-3C33-4BB1-9FC1-BE18E7D738ED + ../.. + + IDESourceControlProjectURL + https://github.com/devxoul/Allkdic.git + IDESourceControlProjectVersion + 110 + IDESourceControlProjectWCCIdentifier + 35B85E91-3C33-4BB1-9FC1-BE18E7D738ED + IDESourceControlProjectWCConfigurations + + + IDESourceControlRepositoryExtensionIdentifierKey + public.vcs.git + IDESourceControlWCCIdentifierKey + 35B85E91-3C33-4BB1-9FC1-BE18E7D738ED + IDESourceControlWCCName + Allkdic + + + + diff --git a/Allkdic/Allkdic-Info.plist b/Allkdic/Allkdic-Info.plist index 96242c3..78d2e39 100644 --- a/Allkdic/Allkdic-Info.plist +++ b/Allkdic/Allkdic-Info.plist @@ -17,11 +17,11 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.0.2 + 1.0.1 CFBundleSignature ???? CFBundleVersion - 12 + 19 LSApplicationCategoryType public.app-category.utilities LSMinimumSystemVersion diff --git a/Allkdic/AppDelegate.m b/Allkdic/AppDelegate.m index 09b2d3b..4553fc0 100644 --- a/Allkdic/AppDelegate.m +++ b/Allkdic/AppDelegate.m @@ -37,7 +37,7 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification [LoginUtil setStartAtLoginEnabled:YES]; } - [[SUUpdater sharedUpdater] checkForUpdates:self]; + [[SUUpdater sharedUpdater] checkForUpdatesInBackground]; } diff --git a/Allkdic/Views/AboutWindow.xib b/Allkdic/Views/AboutWindow.xib index 154929c..039f76b 100644 --- a/Allkdic/Views/AboutWindow.xib +++ b/Allkdic/Views/AboutWindow.xib @@ -1,1897 +1,218 @@ - - - - 1080 - 12E55 - 3084 - 1187.39 - 626.00 - - com.apple.InterfaceBuilder.CocoaPlugin - 3084 - - - IBNSLayoutConstraint - NSButton - NSButtonCell - NSCustomObject - NSImageCell - NSImageView - NSTextField - NSTextFieldCell - NSView - NSWindowTemplate - - - com.apple.InterfaceBuilder.CocoaPlugin - - - PluginDependencyRecalculationVersion - - - - - AboutWindowController - - - FirstResponder - - - NSApplication - - - 3 - 2 - {{685, 224}, {310, 408}} - 1618478080 - 올ㅋ사전에 관하여 - NSWindow - - - - - 256 - - - - 268 - - Apple PDF pasteboard type - Apple PICT pasteboard type - Apple PNG pasteboard type - NSFilenamesPboardType - NeXT Encapsulated PostScript v1.2 pasteboard type - NeXT TIFF v4.0 pasteboard type - - {{112, 288}, {87, 87}} - - - - _NS:9 - YES - - 134217728 - 33554432 - - NSImage - icon - - _NS:9 - 0 - 1 - 0 - NO - - NO - YES - - - - 268 - {{68, 252}, {174, 28}} - - - - _NS:1535 - YES - - 605028416 - 138413056 - 올ㅋ사전 - - LucidaGrande-Bold - 23 - 16 - - _NS:1535 - - - 6 - System - controlColor - - 3 - MC42NjY2NjY2NjY3AA - - - - 6 - System - controlTextColor - - 3 - MAA - - - - NO - - - - 268 - {{9, 230}, {292, 14}} - - - - _NS:1535 - YES - - 605028416 - 138413056 - 버전 1.0.0 - - LucidaGrande - 11 - 3100 - - _NS:1535 - - - - 6 - System - headerColor - - 3 - MQA - - - - NO - - - - 268 - {{9, 20}, {292, 17}} - - - _NS:1535 - YES - - 605028416 - 138413056 - Copyright © 2013 Su Yeol Jeon. All Rights Reserved. - - LucidaGrande - 9 - 3614 - - _NS:1535 - - - - - NO - - - - 268 - {{23, 161}, {120, 17}} - - - - _NS:1535 - YES - - 605028416 - 71304192 - 개발 - - LucidaGrande-Bold - 11 - 3357 - - _NS:1535 - - - - - NO - - - - 268 - {{145, 161}, {143, 17}} - - - - _NS:1535 - YES - - 605028416 - 272630784 - 전수열 - - _NS:1535 - - - - - NO - - - - 268 - {{23, 136}, {120, 17}} - - - - _NS:1535 - YES - - 605028416 - 71304192 - 작명 - - _NS:1535 - - - - - NO - - - - 268 - {{145, 136}, {143, 17}} - - - - _NS:1535 - YES - - 605028416 - 272630784 - 하상욱 - - _NS:1535 - - - - - NO - - - - 268 - {{23, 111}, {120, 17}} - - - - _NS:1535 - YES - - 605028416 - 71304192 - 도움 - - _NS:1535 - - - - - NO - - - - 268 - {{145, 111}, {143, 17}} - - - - _NS:1535 - YES - - 605028416 - 272630784 - 설진석 (치킨사줌) - - _NS:1535 - - - - - NO - - - - 268 - {{77, 79}, {156, 28}} - - - - _NS:9 - YES - - 67108864 - 134348800 - View on GitHub... - - _NS:9 - - -2038284288 - 129 - - - 200 - 25 - - NO - - - - 268 - {{77, 51}, {156, 28}} - - - - _NS:9 - YES - - 67108864 - 134348800 - 올ㅋ사전 종료 - - AppleSDGothicNeo-Regular - 11 - 16 - - _NS:9 - - -2038284288 - 129 - - - 200 - 25 - - NO - - - - 268 - {{77, 192}, {156, 28}} - - - - _NS:9 - YES - - 67108864 - 134348800 - 업데이트 확인... - - _NS:9 - - -2038284288 - 129 - - - 200 - 25 - - NO - - - {310, 408} - - - - - {{0, 0}, {1680, 1028}} - {10000000000000, 10000000000000} - 1 - YES - - - - - - - checkForUpdate - - - - 290 - - - - window - - - - 291 - - - - viewOnGitHub: - - - - 309 - - - - versionLabel - - - - 310 - - - - quit: - - - - 330 - - - - - - 0 - - - - - - -2 - - - File's Owner - - - -1 - - - First Responder - - - -3 - - - Application - - - 1 - - - - - - - - 2 - - - - - 9 - 0 - - 9 - 1 - - 0.0 - - 1000 - - 5 - 22 - 2 - - - - 4 - 0 - - 4 - 1 - - 20 - - 1000 - - 8 - 29 - 3 - - - - 4 - 0 - - 4 - 1 - - 57 - - 1000 - - 3 - 9 - 3 - - - - 3 - 0 - - 4 - 1 - - 10 - - 1000 - - 6 - 24 - 3 - - - - 5 - 0 - - 5 - 1 - - 0.0 - - 1000 - - 6 - 24 - 2 - - - - 6 - 0 - - 6 - 1 - - 0.0 - - 1000 - - 6 - 24 - 2 - - - - 6 - 0 - - 6 - 1 - - 0.0 - - 1000 - - 6 - 24 - 2 - - - - 5 - 0 - - 6 - 1 - - 8 - - 1000 - - 6 - 24 - 3 - - - - 3 - 0 - - 4 - 1 - - 8 - - 1000 - - 6 - 24 - 3 - - - - 5 - 0 - - 5 - 1 - - 0.0 - - 1000 - - 6 - 24 - 2 - - - - 11 - 0 - - 11 - 1 - - 0.0 - - 1000 - - 6 - 24 - 2 - - - - 3 - 0 - - 4 - 1 - - 8 - - 1000 - - 6 - 24 - 3 - - - - 5 - 0 - - 6 - 1 - - 8 - - 1000 - - 6 - 24 - 3 - - - - 3 - 0 - - 4 - 1 - - 8 - - 1000 - - 6 - 24 - 3 - - - - 5 - 0 - - 5 - 1 - - 0.0 - - 1000 - - 6 - 24 - 2 - - - - 11 - 0 - - 11 - 1 - - 0.0 - - 1000 - - 6 - 24 - 2 - - - - 3 - 0 - - 4 - 1 - - 8 - - 1000 - - 6 - 24 - 3 - - - - 5 - 0 - - 6 - 1 - - 8 - - 1000 - - 6 - 24 - 3 - - - - 6 - 0 - - 6 - 1 - - 0.0 - - 1000 - - 6 - 24 - 2 - - - - 11 - 0 - - 11 - 1 - - 0.0 - - 1000 - - 6 - 24 - 2 - - - - 5 - 0 - - 5 - 1 - - 0.0 - - 1000 - - 6 - 24 - 2 - - - - 3 - 0 - - 4 - 1 - - 8 - - 1000 - - 6 - 24 - 3 - - - - 5 - 0 - - 5 - 1 - - 26 - - 1000 - - 3 - 9 - 3 - - - - 5 - 0 - - 5 - 1 - - 0.0 - - 1000 - - 6 - 24 - 2 - - - - 3 - 0 - - 3 - 1 - - 0.0 - - 1000 - - 6 - 24 - 2 - - - - 9 - 0 - - 9 - 1 - - 0.0 - - 1000 - - 6 - 24 - 2 - - - - 3 - 0 - - 3 - 1 - - 192 - - 1000 - - 3 - 9 - 3 - - - - 6 - 0 - - 6 - 1 - - 0.0 - - 1000 - - 6 - 24 - 2 - - - - 5 - 0 - - 5 - 1 - - 0.0 - - 1000 - - 6 - 24 - 2 - - - - 3 - 0 - - 4 - 1 - - 8 - - 1000 - - 6 - 24 - 3 - - - - 6 - 0 - - 6 - 1 - - 0.0 - - 1000 - - 6 - 24 - 2 - - - - 5 - 0 - - 5 - 1 - - 0.0 - - 1000 - - 6 - 24 - 2 - - - - 9 - 0 - - 9 - 1 - - 0.0 - - 1000 - - 6 - 24 - 2 - - - - 3 - 0 - - 4 - 1 - - 8 - - 1000 - - 6 - 24 - 3 - - - - 9 - 0 - - 9 - 1 - - 0.0 - - 1000 - - 6 - 24 - 2 - - - - 3 - 0 - - 3 - 1 - - 33 - - 1000 - - 3 - 9 - 3 - - - - - - - - - - - - - - - - - - - 27 - - - - - - 8 - 0 - - 0 - 1 - - 87 - - 1000 - - 3 - 9 - 1 - - - - 7 - 0 - - 0 - 1 - - 87 - - 1000 - - 3 - 9 - 1 - - - - - - 28 - - - - - 45 - - - - - 46 - - - - - 50 - - - - - - 7 - 0 - - 0 - 1 - - 168 - - 1000 - - 3 - 9 - 1 - - - - - - 51 - - - - - 57 - - - - - 62 - - - - - 64 - - - - - 65 - - - - - - 7 - 0 - - 0 - 1 - - 286 - - 1000 - - 3 - 9 - 1 - - - - - - 66 - - - - - 73 - - - - - 75 - - - - - - 8 - 0 - - 0 - 1 - - 17 - - 1000 - - 3 - 9 - 1 - - - - - - 77 - - - - - 80 - - - - - 83 - - - - - 85 - - - - - 86 - - - - - 141 - - - - - - 7 - 0 - - 0 - 1 - - 114 - - 1000 - - 3 - 9 - 1 - - - - 8 - 0 - - 0 - 1 - - 17 - - 1000 - - 3 - 9 - 1 - - - - - - 142 - - - - - 146 - - - - - 151 - - - - - - 7 - 0 - - 0 - 1 - - 137 - - 1000 - - 3 - 9 - 1 - - - - - - 152 - - - - - 153 - - - - - 157 - - - - - 165 - - - - - 8 - 0 - - 0 - 1 - - 17 - - 1000 - - 3 - 9 - 1 - - - - - - - 166 - - - - - - - - 167 - - - - - 168 - - - - - 170 - - - - - 174 - - - - - 178 - - - - - 180 - - - - - 181 - - - - - 183 - - - - - - 8 - 0 - - 0 - 1 - - 17 - - 1000 - - 3 - 9 - 1 - - - - - - 184 - - - - - - - - 185 - - - - - 186 - - - - - 187 - - - - - 192 - - - - - 195 - - - - - 197 - - - - - 198 - - - - - 201 - - - - - - - - 202 - - - - - 212 - - - - - 7 - 0 - - 0 - 1 - - 146 - - 1000 - - 3 - 9 - 1 - - - - - - - 214 - - - - - 217 - - - - - 218 - - - - - 232 - - - - - 235 - - - - - 237 - - - - - 238 - - - - - 239 - - - - - 241 - - - - - 242 - - - - - 243 - - - - - 245 - - - - - 248 - - - - - 288 - - - - - 293 - - - - - 296 - - - - - 305 - - - - - 307 - - - - - 313 - - - - - - - - 314 - - - - - 319 - - - - - 321 - - - - - 323 - - - - - 325 - - - - - 326 - - - - - 328 - - - - - 329 - - - - - - - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - - com.apple.InterfaceBuilder.CocoaPlugin - {{357, 418}, {480, 270}} - - - - - - - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - - - - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - - - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - - - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - - - - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - - - - - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - - - - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - - - - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - - - - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - - - - - 330 - - - - - AboutWindowController - NSWindowController - - id - id - id - id - - - - checkForUpdate: - id - - - quit: - id - - - showWindow: - id - - - viewOnGitHub: - id - - - - versionLabel - NSTextField - - - versionLabel - - versionLabel - NSTextField - - - - IBProjectSource - ./Classes/AboutWindowController.h - - - - NSLayoutConstraint - NSObject - - IBProjectSource - ./Classes/NSLayoutConstraint.h - - - - - 0 - IBCocoaFramework - YES - 3 - - icon - {512, 512} - - YES - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Allkdic/Views/AlldicContentView.xib b/Allkdic/Views/AlldicContentView.xib index f17e753..85054da 100644 --- a/Allkdic/Views/AlldicContentView.xib +++ b/Allkdic/Views/AlldicContentView.xib @@ -1,751 +1,86 @@ - - - - 1080 - 12E55 - 3084 - 1187.39 - 626.00 - - 3084 - 2053 - - - IBNSLayoutConstraint - NSButton - NSButtonCell - NSCustomObject - NSCustomView - NSImageCell - NSImageView - NSTextField - NSTextFieldCell - WebView - - - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.WebKitIBPlugin - - - PluginDependencyRecalculationVersion - - - - - AlldicContentViewController - - - FirstResponder - - - NSApplication - - - - 268 - - - - 268 - {{109, 522}, {186, 17}} - - - - _NS:1535 - YES - - 68157504 - 138413056 - Option + Command + Space - - LucidaGrande - 11 - 3100 - - _NS:1535 - - - 6 - System - controlColor - - 3 - MC42NjY2NjY2NjY3AA - - - - 6 - System - headerColor - - 3 - MQA - - - - NO - - - - 268 - {{374, 528}, {25, 25}} - - - - _NS:1598 - YES - - 67108864 - 134217728 - - - LucidaGrande - 13 - 1044 - - _NS:1598 - - -2038415360 - 161 - - - 200 - 25 - - NO - - - - 268 - - Apple PDF pasteboard type - Apple PICT pasteboard type - Apple PNG pasteboard type - NSFilenamesPboardType - NeXT Encapsulated PostScript v1.2 pasteboard type - NeXT TIFF v4.0 pasteboard type - - {{0, 511}, {405, 2}} - - - - _NS:9 - YES - - 134217728 - 33554432 - - NSImage - line - - _NS:9 - 0 - 0 - 0 - NO - - NO - YES - - - - 256 - - Apple HTML pasteboard type - Apple PDF pasteboard type - Apple PICT pasteboard type - Apple URL pasteboard type - Apple Web Archive pasteboard type - NSColor pasteboard type - NSFilenamesPboardType - NSStringPboardType - NeXT RTFD pasteboard type - NeXT Rich Text Format v1.0 pasteboard type - NeXT TIFF v4.0 pasteboard type - WebURLsWithTitlesPboardType - public.png - public.url - public.url-name - - {405, 513} - - - - _NS:9 - - - - - - - - - - - YES - YES - - - - 268 - {{170, 537}, {64, 24}} - - - - _NS:1535 - YES - - 68157504 - 138413056 - 올ㅋ사전 - - AppleSDGothicNeo-Regular - 16 - 16 - - _NS:1535 - - - - 6 - System - controlTextColor - - 3 - MAA - - - - NO - - - {405, 566} - - - - NSView - - - - - - - view - - - - 20 - - - - webView - - - - 77 - - - - showAboutWindow - - - - 110 - - - - - - 0 - - - - - - -2 - - - File's Owner - - - -1 - - - First Responder - - - -3 - - - Application - - - 4 - - - - - 3 - 0 - - 3 - 1 - - 14 - - 1000 - - 3 - 9 - 3 - - - - 6 - 0 - - 6 - 1 - - 8 - - 1000 - - 3 - 9 - 3 - - - - 3 - 0 - - 3 - 1 - - 5 - - 1000 - - 3 - 9 - 3 - - - - 3 - 0 - - 3 - 1 - - 27 - - 1000 - - 3 - 9 - 3 - - - - 9 - 0 - - 9 - 1 - - 0.0 - - 1000 - - 6 - 24 - 2 - - - - 9 - 0 - - 9 - 1 - - 0.0 - - 1000 - - 6 - 24 - 2 - - - - 5 - 0 - - 5 - 1 - - 0.0 - - 1000 - - 8 - 29 - 3 - - - - 4 - 0 - - 4 - 1 - - 0.0 - - 1000 - - 8 - 29 - 3 - - - - 3 - 0 - - 3 - 1 - - 0.0 - - 1000 - - 6 - 24 - 2 - - - - 6 - 0 - - 6 - 1 - - 0.0 - - 1000 - - 8 - 29 - 3 - - - - 5 - 0 - - 5 - 1 - - 0.0 - - 1000 - - 8 - 29 - 3 - - - - - - - - - AlldicContentView - - - 5 - - - - - 8 - 0 - - 0 - 1 - - 513 - - 1000 - - 3 - 9 - 1 - - - - - - 6 - - - - - - - - 7 - - - - - - - - 8 - - - - - 10 - - - - - 16 - - - - - 18 - - - - - 21 - - - - - 28 - - - - - - - - 29 - - - - - 37 - - - - - 39 - - - - - - 7 - 0 - - 0 - 1 - - 180 - - 1000 - - 3 - 9 - 1 - - - - 8 - 0 - - 0 - 1 - - 17 - - 1000 - - 3 - 9 - 1 - - - - - - 40 - - - - - 44 - - - - - 45 - - - - - 63 - - - - - 65 - - - - - 73 - - - - - 78 - - - - - 104 - - - - - 102 - - - - - 101 - - - - - 109 - - - - - - - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - - - - - com.apple.InterfaceBuilder.CocoaPlugin - - - - - - - - - - - - - - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - - - - com.apple.WebKitIBPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - - - - - 110 - - - - - AlldicContentViewController - NSViewController - - webView - WebView - - - webView - - webView - WebView - - - - IBProjectSource - ./Classes/AlldicContentViewController.h - - - - NSLayoutConstraint - NSObject - - IBProjectSource - ./Classes/NSLayoutConstraint.h - - - - - 0 - IBCocoaFramework - YES - 3 - - line - {405, 2} - - YES - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From 546d81cd5e191235c3d357d4e6a0d8e46ce7e8a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=84=EC=88=98=EC=97=B4?= Date: Sat, 14 Sep 2013 02:40:26 +0900 Subject: [PATCH 02/11] Recognize keys. --- Allkdic.xcodeproj/project.pbxproj | 10 ++++ .../xcdebugger/Breakpoints_v2.xcbkptlist | 5 ++ Allkdic/Allkdic-Info.plist | 2 +- Allkdic/AllkdicController.m | 33 +++++++++++- Allkdic/AppDelegate.m | 2 +- Allkdic/Controllers/AboutWindowController.m | 1 - .../Controllers/AlldicContentViewController.h | 7 +++ .../Controllers/AlldicContentViewController.m | 22 ++++++-- .../Controllers/PreferenceWindowController.h | 15 ++++++ .../Controllers/PreferenceWindowController.m | 37 ++++++++++++++ Allkdic/Views/AboutWindow.xib | 2 +- Allkdic/Views/AlldicContentView.xib | 31 +++++++++++- Allkdic/Views/PreferenceWindow.xib | 50 +++++++++++++++++++ 13 files changed, 207 insertions(+), 10 deletions(-) create mode 100644 Allkdic.xcodeproj/xcuserdata/xoul.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist create mode 100644 Allkdic/Controllers/PreferenceWindowController.h create mode 100644 Allkdic/Controllers/PreferenceWindowController.m create mode 100644 Allkdic/Views/PreferenceWindow.xib diff --git a/Allkdic.xcodeproj/project.pbxproj b/Allkdic.xcodeproj/project.pbxproj index 65ce45e..f75df81 100644 --- a/Allkdic.xcodeproj/project.pbxproj +++ b/Allkdic.xcodeproj/project.pbxproj @@ -11,6 +11,8 @@ 0322CF9E17AE9BBB007E832C /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0322CF9D17AE9BBB007E832C /* WebKit.framework */; }; 0322CFA317AF389B007E832C /* statusicon_default.png in Resources */ = {isa = PBXBuildFile; fileRef = 0322CFA117AF389B007E832C /* statusicon_default.png */; }; 0322CFA517AF3A6C007E832C /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0322CFA417AF3A6C007E832C /* Carbon.framework */; }; + 0324200817E37710003025E3 /* PreferenceWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0324200717E37710003025E3 /* PreferenceWindowController.m */; }; + 0324200A17E378C9003025E3 /* PreferenceWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0324200917E37742003025E3 /* PreferenceWindow.xib */; }; 0367293617B00CEC0074D249 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 0367293317B00CEC0074D249 /* InfoPlist.strings */; }; 0367293917B00CF70074D249 /* MainInterface.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0367293717B00CF70074D249 /* MainInterface.xib */; }; 0367294217B016A80074D249 /* line.png in Resources */ = {isa = PBXBuildFile; fileRef = 0367294117B016A80074D249 /* line.png */; }; @@ -53,6 +55,9 @@ 0322CF9D17AE9BBB007E832C /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; }; 0322CFA117AF389B007E832C /* statusicon_default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = statusicon_default.png; sourceTree = ""; }; 0322CFA417AF3A6C007E832C /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = System/Library/Frameworks/Carbon.framework; sourceTree = SDKROOT; }; + 0324200617E37710003025E3 /* PreferenceWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PreferenceWindowController.h; sourceTree = ""; }; + 0324200717E37710003025E3 /* PreferenceWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PreferenceWindowController.m; sourceTree = ""; }; + 0324200917E37742003025E3 /* PreferenceWindow.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = PreferenceWindow.xib; sourceTree = ""; }; 0367292517B00CB30074D249 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = Allkdic/AppDelegate.h; sourceTree = SOURCE_ROOT; }; 0367292617B00CB30074D249 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = Allkdic/AppDelegate.m; sourceTree = SOURCE_ROOT; }; 0367292D17B00CD90074D249 /* Allkdic-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = "Allkdic-Info.plist"; path = "Allkdic/Allkdic-Info.plist"; sourceTree = SOURCE_ROOT; }; @@ -195,6 +200,8 @@ children = ( 0367296017B0458D0074D249 /* AlldicContentViewController.h */, 0367296117B0458D0074D249 /* AlldicContentViewController.m */, + 0324200617E37710003025E3 /* PreferenceWindowController.h */, + 0324200717E37710003025E3 /* PreferenceWindowController.m */, 0367295E17B0458D0074D249 /* AboutWindowController.h */, 0367295F17B0458D0074D249 /* AboutWindowController.m */, ); @@ -206,6 +213,7 @@ isa = PBXGroup; children = ( 0367296417B0458D0074D249 /* AlldicContentView.xib */, + 0324200917E37742003025E3 /* PreferenceWindow.xib */, 0367296317B0458D0074D249 /* AboutWindow.xib */, ); name = Views; @@ -272,6 +280,7 @@ 0367294517B029CD0074D249 /* icon_settings.png in Resources */, 0367294D17B031FA0074D249 /* icon.png in Resources */, 0367294F17B032DF0074D249 /* icon.iconset in Resources */, + 0324200A17E378C9003025E3 /* PreferenceWindow.xib in Resources */, 0367296817B0458D0074D249 /* AboutWindow.xib in Resources */, 0367296917B0458D0074D249 /* AlldicContentView.xib in Resources */, 0367297717B052B70074D249 /* dsa_pub.pem in Resources */, @@ -303,6 +312,7 @@ files = ( 0367296C17B045BF0074D249 /* AppDelegate.m in Sources */, 0367296D17B045BF0074D249 /* AllkdicController.m in Sources */, + 0324200817E37710003025E3 /* PreferenceWindowController.m in Sources */, 0367296E17B045BF0074D249 /* AboutWindowController.m in Sources */, 0367296F17B045BF0074D249 /* AlldicContentViewController.m in Sources */, 0367297017B045BF0074D249 /* NSWindow+CanBecomeKeyWindow.m in Sources */, diff --git a/Allkdic.xcodeproj/xcuserdata/xoul.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/Allkdic.xcodeproj/xcuserdata/xoul.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist new file mode 100644 index 0000000..fe2b454 --- /dev/null +++ b/Allkdic.xcodeproj/xcuserdata/xoul.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -0,0 +1,5 @@ + + + diff --git a/Allkdic/Allkdic-Info.plist b/Allkdic/Allkdic-Info.plist index 78d2e39..7358cf4 100644 --- a/Allkdic/Allkdic-Info.plist +++ b/Allkdic/Allkdic-Info.plist @@ -21,7 +21,7 @@ CFBundleSignature ???? CFBundleVersion - 19 + 55 LSApplicationCategoryType public.app-category.utilities LSMinimumSystemVersion diff --git a/Allkdic/AllkdicController.m b/Allkdic/AllkdicController.m index 83c5633..40f6f51 100644 --- a/Allkdic/AllkdicController.m +++ b/Allkdic/AllkdicController.m @@ -23,7 +23,12 @@ - (id)initWithStatusItem:(NSStatusItem *)statusItem [self close]; }]; - return self; + [NSEvent addLocalMonitorForEventsMatchingMask:NSKeyDownMask handler:^(NSEvent *event) { + [self handleKeyCode:event.keyCode flags:event.modifierFlags]; + return event; + }]; + + return self; } - (void)open @@ -51,4 +56,30 @@ - (void)close [self.popover close]; } +- (void)handleKeyCode:(unsigned short)keyCode flags:(NSUInteger)flag +{ + BOOL control = NO; + BOOL shift = NO; + BOOL command = NO; + BOOL alt = NO; + + for( int i = 0; i < 6; i ++ ) + { + if( flag & (1 << i) ) + { + if( i == 0 ) { + control = YES; + } else if( i == 1 ) { + shift = YES; + } else if( i == 3 ) { + command = YES; + } else if( i == 5 ) { + alt = YES; + } + } + } + + NSLog( @"keys : %d, %d, %d, %d, %d", keyCode, control, shift, command, alt ); +} + @end diff --git a/Allkdic/AppDelegate.m b/Allkdic/AppDelegate.m index 4553fc0..02f258f 100644 --- a/Allkdic/AppDelegate.m +++ b/Allkdic/AppDelegate.m @@ -56,7 +56,7 @@ - (void)registerHotKey InstallApplicationEventHandler( &hotKeyHandler, 1, &eventType, NULL, NULL ); // 4byte character - hotKeyId.signature = 'xoul'; + hotKeyId.signature = 'allk'; hotKeyId.id = 0; // Register hotkey. (option + command + space) diff --git a/Allkdic/Controllers/AboutWindowController.m b/Allkdic/Controllers/AboutWindowController.m index 9588ac7..a4260da 100644 --- a/Allkdic/Controllers/AboutWindowController.m +++ b/Allkdic/Controllers/AboutWindowController.m @@ -16,7 +16,6 @@ - (void)windowDidLoad { [super windowDidLoad]; self.versionLabel.stringValue = [NSString stringWithFormat:@"버전 : %@ (빌드 %@)", VERSION, BUILD]; - } - (void)showWindow:(id)sender diff --git a/Allkdic/Controllers/AlldicContentViewController.h b/Allkdic/Controllers/AlldicContentViewController.h index 8e8535c..70e980b 100644 --- a/Allkdic/Controllers/AlldicContentViewController.h +++ b/Allkdic/Controllers/AlldicContentViewController.h @@ -8,14 +8,21 @@ #import #import +#import "PreferenceWindowController.h" #import "AboutWindowController.h" @interface AlldicContentViewController : NSViewController @property (nonatomic, strong) IBOutlet WebView *webView; +@property (nonatomic, strong) IBOutlet NSButton *menuButton; +@property (nonatomic, strong) IBOutlet NSMenu *menu; +@property (nonatomic, strong) PreferenceWindowController *preferenceWindowController; @property (nonatomic, strong) AboutWindowController *aboutWindowController; - (void)focusOnTextArea; +- (IBAction)showMenu:(id)sender; +- (IBAction)showPreferenceWindow:(id)sender; - (IBAction)showAboutWindow:(id)sender; +- (IBAction)quit:(id)sender; @end diff --git a/Allkdic/Controllers/AlldicContentViewController.m b/Allkdic/Controllers/AlldicContentViewController.m index f3dea2c..f4d33a2 100644 --- a/Allkdic/Controllers/AlldicContentViewController.m +++ b/Allkdic/Controllers/AlldicContentViewController.m @@ -7,15 +7,16 @@ // #import "AlldicContentViewController.h" -#import "AboutWindowController.h" @implementation AlldicContentViewController - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; + self.preferenceWindowController = [[PreferenceWindowController alloc] initWithWindowNibName:@"PreferenceWindow"]; self.aboutWindowController = [[AboutWindowController alloc] initWithWindowNibName:@"AboutWindow"]; - return self; + + return self; } - (void)awakeFromNib @@ -33,9 +34,24 @@ - (void)focusOnTextArea [self.webView.mainFrameDocument evaluateWebScript:@"document.ac_input.focus()"]; } +- (IBAction)showMenu:(id)sender +{ + [self.menu popUpMenuPositioningItem:[self.menu itemAtIndex:0] atLocation:self.menuButton.frame.origin inView:self.view]; +} + +- (IBAction)showPreferenceWindow:(id)sender +{ + [self.preferenceWindowController showWindow:self]; +} + - (IBAction)showAboutWindow:(id)sender { - [self.aboutWindowController showWindow:self]; + [self.aboutWindowController showWindow:self]; +} + +- (IBAction)quit:(id)sender +{ + [NSApp performSelector:@selector(terminate:) withObject:nil afterDelay:0.0]; } @end diff --git a/Allkdic/Controllers/PreferenceWindowController.h b/Allkdic/Controllers/PreferenceWindowController.h new file mode 100644 index 0000000..3dc89f5 --- /dev/null +++ b/Allkdic/Controllers/PreferenceWindowController.h @@ -0,0 +1,15 @@ +// +// PreferenceWindowController.h +// Allkdic +// +// Created by 전수열 on 13. 9. 14.. +// Copyright (c) 2013년 Joyfl. All rights reserved. +// + +#import + +@interface PreferenceWindowController : NSWindowController + +@property (nonatomic, strong) IBOutlet NSTextField *hotKeyTextField; + +@end diff --git a/Allkdic/Controllers/PreferenceWindowController.m b/Allkdic/Controllers/PreferenceWindowController.m new file mode 100644 index 0000000..1ec9354 --- /dev/null +++ b/Allkdic/Controllers/PreferenceWindowController.m @@ -0,0 +1,37 @@ +// +// PreferenceWindowController.m +// Allkdic +// +// Created by 전수열 on 13. 9. 14.. +// Copyright (c) 2013년 Joyfl. All rights reserved. +// + +#import "PreferenceWindowController.h" +#import "AppDelegate.h" + +@implementation PreferenceWindowController + +- (void)windowDidLoad +{ + [super windowDidLoad]; +} + +- (void)showWindow:(id)sender +{ + [[(AppDelegate *)[NSApp delegate] allkdicController] close]; + [super showWindow:sender]; +} + +- (void)keyDown:(NSEvent *)theEvent +{ + NSLog( @"keydown : %@", theEvent ); +} + +- (void)controlTextDidChange:(NSNotification *)obj +{ + NSTextField *textField = (NSTextField *)obj.object; + + textField.stringValue = @""; +} + +@end diff --git a/Allkdic/Views/AboutWindow.xib b/Allkdic/Views/AboutWindow.xib index 039f76b..420951a 100644 --- a/Allkdic/Views/AboutWindow.xib +++ b/Allkdic/Views/AboutWindow.xib @@ -20,7 +20,7 @@ - + diff --git a/Allkdic/Views/AlldicContentView.xib b/Allkdic/Views/AlldicContentView.xib index 85054da..ae73e71 100644 --- a/Allkdic/Views/AlldicContentView.xib +++ b/Allkdic/Views/AlldicContentView.xib @@ -8,6 +8,8 @@ + + @@ -33,7 +35,9 @@ - + + + @@ -48,7 +52,7 @@ - + @@ -79,6 +83,29 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Allkdic/Views/PreferenceWindow.xib b/Allkdic/Views/PreferenceWindow.xib new file mode 100644 index 0000000..9d09d69 --- /dev/null +++ b/Allkdic/Views/PreferenceWindow.xib @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From 72bb9c9efce6521e632a484a237198343d467166 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=84=EC=88=98=EC=97=B4?= Date: Sat, 14 Sep 2013 04:56:01 +0900 Subject: [PATCH 03/11] Fuck!! Setting hot key works!! --- Allkdic.xcodeproj/project.pbxproj | 20 ++ Allkdic/Allkdic-Info.plist | 2 +- Allkdic/AllkdicController.h | 3 + Allkdic/AllkdicController.m | 49 +-- Allkdic/AppDelegate.h | 3 + Allkdic/AppDelegate.m | 39 ++- Allkdic/Common.h | 2 + Allkdic/Controllers/AboutWindowController.h | 3 +- .../Controllers/AlldicContentViewController.h | 4 +- .../Controllers/AlldicContentViewController.m | 32 +- Allkdic/Controllers/AllkdicWindowController.h | 17 + Allkdic/Controllers/AllkdicWindowController.m | 21 ++ .../Controllers/PreferenceWindowController.h | 8 +- .../Controllers/PreferenceWindowController.m | 50 ++- Allkdic/Models/KeyBinding.h | 26 ++ Allkdic/Models/KeyBinding.m | 321 ++++++++++++++++++ Allkdic/Views/AboutWindow.xib | 3 + Allkdic/Views/AlldicContentView.xib | 1 + Allkdic/Views/PreferenceWindow.xib | 83 ++++- 19 files changed, 627 insertions(+), 60 deletions(-) create mode 100644 Allkdic/Controllers/AllkdicWindowController.h create mode 100644 Allkdic/Controllers/AllkdicWindowController.m create mode 100644 Allkdic/Models/KeyBinding.h create mode 100644 Allkdic/Models/KeyBinding.m diff --git a/Allkdic.xcodeproj/project.pbxproj b/Allkdic.xcodeproj/project.pbxproj index f75df81..3f096bb 100644 --- a/Allkdic.xcodeproj/project.pbxproj +++ b/Allkdic.xcodeproj/project.pbxproj @@ -13,6 +13,8 @@ 0322CFA517AF3A6C007E832C /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0322CFA417AF3A6C007E832C /* Carbon.framework */; }; 0324200817E37710003025E3 /* PreferenceWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0324200717E37710003025E3 /* PreferenceWindowController.m */; }; 0324200A17E378C9003025E3 /* PreferenceWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0324200917E37742003025E3 /* PreferenceWindow.xib */; }; + 0324200F17E38DA4003025E3 /* AllkdicWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0324200E17E38DA4003025E3 /* AllkdicWindowController.m */; }; + 0324201317E38ED8003025E3 /* KeyBinding.m in Sources */ = {isa = PBXBuildFile; fileRef = 0324201217E38ED8003025E3 /* KeyBinding.m */; }; 0367293617B00CEC0074D249 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 0367293317B00CEC0074D249 /* InfoPlist.strings */; }; 0367293917B00CF70074D249 /* MainInterface.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0367293717B00CF70074D249 /* MainInterface.xib */; }; 0367294217B016A80074D249 /* line.png in Resources */ = {isa = PBXBuildFile; fileRef = 0367294117B016A80074D249 /* line.png */; }; @@ -58,6 +60,10 @@ 0324200617E37710003025E3 /* PreferenceWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PreferenceWindowController.h; sourceTree = ""; }; 0324200717E37710003025E3 /* PreferenceWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PreferenceWindowController.m; sourceTree = ""; }; 0324200917E37742003025E3 /* PreferenceWindow.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = PreferenceWindow.xib; sourceTree = ""; }; + 0324200B17E38AC6003025E3 /* AllkdicWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AllkdicWindowController.h; sourceTree = ""; }; + 0324200E17E38DA4003025E3 /* AllkdicWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AllkdicWindowController.m; sourceTree = ""; }; + 0324201117E38ED8003025E3 /* KeyBinding.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = KeyBinding.h; path = Allkdic/Models/KeyBinding.h; sourceTree = SOURCE_ROOT; }; + 0324201217E38ED8003025E3 /* KeyBinding.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = KeyBinding.m; path = Allkdic/Models/KeyBinding.m; sourceTree = SOURCE_ROOT; }; 0367292517B00CB30074D249 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = Allkdic/AppDelegate.h; sourceTree = SOURCE_ROOT; }; 0367292617B00CB30074D249 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = Allkdic/AppDelegate.m; sourceTree = SOURCE_ROOT; }; 0367292D17B00CD90074D249 /* Allkdic-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = "Allkdic-Info.plist"; path = "Allkdic/Allkdic-Info.plist"; sourceTree = SOURCE_ROOT; }; @@ -155,6 +161,7 @@ 03C0861C17B064480070A164 /* LoginUtil.m */, 0367296217B0458D0074D249 /* Views */, 0367295D17B0458D0074D249 /* Controllers */, + 0324201017E38EC3003025E3 /* Models */, 0367295A17B0458D0074D249 /* Categories */, 0322CF8417AE9965007E832C /* Supporting Files */, ); @@ -185,6 +192,15 @@ path = Resources; sourceTree = ""; }; + 0324201017E38EC3003025E3 /* Models */ = { + isa = PBXGroup; + children = ( + 0324201117E38ED8003025E3 /* KeyBinding.h */, + 0324201217E38ED8003025E3 /* KeyBinding.m */, + ); + name = Models; + sourceTree = ""; + }; 0367295A17B0458D0074D249 /* Categories */ = { isa = PBXGroup; children = ( @@ -198,6 +214,8 @@ 0367295D17B0458D0074D249 /* Controllers */ = { isa = PBXGroup; children = ( + 0324200B17E38AC6003025E3 /* AllkdicWindowController.h */, + 0324200E17E38DA4003025E3 /* AllkdicWindowController.m */, 0367296017B0458D0074D249 /* AlldicContentViewController.h */, 0367296117B0458D0074D249 /* AlldicContentViewController.m */, 0324200617E37710003025E3 /* PreferenceWindowController.h */, @@ -316,8 +334,10 @@ 0367296E17B045BF0074D249 /* AboutWindowController.m in Sources */, 0367296F17B045BF0074D249 /* AlldicContentViewController.m in Sources */, 0367297017B045BF0074D249 /* NSWindow+CanBecomeKeyWindow.m in Sources */, + 0324200F17E38DA4003025E3 /* AllkdicWindowController.m in Sources */, 0367297117B045BF0074D249 /* main.m in Sources */, 03C0861D17B064480070A164 /* LoginUtil.m in Sources */, + 0324201317E38ED8003025E3 /* KeyBinding.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Allkdic/Allkdic-Info.plist b/Allkdic/Allkdic-Info.plist index 7358cf4..f880a71 100644 --- a/Allkdic/Allkdic-Info.plist +++ b/Allkdic/Allkdic-Info.plist @@ -21,7 +21,7 @@ CFBundleSignature ???? CFBundleVersion - 55 + 129 LSApplicationCategoryType public.app-category.utilities LSMinimumSystemVersion diff --git a/Allkdic/AllkdicController.h b/Allkdic/AllkdicController.h index 719043d..7ca282c 100644 --- a/Allkdic/AllkdicController.h +++ b/Allkdic/AllkdicController.h @@ -15,7 +15,10 @@ @property (nonatomic, strong) NSStatusItem *statusItem; @property (nonatomic, strong) NSPopover *popover; @property (nonatomic, strong) AlldicContentViewController *contentViewController; +@property (nonatomic, strong) PreferenceWindowController *preferenceWindowController; +@property (nonatomic, strong) AboutWindowController *aboutWindowController; ++ (AllkdicController *)sharedController; - (id)initWithStatusItem:(NSStatusItem *)statusItem; - (void)open; - (void)close; diff --git a/Allkdic/AllkdicController.m b/Allkdic/AllkdicController.m index 40f6f51..824915c 100644 --- a/Allkdic/AllkdicController.m +++ b/Allkdic/AllkdicController.m @@ -7,24 +7,36 @@ // #import "AllkdicController.h" +#import "AppDelegate.h" +#import "AllkdicWindowController.h" +#import "KeyBinding.h" @implementation AllkdicController ++ (AllkdicController *)sharedController +{ + return [(AppDelegate *)[NSApplication sharedApplication].delegate allkdicController]; +} + - (id)initWithStatusItem:(NSStatusItem *)statusItem { self = [super init]; self.statusItem = statusItem; + self.contentViewController = [[AlldicContentViewController alloc] initWithNibName:@"AlldicContentView" bundle:nil]; + self.preferenceWindowController = [[PreferenceWindowController alloc] initWithWindowNibName:@"PreferenceWindow"]; + self.aboutWindowController = [[AboutWindowController alloc] initWithWindowNibName:@"AboutWindow"]; + self.popover = [[NSPopover alloc] init]; - self.popover.contentViewController = [[AlldicContentViewController alloc] initWithNibName:@"AlldicContentView" bundle:nil]; + self.popover.contentViewController = self.contentViewController; [NSEvent addGlobalMonitorForEventsMatchingMask:NSLeftMouseUp | NSLeftMouseDown handler:^(NSEvent *event) { [self close]; }]; [NSEvent addLocalMonitorForEventsMatchingMask:NSKeyDownMask handler:^(NSEvent *event) { - [self handleKeyCode:event.keyCode flags:event.modifierFlags]; + [self handleKeyCode:event.keyCode flags:event.modifierFlags windowNumber:event.windowNumber]; return event; }]; @@ -33,6 +45,12 @@ - (id)initWithStatusItem:(NSStatusItem *)statusItem - (void)open { + if( self.preferenceWindowController.window.isVisible ) + { + NSLog( @"Preference window is visible." ); + return; + } + NSButton *button = [self.statusItem valueForKey:@"_button"]; if( self.popover.isShown ) @@ -45,6 +63,7 @@ - (void)open [NSApp activateIgnoringOtherApps:YES]; [self.popover showRelativeToRect:NSZeroRect ofView:button preferredEdge:NSMaxYEdge]; + [self.contentViewController updateHotKeyLabel]; [self.contentViewController focusOnTextArea]; } @@ -56,30 +75,14 @@ - (void)close [self.popover close]; } -- (void)handleKeyCode:(unsigned short)keyCode flags:(NSUInteger)flag +- (void)handleKeyCode:(unsigned short)keyCode flags:(NSUInteger)flags windowNumber:(NSInteger)windowNumber { - BOOL control = NO; - BOOL shift = NO; - BOOL command = NO; - BOOL alt = NO; - - for( int i = 0; i < 6; i ++ ) + NSWindow *window = [NSApp windowWithWindowNumber:windowNumber]; + if( [window.windowController isKindOfClass:[AllkdicWindowController class]] ) { - if( flag & (1 << i) ) - { - if( i == 0 ) { - control = YES; - } else if( i == 1 ) { - shift = YES; - } else if( i == 3 ) { - command = YES; - } else if( i == 5 ) { - alt = YES; - } - } + KeyBinding *keyBinding = [KeyBinding keyBindingWithKeyCode:keyCode flags:flags]; + [(AllkdicWindowController *)window.windowController handleKeyBinding:keyBinding]; } - - NSLog( @"keys : %d, %d, %d, %d, %d", keyCode, control, shift, command, alt ); } @end diff --git a/Allkdic/AppDelegate.h b/Allkdic/AppDelegate.h index 79ee71a..50b449f 100644 --- a/Allkdic/AppDelegate.h +++ b/Allkdic/AppDelegate.h @@ -14,4 +14,7 @@ @property (nonatomic, strong) AllkdicController *allkdicController; @property (nonatomic, strong) NSStatusItem *statusItem; +- (void)registerHotKey; +- (void)unregisterHotKey; + @end diff --git a/Allkdic/AppDelegate.m b/Allkdic/AppDelegate.m index 02f258f..dcb0d3b 100644 --- a/Allkdic/AppDelegate.m +++ b/Allkdic/AppDelegate.m @@ -10,6 +10,7 @@ #import #import #import "LoginUtil.h" +#import "KeyBinding.h" @implementation AppDelegate @@ -44,9 +45,10 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification /** * Reference : http://dbachrach.com/blog/2005/11/program-global-hotkeys-in-cocoa-easily/ */ +EventHotKeyRef hotKeyRef; + - (void)registerHotKey { - EventHotKeyRef hotKeyRef; EventHotKeyID hotKeyId; EventTypeSpec eventType; eventType.eventClass = kEventClassKeyboard; @@ -59,8 +61,39 @@ - (void)registerHotKey hotKeyId.signature = 'allk'; hotKeyId.id = 0; - // Register hotkey. (option + command + space) - RegisterEventHotKey( 49, optionKey + cmdKey, hotKeyId, GetApplicationEventTarget(), 0, &hotKeyRef ); + KeyBinding *keyBinding = [KeyBinding keyBindingWithDictionary:[[NSUserDefaults standardUserDefaults] objectForKey:AllkdicSettingKeyHotKey]]; + if( !keyBinding ) { + keyBinding = [[KeyBinding alloc] init]; + keyBinding.option = YES; + keyBinding.command = YES; + keyBinding.keyCode = 49; // Space + [[NSUserDefaults standardUserDefaults] setObject:keyBinding.dictionary forKey:AllkdicSettingKeyHotKey]; + [[NSUserDefaults standardUserDefaults] synchronize]; + } + + NSLog( @"Bind HotKey : %@", keyBinding ); + + UInt32 hotKeyModifiers = 0; + if( keyBinding.shift ) { + hotKeyModifiers += shiftKey; + } + if( keyBinding.option ) { + hotKeyModifiers += optionKey; + } + if( keyBinding.control ) { + hotKeyModifiers += controlKey; + } + if( keyBinding.command ) { + hotKeyModifiers += cmdKey; + } + + RegisterEventHotKey( (UInt32)keyBinding.keyCode, hotKeyModifiers, hotKeyId, GetApplicationEventTarget(), 0, &hotKeyRef ); +} + +- (void)unregisterHotKey +{ + NSLog( @"Unbind HotKey" ); + UnregisterEventHotKey( hotKeyRef ); } diff --git a/Allkdic/Common.h b/Allkdic/Common.h index d608d45..0f0a05b 100644 --- a/Allkdic/Common.h +++ b/Allkdic/Common.h @@ -9,3 +9,5 @@ #define VERSION [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"] #define BUILD [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"] #define BUNDLE_NAME [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleName"]; + +static NSString *AllkdicSettingKeyHotKey = @"AllkdicSettingKeyHotKey"; \ No newline at end of file diff --git a/Allkdic/Controllers/AboutWindowController.h b/Allkdic/Controllers/AboutWindowController.h index 146aa62..90899d6 100644 --- a/Allkdic/Controllers/AboutWindowController.h +++ b/Allkdic/Controllers/AboutWindowController.h @@ -7,8 +7,9 @@ // #import +#import "AllkdicWindowController.h" -@interface AboutWindowController : NSWindowController +@interface AboutWindowController : AllkdicWindowController @property (nonatomic, strong) IBOutlet NSTextField *versionLabel; diff --git a/Allkdic/Controllers/AlldicContentViewController.h b/Allkdic/Controllers/AlldicContentViewController.h index 70e980b..2c68e18 100644 --- a/Allkdic/Controllers/AlldicContentViewController.h +++ b/Allkdic/Controllers/AlldicContentViewController.h @@ -13,12 +13,12 @@ @interface AlldicContentViewController : NSViewController +@property (nonatomic, strong) IBOutlet NSTextField *hotKeyLabel; @property (nonatomic, strong) IBOutlet WebView *webView; @property (nonatomic, strong) IBOutlet NSButton *menuButton; @property (nonatomic, strong) IBOutlet NSMenu *menu; -@property (nonatomic, strong) PreferenceWindowController *preferenceWindowController; -@property (nonatomic, strong) AboutWindowController *aboutWindowController; +- (void)updateHotKeyLabel; - (void)focusOnTextArea; - (IBAction)showMenu:(id)sender; - (IBAction)showPreferenceWindow:(id)sender; diff --git a/Allkdic/Controllers/AlldicContentViewController.m b/Allkdic/Controllers/AlldicContentViewController.m index f4d33a2..e6ff7fb 100644 --- a/Allkdic/Controllers/AlldicContentViewController.m +++ b/Allkdic/Controllers/AlldicContentViewController.m @@ -7,21 +7,33 @@ // #import "AlldicContentViewController.h" +#import "AllkdicController.h" @implementation AlldicContentViewController -- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil +- (void)awakeFromNib { - self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; - self.preferenceWindowController = [[PreferenceWindowController alloc] initWithWindowNibName:@"PreferenceWindow"]; - self.aboutWindowController = [[AboutWindowController alloc] initWithWindowNibName:@"AboutWindow"]; - - return self; + self.webView.mainFrameURL = @"http://endic.naver.com/popManager.nhn?m=miniPopMain"; } -- (void)awakeFromNib +- (void)updateHotKeyLabel { - self.webView.mainFrameURL = @"http://endic.naver.com/popManager.nhn?m=miniPopMain"; + KeyBinding *keyBinding = [KeyBinding keyBindingWithDictionary:[[NSUserDefaults standardUserDefaults] objectForKey:AllkdicSettingKeyHotKey]]; + NSMutableArray *keys = [NSMutableArray array]; + if( keyBinding.shift ) { + [keys addObject:@"Shift"]; + } + if( keyBinding.option ) { + [keys addObject:@"Option"]; + } + if( keyBinding.control ) { + [keys addObject:@"Control"]; + } + if( keyBinding.command ) { + [keys addObject:@"Command"]; + } + [keys addObject:[[KeyBinding keyStringFormKeyCode:keyBinding.keyCode] capitalizedString]]; + self.hotKeyLabel.stringValue = [keys componentsJoinedByString:@" + "]; } - (void)webviewDidFinishLoading @@ -41,12 +53,12 @@ - (IBAction)showMenu:(id)sender - (IBAction)showPreferenceWindow:(id)sender { - [self.preferenceWindowController showWindow:self]; + [[AllkdicController sharedController].preferenceWindowController showWindow:self]; } - (IBAction)showAboutWindow:(id)sender { - [self.aboutWindowController showWindow:self]; + [[AllkdicController sharedController].aboutWindowController showWindow:self]; } - (IBAction)quit:(id)sender diff --git a/Allkdic/Controllers/AllkdicWindowController.h b/Allkdic/Controllers/AllkdicWindowController.h new file mode 100644 index 0000000..37073d9 --- /dev/null +++ b/Allkdic/Controllers/AllkdicWindowController.h @@ -0,0 +1,17 @@ +// +// AllkdicWindowController.h +// Allkdic +// +// Created by 전수열 on 13. 9. 14.. +// Copyright (c) 2013년 Joyfl. All rights reserved. +// + +#import +#import "KeyBinding.h" + +@interface AllkdicWindowController : NSWindowController + +// Abstract +- (void)handleKeyBinding:(KeyBinding *)keyBinding; + +@end diff --git a/Allkdic/Controllers/AllkdicWindowController.m b/Allkdic/Controllers/AllkdicWindowController.m new file mode 100644 index 0000000..0de4b52 --- /dev/null +++ b/Allkdic/Controllers/AllkdicWindowController.m @@ -0,0 +1,21 @@ +// +// AllkdicWindowController.m +// Allkdic +// +// Created by 전수열 on 13. 9. 14.. +// Copyright (c) 2013년 Joyfl. All rights reserved. +// + +#import "AllkdicWindowController.h" + +@implementation AllkdicWindowController + +- (void)windowDidLoad +{ + [self.window close]; +} + +// Abstract +- (void)handleKeyBinding:(KeyBinding *)keyBinding {} + +@end diff --git a/Allkdic/Controllers/PreferenceWindowController.h b/Allkdic/Controllers/PreferenceWindowController.h index 3dc89f5..21ed391 100644 --- a/Allkdic/Controllers/PreferenceWindowController.h +++ b/Allkdic/Controllers/PreferenceWindowController.h @@ -7,9 +7,15 @@ // #import +#import "AllkdicWindowController.h" -@interface PreferenceWindowController : NSWindowController +@interface PreferenceWindowController : AllkdicWindowController @property (nonatomic, strong) IBOutlet NSTextField *hotKeyTextField; +@property (nonatomic, strong) IBOutlet NSTextField *shiftLabel; +@property (nonatomic, strong) IBOutlet NSTextField *controlLabel; +@property (nonatomic, strong) IBOutlet NSTextField *altLabel; +@property (nonatomic, strong) IBOutlet NSTextField *commandLabel; +@property (nonatomic, strong) IBOutlet NSTextField *keyLabel; @end diff --git a/Allkdic/Controllers/PreferenceWindowController.m b/Allkdic/Controllers/PreferenceWindowController.m index 1ec9354..c1dfdb0 100644 --- a/Allkdic/Controllers/PreferenceWindowController.m +++ b/Allkdic/Controllers/PreferenceWindowController.m @@ -14,24 +14,66 @@ @implementation PreferenceWindowController - (void)windowDidLoad { [super windowDidLoad]; + + KeyBinding *keyBinding = [KeyBinding keyBindingWithDictionary:[[NSUserDefaults standardUserDefaults] objectForKey:AllkdicSettingKeyHotKey]]; + [self handleKeyBinding:keyBinding]; } - (void)showWindow:(id)sender { - [[(AppDelegate *)[NSApp delegate] allkdicController] close]; + AppDelegate *appDelegate = (AppDelegate *)[NSApp delegate]; + [[appDelegate allkdicController] close]; + [appDelegate unregisterHotKey]; + + self.window.level = NSScreenSaverWindowLevel; + [super showWindow:sender]; } -- (void)keyDown:(NSEvent *)theEvent +- (BOOL)windowShouldClose:(id)sender { - NSLog( @"keydown : %@", theEvent ); + AppDelegate *appDelegate = (AppDelegate *)[NSApp delegate]; + [appDelegate registerHotKey]; + + return YES; } - (void)controlTextDidChange:(NSNotification *)obj { NSTextField *textField = (NSTextField *)obj.object; + if( textField == self.hotKeyTextField ) + { + textField.stringValue = @""; + } +} + +- (void)handleKeyBinding:(KeyBinding *)keyBinding +{ + if( !keyBinding.shift && !keyBinding.control && !keyBinding.option && !keyBinding.command ) { + return; + } + + NSLog( @"New HotKey : %@", keyBinding ); + + self.shiftLabel.textColor = self.controlLabel.textColor = self.altLabel.textColor = self.commandLabel.textColor = [NSColor lightGrayColor]; + + if( keyBinding.shift ) { + self.shiftLabel.textColor = [NSColor blackColor]; + } + if( keyBinding.control ) { + self.controlLabel.textColor = [NSColor blackColor]; + } + if( keyBinding.option ) { + self.altLabel.textColor = [NSColor blackColor]; + } + if( keyBinding.command ) { + self.commandLabel.textColor = [NSColor blackColor]; + } + + self.keyLabel.stringValue = [KeyBinding keyStringFormKeyCode:keyBinding.keyCode].uppercaseString; - textField.stringValue = @""; + [[NSUserDefaults standardUserDefaults] setObject:keyBinding.dictionary forKey:AllkdicSettingKeyHotKey]; + [[NSUserDefaults standardUserDefaults] synchronize]; } @end diff --git a/Allkdic/Models/KeyBinding.h b/Allkdic/Models/KeyBinding.h new file mode 100644 index 0000000..ea9465c --- /dev/null +++ b/Allkdic/Models/KeyBinding.h @@ -0,0 +1,26 @@ +// +// KeyBinding.h +// Allkdic +// +// Created by 전수열 on 13. 9. 14.. +// Copyright (c) 2013년 Joyfl. All rights reserved. +// + +#import + +@interface KeyBinding : NSObject + +@property (nonatomic, assign) NSInteger keyCode; +@property (nonatomic, assign) BOOL shift; +@property (nonatomic, assign) BOOL control; +@property (nonatomic, assign) BOOL option; +@property (nonatomic, assign) BOOL command; +@property (nonatomic, readonly) NSDictionary *dictionary; + ++ (KeyBinding *)keyBindingWithKeyCode:(NSInteger)keyCode flags:(NSUInteger)flag; ++ (KeyBinding *)keyBindingWithDictionary:(NSDictionary *)dictionary; + ++ (NSString *)keyStringFormKeyCode:(CGKeyCode)keyCode; ++ (CGKeyCode)keyCodeFormKeyString:(NSString *)keyString; + +@end diff --git a/Allkdic/Models/KeyBinding.m b/Allkdic/Models/KeyBinding.m new file mode 100644 index 0000000..03f2606 --- /dev/null +++ b/Allkdic/Models/KeyBinding.m @@ -0,0 +1,321 @@ +// +// KeyBinding.m +// Allkdic +// +// Created by 전수열 on 13. 9. 14.. +// Copyright (c) 2013년 Joyfl. All rights reserved. +// + +#import "KeyBinding.h" + +@implementation KeyBinding + ++ (KeyBinding *)keyBindingWithKeyCode:(NSInteger)keyCode flags:(NSUInteger)flag +{ + KeyBinding *keyBinding = [[KeyBinding alloc] init]; + keyBinding.keyCode = keyCode; + for( int i = 0; i < 6; i ++ ) + { + if( flag & (1 << i) ) + { + if( i == 0 ) { + keyBinding.control = YES; + } else if( i == 1 ) { + keyBinding.shift = YES; + } else if( i == 3 ) { + keyBinding.command = YES; + } else if( i == 5 ) { + keyBinding.option = YES; + } + } + } + + return keyBinding; +} + ++ (KeyBinding *)keyBindingWithDictionary:(NSDictionary *)dictionary +{ + if( !dictionary ) return nil; + + KeyBinding *keyBinding = [[KeyBinding alloc] init]; + keyBinding.keyCode = [[dictionary objectForKey:@"keyCode"] integerValue]; + keyBinding.shift = [[dictionary objectForKey:@"shift"] boolValue]; + keyBinding.control = [[dictionary objectForKey:@"control"] boolValue]; + keyBinding.option = [[dictionary objectForKey:@"option"] boolValue]; + keyBinding.command = [[dictionary objectForKey:@"command"] boolValue]; + return keyBinding; +} + +- (NSString *)description +{ + return [NSString stringWithFormat:@"", + self.keyCode, + self.control ? @"YES" : @"NO", + self.shift ? @"YES" : @"NO", + self.command ? @"YES" : @"NO", + self.option ? @"YES" : @"NO"]; +} + +- (NSDictionary *)dictionary +{ + return @{@"shift": [NSNumber numberWithBool:self.shift], + @"control": [NSNumber numberWithBool:self.control], + @"option": [NSNumber numberWithBool:self.option], + @"command": [NSNumber numberWithBool:self.command], + @"keyCode": [NSNumber numberWithInteger:self.keyCode]}; +} + ++ (NSString *)keyStringFormKeyCode:(CGKeyCode)keyCode +{ + // Proper key detection seems to want a switch statement, unfortunately + switch (keyCode) + { + case 0: return @"a"; + case 1: return @"s"; + case 2: return @"d"; + case 3: return @"f"; + case 4: return @"h"; + case 5: return @"g"; + case 6: return @"z"; + case 7: return @"x"; + case 8: return @"c"; + case 9: return @"v"; + // what is 10? + case 11: return @"b"; + case 12: return @"q"; + case 13: return @"w"; + case 14: return @"e"; + case 15: return @"r"; + case 16: return @"y"; + case 17: return @"t"; + case 18: return @"1"; + case 19: return @"2"; + case 20: return @"3"; + case 21: return @"4"; + case 22: return @"6"; + case 23: return @"5"; + case 24: return @"="; + case 25: return @"9"; + case 26: return @"7"; + case 27: return @"-"; + case 28: return @"8"; + case 29: return @"0"; + case 30: return @"]"; + case 31: return @"o"; + case 32: return @"u"; + case 33: return @"["; + case 34: return @"i"; + case 35: return @"p"; + case 36: return @"RETURN"; + case 37: return @"l"; + case 38: return @"j"; + case 39: return @"'"; + case 40: return @"k"; + case 41: return @";"; + case 42: return @"\\"; + case 43: return @","; + case 44: return @"/"; + case 45: return @"n"; + case 46: return @"m"; + case 47: return @"."; + case 48: return @"TAB"; + case 49: return @"SPACE"; + case 50: return @"`"; + case 51: return @"DELETE"; + case 52: return @"ENTER"; + case 53: return @"ESCAPE"; + + // some more missing codes abound, reserved I presume, but it would + // have been helpful for Apple to have a document with them all listed + + case 65: return @"."; + + case 67: return @"*"; + + case 69: return @"+"; + + case 71: return @"CLEAR"; + + case 75: return @"/"; + case 76: return @"ENTER"; // numberpad on full kbd + + case 78: return @"-"; + + case 81: return @"="; + case 82: return @"0"; + case 83: return @"1"; + case 84: return @"2"; + case 85: return @"3"; + case 86: return @"4"; + case 87: return @"5"; + case 88: return @"6"; + case 89: return @"7"; + + case 91: return @"8"; + case 92: return @"9"; + + case 96: return @"F5"; + case 97: return @"F6"; + case 98: return @"F7"; + case 99: return @"F3"; + case 100: return @"F8"; + case 101: return @"F9"; + + case 103: return @"F11"; + + case 105: return @"F13"; + + case 107: return @"F14"; + + case 109: return @"F10"; + + case 111: return @"F12"; + + case 113: return @"F15"; + case 114: return @"HELP"; + case 115: return @"HOME"; + case 116: return @"PGUP"; + case 117: return @"DELETE"; // full keyboard right side numberpad + case 118: return @"F4"; + case 119: return @"END"; + case 120: return @"F2"; + case 121: return @"PGDN"; + case 122: return @"F1"; + case 123: return @"LEFT"; + case 124: return @"RIGHT"; + case 125: return @"DOWN"; + case 126: return @"UP"; + + default: + + return @"Unknown key"; + // Unknown key, bail and note that RUI needs improvement + //fprintf(stderr, "%ld\tKey\t%c (DEBUG: %d)\n", currenttime, keyCode; + //exit(EXIT_FAILURE; + } +} + ++ (CGKeyCode)keyCodeFormKeyString:(NSString *)keyString +{ + if ([keyString isEqualToString:@"a"]) return 0; + if ([keyString isEqualToString:@"s"]) return 1; + if ([keyString isEqualToString:@"d"]) return 2; + if ([keyString isEqualToString:@"f"]) return 3; + if ([keyString isEqualToString:@"h"]) return 4; + if ([keyString isEqualToString:@"g"]) return 5; + if ([keyString isEqualToString:@"z"]) return 6; + if ([keyString isEqualToString:@"x"]) return 7; + if ([keyString isEqualToString:@"c"]) return 8; + if ([keyString isEqualToString:@"v"]) return 9; + // what is 10? + if ([keyString isEqualToString:@"b"]) return 11; + if ([keyString isEqualToString:@"q"]) return 12; + if ([keyString isEqualToString:@"w"]) return 13; + if ([keyString isEqualToString:@"e"]) return 14; + if ([keyString isEqualToString:@"r"]) return 15; + if ([keyString isEqualToString:@"y"]) return 16; + if ([keyString isEqualToString:@"t"]) return 17; + if ([keyString isEqualToString:@"1"]) return 18; + if ([keyString isEqualToString:@"2"]) return 19; + if ([keyString isEqualToString:@"3"]) return 20; + if ([keyString isEqualToString:@"4"]) return 21; + if ([keyString isEqualToString:@"6"]) return 22; + if ([keyString isEqualToString:@"5"]) return 23; + if ([keyString isEqualToString:@"="]) return 24; + if ([keyString isEqualToString:@"9"]) return 25; + if ([keyString isEqualToString:@"7"]) return 26; + if ([keyString isEqualToString:@"-"]) return 27; + if ([keyString isEqualToString:@"8"]) return 28; + if ([keyString isEqualToString:@"0"]) return 29; + if ([keyString isEqualToString:@"]"]) return 30; + if ([keyString isEqualToString:@"o"]) return 31; + if ([keyString isEqualToString:@"u"]) return 32; + if ([keyString isEqualToString:@"["]) return 33; + if ([keyString isEqualToString:@"i"]) return 34; + if ([keyString isEqualToString:@"p"]) return 35; + if ([keyString isEqualToString:@"RETURN"]) return 36; + if ([keyString isEqualToString:@"l"]) return 37; + if ([keyString isEqualToString:@"j"]) return 38; + if ([keyString isEqualToString:@"'"]) return 39; + if ([keyString isEqualToString:@"k"]) return 40; + if ([keyString isEqualToString:@";"]) return 41; + if ([keyString isEqualToString:@"\\"]) return 42; + if ([keyString isEqualToString:@","]) return 43; + if ([keyString isEqualToString:@"/"]) return 44; + if ([keyString isEqualToString:@"n"]) return 45; + if ([keyString isEqualToString:@"m"]) return 46; + if ([keyString isEqualToString:@"."]) return 47; + if ([keyString isEqualToString:@"TAB"]) return 48; + if ([keyString isEqualToString:@"SPACE"]) return 49; + if ([keyString isEqualToString:@"`"]) return 50; + if ([keyString isEqualToString:@"DELETE"]) return 51; + if ([keyString isEqualToString:@"ENTER"]) return 52; + if ([keyString isEqualToString:@"ESCAPE"]) return 53; + + // some more missing codes abound, reserved I presume, but it would + // have been helpful for Apple to have a document with them all listed + + if ([keyString isEqualToString:@"."]) return 65; + + if ([keyString isEqualToString:@"*"]) return 67; + + if ([keyString isEqualToString:@"+"]) return 69; + + if ([keyString isEqualToString:@"CLEAR"]) return 71; + + if ([keyString isEqualToString:@"/"]) return 75; + if ([keyString isEqualToString:@"ENTER"]) return 76; // numberpad on full kbd + + if ([keyString isEqualToString:@"="]) return 78; + + if ([keyString isEqualToString:@"="]) return 81; + if ([keyString isEqualToString:@"0"]) return 82; + if ([keyString isEqualToString:@"1"]) return 83; + if ([keyString isEqualToString:@"2"]) return 84; + if ([keyString isEqualToString:@"3"]) return 85; + if ([keyString isEqualToString:@"4"]) return 86; + if ([keyString isEqualToString:@"5"]) return 87; + if ([keyString isEqualToString:@"6"]) return 88; + if ([keyString isEqualToString:@"7"]) return 89; + + if ([keyString isEqualToString:@"8"]) return 91; + if ([keyString isEqualToString:@"9"]) return 92; + + if ([keyString isEqualToString:@"F5"]) return 96; + if ([keyString isEqualToString:@"F6"]) return 97; + if ([keyString isEqualToString:@"F7"]) return 98; + if ([keyString isEqualToString:@"F3"]) return 99; + if ([keyString isEqualToString:@"F8"]) return 100; + if ([keyString isEqualToString:@"F9"]) return 101; + + if ([keyString isEqualToString:@"F11"]) return 103; + + if ([keyString isEqualToString:@"F13"]) return 105; + + if ([keyString isEqualToString:@"F14"]) return 107; + + if ([keyString isEqualToString:@"F10"]) return 109; + + if ([keyString isEqualToString:@"F12"]) return 111; + + if ([keyString isEqualToString:@"F15"]) return 113; + if ([keyString isEqualToString:@"HELP"]) return 114; + if ([keyString isEqualToString:@"HOME"]) return 115; + if ([keyString isEqualToString:@"PGUP"]) return 116; + if ([keyString isEqualToString:@"DELETE"]) return 117; + if ([keyString isEqualToString:@"F4"]) return 118; + if ([keyString isEqualToString:@"END"]) return 119; + if ([keyString isEqualToString:@"F2"]) return 120; + if ([keyString isEqualToString:@"PGDN"]) return 121; + if ([keyString isEqualToString:@"F1"]) return 122; + if ([keyString isEqualToString:@"LEFT"]) return 123; + if ([keyString isEqualToString:@"RIGHT"]) return 124; + if ([keyString isEqualToString:@"DOWN"]) return 125; + if ([keyString isEqualToString:@"UP"]) return 126; + + return 0; + //fprintf(stderr, "keyString %s Not Found. Aborting...\n", keyString); + //exit(EXIT_FAILURE); +} + +@end diff --git a/Allkdic/Views/AboutWindow.xib b/Allkdic/Views/AboutWindow.xib index 420951a..2aaec12 100644 --- a/Allkdic/Views/AboutWindow.xib +++ b/Allkdic/Views/AboutWindow.xib @@ -210,6 +210,9 @@ + + + diff --git a/Allkdic/Views/AlldicContentView.xib b/Allkdic/Views/AlldicContentView.xib index ae73e71..f87f173 100644 --- a/Allkdic/Views/AlldicContentView.xib +++ b/Allkdic/Views/AlldicContentView.xib @@ -8,6 +8,7 @@ + diff --git a/Allkdic/Views/PreferenceWindow.xib b/Allkdic/Views/PreferenceWindow.xib index 9d09d69..463ce75 100644 --- a/Allkdic/Views/PreferenceWindow.xib +++ b/Allkdic/Views/PreferenceWindow.xib @@ -7,44 +7,97 @@ - + + + + + + + - + - - + - - - + + + - - + + - + + + + + + + + + + - + - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From fd281246404ef0db9d94ff140210db2cc55e90d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=84=EC=88=98=EC=97=B4?= Date: Sat, 14 Sep 2013 05:15:39 +0900 Subject: [PATCH 04/11] HotKey setting logic --- Allkdic/Allkdic-Info.plist | 2 +- Allkdic/AllkdicController.m | 6 ------ Allkdic/AppDelegate.m | 3 +++ Allkdic/Controllers/AboutWindowController.m | 1 + Allkdic/Controllers/PreferenceWindowController.m | 2 ++ Allkdic/Views/AlldicContentView.xib | 13 +++---------- 6 files changed, 10 insertions(+), 17 deletions(-) diff --git a/Allkdic/Allkdic-Info.plist b/Allkdic/Allkdic-Info.plist index f880a71..cd843ca 100644 --- a/Allkdic/Allkdic-Info.plist +++ b/Allkdic/Allkdic-Info.plist @@ -21,7 +21,7 @@ CFBundleSignature ???? CFBundleVersion - 129 + 159 LSApplicationCategoryType public.app-category.utilities LSMinimumSystemVersion diff --git a/Allkdic/AllkdicController.m b/Allkdic/AllkdicController.m index 824915c..c0247ad 100644 --- a/Allkdic/AllkdicController.m +++ b/Allkdic/AllkdicController.m @@ -45,12 +45,6 @@ - (id)initWithStatusItem:(NSStatusItem *)statusItem - (void)open { - if( self.preferenceWindowController.window.isVisible ) - { - NSLog( @"Preference window is visible." ); - return; - } - NSButton *button = [self.statusItem valueForKey:@"_button"]; if( self.popover.isShown ) diff --git a/Allkdic/AppDelegate.m b/Allkdic/AppDelegate.m index dcb0d3b..7a22550 100644 --- a/Allkdic/AppDelegate.m +++ b/Allkdic/AppDelegate.m @@ -63,6 +63,7 @@ - (void)registerHotKey KeyBinding *keyBinding = [KeyBinding keyBindingWithDictionary:[[NSUserDefaults standardUserDefaults] objectForKey:AllkdicSettingKeyHotKey]]; if( !keyBinding ) { + NSLog( @"No existing key setting." ); keyBinding = [[KeyBinding alloc] init]; keyBinding.option = YES; keyBinding.command = YES; @@ -88,6 +89,8 @@ - (void)registerHotKey } RegisterEventHotKey( (UInt32)keyBinding.keyCode, hotKeyModifiers, hotKeyId, GetApplicationEventTarget(), 0, &hotKeyRef ); + + [self.allkdicController.contentViewController updateHotKeyLabel]; } - (void)unregisterHotKey diff --git a/Allkdic/Controllers/AboutWindowController.m b/Allkdic/Controllers/AboutWindowController.m index a4260da..9df3d9f 100644 --- a/Allkdic/Controllers/AboutWindowController.m +++ b/Allkdic/Controllers/AboutWindowController.m @@ -21,6 +21,7 @@ - (void)windowDidLoad - (void)showWindow:(id)sender { [[(AppDelegate *)[NSApp delegate] allkdicController] close]; + self.window.level = NSScreenSaverWindowLevel; [super showWindow:sender]; } diff --git a/Allkdic/Controllers/PreferenceWindowController.m b/Allkdic/Controllers/PreferenceWindowController.m index c1dfdb0..6227e92 100644 --- a/Allkdic/Controllers/PreferenceWindowController.m +++ b/Allkdic/Controllers/PreferenceWindowController.m @@ -74,6 +74,8 @@ - (void)handleKeyBinding:(KeyBinding *)keyBinding [[NSUserDefaults standardUserDefaults] setObject:keyBinding.dictionary forKey:AllkdicSettingKeyHotKey]; [[NSUserDefaults standardUserDefaults] synchronize]; + + [[AllkdicController sharedController].contentViewController updateHotKeyLabel]; } @end diff --git a/Allkdic/Views/AlldicContentView.xib b/Allkdic/Views/AlldicContentView.xib index f87f173..cfb755b 100644 --- a/Allkdic/Views/AlldicContentView.xib +++ b/Allkdic/Views/AlldicContentView.xib @@ -21,7 +21,7 @@ - + @@ -56,13 +56,9 @@ - - + + - - - - @@ -75,10 +71,7 @@ - - - From 0a39796939b7e7d5eb7f7e1f8ccb4173061bf258 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=84=EC=88=98=EC=97=B4?= Date: Sat, 14 Sep 2013 05:19:04 +0900 Subject: [PATCH 05/11] CapitalizedString for key. --- Allkdic/Controllers/PreferenceWindowController.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Allkdic/Controllers/PreferenceWindowController.m b/Allkdic/Controllers/PreferenceWindowController.m index 6227e92..3fc773a 100644 --- a/Allkdic/Controllers/PreferenceWindowController.m +++ b/Allkdic/Controllers/PreferenceWindowController.m @@ -70,7 +70,7 @@ - (void)handleKeyBinding:(KeyBinding *)keyBinding self.commandLabel.textColor = [NSColor blackColor]; } - self.keyLabel.stringValue = [KeyBinding keyStringFormKeyCode:keyBinding.keyCode].uppercaseString; + self.keyLabel.stringValue = [KeyBinding keyStringFormKeyCode:keyBinding.keyCode].capitalizedString; [[NSUserDefaults standardUserDefaults] setObject:keyBinding.dictionary forKey:AllkdicSettingKeyHotKey]; [[NSUserDefaults standardUserDefaults] synchronize]; From 56d6428670e99441353d9fb967e90a6bbd587541 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=84=EC=88=98=EC=97=B4?= Date: Sat, 14 Sep 2013 06:01:30 +0900 Subject: [PATCH 06/11] Command + A, X, C, V work. --- Allkdic/Allkdic-Info.plist | 2 +- Allkdic/AllkdicController.m | 9 ++- .../Controllers/AlldicContentViewController.h | 2 + .../Controllers/AlldicContentViewController.m | 58 ++++++++++++++++++- 4 files changed, 67 insertions(+), 4 deletions(-) diff --git a/Allkdic/Allkdic-Info.plist b/Allkdic/Allkdic-Info.plist index cd843ca..f4a98b6 100644 --- a/Allkdic/Allkdic-Info.plist +++ b/Allkdic/Allkdic-Info.plist @@ -21,7 +21,7 @@ CFBundleSignature ???? CFBundleVersion - 159 + 190 LSApplicationCategoryType public.app-category.utilities LSMinimumSystemVersion diff --git a/Allkdic/AllkdicController.m b/Allkdic/AllkdicController.m index c0247ad..0d25503 100644 --- a/Allkdic/AllkdicController.m +++ b/Allkdic/AllkdicController.m @@ -71,10 +71,15 @@ - (void)close - (void)handleKeyCode:(unsigned short)keyCode flags:(NSUInteger)flags windowNumber:(NSInteger)windowNumber { + KeyBinding *keyBinding = [KeyBinding keyBindingWithKeyCode:keyCode flags:flags]; + NSWindow *window = [NSApp windowWithWindowNumber:windowNumber]; - if( [window.windowController isKindOfClass:[AllkdicWindowController class]] ) + if( [[window.class description] isEqualToString:@"NSStatusBarWindow"] ) + { + [self.contentViewController handleKeyBinding:keyBinding]; + } + else if( [window.windowController isKindOfClass:[AllkdicWindowController class]] ) { - KeyBinding *keyBinding = [KeyBinding keyBindingWithKeyCode:keyCode flags:flags]; [(AllkdicWindowController *)window.windowController handleKeyBinding:keyBinding]; } } diff --git a/Allkdic/Controllers/AlldicContentViewController.h b/Allkdic/Controllers/AlldicContentViewController.h index 2c68e18..a2a3b06 100644 --- a/Allkdic/Controllers/AlldicContentViewController.h +++ b/Allkdic/Controllers/AlldicContentViewController.h @@ -10,6 +10,7 @@ #import #import "PreferenceWindowController.h" #import "AboutWindowController.h" +#import "KeyBinding.h" @interface AlldicContentViewController : NSViewController @@ -20,6 +21,7 @@ - (void)updateHotKeyLabel; - (void)focusOnTextArea; +- (void)handleKeyBinding:(KeyBinding *)keyBinding; - (IBAction)showMenu:(id)sender; - (IBAction)showPreferenceWindow:(id)sender; - (IBAction)showAboutWindow:(id)sender; diff --git a/Allkdic/Controllers/AlldicContentViewController.m b/Allkdic/Controllers/AlldicContentViewController.m index e6ff7fb..989632c 100644 --- a/Allkdic/Controllers/AlldicContentViewController.m +++ b/Allkdic/Controllers/AlldicContentViewController.m @@ -14,6 +14,7 @@ @implementation AlldicContentViewController - (void)awakeFromNib { self.webView.mainFrameURL = @"http://endic.naver.com/popManager.nhn?m=miniPopMain"; + } - (void)updateHotKeyLabel @@ -43,9 +44,64 @@ - (void)webviewDidFinishLoading - (void)focusOnTextArea { - [self.webView.mainFrameDocument evaluateWebScript:@"document.ac_input.focus()"]; + [self javascript:@"ac_input.focus()"]; + [self javascript:@"ac_input.select()"]; +} + +- (void)handleKeyBinding:(KeyBinding *)keyBinding +{ + // Command + A + if( keyBinding.command && keyBinding.keyCode == [KeyBinding keyCodeFormKeyString:@"a"] ) + { + [self focusOnTextArea]; + } + + // Command + X + else if( keyBinding.command && keyBinding.keyCode == [KeyBinding keyCodeFormKeyString:@"x"] ) + { + NSString *input = [self javascript:@"ac_input.value.slice(ac_input.selectionStart, ac_input.selectionEnd)"]; + [[NSPasteboard generalPasteboard] clearContents]; + [[NSPasteboard generalPasteboard] setString:input forType:NSStringPboardType]; + NSLog( @"'%@' has been copied.", input ); + + NSMutableString *script = [NSMutableString string]; + [script appendString:@"var selection = ac_input.selectionStart;"]; + [script appendString:@"ac_input.value = ac_input.value.substring(0, ac_input.selectionStart) + ac_input.value.substr(ac_input.selectionEnd, ac_input.value.length - ac_input.selectionEnd);"]; + [script appendString:@"ac_input.selectionStart = ac_input.selectionEnd = selection;"]; + [self javascript:script]; + } + + // Command + C + else if( keyBinding.command && keyBinding.keyCode == [KeyBinding keyCodeFormKeyString:@"c"] ) + { + NSString *input = [self javascript:@"ac_input.value.slice(ac_input.selectionStart, ac_input.selectionEnd)"]; + [[NSPasteboard generalPasteboard] clearContents]; + [[NSPasteboard generalPasteboard] setString:input forType:NSStringPboardType]; + NSLog( @"'%@' has been copied.", input ); + } + + // Command + V + else if( keyBinding.command && keyBinding.keyCode == [KeyBinding keyCodeFormKeyString:@"v"] ) + { + NSString *input = [[NSPasteboard generalPasteboard] stringForType:NSStringPboardType]; + if( !input ) return; + + NSMutableString *script = [NSMutableString string]; + [script appendFormat:@"var input = '%@';", input]; + [script appendString:@"var selection = ac_input.selectionStart + input.length;"]; + [script appendString:@"ac_input.value = ac_input.value.substring(0, ac_input.selectionStart) + input + ac_input.value.substr(ac_input.selectionEnd, ac_input.value.length - ac_input.selectionEnd);"]; + [script appendString:@"ac_input.selectionStart = ac_input.selectionEnd = selection;"]; + [self javascript:script]; + NSLog( @"script: %@", script ); + } +} + +- (id)javascript:(NSString *)javascript +{ + return [self.webView.mainFrameDocument evaluateWebScript:javascript]; } + - (IBAction)showMenu:(id)sender { [self.menu popUpMenuPositioningItem:[self.menu itemAtIndex:0] atLocation:self.menuButton.frame.origin inView:self.view]; From 92f2860fcd1cb52e629be86d9643bcec3f57ee60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=84=EC=88=98=EC=97=B4?= Date: Sat, 14 Sep 2013 06:13:04 +0900 Subject: [PATCH 07/11] Added loading indicator. --- Allkdic/Allkdic-Info.plist | 2 +- Allkdic/Controllers/AlldicContentViewController.h | 1 + Allkdic/Controllers/AlldicContentViewController.m | 6 +++--- Allkdic/Views/AlldicContentView.xib | 8 ++++++++ 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/Allkdic/Allkdic-Info.plist b/Allkdic/Allkdic-Info.plist index f4a98b6..1dffb48 100644 --- a/Allkdic/Allkdic-Info.plist +++ b/Allkdic/Allkdic-Info.plist @@ -21,7 +21,7 @@ CFBundleSignature ???? CFBundleVersion - 190 + 206 LSApplicationCategoryType public.app-category.utilities LSMinimumSystemVersion diff --git a/Allkdic/Controllers/AlldicContentViewController.h b/Allkdic/Controllers/AlldicContentViewController.h index a2a3b06..cc22ea2 100644 --- a/Allkdic/Controllers/AlldicContentViewController.h +++ b/Allkdic/Controllers/AlldicContentViewController.h @@ -15,6 +15,7 @@ @interface AlldicContentViewController : NSViewController @property (nonatomic, strong) IBOutlet NSTextField *hotKeyLabel; +@property (nonatomic, strong) IBOutlet NSProgressIndicator *indicator; @property (nonatomic, strong) IBOutlet WebView *webView; @property (nonatomic, strong) IBOutlet NSButton *menuButton; @property (nonatomic, strong) IBOutlet NSMenu *menu; diff --git a/Allkdic/Controllers/AlldicContentViewController.m b/Allkdic/Controllers/AlldicContentViewController.m index 989632c..159ceb7 100644 --- a/Allkdic/Controllers/AlldicContentViewController.m +++ b/Allkdic/Controllers/AlldicContentViewController.m @@ -14,7 +14,7 @@ @implementation AlldicContentViewController - (void)awakeFromNib { self.webView.mainFrameURL = @"http://endic.naver.com/popManager.nhn?m=miniPopMain"; - + [self.indicator startAnimation:nil]; } - (void)updateHotKeyLabel @@ -37,8 +37,9 @@ - (void)updateHotKeyLabel self.hotKeyLabel.stringValue = [keys componentsJoinedByString:@" + "]; } -- (void)webviewDidFinishLoading +- (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame { + [self.indicator stopAnimation:nil]; [self focusOnTextArea]; } @@ -92,7 +93,6 @@ - (void)handleKeyBinding:(KeyBinding *)keyBinding [script appendString:@"ac_input.value = ac_input.value.substring(0, ac_input.selectionStart) + input + ac_input.value.substr(ac_input.selectionEnd, ac_input.value.length - ac_input.selectionEnd);"]; [script appendString:@"ac_input.selectionStart = ac_input.selectionEnd = selection;"]; [self javascript:script]; - NSLog( @"script: %@", script ); } } diff --git a/Allkdic/Views/AlldicContentView.xib b/Allkdic/Views/AlldicContentView.xib index cfb755b..ba02517 100644 --- a/Allkdic/Views/AlldicContentView.xib +++ b/Allkdic/Views/AlldicContentView.xib @@ -9,6 +9,7 @@ + @@ -39,6 +40,9 @@ + + + @@ -65,6 +69,10 @@ + + + + From cdc109449d86d0c50c37dadcc32d5fbb66d54f1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=84=EC=88=98=EC=97=B4?= Date: Sat, 14 Sep 2013 06:16:33 +0900 Subject: [PATCH 08/11] =?UTF-8?q?Added=20'=ED=9C=91~'=20to=20preference=20?= =?UTF-8?q?window.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Allkdic/Allkdic-Info.plist | 2 +- Allkdic/Views/PreferenceWindow.xib | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Allkdic/Allkdic-Info.plist b/Allkdic/Allkdic-Info.plist index 1dffb48..686a4dc 100644 --- a/Allkdic/Allkdic-Info.plist +++ b/Allkdic/Allkdic-Info.plist @@ -21,7 +21,7 @@ CFBundleSignature ???? CFBundleVersion - 206 + 208 LSApplicationCategoryType public.app-category.utilities LSMinimumSystemVersion diff --git a/Allkdic/Views/PreferenceWindow.xib b/Allkdic/Views/PreferenceWindow.xib index 463ce75..236e295 100644 --- a/Allkdic/Views/PreferenceWindow.xib +++ b/Allkdic/Views/PreferenceWindow.xib @@ -49,7 +49,7 @@ - + @@ -85,7 +85,7 @@ - + @@ -93,6 +93,15 @@ + + + + + + + + + From 8c53129af06c39e5b9cb9c6f0a47afe279470c4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=84=EC=88=98=EC=97=B4?= Date: Sat, 14 Sep 2013 06:20:46 +0900 Subject: [PATCH 09/11] Press 'ESC' to close. --- Allkdic/Allkdic-Info.plist | 2 +- Allkdic/Controllers/AlldicContentViewController.m | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Allkdic/Allkdic-Info.plist b/Allkdic/Allkdic-Info.plist index 686a4dc..2dbf4e3 100644 --- a/Allkdic/Allkdic-Info.plist +++ b/Allkdic/Allkdic-Info.plist @@ -21,7 +21,7 @@ CFBundleSignature ???? CFBundleVersion - 208 + 210 LSApplicationCategoryType public.app-category.utilities LSMinimumSystemVersion diff --git a/Allkdic/Controllers/AlldicContentViewController.m b/Allkdic/Controllers/AlldicContentViewController.m index 159ceb7..609bce1 100644 --- a/Allkdic/Controllers/AlldicContentViewController.m +++ b/Allkdic/Controllers/AlldicContentViewController.m @@ -51,8 +51,14 @@ - (void)focusOnTextArea - (void)handleKeyBinding:(KeyBinding *)keyBinding { + // Esc + if( !keyBinding.shift && !keyBinding.control && !keyBinding.option && !keyBinding.command && keyBinding.keyCode == 53 ) + { + [[AllkdicController sharedController] close]; + } + // Command + A - if( keyBinding.command && keyBinding.keyCode == [KeyBinding keyCodeFormKeyString:@"a"] ) + else if( keyBinding.command && keyBinding.keyCode == [KeyBinding keyCodeFormKeyString:@"a"] ) { [self focusOnTextArea]; } From 4a95d69d95e2302bd47163b7a668310b70473c79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=84=EC=88=98=EC=97=B4?= Date: Sat, 14 Sep 2013 06:21:52 +0900 Subject: [PATCH 10/11] A, X, C, V only with Command key. --- Allkdic/Allkdic-Info.plist | 2 +- Allkdic/Controllers/AlldicContentViewController.m | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Allkdic/Allkdic-Info.plist b/Allkdic/Allkdic-Info.plist index 2dbf4e3..ce3b983 100644 --- a/Allkdic/Allkdic-Info.plist +++ b/Allkdic/Allkdic-Info.plist @@ -21,7 +21,7 @@ CFBundleSignature ???? CFBundleVersion - 210 + 211 LSApplicationCategoryType public.app-category.utilities LSMinimumSystemVersion diff --git a/Allkdic/Controllers/AlldicContentViewController.m b/Allkdic/Controllers/AlldicContentViewController.m index 609bce1..5288404 100644 --- a/Allkdic/Controllers/AlldicContentViewController.m +++ b/Allkdic/Controllers/AlldicContentViewController.m @@ -58,13 +58,13 @@ - (void)handleKeyBinding:(KeyBinding *)keyBinding } // Command + A - else if( keyBinding.command && keyBinding.keyCode == [KeyBinding keyCodeFormKeyString:@"a"] ) + else if( !keyBinding.shift && !keyBinding.control && !keyBinding.option && keyBinding.command && keyBinding.keyCode == [KeyBinding keyCodeFormKeyString:@"a"] ) { [self focusOnTextArea]; } // Command + X - else if( keyBinding.command && keyBinding.keyCode == [KeyBinding keyCodeFormKeyString:@"x"] ) + else if( !keyBinding.shift && !keyBinding.control && !keyBinding.option && keyBinding.command && keyBinding.keyCode == [KeyBinding keyCodeFormKeyString:@"x"] ) { NSString *input = [self javascript:@"ac_input.value.slice(ac_input.selectionStart, ac_input.selectionEnd)"]; [[NSPasteboard generalPasteboard] clearContents]; @@ -79,7 +79,7 @@ - (void)handleKeyBinding:(KeyBinding *)keyBinding } // Command + C - else if( keyBinding.command && keyBinding.keyCode == [KeyBinding keyCodeFormKeyString:@"c"] ) + else if( !keyBinding.shift && !keyBinding.control && !keyBinding.option && keyBinding.command && keyBinding.keyCode == [KeyBinding keyCodeFormKeyString:@"c"] ) { NSString *input = [self javascript:@"ac_input.value.slice(ac_input.selectionStart, ac_input.selectionEnd)"]; [[NSPasteboard generalPasteboard] clearContents]; @@ -88,7 +88,7 @@ - (void)handleKeyBinding:(KeyBinding *)keyBinding } // Command + V - else if( keyBinding.command && keyBinding.keyCode == [KeyBinding keyCodeFormKeyString:@"v"] ) + else if( !keyBinding.shift && !keyBinding.control && !keyBinding.option && keyBinding.command && keyBinding.keyCode == [KeyBinding keyCodeFormKeyString:@"v"] ) { NSString *input = [[NSPasteboard generalPasteboard] stringForType:NSStringPboardType]; if( !input ) return; From 1460419455529f72beee9fd13d344845374ea4e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=84=EC=88=98=EC=97=B4?= Date: Sat, 14 Sep 2013 07:35:25 +0900 Subject: [PATCH 11/11] 1.0.1 --- Allkdic/Allkdic-Info.plist | 8 +++++--- Allkdic/en.lproj/MainInterface.xib | 15 ++++++++++++--- Resources/dsa_pub.pem | 28 ++++++++++------------------ 3 files changed, 27 insertions(+), 24 deletions(-) diff --git a/Allkdic/Allkdic-Info.plist b/Allkdic/Allkdic-Info.plist index ce3b983..a8d4c90 100644 --- a/Allkdic/Allkdic-Info.plist +++ b/Allkdic/Allkdic-Info.plist @@ -4,6 +4,8 @@ CFBundleDevelopmentRegion en + CFBundleDisplayName + 올ㅋ사전 CFBundleExecutable ${EXECUTABLE_NAME} CFBundleIconFile @@ -17,11 +19,11 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.0.1 + 1.0.2 CFBundleSignature ???? CFBundleVersion - 211 + 213 LSApplicationCategoryType public.app-category.utilities LSMinimumSystemVersion @@ -29,7 +31,7 @@ LSUIElement NSHumanReadableCopyright - Copyright © 2013년 Joyfl. All rights reserved. + Copyright © 2013 Su Yeol Jeon. All Rights Reserved. NSMainNibFile MainInterface NSPrincipalClass diff --git a/Allkdic/en.lproj/MainInterface.xib b/Allkdic/en.lproj/MainInterface.xib index 03bec16..4095916 100644 --- a/Allkdic/en.lproj/MainInterface.xib +++ b/Allkdic/en.lproj/MainInterface.xib @@ -1,14 +1,14 @@ - 1080 + 1070 12E55 - 3084 + 4488.1 1187.39 626.00 com.apple.InterfaceBuilder.CocoaPlugin - 3084 + 4488.1 NSCustomObject @@ -111,6 +111,15 @@ 0 IBCocoaFramework + YES + + com.apple.InterfaceBuilder.CocoaPlugin.macosx + + + + com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3 + + YES 3 YES diff --git a/Resources/dsa_pub.pem b/Resources/dsa_pub.pem index 2ef52bc..6c451a3 100644 --- a/Resources/dsa_pub.pem +++ b/Resources/dsa_pub.pem @@ -1,20 +1,12 @@ -----BEGIN PUBLIC KEY----- -MIIDRjCCAjkGByqGSM44BAEwggIsAoIBAQDqgAc/e76isM4KOEXGq8A5ytNHlTRK -5xcRHxPM2opHCxdE44SyR/JnGs+49PUb2cgJSqShErmoIeXoYrlvcQUjE47c6hr+ -axIcYhzMhg9/5trfKDL0jHnlGUcb/o6hFKJgDveZ9qqe/AONgMuE/GdQDJ8tk/y/ -j4O2J+GTPho1mMjqgGX2THlayKFYtwp4HTJ5Le3SSqIFCpFMh3ga8sgdQIWr7ycv -U8NM6NXvl0n7Z1OTroI4jV+IvMdYxdSNsJht0qPGNARBLs3Dpqu1Dh7x4vXWvahj -Z1NDoGD2BSLkWDlN5N3y7rQQeT3NdRjvXvguSBraR2hpFAF6GNVpLj2lAiEA3O9J -V+2e1o1CWEWET7cpdrWjBDFI0+T+EOnTpsKevLUCggEAdQPytkQ6RW79HFXeZZa9 -1T/piNaiqIfXbo6i37L2U8/8rOrKiQsYhuvwYl8pur/C3GgcEWI/6BvV5clc8cTh -bt9szRLUlrOrD+UzMlEyODcTr8xmgf+UkgC3erzv1t9OPAJzlLz/wkbnbWQojIVK -FZNpOEnb5SplPnHhJ5Wmo8pLwdG/cvhecTRroenS0dzCAeO2Q/WBdq09nScrekX9 -NzML0AF3MDWqY6WBIr+l+aTA0sD2euuQ81A183gbd2jkGmVSiA+c0JDiVpvC6IdJ -VFElyRa2lU+xVBiA/qmEcPUcgEXOp/QElSs5u6bqqpnfyBj+M2CrIH/oBewRx4MS -NQOCAQUAAoIBABSs9vdTouBe9Z6bXjr1ulbmFZSGxtOmCJLTQCfXcMJfkIqx9u24 -CVTLo08j3vh0l2+r32+lr0u5IhWEncbgr+qyDz5qzS+SLyMtafFNFTxR0oiHPHog -iXlZdpAGVTFidgYAm4zrkS3jZjUxthkYkOhl83OMTO8NuO1R9gXzVtjKUYJGQYNF -cE3adc7Hjx8F8ddMCf/SvZ9FD68pNJ8EgFQnbZJU+6hfq5dEoeAqKaBPzKAStSuS -eMqTT4bC11sYQ5Ey3m/iylQMUj7MGlfq+W0dTm8Esto7XScy2HCO/RBF3ns8ic1t -8WqVXdJEasux2DEnw1aulc82cfizmp8QFEQ= +MIIBuDCCASwGByqGSM44BAEwggEfAoGBANTADwfBkX0/qjjftEpc//77qmweF8JX +QWsUWFjeL1Qakowdvht/NsbddUpeAuQQxpHZfXHRGwWFTJv70QDK5+HDKlfvd0GG +jLSJtNiurHSUvCIJkdN9dUvkVr8k6jpFFePtK/ZfMC0eHMFCrWmz0Mpt9SEeauxS +kIiiz+l0RsafAhUAjJKAPE2hQ/rtn9T3sZcvJCejbw0CgYEAlUo3XpvQEgXimmqO +y8uOn/CtZXXa+jh27xM7i8b9ogjErWZ73aKzog2Qf2u89lnDeevfonWPe4SmDfmQ +VDwSn163OROcg2YYJEneI3CcvngNc4VUpnAlMbWCpz5Us1h5VJN5lBMW2+aWHiil +1hxIwPblnsWZ6EeNXp//Yw4k45wDgYUAAoGBAJEq6fL6pujYKITu8enxeoNWHnmy +8PhSFz6lMKWbdf2HrMp6c6OZwe9/szErlZk5FPZSNlUF0AEF14JjsR1phbEUyPps +9Ysz9eOrNZ6LvtU7rytZJ3kCnu3onthEB5zeYlEiEdO8n79Rk8sSBeo9H9jU0wsA +6+HGi7DGV2gupnYk -----END PUBLIC KEY-----