Author: dchapyshev
Date: Tue May 13 15:23:23 2008
New Revision: 33504
URL:
http://svn.reactos.org/svn/reactos?rev=33504&view=rev
Log:
- Implement "Input language Properties" dialog
Removed:
trunk/reactos/dll/cpl/input/inputlangprop.c
Modified:
trunk/reactos/dll/cpl/input/add.c
trunk/reactos/dll/cpl/input/input.h
trunk/reactos/dll/cpl/input/input.rbuild
trunk/reactos/dll/cpl/input/lang/bg-BG.rc
trunk/reactos/dll/cpl/input/lang/de-DE.rc
trunk/reactos/dll/cpl/input/lang/el-GR.rc
trunk/reactos/dll/cpl/input/lang/en-US.rc
trunk/reactos/dll/cpl/input/lang/es-ES.rc
trunk/reactos/dll/cpl/input/lang/fr-FR.rc
trunk/reactos/dll/cpl/input/lang/it-IT.rc
trunk/reactos/dll/cpl/input/lang/pl-PL.rc
trunk/reactos/dll/cpl/input/lang/ru-RU.rc
trunk/reactos/dll/cpl/input/lang/sk-SK.rc
trunk/reactos/dll/cpl/input/lang/uk-UA.rc
trunk/reactos/dll/cpl/input/resource.h
trunk/reactos/dll/cpl/input/settings.c
Modified: trunk/reactos/dll/cpl/input/add.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/input/add.c?rev=33…
==============================================================================
--- trunk/reactos/dll/cpl/input/add.c [iso-8859-1] (original)
+++ trunk/reactos/dll/cpl/input/add.c [iso-8859-1] Tue May 13 15:23:23 2008
@@ -36,7 +36,7 @@
}
}
-static INT
+INT
GetLayoutCount(LPTSTR szLang)
{
HKEY hKey;
@@ -84,7 +84,7 @@
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 @@
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 @@
}
RegCloseKey(hSubKey);
}
- pts = SubPath;
+ lstrcpy(pts, SubPath);
}
if (RegSetValueEx(hKey,
@@ -141,7 +141,7 @@
}
VOID
-CreateKeyboardLayoutList(VOID)
+CreateKeyboardLayoutList(HWND hItemsList)
{
HKEY hKey;
PTSTR pstrLayoutID;
@@ -157,16 +157,16 @@
{
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 @@
hLangList = GetDlgItem(hDlg, IDC_INPUT_LANG_COMBO);
hLayoutList = GetDlgItem(hDlg, IDC_KEYBOARD_LO_COMBO);
EnumSystemLocales(LanguagesEnumProc, LCID_INSTALLED);
- CreateKeyboardLayoutList();
+ CreateKeyboardLayoutList(hLayoutList);
}
break;
Modified: trunk/reactos/dll/cpl/input/input.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/input/input.h?rev=…
==============================================================================
--- trunk/reactos/dll/cpl/input/input.h [iso-8859-1] (original)
+++ trunk/reactos/dll/cpl/input/input.h [iso-8859-1] Tue May 13 15:23:23 2008
@@ -50,15 +50,13 @@
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);
Modified: trunk/reactos/dll/cpl/input/input.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/input/input.rbuild…
==============================================================================
--- trunk/reactos/dll/cpl/input/input.rbuild [iso-8859-1] (original)
+++ trunk/reactos/dll/cpl/input/input.rbuild [iso-8859-1] Tue May 13 15:23:23 2008
@@ -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>
Removed: trunk/reactos/dll/cpl/input/inputlangprop.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/input/inputlangpro…
==============================================================================
--- trunk/reactos/dll/cpl/input/inputlangprop.c [iso-8859-1] (original)
+++ trunk/reactos/dll/cpl/input/inputlangprop.c (removed)
@@ -1,45 +1,0 @@
-/*
- *
- * PROJECT: input.dll
- * FILE: dll/win32/input/inputlangprop.c
- * PURPOSE: input.dll
- * PROGRAMMER: Dmitry Chapyshev (lentind(a)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 */
Modified: trunk/reactos/dll/cpl/input/lang/bg-BG.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/input/lang/bg-BG.r…
==============================================================================
--- trunk/reactos/dll/cpl/input/lang/bg-BG.rc [iso-8859-1] (original)
+++ trunk/reactos/dll/cpl/input/lang/bg-BG.rc [iso-8859-1] Tue May 13 15:23:23 2008
@@ -67,9 +67,9 @@
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
Modified: trunk/reactos/dll/cpl/input/lang/de-DE.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/input/lang/de-DE.r…
==============================================================================
--- trunk/reactos/dll/cpl/input/lang/de-DE.rc [iso-8859-1] (original)
+++ trunk/reactos/dll/cpl/input/lang/de-DE.rc [iso-8859-1] Tue May 13 15:23:23 2008
@@ -67,9 +67,9 @@
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
Modified: trunk/reactos/dll/cpl/input/lang/el-GR.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/input/lang/el-GR.r…
==============================================================================
--- trunk/reactos/dll/cpl/input/lang/el-GR.rc [iso-8859-1] (original)
+++ trunk/reactos/dll/cpl/input/lang/el-GR.rc [iso-8859-1] Tue May 13 15:23:23 2008
@@ -67,9 +67,9 @@
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
Modified: trunk/reactos/dll/cpl/input/lang/en-US.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/input/lang/en-US.r…
==============================================================================
--- trunk/reactos/dll/cpl/input/lang/en-US.rc [iso-8859-1] (original)
+++ trunk/reactos/dll/cpl/input/lang/en-US.rc [iso-8859-1] Tue May 13 15:23:23 2008
@@ -67,9 +67,9 @@
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
Modified: trunk/reactos/dll/cpl/input/lang/es-ES.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/input/lang/es-ES.r…
==============================================================================
--- trunk/reactos/dll/cpl/input/lang/es-ES.rc [iso-8859-1] (original)
+++ trunk/reactos/dll/cpl/input/lang/es-ES.rc [iso-8859-1] Tue May 13 15:23:23 2008
@@ -72,9 +72,9 @@
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
Modified: trunk/reactos/dll/cpl/input/lang/fr-FR.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/input/lang/fr-FR.r…
==============================================================================
--- trunk/reactos/dll/cpl/input/lang/fr-FR.rc [iso-8859-1] (original)
+++ trunk/reactos/dll/cpl/input/lang/fr-FR.rc [iso-8859-1] Tue May 13 15:23:23 2008
@@ -67,9 +67,9 @@
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
Modified: trunk/reactos/dll/cpl/input/lang/it-IT.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/input/lang/it-IT.r…
==============================================================================
--- trunk/reactos/dll/cpl/input/lang/it-IT.rc [iso-8859-1] (original)
+++ trunk/reactos/dll/cpl/input/lang/it-IT.rc [iso-8859-1] Tue May 13 15:23:23 2008
@@ -67,9 +67,9 @@
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
Modified: trunk/reactos/dll/cpl/input/lang/pl-PL.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/input/lang/pl-PL.r…
==============================================================================
--- trunk/reactos/dll/cpl/input/lang/pl-PL.rc [iso-8859-1] (original)
+++ trunk/reactos/dll/cpl/input/lang/pl-PL.rc [iso-8859-1] Tue May 13 15:23:23 2008
@@ -74,9 +74,9 @@
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
Modified: trunk/reactos/dll/cpl/input/lang/ru-RU.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/input/lang/ru-RU.r…
==============================================================================
--- trunk/reactos/dll/cpl/input/lang/ru-RU.rc [iso-8859-1] (original)
+++ trunk/reactos/dll/cpl/input/lang/ru-RU.rc [iso-8859-1] Tue May 13 15:23:23 2008
@@ -67,9 +67,9 @@
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
Modified: trunk/reactos/dll/cpl/input/lang/sk-SK.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/input/lang/sk-SK.r…
==============================================================================
--- trunk/reactos/dll/cpl/input/lang/sk-SK.rc [iso-8859-1] (original)
+++ trunk/reactos/dll/cpl/input/lang/sk-SK.rc [iso-8859-1] Tue May 13 15:23:23 2008
@@ -71,9 +71,9 @@
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 "Zrui", IDCANCEL, 169, 53, 52, 14
END
Modified: trunk/reactos/dll/cpl/input/lang/uk-UA.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/input/lang/uk-UA.r…
==============================================================================
--- trunk/reactos/dll/cpl/input/lang/uk-UA.rc [iso-8859-1] (original)
+++ trunk/reactos/dll/cpl/input/lang/uk-UA.rc [iso-8859-1] Tue May 13 15:23:23 2008
@@ -75,9 +75,9 @@
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
Modified: trunk/reactos/dll/cpl/input/resource.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/input/resource.h?r…
==============================================================================
--- trunk/reactos/dll/cpl/input/resource.h [iso-8859-1] (original)
+++ trunk/reactos/dll/cpl/input/resource.h [iso-8859-1] Tue May 13 15:23:23 2008
@@ -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
Modified: trunk/reactos/dll/cpl/input/settings.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/input/settings.c?r…
==============================================================================
--- trunk/reactos/dll/cpl/input/settings.c [iso-8859-1] (original)
+++ trunk/reactos/dll/cpl/input/settings.c [iso-8859-1] Tue May 13 15:23:23 2008
@@ -14,6 +14,8 @@
static HWND MainDlgWnd;
static HIMAGELIST hImgList;
+// for SaveInputLang()
+static INT OldLayoutNum;
typedef struct
{
@@ -24,6 +26,15 @@
TCHAR IndName[MAX_PATH];
} 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)
@@ -83,6 +94,51 @@
DeleteObject(hBitmap);
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
@@ -312,6 +368,195 @@
}
}
+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 @@
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 @@
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: