Skip to content

Commit

Permalink
Merge branch 'meaningfulresult'
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowone committed Jan 7, 2012
2 parents bbbad23 + 2432686 commit bd8ec8c
Show file tree
Hide file tree
Showing 21 changed files with 855 additions and 134 deletions.
6 changes: 6 additions & 0 deletions CharmIM.xcodeproj/project.pbxproj
Expand Up @@ -10,6 +10,7 @@
3802E45E141380BF00256B54 /* han2classic.png in Resources */ = {isa = PBXBuildFile; fileRef = 3802E45D141380BF00256B54 /* han2classic.png */; };
3802E4651413AA0000256B54 /* CIMConfiguration.m in Sources */ = {isa = PBXBuildFile; fileRef = 3802E4641413A9FF00256B54 /* CIMConfiguration.m */; };
3802E4661413AA0000256B54 /* CIMConfiguration.m in Sources */ = {isa = PBXBuildFile; fileRef = 3802E4641413A9FF00256B54 /* CIMConfiguration.m */; };
380E1C6314B7F5D800289EE7 /* CIMInputControllerGureum.m in Sources */ = {isa = PBXBuildFile; fileRef = 380E1C6214B7F5D800289EE7 /* CIMInputControllerGureum.m */; };
38162D7D140F64BE0077AA2D /* HangulComposer.m in Sources */ = {isa = PBXBuildFile; fileRef = 38162D7B140F64B70077AA2D /* HangulComposer.m */; };
38162DF5141263270077AA2D /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 38863C63140E64EB00A8ED76 /* Cocoa.framework */; };
38162DFB141263280077AA2D /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 38162DF9141263280077AA2D /* InfoPlist.strings */; };
Expand Down Expand Up @@ -153,6 +154,8 @@
3802E4631413A9FF00256B54 /* CIMConfiguration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CIMConfiguration.h; sourceTree = "<group>"; };
3802E4641413A9FF00256B54 /* CIMConfiguration.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CIMConfiguration.m; sourceTree = "<group>"; };
380B908714303836001D7550 /* ShortcutRecorder.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = ShortcutRecorder.xcodeproj; path = shortcutrecorder/ShortcutRecorder.xcodeproj; sourceTree = SOURCE_ROOT; };
380E1C6114B7F5D800289EE7 /* CIMInputControllerGureum.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CIMInputControllerGureum.h; sourceTree = "<group>"; };
380E1C6214B7F5D800289EE7 /* CIMInputControllerGureum.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CIMInputControllerGureum.m; sourceTree = "<group>"; };
38162D7A140F64B70077AA2D /* HangulComposer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HangulComposer.h; sourceTree = "<group>"; };
38162D7B140F64B70077AA2D /* HangulComposer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HangulComposer.m; sourceTree = "<group>"; };
38162DCA1410A4A50077AA2D /* CIMComposer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CIMComposer.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -275,6 +278,8 @@
isa = PBXGroup;
children = (
38FA220114233FD900444D67 /* Hangul.xcodeproj */,
380E1C6114B7F5D800289EE7 /* CIMInputControllerGureum.h */,
380E1C6214B7F5D800289EE7 /* CIMInputControllerGureum.m */,
38162E02141263280077AA2D /* GureumAppDelegate.h */,
38162E03141263280077AA2D /* GureumAppDelegate.m */,
38FA21DF14231BCC00444D67 /* Composers */,
Expand Down Expand Up @@ -709,6 +714,7 @@
38FA21DD14230E2E00444D67 /* CIMInputController.m in Sources */,
38FA22131423458900444D67 /* ICUtility.m in Sources */,
389A9D55142F82EA0087F074 /* GureumPreferencesWindowController.m in Sources */,
380E1C6314B7F5D800289EE7 /* CIMInputControllerGureum.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
14 changes: 13 additions & 1 deletion CommonInputMethod/CIMCommon.h
Expand Up @@ -14,6 +14,18 @@
#import <Foundation/Foundation.h>

@class CIMInputController;

/*!
@enum
@brief 최종적으로 CIMInputController가 처리할 결과
*/
typedef enum {
CIMInputTextProcessResultNotProcessedAndNeedsCommit = -2,
CIMInputTextProcessResultNotProcessedAndNeedsCancel = -1,
CIMInputTextProcessResultNotProcessed = 0,
CIMInputTextProcessResultProcessed = 1,
} CIMInputTextProcessResult;

