Updated French translations for input and winemine
[reactos.git] / reactos / dll / cpl / input / add.c
1 /*
2 * ReactOS
3 * Copyright (C) 2007 ReactOS Team
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19 /*
20 *
21 * PROJECT: input.dll
22 * FILE: dll/win32/input/add.c
23 * PURPOSE: input.dll
24 * PROGRAMMER: Dmitry Chapyshev (lentind@yandex.ru)
25 * UPDATE HISTORY:
26 * 06-09-2007 Created
27 */
28
29 #include <windows.h>
30 #include <commctrl.h>
31 #include <cpl.h>
32
33 #include <stdlib.h>
34 #include <stdio.h>
35 #include <stdarg.h>
36 #include <tchar.h>
37 #include <process.h>
38
39 #include "resource.h"
40 #include "input.h"
41
42 HWND hLanguageList;
43
44 /*struct LangAndLayout
45 {
46 TCHAR Lang;
47 TCHAR Layout;
48 TCHAR SubLayout;
49 } VarLang[133];
50
51 char *SubLang[133] = {}
52
53 VOID CreateLangStruct(VOID)
54 {
55 UINT Count;
56 TCHAR Layout[256];
57
58 for(Count = 0; Count < END_LAYOUT - BEGIN_LAYOUT; Count++)
59 {
60 LoadString(hApplet,
61 Count,
62 Layout,
63 sizeof(Layout) / sizeof(TCHAR));
64 strcpy(VarLang[Count].Layout,Layout);
65 }
66 }*/
67
68 /* Language enumerate procedure */
69 BOOL
70 CALLBACK
71 LanguagesEnumProc(LPTSTR lpLanguage)
72 {
73 LCID Lcid;
74 TCHAR Lang[1024];
75 INT Index;
76
77 Lcid = _tcstoul(lpLanguage, NULL, 16);
78
79 GetLocaleInfo(Lcid, LOCALE_SLANGUAGE, Lang, sizeof(Lang));
80 Index = (INT)SendMessage(hLanguageList,
81 CB_ADDSTRING,
82 0,
83 (LPARAM)Lang);
84
85 SendMessage(hLanguageList,
86 CB_SETITEMDATA,
87 Index,
88 (LPARAM)Lcid);
89
90 return TRUE;
91 }
92
93 /* Enumerate all installed language identifiers */
94 static
95 VOID
96 CreateLanguagesList(HWND hWnd)
97 {
98 //TCHAR LangSel[256];
99
100 hLanguageList = hWnd;
101 EnumSystemLocales(LanguagesEnumProc, LCID_INSTALLED);
102
103 /*SendMessage(hLanguageList,
104 CB_SELECTSTRING,
105 (WPARAM) -1,
106 (LPARAM)LangSel);*/
107 }
108
109 static
110 VOID
111 SelectCurrentLayout(HWND hWnd)
112 {
113 //TCHAR Layout[256];
114
115 /*SendMessage(hWnd,
116 CB_SELECTSTRING,
117 (WPARAM) -1,
118 (LPARAM)Layout);*/
119 }
120
121 INT_PTR CALLBACK
122 AddDlgProc(HWND hDlg,
123 UINT message,
124 WPARAM wParam,
125 LPARAM lParam)
126 {
127 UNREFERENCED_PARAMETER(lParam);
128
129 switch (message)
130 {
131 case WM_INITDIALOG:
132 CreateLanguagesList(GetDlgItem(hDlg, IDC_INPUT_LANGUAGE_COMBO));
133 CreateKeyboardLayoutList(GetDlgItem(hDlg, IDC_KEYBOARD_LAYOUT_COMBO));
134 SelectCurrentLayout(GetDlgItem(hDlg, IDC_KEYBOARD_LAYOUT_COMBO));
135 break;
136
137 case WM_COMMAND:
138 switch (LOWORD(wParam))
139 {
140 case IDC_INPUT_LANGUAGE_COMBO:
141 if (HIWORD(wParam) == CBN_SELCHANGE)
142 {
143 SelectCurrentLayout(GetDlgItem(hDlg, IDC_KEYBOARD_LAYOUT_COMBO));
144 }
145 break;
146
147 case IDOK:
148 break;
149
150 case IDCANCEL:
151 EndDialog(hDlg, LOWORD(wParam));
152 return TRUE;
153 }
154 break;
155 }
156
157 return FALSE;
158 }
159
160 /* EOF */