ReactOS  0.4.15-dev-3453-gff89651
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 
107  CB_ADDSTRING,
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 
123  CB_ADDSTRING,
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 CB_SETITEMDATA
Definition: winuser.h:1953
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define MAKELCID(lgid, srtid)
#define SUBLANG_SPANISH_MODERN
Definition: nls.h:338
int32_t INT
Definition: typedefs.h:58
INT WINAPI GetLocaleInfoW(LCID lcid, LCTYPE lctype, LPWSTR buffer, INT len)
Definition: lang.c:1102
static BOOL CALLBACK SortEnumProc(LPTSTR lpLocale)
Definition: sort.c:49
#define CB_ADDSTRING
Definition: winuser.h:1923
LONG_PTR LPARAM
Definition: windef.h:208
GLuint index
Definition: glext.h:6031
BOOL WINAPI EnumSystemLocalesW(LOCALE_ENUMPROCW lpfnLocaleEnum, DWORD dwFlags)
Definition: lang.c:1608
static const WCHAR lang[]
Definition: wbemdisp.c:287
char TCHAR
Definition: xmlstorage.h:189
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define SORT_DEFAULT
#define index(s, c)
Definition: various.h:29
#define CB_SELECTSTRING
Definition: winuser.h:1947
static HWND hWndSortList
Definition: sort.c:13
#define SUBLANG_SPANISH
Definition: nls.h:336
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define MAKELANGID(p, s)
Definition: nls.h:15
static LCID userLcid
Definition: sort.c:11
#define LANG_SPANISH
Definition: nls.h:123
#define LCID_ALTERNATE_SORTS
Definition: winnls.h:203

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;
40  bSortPage = FALSE;
41 
43 
44  return bSortPage;
45 }
#define MAKELCID(lgid, srtid)
#define TRUE
Definition: types.h:120
#define SUBLANG_SPANISH_MODERN
Definition: nls.h:338
#define FALSE
Definition: types.h:117
BOOL WINAPI EnumSystemLocalesW(LOCALE_ENUMPROCW lpfnLocaleEnum, DWORD dwFlags)
Definition: lang.c:1608
#define SORT_DEFAULT
static BOOL bSortPage
Definition: sort.c:10
#define SUBLANG_SPANISH
Definition: nls.h:336
#define MAKELANGID(p, s)
Definition: nls.h:15
static LCID userLcid
Definition: sort.c:11
#define LANG_SPANISH
Definition: nls.h:123
#define LCID_ALTERNATE_SORTS
Definition: winnls.h:203
static BOOL CALLBACK SortTestEnumProc(PWSTR lpLocale)
Definition: sort.c:17

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 CB_SETITEMDATA
Definition: winuser.h:1953
#define TRUE
Definition: types.h:120
DWORD LCID
Definition: nls.h:13
_Check_return_ unsigned long __cdecl wcstoul(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
int32_t INT
Definition: typedefs.h:58
INT WINAPI GetLocaleInfoW(LCID lcid, LCTYPE lctype, LPWSTR buffer, INT len)
Definition: lang.c:1102
#define CB_ADDSTRING
Definition: winuser.h:1923
LONG_PTR LPARAM
Definition: windef.h:208
GLuint index
Definition: glext.h:6031
static const WCHAR lang[]
Definition: wbemdisp.c:287
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define index(s, c)
Definition: various.h:29
#define LANGIDFROMLCID(l)
Definition: nls.h:18
static HWND hWndSortList
Definition: sort.c:13
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define SORTIDFROMLCID(lcid)
#define NULL
Definition: types.h:112
static LCID userLcid
Definition: sort.c:11

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  {
168  case IDC_SORTLIST_COMBO:
169  if (HIWORD(wParam) == CBN_SELCHANGE)
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,
185  CB_GETCURSEL,
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 }
struct _GLOBALDATA * PGLOBALDATA
#define TRUE
Definition: types.h:120
#define CB_GETITEMDATA
Definition: winuser.h:1937
BOOL bUserLocaleChanged
Definition: intl.h:115
DWORD LCID
Definition: nls.h:13
#define SendDlgItemMessage
Definition: winuser.h:5822
#define PSN_APPLY
Definition: prsht.h:117
int32_t INT
Definition: typedefs.h:58
#define SetWindowLongPtr
Definition: treelist.c:70
#define CB_GETCURSEL
Definition: winuser.h:1930
WPARAM wParam
Definition: combotst.c:138
#define FALSE
Definition: types.h:117
#define LPPROPSHEETPAGE
Definition: prsht.h:390
#define CB_ERR
Definition: winuser.h:2415
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define PropSheet_Changed(d, w)
Definition: prsht.h:344
#define DWLP_USER
Definition: winuser.h:866
#define WM_COMMAND
Definition: winuser.h:1727
Definition: inflate.c:139
HWND WINAPI GetParent(_In_ HWND)
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
unsigned int UINT
Definition: ndis.h:50
#define IDC_SORTLIST_COMBO
Definition: resource.h:70
#define CBN_SELCHANGE
Definition: winuser.h:1966
#define HIWORD(l)
Definition: typedefs.h:247
#define GetWindowLongPtr
Definition: treelist.c:73
static VOID CreateSortList(HWND hwnd, LCID lcid)
Definition: sort.c:77
#define WM_INITDIALOG
Definition: winuser.h:1726
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define WM_NOTIFY
Definition: richedit.h:61
LCID UserLCID
Definition: intl.h:113

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)) &&
25  bSortPage = TRUE;
26 
27  return TRUE;
28 }
#define TRUE
Definition: types.h:120
DWORD LCID
Definition: nls.h:13
_Check_return_ unsigned long __cdecl wcstoul(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
#define LANGIDFROMLCID(l)
Definition: nls.h:18
static BOOL bSortPage
Definition: sort.c:10
#define SORTIDFROMLCID(lcid)
#define NULL
Definition: types.h:112
static LCID userLcid
Definition: sort.c:11

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().