ReactOS 0.4.15-dev-8109-gd7be748
date.c File Reference
#include "intl.h"
Include dependency graph for date.c:

Go to the source code of this file.

Macros

#define YEAR_STR_MAX_SIZE   5
 
#define MAX_SHRT_DATE_SEPARATORS   3
 
#define STD_DATE_SEP   L"."
 
#define YEAR_DIFF   (99)
 
#define MAX_YEAR   (9999)
 

Functions

BOOL isDateCompAl (WCHAR alpha)
 
LPTSTR FindDateSep (const WCHAR *szSourceStr)
 
static BOOL SetShortDateSep (HWND hwndDlg, PWSTR pszShortDateSep)
 
static BOOL SetShortDateFormat (HWND hwndDlg, PWSTR pszShortDateFmt)
 
static BOOL SetLongDateFormat (HWND hwndDlg, PWSTR pszLongDateFmt)
 
static VOID InitShortDateSepSamples (HWND hwndDlg, PGLOBALDATA pGlobalData)
 
static BOOL CALLBACK ShortDateFormatEnumProc (PWSTR lpTimeFormatString)
 
VOID InitShortDateCB (HWND hwndDlg, PGLOBALDATA pGlobalData)
 
static VOID InitLongDateCB (HWND hwndDlg, PGLOBALDATA pGlobalData)
 
static VOID SetMaxDate (HWND hwndDlg, LCID lcid)
 
static INT GetMaxDate (LCID lcid)
 
static VOID SetMinDate (HWND hwndDlg)
 
static VOID InitMinMaxDateSpin (HWND hwndDlg, PGLOBALDATA pGlobalData)
 
static VOID UpdateDateLocaleSamples (HWND hwndDlg, PGLOBALDATA pGlobalData)
 
static BOOL GetDateSetting (HWND hwndDlg, PGLOBALDATA pGlobalData)
 
INT_PTR CALLBACK DatePageProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 

Variables

static HWND hwndEnum = NULL
 

Macro Definition Documentation

◆ MAX_SHRT_DATE_SEPARATORS

#define MAX_SHRT_DATE_SEPARATORS   3

Definition at line 32 of file date.c.

◆ MAX_YEAR

#define MAX_YEAR   (9999)

Definition at line 35 of file date.c.

◆ STD_DATE_SEP

#define STD_DATE_SEP   L"."

Definition at line 33 of file date.c.

◆ YEAR_DIFF

#define YEAR_DIFF   (99)

Definition at line 34 of file date.c.

◆ YEAR_STR_MAX_SIZE

#define YEAR_STR_MAX_SIZE   5

Definition at line 31 of file date.c.

Function Documentation

◆ DatePageProc()

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

Definition at line 544 of file date.c.

