PrefUI // Make tab pages scrollable if too large.

This commit is contained in:
ShikiSuen 2022-08-19 10:46:06 +08:00
parent 4af7ad6c9d
commit c5740fb204
5 changed files with 560 additions and 541 deletions

View File

@ -16,6 +16,8 @@ struct suiPrefPaneDevZone: View {
forKey: UserDef.kHandleDefaultCandidateFontsByLangIdentifier.rawValue)
@State private var selShouldAlwaysUseShiftKeyAccommodation: Bool = UserDefaults.standard.bool(
forKey: UserDef.kShouldAlwaysUseShiftKeyAccommodation.rawValue)
private let contentMaxHeight: Double = 430
private let contentWidth: Double = {
switch mgrPrefs.appleLanguages[0] {
case "ja":
@ -30,48 +32,50 @@ struct suiPrefPaneDevZone: View {
}()
var body: some View {
Preferences.Container(contentWidth: contentWidth) {
Preferences.Section(title: "", bottomDivider: true) {
Text(
LocalizedStringKey(
"Warning: This page is for testing future features. \nFeatures listed here may not work as expected.")
)
.fixedSize(horizontal: false, vertical: true)
Divider()
Toggle(
LocalizedStringKey("Use IMK Candidate Window instead (will reboot the IME)"),
isOn: $selUseIMKCandidateWindow.onChange {
mgrPrefs.useIMKCandidateWindow = selUseIMKCandidateWindow
}
)
Text(LocalizedStringKey("IMK candidate window is plagued with issues and incapabilities."))
ScrollView {
Preferences.Container(contentWidth: contentWidth) {
Preferences.Section(title: "", bottomDivider: true) {
Text(
LocalizedStringKey(
"Warning: This page is for testing future features. \nFeatures listed here may not work as expected.")
)
.fixedSize(horizontal: false, vertical: true)
Divider()
Toggle(
LocalizedStringKey("Use IMK Candidate Window instead (will reboot the IME)"),
isOn: $selUseIMKCandidateWindow.onChange {
mgrPrefs.useIMKCandidateWindow = selUseIMKCandidateWindow
}
)
Text(LocalizedStringKey("IMK candidate window is plagued with issues and incapabilities."))
.preferenceDescription().fixedSize(horizontal: false, vertical: true)
Toggle(
LocalizedStringKey("Use .langIdentifier to handle UI fonts in candidate window"),
isOn: $selHandleDefaultCandidateFontsByLangIdentifier.onChange {
mgrPrefs.handleDefaultCandidateFontsByLangIdentifier = selHandleDefaultCandidateFontsByLangIdentifier
}
)
Text(
LocalizedStringKey(
"This only works since macOS 12 with non-IMK candidate window as an alternative wordaround of Apple Bug Report #FB10978412. Apple should patch that for macOS 11 and later."
)
)
.preferenceDescription().fixedSize(horizontal: false, vertical: true)
Toggle(
LocalizedStringKey("Use .langIdentifier to handle UI fonts in candidate window"),
isOn: $selHandleDefaultCandidateFontsByLangIdentifier.onChange {
mgrPrefs.handleDefaultCandidateFontsByLangIdentifier = selHandleDefaultCandidateFontsByLangIdentifier
}
)
Text(
LocalizedStringKey(
"This only works since macOS 12 with non-IMK candidate window as an alternative wordaround of Apple Bug Report #FB10978412. Apple should patch that for macOS 11 and later."
Toggle(
LocalizedStringKey("Use Shift Key Accommodation in all cases"),
isOn: $selShouldAlwaysUseShiftKeyAccommodation.onChange {
mgrPrefs.shouldAlwaysUseShiftKeyAccommodation = selShouldAlwaysUseShiftKeyAccommodation
}
)
)
.preferenceDescription().fixedSize(horizontal: false, vertical: true)
Toggle(
LocalizedStringKey("Use Shift Key Accommodation in all cases"),
isOn: $selShouldAlwaysUseShiftKeyAccommodation.onChange {
mgrPrefs.shouldAlwaysUseShiftKeyAccommodation = selShouldAlwaysUseShiftKeyAccommodation
}
)
Text(
LocalizedStringKey(
"Some client apps (like Chromium-cored browsers: MS Edge, Google Chrome, etc.) may duplicate Shift-key inputs due to their internal bugs, and their devs are less likely to fix their bugs of such. vChewing has its accommodation procedures enabled by default for known Chromium-cored browsers. If you want the same accommodation for other client apps, please tick this checkbox on."
Text(
LocalizedStringKey(
"Some client apps (like Chromium-cored browsers: MS Edge, Google Chrome, etc.) may duplicate Shift-key inputs due to their internal bugs, and their devs are less likely to fix their bugs of such. vChewing has its accommodation procedures enabled by default for known Chromium-cored browsers. If you want the same accommodation for other client apps, please tick this checkbox on."
)
)
)
.preferenceDescription().fixedSize(horizontal: false, vertical: true)
.preferenceDescription().fixedSize(horizontal: false, vertical: true)
}
}
}
}.frame(maxHeight: contentMaxHeight).fixedSize(horizontal: false, vertical: true)
}
}

View File

@ -25,6 +25,8 @@ struct suiPrefPaneDictionary: View {
forKey: UserDef.kFetchSuggestionsFromUserOverrideModel.rawValue)
@State private var selUseFixecCandidateOrderOnSelection: Bool = UserDefaults.standard.bool(
forKey: UserDef.kUseFixecCandidateOrderOnSelection.rawValue)
private let contentMaxHeight: Double = 430
private let contentWidth: Double = {
switch mgrPrefs.appleLanguages[0] {
case "ja":
@ -39,109 +41,111 @@ struct suiPrefPaneDictionary: View {
}()
var body: some View {
Preferences.Container(contentWidth: contentWidth) {
Preferences.Section(title: "", bottomDivider: true) {
Text(LocalizedStringKey("Choose your desired user data folder path. Will be omitted if invalid."))
HStack {
if #available(macOS 11.0, *) {
TextField(fdrDefault, text: $tbxUserDataPathSpecified).disabled(true)
.help(tbxUserDataPathSpecified)
} else {
TextField(fdrDefault, text: $tbxUserDataPathSpecified).disabled(true)
.toolTip(tbxUserDataPathSpecified)
}
Button {
IME.dlgOpenPath.title = NSLocalizedString(
"Choose your desired user data folder.", comment: ""
)
IME.dlgOpenPath.showsResizeIndicator = true
IME.dlgOpenPath.showsHiddenFiles = true
IME.dlgOpenPath.canChooseFiles = false
IME.dlgOpenPath.canChooseDirectories = true
ScrollView {
Preferences.Container(contentWidth: contentWidth) {
Preferences.Section(title: "", bottomDivider: true) {
Text(LocalizedStringKey("Choose your desired user data folder path. Will be omitted if invalid."))
HStack {
if #available(macOS 11.0, *) {
TextField(fdrDefault, text: $tbxUserDataPathSpecified).disabled(true)
.help(tbxUserDataPathSpecified)
} else {
TextField(fdrDefault, text: $tbxUserDataPathSpecified).disabled(true)
.toolTip(tbxUserDataPathSpecified)
}
Button {
IME.dlgOpenPath.title = NSLocalizedString(
"Choose your desired user data folder.", comment: ""
)
IME.dlgOpenPath.showsResizeIndicator = true
IME.dlgOpenPath.showsHiddenFiles = true
IME.dlgOpenPath.canChooseFiles = false
IME.dlgOpenPath.canChooseDirectories = true
let bolPreviousFolderValidity = mgrLangModel.checkIfSpecifiedUserDataFolderValid(
mgrPrefs.userDataFolderSpecified.expandingTildeInPath)
let bolPreviousFolderValidity = mgrLangModel.checkIfSpecifiedUserDataFolderValid(
mgrPrefs.userDataFolderSpecified.expandingTildeInPath)
if let window = ctlPrefUI.shared.controller.window {
IME.dlgOpenPath.beginSheetModal(for: window) { result in
if result == NSApplication.ModalResponse.OK {
if IME.dlgOpenPath.url != nil {
// CommonDialog
//
var newPath = IME.dlgOpenPath.url!.path
newPath.ensureTrailingSlash()
if mgrLangModel.checkIfSpecifiedUserDataFolderValid(newPath) {
mgrPrefs.userDataFolderSpecified = newPath
tbxUserDataPathSpecified = mgrPrefs.userDataFolderSpecified
IME.initLangModels(userOnly: true)
(NSApplication.shared.delegate as! AppDelegate).updateStreamHelperPath()
} else {
clsSFX.beep()
if !bolPreviousFolderValidity {
mgrPrefs.resetSpecifiedUserDataFolder()
if let window = ctlPrefUI.shared.controller.window {
IME.dlgOpenPath.beginSheetModal(for: window) { result in
if result == NSApplication.ModalResponse.OK {
if IME.dlgOpenPath.url != nil {
// CommonDialog
//
var newPath = IME.dlgOpenPath.url!.path
newPath.ensureTrailingSlash()
if mgrLangModel.checkIfSpecifiedUserDataFolderValid(newPath) {
mgrPrefs.userDataFolderSpecified = newPath
tbxUserDataPathSpecified = mgrPrefs.userDataFolderSpecified
IME.initLangModels(userOnly: true)
(NSApplication.shared.delegate as! AppDelegate).updateStreamHelperPath()
} else {
clsSFX.beep()
if !bolPreviousFolderValidity {
mgrPrefs.resetSpecifiedUserDataFolder()
}
return
}
return
}
} else {
if !bolPreviousFolderValidity {
mgrPrefs.resetSpecifiedUserDataFolder()
}
return
}
} else {
if !bolPreviousFolderValidity {
mgrPrefs.resetSpecifiedUserDataFolder()
}
return
}
}
} label: {
Text("...")
}
Button {
mgrPrefs.resetSpecifiedUserDataFolder()
tbxUserDataPathSpecified = ""
} label: {
Text("")
}
} label: {
Text("...")
}
Button {
mgrPrefs.resetSpecifiedUserDataFolder()
tbxUserDataPathSpecified = ""
} label: {
Text("")
}
Toggle(
LocalizedStringKey("Automatically reload user data files if changes detected"),
isOn: $selAutoReloadUserData.onChange {
mgrPrefs.shouldAutoReloadUserDataFiles = selAutoReloadUserData
}
).controlSize(.small)
Divider()
Toggle(
LocalizedStringKey("Enable CNS11643 Support (2022-07-20)"),
isOn: $selEnableCNS11643.onChange {
mgrPrefs.cns11643Enabled = selEnableCNS11643
mgrLangModel.setCNSEnabled(mgrPrefs.cns11643Enabled)
}
)
Toggle(
LocalizedStringKey("Enable symbol input support (incl. certain emoji symbols)"),
isOn: $selEnableSymbolInputSupport.onChange {
mgrPrefs.symbolInputEnabled = selEnableSymbolInputSupport
mgrLangModel.setSymbolEnabled(mgrPrefs.symbolInputEnabled)
}
)
Toggle(
LocalizedStringKey("Allow boosting / excluding a candidate of single kanji"),
isOn: $selAllowBoostingSingleKanjiAsUserPhrase.onChange {
mgrPrefs.allowBoostingSingleKanjiAsUserPhrase = selAllowBoostingSingleKanjiAsUserPhrase
}
)
Toggle(
LocalizedStringKey("Applying typing suggestions from half-life user override model"),
isOn: $selFetchSuggestionsFromUserOverrideModel.onChange {
mgrPrefs.fetchSuggestionsFromUserOverrideModel = selFetchSuggestionsFromUserOverrideModel
}
)
Toggle(
LocalizedStringKey("Always use fixed listing order in candidate window"),
isOn: $selUseFixecCandidateOrderOnSelection.onChange {
mgrPrefs.useFixecCandidateOrderOnSelection = selUseFixecCandidateOrderOnSelection
}
)
}
Toggle(
LocalizedStringKey("Automatically reload user data files if changes detected"),
isOn: $selAutoReloadUserData.onChange {
mgrPrefs.shouldAutoReloadUserDataFiles = selAutoReloadUserData
}
).controlSize(.small)
Divider()
Toggle(
LocalizedStringKey("Enable CNS11643 Support (2022-07-20)"),
isOn: $selEnableCNS11643.onChange {
mgrPrefs.cns11643Enabled = selEnableCNS11643
mgrLangModel.setCNSEnabled(mgrPrefs.cns11643Enabled)
}
)
Toggle(
LocalizedStringKey("Enable symbol input support (incl. certain emoji symbols)"),
isOn: $selEnableSymbolInputSupport.onChange {
mgrPrefs.symbolInputEnabled = selEnableSymbolInputSupport
mgrLangModel.setSymbolEnabled(mgrPrefs.symbolInputEnabled)
}
)
Toggle(
LocalizedStringKey("Allow boosting / excluding a candidate of single kanji"),
isOn: $selAllowBoostingSingleKanjiAsUserPhrase.onChange {
mgrPrefs.allowBoostingSingleKanjiAsUserPhrase = selAllowBoostingSingleKanjiAsUserPhrase
}
)
Toggle(
LocalizedStringKey("Applying typing suggestions from half-life user override model"),
isOn: $selFetchSuggestionsFromUserOverrideModel.onChange {
mgrPrefs.fetchSuggestionsFromUserOverrideModel = selFetchSuggestionsFromUserOverrideModel
}
)
Toggle(
LocalizedStringKey("Always use fixed listing order in candidate window"),
isOn: $selUseFixecCandidateOrderOnSelection.onChange {
mgrPrefs.useFixecCandidateOrderOnSelection = selUseFixecCandidateOrderOnSelection
}
)
}
}
}.frame(maxHeight: contentMaxHeight).fixedSize(horizontal: false, vertical: true)
}
}

View File

@ -38,6 +38,8 @@ struct suiPrefPaneExperience: View {
forKey: UserDef.kUpperCaseLetterKeyBehavior.rawValue)
@State private var selDisableShiftTogglingAlphanumericalMode: Bool = UserDefaults.standard.bool(
forKey: UserDef.kDisableShiftTogglingAlphanumericalMode.rawValue)
private let contentMaxHeight: Double = 430
private let contentWidth: Double = {
switch mgrPrefs.appleLanguages[0] {
case "ja":
@ -52,128 +54,130 @@ struct suiPrefPaneExperience: View {
}()
var body: some View {
Preferences.Container(contentWidth: contentWidth) {
Preferences.Section(label: { Text(LocalizedStringKey("Cursor Selection:")) }) {
Picker(
"",
selection: $selCursorPosition.onChange {
mgrPrefs.useRearCursorMode = (selCursorPosition == 1) ? true : false
ScrollView {
Preferences.Container(contentWidth: contentWidth) {
Preferences.Section(label: { Text(LocalizedStringKey("Cursor Selection:")) }) {
Picker(
"",
selection: $selCursorPosition.onChange {
mgrPrefs.useRearCursorMode = (selCursorPosition == 1) ? true : false
}
) {
Text(LocalizedStringKey("in front of the phrase (like macOS built-in Zhuyin IME)")).tag(0)
Text(LocalizedStringKey("at the rear of the phrase (like Microsoft New Phonetic)")).tag(1)
}
) {
Text(LocalizedStringKey("in front of the phrase (like macOS built-in Zhuyin IME)")).tag(0)
Text(LocalizedStringKey("at the rear of the phrase (like Microsoft New Phonetic)")).tag(1)
.labelsHidden()
.pickerStyle(RadioGroupPickerStyle())
Text(LocalizedStringKey("Choose the cursor position where you want to list possible candidates."))
.preferenceDescription()
Toggle(
LocalizedStringKey("Push the cursor in front of the phrase after selection"),
isOn: $selPushCursorAfterSelection.onChange {
mgrPrefs.moveCursorAfterSelectingCandidate = selPushCursorAfterSelection
}
).controlSize(.small)
}
.labelsHidden()
.pickerStyle(RadioGroupPickerStyle())
Text(LocalizedStringKey("Choose the cursor position where you want to list possible candidates."))
.preferenceDescription()
Toggle(
LocalizedStringKey("Push the cursor in front of the phrase after selection"),
isOn: $selPushCursorAfterSelection.onChange {
mgrPrefs.moveCursorAfterSelectingCandidate = selPushCursorAfterSelection
Preferences.Section(title: "(Shift+)Tab:") {
Picker(
"",
selection: $selKeyBehaviorShiftTab.onChange {
mgrPrefs.specifyShiftTabKeyBehavior = (selKeyBehaviorShiftTab == 1) ? true : false
}
) {
Text(LocalizedStringKey("for cycling candidates")).tag(0)
Text(LocalizedStringKey("for cycling pages")).tag(1)
}
).controlSize(.small)
}
Preferences.Section(title: "(Shift+)Tab:") {
Picker(
"",
selection: $selKeyBehaviorShiftTab.onChange {
mgrPrefs.specifyShiftTabKeyBehavior = (selKeyBehaviorShiftTab == 1) ? true : false
}
) {
Text(LocalizedStringKey("for cycling candidates")).tag(0)
Text(LocalizedStringKey("for cycling pages")).tag(1)
.labelsHidden()
.horizontalRadioGroupLayout()
.pickerStyle(RadioGroupPickerStyle())
Text(LocalizedStringKey("Choose the behavior of (Shift+)Tab key in the candidate window."))
.preferenceDescription()
}
.labelsHidden()
.horizontalRadioGroupLayout()
.pickerStyle(RadioGroupPickerStyle())
Text(LocalizedStringKey("Choose the behavior of (Shift+)Tab key in the candidate window."))
.preferenceDescription()
}
Preferences.Section(label: { Text(LocalizedStringKey("(Shift+)Space:")) }) {
Picker(
"",
selection: $selKeyBehaviorShiftSpace.onChange {
mgrPrefs.specifyShiftSpaceKeyBehavior = (selKeyBehaviorShiftSpace == 1) ? true : false
Preferences.Section(label: { Text(LocalizedStringKey("(Shift+)Space:")) }) {
Picker(
"",
selection: $selKeyBehaviorShiftSpace.onChange {
mgrPrefs.specifyShiftSpaceKeyBehavior = (selKeyBehaviorShiftSpace == 1) ? true : false
}
) {
Text(LocalizedStringKey("Space to +cycle candidates, Shift+Space to +cycle pages")).tag(0)
Text(LocalizedStringKey("Space to +cycle pages, Shift+Space to +cycle candidates")).tag(1)
}
) {
Text(LocalizedStringKey("Space to +cycle candidates, Shift+Space to +cycle pages")).tag(0)
Text(LocalizedStringKey("Space to +cycle pages, Shift+Space to +cycle candidates")).tag(1)
.labelsHidden()
.pickerStyle(RadioGroupPickerStyle())
Text(LocalizedStringKey("Choose the behavior of (Shift+)Space key with candidates."))
.preferenceDescription()
}
.labelsHidden()
.pickerStyle(RadioGroupPickerStyle())
Text(LocalizedStringKey("Choose the behavior of (Shift+)Space key with candidates."))
.preferenceDescription()
}
Preferences.Section(label: { Text(LocalizedStringKey("Shift+Letter:")) }) {
Picker(
"",
selection: $selUpperCaseLetterKeyBehavior.onChange {
mgrPrefs.upperCaseLetterKeyBehavior = selUpperCaseLetterKeyBehavior
Preferences.Section(label: { Text(LocalizedStringKey("Shift+Letter:")) }) {
Picker(
"",
selection: $selUpperCaseLetterKeyBehavior.onChange {
mgrPrefs.upperCaseLetterKeyBehavior = selUpperCaseLetterKeyBehavior
}
) {
Text(LocalizedStringKey("Type them into inline composition buffer")).tag(0)
Text(LocalizedStringKey("Directly commit lowercased letters")).tag(1)
Text(LocalizedStringKey("Directly commit uppercased letters")).tag(2)
}
) {
Text(LocalizedStringKey("Type them into inline composition buffer")).tag(0)
Text(LocalizedStringKey("Directly commit lowercased letters")).tag(1)
Text(LocalizedStringKey("Directly commit uppercased letters")).tag(2)
.labelsHidden()
.pickerStyle(RadioGroupPickerStyle())
Text(LocalizedStringKey("Choose the behavior of Shift+Letter key with letter inputs."))
.preferenceDescription()
}
Preferences.Section(label: { Text(LocalizedStringKey("Misc Settings:")) }) {
Toggle(
LocalizedStringKey("Enable Space key for calling candidate window"),
isOn: $selKeyBehaviorSpaceForCallingCandidate.onChange {
mgrPrefs.chooseCandidateUsingSpace = selKeyBehaviorSpaceForCallingCandidate
}
)
Toggle(
LocalizedStringKey("Use ESC key to clear the entire input buffer"),
isOn: $selKeyBehaviorESCForClearingTheBuffer.onChange {
mgrPrefs.escToCleanInputBuffer = selKeyBehaviorESCForClearingTheBuffer
}
)
Toggle(
LocalizedStringKey("Automatically correct reading combinations when typing"),
isOn: $selAutoCorrectReadingCombination.onChange {
mgrPrefs.autoCorrectReadingCombination = selAutoCorrectReadingCombination
}
)
Toggle(
LocalizedStringKey("Allow using Enter key to confirm associated candidate selection"),
isOn: $selAlsoConfirmAssociatedCandidatesByEnter.onChange {
mgrPrefs.alsoConfirmAssociatedCandidatesByEnter = selAlsoConfirmAssociatedCandidatesByEnter
}
)
Toggle(
LocalizedStringKey("Also toggle alphanumerical mode with Left-Shift"),
isOn: $selTogglingAlphanumericalModeWithLShift.onChange {
mgrPrefs.togglingAlphanumericalModeWithLShift = selTogglingAlphanumericalModeWithLShift
}
).disabled(mgrPrefs.disableShiftTogglingAlphanumericalMode == true)
Toggle(
LocalizedStringKey("Completely disable using Shift key to toggling alphanumerical mode"),
isOn: $selDisableShiftTogglingAlphanumericalMode.onChange {
mgrPrefs.disableShiftTogglingAlphanumericalMode = selDisableShiftTogglingAlphanumericalMode
}
)
Toggle(
LocalizedStringKey("Allow backspace-editing miscomposed readings"),
isOn: $selKeepReadingUponCompositionError.onChange {
mgrPrefs.keepReadingUponCompositionError = selKeepReadingUponCompositionError
}
)
Toggle(
LocalizedStringKey("Emulating select-candidate-per-character mode"),
isOn: $selEnableSCPCTypingMode.onChange {
mgrPrefs.useSCPCTypingMode = selEnableSCPCTypingMode
}
)
Text(LocalizedStringKey("An accommodation for elder computer users."))
.preferenceDescription()
}
.labelsHidden()
.pickerStyle(RadioGroupPickerStyle())
Text(LocalizedStringKey("Choose the behavior of Shift+Letter key with letter inputs."))
.preferenceDescription()
}
Preferences.Section(label: { Text(LocalizedStringKey("Misc Settings:")) }) {
Toggle(
LocalizedStringKey("Enable Space key for calling candidate window"),
isOn: $selKeyBehaviorSpaceForCallingCandidate.onChange {
mgrPrefs.chooseCandidateUsingSpace = selKeyBehaviorSpaceForCallingCandidate
}
)
Toggle(
LocalizedStringKey("Use ESC key to clear the entire input buffer"),
isOn: $selKeyBehaviorESCForClearingTheBuffer.onChange {
mgrPrefs.escToCleanInputBuffer = selKeyBehaviorESCForClearingTheBuffer
}
)
Toggle(
LocalizedStringKey("Automatically correct reading combinations when typing"),
isOn: $selAutoCorrectReadingCombination.onChange {
mgrPrefs.autoCorrectReadingCombination = selAutoCorrectReadingCombination
}
)
Toggle(
LocalizedStringKey("Allow using Enter key to confirm associated candidate selection"),
isOn: $selAlsoConfirmAssociatedCandidatesByEnter.onChange {
mgrPrefs.alsoConfirmAssociatedCandidatesByEnter = selAlsoConfirmAssociatedCandidatesByEnter
}
)
Toggle(
LocalizedStringKey("Also toggle alphanumerical mode with Left-Shift"),
isOn: $selTogglingAlphanumericalModeWithLShift.onChange {
mgrPrefs.togglingAlphanumericalModeWithLShift = selTogglingAlphanumericalModeWithLShift
}
).disabled(mgrPrefs.disableShiftTogglingAlphanumericalMode == true)
Toggle(
LocalizedStringKey("Completely disable using Shift key to toggling alphanumerical mode"),
isOn: $selDisableShiftTogglingAlphanumericalMode.onChange {
mgrPrefs.disableShiftTogglingAlphanumericalMode = selDisableShiftTogglingAlphanumericalMode
}
)
Toggle(
LocalizedStringKey("Allow backspace-editing miscomposed readings"),
isOn: $selKeepReadingUponCompositionError.onChange {
mgrPrefs.keepReadingUponCompositionError = selKeepReadingUponCompositionError
}
)
Toggle(
LocalizedStringKey("Emulating select-candidate-per-character mode"),
isOn: $selEnableSCPCTypingMode.onChange {
mgrPrefs.useSCPCTypingMode = selEnableSCPCTypingMode
}
)
Text(LocalizedStringKey("An accommodation for elder computer users."))
.preferenceDescription()
}
}
}.frame(maxHeight: contentMaxHeight).fixedSize(horizontal: false, vertical: true)
}
}

View File

@ -37,6 +37,8 @@ struct suiPrefPaneGeneral: View {
@State private var selEnableAutoUpdateCheck = UserDefaults.standard.bool(
forKey: UserDef.kCheckUpdateAutomatically.rawValue)
@State private var selEnableDebugMode = UserDefaults.standard.bool(forKey: UserDef.kIsDebugModeEnabled.rawValue)
private let contentMaxHeight: Double = 430
private let contentWidth: Double = {
switch mgrPrefs.appleLanguages[0] {
case "ja":
@ -51,135 +53,137 @@ struct suiPrefPaneGeneral: View {
}()
var body: some View {
Preferences.Container(contentWidth: contentWidth) {
Preferences.Section(bottomDivider: false, label: { Text(LocalizedStringKey("Candidate Size:")) }) {
Picker(
"",
selection: $selCandidateUIFontSize.onChange {
mgrPrefs.candidateListTextSize = CGFloat(selCandidateUIFontSize)
}
) {
Text("12").tag(12)
Text("14").tag(14)
Text("16").tag(16)
Text("18").tag(18)
Text("24").tag(24)
Text("32").tag(32)
Text("64").tag(64)
Text("96").tag(96)
}
.labelsHidden()
.frame(width: 120.0)
Text(LocalizedStringKey("Choose candidate font size for better visual clarity."))
.preferenceDescription()
}
Preferences.Section(bottomDivider: false, label: { Text(LocalizedStringKey("UI Language:")) }) {
Picker(
LocalizedStringKey("Follow OS settings"),
selection: $selUILanguage.onChange {
IME.prtDebugIntel(selUILanguage[0])
if selUILanguage == mgrPrefs.appleLanguages
|| (selUILanguage[0] == "auto"
&& UserDefaults.standard.object(forKey: UserDef.kAppleLanguages.rawValue) == nil)
{
return
ScrollView {
Preferences.Container(contentWidth: contentWidth) {
Preferences.Section(bottomDivider: false, label: { Text(LocalizedStringKey("Candidate Size:")) }) {
Picker(
"",
selection: $selCandidateUIFontSize.onChange {
mgrPrefs.candidateListTextSize = CGFloat(selCandidateUIFontSize)
}
if selUILanguage[0] != "auto" {
mgrPrefs.appleLanguages = selUILanguage
} else {
UserDefaults.standard.removeObject(forKey: UserDef.kAppleLanguages.rawValue)
}
NSLog("vChewing App self-terminated due to UI language change.")
NSApplication.shared.terminate(nil)
) {
Text("12").tag(12)
Text("14").tag(14)
Text("16").tag(16)
Text("18").tag(18)
Text("24").tag(24)
Text("32").tag(32)
Text("64").tag(64)
Text("96").tag(96)
}
) {
Text(LocalizedStringKey("Follow OS settings")).tag(["auto"])
Text(LocalizedStringKey("Simplified Chinese")).tag(["zh-Hans"])
Text(LocalizedStringKey("Traditional Chinese")).tag(["zh-Hant"])
Text(LocalizedStringKey("Japanese")).tag(["ja"])
Text(LocalizedStringKey("English")).tag(["en"])
.labelsHidden()
.frame(width: 120.0)
Text(LocalizedStringKey("Choose candidate font size for better visual clarity."))
.preferenceDescription()
}
.labelsHidden()
.frame(width: 180.0)
Preferences.Section(bottomDivider: false, label: { Text(LocalizedStringKey("UI Language:")) }) {
Picker(
LocalizedStringKey("Follow OS settings"),
selection: $selUILanguage.onChange {
IME.prtDebugIntel(selUILanguage[0])
if selUILanguage == mgrPrefs.appleLanguages
|| (selUILanguage[0] == "auto"
&& UserDefaults.standard.object(forKey: UserDef.kAppleLanguages.rawValue) == nil)
{
return
}
if selUILanguage[0] != "auto" {
mgrPrefs.appleLanguages = selUILanguage
} else {
UserDefaults.standard.removeObject(forKey: UserDef.kAppleLanguages.rawValue)
}
NSLog("vChewing App self-terminated due to UI language change.")
NSApplication.shared.terminate(nil)
}
) {
Text(LocalizedStringKey("Follow OS settings")).tag(["auto"])
Text(LocalizedStringKey("Simplified Chinese")).tag(["zh-Hans"])
Text(LocalizedStringKey("Traditional Chinese")).tag(["zh-Hant"])
Text(LocalizedStringKey("Japanese")).tag(["ja"])
Text(LocalizedStringKey("English")).tag(["en"])
}
.labelsHidden()
.frame(width: 180.0)
Text(LocalizedStringKey("Change user interface language (will reboot the IME)."))
.preferenceDescription()
}
Preferences.Section(bottomDivider: true, label: { Text(LocalizedStringKey("Candidate Layout:")) }) {
Picker(
"",
selection: $selEnableHorizontalCandidateLayout.onChange {
mgrPrefs.useHorizontalCandidateList = selEnableHorizontalCandidateLayout
}
) {
Text(LocalizedStringKey("Vertical")).tag(false)
Text(LocalizedStringKey("Horizontal")).tag(true)
Text(LocalizedStringKey("Change user interface language (will reboot the IME)."))
.preferenceDescription()
}
.labelsHidden()
.horizontalRadioGroupLayout()
.pickerStyle(RadioGroupPickerStyle())
Text(LocalizedStringKey("Choose your preferred layout of the candidate window."))
.preferenceDescription()
Toggle(
LocalizedStringKey("Show page buttons in candidate window"),
isOn: $selShowPageButtonsInCandidateUI.onChange {
mgrPrefs.showPageButtonsInCandidateWindow = selShowPageButtonsInCandidateUI
Preferences.Section(bottomDivider: true, label: { Text(LocalizedStringKey("Candidate Layout:")) }) {
Picker(
"",
selection: $selEnableHorizontalCandidateLayout.onChange {
mgrPrefs.useHorizontalCandidateList = selEnableHorizontalCandidateLayout
}
) {
Text(LocalizedStringKey("Vertical")).tag(false)
Text(LocalizedStringKey("Horizontal")).tag(true)
}
)
.controlSize(.small)
.labelsHidden()
.horizontalRadioGroupLayout()
.pickerStyle(RadioGroupPickerStyle())
Text(LocalizedStringKey("Choose your preferred layout of the candidate window."))
.preferenceDescription()
Toggle(
LocalizedStringKey("Show page buttons in candidate window"),
isOn: $selShowPageButtonsInCandidateUI.onChange {
mgrPrefs.showPageButtonsInCandidateWindow = selShowPageButtonsInCandidateUI
}
)
.controlSize(.small)
}
Preferences.Section(bottomDivider: true, label: { Text(LocalizedStringKey("Output Settings:")) }) {
Toggle(
LocalizedStringKey("Auto-convert traditional Chinese glyphs to KangXi characters"),
isOn: $selEnableKanjiConvToKangXi.onChange {
mgrPrefs.chineseConversionEnabled = selEnableKanjiConvToKangXi
selEnableKanjiConvToJIS = mgrPrefs.shiftJISShinjitaiOutputEnabled
}
)
Toggle(
LocalizedStringKey("Auto-convert traditional Chinese glyphs to JIS Shinjitai characters"),
isOn: $selEnableKanjiConvToJIS.onChange {
mgrPrefs.shiftJISShinjitaiOutputEnabled = selEnableKanjiConvToJIS
selEnableKanjiConvToKangXi = mgrPrefs.chineseConversionEnabled
}
)
Toggle(
LocalizedStringKey("Show Hanyu-Pinyin in the inline composition buffer & tooltip"),
isOn: $selShowHanyuPinyinInCompositionBuffer.onChange {
mgrPrefs.showHanyuPinyinInCompositionBuffer = selShowHanyuPinyinInCompositionBuffer
}
)
Toggle(
LocalizedStringKey("Commit Hanyu-Pinyin instead on Ctrl(+Option)+Command+Enter"),
isOn: $selInlineDumpPinyinInLieuOfZhuyin.onChange {
mgrPrefs.inlineDumpPinyinInLieuOfZhuyin = selInlineDumpPinyinInLieuOfZhuyin
}
)
Toggle(
LocalizedStringKey("Stop farting (when typed phonetic combination is invalid, etc.)"),
isOn: $selEnableFartSuppressor.onChange {
mgrPrefs.shouldNotFartInLieuOfBeep = selEnableFartSuppressor
clsSFX.beep()
}
)
}
Preferences.Section(label: { Text(LocalizedStringKey("Misc Settings:")).controlSize(.small) }) {
Toggle(
LocalizedStringKey("Check for updates automatically"),
isOn: $selEnableAutoUpdateCheck.onChange {
mgrPrefs.checkUpdateAutomatically = selEnableAutoUpdateCheck
}
)
.controlSize(.small)
Toggle(
LocalizedStringKey("Debug Mode"),
isOn: $selEnableDebugMode.onChange {
mgrPrefs.isDebugModeEnabled = selEnableDebugMode
}
)
.controlSize(.small)
}
}
Preferences.Section(bottomDivider: true, label: { Text(LocalizedStringKey("Output Settings:")) }) {
Toggle(
LocalizedStringKey("Auto-convert traditional Chinese glyphs to KangXi characters"),
isOn: $selEnableKanjiConvToKangXi.onChange {
mgrPrefs.chineseConversionEnabled = selEnableKanjiConvToKangXi
selEnableKanjiConvToJIS = mgrPrefs.shiftJISShinjitaiOutputEnabled
}
)
Toggle(
LocalizedStringKey("Auto-convert traditional Chinese glyphs to JIS Shinjitai characters"),
isOn: $selEnableKanjiConvToJIS.onChange {
mgrPrefs.shiftJISShinjitaiOutputEnabled = selEnableKanjiConvToJIS
selEnableKanjiConvToKangXi = mgrPrefs.chineseConversionEnabled
}
)
Toggle(
LocalizedStringKey("Show Hanyu-Pinyin in the inline composition buffer & tooltip"),
isOn: $selShowHanyuPinyinInCompositionBuffer.onChange {
mgrPrefs.showHanyuPinyinInCompositionBuffer = selShowHanyuPinyinInCompositionBuffer
}
)
Toggle(
LocalizedStringKey("Commit Hanyu-Pinyin instead on Ctrl(+Option)+Command+Enter"),
isOn: $selInlineDumpPinyinInLieuOfZhuyin.onChange {
mgrPrefs.inlineDumpPinyinInLieuOfZhuyin = selInlineDumpPinyinInLieuOfZhuyin
}
)
Toggle(
LocalizedStringKey("Stop farting (when typed phonetic combination is invalid, etc.)"),
isOn: $selEnableFartSuppressor.onChange {
mgrPrefs.shouldNotFartInLieuOfBeep = selEnableFartSuppressor
clsSFX.beep()
}
)
}
Preferences.Section(label: { Text(LocalizedStringKey("Misc Settings:")).controlSize(.small) }) {
Toggle(
LocalizedStringKey("Check for updates automatically"),
isOn: $selEnableAutoUpdateCheck.onChange {
mgrPrefs.checkUpdateAutomatically = selEnableAutoUpdateCheck
}
)
.controlSize(.small)
Toggle(
LocalizedStringKey("Debug Mode"),
isOn: $selEnableDebugMode.onChange {
mgrPrefs.isDebugModeEnabled = selEnableDebugMode
}
)
.controlSize(.small)
}
}
}.frame(maxHeight: contentMaxHeight).fixedSize(horizontal: false, vertical: true)
}
}

View File

@ -28,6 +28,7 @@ struct suiPrefPaneKeyboard: View {
@State private var selUsingHotKeyCurrencyNumerals = UserDefaults.standard.bool(
forKey: UserDef.kUsingHotKeyCurrencyNumerals.rawValue)
private let contentMaxHeight: Double = 430
private let contentWidth: Double = {
switch mgrPrefs.appleLanguages[0] {
case "ja":
@ -42,192 +43,194 @@ struct suiPrefPaneKeyboard: View {
}()
var body: some View {
Preferences.Container(contentWidth: contentWidth) {
Preferences.Section(label: { Text(LocalizedStringKey("Selection Keys:")) }) {
ComboBox(
items: mgrPrefs.suggestedCandidateKeys,
text: $selSelectionKeys.onChange {
let value = selSelectionKeys
let keys: String = value.trimmingCharacters(in: .whitespacesAndNewlines).deduplicate
do {
try mgrPrefs.validate(candidateKeys: keys)
mgrPrefs.candidateKeys = keys
selSelectionKeys = mgrPrefs.candidateKeys
} catch mgrPrefs.CandidateKeyError.empty {
selSelectionKeys = mgrPrefs.candidateKeys
} catch {
if let window = ctlPrefUI.shared.controller.window {
let alert = NSAlert(error: error)
alert.beginSheetModal(for: window) { _ in
selSelectionKeys = mgrPrefs.candidateKeys
ScrollView {
Preferences.Container(contentWidth: contentWidth) {
Preferences.Section(label: { Text(LocalizedStringKey("Selection Keys:")) }) {
ComboBox(
items: mgrPrefs.suggestedCandidateKeys,
text: $selSelectionKeys.onChange {
let value = selSelectionKeys
let keys: String = value.trimmingCharacters(in: .whitespacesAndNewlines).deduplicate
do {
try mgrPrefs.validate(candidateKeys: keys)
mgrPrefs.candidateKeys = keys
selSelectionKeys = mgrPrefs.candidateKeys
} catch mgrPrefs.CandidateKeyError.empty {
selSelectionKeys = mgrPrefs.candidateKeys
} catch {
if let window = ctlPrefUI.shared.controller.window {
let alert = NSAlert(error: error)
alert.beginSheetModal(for: window) { _ in
selSelectionKeys = mgrPrefs.candidateKeys
}
clsSFX.beep()
}
clsSFX.beep()
}
}
}
).frame(width: 180)
Text(
LocalizedStringKey(
"Choose or hit Enter to confim your prefered keys for selecting candidates."
)
)
.preferenceDescription()
}
Preferences.Section(label: { Text(LocalizedStringKey("Phonetic Parser:")) }) {
HStack {
Picker(
"",
selection: $selMandarinParser.onChange {
let value = selMandarinParser
mgrPrefs.mandarinParser = value
switch value {
case 0:
if !AppleKeyboardConverter.arrDynamicBasicKeyLayout.contains(mgrPrefs.basicKeyboardLayout) {
mgrPrefs.basicKeyboardLayout = "com.apple.keylayout.ZhuyinBopomofo"
selBasicKeyboardLayout = mgrPrefs.basicKeyboardLayout
}
default:
if AppleKeyboardConverter.arrDynamicBasicKeyLayout.contains(mgrPrefs.basicKeyboardLayout) {
mgrPrefs.basicKeyboardLayout = "com.apple.keylayout.ABC"
selBasicKeyboardLayout = mgrPrefs.basicKeyboardLayout
}
}
}
) {
Group {
Text(LocalizedStringKey("Dachen (Microsoft Standard / Wang / 01, etc.)")).tag(0)
Text(LocalizedStringKey("Eten Traditional")).tag(1)
Text(LocalizedStringKey("IBM")).tag(4)
Text(LocalizedStringKey("MiTAC")).tag(5)
Text(LocalizedStringKey("Seigyou")).tag(8)
Text(LocalizedStringKey("Fake Seigyou")).tag(6)
}
Divider()
Group {
Text(LocalizedStringKey("Dachen 26 (libChewing)")).tag(7)
Text(LocalizedStringKey("Eten 26")).tag(3)
Text(LocalizedStringKey("Hsu")).tag(2)
Text(LocalizedStringKey("Starlight")).tag(9)
}
Divider()
Group {
Text(LocalizedStringKey("Hanyu Pinyin with Numeral Intonation")).tag(10)
Text(LocalizedStringKey("Secondary Pinyin with Numeral Intonation")).tag(11)
Text(LocalizedStringKey("Yale Pinyin with Numeral Intonation")).tag(12)
Text(LocalizedStringKey("Hualuo Pinyin with Numeral Intonation")).tag(13)
Text(LocalizedStringKey("Universal Pinyin with Numeral Intonation")).tag(14)
}
}
.labelsHidden()
Button {
mgrPrefs.mandarinParser = 0
selMandarinParser = mgrPrefs.mandarinParser
mgrPrefs.basicKeyboardLayout = "com.apple.keylayout.ZhuyinBopomofo"
selBasicKeyboardLayout = mgrPrefs.basicKeyboardLayout
} label: {
Text("↻ㄅ")
}
Button {
mgrPrefs.mandarinParser = 10
selMandarinParser = mgrPrefs.mandarinParser
mgrPrefs.basicKeyboardLayout = "com.apple.keylayout.ABC"
selBasicKeyboardLayout = mgrPrefs.basicKeyboardLayout
} label: {
Text("↻A")
}
}
.frame(width: 380.0)
Text(LocalizedStringKey("Choose the phonetic layout for Mandarin parser."))
.preferenceDescription()
}
Preferences.Section(bottomDivider: true, label: { Text(LocalizedStringKey("Basic Keyboard Layout:")) }) {
HStack {
Picker(
"",
selection: $selBasicKeyboardLayout.onChange {
let value = selBasicKeyboardLayout
mgrPrefs.basicKeyboardLayout = value
if AppleKeyboardConverter.arrDynamicBasicKeyLayout.contains(value) {
mgrPrefs.mandarinParser = 0
selMandarinParser = mgrPrefs.mandarinParser
}
}
) {
ForEach(0...(IME.arrEnumerateSystemKeyboardLayouts.count - 1), id: \.self) { id in
Text(IME.arrEnumerateSystemKeyboardLayouts[id].strName).tag(
IME.arrEnumerateSystemKeyboardLayouts[id].strValue)
}.id(UUID())
}
.labelsHidden()
.frame(width: 240.0)
}
Text(LocalizedStringKey("Choose the macOS-level basic keyboard layout."))
.preferenceDescription()
}
Preferences.Section(bottomDivider: true, label: { Text(LocalizedStringKey("Keyboard Shortcuts:")) }) {
Toggle(
LocalizedStringKey("Per-Char Select Mode"),
isOn: $selUsingHotKeySCPC.onChange {
mgrPrefs.usingHotKeySCPC = selUsingHotKeySCPC
}
)
Toggle(
LocalizedStringKey("Per-Char Associated Phrases"),
isOn: $selUsingHotKeyAssociates.onChange {
mgrPrefs.usingHotKeyAssociates = selUsingHotKeyAssociates
}
)
Toggle(
LocalizedStringKey("CNS11643 Mode"),
isOn: $selUsingHotKeyCNS.onChange {
mgrPrefs.usingHotKeyCNS = selUsingHotKeyCNS
}
)
Toggle(
LocalizedStringKey("Force KangXi Writing"),
isOn: $selUsingHotKeyKangXi.onChange {
mgrPrefs.usingHotKeyKangXi = selUsingHotKeyKangXi
}
)
Toggle(
LocalizedStringKey("JIS Shinjitai Output"),
isOn: $selUsingHotKeyJIS.onChange {
mgrPrefs.usingHotKeyJIS = selUsingHotKeyJIS
}
)
Toggle(
LocalizedStringKey("Half-Width Punctuation Mode"),
isOn: $selUsingHotKeyHalfWidthASCII.onChange {
mgrPrefs.usingHotKeyHalfWidthASCII = selUsingHotKeyHalfWidthASCII
}
)
Toggle(
LocalizedStringKey("Currency Numeral Output"),
isOn: $selUsingHotKeyCurrencyNumerals.onChange {
mgrPrefs.usingHotKeyCurrencyNumerals = selUsingHotKeyCurrencyNumerals
}
)
}
}
Divider()
Preferences.Container(contentWidth: contentWidth) {
Preferences.Section(title: "") {
VStack(alignment: .leading, spacing: 10) {
).frame(width: 180)
Text(
LocalizedStringKey(
"Non-QWERTY alphanumerical keyboard layouts are for Hanyu Pinyin parser only."
)
)
.preferenceDescription()
Text(
LocalizedStringKey(
"Apple Dynamic Bopomofo Basic Keyboard Layouts (Dachen & Eten Traditional) must match the Dachen parser in order to be functional."
"Choose or hit Enter to confim your prefered keys for selecting candidates."
)
)
.preferenceDescription()
}
Preferences.Section(label: { Text(LocalizedStringKey("Phonetic Parser:")) }) {
HStack {
Picker(
"",
selection: $selMandarinParser.onChange {
let value = selMandarinParser
mgrPrefs.mandarinParser = value
switch value {
case 0:
if !AppleKeyboardConverter.arrDynamicBasicKeyLayout.contains(mgrPrefs.basicKeyboardLayout) {
mgrPrefs.basicKeyboardLayout = "com.apple.keylayout.ZhuyinBopomofo"
selBasicKeyboardLayout = mgrPrefs.basicKeyboardLayout
}
default:
if AppleKeyboardConverter.arrDynamicBasicKeyLayout.contains(mgrPrefs.basicKeyboardLayout) {
mgrPrefs.basicKeyboardLayout = "com.apple.keylayout.ABC"
selBasicKeyboardLayout = mgrPrefs.basicKeyboardLayout
}
}
}
) {
Group {
Text(LocalizedStringKey("Dachen (Microsoft Standard / Wang / 01, etc.)")).tag(0)
Text(LocalizedStringKey("Eten Traditional")).tag(1)
Text(LocalizedStringKey("IBM")).tag(4)
Text(LocalizedStringKey("MiTAC")).tag(5)
Text(LocalizedStringKey("Seigyou")).tag(8)
Text(LocalizedStringKey("Fake Seigyou")).tag(6)
}
Divider()
Group {
Text(LocalizedStringKey("Dachen 26 (libChewing)")).tag(7)
Text(LocalizedStringKey("Eten 26")).tag(3)
Text(LocalizedStringKey("Hsu")).tag(2)
Text(LocalizedStringKey("Starlight")).tag(9)
}
Divider()
Group {
Text(LocalizedStringKey("Hanyu Pinyin with Numeral Intonation")).tag(10)
Text(LocalizedStringKey("Secondary Pinyin with Numeral Intonation")).tag(11)
Text(LocalizedStringKey("Yale Pinyin with Numeral Intonation")).tag(12)
Text(LocalizedStringKey("Hualuo Pinyin with Numeral Intonation")).tag(13)
Text(LocalizedStringKey("Universal Pinyin with Numeral Intonation")).tag(14)
}
}
.labelsHidden()
Button {
mgrPrefs.mandarinParser = 0
selMandarinParser = mgrPrefs.mandarinParser
mgrPrefs.basicKeyboardLayout = "com.apple.keylayout.ZhuyinBopomofo"
selBasicKeyboardLayout = mgrPrefs.basicKeyboardLayout
} label: {
Text("↻ㄅ")
}
Button {
mgrPrefs.mandarinParser = 10
selMandarinParser = mgrPrefs.mandarinParser
mgrPrefs.basicKeyboardLayout = "com.apple.keylayout.ABC"
selBasicKeyboardLayout = mgrPrefs.basicKeyboardLayout
} label: {
Text("↻A")
}
}
.frame(width: 380.0)
Text(LocalizedStringKey("Choose the phonetic layout for Mandarin parser."))
.preferenceDescription()
}
Preferences.Section(bottomDivider: true, label: { Text(LocalizedStringKey("Basic Keyboard Layout:")) }) {
HStack {
Picker(
"",
selection: $selBasicKeyboardLayout.onChange {
let value = selBasicKeyboardLayout
mgrPrefs.basicKeyboardLayout = value
if AppleKeyboardConverter.arrDynamicBasicKeyLayout.contains(value) {
mgrPrefs.mandarinParser = 0
selMandarinParser = mgrPrefs.mandarinParser
}
}
) {
ForEach(0...(IME.arrEnumerateSystemKeyboardLayouts.count - 1), id: \.self) { id in
Text(IME.arrEnumerateSystemKeyboardLayouts[id].strName).tag(
IME.arrEnumerateSystemKeyboardLayouts[id].strValue)
}.id(UUID())
}
.labelsHidden()
.frame(width: 240.0)
}
Text(LocalizedStringKey("Choose the macOS-level basic keyboard layout."))
.preferenceDescription()
}
Preferences.Section(bottomDivider: true, label: { Text(LocalizedStringKey("Keyboard Shortcuts:")) }) {
Toggle(
LocalizedStringKey("Per-Char Select Mode"),
isOn: $selUsingHotKeySCPC.onChange {
mgrPrefs.usingHotKeySCPC = selUsingHotKeySCPC
}
)
Toggle(
LocalizedStringKey("Per-Char Associated Phrases"),
isOn: $selUsingHotKeyAssociates.onChange {
mgrPrefs.usingHotKeyAssociates = selUsingHotKeyAssociates
}
)
Toggle(
LocalizedStringKey("CNS11643 Mode"),
isOn: $selUsingHotKeyCNS.onChange {
mgrPrefs.usingHotKeyCNS = selUsingHotKeyCNS
}
)
Toggle(
LocalizedStringKey("Force KangXi Writing"),
isOn: $selUsingHotKeyKangXi.onChange {
mgrPrefs.usingHotKeyKangXi = selUsingHotKeyKangXi
}
)
Toggle(
LocalizedStringKey("JIS Shinjitai Output"),
isOn: $selUsingHotKeyJIS.onChange {
mgrPrefs.usingHotKeyJIS = selUsingHotKeyJIS
}
)
Toggle(
LocalizedStringKey("Half-Width Punctuation Mode"),
isOn: $selUsingHotKeyHalfWidthASCII.onChange {
mgrPrefs.usingHotKeyHalfWidthASCII = selUsingHotKeyHalfWidthASCII
}
)
Toggle(
LocalizedStringKey("Currency Numeral Output"),
isOn: $selUsingHotKeyCurrencyNumerals.onChange {
mgrPrefs.usingHotKeyCurrencyNumerals = selUsingHotKeyCurrencyNumerals
}
)
}
}
}
Divider()
Preferences.Container(contentWidth: contentWidth) {
Preferences.Section(title: "") {
VStack(alignment: .leading, spacing: 10) {
Text(
LocalizedStringKey(
"Non-QWERTY alphanumerical keyboard layouts are for Hanyu Pinyin parser only."
)
)
.preferenceDescription()
Text(
LocalizedStringKey(
"Apple Dynamic Bopomofo Basic Keyboard Layouts (Dachen & Eten Traditional) must match the Dachen parser in order to be functional."
)
)
.preferenceDescription()
}
}
}
}.frame(maxHeight: contentMaxHeight).fixedSize(horizontal: false, vertical: true)
}
}