!6 1.3.7 osr3 // Maintentance.

Merge pull request !6 from ShikiSuen/upd/1.3.7osr3
This commit is contained in:
ShikiSuen 2022-03-09 10:46:53 +00:00 committed by Gitee
commit ef5735193d
11 changed files with 165 additions and 37 deletions

View File

@ -1,3 +0,0 @@
#!/bin/sh
killall vChewing
rm -rf ~/Library/Input\ Methods/vChewing.app

View File

@ -0,0 +1,9 @@
#!/bin/sh
killall vChewing
rm -rf ~/Library/Input\ Methods/vChewing.app
rm -rf ~/Library/Keyboard\ Layouts/vChewingKeyLayout.bundle
rm -rf ~/Library/Keyboard\ Layouts/vChewing\ Dachen.keylayout
rm -rf ~/Library/Keyboard\ Layouts/vChewing\ ETen.keylayout
rm -rf ~/Library/Keyboard\ Layouts/vChewing\ FakeSeigyou.keylayout
rm -rf ~/Library/Keyboard\ Layouts/vChewing\ IBM.keylayout
rm -rf ~/Library/Keyboard\ Layouts/vChewing\ MiTAC.keylayout

View File

@ -20,12 +20,10 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR TH
@interface AWFileHash : NSObject @interface AWFileHash : NSObject
+ (NSString *)md5HashOfData:(NSData *)data;
+ (NSString *)sha1HashOfData:(NSData *)data; + (NSString *)sha1HashOfData:(NSData *)data;
+ (NSString *)sha512HashOfData:(NSData *)data; + (NSString *)sha512HashOfData:(NSData *)data;
+ (NSString *)crc32HashOfData:(NSData *)data; + (NSString *)crc32HashOfData:(NSData *)data;
+ (NSString *)md5HashOfFileAtPath:(NSString *)filePath;
+ (NSString *)sha1HashOfFileAtPath:(NSString *)filePath; + (NSString *)sha1HashOfFileAtPath:(NSString *)filePath;
+ (NSString *)sha512HashOfFileAtPath:(NSString *)filePath; + (NSString *)sha512HashOfFileAtPath:(NSString *)filePath;
+ (NSString *)crc32HashOfFileAtPath:(NSString *)filePath; + (NSString *)crc32HashOfFileAtPath:(NSString *)filePath;

View File

@ -307,11 +307,7 @@ int CC_CRC32_Final(unsigned char *md, CC_CRC32_CTX *c) {
#pragma mark - #pragma mark -
#pragma mark public class accessors #pragma mark public class accessors
+ (NSString *)md5HashOfData:(NSData *)data {
FileHashComputationContext context;
FileHashComputationContextInitialize(context, MD5);
return [self hashOfNSData:data withComputationContext:&context];
}
+ (NSString *)sha1HashOfData:(NSData *)data { + (NSString *)sha1HashOfData:(NSData *)data {
FileHashComputationContext context; FileHashComputationContext context;
@ -331,12 +327,6 @@ int CC_CRC32_Final(unsigned char *md, CC_CRC32_CTX *c) {
return [self hashOfNSData:data withComputationContext:&context]; return [self hashOfNSData:data withComputationContext:&context];
} }
+ (NSString *)md5HashOfFileAtPath:(NSString *)filePath {
FileHashComputationContext context;
FileHashComputationContextInitialize(context, MD5);
return [self hashOfFileAtPath:filePath withComputationContext:&context];
}
+ (NSString *)sha1HashOfFileAtPath:(NSString *)filePath { + (NSString *)sha1HashOfFileAtPath:(NSString *)filePath {
FileHashComputationContext context; FileHashComputationContext context;
FileHashComputationContextInitialize(context, SHA1); FileHashComputationContextInitialize(context, SHA1);

@ -1 +1 @@
Subproject commit ed8e8f37aeff477a242f4ad345d5b2cfa85e0cf0 Subproject commit e7785674095589d8d35a54f9ad3920d26d39a448

View File

@ -299,4 +299,19 @@ class AppDelegate: NSObject, NSApplicationDelegate, ctlNonModalAlertWindowDelega
NSLog("vChewingErrorCallback: %@", strPrint) NSLog("vChewingErrorCallback: %@", strPrint)
} }
} }
@objc static func isDarkMode() -> Bool {
if #available(macOS 10.15, *) {
let appearanceDescription = NSApplication.shared.effectiveAppearance.debugDescription.lowercased()
if appearanceDescription.contains("dark") {
return true
}
} else if #available(macOS 10.14, *) {
if let appleInterfaceStyle = UserDefaults.standard.object(forKey: "AppleInterfaceStyle") as? String {
if appleInterfaceStyle.lowercased().contains("dark") {
return true
}
}
}
return false
}
} }

