diff --git a/Source/Installer/AppDelegate.swift b/Installer/AppDelegate.swift similarity index 100% rename from Source/Installer/AppDelegate.swift rename to Installer/AppDelegate.swift diff --git a/Source/Installer/ArchiveUtil.swift b/Installer/ArchiveUtil.swift similarity index 100% rename from Source/Installer/ArchiveUtil.swift rename to Installer/ArchiveUtil.swift diff --git a/Source/Installer/Chronosphere.h b/Installer/Chronosphere.h similarity index 100% rename from Source/Installer/Chronosphere.h rename to Installer/Chronosphere.h diff --git a/Source/Installer/Chronosphere.m b/Installer/Chronosphere.m similarity index 100% rename from Source/Installer/Chronosphere.m rename to Installer/Chronosphere.m diff --git a/Source/Installer/Installer-Info.plist b/Installer/Installer-Info.plist similarity index 93% rename from Source/Installer/Installer-Info.plist rename to Installer/Installer-Info.plist index 083859b0..4f418f3e 100644 --- a/Source/Installer/Installer-Info.plist +++ b/Installer/Installer-Info.plist @@ -2,8 +2,6 @@ - CFEULAContent - License texts used in the customized about window. CFBundleDevelopmentRegion en CFBundleExecutable @@ -17,11 +15,13 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.2.0 + $(MARKETING_VERSION) CFBundleSignature MBIN CFBundleVersion - 893 + $(CURRENT_PROJECT_VERSION) + CFEULAContent + License texts used in the customized about window. LSApplicationCategoryType public.app-category.utilities LSHasLocalizedDisplayName diff --git a/Source/Installer/Installer-Prefix.pch b/Installer/Installer-Prefix.pch similarity index 100% rename from Source/Installer/Installer-Prefix.pch rename to Installer/Installer-Prefix.pch diff --git a/Source/Installer/NotarizedArchives/README.md b/Installer/NotarizedArchives/README.md similarity index 100% rename from Source/Installer/NotarizedArchives/README.md rename to Installer/NotarizedArchives/README.md diff --git a/Source/Installer/Base.lproj/MainMenu.xib b/Installer/Resources/Base.lproj/MainMenu.xib similarity index 99% rename from Source/Installer/Base.lproj/MainMenu.xib rename to Installer/Resources/Base.lproj/MainMenu.xib index 965dfaf3..c78e887e 100644 --- a/Source/Installer/Base.lproj/MainMenu.xib +++ b/Installer/Resources/Base.lproj/MainMenu.xib @@ -91,7 +91,7 @@ - + diff --git a/Source/Installer/en.lproj/InfoPlist.strings b/Installer/Resources/en.lproj/InfoPlist.strings similarity index 100% rename from Source/Installer/en.lproj/InfoPlist.strings rename to Installer/Resources/en.lproj/InfoPlist.strings diff --git a/Source/Installer/en.lproj/Localizable.strings b/Installer/Resources/en.lproj/Localizable.strings similarity index 100% rename from Source/Installer/en.lproj/Localizable.strings rename to Installer/Resources/en.lproj/Localizable.strings diff --git a/Source/Installer/en.lproj/MainMenu.strings b/Installer/Resources/en.lproj/MainMenu.strings similarity index 95% rename from Source/Installer/en.lproj/MainMenu.strings rename to Installer/Resources/en.lproj/MainMenu.strings index 61361985..4a3f46d6 100644 --- a/Source/Installer/en.lproj/MainMenu.strings +++ b/Installer/Resources/en.lproj/MainMenu.strings @@ -56,8 +56,8 @@ /* Class = "NSTextFieldCell"; title = "Derived from OpenVanilla McBopopmofo Project."; ObjectID = "QYf-Nf-hoi"; */ "QYf-Nf-hoi.title" = "Derived from OpenVanilla McBopopmofo Project."; -/* Class = "NSTextFieldCell"; title = "McBopomofo Engine by Mengjuei Hsieh, Lukhnos Liu, Zonble Yang, et al.\nvChewing macOS Development Reinforced by Hiraku Wang.
vChewing Phrase Database Maintained by Shiki Suen."; ObjectID = "VW8-s5-Wpn"; */ -"VW8-s5-Wpn.title" = "McBopomofo Engine by Mengjuei Hsieh, Lukhnos Liu, Zonble Yang, et al.\nvChewing macOS Development Reinforced by Hiraku Wang.
vChewing Phrase Database Maintained by Shiki Suen."; +/* Class = "NSTextFieldCell"; title = "McBopomofo Engine by Mengjuei Hsieh, Lukhnos Liu, Zonble Yang, et al.\nvChewing macOS Development Reinforced by Hiraku Wang.\nvChewing Phrase Database Maintained by Shiki Suen."; ObjectID = "VW8-s5-Wpn"; */ +"VW8-s5-Wpn.title" = "McBopomofo Engine by Mengjuei Hsieh, Lukhnos Liu, Zonble Yang, et al.\nvChewing macOS Development Reinforced by Hiraku Wang.\nvChewing Phrase Database Maintained by Shiki Suen."; /* Class = "NSTextFieldCell"; title = "Placeholder for showing copyright information."; ObjectID = "eo3-TK-0rB"; */ // "eo3-TK-0rB.title" = "Placeholder for showing copyright information."; diff --git a/Source/Installer/ja.lproj/InfoPlist.strings b/Installer/Resources/ja.lproj/InfoPlist.strings similarity index 100% rename from Source/Installer/ja.lproj/InfoPlist.strings rename to Installer/Resources/ja.lproj/InfoPlist.strings diff --git a/Source/Installer/ja.lproj/Localizable.strings b/Installer/Resources/ja.lproj/Localizable.strings similarity index 100% rename from Source/Installer/ja.lproj/Localizable.strings rename to Installer/Resources/ja.lproj/Localizable.strings diff --git a/Source/Installer/ja.lproj/MainMenu.strings b/Installer/Resources/ja.lproj/MainMenu.strings similarity index 97% rename from Source/Installer/ja.lproj/MainMenu.strings rename to Installer/Resources/ja.lproj/MainMenu.strings index 5c86d3b6..8e72bb27 100644 --- a/Source/Installer/ja.lproj/MainMenu.strings +++ b/Installer/Resources/ja.lproj/MainMenu.strings @@ -56,7 +56,7 @@ /* Class = "NSTextFieldCell"; title = "Derived from OpenVanilla McBopopmofo Project."; ObjectID = "QYf-Nf-hoi"; */ "QYf-Nf-hoi.title" = "OpenVanilla 小麦注音プロジェクトから派生。"; -/* Class = "NSTextFieldCell"; title = "McBopomofo Engine by Mengjuei Hsieh, Lukhnos Liu, Zonble Yang, et al.\nvChewing macOS Development Reinforced by Hiraku Wang.
vChewing Phrase Database Maintained by Shiki Suen."; ObjectID = "VW8-s5-Wpn"; */ +/* Class = "NSTextFieldCell"; title = "McBopomofo Engine by Mengjuei Hsieh, Lukhnos Liu, Zonble Yang, et al.\nvChewing macOS Development Reinforced by Hiraku Wang.\nvChewing Phrase Database Maintained by Shiki Suen."; ObjectID = "VW8-s5-Wpn"; */ "VW8-s5-Wpn.title" = "小麦注音入力エンジン開発:Mengjuei Hsieh, Lukhnos Liu, Zonble Yang, など。\nmacOS 版の開発協力:Hiraku Wang。\n威注音語彙データの維持:孫志貴 (Shiki Suen)。"; /* Class = "NSTextFieldCell"; title = "Placeholder for showing copyright information."; ObjectID = "eo3-TK-0rB"; */ diff --git a/Source/Installer/zh-Hans.lproj/InfoPlist.strings b/Installer/Resources/zh-Hans.lproj/InfoPlist.strings similarity index 100% rename from Source/Installer/zh-Hans.lproj/InfoPlist.strings rename to Installer/Resources/zh-Hans.lproj/InfoPlist.strings diff --git a/Source/Installer/zh-Hans.lproj/Localizable.strings b/Installer/Resources/zh-Hans.lproj/Localizable.strings similarity index 100% rename from Source/Installer/zh-Hans.lproj/Localizable.strings rename to Installer/Resources/zh-Hans.lproj/Localizable.strings diff --git a/Source/Installer/zh-Hans.lproj/MainMenu.strings b/Installer/Resources/zh-Hans.lproj/MainMenu.strings similarity index 100% rename from Source/Installer/zh-Hans.lproj/MainMenu.strings rename to Installer/Resources/zh-Hans.lproj/MainMenu.strings diff --git a/Source/Installer/zh-Hant.lproj/InfoPlist.strings b/Installer/Resources/zh-Hant.lproj/InfoPlist.strings similarity index 100% rename from Source/Installer/zh-Hant.lproj/InfoPlist.strings rename to Installer/Resources/zh-Hant.lproj/InfoPlist.strings diff --git a/Source/Installer/zh-Hant.lproj/Localizable.strings b/Installer/Resources/zh-Hant.lproj/Localizable.strings similarity index 100% rename from Source/Installer/zh-Hant.lproj/Localizable.strings rename to Installer/Resources/zh-Hant.lproj/Localizable.strings diff --git a/Source/Installer/zh-Hant.lproj/MainMenu.strings b/Installer/Resources/zh-Hant.lproj/MainMenu.strings similarity index 100% rename from Source/Installer/zh-Hant.lproj/MainMenu.strings rename to Installer/Resources/zh-Hant.lproj/MainMenu.strings diff --git a/Source/vChewingInstaller-Bridging-Header.h b/Installer/vChewingInstaller-Bridging-Header.h similarity index 100% rename from Source/vChewingInstaller-Bridging-Header.h rename to Installer/vChewingInstaller-Bridging-Header.h diff --git a/Source/Beep.aif b/Source/Beep.aif deleted file mode 100644 index ba0f9895..00000000 Binary files a/Source/Beep.aif and /dev/null differ diff --git a/Source/Engine/LanguageModel/FastLM.h b/Source/Engine/LanguageModel/FastLM.h deleted file mode 100644 index aa94a005..00000000 --- a/Source/Engine/LanguageModel/FastLM.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * FastLM.h - * - * Copyright 2021-2022 vChewing Project (3-Clause BSD License). - * Derived from 2011-2022 OpenVanilla Project (MIT License). - * Some rights reserved. See "LICENSE.TXT" for details. - */ - -#ifndef FASTLM_H -#define FASTLM_H - -#include -#include -#include -#include "LanguageModel.h" - -// this class relies on the fact that we have a space-separated data -// format, and we use mmap and zero-out the separators and line feeds -// to avoid creating new string objects; the parser is a simple DFA - -namespace Taiyan { - namespace Gramambular { - class FastLM : public LanguageModel - { - public: - FastLM(); - ~FastLM(); - - bool open(const char *path); - void close(); - void dump(); - - virtual const vector bigramsForKeys(const string& preceedingKey, const string& key); - virtual const vector unigramsForKey(const string& key); - virtual bool hasUnigramsForKey(const string& key); - - protected: - struct CStringCmp - { - bool operator()(const char* s1, const char* s2) const - { - return strcmp(s1, s2) < 0; - } - }; - - struct Row { - const char *key; - const char *value; - const char *logProbability; - }; - - map, CStringCmp> keyRowMap; - int fd; - void *data; - size_t length; - }; - - } -} - -#endif diff --git a/Source/Fart.aif b/Source/Fart.aif deleted file mode 100644 index 84c06b39..00000000 Binary files a/Source/Fart.aif and /dev/null differ diff --git a/Source/vChewing-Bridging-Header.h b/Source/Headers/vChewing-Bridging-Header.h similarity index 93% rename from Source/vChewing-Bridging-Header.h rename to Source/Headers/vChewing-Bridging-Header.h index 19b78ffd..b3646929 100644 --- a/Source/vChewing-Bridging-Header.h +++ b/Source/Headers/vChewing-Bridging-Header.h @@ -12,7 +12,7 @@ #import // @import Foundation; #import "SSZipArchive.h" // Zip Archive Support; -@interface LanguageModelManager : NSObject +@interface mgrLangModel : NSObject + (void)loadDataModels; + (void)loadCNSData; + (void)loadUserPhrases; diff --git a/Source/vChewing-Prefix.pch b/Source/Headers/vChewing-Prefix.pch similarity index 100% rename from Source/vChewing-Prefix.pch rename to Source/Headers/vChewing-Prefix.pch diff --git a/Source/Images/Bopomofo.tiff b/Source/Images/Bopomofo.tiff deleted file mode 100644 index 4d1ada39..00000000 Binary files a/Source/Images/Bopomofo.tiff and /dev/null differ diff --git a/Source/Images/Bopomofo@2x.tiff b/Source/Images/Bopomofo@2x.tiff deleted file mode 100644 index bc497561..00000000 Binary files a/Source/Images/Bopomofo@2x.tiff and /dev/null differ diff --git a/Source/Images/SimpBopomofo.tiff b/Source/Images/SimpBopomofo.tiff deleted file mode 100644 index 3a73e585..00000000 Binary files a/Source/Images/SimpBopomofo.tiff and /dev/null differ diff --git a/Source/Images/SimpBopomofo@2x.tiff b/Source/Images/SimpBopomofo@2x.tiff deleted file mode 100644 index 49695293..00000000 Binary files a/Source/Images/SimpBopomofo@2x.tiff and /dev/null differ diff --git a/Source/AppDelegate.swift b/Source/Modules/AppDelegate.swift similarity index 81% rename from Source/AppDelegate.swift rename to Source/Modules/AppDelegate.swift index 02f4d82a..21222298 100644 --- a/Source/AppDelegate.swift +++ b/Source/Modules/AppDelegate.swift @@ -128,27 +128,27 @@ struct VersionUpdateApi { } @objc(AppDelegate) -class AppDelegate: NSObject, NSApplicationDelegate, NonModalAlertWindowControllerDelegate, FSEventStreamHelperDelegate { +class AppDelegate: NSObject, NSApplicationDelegate, ctlNonModalAlertWindowDelegate, FSEventStreamHelperDelegate { func helper(_ helper: FSEventStreamHelper, didReceive events: [FSEventStreamHelper.Event]) { DispatchQueue.main.async { if Preferences.shouldAutoReloadUserDataFiles { - LanguageModelManager.loadUserPhrases() - LanguageModelManager.loadUserPhraseReplacement() + mgrLangModel.loadUserPhrases() + mgrLangModel.loadUserPhraseReplacement() } } } @IBOutlet weak var window: NSWindow? - private var preferencesWindowController: PreferencesWindowController? - private var aboutWindowController: frmAboutWindow? // New About Window + private var ctlPrefWindowInstance: ctlPrefWindow? + private var ctlAboutWindowInstance: ctlAboutWindow? // New About Window private var checkTask: URLSessionTask? private var updateNextStepURL: URL? - private var fsStreamHelper = FSEventStreamHelper(path: LanguageModelManager.dataFolderPath, queue: DispatchQueue(label: "User Phrases")) + private var fsStreamHelper = FSEventStreamHelper(path: mgrLangModel.dataFolderPath, queue: DispatchQueue(label: "User Phrases")) // 補上 dealloc deinit { - preferencesWindowController = nil - aboutWindowController = nil + ctlPrefWindowInstance = nil + ctlAboutWindowInstance = nil checkTask = nil updateNextStepURL = nil fsStreamHelper.stop() @@ -156,10 +156,10 @@ class AppDelegate: NSObject, NSApplicationDelegate, NonModalAlertWindowControlle } func applicationDidFinishLaunching(_ notification: Notification) { - LanguageModelManager.loadDataModels() - LanguageModelManager.loadCNSData() - LanguageModelManager.loadUserPhrases() - LanguageModelManager.loadUserPhraseReplacement() + mgrLangModel.loadDataModels() + mgrLangModel.loadCNSData() + mgrLangModel.loadUserPhrases() + mgrLangModel.loadUserPhraseReplacement() fsStreamHelper.delegate = self _ = fsStreamHelper.start() @@ -172,20 +172,20 @@ class AppDelegate: NSObject, NSApplicationDelegate, NonModalAlertWindowControlle } @objc func showPreferences() { - if (preferencesWindowController == nil) { - preferencesWindowController = PreferencesWindowController(windowNibName: "preferences") + if (ctlPrefWindowInstance == nil) { + ctlPrefWindowInstance = ctlPrefWindow.init(windowNibName: "frmPrefWindow") } - preferencesWindowController?.window?.center() - preferencesWindowController?.window?.orderFrontRegardless() // 逼著屬性視窗往最前方顯示 + ctlPrefWindowInstance?.window?.center() + ctlPrefWindowInstance?.window?.orderFrontRegardless() // 逼著屬性視窗往最前方顯示 } // New About Window @objc func showAbout() { - if (aboutWindowController == nil) { - aboutWindowController = frmAboutWindow.init(windowNibName: "frmAboutWindow") + if (ctlAboutWindowInstance == nil) { + ctlAboutWindowInstance = ctlAboutWindow.init(windowNibName: "frmAboutWindow") } - aboutWindowController?.window?.center() - aboutWindowController?.window?.orderFrontRegardless() // 逼著關於視窗往最前方顯示 + ctlAboutWindowInstance?.window?.center() + ctlAboutWindowInstance?.window?.orderFrontRegardless() // 逼著關於視窗往最前方顯示 } @objc(checkForUpdate) @@ -231,7 +231,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NonModalAlertWindowControlle report.remoteShortVersion, report.remoteVersion, report.versionDescription) - NonModalAlertWindowController.shared.show(title: NSLocalizedString("New Version Available", comment: ""), content: content, confirmButtonTitle: NSLocalizedString("Visit Website", comment: ""), cancelButtonTitle: NSLocalizedString("Not Now", comment: ""), cancelAsDefault: false, delegate: self) + ctlNonModalAlertWindow.shared.show(title: NSLocalizedString("New Version Available", comment: ""), content: content, confirmButtonTitle: NSLocalizedString("Visit Website", comment: ""), cancelButtonTitle: NSLocalizedString("Not Now", comment: ""), cancelAsDefault: false, delegate: self) case .noNeedToUpdate, .ignored: break } @@ -241,7 +241,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NonModalAlertWindowControlle let title = NSLocalizedString("Update Check Failed", comment: "") let content = String(format: NSLocalizedString("There may be no internet connection or the server failed to respond.\n\nError message: %@", comment: ""), message) let buttonTitle = NSLocalizedString("Dismiss", comment: "") - NonModalAlertWindowController.shared.show(title: title, content: content, confirmButtonTitle: buttonTitle, cancelButtonTitle: nil, cancelAsDefault: false, delegate: nil) + ctlNonModalAlertWindow.shared.show(title: title, content: content, confirmButtonTitle: buttonTitle, cancelButtonTitle: nil, cancelAsDefault: false, delegate: nil) default: break } @@ -249,14 +249,14 @@ class AppDelegate: NSObject, NSApplicationDelegate, NonModalAlertWindowControlle } } - func nonModalAlertWindowControllerDidConfirm(_ controller: NonModalAlertWindowController) { + func ctlNonModalAlertWindowDidConfirm(_ controller: ctlNonModalAlertWindow) { if let updateNextStepURL = updateNextStepURL { NSWorkspace.shared.open(updateNextStepURL) } updateNextStepURL = nil } - func nonModalAlertWindowControllerDidCancel(_ controller: NonModalAlertWindowController) { + func ctlNonModalAlertWindowDidCancel(_ controller: ctlNonModalAlertWindow) { updateNextStepURL = nil } diff --git a/Source/Engine/ControllerModules/InputState.swift b/Source/Modules/ControllerModules/InputState.swift similarity index 100% rename from Source/Engine/ControllerModules/InputState.swift rename to Source/Modules/ControllerModules/InputState.swift diff --git a/Source/Engine/ControllerModules/KeyHandler.h b/Source/Modules/ControllerModules/KeyHandler.h similarity index 100% rename from Source/Engine/ControllerModules/KeyHandler.h rename to Source/Modules/ControllerModules/KeyHandler.h diff --git a/Source/Engine/ControllerModules/KeyHandler.mm b/Source/Modules/ControllerModules/KeyHandler.mm similarity index 98% rename from Source/Engine/ControllerModules/KeyHandler.mm rename to Source/Modules/ControllerModules/KeyHandler.mm index 4602bfde..ba459544 100644 --- a/Source/Engine/ControllerModules/KeyHandler.mm +++ b/Source/Modules/ControllerModules/KeyHandler.mm @@ -10,7 +10,7 @@ #import "Gramambular.h" #import "vChewingLM.h" #import "UserOverrideModel.h" -#import "LanguageModelManager.h" +#import "mgrLangModel.h" #import "KeyHandler.h" #import "vChewing-Swift.h" @@ -87,12 +87,12 @@ static NSString *const kGraphVizOutputfile = @"/tmp/vChewing-visualization.dot"; if ([value isKindOfClass:[NSString class]] && [value isEqual:kBopomofoModeIdentifierCHS]) { newInputMode = kBopomofoModeIdentifierCHS; - newLanguageModel = [LanguageModelManager languageModelCoreCHS]; - newUserOverrideModel = [LanguageModelManager userOverrideModelCHS]; + newLanguageModel = [mgrLangModel languageModelCoreCHS]; + newUserOverrideModel = [mgrLangModel userOverrideModelCHS]; } else { newInputMode = kBopomofoModeIdentifierCHT; - newLanguageModel = [LanguageModelManager languageModelCoreCHT]; - newUserOverrideModel = [LanguageModelManager userOverrideModelCHT]; + newLanguageModel = [mgrLangModel languageModelCoreCHT]; + newUserOverrideModel = [mgrLangModel userOverrideModelCHT]; } // 自 Preferences 模組讀入自訂語彙置換功能開關狀態。 @@ -140,10 +140,10 @@ static NSString *const kGraphVizOutputfile = @"/tmp/vChewing-visualization.dot"; _bpmfReadingBuffer = new BopomofoReadingBuffer(BopomofoKeyboardLayout::StandardLayout()); // create the lattice builder - _languageModel = [LanguageModelManager languageModelCoreCHT]; + _languageModel = [mgrLangModel languageModelCoreCHT]; _languageModel->setPhraseReplacementEnabled(Preferences.phraseReplacementEnabled); _languageModel->setCNSEnabled(Preferences.cns11643Enabled); - _userOverrideModel = [LanguageModelManager userOverrideModelCHT]; + _userOverrideModel = [mgrLangModel userOverrideModelCHT]; _builder = new BlockReadingBuilder(_languageModel); diff --git a/Source/Engine/ControllerModules/KeyHandlerInput.swift b/Source/Modules/ControllerModules/KeyHandlerInput.swift similarity index 100% rename from Source/Engine/ControllerModules/KeyHandlerInput.swift rename to Source/Modules/ControllerModules/KeyHandlerInput.swift diff --git a/Source/Engine/ControllerModules/KeyValueBlobReader.cpp b/Source/Modules/ControllerModules/KeyValueBlobReader.cpp similarity index 100% rename from Source/Engine/ControllerModules/KeyValueBlobReader.cpp rename to Source/Modules/ControllerModules/KeyValueBlobReader.cpp diff --git a/Source/Engine/ControllerModules/KeyValueBlobReader.h b/Source/Modules/ControllerModules/KeyValueBlobReader.h similarity index 100% rename from Source/Engine/ControllerModules/KeyValueBlobReader.h rename to Source/Modules/ControllerModules/KeyValueBlobReader.h diff --git a/Source/Engine/ControllerModules/StringUtils.swift b/Source/Modules/ControllerModules/StringUtils.swift similarity index 100% rename from Source/Engine/ControllerModules/StringUtils.swift rename to Source/Modules/ControllerModules/StringUtils.swift diff --git a/Source/Engine/LanguageModel/FSEventStreamHelper.swift b/Source/Modules/FileHandlers/FSEventStreamHelper.swift similarity index 100% rename from Source/Engine/LanguageModel/FSEventStreamHelper.swift rename to Source/Modules/FileHandlers/FSEventStreamHelper.swift diff --git a/Source/Engine/LanguageModel/LMConsolidator.h b/Source/Modules/FileHandlers/LMConsolidator.h similarity index 100% rename from Source/Engine/LanguageModel/LMConsolidator.h rename to Source/Modules/FileHandlers/LMConsolidator.h diff --git a/Source/Engine/LanguageModel/LMConsolidator.mm b/Source/Modules/FileHandlers/LMConsolidator.mm similarity index 100% rename from Source/Engine/LanguageModel/LMConsolidator.mm rename to Source/Modules/FileHandlers/LMConsolidator.mm diff --git a/Source/InputSourceHelper.swift b/Source/Modules/IMEModules/InputSourceHelper.swift similarity index 100% rename from Source/InputSourceHelper.swift rename to Source/Modules/IMEModules/InputSourceHelper.swift diff --git a/Source/OpenCCBridge.swift b/Source/Modules/IMEModules/OpenCCBridge.swift similarity index 100% rename from Source/OpenCCBridge.swift rename to Source/Modules/IMEModules/OpenCCBridge.swift diff --git a/Source/PreferencesModule.swift b/Source/Modules/IMEModules/PreferencesModule.swift similarity index 100% rename from Source/PreferencesModule.swift rename to Source/Modules/IMEModules/PreferencesModule.swift diff --git a/Source/InputMethodController.h b/Source/Modules/IMEModules/ctlInputMethod.h similarity index 79% rename from Source/InputMethodController.h rename to Source/Modules/IMEModules/ctlInputMethod.h index 3ae0fe35..dad41093 100644 --- a/Source/InputMethodController.h +++ b/Source/Modules/IMEModules/ctlInputMethod.h @@ -1,5 +1,5 @@ /* - * InputMethodController.h + * ctlInputMethod.h * * Copyright 2021-2022 vChewing Project (3-Clause BSD License). * Derived from 2011-2022 OpenVanilla Project (MIT License). @@ -10,6 +10,6 @@ #import #import "vChewing-Swift.h" -@interface vChewingInputMethodController : IMKInputController +@interface ctlInputMethod : IMKInputController - (void)handleState:(InputState *)newState client:(id)client; @end diff --git a/Source/InputMethodController.mm b/Source/Modules/IMEModules/ctlInputMethod.mm similarity index 91% rename from Source/InputMethodController.mm rename to Source/Modules/IMEModules/ctlInputMethod.mm index 439a054a..2d927b27 100644 --- a/Source/InputMethodController.mm +++ b/Source/Modules/IMEModules/ctlInputMethod.mm @@ -1,5 +1,5 @@ /* - * InputMethodController.mm + * ctlInputMethod.mm * * Copyright 2021-2022 vChewing Project (3-Clause BSD License). * Derived from 2011-2022 OpenVanilla Project (MIT License). @@ -7,9 +7,9 @@ */ #import "vChewingLM.h" -#import "InputMethodController.h" +#import "ctlInputMethod.h" #import "KeyHandler.h" -#import "LanguageModelManager.h" +#import "mgrLangModel.h" using namespace std; using namespace vChewing; @@ -23,7 +23,7 @@ static inline NSString *LocalizationNotNeeded(NSString *s) { return s; } -@interface vChewingInputMethodController () +@interface ctlInputMethod () { // the current text input client; we need to keep this when candidate panel is on id _currentCandidateClient; @@ -36,13 +36,13 @@ static inline NSString *LocalizationNotNeeded(NSString *s) { } @end -@interface vChewingInputMethodController (VTCandidateController) +@interface ctlInputMethod (VTCandidateController) @end -@interface vChewingInputMethodController (KeyHandlerDelegate) +@interface ctlInputMethod (KeyHandlerDelegate) @end -@interface vChewingInputMethodController (UI) +@interface ctlInputMethod (UI) + (VTHorizontalCandidateController *)horizontalCandidateController; + (VTVerticalCandidateController *)verticalCandidateController; + (TooltipController *)tooltipController; @@ -50,7 +50,7 @@ static inline NSString *LocalizationNotNeeded(NSString *s) { - (void)_hideTooltip; @end -@implementation vChewingInputMethodController +@implementation ctlInputMethod - (id)initWithServer:(IMKServer *)server delegate:(id)delegate client:(id)client { @@ -398,11 +398,11 @@ static inline NSString *LocalizationNotNeeded(NSString *s) { BOOL useVerticalMode = state.useVerticalMode; if (useVerticalMode) { - gCurrentCandidateController = [vChewingInputMethodController verticalCandidateController]; + gCurrentCandidateController = [ctlInputMethod verticalCandidateController]; } else if (Preferences.useHorizontalCandidateList) { - gCurrentCandidateController = [vChewingInputMethodController horizontalCandidateController]; + gCurrentCandidateController = [ctlInputMethod horizontalCandidateController]; } else { - gCurrentCandidateController = [vChewingInputMethodController verticalCandidateController]; + gCurrentCandidateController = [ctlInputMethod verticalCandidateController]; } // set the attributes for the candidate panel (which uses NSAttributedString) @@ -495,19 +495,19 @@ static inline NSString *LocalizationNotNeeded(NSString *s) { - (void)togglePhraseReplacementEnabled:(id)sender { if (_keyHandler.inputMode == kBopomofoModeIdentifierCHT){ - [LanguageModelManager languageModelCoreCHT]->setPhraseReplacementEnabled([Preferences togglePhraseReplacementEnabled]); + [mgrLangModel languageModelCoreCHT]->setPhraseReplacementEnabled([Preferences togglePhraseReplacementEnabled]); } else { - [LanguageModelManager languageModelCoreCHS]->setPhraseReplacementEnabled([Preferences togglePhraseReplacementEnabled]); + [mgrLangModel languageModelCoreCHS]->setPhraseReplacementEnabled([Preferences togglePhraseReplacementEnabled]); } } - (void)toggleCNS11643Enabled:(id)sender { if (_keyHandler.inputMode == kBopomofoModeIdentifierCHT){ - [LanguageModelManager languageModelCoreCHT]->setCNSEnabled([Preferences toggleCNS11643Enabled]); + [mgrLangModel languageModelCoreCHT]->setCNSEnabled([Preferences toggleCNS11643Enabled]); } else { - [LanguageModelManager languageModelCoreCHS]->setCNSEnabled([Preferences toggleCNS11643Enabled]); + [mgrLangModel languageModelCoreCHS]->setCNSEnabled([Preferences toggleCNS11643Enabled]); } // 注意上面這一行已經動過開關了,所以接下來就不要 toggle。 [NotifierController notifyWithMessage:[NSString stringWithFormat:@"%@%@%@", NSLocalizedString(@"CNS11643 Mode", @""), @"\n", [Preferences cns11643Enabled] ? NSLocalizedString(@"NotificationSwitchON", @"") : NSLocalizedString(@"NotificationSwitchOFF", @"")] stay:NO]; @@ -526,9 +526,9 @@ static inline NSString *LocalizationNotNeeded(NSString *s) { - (BOOL)_checkUserFiles { - if (![LanguageModelManager checkIfUserLanguageModelFilesExist]) { - NSString *content = [NSString stringWithFormat:NSLocalizedString(@"Please check the permission of at \"%@\".", @""), [LanguageModelManager dataFolderPath]]; - [[NonModalAlertWindowController sharedInstance] showWithTitle:NSLocalizedString(@"Unable to create the user phrase file.", @"") content:content confirmButtonTitle:NSLocalizedString(@"OK", @"") cancelButtonTitle:nil cancelAsDefault:NO delegate:nil]; + if (![mgrLangModel checkIfUserLanguageModelFilesExist]) { + NSString *content = [NSString stringWithFormat:NSLocalizedString(@"Please check the permission of at \"%@\".", @""), [mgrLangModel dataFolderPath]]; + [[ctlNonModalAlertWindow sharedInstance] showWithTitle:NSLocalizedString(@"Unable to create the user phrase file.", @"") content:content confirmButtonTitle:NSLocalizedString(@"OK", @"") cancelButtonTitle:nil cancelAsDefault:NO delegate:nil]; return NO; } @@ -545,23 +545,23 @@ static inline NSString *LocalizationNotNeeded(NSString *s) { - (void)openUserPhrases:(id)sender { - [self _openUserFile:[LanguageModelManager userPhrasesDataPath:_keyHandler.inputMode]]; + [self _openUserFile:[mgrLangModel userPhrasesDataPath:_keyHandler.inputMode]]; } - (void)openExcludedPhrases:(id)sender { - [self _openUserFile:[LanguageModelManager excludedPhrasesDataPath:_keyHandler.inputMode]]; + [self _openUserFile:[mgrLangModel excludedPhrasesDataPath:_keyHandler.inputMode]]; } - (void)openPhraseReplacement:(id)sender { - [self _openUserFile:[LanguageModelManager phraseReplacementDataPath:_keyHandler.inputMode]]; + [self _openUserFile:[mgrLangModel phraseReplacementDataPath:_keyHandler.inputMode]]; } - (void)reloadUserPhrases:(id)sender { - [LanguageModelManager loadUserPhrases]; - [LanguageModelManager loadUserPhraseReplacement]; + [mgrLangModel loadUserPhrases]; + [mgrLangModel loadUserPhraseReplacement]; } - (void)showAbout:(id)sender @@ -575,7 +575,7 @@ static inline NSString *LocalizationNotNeeded(NSString *s) { #pragma mark - Voltaire -@implementation vChewingInputMethodController (VTCandidateController) +@implementation ctlInputMethod (VTCandidateController) - (NSUInteger)candidateCountForController:(VTCandidateController *)controller { @@ -623,7 +623,7 @@ static inline NSString *LocalizationNotNeeded(NSString *s) { #pragma mark - Implementation -@implementation vChewingInputMethodController (KeyHandlerDelegate) +@implementation ctlInputMethod (KeyHandlerDelegate) - (nonnull VTCandidateController *)candidateControllerForKeyHandler:(nonnull KeyHandler *)keyHandler { @@ -636,7 +636,7 @@ static inline NSString *LocalizationNotNeeded(NSString *s) { return NO; } NSString *userPhrase = state.userPhrase; - return [LanguageModelManager writeUserPhrase:userPhrase inputMode:_keyHandler.inputMode]; + return [mgrLangModel writeUserPhrase:userPhrase inputMode:_keyHandler.inputMode]; return YES; } @@ -648,7 +648,7 @@ static inline NSString *LocalizationNotNeeded(NSString *s) { @end -@implementation vChewingInputMethodController (UI) +@implementation ctlInputMethod (UI) + (VTHorizontalCandidateController *)horizontalCandidateController { @@ -701,13 +701,13 @@ static inline NSString *LocalizationNotNeeded(NSString *s) { NSLog(@"%@", exception); } - [[vChewingInputMethodController tooltipController] showTooltip:tooltip atPoint:lineHeightRect.origin]; + [[ctlInputMethod tooltipController] showTooltip:tooltip atPoint:lineHeightRect.origin]; } - (void)_hideTooltip { - if ([vChewingInputMethodController tooltipController].window.isVisible) { - [[vChewingInputMethodController tooltipController] hide]; + if ([ctlInputMethod tooltipController].window.isVisible) { + [[ctlInputMethod tooltipController] hide]; } } diff --git a/Source/Engine/LanguageModel/CNSLM.h b/Source/Modules/LangModelRelated/SubLanguageModels/CNSLM.h similarity index 100% rename from Source/Engine/LanguageModel/CNSLM.h rename to Source/Modules/LangModelRelated/SubLanguageModels/CNSLM.h diff --git a/Source/Engine/LanguageModel/CNSLM.mm b/Source/Modules/LangModelRelated/SubLanguageModels/CNSLM.mm similarity index 100% rename from Source/Engine/LanguageModel/CNSLM.mm rename to Source/Modules/LangModelRelated/SubLanguageModels/CNSLM.mm diff --git a/Source/Modules/LangModelRelated/SubLanguageModels/CoreLM.h b/Source/Modules/LangModelRelated/SubLanguageModels/CoreLM.h new file mode 100644 index 00000000..9261b304 --- /dev/null +++ b/Source/Modules/LangModelRelated/SubLanguageModels/CoreLM.h @@ -0,0 +1,64 @@ +/* + * CoreLM.hh + * + * Copyright 2021-2022 vChewing Project (3-Clause BSD License). + * Derived from 2011-2022 OpenVanilla Project (MIT License). + * Some rights reserved. See "LICENSE.TXT" for details. + */ + +#ifndef CoreLM_H +#define CoreLM_H + +#include "LanguageModel.h" +#include +#include +#include +#include + +// this class relies on the fact that we have a space-separated data +// format, and we use mmap and zero-out the separators and line feeds +// to avoid creating new string objects; the parser is a simple DFA + +using namespace std; +using namespace Taiyan::Gramambular; + +namespace vChewing { + +class CoreLM : public Taiyan::Gramambular::LanguageModel { +public: + CoreLM(); + ~CoreLM(); + + bool isLoaded(); + bool open(const char *path); + void close(); + void dump(); + + virtual const vector bigramsForKeys(const string& preceedingKey, const string& key); + virtual const vector unigramsForKey(const string& key); + virtual bool hasUnigramsForKey(const string& key); + +protected: + struct CStringCmp + { + bool operator()(const char* s1, const char* s2) const + { + return strcmp(s1, s2) < 0; + } + }; + + struct Row { + const char *key; + const char *value; + const char *logProbability; + }; + + map, CStringCmp> keyRowMap; + int fd; + void *data; + size_t length; +}; + +}; // namespace vChewing + +#endif diff --git a/Source/Engine/LanguageModel/FastLM.mm b/Source/Modules/LangModelRelated/SubLanguageModels/CoreLM.mm similarity index 90% rename from Source/Engine/LanguageModel/FastLM.mm rename to Source/Modules/LangModelRelated/SubLanguageModels/CoreLM.mm index fc90914b..d5900fde 100644 --- a/Source/Engine/LanguageModel/FastLM.mm +++ b/Source/Modules/LangModelRelated/SubLanguageModels/CoreLM.mm @@ -1,12 +1,12 @@ -/* - * FastLM.mm - * +/* + * CoreLM.mm + * * Copyright 2021-2022 vChewing Project (3-Clause BSD License). * Derived from 2011-2022 OpenVanilla Project (MIT License). * Some rights reserved. See "LICENSE.TXT" for details. */ -#include "FastLM.h" +#include "CoreLM.h" #include #include #include @@ -16,21 +16,29 @@ using namespace Taiyan::Gramambular; -FastLM::FastLM() +vChewing::CoreLM::CoreLM() : fd(-1) , data(0) , length(0) { } -FastLM::~FastLM() +vChewing::CoreLM::~CoreLM() { if (data) { close(); } } -bool FastLM::open(const char *path) +bool vChewing::CoreLM::isLoaded() +{ + if (data) { + return true; + } + return false; +} + +bool vChewing::CoreLM::open(const char *path) { if (data) { return false; @@ -238,7 +246,7 @@ end: return true; } -void FastLM::close() +void vChewing::CoreLM::close() { if (data) { munmap(data, length); @@ -249,7 +257,7 @@ void FastLM::close() keyRowMap.clear(); } -void FastLM::dump() +void vChewing::CoreLM::dump() { size_t rows = 0; for (map >::const_iterator i = keyRowMap.begin(), e = keyRowMap.end(); i != e; ++i) { @@ -262,12 +270,12 @@ void FastLM::dump() } } -const vector FastLM::bigramsForKeys(const string& preceedingKey, const string& key) +const vector vChewing::CoreLM::bigramsForKeys(const string& preceedingKey, const string& key) { return vector(); } -const vector FastLM::unigramsForKey(const string& key) +const vector vChewing::CoreLM::unigramsForKey(const string& key) { vector v; map >::const_iterator i = keyRowMap.find(key.c_str()); @@ -286,7 +294,7 @@ const vector FastLM::unigramsForKey(const string& key) return v; } -bool FastLM::hasUnigramsForKey(const string& key) +bool vChewing::CoreLM::hasUnigramsForKey(const string& key) { return keyRowMap.find(key.c_str()) != keyRowMap.end(); } diff --git a/Source/Engine/LanguageModel/PhraseReplacementMap.h b/Source/Modules/LangModelRelated/SubLanguageModels/PhraseReplacementMap.h similarity index 100% rename from Source/Engine/LanguageModel/PhraseReplacementMap.h rename to Source/Modules/LangModelRelated/SubLanguageModels/PhraseReplacementMap.h diff --git a/Source/Engine/LanguageModel/PhraseReplacementMap.mm b/Source/Modules/LangModelRelated/SubLanguageModels/PhraseReplacementMap.mm similarity index 100% rename from Source/Engine/LanguageModel/PhraseReplacementMap.mm rename to Source/Modules/LangModelRelated/SubLanguageModels/PhraseReplacementMap.mm diff --git a/Source/Engine/LanguageModel/UserOverrideModel.h b/Source/Modules/LangModelRelated/SubLanguageModels/UserOverrideModel.h similarity index 100% rename from Source/Engine/LanguageModel/UserOverrideModel.h rename to Source/Modules/LangModelRelated/SubLanguageModels/UserOverrideModel.h diff --git a/Source/Engine/LanguageModel/UserOverrideModel.mm b/Source/Modules/LangModelRelated/SubLanguageModels/UserOverrideModel.mm similarity index 100% rename from Source/Engine/LanguageModel/UserOverrideModel.mm rename to Source/Modules/LangModelRelated/SubLanguageModels/UserOverrideModel.mm diff --git a/Source/Engine/LanguageModel/UserPhrasesLM.h b/Source/Modules/LangModelRelated/SubLanguageModels/UserPhrasesLM.h similarity index 100% rename from Source/Engine/LanguageModel/UserPhrasesLM.h rename to Source/Modules/LangModelRelated/SubLanguageModels/UserPhrasesLM.h diff --git a/Source/Engine/LanguageModel/UserPhrasesLM.mm b/Source/Modules/LangModelRelated/SubLanguageModels/UserPhrasesLM.mm similarity index 100% rename from Source/Engine/LanguageModel/UserPhrasesLM.mm rename to Source/Modules/LangModelRelated/SubLanguageModels/UserPhrasesLM.mm diff --git a/Source/LanguageModelManager.h b/Source/Modules/LangModelRelated/mgrLangModel.h similarity index 93% rename from Source/LanguageModelManager.h rename to Source/Modules/LangModelRelated/mgrLangModel.h index 52507e57..28136324 100644 --- a/Source/LanguageModelManager.h +++ b/Source/Modules/LangModelRelated/mgrLangModel.h @@ -1,5 +1,5 @@ /* - * LanguageModelManager.h + * mgrLangModel.h * * Copyright 2021-2022 vChewing Project (3-Clause BSD License). * Derived from 2011-2022 OpenVanilla Project (MIT License). @@ -7,7 +7,6 @@ */ #import -#import "FastLM.h" #import "UserOverrideModel.h" #import "vChewingLM.h" #import "SSZipArchive.h" @@ -15,7 +14,7 @@ NS_ASSUME_NONNULL_BEGIN -@interface LanguageModelManager : NSObject +@interface mgrLangModel : NSObject + (void)loadDataModels; + (void)deployZipDataFile:(NSString *)filenameWithoutExtension; diff --git a/Source/LanguageModelManager.mm b/Source/Modules/LangModelRelated/mgrLangModel.mm similarity index 97% rename from Source/LanguageModelManager.mm rename to Source/Modules/LangModelRelated/mgrLangModel.mm index ceefa187..9380fb79 100644 --- a/Source/LanguageModelManager.mm +++ b/Source/Modules/LangModelRelated/mgrLangModel.mm @@ -1,12 +1,12 @@ /* - * LanguageModelManager.mm + * mgrLangModel.mm * * Copyright 2021-2022 vChewing Project (3-Clause BSD License). * Derived from 2011-2022 OpenVanilla Project (MIT License). * Some rights reserved. See "LICENSE.TXT" for details. */ -#import "LanguageModelManager.h" +#import "mgrLangModel.h" using namespace std; using namespace vChewing; @@ -24,11 +24,11 @@ UserOverrideModel gUserOverrideModelCHT(kUserOverrideModelCapacity, kObservedOve static NSString *const kBopomofoModeIdentifierCHT = @"org.atelierInmu.inputmethod.vChewing.TradBopomofo"; static NSString *const kBopomofoModeIdentifierCHS = @"org.atelierInmu.inputmethod.vChewing.SimpBopomofo"; -@implementation LanguageModelManager +@implementation mgrLangModel + (void)deployZipDataFile:(NSString *)filenameWithoutExtension { - Class cls = NSClassFromString(@"vChewingInputMethodController"); + Class cls = NSClassFromString(@"ctlInputMethod"); NSString *zipPath = [[NSBundle bundleForClass:cls] pathForResource:filenameWithoutExtension ofType:@"zip"]; NSString *destinationPath = [self dataFolderPath]; [SSZipArchive unzipFileAtPath:zipPath toDestination:destinationPath]; @@ -39,7 +39,7 @@ static NSString *const kBopomofoModeIdentifierCHS = @"org.atelierInmu.inputmetho static void LTLoadLanguageModelFile(NSString *filenameWithoutExtension, vChewingLM &lm) { - Class cls = NSClassFromString(@"vChewingInputMethodController"); + Class cls = NSClassFromString(@"ctlInputMethod"); NSString *dataPath = [[NSBundle bundleForClass:cls] pathForResource:filenameWithoutExtension ofType:@"txt"]; lm.loadLanguageModel([dataPath UTF8String]); } diff --git a/Source/Engine/LanguageModel/vChewingLM.h b/Source/Modules/LangModelRelated/vChewingLM.h similarity index 97% rename from Source/Engine/LanguageModel/vChewingLM.h rename to Source/Modules/LangModelRelated/vChewingLM.h index 3378e5de..1b86f751 100644 --- a/Source/Engine/LanguageModel/vChewingLM.h +++ b/Source/Modules/LangModelRelated/vChewingLM.h @@ -10,7 +10,7 @@ #define VCHEWINGLM_H #include -#include "FastLM.h" +#include "CoreLM.h" #include "CNSLM.h" #include "UserPhrasesLM.h" #include "PhraseReplacementMap.h" @@ -45,7 +45,7 @@ protected: const std::unordered_set& excludedValues, std::unordered_set& insertedValues); - FastLM m_languageModel; + CoreLM m_languageModel; CNSLM m_cnsModel; UserPhrasesLM m_userPhrases; UserPhrasesLM m_excludedPhrases; diff --git a/Source/Engine/LanguageModel/vChewingLM.mm b/Source/Modules/LangModelRelated/vChewingLM.mm similarity index 100% rename from Source/Engine/LanguageModel/vChewingLM.mm rename to Source/Modules/LangModelRelated/vChewingLM.mm diff --git a/Source/Engine/Gramambular/Bigram.h b/Source/Modules/LanguageParsers/Gramambular/Bigram.h similarity index 100% rename from Source/Engine/Gramambular/Bigram.h rename to Source/Modules/LanguageParsers/Gramambular/Bigram.h diff --git a/Source/Engine/Gramambular/BlockReadingBuilder.h b/Source/Modules/LanguageParsers/Gramambular/BlockReadingBuilder.h similarity index 100% rename from Source/Engine/Gramambular/BlockReadingBuilder.h rename to Source/Modules/LanguageParsers/Gramambular/BlockReadingBuilder.h diff --git a/Source/Engine/Gramambular/Gramambular.h b/Source/Modules/LanguageParsers/Gramambular/Gramambular.h similarity index 100% rename from Source/Engine/Gramambular/Gramambular.h rename to Source/Modules/LanguageParsers/Gramambular/Gramambular.h diff --git a/Source/Engine/Gramambular/Grid.h b/Source/Modules/LanguageParsers/Gramambular/Grid.h similarity index 100% rename from Source/Engine/Gramambular/Grid.h rename to Source/Modules/LanguageParsers/Gramambular/Grid.h diff --git a/Source/Engine/Gramambular/KeyValuePair.h b/Source/Modules/LanguageParsers/Gramambular/KeyValuePair.h similarity index 100% rename from Source/Engine/Gramambular/KeyValuePair.h rename to Source/Modules/LanguageParsers/Gramambular/KeyValuePair.h diff --git a/Source/Engine/Gramambular/LanguageModel.h b/Source/Modules/LanguageParsers/Gramambular/LanguageModel.h similarity index 100% rename from Source/Engine/Gramambular/LanguageModel.h rename to Source/Modules/LanguageParsers/Gramambular/LanguageModel.h diff --git a/Source/Engine/Gramambular/Node.h b/Source/Modules/LanguageParsers/Gramambular/Node.h similarity index 100% rename from Source/Engine/Gramambular/Node.h rename to Source/Modules/LanguageParsers/Gramambular/Node.h diff --git a/Source/Engine/Gramambular/NodeAnchor.h b/Source/Modules/LanguageParsers/Gramambular/NodeAnchor.h similarity index 100% rename from Source/Engine/Gramambular/NodeAnchor.h rename to Source/Modules/LanguageParsers/Gramambular/NodeAnchor.h diff --git a/Source/Engine/Gramambular/Span.h b/Source/Modules/LanguageParsers/Gramambular/Span.h similarity index 100% rename from Source/Engine/Gramambular/Span.h rename to Source/Modules/LanguageParsers/Gramambular/Span.h diff --git a/Source/Engine/Gramambular/Unigram.h b/Source/Modules/LanguageParsers/Gramambular/Unigram.h similarity index 100% rename from Source/Engine/Gramambular/Unigram.h rename to Source/Modules/LanguageParsers/Gramambular/Unigram.h diff --git a/Source/Engine/Gramambular/Walker.h b/Source/Modules/LanguageParsers/Gramambular/Walker.h similarity index 100% rename from Source/Engine/Gramambular/Walker.h rename to Source/Modules/LanguageParsers/Gramambular/Walker.h diff --git a/Source/Engine/SFX/clsSFX.swift b/Source/Modules/SFX/clsSFX.swift similarity index 100% rename from Source/Engine/SFX/clsSFX.swift rename to Source/Modules/SFX/clsSFX.swift diff --git a/Source/main.swift b/Source/Modules/main.swift similarity index 100% rename from Source/main.swift rename to Source/Modules/main.swift diff --git a/Source/Resources/Beep.m4a b/Source/Resources/Beep.m4a new file mode 100644 index 00000000..6e4e3150 Binary files /dev/null and b/Source/Resources/Beep.m4a differ diff --git a/Source/Resources/Fart.m4a b/Source/Resources/Fart.m4a new file mode 100644 index 00000000..82a7711a Binary files /dev/null and b/Source/Resources/Fart.m4a differ diff --git a/Source/Images/Images.xcassets/AboutBanner.imageset/AboutBanner.png b/Source/Resources/Images/Images.xcassets/AboutBanner.imageset/AboutBanner.png similarity index 100% rename from Source/Images/Images.xcassets/AboutBanner.imageset/AboutBanner.png rename to Source/Resources/Images/Images.xcassets/AboutBanner.imageset/AboutBanner.png diff --git a/Source/Images/Images.xcassets/AboutBanner.imageset/AboutBanner@2x.png b/Source/Resources/Images/Images.xcassets/AboutBanner.imageset/AboutBanner@2x.png similarity index 100% rename from Source/Images/Images.xcassets/AboutBanner.imageset/AboutBanner@2x.png rename to Source/Resources/Images/Images.xcassets/AboutBanner.imageset/AboutBanner@2x.png diff --git a/Source/Images/Images.xcassets/AboutBanner.imageset/AboutBanner@3x.png b/Source/Resources/Images/Images.xcassets/AboutBanner.imageset/AboutBanner@3x.png similarity index 100% rename from Source/Images/Images.xcassets/AboutBanner.imageset/AboutBanner@3x.png rename to Source/Resources/Images/Images.xcassets/AboutBanner.imageset/AboutBanner@3x.png diff --git a/Source/Images/Images.xcassets/AboutBanner.imageset/Contents.json b/Source/Resources/Images/Images.xcassets/AboutBanner.imageset/Contents.json similarity index 100% rename from Source/Images/Images.xcassets/AboutBanner.imageset/Contents.json rename to Source/Resources/Images/Images.xcassets/AboutBanner.imageset/Contents.json diff --git a/Source/Images/Images.xcassets/AlertIcon.imageset/128X128.png b/Source/Resources/Images/Images.xcassets/AlertIcon.imageset/128X128.png similarity index 100% rename from Source/Images/Images.xcassets/AlertIcon.imageset/128X128.png rename to Source/Resources/Images/Images.xcassets/AlertIcon.imageset/128X128.png diff --git a/Source/Images/Images.xcassets/AlertIcon.imageset/192x192.png b/Source/Resources/Images/Images.xcassets/AlertIcon.imageset/192x192.png similarity index 100% rename from Source/Images/Images.xcassets/AlertIcon.imageset/192x192.png rename to Source/Resources/Images/Images.xcassets/AlertIcon.imageset/192x192.png diff --git a/Source/Images/Images.xcassets/AlertIcon.imageset/64X64.png b/Source/Resources/Images/Images.xcassets/AlertIcon.imageset/64X64.png similarity index 100% rename from Source/Images/Images.xcassets/AlertIcon.imageset/64X64.png rename to Source/Resources/Images/Images.xcassets/AlertIcon.imageset/64X64.png diff --git a/Source/Images/Images.xcassets/AlertIcon.imageset/Contents.json b/Source/Resources/Images/Images.xcassets/AlertIcon.imageset/Contents.json similarity index 100% rename from Source/Images/Images.xcassets/AlertIcon.imageset/Contents.json rename to Source/Resources/Images/Images.xcassets/AlertIcon.imageset/Contents.json diff --git a/Source/Images/Images.xcassets/AppIcon.appiconset/1024X1024.png b/Source/Resources/Images/Images.xcassets/AppIcon.appiconset/1024X1024.png similarity index 100% rename from Source/Images/Images.xcassets/AppIcon.appiconset/1024X1024.png rename to Source/Resources/Images/Images.xcassets/AppIcon.appiconset/1024X1024.png diff --git a/Source/Images/Images.xcassets/AppIcon.appiconset/128X128.png b/Source/Resources/Images/Images.xcassets/AppIcon.appiconset/128X128.png similarity index 100% rename from Source/Images/Images.xcassets/AppIcon.appiconset/128X128.png rename to Source/Resources/Images/Images.xcassets/AppIcon.appiconset/128X128.png diff --git a/Source/Images/Images.xcassets/AppIcon.appiconset/16X16.png b/Source/Resources/Images/Images.xcassets/AppIcon.appiconset/16X16.png similarity index 100% rename from Source/Images/Images.xcassets/AppIcon.appiconset/16X16.png rename to Source/Resources/Images/Images.xcassets/AppIcon.appiconset/16X16.png diff --git a/Source/Images/Images.xcassets/AppIcon.appiconset/256X256.png b/Source/Resources/Images/Images.xcassets/AppIcon.appiconset/256X256.png similarity index 100% rename from Source/Images/Images.xcassets/AppIcon.appiconset/256X256.png rename to Source/Resources/Images/Images.xcassets/AppIcon.appiconset/256X256.png diff --git a/Source/Images/Images.xcassets/AppIcon.appiconset/32X32.png b/Source/Resources/Images/Images.xcassets/AppIcon.appiconset/32X32.png similarity index 100% rename from Source/Images/Images.xcassets/AppIcon.appiconset/32X32.png rename to Source/Resources/Images/Images.xcassets/AppIcon.appiconset/32X32.png diff --git a/Source/Images/Images.xcassets/AppIcon.appiconset/512X512.png b/Source/Resources/Images/Images.xcassets/AppIcon.appiconset/512X512.png similarity index 100% rename from Source/Images/Images.xcassets/AppIcon.appiconset/512X512.png rename to Source/Resources/Images/Images.xcassets/AppIcon.appiconset/512X512.png diff --git a/Source/Images/Images.xcassets/AppIcon.appiconset/64X64.png b/Source/Resources/Images/Images.xcassets/AppIcon.appiconset/64X64.png similarity index 100% rename from Source/Images/Images.xcassets/AppIcon.appiconset/64X64.png rename to Source/Resources/Images/Images.xcassets/AppIcon.appiconset/64X64.png diff --git a/Source/Images/Images.xcassets/AppIcon.appiconset/Contents.json b/Source/Resources/Images/Images.xcassets/AppIcon.appiconset/Contents.json similarity index 100% rename from Source/Images/Images.xcassets/AppIcon.appiconset/Contents.json rename to Source/Resources/Images/Images.xcassets/AppIcon.appiconset/Contents.json diff --git a/Source/Images/Images.xcassets/Contents.json b/Source/Resources/Images/Images.xcassets/Contents.json similarity index 100% rename from Source/Images/Images.xcassets/Contents.json rename to Source/Resources/Images/Images.xcassets/Contents.json diff --git a/Source/Images/RAW/March.jpg b/Source/Resources/Images/RAW/March.jpg similarity index 100% rename from Source/Images/RAW/March.jpg rename to Source/Resources/Images/RAW/March.jpg diff --git a/Source/Images/RAW/vChewing.svg b/Source/Resources/Images/RAW/vChewing.svg similarity index 100% rename from Source/Images/RAW/vChewing.svg rename to Source/Resources/Images/RAW/vChewing.svg diff --git a/Source/en.lproj/InfoPlist.strings b/Source/Resources/Localization/en.lproj/InfoPlist.strings similarity index 100% rename from Source/en.lproj/InfoPlist.strings rename to Source/Resources/Localization/en.lproj/InfoPlist.strings diff --git a/Source/en.lproj/Localizable.strings b/Source/Resources/Localization/en.lproj/Localizable.strings similarity index 100% rename from Source/en.lproj/Localizable.strings rename to Source/Resources/Localization/en.lproj/Localizable.strings diff --git a/Source/ja.lproj/InfoPlist.strings b/Source/Resources/Localization/ja.lproj/InfoPlist.strings similarity index 100% rename from Source/ja.lproj/InfoPlist.strings rename to Source/Resources/Localization/ja.lproj/InfoPlist.strings diff --git a/Source/ja.lproj/Localizable.strings b/Source/Resources/Localization/ja.lproj/Localizable.strings similarity index 100% rename from Source/ja.lproj/Localizable.strings rename to Source/Resources/Localization/ja.lproj/Localizable.strings diff --git a/Source/zh-Hans.lproj/InfoPlist.strings b/Source/Resources/Localization/zh-Hans.lproj/InfoPlist.strings similarity index 95% rename from Source/zh-Hans.lproj/InfoPlist.strings rename to Source/Resources/Localization/zh-Hans.lproj/InfoPlist.strings index 7691e23b..093d7507 100644 --- a/Source/zh-Hans.lproj/InfoPlist.strings +++ b/Source/Resources/Localization/zh-Hans.lproj/InfoPlist.strings @@ -1,6 +1,6 @@ CFBundleName = "威注音"; CFBundleDisplayName = "威注音"; NSHumanReadableCopyright = "© 2011-2022 OpenVanilla Project & © 2021-2022 vChewing Project."; -"org.atelierInmu.inputmethod.vChewing.TradBopomofo" = "威註音"; -"org.atelierInmu.inputmethod.vChewing.SimpBopomofo" = "威注音"; +"org.atelierInmu.inputmethod.vChewing.TradBopomofo" = "威注音-繁"; +"org.atelierInmu.inputmethod.vChewing.SimpBopomofo" = "威注音-简"; CFEULAContent = "该授权条款,在使用者符合以下诸条件之情形下,授予使用者使用及再散播本软件套件装原始码及二进位可执行形式之权利,无论此包装是否经改作皆然:\n\n1)对于本软件原始码之再散播,必须保留上述之著作权宣告、此诸条件表列,以及下述之免责声明。\n2)对于本套件二进位可执行形式之再散播,必须连带以档案以及/或者其他附于散播包装中之媒介方式,重制上述之著作权宣告、此诸条件表列,以及下述之免责声明。\n3)未获事前取得书面授权,不得使用威注音或本软件贡献者之名称,来为本软件之衍生物做任何表示支援、认可或推广、促销之行为。\n\n免责声明:本软件由威注音及本软件之贡献者以现状(「as is」)提供,本软件套件装不负任何明示或默示之担保责任,包括但不限于就适售性以及特定目之之适用性为默示性担保。威注音及本软件之贡献者,无论任何条件、无论成因或任何责任主义、无论此责任为因合约关系、无过失责任主义或因非违约之侵权(包括过失或其他原因等)而起,对于任何因使用本软件套件装所产生之任何直接性、间接性、偶发性、特殊性、惩罚性或任何结果之损害(包括但不限于替代商品或劳务之购用、使用损失、资料损失、利益损失、业务中断等等),不负任何责任,即在该种使用已获事前告知可能会造成此类损害之情形下亦然。\n"; diff --git a/Source/zh-Hans.lproj/Localizable.strings b/Source/Resources/Localization/zh-Hans.lproj/Localizable.strings similarity index 100% rename from Source/zh-Hans.lproj/Localizable.strings rename to Source/Resources/Localization/zh-Hans.lproj/Localizable.strings diff --git a/Source/zh-Hant.lproj/InfoPlist.strings b/Source/Resources/Localization/zh-Hant.lproj/InfoPlist.strings similarity index 95% rename from Source/zh-Hant.lproj/InfoPlist.strings rename to Source/Resources/Localization/zh-Hant.lproj/InfoPlist.strings index 8be0ef40..6ddf208a 100644 --- a/Source/zh-Hant.lproj/InfoPlist.strings +++ b/Source/Resources/Localization/zh-Hant.lproj/InfoPlist.strings @@ -1,6 +1,6 @@ CFBundleName = "威注音"; CFBundleDisplayName = "威注音"; NSHumanReadableCopyright = "© 2011-2022 OpenVanilla Project & © 2021-2022 vChewing Project."; -"org.atelierInmu.inputmethod.vChewing.TradBopomofo" = "威註音"; -"org.atelierInmu.inputmethod.vChewing.SimpBopomofo" = "威注音"; +"org.atelierInmu.inputmethod.vChewing.TradBopomofo" = "威注音-繁"; +"org.atelierInmu.inputmethod.vChewing.SimpBopomofo" = "威注音-簡"; CFEULAContent = "該授權條款,在使用者符合以下諸條件之情形下,授予使用者使用及再散播本軟體套件裝原始碼及二進位可執行形式之權利,無論此包裝是否經改作皆然:\n\n1)對於本軟體原始碼之再散播,必須保留上述之著作權宣告、此諸條件表列,以及下述之免責聲明。\n2)對於本套件二進位可執行形式之再散播,必須連帶以檔案以及/或者其他附於散播包裝中之媒介方式,重製上述之著作權宣告、此諸條件表列,以及下述之免責聲明。\n3)未獲事前取得書面授權,不得使用威注音或本軟體貢獻者之名稱,來為本軟體之衍生物做任何表示支援、認可或推廣、促銷之行為。\n\n免責聲明:本軟體由威注音及本軟體之貢獻者以現狀(「as is」)提供,本軟體套件裝不負任何明示或默示之擔保責任,包括但不限於就適售性以及特定目之之適用性為默示性擔保。威注音及本軟體之貢獻者,無論任何條件、無論成因或任何責任主義、無論此責任為因合約關係、無過失責任主義或因非違約之侵權(包括過失或其他原因等)而起,對於任何因使用本軟體套件裝所產生之任何直接性、間接性、偶發性、特殊性、懲罰性或任何結果之損害(包括但不限於替代商品或勞務之購用、使用損失、資料損失、利益損失、業務中斷等等),不負任何責任,即在該種使用已獲事前告知可能會造成此類損害之情形下亦然。\n"; diff --git a/Source/zh-Hant.lproj/Localizable.strings b/Source/Resources/Localization/zh-Hant.lproj/Localizable.strings similarity index 100% rename from Source/zh-Hant.lproj/Localizable.strings rename to Source/Resources/Localization/zh-Hant.lproj/Localizable.strings diff --git a/Source/Resources/MenuIcons/MenuIcon-SCVIM.png b/Source/Resources/MenuIcons/MenuIcon-SCVIM.png new file mode 100644 index 00000000..86c8e604 Binary files /dev/null and b/Source/Resources/MenuIcons/MenuIcon-SCVIM.png differ diff --git a/Source/Resources/MenuIcons/MenuIcon-SCVIM@2x.png b/Source/Resources/MenuIcons/MenuIcon-SCVIM@2x.png new file mode 100644 index 00000000..2511631a Binary files /dev/null and b/Source/Resources/MenuIcons/MenuIcon-SCVIM@2x.png differ diff --git a/Source/Resources/MenuIcons/MenuIcon-TCVIM.png b/Source/Resources/MenuIcons/MenuIcon-TCVIM.png new file mode 100644 index 00000000..e88ae4d5 Binary files /dev/null and b/Source/Resources/MenuIcons/MenuIcon-TCVIM.png differ diff --git a/Source/Resources/MenuIcons/MenuIcon-TCVIM@2x.png b/Source/Resources/MenuIcons/MenuIcon-TCVIM@2x.png new file mode 100644 index 00000000..ca92d0ec Binary files /dev/null and b/Source/Resources/MenuIcons/MenuIcon-TCVIM@2x.png differ diff --git a/Source/Tools/genRTF.py b/Source/Tools/genRTF.py deleted file mode 100755 index 28e36840..00000000 --- a/Source/Tools/genRTF.py +++ /dev/null @@ -1,66 +0,0 @@ -""" - genRTF.py - - Copyright 2021-2022 vChewing Project (3-Clause BSD License). - Derived from 2011-2022 OpenVanilla Project (MIT License). - Some rights reserved. See "LICENSE.TXT" for details. -""" - -#!/usr/bin/env python -import sys, os -import platform -myversion, _, _ = platform.mac_ver() -myversion = float('.'.join(myversion.split('.')[:2])) - -if myversion == 10.8: - os.environ["MACOSX_DEPLOYMENT_TARGET"] = "10.8" - print myversion -else: - os.environ["MACOSX_DEPLOYMENT_TARGET"] = "10.7" - -os.environ["PYTHONPATH"] = "/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/" - -import subprocess, getopt -from Foundation import * -from AppKit import * - -def generateRTF(inString="", inFile=""): - if len(inString) == 0: return - if len(inFile) == 0: return - paragraphStyle = NSMutableParagraphStyle.alloc().init() - paragraphStyle.setAlignment_(NSCenterTextAlignment) - attributedString = NSAttributedString.alloc().initWithString_attributes_(inString, { - NSParagraphStyleAttributeName: paragraphStyle, - NSFontAttributeName: NSFont.systemFontOfSize_(11) - }) - data = attributedString.RTFFromRange_documentAttributes_(NSMakeRange(0, len(inString)), None) - try: os.remove(inFile) - except: pass - data.writeToFile_atomically_(inFile, True) - os.utime(inFile, None) # Touch the file - -def main(argv=None): - if argv is None: - argv = sys.argv - try: - path = argv[1] - except: - return - - path = os.path.abspath(path) - cmd = "/usr/bin/git log --format='%h' -1" - try: - p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - lines = "" - while True: - line = p.stdout.readline() - if not line: break - line = line.strip() - if len(line): lines += line + "\n" - lines = lines.strip() - generateRTF("Build: " + lines, os.path.join(path, "Credits.rtf")) - except Exception, e: - pass - -if __name__ == "__main__": - sys.exit(main()) diff --git a/Source/Tools/tistool.m b/Source/Tools/tistool.m deleted file mode 100644 index 2800c23b..00000000 --- a/Source/Tools/tistool.m +++ /dev/null @@ -1,115 +0,0 @@ -/* - * tistool.m - * - * Copyright 2021-2022 vChewing Project (3-Clause BSD License). - * Derived from 2011-2022 OpenVanilla Project (MIT License). - * Some rights reserved. See "LICENSE.TXT" for details. - */ - -#import "OVInputSourceHelper.h" - -static void PrintUsage(); - -int main(int argc, char **argv) -{ - // we'll let the OS clean up this pool for us - [NSAutoreleasePool new]; - - if (argc < 2) { - PrintUsage(); - return 1; - } - - int opt; - while ((opt = getopt(argc, argv, "lr:e:d:s:")) != -1) { - switch (opt) { - case 'l': - { - for (id source in [OVInputSourceHelper allInstalledInputSources]) { - if (TISGetInputSourceProperty((TISInputSourceRef)source, kTISPropertyInputSourceType) != kTISTypeKeyboardInputMode) { - printf("%s\n", [(id)TISGetInputSourceProperty((TISInputSourceRef)source, kTISPropertyInputSourceID) UTF8String]); - } - } - break; - } - - case 'r': - { - NSURL *bundle = [NSURL fileURLWithPath:[NSString stringWithUTF8String:optarg]]; - if (bundle) { - BOOL status = [OVInputSourceHelper registerInputSource:bundle]; - NSLog(@"register input source at: %@, result: %d", [bundle absoluteString], status); - } - break; - } - - - case 'e': - { - TISInputSourceRef inputSource = [OVInputSourceHelper inputSourceForInputSourceID:[NSString stringWithUTF8String:optarg]]; - if (!inputSource) { - NSLog(@"Cannot find input source: %s", optarg); - return 1; - } - - BOOL status = [OVInputSourceHelper enableInputSource:inputSource]; - NSLog(@"Enable input source: %s, result: %d", optarg, status); - return status; - } - - case 'd': - { - TISInputSourceRef inputSource = [OVInputSourceHelper inputSourceForInputSourceID:[NSString stringWithUTF8String:optarg]]; - if (!inputSource) { - NSLog(@"Cannot find input source: %s", optarg); - return 1; - } - - BOOL status = [OVInputSourceHelper disableInputSource:inputSource]; - NSLog(@"Disable input source: %s, result: %d", optarg, status); - return status; - } - - case 's': - { - TISInputSourceRef inputSource = [OVInputSourceHelper inputSourceForInputSourceID:[NSString stringWithUTF8String:optarg]]; - if (!inputSource) { - NSLog(@"Cannot find input source: %s", optarg); - return 1; - } - - BOOL status = [OVInputSourceHelper inputSourceEnabled:inputSource]; - NSLog(@"Input source: %s, enabled: %@", optarg, (status ? @"yes" : @"no")); - return 0; - } - default: - PrintUsage(); - return 1; - } - } - - return 0; -} - -static void PrintUsage() -{ - fprintf(stderr, "usage: tistool [options]\n" - "options:\n" - " -l list all input sources\n" - " -r register an input source\n" - " -e enable an input source\n" - " -d disable an input source\n" - " -s check if an input source is enabled\n\n" - " is an input source id, a few examples:\n" - " com.apple.inputmethod.Kotoeri (Apple's Japanese input method)\n" - " com.apple.CharacterPaletteIM (Keyboard/Character Viewer palettes)\n" - " com.apple.keylayout.German (German keyboard layout)\n" - "\n" - " must be a bundle in one of the directories:\n" - " ~/Library/Input Methods/\n" - " /Library/Input Methods/\n" - " ~/Library/Keyboard Layouts/\n" - " /Library/Keyboard Layouts/\n" - "\n" - ); -} diff --git a/Source/frmAboutWindow.swift b/Source/WindowControllers/ctlAboutWindow.swift similarity index 93% rename from Source/frmAboutWindow.swift rename to Source/WindowControllers/ctlAboutWindow.swift index 102c0178..267657a3 100644 --- a/Source/frmAboutWindow.swift +++ b/Source/WindowControllers/ctlAboutWindow.swift @@ -1,5 +1,5 @@ /* - * frmAboutWindow.swift + * AboutWindow.swift * * Copyright 2021-2022 vChewing Project (3-Clause BSD License). * Derived from 2011-2022 OpenVanilla Project (MIT License). @@ -8,7 +8,7 @@ import Cocoa -@objc(frmAboutWindow) class frmAboutWindow: NSWindowController { +@objc(AboutWindow) class ctlAboutWindow: NSWindowController { @IBOutlet weak var appVersionLabel: NSTextField! @IBOutlet weak var appCopyrightLabel: NSTextField! @IBOutlet var appEULAContent: NSTextView! diff --git a/Source/NonModalAlertWindowController.swift b/Source/WindowControllers/ctlNonModalAlertWindow.swift similarity index 82% rename from Source/NonModalAlertWindowController.swift rename to Source/WindowControllers/ctlNonModalAlertWindow.swift index 1b79ec8c..0bc349a4 100644 --- a/Source/NonModalAlertWindowController.swift +++ b/Source/WindowControllers/ctlNonModalAlertWindow.swift @@ -1,5 +1,5 @@ /* - * NonModalAlertWindowController.swift + * ctlNonModalAlertWindow.swift * * Copyright 2021-2022 vChewing Project (3-Clause BSD License). * Derived from 2011-2022 OpenVanilla Project (MIT License). @@ -8,25 +8,25 @@ import Cocoa -@objc protocol NonModalAlertWindowControllerDelegate: AnyObject { - func nonModalAlertWindowControllerDidConfirm(_ controller: NonModalAlertWindowController) - func nonModalAlertWindowControllerDidCancel(_ controller: NonModalAlertWindowController) +@objc protocol ctlNonModalAlertWindowDelegate: AnyObject { + func ctlNonModalAlertWindowDidConfirm(_ controller: ctlNonModalAlertWindow) + func ctlNonModalAlertWindowDidCancel(_ controller: ctlNonModalAlertWindow) } -class NonModalAlertWindowController: NSWindowController { +class ctlNonModalAlertWindow: NSWindowController { @objc(sharedInstance) - static let shared = NonModalAlertWindowController(windowNibName: "NonModalAlertWindowController") + static let shared = ctlNonModalAlertWindow(windowNibName: "ctlNonModalAlertWindow") @IBOutlet weak var titleTextField: NSTextField! @IBOutlet weak var contentTextField: NSTextField! @IBOutlet weak var confirmButton: NSButton! @IBOutlet weak var cancelButton: NSButton! - weak var delegate: NonModalAlertWindowControllerDelegate? + weak var delegate: ctlNonModalAlertWindowDelegate? - @objc func show(title: String, content: String, confirmButtonTitle: String, cancelButtonTitle: String?, cancelAsDefault: Bool, delegate: NonModalAlertWindowControllerDelegate?) { + @objc func show(title: String, content: String, confirmButtonTitle: String, cancelButtonTitle: String?, cancelAsDefault: Bool, delegate: ctlNonModalAlertWindowDelegate?) { if window?.isVisible == true { - self.delegate?.nonModalAlertWindowControllerDidCancel(self) + self.delegate?.ctlNonModalAlertWindowDidCancel(self) } self.delegate = delegate @@ -91,7 +91,7 @@ class NonModalAlertWindowController: NSWindowController { } @IBAction func confirmButtonAction(_ sender: Any) { - delegate?.nonModalAlertWindowControllerDidConfirm(self) + delegate?.ctlNonModalAlertWindowDidConfirm(self) window?.orderOut(self) } @@ -100,7 +100,7 @@ class NonModalAlertWindowController: NSWindowController { } func cancel(_ sender: Any) { - delegate?.nonModalAlertWindowControllerDidCancel(self) + delegate?.ctlNonModalAlertWindowDidCancel(self) delegate = nil window?.orderOut(self) } diff --git a/Source/PreferencesWindowController.swift b/Source/WindowControllers/ctlPrefWindow.swift similarity index 96% rename from Source/PreferencesWindowController.swift rename to Source/WindowControllers/ctlPrefWindow.swift index 4729477a..7ac2ecca 100644 --- a/Source/PreferencesWindowController.swift +++ b/Source/WindowControllers/ctlPrefWindow.swift @@ -1,5 +1,5 @@ /* - * PreferencesWindowController.swift + * ctlPrefWindow.swift * * Copyright 2021-2022 vChewing Project (3-Clause BSD License). * Derived from 2011-2022 OpenVanilla Project (MIT License). @@ -17,10 +17,10 @@ extension RangeReplaceableCollection where Element: Hashable { } } -// Please note that the class should be exposed as "PreferencesWindowController" +// Please note that the class should be exposed as "ctlPrefWindow" // in Objective-C in order to let IMK to see the same class name as -// the "InputMethodServerPreferencesWindowControllerClass" in Info.plist. -@objc(PreferencesWindowController) class PreferencesWindowController: NSWindowController { +// the "InputMethodServerctlPrefWindowClass" in Info.plist. +@objc(ctlPrefWindow) class ctlPrefWindow: NSWindowController { @IBOutlet weak var fontSizePopUpButton: NSPopUpButton! @IBOutlet weak var uiLanguageButton: NSPopUpButton! @IBOutlet weak var basisKeyboardLayoutButton: NSPopUpButton! diff --git a/Source/Base.lproj/MainMenu.xib b/Source/WindowNIBs/Base.lproj/MainMenu.xib similarity index 100% rename from Source/Base.lproj/MainMenu.xib rename to Source/WindowNIBs/Base.lproj/MainMenu.xib diff --git a/Source/Base.lproj/frmAboutWindow.xib b/Source/WindowNIBs/Base.lproj/frmAboutWindow.xib similarity index 99% rename from Source/Base.lproj/frmAboutWindow.xib rename to Source/WindowNIBs/Base.lproj/frmAboutWindow.xib index ab42cf91..c6030e04 100644 --- a/Source/Base.lproj/frmAboutWindow.xib +++ b/Source/WindowNIBs/Base.lproj/frmAboutWindow.xib @@ -6,7 +6,7 @@ - + diff --git a/Source/NonModalAlertWindowController.xib b/Source/WindowNIBs/Base.lproj/frmNonModalAlertWindow.xib similarity index 90% rename from Source/NonModalAlertWindowController.xib rename to Source/WindowNIBs/Base.lproj/frmNonModalAlertWindow.xib index 8dc2d753..9a161183 100644 --- a/Source/NonModalAlertWindowController.xib +++ b/Source/WindowNIBs/Base.lproj/frmNonModalAlertWindow.xib @@ -6,7 +6,7 @@ - + @@ -29,7 +29,7 @@