Proj // Shorten the naming of Candidate Controllers.
This commit is contained in:
parent
1f6cf32159
commit
c72f1c10a7
|
@ -39,10 +39,8 @@ extern InputMode imeModeNULL;
|
|||
@class KeyHandler;
|
||||
|
||||
@protocol KeyHandlerDelegate <NSObject>
|
||||
- (id)candidateControllerForKeyHandler:(KeyHandler *)keyHandler;
|
||||
- (void)keyHandler:(KeyHandler *)keyHandler
|
||||
didSelectCandidateAtIndex:(NSInteger)index
|
||||
candidateController:(id)controller;
|
||||
- (id)ctlCandidateForKeyHandler:(KeyHandler *)keyHandler;
|
||||
- (void)keyHandler:(KeyHandler *)keyHandler didSelectCandidateAtIndex:(NSInteger)index ctlCandidate:(id)controller;
|
||||
- (BOOL)keyHandler:(KeyHandler *)keyHandler didRequestWriteUserPhraseWithState:(InputState *)state;
|
||||
@end
|
||||
|
||||
|
|
|
@ -1261,7 +1261,7 @@ static NSString *const kGraphVizOutputfile = @"/tmp/vChewing-visualization.dot";
|
|||
{
|
||||
NSString *inputText = input.inputText;
|
||||
UniChar charCode = input.charCode;
|
||||
VTCandidateController *gCurrentCandidateController = [self.delegate candidateControllerForKeyHandler:self];
|
||||
ctlCandidate *ctlCandidateCurrent = [self.delegate ctlCandidateForKeyHandler:self];
|
||||
|
||||
BOOL cancelCandidateKey = [input isBackSpace] || [input isESC] || [input isDelete] ||
|
||||
(([input isCursorBackward] || [input isCursorForward]) && [input isShiftHold]);
|
||||
|
@ -1306,18 +1306,18 @@ static NSString *const kGraphVizOutputfile = @"/tmp/vChewing-visualization.dot";
|
|||
return YES;
|
||||
}
|
||||
[self.delegate keyHandler:self
|
||||
didSelectCandidateAtIndex:gCurrentCandidateController.selectedCandidateIndex
|
||||
candidateController:gCurrentCandidateController];
|
||||
didSelectCandidateAtIndex:ctlCandidateCurrent.selectedCandidateIndex
|
||||
ctlCandidate:ctlCandidateCurrent];
|
||||
return YES;
|
||||
}
|
||||
|
||||
if ([input isTab])
|
||||
{
|
||||
BOOL updated = mgrPrefs.specifyTabKeyBehavior
|
||||
? ([input isShiftHold] ? [gCurrentCandidateController showPreviousPage]
|
||||
: [gCurrentCandidateController showNextPage])
|
||||
: ([input isShiftHold] ? [gCurrentCandidateController highlightPreviousCandidate]
|
||||
: [gCurrentCandidateController highlightNextCandidate]);
|
||||
BOOL updated =
|
||||
mgrPrefs.specifyTabKeyBehavior
|
||||
? ([input isShiftHold] ? [ctlCandidateCurrent showPreviousPage] : [ctlCandidateCurrent showNextPage])
|
||||
: ([input isShiftHold] ? [ctlCandidateCurrent highlightPreviousCandidate]
|
||||
: [ctlCandidateCurrent highlightNextCandidate]);
|
||||
if (!updated)
|
||||
{
|
||||
[IME prtDebugIntel:@"9B691919"];
|
||||
|
@ -1329,10 +1329,10 @@ static NSString *const kGraphVizOutputfile = @"/tmp/vChewing-visualization.dot";
|
|||
if ([input isSpace])
|
||||
{
|
||||
BOOL updated = mgrPrefs.specifySpaceKeyBehavior
|
||||
? ([input isShiftHold] ? [gCurrentCandidateController highlightNextCandidate]
|
||||
: [gCurrentCandidateController showNextPage])
|
||||
: ([input isShiftHold] ? [gCurrentCandidateController showNextPage]
|
||||
: [gCurrentCandidateController highlightNextCandidate]);
|
||||
? ([input isShiftHold] ? [ctlCandidateCurrent highlightNextCandidate]
|
||||
: [ctlCandidateCurrent showNextPage])
|
||||
: ([input isShiftHold] ? [ctlCandidateCurrent showNextPage]
|
||||
: [ctlCandidateCurrent highlightNextCandidate]);
|
||||
if (!updated)
|
||||
{
|
||||
[IME prtDebugIntel:@"A11C781F"];
|
||||
|
@ -1343,7 +1343,7 @@ static NSString *const kGraphVizOutputfile = @"/tmp/vChewing-visualization.dot";
|
|||
|
||||
if ([input isPageDown] || input.emacsKey == vChewingEmacsKeyNextPage)
|
||||
{
|
||||
BOOL updated = [gCurrentCandidateController showNextPage];
|
||||
BOOL updated = [ctlCandidateCurrent showNextPage];
|
||||
if (!updated)
|
||||
{
|
||||
[IME prtDebugIntel:@"9B691919"];
|
||||
|
@ -1354,7 +1354,7 @@ static NSString *const kGraphVizOutputfile = @"/tmp/vChewing-visualization.dot";
|
|||
|
||||
if ([input isPageUp])
|
||||
{
|
||||
BOOL updated = [gCurrentCandidateController showPreviousPage];
|
||||
BOOL updated = [ctlCandidateCurrent showPreviousPage];
|
||||
if (!updated)
|
||||
{
|
||||
[IME prtDebugIntel:@"9569955D"];
|
||||
|
@ -1365,9 +1365,9 @@ static NSString *const kGraphVizOutputfile = @"/tmp/vChewing-visualization.dot";
|
|||
|
||||
if ([input isLeft])
|
||||
{
|
||||
if ([gCurrentCandidateController isKindOfClass:[VTHorizontalCandidateController class]])
|
||||
if ([ctlCandidateCurrent isKindOfClass:[ctlCandidateHorizontal class]])
|
||||
{
|
||||
BOOL updated = [gCurrentCandidateController highlightPreviousCandidate];
|
||||
BOOL updated = [ctlCandidateCurrent highlightPreviousCandidate];
|
||||
if (!updated)
|
||||
{
|
||||
[IME prtDebugIntel:@"1145148D"];
|
||||
|
@ -1376,7 +1376,7 @@ static NSString *const kGraphVizOutputfile = @"/tmp/vChewing-visualization.dot";
|
|||
}
|
||||
else
|
||||
{
|
||||
BOOL updated = [gCurrentCandidateController showPreviousPage];
|
||||
BOOL updated = [ctlCandidateCurrent showPreviousPage];
|
||||
if (!updated)
|
||||
{
|
||||
[IME prtDebugIntel:@"1919810D"];
|
||||
|
@ -1388,7 +1388,7 @@ static NSString *const kGraphVizOutputfile = @"/tmp/vChewing-visualization.dot";
|
|||
|
||||
if (input.emacsKey == vChewingEmacsKeyBackward)
|
||||
{
|
||||
BOOL updated = [gCurrentCandidateController highlightPreviousCandidate];
|
||||
BOOL updated = [ctlCandidateCurrent highlightPreviousCandidate];
|
||||
if (!updated)
|
||||
{
|
||||
[IME prtDebugIntel:@"9B89308D"];
|
||||
|
@ -1399,9 +1399,9 @@ static NSString *const kGraphVizOutputfile = @"/tmp/vChewing-visualization.dot";
|
|||
|
||||
if ([input isRight])
|
||||
{
|
||||
if ([gCurrentCandidateController isKindOfClass:[VTHorizontalCandidateController class]])
|
||||
if ([ctlCandidateCurrent isKindOfClass:[ctlCandidateHorizontal class]])
|
||||
{
|
||||
BOOL updated = [gCurrentCandidateController highlightNextCandidate];
|
||||
BOOL updated = [ctlCandidateCurrent highlightNextCandidate];
|
||||
if (!updated)
|
||||
{
|
||||
[IME prtDebugIntel:@"9B65138D"];
|
||||
|
@ -1410,7 +1410,7 @@ static NSString *const kGraphVizOutputfile = @"/tmp/vChewing-visualization.dot";
|
|||
}
|
||||
else
|
||||
{
|
||||
BOOL updated = [gCurrentCandidateController showNextPage];
|
||||
BOOL updated = [ctlCandidateCurrent showNextPage];
|
||||
if (!updated)
|
||||
{
|
||||
[IME prtDebugIntel:@"9244908D"];
|
||||
|
@ -1422,7 +1422,7 @@ static NSString *const kGraphVizOutputfile = @"/tmp/vChewing-visualization.dot";
|
|||
|
||||
if (input.emacsKey == vChewingEmacsKeyForward)
|
||||
{
|
||||
BOOL updated = [gCurrentCandidateController highlightNextCandidate];
|
||||
BOOL updated = [ctlCandidateCurrent highlightNextCandidate];
|
||||
if (!updated)
|
||||
{
|
||||
[IME prtDebugIntel:@"9B2428D"];
|
||||
|
@ -1433,9 +1433,9 @@ static NSString *const kGraphVizOutputfile = @"/tmp/vChewing-visualization.dot";
|
|||
|
||||
if ([input isUp])
|
||||
{
|
||||
if ([gCurrentCandidateController isKindOfClass:[VTHorizontalCandidateController class]])
|
||||
if ([ctlCandidateCurrent isKindOfClass:[ctlCandidateHorizontal class]])
|
||||
{
|
||||
BOOL updated = [gCurrentCandidateController showPreviousPage];
|
||||
BOOL updated = [ctlCandidateCurrent showPreviousPage];
|
||||
if (!updated)
|
||||
{
|
||||
[IME prtDebugIntel:@"9B614524"];
|
||||
|
@ -1444,7 +1444,7 @@ static NSString *const kGraphVizOutputfile = @"/tmp/vChewing-visualization.dot";
|
|||
}
|
||||
else
|
||||
{
|
||||
BOOL updated = [gCurrentCandidateController highlightPreviousCandidate];
|
||||
BOOL updated = [ctlCandidateCurrent highlightPreviousCandidate];
|
||||
if (!updated)
|
||||
{
|
||||
[IME prtDebugIntel:@"ASD9908D"];
|
||||
|
@ -1456,9 +1456,9 @@ static NSString *const kGraphVizOutputfile = @"/tmp/vChewing-visualization.dot";
|
|||
|
||||
if ([input isDown])
|
||||
{
|
||||
if ([gCurrentCandidateController isKindOfClass:[VTHorizontalCandidateController class]])
|
||||
if ([ctlCandidateCurrent isKindOfClass:[ctlCandidateHorizontal class]])
|
||||
{
|
||||
BOOL updated = [gCurrentCandidateController showNextPage];
|
||||
BOOL updated = [ctlCandidateCurrent showNextPage];
|
||||
if (!updated)
|
||||
{
|
||||
[IME prtDebugIntel:@"92B990DD"];
|
||||
|
@ -1467,7 +1467,7 @@ static NSString *const kGraphVizOutputfile = @"/tmp/vChewing-visualization.dot";
|
|||
}
|
||||
else
|
||||
{
|
||||
BOOL updated = [gCurrentCandidateController highlightNextCandidate];
|
||||
BOOL updated = [ctlCandidateCurrent highlightNextCandidate];
|
||||
if (!updated)
|
||||
{
|
||||
[IME prtDebugIntel:@"6B99908D"];
|
||||
|
@ -1479,14 +1479,14 @@ static NSString *const kGraphVizOutputfile = @"/tmp/vChewing-visualization.dot";
|
|||
|
||||
if ([input isHome] || input.emacsKey == vChewingEmacsKeyHome)
|
||||
{
|
||||
if (gCurrentCandidateController.selectedCandidateIndex == 0)
|
||||
if (ctlCandidateCurrent.selectedCandidateIndex == 0)
|
||||
{
|
||||
[IME prtDebugIntel:@"9B6EDE8D"];
|
||||
errorCallback();
|
||||
}
|
||||
else
|
||||
{
|
||||
gCurrentCandidateController.selectedCandidateIndex = 0;
|
||||
ctlCandidateCurrent.selectedCandidateIndex = 0;
|
||||
}
|
||||
|
||||
return YES;
|
||||
|
@ -1510,14 +1510,14 @@ static NSString *const kGraphVizOutputfile = @"/tmp/vChewing-visualization.dot";
|
|||
|
||||
if (([input isEnd] || input.emacsKey == vChewingEmacsKeyEnd) && candidates.count > 0)
|
||||
{
|
||||
if (gCurrentCandidateController.selectedCandidateIndex == candidates.count - 1)
|
||||
if (ctlCandidateCurrent.selectedCandidateIndex == candidates.count - 1)
|
||||
{
|
||||
[IME prtDebugIntel:@"9B69AAAD"];
|
||||
errorCallback();
|
||||
}
|
||||
else
|
||||
{
|
||||
gCurrentCandidateController.selectedCandidateIndex = candidates.count - 1;
|
||||
ctlCandidateCurrent.selectedCandidateIndex = candidates.count - 1;
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
|
@ -1541,9 +1541,9 @@ static NSString *const kGraphVizOutputfile = @"/tmp/vChewing-visualization.dot";
|
|||
match = inputText;
|
||||
}
|
||||
|
||||
for (NSUInteger j = 0, c = [gCurrentCandidateController.keyLabels count]; j < c; j++)
|
||||
for (NSUInteger j = 0, c = [ctlCandidateCurrent.keyLabels count]; j < c; j++)
|
||||
{
|
||||
VTCandidateKeyLabel *label = gCurrentCandidateController.keyLabels[j];
|
||||
VTCandidateKeyLabel *label = ctlCandidateCurrent.keyLabels[j];
|
||||
if ([match compare:label.key options:NSCaseInsensitiveSearch] == NSOrderedSame)
|
||||
{
|
||||
index = j;
|
||||
|
@ -1553,12 +1553,10 @@ static NSString *const kGraphVizOutputfile = @"/tmp/vChewing-visualization.dot";
|
|||
|
||||
if (index != NSNotFound)
|
||||
{
|
||||
NSUInteger candidateIndex = [gCurrentCandidateController candidateIndexAtKeyLabelIndex:index];
|
||||
NSUInteger candidateIndex = [ctlCandidateCurrent candidateIndexAtKeyLabelIndex:index];
|
||||
if (candidateIndex != NSUIntegerMax)
|
||||
{
|
||||
[self.delegate keyHandler:self
|
||||
didSelectCandidateAtIndex:candidateIndex
|
||||
candidateController:gCurrentCandidateController];
|
||||
[self.delegate keyHandler:self didSelectCandidateAtIndex:candidateIndex ctlCandidate:ctlCandidateCurrent];
|
||||
return YES;
|
||||
}
|
||||
}
|
||||
|
@ -1606,12 +1604,12 @@ static NSString *const kGraphVizOutputfile = @"/tmp/vChewing-visualization.dot";
|
|||
|
||||
if (shouldAutoSelectCandidate)
|
||||
{
|
||||
NSUInteger candidateIndex = [gCurrentCandidateController candidateIndexAtKeyLabelIndex:0];
|
||||
NSUInteger candidateIndex = [ctlCandidateCurrent candidateIndexAtKeyLabelIndex:0];
|
||||
if (candidateIndex != NSUIntegerMax)
|
||||
{
|
||||
[self.delegate keyHandler:self
|
||||
didSelectCandidateAtIndex:candidateIndex
|
||||
candidateController:gCurrentCandidateController];
|
||||
ctlCandidate:ctlCandidateCurrent];
|
||||
[self clear];
|
||||
InputStateEmptyIgnoringPreviousState *empty = [[InputStateEmptyIgnoringPreviousState alloc] init];
|
||||
stateCallback(empty);
|
||||
|
|
|
@ -35,11 +35,11 @@ extension Bool {
|
|||
|
||||
private let kMinKeyLabelSize: CGFloat = 10
|
||||
|
||||
private var gCurrentCandidateController: CandidateController?
|
||||
private var ctlCandidateCurrent: ctlCandidate?
|
||||
|
||||
extension CandidateController {
|
||||
fileprivate static let horizontal = HorizontalCandidateController()
|
||||
fileprivate static let vertical = VerticalCandidateController()
|
||||
extension ctlCandidate {
|
||||
fileprivate static let horizontal = ctlCandidateHorizontal()
|
||||
fileprivate static let vertical = ctlCandidateVertical()
|
||||
}
|
||||
|
||||
@objc(ctlInputMethod)
|
||||
|
@ -500,8 +500,8 @@ extension ctlInputMethod {
|
|||
private func handle(state: InputState.Deactivated, previous: InputState, client: Any?) {
|
||||
currentCandidateClient = nil
|
||||
|
||||
gCurrentCandidateController?.delegate = nil
|
||||
gCurrentCandidateController?.visible = false
|
||||
ctlCandidateCurrent?.delegate = nil
|
||||
ctlCandidateCurrent?.visible = false
|
||||
hideTooltip()
|
||||
|
||||
if let previous = previous as? InputState.NotEmpty {
|
||||
|
@ -513,7 +513,7 @@ extension ctlInputMethod {
|
|||
}
|
||||
|
||||
private func handle(state: InputState.Empty, previous: InputState, client: Any?) {
|
||||
gCurrentCandidateController?.visible = false
|
||||
ctlCandidateCurrent?.visible = false
|
||||
hideTooltip()
|
||||
|
||||
guard let client = client as? IMKTextInput else {
|
||||
|
@ -531,7 +531,7 @@ extension ctlInputMethod {
|
|||
private func handle(
|
||||
state: InputState.EmptyIgnoringPreviousState, previous: InputState, client: Any!
|
||||
) {
|
||||
gCurrentCandidateController?.visible = false
|
||||
ctlCandidateCurrent?.visible = false
|
||||
hideTooltip()
|
||||
|
||||
guard let client = client as? IMKTextInput else {
|
||||
|
@ -544,7 +544,7 @@ extension ctlInputMethod {
|
|||
}
|
||||
|
||||
private func handle(state: InputState.Committing, previous: InputState, client: Any?) {
|
||||
gCurrentCandidateController?.visible = false
|
||||
ctlCandidateCurrent?.visible = false
|
||||
hideTooltip()
|
||||
|
||||
guard let client = client as? IMKTextInput else {
|
||||
|
@ -561,7 +561,7 @@ extension ctlInputMethod {
|
|||
}
|
||||
|
||||
private func handle(state: InputState.Inputting, previous: InputState, client: Any?) {
|
||||
gCurrentCandidateController?.visible = false
|
||||
ctlCandidateCurrent?.visible = false
|
||||
hideTooltip()
|
||||
|
||||
guard let client = client as? IMKTextInput else {
|
||||
|
@ -586,7 +586,7 @@ extension ctlInputMethod {
|
|||
}
|
||||
|
||||
private func handle(state: InputState.Marking, previous: InputState, client: Any?) {
|
||||
gCurrentCandidateController?.visible = false
|
||||
ctlCandidateCurrent?.visible = false
|
||||
guard let client = client as? IMKTextInput else {
|
||||
hideTooltip()
|
||||
return
|
||||
|
@ -610,7 +610,7 @@ extension ctlInputMethod {
|
|||
private func handle(state: InputState.ChoosingCandidate, previous: InputState, client: Any?) {
|
||||
hideTooltip()
|
||||
guard let client = client as? IMKTextInput else {
|
||||
gCurrentCandidateController?.visible = false
|
||||
ctlCandidateCurrent?.visible = false
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -625,7 +625,7 @@ extension ctlInputMethod {
|
|||
private func handle(state: InputState.AssociatedPhrases, previous: InputState, client: Any?) {
|
||||
hideTooltip()
|
||||
guard let client = client as? IMKTextInput else {
|
||||
gCurrentCandidateController?.visible = false
|
||||
ctlCandidateCurrent?.visible = false
|
||||
return
|
||||
}
|
||||
client.setMarkedText(
|
||||
|
@ -664,14 +664,14 @@ extension ctlInputMethod {
|
|||
return false
|
||||
}()
|
||||
|
||||
gCurrentCandidateController?.delegate = nil
|
||||
ctlCandidateCurrent?.delegate = nil
|
||||
|
||||
if useVerticalMode {
|
||||
gCurrentCandidateController = .vertical
|
||||
ctlCandidateCurrent = .vertical
|
||||
} else if mgrPrefs.useHorizontalCandidateList {
|
||||
gCurrentCandidateController = .horizontal
|
||||
ctlCandidateCurrent = .horizontal
|
||||
} else {
|
||||
gCurrentCandidateController = .vertical
|
||||
ctlCandidateCurrent = .vertical
|
||||
}
|
||||
|
||||
// set the attributes for the candidate panel (which uses NSAttributedString)
|
||||
|
@ -699,24 +699,24 @@ extension ctlInputMethod {
|
|||
return finalReturnFont
|
||||
}
|
||||
|
||||
gCurrentCandidateController?.keyLabelFont = labelFont(
|
||||
ctlCandidateCurrent?.keyLabelFont = labelFont(
|
||||
name: mgrPrefs.candidateKeyLabelFontName, size: keyLabelSize)
|
||||
gCurrentCandidateController?.candidateFont = candidateFont(
|
||||
ctlCandidateCurrent?.candidateFont = candidateFont(
|
||||
name: mgrPrefs.candidateTextFontName, size: textSize)
|
||||
|
||||
let candidateKeys = mgrPrefs.candidateKeys
|
||||
let keyLabels =
|
||||
candidateKeys.count > 4 ? Array(candidateKeys) : Array(mgrPrefs.defaultCandidateKeys)
|
||||
let keyLabelSuffix = state is InputState.AssociatedPhrases ? "^" : ""
|
||||
gCurrentCandidateController?.keyLabels = keyLabels.map {
|
||||
ctlCandidateCurrent?.keyLabels = keyLabels.map {
|
||||
CandidateKeyLabel(key: String($0), displayedText: String($0) + keyLabelSuffix)
|
||||
}
|
||||
|
||||
gCurrentCandidateController?.delegate = self
|
||||
gCurrentCandidateController?.reloadData()
|
||||
ctlCandidateCurrent?.delegate = self
|
||||
ctlCandidateCurrent?.reloadData()
|
||||
currentCandidateClient = client
|
||||
|
||||
gCurrentCandidateController?.visible = true
|
||||
ctlCandidateCurrent?.visible = true
|
||||
|
||||
var lineHeightRect = NSMakeRect(0.0, 0.0, 16.0, 16.0)
|
||||
var cursor: Int = 0
|
||||
|
@ -735,13 +735,13 @@ extension ctlInputMethod {
|
|||
}
|
||||
|
||||
if useVerticalMode {
|
||||
gCurrentCandidateController?.set(
|
||||
ctlCandidateCurrent?.set(
|
||||
windowTopLeftPoint: NSMakePoint(
|
||||
lineHeightRect.origin.x + lineHeightRect.size.width + 4.0,
|
||||
lineHeightRect.origin.y - 4.0),
|
||||
bottomOutOfScreenAdjustmentHeight: lineHeightRect.size.height + 4.0)
|
||||
} else {
|
||||
gCurrentCandidateController?.set(
|
||||
ctlCandidateCurrent?.set(
|
||||
windowTopLeftPoint: NSMakePoint(
|
||||
lineHeightRect.origin.x, lineHeightRect.origin.y - 4.0),
|
||||
bottomOutOfScreenAdjustmentHeight: lineHeightRect.size.height + 4.0)
|
||||
|
@ -776,16 +776,16 @@ extension ctlInputMethod {
|
|||
// MARK: -
|
||||
|
||||
extension ctlInputMethod: KeyHandlerDelegate {
|
||||
func candidateController(for keyHandler: KeyHandler) -> Any {
|
||||
gCurrentCandidateController ?? .vertical
|
||||
func ctlCandidate(for keyHandler: KeyHandler) -> Any {
|
||||
ctlCandidateCurrent ?? .vertical
|
||||
}
|
||||
|
||||
func keyHandler(
|
||||
_ keyHandler: KeyHandler, didSelectCandidateAt index: Int,
|
||||
candidateController controller: Any
|
||||
ctlCandidate controller: Any
|
||||
) {
|
||||
if let controller = controller as? CandidateController {
|
||||
self.candidateController(controller, didSelectCandidateAtIndex: UInt(index))
|
||||
if let controller = controller as? ctlCandidate {
|
||||
self.ctlCandidate(controller, didSelectCandidateAtIndex: UInt(index))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -815,8 +815,8 @@ extension ctlInputMethod: KeyHandlerDelegate {
|
|||
|
||||
// MARK: -
|
||||
|
||||
extension ctlInputMethod: CandidateControllerDelegate {
|
||||
func candidateCountForController(_ controller: CandidateController) -> UInt {
|
||||
extension ctlInputMethod: ctlCandidateDelegate {
|
||||
func candidateCountForController(_ controller: ctlCandidate) -> UInt {
|
||||
if let state = state as? InputState.ChoosingCandidate {
|
||||
return UInt(state.candidates.count)
|
||||
} else if let state = state as? InputState.AssociatedPhrases {
|
||||
|
@ -825,7 +825,7 @@ extension ctlInputMethod: CandidateControllerDelegate {
|
|||
return 0
|
||||
}
|
||||
|
||||
func candidateController(_ controller: CandidateController, candidateAtIndex index: UInt)
|
||||
func ctlCandidate(_ controller: ctlCandidate, candidateAtIndex index: UInt)
|
||||
-> String
|
||||
{
|
||||
if let state = state as? InputState.ChoosingCandidate {
|
||||
|
@ -836,9 +836,7 @@ extension ctlInputMethod: CandidateControllerDelegate {
|
|||
return ""
|
||||
}
|
||||
|
||||
func candidateController(
|
||||
_ controller: CandidateController, didSelectCandidateAtIndex index: UInt
|
||||
) {
|
||||
func ctlCandidate(_ controller: ctlCandidate, didSelectCandidateAtIndex index: UInt) {
|
||||
let client = currentCandidateClient
|
||||
|
||||
if let state = state as? InputState.SymbolTable,
|
||||
|
|
|
@ -38,18 +38,18 @@ public class CandidateKeyLabel: NSObject {
|
|||
}
|
||||
}
|
||||
|
||||
@objc(VTCandidateControllerDelegate)
|
||||
public protocol CandidateControllerDelegate: AnyObject {
|
||||
func candidateCountForController(_ controller: CandidateController) -> UInt
|
||||
func candidateController(_ controller: CandidateController, candidateAtIndex index: UInt)
|
||||
@objc(ctlCandidateDelegate)
|
||||
public protocol ctlCandidateDelegate: AnyObject {
|
||||
func candidateCountForController(_ controller: ctlCandidate) -> UInt
|
||||
func ctlCandidate(_ controller: ctlCandidate, candidateAtIndex index: UInt)
|
||||
-> String
|
||||
func candidateController(
|
||||
_ controller: CandidateController, didSelectCandidateAtIndex index: UInt)
|
||||
func ctlCandidate(
|
||||
_ controller: ctlCandidate, didSelectCandidateAtIndex index: UInt)
|
||||
}
|
||||
|
||||
@objc(VTCandidateController)
|
||||
public class CandidateController: NSWindowController {
|
||||
@objc public weak var delegate: CandidateControllerDelegate? {
|
||||
@objc(ctlCandidate)
|
||||
public class ctlCandidate: NSWindowController {
|
||||
@objc public weak var delegate: ctlCandidateDelegate? {
|
||||
didSet {
|
||||
reloadData()
|
||||
}
|
|
@ -236,8 +236,7 @@ private class HorizontalCandidateView: NSView {
|
|||
}
|
||||
}
|
||||
|
||||
@objc(VTHorizontalCandidateController)
|
||||
public class HorizontalCandidateController: CandidateController {
|
||||
@objc public class ctlCandidateHorizontal: ctlCandidate {
|
||||
private var candidateView: HorizontalCandidateView
|
||||
private var prevPageButton: NSButton
|
||||
private var nextPageButton: NSButton
|
||||
|
@ -379,7 +378,7 @@ public class HorizontalCandidateController: CandidateController {
|
|||
}
|
||||
}
|
||||
|
||||
extension HorizontalCandidateController {
|
||||
extension ctlCandidateHorizontal {
|
||||
|
||||
private var pageCount: UInt {
|
||||
guard let delegate = delegate else {
|
||||
|
@ -402,7 +401,7 @@ extension HorizontalCandidateController {
|
|||
|
||||
let begin = currentPage * keyLabelCount
|
||||
for index in begin..<min(begin + keyLabelCount, count) {
|
||||
let candidate = delegate.candidateController(self, candidateAtIndex: index)
|
||||
let candidate = delegate.ctlCandidate(self, candidateAtIndex: index)
|
||||
candidates.append(candidate)
|
||||
}
|
||||
candidateView.set(
|
||||
|
@ -456,7 +455,7 @@ extension HorizontalCandidateController {
|
|||
}
|
||||
|
||||
@objc fileprivate func candidateViewMouseDidClick(_ sender: Any) {
|
||||
delegate?.candidateController(self, didSelectCandidateAtIndex: selectedCandidateIndex)
|
||||
delegate?.ctlCandidate(self, didSelectCandidateAtIndex: selectedCandidateIndex)
|
||||
}
|
||||
|
||||
}
|
|
@ -241,8 +241,7 @@ private class VerticalCandidateView: NSView {
|
|||
}
|
||||
}
|
||||
|
||||
@objc(VTVerticalCandidateController)
|
||||
public class VerticalCandidateController: CandidateController {
|
||||
@objc public class ctlCandidateVertical: ctlCandidate {
|
||||
private var candidateView: VerticalCandidateView
|
||||
private var prevPageButton: NSButton
|
||||
private var nextPageButton: NSButton
|
||||
|
@ -384,7 +383,7 @@ public class VerticalCandidateController: CandidateController {
|
|||
}
|
||||
}
|
||||
|
||||
extension VerticalCandidateController {
|
||||
extension ctlCandidateVertical {
|
||||
|
||||
private var pageCount: UInt {
|
||||
guard let delegate = delegate else {
|
||||
|
@ -407,7 +406,7 @@ extension VerticalCandidateController {
|
|||
|
||||
let begin = currentPage * keyLabelCount
|
||||
for index in begin..<min(begin + keyLabelCount, count) {
|
||||
let candidate = delegate.candidateController(self, candidateAtIndex: index)
|
||||
let candidate = delegate.ctlCandidate(self, candidateAtIndex: index)
|
||||
candidates.append(candidate)
|
||||
}
|
||||
candidateView.set(
|
||||
|
@ -461,7 +460,7 @@ extension VerticalCandidateController {
|
|||
}
|
||||
|
||||
@objc fileprivate func candidateViewMouseDidClick(_ sender: Any) {
|
||||
delegate?.candidateController(self, didSelectCandidateAtIndex: selectedCandidateIndex)
|
||||
delegate?.ctlCandidate(self, didSelectCandidateAtIndex: selectedCandidateIndex)
|
||||
}
|
||||
|
||||
}
|
|
@ -20,9 +20,9 @@
|
|||
5B62A33627AE795800A19448 /* mgrPrefs.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B62A33527AE795800A19448 /* mgrPrefs.swift */; };
|
||||
5B62A33827AE79CD00A19448 /* NSStringUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B62A33727AE79CD00A19448 /* NSStringUtils.swift */; };
|
||||
5B62A33D27AE7CC100A19448 /* ctlAboutWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B62A33C27AE7CC100A19448 /* ctlAboutWindow.swift */; };
|
||||
5B62A34627AE7CD900A19448 /* HorizontalCandidateController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B62A33F27AE7CD900A19448 /* HorizontalCandidateController.swift */; };
|
||||
5B62A34727AE7CD900A19448 /* CandidateController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B62A34027AE7CD900A19448 /* CandidateController.swift */; };
|
||||
5B62A34827AE7CD900A19448 /* VerticalCandidateController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B62A34127AE7CD900A19448 /* VerticalCandidateController.swift */; };
|
||||
5B62A34627AE7CD900A19448 /* ctlCandidateHorizontal.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B62A33F27AE7CD900A19448 /* ctlCandidateHorizontal.swift */; };
|
||||
5B62A34727AE7CD900A19448 /* ctlCandidate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B62A34027AE7CD900A19448 /* ctlCandidate.swift */; };
|
||||
5B62A34827AE7CD900A19448 /* ctlCandidateVertical.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B62A34127AE7CD900A19448 /* ctlCandidateVertical.swift */; };
|
||||
5B62A34927AE7CD900A19448 /* TooltipController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B62A34327AE7CD900A19448 /* TooltipController.swift */; };
|
||||
5B62A34A27AE7CD900A19448 /* NotifierController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B62A34527AE7CD900A19448 /* NotifierController.swift */; };
|
||||
5B62A35327AE89C400A19448 /* InputSourceHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B62A33127AE792F00A19448 /* InputSourceHelper.swift */; };
|
||||
|
@ -174,9 +174,9 @@
|
|||
5B62A33527AE795800A19448 /* mgrPrefs.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = mgrPrefs.swift; sourceTree = "<group>"; };
|
||||
5B62A33727AE79CD00A19448 /* NSStringUtils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NSStringUtils.swift; sourceTree = "<group>"; };
|
||||
5B62A33C27AE7CC100A19448 /* ctlAboutWindow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ctlAboutWindow.swift; sourceTree = "<group>"; };
|
||||
5B62A33F27AE7CD900A19448 /* HorizontalCandidateController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HorizontalCandidateController.swift; sourceTree = "<group>"; };
|
||||
5B62A34027AE7CD900A19448 /* CandidateController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CandidateController.swift; sourceTree = "<group>"; };
|
||||
5B62A34127AE7CD900A19448 /* VerticalCandidateController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = VerticalCandidateController.swift; sourceTree = "<group>"; };
|
||||
5B62A33F27AE7CD900A19448 /* ctlCandidateHorizontal.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ctlCandidateHorizontal.swift; sourceTree = "<group>"; };
|
||||
5B62A34027AE7CD900A19448 /* ctlCandidate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ctlCandidate.swift; sourceTree = "<group>"; };
|
||||
5B62A34127AE7CD900A19448 /* ctlCandidateVertical.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ctlCandidateVertical.swift; sourceTree = "<group>"; };
|
||||
5B62A34327AE7CD900A19448 /* TooltipController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TooltipController.swift; sourceTree = "<group>"; };
|
||||
5B62A34527AE7CD900A19448 /* NotifierController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NotifierController.swift; sourceTree = "<group>"; };
|
||||
5B707CE527D9F3A10099EF99 /* SwiftyOpenCC */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = SwiftyOpenCC; path = Packages/SwiftyOpenCC; sourceTree = "<group>"; };
|
||||
|
@ -505,9 +505,9 @@
|
|||
5B62A33E27AE7CD900A19448 /* CandidateUI */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
5B62A33F27AE7CD900A19448 /* HorizontalCandidateController.swift */,
|
||||
5B62A34027AE7CD900A19448 /* CandidateController.swift */,
|
||||
5B62A34127AE7CD900A19448 /* VerticalCandidateController.swift */,
|
||||
5B62A34027AE7CD900A19448 /* ctlCandidate.swift */,
|
||||
5B62A33F27AE7CD900A19448 /* ctlCandidateHorizontal.swift */,
|
||||
5B62A34127AE7CD900A19448 /* ctlCandidateVertical.swift */,
|
||||
);
|
||||
path = CandidateUI;
|
||||
sourceTree = "<group>";
|
||||
|
@ -984,12 +984,12 @@
|
|||
5B5E535227EF261400C6AA1E /* IME.swift in Sources */,
|
||||
5B62A34927AE7CD900A19448 /* TooltipController.swift in Sources */,
|
||||
6A0D4F4515FC0EB100ABF4B3 /* Mandarin.cpp in Sources */,
|
||||
5B62A34827AE7CD900A19448 /* VerticalCandidateController.swift in Sources */,
|
||||
5B62A34827AE7CD900A19448 /* ctlCandidateVertical.swift in Sources */,
|
||||
6ACC3D452793701600F1B140 /* ParselessLM.cpp in Sources */,
|
||||
5BBBB77A27AEDC690023B93A /* clsSFX.swift in Sources */,
|
||||
5BF8423127BAA942008E7E4C /* vChewingKanjiConverter.swift in Sources */,
|
||||
5B62A34627AE7CD900A19448 /* HorizontalCandidateController.swift in Sources */,
|
||||
5B62A34727AE7CD900A19448 /* CandidateController.swift in Sources */,
|
||||
5B62A34627AE7CD900A19448 /* ctlCandidateHorizontal.swift in Sources */,
|
||||
5B62A34727AE7CD900A19448 /* ctlCandidate.swift in Sources */,
|
||||
D41355DE278EA3ED005E5CBD /* UserPhrasesLM.mm in Sources */,
|
||||
6ACC3D3F27914F2400F1B140 /* KeyValueBlobReader.cpp in Sources */,
|
||||
D41355D8278D74B5005E5CBD /* mgrLangModel.mm in Sources */,
|
||||
|
|
Loading…
Reference in New Issue