Skip to content

Commit

Permalink
add multiple optimize multilang levels
Browse files Browse the repository at this point in the history
  • Loading branch information
dinhngtu committed Jan 7, 2024
1 parent 1cb2b38 commit bf007fb
Show file tree
Hide file tree
Showing 7 changed files with 316 additions and 245 deletions.
4 changes: 2 additions & 2 deletions VietTypeATL/EngineSettingsController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@ HRESULT EngineSettingsController::LoadTelexSettings(Telex::TelexConfig& cfg) {

DWORD optimize_multilang = true;
hr = _tc_optimize_multilang->GetValueOrDefault(
&optimize_multilang, _ec->GetEngine().GetConfig().optimize_multilang);
&optimize_multilang, static_cast<DWORD>(_ec->GetEngine().GetConfig().optimize_multilang));
HRESULT_CHECK_RETURN(hr, L"%s", L"_tc_optimize_multilang->GetValueOrWriteback failed");
cfg.optimize_multilang = static_cast<bool>(optimize_multilang);
cfg.optimize_multilang = static_cast<Telex::TelexConfig::OptimizeMultilang>(optimize_multilang);

return S_OK;
}
Expand Down
34 changes: 23 additions & 11 deletions VietTypeConfig/Form1.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion VietTypeConfig/Form1.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Resources;
using System.Runtime;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using VietTypeConfig.Properties;
Expand All @@ -14,7 +15,9 @@ public Form1() {
}

private void Form1_Load(object sender, EventArgs e) {
settingsBindingSource.DataSource = Settings.LoadSettings();
var settings = Settings.LoadSettings();
settingsBindingSource.DataSource = settings;
cbOptimizeMultilang.SelectedIndex = settings.OptimizeMultilang;
try {
UpdateEnabled();
} catch (Exception ex) {
Expand All @@ -31,6 +34,7 @@ private void CloseForm(object sender, EventArgs e) {
private void Form1_FormClosing(object sender, FormClosingEventArgs e) {
var settings = settingsBindingSource.DataSource as Settings;
if (DialogResult == DialogResult.OK && settings != null) {
settings.OptimizeMultilang = cbOptimizeMultilang.SelectedIndex;
try {
Settings.SaveSettings(settings);
} catch (Exception ex) {
Expand Down
14 changes: 10 additions & 4 deletions VietTypeConfig/Form1.en.resx
Original file line number Diff line number Diff line change
Expand Up @@ -167,17 +167,23 @@ VietType is free software, licensed under the GNU General Public License. VietTy
<data name="cbOaUy.Text" xml:space="preserve">
<value>&amp;Use "oà", "uý" instead of "òa", "úy"</value>
</data>
<data name="cbOptimizeMultilang.Text" xml:space="preserve">
<value>&amp;Optimize multilingual typing</value>
<data name="cbOptimizeMultilang.Items" xml:space="preserve">
<value>Off</value>
</data>
<data name="cbOptimizeMultilang.Items1" xml:space="preserve">
<value>On</value>
</data>
<data name="cbOptimizeMultilang.Items2" xml:space="preserve">
<value>Aggressive</value>
</data>
<data name="disableSuccessMessage" xml:space="preserve">
<value>Successfully disabled VietType.</value>
</data>
<data name="enableSuccessMessage" xml:space="preserve">
<value>Successfully enabled VietType. Switch to VietType in the language bar to start using it.</value>
</data>
<data name="label1.Text" xml:space="preserve">
<value>label1</value>
<data name="lblOptimizeMultilang.Text" xml:space="preserve">
<value>&amp;Optimize multilingual typing</value>
</data>
<data name="notEnabledQuestion" xml:space="preserve">
<value>VietType is not enabled. Enable it now?</value>
Expand Down
Loading

0 comments on commit bf007fb

Please sign in to comment.