548{
549 PGLOBALDATA pGlobalData;
550
551 pGlobalData = (PGLOBALDATA)GetWindowLongPtr(hwndDlg, DWLP_USER);
552
553 switch (uMsg)
554 {
555 case WM_INITDIALOG:
556 pGlobalData = (PGLOBALDATA)((LPPROPSHEETPAGE)lParam)->lParam;
557 SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pGlobalData);
558
559 InitMinMaxDateSpin(hwndDlg, pGlobalData);
560 UpdateDateLocaleSamples(hwndDlg, pGlobalData);
561 InitShortDateCB(hwndDlg, pGlobalData);
562 InitLongDateCB(hwndDlg, pGlobalData);
563 InitShortDateSepSamples(hwndDlg, pGlobalData);
564 /* TODO: Add other calendar types */
565 pGlobalData->bEnableYearNotification = TRUE;
566 break;
567
568 case WM_COMMAND:
569 switch (LOWORD(wParam))
570 {
572 if (HIWORD(wParam) == EN_CHANGE &&
573 pGlobalData != NULL &&
574 pGlobalData->bEnableYearNotification == TRUE)
575 {
576 SetMinDate(hwndDlg);
577
578 /* Enable the Apply button */
579 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
580 }
581 break;
582
588 if (HIWORD(wParam) == CBN_SELCHANGE ||
590 {
591 /* Enable the Apply button */
592 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
593 }
594 break;
595 }
596 break;
597
598 case WM_NOTIFY:
599 if (((LPNMHDR)lParam)->code == (UINT)PSN_APPLY)
600 {
601 if (GetDateSetting(hwndDlg, pGlobalData))
602 {
603 pGlobalData->bUserLocaleChanged = TRUE;
604 SetMaxDate(hwndDlg, pGlobalData->UserLCID);
605 UpdateDateLocaleSamples(hwndDlg, pGlobalData);
606 }
607 }
608 break;
609 }
610
611 return FALSE;
612}
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
static VOID UpdateDateLocaleSamples(HWND hwndDlg, PGLOBALDATA pGlobalData)
Definition: date.c:496
static VOID SetMinDate(HWND hwndDlg)
Definition: date.c:425
static VOID InitShortDateSepSamples(HWND hwndDlg, PGLOBALDATA pGlobalData)
Definition: date.c:236
static VOID InitMinMaxDateSpin(HWND hwndDlg, PGLOBALDATA pGlobalData)
Definition: date.c:449
static BOOL GetDateSetting(HWND hwndDlg, PGLOBALDATA pGlobalData)
Definition: date.c:519
static VOID SetMaxDate(HWND hwndDlg, LCID lcid)
Definition: date.c:383
static VOID InitLongDateCB(HWND hwndDlg, PGLOBALDATA pGlobalData)
Definition: date.c:341
VOID InitShortDateCB(HWND hwndDlg, PGLOBALDATA pGlobalData)
Definition: date.c:295
#define IDC_SECONDYEAR_EDIT
Definition: resource.h:55
#define IDC_SHRTDATESEP_COMBO
Definition: resource.h:62
#define IDC_HIJCHRON_COMBO
Definition: resource.h:58
#define IDC_LONGDATEFMT_COMBO
Definition: resource.h:65
#define IDC_CALTYPE_COMBO
Definition: resource.h:57
#define IDC_SHRTDATEFMT_COMBO
Definition: resource.h:61
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 bEnableYearNotification
Definition: intl.h:106
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 WM_INITDIALOG
Definition: winuser.h:1739
#define CBN_SELCHANGE
Definition: winuser.h:1979
HWND WINAPI GetParent(_In_ HWND)
#define CBN_EDITCHANGE
Definition: winuser.h:1975
#define EN_CHANGE
Definition: winuser.h:2022

Referenced by CustomizeLocalePropertySheet().

◆ FindDateSep()

LPTSTR FindDateSep ( const WCHAR szSourceStr)

Definition at line 53 of file date.c.

54{
55 PWSTR pszFoundSep;
56 UINT nDateCompCount=0;
57 UINT nDateSepCount=0;
58
59 pszFoundSep = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, MAX_SAMPLES_STR_SIZE * sizeof(WCHAR));
60 if (pszFoundSep == NULL)
61 return NULL;
62
63 wcscpy(pszFoundSep,STD_DATE_SEP);
64
65 while (nDateCompCount < wcslen(szSourceStr))
66 {
67 if (!isDateCompAl(szSourceStr[nDateCompCount]) && (szSourceStr[nDateCompCount] != L'\''))
68 {
69 while (!isDateCompAl(szSourceStr[nDateCompCount]) && (szSourceStr[nDateCompCount] != L'\''))
70 {
71 pszFoundSep[nDateSepCount++] = szSourceStr[nDateCompCount];
72 nDateCompCount++;
73 }
74
75 pszFoundSep[nDateSepCount] = L'\0';
76 return pszFoundSep;
77 }
78
79 nDateCompCount++;
80 }
81
82 return pszFoundSep;
83}
#define STD_DATE_SEP
Definition: date.c:33
BOOL isDateCompAl(WCHAR alpha)
Definition: date.c:43
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define MAX_SAMPLES_STR_SIZE
Definition: intl.h:24
#define L(x)
Definition: ntvdm.h:50
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
uint16_t * PWSTR
Definition: typedefs.h:56
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by SetShortDateFormat().

