mirror of
https://github.com/reactos/reactos.git
synced 2025-04-20 12:29:56 +00:00
[INPUT]
- Implement 'Remove', 'Set Default' for input methods svn path=/trunk/; revision=72166
This commit is contained in:
parent
22f90f2210
commit
b346062c73
11 changed files with 252 additions and 71 deletions
|
@ -71,7 +71,7 @@ OnInitAddDialog(HWND hwndDlg)
|
||||||
|
|
||||||
dwDefaultLocaleId = GetSystemDefaultLCID();
|
dwDefaultLocaleId = GetSystemDefaultLCID();
|
||||||
|
|
||||||
for (pCurrentLocale = LocaleList_Get();
|
for (pCurrentLocale = LocaleList_GetFirst();
|
||||||
pCurrentLocale != NULL;
|
pCurrentLocale != NULL;
|
||||||
pCurrentLocale = pCurrentLocale->pNext)
|
pCurrentLocale = pCurrentLocale->pNext)
|
||||||
{
|
{
|
||||||
|
@ -86,7 +86,7 @@ OnInitAddDialog(HWND hwndDlg)
|
||||||
|
|
||||||
dwDefaultLayoutId = GetDefaultLayoutForLocale(dwDefaultLocaleId);
|
dwDefaultLayoutId = GetDefaultLayoutForLocale(dwDefaultLocaleId);
|
||||||
|
|
||||||
for (pCurrentLayout = LayoutList_Get();
|
for (pCurrentLayout = LayoutList_GetFirst();
|
||||||
pCurrentLayout != NULL;
|
pCurrentLayout != NULL;
|
||||||
pCurrentLayout = pCurrentLayout->pNext)
|
pCurrentLayout = pCurrentLayout->pNext)
|
||||||
{
|
{
|
||||||
|
@ -158,9 +158,11 @@ OnCommandAddDialog(HWND hwndDlg, WPARAM wParam)
|
||||||
LAYOUT_LIST_NODE *pCurrentLayout;
|
LAYOUT_LIST_NODE *pCurrentLayout;
|
||||||
|
|
||||||
pCurrentLayout = (LAYOUT_LIST_NODE*)ComboBox_GetItemData(hwndLayoutCombo, iIndex);
|
pCurrentLayout = (LAYOUT_LIST_NODE*)ComboBox_GetItemData(hwndLayoutCombo, iIndex);
|
||||||
|
|
||||||
if (pCurrentLayout != NULL && pCurrentLayout->dwId == dwLayoutId)
|
if (pCurrentLayout != NULL && pCurrentLayout->dwId == dwLayoutId)
|
||||||
{
|
{
|
||||||
ComboBox_SetCurSel(hwndLayoutCombo, iIndex);
|
ComboBox_SetCurSel(hwndLayoutCombo, iIndex);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,3 +6,33 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
|
|
||||||
|
|
||||||
|
INT_PTR CALLBACK
|
||||||
|
EditDialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
|
{
|
||||||
|
UNREFERENCED_PARAMETER(lParam);
|
||||||
|
|
||||||
|
switch (uMsg)
|
||||||
|
{
|
||||||
|
case WM_INITDIALOG:
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WM_COMMAND:
|
||||||
|
{
|
||||||
|
switch (LOWORD(wParam))
|
||||||
|
{
|
||||||
|
case IDOK:
|
||||||
|
EndDialog(hDlg, LOWORD(wParam));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case IDCANCEL:
|
||||||
|
EndDialog(hDlg, LOWORD(wParam));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
|
@ -51,6 +51,15 @@ AdvancedSettingsPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||||
INT_PTR CALLBACK
|
INT_PTR CALLBACK
|
||||||
AddDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
|
AddDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
|
||||||
|
|
||||||
|
/* edit_dialog.c */
|
||||||
|
INT_PTR CALLBACK
|
||||||
|
EditDialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||||
|
|
||||||
|
/* key_settings_dialog.c */
|
||||||
|
INT_PTR CALLBACK
|
||||||
|
KeySettingsDialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||||
|
|
||||||
|
|
||||||
static inline WCHAR*
|
static inline WCHAR*
|
||||||
DublicateString(const WCHAR *pszString)
|
DublicateString(const WCHAR *pszString)
|
||||||
{
|
{
|
||||||
|
|
|
@ -44,8 +44,8 @@ InputList_AppendNode(VOID)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
static VOID
|
||||||
InputList_Remove(INPUT_LIST_NODE *pNode)
|
InputList_RemoveNode(INPUT_LIST_NODE *pNode)
|
||||||
{
|
{
|
||||||
INPUT_LIST_NODE *pCurrent = pNode;
|
INPUT_LIST_NODE *pCurrent = pNode;
|
||||||
|
|
||||||
|
@ -57,6 +57,7 @@ InputList_Remove(INPUT_LIST_NODE *pNode)
|
||||||
INPUT_LIST_NODE *pNext = pCurrent->pNext;
|
INPUT_LIST_NODE *pNext = pCurrent->pNext;
|
||||||
INPUT_LIST_NODE *pPrev = pCurrent->pPrev;
|
INPUT_LIST_NODE *pPrev = pCurrent->pPrev;
|
||||||
|
|
||||||
|
free(pCurrent->pszIndicator);
|
||||||
free(pCurrent);
|
free(pCurrent);
|
||||||
|
|
||||||
if (pNext != NULL)
|
if (pNext != NULL)
|
||||||
|
@ -84,6 +85,7 @@ InputList_Destroy(VOID)
|
||||||
{
|
{
|
||||||
INPUT_LIST_NODE *pNext = pCurrent->pNext;
|
INPUT_LIST_NODE *pNext = pCurrent->pNext;
|
||||||
|
|
||||||
|
free(pCurrent->pszIndicator);
|
||||||
free(pCurrent);
|
free(pCurrent);
|
||||||
|
|
||||||
pCurrent = pNext;
|
pCurrent = pNext;
|
||||||
|
@ -234,7 +236,7 @@ InputList_Process(VOID)
|
||||||
|
|
||||||
if (UnloadKeyboardLayout(pCurrent->hkl))
|
if (UnloadKeyboardLayout(pCurrent->hkl))
|
||||||
{
|
{
|
||||||
InputList_Remove(pCurrent);
|
InputList_RemoveNode(pCurrent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -267,12 +269,16 @@ InputList_Process(VOID)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add methods to registry */
|
/* Add methods to registry */
|
||||||
for (pCurrent = _InputList, dwIndex = 2; pCurrent != NULL; pCurrent = pCurrent->pNext, dwIndex++)
|
dwIndex = 2;
|
||||||
|
|
||||||
|
for (pCurrent = _InputList; pCurrent != NULL; pCurrent = pCurrent->pNext)
|
||||||
{
|
{
|
||||||
if (pCurrent->dwFlags & INPUT_LIST_NODE_FLAG_DEFAULT)
|
if (pCurrent->dwFlags & INPUT_LIST_NODE_FLAG_DEFAULT)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
InputList_AddInputMethodToUserRegistry(dwIndex, pCurrent);
|
InputList_AddInputMethodToUserRegistry(dwIndex, pCurrent);
|
||||||
|
|
||||||
|
dwIndex++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -280,6 +286,7 @@ InputList_Process(VOID)
|
||||||
VOID
|
VOID
|
||||||
InputList_Add(LOCALE_LIST_NODE *pLocale, LAYOUT_LIST_NODE *pLayout)
|
InputList_Add(LOCALE_LIST_NODE *pLocale, LAYOUT_LIST_NODE *pLayout)
|
||||||
{
|
{
|
||||||
|
WCHAR szIndicator[MAX_STR_LEN];
|
||||||
INPUT_LIST_NODE *pInput;
|
INPUT_LIST_NODE *pInput;
|
||||||
|
|
||||||
if (pLocale == NULL || pLayout == NULL)
|
if (pLocale == NULL || pLayout == NULL)
|
||||||
|
@ -293,6 +300,64 @@ InputList_Add(LOCALE_LIST_NODE *pLocale, LAYOUT_LIST_NODE *pLayout)
|
||||||
|
|
||||||
pInput->pLocale = pLocale;
|
pInput->pLocale = pLocale;
|
||||||
pInput->pLayout = pLayout;
|
pInput->pLayout = pLayout;
|
||||||
|
|
||||||
|
if (GetLocaleInfoW(LOWORD(pInput->pLocale->dwId),
|
||||||
|
LOCALE_SABBREVLANGNAME | LOCALE_NOUSEROVERRIDE,
|
||||||
|
szIndicator,
|
||||||
|
ARRAYSIZE(szIndicator)))
|
||||||
|
{
|
||||||
|
size_t len = wcslen(szIndicator);
|
||||||
|
|
||||||
|
if (len > 0)
|
||||||
|
{
|
||||||
|
szIndicator[len - 1] = 0;
|
||||||
|
pInput->pszIndicator = DublicateString(szIndicator);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
VOID
|
||||||
|
InputList_SetDefault(INPUT_LIST_NODE *pNode)
|
||||||
|
{
|
||||||
|
INPUT_LIST_NODE *pCurrent;
|
||||||
|
|
||||||
|
if (pNode == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (pCurrent = _InputList; pCurrent != NULL; pCurrent = pCurrent->pNext)
|
||||||
|
{
|
||||||
|
if (pCurrent == pNode)
|
||||||
|
{
|
||||||
|
pCurrent->dwFlags |= INPUT_LIST_NODE_FLAG_DEFAULT;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pCurrent->dwFlags &= ~INPUT_LIST_NODE_FLAG_DEFAULT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
VOID
|
||||||
|
InputList_Remove(INPUT_LIST_NODE *pNode)
|
||||||
|
{
|
||||||
|
if (pNode == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
pNode->dwFlags |= INPUT_LIST_NODE_FLAG_DELETED;
|
||||||
|
|
||||||
|
if (pNode->dwFlags & INPUT_LIST_NODE_FLAG_DEFAULT)
|
||||||
|
{
|
||||||
|
if (pNode->pNext != NULL)
|
||||||
|
{
|
||||||
|
pNode->pNext->dwFlags |= INPUT_LIST_NODE_FLAG_DEFAULT;
|
||||||
|
}
|
||||||
|
else if (pNode->pPrev != NULL)
|
||||||
|
{
|
||||||
|
pNode->pPrev->dwFlags |= INPUT_LIST_NODE_FLAG_DEFAULT;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -318,14 +383,42 @@ InputList_Create(VOID)
|
||||||
|
|
||||||
if (pLocale != NULL && pLayout != NULL)
|
if (pLocale != NULL && pLayout != NULL)
|
||||||
{
|
{
|
||||||
|
WCHAR szIndicator[MAX_STR_LEN] = { 0 };
|
||||||
INPUT_LIST_NODE *pInput;
|
INPUT_LIST_NODE *pInput;
|
||||||
|
HKL hklDefault;
|
||||||
|
|
||||||
pInput = InputList_AppendNode();
|
pInput = InputList_AppendNode();
|
||||||
|
|
||||||
pInput->dwFlags = 0;
|
|
||||||
pInput->pLocale = pLocale;
|
pInput->pLocale = pLocale;
|
||||||
pInput->pLayout = pLayout;
|
pInput->pLayout = pLayout;
|
||||||
pInput->hkl = pLayoutList[iIndex];
|
pInput->hkl = pLayoutList[iIndex];
|
||||||
|
|
||||||
|
if (SystemParametersInfoW(SPI_GETDEFAULTINPUTLANG,
|
||||||
|
0,
|
||||||
|
(LPVOID)((LPDWORD)&hklDefault),
|
||||||
|
0) == FALSE)
|
||||||
|
{
|
||||||
|
hklDefault = GetKeyboardLayout(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pInput->hkl == hklDefault)
|
||||||
|
{
|
||||||
|
pInput->dwFlags |= INPUT_LIST_NODE_FLAG_DEFAULT;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GetLocaleInfoW(LOWORD(pInput->pLocale->dwId),
|
||||||
|
LOCALE_SABBREVLANGNAME | LOCALE_NOUSEROVERRIDE,
|
||||||
|
szIndicator,
|
||||||
|
ARRAYSIZE(szIndicator)))
|
||||||
|
{
|
||||||
|
size_t len = wcslen(szIndicator);
|
||||||
|
|
||||||
|
if (len > 0)
|
||||||
|
{
|
||||||
|
szIndicator[len - 1] = 0;
|
||||||
|
pInput->pszIndicator = DublicateString(szIndicator);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -336,7 +429,7 @@ InputList_Create(VOID)
|
||||||
|
|
||||||
|
|
||||||
INPUT_LIST_NODE*
|
INPUT_LIST_NODE*
|
||||||
InputList_Get(VOID)
|
InputList_GetFirst(VOID)
|
||||||
{
|
{
|
||||||
return _InputList;
|
return _InputList;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,8 @@ typedef struct _INPUT_LIST_NODE
|
||||||
|
|
||||||
HKL hkl;
|
HKL hkl;
|
||||||
|
|
||||||
|
WCHAR *pszIndicator;
|
||||||
|
|
||||||
struct _INPUT_LIST_NODE *pPrev;
|
struct _INPUT_LIST_NODE *pPrev;
|
||||||
struct _INPUT_LIST_NODE *pNext;
|
struct _INPUT_LIST_NODE *pNext;
|
||||||
} INPUT_LIST_NODE;
|
} INPUT_LIST_NODE;
|
||||||
|
@ -34,6 +36,9 @@ InputList_Process(VOID);
|
||||||
VOID
|
VOID
|
||||||
InputList_Add(LOCALE_LIST_NODE *pLocale, LAYOUT_LIST_NODE *pLayout);
|
InputList_Add(LOCALE_LIST_NODE *pLocale, LAYOUT_LIST_NODE *pLayout);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
InputList_SetDefault(INPUT_LIST_NODE *pNode);
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
InputList_Remove(INPUT_LIST_NODE *pNode);
|
InputList_Remove(INPUT_LIST_NODE *pNode);
|
||||||
|
|
||||||
|
@ -41,4 +46,4 @@ VOID
|
||||||
InputList_Destroy(VOID);
|
InputList_Destroy(VOID);
|
||||||
|
|
||||||
INPUT_LIST_NODE*
|
INPUT_LIST_NODE*
|
||||||
InputList_Get(VOID);
|
InputList_GetFirst(VOID);
|
||||||
|
|
|
@ -6,3 +6,33 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
|
|
||||||
|
|
||||||
|
INT_PTR CALLBACK
|
||||||
|
KeySettingsDialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
|
{
|
||||||
|
UNREFERENCED_PARAMETER(lParam);
|
||||||
|
|
||||||
|
switch (uMsg)
|
||||||
|
{
|
||||||
|
case WM_INITDIALOG:
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WM_COMMAND:
|
||||||
|
{
|
||||||
|
switch (LOWORD(wParam))
|
||||||
|
{
|
||||||
|
case IDOK:
|
||||||
|
EndDialog(hDlg, LOWORD(wParam));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case IDCANCEL:
|
||||||
|
EndDialog(hDlg, LOWORD(wParam));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
|
@ -12,12 +12,12 @@ static LAYOUT_LIST_NODE *_LayoutList = NULL;
|
||||||
|
|
||||||
|
|
||||||
static LAYOUT_LIST_NODE*
|
static LAYOUT_LIST_NODE*
|
||||||
LayoutList_Append(DWORD dwId, DWORD dwSpecialId, const WCHAR *pszName, const WCHAR *pszFile)
|
LayoutList_AppendNode(DWORD dwId, DWORD dwSpecialId, const WCHAR *pszName)
|
||||||
{
|
{
|
||||||
LAYOUT_LIST_NODE *pCurrent;
|
LAYOUT_LIST_NODE *pCurrent;
|
||||||
LAYOUT_LIST_NODE *pNew;
|
LAYOUT_LIST_NODE *pNew;
|
||||||
|
|
||||||
if (pszName == NULL || pszFile == NULL)
|
if (pszName == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
pCurrent = _LayoutList;
|
pCurrent = _LayoutList;
|
||||||
|
@ -35,14 +35,6 @@ LayoutList_Append(DWORD dwId, DWORD dwSpecialId, const WCHAR *pszName, const WCH
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
pNew->pszFile = DublicateString(pszFile);
|
|
||||||
if (pNew->pszFile == NULL)
|
|
||||||
{
|
|
||||||
free(pNew->pszName);
|
|
||||||
free(pNew);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
pNew->dwId = dwId;
|
pNew->dwId = dwId;
|
||||||
pNew->dwSpecialId = dwSpecialId;
|
pNew->dwSpecialId = dwSpecialId;
|
||||||
|
|
||||||
|
@ -80,7 +72,6 @@ LayoutList_Destroy(VOID)
|
||||||
LAYOUT_LIST_NODE *pNext = pCurrent->pNext;
|
LAYOUT_LIST_NODE *pNext = pCurrent->pNext;
|
||||||
|
|
||||||
free(pCurrent->pszName);
|
free(pCurrent->pszName);
|
||||||
free(pCurrent->pszFile);
|
|
||||||
free(pCurrent);
|
free(pCurrent);
|
||||||
|
|
||||||
pCurrent = pNext;
|
pCurrent = pNext;
|
||||||
|
@ -163,10 +154,7 @@ LayoutList_Create(VOID)
|
||||||
{
|
{
|
||||||
DWORD dwLayoutId = DWORDfromString(szLayoutId);
|
DWORD dwLayoutId = DWORDfromString(szLayoutId);
|
||||||
|
|
||||||
LayoutList_Append(dwLayoutId,
|
LayoutList_AppendNode(dwLayoutId, dwSpecialId, szBuffer);
|
||||||
dwSpecialId,
|
|
||||||
szBuffer,
|
|
||||||
szFilePath);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -215,7 +203,7 @@ LayoutList_GetByHkl(HKL hkl)
|
||||||
|
|
||||||
|
|
||||||
LAYOUT_LIST_NODE*
|
LAYOUT_LIST_NODE*
|
||||||
LayoutList_Get(VOID)
|
LayoutList_GetFirst(VOID)
|
||||||
{
|
{
|
||||||
return _LayoutList;
|
return _LayoutList;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,9 +5,10 @@
|
||||||
typedef struct _LAYOUT_LIST_NODE
|
typedef struct _LAYOUT_LIST_NODE
|
||||||
{
|
{
|
||||||
WCHAR *pszName;
|
WCHAR *pszName;
|
||||||
WCHAR *pszFile;
|
|
||||||
DWORD dwId;
|
DWORD dwId;
|
||||||
DWORD dwSpecialId;
|
DWORD dwSpecialId;
|
||||||
|
|
||||||
struct _LAYOUT_LIST_NODE *pPrev;
|
struct _LAYOUT_LIST_NODE *pPrev;
|
||||||
struct _LAYOUT_LIST_NODE *pNext;
|
struct _LAYOUT_LIST_NODE *pNext;
|
||||||
} LAYOUT_LIST_NODE;
|
} LAYOUT_LIST_NODE;
|
||||||
|
@ -22,4 +23,4 @@ LAYOUT_LIST_NODE*
|
||||||
LayoutList_GetByHkl(HKL hkl);
|
LayoutList_GetByHkl(HKL hkl);
|
||||||
|
|
||||||
LAYOUT_LIST_NODE*
|
LAYOUT_LIST_NODE*
|
||||||
LayoutList_Get(VOID);
|
LayoutList_GetFirst(VOID);
|
||||||
|
|
|
@ -12,12 +12,12 @@ static LOCALE_LIST_NODE *_LocaleList = NULL;
|
||||||
|
|
||||||
|
|
||||||
static LOCALE_LIST_NODE*
|
static LOCALE_LIST_NODE*
|
||||||
LocaleList_Append(DWORD dwId, const WCHAR *pszName, const WCHAR *pszIndicator)
|
LocaleList_Append(DWORD dwId, const WCHAR *pszName)
|
||||||
{
|
{
|
||||||
LOCALE_LIST_NODE *pCurrent;
|
LOCALE_LIST_NODE *pCurrent;
|
||||||
LOCALE_LIST_NODE *pNew;
|
LOCALE_LIST_NODE *pNew;
|
||||||
|
|
||||||
if (pszName == NULL || pszIndicator == NULL)
|
if (pszName == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
pCurrent = _LocaleList;
|
pCurrent = _LocaleList;
|
||||||
|
@ -35,14 +35,6 @@ LocaleList_Append(DWORD dwId, const WCHAR *pszName, const WCHAR *pszIndicator)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
pNew->pszIndicator = DublicateString(pszIndicator);
|
|
||||||
if (pNew->pszIndicator == NULL)
|
|
||||||
{
|
|
||||||
free(pNew->pszName);
|
|
||||||
free(pNew);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
pNew->dwId = dwId;
|
pNew->dwId = dwId;
|
||||||
|
|
||||||
if (pCurrent == NULL)
|
if (pCurrent == NULL)
|
||||||
|
@ -79,7 +71,6 @@ LocaleList_Destroy(VOID)
|
||||||
LOCALE_LIST_NODE *pNext = pCurrent->pNext;
|
LOCALE_LIST_NODE *pNext = pCurrent->pNext;
|
||||||
|
|
||||||
free(pCurrent->pszName);
|
free(pCurrent->pszName);
|
||||||
free(pCurrent->pszIndicator);
|
|
||||||
free(pCurrent);
|
free(pCurrent);
|
||||||
|
|
||||||
pCurrent = pNext;
|
pCurrent = pNext;
|
||||||
|
@ -121,22 +112,7 @@ LocaleList_Create(VOID)
|
||||||
LOCALE_SLANGUAGE,
|
LOCALE_SLANGUAGE,
|
||||||
szName, ARRAYSIZE(szName)))
|
szName, ARRAYSIZE(szName)))
|
||||||
{
|
{
|
||||||
WCHAR szIndicator[MAX_STR_LEN] = { 0 };
|
LocaleList_Append(dwId, szName);
|
||||||
|
|
||||||
if (GetLocaleInfoW(LOWORD(dwId),
|
|
||||||
LOCALE_SABBREVLANGNAME | LOCALE_NOUSEROVERRIDE,
|
|
||||||
szIndicator,
|
|
||||||
ARRAYSIZE(szIndicator)))
|
|
||||||
{
|
|
||||||
size_t len = wcslen(szIndicator);
|
|
||||||
|
|
||||||
if (len > 0)
|
|
||||||
{
|
|
||||||
szIndicator[len - 1] = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
LocaleList_Append(dwId, szName, szIndicator);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dwSize = sizeof(szValue);
|
dwSize = sizeof(szValue);
|
||||||
|
@ -165,7 +141,7 @@ LocaleList_GetByHkl(HKL hkl)
|
||||||
|
|
||||||
|
|
||||||
LOCALE_LIST_NODE*
|
LOCALE_LIST_NODE*
|
||||||
LocaleList_Get(VOID)
|
LocaleList_GetFirst(VOID)
|
||||||
{
|
{
|
||||||
return _LocaleList;
|
return _LocaleList;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,8 +5,9 @@
|
||||||
typedef struct _LOCALE_LIST_NODE
|
typedef struct _LOCALE_LIST_NODE
|
||||||
{
|
{
|
||||||
WCHAR *pszName;
|
WCHAR *pszName;
|
||||||
WCHAR *pszIndicator;
|
|
||||||
DWORD dwId;
|
DWORD dwId;
|
||||||
|
|
||||||
struct _LOCALE_LIST_NODE *pPrev;
|
struct _LOCALE_LIST_NODE *pPrev;
|
||||||
struct _LOCALE_LIST_NODE *pNext;
|
struct _LOCALE_LIST_NODE *pNext;
|
||||||
} LOCALE_LIST_NODE;
|
} LOCALE_LIST_NODE;
|
||||||
|
@ -21,4 +22,4 @@ LOCALE_LIST_NODE*
|
||||||
LocaleList_GetByHkl(HKL hkl);
|
LocaleList_GetByHkl(HKL hkl);
|
||||||
|
|
||||||
LOCALE_LIST_NODE*
|
LOCALE_LIST_NODE*
|
||||||
LocaleList_Get(VOID);
|
LocaleList_GetFirst(VOID);
|
||||||
|
|
|
@ -99,7 +99,7 @@ AddToInputListView(HWND hwndList, INPUT_LIST_NODE *pInputNode)
|
||||||
{
|
{
|
||||||
HICON hLayoutIcon;
|
HICON hLayoutIcon;
|
||||||
|
|
||||||
hLayoutIcon = CreateLayoutIcon(pInputNode->pLocale->pszIndicator);
|
hLayoutIcon = CreateLayoutIcon(pInputNode->pszIndicator);
|
||||||
|
|
||||||
if (hLayoutIcon != NULL)
|
if (hLayoutIcon != NULL)
|
||||||
{
|
{
|
||||||
|
@ -136,13 +136,16 @@ UpdateInputListView(HWND hwndList)
|
||||||
|
|
||||||
ListView_DeleteAllItems(hwndList);
|
ListView_DeleteAllItems(hwndList);
|
||||||
|
|
||||||
for (pCurrentInputNode = InputList_Get();
|
for (pCurrentInputNode = InputList_GetFirst();
|
||||||
pCurrentInputNode != NULL;
|
pCurrentInputNode != NULL;
|
||||||
pCurrentInputNode = pCurrentInputNode->pNext)
|
pCurrentInputNode = pCurrentInputNode->pNext)
|
||||||
|
{
|
||||||
|
if (!(pCurrentInputNode->dwFlags & INPUT_LIST_NODE_FLAG_DELETED))
|
||||||
{
|
{
|
||||||
AddToInputListView(hwndList, pCurrentInputNode);
|
AddToInputListView(hwndList, pCurrentInputNode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static VOID
|
static VOID
|
||||||
|
@ -158,7 +161,6 @@ OnInitSettingsPage(HWND hwndDlg)
|
||||||
|
|
||||||
if (hwndInputList != NULL)
|
if (hwndInputList != NULL)
|
||||||
{
|
{
|
||||||
INPUT_LIST_NODE *pCurrentInputNode;
|
|
||||||
WCHAR szBuffer[MAX_STR_LEN];
|
WCHAR szBuffer[MAX_STR_LEN];
|
||||||
HIMAGELIST hLayoutImageList;
|
HIMAGELIST hLayoutImageList;
|
||||||
LV_COLUMN column;
|
LV_COLUMN column;
|
||||||
|
@ -191,12 +193,7 @@ OnInitSettingsPage(HWND hwndDlg)
|
||||||
ListView_SetImageList(hwndInputList, hLayoutImageList, LVSIL_SMALL);
|
ListView_SetImageList(hwndInputList, hLayoutImageList, LVSIL_SMALL);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (pCurrentInputNode = InputList_Get();
|
UpdateInputListView(hwndInputList);
|
||||||
pCurrentInputNode != NULL;
|
|
||||||
pCurrentInputNode = pCurrentInputNode->pNext)
|
|
||||||
{
|
|
||||||
AddToInputListView(hwndInputList, pCurrentInputNode);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -239,25 +236,74 @@ OnCommandSettingsPage(HWND hwndDlg, WPARAM wParam)
|
||||||
|
|
||||||
case IDC_REMOVE_BUTTON:
|
case IDC_REMOVE_BUTTON:
|
||||||
{
|
{
|
||||||
|
HWND hwndList = GetDlgItem(hwndDlg, IDC_KEYLAYOUT_LIST);
|
||||||
|
|
||||||
|
if (hwndList != NULL)
|
||||||
|
{
|
||||||
|
LVITEM item = { 0 };
|
||||||
|
|
||||||
|
item.mask = LVIF_PARAM;
|
||||||
|
item.iItem = ListView_GetNextItem(hwndList, -1, LVNI_SELECTED);
|
||||||
|
|
||||||
|
if (ListView_GetItem(hwndList, &item) != FALSE)
|
||||||
|
{
|
||||||
|
InputList_Remove((INPUT_LIST_NODE*)item.lParam);
|
||||||
|
UpdateInputListView(GetDlgItem(hwndDlg, IDC_KEYLAYOUT_LIST));
|
||||||
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IDC_PROP_BUTTON:
|
case IDC_PROP_BUTTON:
|
||||||
{
|
{
|
||||||
|
if (DialogBoxW(hApplet,
|
||||||
|
MAKEINTRESOURCEW(IDD_INPUT_LANG_PROP),
|
||||||
|
hwndDlg,
|
||||||
|
EditDialogProc) == IDOK)
|
||||||
|
{
|
||||||
|
UpdateInputListView(GetDlgItem(hwndDlg, IDC_KEYLAYOUT_LIST));
|
||||||
|
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IDC_SET_DEFAULT:
|
case IDC_SET_DEFAULT:
|
||||||
{
|
{
|
||||||
|
HWND hwndList = GetDlgItem(hwndDlg, IDC_KEYLAYOUT_LIST);
|
||||||
|
|
||||||
|
if (hwndList != NULL)
|
||||||
|
{
|
||||||
|
LVITEM item = { 0 };
|
||||||
|
|
||||||
|
item.mask = LVIF_PARAM;
|
||||||
|
item.iItem = ListView_GetNextItem(hwndList, -1, LVNI_SELECTED);
|
||||||
|
|
||||||
|
if (ListView_GetItem(hwndList, &item) != FALSE)
|
||||||
|
{
|
||||||
|
INPUT_LIST_NODE *pSelected;
|
||||||
|
|
||||||
|
pSelected = (INPUT_LIST_NODE*) item.lParam;
|
||||||
|
if (pSelected != NULL)
|
||||||
|
{
|
||||||
|
InputList_SetDefault(pSelected);
|
||||||
|
}
|
||||||
|
|
||||||
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IDC_KEY_SET_BTN:
|
case IDC_KEY_SET_BTN:
|
||||||
{
|
{
|
||||||
|
if (DialogBoxW(hApplet,
|
||||||
|
MAKEINTRESOURCEW(IDD_KEYSETTINGS),
|
||||||
|
hwndDlg,
|
||||||
|
KeySettingsDialogProc) == IDOK)
|
||||||
|
{
|
||||||
|
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue