Author: ekohl
Date: Sun Sep 9 02:27:41 2007
New Revision: 28960
URL:
http://svn.reactos.org/svn/reactos?rev=28960&view=rev
Log:
- Add sorting page and show it if a language that supports multiple sorting methods has
been selected.
Added:
trunk/reactos/dll/cpl/intl/sort.c (with props)
Modified:
trunk/reactos/dll/cpl/intl/generalp.c
trunk/reactos/dll/cpl/intl/intl.c
trunk/reactos/dll/cpl/intl/intl.h
trunk/reactos/dll/cpl/intl/intl.rbuild
trunk/reactos/dll/cpl/intl/lang/de-DE.rc
trunk/reactos/dll/cpl/intl/lang/en-US.rc
trunk/reactos/dll/cpl/intl/lang/it-IT.rc
trunk/reactos/dll/cpl/intl/lang/ru-RU.rc
trunk/reactos/dll/cpl/intl/lang/uk-UA.rc
trunk/reactos/dll/cpl/intl/misc.c
trunk/reactos/dll/cpl/intl/resource.h
Modified: trunk/reactos/dll/cpl/intl/generalp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/intl/generalp.c?re…
==============================================================================
--- trunk/reactos/dll/cpl/intl/generalp.c (original)
+++ trunk/reactos/dll/cpl/intl/generalp.c Sun Sep 9 02:27:41 2007
@@ -367,7 +367,26 @@
break;
case IDC_SETUP_BUTTON:
- SetupApplet(hwndDlg, uMsg, wParam, lParam);
+ {
+ LCID NewLcid;
+ INT iCurSel;
+
+ iCurSel = SendMessage(hList,
+ CB_GETCURSEL,
+ 0,
+ 0);
+ if (iCurSel == CB_ERR)
+ break;
+
+ NewLcid = SendMessage(hList,
+ CB_GETITEMDATA,
+ iCurSel,
+ 0);
+ if (NewLcid == (LCID)CB_ERR)
+ break;
+
+ SetupApplet(NewLcid);
+ }
break;
}
break;
Modified: trunk/reactos/dll/cpl/intl/intl.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/intl/intl.c?rev=28…
==============================================================================
--- trunk/reactos/dll/cpl/intl/intl.c (original)
+++ trunk/reactos/dll/cpl/intl/intl.c Sun Sep 9 02:27:41 2007
@@ -52,7 +52,7 @@
};
-VOID
+static VOID
InitPropSheetPage(PROPSHEETPAGE *psp, WORD idDlg, DLGPROC DlgProc)
{
ZeroMemory(psp, sizeof(PROPSHEETPAGE));
Modified: trunk/reactos/dll/cpl/intl/intl.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/intl/intl.h?rev=28…
==============================================================================
--- trunk/reactos/dll/cpl/intl/intl.h (original)
+++ trunk/reactos/dll/cpl/intl/intl.h Sun Sep 9 02:27:41 2007
@@ -19,8 +19,6 @@
extern DWORD UnattendLCID;
/* intl.c */
-VOID
-InitPropSheetPage(PROPSHEETPAGE *psp, WORD idDlg, DLGPROC DlgProc);
/* languages.c */
INT_PTR CALLBACK
@@ -78,8 +76,15 @@
WPARAM wParam,
LPARAM lParam);
+/* sort.c */
+BOOL
+IsSortPageNeeded(LCID lcid);
-void SetNewLocale(LCID lcid);
+INT_PTR CALLBACK
+SortPageProc(HWND hwndDlg,
+ UINT uMsg,
+ WPARAM wParam,
+ LPARAM lParam);
/* misc.c */
LPTSTR
@@ -90,7 +95,7 @@
LONG
APIENTRY
-SetupApplet(HWND hwnd, UINT uMsg, LONG wParam, LONG lParam);
+SetupApplet(LCID lcid);
#endif /* __CPL_INTL_H */
Modified: trunk/reactos/dll/cpl/intl/intl.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/intl/intl.rbuild?r…
==============================================================================
--- trunk/reactos/dll/cpl/intl/intl.rbuild (original)
+++ trunk/reactos/dll/cpl/intl/intl.rbuild Sun Sep 9 02:27:41 2007
@@ -23,5 +23,6 @@
<file>misc.c</file>
<file>languages.c</file>
<file>advanced.c</file>
+ <file>sort.c</file>
<file>intl.rc</file>
</module>
Modified: trunk/reactos/dll/cpl/intl/lang/de-DE.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/intl/lang/de-DE.rc…
==============================================================================
--- trunk/reactos/dll/cpl/intl/lang/de-DE.rc (original)
+++ trunk/reactos/dll/cpl/intl/lang/de-DE.rc Sun Sep 9 02:27:41 2007
@@ -173,6 +173,19 @@
COMBOBOX IDC_LONGDATEFMT_COMBO, 77, 213, 153, 100, CBS_DROPDOWN | CBS_AUTOHSCROLL |
WS_VSCROLL | WS_TABSTOP | WS_VISIBLE
END
+
+IDD_SORTPAGE DIALOGEX 0, 0, 246, 234
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION
+CAPTION "Sortierung"
+FONT 8, "MS Shell Dlg"
+BEGIN
+ GROUPBOX "Sortierung", -1, 7, 7, 230, 74
+ LTEXT "Sorting methods define the sorting order of characters, words, files and
folders.", -1, 14, 17, 220, 25
+ LTEXT "Select a sorting method for your language:", -1, 14, 37, 220, 22
+ COMBOBOX IDC_SORTLIST_COMBO, 14, 56, 217, 83, CBS_DROPDOWNLIST | WS_CHILD |
WS_VISIBLE | WS_TABSTOP | WS_VSCROLL
+END
+
+
STRINGTABLE
BEGIN
IDS_CUSTOMIZE_TITLE "Regionale Einstellungen bearbeiten"
Modified: trunk/reactos/dll/cpl/intl/lang/en-US.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/intl/lang/en-US.rc…
==============================================================================
--- trunk/reactos/dll/cpl/intl/lang/en-US.rc (original)
+++ trunk/reactos/dll/cpl/intl/lang/en-US.rc Sun Sep 9 02:27:41 2007
@@ -176,6 +176,19 @@
COMBOBOX IDC_LONGDATEFMT_COMBO, 77, 213, 153, 100, CBS_DROPDOWN | CBS_AUTOHSCROLL |
WS_VSCROLL | WS_TABSTOP | WS_VISIBLE
END
+
+IDD_SORTPAGE DIALOGEX 0, 0, 246, 234
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION
+CAPTION "Sorting"
+FONT 8, "MS Shell Dlg"
+BEGIN
+ GROUPBOX "Sorting", -1, 7, 7, 230, 74
+ LTEXT "Sorting methods define the sorting order of characters, words, files and
folders.", -1, 14, 17, 220, 25
+ LTEXT "Select a sorting method for your language:", -1, 14, 37, 220, 22
+ COMBOBOX IDC_SORTLIST_COMBO, 14, 56, 217, 83, CBS_DROPDOWNLIST | WS_CHILD |
WS_VISIBLE | WS_TABSTOP | WS_VSCROLL
+END
+
+
STRINGTABLE
BEGIN
IDS_CUSTOMIZE_TITLE "Customize Regional Options"
Modified: trunk/reactos/dll/cpl/intl/lang/it-IT.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/intl/lang/it-IT.rc…
==============================================================================
--- trunk/reactos/dll/cpl/intl/lang/it-IT.rc (original)
+++ trunk/reactos/dll/cpl/intl/lang/it-IT.rc Sun Sep 9 02:27:41 2007
@@ -177,6 +177,19 @@
COMBOBOX IDC_LONGDATEFMT_COMBO, 77, 213, 153, 100, CBS_DROPDOWN | CBS_AUTOHSCROLL |
WS_VSCROLL | WS_TABSTOP | WS_VISIBLE
END
+
+IDD_SORTPAGE DIALOGEX 0, 0, 246, 234
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION
+CAPTION "Sorting"
+FONT 8, "MS Shell Dlg"
+BEGIN
+ GROUPBOX "Sorting", -1, 7, 7, 230, 74
+ LTEXT "Sorting methods define the sorting order of characters, words, files and
folders.", -1, 14, 17, 220, 25
+ LTEXT "Select a sorting method for your language:", -1, 14, 37, 220, 22
+ COMBOBOX IDC_SORTLIST_COMBO, 14, 56, 217, 83, CBS_DROPDOWNLIST | WS_CHILD |
WS_VISIBLE | WS_TABSTOP | WS_VSCROLL
+END
+
+
STRINGTABLE
BEGIN
IDS_CUSTOMIZE_TITLE "Opzioni internazionali e della lingua"
Modified: trunk/reactos/dll/cpl/intl/lang/ru-RU.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/intl/lang/ru-RU.rc…
==============================================================================
--- trunk/reactos/dll/cpl/intl/lang/ru-RU.rc (original)
+++ trunk/reactos/dll/cpl/intl/lang/ru-RU.rc Sun Sep 9 02:27:41 2007
@@ -176,6 +176,19 @@
COMBOBOX IDC_LONGDATEFMT_COMBO, 77, 213, 153, 100, CBS_DROPDOWN | CBS_AUTOHSCROLL |
WS_VSCROLL | WS_TABSTOP | WS_VISIBLE
END
+
+IDD_SORTPAGE DIALOGEX 0, 0, 246, 234
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION
+CAPTION "Sorting"
+FONT 8, "MS Shell Dlg"
+BEGIN
+ GROUPBOX "Sorting", -1, 7, 7, 230, 74
+ LTEXT "Sorting methods define the sorting order of characters, words, files and
folders.", -1, 14, 17, 220, 25
+ LTEXT "Select a sorting method for your language:", -1, 14, 37, 220, 22
+ COMBOBOX IDC_SORTLIST_COMBO, 14, 56, 217, 83, CBS_DROPDOWNLIST | WS_CHILD |
WS_VISIBLE | WS_TABSTOP | WS_VSCROLL
+END
+
+
STRINGTABLE
BEGIN
IDS_CUSTOMIZE_TITLE "Íàñòðîéêà ðåãèîíàëüíûõ ïàðàìåòðîâ"
Modified: trunk/reactos/dll/cpl/intl/lang/uk-UA.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/intl/lang/uk-UA.rc…
==============================================================================
--- trunk/reactos/dll/cpl/intl/lang/uk-UA.rc (original)
+++ trunk/reactos/dll/cpl/intl/lang/uk-UA.rc Sun Sep 9 02:27:41 2007
@@ -182,6 +182,19 @@
COMBOBOX IDC_LONGDATEFMT_COMBO, 77, 213, 153, 100, CBS_DROPDOWN | CBS_AUTOHSCROLL |
WS_VSCROLL | WS_TABSTOP | WS_VISIBLE
END
+
+IDD_SORTPAGE DIALOGEX 0, 0, 246, 234
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION
+CAPTION "Sorting"
+FONT 8, "MS Shell Dlg"
+BEGIN
+ GROUPBOX "Sorting", -1, 7, 7, 230, 74
+ LTEXT "Sorting methods define the sorting order of characters, words, files and
folders.", -1, 14, 17, 220, 25
+ LTEXT "Select a sorting method for your language:", -1, 14, 37, 220, 22
+ COMBOBOX IDC_SORTLIST_COMBO, 14, 56, 217, 83, CBS_DROPDOWNLIST | WS_CHILD |
WS_VISIBLE | WS_TABSTOP | WS_VSCROLL
+END
+
+
STRINGTABLE
BEGIN
IDS_CUSTOMIZE_TITLE "Íàñòðîéêà ðåã³îíàëüíèõ ïàðàìåòð³â"
Modified: trunk/reactos/dll/cpl/intl/misc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/intl/misc.c?rev=28…
==============================================================================
--- trunk/reactos/dll/cpl/intl/misc.c (original)
+++ trunk/reactos/dll/cpl/intl/misc.c Sun Sep 9 02:27:41 2007
@@ -173,19 +173,28 @@
return szDestStr;
}
+
+static VOID
+InitPropSheetPage(PROPSHEETPAGE *psp, WORD idDlg, DLGPROC DlgProc, LCID lcid)
+{
+ ZeroMemory(psp, sizeof(PROPSHEETPAGE));
+ psp->dwSize = sizeof(PROPSHEETPAGE);
+ psp->dwFlags = PSP_DEFAULT;
+ psp->hInstance = hApplet;
+ psp->pszTemplate = MAKEINTRESOURCE(idDlg);
+ psp->pfnDlgProc = DlgProc;
+ psp->lParam = (LPARAM)lcid;
+}
+
+
/* Create applets */
LONG
APIENTRY
-SetupApplet(HWND hwnd, UINT uMsg, LONG wParam, LONG lParam)
-{
- PROPSHEETPAGE PsPage[NUM_SHEETS];
+SetupApplet(LCID lcid)
+{
+ PROPSHEETPAGE PsPage[NUM_SHEETS + 1];
PROPSHEETHEADER psh;
TCHAR Caption[MAX_STR_SIZE];
-
- UNREFERENCED_PARAMETER(lParam);
- UNREFERENCED_PARAMETER(wParam);
- UNREFERENCED_PARAMETER(uMsg);
- UNREFERENCED_PARAMETER(hwnd);
LoadString(hApplet, IDS_CUSTOMIZE_TITLE, Caption, sizeof(Caption) / sizeof(TCHAR));
@@ -196,14 +205,20 @@
psh.hInstance = hApplet;
psh.hIcon = LoadIcon(hApplet, MAKEINTRESOURCE(IDC_CPLICON));
psh.pszCaption = Caption;
- psh.nPages = sizeof(PsPage) / sizeof(PROPSHEETPAGE);
+ psh.nPages = (sizeof(PsPage) / sizeof(PROPSHEETPAGE)) - 1;
psh.nStartPage = 0;
psh.ppsp = PsPage;
- InitPropSheetPage(&PsPage[0], IDD_NUMBERSPAGE, NumbersPageProc);
- InitPropSheetPage(&PsPage[1], IDD_CURRENCYPAGE, CurrencyPageProc);
- InitPropSheetPage(&PsPage[2], IDD_TIMEPAGE, TimePageProc);
- InitPropSheetPage(&PsPage[3], IDD_DATEPAGE, DatePageProc);
+ InitPropSheetPage(&PsPage[0], IDD_NUMBERSPAGE, NumbersPageProc, lcid);
+ InitPropSheetPage(&PsPage[1], IDD_CURRENCYPAGE, CurrencyPageProc, lcid);
+ InitPropSheetPage(&PsPage[2], IDD_TIMEPAGE, TimePageProc, lcid);
+ InitPropSheetPage(&PsPage[3], IDD_DATEPAGE, DatePageProc, lcid);
+
+ if (IsSortPageNeeded(lcid))
+ {
+ psh.nPages++;
+ InitPropSheetPage(&PsPage[4], IDD_SORTPAGE, SortPageProc, lcid);
+ }
return (LONG)(PropertySheet(&psh) != -1);
}
Modified: trunk/reactos/dll/cpl/intl/resource.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/intl/resource.h?re…
==============================================================================
--- trunk/reactos/dll/cpl/intl/resource.h (original)
+++ trunk/reactos/dll/cpl/intl/resource.h Sun Sep 9 02:27:41 2007
@@ -71,6 +71,9 @@
#define IDC_APPLY_CUR_USER_DEF_PROFILE 366
#define IDC_CONV_TABLES 367
+#define IDD_SORTPAGE 400
+#define IDC_SORTLIST_COMBO 401
+
#define IDS_CPLNAME 1000
#define IDS_CPLDESCRIPTION 1001
#define IDS_CUSTOMIZE_TITLE 1002
Added: trunk/reactos/dll/cpl/intl/sort.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/intl/sort.c?rev=28…
==============================================================================
--- trunk/reactos/dll/cpl/intl/sort.c (added)
+++ trunk/reactos/dll/cpl/intl/sort.c Sun Sep 9 02:27:41 2007
@@ -1,0 +1,217 @@
+/* $Id$
+ *
+ * PROJECT: ReactOS International Control Panel
+ * FILE: dll/cpl/intl/sort.c
+ * PURPOSE: Sorting property page
+ * PROGRAMMER: Eric Kohl
+ */
+
+#include <windows.h>
+#include <commctrl.h>
+#include <cpl.h>
+#include <tchar.h>
+
+#include "intl.h"
+#include "resource.h"
+
+static BOOL bSortPage = FALSE;
+static LCID userLcid;
+
+static HWND hWndSortList = NULL;
+
+
+static BOOL CALLBACK
+SortTestEnumProc(LPTSTR lpLocale)
+{
+ LCID lcid;
+
+ lcid = _tcstoul(lpLocale, NULL, 16);
+
+ if ((LANGIDFROMLCID(lcid) == LANGIDFROMLCID(userLcid)) &&
+ (SORTIDFROMLCID(lcid) != SORTIDFROMLCID(userLcid)))
+ bSortPage = TRUE;
+
+ return TRUE;
+}
+
+
+BOOL
+IsSortPageNeeded(LCID lcid)
+{
+ /* Handle special case for Spanish (Spain) */
+ if (lcid == MAKELCID(MAKELANGID(LANG_SPANISH, SUBLANG_SPANISH), SORT_DEFAULT) ||
+ lcid == MAKELCID(MAKELANGID(LANG_SPANISH, SUBLANG_SPANISH_MODERN),
SORT_DEFAULT))
+ return TRUE;
+
+ userLcid = lcid;
+ bSortPage = FALSE;
+
+ EnumSystemLocales(SortTestEnumProc, LCID_ALTERNATE_SORTS);
+
+ return bSortPage;
+}
+
+
+static BOOL CALLBACK
+SortEnumProc(LPTSTR lpLocale)
+{
+ LCID lcid;
+ TCHAR lang[255];
+ INT index;
+
+ lcid = _tcstoul(lpLocale, NULL, 16);
+
+ if ((LANGIDFROMLCID(lcid) == LANGIDFROMLCID(userLcid)) &&
+ (SORTIDFROMLCID(lcid) != SORTIDFROMLCID(userLcid)))
+ {
+ GetLocaleInfo(lcid, LOCALE_SSORTNAME, lang, sizeof(lang));
+
+ index = SendMessage(hWndSortList,
+ CB_ADDSTRING,
+ 0,
+ (LPARAM)lang);
+
+ SendMessage(hWndSortList,
+ CB_SETITEMDATA,
+ index,
+ (LPARAM)lcid);
+ }
+
+ return TRUE;
+}
+
+static VOID
+CreateSortList(HWND hwnd, LCID lcid)
+{
+ TCHAR lang[255];
+ INT index;
+
+ hWndSortList = hwnd;
+
+ /* Handle special case for Spainish (Spain) */
+ if (lcid == MAKELCID(MAKELANGID(LANG_SPANISH, SUBLANG_SPANISH), SORT_DEFAULT) ||
+ lcid == MAKELCID(MAKELANGID(LANG_SPANISH, SUBLANG_SPANISH_MODERN),
SORT_DEFAULT))
+ {
+ /* Add traditional sorting */
+ GetLocaleInfo(MAKELANGID(LANG_SPANISH, SUBLANG_SPANISH),
+ LOCALE_SSORTNAME, lang, sizeof(lang));
+
+ index = SendMessage(hwnd,
+ CB_ADDSTRING,
+ 0,
+ (LPARAM)lang);
+
+ SendMessage(hwnd,
+ CB_SETITEMDATA,
+ index,
+ (LPARAM)MAKELANGID(LANG_SPANISH, SUBLANG_SPANISH));
+
+ /* Add modern sorting */
+ GetLocaleInfo(MAKELANGID(LANG_SPANISH, SUBLANG_SPANISH_MODERN),
+ LOCALE_SSORTNAME, lang, sizeof(lang));
+
+ index = SendMessage(hwnd,
+ CB_ADDSTRING,
+ 0,
+ (LPARAM)lang);
+
+ SendMessage(hwnd,
+ CB_SETITEMDATA,
+ index,
+ (LPARAM)MAKELANGID(LANG_SPANISH, SUBLANG_SPANISH_MODERN));
+ }
+ else
+ {
+ userLcid = lcid;
+
+ GetLocaleInfo(lcid & 0xFFFF, LOCALE_SSORTNAME, lang, sizeof(lang));
+
+ index = SendMessage(hWndSortList,
+ CB_ADDSTRING,
+ 0,
+ (LPARAM)lang);
+
+ SendMessage(hWndSortList,
+ CB_SETITEMDATA,
+ index,
+ (LPARAM)lcid & 0xFFFF);
+
+ EnumSystemLocales(SortEnumProc, LCID_ALTERNATE_SORTS);
+ }
+
+ /* Select current locale */
+ /* or should it be System and not user? */
+ GetLocaleInfo(lcid, LOCALE_SSORTNAME, lang, sizeof(lang));
+
+ SendMessage(hwnd,
+ CB_SELECTSTRING,
+ -1,
+ (LPARAM)lang);
+}
+
+/* Property page dialog callback */
+INT_PTR CALLBACK
+SortPageProc(HWND hwndDlg,
+ UINT uMsg,
+ WPARAM wParam,
+ LPARAM lParam)
+{
+ switch (uMsg)
+ {
+ case WM_INITDIALOG:
+ {
+ LCID lcid = (LCID)((LPPROPSHEETPAGE)lParam)->lParam;
+
+ CreateSortList(GetDlgItem(hwndDlg, IDC_SORTLIST_COMBO), lcid);
+ }
+ break;
+
+ case WM_COMMAND:
+ switch (LOWORD(wParam))
+ {
+ case IDC_SORTLIST_COMBO:
+ if (HIWORD(wParam) == CBN_SELCHANGE)
+ {
+ PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
+ }
+ break;
+ }
+ break;
+
+ case WM_NOTIFY:
+ {
+ LPNMHDR lpnm = (LPNMHDR)lParam;
+
+ if (lpnm->code == (UINT)PSN_APPLY)
+ {
+
+ LCID NewLcid;
+ INT iCurSel;
+
+ iCurSel = SendDlgItemMessage(hwndDlg,
+ IDC_SORTLIST_COMBO,
+ CB_GETCURSEL,
+ 0,
+ 0);
+ if (iCurSel == CB_ERR)
+ break;
+
+ NewLcid = SendDlgItemMessage(hwndDlg,
+ IDC_SORTLIST_COMBO,
+ CB_GETITEMDATA,
+ iCurSel,
+ 0);
+ if (NewLcid == (LCID)CB_ERR)
+ break;
+#if 0
+ /* FIXME: Set locale ID */
+#endif
+ }
+ }
+ break;
+ }
+
+ return FALSE;
+}
+
+/* EOF */
Propchange: trunk/reactos/dll/cpl/intl/sort.c
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: trunk/reactos/dll/cpl/intl/sort.c
------------------------------------------------------------------------------
svn:keywords = author date id revision