◆ GetDateSetting()

static BOOL GetDateSetting ( HWND  hwndDlg,
PGLOBALDATA  pGlobalData 
)
static

Definition at line 519 of file date.c.

522{
523 WCHAR szLongDateFormat[MAX_LONGDATEFORMAT];
524 WCHAR szShortDateFormat[MAX_SHORTDATEFORMAT];
525 WCHAR szDateSeparator[MAX_DATESEPARATOR];
526
527 if (!SetLongDateFormat(hwndDlg, szLongDateFormat) ||
528 !SetShortDateFormat(hwndDlg, szShortDateFormat) ||
529 !SetShortDateSep(hwndDlg, szDateSeparator))
530 {
531 return FALSE;
532 }
533
534 /* Store settings in global data */
535 wcscpy(pGlobalData->szLongDateFormat, szLongDateFormat);
536 wcscpy(pGlobalData->szShortDateFormat, szShortDateFormat);
537 wcscpy(pGlobalData->szDateSep, szDateSeparator);
538
539 return TRUE;
540}
static BOOL SetShortDateFormat(HWND hwndDlg, PWSTR pszShortDateFmt)
Definition: date.c:125
static BOOL SetLongDateFormat(HWND hwndDlg, PWSTR pszLongDateFmt)
Definition: date.c:193
static BOOL SetShortDateSep(HWND hwndDlg, PWSTR pszShortDateSep)
Definition: date.c:90
#define MAX_LONGDATEFORMAT
Definition: intl.h:44
#define MAX_SHORTDATEFORMAT
Definition: intl.h:43
#define MAX_DATESEPARATOR
Definition: intl.h:45
WCHAR szShortDateFormat[MAX_SHORTDATEFORMAT]
Definition: intl.h:100
WCHAR szLongDateFormat[MAX_LONGDATEFORMAT]
Definition: intl.h:99
WCHAR szDateSep[MAX_DATESEPARATOR]
Definition: intl.h:101

Referenced by DatePageProc().

◆ GetMaxDate()

static INT GetMaxDate ( LCID  lcid)
static

Definition at line 409 of file date.c.

410{
411 INT nMaxDateVal = 0;
412
413 GetCalendarInfoW(lcid,
415 CAL_ITWODIGITYEARMAX | CAL_RETURN_NUMBER,
416 NULL,
417 0, /* ret type - number */
418 (LPDWORD)&nMaxDateVal);
419
420 return nMaxDateVal;
421}
int WINAPI GetCalendarInfoW(LCID Locale, CALID Calendar, CALTYPE CalType, LPWSTR lpCalData, int cchData, LPDWORD lpValue)
Definition: lcformat.c:2499
uint32_t * LPDWORD
Definition: typedefs.h:59
int32_t INT
Definition: typedefs.h:58
#define CAL_GREGORIAN
Definition: winnls.h:443

Referenced by InitMinMaxDateSpin().

◆ InitLongDateCB()

static VOID InitLongDateCB ( HWND  hwndDlg,
PGLOBALDATA  pGlobalData 
)
static

Definition at line 341 of file date.c.

