keyParser // Rebrand from KeyHandlerInput.
This commit is contained in:
parent
9a3004db50
commit
87922d3c16
|
@ -19,7 +19,7 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR TH
|
|||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@class KeyHandlerInput;
|
||||
@class keyParser;
|
||||
@class InputState;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
@ -40,7 +40,7 @@ extern InputMode imeModeNULL;
|
|||
@interface KeyHandler : NSObject
|
||||
|
||||
- (BOOL)isBuilderEmpty;
|
||||
- (BOOL)handleInput:(KeyHandlerInput *)input
|
||||
- (BOOL)handleInput:(keyParser *)input
|
||||
state:(InputState *)state
|
||||
stateCallback:(void (^)(InputState *))stateCallback
|
||||
errorCallback:(void (^)(void))errorCallback NS_SWIFT_NAME(handle(input:state:stateCallback:errorCallback:));
|
||||
|
|
|
@ -260,7 +260,7 @@ static NSString *const kGraphVizOutputfile = @"/tmp/vChewing-visualization.dot";
|
|||
return layout;
|
||||
}
|
||||
|
||||
- (BOOL)handleInput:(KeyHandlerInput *)input state:(InputState *)inState stateCallback:(void (^)(InputState *))stateCallback errorCallback:(void (^)(void))errorCallback
|
||||
- (BOOL)handleInput:(keyParser *)input state:(InputState *)inState stateCallback:(void (^)(InputState *))stateCallback errorCallback:(void (^)(void))errorCallback
|
||||
{
|
||||
InputState *state = inState;
|
||||
UniChar charCode = input.charCode;
|
||||
|
@ -638,7 +638,7 @@ static NSString *const kGraphVizOutputfile = @"/tmp/vChewing-visualization.dot";
|
|||
return YES;
|
||||
}
|
||||
|
||||
- (BOOL)_handleBackwardWithState:(InputState *)state input:(KeyHandlerInput *)input stateCallback:(void (^)(InputState *))stateCallback errorCallback:(void (^)(void))errorCallback
|
||||
- (BOOL)_handleBackwardWithState:(InputState *)state input:(keyParser *)input stateCallback:(void (^)(InputState *))stateCallback errorCallback:(void (^)(void))errorCallback
|
||||
{
|
||||
if (![state isKindOfClass:[InputStateInputting class]]) {
|
||||
return NO;
|
||||
|
@ -679,7 +679,7 @@ static NSString *const kGraphVizOutputfile = @"/tmp/vChewing-visualization.dot";
|
|||
return YES;
|
||||
}
|
||||
|
||||
- (BOOL)_handleForwardWithState:(InputState *)state input:(KeyHandlerInput *)input stateCallback:(void (^)(InputState *))stateCallback errorCallback:(void (^)(void))errorCallback
|
||||
- (BOOL)_handleForwardWithState:(InputState *)state input:(keyParser *)input stateCallback:(void (^)(InputState *))stateCallback errorCallback:(void (^)(void))errorCallback
|
||||
{
|
||||
if (![state isKindOfClass:[InputStateInputting class]]) {
|
||||
return NO;
|
||||
|
@ -920,7 +920,7 @@ static NSString *const kGraphVizOutputfile = @"/tmp/vChewing-visualization.dot";
|
|||
|
||||
|
||||
- (BOOL)_handleMarkingState:(InputStateMarking *)state
|
||||
input:(KeyHandlerInput *)input
|
||||
input:(keyParser *)input
|
||||
stateCallback:(void (^)(InputState *))stateCallback
|
||||
errorCallback:(void (^)(void))errorCallback
|
||||
{
|
||||
|
@ -992,7 +992,7 @@ static NSString *const kGraphVizOutputfile = @"/tmp/vChewing-visualization.dot";
|
|||
|
||||
|
||||
- (BOOL)_handleCandidateState:(InputState *)state
|
||||
input:(KeyHandlerInput *)input
|
||||
input:(keyParser *)input
|
||||
stateCallback:(void (^)(InputState *))stateCallback
|
||||
errorCallback:(void (^)(void))errorCallback;
|
||||
{
|
||||
|
|
|
@ -50,7 +50,7 @@ enum CharCode: UInt/*16*/ {
|
|||
// - CharCode is not reliable at all. KeyCode is the most accurate. KeyCode doesn't give a phuque about the character sent through macOS keyboard layouts but only focuses on which physical key is pressed.
|
||||
}
|
||||
|
||||
class KeyHandlerInput: NSObject {
|
||||
class keyParser: NSObject {
|
||||
@objc private (set) var useVerticalMode: Bool
|
||||
@objc private (set) var inputText: String?
|
||||
@objc private (set) var inputTextIgnoringModifiers: String?
|
|
@ -55,7 +55,7 @@ class ctlInputMethod: IMKInputController {
|
|||
|
||||
// 想讓 keyHandler 能夠被外界調查狀態與參數的話,就得對 keyHandler 做常態處理。
|
||||
// 這樣 InputState 可以藉由這個 ctlInputMethod 了解到當前的輸入模式是簡體中文還是繁體中文。
|
||||
// 然而,要是直接對 keyHandler 做常態處理的話,反而會導致 keyHandlerInput 無法協同處理。
|
||||
// 然而,要是直接對 keyHandler 做常態處理的話,反而會導致 keyParser 無法協同處理。
|
||||
// 所以才需要「currentKeyHandler」這個假 keyHandler。
|
||||
// 這個「currentKeyHandler」僅用來讓其他模組知道當前的輸入模式是什麼模式,除此之外別無屌用。
|
||||
static var currentKeyHandler: KeyHandler = KeyHandler()
|
||||
|
@ -232,7 +232,7 @@ class ctlInputMethod: IMKInputController {
|
|||
ctlInputMethod.areWeUsingOurOwnPhraseEditor = false
|
||||
}
|
||||
|
||||
let input = KeyHandlerInput(event: event, isVerticalMode: useVerticalMode)
|
||||
let input = keyParser(event: event, isVerticalMode: useVerticalMode)
|
||||
|
||||
let result = keyHandler.handle(input: input, state: state) { newState in
|
||||
self.handle(state: newState, client: client)
|
||||
|
|
|
@ -70,7 +70,7 @@
|
|||
D41355DE278EA3ED005E5CBD /* UserPhrasesLM.mm in Sources */ = {isa = PBXBuildFile; fileRef = D41355DC278EA3ED005E5CBD /* UserPhrasesLM.mm */; };
|
||||
D427F76C278CA2B0004A2160 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D427F76B278CA1BA004A2160 /* AppDelegate.swift */; };
|
||||
D44FB74D2792189A003C80A6 /* PhraseReplacementMap.mm in Sources */ = {isa = PBXBuildFile; fileRef = D44FB74B2792189A003C80A6 /* PhraseReplacementMap.mm */; };
|
||||
D456576E279E4F7B00DF6BC9 /* KeyHandlerInput.swift in Sources */ = {isa = PBXBuildFile; fileRef = D456576D279E4F7B00DF6BC9 /* KeyHandlerInput.swift */; };
|
||||
D456576E279E4F7B00DF6BC9 /* KeyParser.swift in Sources */ = {isa = PBXBuildFile; fileRef = D456576D279E4F7B00DF6BC9 /* KeyParser.swift */; };
|
||||
D461B792279DAC010070E734 /* InputState.swift in Sources */ = {isa = PBXBuildFile; fileRef = D461B791279DAC010070E734 /* InputState.swift */; };
|
||||
D47B92C027972AD100458394 /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = D47B92BF27972AC800458394 /* main.swift */; };
|
||||
D47D73AC27A6CAE600255A50 /* AssociatedPhrases.mm in Sources */ = {isa = PBXBuildFile; fileRef = D47D73AA27A6CAE600255A50 /* AssociatedPhrases.mm */; };
|
||||
|
@ -262,7 +262,7 @@
|
|||
D427F76B278CA1BA004A2160 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
||||
D44FB74B2792189A003C80A6 /* PhraseReplacementMap.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = PhraseReplacementMap.mm; sourceTree = "<group>"; };
|
||||
D44FB74C2792189A003C80A6 /* PhraseReplacementMap.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PhraseReplacementMap.h; sourceTree = "<group>"; };
|
||||
D456576D279E4F7B00DF6BC9 /* KeyHandlerInput.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeyHandlerInput.swift; sourceTree = "<group>"; };
|
||||
D456576D279E4F7B00DF6BC9 /* KeyParser.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeyParser.swift; sourceTree = "<group>"; };
|
||||
D461B791279DAC010070E734 /* InputState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InputState.swift; sourceTree = "<group>"; };
|
||||
D47B92BF27972AC800458394 /* main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = "<group>"; };
|
||||
D47D73AA27A6CAE600255A50 /* AssociatedPhrases.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = AssociatedPhrases.mm; sourceTree = "<group>"; };
|
||||
|
@ -373,7 +373,7 @@
|
|||
D461B791279DAC010070E734 /* InputState.swift */,
|
||||
D4E569DA27A34CC100AC2CEF /* KeyHandler.h */,
|
||||
D4E569DB27A34CC100AC2CEF /* KeyHandler.mm */,
|
||||
D456576D279E4F7B00DF6BC9 /* KeyHandlerInput.swift */,
|
||||
D456576D279E4F7B00DF6BC9 /* KeyParser.swift */,
|
||||
6ACC3D3E27914F2400F1B140 /* KeyValueBlobReader.cpp */,
|
||||
6ACC3D3C27914AAB00F1B140 /* KeyValueBlobReader.h */,
|
||||
5B62A33727AE79CD00A19448 /* NSStringUtils.swift */,
|
||||
|
@ -963,7 +963,7 @@
|
|||
D47F7DD0278C0897002F9DD7 /* ctlNonModalAlertWindow.swift in Sources */,
|
||||
5B62A32F27AE78B000A19448 /* CoreLM.mm in Sources */,
|
||||
5BE78BE027B38804005EA1BE /* LMConsolidator.mm in Sources */,
|
||||
D456576E279E4F7B00DF6BC9 /* KeyHandlerInput.swift in Sources */,
|
||||
D456576E279E4F7B00DF6BC9 /* KeyParser.swift in Sources */,
|
||||
D47F7DCE278BFB57002F9DD7 /* ctlPrefWindow.swift in Sources */,
|
||||
D47D73AC27A6CAE600255A50 /* AssociatedPhrases.mm in Sources */,
|
||||
5B62A34A27AE7CD900A19448 /* NotifierController.swift in Sources */,
|
||||
|
|
Loading…
Reference in New Issue