- Implement "Input language Properties" dialog

svn path=/trunk/; revision=33504
This commit is contained in:
Dmitry Chapyshev 2008-05-13 20:23:23 +00:00
parent c5465c5668
commit 381642f247
17 changed files with 285 additions and 84 deletions

View file

@ -36,7 +36,7 @@ SelectLayoutByLang(VOID)
}
}
static INT
INT
GetLayoutCount(LPTSTR szLang)
{
HKEY hKey;
@ -84,7 +84,7 @@ AddNewLayout(HWND hwndDlg)
iLayout = SendMessage(hLayoutList, CB_GETCURSEL, 0, 0);
if (iLayout == CB_ERR) return;
if (RegOpenKeyEx(HKEY_CURRENT_USER, _T("Keyboard Layout\\Preload"), 0, KEY_QUERY_VALUE | KEY_SET_VALUE, &hKey) == ERROR_SUCCESS)
if (RegOpenKeyEx(HKEY_CURRENT_USER, _T("Keyboard Layout\\Preload"), 0, KEY_ALL_ACCESS, &hKey) == ERROR_SUCCESS)
{
if (RegQueryInfoKey(hKey, NULL, NULL, NULL, NULL, NULL, NULL, &cValues, NULL, NULL, NULL, NULL) == ERROR_SUCCESS)
{
@ -111,7 +111,7 @@ AddNewLayout(HWND hwndDlg)
if (_tcslen(SubPath) != 0)
{
if (RegCreateKeyEx(HKEY_CURRENT_USER, _T("Keyboard Layout\\Substitutes"), 0, NULL,
REG_OPTION_NON_VOLATILE, KEY_QUERY_VALUE | KEY_SET_VALUE | KEY_WRITE,
REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS,
NULL, &hSubKey, NULL) == ERROR_SUCCESS)
{
if (RegSetValueEx(hSubKey, SubPath, 0, REG_SZ, (LPBYTE)pts,
@ -123,7 +123,7 @@ AddNewLayout(HWND hwndDlg)
}
RegCloseKey(hSubKey);
}
pts = SubPath;
lstrcpy(pts, SubPath);
}
if (RegSetValueEx(hKey,
@ -141,7 +141,7 @@ AddNewLayout(HWND hwndDlg)
}
VOID
CreateKeyboardLayoutList(VOID)
CreateKeyboardLayoutList(HWND hItemsList)
{
HKEY hKey;
PTSTR pstrLayoutID;
@ -157,16 +157,16 @@ CreateKeyboardLayoutList(VOID)
{
GetLayoutName(szLayoutID, KeyName);
INT iIndex = (INT) SendMessage(hLayoutList, CB_ADDSTRING, 0, (LPARAM)KeyName);
INT iIndex = (INT) SendMessage(hItemsList, CB_ADDSTRING, 0, (LPARAM)KeyName);
pstrLayoutID = (PTSTR)HeapAlloc(hProcessHeap, 0, sizeof(szLayoutID));
lstrcpy(pstrLayoutID, szLayoutID);
SendMessage(hLayoutList, CB_SETITEMDATA, iIndex, (LPARAM)pstrLayoutID);
SendMessage(hItemsList, CB_SETITEMDATA, iIndex, (LPARAM)pstrLayoutID);
// FIXME!
if (_tcscmp(szLayoutID, _T("00000409")) == 0)
{
SendMessage(hLayoutList, CB_SETCURSEL, (WPARAM)iIndex, (LPARAM)0);
SendMessage(hItemsList, CB_SETCURSEL, (WPARAM)iIndex, (LPARAM)0);
}
dwIndex++;
@ -220,7 +220,7 @@ AddDlgProc(HWND hDlg,
hLangList = GetDlgItem(hDlg, IDC_INPUT_LANG_COMBO);
hLayoutList = GetDlgItem(hDlg, IDC_KEYBOARD_LO_COMBO);
EnumSystemLocales(LanguagesEnumProc, LCID_INSTALLED);
CreateKeyboardLayoutList();
CreateKeyboardLayoutList(hLayoutList);
}
break;

View file

@ -50,16 +50,14 @@ KeySettingsDlgProc(HWND hDlg,UINT message,WPARAM wParam,LPARAM lParam);
INT_PTR CALLBACK
AddDlgProc(HWND hDlg,UINT message,WPARAM wParam,LPARAM lParam);
VOID
CreateKeyboardLayoutList(VOID);
CreateKeyboardLayoutList(HWND hItemsList);
INT
GetLayoutCount(LPTSTR szLang);
/* changekeyseq.c */
INT_PTR CALLBACK
ChangeKeySeqDlgProc(HWND hDlg,UINT message,WPARAM wParam,LPARAM lParam);
/* inputlangprop.c */
INT_PTR CALLBACK
InputLangPropDlgProc(HWND hDlg,UINT message,WPARAM wParam,LPARAM lParam);
void ShowLastWin32Error(HWND hWndOwner);
#endif /* __CPL_INPUT_H */

View file

@ -16,6 +16,5 @@
<file>keysettings.c</file>
<file>add.c</file>
<file>changekeyseq.c</file>
<file>inputlangprop.c</file>
<file>input.rc</file>
</module>

View file

@ -1,45 +0,0 @@
/*
*
* PROJECT: input.dll
* FILE: dll/win32/input/inputlangprop.c
* PURPOSE: input.dll
* PROGRAMMER: Dmitry Chapyshev (lentind@yandex.ru)
* Colin Finck
* UPDATE HISTORY:
* 06-09-2007 Created
*/
#include "resource.h"
#include "input.h"
INT_PTR CALLBACK
InputLangPropDlgProc(HWND hDlg,
UINT message,
WPARAM wParam,
LPARAM lParam)
{
UNREFERENCED_PARAMETER(lParam);
switch (message)
{
case WM_INITDIALOG:
CreateKeyboardLayoutList();
break;
case WM_COMMAND:
switch (LOWORD(wParam))
{
case IDOK:
break;
case IDCANCEL:
EndDialog(hDlg,LOWORD(wParam));
break;
}
break;
}
return FALSE;
}
/* EOF */

View file

@ -67,9 +67,9 @@ CAPTION "
FONT 8, "MS Shell Dlg"
BEGIN
LTEXT "Åçèê íà ïèñàíå", -1, 7, 7, 55, 8
LTEXT "", -1, 73, 7, 129, 8
LTEXT "", IDC_INPUT_LANG_STR, 73, 7, 129, 8
LTEXT "Êëàâèàòóðíà ïîäðåäáà/IME:", -1, 7, 21, 110, 10
COMBOBOX IDC_KB_LAYOUT_IME_COMBO, 7, 32, 212, 60, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL
COMBOBOX IDC_KB_LAYOUT_IME_COMBO, 7, 32, 212, 150, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL
DEFPUSHBUTTON "Äîáðå", IDOK, 116, 53, 52, 14
PUSHBUTTON "Îòêàç", IDCANCEL, 169, 53, 52, 14
END

View file

@ -67,9 +67,9 @@ CAPTION "Eingabesprache Einstellungen"
FONT 8, "MS Shell Dlg"
BEGIN
LTEXT "Eingabesprache:", -1, 7, 7, 61, 8
LTEXT "", -1, 73, 7, 129, 8
LTEXT "", IDC_INPUT_LANG_STR, 73, 7, 129, 8
LTEXT "&Tastaturlayout/IME:", -1, 7, 21, 110, 10
COMBOBOX IDC_KB_LAYOUT_IME_COMBO, 7, 32, 212, 60, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL
COMBOBOX IDC_KB_LAYOUT_IME_COMBO, 7, 32, 212, 150, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL
DEFPUSHBUTTON "OK", IDOK, 116, 53, 52, 14
PUSHBUTTON "Abbrechen", IDCANCEL, 169, 53, 52, 14
END

View file

@ -67,9 +67,9 @@ CAPTION "
FONT 8, "MS Shell Dlg"
BEGIN
LTEXT "Ãëþóóá åéóáãùãÞò:", -1, 7, 7, 61, 8
LTEXT "", -1, 73, 7, 129, 8
LTEXT "", IDC_INPUT_LANG_STR, 73, 7, 129, 8
LTEXT "&ÄéÜôáîç ðëçêôñïëïãßïõ/IME:", -1, 7, 21, 110, 10
COMBOBOX IDC_KB_LAYOUT_IME_COMBO, 7, 32, 212, 60, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL
COMBOBOX IDC_KB_LAYOUT_IME_COMBO, 7, 32, 212, 150, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL
DEFPUSHBUTTON "OK", IDOK, 116, 53, 52, 14
PUSHBUTTON "¢êõñï", IDCANCEL, 169, 53, 52, 14
END

View file

@ -67,9 +67,9 @@ CAPTION "Input language Properties"
FONT 8, "MS Shell Dlg"
BEGIN
LTEXT "Input language:", -1, 7, 7, 61, 8
LTEXT "", -1, 73, 7, 129, 8
LTEXT "", IDC_INPUT_LANG_STR, 73, 7, 129, 8
LTEXT "&Keyboard layout/IME:", -1, 7, 21, 110, 10
COMBOBOX IDC_KB_LAYOUT_IME_COMBO, 7, 32, 212, 60, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL
COMBOBOX IDC_KB_LAYOUT_IME_COMBO, 7, 32, 212, 150, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL
DEFPUSHBUTTON "OK", IDOK, 116, 53, 52, 14
PUSHBUTTON "Cancel", IDCANCEL, 169, 53, 52, 14
END

View file

@ -72,9 +72,9 @@ CAPTION "Propiedades del idioma de entrada"
FONT 8, "MS Shell Dlg"
BEGIN
LTEXT "&Idioma de dispositivo de entrada:", -1, 7, 7, 61, 8
LTEXT "", -1, 73, 7, 129, 8
LTEXT "", IDC_INPUT_LANG_STR, 73, 7, 129, 8
LTEXT "&Distribución del teclado/IME:", -1, 7, 21, 110, 10
COMBOBOX IDC_KB_LAYOUT_IME_COMBO, 7, 32, 212, 60, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL
COMBOBOX IDC_KB_LAYOUT_IME_COMBO, 7, 32, 212, 150, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL
DEFPUSHBUTTON "Aceptar", IDOK, 116, 53, 52, 14
PUSHBUTTON "Cancelar", IDCANCEL, 169, 53, 52, 14
END

View file

@ -67,9 +67,9 @@ CAPTION "Propriet
FONT 8, "MS Shell Dlg"
BEGIN
LTEXT "Langue de saisie :", -1, 7, 7, 61, 8
LTEXT "", -1, 73, 7, 129, 8
LTEXT "", IDC_INPUT_LANG_STR, 73, 7, 129, 8
LTEXT "Configuration clavier/IME :", -1, 7, 21, 110, 10
COMBOBOX IDC_KB_LAYOUT_IME_COMBO, 7, 32, 212, 60, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL
COMBOBOX IDC_KB_LAYOUT_IME_COMBO, 7, 32, 212, 150, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL
DEFPUSHBUTTON "OK", IDOK, 116, 53, 52, 14
PUSHBUTTON "Annuler", IDCANCEL, 169, 53, 52, 14
END

View file

@ -67,9 +67,9 @@ CAPTION "Propriet
FONT 8, "MS Shell Dlg"
BEGIN
LTEXT "Lingua:", -1, 7, 7, 61, 8
LTEXT "", -1, 73, 7, 129, 8
LTEXT "", IDC_INPUT_LANG_STR, 73, 7, 129, 8
LTEXT "&Disposizione/IME tastiera:", -1, 7, 21, 110, 10
COMBOBOX IDC_KB_LAYOUT_IME_COMBO, 7, 32, 212, 60, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL
COMBOBOX IDC_KB_LAYOUT_IME_COMBO, 7, 32, 212, 150, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL
DEFPUSHBUTTON "OK", IDOK, 116, 53, 52, 14
PUSHBUTTON "Annulla", IDCANCEL, 169, 53, 52, 14
END

View file

@ -74,9 +74,9 @@ CAPTION "W
FONT 8, "MS Shell Dlg"
BEGIN
LTEXT "Jêzyk:", -1, 7, 7, 61, 8
LTEXT "", -1, 73, 7, 129, 8
LTEXT "", IDC_INPUT_LANG_STR, 73, 7, 129, 8
LTEXT "&Uk³ad klawiatury/IME:", -1, 7, 21, 110, 10
COMBOBOX IDC_KB_LAYOUT_IME_COMBO, 7, 32, 212, 60, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL
COMBOBOX IDC_KB_LAYOUT_IME_COMBO, 7, 32, 212, 150, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL
DEFPUSHBUTTON "OK", IDOK, 116, 53, 52, 14
PUSHBUTTON "Anuluj", IDCANCEL, 169, 53, 52, 14
END

View file

@ -67,9 +67,9 @@ CAPTION "
FONT 8, "MS Shell Dlg"
BEGIN
LTEXT "ßçûê ââîäà:", -1, 7, 7, 61, 8
LTEXT "", -1, 73, 7, 129, 8
LTEXT "", IDC_INPUT_LANG_STR, 73, 7, 129, 8
LTEXT "&Ðàñêëàäêà êëàâèàòóðû:", -1, 7, 21, 170, 10
COMBOBOX IDC_KB_LAYOUT_IME_COMBO, 7, 32, 212, 60, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL
COMBOBOX IDC_KB_LAYOUT_IME_COMBO, 7, 32, 212, 150, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL
DEFPUSHBUTTON "OK", IDOK, 114, 53, 52, 14
PUSHBUTTON "Îòìåíà", IDCANCEL, 169, 53, 52, 14
END

View file

@ -71,9 +71,9 @@ CAPTION "Input language Properties"
FONT 8, "MS Shell Dlg"
BEGIN
LTEXT "Input language:", -1, 7, 7, 61, 8
LTEXT "", -1, 73, 7, 129, 8
LTEXT "", IDC_INPUT_LANG_STR, 73, 7, 129, 8
LTEXT "&Keyboard layout/IME:", -1, 7, 21, 110, 10
COMBOBOX IDC_KB_LAYOUT_IME_COMBO, 7, 32, 212, 60, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL
COMBOBOX IDC_KB_LAYOUT_IME_COMBO, 7, 32, 212, 150, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL
DEFPUSHBUTTON "OK", IDOK, 116, 53, 52, 14
PUSHBUTTON "Zruši<C5A1>", IDCANCEL, 169, 53, 52, 14
END

View file

@ -75,9 +75,9 @@ CAPTION "
FONT 8, "MS Shell Dlg"
BEGIN
LTEXT "Ìîâà ââîäó:", -1, 7, 7, 61, 8
LTEXT "", -1, 73, 7, 129, 8
LTEXT "", IDC_INPUT_LANG_STR, 73, 7, 129, 8
LTEXT "&Ðîçêëàäêà êëàâ³àòóðè àáî çàñ³á ââîäó (IME):", -1, 7, 21, 110, 10
COMBOBOX IDC_KB_LAYOUT_IME_COMBO, 7, 32, 212, 60, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL
COMBOBOX IDC_KB_LAYOUT_IME_COMBO, 7, 32, 212, 150, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL
DEFPUSHBUTTON "OK", IDOK, 116, 53, 52, 14
PUSHBUTTON "Ñêàñóâàòè", IDCANCEL, 169, 53, 52, 14
END

View file

@ -38,6 +38,7 @@
#define IDC_KEYBOARD_LO_COMBO 1011
#define IDC_USE_SK 1012
#define IDC_KB_LAYOUT_IME_COMBO 1013
#define IDC_INPUT_LANG_STR 1014
/* IDS */
#define IDS_CPLSYSTEMNAME 1

View file

@ -14,6 +14,8 @@
static HWND MainDlgWnd;
static HIMAGELIST hImgList;
// for SaveInputLang()
static INT OldLayoutNum;
typedef struct
{
@ -25,6 +27,15 @@ typedef struct
} LAYOUT_ITEM, *LPLAYOUT_ITEM;
static INT
IsLayoutSelected()
{
INT iIndex = (INT) SendMessage(GetDlgItem(MainDlgWnd, IDC_KEYLAYOUT_LIST),
LVM_GETNEXTITEM, -1, LVNI_FOCUSED);
return iIndex;
}
static HICON
CreateLayoutIcon(LPTSTR szInd)
{
@ -85,6 +96,51 @@ CreateLayoutIcon(LPTSTR szInd)
return hIcon;
}
static BOOL
GetLayoutID(LPTSTR szLayoutNum, LPTSTR szLCID)
{
DWORD dwBufLen;
DWORD dwRes;
HKEY hKey;
TCHAR szTempLCID[CCH_LAYOUT_ID + 1];
// Get the Layout ID
if (RegOpenKeyEx(HKEY_CURRENT_USER, _T("Keyboard Layout\\Preload"), 0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS)
{
dwBufLen = sizeof(szTempLCID);
dwRes = RegQueryValueEx(hKey, szLayoutNum, NULL, NULL, (LPBYTE)szTempLCID, &dwBufLen);
if (dwRes != ERROR_SUCCESS)
{
RegCloseKey(hKey);
return FALSE;
}
RegCloseKey(hKey);
}
// Look for a substitude of this layout
if (RegOpenKeyEx(HKEY_CURRENT_USER, _T("Keyboard Layout\\Substitutes"), 0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS)
{
dwBufLen = sizeof(szTempLCID);
if (RegQueryValueEx(hKey, szTempLCID, NULL, NULL, (LPBYTE)szLCID, &dwBufLen) != ERROR_SUCCESS)
{
// No substitute found, then use the old LCID
lstrcpy(szLCID, szTempLCID);
}
RegCloseKey(hKey);
}
else
{
// Substitutes key couldn't be opened, so use the old LCID
lstrcpy(szLCID, szTempLCID);
}
return TRUE;
}
BOOL
GetLayoutName(LPCTSTR szLCID, LPTSTR szName)
{
@ -312,6 +368,195 @@ DeleteLayout(VOID)
}
}
static VOID
SaveInputLang(HWND hDlg)
{
HKEY hKey, hSubKey;
TCHAR szLayoutID[CCH_LAYOUT_ID + 1], szLayoutNum[CCH_ULONG_DEC + 1],
szPreload[CCH_LAYOUT_ID + 1], LangID[CCH_LAYOUT_ID + 1],
Lang[MAX_PATH], SubPath[MAX_PATH];
PTSTR pts;
INT iLayout;
DWORD dwSize;
LANGID langid;
iLayout = SendMessage(GetDlgItem(hDlg, IDC_KB_LAYOUT_IME_COMBO), CB_GETCURSEL, 0, 0);
if (iLayout == CB_ERR) return;
pts = (PTSTR) SendMessage(GetDlgItem(hDlg, IDC_KB_LAYOUT_IME_COMBO), CB_GETITEMDATA, iLayout, 0);
_ultot(OldLayoutNum, szLayoutNum, 10);
if (!GetLayoutID(szLayoutNum, szLayoutID)) return;
// if old layout = selected layout
if (_tcscmp(szLayoutID, pts) == 0) return;
if (RegOpenKeyEx(HKEY_CURRENT_USER, _T("Keyboard Layout\\Preload"), 0,
KEY_ALL_ACCESS, &hKey) == ERROR_SUCCESS)
{
dwSize = sizeof(szPreload);
if (RegQueryValueEx(hKey, szLayoutNum, NULL, NULL, (LPBYTE)szPreload, &dwSize) != ERROR_SUCCESS)
{
RegCloseKey(hKey);
return;
}
langid = (LANGID)_tcstoul(szPreload, NULL, 16);
GetLocaleInfo(langid, LOCALE_ILANGUAGE, Lang, sizeof(Lang) / sizeof(TCHAR));
wsprintf(LangID, _T("0000%s"), Lang);
if (szPreload[0] == 'd')
{
if (_tcscmp(LangID, pts) == 0)
{
if (RegOpenKeyEx(HKEY_CURRENT_USER, _T("Keyboard Layout\\Substitutes"), 0,
KEY_ALL_ACCESS, &hSubKey) == ERROR_SUCCESS)
{
if (RegDeleteValue(hSubKey, szPreload) != ERROR_SUCCESS)
{
RegCloseKey(hSubKey);
RegCloseKey(hKey);
return;
}
RegCloseKey(hSubKey);
RegSetValueEx(hKey, szLayoutNum, 0, REG_SZ, (LPBYTE)pts,
(DWORD)((CCH_LAYOUT_ID + 1) * sizeof(TCHAR)));
}
}
else
{
if (RegOpenKeyEx(HKEY_CURRENT_USER, _T("Keyboard Layout\\Substitutes"), 0,
KEY_ALL_ACCESS, &hSubKey) == ERROR_SUCCESS)
{
RegSetValueEx(hSubKey, szPreload, 0, REG_SZ, (LPBYTE)pts,
(DWORD)((CCH_LAYOUT_ID + 1) * sizeof(TCHAR)));
RegCloseKey(hSubKey);
}
}
}
else
{
if (_tcscmp(LangID, pts) == 0)
{
RegSetValueEx(hKey, szLayoutNum, 0, REG_SZ, (LPBYTE)pts,
(DWORD)((CCH_LAYOUT_ID + 1) * sizeof(TCHAR)));
}
else
{
if (RegCreateKeyEx(HKEY_CURRENT_USER, _T("Keyboard Layout\\Substitutes"), 0, NULL,
REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS,
NULL, &hSubKey, NULL) == ERROR_SUCCESS)
{
wsprintf(SubPath, _T("d%03d%s"), GetLayoutCount(Lang)-1, Lang);
RegSetValueEx(hSubKey, SubPath, 0, REG_SZ, (LPBYTE)pts,
(DWORD)((CCH_LAYOUT_ID + 1) * sizeof(TCHAR)));
RegSetValueEx(hKey, szLayoutNum, 0, REG_SZ, (LPBYTE)SubPath,
(DWORD)((CCH_LAYOUT_ID + 1) * sizeof(TCHAR)));
RegCloseKey(hSubKey);
}
}
}
RegCloseKey(hKey);
}
}
static VOID
InitInputLangPropDlg(HWND hDlg)
{
HKEY hKey, hSubKey;
LVITEM item;
INT LayoutNum;
TCHAR szLayoutNum[10 + 1], szPreload[CCH_LAYOUT_ID + 1],
szTmp[CCH_LAYOUT_ID + 1], szName[MAX_PATH];
DWORD dwSize;
LANGID langid;
ZeroMemory(&item, sizeof(LVITEM));
item.mask = LVIF_PARAM;
item.iItem = IsLayoutSelected();
(VOID) ListView_GetItem(GetDlgItem(MainDlgWnd, IDC_KEYLAYOUT_LIST), &item);
LayoutNum = (INT) item.lParam;
OldLayoutNum = LayoutNum;
if (RegOpenKeyEx(HKEY_CURRENT_USER, _T("Keyboard Layout\\Preload"), 0,
KEY_ALL_ACCESS, &hKey) == ERROR_SUCCESS)
{
_ultot(LayoutNum, szLayoutNum, 10);
dwSize = sizeof(szPreload);
RegQueryValueEx(hKey, szLayoutNum, NULL, NULL, (LPBYTE)szPreload, &dwSize);
langid = (LANGID)_tcstoul(szPreload, NULL, 16);
GetLocaleInfo(langid, LOCALE_SLANGUAGE, (LPTSTR)szName, sizeof(szName) / sizeof(TCHAR));
SetWindowText(GetDlgItem(hDlg, IDC_INPUT_LANG_STR), szName);
if (szPreload[0] == 'd')
{
if (RegOpenKeyEx(HKEY_CURRENT_USER, _T("Keyboard Layout\\Substitutes"), 0,
KEY_ALL_ACCESS, &hSubKey) == ERROR_SUCCESS)
{
if (RegQueryValueEx(hSubKey, szPreload, NULL, NULL, (LPBYTE)szTmp, &dwSize) != ERROR_SUCCESS)
{
RegCloseKey(hSubKey);
RegCloseKey(hKey);
return;
}
lstrcpy(szPreload, szTmp);
RegCloseKey(hSubKey);
}
}
if (GetLayoutName(szPreload, szName))
{
SendMessage(GetDlgItem(hDlg, IDC_KB_LAYOUT_IME_COMBO),
CB_SELECTSTRING, (WPARAM)-1, (LPARAM)szName);
}
}
RegCloseKey(hKey);
}
INT_PTR CALLBACK
InputLangPropDlgProc(HWND hDlg,
UINT message,
WPARAM wParam,
LPARAM lParam)
{
UNREFERENCED_PARAMETER(lParam);
switch (message)
{
case WM_INITDIALOG:
CreateKeyboardLayoutList(GetDlgItem(hDlg, IDC_KB_LAYOUT_IME_COMBO));
InitInputLangPropDlg(hDlg);
break;
case WM_COMMAND:
switch (LOWORD(wParam))
{
case IDOK:
SaveInputLang(hDlg);
UpdateLayoutsList();
EndDialog(hDlg,LOWORD(wParam));
break;
case IDCANCEL:
EndDialog(hDlg,LOWORD(wParam));
break;
}
break;
}
return FALSE;
}
/* Property page dialog callback */
INT_PTR CALLBACK
SettingPageProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam)
@ -329,8 +574,6 @@ SettingPageProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam)
hImgList = ImageList_Create(16, 16, ILC_COLOR8 | ILC_MASK, 0, 1);
InitLangList(hwndDlg);
(VOID) ListView_SetImageList(GetDlgItem(MainDlgWnd, IDC_KEYLAYOUT_LIST), hImgList, LVSIL_SMALL);
EnableWindow(GetDlgItem(hwndDlg, IDC_PROP_BUTTON),FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_SET_DEFAULT),FALSE);
}
break;
case WM_NOTIFY:
@ -363,11 +606,16 @@ SettingPageProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam)
break;
case IDC_PROP_BUTTON:
if (IsLayoutSelected() != -1)
DialogBox(hApplet,
MAKEINTRESOURCE(IDD_INPUT_LANG_PROP),
hwndDlg,
InputLangPropDlgProc);
break;
case IDC_SET_DEFAULT:
break;
}
break;
case WM_DESTROY: