ReactOS 0.4.15-dev-7842-g558ab78
sort.c File Reference
#include "intl.h"
Include dependency graph for sort.c:

Go to the source code of this file.

Functions

static BOOL CALLBACK SortTestEnumProc (PWSTR lpLocale)
 
BOOL IsSortPageNeeded (LCID lcid)
 
static BOOL CALLBACK SortEnumProc (LPTSTR lpLocale)
 
static VOID CreateSortList (HWND hwnd, LCID lcid)
 
INT_PTR CALLBACK SortPageProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 

Variables

static BOOL bSortPage = FALSE
 
static LCID userLcid
 
static HWND hWndSortList = NULL
 

Function Documentation

◆ CreateSortList()

static VOID CreateSortList ( HWND  hwnd,
LCID  lcid 
)
static

Definition at line 77 of file sort.c.

78{
79 WCHAR lang[255];
80 INT index;
81
83
84 /* Handle special case for Spanish (Spain) */
87 {
88 /* Add traditional sorting */
90 LOCALE_SSORTNAME, lang, sizeof(lang)/sizeof(TCHAR));
91
94 0,
95 (LPARAM)lang);
96
99 index,
101
102 /* Add modern sorting */
104 LOCALE_SSORTNAME, lang, sizeof(lang)/sizeof(TCHAR));
105
108 0,
109 (LPARAM)lang);
110
113 index,
115 }
116 else
117 {
118 userLcid = lcid;
119
120 GetLocaleInfoW(lcid & 0xFFFF, LOCALE_SSORTNAME, lang, sizeof(lang)/sizeof(WCHAR));
121
124 0,
125 (LPARAM)lang);
126
129 index,
130 (LPARAM)lcid & 0xFFFF);
131
133 }
134
135 /* Select current locale */
136 /* or should it be System and not user? */
137 GetLocaleInfoW(lcid, LOCALE_SSORTNAME, lang, sizeof(lang)/sizeof(WCHAR));
138
141 -1,
142 (LPARAM)lang);
143}
#define index(s, c)
Definition: various.h:29
static LCID userLcid
Definition: sort.c:11
static BOOL CALLBACK SortEnumProc(LPTSTR lpLocale)
Definition: sort.c:49
static HWND hWndSortList
Definition: sort.c:13
GLuint index
Definition: glext.h:6031
BOOL WINAPI EnumSystemLocalesW(LOCALE_ENUMPROCW lpfnLocaleEnum, DWORD dwFlags)
Definition: lang.c:1614
INT WINAPI GetLocaleInfoW(LCID lcid, LCTYPE lctype, LPWSTR buffer, INT len)
Definition: lang.c:1108
#define SORT_DEFAULT
#define MAKELCID(lgid, srtid)
#define SUBLANG_SPANISH
Definition: nls.h:336
#define MAKELANGID(p, s)
Definition: nls.h:15
#define LANG_SPANISH
Definition: nls.h:123
#define SUBLANG_SPANISH_MODERN
Definition: nls.h:338
int32_t INT
Definition: typedefs.h:58
static const WCHAR lang[]
Definition: wbemdisp.c:287
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
LONG_PTR LPARAM
Definition: windef.h:208
#define LCID_ALTERNATE_SORTS
Definition: winnls.h:203
#define CB_SELECTSTRING
Definition: winuser.h:1960
#define CB_SETITEMDATA
Definition: winuser.h:1966
#define CB_ADDSTRING
Definition: winuser.h:1936
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
char TCHAR
Definition: xmlstorage.h:189
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by SortPageProc().

◆ IsSortPageNeeded()

BOOL IsSortPageNeeded ( LCID  lcid)

Definition at line 32 of file sort.c.

33{
34 /* Handle special case for Spanish (Spain) */
37 return TRUE;
38
39 userLcid = lcid;
41
43
44 return bSortPage;
45}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
static BOOL CALLBACK SortTestEnumProc(PWSTR lpLocale)
Definition: sort.c:17
static BOOL bSortPage
Definition: sort.c:10

Referenced by CustomizeLocalePropertySheet().

◆ SortEnumProc()

static BOOL CALLBACK SortEnumProc ( LPTSTR  lpLocale)
static

Definition at line 49 of file sort.c.