342{
343 INT nRetCode;
344
345 /* Limit text length */
349 0);
350
351 /* Clear all box content */
354 (WPARAM)0,
355 (LPARAM)0);
356
357 /* Enumerate short long formats */
360
361 /* Set current item to value from registry */
362 nRetCode = SendDlgItemMessageW(hwndDlg, IDC_LONGDATEFMT_COMBO,
364 -1,
365 (LPARAM)pGlobalData->szLongDateFormat);
366
367 /* If it is not successful, add new value to list and select them */
368 if (nRetCode == CB_ERR)
369 {
372 0,
373 (LPARAM)pGlobalData->szLongDateFormat);
376 -1,
377 (LPARAM)pGlobalData->szLongDateFormat);
378 }
379}
static HWND hwndEnum
Definition: date.c:37
static BOOL CALLBACK ShortDateFormatEnumProc(PWSTR lpTimeFormatString)
Definition: date.c:283
BOOL WINAPI EnumDateFormatsW(DATEFMT_ENUMPROCW proc, LCID lcid, DWORD flags)
Definition: lcformat.c:2033
LONG_PTR LPARAM
Definition: windef.h:208
UINT_PTR WPARAM
Definition: windef.h:207
#define DATE_LONGDATE
Definition: winnls.h:197
#define CB_SELECTSTRING
Definition: winuser.h:1960
#define CB_ERR
Definition: winuser.h:2435
#define CB_RESETCONTENT
Definition: winuser.h:1959
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CB_ADDSTRING
Definition: winuser.h:1936
#define CB_LIMITTEXT
Definition: winuser.h:1958

Referenced by DatePageProc().

◆ InitMinMaxDateSpin()

static VOID InitMinMaxDateSpin ( HWND  hwndDlg,
PGLOBALDATA  pGlobalData 
)
static

Definition at line 449 of file date.c.

450{
452 HWND hWndYearSpin;
453
454 /* Limit text lengths */
458 0);
462 0);
463
464 hWndYearSpin = GetDlgItem(hwndDlg, IDC_SCR_MAX_YEAR);
465
466 /* Init max date value */
467 wsprintf(OutBuffer, L"%04d", (DWORD)GetMaxDate(pGlobalData->UserLCID));
470 0,
472
473 /* Init min date value */
474 wsprintf(OutBuffer, L"%04d", (DWORD)GetMaxDate(pGlobalData->UserLCID) - YEAR_DIFF);
477 0,
479
480 /* Init updown control */
481 /* Set bounds */
482 SendMessageW(hWndYearSpin,
484 0,
486
487 /* Set current value */
488 SendMessageW(hWndYearSpin,
490 0,
491 MAKELONG(GetMaxDate(pGlobalData->UserLCID),0));
492}
#define YEAR_DIFF
Definition: date.c:34
#define MAX_YEAR
Definition: date.c:35
static INT GetMaxDate(LCID lcid)
Definition: date.c:409
#define YEAR_STR_MAX_SIZE
Definition: date.c:31
#define IDC_FIRSTYEAR_EDIT
Definition: resource.h:54
#define IDC_SCR_MAX_YEAR
Definition: resource.h:56
unsigned long DWORD
Definition: ntddk_ex.h:95
#define MAX_YEAR_EDIT
Definition: intl.h:46
#define UDM_SETPOS
Definition: commctrl.h:2143
#define UDM_SETRANGE
Definition: commctrl.h:2141
_In_ UCHAR _In_ ULONG _Out_ PUCHAR _Outptr_result_bytebuffer_ OutBufferLength PVOID * OutBuffer
Definition: scsi.h:4071
#define MAKELONG(a, b)
Definition: typedefs.h:249
#define EM_LIMITTEXT
Definition: winuser.h:2000
#define WM_SETTEXT
Definition: winuser.h:1617
#define wsprintf
Definition: winuser.h:5865
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by DatePageProc().

◆ InitShortDateCB()

VOID InitShortDateCB ( HWND  hwndDlg,
PGLOBALDATA  pGlobalData 
)

Definition at line 295 of file date.c.

