InputHander // Show tooltip for standalone intonation marks.

This commit is contained in:
ShikiSuen 2023-05-07 23:42:57 +08:00
parent ce611799dc
commit 6963784e59
8 changed files with 32 additions and 2 deletions

View File

@ -167,12 +167,14 @@ public class NSAttributedTooltipTextView: NSAttributedTextView {
text = text.replacingOccurrences(of: "Command", with: "") text = text.replacingOccurrences(of: "Command", with: "")
text = text.replacingOccurrences(of: "Delete", with: "") text = text.replacingOccurrences(of: "Delete", with: "")
text = text.replacingOccurrences(of: "BackSpace", with: "") text = text.replacingOccurrences(of: "BackSpace", with: "")
text = text.replacingOccurrences(of: "Space", with: "")
text = text.replacingOccurrences(of: "SHIFT", with: "") text = text.replacingOccurrences(of: "SHIFT", with: "")
text = text.replacingOccurrences(of: "CONTROL", with: "") text = text.replacingOccurrences(of: "CONTROL", with: "")
text = text.replacingOccurrences(of: "ENTER", with: "") text = text.replacingOccurrences(of: "ENTER", with: "")
text = text.replacingOccurrences(of: "COMMAND", with: "") text = text.replacingOccurrences(of: "COMMAND", with: "")
text = text.replacingOccurrences(of: "DELETE", with: "") text = text.replacingOccurrences(of: "DELETE", with: "")
text = text.replacingOccurrences(of: "BACKSPACE", with: "") text = text.replacingOccurrences(of: "BACKSPACE", with: "")
text = text.replacingOccurrences(of: "SPACE", with: "")
} }
if areaCalculation { if areaCalculation {
text = text.replacingOccurrences( text = text.replacingOccurrences(

View File

@ -184,7 +184,11 @@ extension InputHandler {
return nil return nil
} }
// setInlineDisplayWithCursor() // setInlineDisplayWithCursor()
delegate.switchState(generateStateOfInputting()) var resultState = generateStateOfInputting()
resultState.tooltip = tooltipForStandaloneIntonationMark
resultState.tooltipDuration = 0
resultState.data.tooltipColorState = .prompt
delegate.switchState(resultState)
return true return true
} }
return nil return nil

View File

@ -68,7 +68,21 @@ extension InputHandler {
) )
} }
/// /// 調
var tooltipForStandaloneIntonationMark: String {
guard !isComposerUsingPinyin else { return "" }
guard composer.hasIntonation(withNothingElse: true) else { return "" }
guard composer.intonation.value != " " else { return "" }
let result = NSMutableString()
result.append("Intonation mark. ENTER to commit.\nSPACE to insert into composition buffer.".localized)
if prefs.acceptLeadingIntonations {
result.append("\n")
result.append("It will attempt to combine with the incoming phonabet input.".localized)
}
return result.description
}
///
/// - Parameter rawCursor: /// - Parameter rawCursor:
/// - Returns: /// - Returns:
func convertCursorForDisplay(_ rawCursor: Int) -> Int { func convertCursorForDisplay(_ rawCursor: Int) -> Int {

View File

@ -1,4 +1,6 @@
"vChewing" = "vChewing"; "vChewing" = "vChewing";
"It will attempt to combine with the incoming phonabet input." = "It will attempt to combine with the incoming phonabet input.";
"Intonation mark. ENTER to commit.\nSPACE to insert into composition buffer." = "Intonation mark. ENTER to commit.\nSPACE to insert into composition buffer.";
"CHS / CHT Input Mode Switch" = "CHS / CHT Input Mode Switch"; "CHS / CHT Input Mode Switch" = "CHS / CHT Input Mode Switch";
"Switch to %@ Input Mode" = "Switch to %@ Input Mode"; "Switch to %@ Input Mode" = "Switch to %@ Input Mode";
"Target Input Mode Activation Required" = "Target Input Mode Activation Required"; "Target Input Mode Activation Required" = "Target Input Mode Activation Required";

View File

@ -1,4 +1,6 @@
"vChewing" = "vChewing"; "vChewing" = "vChewing";
"It will attempt to combine with the incoming phonabet input." = "It will attempt to combine with the incoming phonabet input.";
"Intonation mark. ENTER to commit.\nSPACE to insert into composition buffer." = "Intonation mark. ENTER to commit.\nSPACE to insert into composition buffer.";
"CHS / CHT Input Mode Switch" = "CHS / CHT Input Mode Switch"; "CHS / CHT Input Mode Switch" = "CHS / CHT Input Mode Switch";
"Switch to %@ Input Mode" = "Switch to %@ Input Mode"; "Switch to %@ Input Mode" = "Switch to %@ Input Mode";
"Target Input Mode Activation Required" = "Target Input Mode Activation Required"; "Target Input Mode Activation Required" = "Target Input Mode Activation Required";

View File

@ -1,4 +1,6 @@
"vChewing" = "威注音入力アプリ"; "vChewing" = "威注音入力アプリ";
"It will attempt to combine with the incoming phonabet input." = "この音調は次の注音入力と組み合わす。";
"Intonation mark. ENTER to commit.\nSPACE to insert into composition buffer." = "音調記号。ENTER で送り出す。\nSPACE で入力緩衝列に挿入。";
"CHS / CHT Input Mode Switch" = "簡体・繁体中国語入力の切り替え"; "CHS / CHT Input Mode Switch" = "簡体・繁体中国語入力の切り替え";
"Switch to %@ Input Mode" = "%@入力モードに切り替え"; "Switch to %@ Input Mode" = "%@入力モードに切り替え";
"Target Input Mode Activation Required" = "関連の入力ソースの追加が必要"; "Target Input Mode Activation Required" = "関連の入力ソースの追加が必要";

View File

@ -1,4 +1,6 @@
"vChewing" = "威注音输入法"; "vChewing" = "威注音输入法";
"It will attempt to combine with the incoming phonabet input." = "该声调亦会尝试与接下来输入的注音相组合。";
"Intonation mark. ENTER to commit.\nSPACE to insert into composition buffer." = "声调符号。敲 Enter 以递交。\n敲空格键以插入组字区。";
"CHS / CHT Input Mode Switch" = "简体/繁体中文输入模式切换"; "CHS / CHT Input Mode Switch" = "简体/繁体中文输入模式切换";
"Switch to %@ Input Mode" = "切换至%@输入模式"; "Switch to %@ Input Mode" = "切换至%@输入模式";
"Target Input Mode Activation Required" = "得启用对应的「輸入法」"; "Target Input Mode Activation Required" = "得启用对应的「輸入法」";

View File

@ -1,4 +1,6 @@
"vChewing" = "威注音輸入法"; "vChewing" = "威注音輸入法";
"It will attempt to combine with the incoming phonabet input." = "該聲調亦會嘗試與接下來輸入的注音相組合。";
"Intonation mark. ENTER to commit.\nSPACE to insert into composition buffer." = "聲調符號。敲 Enter 以遞交。\n敲空格鍵以插入組字區。";
"CHS / CHT Input Mode Switch" = "簡體/繁體中文輸入模式切換"; "CHS / CHT Input Mode Switch" = "簡體/繁體中文輸入模式切換";
"Switch to %@ Input Mode" = "切換至%@輸入模式"; "Switch to %@ Input Mode" = "切換至%@輸入模式";
"Target Input Mode Activation Required" = "得啟用對應的「輸入方式」"; "Target Input Mode Activation Required" = "得啟用對應的「輸入方式」";