From 6659cddddd27ca0995d6cbd9247bdbe4ac39e10f Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Sun, 11 Sep 2022 22:56:01 +0800 Subject: [PATCH 1/7] ctlTooltip // Fix font rendering issue on non-retina displays. - Since macOS 11, AppKit requires that rect origin axis values must be integers (in both direction) in order to make sure fonts are rendered clear. --- Source/Modules/UIModules/TooltipUI/ctlTooltip.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Modules/UIModules/TooltipUI/ctlTooltip.swift b/Source/Modules/UIModules/TooltipUI/ctlTooltip.swift index 2f41fc63..1e298c05 100644 --- a/Source/Modules/UIModules/TooltipUI/ctlTooltip.swift +++ b/Source/Modules/UIModules/TooltipUI/ctlTooltip.swift @@ -168,8 +168,8 @@ public class ctlTooltip: NSWindowController { var bigRect = rect bigRect.size.width += NSFont.systemFontSize bigRect.size.height += NSFont.systemFontSize - rect.origin.x += NSFont.systemFontSize / 2 - rect.origin.y += NSFont.systemFontSize / 2 + rect.origin.x += ceil(NSFont.systemFontSize / 2) + rect.origin.y += ceil(NSFont.systemFontSize / 2) messageText.frame = rect window?.setFrame(bigRect, display: true) messageText.draw(messageText.frame) From 5e989c9e98c6c4ceb0f0907a7ea4172bd8b53738 Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Sun, 11 Sep 2022 22:59:55 +0800 Subject: [PATCH 2/7] PCB // Fix font rendering issue on non-retina displays. --- .../PopupCompositionBufferUI/ctlPopupCompositionBuffer.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Modules/UIModules/PopupCompositionBufferUI/ctlPopupCompositionBuffer.swift b/Source/Modules/UIModules/PopupCompositionBufferUI/ctlPopupCompositionBuffer.swift index c9ce1870..6e3c8d52 100644 --- a/Source/Modules/UIModules/PopupCompositionBufferUI/ctlPopupCompositionBuffer.swift +++ b/Source/Modules/UIModules/PopupCompositionBufferUI/ctlPopupCompositionBuffer.swift @@ -119,8 +119,8 @@ public class ctlPopupCompositionBuffer: NSWindowController { var bigRect = rect bigRect.size.width += NSFont.systemFontSize bigRect.size.height += NSFont.systemFontSize - rect.origin.x += NSFont.systemFontSize / 2 - rect.origin.y += NSFont.systemFontSize / 2 + rect.origin.x += ceil(NSFont.systemFontSize / 2) + rect.origin.y += ceil(NSFont.systemFontSize / 2) messageTextField.frame = rect window?.setFrame(bigRect, display: true) } From 80ee644c543177c45f31b5dc75bf63cb7980e485 Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Sun, 11 Sep 2022 22:58:57 +0800 Subject: [PATCH 3/7] i18n // "Open User Folder" -> "Open User Dictionary Folder". --- Source/Modules/ControllerModules/ctlInputMethod_Menu.swift | 2 +- Source/Resources/Base.lproj/Localizable.strings | 2 +- Source/Resources/en.lproj/Localizable.strings | 2 +- Source/Resources/ja.lproj/Localizable.strings | 2 +- Source/Resources/zh-Hans.lproj/Localizable.strings | 2 +- Source/Resources/zh-Hant.lproj/Localizable.strings | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Source/Modules/ControllerModules/ctlInputMethod_Menu.swift b/Source/Modules/ControllerModules/ctlInputMethod_Menu.swift index 9cf870e3..4865bdae 100644 --- a/Source/Modules/ControllerModules/ctlInputMethod_Menu.swift +++ b/Source/Modules/ControllerModules/ctlInputMethod_Menu.swift @@ -96,7 +96,7 @@ extension ctlInputMethod { menu.addItem(NSMenuItem.separator()) // --------------------- menu.addItem( - withTitle: NSLocalizedString("Open User Data Folder", comment: ""), + withTitle: NSLocalizedString("Open User Dictionary Folder", comment: ""), action: #selector(openUserDataFolder(_:)), keyEquivalent: "" ) menu.addItem( diff --git a/Source/Resources/Base.lproj/Localizable.strings b/Source/Resources/Base.lproj/Localizable.strings index a52613a2..39aea529 100644 --- a/Source/Resources/Base.lproj/Localizable.strings +++ b/Source/Resources/Base.lproj/Localizable.strings @@ -60,7 +60,7 @@ "CNS11643 Mode" = "CNS11643 Mode"; "JIS Shinjitai Output" = "JIS Shinjitai Output"; "Per-Char Associated Phrases" = "Per-Char Associated Phrases"; -"Open User Data Folder" = "Open User Data Folder"; +"Open User Dictionary Folder" = "Open User Dictionary Folder"; "Edit Associated Phrases…" = "Edit Associated Phrases…"; "Reboot vChewing…" = "Reboot vChewing…"; "auto" = "Follow System Settings"; diff --git a/Source/Resources/en.lproj/Localizable.strings b/Source/Resources/en.lproj/Localizable.strings index a52613a2..39aea529 100644 --- a/Source/Resources/en.lproj/Localizable.strings +++ b/Source/Resources/en.lproj/Localizable.strings @@ -60,7 +60,7 @@ "CNS11643 Mode" = "CNS11643 Mode"; "JIS Shinjitai Output" = "JIS Shinjitai Output"; "Per-Char Associated Phrases" = "Per-Char Associated Phrases"; -"Open User Data Folder" = "Open User Data Folder"; +"Open User Dictionary Folder" = "Open User Dictionary Folder"; "Edit Associated Phrases…" = "Edit Associated Phrases…"; "Reboot vChewing…" = "Reboot vChewing…"; "auto" = "Follow System Settings"; diff --git a/Source/Resources/ja.lproj/Localizable.strings b/Source/Resources/ja.lproj/Localizable.strings index 3e465824..0e969efb 100644 --- a/Source/Resources/ja.lproj/Localizable.strings +++ b/Source/Resources/ja.lproj/Localizable.strings @@ -60,7 +60,7 @@ "CNS11643 Mode" = "全字庫モード"; "JIS Shinjitai Output" = "JIS 新字体モード"; "Per-Char Associated Phrases" = "全候補入力で連想語彙"; -"Open User Data Folder" = "ユーザー資料フォルダを開く"; +"Open User Dictionary Folder" = "ユーザー辞書フォルダを開く"; "Edit Associated Phrases…" = "連想語彙を編集…"; "Reboot vChewing…" = "入力アプリ再起動…"; "auto" = "システム設定に準ず"; diff --git a/Source/Resources/zh-Hans.lproj/Localizable.strings b/Source/Resources/zh-Hans.lproj/Localizable.strings index e989b8d8..487eec0a 100644 --- a/Source/Resources/zh-Hans.lproj/Localizable.strings +++ b/Source/Resources/zh-Hans.lproj/Localizable.strings @@ -60,7 +60,7 @@ "CNS11643 Mode" = "全字库模式"; "JIS Shinjitai Output" = "JIS 新字体模式"; "Per-Char Associated Phrases" = "逐字选字联想模式"; -"Open User Data Folder" = "开启使用者资料夹"; +"Open User Dictionary Folder" = "开启使用者辞典资料夹"; "Edit Associated Phrases…" = "编辑联想词…"; "Reboot vChewing…" = "重新启动输入法…"; "auto" = "与系统设定一致"; diff --git a/Source/Resources/zh-Hant.lproj/Localizable.strings b/Source/Resources/zh-Hant.lproj/Localizable.strings index 2d686182..1886dff6 100644 --- a/Source/Resources/zh-Hant.lproj/Localizable.strings +++ b/Source/Resources/zh-Hant.lproj/Localizable.strings @@ -60,7 +60,7 @@ "CNS11643 Mode" = "全字庫模式"; "JIS Shinjitai Output" = "JIS 新字體模式"; "Per-Char Associated Phrases" = "逐字選字聯想模式"; -"Open User Data Folder" = "開啟使用者資料夾"; +"Open User Dictionary Folder" = "開啟使用者辭典資料夾"; "Edit Associated Phrases…" = "編輯聯想詞…"; "Reboot vChewing…" = "重新啟動輸入法…"; "auto" = "與系統設定一致"; From be3ccb52f406fde398776a98ae0873f03b66ee3c Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Sun, 11 Sep 2022 23:04:13 +0800 Subject: [PATCH 4/7] ClientMgr // Apply already-entered identifiers when calling COMDLG32. --- Source/WindowControllers/ctlClientListMgr.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/WindowControllers/ctlClientListMgr.swift b/Source/WindowControllers/ctlClientListMgr.swift index 8dc51cbc..d49ddbf1 100644 --- a/Source/WindowControllers/ctlClientListMgr.swift +++ b/Source/WindowControllers/ctlClientListMgr.swift @@ -79,11 +79,11 @@ extension ctlClientListMgr { alert.accessoryView = scrollview alert.beginSheetModal(for: window) { result in switch result { - case .alertFirstButtonReturn: + case .alertFirstButtonReturn, .alertSecondButtonReturn: theTextView.textContainer?.textView?.string.components(separatedBy: "\n").filter { !$0.isEmpty }.forEach { self.applyNewValue($0) } - case .alertSecondButtonReturn: + if result == .alertFirstButtonReturn { break } IME.dlgOpenPath.title = NSLocalizedString( "Choose the target application bundle.", comment: "" ) From fda532a799aea933198c04ccba58daf35c90a855 Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Sun, 11 Sep 2022 23:25:02 +0800 Subject: [PATCH 5/7] ClientMgr // Enable batch deletion. --- .../WindowControllers/ctlClientListMgr.swift | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/Source/WindowControllers/ctlClientListMgr.swift b/Source/WindowControllers/ctlClientListMgr.swift index d49ddbf1..23cda7a1 100644 --- a/Source/WindowControllers/ctlClientListMgr.swift +++ b/Source/WindowControllers/ctlClientListMgr.swift @@ -17,6 +17,7 @@ class ctlClientListMgr: NSWindowController, NSTableViewDelegate, NSTableViewData super.windowDidLoad() localize() tblClients.delegate = self + tblClients.allowsMultipleSelection = true tblClients.dataSource = self tblClients.reloadData() } @@ -132,18 +133,24 @@ extension ctlClientListMgr { } @IBAction func btnRemoveClientClicked(_: Any) { - if tblClients.selectedRow >= mgrPrefs.clientsIMKTextInputIncapable.count { return } - if tblClients.selectedRow < 0 { return } - let isLastRow: Bool = { - if mgrPrefs.clientsIMKTextInputIncapable.count < 2 { return false } - return tblClients.selectedRow == mgrPrefs.clientsIMKTextInputIncapable.count - 1 - }() - mgrPrefs.clientsIMKTextInputIncapable.remove(at: tblClients.selectedRow) + guard let minIndexSelected = tblClients.selectedRowIndexes.min() else { return } + if minIndexSelected >= mgrPrefs.clientsIMKTextInputIncapable.count { return } + if minIndexSelected < 0 { return } + var isLastRow = false + tblClients.selectedRowIndexes.sorted().reversed().forEach { index in + isLastRow = { + if mgrPrefs.clientsIMKTextInputIncapable.count < 2 { return false } + return minIndexSelected == mgrPrefs.clientsIMKTextInputIncapable.count - 1 + }() + if index < mgrPrefs.clientsIMKTextInputIncapable.count { + mgrPrefs.clientsIMKTextInputIncapable.remove(at: index) + } + } if isLastRow { - tblClients.selectRowIndexes(.init(arrayLiteral: tblClients.selectedRow - 1), byExtendingSelection: false) + tblClients.selectRowIndexes(.init(arrayLiteral: minIndexSelected - 1), byExtendingSelection: false) } tblClients.reloadData() - btnRemoveClient.isEnabled = (0.. Any? { From bd2000937a886ccaa529b19df0c89d15c38f7498 Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Sun, 11 Sep 2022 23:42:05 +0800 Subject: [PATCH 6/7] KeyHandler // Fix a bug in Apple dynamic keyboard layouts. --- .../ControllerModules/KeyHandler_HandleInput.swift | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Source/Modules/ControllerModules/KeyHandler_HandleInput.swift b/Source/Modules/ControllerModules/KeyHandler_HandleInput.swift index 75d718e9..6af1aee1 100644 --- a/Source/Modules/ControllerModules/KeyHandler_HandleInput.swift +++ b/Source/Modules/ControllerModules/KeyHandler_HandleInput.swift @@ -83,8 +83,16 @@ extension KeyHandler { return false } + // 糾正 macOS 內建的的動態注音鍵盤佈局的一個 bug。 + var charToCommit = inputText.lowercased() + if "-·".contains(charToCommit), input.isSymbolMenuPhysicalKey, + AppleKeyboardConverter.isDynamicBasicKeyboardLayoutEnabled + { + charToCommit = "`" + } + // 將整個組字區的內容遞交給客體應用。 - stateCallback(IMEState.ofCommitting(textToCommit: inputText.lowercased())) + stateCallback(IMEState.ofCommitting(textToCommit: charToCommit)) stateCallback(IMEState.ofEmpty()) return true From 2b36cdda3668719b0b9732bfa175d6b4b1659320 Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Sun, 11 Sep 2022 23:57:56 +0800 Subject: [PATCH 7/7] Bump version to 2.6.0 SP1 Build 2601. --- Update-Info.plist | 2 +- vChewing.xcodeproj/project.pbxproj | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Update-Info.plist b/Update-Info.plist index 544ec404..bbc8dcbb 100644 --- a/Update-Info.plist +++ b/Update-Info.plist @@ -5,7 +5,7 @@ CFBundleShortVersionString 2.6.0 CFBundleVersion - 2600 + 2601 UpdateInfoEndpoint https://gitee.com/vchewing/vChewing-macOS/raw/main/Update-Info.plist UpdateInfoSite diff --git a/vChewing.xcodeproj/project.pbxproj b/vChewing.xcodeproj/project.pbxproj index 6ac32cb2..e1d8a804 100644 --- a/vChewing.xcodeproj/project.pbxproj +++ b/vChewing.xcodeproj/project.pbxproj @@ -1483,7 +1483,7 @@ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 2600; + CURRENT_PROJECT_VERSION = 2601; GCC_C_LANGUAGE_STANDARD = gnu11; GCC_DYNAMIC_NO_PIC = NO; GCC_PREPROCESSOR_DEFINITIONS = ( @@ -1522,7 +1522,7 @@ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 2600; + CURRENT_PROJECT_VERSION = 2601; ENABLE_NS_ASSERTIONS = NO; GCC_C_LANGUAGE_STANDARD = gnu11; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; @@ -1560,7 +1560,7 @@ CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 2600; + CURRENT_PROJECT_VERSION = 2601; DEAD_CODE_STRIPPING = YES; ENABLE_HARDENED_RUNTIME = YES; GCC_C_LANGUAGE_STANDARD = gnu11; @@ -1612,7 +1612,7 @@ CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 2600; + CURRENT_PROJECT_VERSION = 2601; DEAD_CODE_STRIPPING = YES; ENABLE_HARDENED_RUNTIME = YES; ENABLE_NS_ASSERTIONS = NO; @@ -1746,7 +1746,7 @@ CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 2600; + CURRENT_PROJECT_VERSION = 2601; DEAD_CODE_STRIPPING = YES; DEVELOPMENT_ASSET_PATHS = ""; DEVELOPMENT_TEAM = ""; @@ -1805,7 +1805,7 @@ CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 2600; + CURRENT_PROJECT_VERSION = 2601; DEAD_CODE_STRIPPING = YES; DEVELOPMENT_ASSET_PATHS = ""; DEVELOPMENT_TEAM = ""; @@ -1852,7 +1852,7 @@ CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 2600; + CURRENT_PROJECT_VERSION = 2601; DEAD_CODE_STRIPPING = YES; DEVELOPMENT_TEAM = ""; ENABLE_HARDENED_RUNTIME = YES; @@ -1896,7 +1896,7 @@ CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 2600; + CURRENT_PROJECT_VERSION = 2601; DEAD_CODE_STRIPPING = YES; DEVELOPMENT_TEAM = ""; ENABLE_HARDENED_RUNTIME = YES;