Merge branch 'master' of github.com:openvanilla/McBopomofo
This commit is contained in:
commit
dae5246af6
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2011-2021 Mengjuei Hsieh et al.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
|
@ -33,6 +33,7 @@
|
|||
6A2E40F9253A6AA000D1AE1D /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6A2E40F5253A69DA00D1AE1D /* Images.xcassets */; };
|
||||
6A38BC1515FC117A00A8A51F /* data.txt in Resources */ = {isa = PBXBuildFile; fileRef = 6A38BBF615FC117A00A8A51F /* data.txt */; };
|
||||
6A38BC2815FC158A00A8A51F /* InputMethodKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6A38BC2715FC158A00A8A51F /* InputMethodKit.framework */; };
|
||||
6AB3620D274CA50700AC7547 /* OVInputSourceHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 6A0D4ECA15FC0D6400ABF4B3 /* OVInputSourceHelper.m */; };
|
||||
6ACA41CD15FC1D7500935EF6 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6A0D4EA615FC0D2D00ABF4B3 /* Cocoa.framework */; };
|
||||
6ACA41F915FC1D9000935EF6 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 6ACA41E915FC1D9000935EF6 /* AppDelegate.m */; };
|
||||
6ACA41FA15FC1D9000935EF6 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 6ACA41EA15FC1D9000935EF6 /* InfoPlist.strings */; };
|
||||
|
@ -544,7 +545,7 @@
|
|||
6A0D4E9415FC0CFA00ABF4B3 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 1220;
|
||||
LastUpgradeCheck = 1310;
|
||||
TargetAttributes = {
|
||||
6A0D4EA115FC0D2D00ABF4B3 = {
|
||||
LastSwiftMigration = 1240;
|
||||
|
@ -660,6 +661,7 @@
|
|||
files = (
|
||||
6ACA41F915FC1D9000935EF6 /* AppDelegate.m in Sources */,
|
||||
6A225A232367A1D700F685C6 /* ArchiveUtil.m in Sources */,
|
||||
6AB3620D274CA50700AC7547 /* OVInputSourceHelper.m in Sources */,
|
||||
6ACA41FF15FC1D9000935EF6 /* main.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
|
@ -837,6 +839,7 @@
|
|||
"$(OTHER_CFLAGS)",
|
||||
"-fcxx-modules",
|
||||
);
|
||||
SWIFT_COMPILATION_MODE = wholemodule;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
|
@ -1037,6 +1040,7 @@
|
|||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
HEADER_SEARCH_PATHS = ../;
|
||||
INFOPLIST_FILE = "Source/Installer/Installer-Info.plist";
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.10;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
|
@ -1069,6 +1073,7 @@
|
|||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
HEADER_SEARCH_PATHS = ../;
|
||||
INFOPLIST_FILE = "Source/Installer/Installer-Info.plist";
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.10;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "org.openvanilla.McBopomofo.${PRODUCT_NAME:rfc1034identifier}";
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1240"
|
||||
LastUpgradeVersion = "1310"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1240"
|
||||
LastUpgradeVersion = "1310"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
|
|
|
@ -2,19 +2,13 @@
|
|||
|
||||
## 開發流程
|
||||
|
||||
用 Xcode 開啟 `McBopomofo.xcodeproj`,選 "McBopomofo Installer" target,build
|
||||
完之後直接執行該安裝程式,就可以安裝小麥注音。
|
||||
用 Xcode 開啟 `McBopomofo.xcodeproj`,選 "McBopomofo Installer" target,build 完之後直接執行該安裝程式,就可以安裝小麥注音。
|
||||
|
||||
第一次安裝完,日後程式碼或詞庫有任何修改,只要重複上述流程,再次安裝小麥注音即可。
|
||||
|
||||
要注意的是 macOS 可能會限制同一次 login session 能 kill 同一個輸入法 process 的次數(
|
||||
安裝程式透過 process killing來讓新版的輸入法生效)。如果安裝若干次後,發現程式修改的結果並
|
||||
沒有出現,或甚至輸入法已無法再選用,只要登出目前帳號再重新登入即可。
|
||||
要注意的是 macOS 可能會限制同一次 login session 能 kill 同一個輸入法 process 的次數(安裝程式透過 kill input method process 來讓新版的輸入法生效)。如果安裝若干次後,發現程式修改的結果並沒有出現,或甚至輸入法已無法再選用,只要登出目前帳號再重新登入即可。
|
||||
|
||||
## 軟體授權
|
||||
|
||||
本專案主要程式碼以及編譯後軟體採用 MIT License 釋出,使用者可自由使用、散播本軟體,惟散播本輸入法的原始碼時必須保持軟體完整原始碼、不得修改版權文字。
|
||||
本專案採用 MIT License 釋出,使用者可自由使用、散播本軟體,惟散播時必須完整保留版權聲明及軟體授權([詳全文](https://github.com/openvanilla/McBopomofo/blob/master/LICENSE.txt))。
|
||||
|
||||
## Continuous Integration
|
||||
|
||||
我們使用 Travis-CI [](https://travis-ci.org/openvanilla/McBopomofo) 作為雲端持續整合工具。
|
||||
|
|
|
@ -98,7 +98,7 @@
|
|||
|
||||
for (NSScreen *screen in [NSScreen screens]) {
|
||||
NSRect frame = [screen visibleFrame];
|
||||
if (topLeftPoint.x >= NSMinX(frame) && topLeftPoint.x <= NSMaxX(frame)) {
|
||||
if (topLeftPoint.x >= NSMinX(frame) && topLeftPoint.x <= NSMaxX(frame) && topLeftPoint.y >= NSMinY(frame) && topLeftPoint.y <= NSMaxY(frame)) {
|
||||
screenFrame = frame;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -394,6 +394,7 @@ public:
|
|||
return;
|
||||
}
|
||||
|
||||
// Chinese conversion.
|
||||
NSString *buffer = _composingBuffer;
|
||||
if (_chineseConversionEnabled) {
|
||||
buffer = [OpenCCBridge convert:_composingBuffer];
|
||||
|
@ -528,6 +529,10 @@ public:
|
|||
if (_walkedNodes.size() > 0) {
|
||||
NodeAnchor &anchor = _walkedNodes[0];
|
||||
NSString *popedText = [NSString stringWithUTF8String:anchor.node->currentKeyValue().value.c_str()];
|
||||
// Chinese conversion.
|
||||
if (_chineseConversionEnabled) {
|
||||
popedText = [OpenCCBridge convert:popedText];
|
||||
}
|
||||
[client insertText:popedText replacementRange:NSMakeRange(NSNotFound, NSNotFound)];
|
||||
_builder->removeHeadReadings(anchor.spanningLength);
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
|
||||
#import "AppDelegate.h"
|
||||
#import <sys/mount.h>
|
||||
#import "OVInputSourceHelper.h"
|
||||
|
||||
static NSString *const kTargetBin = @"McBopomofo";
|
||||
static NSString *const kTargetType = @"app";
|
||||
|
@ -55,7 +56,6 @@ void RunAlertPanel(NSString *title, NSString *message, NSString *buttonTitle) {
|
|||
@synthesize progressSheet = _progressSheet;
|
||||
@synthesize progressIndicator = _progressIndicator;
|
||||
|
||||
|
||||
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
|
||||
{
|
||||
_installingVersion = [[[NSBundle mainBundle] infoDictionary] objectForKey:(id)kCFBundleVersionKey];
|
||||
|
@ -130,9 +130,9 @@ void RunAlertPanel(NSString *title, NSString *message, NSString *buttonTitle) {
|
|||
// Schedule the install action in runloop so that the sheet gets a change to dismiss itself.
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
if (returnCode == NSModalResponseContinue) {
|
||||
[self installInputMethodWithWarning:NO];
|
||||
[self installInputMethodWithPreviousExists:YES previousVersionNotFullyDeactivatedWarning:NO];
|
||||
} else {
|
||||
[self installInputMethodWithWarning:YES];
|
||||
[self installInputMethodWithPreviousExists:YES previousVersionNotFullyDeactivatedWarning:YES];
|
||||
}
|
||||
});
|
||||
}];
|
||||
|
@ -143,7 +143,7 @@ void RunAlertPanel(NSString *title, NSString *message, NSString *buttonTitle) {
|
|||
}
|
||||
}
|
||||
|
||||
[self installInputMethodWithWarning:NO];
|
||||
[self installInputMethodWithPreviousExists:NO previousVersionNotFullyDeactivatedWarning:NO];
|
||||
}
|
||||
|
||||
- (void)timerTick:(NSTimer *)timer
|
||||
|
@ -162,7 +162,7 @@ void RunAlertPanel(NSString *title, NSString *message, NSString *buttonTitle) {
|
|||
}
|
||||
|
||||
|
||||
- (void)installInputMethodWithWarning:(BOOL)warning
|
||||
- (void)installInputMethodWithPreviousExists:(BOOL)previousVersionExists previousVersionNotFullyDeactivatedWarning:(BOOL)warning
|
||||
{
|
||||
// If the unzipped archive does not exist, this must be a dev-mode installer.
|
||||
NSString *targetBundle = [_archiveUtil unzipNotarizedArchive];
|
||||
|
@ -177,23 +177,77 @@ void RunAlertPanel(NSString *title, NSString *message, NSString *buttonTitle) {
|
|||
[NSApp terminate:self];
|
||||
}
|
||||
|
||||
NSArray *installArgs = [NSArray arrayWithObjects:@"install", nil];
|
||||
NSTask *installTask = [NSTask launchedTaskWithLaunchPath:[kTargetFullBinPartialPath stringByExpandingTildeInPath] arguments:installArgs];
|
||||
[installTask waitUntilExit];
|
||||
if ([installTask terminationStatus] != 0) {
|
||||
RunAlertPanel(NSLocalizedString(@"Install Failed", nil), NSLocalizedString(@"Cannot activate the input method.", nil), NSLocalizedString(@"Cancel", nil));
|
||||
[NSApp terminate:self];
|
||||
NSBundle *imeBundle = [NSBundle bundleWithPath:[kTargetPartialPath stringByExpandingTildeInPath]];
|
||||
NSCAssert(imeBundle != nil, @"Target bundle must exists");
|
||||
NSURL *imeBundleURL = imeBundle.bundleURL;
|
||||
NSString *imeIdentifier = imeBundle.bundleIdentifier;
|
||||
|
||||
TISInputSourceRef inputSource = [OVInputSourceHelper inputSourceForInputSourceID:imeIdentifier];
|
||||
|
||||
// if this IME name is not found in the list of available IMEs
|
||||
if (!inputSource) {
|
||||
NSLog(@"Registering input source %@ at %@.", imeIdentifier, imeBundleURL.absoluteString);
|
||||
// then register
|
||||
BOOL status = [OVInputSourceHelper registerInputSource:imeBundleURL];
|
||||
|
||||
if (!status) {
|
||||
NSString *message = [NSString stringWithFormat:NSLocalizedString(@"Cannot register input source %@ at %@.", nil), imeIdentifier, imeBundleURL.absoluteString];
|
||||
RunAlertPanel(NSLocalizedString(@"Fatal Error", nil), message, NSLocalizedString(@"Abort", nil));
|
||||
[self endAppWithDelay];
|
||||
return;
|
||||
}
|
||||
|
||||
inputSource = [OVInputSourceHelper inputSourceForInputSourceID:imeIdentifier];
|
||||
// if it still doesn't register successfully, bail.
|
||||
if (!inputSource) {
|
||||
NSString *message = [NSString stringWithFormat:NSLocalizedString(@"Cannot find input source %@ after registration.", nil), imeIdentifier];
|
||||
RunAlertPanel(NSLocalizedString(@"Fatal Error", nil), message, NSLocalizedString(@"Abort", nil));
|
||||
[self endAppWithDelay];
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
BOOL isMacOS12OrAbove = NO;
|
||||
if (@available(macOS 12.0, *)) {
|
||||
NSLog(@"macOS 12 or later detected.");
|
||||
isMacOS12OrAbove = YES;
|
||||
} else {
|
||||
NSLog(@"Installer runs with the pre-macOS 12 flow.");
|
||||
}
|
||||
|
||||
// If the IME is not enabled, enable it. Also, unconditionally enable it on macOS 12.0+,
|
||||
// as the kTISPropertyInputSourceIsEnabled can still be true even if the IME is *not*
|
||||
// enabled in the user's current set of IMEs (which means the IME does not show up in
|
||||
// the user's input menu).
|
||||
BOOL mainInputSourceEnabled = [OVInputSourceHelper inputSourceEnabled:inputSource];
|
||||
if (!mainInputSourceEnabled || isMacOS12OrAbove) {
|
||||
|
||||
mainInputSourceEnabled = [OVInputSourceHelper enableInputSource:inputSource];
|
||||
if (mainInputSourceEnabled) {
|
||||
NSLog(@"Input method enabled: %@", imeIdentifier);
|
||||
} else {
|
||||
NSLog(@"Failed to enable input method: %@", imeIdentifier);
|
||||
}
|
||||
}
|
||||
|
||||
if (warning) {
|
||||
RunAlertPanel(NSLocalizedString(@"Attention", nil), NSLocalizedString(@"McBopomofo is upgraded, but please log out or reboot for the new version to be fully functional.", nil), NSLocalizedString(@"OK", nil));
|
||||
} else {
|
||||
RunAlertPanel(NSLocalizedString(@"Installation Successful", nil), NSLocalizedString(@"McBopomofo is ready to use.", nil), NSLocalizedString(@"OK", nil));
|
||||
// Only prompt a warning if pre-macOS 12. The flag is not indicative of anything meaningful due to the need of user intervention in Prefernces.app on macOS 12.
|
||||
if (!mainInputSourceEnabled && !isMacOS12OrAbove) {
|
||||
RunAlertPanel(NSLocalizedString(@"Warning", nil), NSLocalizedString(@"Input method may not be fully enabled. Please enable it through System Preferences > Keyboard > Input Sources.", nil), NSLocalizedString(@"Continue", nil));
|
||||
} else {
|
||||
RunAlertPanel(NSLocalizedString(@"Installation Successful", nil), NSLocalizedString(@"McBopomofo is ready to use.", nil), NSLocalizedString(@"OK", nil));
|
||||
}
|
||||
}
|
||||
|
||||
[[NSApplication sharedApplication] performSelector:@selector(terminate:) withObject:self afterDelay:0.1];
|
||||
[self endAppWithDelay];
|
||||
}
|
||||
|
||||
- (void)endAppWithDelay
|
||||
{
|
||||
[[NSApplication sharedApplication] performSelector:@selector(terminate:) withObject:self afterDelay:0.1];
|
||||
}
|
||||
|
||||
- (IBAction)cancelAction:(id)sender
|
||||
{
|
||||
|
|
|
@ -15,11 +15,11 @@
|
|||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<string>1.1</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>MBIN</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>846</string>
|
||||
<string>879</string>
|
||||
<key>LSApplicationCategoryType</key>
|
||||
<string>public.app-category.utilities</string>
|
||||
<key>LSHasLocalizedDisplayName</key>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Localized versions of Info.plist keys */
|
||||
|
||||
CFBundleName = "Install McBopomofo";
|
||||
NSHumanReadableCopyright = "Copyright © 2011-2020 Mengjuei Hsieh et al.\nAll Rights Reserved.";
|
||||
NSHumanReadableCopyright = "Copyright © 2011-2021 Mengjuei Hsieh et al.\nAll Rights Reserved.";
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
\f0\b\fs36 \cf0 McBopomofo License Agreement
|
||||
\f1\b0\fs24 \
|
||||
\
|
||||
Copyright \'a9 2011-2020 Mengjuei Hsieh et al.\
|
||||
Copyright \'a9 2011-2021 Mengjuei Hsieh et al.\
|
||||
\
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \'93Software\'94), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\
|
||||
\
|
||||
|
|
|
@ -28,3 +28,12 @@
|
|||
"Stopping the old version. This may take up to one minute…" = "Stopping the old version. This may take up to one minute…";
|
||||
"Attention" = "Attention";
|
||||
"McBopomofo is upgraded, but please log out or reboot for the new version to be fully functional." = "McBopomofo is upgraded, but please log out or reboot for the new version to be fully functional.";
|
||||
|
||||
"Fatal Error" = "Fatal Error";
|
||||
"Abort" = "Abort";
|
||||
"Cannot register input source %@ at %@." = "Cannot register input source %@ at %@.";
|
||||
"Cannot find input source %@ after registration." = "Cannot find input source %@ after registration.";
|
||||
|
||||
"Warning" = "Warning";
|
||||
"Input method may not be fully enabled. Please enable it through System Preferences > Keyboard > Input Sources." = "Input method may not be fully enabled. Please enable it through System Preferences > Keyboard > Input Sources.";
|
||||
"Continue" = "Continue";
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* Localized versions of Info.plist keys */
|
||||
|
||||
CFBundleName = "安裝小麥注音";
|
||||
NSHumanReadableCopyright = "Copyright © 2011-2020 Mengjuei Hsieh et al.\nAll Rights Reserved.";
|
||||
NSHumanReadableCopyright = "Copyright © 2011-2021 Mengjuei Hsieh et al.\nAll Rights Reserved.";
|
||||
|
||||
|
|
|
@ -9,10 +9,10 @@
|
|||
\f0\b\fs36 \cf0 McBopomofo License Agreement
|
||||
\f1\b0\fs24 \
|
||||
\
|
||||
Copyright \'a9 2011-2020 Mengjuei Hsieh et al.\
|
||||
Copyright \'a9 2011-2021 Mengjuei Hsieh et al.\
|
||||
|
||||
\f2 \'b5\'db\'a7\'40\'c5\'76\'a7\'51\'a9\'d2\'a6\'b3
|
||||
\f1 \'a9 2011-2020 Mengjuei Hsieh
|
||||
\f2 \cf0 \'b5\'db\'a7\'40\'c5\'76\'a7\'51\'a9\'d2\'a6\'b3
|
||||
\f1 \'a9 2011-2021 Mengjuei Hsieh
|
||||
\f2 \'b5\'a5\'a4\'48
|
||||
\f1 \
|
||||
\
|
||||
|
|
|
@ -28,3 +28,12 @@
|
|||
"Finish" = "結束";
|
||||
"Attention" = "請注意";
|
||||
"McBopomofo is upgraded, but please log out or reboot for the new version to be fully functional." = "McBopomofo 安裝完成,但建議您登出或重新開機,以便順利使用新版。";
|
||||
|
||||
"Fatal Error" = "安裝錯誤";
|
||||
"Abort" = "放棄安裝";
|
||||
"Cannot register input source %@ at %@." = "無法從檔案位置 %2$@ 安裝輸入法 \"%1$@\"。";
|
||||
"Cannot find input source %@ after registration." = "在註冊完輸入法 \"%@\" 仍然無法找到輸入法。";
|
||||
|
||||
"Warning" = "安裝不完整";
|
||||
"Input method may not be fully enabled. Please enable it through System Preferences > Keyboard > Input Sources." = "輸入法已經安裝好,但可能沒有完全啟用。請從「系統偏好設定」 > 「鍵盤」 > 「輸入方式」分頁加入輸入法。";
|
||||
"Continue" = "繼續";
|
||||
|
|
|
@ -15,11 +15,11 @@
|
|||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<string>1.1</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>BPMF</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>846</string>
|
||||
<string>879</string>
|
||||
<key>ComponentInputModeDict</key>
|
||||
<dict>
|
||||
<key>tsInputModeListKey</key>
|
||||
|
@ -118,7 +118,7 @@
|
|||
<key>LSUIElement</key>
|
||||
<true/>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>Copyright © 2011-2020 Mengjuei Hsieh et al.</string>
|
||||
<string>Copyright © 2011-2021 Mengjuei Hsieh et al.</string>
|
||||
<key>NSMainNibFile</key>
|
||||
<string>MainMenu</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
+ (BOOL)inputSourceEnabled:(TISInputSourceRef)inInputSource;
|
||||
+ (BOOL)enableInputSource:(TISInputSourceRef)inInputSource;
|
||||
+ (BOOL)enableAllInputModesForInputSourceBundleID:(NSString *)inID;
|
||||
+ (BOOL)enableInputMode:(NSString *)modeID forInputSourceBundleID:(NSString *)bundleID;
|
||||
+ (BOOL)disableInputSource:(TISInputSourceRef)inInputSource;
|
||||
|
||||
// register (i.e. make available to Input Source tab in Language & Text Preferences)
|
||||
|
|
|
@ -90,6 +90,24 @@
|
|||
return enabled;
|
||||
}
|
||||
|
||||
+ (BOOL)enableInputMode:(NSString *)modeID forInputSourceBundleID:(NSString *)bundleID
|
||||
{
|
||||
for (id source in [self allInstalledInputSources]) {
|
||||
TISInputSourceRef inputSource = (__bridge TISInputSourceRef)source;
|
||||
NSString *inputSoureBundleID = (__bridge NSString *)TISGetInputSourceProperty(inputSource, kTISPropertyBundleID);
|
||||
NSString *inputSourceModeID = (NSString *)CFBridgingRelease(TISGetInputSourceProperty(inputSource, kTISPropertyInputModeID));
|
||||
|
||||
if ([modeID isEqual:inputSourceModeID] && [bundleID isEqual:inputSoureBundleID]) {
|
||||
BOOL enabled = [self enableInputSource:inputSource];
|
||||
NSLog(@"Attempt to enable input source of mode: %@, bundle ID: %@, result: %d", modeID, bundleID, enabled);
|
||||
return enabled;
|
||||
}
|
||||
}
|
||||
|
||||
NSLog(@"Failed to find any matching input source of mode: %@, bundle ID: %@", modeID, bundleID);
|
||||
return NO;
|
||||
}
|
||||
|
||||
+ (BOOL)disableInputSource:(TISInputSourceRef)inInputSource
|
||||
{
|
||||
OSStatus status = TISDisableInputSource(inInputSource);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
CFBundleName = "McBopomofo";
|
||||
CFBundleDisplayName = "McBopomofo";
|
||||
NSHumanReadableCopyright = "Copyright © 2011-2020 Mengjuei Hsieh et al.\nAll Rights Reserved.";
|
||||
NSHumanReadableCopyright = "Copyright © 2011-2021 Mengjuei Hsieh et al.\nAll Rights Reserved.";
|
||||
"org.openvanilla.inputmethod.McBopomofo.Bopomofo" = "Bopomofo";
|
||||
"org.openvanilla.inputmethod.McBopomofo.PlainBopomofo" = "Plain Bopomofo";
|
||||
|
||||
|
|
|
@ -49,4 +49,4 @@
|
|||
/* No comment provided by engineer. */
|
||||
"You're currently using McBopomofo %@ (%@), a new version %@ (%@) is now available. Do you want to visit McBopomofo's website to download the version?%@" = "You're currently using McBopomofo %@ (%@), a new version %@ (%@) is now available. Do you want to visit McBopomofo's website to download the version?%@";
|
||||
|
||||
"Chinese Conversion" = "Chinese Conversion";
|
||||
"Chinese Conversion" = "Convert to Simplified Chinese";
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
CFBundleName = "小麥注音";
|
||||
CFBundleDisplayName = "小麥注音";
|
||||
NSHumanReadableCopyright = "Copyright © 2011-2020 Mengjuei Hsieh et al.\nAll Rights Reserved.";
|
||||
NSHumanReadableCopyright = "Copyright © 2011-2021 Mengjuei Hsieh et al.\nAll Rights Reserved.";
|
||||
"org.openvanilla.inputmethod.McBopomofo.Bopomofo" = "小麥注音";
|
||||
"org.openvanilla.inputmethod.McBopomofo.PlainBopomofo" = "傳統注音";
|
||||
|
|
|
@ -49,4 +49,4 @@
|
|||
/* No comment provided by engineer. */
|
||||
"You're currently using McBopomofo %@ (%@), a new version %@ (%@) is now available. Do you want to visit McBopomofo's website to download the version?%@" = "目前使用的小麥注音版本是 %1$@ (%2$@),網路上有更新版本 %3$@ (%4$@) 可供下載。是否要前往小麥注音網站下載新版來安裝?%5$@";
|
||||
|
||||
"Chinese Conversion" = "簡繁轉換";
|
||||
"Chinese Conversion" = "輸出簡體中文";
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES"/>
|
||||
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
|
||||
<rect key="contentRect" x="489" y="334" width="406" height="353"/>
|
||||
<rect key="screenRect" x="0.0" y="0.0" width="1920" height="1055"/>
|
||||
<rect key="screenRect" x="0.0" y="0.0" width="1440" height="875"/>
|
||||
<view key="contentView" id="2">
|
||||
<rect key="frame" x="0.0" y="0.0" width="406" height="353"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
|
@ -223,7 +223,7 @@
|
|||
<rect key="frame" x="69" y="243" width="108" height="17"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="right" title="選字鍵:" id="eBT-Tv-vED">
|
||||
<font key="font" size="13" name=".PingFangTC-Regular"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
|
|
Loading…
Reference in New Issue