/*!
@protocol
@brief 입력을 처리하는 클래스의 관한 공통 형식
Expand All @@ -31,6 +43,6 @@
@return 입력 처리 여부. YES를 반환하면 이미 처리된 입력으로 보고 NO를 반환하면 외부에서 입력을 다시 처리한다.
@see IMKServerInput
*/
- (BOOL)inputController:(CIMInputController *)controller inputText:(NSString *)string key:(NSInteger)keyCode modifiers:(NSUInteger)flags client:(id)sender;
- (CIMInputTextProcessResult)inputController:(CIMInputController *)controller inputText:(NSString *)string key:(NSInteger)keyCode modifiers:(NSUInteger)flags client:(id)sender;
@end

23 changes: 19 additions & 4 deletions CommonInputMethod/CIMComposer.h
Expand Up @@ -14,6 +14,12 @@


@protocol CIMComposerDelegate<CIMInputTextDelegate>

@optional
//! @brief 입력기가 선택 됨
- (void)composerSelected:(id)sender;

@required
//! @brief 합성 중인 문자로 보여줄 문자열
@property(nonatomic, readonly) NSString *composedString;
//! @brief 합성을 취소하면 사용할 문자열
Expand All @@ -26,7 +32,17 @@
- (void)cancelComposition;
//! @brief 조합 문맥 초기화
- (void)clearContext;

//! @brief 변환 후보 문자열 존재 여부
@property(nonatomic, readonly) BOOL hasCandidates;

@optional
//! @brief 변환 후보 문자열 리스트
@property(nonatomic, readonly) NSArray *candidates;
//! @brief 변환 후보 문자열 선택
- (void)candidateSelected:(NSAttributedString *)candidateString;
//! @brief 변환 후보 문자열 변경
- (void)candidateSelectionChanged:(NSAttributedString *)candidateString;

@end

Expand All @@ -36,11 +52,10 @@
@warning 이 자체로는 동작하지 않는다. 상속하여 동작을 구현하거나 @ref CIMBaseComposer 를 사용한다.
*/
@interface CIMComposer : NSObject<CIMComposerDelegate> {
id<CIMComposerDelegate> _delegate;
NSString *_inputMode;
@protected
CIMInputManager *manager;
id<CIMComposerDelegate> delegate;

NSString *inputMode;
}
@property(nonatomic, retain) id<CIMComposerDelegate> delegate;
@property(nonatomic, retain) NSString *inputMode;
Expand All @@ -52,4 +67,4 @@
*/
@interface CIMBaseComposer : CIMComposer

@end
@end
44 changes: 35 additions & 9 deletions CommonInputMethod/CIMComposer.m
Expand Up @@ -9,37 +9,59 @@
#include "CIMComposer.h"

@implementation CIMComposer
@synthesize delegate;
@synthesize inputMode;
@synthesize delegate=_delegate;
@synthesize inputMode=_inputMode;

- (void)dealloc {
self.delegate = nil;
self.inputMode = nil;
[super dealloc];
}

#pragma - delegate

- (NSString *)composedString {
return [delegate composedString];
return [_delegate composedString];
}

- (NSString *)originalString {
return [delegate originalString];
return [_delegate originalString];
}

- (NSString *)commitString {
return [delegate commitString];
return [_delegate commitString];
}

- (NSString *)dequeueCommitString {
return [delegate dequeueCommitString];
return [_delegate dequeueCommitString];
}

- (void)cancelComposition {
[delegate cancelComposition];
[_delegate cancelComposition];
}

- (void)clearContext {
[delegate clearContext];
[_delegate clearContext];
}

- (BOOL)hasCandidates {
return [_delegate hasCandidates];
}

- (NSArray *)candidates {
return [_delegate candidates];
}

- (void)candidateSelected:(NSAttributedString *)candidateString {
[_delegate candidateSelected:candidateString];
}

- (void)candidateSelectionChanged:(NSAttributedString *)candidateString {
[_delegate candidateSelectionChanged:candidateString];
}

- (BOOL)inputController:(CIMInputController *)controller inputText:(NSString *)string key:(NSInteger)keyCode modifiers:(NSUInteger)flags client:(id)sender {
return [delegate inputController:controller inputText:string key:keyCode modifiers:flags client:sender];
return [_delegate inputController:controller inputText:string key:keyCode modifiers:flags client:sender];
}

