From f919c3a8be3d8f3411ecb5c739dbf8672079f221 Mon Sep 17 00:00:00 2001 From: Tu Dinh <1257909+dinhngtu@users.noreply.github.com> Date: Sun, 7 Jan 2024 07:04:50 +0100 Subject: [PATCH] add optimize multilang option --- VietTypeATL/EngineSettingsController.cpp | 20 ++ VietTypeATL/EngineSettingsController.h | 1 + VietTypeConfig/Form1.Designer.cs | 47 +++-- VietTypeConfig/Form1.en.resx | 185 +++++++++++++++++ VietTypeConfig/Form1.resx | 235 ++++++++++++---------- VietTypeConfig/Form1.vi.resx | 3 + VietTypeConfig/Properties/AssemblyInfo.cs | 2 +- VietTypeConfig/Settings.cs | 15 ++ VietTypeConfig/VietTypeConfig.csproj | 4 + VietTypeSetup/Product.wxs | 6 +- 10 files changed, 396 insertions(+), 122 deletions(-) create mode 100644 VietTypeConfig/Form1.en.resx diff --git a/VietTypeATL/EngineSettingsController.cpp b/VietTypeATL/EngineSettingsController.cpp index b86f472..943f30e 100644 --- a/VietTypeATL/EngineSettingsController.cpp +++ b/VietTypeATL/EngineSettingsController.cpp @@ -61,12 +61,26 @@ _Check_return_ HRESULT EngineSettingsController::Initialize( clientid); HRESULT_CHECK_RETURN(hr, L"%s", L"CreateInitialize(_tc_backspace_invalid) failed"); + hr = CreateInitialize( + &_tc_optimize_multilang, + HKEY_CURRENT_USER, + Globals::ConfigKeyName.c_str(), + L"optimize_multilang", + KEY_QUERY_VALUE, + threadMgr, + clientid); + HRESULT_CHECK_RETURN(hr, L"%s", L"CreateInitialize(_tc_optimize_multilang) failed"); + return S_OK; } HRESULT EngineSettingsController::Uninitialize() { HRESULT hr; + hr = _tc_optimize_multilang->Uninitialize(); + HRESULT_CHECK_RETURN(hr, L"%s", L"_tc_optimize_multilang->Uninitialize failed"); + _tc_optimize_multilang.Release(); + hr = _tc_backspace_invalid->Uninitialize(); HRESULT_CHECK_RETURN(hr, L"%s", L"_tc_backspace_invalid->Uninitialize failed"); _tc_backspace_invalid.Release(); @@ -109,6 +123,12 @@ HRESULT EngineSettingsController::LoadTelexSettings(Telex::TelexConfig& cfg) { HRESULT_CHECK_RETURN(hr, L"%s", L"_tc_backspace_invalid->GetValueOrWriteback failed"); cfg.backspaced_word_stays_invalid = static_cast(backspace_invalid); + DWORD optimize_multilang = true; + hr = _tc_optimize_multilang->GetValueOrDefault( + &optimize_multilang, _ec->GetEngine().GetConfig().optimize_multilang); + HRESULT_CHECK_RETURN(hr, L"%s", L"_tc_optimize_multilang->GetValueOrWriteback failed"); + cfg.optimize_multilang = static_cast(optimize_multilang); + return S_OK; } diff --git a/VietTypeATL/EngineSettingsController.h b/VietTypeATL/EngineSettingsController.h index 3c0c0f8..20a327b 100644 --- a/VietTypeATL/EngineSettingsController.h +++ b/VietTypeATL/EngineSettingsController.h @@ -46,6 +46,7 @@ class EngineSettingsController : public CComObjectRootEx CComPtr> _tc_oa_uy_tone1; CComPtr> _tc_accept_dd; CComPtr> _tc_backspace_invalid; + CComPtr> _tc_optimize_multilang; }; } // namespace VietType diff --git a/VietTypeConfig/Form1.Designer.cs b/VietTypeConfig/Form1.Designer.cs index b19236c..53f3763 100644 --- a/VietTypeConfig/Form1.Designer.cs +++ b/VietTypeConfig/Form1.Designer.cs @@ -31,11 +31,12 @@ private void InitializeComponent() { this.cbAcceptDd = new System.Windows.Forms.CheckBox(); this.cbBackspaceInvalid = new System.Windows.Forms.CheckBox(); this.cbBackconvertOnBackspace = new System.Windows.Forms.CheckBox(); + this.btnEnable = new System.Windows.Forms.Button(); + this.label1 = new System.Windows.Forms.Label(); + this.cbOptimizeMultilang = new System.Windows.Forms.CheckBox(); this.btnOK = new System.Windows.Forms.Button(); this.btnCancel = new System.Windows.Forms.Button(); this.btnAbout = new System.Windows.Forms.Button(); - this.btnEnable = new System.Windows.Forms.Button(); - this.label1 = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.settingsBindingSource)).BeginInit(); this.SuspendLayout(); // @@ -83,6 +84,27 @@ private void InitializeComponent() { this.cbBackconvertOnBackspace.Name = "cbBackconvertOnBackspace"; this.cbBackconvertOnBackspace.UseVisualStyleBackColor = true; // + // btnEnable + // + resources.ApplyResources(this.btnEnable, "btnEnable"); + this.btnEnable.Name = "btnEnable"; + this.btnEnable.UseVisualStyleBackColor = true; + this.btnEnable.Click += new System.EventHandler(this.btnEnable_Click); + // + // label1 + // + resources.ApplyResources(this.label1, "label1"); + this.label1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; + this.label1.Name = "label1"; + // + // cbOptimizeMultilang + // + resources.ApplyResources(this.cbOptimizeMultilang, "cbOptimizeMultilang"); + this.cbOptimizeMultilang.AutoEllipsis = true; + this.cbOptimizeMultilang.DataBindings.Add(new System.Windows.Forms.Binding("Checked", this.settingsBindingSource, "OptimizeMultilang", true)); + this.cbOptimizeMultilang.Name = "cbOptimizeMultilang"; + this.cbOptimizeMultilang.UseVisualStyleBackColor = true; + // // btnOK // resources.ApplyResources(this.btnOK, "btnOK"); @@ -106,19 +128,6 @@ private void InitializeComponent() { this.btnAbout.UseVisualStyleBackColor = true; this.btnAbout.Click += new System.EventHandler(this.btnAbout_Click); // - // btnEnable - // - resources.ApplyResources(this.btnEnable, "btnEnable"); - this.btnEnable.Name = "btnEnable"; - this.btnEnable.UseVisualStyleBackColor = true; - this.btnEnable.Click += new System.EventHandler(this.btnEnable_Click); - // - // label1 - // - resources.ApplyResources(this.label1, "label1"); - this.label1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; - this.label1.Name = "label1"; - // // Form1 // this.AcceptButton = this.btnOK; @@ -130,6 +139,7 @@ private void InitializeComponent() { this.Controls.Add(this.btnAbout); this.Controls.Add(this.btnCancel); this.Controls.Add(this.btnOK); + this.Controls.Add(this.cbOptimizeMultilang); this.Controls.Add(this.cbBackconvertOnBackspace); this.Controls.Add(this.cbBackspaceInvalid); this.Controls.Add(this.cbAcceptDd); @@ -155,12 +165,13 @@ private void InitializeComponent() { private System.Windows.Forms.CheckBox cbAcceptDd; private System.Windows.Forms.CheckBox cbBackspaceInvalid; private System.Windows.Forms.CheckBox cbBackconvertOnBackspace; - private System.Windows.Forms.Button btnOK; - private System.Windows.Forms.Button btnCancel; private System.Windows.Forms.BindingSource settingsBindingSource; - private System.Windows.Forms.Button btnAbout; private System.Windows.Forms.Button btnEnable; private System.Windows.Forms.Label label1; + private System.Windows.Forms.CheckBox cbOptimizeMultilang; + private System.Windows.Forms.Button btnOK; + private System.Windows.Forms.Button btnCancel; + private System.Windows.Forms.Button btnAbout; } } diff --git a/VietTypeConfig/Form1.en.resx b/VietTypeConfig/Form1.en.resx new file mode 100644 index 0000000..27240ed --- /dev/null +++ b/VietTypeConfig/Form1.en.resx @@ -0,0 +1,185 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + VietType Settings + + + VietType {0} {1} +Copyright © 2018 Dinh Ngoc Tu. +VietType is free software, licensed under the GNU General Public License. VietType is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the included LICENSE file for more details. + + + About VietType + + + A&bout + + + Cancel + + + &Enable VietType + + + &Disable VietType + + + OK + + + Cannot configure VietType: {0} + + + Cannot find VietType library: {0} + + + Cannot save settings: {0} + + + Accept 'd' any&where + + + &Reconvert word on Backspace (Experimental) + + + Backspaced &invalid word stays invalid + + + Vietnamese mode by de&fault + + + &Use "oà", "uý" instead of "òa", "úy" + + + &Optimize multilingual typing + + + Successfully disabled VietType. + + + Successfully enabled VietType. Switch to VietType in the language bar to start using it. + + + label1 + + + VietType is not enabled. Enable it now? + + \ No newline at end of file diff --git a/VietTypeConfig/Form1.resx b/VietTypeConfig/Form1.resx index 47c5705..4043d2c 100644 --- a/VietTypeConfig/Form1.resx +++ b/VietTypeConfig/Form1.resx @@ -1,4 +1,4 @@ - +