diff --git a/.github/workflows/continuous-integration-workflow.yml b/.github/workflows/continuous-integration-workflow.yml new file mode 100644 index 00000000..c8a87cdc --- /dev/null +++ b/.github/workflows/continuous-integration-workflow.yml @@ -0,0 +1,15 @@ +name: Build +on: [push] + +jobs: + build: + name: Build + runs-on: macOS-latest + env: + DEVELOPER_DIR: /Applications/Xcode_12.app/Contents/Developer + steps: + - uses: actions/checkout@v1 + - name: Clean + run: xcodebuild -scheme McBopomofo -configuration Release clean + - name: Build + run: xcodebuild -scheme McBopomofo -configuration Release diff --git a/.gitignore b/.gitignore index bd1ec3ca..3160b584 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,7 @@ build project.xcworkspace xcuserdata Credits.rtf +# the executable we used to count the occurance of a string in a file +# that can be built by make -C Source/Data/bin/C_Version +# C_count.occ.exe +.idea diff --git a/McBopomofo.xcodeproj/project.pbxproj b/McBopomofo.xcodeproj/project.pbxproj index 0d2c102f..f32ece51 100644 --- a/McBopomofo.xcodeproj/project.pbxproj +++ b/McBopomofo.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 46; + objectVersion = 52; objects = { /* Begin PBXBuildFile section */ @@ -14,7 +14,6 @@ 6A0D4ED315FC0D6400ABF4B3 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 6A0D4EC815FC0D6400ABF4B3 /* main.m */; }; 6A0D4ED415FC0D6400ABF4B3 /* OVInputSourceHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 6A0D4ECA15FC0D6400ABF4B3 /* OVInputSourceHelper.m */; }; 6A0D4ED515FC0D6400ABF4B3 /* PreferencesWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6A0D4ECC15FC0D6400ABF4B3 /* PreferencesWindowController.m */; }; - 6A0D4ED615FC0D6400ABF4B3 /* UpdateNotificationController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6A0D4ECE15FC0D6400ABF4B3 /* UpdateNotificationController.m */; }; 6A0D4EFE15FC0DA600ABF4B3 /* VTCandidateController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6A0D4EDA15FC0DA600ABF4B3 /* VTCandidateController.m */; }; 6A0D4EFF15FC0DA600ABF4B3 /* VTHorizontalCandidateController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6A0D4EDC15FC0DA600ABF4B3 /* VTHorizontalCandidateController.m */; }; 6A0D4F0015FC0DA600ABF4B3 /* VTHorizontalCandidateView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6A0D4EDE15FC0DA600ABF4B3 /* VTHorizontalCandidateView.m */; }; @@ -24,19 +23,16 @@ 6A0D4F0815FC0DA600ABF4B3 /* Bopomofo.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 6A0D4EEF15FC0DA600ABF4B3 /* Bopomofo.tiff */; }; 6A0D4F0915FC0DA600ABF4B3 /* Bopomofo@2x.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 6A0D4EF015FC0DA600ABF4B3 /* Bopomofo@2x.tiff */; }; 6A0D4F4515FC0EB100ABF4B3 /* Mandarin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6A0D4F2015FC0EB100ABF4B3 /* Mandarin.cpp */; }; - 6A0D4F5215FC0EE100ABF4B3 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6A0D4F4C15FC0EE100ABF4B3 /* MainMenu.xib */; }; 6A0D4F5315FC0EE100ABF4B3 /* preferences.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6A0D4F4E15FC0EE100ABF4B3 /* preferences.xib */; }; 6A0D4F5715FC0EF900ABF4B3 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 6A0D4F4815FC0EE100ABF4B3 /* InfoPlist.strings */; }; 6A0D4F5815FC0EF900ABF4B3 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 6A0D4F4A15FC0EE100ABF4B3 /* Localizable.strings */; }; 6A187E2616004C5900466B2E /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6A187E2816004C5900466B2E /* MainMenu.xib */; }; + 6A225A1F23679F2600F685C6 /* NotarizedArchives in Resources */ = {isa = PBXBuildFile; fileRef = 6A225A1E23679F2600F685C6 /* NotarizedArchives */; }; + 6A225A232367A1D700F685C6 /* ArchiveUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = 6A225A222367A1D700F685C6 /* ArchiveUtil.m */; }; + 6A2E40F6253A69DA00D1AE1D /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6A2E40F5253A69DA00D1AE1D /* Images.xcassets */; }; + 6A2E40F9253A6AA000D1AE1D /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6A2E40F5253A69DA00D1AE1D /* Images.xcassets */; }; 6A38BC1515FC117A00A8A51F /* data.txt in Resources */ = {isa = PBXBuildFile; fileRef = 6A38BBF615FC117A00A8A51F /* data.txt */; }; - 6A38BC1D15FC11C700A8A51F /* UpdateNotificationController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6A38BC1F15FC11C700A8A51F /* UpdateNotificationController.xib */; }; 6A38BC2815FC158A00A8A51F /* InputMethodKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6A38BC2715FC158A00A8A51F /* InputMethodKit.framework */; }; - 6A38BC2A15FC161000A8A51F /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6A38BC2915FC161000A8A51F /* Carbon.framework */; }; - 6A719D0415FC5FD200C8B8E3 /* McBopomofo.iconset in Resources */ = {isa = PBXBuildFile; fileRef = 6A719D0315FC5FD200C8B8E3 /* McBopomofo.iconset */; }; - 6A719D0515FC5FD200C8B8E3 /* McBopomofo.iconset in Resources */ = {isa = PBXBuildFile; fileRef = 6A719D0315FC5FD200C8B8E3 /* McBopomofo.iconset */; }; - 6AA67FEB15FC5B0D00B5A308 /* BopomofoTextMenu.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 6AA67FE915FC5B0D00B5A308 /* BopomofoTextMenu.tiff */; }; - 6AA67FEC15FC5B0D00B5A308 /* BopomofoTextMenu@2x.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 6AA67FEA15FC5B0D00B5A308 /* BopomofoTextMenu@2x.tiff */; }; 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 */; }; @@ -49,6 +45,10 @@ 6AE210B215FC63CC003659FE /* PlainBopomofo.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 6AE210B015FC63CC003659FE /* PlainBopomofo.tiff */; }; 6AE210B315FC63CC003659FE /* PlainBopomofo@2x.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 6AE210B115FC63CC003659FE /* PlainBopomofo@2x.tiff */; }; 6AE30A491F7F40B7008735BD /* UserOverrideModel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6AE30A471F7F40B7008735BD /* UserOverrideModel.cpp */; }; + 6AFF97F2253B299E007F1C49 /* OVNonModalAlertWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6AFF97F0253B299E007F1C49 /* OVNonModalAlertWindowController.xib */; }; + 6AFF97F3253B299E007F1C49 /* OVNonModalAlertWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6AFF97F1253B299E007F1C49 /* OVNonModalAlertWindowController.m */; }; + D427A9C125ED28CC005D43E0 /* OpenCCBridge.swift in Sources */ = {isa = PBXBuildFile; fileRef = D427A9C025ED28CC005D43E0 /* OpenCCBridge.swift */; }; + D48550A325EBE689006A204C /* OpenCC in Frameworks */ = {isa = PBXBuildFile; productRef = D48550A225EBE689006A204C /* OpenCC */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -84,8 +84,6 @@ 6A0D4ECA15FC0D6400ABF4B3 /* OVInputSourceHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OVInputSourceHelper.m; sourceTree = ""; }; 6A0D4ECB15FC0D6400ABF4B3 /* PreferencesWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PreferencesWindowController.h; sourceTree = ""; }; 6A0D4ECC15FC0D6400ABF4B3 /* PreferencesWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PreferencesWindowController.m; sourceTree = ""; }; - 6A0D4ECD15FC0D6400ABF4B3 /* UpdateNotificationController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UpdateNotificationController.h; sourceTree = ""; }; - 6A0D4ECE15FC0D6400ABF4B3 /* UpdateNotificationController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UpdateNotificationController.m; sourceTree = ""; }; 6A0D4ED915FC0DA600ABF4B3 /* VTCandidateController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VTCandidateController.h; sourceTree = ""; }; 6A0D4EDA15FC0DA600ABF4B3 /* VTCandidateController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VTCandidateController.m; sourceTree = ""; }; 6A0D4EDB15FC0DA600ABF4B3 /* VTHorizontalCandidateController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VTHorizontalCandidateController.h; sourceTree = ""; }; @@ -149,12 +147,17 @@ 6A0D4F4215FC0EB100ABF4B3 /* OVWildcard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OVWildcard.h; sourceTree = ""; }; 6A0D4F4915FC0EE100ABF4B3 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = Source/en.lproj/InfoPlist.strings; sourceTree = ""; }; 6A0D4F4B15FC0EE100ABF4B3 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = Source/en.lproj/Localizable.strings; sourceTree = ""; }; - 6A0D4F4F15FC0EE100ABF4B3 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = Source/en.lproj/preferences.xib; sourceTree = ""; }; 6A0D4F5415FC0EF900ABF4B3 /* zh-Hant */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hant"; path = "Source/zh-Hant.lproj/InfoPlist.strings"; sourceTree = ""; }; 6A0D4F5515FC0EF900ABF4B3 /* zh-Hant */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hant"; path = "Source/zh-Hant.lproj/Localizable.strings"; sourceTree = ""; }; 6A0D4F5615FC0EF900ABF4B3 /* zh-Hant */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = "zh-Hant"; path = "Source/zh-Hant.lproj/preferences.xib"; sourceTree = ""; }; - 6A187E2716004C5900466B2E /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/MainMenu.xib; sourceTree = ""; }; + 6A15B32421A51F2300B92CD3 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; }; + 6A15B32521A51F2300B92CD3 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; }; + 6A15B32721A51F2300B92CD3 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Source/Base.lproj/preferences.xib; sourceTree = ""; }; 6A187E2916004C7300466B2E /* zh-Hant */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = "zh-Hant"; path = "zh-Hant.lproj/MainMenu.xib"; sourceTree = ""; }; + 6A225A1E23679F2600F685C6 /* NotarizedArchives */ = {isa = PBXFileReference; lastKnownFileType = folder; path = NotarizedArchives; sourceTree = ""; }; + 6A225A212367A1D700F685C6 /* ArchiveUtil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ArchiveUtil.h; sourceTree = ""; }; + 6A225A222367A1D700F685C6 /* ArchiveUtil.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ArchiveUtil.m; sourceTree = ""; }; + 6A2E40F5253A69DA00D1AE1D /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 6A38BBDE15FC117A00A8A51F /* 4_in_5.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = 4_in_5.txt; sourceTree = ""; }; 6A38BBDF15FC117A00A8A51F /* 4_in_6.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = 4_in_6.txt; sourceTree = ""; }; 6A38BBE015FC117A00A8A51F /* 5_in_6.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = 5_in_6.txt; sourceTree = ""; }; @@ -186,20 +189,13 @@ 6A38BBFB15FC117A00A8A51F /* phrase.occ */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = phrase.occ; sourceTree = ""; }; 6A38BBFC15FC117A00A8A51F /* PhraseFreq.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = PhraseFreq.txt; sourceTree = ""; }; 6A38BBFD15FC117A00A8A51F /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = ""; }; - 6A38BC1E15FC11C700A8A51F /* zh-Hant */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = "zh-Hant"; path = "zh-Hant.lproj/UpdateNotificationController.xib"; sourceTree = ""; }; - 6A38BC2015FC11CE00A8A51F /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/UpdateNotificationController.xib; sourceTree = ""; }; 6A38BC2715FC158A00A8A51F /* InputMethodKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = InputMethodKit.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks/InputMethodKit.framework; sourceTree = DEVELOPER_DIR; }; - 6A38BC2915FC161000A8A51F /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks/Carbon.framework; sourceTree = DEVELOPER_DIR; }; - 6A719D0315FC5FD200C8B8E3 /* McBopomofo.iconset */ = {isa = PBXFileReference; lastKnownFileType = folder.iconset; path = McBopomofo.iconset; sourceTree = ""; }; - 6AA67FE915FC5B0D00B5A308 /* BopomofoTextMenu.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = BopomofoTextMenu.tiff; sourceTree = ""; }; - 6AA67FEA15FC5B0D00B5A308 /* BopomofoTextMenu@2x.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = "BopomofoTextMenu@2x.tiff"; sourceTree = ""; }; 6ACA41CB15FC1D7500935EF6 /* McBopomofoInstaller.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = McBopomofoInstaller.app; sourceTree = BUILT_PRODUCTS_DIR; }; 6ACA41E815FC1D9000935EF6 /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = Source/Installer/AppDelegate.h; sourceTree = SOURCE_ROOT; }; 6ACA41E915FC1D9000935EF6 /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = Source/Installer/AppDelegate.m; sourceTree = SOURCE_ROOT; }; 6ACA41EB15FC1D9000935EF6 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 6ACA41ED15FC1D9000935EF6 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = en; path = en.lproj/License.rtf; sourceTree = ""; }; 6ACA41EF15FC1D9000935EF6 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = ""; }; - 6ACA41F115FC1D9000935EF6 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/MainMenu.xib; sourceTree = ""; }; 6ACA41F215FC1D9000935EF6 /* Installer-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "Installer-Info.plist"; path = "Source/Installer/Installer-Info.plist"; sourceTree = SOURCE_ROOT; }; 6ACA41F315FC1D9000935EF6 /* Installer-Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "Installer-Prefix.pch"; path = "Source/Installer/Installer-Prefix.pch"; sourceTree = SOURCE_ROOT; }; 6ACA41F415FC1D9000935EF6 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = Source/Installer/main.m; sourceTree = SOURCE_ROOT; }; @@ -212,6 +208,11 @@ 6AE210B115FC63CC003659FE /* PlainBopomofo@2x.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = "PlainBopomofo@2x.tiff"; sourceTree = ""; }; 6AE30A471F7F40B7008735BD /* UserOverrideModel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UserOverrideModel.cpp; sourceTree = ""; }; 6AE30A481F7F40B7008735BD /* UserOverrideModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserOverrideModel.h; sourceTree = ""; }; + 6AFF97EF253B299E007F1C49 /* OVNonModalAlertWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OVNonModalAlertWindowController.h; sourceTree = ""; }; + 6AFF97F0253B299E007F1C49 /* OVNonModalAlertWindowController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = OVNonModalAlertWindowController.xib; sourceTree = ""; }; + 6AFF97F1253B299E007F1C49 /* OVNonModalAlertWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OVNonModalAlertWindowController.m; sourceTree = ""; }; + D427A9BF25ED28CC005D43E0 /* McBopomofo-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "McBopomofo-Bridging-Header.h"; sourceTree = ""; }; + D427A9C025ED28CC005D43E0 /* OpenCCBridge.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OpenCCBridge.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -219,8 +220,8 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 6A38BC2A15FC161000A8A51F /* Carbon.framework in Frameworks */, 6A38BC2815FC158A00A8A51F /* InputMethodKit.framework in Frameworks */, + D48550A325EBE689006A204C /* OpenCC in Frameworks */, 6A0D4EA715FC0D2D00ABF4B3 /* Cocoa.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -258,7 +259,6 @@ isa = PBXGroup; children = ( 6A0D4EA915FC0D2D00ABF4B3 /* AppKit.framework */, - 6A38BC2915FC161000A8A51F /* Carbon.framework */, 6A0D4EA615FC0D2D00ABF4B3 /* Cocoa.framework */, 6A0D4EAB15FC0D2D00ABF4B3 /* Foundation.framework */, 6A38BC2715FC158A00A8A51F /* InputMethodKit.framework */, @@ -280,6 +280,8 @@ 6A0D4EC715FC0D6400ABF4B3 /* InputMethodController.mm */, 6A0D4EC815FC0D6400ABF4B3 /* main.m */, 6A0D4EF615FC0DA600ABF4B3 /* McBopomofo-Prefix.pch */, + 6AFF97EF253B299E007F1C49 /* OVNonModalAlertWindowController.h */, + 6AFF97F1253B299E007F1C49 /* OVNonModalAlertWindowController.m */, 6A0D4EC915FC0D6400ABF4B3 /* OVInputSourceHelper.h */, 6A0D4ECA15FC0D6400ABF4B3 /* OVInputSourceHelper.m */, 6A0D4ECB15FC0D6400ABF4B3 /* PreferencesWindowController.h */, @@ -288,6 +290,8 @@ 6A0D4ECE15FC0D6400ABF4B3 /* UpdateNotificationController.m */, 6AE30A471F7F40B7008735BD /* UserOverrideModel.cpp */, 6AE30A481F7F40B7008735BD /* UserOverrideModel.h */, + D427A9C025ED28CC005D43E0 /* OpenCCBridge.swift */, + D427A9BF25ED28CC005D43E0 /* McBopomofo-Bridging-Header.h */, ); path = Source; sourceTree = ""; @@ -314,11 +318,9 @@ 6A0D4EEE15FC0DA600ABF4B3 /* Images */ = { isa = PBXGroup; children = ( + 6A2E40F5253A69DA00D1AE1D /* Images.xcassets */, 6A0D4EEF15FC0DA600ABF4B3 /* Bopomofo.tiff */, 6A0D4EF015FC0DA600ABF4B3 /* Bopomofo@2x.tiff */, - 6AA67FE915FC5B0D00B5A308 /* BopomofoTextMenu.tiff */, - 6AA67FEA15FC5B0D00B5A308 /* BopomofoTextMenu@2x.tiff */, - 6A719D0315FC5FD200C8B8E3 /* McBopomofo.iconset */, 6AE210B015FC63CC003659FE /* PlainBopomofo.tiff */, 6AE210B115FC63CC003659FE /* PlainBopomofo@2x.tiff */, ); @@ -406,12 +408,12 @@ 6A0D4F4715FC0EB900ABF4B3 /* Resources */ = { isa = PBXGroup; children = ( + 6AFF97F0253B299E007F1C49 /* OVNonModalAlertWindowController.xib */, 6A0D4EEE15FC0DA600ABF4B3 /* Images */, 6A0D4EF515FC0DA600ABF4B3 /* McBopomofo-Info.plist */, 6A0D4F4815FC0EE100ABF4B3 /* InfoPlist.strings */, 6A0D4F4A15FC0EE100ABF4B3 /* Localizable.strings */, 6A187E2816004C5900466B2E /* MainMenu.xib */, - 6A38BC1F15FC11C700A8A51F /* UpdateNotificationController.xib */, 6A0D4F4E15FC0EE100ABF4B3 /* preferences.xib */, ); name = Resources; @@ -467,6 +469,9 @@ 6ACA41E715FC1D9000935EF6 /* Installer */ = { isa = PBXGroup; children = ( + 6A225A212367A1D700F685C6 /* ArchiveUtil.h */, + 6A225A222367A1D700F685C6 /* ArchiveUtil.m */, + 6A225A1E23679F2600F685C6 /* NotarizedArchives */, 6ACA41E815FC1D9000935EF6 /* AppDelegate.h */, 6ACA41E915FC1D9000935EF6 /* AppDelegate.m */, 6ACA41EA15FC1D9000935EF6 /* InfoPlist.strings */, @@ -514,6 +519,9 @@ 6A38BC2615FC131100A8A51F /* PBXTargetDependency */, ); name = McBopomofo; + packageProductDependencies = ( + D48550A225EBE689006A204C /* OpenCC */, + ); productName = McBopomofo; productReference = 6A0D4EA215FC0D2D00ABF4B3 /* McBopomofo.app */; productType = "com.apple.product-type.application"; @@ -525,6 +533,7 @@ 6ACA41C715FC1D7500935EF6 /* Sources */, 6ACA41C815FC1D7500935EF6 /* Frameworks */, 6ACA41C915FC1D7500935EF6 /* Resources */, + 6A225A2023679F5F00F685C6 /* ShellScript */, ); buildRules = ( ); @@ -542,17 +551,26 @@ 6A0D4E9415FC0CFA00ABF4B3 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0500; + LastUpgradeCheck = 1220; + TargetAttributes = { + 6A0D4EA115FC0D2D00ABF4B3 = { + LastSwiftMigration = 1240; + }; + }; }; buildConfigurationList = 6A0D4E9715FC0CFA00ABF4B3 /* Build configuration list for PBXProject "McBopomofo" */; compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; + developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( en, "zh-Hant", + Base, ); mainGroup = 6A0D4E9215FC0CFA00ABF4B3; + packageReferences = ( + D48550A125EBE689006A204C /* XCRemoteSwiftPackageReference "SwiftyOpenCC" */, + ); productRefGroup = 6A0D4EA315FC0D2D00ABF4B3 /* Products */; projectDirPath = ""; projectRoot = ""; @@ -569,17 +587,14 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - 6A38BC1D15FC11C700A8A51F /* UpdateNotificationController.xib in Resources */, 6A0D4F0815FC0DA600ABF4B3 /* Bopomofo.tiff in Resources */, 6A0D4F0915FC0DA600ABF4B3 /* Bopomofo@2x.tiff in Resources */, - 6A0D4F5215FC0EE100ABF4B3 /* MainMenu.xib in Resources */, 6A0D4F5315FC0EE100ABF4B3 /* preferences.xib in Resources */, 6A0D4F5715FC0EF900ABF4B3 /* InfoPlist.strings in Resources */, 6A0D4F5815FC0EF900ABF4B3 /* Localizable.strings in Resources */, + 6A2E40F6253A69DA00D1AE1D /* Images.xcassets in Resources */, 6A38BC1515FC117A00A8A51F /* data.txt in Resources */, - 6AA67FEB15FC5B0D00B5A308 /* BopomofoTextMenu.tiff in Resources */, - 6AA67FEC15FC5B0D00B5A308 /* BopomofoTextMenu@2x.tiff in Resources */, - 6A719D0415FC5FD200C8B8E3 /* McBopomofo.iconset in Resources */, + 6AFF97F2253B299E007F1C49 /* OVNonModalAlertWindowController.xib in Resources */, 6AE210B215FC63CC003659FE /* PlainBopomofo.tiff in Resources */, 6AE210B315FC63CC003659FE /* PlainBopomofo@2x.tiff in Resources */, 6AD7CBC815FE555000691B5B /* data-plain-bpmf.txt in Resources */, @@ -592,16 +607,37 @@ buildActionMask = 2147483647; files = ( 6ACA420215FC1E5200935EF6 /* McBopomofo.app in Resources */, + 6A2E40F9253A6AA000D1AE1D /* Images.xcassets in Resources */, 6ACA41FA15FC1D9000935EF6 /* InfoPlist.strings in Resources */, + 6A225A1F23679F2600F685C6 /* NotarizedArchives in Resources */, 6ACA41FB15FC1D9000935EF6 /* License.rtf in Resources */, 6ACA41FC15FC1D9000935EF6 /* Localizable.strings in Resources */, 6ACA41FD15FC1D9000935EF6 /* MainMenu.xib in Resources */, - 6A719D0515FC5FD200C8B8E3 /* McBopomofo.iconset in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ +/* Begin PBXShellScriptBuildPhase section */ + 6A225A2023679F5F00F685C6 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + ); + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "# Remove the README.md in the NotarizedArchives directory\nrm -f \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/NotarizedArchives/README.md\"\n"; + }; +/* End PBXShellScriptBuildPhase section */ + /* Begin PBXSourcesBuildPhase section */ 6A0D4E9E15FC0D2D00ABF4B3 /* Sources */ = { isa = PBXSourcesBuildPhase; @@ -612,14 +648,15 @@ 6A0D4ED315FC0D6400ABF4B3 /* main.m in Sources */, 6A0D4ED415FC0D6400ABF4B3 /* OVInputSourceHelper.m in Sources */, 6A0D4ED515FC0D6400ABF4B3 /* PreferencesWindowController.m in Sources */, - 6A0D4ED615FC0D6400ABF4B3 /* UpdateNotificationController.m in Sources */, 6A0D4EFE15FC0DA600ABF4B3 /* VTCandidateController.m in Sources */, 6A0D4EFF15FC0DA600ABF4B3 /* VTHorizontalCandidateController.m in Sources */, 6A0D4F0015FC0DA600ABF4B3 /* VTHorizontalCandidateView.m in Sources */, + 6AFF97F3253B299E007F1C49 /* OVNonModalAlertWindowController.m in Sources */, 6A0D4F0115FC0DA600ABF4B3 /* VTVerticalCandidateController.m in Sources */, 6AE30A491F7F40B7008735BD /* UserOverrideModel.cpp in Sources */, 6A0D4F0215FC0DA600ABF4B3 /* VTVerticalCandidateTableView.m in Sources */, 6A0D4F0315FC0DA600ABF4B3 /* VTVerticalKeyLabelStripView.m in Sources */, + D427A9C125ED28CC005D43E0 /* OpenCCBridge.swift in Sources */, 6A0D4F4515FC0EB100ABF4B3 /* Mandarin.cpp in Sources */, 6A0421A815FEF3F50061ED63 /* FastLM.cpp in Sources */, ); @@ -630,6 +667,7 @@ buildActionMask = 2147483647; files = ( 6ACA41F915FC1D9000935EF6 /* AppDelegate.m in Sources */, + 6A225A232367A1D700F685C6 /* ArchiveUtil.m in Sources */, 6ACA41FF15FC1D9000935EF6 /* main.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -670,19 +708,11 @@ path = ..; sourceTree = ""; }; - 6A0D4F4C15FC0EE100ABF4B3 /* MainMenu.xib */ = { - isa = PBXVariantGroup; - children = ( - ); - name = MainMenu.xib; - path = /Users/lukhnos/projects/McBopomofo; - sourceTree = ""; - }; 6A0D4F4E15FC0EE100ABF4B3 /* preferences.xib */ = { isa = PBXVariantGroup; children = ( - 6A0D4F4F15FC0EE100ABF4B3 /* en */, 6A0D4F5615FC0EF900ABF4B3 /* zh-Hant */, + 6A15B32721A51F2300B92CD3 /* Base */, ); name = preferences.xib; path = ..; @@ -691,21 +721,12 @@ 6A187E2816004C5900466B2E /* MainMenu.xib */ = { isa = PBXVariantGroup; children = ( - 6A187E2716004C5900466B2E /* en */, 6A187E2916004C7300466B2E /* zh-Hant */, + 6A15B32521A51F2300B92CD3 /* Base */, ); name = MainMenu.xib; sourceTree = ""; }; - 6A38BC1F15FC11C700A8A51F /* UpdateNotificationController.xib */ = { - isa = PBXVariantGroup; - children = ( - 6A38BC1E15FC11C700A8A51F /* zh-Hant */, - 6A38BC2015FC11CE00A8A51F /* en */, - ); - name = UpdateNotificationController.xib; - sourceTree = ""; - }; 6ACA41EA15FC1D9000935EF6 /* InfoPlist.strings */ = { isa = PBXVariantGroup; children = ( @@ -739,8 +760,8 @@ 6ACA41F015FC1D9000935EF6 /* MainMenu.xib */ = { isa = PBXVariantGroup; children = ( - 6ACA41F115FC1D9000935EF6 /* en */, 6ACA41F815FC1D9000935EF6 /* zh-Hant */, + 6A15B32421A51F2300B92CD3 /* Base */, ); name = MainMenu.xib; path = Source/Installer; @@ -752,12 +773,78 @@ 6A0D4E9915FC0CFA00ABF4B3 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CLANG_ENABLE_MODULES = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + ONLY_ACTIVE_ARCH = YES; + OTHER_CPLUSPLUSFLAGS = ( + "$(OTHER_CFLAGS)", + "-fcxx-modules", + ); }; name = Debug; }; 6A0D4E9A15FC0CFA00ABF4B3 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CLANG_ENABLE_MODULES = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + OTHER_CPLUSPLUSFLAGS = ( + "$(OTHER_CFLAGS)", + "-fcxx-modules", + ); }; name = Release; }; @@ -765,13 +852,17 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_IMPLICIT_SIGN_CONVERSION = NO; CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = YES; CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "-"; COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = NO; GCC_C_LANGUAGE_STANDARD = gnu99; @@ -801,10 +892,18 @@ GCC_WARN_UNUSED_LABEL = YES; GCC_WARN_UNUSED_VARIABLE = YES; INFOPLIST_FILE = "Source/McBopomofo-Info.plist"; - MACOSX_DEPLOYMENT_TARGET = 10.6; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + MACOSX_DEPLOYMENT_TARGET = 10.10; ONLY_ACTIVE_ARCH = YES; + PRODUCT_BUNDLE_IDENTIFIER = org.openvanilla.inputmethod.McBopomofo; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = macosx; + SWIFT_OBJC_BRIDGING_HEADER = "Source/McBopomofo-Bridging-Header.h"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; WRAPPER_EXTENSION = app; }; name = Debug; @@ -813,13 +912,17 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_IMPLICIT_SIGN_CONVERSION = NO; CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = YES; CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "-"; COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; @@ -843,9 +946,16 @@ GCC_WARN_UNUSED_LABEL = YES; GCC_WARN_UNUSED_VARIABLE = YES; INFOPLIST_FILE = "Source/McBopomofo-Info.plist"; - MACOSX_DEPLOYMENT_TARGET = 10.6; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + MACOSX_DEPLOYMENT_TARGET = 10.10; + PRODUCT_BUNDLE_IDENTIFIER = org.openvanilla.inputmethod.McBopomofo; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = macosx; + SWIFT_OBJC_BRIDGING_HEADER = "Source/McBopomofo-Bridging-Header.h"; + SWIFT_VERSION = 5.0; WRAPPER_EXTENSION = app; }; name = Release; @@ -855,6 +965,7 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_ENABLE_OBJC_WEAK = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = NO; @@ -873,7 +984,7 @@ GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.7; + MACOSX_DEPLOYMENT_TARGET = 10.10; ONLY_ACTIVE_ARCH = YES; OTHER_CFLAGS = ""; OTHER_LDFLAGS = ""; @@ -887,6 +998,7 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_ENABLE_OBJC_WEAK = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = YES; @@ -897,7 +1009,7 @@ GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.7; + MACOSX_DEPLOYMENT_TARGET = 10.10; OTHER_CFLAGS = ""; OTHER_LDFLAGS = ""; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -909,9 +1021,12 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "-"; COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = NO; GCC_C_LANGUAGE_STANDARD = gnu99; @@ -925,13 +1040,15 @@ "$(inherited)", ); GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_TREAT_WARNINGS_AS_ERRORS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_VARIABLE = YES; INFOPLIST_FILE = "Source/Installer/Installer-Info.plist"; - MACOSX_DEPLOYMENT_TARGET = 10.6; + MACOSX_DEPLOYMENT_TARGET = 10.10; ONLY_ACTIVE_ARCH = YES; + PRODUCT_BUNDLE_IDENTIFIER = "org.openvanilla.McBopomofo.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = macosx; WRAPPER_EXTENSION = app; @@ -942,9 +1059,12 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "-"; COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; @@ -952,12 +1072,14 @@ GCC_ENABLE_OBJC_EXCEPTIONS = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "Source/Installer/Installer-Prefix.pch"; + GCC_TREAT_WARNINGS_AS_ERRORS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_VARIABLE = YES; INFOPLIST_FILE = "Source/Installer/Installer-Info.plist"; - MACOSX_DEPLOYMENT_TARGET = 10.6; + MACOSX_DEPLOYMENT_TARGET = 10.10; + PRODUCT_BUNDLE_IDENTIFIER = "org.openvanilla.McBopomofo.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = macosx; WRAPPER_EXTENSION = app; @@ -1004,6 +1126,25 @@ defaultConfigurationName = Release; }; /* End XCConfigurationList section */ + +/* Begin XCRemoteSwiftPackageReference section */ + D48550A125EBE689006A204C /* XCRemoteSwiftPackageReference "SwiftyOpenCC" */ = { + isa = XCRemoteSwiftPackageReference; + repositoryURL = "https://github.com/ddddxxx/SwiftyOpenCC.git"; + requirement = { + kind = revision; + revision = 1d8105a0f7199c90af722bff62728050c858e777; + }; + }; +/* End XCRemoteSwiftPackageReference section */ + +/* Begin XCSwiftPackageProductDependency section */ + D48550A225EBE689006A204C /* OpenCC */ = { + isa = XCSwiftPackageProductDependency; + package = D48550A125EBE689006A204C /* XCRemoteSwiftPackageReference "SwiftyOpenCC" */; + productName = OpenCC; + }; +/* End XCSwiftPackageProductDependency section */ }; rootObject = 6A0D4E9415FC0CFA00ABF4B3 /* Project object */; } diff --git a/McBopomofo.xcodeproj/xcshareddata/xcschemes/McBopomofo.xcscheme b/McBopomofo.xcodeproj/xcshareddata/xcschemes/McBopomofo.xcscheme new file mode 100644 index 00000000..56d01ed8 --- /dev/null +++ b/McBopomofo.xcodeproj/xcshareddata/xcschemes/McBopomofo.xcscheme @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/McBopomofo.xcodeproj/xcshareddata/xcschemes/McBopomofoInstaller.xcscheme b/McBopomofo.xcodeproj/xcshareddata/xcschemes/McBopomofoInstaller.xcscheme new file mode 100644 index 00000000..e47539ec --- /dev/null +++ b/McBopomofo.xcodeproj/xcshareddata/xcschemes/McBopomofoInstaller.xcscheme @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/README.markdown b/README.markdown index 65d8942b..e3da0310 100644 --- a/README.markdown +++ b/README.markdown @@ -1,5 +1,16 @@ # OpenVanilla McBopomofo 小麥注音輸入法 +## 開發流程 + +用 Xcode 開啟 `McBopomofo.xcodeproj`,選 "McBopomofo Installer" target,build +完之後直接執行該安裝程式,就可以安裝小麥注音。 + +第一次安裝完,日後程式碼或詞庫有任何修改,只要重複上述流程,再次安裝小麥注音即可。 + +要注意的是 macOS 可能會限制同一次 login session 能 kill 同一個輸入法 process 的次數( +安裝程式透過 process killing來讓新版的輸入法生效)。如果安裝若干次後,發現程式修改的結果並 +沒有出現,或甚至輸入法已無法再選用,只要登出目前帳號再重新登入即可。 + ## 軟體授權 本專案主要程式碼以及編譯後軟體採用 MIT License 釋出,使用者可自由使用、散播本軟體,惟散播本輸入法的原始碼時必須保持軟體完整原始碼、不得修改版權文字。 diff --git a/Source/AppDelegate.h b/Source/AppDelegate.h index eb216be0..96ee6e0c 100644 --- a/Source/AppDelegate.h +++ b/Source/AppDelegate.h @@ -35,21 +35,20 @@ #import @class PreferencesWindowController; -@class UpdateNotificationController; @interface AppDelegate : NSObject { @private - NSWindow *_window; NSURLConnection *_updateCheckConnection; + BOOL _currentUpdateCheckIsForced; NSMutableData *_receivingData; + NSURL *_updateNextStepURL; PreferencesWindowController *_preferencesWindowController; - UpdateNotificationController *_updateNotificationController; } - (void)checkForUpdate; - (void)checkForUpdateForced:(BOOL)forced; - (void)showPreferences; -@property (assign, nonatomic) IBOutlet NSWindow *window; +@property (weak, nonatomic) IBOutlet NSWindow *window; @end diff --git a/Source/AppDelegate.m b/Source/AppDelegate.m index 02b4270c..cc6b896c 100644 --- a/Source/AppDelegate.m +++ b/Source/AppDelegate.m @@ -33,18 +33,19 @@ // #import "AppDelegate.h" -#import "UpdateNotificationController.h" +#import "OVNonModalAlertWindowController.h" #import "PreferencesWindowController.h" -void LTLoadLanguageModel(); +extern void LTLoadLanguageModel(void); +static NSString *kCheckUpdateAutomatically = @"CheckUpdateAutomatically"; static NSString *kNextUpdateCheckDateKey = @"NextUpdateCheckDate"; static NSString *kUpdateInfoEndpointKey = @"UpdateInfoEndpoint"; static NSString *kUpdateInfoSiteKey = @"UpdateInfoSite"; static const NSTimeInterval kNextCheckInterval = 86400.0; static const NSTimeInterval kTimeoutInterval = 60.0; -@interface AppDelegate () +@interface AppDelegate () @end @implementation AppDelegate @@ -52,16 +53,19 @@ static const NSTimeInterval kTimeoutInterval = 60.0; - (void)dealloc { - [_preferencesWindowController release]; - [_updateCheckConnection release]; - [_updateNotificationController release]; - [super dealloc]; + _preferencesWindowController = nil; + _updateCheckConnection = nil; } - (void)applicationDidFinishLaunching:(NSNotification *)inNotification { LTLoadLanguageModel(); + if (![[NSUserDefaults standardUserDefaults] objectForKey:kCheckUpdateAutomatically]) { + [[NSUserDefaults standardUserDefaults] setBool:YES forKey:kCheckUpdateAutomatically]; + [[NSUserDefaults standardUserDefaults] synchronize]; + } + [self checkForUpdate]; } @@ -77,8 +81,14 @@ static const NSTimeInterval kTimeoutInterval = 60.0; return; } + _currentUpdateCheckIsForced = forced; + // time for update? if (!forced) { + if (![[NSUserDefaults standardUserDefaults] boolForKey:kCheckUpdateAutomatically]) { + return; + } + NSDate *now = [NSDate date]; NSDate *date = [[NSUserDefaults standardUserDefaults] objectForKey:kNextUpdateCheckDateKey]; if (![date isKindOfClass:[NSDate class]]) { @@ -113,7 +123,6 @@ static const NSTimeInterval kTimeoutInterval = 60.0; #endif if (_receivingData) { - [_receivingData release]; _receivingData = nil; } @@ -134,25 +143,39 @@ static const NSTimeInterval kTimeoutInterval = 60.0; - (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error { - [_receivingData release]; + BOOL isForcedCheck = _currentUpdateCheckIsForced; + _receivingData = nil; - [_updateCheckConnection release]; _updateCheckConnection = nil; + _currentUpdateCheckIsForced = NO; + + if (isForcedCheck) { + [[OVNonModalAlertWindowController sharedInstance] showWithTitle:NSLocalizedString(@"Update Check Failed", nil) content:[NSString stringWithFormat:NSLocalizedString(@"There may be no internet connection or the server failed to respond.\n\nError message: %@", nil), [error localizedDescription]] confirmButtonTitle:NSLocalizedString(@"Dismiss", nil) cancelButtonTitle:nil cancelAsDefault:NO delegate:nil]; + } +} + +- (void)showNoUpdateAvailableAlert +{ + [[OVNonModalAlertWindowController sharedInstance] showWithTitle:NSLocalizedString(@"Check for Update Completed", nil) content:NSLocalizedString(@"You are already using the latest version of McBopomofo.", nil) confirmButtonTitle:NSLocalizedString(@"OK", nil) cancelButtonTitle:nil cancelAsDefault:NO delegate:nil]; } - (void)connectionDidFinishLoading:(NSURLConnection *)connection { - id plist = [NSPropertyListSerialization propertyListFromData:_receivingData mutabilityOption:NSPropertyListImmutable format:NULL errorDescription:NULL]; + id plist = [NSPropertyListSerialization propertyListWithData:_receivingData options:NSPropertyListImmutable format:NULL error:NULL]; #if DEBUG NSLog(@"plist %@",plist); #endif - [_receivingData release]; + BOOL isForcedCheck = _currentUpdateCheckIsForced; + _receivingData = nil; - [_updateCheckConnection release]; _updateCheckConnection = nil; + _currentUpdateCheckIsForced = NO; if (!plist) { + if (isForcedCheck) { + [self showNoUpdateAvailableAlert]; + } return; } @@ -161,6 +184,9 @@ static const NSTimeInterval kTimeoutInterval = 60.0; NSLog(@"the remoteversion is %@",remoteVersion); #endif if (!remoteVersion) { + if (isForcedCheck) { + [self showNoUpdateAvailableAlert]; + } return; } @@ -172,41 +198,74 @@ static const NSTimeInterval kTimeoutInterval = 60.0; NSComparisonResult result = [currentVersion compare:remoteVersion options:NSNumericSearch]; if (result != NSOrderedAscending) { + if (isForcedCheck) { + [self showNoUpdateAvailableAlert]; + } return; } NSString *siteInfoURLString = [plist objectForKey:kUpdateInfoSiteKey]; if (!siteInfoURLString) { + if (isForcedCheck) { + [self showNoUpdateAvailableAlert]; + } return; } NSURL *siteInfoURL = [NSURL URLWithString:siteInfoURLString]; if (!siteInfoURL) { + if (isForcedCheck) { + [self showNoUpdateAvailableAlert]; + } return; } + _updateNextStepURL = siteInfoURL; + NSDictionary *versionDescriptions = [plist objectForKey:@"Description"]; + NSString *versionDescription = @""; + if ([versionDescriptions isKindOfClass:[NSDictionary class]]) { + NSString *locale = @"en"; + NSArray *supportedLocales = [NSArray arrayWithObjects:@"en", @"zh-Hant", @"zh-Hans", nil]; + NSArray *preferredTags = [NSBundle preferredLocalizationsFromArray:supportedLocales]; + if ([preferredTags count]) { + locale = [preferredTags objectAtIndex:0]; + } + versionDescription = [versionDescriptions objectForKey:locale]; + if (!versionDescription) { + versionDescription = [versionDescriptions objectForKey:@"en"]; + } - if (_updateNotificationController) { - [_updateNotificationController release], _updateNotificationController = nil; + if (!versionDescription) { + versionDescription = @""; + } + else { + versionDescription = [@"\n\n" stringByAppendingString:versionDescription]; + } } - _updateNotificationController = [[UpdateNotificationController alloc] initWithWindowNibName:@"UpdateNotificationController"]; + NSString *content = [NSString stringWithFormat:NSLocalizedString(@"You're currently using McBopomofo %@ (%@), a new version %@ (%@) is now available. Do you want to visit McBopomofo's website to download the version?%@", nil), [infoDict objectForKey:@"CFBundleShortVersionString"], currentVersion, [plist objectForKey:@"CFBundleShortVersionString"], remoteVersion, versionDescription]; - _updateNotificationController.siteURL = siteInfoURL; - _updateNotificationController.infoText = [NSString stringWithFormat:NSLocalizedString(@"You are running version %@ (%@), and the new version %@ (%@) is now available.\n\nVisit the website to download it?", @""), - [infoDict objectForKey:@"CFBundleShortVersionString"], - [infoDict objectForKey:(id)kCFBundleVersionKey], - [plist objectForKey:@"CFBundleShortVersionString"], - [plist objectForKey:(id)kCFBundleVersionKey], - nil]; - - [_updateNotificationController showWindow:self]; - [[NSApplication sharedApplication] activateIgnoringOtherApps:YES]; + [[OVNonModalAlertWindowController sharedInstance] showWithTitle:NSLocalizedString(@"New Version Available", nil) content:content confirmButtonTitle:NSLocalizedString(@"Visit Website", nil) cancelButtonTitle:NSLocalizedString(@"Not Now", nil) cancelAsDefault:NO delegate:self]; } - (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data { [_receivingData appendData:data]; } + +- (void)nonModalAlertWindowControllerDidConfirm:(OVNonModalAlertWindowController *)controller +{ + if (_updateNextStepURL) { + [[NSWorkspace sharedWorkspace] openURL:_updateNextStepURL]; + } + + _updateNextStepURL = nil; +} + +- (void)nonModalAlertWindowControllerDidCancel:(OVNonModalAlertWindowController *)controller +{ + _updateNextStepURL = nil; +} + @end diff --git a/Source/Base.lproj/MainMenu.xib b/Source/Base.lproj/MainMenu.xib new file mode 100644 index 00000000..5f7bcf12 --- /dev/null +++ b/Source/Base.lproj/MainMenu.xib @@ -0,0 +1,295 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Source/en.lproj/preferences.xib b/Source/Base.lproj/preferences.xib similarity index 66% rename from Source/en.lproj/preferences.xib rename to Source/Base.lproj/preferences.xib index ff3d8a3a..4534c6b6 100644 --- a/Source/en.lproj/preferences.xib +++ b/Source/Base.lproj/preferences.xib @@ -1,42 +1,44 @@ - - + + - - + + + + - - + + - - + + - + - - + + - + - + - + - + @@ -44,8 +46,8 @@ - - + + @@ -53,20 +55,20 @@ - - + + - + - - + + @@ -74,8 +76,8 @@ - - + + @@ -83,8 +85,8 @@ - - + + @@ -92,8 +94,8 @@ - - + + @@ -101,8 +103,8 @@ - - + + @@ -127,8 +129,8 @@ - - + + @@ -153,12 +155,12 @@ - - + + - + @@ -176,8 +178,8 @@ - + + + + + + + + + Item 1 + Item 2 + Item 3 + + + + + + + + + + + + + + + + + diff --git a/Source/CandidateUI/VTCandidateController.h b/Source/CandidateUI/VTCandidateController.h index ebbda761..41e36a5c 100644 --- a/Source/CandidateUI/VTCandidateController.h +++ b/Source/CandidateUI/VTCandidateController.h @@ -38,7 +38,7 @@ @interface VTCandidateController : NSWindowController { @protected - id _delegate; + __weak id _delegate; NSArray *_keyLabels; NSFont *_keyLabelFont; NSFont *_candidateFont; @@ -56,7 +56,7 @@ - (NSUInteger)candidateIndexAtKeyLabelIndex:(NSUInteger)index; -@property (assign, weak, nonatomic) id delegate; +@property (weak, nonatomic) id delegate; @property (assign, nonatomic) NSUInteger selectedCandidateIndex; @property (assign, nonatomic) BOOL visible; diff --git a/Source/CandidateUI/VTCandidateController.m b/Source/CandidateUI/VTCandidateController.m index c7db63d9..5605ff71 100644 --- a/Source/CandidateUI/VTCandidateController.m +++ b/Source/CandidateUI/VTCandidateController.m @@ -36,10 +36,9 @@ - (void)dealloc { - [_keyLabels release]; - [_keyLabelFont release]; - [_candidateFont release]; - [super dealloc]; + _keyLabels = nil; + _keyLabelFont = nil; + _candidateFont = nil; } - (id)initWithWindow:(NSWindow *)window @@ -47,11 +46,10 @@ self = [super initWithWindow:window]; if (self) { // populate the default values - _keyLabels = [[NSArray arrayWithObjects:@"1", @"2", @"3", @"4", @"5", @"6", @"7", @"8", @"9", nil] retain]; - _keyLabelFont = [[NSFont systemFontOfSize:14.0] retain]; - _candidateFont = [[NSFont systemFontOfSize:18.0] retain]; + _keyLabels = @[@"1", @"2", @"3", @"4", @"5", @"6", @"7", @"8", @"9"]; + _keyLabelFont = [NSFont systemFontOfSize:14.0]; + _candidateFont = [NSFont systemFontOfSize:18.0]; } - return self; } diff --git a/Source/CandidateUI/VTHorizontalCandidateController.m b/Source/CandidateUI/VTHorizontalCandidateController.m index f69affdd..4cc8795b 100644 --- a/Source/CandidateUI/VTHorizontalCandidateController.m +++ b/Source/CandidateUI/VTHorizontalCandidateController.m @@ -40,10 +40,9 @@ - (void)dealloc { - [_candidateView release]; - [_prevPageButton release]; - [_nextPageButton release]; - [super dealloc]; + _candidateView = nil; + _prevPageButton = nil; + _nextPageButton = nil; } - (id)init @@ -51,7 +50,7 @@ NSRect contentRect = NSMakeRect(128.0, 128.0, 0.0, 0.0); NSUInteger styleMask = NSBorderlessWindowMask | NSNonactivatingPanelMask; - NSPanel *panel = [[[NSPanel alloc] initWithContentRect:contentRect styleMask:styleMask backing:NSBackingStoreBuffered defer:NO] autorelease]; + NSPanel *panel = [[NSPanel alloc] initWithContentRect:contentRect styleMask:styleMask backing:NSBackingStoreBuffered defer:NO]; [panel setLevel:kCGPopUpMenuWindowLevel]; [panel setHasShadow:YES]; diff --git a/Source/CandidateUI/VTHorizontalCandidateView.h b/Source/CandidateUI/VTHorizontalCandidateView.h index d71d3128..492b7c5c 100644 --- a/Source/CandidateUI/VTHorizontalCandidateView.h +++ b/Source/CandidateUI/VTHorizontalCandidateView.h @@ -41,7 +41,7 @@ NSUInteger _highlightedIndex; NSUInteger _trackingHighlightedIndex; SEL _action; - id _target; + __weak id _target; } - (void)setKeyLabels:(NSArray *)labels displayedCandidates:(NSArray *)candidates; @@ -50,5 +50,5 @@ @property (readonly, nonatomic) NSSize sizeForView; @property (assign, nonatomic) NSUInteger highlightedIndex; @property (assign, nonatomic) SEL action; -@property (weak, assign, nonatomic) id target; +@property (weak, nonatomic) id target; @end diff --git a/Source/CandidateUI/VTHorizontalCandidateView.m b/Source/CandidateUI/VTHorizontalCandidateView.m index 13a94339..d24122f5 100644 --- a/Source/CandidateUI/VTHorizontalCandidateView.m +++ b/Source/CandidateUI/VTHorizontalCandidateView.m @@ -39,26 +39,18 @@ NS_INLINE CGFloat max(CGFloat a, CGFloat b) { return a > b ? a : b; } - (void)dealloc { - [_keyLabels release]; - [_displayedCandidates release]; - [_keyLabelAttrDict release]; - [_candidateAttrDict release]; - [_elementWidths release]; - [super dealloc]; + _keyLabels = nil; + _displayedCandidates = nil; + _keyLabelAttrDict = nil; + _candidateAttrDict = nil; + _elementWidths = nil; } - (void)setKeyLabels:(NSArray *)labels displayedCandidates:(NSArray *)candidates { NSUInteger count = min([labels count], [candidates count]); - id tmp; - - tmp = _keyLabels; - _keyLabels = [[labels subarrayWithRange:NSMakeRange(0, count)] retain]; - [tmp release]; - - tmp = _displayedCandidates; - _displayedCandidates = [[candidates subarrayWithRange:NSMakeRange(0, count)] retain]; - [tmp release]; + _keyLabels = [labels subarrayWithRange:NSMakeRange(0, count)]; + _displayedCandidates = [candidates subarrayWithRange:NSMakeRange(0, count)]; NSMutableArray *newWidths = [NSMutableArray array]; @@ -71,33 +63,25 @@ NS_INLINE CGFloat max(CGFloat a, CGFloat b) { return a > b ? a : b; } CGFloat width = max(labelRect.size.width, candidateRect.size.width) + _cellPadding; [newWidths addObject:[NSNumber numberWithDouble:width]]; } - - tmp = _elementWidths; - _elementWidths = [newWidths retain]; - [tmp release]; + + _elementWidths = newWidths; } - (void)setKeyLabelFont:(NSFont *)labelFont candidateFont:(NSFont *)candidateFont { - NSMutableParagraphStyle *paraStyle = [[[NSParagraphStyle defaultParagraphStyle] mutableCopy] autorelease]; + NSMutableParagraphStyle *paraStyle = [[NSParagraphStyle defaultParagraphStyle] mutableCopy]; [paraStyle setAlignment:NSCenterTextAlignment]; - - id tmp; - tmp = _keyLabelAttrDict; - _keyLabelAttrDict = [[NSDictionary dictionaryWithObjectsAndKeys: + + _keyLabelAttrDict = [NSDictionary dictionaryWithObjectsAndKeys: labelFont, NSFontAttributeName, paraStyle, NSParagraphStyleAttributeName, - [NSColor textColor], NSForegroundColorAttributeName, - nil] retain]; - [tmp release]; - - tmp = _candidateAttrDict; - _candidateAttrDict = [[NSDictionary dictionaryWithObjectsAndKeys: + [NSColor blackColor], NSForegroundColorAttributeName, + nil]; + _candidateAttrDict = [NSDictionary dictionaryWithObjectsAndKeys: candidateFont, NSFontAttributeName, paraStyle, NSParagraphStyleAttributeName, [NSColor textColor], NSForegroundColorAttributeName, - nil] retain]; - [tmp release]; + nil]; CGFloat labelFontSize = [labelFont pointSize]; CGFloat candidateFontSize = [candidateFont pointSize]; @@ -131,13 +115,13 @@ NS_INLINE CGFloat max(CGFloat a, CGFloat b) { return a > b ? a : b; } - (void)drawRect:(NSRect)dirtyRect { - NSColor *white = [NSColor whiteColor]; + NSColor *backgroundColor = [NSColor controlBackgroundColor]; NSColor *darkGray = [NSColor colorWithDeviceWhite:0.7 alpha:1.0]; NSColor *lightGray = [NSColor colorWithDeviceWhite:0.8 alpha:1.0]; NSRect bounds = [self bounds]; - [white setFill]; + [backgroundColor setFill]; [NSBezierPath fillRect:bounds]; [[NSColor darkGrayColor] setStroke]; @@ -165,11 +149,11 @@ NS_INLINE CGFloat max(CGFloat a, CGFloat b) { return a > b ? a : b; } if (index == _highlightedIndex) { [[NSColor selectedTextBackgroundColor] setFill]; - activeCandidateAttr = [[_candidateAttrDict mutableCopy] autorelease]; + activeCandidateAttr = [_candidateAttrDict mutableCopy]; [(NSMutableDictionary *)activeCandidateAttr setObject:[NSColor selectedTextColor] forKey:NSForegroundColorAttributeName]; } else { - [white setFill]; + [backgroundColor setFill]; } [NSBezierPath fillRect:candidateRect]; @@ -230,9 +214,12 @@ NS_INLINE CGFloat max(CGFloat a, CGFloat b) { return a > b ? a : b; } _trackingHighlightedIndex = 0; [self setNeedsDisplay:YES]; +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Warc-performSelector-leaks" if (triggerAction && _target && _action) { [_target performSelector:_action withObject:self]; } +# pragma clang diagnostic pop } @end diff --git a/Source/CandidateUI/VTVerticalCandidateController.m b/Source/CandidateUI/VTVerticalCandidateController.m index 2c04f5d8..7150d45b 100644 --- a/Source/CandidateUI/VTVerticalCandidateController.m +++ b/Source/CandidateUI/VTVerticalCandidateController.m @@ -36,6 +36,11 @@ NS_INLINE CGFloat max(CGFloat a, CGFloat b) { return a > b ? a : b; } static const CGFloat kCandidateTextPadding = 24.0; static const CGFloat kCandidateTextLeftMargin = 8.0; +#if defined(__MAC_10_16) +static const CGFloat kCandidateTextPaddingWithMandatedTableViewPadding = 18.0; +static const CGFloat kCandidateTextLeftMarginWithMandatedTableViewPadding = 0.0; +#endif + @interface VTVerticalCandidateController (Private) - (void)rowDoubleClicked:(id)sender; - (BOOL)scrollPageByOne:(BOOL)forward; @@ -44,31 +49,26 @@ static const CGFloat kCandidateTextLeftMargin = 8.0; @end @implementation VTVerticalCandidateController - -- (void)dealloc { - [_candidateTextParagraphStyle release]; - [_keyLabelStripView release]; - [_scrollView release]; - [_tableView release]; - [super dealloc]; + // Total padding added to the left and the right of the table view cell text. + CGFloat _candidateTextPadding; + + // The indent of the table view cell text from the left. + CGFloat _candidateTextLeftMargin; } + - (id)init { NSRect contentRect = NSMakeRect(128.0, 128.0, 0.0, 0.0); NSUInteger styleMask = NSBorderlessWindowMask | NSNonactivatingPanelMask; - NSPanel *panel = [[[NSPanel alloc] initWithContentRect:contentRect styleMask:styleMask backing:NSBackingStoreBuffered defer:NO] autorelease]; + NSPanel *panel = [[NSPanel alloc] initWithContentRect:contentRect styleMask:styleMask backing:NSBackingStoreBuffered defer:NO]; [panel setLevel:kCGPopUpMenuWindowLevel]; [panel setHasShadow:YES]; self = [self initWithWindow:panel]; if (self) { - _candidateTextParagraphStyle = [[NSParagraphStyle defaultParagraphStyle] mutableCopy]; - [_candidateTextParagraphStyle setFirstLineHeadIndent:kCandidateTextLeftMargin]; - [_candidateTextParagraphStyle setLineBreakMode:NSLineBreakByClipping]; - contentRect.origin = NSMakePoint(0.0, 0.0); NSRect stripRect = contentRect; @@ -92,10 +92,13 @@ static const CGFloat kCandidateTextLeftMargin = 8.0; [_tableView setDataSource:self]; [_tableView setDelegate:self]; - NSTableColumn *column = [[[NSTableColumn alloc] initWithIdentifier:@"candidate"] autorelease]; - [column setDataCell:[[[NSTextFieldCell alloc] init] autorelease]]; + NSTableColumn *column = [[NSTableColumn alloc] initWithIdentifier:@"candidate"]; + [column setDataCell:[[NSTextFieldCell alloc] init]]; [column setEditable:NO]; - + + _candidateTextPadding = kCandidateTextPadding; + _candidateTextLeftMargin = kCandidateTextLeftMargin; + [_tableView addTableColumn:column]; [_tableView setIntercellSpacing:NSMakeSize(0.0, 1.0)]; [_tableView setHeaderView:nil]; @@ -104,8 +107,20 @@ static const CGFloat kCandidateTextLeftMargin = 8.0; [_tableView setDoubleAction:@selector(rowDoubleClicked:)]; [_tableView setTarget:self]; + #if defined(__MAC_10_16) + if (@available(macOS 10.16, *)) { + [_tableView setStyle:NSTableViewStyleFullWidth]; + _candidateTextPadding = kCandidateTextPaddingWithMandatedTableViewPadding; + _candidateTextLeftMargin = kCandidateTextLeftMarginWithMandatedTableViewPadding; + } + #endif + [_scrollView setDocumentView:_tableView]; [[panel contentView] addSubview:_scrollView]; + + _candidateTextParagraphStyle = [[NSParagraphStyle defaultParagraphStyle] mutableCopy]; + [_candidateTextParagraphStyle setFirstLineHeadIndent:_candidateTextLeftMargin]; + [_candidateTextParagraphStyle setLineBreakMode:NSLineBreakByClipping]; } return self; @@ -113,7 +128,7 @@ static const CGFloat kCandidateTextLeftMargin = 8.0; - (void)reloadData { - _maxCandidateAttrStringWidth = ceil([_candidateFont pointSize] * 2.0 + kCandidateTextPadding); + _maxCandidateAttrStringWidth = ceil([_candidateFont pointSize] * 2.0 + _candidateTextPadding); [_tableView reloadData]; [self layoutCandidateView]; @@ -215,13 +230,13 @@ static const CGFloat kCandidateTextLeftMargin = 8.0; candidate = [_delegate candidateController:self candidateAtIndex:row]; } - NSAttributedString *attrString = [[[NSAttributedString alloc] initWithString:candidate attributes:[NSDictionary dictionaryWithObjectsAndKeys:_candidateFont, NSFontAttributeName, _candidateTextParagraphStyle, NSParagraphStyleAttributeName, nil]] autorelease]; + NSAttributedString *attrString = [[NSAttributedString alloc] initWithString:candidate attributes:[NSDictionary dictionaryWithObjectsAndKeys:_candidateFont, NSFontAttributeName, _candidateTextParagraphStyle, NSParagraphStyleAttributeName, nil]]; // we do more work than what this method is expected to; normally not a good practice, but for the amount of data (9 to 10 rows max), we can afford the overhead // expand the window width if text overflows NSRect boundingRect = [attrString boundingRectWithSize:NSMakeSize(10240.0, 10240.0) options:NSStringDrawingUsesLineFragmentOrigin]; - CGFloat textWidth = boundingRect.size.width + kCandidateTextPadding; + CGFloat textWidth = boundingRect.size.width + _candidateTextPadding; if (textWidth > _maxCandidateAttrStringWidth) { _maxCandidateAttrStringWidth = textWidth; [self layoutCandidateView]; @@ -378,17 +393,9 @@ static const CGFloat kCandidateTextLeftMargin = 8.0; [_scrollView setHasVerticalScroller:YES]; NSScroller *verticalScroller = [_scrollView verticalScroller]; - [verticalScroller setControlSize:controlSize]; - - // calling >=10.7 only API - if ([verticalScroller respondsToSelector:@selector(setScrollerStyle:)]) { - [verticalScroller setScrollerStyle:NSScrollerStyleLegacy]; - scrollerWidth = [NSScroller scrollerWidthForControlSize:controlSize scrollerStyle:NSScrollerStyleLegacy]; - } - else { - // not on >=10.7 - scrollerWidth = [NSScroller scrollerWidthForControlSize:controlSize]; - } + [verticalScroller setControlSize:controlSize]; + [verticalScroller setScrollerStyle:NSScrollerStyleLegacy]; + scrollerWidth = [NSScroller scrollerWidthForControlSize:controlSize scrollerStyle:NSScrollerStyleLegacy]; } _keyLabelStripView.keyLabelFont = _keyLabelFont; diff --git a/Source/CandidateUI/VTVerticalKeyLabelStripView.m b/Source/CandidateUI/VTVerticalKeyLabelStripView.m index b6514421..1a7d2a19 100644 --- a/Source/CandidateUI/VTVerticalKeyLabelStripView.m +++ b/Source/CandidateUI/VTVerticalKeyLabelStripView.m @@ -35,9 +35,8 @@ - (void)dealloc { - [_keyLabelFont release]; - [_keyLabels release]; - [super dealloc]; + _keyLabelFont = nil; + _keyLabels = nil; } - (id)initWithFrame:(NSRect)frameRect @@ -71,7 +70,7 @@ NSColor *darkGray = [NSColor colorWithDeviceWhite:0.7 alpha:1.0]; NSColor *lightGray = [NSColor colorWithDeviceWhite:0.8 alpha:1.0]; - NSMutableParagraphStyle *style = [[[NSParagraphStyle defaultParagraphStyle] mutableCopy] autorelease]; + NSMutableParagraphStyle *style = [[NSParagraphStyle defaultParagraphStyle] mutableCopy]; [style setAlignment:NSCenterTextAlignment]; NSDictionary *textAttr = [NSDictionary dictionaryWithObjectsAndKeys: diff --git a/Source/Engine/FastLM.cpp b/Source/Engine/FastLM.cpp index 9977d31d..48569c65 100644 --- a/Source/Engine/FastLM.cpp +++ b/Source/Engine/FastLM.cpp @@ -30,6 +30,7 @@ #include #include #include +#include using namespace Formosa::Gramambular; diff --git a/Source/Engine/Gramambular/Grid.h b/Source/Engine/Gramambular/Grid.h index 53d52e02..e13c8eab 100644 --- a/Source/Engine/Gramambular/Grid.h +++ b/Source/Engine/Gramambular/Grid.h @@ -47,6 +47,7 @@ namespace Formosa { size_t width() const; vector nodesEndingAt(size_t inLocation); vector nodesCrossingOrEndingAt(size_t inLocation); + void fixNodeSelectedCandidate(size_t location, const string& value); const string dumpDOT(); @@ -175,6 +176,24 @@ namespace Formosa { return result; } + // For nodes found at the location, fix their currently-selected candidate using the supplied string value. + inline void Grid::fixNodeSelectedCandidate(size_t location, const string& value) + { + vector nodes = nodesCrossingOrEndingAt(location); + for (auto nodeAnchor : nodes) { + auto candidates = nodeAnchor.node->candidates(); + + // Reset the candidate-fixed state of every node at the location. + const_cast(nodeAnchor.node)->resetCandidate(); + + for (size_t i = 0, c = candidates.size(); i < c; ++i) { + if (candidates[i].value == value) { + const_cast(nodeAnchor.node)->selectCandidateAtIndex(i); + break; + } + } + } + } inline const string Grid::dumpDOT() { diff --git a/Source/Engine/Gramambular/Node.h b/Source/Engine/Gramambular/Node.h index 8641ccdf..f265ebe9 100644 --- a/Source/Engine/Gramambular/Node.h +++ b/Source/Engine/Gramambular/Node.h @@ -47,6 +47,7 @@ namespace Formosa { const vector& candidates() const; void selectCandidateAtIndex(size_t inIndex = 0, bool inFix = true); void selectFloatingCandidateAtIndex(size_t index, double score); + void resetCandidate(); const string& key() const; double score() const; @@ -177,6 +178,15 @@ namespace Formosa { m_candidateFixed = false; m_score = score; } + + inline void Node::resetCandidate() + { + m_selectedUnigramIndex = 0; + m_candidateFixed = 0; + if (m_unigrams.size()) { + m_score = m_unigrams[0].score; + } + } inline const string& Node::key() const { diff --git a/Source/IconMaker/AppIconRendererView.m b/Source/IconMaker/AppIconRendererView.m deleted file mode 100644 index 5c07e9ca..00000000 --- a/Source/IconMaker/AppIconRendererView.m +++ /dev/null @@ -1,229 +0,0 @@ -// -// AppIconRendererView.m -// -// Copyright (c) 2011 The McBopomofo Project. -// -// Contributors: -// Mengjuei Hsieh (@mjhsieh) -// Weizhong Yang (@zonble) -// -// Based on the Syrup Project and the Formosana Library -// by Lukhnos Liu (@lukhnos). -// -// 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. -// - -#import "AppIconRendererView.h" - - -@implementation AppIconRendererView - -- (id)initWithFrame:(NSRect)frame -{ - self = [super initWithFrame:frame]; - if (self) { - // Initialization code here. - -// CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceGray(); -// CGContextRef context = CGBitmapContextCreate(NULL, frame.size.width, frame.size.height, 8, frame.size.width, colorSpace, 0); -// CGColorSpaceRelease(colorSpace); - -// imageRep = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL pixelsWide:frame.size.width pixelsHigh:frame.size.height bitsPerSample:8 samplesPerPixel:1 hasAlpha:NO isPlanar:NO colorSpaceName:NSDeviceWhiteColorSpace bytesPerRow:0 bitsPerPixel:0]; - - NSRect bounds = [self bounds]; - - image = [[NSImage alloc] initWithSize:frame.size]; - [image lockFocus]; - - [[NSColor blackColor] setFill]; - [NSBezierPath fillRect:bounds]; - - - CIContext *imageContext = [[NSGraphicsContext currentContext] CIContext]; - - CIFilter *filter = [CIFilter filterWithName:@"CIRandomGenerator"]; - [filter setDefaults]; - -// CIContext *imageContext = [CIContext contextWithCGContext:context options:nil]; - - CIImage *output = [filter valueForKey:@"outputImage"]; - - CIFilter *mono = [CIFilter filterWithName:@"CIColorMonochrome"]; - [mono setDefaults]; - [mono setValue:output forKey:@"inputImage"]; - - CIColor *color = [[[CIColor alloc] initWithColor:[NSColor blackColor]] autorelease]; - - [mono setValue:color forKey:@"inputColor"]; - [mono setValue:[NSNumber numberWithDouble:1.0] forKey:@"inputIntensity"]; - output = [mono valueForKey:@"outputImage"]; - - CIFilter *blur = [CIFilter filterWithName:@"CIMotionBlur"]; - [blur setDefaults]; - [blur setValue:output forKey:@"inputImage"]; - [blur setValue:[NSNumber numberWithDouble:25.0] forKey:@"inputRadius"]; - [blur setValue:[NSNumber numberWithDouble:0.0] forKey:@"inputAngle"]; - output = [blur valueForKey:@"outputImage"]; - - - [imageContext drawImage:output inRect:[self bounds] fromRect:[self bounds]]; - - - NSColor *transWhite = [NSColor colorWithDeviceWhite:0.9 alpha:0.2]; - NSColor *transBlack = [NSColor colorWithDeviceWhite:0.5 alpha:0.3]; - - NSGradient *gradient = // [[[NSGradient alloc] initWithStartingColor:transBlack endingColor:transWhite] autorelease]; - [[[NSGradient alloc] initWithColorsAndLocations: - transBlack, 0.0, -// [NSColor darkGrayColor], 0.1, - transWhite, 0.5, -// [NSColor darkGrayColor], 0.9, - transBlack, 1.0, - nil] autorelease]; -// bounds.size.width /= 2; - [gradient drawInRect:bounds angle:0.0]; - -// bounds.origin.x += bounds.size.width; -// [gradient drawInRect:bounds angle:180.0]; - -// CGBitmapContextCreateImage(context); - -// CGColorSpaceRef colorColorSpace = CGColorSpaceCreateDeviceRGB(); -// CGImageRef tmpImage = CGBitmapContextCreateImage(context); -// image = CGImageCreateCopyWithColorSpace(tmpImage, colorColorSpace); -// CGImageRelease(tmpImage); -// CGColorSpaceRelease(colorColorSpace); - - - -// CGContextRelease(context); - - [image unlockFocus]; - -// NSLog(@"%@", [image representations]); - -// [image addRepresentation:imageRep]; -// NSLog(@"%@", [image representations]); - -// for (NSBitmapImageRep *rep in [image representations]) { -// [rep setColorSpaceName:NSDeviceWhiteColorSpace]; -// } - } - - return self; -} - -- (void)dealloc -{ -// CGImageRelease(image); - [image release]; - [super dealloc]; -} - -- (void)drawRect:(NSRect)dirtyRect -{ - NSRect boundRect = [self bounds]; - CGFloat radius = 1.0; - - if (boundRect.size.width > 16.0 && boundRect.size.width <= 32.0) { - boundRect.origin.x += 1.0; - boundRect.origin.y += 1.0; - boundRect.size.width -= 2.0; - boundRect.size.height -= 2.0; - radius = 2.0; - } - else if (boundRect.size.width > 32.0) { - boundRect.origin.x += 5.0; - boundRect.origin.y += 5.0; - boundRect.size.width -= 10.0; - boundRect.size.height -= 10.0; - radius = 7.0; - } - - NSShadow *imageShadow = [[[NSShadow alloc] init] autorelease]; - [imageShadow setShadowOffset:NSMakeSize(1.0, -1.0)]; - [imageShadow setShadowColor:[NSColor darkGrayColor]]; - [imageShadow setShadowBlurRadius:radius / 2]; - - - NSBezierPath *clipPath = [NSBezierPath bezierPathWithRoundedRect:boundRect xRadius:radius yRadius:radius]; - [[NSGraphicsContext currentContext] saveGraphicsState]; - [imageShadow set]; - [[NSColor whiteColor] setFill]; - [clipPath fill]; - [[NSGraphicsContext currentContext] restoreGraphicsState]; - - [clipPath setClip]; - - [image drawInRect:boundRect fromRect:boundRect operation:NSCompositeCopy fraction:1.0]; - - NSString *text = @"ㄅ"; - - if ([self bounds].size.width >= 32.0) { - text = @"ㄅㄆ\nㄇㄈ"; - } - - NSFont *font = [NSFont fontWithName:@"LiSong Pro" size:boundRect.size.width * 0.40]; - - NSShadow *shadow = [[[NSShadow alloc] init] autorelease]; - [shadow setShadowColor:[NSColor blackColor]]; - [shadow setShadowOffset:NSMakeSize(1.0, 1.0)]; - // [shadow setShadowBlurRadius:2.0]; - // [NSFont boldSystemFontOfSize:48.0]; - - - NSColor *textColor = [NSColor whiteColor]; - - NSMutableDictionary *attr = [NSMutableDictionary dictionaryWithObjectsAndKeys: - font, NSFontAttributeName, - textColor, NSForegroundColorAttributeName, - shadow, NSShadowAttributeName, - nil]; - - NSAttributedString *attrStr = [[[NSAttributedString alloc] initWithString:text attributes:attr] autorelease]; - - NSRect textRect = [attrStr boundingRectWithSize:boundRect.size options:NSStringDrawingUsesLineFragmentOrigin]; - - textRect.origin.x = boundRect.origin.x + (boundRect.size.width - textRect.size.width) / 2.0; - textRect.origin.y = boundRect.origin.y + (boundRect.size.height - textRect.size.height) / 2.0; - - textRect.origin.y += boundRect.size.height * 0.025; - - [attrStr drawInRect:textRect]; - - -// NSBitmapImageRep *imageRep = [[[NSBitmapImageRep alloc] initWithCGImage:image] autorelease]; -// -// [imageRep colorizeByMappingGray:0.2 toColor:[NSColor greenColor] blackMapping:[NSColor darkGrayColor] whiteMapping:[NSColor redColor]]; - -// NSImage *img = [[NSImage alloc] initWithCGImage:image size:NSZeroSize]; -// NSLog(@"%@", [img representations]); -// -// [img drawInRect:[self bounds] fromRect:[self bounds] operation:NSCompositeCopy fraction:1.0]; -// [img release]; - - // [image drawRepresentation:imageRep inRect:[self bounds]]; - // [imageRep draw]; -// [imageRep drawInRect:[self bounds] fromRect:[self bounds] operation:NSCompositeCopy fraction:1.0 respectFlipped:YES hints:nil]; -} - -@end diff --git a/Source/IconMaker/BopomofoIconRenderView.h b/Source/IconMaker/BopomofoIconRenderView.h deleted file mode 100644 index bbdca90d..00000000 --- a/Source/IconMaker/BopomofoIconRenderView.h +++ /dev/null @@ -1,14 +0,0 @@ -// -// BopomofoIconRenderView.h -// Lettuce -// -// Created by Lukhnos D. Liu on 9/3/12. -// -// - -#import - -@interface BopomofoIconRenderView : NSView -@property (assign, nonatomic) BOOL textMenuIcon; -@property (assign, nonatomic) BOOL plainBopomofoIcon; -@end diff --git a/Source/IconMaker/BopomofoIconRenderView.m b/Source/IconMaker/BopomofoIconRenderView.m deleted file mode 100644 index 21a39548..00000000 --- a/Source/IconMaker/BopomofoIconRenderView.m +++ /dev/null @@ -1,115 +0,0 @@ -// -// BopomofoIconRenderView.m -// Lettuce -// -// Created by Lukhnos D. Liu on 9/3/12. -// -// - -#import "BopomofoIconRenderView.h" - -@implementation BopomofoIconRenderView -- (void)drawRect:(NSRect)dirtyRect -{ - NSAffineTransform *transform = [NSAffineTransform transform]; - [transform scaleBy:[self bounds].size.width / 16.0]; - [transform concat]; - - NSRect boundsRect = NSMakeRect(0.0, 0.0, 16.0, 16.0); - - if ([self bounds].size.width > 16.0) { - boundsRect.origin.x += 0.5; - } - - boundsRect.size.width -= 1.0; - - NSBezierPath *backgroundPath = [NSBezierPath bezierPathWithRoundedRect:boundsRect xRadius:2.0 yRadius:2.0]; - if (self.textMenuIcon) { - [[NSColor colorWithDeviceWhite:0.95 alpha:1.0] setFill]; - [[NSColor colorWithDeviceWhite:0.6 alpha:1.0] setStroke]; - [backgroundPath fill]; - - NSRect innerBoundRect = boundsRect; - innerBoundRect.size.width -= 1.0; - innerBoundRect.size.height -= 1.0; - innerBoundRect.origin.x += 0.5; - innerBoundRect.origin.y += 0.5; - backgroundPath = [NSBezierPath bezierPathWithRoundedRect:innerBoundRect xRadius:2.0 yRadius:2.0]; - [backgroundPath stroke]; - - [NSGraphicsContext saveGraphicsState]; - NSBezierPath *coveringPath = [NSBezierPath bezierPath]; - [coveringPath appendBezierPathWithArcWithCenter:NSMakePoint(16.0, 1.0) radius:14.0 startAngle:0.0 endAngle:360.0]; - [coveringPath setClip]; - - [[NSColor colorWithDeviceWhite:0.3 alpha:1.0] setStroke]; - backgroundPath = [NSBezierPath bezierPathWithRoundedRect:innerBoundRect xRadius:2.0 yRadius:2.0]; - [backgroundPath stroke]; - [NSGraphicsContext restoreGraphicsState]; - } - else { - if (self.plainBopomofoIcon) { - if ([self bounds].size.width > 16.0) { - [[NSColor colorWithDeviceWhite:0.3 alpha:1.0] setFill]; - } - else { - [[NSColor colorWithDeviceWhite:0.1 alpha:1.0] setFill]; - } - } - else { - [[NSColor colorWithDeviceWhite:0.3 alpha:1.0] setFill]; - } - [backgroundPath fill]; - } - - - CGFloat fontSize = ([self bounds].size.width > 16.0) ? 14.0 : 13.0; - NSString *text = @"ㄅ"; - NSString *fontName = @"BiauKai"; - - NSColor *textColor = nil; - - if (self.textMenuIcon) { - textColor = [NSColor blackColor]; - } - else if (self.plainBopomofoIcon) { - textColor = [NSColor colorWithDeviceWhite:0.95 alpha:1.0]; - } - else { - textColor = [NSColor colorWithDeviceWhite:1.0 alpha:1.0]; - } - - NSMutableDictionary *attrDict = [NSMutableDictionary dictionaryWithObjectsAndKeys: - textColor, NSForegroundColorAttributeName, - [NSFont fontWithName:fontName size:fontSize], NSFontAttributeName, - nil]; - NSMutableAttributedString *attrString = [[[NSMutableAttributedString alloc] initWithString:text attributes:attrDict] autorelease]; - - NSRect textBounds = [attrString boundingRectWithSize:boundsRect.size options:NSStringDrawingUsesLineFragmentOrigin]; - - NSPoint textOrigin; - textOrigin.x = boundsRect.origin.x + (boundsRect.size.width - textBounds.size.width) / 2.0; - textOrigin.y = boundsRect.origin.y; - - [attrString drawAtPoint:textOrigin]; - - if (self.plainBopomofoIcon) { - NSBezierPath *coveringPath = [NSBezierPath bezierPath]; - [coveringPath appendBezierPathWithArcWithCenter:NSMakePoint(16.0, -3.0) radius:13.0 startAngle:0.0 endAngle:360.0]; - [coveringPath setClip]; - - if (!([self bounds].size.width > 16.0)) { - [[NSColor colorWithDeviceWhite:0.6 alpha:1.0] setFill]; - } - else { - [[NSColor colorWithDeviceWhite:0.65 alpha:1.0] setFill]; - } - - [backgroundPath fill]; - - [attrDict setObject:[NSColor colorWithDeviceWhite:1.0 alpha:1.0] forKey:NSForegroundColorAttributeName]; - [attrString setAttributes:attrDict range:NSMakeRange(0, [text length])]; - [attrString drawAtPoint:textOrigin]; - } -} -@end diff --git a/Source/IconMaker/IconMaker-Info.plist b/Source/IconMaker/IconMaker-Info.plist deleted file mode 100644 index 491e5a8a..00000000 --- a/Source/IconMaker/IconMaker-Info.plist +++ /dev/null @@ -1,34 +0,0 @@ - - - - - NSHumanReadableCopyright - Copyright © 2011-2012 Mengjuei Hsieh et al. - CFBundleDevelopmentRegion - en - CFBundleExecutable - ${EXECUTABLE_NAME} - CFBundleIconFile - - CFBundleIdentifier - org.openvanilla.McBopomofo.${PRODUCT_NAME:rfc1034identifier} - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - ${PRODUCT_NAME} - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.0 - CFBundleSignature - MICM - CFBundleVersion - 1 - LSMinimumSystemVersion - ${MACOSX_DEPLOYMENT_TARGET} - NSMainNibFile - MainMenu - NSPrincipalClass - NSApplication - - diff --git a/Source/IconMaker/IconMaker-Prefix.pch b/Source/IconMaker/IconMaker-Prefix.pch deleted file mode 100644 index f2f2ca34..00000000 --- a/Source/IconMaker/IconMaker-Prefix.pch +++ /dev/null @@ -1,7 +0,0 @@ -// -// Prefix header for all source files of the 'IconMaker' target in the 'IconMaker' project -// - -#ifdef __OBJC__ - #import -#endif diff --git a/Source/IconMaker/IconMaker.xcodeproj/project.pbxproj b/Source/IconMaker/IconMaker.xcodeproj/project.pbxproj deleted file mode 100644 index ba9e28d8..00000000 --- a/Source/IconMaker/IconMaker.xcodeproj/project.pbxproj +++ /dev/null @@ -1,282 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 6AA67F9E15FC429D00B5A308 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6AA67F9D15FC429D00B5A308 /* Cocoa.framework */; }; - 6AA67FD315FC430F00B5A308 /* AppIconRendererView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6AA67FC015FC430F00B5A308 /* AppIconRendererView.m */; }; - 6AA67FD415FC430F00B5A308 /* BopomofoIconRenderView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6AA67FC215FC430F00B5A308 /* BopomofoIconRenderView.m */; }; - 6AA67FD715FC430F00B5A308 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6AA67FC815FC430F00B5A308 /* MainMenu.xib */; }; - 6AA67FD915FC430F00B5A308 /* IconMakerAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 6AA67FCD15FC430F00B5A308 /* IconMakerAppDelegate.m */; }; - 6AA67FDA15FC430F00B5A308 /* ImageZoomInView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6AA67FCF15FC430F00B5A308 /* ImageZoomInView.m */; }; - 6AA67FDB15FC430F00B5A308 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 6AA67FD015FC430F00B5A308 /* main.m */; }; - 6AA67FDC15FC430F00B5A308 /* TISIconRendererView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6AA67FD215FC430F00B5A308 /* TISIconRendererView.m */; }; - 6AA67FE215FC43BC00B5A308 /* Quartz.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6AA67FE115FC43BC00B5A308 /* Quartz.framework */; }; -/* End PBXBuildFile section */ - -/* Begin PBXFileReference section */ - 6AA67F9915FC429D00B5A308 /* IconMaker.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = IconMaker.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 6AA67F9D15FC429D00B5A308 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; }; - 6AA67FBF15FC430F00B5A308 /* AppIconRendererView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppIconRendererView.h; sourceTree = ""; }; - 6AA67FC015FC430F00B5A308 /* AppIconRendererView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppIconRendererView.m; sourceTree = ""; }; - 6AA67FC115FC430F00B5A308 /* BopomofoIconRenderView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BopomofoIconRenderView.h; sourceTree = ""; }; - 6AA67FC215FC430F00B5A308 /* BopomofoIconRenderView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BopomofoIconRenderView.m; sourceTree = ""; }; - 6AA67FC915FC430F00B5A308 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = MainMenu.xib; sourceTree = ""; }; - 6AA67FCA15FC430F00B5A308 /* IconMaker-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "IconMaker-Info.plist"; sourceTree = ""; }; - 6AA67FCB15FC430F00B5A308 /* IconMaker-Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "IconMaker-Prefix.pch"; sourceTree = ""; }; - 6AA67FCC15FC430F00B5A308 /* IconMakerAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IconMakerAppDelegate.h; sourceTree = ""; }; - 6AA67FCD15FC430F00B5A308 /* IconMakerAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IconMakerAppDelegate.m; sourceTree = ""; }; - 6AA67FCE15FC430F00B5A308 /* ImageZoomInView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageZoomInView.h; sourceTree = ""; }; - 6AA67FCF15FC430F00B5A308 /* ImageZoomInView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ImageZoomInView.m; sourceTree = ""; }; - 6AA67FD015FC430F00B5A308 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; - 6AA67FD115FC430F00B5A308 /* TISIconRendererView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TISIconRendererView.h; sourceTree = ""; }; - 6AA67FD215FC430F00B5A308 /* TISIconRendererView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TISIconRendererView.m; sourceTree = ""; }; - 6AA67FE115FC43BC00B5A308 /* Quartz.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Quartz.framework; path = System/Library/Frameworks/Quartz.framework; sourceTree = SDKROOT; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 6AA67F9615FC429D00B5A308 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 6AA67FE215FC43BC00B5A308 /* Quartz.framework in Frameworks */, - 6AA67F9E15FC429D00B5A308 /* Cocoa.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 6AA67F8E15FC429D00B5A308 = { - isa = PBXGroup; - children = ( - 6AA67FBF15FC430F00B5A308 /* AppIconRendererView.h */, - 6AA67FC015FC430F00B5A308 /* AppIconRendererView.m */, - 6AA67FC115FC430F00B5A308 /* BopomofoIconRenderView.h */, - 6AA67FC215FC430F00B5A308 /* BopomofoIconRenderView.m */, - 6AA67FCC15FC430F00B5A308 /* IconMakerAppDelegate.h */, - 6AA67FCD15FC430F00B5A308 /* IconMakerAppDelegate.m */, - 6AA67FCE15FC430F00B5A308 /* ImageZoomInView.h */, - 6AA67FCF15FC430F00B5A308 /* ImageZoomInView.m */, - 6AA67FD015FC430F00B5A308 /* main.m */, - 6AA67FD115FC430F00B5A308 /* TISIconRendererView.h */, - 6AA67FD215FC430F00B5A308 /* TISIconRendererView.m */, - 6AE210AF15FC6388003659FE /* Resources */, - 6AA67F9C15FC429D00B5A308 /* Frameworks */, - 6AA67F9A15FC429D00B5A308 /* Products */, - ); - sourceTree = ""; - }; - 6AA67F9A15FC429D00B5A308 /* Products */ = { - isa = PBXGroup; - children = ( - 6AA67F9915FC429D00B5A308 /* IconMaker.app */, - ); - name = Products; - sourceTree = ""; - }; - 6AA67F9C15FC429D00B5A308 /* Frameworks */ = { - isa = PBXGroup; - children = ( - 6AA67F9D15FC429D00B5A308 /* Cocoa.framework */, - 6AA67FE115FC43BC00B5A308 /* Quartz.framework */, - ); - name = Frameworks; - sourceTree = ""; - }; - 6AE210AF15FC6388003659FE /* Resources */ = { - isa = PBXGroup; - children = ( - 6AA67FCA15FC430F00B5A308 /* IconMaker-Info.plist */, - 6AA67FCB15FC430F00B5A308 /* IconMaker-Prefix.pch */, - 6AA67FC815FC430F00B5A308 /* MainMenu.xib */, - ); - name = Resources; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 6AA67F9815FC429D00B5A308 /* IconMaker */ = { - isa = PBXNativeTarget; - buildConfigurationList = 6AA67FB715FC429D00B5A308 /* Build configuration list for PBXNativeTarget "IconMaker" */; - buildPhases = ( - 6AA67F9515FC429D00B5A308 /* Sources */, - 6AA67F9615FC429D00B5A308 /* Frameworks */, - 6AA67F9715FC429D00B5A308 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = IconMaker; - productName = IconMaker; - productReference = 6AA67F9915FC429D00B5A308 /* IconMaker.app */; - productType = "com.apple.product-type.application"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 6AA67F9015FC429D00B5A308 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0440; - ORGANIZATIONNAME = OpenVanilla; - }; - buildConfigurationList = 6AA67F9315FC429D00B5A308 /* Build configuration list for PBXProject "IconMaker" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - ); - mainGroup = 6AA67F8E15FC429D00B5A308; - productRefGroup = 6AA67F9A15FC429D00B5A308 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 6AA67F9815FC429D00B5A308 /* IconMaker */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 6AA67F9715FC429D00B5A308 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 6AA67FD715FC430F00B5A308 /* MainMenu.xib in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 6AA67F9515FC429D00B5A308 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 6AA67FD315FC430F00B5A308 /* AppIconRendererView.m in Sources */, - 6AA67FD415FC430F00B5A308 /* BopomofoIconRenderView.m in Sources */, - 6AA67FD915FC430F00B5A308 /* IconMakerAppDelegate.m in Sources */, - 6AA67FDA15FC430F00B5A308 /* ImageZoomInView.m in Sources */, - 6AA67FDB15FC430F00B5A308 /* main.m in Sources */, - 6AA67FDC15FC430F00B5A308 /* TISIconRendererView.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXVariantGroup section */ - 6AA67FC815FC430F00B5A308 /* MainMenu.xib */ = { - isa = PBXVariantGroup; - children = ( - 6AA67FC915FC430F00B5A308 /* en */, - ); - name = MainMenu.xib; - path = en.lproj; - sourceTree = ""; - }; -/* End PBXVariantGroup section */ - -/* Begin XCBuildConfiguration section */ - 6AA67FB515FC429D00B5A308 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = "$(ARCHS_STANDARD_64_BIT)"; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_OBJC_EXCEPTIONS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.7; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = macosx; - }; - name = Debug; - }; - 6AA67FB615FC429D00B5A308 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = "$(ARCHS_STANDARD_64_BIT)"; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_ENABLE_OBJC_EXCEPTIONS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.7; - SDKROOT = macosx; - }; - name = Release; - }; - 6AA67FB815FC429D00B5A308 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - COMBINE_HIDPI_IMAGES = YES; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "IconMaker-Prefix.pch"; - INFOPLIST_FILE = "IconMaker-Info.plist"; - PRODUCT_NAME = "$(TARGET_NAME)"; - WRAPPER_EXTENSION = app; - }; - name = Debug; - }; - 6AA67FB915FC429D00B5A308 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - COMBINE_HIDPI_IMAGES = YES; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "IconMaker-Prefix.pch"; - INFOPLIST_FILE = "IconMaker-Info.plist"; - PRODUCT_NAME = "$(TARGET_NAME)"; - WRAPPER_EXTENSION = app; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 6AA67F9315FC429D00B5A308 /* Build configuration list for PBXProject "IconMaker" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 6AA67FB515FC429D00B5A308 /* Debug */, - 6AA67FB615FC429D00B5A308 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 6AA67FB715FC429D00B5A308 /* Build configuration list for PBXNativeTarget "IconMaker" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 6AA67FB815FC429D00B5A308 /* Debug */, - 6AA67FB915FC429D00B5A308 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 6AA67F9015FC429D00B5A308 /* Project object */; -} diff --git a/Source/IconMaker/IconMakerAppDelegate.h b/Source/IconMaker/IconMakerAppDelegate.h deleted file mode 100644 index 59eed283..00000000 --- a/Source/IconMaker/IconMakerAppDelegate.h +++ /dev/null @@ -1,45 +0,0 @@ -// -// IconMakerAppDelegate.h -// -// Copyright (c) 2011 The McBopomofo Project. -// -// Contributors: -// Mengjuei Hsieh (@mjhsieh) -// Weizhong Yang (@zonble) -// -// Based on the Syrup Project and the Formosana Library -// by Lukhnos Liu (@lukhnos). -// -// 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. -// - -#import -#import "TISIconRendererView.h" -#import "BopomofoIconRenderView.h" - -@interface IconMakerAppDelegate : NSObject -@property (assign) IBOutlet NSWindow *window; -@property (assign) IBOutlet TISIconRendererView *selectedTISIconRendererView; -@property (assign) IBOutlet TISIconRendererView *faviconRenderView; -@property (assign) IBOutlet BopomofoIconRenderView *bopomofoIconRenderView; -@property (assign) IBOutlet BopomofoIconRenderView *bopomofoIconRenderView2x; -@end diff --git a/Source/IconMaker/IconMakerAppDelegate.m b/Source/IconMaker/IconMakerAppDelegate.m deleted file mode 100644 index 12daed47..00000000 --- a/Source/IconMaker/IconMakerAppDelegate.m +++ /dev/null @@ -1,112 +0,0 @@ -// -// IconMakerAppDelegate.m -// -// Copyright (c) 2011 The McBopomofo Project. -// -// Contributors: -// Mengjuei Hsieh (@mjhsieh) -// Weizhong Yang (@zonble) -// -// Based on the Syrup Project and the Formosana Library -// by Lukhnos Liu (@lukhnos). -// -// 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. -// - -#import "IconMakerAppDelegate.h" - -@implementation IconMakerAppDelegate - -- (void)makeIconForObject:(id)object size:(NSSize)size filename:(NSString *)name -{ - NSRect rect; - rect.origin = NSZeroPoint; - rect.size = size; - - NSView *view = nil; - if ([object isKindOfClass:[NSView class]]) { - view = object; - [view setFrame:NSMakeRect(0.0, 0.0, size.width, size.height)]; - } - else if ([object isKindOfClass:[NSString class]]) { - view = [[[NSClassFromString(object) alloc] initWithFrame:rect] autorelease]; - } - - NSImage *image = [[[NSImage alloc] initWithSize:size] autorelease]; - [image lockFocus]; - [view drawRect:rect]; - [image unlockFocus]; - NSData *data = [image TIFFRepresentation]; - [data writeToFile:name atomically:YES]; -} - -- (void)applicationDidFinishLaunching:(NSNotification *)aNotification -{ - // Insert code here to initialize your application - self.selectedTISIconRendererView.selected = YES; - [self.selectedTISIconRendererView setNeedsDisplay:YES]; - - self.faviconRenderView.favicon = YES; - self.faviconRenderView.selected = YES; - NSRect oldFrame = [self.faviconRenderView frame]; - [self makeIconForObject:self.faviconRenderView size:NSMakeSize(16, 16) filename:@"/tmp/BopomofoFavicon.tiff"]; - [self.faviconRenderView setFrame:oldFrame]; - [self.faviconRenderView setNeedsDisplay:YES]; - - self.bopomofoIconRenderView.textMenuIcon = NO; - self.bopomofoIconRenderView.plainBopomofoIcon = NO; - self.bopomofoIconRenderView2x.textMenuIcon = NO; - self.bopomofoIconRenderView2x.plainBopomofoIcon = NO; - [self.bopomofoIconRenderView setNeedsDisplay:YES]; - [self.bopomofoIconRenderView2x setNeedsDisplay:YES]; - - BopomofoIconRenderView *iconRenderView = [[[BopomofoIconRenderView alloc] init] autorelease]; - iconRenderView.textMenuIcon = NO; - iconRenderView.plainBopomofoIcon = NO; - [self makeIconForObject:iconRenderView size:NSMakeSize(16, 16) filename:@"/tmp/Bopomofo.tiff"]; - [self makeIconForObject:iconRenderView size:NSMakeSize(32, 32) filename:@"/tmp/Bopomofo@2x.tiff"]; - - iconRenderView.textMenuIcon = NO; - iconRenderView.plainBopomofoIcon = YES; - [self makeIconForObject:iconRenderView size:NSMakeSize(16, 16) filename:@"/tmp/PlainBopomofo.tiff"]; - [self makeIconForObject:iconRenderView size:NSMakeSize(32, 32) filename:@"/tmp/PlainBopomofo@2x.tiff"]; - - iconRenderView.plainBopomofoIcon = NO; - iconRenderView.textMenuIcon = YES; - [self makeIconForObject:iconRenderView size:NSMakeSize(16, 16) filename:@"/tmp/BopomofoTextMenu.tiff"]; - [self makeIconForObject:iconRenderView size:NSMakeSize(32, 32) filename:@"/tmp/BopomofoTextMenu@2x.tiff"]; - - [self makeIconForObject:iconRenderView size:NSMakeSize(16, 16) filename:@"/tmp/icon_16x16.tiff"]; - [self makeIconForObject:iconRenderView size:NSMakeSize(32, 32) filename:@"/tmp/icon_16x16@2x.tiff"]; - [self makeIconForObject:iconRenderView size:NSMakeSize(32, 32) filename:@"/tmp/icon_32x32.tiff"]; - [self makeIconForObject:iconRenderView size:NSMakeSize(64, 64) filename:@"/tmp/icon_32x32@2x.tiff"]; - [self makeIconForObject:@"AppIconRendererView" size:NSMakeSize(128, 128) filename:@"/tmp/icon_128x128.tiff"]; - [self makeIconForObject:@"AppIconRendererView" size:NSMakeSize(256, 256) filename:@"/tmp/icon_128x128@2x.tiff"]; - [self makeIconForObject:@"AppIconRendererView" size:NSMakeSize(256, 256) filename:@"/tmp/icon_256x256.tiff"]; - [self makeIconForObject:@"AppIconRendererView" size:NSMakeSize(512, 512) filename:@"/tmp/icon_256x256@2x.tiff"]; - [self makeIconForObject:@"AppIconRendererView" size:NSMakeSize(512, 512) filename:@"/tmp/icon_512x512.tiff"]; - [self makeIconForObject:@"AppIconRendererView" size:NSMakeSize(1024, 1024) filename:@"/tmp/icon_512x512@2x.tiff"]; - - NSRunAlertPanel(@"Icons Generated", @"TIFF files are placed in /tmp", @"Dismiss", nil, nil); -} - -@end diff --git a/Source/IconMaker/ImageZoomInView.h b/Source/IconMaker/ImageZoomInView.h deleted file mode 100644 index 59065894..00000000 --- a/Source/IconMaker/ImageZoomInView.h +++ /dev/null @@ -1,42 +0,0 @@ -// -// ImageZoomInView.h -// -// Copyright (c) 2011 The McBopomofo Project. -// -// Contributors: -// Mengjuei Hsieh (@mjhsieh) -// Weizhong Yang (@zonble) -// -// Based on the Syrup Project and the Formosana Library -// by Lukhnos Liu (@lukhnos). -// -// 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. -// - -#import - -@interface ImageZoomInView : NSView -{ - NSRect imageBoundRect; -} -@property (nonatomic, retain) NSImage *image; -@end diff --git a/Source/IconMaker/ImageZoomInView.m b/Source/IconMaker/ImageZoomInView.m deleted file mode 100644 index 0fcb66b9..00000000 --- a/Source/IconMaker/ImageZoomInView.m +++ /dev/null @@ -1,77 +0,0 @@ -// -// ImageZoomInView.m -// -// Copyright (c) 2011 The McBopomofo Project. -// -// Contributors: -// Mengjuei Hsieh (@mjhsieh) -// Weizhong Yang (@zonble) -// -// Based on the Syrup Project and the Formosana Library -// by Lukhnos Liu (@lukhnos). -// -// 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. -// - -#import "ImageZoomInView.h" -#import "TISIconRendererView.h" - -@implementation ImageZoomInView -@synthesize image; - -- (id)initWithFrame:(NSRect)frame -{ - self = [super initWithFrame:frame]; - if (self) { - // Initialization code here. - - image = [[NSImage alloc] initWithSize:NSMakeSize(16.0, 16.0)]; - [image lockFocus]; - imageBoundRect = NSMakeRect(0.0, 0.0, 16.0, 16.0); - -// [[NSColor clearColor] setFill]; -// [NSBezierPath fillRect:imageBoundRect]; - - TISIconRendererView *rendererView = [[TISIconRendererView alloc] initWithFrame:imageBoundRect]; - [rendererView drawRect:imageBoundRect]; - [image unlockFocus]; - } - - - return self; -} - -- (void)dealloc -{ - [image release]; - [super dealloc]; -} - -- (void)drawRect:(NSRect)dirtyRect -{ - [[NSColor blackColor] setStroke]; - [NSBezierPath strokeRect:[self bounds]]; - - [image drawInRect:[self bounds] fromRect:imageBoundRect operation:NSCompositeSourceOver fraction:1.0]; -} - -@end diff --git a/Source/IconMaker/TISIconRendererView.h b/Source/IconMaker/TISIconRendererView.h deleted file mode 100644 index 990f56fd..00000000 --- a/Source/IconMaker/TISIconRendererView.h +++ /dev/null @@ -1,40 +0,0 @@ -// -// TISIconRendererView.h -// -// Copyright (c) 2011 The McBopomofo Project. -// -// Contributors: -// Mengjuei Hsieh (@mjhsieh) -// Weizhong Yang (@zonble) -// -// Based on the Syrup Project and the Formosana Library -// by Lukhnos Liu (@lukhnos). -// -// 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. -// - -#import - -@interface TISIconRendererView : NSView -@property (nonatomic, assign) BOOL favicon; -@property (nonatomic, assign) BOOL selected; -@end diff --git a/Source/IconMaker/TISIconRendererView.m b/Source/IconMaker/TISIconRendererView.m deleted file mode 100644 index 8f40122a..00000000 --- a/Source/IconMaker/TISIconRendererView.m +++ /dev/null @@ -1,116 +0,0 @@ -// -// TISIconRendererView.m -// -// Copyright (c) 2011 The McBopomofo Project. -// -// Contributors: -// Mengjuei Hsieh (@mjhsieh) -// Weizhong Yang (@zonble) -// -// Based on the Syrup Project and the Formosana Library -// by Lukhnos Liu (@lukhnos). -// -// 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. -// - -#import "TISIconRendererView.h" - -@implementation TISIconRendererView -@synthesize selected; -@synthesize favicon; - -- (void)drawRect:(NSRect)dirtyRect -{ - NSRect boundsRect = [self bounds]; - - if (favicon) { - boundsRect.origin.x += 0.0; - boundsRect.origin.y += 1.0; - boundsRect.size.width -= 1.0; - boundsRect.size.height -= 2.0; - - NSBezierPath *roundRectPath = [NSBezierPath bezierPathWithRoundedRect:boundsRect xRadius:1 yRadius:2]; - [[NSColor grayColor] setFill]; - [roundRectPath fill]; - - boundsRect.origin.x += 0.0; - boundsRect.origin.y += 1.0; - boundsRect.size.width -= 1.0; - boundsRect.size.height -= 1.0; - - } - else { - boundsRect.origin.x += 0.0; - boundsRect.origin.y += 1.0; - boundsRect.size.width -= 1.0; - boundsRect.size.height -= 1.0; - } - - NSInteger fontSize = 16; - if (favicon) { - fontSize = 11; - } - - NSString *text = @"ㄅ"; - NSString *fontName = @"LiSong Pro"; - - NSColor *textColor = nil; - NSColor *shadowColor = nil; - if (!selected) { - textColor = [NSColor blackColor]; - shadowColor = [NSColor colorWithDeviceWhite:0.9 alpha:0.9]; - } - else { - shadowColor = [NSColor darkGrayColor]; - textColor = [NSColor colorWithDeviceWhite:1.0 alpha:1.0]; - } - - NSShadow *textShadow = [[NSShadow alloc] init]; - [textShadow setShadowColor:shadowColor]; - [textShadow setShadowOffset:NSMakeSize(-1, -1)]; - - NSMutableDictionary *attrDict = [NSMutableDictionary dictionaryWithObjectsAndKeys: - textColor, NSForegroundColorAttributeName, - textShadow, NSShadowAttributeName, - [NSFont fontWithName:fontName size:fontSize], NSFontAttributeName, - nil]; - NSAttributedString *attrString = [[NSAttributedString alloc] initWithString:text attributes:attrDict]; - - NSRect textBounds = [attrString boundingRectWithSize:boundsRect.size options:NSStringDrawingUsesLineFragmentOrigin]; - - NSPoint textOrigin; - textOrigin.x = boundsRect.origin.x + (boundsRect.size.width - textBounds.size.width) / 2.0; - - if (favicon) { - textOrigin.x += 1; - textOrigin.y = boundsRect.origin.y; - } - else { - textOrigin.y = boundsRect.origin.y - 2; - } - - attrString = [[NSAttributedString alloc] initWithString:text attributes:attrDict]; - [attrString drawAtPoint:textOrigin]; - -} - -@end diff --git a/Source/IconMaker/en.lproj/MainMenu.xib b/Source/IconMaker/en.lproj/MainMenu.xib deleted file mode 100644 index 49314f54..00000000 --- a/Source/IconMaker/en.lproj/MainMenu.xib +++ /dev/null @@ -1,3739 +0,0 @@ - - - - 1070 - 11E53 - 2549 - 1138.47 - 569.00 - - com.apple.InterfaceBuilder.CocoaPlugin - 2549 - - - YES - NSCustomObject - NSCustomView - NSMenu - NSMenuItem - NSView - NSWindowTemplate - - - YES - com.apple.InterfaceBuilder.CocoaPlugin - - - PluginDependencyRecalculationVersion - - - - YES - - NSApplication - - - FirstResponder - - - NSApplication - - - AMainMenu - - YES - - - IconMaker - - 1048576 - 2147483647 - - NSImage - NSMenuCheckmark - - - NSImage - NSMenuMixedState - - submenuAction: - - IconMaker - - YES - - - About IconMaker - - 2147483647 - - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Preferences… - , - 1048576 - 2147483647 - - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Services - - 1048576 - 2147483647 - - - submenuAction: - - Services - - YES - - _NSServicesMenu - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Hide IconMaker - h - 1048576 - 2147483647 - - - - - - Hide Others - h - 1572864 - 2147483647 - - - - - - Show All - - 1048576 - 2147483647 - - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Quit IconMaker - q - 1048576 - 2147483647 - - - - - _NSAppleMenu - - - - - File - - 1048576 - 2147483647 - - - submenuAction: - - File - - YES - - - New - n - 1048576 - 2147483647 - - - - - - Open… - o - 1048576 - 2147483647 - - - - - - Open Recent - - 1048576 - 2147483647 - - - submenuAction: - - Open Recent - - YES - - - Clear Menu - - 1048576 - 2147483647 - - - - - _NSRecentDocumentsMenu - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Close - w - 1048576 - 2147483647 - - - - - - Save - s - 1048576 - 2147483647 - - - - - - Save As… - S - 1179648 - 2147483647 - - - - - - Revert to Saved - - 2147483647 - - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Page Setup... - P - 1179648 - 2147483647 - - - - - - - Print… - p - 1048576 - 2147483647 - - - - - - - - - Edit - - 1048576 - 2147483647 - - - submenuAction: - - Edit - - YES - - - Undo - z - 1048576 - 2147483647 - - - - - - Redo - Z - 1179648 - 2147483647 - - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Cut - x - 1048576 - 2147483647 - - - - - - Copy - c - 1048576 - 2147483647 - - - - - - Paste - v - 1048576 - 2147483647 - - - - - - Paste and Match Style - V - 1572864 - 2147483647 - - - - - - Delete - - 1048576 - 2147483647 - - - - - - Select All - a - 1048576 - 2147483647 - - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Find - - 1048576 - 2147483647 - - - submenuAction: - - Find - - YES - - - Find… - f - 1048576 - 2147483647 - - - 1 - - - - Find Next - g - 1048576 - 2147483647 - - - 2 - - - - Find Previous - G - 1179648 - 2147483647 - - - 3 - - - - Use Selection for Find - e - 1048576 - 2147483647 - - - 7 - - - - Jump to Selection - j - 1048576 - 2147483647 - - - - - - - - - Spelling and Grammar - - 1048576 - 2147483647 - - - submenuAction: - - Spelling and Grammar - - YES - - - Show Spelling and Grammar - : - 1048576 - 2147483647 - - - - - - Check Document Now - ; - 1048576 - 2147483647 - - - - - - YES - YES - - - 2147483647 - - - - - - Check Spelling While Typing - - 1048576 - 2147483647 - - - - - - Check Grammar With Spelling - - 1048576 - 2147483647 - - - - - - Correct Spelling Automatically - - 2147483647 - - - - - - - - - Substitutions - - 1048576 - 2147483647 - - - submenuAction: - - Substitutions - - YES - - - Show Substitutions - - 2147483647 - - - - - - YES - YES - - - 2147483647 - - - - - - Smart Copy/Paste - f - 1048576 - 2147483647 - - - 1 - - - - Smart Quotes - g - 1048576 - 2147483647 - - - 2 - - - - Smart Dashes - - 2147483647 - - - - - - Smart Links - G - 1179648 - 2147483647 - - - 3 - - - - Text Replacement - - 2147483647 - - - - - - - - - Transformations - - 2147483647 - - - submenuAction: - - Transformations - - YES - - - Make Upper Case - - 2147483647 - - - - - - Make Lower Case - - 2147483647 - - - - - - Capitalize - - 2147483647 - - - - - - - - - Speech - - 1048576 - 2147483647 - - - submenuAction: - - Speech - - YES - - - Start Speaking - - 1048576 - 2147483647 - - - - - - Stop Speaking - - 1048576 - 2147483647 - - - - - - - - - - - - Format - - 2147483647 - - - submenuAction: - - Format - - YES - - - Font - - 2147483647 - - - submenuAction: - - Font - - YES - - - Show Fonts - t - 1048576 - 2147483647 - - - - - - Bold - b - 1048576 - 2147483647 - - - 2 - - - - Italic - i - 1048576 - 2147483647 - - - 1 - - - - Underline - u - 1048576 - 2147483647 - - - - - - YES - YES - - - 2147483647 - - - - - - Bigger - + - 1048576 - 2147483647 - - - 3 - - - - Smaller - - - 1048576 - 2147483647 - - - 4 - - - - YES - YES - - - 2147483647 - - - - - - Kern - - 2147483647 - - - submenuAction: - - Kern - - YES - - - Use Default - - 2147483647 - - - - - - Use None - - 2147483647 - - - - - - Tighten - - 2147483647 - - - - - - Loosen - - 2147483647 - - - - - - - - - Ligature - - 2147483647 - - - submenuAction: - - Ligature - - YES - - - Use Default - - 2147483647 - - - - - - Use None - - 2147483647 - - - - - - Use All - - 2147483647 - - - - - - - - - Baseline - - 2147483647 - - - submenuAction: - - Baseline - - YES - - - Use Default - - 2147483647 - - - - - - Superscript - - 2147483647 - - - - - - Subscript - - 2147483647 - - - - - - Raise - - 2147483647 - - - - - - Lower - - 2147483647 - - - - - - - - - YES - YES - - - 2147483647 - - - - - - Show Colors - C - 1048576 - 2147483647 - - - - - - YES - YES - - - 2147483647 - - - - - - Copy Style - c - 1572864 - 2147483647 - - - - - - Paste Style - v - 1572864 - 2147483647 - - - - - _NSFontMenu - - - - - Text - - 2147483647 - - - submenuAction: - - Text - - YES - - - Align Left - { - 1048576 - 2147483647 - - - - - - Center - | - 1048576 - 2147483647 - - - - - - Justify - - 2147483647 - - - - - - Align Right - } - 1048576 - 2147483647 - - - - - - YES - YES - - - 2147483647 - - - - - - Writing Direction - - 2147483647 - - - submenuAction: - - Writing Direction - - YES - - - YES - Paragraph - - 2147483647 - - - - - - CURlZmF1bHQ - - 2147483647 - - - - - - CUxlZnQgdG8gUmlnaHQ - - 2147483647 - - - - - - CVJpZ2h0IHRvIExlZnQ - - 2147483647 - - - - - - YES - YES - - - 2147483647 - - - - - - YES - Selection - - 2147483647 - - - - - - CURlZmF1bHQ - - 2147483647 - - - - - - CUxlZnQgdG8gUmlnaHQ - - 2147483647 - - - - - - CVJpZ2h0IHRvIExlZnQ - - 2147483647 - - - - - - - - - YES - YES - - - 2147483647 - - - - - - Show Ruler - - 2147483647 - - - - - - Copy Ruler - c - 1310720 - 2147483647 - - - - - - Paste Ruler - v - 1310720 - 2147483647 - - - - - - - - - - - - View - - 1048576 - 2147483647 - - - submenuAction: - - View - - YES - - - Show Toolbar - t - 1572864 - 2147483647 - - - - - - Customize Toolbar… - - 1048576 - 2147483647 - - - - - - - - - Window - - 1048576 - 2147483647 - - - submenuAction: - - Window - - YES - - - Minimize - m - 1048576 - 2147483647 - - - - - - Zoom - - 1048576 - 2147483647 - - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Bring All to Front - - 1048576 - 2147483647 - - - - - _NSWindowsMenu - - - - - Help - - 2147483647 - - - submenuAction: - - Help - - YES - - - IconMaker Help - ? - 1048576 - 2147483647 - - - - - _NSHelpMenu - - - - _NSMainMenu - - - 7 - 2 - {{335, 390}, {451, 296}} - 1954021376 - IconMaker - NSWindow - - - - - 256 - - YES - - - 268 - {{20, 260}, {16, 16}} - - - - TISIconRendererView - - - - 268 - {{20, 188}, {16, 16}} - - - - BopomofoIconRenderView - - - - 268 - {{44, 148}, {128, 128}} - - - - AppIconRendererView - - - - 268 - {{180, 20}, {256, 256}} - - - AppIconRendererView - - - - 268 - {{20, 236}, {16, 16}} - - - - TISIconRendererView - - - - 268 - {{20, 212}, {16, 16}} - - - - TISIconRendererView - - - - 268 - {{20, 108}, {32, 32}} - - - - BopomofoIconRenderView - - - {451, 296} - - - - - {{0, 0}, {1440, 878}} - {10000000000000, 10000000000000} - YES - - - IconMakerAppDelegate - - - NSFontManager - - - - - YES - - - terminate: - - - - 449 - - - - orderFrontStandardAboutPanel: - - - - 142 - - - - delegate - - - - 495 - - - - performMiniaturize: - - - - 37 - - - - arrangeInFront: - - - - 39 - - - - print: - - - - 86 - - - - runPageLayout: - - - - 87 - - - - clearRecentDocuments: - - - - 127 - - - - performClose: - - - - 193 - - - - toggleContinuousSpellChecking: - - - - 222 - - - - undo: - - - - 223 - - - - copy: - - - - 224 - - - - checkSpelling: - - - - 225 - - - - paste: - - - - 226 - - - - stopSpeaking: - - - - 227 - - - - cut: - - - - 228 - - - - showGuessPanel: - - - - 230 - - - - redo: - - - - 231 - - - - selectAll: - - - - 232 - - - - startSpeaking: - - - - 233 - - - - delete: - - - - 235 - - - - performZoom: - - - - 240 - - - - performFindPanelAction: - - - - 241 - - - - centerSelectionInVisibleArea: - - - - 245 - - - - toggleGrammarChecking: - - - - 347 - - - - toggleSmartInsertDelete: - - - - 355 - - - - toggleAutomaticQuoteSubstitution: - - - - 356 - - - - toggleAutomaticLinkDetection: - - - - 357 - - - - saveDocument: - - - - 362 - - - - saveDocumentAs: - - - - 363 - - - - revertDocumentToSaved: - - - - 364 - - - - runToolbarCustomizationPalette: - - - - 365 - - - - toggleToolbarShown: - - - - 366 - - - - hide: - - - - 367 - - - - hideOtherApplications: - - - - 368 - - - - unhideAllApplications: - - - - 370 - - - - newDocument: - - - - 373 - - - - openDocument: - - - - 374 - - - - raiseBaseline: - - - - 426 - - - - lowerBaseline: - - - - 427 - - - - copyFont: - - - - 428 - - - - subscript: - - - - 429 - - - - superscript: - - - - 430 - - - - tightenKerning: - - - - 431 - - - - underline: - - - - 432 - - - - orderFrontColorPanel: - - - - 433 - - - - useAllLigatures: - - - - 434 - - - - loosenKerning: - - - - 435 - - - - pasteFont: - - - - 436 - - - - unscript: - - - - 437 - - - - useStandardKerning: - - - - 438 - - - - useStandardLigatures: - - - - 439 - - - - turnOffLigatures: - - - - 440 - - - - turnOffKerning: - - - - 441 - - - - toggleAutomaticSpellingCorrection: - - - - 456 - - - - orderFrontSubstitutionsPanel: - - - - 458 - - - - toggleAutomaticDashSubstitution: - - - - 461 - - - - toggleAutomaticTextReplacement: - - - - 463 - - - - uppercaseWord: - - - - 464 - - - - capitalizeWord: - - - - 467 - - - - lowercaseWord: - - - - 468 - - - - pasteAsPlainText: - - - - 486 - - - - performFindPanelAction: - - - - 487 - - - - performFindPanelAction: - - - - 488 - - - - performFindPanelAction: - - - - 489 - - - - showHelp: - - - - 493 - - - - alignCenter: - - - - 518 - - - - pasteRuler: - - - - 519 - - - - toggleRuler: - - - - 520 - - - - alignRight: - - - - 521 - - - - copyRuler: - - - - 522 - - - - alignJustified: - - - - 523 - - - - alignLeft: - - - - 524 - - - - makeBaseWritingDirectionNatural: - - - - 525 - - - - makeBaseWritingDirectionLeftToRight: - - - - 526 - - - - makeBaseWritingDirectionRightToLeft: - - - - 527 - - - - makeTextWritingDirectionNatural: - - - - 528 - - - - makeTextWritingDirectionLeftToRight: - - - - 529 - - - - makeTextWritingDirectionRightToLeft: - - - - 530 - - - - addFontTrait: - - - - 421 - - - - addFontTrait: - - - - 422 - - - - modifyFont: - - - - 423 - - - - orderFrontFontPanel: - - - - 424 - - - - modifyFont: - - - - 425 - - - - window - - - - 532 - - - - selectedTISIconRendererView - - - - 537 - - - - faviconRenderView - - - - 539 - - - - bopomofoIconRenderView - - - - 542 - - - - bopomofoIconRenderView2x - - - - 543 - - - - - YES - - 0 - - YES - - - - - - -2 - - - File's Owner - - - -1 - - - First Responder - - - -3 - - - Application - - - 29 - - - YES - - - - - - - - - - - - 19 - - - YES - - - - - - 56 - - - YES - - - - - - 217 - - - YES - - - - - - 83 - - - YES - - - - - - 81 - - - YES - - - - - - - - - - - - - - - - 75 - - - - - 80 - - - - - 78 - - - - - 72 - - - - - 82 - - - - - 124 - - - YES - - - - - - 77 - - - - - 73 - - - - - 79 - - - - - 112 - - - - - 74 - - - - - 125 - - - YES - - - - - - 126 - - - - - 205 - - - YES - - - - - - - - - - - - - - - - - - - - 202 - - - - - 198 - - - - - 207 - - - - - 214 - - - - - 199 - - - - - 203 - - - - - 197 - - - - - 206 - - - - - 215 - - - - - 218 - - - YES - - - - - - 216 - - - YES - - - - - - 200 - - - YES - - - - - - - - - - - 219 - - - - - 201 - - - - - 204 - - - - - 220 - - - YES - - - - - - - - - - 213 - - - - - 210 - - - - - 221 - - - - - 208 - - - - - 209 - - - - - 57 - - - YES - - - - - - - - - - - - - - - - 58 - - - - - 134 - - - - - 150 - - - - - 136 - - - - - 144 - - - - - 129 - - - - - 143 - - - - - 236 - - - - - 131 - - - YES - - - - - - 149 - - - - - 145 - - - - - 130 - - - - - 24 - - - YES - - - - - - - - - 92 - - - - - 5 - - - - - 239 - - - - - 23 - - - - - 295 - - - YES - - - - - - 296 - - - YES - - - - - - - 297 - - - - - 298 - - - - - 211 - - - YES - - - - - - 212 - - - YES - - - - - - - 195 - - - - - 196 - - - - - 346 - - - - - 348 - - - YES - - - - - - 349 - - - YES - - - - - - - - - - - - 350 - - - - - 351 - - - - - 354 - - - - - 371 - - - YES - - - - - - 372 - - - YES - - - - - - - - - - - - 375 - - - YES - - - - - - 376 - - - YES - - - - - - - 377 - - - YES - - - - - - 388 - - - YES - - - - - - - - - - - - - - - - - - - - - 389 - - - - - 390 - - - - - 391 - - - - - 392 - - - - - 393 - - - - - 394 - - - - - 395 - - - - - 396 - - - - - 397 - - - YES - - - - - - 398 - - - YES - - - - - - 399 - - - YES - - - - - - 400 - - - - - 401 - - - - - 402 - - - - - 403 - - - - - 404 - - - - - 405 - - - YES - - - - - - - - - - 406 - - - - - 407 - - - - - 408 - - - - - 409 - - - - - 410 - - - - - 411 - - - YES - - - - - - - - 412 - - - - - 413 - - - - - 414 - - - - - 415 - - - YES - - - - - - - - - 416 - - - - - 417 - - - - - 418 - - - - - 419 - - - - - 420 - - - - - 450 - - - YES - - - - - - 451 - - - YES - - - - - - - - 452 - - - - - 453 - - - - - 454 - - - - - 457 - - - - - 459 - - - - - 460 - - - - - 462 - - - - - 465 - - - - - 466 - - - - - 485 - - - - - 490 - - - YES - - - - - - 491 - - - YES - - - - - - 492 - - - - - 494 - - - - - 496 - - - YES - - - - - - 497 - - - YES - - - - - - - - - - - - - - - 498 - - - - - 499 - - - - - 500 - - - - - 501 - - - - - 502 - - - - - 503 - - - YES - - - - - - 504 - - - - - 505 - - - - - 506 - - - - - 507 - - - - - 508 - - - YES - - - - - - - - - - - - - - 509 - - - - - 510 - - - - - 511 - - - - - 512 - - - - - 513 - - - - - 514 - - - - - 515 - - - - - 516 - - - - - 517 - - - - - 533 - - - - - 534 - - - - - 535 - - - - - 536 - - - - - 538 - - - - - 540 - - - - - 541 - - - - - - - YES - - YES - -1.IBPluginDependency - -2.IBPluginDependency - -3.IBPluginDependency - 112.IBPluginDependency - 124.IBPluginDependency - 125.IBPluginDependency - 126.IBPluginDependency - 129.IBPluginDependency - 130.IBPluginDependency - 131.IBPluginDependency - 134.IBPluginDependency - 136.IBPluginDependency - 143.IBPluginDependency - 144.IBPluginDependency - 145.IBPluginDependency - 149.IBPluginDependency - 150.IBPluginDependency - 19.IBPluginDependency - 195.IBPluginDependency - 196.IBPluginDependency - 197.IBPluginDependency - 198.IBPluginDependency - 199.IBPluginDependency - 200.IBPluginDependency - 201.IBPluginDependency - 202.IBPluginDependency - 203.IBPluginDependency - 204.IBPluginDependency - 205.IBPluginDependency - 206.IBPluginDependency - 207.IBPluginDependency - 208.IBPluginDependency - 209.IBPluginDependency - 210.IBPluginDependency - 211.IBPluginDependency - 212.IBPluginDependency - 213.IBPluginDependency - 214.IBPluginDependency - 215.IBPluginDependency - 216.IBPluginDependency - 217.IBPluginDependency - 218.IBPluginDependency - 219.IBPluginDependency - 220.IBPluginDependency - 221.IBPluginDependency - 23.IBPluginDependency - 236.IBPluginDependency - 239.IBPluginDependency - 24.IBPluginDependency - 29.IBPluginDependency - 295.IBPluginDependency - 296.IBPluginDependency - 297.IBPluginDependency - 298.IBPluginDependency - 346.IBPluginDependency - 348.IBPluginDependency - 349.IBPluginDependency - 350.IBPluginDependency - 351.IBPluginDependency - 354.IBPluginDependency - 371.IBPluginDependency - 371.IBWindowTemplateEditedContentRect - 371.NSWindowTemplate.visibleAtLaunch - 372.IBPluginDependency - 375.IBPluginDependency - 376.IBPluginDependency - 377.IBPluginDependency - 388.IBPluginDependency - 389.IBPluginDependency - 390.IBPluginDependency - 391.IBPluginDependency - 392.IBPluginDependency - 393.IBPluginDependency - 394.IBPluginDependency - 395.IBPluginDependency - 396.IBPluginDependency - 397.IBPluginDependency - 398.IBPluginDependency - 399.IBPluginDependency - 400.IBPluginDependency - 401.IBPluginDependency - 402.IBPluginDependency - 403.IBPluginDependency - 404.IBPluginDependency - 405.IBPluginDependency - 406.IBPluginDependency - 407.IBPluginDependency - 408.IBPluginDependency - 409.IBPluginDependency - 410.IBPluginDependency - 411.IBPluginDependency - 412.IBPluginDependency - 413.IBPluginDependency - 414.IBPluginDependency - 415.IBPluginDependency - 416.IBPluginDependency - 417.IBPluginDependency - 418.IBPluginDependency - 419.IBPluginDependency - 420.IBPluginDependency - 450.IBPluginDependency - 451.IBPluginDependency - 452.IBPluginDependency - 453.IBPluginDependency - 454.IBPluginDependency - 457.IBPluginDependency - 459.IBPluginDependency - 460.IBPluginDependency - 462.IBPluginDependency - 465.IBPluginDependency - 466.IBPluginDependency - 485.IBPluginDependency - 490.IBPluginDependency - 491.IBPluginDependency - 492.IBPluginDependency - 494.IBPluginDependency - 496.IBPluginDependency - 497.IBPluginDependency - 498.IBPluginDependency - 499.IBPluginDependency - 5.IBPluginDependency - 500.IBPluginDependency - 501.IBPluginDependency - 502.IBPluginDependency - 503.IBPluginDependency - 504.IBPluginDependency - 505.IBPluginDependency - 506.IBPluginDependency - 507.IBPluginDependency - 508.IBPluginDependency - 509.IBPluginDependency - 510.IBPluginDependency - 511.IBPluginDependency - 512.IBPluginDependency - 513.IBPluginDependency - 514.IBPluginDependency - 515.IBPluginDependency - 516.IBPluginDependency - 517.IBPluginDependency - 533.IBPluginDependency - 534.IBPluginDependency - 535.IBPluginDependency - 536.IBPluginDependency - 538.IBPluginDependency - 540.IBPluginDependency - 541.IBPluginDependency - 56.IBPluginDependency - 57.IBPluginDependency - 58.IBPluginDependency - 72.IBPluginDependency - 73.IBPluginDependency - 74.IBPluginDependency - 75.IBPluginDependency - 77.IBPluginDependency - 78.IBPluginDependency - 79.IBPluginDependency - 80.IBPluginDependency - 81.IBPluginDependency - 82.IBPluginDependency - 83.IBPluginDependency - 92.IBPluginDependency - - - YES - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - {{380, 496}, {480, 360}} - - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - - - YES - - - - - - YES - - - - - 543 - - - - YES - - AppIconRendererView - NSView - - IBProjectSource - ./Classes/AppIconRendererView.h - - - - BopomofoIconRenderView - NSView - - IBProjectSource - ./Classes/BopomofoIconRenderView.h - - - - IconMakerAppDelegate - NSObject - - YES - - YES - bopomofoIconRenderView - bopomofoIconRenderView2x - faviconRenderView - selectedTISIconRendererView - window - - - YES - BopomofoIconRenderView - BopomofoIconRenderView - TISIconRendererView - TISIconRendererView - NSWindow - - - - YES - - YES - bopomofoIconRenderView - bopomofoIconRenderView2x - faviconRenderView - selectedTISIconRendererView - window - - - YES - - bopomofoIconRenderView - BopomofoIconRenderView - - - bopomofoIconRenderView2x - BopomofoIconRenderView - - - faviconRenderView - TISIconRendererView - - - selectedTISIconRendererView - TISIconRendererView - - - window - NSWindow - - - - - IBProjectSource - ./Classes/IconMakerAppDelegate.h - - - - NSDocument - - YES - - YES - printDocument: - revertDocumentToSaved: - runPageLayout: - saveDocument: - saveDocumentAs: - saveDocumentTo: - - - YES - id - id - id - id - id - id - - - - YES - - YES - printDocument: - revertDocumentToSaved: - runPageLayout: - saveDocument: - saveDocumentAs: - saveDocumentTo: - - - YES - - printDocument: - id - - - revertDocumentToSaved: - id - - - runPageLayout: - id - - - saveDocument: - id - - - saveDocumentAs: - id - - - saveDocumentTo: - id - - - - - IBProjectSource - ./Classes/NSDocument.h - - - - TISIconRendererView - NSView - - IBProjectSource - ./Classes/TISIconRendererView.h - - - - - 0 - IBCocoaFramework - - com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3 - - - YES - 3 - - YES - - YES - NSMenuCheckmark - NSMenuMixedState - - - YES - {11, 11} - {10, 3} - - - - diff --git a/Source/IconMaker/main.m b/Source/IconMaker/main.m deleted file mode 100644 index af9a0ec9..00000000 --- a/Source/IconMaker/main.m +++ /dev/null @@ -1,40 +0,0 @@ -// -// main.m -// -// Copyright (c) 2011 The McBopomofo Project. -// -// Contributors: -// Mengjuei Hsieh (@mjhsieh) -// Weizhong Yang (@zonble) -// -// Based on the Syrup Project and the Formosana Library -// by Lukhnos Liu (@lukhnos). -// -// 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. -// - -#import - -int main(int argc, char *argv[]) -{ - return NSApplicationMain(argc, (const char **)argv); -} diff --git a/Source/Images/Bopomofo.tiff b/Source/Images/Bopomofo.tiff index 08c835c3..a1c29ed1 100644 Binary files a/Source/Images/Bopomofo.tiff and b/Source/Images/Bopomofo.tiff differ diff --git a/Source/Images/Bopomofo@2x.tiff b/Source/Images/Bopomofo@2x.tiff index 17900a1c..61adceeb 100644 Binary files a/Source/Images/Bopomofo@2x.tiff and b/Source/Images/Bopomofo@2x.tiff differ diff --git a/Source/Images/BopomofoTextMenu.tiff b/Source/Images/BopomofoTextMenu.tiff deleted file mode 100644 index 1b99e700..00000000 Binary files a/Source/Images/BopomofoTextMenu.tiff and /dev/null differ diff --git a/Source/Images/BopomofoTextMenu@2x.tiff b/Source/Images/BopomofoTextMenu@2x.tiff deleted file mode 100644 index ca6bf08f..00000000 Binary files a/Source/Images/BopomofoTextMenu@2x.tiff and /dev/null differ diff --git a/Source/Images/Images.xcassets/AlertIcon.imageset/128X128.png b/Source/Images/Images.xcassets/AlertIcon.imageset/128X128.png new file mode 100644 index 00000000..1a599df9 Binary files /dev/null and b/Source/Images/Images.xcassets/AlertIcon.imageset/128X128.png differ diff --git a/Source/Images/Images.xcassets/AlertIcon.imageset/192x192.png b/Source/Images/Images.xcassets/AlertIcon.imageset/192x192.png new file mode 100644 index 00000000..33fa764a Binary files /dev/null and b/Source/Images/Images.xcassets/AlertIcon.imageset/192x192.png differ diff --git a/Source/Images/Images.xcassets/AlertIcon.imageset/64X64.png b/Source/Images/Images.xcassets/AlertIcon.imageset/64X64.png new file mode 100644 index 00000000..2b3d950b Binary files /dev/null and b/Source/Images/Images.xcassets/AlertIcon.imageset/64X64.png differ diff --git a/Source/Images/Images.xcassets/AlertIcon.imageset/Contents.json b/Source/Images/Images.xcassets/AlertIcon.imageset/Contents.json new file mode 100644 index 00000000..78b259ac --- /dev/null +++ b/Source/Images/Images.xcassets/AlertIcon.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "64X64.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "128X128.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "192x192.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Source/Images/Images.xcassets/AppIcon.appiconset/1024X1024.png b/Source/Images/Images.xcassets/AppIcon.appiconset/1024X1024.png new file mode 100644 index 00000000..cffcacb2 Binary files /dev/null and b/Source/Images/Images.xcassets/AppIcon.appiconset/1024X1024.png differ diff --git a/Source/Images/Images.xcassets/AppIcon.appiconset/128X128.png b/Source/Images/Images.xcassets/AppIcon.appiconset/128X128.png new file mode 100644 index 00000000..1a599df9 Binary files /dev/null and b/Source/Images/Images.xcassets/AppIcon.appiconset/128X128.png differ diff --git a/Source/Images/Images.xcassets/AppIcon.appiconset/16X16.png b/Source/Images/Images.xcassets/AppIcon.appiconset/16X16.png new file mode 100644 index 00000000..58e99c3b Binary files /dev/null and b/Source/Images/Images.xcassets/AppIcon.appiconset/16X16.png differ diff --git a/Source/Images/Images.xcassets/AppIcon.appiconset/256X256.png b/Source/Images/Images.xcassets/AppIcon.appiconset/256X256.png new file mode 100644 index 00000000..77503fcd Binary files /dev/null and b/Source/Images/Images.xcassets/AppIcon.appiconset/256X256.png differ diff --git a/Source/Images/Images.xcassets/AppIcon.appiconset/32X32.png b/Source/Images/Images.xcassets/AppIcon.appiconset/32X32.png new file mode 100644 index 00000000..157177af Binary files /dev/null and b/Source/Images/Images.xcassets/AppIcon.appiconset/32X32.png differ diff --git a/Source/Images/Images.xcassets/AppIcon.appiconset/512X512.png b/Source/Images/Images.xcassets/AppIcon.appiconset/512X512.png new file mode 100644 index 00000000..350731f8 Binary files /dev/null and b/Source/Images/Images.xcassets/AppIcon.appiconset/512X512.png differ diff --git a/Source/Images/Images.xcassets/AppIcon.appiconset/64X64.png b/Source/Images/Images.xcassets/AppIcon.appiconset/64X64.png new file mode 100644 index 00000000..2b3d950b Binary files /dev/null and b/Source/Images/Images.xcassets/AppIcon.appiconset/64X64.png differ diff --git a/Source/Images/Images.xcassets/AppIcon.appiconset/Contents.json b/Source/Images/Images.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 00000000..96ec4381 --- /dev/null +++ b/Source/Images/Images.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,68 @@ +{ + "images" : [ + { + "filename" : "16X16.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "16x16" + }, + { + "filename" : "32X32.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "16x16" + }, + { + "filename" : "32X32.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "32x32" + }, + { + "filename" : "64X64.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "32x32" + }, + { + "filename" : "128X128.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "128x128" + }, + { + "filename" : "256X256.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "128x128" + }, + { + "filename" : "256X256.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "256x256" + }, + { + "filename" : "512X512.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "256x256" + }, + { + "filename" : "512X512.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "512x512" + }, + { + "filename" : "1024X1024.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "512x512" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Source/Images/Images.xcassets/Contents.json b/Source/Images/Images.xcassets/Contents.json new file mode 100644 index 00000000..73c00596 --- /dev/null +++ b/Source/Images/Images.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Source/Images/McBopomofo.iconset/icon_128x128.png b/Source/Images/McBopomofo.iconset/icon_128x128.png deleted file mode 100644 index 941a1f6c..00000000 Binary files a/Source/Images/McBopomofo.iconset/icon_128x128.png and /dev/null differ diff --git a/Source/Images/McBopomofo.iconset/icon_128x128@2x.png b/Source/Images/McBopomofo.iconset/icon_128x128@2x.png deleted file mode 100644 index efab7686..00000000 Binary files a/Source/Images/McBopomofo.iconset/icon_128x128@2x.png and /dev/null differ diff --git a/Source/Images/McBopomofo.iconset/icon_16x16.png b/Source/Images/McBopomofo.iconset/icon_16x16.png deleted file mode 100644 index 90f87a85..00000000 Binary files a/Source/Images/McBopomofo.iconset/icon_16x16.png and /dev/null differ diff --git a/Source/Images/McBopomofo.iconset/icon_16x16@2x.png b/Source/Images/McBopomofo.iconset/icon_16x16@2x.png deleted file mode 100644 index 025d6d00..00000000 Binary files a/Source/Images/McBopomofo.iconset/icon_16x16@2x.png and /dev/null differ diff --git a/Source/Images/McBopomofo.iconset/icon_256x256.png b/Source/Images/McBopomofo.iconset/icon_256x256.png deleted file mode 100644 index efab7686..00000000 Binary files a/Source/Images/McBopomofo.iconset/icon_256x256.png and /dev/null differ diff --git a/Source/Images/McBopomofo.iconset/icon_256x256@2x.png b/Source/Images/McBopomofo.iconset/icon_256x256@2x.png deleted file mode 100644 index 4628eaf5..00000000 Binary files a/Source/Images/McBopomofo.iconset/icon_256x256@2x.png and /dev/null differ diff --git a/Source/Images/McBopomofo.iconset/icon_32x32.png b/Source/Images/McBopomofo.iconset/icon_32x32.png deleted file mode 100644 index 025d6d00..00000000 Binary files a/Source/Images/McBopomofo.iconset/icon_32x32.png and /dev/null differ diff --git a/Source/Images/McBopomofo.iconset/icon_32x32@2x.png b/Source/Images/McBopomofo.iconset/icon_32x32@2x.png deleted file mode 100644 index 68750bd8..00000000 Binary files a/Source/Images/McBopomofo.iconset/icon_32x32@2x.png and /dev/null differ diff --git a/Source/Images/McBopomofo.iconset/icon_512x512.png b/Source/Images/McBopomofo.iconset/icon_512x512.png deleted file mode 100644 index 4628eaf5..00000000 Binary files a/Source/Images/McBopomofo.iconset/icon_512x512.png and /dev/null differ diff --git a/Source/Images/McBopomofo.iconset/icon_512x512@2x.png b/Source/Images/McBopomofo.iconset/icon_512x512@2x.png deleted file mode 100644 index f816c2e2..00000000 Binary files a/Source/Images/McBopomofo.iconset/icon_512x512@2x.png and /dev/null differ diff --git a/Source/Images/PlainBopomofo.tiff b/Source/Images/PlainBopomofo.tiff index 2af4496e..2aee9334 100644 Binary files a/Source/Images/PlainBopomofo.tiff and b/Source/Images/PlainBopomofo.tiff differ diff --git a/Source/Images/PlainBopomofo@2x.tiff b/Source/Images/PlainBopomofo@2x.tiff index 9c0a24a8..af559d63 100644 Binary files a/Source/Images/PlainBopomofo@2x.tiff and b/Source/Images/PlainBopomofo@2x.tiff differ diff --git a/Source/Images/favicon.ico b/Source/Images/favicon.ico deleted file mode 100644 index 9f1ea001..00000000 Binary files a/Source/Images/favicon.ico and /dev/null differ diff --git a/Source/Images/favicon.png b/Source/Images/favicon.png deleted file mode 100644 index 0eed42be..00000000 Binary files a/Source/Images/favicon.png and /dev/null differ diff --git a/Source/Images/favicon.tiff b/Source/Images/favicon.tiff deleted file mode 100644 index 9b51cb8d..00000000 Binary files a/Source/Images/favicon.tiff and /dev/null differ diff --git a/Source/InputMethodController.h b/Source/InputMethodController.h index 210734ef..71437a00 100644 --- a/Source/InputMethodController.h +++ b/Source/InputMethodController.h @@ -72,6 +72,9 @@ // current input mode NSString *_inputMode; + + // if Chinese conversion is enabled + BOOL _chineseConversionEnabled; } @end diff --git a/Source/InputMethodController.mm b/Source/InputMethodController.mm index 7fadd3c6..e420d3fc 100644 --- a/Source/InputMethodController.mm +++ b/Source/InputMethodController.mm @@ -41,6 +41,9 @@ #import "AppDelegate.h" #import "VTHorizontalCandidateController.h" #import "VTVerticalCandidateController.h" +#import "McBopomofo-Swift.h" + +//@import SwiftUI; // C++ namespace usages using namespace std; @@ -74,6 +77,8 @@ static NSString *const kSelectPhraseAfterCursorAsCandidatePreferenceKey = @"Sele static NSString *const kUseHorizontalCandidateListPreferenceKey = @"UseHorizontalCandidateList"; static NSString *const kComposingBufferSizePreferenceKey = @"ComposingBufferSize"; static NSString *const kChooseCandidateUsingSpaceKey = @"ChooseCandidateUsingSpaceKey"; +static NSString *const kChineseConversionEnabledKey = @"ChineseConversionEnabledKey"; +static NSString *const kDisableUserCandidateSelectionLearning = @"DisableUserCandidateSelectionLearning"; // advanced (usually optional) settings static NSString *const kCandidateTextFontName = @"CandidateTextFontName"; @@ -117,6 +122,12 @@ static const int kUserOverrideModelCapacity = 500; static const double kObservedOverrideHalflife = 5400.0; // 1.5 hr. McBopomofo::UserOverrideModel gUserOverrideModel(kUserOverrideModelCapacity, kObservedOverrideHalflife); +// https://clang-analyzer.llvm.org/faq.html +__attribute__((annotate("returns_localized_nsstring"))) +static inline NSString *LocalizationNotNeeded(NSString *s) { + return s; +} + // private methods @interface McBopomofoInputMethodController () + (VTHorizontalCandidateController *)horizontalCandidateController; @@ -183,15 +194,8 @@ static void OverrideCandidate(const vector& nodes, const string& can if (_builder) { delete _builder; } - - [_composingBuffer release]; - - [_candidates release]; - // the two client pointers are weak pointers (i.e. we don't retain them) // therefore we don't do anything about it - - [super dealloc]; } - (id)initWithServer:(IMKServer *)server delegate:(id)delegate client:(id)client @@ -218,6 +222,7 @@ static void OverrideCandidate(const vector& nodes, const string& can _composingBuffer = [[NSMutableString alloc] init]; _inputMode = kBopomofoModeIdentifier; + _chineseConversionEnabled = [[NSUserDefaults standardUserDefaults] boolForKey:kChineseConversionEnabledKey]; } return self; @@ -226,16 +231,43 @@ static void OverrideCandidate(const vector& nodes, const string& can - (NSMenu *)menu { // a menu instance (autoreleased) is requested every time the user click on the input menu - NSMenu *menu = [[[NSMenu alloc] initWithTitle:@"Input Method Menu"] autorelease]; - NSMenuItem *preferenceMenuItem = [[[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"McBopomofo Preferences", @"") action:@selector(showPreferences:) keyEquivalent:@""] autorelease]; + NSMenu *menu = [[NSMenu alloc] initWithTitle:LocalizationNotNeeded(@"Input Method Menu")]; + NSMenuItem *preferenceMenuItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"McBopomofo Preferences", @"") action:@selector(showPreferences:) keyEquivalent:@""]; [menu addItem:preferenceMenuItem]; - #if DEBUG - NSMenuItem *updateCheckItem = [[[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Check for Updates…", @"") action:@selector(checkForUpdate:) keyEquivalent:@""] autorelease]; - [menu addItem:updateCheckItem]; - #endif + // If Option key is pressed, show the learning-related menu - NSMenuItem *aboutMenuItem = [[[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"About McBopomofo…", @"") action:@selector(showAbout:) keyEquivalent:@""] autorelease]; + #if DEBUG + //I think the following line is 10.6+ specific + if ([[NSEvent class] respondsToSelector:@selector(modifierFlags)] && ([NSEvent modifierFlags] & NSAlternateKeyMask)) { + + BOOL learningEnabled = ![[NSUserDefaults standardUserDefaults] boolForKey:kDisableUserCandidateSelectionLearning]; + + NSMenuItem *learnMenuItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Enable Selection Learning", @"") action:@selector(toggleLearning:) keyEquivalent:@""]; + learnMenuItem.state = learningEnabled ? NSControlStateValueOn : NSControlStateValueOff; + [menu addItem:learnMenuItem]; + + if (learningEnabled) { + NSString *clearMenuItemTitle = [NSString stringWithFormat:NSLocalizedString(@"Clear Learning Dictionary (%ju Items)", @""), (uintmax_t)[gCandidateLearningDictionary count]]; + NSMenuItem *clearMenuItem = [[NSMenuItem alloc] initWithTitle:clearMenuItemTitle action:@selector(clearLearningDictionary:) keyEquivalent:@""]; + [menu addItem:clearMenuItem]; + + + NSMenuItem *dumpMenuItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Dump Learning Data to Console", @"") action:@selector(dumpLearningDictionary:) keyEquivalent:@""]; + [menu addItem:dumpMenuItem]; + } + } + #endif //DEBUG + + NSMenuItem *chineseConversionMenuItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Chinese Conversion", @"") action:@selector(toggleChineseConverter:) keyEquivalent:@"G"]; + chineseConversionMenuItem.keyEquivalentModifierMask = NSEventModifierFlagCommand | NSEventModifierFlagControl; + chineseConversionMenuItem.state = _chineseConversionEnabled ? NSControlStateValueOn : NSControlStateValueOff; + [menu addItem:chineseConversionMenuItem]; + + NSMenuItem *updateCheckItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Check for Updates…", @"") action:@selector(checkForUpdate:) keyEquivalent:@""]; + [menu addItem:updateCheckItem]; + + NSMenuItem *aboutMenuItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"About McBopomofo…", @"") action:@selector(showAbout:) keyEquivalent:@""]; [menu addItem:aboutMenuItem]; return menu; @@ -389,8 +421,13 @@ static void OverrideCandidate(const vector& nodes, const string& can return; } + NSString *buffer = _composingBuffer; + if (_chineseConversionEnabled) { + buffer = [OpenCCBridge convert:_composingBuffer]; + } + // commit the text, clear the state - [client insertText:_composingBuffer replacementRange:NSMakeRange(NSNotFound, NSNotFound)]; + [client insertText:buffer replacementRange:NSMakeRange(NSNotFound, NSNotFound)]; _builder->clear(); _walkedNodes.clear(); [_composingBuffer setString:@""]; @@ -453,10 +490,9 @@ static void OverrideCandidate(const vector& nodes, const string& can // we must use NSAttributedString so that the cursor is visible -- // can't just use NSString - NSDictionary *attrDict = [NSDictionary dictionaryWithObjectsAndKeys: - [NSNumber numberWithInt:NSUnderlineStyleSingle], NSUnderlineStyleAttributeName, - [NSNumber numberWithInt:0], NSMarkedClauseSegmentAttributeName, nil]; - NSMutableAttributedString *attrString = [[[NSMutableAttributedString alloc] initWithString:composedText attributes:attrDict] autorelease]; + NSDictionary *attrDict = @{NSUnderlineStyleAttributeName: @(NSUnderlineStyleSingle), + NSMarkedClauseSegmentAttributeName: @0}; + NSMutableAttributedString *attrString = [[NSMutableAttributedString alloc] initWithString:composedText attributes:attrDict]; // the selection range is where the cursor is, with the length being 0 and replacement range NSNotFound, // i.e. the client app needs to take care of where to put ths composing buffer @@ -589,6 +625,11 @@ static void OverrideCandidate(const vector& nodes, const string& can return NO; } + // if ASCII but not printable, don't use insertText:replacementRange: as many apps don't handle non-ASCII char insertions. + if (charCode < 0x80 && !isprint(charCode)) { + return NO; + } + // when shift is pressed, don't do further processing, since it outputs capital letter anyway. NSString *popedText = [inputText lowercaseString]; [client insertText:popedText replacementRange:NSMakeRange(NSNotFound, NSNotFound)]; @@ -974,7 +1015,12 @@ static void OverrideCandidate(const vector& nodes, const string& can } } - if (charCode == 27) { + BOOL cancelCandidateKey = + (charCode == 27) || + ((_inputMode == kPlainBopomofoModeIdentifier) && + (charCode == 8 || keyCode == kDeleteKeyCode)); + + if (cancelCandidateKey) { gCurrentCandidateController.visible = NO; [_candidates removeAllObjects]; @@ -995,6 +1041,7 @@ static void OverrideCandidate(const vector& nodes, const string& can if (!updated) { [self beep]; } + [self updateClientComposingBuffer:_currentCandidateClient]; return YES; } else if (keyCode == kPageUpKeyCode) { @@ -1002,6 +1049,7 @@ static void OverrideCandidate(const vector& nodes, const string& can if (!updated) { [self beep]; } + [self updateClientComposingBuffer:_currentCandidateClient]; return YES; } else if (keyCode == kLeftKeyCode) { @@ -1010,10 +1058,12 @@ static void OverrideCandidate(const vector& nodes, const string& can if (!updated) { [self beep]; } + [self updateClientComposingBuffer:_currentCandidateClient]; return YES; } else { [self beep]; + [self updateClientComposingBuffer:_currentCandidateClient]; return YES; } } @@ -1023,10 +1073,12 @@ static void OverrideCandidate(const vector& nodes, const string& can if (!updated) { [self beep]; } + [self updateClientComposingBuffer:_currentCandidateClient]; return YES; } else { [self beep]; + [self updateClientComposingBuffer:_currentCandidateClient]; return YES; } } @@ -1036,6 +1088,7 @@ static void OverrideCandidate(const vector& nodes, const string& can if (!updated) { [self beep]; } + [self updateClientComposingBuffer:_currentCandidateClient]; return YES; } else { @@ -1043,6 +1096,7 @@ static void OverrideCandidate(const vector& nodes, const string& can if (!updated) { [self beep]; } + [self updateClientComposingBuffer:_currentCandidateClient]; return YES; } } @@ -1052,6 +1106,7 @@ static void OverrideCandidate(const vector& nodes, const string& can if (!updated) { [self beep]; } + [self updateClientComposingBuffer:_currentCandidateClient]; return YES; } else { @@ -1059,6 +1114,7 @@ static void OverrideCandidate(const vector& nodes, const string& can if (!updated) { [self beep]; } + [self updateClientComposingBuffer:_currentCandidateClient]; return YES; } } @@ -1071,6 +1127,7 @@ static void OverrideCandidate(const vector& nodes, const string& can gCurrentCandidateController.selectedCandidateIndex = 0; } + [self updateClientComposingBuffer:_currentCandidateClient]; return YES; } else if (keyCode == kEndKeyCode && [_candidates count] > 0) { @@ -1081,6 +1138,7 @@ static void OverrideCandidate(const vector& nodes, const string& can gCurrentCandidateController.selectedCandidateIndex = [_candidates count] - 1; } + [self updateClientComposingBuffer:_currentCandidateClient]; return YES; } else { @@ -1112,6 +1170,7 @@ static void OverrideCandidate(const vector& nodes, const string& can } [self beep]; + [self updateClientComposingBuffer:_currentCandidateClient]; return YES; } } @@ -1345,6 +1404,30 @@ static void OverrideCandidate(const vector& nodes, const string& can [[NSApplication sharedApplication] activateIgnoringOtherApps:YES]; } +- (void)toggleLearning:(id)sender +{ + BOOL toggle = ![[NSUserDefaults standardUserDefaults] boolForKey:kDisableUserCandidateSelectionLearning]; + + [[NSUserDefaults standardUserDefaults] setBool:toggle forKey:kDisableUserCandidateSelectionLearning]; +} + +- (void)toggleChineseConverter:(id)sender +{ + _chineseConversionEnabled = !_chineseConversionEnabled; + [[NSUserDefaults standardUserDefaults] setBool:_chineseConversionEnabled forKey:kChineseConversionEnabledKey]; +} + +- (void)clearLearningDictionary:(id)sender +{ + [gCandidateLearningDictionary removeAllObjects]; + [self _performDeferredSaveUserCandidatesDictionary]; +} + +- (void)dumpLearningDictionary:(id)sender +{ + NSLog(@"%@", gCandidateLearningDictionary); +} + - (NSUInteger)candidateCountForController:(VTCandidateController *)controller { return [_candidates count]; @@ -1366,6 +1449,7 @@ static void OverrideCandidate(const vector& nodes, const string& can if (_inputMode != kPlainBopomofoModeIdentifier) { _uom->observe(_walkedNodes, cursorIndex, selectedValue, [[NSDate date] timeIntervalSince1970]); } + _builder->grid().fixNodeSelectedCandidate(cursorIndex, selectedValue); vector nodes = _builder->grid().nodesCrossingOrEndingAt(cursorIndex); OverrideCandidate(nodes, selectedValue, true, 0.0); @@ -1433,7 +1517,7 @@ void LTLoadLanguageModel() // TODO: Change this NSString *userDictFile = [userDictPath stringByAppendingPathComponent:@"UserCandidatesCache.plist"]; - gUserCandidatesDictionaryPath = [userDictFile retain]; + gUserCandidatesDictionaryPath = userDictFile; exists = [[NSFileManager defaultManager] fileExistsAtPath:userDictFile isDirectory:&isDir]; if (exists && !isDir) { @@ -1442,9 +1526,7 @@ void LTLoadLanguageModel() return; } - NSString *errorStr = nil; - NSPropertyListFormat format; - id plist = [NSPropertyListSerialization propertyListFromData:data mutabilityOption:NSPropertyListImmutable format:&format errorDescription:&errorStr]; + id plist = [NSPropertyListSerialization propertyListWithData:data options:NSPropertyListImmutable format:NULL error:NULL]; if (plist && [plist isKindOfClass:[NSDictionary class]]) { [gCandidateLearningDictionary setDictionary:(NSDictionary *)plist]; NSLog(@"User dictionary read, item count: %ju", (uintmax_t)[gCandidateLearningDictionary count]); diff --git a/Source/Installer/AppDelegate.h b/Source/Installer/AppDelegate.h index 8f95771b..32b4936f 100644 --- a/Source/Installer/AppDelegate.h +++ b/Source/Installer/AppDelegate.h @@ -26,26 +26,28 @@ // #import +#import "ArchiveUtil.h" @interface AppDelegate : NSWindowController { @protected + ArchiveUtil *_archiveUtil; NSString *_installingVersion; BOOL _upgrading; - NSButton *_installButton; - NSButton *_cancelButton; - NSTextView *_textView; - NSWindow *_progressSheet; - NSProgressIndicator *_progressIndicator; + NSButton *__weak _installButton; + NSButton *__weak _cancelButton; + NSTextView *__unsafe_unretained _textView; + NSWindow *__weak _progressSheet; + NSProgressIndicator *__weak _progressIndicator; NSDate *_translocationRemovalStartTime; NSInteger _currentVersionNumber; } - (IBAction)agreeAndInstallAction:(id)sender; - (IBAction)cancelAction:(id)sender; -@property (assign) IBOutlet NSButton *installButton; -@property (assign) IBOutlet NSButton *cancelButton; -@property (assign) IBOutlet NSTextView *textView; -@property (assign) IBOutlet NSWindow *progressSheet; -@property (assign) IBOutlet NSProgressIndicator *progressIndicator; +@property (weak) IBOutlet NSButton *installButton; +@property (weak) IBOutlet NSButton *cancelButton; +@property (unsafe_unretained) IBOutlet NSTextView *textView; +@property (weak) IBOutlet NSWindow *progressSheet; +@property (weak) IBOutlet NSProgressIndicator *progressIndicator; @end diff --git a/Source/Installer/AppDelegate.m b/Source/Installer/AppDelegate.m index b35d7cf2..435e2c37 100644 --- a/Source/Installer/AppDelegate.m +++ b/Source/Installer/AppDelegate.m @@ -38,6 +38,16 @@ static NSString *const kTargetFullBinPartialPath = @"~/Library/Input Methods/McB static const NSTimeInterval kTranslocationRemovalTickInterval = 0.5; static const NSTimeInterval kTranslocationRemovalDeadline = 60.0; +/// A simple replacement for the deprecated NSRunAlertPanel. +void RunAlertPanel(NSString *title, NSString *message, NSString *buttonTitle) { + NSAlert *alert = [[NSAlert alloc] init]; + [alert setAlertStyle:NSAlertStyleInformational]; + [alert setMessageText:title]; + [alert setInformativeText:message]; + [alert addButtonWithTitle:buttonTitle]; + [alert runModal]; +} + @implementation AppDelegate @synthesize installButton = _installButton; @synthesize cancelButton = _cancelButton; @@ -45,27 +55,26 @@ static const NSTimeInterval kTranslocationRemovalDeadline = 60.0; @synthesize progressSheet = _progressSheet; @synthesize progressIndicator = _progressIndicator; -- (void)dealloc -{ - [_installingVersion release]; - [_translocationRemovalStartTime release]; - [super dealloc]; -} - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { + _installingVersion = [[[NSBundle mainBundle] infoDictionary] objectForKey:(id)kCFBundleVersionKey]; + NSString *versionString = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]; + + _archiveUtil = [[ArchiveUtil alloc] initWithAppName:kTargetBin targetAppBundleName:kTargetBundle]; + [_archiveUtil validateIfNotarizedArchiveExists]; + [self.cancelButton setNextKeyView:self.installButton]; [self.installButton setNextKeyView:self.cancelButton]; [[self window] setDefaultButtonCell:[self.installButton cell]]; - NSAttributedString *attrStr = [[[NSAttributedString alloc] initWithRTF:[NSData dataWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"License" ofType:@"rtf"]] documentAttributes:NULL] autorelease]; - - [[self.textView textStorage] setAttributedString:attrStr]; - - NSBundle *installingBundle = [NSBundle bundleWithPath:[[NSBundle mainBundle] pathForResource:kTargetBin ofType:kTargetType]]; - _installingVersion = [[[installingBundle infoDictionary] objectForKey:(id)kCFBundleVersionKey] retain]; - NSString *versionString = [[installingBundle infoDictionary] objectForKey:@"CFBundleShortVersionString"]; + NSAttributedString *attrStr = [[NSAttributedString alloc] initWithRTF:[NSData dataWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"License" ofType:@"rtf"]] documentAttributes:NULL]; + NSMutableAttributedString *mutableAttrStr = [attrStr mutableCopy]; + [mutableAttrStr addAttribute:NSForegroundColorAttributeName value:[NSColor controlTextColor] range:NSMakeRange(0, [mutableAttrStr length])]; + [[self.textView textStorage] setAttributedString:mutableAttrStr]; + [self.textView setSelectedRange:NSMakeRange(0, 0)]; + [[self window] setTitle:[NSString stringWithFormat:NSLocalizedString(@"%@ (for version %@, r%@)", nil), [[self window] title], versionString, _installingVersion]]; if ([[NSFileManager defaultManager] fileExistsAtPath:[kTargetPartialPath stringByExpandingTildeInPath]]) { @@ -128,8 +137,7 @@ static const NSTimeInterval kTranslocationRemovalDeadline = 60.0; }); }]; - [_translocationRemovalStartTime release]; - _translocationRemovalStartTime = [[NSDate date] retain]; + _translocationRemovalStartTime = [NSDate date]; [NSTimer scheduledTimerWithTimeInterval:kTranslocationRemovalTickInterval target:self selector:@selector(timerTick:) userInfo:nil repeats:YES]; return; } @@ -156,25 +164,31 @@ static const NSTimeInterval kTranslocationRemovalDeadline = 60.0; - (void)installInputMethodWithWarning:(BOOL)warning { - NSTask *cpTask = [NSTask launchedTaskWithLaunchPath:@"/bin/cp" arguments:[NSArray arrayWithObjects:@"-R", [[NSBundle mainBundle] pathForResource:kTargetBin ofType:kTargetType], [kDestinationPartial stringByExpandingTildeInPath], nil]]; + // If the unzipped archive does not exist, this must be a dev-mode installer. + NSString *targetBundle = [_archiveUtil unzipNotarizedArchive]; + if (!targetBundle) { + targetBundle = [[NSBundle mainBundle] pathForResource:kTargetBin ofType:kTargetType]; + } + + NSTask *cpTask = [NSTask launchedTaskWithLaunchPath:@"/bin/cp" arguments:[NSArray arrayWithObjects:@"-R", targetBundle, [kDestinationPartial stringByExpandingTildeInPath], nil]]; [cpTask waitUntilExit]; if ([cpTask terminationStatus] != 0) { - NSRunAlertPanel(NSLocalizedString(@"Install Failed", nil), NSLocalizedString(@"Cannot copy the file to the destination.", nil), NSLocalizedString(@"Cancel", nil), nil, nil); - [NSApp terminate:self]; + RunAlertPanel(NSLocalizedString(@"Install Failed", nil), NSLocalizedString(@"Cannot copy the file to the destination.", nil), NSLocalizedString(@"Cancel", nil)); + [NSApp terminate:self]; } NSArray *installArgs = [NSArray arrayWithObjects:@"install", nil]; NSTask *installTask = [NSTask launchedTaskWithLaunchPath:[kTargetFullBinPartialPath stringByExpandingTildeInPath] arguments:installArgs]; [installTask waitUntilExit]; if ([installTask terminationStatus] != 0) { - NSRunAlertPanel(NSLocalizedString(@"Install Failed", nil), NSLocalizedString(@"Cannot activate the input method.", nil), NSLocalizedString(@"Cancel", nil), nil, nil); + RunAlertPanel(NSLocalizedString(@"Install Failed", nil), NSLocalizedString(@"Cannot activate the input method.", nil), NSLocalizedString(@"Cancel", nil)); [NSApp terminate:self]; } if (warning) { - NSRunAlertPanel(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), nil, nil); + 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 { - NSRunAlertPanel(NSLocalizedString(@"Installation Successful", nil), NSLocalizedString(@"McBopomofo is ready to use.", nil), NSLocalizedString(@"OK", nil), nil, nil); + 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]; @@ -202,9 +216,22 @@ static const NSTimeInterval kTranslocationRemovalDeadline = 60.0; entryCount = getfsstat(bufs, entryCount * entrySize, MNT_NOWAIT); for (int i = 0; i < entryCount; i++) { if (!strcmp(bundleAbsPath, bufs[i].f_mntfromname)) { + free(bufs); + + // getfsstat() may return us a cached result, and so we need to get the stat of the mounted fs. + // If statfs() returns an error, the mounted fs is already gone. + struct statfs stat; + int checkResult = statfs(bundleAbsPath, &stat); + if (checkResult != 0) { + // Meaning the app's bundle is not mounted, that is it's not translocated. + // It also means that the app is not loaded. + return NO; + } + return YES; } } + free(bufs); return NO; } diff --git a/Source/IconMaker/AppIconRendererView.h b/Source/Installer/ArchiveUtil.h similarity index 65% rename from Source/IconMaker/AppIconRendererView.h rename to Source/Installer/ArchiveUtil.h index de729be5..aab19c61 100644 --- a/Source/IconMaker/AppIconRendererView.h +++ b/Source/Installer/ArchiveUtil.h @@ -1,15 +1,5 @@ +// Copyright (c) 2011-2019 The McBopomofo Project. // -// AppIconRendererView.h -// -// Copyright (c) 2011 The McBopomofo Project. -// -// Contributors: -// Mengjuei Hsieh (@mjhsieh) -// Weizhong Yang (@zonble) -// -// Based on the Syrup Project and the Formosana Library -// by Lukhnos Liu (@lukhnos). -// // 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 @@ -30,14 +20,20 @@ // 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. -// -#import -#import +#import -@interface AppIconRendererView : NSView { -// CGImageRef image; - NSImage *image; +@interface ArchiveUtil : NSObject { + NSString *_appName; + NSString *_targetAppBundleName; } +- (instancetype _Nonnull)initWithAppName:(NSString *_Nonnull)name + targetAppBundleName:(NSString *_Nonnull)invalidAppBundleName; +// Returns YES if (1) a zip file under +// Resources/NotarizedArchives/$_appName-$bundleVersion.zip exists, and (2) if +// Resources/$_invalidAppBundleName does not exist. +- (BOOL)validateIfNotarizedArchiveExists; + +- (NSString *_Nullable)unzipNotarizedArchive; @end diff --git a/Source/Installer/ArchiveUtil.m b/Source/Installer/ArchiveUtil.m new file mode 100644 index 00000000..90d47e35 --- /dev/null +++ b/Source/Installer/ArchiveUtil.m @@ -0,0 +1,132 @@ +// Copyright (c) 2011-2019 The McBopomofo Project. +// +// 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. + +#import "ArchiveUtil.h" + +@implementation ArchiveUtil +- (instancetype)initWithAppName:(NSString *)name + targetAppBundleName:(NSString *)targetAppBundleName { + self = [super init]; + if (self) { + _appName = name; + _targetAppBundleName = targetAppBundleName; + } + return self; +} + +- (void)delloc { + _appName = nil; + _targetAppBundleName = nil; +} + +- (BOOL)validateIfNotarizedArchiveExists { + NSString *resourePath = [[NSBundle mainBundle] resourcePath]; + NSString *devModeAppBundlePath = + [resourePath stringByAppendingPathComponent:_targetAppBundleName]; + + NSArray *notarizedArchivesContent = + [[NSFileManager defaultManager] subpathsAtPath:[self notarizedArchivesPath]]; + NSInteger count = [notarizedArchivesContent count]; + BOOL notarizedArchiveExists = + [[NSFileManager defaultManager] fileExistsAtPath:[self notarizedArchive]]; + BOOL devModeAppBundleExists = + [[NSFileManager defaultManager] fileExistsAtPath:devModeAppBundlePath]; + + if (count > 0) { + // Not a valid distribution package. + if (count != 1 || !notarizedArchiveExists || devModeAppBundleExists) { + NSAlert *alert = [[NSAlert alloc] init]; + [alert setAlertStyle:NSAlertStyleInformational]; + [alert setMessageText:@"Internal Error"]; + [alert + setInformativeText: + [NSString stringWithFormat:@"devMode installer, expected archive name: %@, " + @"archive exists: %d, devMode app bundle exists: %d", + [self notarizedArchive], notarizedArchiveExists, + devModeAppBundleExists]]; + [alert addButtonWithTitle:@"Terminate"]; + [alert runModal]; + + [[NSApplication sharedApplication] terminate:nil]; + } else { + return YES; + } + } + + if (!devModeAppBundleExists) { + NSAlert *alert = [[NSAlert alloc] init]; + [alert setAlertStyle:NSAlertStyleInformational]; + [alert setMessageText:@"Internal Error"]; + [alert + setInformativeText:[NSString stringWithFormat:@"Dev target bundle does not exist: %@", + devModeAppBundlePath]]; + [alert addButtonWithTitle:@"Terminate"]; + [alert runModal]; + [[NSApplication sharedApplication] terminate:nil]; + } + + // Notarized archive does not exist, but it's ok. + return NO; +} + +- (NSString *)unzipNotarizedArchive { + if (![self validateIfNotarizedArchiveExists]) { + return nil; + } + + NSString *tempFilePath = + [NSTemporaryDirectory() stringByAppendingPathComponent:[[NSUUID UUID] UUIDString]]; + NSArray *arguments = @[ [self notarizedArchive], @"-d", tempFilePath ]; + + NSTask *unzipTask = [[NSTask alloc] init]; + [unzipTask setLaunchPath:@"/usr/bin/unzip"]; + [unzipTask setCurrentDirectoryPath:[[NSBundle mainBundle] resourcePath]]; + [unzipTask setArguments:arguments]; + [unzipTask launch]; + [unzipTask waitUntilExit]; + + NSAssert(unzipTask.terminationStatus == 0, @"Must successfully unzipped"); + + NSString *result = [tempFilePath stringByAppendingPathComponent:_targetAppBundleName]; + NSAssert([[NSFileManager defaultManager] fileExistsAtPath:result], + @"App bundle must be unzipped at %@", result); + return result; +} + +- (NSString *)notarizedArchivesPath { + NSString *resourePath = [[NSBundle mainBundle] resourcePath]; + NSString *notarizedArchivesPath = + [resourePath stringByAppendingPathComponent:@"NotarizedArchives"]; + return notarizedArchivesPath; +} + +- (NSString *)notarizedArchive { + NSString *bundleVersion = + [[[NSBundle mainBundle] infoDictionary] objectForKey:(id)kCFBundleVersionKey]; + NSString *notarizedArchiveBasename = + [NSString stringWithFormat:@"%@-r%@.zip", _appName, bundleVersion]; + NSString *notarizedArchive = + [[self notarizedArchivesPath] stringByAppendingPathComponent:notarizedArchiveBasename]; + return notarizedArchive; +} +@end diff --git a/Source/Installer/en.lproj/MainMenu.xib b/Source/Installer/Base.lproj/MainMenu.xib similarity index 91% rename from Source/Installer/en.lproj/MainMenu.xib rename to Source/Installer/Base.lproj/MainMenu.xib index 3ced5670..000f018d 100644 --- a/Source/Installer/en.lproj/MainMenu.xib +++ b/Source/Installer/Base.lproj/MainMenu.xib @@ -1,8 +1,8 @@ - + - - + + @@ -12,7 +12,7 @@ - + @@ -94,20 +94,20 @@ - + - + - + + - + -