296{
297 INT nRetCode;
298
299 /* Limit text lengths */
303 0);
307 0);
308
309 /* Clear all box content */
312 (WPARAM)0,
313 (LPARAM)0);
314
315 /* Enumerate short date formats */
318
319 /* Set current item to value from registry */
320 nRetCode = SendDlgItemMessageW(hwndDlg, IDC_SHRTDATEFMT_COMBO,
322 -1,
323 (LPARAM)pGlobalData->szShortDateFormat);
324
325 /* If it is not successful, add new value to list and select them */
326 if (nRetCode == CB_ERR)
327 {
330 0,
331 (LPARAM)pGlobalData->szShortDateFormat);
334 -1,
335 (LPARAM)pGlobalData->szShortDateFormat);
336 }
337}
#define DATE_SHORTDATE
Definition: winnls.h:196

Referenced by DatePageProc().

◆ InitShortDateSepSamples()

static VOID InitShortDateSepSamples ( HWND  hwndDlg,
PGLOBALDATA  pGlobalData 
)
static

Definition at line 236 of file date.c.

237{
238 PWSTR ShortDateSepSamples[MAX_SHRT_DATE_SEPARATORS] =
239 {
240 L".",
241 L"/",
242 L"-"
243 };
244 INT nCBIndex;
245 INT nRetCode;
246
247 /* Clear all box content */
250 (WPARAM)0,
251 (LPARAM)0);
252
253 /* Create standard list of separators */
254 for (nCBIndex = 0; nCBIndex < MAX_SHRT_DATE_SEPARATORS; nCBIndex++)
255 {
258 0,
259 (LPARAM)ShortDateSepSamples[nCBIndex]);
260 }
261
262 /* Set current item to value from registry */
263 nRetCode = SendDlgItemMessageW(hwndDlg, IDC_SHRTDATESEP_COMBO,
265 -1,
266 (LPARAM)pGlobalData->szDateSep);
267
268 /* If it is not successful, add new value to list and select them */
269 if (nRetCode == CB_ERR)
270 {
273 0,
274 (LPARAM)pGlobalData->szDateSep);
277 -1,
278 (LPARAM)pGlobalData->szDateSep);
279 }
280}
#define MAX_SHRT_DATE_SEPARATORS
Definition: date.c:32

Referenced by DatePageProc().

◆ isDateCompAl()

BOOL isDateCompAl ( WCHAR  alpha)

Definition at line 43 of file date.c.

44{
45 if ((alpha == L'y') || (alpha == L'M') || (alpha == L'd') || (alpha == L' '))
46 return TRUE;
47 else
48 return FALSE;
49}
GLclampf GLclampf GLclampf alpha
Definition: gl.h:1740

Referenced by FindDateSep(), SetLongDateFormat(), and SetShortDateFormat().

◆ SetLongDateFormat()

static BOOL SetLongDateFormat ( HWND  hwndDlg,
PWSTR  pszLongDateFmt 
)
static

Definition at line 193 of file date.c.

194{
195 BOOL OpenApostFlg = FALSE;
196 INT nFmtStrSize;
197 INT nDateCompCount;
198
199 /* Get format */
203 (LPARAM)pszLongDateFmt);
204
205 /* Get format string size */
206 nFmtStrSize = wcslen(pszLongDateFmt);
207
208 /* Check date components */
209 for (nDateCompCount = 0; nDateCompCount < nFmtStrSize; nDateCompCount++)
210 {
211 if (pszLongDateFmt[nDateCompCount] == L'\'')
212 {
213 OpenApostFlg = !OpenApostFlg;
214 }
215
216 if (iswalnum(pszLongDateFmt[nDateCompCount]) &&
217 !isDateCompAl(pszLongDateFmt[nDateCompCount]) &&
218 !OpenApostFlg)
219 {
221 return FALSE;
222 }
223 }
224
225 if (OpenApostFlg || nFmtStrSize == 0)
226 {
228 return FALSE;
229 }
230
231 return TRUE;
232}
#define IDS_ERROR_SYMBOL_FORMAT_LONG
Definition: resource.h:89
unsigned int BOOL
Definition: ntddk_ex.h:94
#define iswalnum(_c)
Definition: ctype.h:671
VOID PrintErrorMsgBox(UINT msg)
Definition: intl.c:51
#define WM_GETTEXT
Definition: winuser.h:1618

