https://git.reactos.org/?p=reactos.git;a=commitdiff;h=34635e1585e97539358d9…
commit 34635e1585e97539358d975c4fe0e03758c3c14d
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Mon Sep 19 18:13:17 2022 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Mon Sep 19 18:13:17 2022 +0900
[CPL][INTL] Realize automatic Japanese IME installation (#4705)
In intl.cpl, realize semi-automatic Japanese IME installation by checkbox
"Install files for East Asian languages" by using rapps.exe. CORE-11700
---
dll/cpl/intl/languages.c | 65 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 65 insertions(+)
diff --git a/dll/cpl/intl/languages.c b/dll/cpl/intl/languages.c
index 6056a121511..c4507b75643 100644
--- a/dll/cpl/intl/languages.c
+++ b/dll/cpl/intl/languages.c
@@ -1,6 +1,16 @@
#include "intl.h"
#include <shellapi.h>
+#include <strsafe.h>
+
+/* Is there any Japanese input method? */
+BOOL HasJapaneseIME(VOID)
+{
+ WCHAR szImePath[MAX_PATH];
+ GetSystemDirectoryW(szImePath, _countof(szImePath));
+ StringCchCatW(szImePath, _countof(szImePath), L"\\mzimeja.ime");
+ return GetFileAttributesW(szImePath) != INVALID_FILE_ATTRIBUTES;
+}
/* Property page dialog callback */
INT_PTR CALLBACK
@@ -25,6 +35,24 @@ LanguagesPageProc(HWND hwndDlg,
EnableWindow(GetDlgItem(hwndDlg, IDC_INST_FILES_FOR_RTOL_LANG), FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_INST_FILES_FOR_ASIAN), FALSE);
}
+
+ /* EAST ASIAN specific */
+ switch (PRIMARYLANGID(GetUserDefaultLangID()))
+ {
+ case LANG_JAPANESE:
+ if (HasJapaneseIME())
+ {
+ EnableWindow(GetDlgItem(hwndDlg, IDC_INST_FILES_FOR_ASIAN),
FALSE);
+ CheckDlgButton(hwndDlg, IDC_INST_FILES_FOR_ASIAN, BST_CHECKED);
+ }
+ break;
+
+ case LANG_CHINESE: /* Not supported yet */
+ case LANG_KOREAN: /* Not supported yet */
+ default:
+ EnableWindow(GetDlgItem(hwndDlg, IDC_INST_FILES_FOR_ASIAN), FALSE);
+ break;
+ }
break;
case WM_COMMAND:
@@ -46,6 +74,43 @@ LanguagesPageProc(HWND hwndDlg,
}
}
break;
+
+ case IDC_INST_FILES_FOR_ASIAN:
+ PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
+ break;
+ }
+ break;
+
+ case WM_NOTIFY:
+ if (((LPNMHDR)lParam)->code == (UINT)PSN_APPLY)
+ {
+ /* Apply changes */
+ if (IsDlgButtonChecked(hwndDlg, IDC_INST_FILES_FOR_ASIAN) ==
BST_CHECKED)
+ {
+ /* EAST ASIAN specific */
+ switch (PRIMARYLANGID(GetUserDefaultLangID()))
+ {
+ case LANG_JAPANESE:
+ if (HasJapaneseIME())
+ {
+ EnableWindow(GetDlgItem(hwndDlg,
IDC_INST_FILES_FOR_ASIAN), FALSE);
+ CheckDlgButton(hwndDlg, IDC_INST_FILES_FOR_ASIAN,
BST_CHECKED);
+ }
+ else
+ {
+ ShellExecuteW(hwndDlg, NULL, L"rapps.exe",
L"/INSTALL mzimeja",
+ NULL, SW_SHOWNORMAL);
+ }
+ break;
+
+ case LANG_CHINESE: /* Not supported yet */
+ case LANG_KOREAN: /* Not supported yet */
+ default:
+ break;
+ }
+ }
+
+ PropSheet_UnChanged(GetParent(hwndDlg), hwndDlg);
}
break;
}