Fixed a regression of KangXi mode hotkey failure.

- Previously, the KangXi mode switch was actually not inserted to the menu in the CHS mode when I was trying to just hide it. This leads to the defect of the hotkey used for toggling the KangXi mode. This feature needs will be dealt later.

Fixed a regression of KangXi mode hotkey failure. // p2
This commit is contained in:
ShikiSuen 2022-01-19 12:07:24 +08:00
parent 75c99a10da
commit 8be06a89d5
1 changed files with 2 additions and 7 deletions

View File

@ -138,11 +138,9 @@ static double FindHighestScore(const vector<NodeAnchor>& nodes, double epsilon)
[menu addItemWithTitle:NSLocalizedString(@"vChewing Preferences", @"") action:@selector(showPreferences:) keyEquivalent:@""];
if ((_inputMode == kBopomofoModeIdentifierCHT) && optionKeyPressed) {
NSMenuItem *chineseConversionMenuItem = [menu addItemWithTitle:NSLocalizedString(@"Force KangXi Writing", @"") action:@selector(toggleChineseConverter:) keyEquivalent:@"K"];
NSMenuItem *chineseConversionMenuItem = [menu addItemWithTitle:NSLocalizedString(@"Force KangXi Writing", @"") action:@selector(toggleChineseConverter:) keyEquivalent:@"K"];
chineseConversionMenuItem.keyEquivalentModifierMask = NSEventModifierFlagCommand | NSEventModifierFlagControl;
chineseConversionMenuItem.state = Preferences.chineseConversionEnabled ? NSControlStateValueOn : NSControlStateValueOff;
}
NSMenuItem *halfWidthPunctuationMenuItem = [menu addItemWithTitle:NSLocalizedString(@"Use Half-Width Punctuations", @"") action:@selector(toggleHalfWidthPunctuation:) keyEquivalent:@""];
halfWidthPunctuationMenuItem.state = Preferences.halfWidthPunctuationEnabled ? NSControlStateValueOn : NSControlStateValueOff;
@ -1491,10 +1489,7 @@ NS_INLINE size_t max(size_t a, size_t b) { return a > b ? a : b; }
- (void)toggleChineseConverter:(id)sender
{
if (_inputMode == kBopomofoModeIdentifierCHT) {
BOOL chineseConversionEnabled = [Preferences toggleChineseConversionEnabled];
[NotifierController notifyWithMessage:[NSString stringWithFormat:@"%@%@%@", NSLocalizedString(@"Force KangXi Writing", @""), @"\n", chineseConversionEnabled ? NSLocalizedString(@"NotificationSwitchON", @"") : NSLocalizedString(@"NotificationSwitchOFF", @"")] stay:NO];
}
[NotifierController notifyWithMessage:[NSString stringWithFormat:@"%@%@%@", NSLocalizedString(@"Force KangXi Writing", @""), @"\n", [Preferences toggleChineseConversionEnabled] ? NSLocalizedString(@"NotificationSwitchON", @"") : NSLocalizedString(@"NotificationSwitchOFF", @"")] stay:NO];
}
- (void)toggleHalfWidthPunctuation:(id)sender