CtlCandidateTDK // DIfferentiate page flipping and row flipping.
This commit is contained in:
parent
b38938de54
commit
cef1a2a3f5
|
@ -65,12 +65,28 @@ public class CtlCandidateTDK: CtlCandidate {
|
||||||
}
|
}
|
||||||
|
|
||||||
@discardableResult override public func showNextPage() -> Bool {
|
@discardableResult override public func showNextPage() -> Bool {
|
||||||
thePool.selectNewNeighborRow(direction: .down)
|
for _ in 0..<6 {
|
||||||
|
thePool.selectNewNeighborRow(direction: .down)
|
||||||
|
}
|
||||||
updateDisplay()
|
updateDisplay()
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
@discardableResult override public func showPreviousPage() -> Bool {
|
@discardableResult override public func showPreviousPage() -> Bool {
|
||||||
|
for _ in 0..<6 {
|
||||||
|
thePool.selectNewNeighborRow(direction: .up)
|
||||||
|
}
|
||||||
|
updateDisplay()
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
@discardableResult public func showNextLine() -> Bool {
|
||||||
|
thePool.selectNewNeighborRow(direction: .down)
|
||||||
|
updateDisplay()
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
@discardableResult public func showPreviousLine() -> Bool {
|
||||||
thePool.selectNewNeighborRow(direction: .up)
|
thePool.selectNewNeighborRow(direction: .up)
|
||||||
updateDisplay()
|
updateDisplay()
|
||||||
return true
|
return true
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
/// 該檔案乃按鍵調度模組當中「用來規定在選字窗出現時的按鍵行為」的部分。
|
/// 該檔案乃按鍵調度模組當中「用來規定在選字窗出現時的按鍵行為」的部分。
|
||||||
|
|
||||||
|
import CandidateWindow
|
||||||
import Shared
|
import Shared
|
||||||
|
|
||||||
// MARK: - § 對選字狀態進行調度 (Handle Candidate State).
|
// MARK: - § 對選字狀態進行調度 (Handle Candidate State).
|
||||||
|
@ -162,8 +163,21 @@ extension KeyHandler {
|
||||||
if input.isUp {
|
if input.isUp {
|
||||||
switch ctlCandidate.currentLayout {
|
switch ctlCandidate.currentLayout {
|
||||||
case .horizontal:
|
case .horizontal:
|
||||||
if !ctlCandidate.showPreviousPage() {
|
if #available(macOS 12, *) {
|
||||||
errorCallback("9B614524")
|
if let ctlCandidate = ctlCandidate as? CtlCandidateTDK {
|
||||||
|
ctlCandidate.showPreviousLine()
|
||||||
|
break
|
||||||
|
} else {
|
||||||
|
if !ctlCandidate.showPreviousPage() {
|
||||||
|
errorCallback("9B614524")
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if !ctlCandidate.showPreviousPage() {
|
||||||
|
errorCallback("9B614524")
|
||||||
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
case .vertical:
|
case .vertical:
|
||||||
if !ctlCandidate.highlightPreviousCandidate() {
|
if !ctlCandidate.highlightPreviousCandidate() {
|
||||||
|
@ -180,8 +194,21 @@ extension KeyHandler {
|
||||||
if input.isDown {
|
if input.isDown {
|
||||||
switch ctlCandidate.currentLayout {
|
switch ctlCandidate.currentLayout {
|
||||||
case .horizontal:
|
case .horizontal:
|
||||||
if !ctlCandidate.showNextPage() {
|
if #available(macOS 12, *) {
|
||||||
errorCallback("92B990DD")
|
if let ctlCandidate = ctlCandidate as? CtlCandidateTDK {
|
||||||
|
ctlCandidate.showNextLine()
|
||||||
|
break
|
||||||
|
} else {
|
||||||
|
if !ctlCandidate.showNextPage() {
|
||||||
|
errorCallback("92B990DD")
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if !ctlCandidate.showNextPage() {
|
||||||
|
errorCallback("92B990DD")
|
||||||
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
case .vertical:
|
case .vertical:
|
||||||
if !ctlCandidate.highlightNextCandidate() {
|
if !ctlCandidate.highlightNextCandidate() {
|
||||||
|
@ -294,8 +321,16 @@ extension KeyHandler {
|
||||||
// MARK: - Flipping pages by using symbol menu keys (when they are not occupied).
|
// MARK: - Flipping pages by using symbol menu keys (when they are not occupied).
|
||||||
|
|
||||||
if input.isSymbolMenuPhysicalKey {
|
if input.isSymbolMenuPhysicalKey {
|
||||||
let updated: Bool =
|
var updated = true
|
||||||
input.isShiftHold ? ctlCandidate.showPreviousPage() : ctlCandidate.showNextPage()
|
if #available(macOS 12, *) {
|
||||||
|
if let ctlCandidate = ctlCandidate as? CtlCandidateTDK {
|
||||||
|
updated = input.isShiftHold ? ctlCandidate.showPreviousLine() : ctlCandidate.showNextLine()
|
||||||
|
} else {
|
||||||
|
updated = input.isShiftHold ? ctlCandidate.showPreviousPage() : ctlCandidate.showNextPage()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
updated = input.isShiftHold ? ctlCandidate.showPreviousPage() : ctlCandidate.showNextPage()
|
||||||
|
}
|
||||||
if !updated {
|
if !updated {
|
||||||
errorCallback("66F3477B")
|
errorCallback("66F3477B")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue