From 80a1c11cbd6d58ea67ec44c6d449876e293c9dfe Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Wed, 6 Jul 2022 11:30:35 +0800 Subject: [PATCH] ctlIME // Move kMinKeyLabelSize to mgrPrefs. --- Source/Modules/ControllerModules/ctlInputMethod_Core.swift | 5 +---- Source/Modules/IMEModules/mgrPrefs.swift | 4 +++- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Source/Modules/ControllerModules/ctlInputMethod_Core.swift b/Source/Modules/ControllerModules/ctlInputMethod_Core.swift index fa8c578e..91265975 100644 --- a/Source/Modules/ControllerModules/ctlInputMethod_Core.swift +++ b/Source/Modules/ControllerModules/ctlInputMethod_Core.swift @@ -27,9 +27,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. import Cocoa import InputMethodKit -/// 最小選字鍵字號。 -private let kMinKeyLabelSize: CGFloat = 10 - /// 目前在用的的選字窗副本。 private var ctlCandidateCurrent = ctlCandidateUniversal.init(.horizontal) @@ -488,7 +485,7 @@ extension ctlInputMethod { // set the attributes for the candidate panel (which uses NSAttributedString) let textSize = mgrPrefs.candidateListTextSize - let keyLabelSize = max(textSize / 2, kMinKeyLabelSize) + let keyLabelSize = max(textSize / 2, mgrPrefs.minKeyLabelSize) func labelFont(name: String?, size: CGFloat) -> NSFont { if let name = name { diff --git a/Source/Modules/IMEModules/mgrPrefs.swift b/Source/Modules/IMEModules/mgrPrefs.swift index 6bf13e1f..61ef3134 100644 --- a/Source/Modules/IMEModules/mgrPrefs.swift +++ b/Source/Modules/IMEModules/mgrPrefs.swift @@ -75,7 +75,7 @@ struct UserDef { } private let kDefaultCandidateListTextSize: CGFloat = 18 -private let kMinKeyLabelSize: CGFloat = 10 +private let kDefaultMinKeyLabelSize: CGFloat = 10 private let kMinCandidateListTextSize: CGFloat = 12 private let kMaxCandidateListTextSize: CGFloat = 196 @@ -331,6 +331,8 @@ public enum mgrPrefs { @CandidateListTextSize(key: UserDef.kCandidateListTextSize) static var candidateListTextSize: CGFloat + static var minKeyLabelSize: CGFloat { kDefaultMinKeyLabelSize } + @UserDefault(key: UserDef.kShouldAutoReloadUserDataFiles, defaultValue: true) static var shouldAutoReloadUserDataFiles: Bool