Referenced by GetDateSetting().

◆ SetMaxDate()

static VOID SetMaxDate ( HWND  hwndDlg,
LCID  lcid 
)
static

Definition at line 383 of file date.c.

384{
385 WCHAR szMaxDateVal[YEAR_STR_MAX_SIZE];
386 HWND hWndYearSpin;
387 INT nSpinVal;
388
389 hWndYearSpin = GetDlgItem(hwndDlg, IDC_SCR_MAX_YEAR);
390
391 /* Get spin value */
392 nSpinVal = LOWORD(SendMessageW(hWndYearSpin,
394 0,
395 0));
396
397 /* convert to wide char */
398 _itow(nSpinVal, szMaxDateVal, DECIMAL_RADIX);
399
400 /* Save max date value */
401 SetCalendarInfoW(lcid,
403 48 , /* CAL_ITWODIGITYEARMAX */
404 (PCWSTR)szMaxDateVal);
405}
_CRTIMP wchar_t *__cdecl _itow(_In_ int _Value, _Pre_notnull_ _Post_z_ wchar_t *_Dest, _In_ int _Radix)
#define DECIMAL_RADIX
Definition: intl.h:19
int WINAPI SetCalendarInfoW(LCID Locale, CALID Calendar, CALTYPE CalType, LPCWSTR lpCalData)
Definition: lcformat.c:2842
#define UDM_GETPOS
Definition: commctrl.h:2144
const uint16_t * PCWSTR
Definition: typedefs.h:57

Referenced by DatePageProc().

◆ SetMinDate()

static VOID SetMinDate ( HWND  hwndDlg)
static

Definition at line 425 of file date.c.

426{
428 HWND hWndYearSpin;
429 INT nSpinVal;
430
431 hWndYearSpin = GetDlgItem(hwndDlg, IDC_SCR_MAX_YEAR);
432
433 /* Get spin value */
434 nSpinVal = LOWORD(SendMessageW(hWndYearSpin,
436 0,
437 0));
438
439 /* Set min year value */
440 wsprintf(OutBuffer, L"%d", (DWORD)nSpinVal - YEAR_DIFF);
443 0,
445}

Referenced by DatePageProc().

◆ SetShortDateFormat()

static BOOL SetShortDateFormat ( HWND  hwndDlg,
PWSTR  pszShortDateFmt 
)
static

Definition at line 125 of file date.c.

126{
127 WCHAR szShortDateSep[MAX_SAMPLES_STR_SIZE];
128 WCHAR szFoundDateSep[MAX_SAMPLES_STR_SIZE];
129 PWSTR pszResultStr;
130 PWSTR pszFoundSep;
131 BOOL OpenApostFlg = FALSE;
132 INT nFmtStrSize;
133 INT nDateCompCount;
134
135 /* Get format */
139 (LPARAM)pszShortDateFmt);
140
141 /* Get separator */
145 (LPARAM)szShortDateSep);
146
147 /* Get format-string size */
148 nFmtStrSize = wcslen(pszShortDateFmt);
149
150 /* Check date components */
151 for (nDateCompCount = 0; nDateCompCount < nFmtStrSize; nDateCompCount++)
152 {
153 if (pszShortDateFmt[nDateCompCount] == L'\'')
154 {
155 OpenApostFlg = !OpenApostFlg;
156 }
157
158 if (iswalnum(pszShortDateFmt[nDateCompCount]) &&
159 !isDateCompAl(pszShortDateFmt[nDateCompCount]) &&
160 !OpenApostFlg)
161 {
163 return FALSE;
164 }
165 }
166
167 if (OpenApostFlg || nFmtStrSize == 0)
168 {
170 return FALSE;
171 }
172
173 pszFoundSep = FindDateSep(pszShortDateFmt);
174 if (pszFoundSep != NULL)
175 {
176 /* Substring replacement of separator */
177 wcscpy(szFoundDateSep, pszFoundSep);
178 pszResultStr = ReplaceSubStr(pszShortDateFmt, szShortDateSep, szFoundDateSep);
179 if (pszResultStr != NULL)
180 {
181 wcscpy(pszShortDateFmt, pszResultStr);
182 HeapFree(GetProcessHeap(), 0, pszResultStr);
183 }
184
185 HeapFree(GetProcessHeap(), 0, pszFoundSep);
186 }
187
188 return TRUE;
189}
LPTSTR FindDateSep(const WCHAR *szSourceStr)
Definition: date.c:53
#define IDS_ERROR_SYMBOL_FORMAT_SHORT
Definition: resource.h:88
#define HeapFree(x, y, z)
Definition: compat.h:735
PWSTR ReplaceSubStr(PCWSTR szSourceStr, PCWSTR szStrToReplace, PCWSTR szTempl)
Definition: misc.c:118

