diff --git a/Packages/vChewing_CandidateWindow/Sources/CandidateWindow/TDKCandidates/CtlCandidateTDK.swift b/Packages/vChewing_CandidateWindow/Sources/CandidateWindow/TDKCandidates/CtlCandidateTDK.swift index 14755e89..50f44ed8 100644 --- a/Packages/vChewing_CandidateWindow/Sources/CandidateWindow/TDKCandidates/CtlCandidateTDK.swift +++ b/Packages/vChewing_CandidateWindow/Sources/CandidateWindow/TDKCandidates/CtlCandidateTDK.swift @@ -111,6 +111,7 @@ public class CtlCandidateTDK: CtlCandidate, NSWindowDelegate { if let currentCandidateText = Self.thePool.currentSelectedCandidateText { reverseLookupResult = delegate?.reverseLookup(for: currentCandidateText) ?? [] Self.thePool.reverseLookupResult = reverseLookupResult + Self.thePool.tooltip = delegate?.candidateToolTip(shortened: !Self.thePool.isMatrix) ?? "" } delegate?.candidatePairHighlightChanged(at: highlightedIndex) DispatchQueue.main.async { [self] in diff --git a/Packages/vChewing_MainAssembly/Sources/MainAssembly/SessionCtl_Delegates.swift b/Packages/vChewing_MainAssembly/Sources/MainAssembly/SessionCtl_Delegates.swift index c8cb811d..8b1fd3c7 100644 --- a/Packages/vChewing_MainAssembly/Sources/MainAssembly/SessionCtl_Delegates.swift +++ b/Packages/vChewing_MainAssembly/Sources/MainAssembly/SessionCtl_Delegates.swift @@ -92,6 +92,19 @@ extension SessionCtl: CtlCandidateDelegate { public var showReverseLookupResult: Bool { PrefMgr.shared.showReverseLookupInCandidateUI } + public func candidateToolTip(shortened: Bool) -> String { + if state.type == .ofAssociates { + return shortened ? "⇧" : NSLocalizedString("Hold ⇧ to choose associates.", comment: "") + } else if state.type == .ofInputting, state.isCandidateContainer { + let useShift = LMMgr.currentLM.areCassetteCandidateKeysShiftHeld + let theEmoji = useShift ? "⬆️" : "⚡️" + return shortened ? theEmoji : "\(theEmoji) " + NSLocalizedString("Quick Candidates", comment: "") + } else if PrefMgr.shared.cassetteEnabled { + return shortened ? "📼" : "📼 " + NSLocalizedString("CIN Cassette Mode", comment: "") + } + return "" + } + @discardableResult public func reverseLookup(for value: String) -> [String] { let blankResult: [String] = [] // 這一段專門處理「反查」。 diff --git a/Packages/vChewing_MainAssembly/Sources/MainAssembly/SessionCtl_HandleDisplay.swift b/Packages/vChewing_MainAssembly/Sources/MainAssembly/SessionCtl_HandleDisplay.swift index ea983f18..768abb7d 100644 --- a/Packages/vChewing_MainAssembly/Sources/MainAssembly/SessionCtl_HandleDisplay.swift +++ b/Packages/vChewing_MainAssembly/Sources/MainAssembly/SessionCtl_HandleDisplay.swift @@ -96,19 +96,6 @@ public extension SessionCtl { name: PrefMgr.shared.candidateTextFontName, size: PrefMgr.shared.candidateListTextSize ) - if state.type == .ofAssociates { - candidateUI?.tooltip = - singleLine ? "⇧" : NSLocalizedString("Hold ⇧ to choose associates.", comment: "") - } else if state.type == .ofInputting, state.isCandidateContainer { - let useShift = LMMgr.currentLM.areCassetteCandidateKeysShiftHeld - let theEmoji = useShift ? "⬆️" : "⚡️" - candidateUI?.tooltip = - singleLine ? theEmoji : "\(theEmoji) " + NSLocalizedString("Quick Candidates", comment: "") - } else if PrefMgr.shared.cassetteEnabled { - candidateUI?.tooltip = - singleLine ? "📼" : "📼 " + NSLocalizedString("CIN Cassette Mode", comment: "") - } - candidateUI?.locale = { switch inputMode { case .imeModeCHS: return "zh-Hans" diff --git a/Packages/vChewing_Shared/Sources/Shared/Protocols/CtlCandidateProtocol.swift b/Packages/vChewing_Shared/Sources/Shared/Protocols/CtlCandidateProtocol.swift index 135c8188..113a5297 100644 --- a/Packages/vChewing_Shared/Sources/Shared/Protocols/CtlCandidateProtocol.swift +++ b/Packages/vChewing_Shared/Sources/Shared/Protocols/CtlCandidateProtocol.swift @@ -13,7 +13,7 @@ public protocol CtlCandidateDelegate { func candidatePairSelectionConfirmed(at index: Int) func candidatePairHighlightChanged(at index: Int) func candidatePairRightClicked(at index: Int, action: CandidateContextMenuAction) - func candidates(_ sender: Any!) -> [Any]! + func candidateToolTip(shortened: Bool) -> String func resetCandidateWindowOrigin() @discardableResult func reverseLookup(for value: String) -> [String] var selectionKeys: String { get }