50{
51 LCID lcid;
52 WCHAR lang[255];
53 INT index;
54
55 lcid = wcstoul(lpLocale, NULL, 16);
56
57 if ((LANGIDFROMLCID(lcid) == LANGIDFROMLCID(userLcid)) &&
59 {
60 GetLocaleInfoW(lcid, LOCALE_SSORTNAME, lang, sizeof(lang)/sizeof(WCHAR));
61
64 0,
65 (LPARAM)lang);
66
69 index,
70 (LPARAM)lcid);
71 }
72
73 return TRUE;
74}
#define NULL
Definition: types.h:112
_Check_return_ unsigned long __cdecl wcstoul(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
#define SORTIDFROMLCID(lcid)
#define LANGIDFROMLCID(l)
Definition: nls.h:18
DWORD LCID
Definition: nls.h:13

Referenced by CreateSortList().

◆ SortPageProc()

INT_PTR CALLBACK SortPageProc ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 147 of file sort.c.

151{
152 PGLOBALDATA pGlobalData;
153
154 pGlobalData = (PGLOBALDATA)GetWindowLongPtr(hwndDlg, DWLP_USER);
155
156 switch (uMsg)
157 {
158 case WM_INITDIALOG:
159 pGlobalData = (PGLOBALDATA)((LPPROPSHEETPAGE)lParam)->lParam;
160 SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pGlobalData);
161
162 CreateSortList(GetDlgItem(hwndDlg, IDC_SORTLIST_COMBO), pGlobalData->UserLCID);
163 break;
164
165 case WM_COMMAND:
166 switch (LOWORD(wParam))
167 {
170 {
171 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
172 }
173 break;
174 }
175 break;
176
177 case WM_NOTIFY:
178 if (((LPNMHDR)lParam)->code == (UINT)PSN_APPLY)
179 {
180 LCID NewLcid;
181 INT iCurSel;
182
183 iCurSel = SendDlgItemMessage(hwndDlg,
186 0,
187 0);
188 if (iCurSel == CB_ERR)
189 break;
190
191 NewLcid = SendDlgItemMessage(hwndDlg,
194 iCurSel,
195 0);
196 if (NewLcid == (LCID)CB_ERR)
197 break;
198
199 /* Save the new LCID */
200 pGlobalData->UserLCID = NewLcid;
201 pGlobalData->bUserLocaleChanged = TRUE;
202 }
203 break;
204 }
205
206 return FALSE;
207}
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define IDC_SORTLIST_COMBO
Definition: resource.h:70
static VOID CreateSortList(HWND hwnd, LCID lcid)
Definition: sort.c:77
struct _GLOBALDATA * PGLOBALDATA
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
unsigned int UINT
Definition: ndis.h:50
#define LOWORD(l)
Definition: pedump.c:82
#define PropSheet_Changed(d, w)
Definition: prsht.h:344
#define PSN_APPLY
Definition: prsht.h:117
#define LPPROPSHEETPAGE
Definition: prsht.h:390
#define WM_NOTIFY
Definition: richedit.h:61
LCID UserLCID
Definition: intl.h:113
BOOL bUserLocaleChanged
Definition: intl.h:115
Definition: inflate.c:139
#define GetWindowLongPtr
Definition: treelist.c:73
#define SetWindowLongPtr
Definition: treelist.c:70
#define HIWORD(l)
Definition: typedefs.h:247
#define DWLP_USER
Definition: winuser.h:872
#define WM_COMMAND
Definition: winuser.h:1740
#define CB_ERR
Definition: winuser.h:2435
#define WM_INITDIALOG
Definition: winuser.h:1739
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define CBN_SELCHANGE
Definition: winuser.h:1979
#define CB_GETITEMDATA
Definition: winuser.h:1950
HWND WINAPI GetParent(_In_ HWND)
#define CB_GETCURSEL
Definition: winuser.h:1943
#define SendDlgItemMessage
Definition: winuser.h:5842

Referenced by CustomizeLocalePropertySheet().

◆ SortTestEnumProc()

static BOOL CALLBACK SortTestEnumProc ( PWSTR  lpLocale)
static

Definition at line 17 of file sort.c.

18{
19 LCID lcid;
20
21 lcid = wcstoul(lpLocale, NULL, 16);
22
23 if ((LANGIDFROMLCID(lcid) == LANGIDFROMLCID(userLcid)) &&
26
27 return TRUE;
28}

Referenced by IsSortPageNeeded().

Variable Documentation

◆ bSortPage

BOOL bSortPage = FALSE
static

Definition at line 10 of file sort.c.

Referenced by IsSortPageNeeded(), and SortTestEnumProc().

◆ hWndSortList

HWND hWndSortList = NULL
static

Definition at line 13 of file sort.c.

Referenced by CreateSortList(), and SortEnumProc().

◆ userLcid

LCID userLcid
static

Definition at line 11 of file sort.c.

Referenced by CreateSortList(), IsSortPageNeeded(), SortEnumProc(), and SortTestEnumProc().