Referenced by GetDateSetting().

◆ SetShortDateSep()

static BOOL SetShortDateSep ( HWND  hwndDlg,
PWSTR  pszShortDateSep 
)
static

Definition at line 90 of file date.c.

91{
92 INT nSepStrSize;
93 INT nSepCount;
94
95 /* Get separator */
99 (LPARAM)pszShortDateSep);
100
101 /* Get separator string size */
102 nSepStrSize = wcslen(pszShortDateSep);
103
104 /* Check date components */
105 for (nSepCount = 0; nSepCount < nSepStrSize; nSepCount++)
106 {
107 if (iswalnum(pszShortDateSep[nSepCount]) || (pszShortDateSep[nSepCount] == L'\''))
108 {
110 return FALSE;
111 }
112 }
113
114 if (nSepStrSize == 0)
115 {
117 return FALSE;
118 }
119
120 return TRUE;
121}
#define IDS_ERROR_SYMBOL_SEPARATE
Definition: resource.h:87

Referenced by GetDateSetting().

◆ ShortDateFormatEnumProc()

static BOOL CALLBACK ShortDateFormatEnumProc ( PWSTR  lpTimeFormatString)
static

Definition at line 283 of file date.c.

284{
287 0,
288 (LPARAM)lpTimeFormatString);
289
290 return TRUE;
291}

Referenced by InitLongDateCB(), and InitShortDateCB().

◆ UpdateDateLocaleSamples()

static VOID UpdateDateLocaleSamples ( HWND  hwndDlg,
PGLOBALDATA  pGlobalData 
)
static

Definition at line 496 of file date.c.

498{
500
501 /* Get short date format sample */
502 GetDateFormatW(pGlobalData->UserLCID, 0, NULL,
503 pGlobalData->szShortDateFormat, OutBuffer,
506 0, (LPARAM)OutBuffer);
507
508 /* Get long date sample */
509 GetDateFormatW(pGlobalData->UserLCID, 0, NULL,
510 pGlobalData->szLongDateFormat, OutBuffer,
514}
#define IDC_LONGDATESAMPLE_EDIT
Definition: resource.h:63
#define IDC_SHRTDATESAMPLE_EDIT
Definition: resource.h:59
INT WINAPI GetDateFormatW(LCID lcid, DWORD dwFlags, const SYSTEMTIME *lpTime, LPCWSTR lpFormat, LPWSTR lpDateStr, INT cchOut)
Definition: lcformat.c:993

Referenced by DatePageProc().

Variable Documentation

◆ hwndEnum

HWND hwndEnum = NULL
static

Definition at line 37 of file date.c.

Referenced by InitLongDateCB(), InitShortDateCB(), and ShortDateFormatEnumProc().