@end
Expand All @@ -66,6 +88,10 @@ - (void)cancelComposition { }

- (void)clearContext { }

- (BOOL)hasCandidates { return NO; }

- (NSArray *)candidates { return nil; }

#pragma -

- (BOOL)inputController:(CIMInputController *)controller inputText:(NSString *)string key:(NSInteger)keyCode modifiers:(NSUInteger)flags client:(id)sender {
Expand Down
5 changes: 4 additions & 1 deletion CommonInputMethod/CIMConfiguration.h
Expand Up @@ -12,10 +12,12 @@
/* Gureum */
ICEXTERN NSString *kCIMLastHangulInputMode;

#define CIMConfigurationIntegerItemCount 4
#define CIMConfigurationIntegerItemCount 6
/* Gureum */
ICEXTERN NSString *kCIMInputModeExchangeKeyModifier;
ICEXTERN NSString *kCIMInputModeExchangeKeyCode;
ICEXTERN NSString *kCIMInputModeHanjaKeyModifier;
ICEXTERN NSString *kCIMInputModeHanjaKeyCode;
/* Hangul */
ICEXTERN NSString *kCIMHangulCombinationModeComposing;
ICEXTERN NSString *kCIMHangulCombinationModeCommiting;
Expand Down Expand Up @@ -55,6 +57,7 @@ extern CIMConfiguration *CIMDefaultUserConfiguration;
@public
NSString *lastHangulInputMode;
NSInteger inputModeExchangeKeyModifier, inputModeExchangeKeyCode;
NSInteger inputModeHanjaKeyModifier, inputModeHanjaKeyCode;
NSInteger hangulCombinationModeComposing, hangulCombinationModeCommiting;
BOOL sharedInputManager;
BOOL autosaveDefaultInputMode;
Expand Down
6 changes: 5 additions & 1 deletion CommonInputMethod/CIMConfiguration.m
Expand Up @@ -12,6 +12,8 @@

NSString * kCIMInputModeExchangeKeyModifier = @"CIMInputModeExchangeKeyModifier";
NSString * kCIMInputModeExchangeKeyCode = @"CIMInputModeExchangeKeyCode";
NSString * kCIMInputModeHanjaKeyModifier = @"CIMInputModeHanjaKeyModifier";
NSString * kCIMInputModeHanjaKeyCode = @"CIMInputModeHanjaKeyCode";
NSString * kCIMHangulCombinationModeComposing = @"CIMHangulCombinationModeComposing";
NSString * kCIMHangulCombinationModeCommiting = @"CIMHangulCombinationModeCommiting";

Expand Down Expand Up @@ -47,8 +49,10 @@ - (id)initWithUserDefaults:(NSUserDefaults *)aUserDefaults {
}

struct CIMConfigurationIntegerItem tempIntegerItems[CIMConfigurationIntegerItemCount] = {
{ kCIMInputModeExchangeKeyModifier, &self->inputModeExchangeKeyModifier, 0x20000 },
{ kCIMInputModeExchangeKeyModifier, &self->inputModeExchangeKeyModifier, NSShiftKeyMask },
{ kCIMInputModeExchangeKeyCode, &self->inputModeExchangeKeyCode, 0x31 },
{ kCIMInputModeHanjaKeyModifier, &self->inputModeHanjaKeyModifier, NSAlternateKeyMask },
{ kCIMInputModeHanjaKeyCode, &self->inputModeHanjaKeyCode, 0x24 },
{ kCIMHangulCombinationModeComposing, &self->hangulCombinationModeComposing, 0 },
{ kCIMHangulCombinationModeCommiting, &self->hangulCombinationModeCommiting, 0 },
};
Expand Down
13 changes: 11 additions & 2 deletions CommonInputMethod/CIMInputController.h
Expand Up @@ -25,9 +25,18 @@
@class CIMComposer;

@interface CIMInputController : IMKInputController<CIMInputTextDelegate> {
@private
CIMComposer *composer;
id _inputClient;
CIMComposer *_composer;
}

@property(nonatomic, readonly) id inputClient;
@property(nonatomic, readonly) CIMComposer *composer;

@end

@interface CIMInputController (CIMMenu)

- (IBAction)showPreferences:(id)sender;
- (IBAction)showStandardAboutPanel:(id)sender;

@end

0 comments on commit bd8ec8c

Please sign in to comment.