Skip to content

Commit

Permalink
Merge branch '1.0.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
devxoul committed Sep 13, 2013
2 parents df292cd + 1460419 commit b86c6e3
Show file tree
Hide file tree
Showing 24 changed files with 1,235 additions and 2,691 deletions.
30 changes: 30 additions & 0 deletions Allkdic.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
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 */; };
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 */; };
Expand Down Expand Up @@ -53,6 +57,13 @@
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 = "<group>"; };
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 = "<group>"; };
0324200717E37710003025E3 /* PreferenceWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PreferenceWindowController.m; sourceTree = "<group>"; };
0324200917E37742003025E3 /* PreferenceWindow.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = PreferenceWindow.xib; sourceTree = "<group>"; };
0324200B17E38AC6003025E3 /* AllkdicWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AllkdicWindowController.h; sourceTree = "<group>"; };
0324200E17E38DA4003025E3 /* AllkdicWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AllkdicWindowController.m; sourceTree = "<group>"; };
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; };
Expand Down Expand Up @@ -150,6 +161,7 @@
03C0861C17B064480070A164 /* LoginUtil.m */,
0367296217B0458D0074D249 /* Views */,
0367295D17B0458D0074D249 /* Controllers */,
0324201017E38EC3003025E3 /* Models */,
0367295A17B0458D0074D249 /* Categories */,
0322CF8417AE9965007E832C /* Supporting Files */,
);
Expand Down Expand Up @@ -180,6 +192,15 @@
path = Resources;
sourceTree = "<group>";
};
0324201017E38EC3003025E3 /* Models */ = {
isa = PBXGroup;
children = (
0324201117E38ED8003025E3 /* KeyBinding.h */,
0324201217E38ED8003025E3 /* KeyBinding.m */,
);
name = Models;
sourceTree = "<group>";
};
0367295A17B0458D0074D249 /* Categories */ = {
isa = PBXGroup;
children = (
Expand All @@ -193,8 +214,12 @@
0367295D17B0458D0074D249 /* Controllers */ = {
isa = PBXGroup;
children = (
0324200B17E38AC6003025E3 /* AllkdicWindowController.h */,
0324200E17E38DA4003025E3 /* AllkdicWindowController.m */,
0367296017B0458D0074D249 /* AlldicContentViewController.h */,
0367296117B0458D0074D249 /* AlldicContentViewController.m */,
0324200617E37710003025E3 /* PreferenceWindowController.h */,
0324200717E37710003025E3 /* PreferenceWindowController.m */,
0367295E17B0458D0074D249 /* AboutWindowController.h */,
0367295F17B0458D0074D249 /* AboutWindowController.m */,
);
Expand All @@ -206,6 +231,7 @@
isa = PBXGroup;
children = (
0367296417B0458D0074D249 /* AlldicContentView.xib */,
0324200917E37742003025E3 /* PreferenceWindow.xib */,
0367296317B0458D0074D249 /* AboutWindow.xib */,
);
name = Views;
Expand Down Expand Up @@ -272,6 +298,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 */,
Expand Down Expand Up @@ -303,11 +330,14 @@
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 */,
0324200F17E38DA4003025E3 /* AllkdicWindowController.m in Sources */,
0367297117B045BF0074D249 /* main.m in Sources */,
03C0861D17B064480070A164 /* LoginUtil.m in Sources */,
0324201317E38ED8003025E3 /* KeyBinding.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?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>IDESourceControlProjectFavoriteDictionaryKey</key>
<false/>
<key>IDESourceControlProjectIdentifier</key>
<string>7CFEC5D0-E6D1-46EE-B710-E7656A13BFC1</string>
<key>IDESourceControlProjectName</key>
<string>Allkdic</string>
<key>IDESourceControlProjectOriginsDictionary</key>
<dict>
<key>35B85E91-3C33-4BB1-9FC1-BE18E7D738ED</key>
<string>https://github.com/devxoul/Allkdic.git</string>
</dict>
<key>IDESourceControlProjectPath</key>
<string>Allkdic.xcodeproj/project.xcworkspace</string>
<key>IDESourceControlProjectRelativeInstallPathDictionary</key>
<dict>
<key>35B85E91-3C33-4BB1-9FC1-BE18E7D738ED</key>
<string>../..</string>
</dict>
<key>IDESourceControlProjectURL</key>
<string>https://github.com/devxoul/Allkdic.git</string>
<key>IDESourceControlProjectVersion</key>
<integer>110</integer>
<key>IDESourceControlProjectWCCIdentifier</key>
<string>35B85E91-3C33-4BB1-9FC1-BE18E7D738ED</string>
<key>IDESourceControlProjectWCConfigurations</key>
<array>
<dict>
<key>IDESourceControlRepositoryExtensionIdentifierKey</key>
<string>public.vcs.git</string>
<key>IDESourceControlWCCIdentifierKey</key>
<string>35B85E91-3C33-4BB1-9FC1-BE18E7D738ED</string>
<key>IDESourceControlWCCName</key>
<string>Allkdic</string>
</dict>
</array>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
type = "1"
version = "2.0">
</Bucket>
6 changes: 4 additions & 2 deletions Allkdic/Allkdic-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>올ㅋ사전</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIconFile</key>
Expand All @@ -21,15 +23,15 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>12</string>
<string>213</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string>
<key>LSMinimumSystemVersion</key>
<string>${MACOSX_DEPLOYMENT_TARGET}</string>
<key>LSUIElement</key>
<true/>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2013년 Joyfl. All rights reserved.</string>
<string>Copyright © 2013 Su Yeol Jeon. All Rights Reserved.</string>
<key>NSMainNibFile</key>
<string>MainInterface</string>
<key>NSPrincipalClass</key>
Expand Down
3 changes: 3 additions & 0 deletions Allkdic/AllkdicController.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
37 changes: 35 additions & 2 deletions Allkdic/AllkdicController.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,40 @@
//

#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];
}];

return self;
[NSEvent addLocalMonitorForEventsMatchingMask:NSKeyDownMask handler:^(NSEvent *event) {
[self handleKeyCode:event.keyCode flags:event.modifierFlags windowNumber:event.windowNumber];
return event;
}];

return self;
}

- (void)open
Expand All @@ -40,6 +57,7 @@ - (void)open

[NSApp activateIgnoringOtherApps:YES];
[self.popover showRelativeToRect:NSZeroRect ofView:button preferredEdge:NSMaxYEdge];
[self.contentViewController updateHotKeyLabel];
[self.contentViewController focusOnTextArea];
}

Expand All @@ -51,4 +69,19 @@ - (void)close
[self.popover 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.class description] isEqualToString:@"NSStatusBarWindow"] )
{
[self.contentViewController handleKeyBinding:keyBinding];
}
else if( [window.windowController isKindOfClass:[AllkdicWindowController class]] )
{
[(AllkdicWindowController *)window.windowController handleKeyBinding:keyBinding];
}
}

@end
3 changes: 3 additions & 0 deletions Allkdic/AppDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,7 @@
@property (nonatomic, strong) AllkdicController *allkdicController;
@property (nonatomic, strong) NSStatusItem *statusItem;

- (void)registerHotKey;
- (void)unregisterHotKey;

@end
46 changes: 41 additions & 5 deletions Allkdic/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#import <Carbon/Carbon.h>
#import <Sparkle/Sparkle.h>
#import "LoginUtil.h"
#import "KeyBinding.h"

@implementation AppDelegate

Expand Down Expand Up @@ -37,16 +38,17 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification
[LoginUtil setStartAtLoginEnabled:YES];
}

[[SUUpdater sharedUpdater] checkForUpdates:self];
[[SUUpdater sharedUpdater] checkForUpdatesInBackground];
}


/**
* 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;
Expand All @@ -56,11 +58,45 @@ - (void)registerHotKey
InstallApplicationEventHandler( &hotKeyHandler, 1, &eventType, NULL, NULL );

// 4byte character
hotKeyId.signature = 'xoul';
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 ) {
NSLog( @"No existing key setting." );
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 );

[self.allkdicController.contentViewController updateHotKeyLabel];
}

- (void)unregisterHotKey
{
NSLog( @"Unbind HotKey" );
UnregisterEventHotKey( hotKeyRef );
}


Expand Down
2 changes: 2 additions & 0 deletions Allkdic/Common.h
Original file line number Diff line number Diff line change
Expand Up @@ -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";
3 changes: 2 additions & 1 deletion Allkdic/Controllers/AboutWindowController.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
//

#import <Cocoa/Cocoa.h>
#import "AllkdicWindowController.h"

@interface AboutWindowController : NSWindowController
@interface AboutWindowController : AllkdicWindowController

@property (nonatomic, strong) IBOutlet NSTextField *versionLabel;

Expand Down
2 changes: 1 addition & 1 deletion Allkdic/Controllers/AboutWindowController.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ - (void)windowDidLoad
{
[super windowDidLoad];
self.versionLabel.stringValue = [NSString stringWithFormat:@"버전 : %@ (빌드 %@)", VERSION, BUILD];

}

- (void)showWindow:(id)sender
{
[[(AppDelegate *)[NSApp delegate] allkdicController] close];
self.window.level = NSScreenSaverWindowLevel;
[super showWindow:sender];
}

Expand Down
12 changes: 11 additions & 1 deletion Allkdic/Controllers/AlldicContentViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,24 @@

#import <Cocoa/Cocoa.h>
#import <WebKit/WebKit.h>
#import "PreferenceWindowController.h"
#import "AboutWindowController.h"
#import "KeyBinding.h"

@interface AlldicContentViewController : NSViewController

@property (nonatomic, strong) IBOutlet NSTextField *hotKeyLabel;
@property (nonatomic, strong) IBOutlet NSProgressIndicator *indicator;
@property (nonatomic, strong) IBOutlet WebView *webView;
@property (nonatomic, strong) AboutWindowController *aboutWindowController;
@property (nonatomic, strong) IBOutlet NSButton *menuButton;
@property (nonatomic, strong) IBOutlet NSMenu *menu;

- (void)updateHotKeyLabel;
- (void)focusOnTextArea;
- (void)handleKeyBinding:(KeyBinding *)keyBinding;
- (IBAction)showMenu:(id)sender;
- (IBAction)showPreferenceWindow:(id)sender;
- (IBAction)showAboutWindow:(id)sender;
- (IBAction)quit:(id)sender;

@end
Loading

0 comments on commit b86c6e3

Please sign in to comment.