View File

@ -563,7 +563,9 @@ extension ctlInputMethod {
func candidateFont(name: String?, size: CGFloat) -> NSFont { func candidateFont(name: String?, size: CGFloat) -> NSFont {
let currentMUIFont = (keyHandler.inputMode == InputMode.imeModeCHS) ? "Sarasa Term Slab SC" : "Sarasa Term Slab TC" let currentMUIFont = (keyHandler.inputMode == InputMode.imeModeCHS) ? "Sarasa Term Slab SC" : "Sarasa Term Slab TC"
let finalReturnFont = NSFont(name: currentMUIFont, size: size) ?? NSFont.systemFont(ofSize: size) var finalReturnFont = NSFont(name: currentMUIFont, size: size) ?? NSFont.systemFont(ofSize: size)
// macOS 11 Big Sur macOS 12 Monterey 使
if #available(macOS 12.0, *) {finalReturnFont = NSFont.systemFont(ofSize: size)}
if let name = name { if let name = name {
return NSFont(name: name, size: size) ?? finalReturnFont return NSFont(name: name, size: size) ?? finalReturnFont
} }

View File

@ -118,12 +118,13 @@ fileprivate class HorizontalCandidateView: NSView {
var activeCandidateIndexAttr = keyLabelAttrDict var activeCandidateIndexAttr = keyLabelAttrDict
var activeCandidateAttr = candidateAttrDict var activeCandidateAttr = candidateAttrDict
if index == highlightedIndex { if index == highlightedIndex {
let colorBlendAmount: CGFloat = IME.isDarkMode() ? 0.25 : 0
// The background color of the highlightened candidate // The background color of the highlightened candidate
switch ctlInputMethod.currentKeyHandler.inputMode { switch ctlInputMethod.currentKeyHandler.inputMode {
case InputMode.imeModeCHS: case InputMode.imeModeCHS:
NSColor.systemRed.withAlphaComponent(0.75).setFill() NSColor.systemRed.blended(withFraction: colorBlendAmount, of: NSColor.controlBackgroundColor)!.setFill()
case InputMode.imeModeCHT: case InputMode.imeModeCHT:
NSColor.systemBlue.withAlphaComponent(0.75).setFill() NSColor.systemBlue.blended(withFraction: colorBlendAmount, of: NSColor.controlBackgroundColor)!.setFill()
default: default:
NSColor.alternateSelectedControlColor.setFill() NSColor.alternateSelectedControlColor.setFill()
} }
@ -132,6 +133,14 @@ fileprivate class HorizontalCandidateView: NSView {
} else { } else {
NSColor.controlBackgroundColor.setFill() NSColor.controlBackgroundColor.setFill()
} }
switch ctlInputMethod.currentKeyHandler.inputMode {
case InputMode.imeModeCHS:
if #available(macOS 12.0, *) {activeCandidateAttr[.languageIdentifier] = "zh-Hans" as AnyObject}
case InputMode.imeModeCHT:
if #available(macOS 12.0, *) {activeCandidateAttr[.languageIdentifier] = "zh-Hant" as AnyObject}
default:
break
}
NSBezierPath.fill(rctCandidateArea) NSBezierPath.fill(rctCandidateArea)
(keyLabels[index] as NSString).draw(in: rctLabel, withAttributes: activeCandidateIndexAttr) (keyLabels[index] as NSString).draw(in: rctLabel, withAttributes: activeCandidateIndexAttr)
(displayedCandidates[index] as NSString).draw(in: rctCandidatePhrase, withAttributes: activeCandidateAttr) (displayedCandidates[index] as NSString).draw(in: rctCandidatePhrase, withAttributes: activeCandidateAttr)

View File

@ -124,12 +124,13 @@ fileprivate class VerticalCandidateView: NSView {
var activeCandidateIndexAttr = keyLabelAttrDict var activeCandidateIndexAttr = keyLabelAttrDict
var activeCandidateAttr = candidateAttrDict var activeCandidateAttr = candidateAttrDict
if index == highlightedIndex { if index == highlightedIndex {
let colorBlendAmount: CGFloat = IME.isDarkMode() ? 0.25 : 0
// The background color of the highlightened candidate // The background color of the highlightened candidate
switch ctlInputMethod.currentKeyHandler.inputMode { switch ctlInputMethod.currentKeyHandler.inputMode {
case InputMode.imeModeCHS: case InputMode.imeModeCHS:
NSColor.systemRed.withAlphaComponent(0.75).setFill() NSColor.systemRed.blended(withFraction: colorBlendAmount, of: NSColor.controlBackgroundColor)!.setFill()
case InputMode.imeModeCHT: case InputMode.imeModeCHT:
NSColor.systemBlue.withAlphaComponent(0.75).setFill() NSColor.systemBlue.blended(withFraction: colorBlendAmount, of: NSColor.controlBackgroundColor)!.setFill()
default: default:
NSColor.alternateSelectedControlColor.setFill() NSColor.alternateSelectedControlColor.setFill()
} }
@ -138,6 +139,14 @@ fileprivate class VerticalCandidateView: NSView {
} else { } else {
NSColor.controlBackgroundColor.setFill() NSColor.controlBackgroundColor.setFill()
} }
switch ctlInputMethod.currentKeyHandler.inputMode {
case InputMode.imeModeCHS:
if #available(macOS 12.0, *) {activeCandidateAttr[.languageIdentifier] = "zh-Hans" as AnyObject}
case InputMode.imeModeCHT:
if #available(macOS 12.0, *) {activeCandidateAttr[.languageIdentifier] = "zh-Hant" as AnyObject}
default:
break
}
NSBezierPath.fill(rctCandidateArea) NSBezierPath.fill(rctCandidateArea)
(keyLabels[index] as NSString).draw(in: rctLabel, withAttributes: activeCandidateIndexAttr) (keyLabels[index] as NSString).draw(in: rctLabel, withAttributes: activeCandidateIndexAttr)
(displayedCandidates[index] as NSString).draw(in: rctCandidatePhrase, withAttributes: activeCandidateAttr) (displayedCandidates[index] as NSString).draw(in: rctCandidatePhrase, withAttributes: activeCandidateAttr)

View File

@ -222,6 +222,7 @@ extension String {
varLineData.regReplace(pattern: "cai", replaceWith: "ㄘㄞ") varLineData.regReplace(pattern: "cai", replaceWith: "ㄘㄞ")
varLineData.regReplace(pattern: "can", replaceWith: "ㄘㄢ") varLineData.regReplace(pattern: "can", replaceWith: "ㄘㄢ")
varLineData.regReplace(pattern: "cao", replaceWith: "ㄘㄠ") varLineData.regReplace(pattern: "cao", replaceWith: "ㄘㄠ")
varLineData.regReplace(pattern: "cei", replaceWith: "ㄘㄟ")
varLineData.regReplace(pattern: "cen", replaceWith: "ㄘㄣ") varLineData.regReplace(pattern: "cen", replaceWith: "ㄘㄣ")
varLineData.regReplace(pattern: "cha", replaceWith: "ㄔㄚ") varLineData.regReplace(pattern: "cha", replaceWith: "ㄔㄚ")
varLineData.regReplace(pattern: "che", replaceWith: "ㄔㄜ") varLineData.regReplace(pattern: "che", replaceWith: "ㄔㄜ")

View File

@ -52,6 +52,22 @@
<key>UID</key> <key>UID</key>
<integer>0</integer> <integer>0</integer>
</dict> </dict>
<dict>
<key>CHILDREN</key>
<array/>
<key>GID</key>
<integer>0</integer>
<key>PATH</key>
<string>Audio</string>
<key>PATH_TYPE</key>
<integer>0</integer>
<key>PERMISSIONS</key>
<integer>493</integer>
<key>TYPE</key>
<integer>1</integer>
<key>UID</key>
<integer>0</integer>
</dict>
<dict> <dict>
<key>CHILDREN</key> <key>CHILDREN</key>
<array/> <array/>
@ -68,6 +84,22 @@
<key>UID</key> <key>UID</key>
<integer>0</integer> <integer>0</integer>
</dict> </dict>
<dict>
<key>CHILDREN</key>
<array/>
<key>GID</key>
<integer>0</integer>
<key>PATH</key>
<string>ColorPickers</string>
<key>PATH_TYPE</key>
<integer>0</integer>
<key>PERMISSIONS</key>
<integer>493</integer>
<key>TYPE</key>
<integer>1</integer>
<key>UID</key>
<integer>0</integer>
</dict>
<dict> <dict>
<key>CHILDREN</key> <key>CHILDREN</key>
<array/> <array/>
@ -116,6 +148,22 @@
<key>UID</key> <key>UID</key>
<integer>0</integer> <integer>0</integer>
</dict> </dict>
<dict>
<key>CHILDREN</key>
<array/>
<key>GID</key>
<integer>80</integer>
<key>PATH</key>
<string>Fonts</string>
<key>PATH_TYPE</key>
<integer>0</integer>
<key>PERMISSIONS</key>
<integer>1021</integer>
<key>TYPE</key>
<integer>1</integer>
<key>UID</key>
<integer>0</integer>
</dict>
<dict> <dict>
<key>CHILDREN</key> <key>CHILDREN</key>
<array/> <array/>
@ -524,6 +572,56 @@
<key>UID</key> <key>UID</key>
<integer>0</integer> <integer>0</integer>
</dict> </dict>
<dict>
<key>CHILDREN</key>
<array>
<dict>
<key>CHILDREN</key>
<array>
<dict>
<key>CHILDREN</key>
<array/>
<key>GID</key>
<integer>0</integer>
<key>PATH</key>
<string>Extensions</string>
<key>PATH_TYPE</key>
<integer>0</integer>
<key>PERMISSIONS</key>
<integer>493</integer>
<key>TYPE</key>
<integer>1</integer>
<key>UID</key>
<integer>0</integer>
</dict>
</array>
<key>GID</key>
<integer>0</integer>
<key>PATH</key>
<string>Library</string>
<key>PATH_TYPE</key>
<integer>0</integer>
<key>PERMISSIONS</key>
<integer>493</integer>
<key>TYPE</key>
<integer>1</integer>
<key>UID</key>
<integer>0</integer>
</dict>
</array>
<key>GID</key>
<integer>0</integer>
<key>PATH</key>
<string>System</string>
<key>PATH_TYPE</key>
<integer>0</integer>
<key>PERMISSIONS</key>
<integer>493</integer>
<key>TYPE</key>
<integer>1</integer>
<key>UID</key>
<integer>0</integer>
</dict>
<dict> <dict>
<key>CHILDREN</key> <key>CHILDREN</key>
<array> <array>
@ -594,7 +692,7 @@
<key>PREINSTALL_PATH</key> <key>PREINSTALL_PATH</key>
<dict> <dict>
<key>PATH</key> <key>PATH</key>
<string>Installer/pkgPostInstall.sh</string> <string>Installer/pkgPreInstall.sh</string>
<key>PATH_TYPE</key> <key>PATH_TYPE</key>
<integer>1</integer> <integer>1</integer>
</dict> </dict>
@ -846,11 +944,11 @@
</dict> </dict>
<dict> <dict>
<key>LANGUAGE</key> <key>LANGUAGE</key>
<string>Simplified Chinese</string> <string>Traditional Chinese</string>
<key>VALUE</key> <key>VALUE</key>
<dict> <dict>
<key>PATH</key> <key>PATH</key>
<string>LICENSE-CHS.txt</string> <string>LICENSE-CHT.txt</string>
<key>PATH_TYPE</key> <key>PATH_TYPE</key>
<integer>1</integer> <integer>1</integer>
</dict> </dict>
@ -868,11 +966,11 @@
</dict> </dict>
<dict> <dict>
<key>LANGUAGE</key> <key>LANGUAGE</key>
<string>Traditional Chinese</string> <string>Simplified Chinese</string>
<key>VALUE</key> <key>VALUE</key>
<dict> <dict>
<key>PATH</key> <key>PATH</key>
<string>LICENSE-CHT.txt</string> <string>LICENSE-CHS.txt</string>
<key>PATH_TYPE</key> <key>PATH_TYPE</key>
<integer>1</integer> <integer>1</integer>
</dict> </dict>
@ -903,9 +1001,9 @@
</dict> </dict>
<dict> <dict>
<key>LANGUAGE</key> <key>LANGUAGE</key>
<string>Traditional Chinese</string> <string>Simplified Chinese</string>
<key>VALUE</key> <key>VALUE</key>
<string>威注音入法</string> <string>威注音入法</string>
</dict> </dict>
<dict> <dict>
<key>LANGUAGE</key> <key>LANGUAGE</key>
@ -915,9 +1013,9 @@
</dict> </dict>
<dict> <dict>
<key>LANGUAGE</key> <key>LANGUAGE</key>
<string>Simplified Chinese</string> <string>Traditional Chinese</string>
<key>VALUE</key> <key>VALUE</key>
<string>威注音入法</string> <string>威注音入法</string>
</dict> </dict>
</array> </array>
</dict> </dict>
@ -954,11 +1052,11 @@
</dict> </dict>
<dict> <dict>
<key>LANGUAGE</key> <key>LANGUAGE</key>
<string>Traditional Chinese</string> <string>Simplified Chinese</string>
<key>SECONDARY_VALUE</key> <key>SECONDARY_VALUE</key>
<string>至少 macOS 10.11.5 方可滿足威注音對系統內的萬國碼版本支援的需要。</string> <string>至少 macOS 10.11.5 方可满足威注音对系统内的万国码版本支援的需要。</string>
<key>VALUE</key> <key>VALUE</key>
<string>作業系統版本太舊</string> <string>作业系统版本太旧</string>
</dict> </dict>
<dict> <dict>
<key>LANGUAGE</key> <key>LANGUAGE</key>
@ -970,11 +1068,11 @@
</dict> </dict>
<dict> <dict>
<key>LANGUAGE</key> <key>LANGUAGE</key>
<string>Simplified Chinese</string> <string>Traditional Chinese</string>
<key>SECONDARY_VALUE</key> <key>SECONDARY_VALUE</key>
<string>至少 macOS 10.11.5 方可满足威注音对系统内的万国码版本支援的需要。</string> <string>至少 macOS 10.11.5 方可滿足威注音對系統內的萬國碼版本支援的需要。</string>
<key>VALUE</key> <key>VALUE</key>
<string>作业系统版本太旧</string> <string>作業系統版本太舊</string>
</dict> </dict>
</array> </array>
<key>NAME</key> <key>NAME</key>