From: Klemens Friedl Date: Sat, 12 Mar 2005 19:46:27 +0000 (+0000) Subject: * add combobox (select language/region) X-Git-Tag: Wine-20050310-sync^2~118 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=b21f552e3ba619311aea63235bc74b777927fbf7;hp=fd962e2f04fa7ff1839c6f31a545464199016748 * add combobox (select language/region) * german & english resource files svn path=/trunk/; revision=13976 --- diff --git a/reactos/lib/cpl/intl/de.rc b/reactos/lib/cpl/intl/de.rc new file mode 100644 index 00000000000..5168f02f154 --- /dev/null +++ b/reactos/lib/cpl/intl/de.rc @@ -0,0 +1,66 @@ +/* $Id: intl.rc 12852 2005-01-06 13:58:04Z mf $ */ + +LANGUAGE LANG_GERMAN, SUBLANG_DEFAULT + +IDD_GENERALPAGE DIALOGEX 0, 0, 246, 228 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Allgemein" +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "Property Page 1",-1,73,74,90,8 +END + + +IDD_NUMBERSPAGE DIALOGEX 0, 0, 246, 228 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Zahlen" +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "Property Page 2",-1,73,74,90,8 +END + + +IDD_CURRENCYPAGE DIALOGEX 0, 0, 246, 228 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Währung" +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "Property Page 3",-1,73,74,90,8 +END + + +IDD_TIMEPAGE DIALOGEX 0, 0, 246, 228 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Uhrzeit" +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "Property Page 4",-1,73,74,90,8 +END + + +IDD_DATEPAGE DIALOGEX 0, 0, 246, 228 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Datum" +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "Property Page 5",-1,73,74,90,8 +END + + +IDD_LOCALEPAGE DIALOGEX 0, 0, 246, 228 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Regionale Einstellungen" +FONT 8, "MS Shell Dlg" +BEGIN + GROUPBOX "Standardsprache", -1, 8, 11, 228, 74 + ICON IDC_FLAGS, IDC_ICON1, 12, 26, 21, 20, SS_ICON + LTEXT "Wählen Sie eine Sprache und Region aus welche Sie benutzen wollen:", -1, 38, 25, 193, 22 + COMBOBOX IDC_LANGUAGELIST, 39, 49, 191, 83, CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_TABSTOP +END + + +STRINGTABLE +BEGIN + IDS_CPLNAME "Regionale Einstellungen" + IDS_CPLDESCRIPTION "Wählen Sie Anzeigeeinstellungen für Sprache, Zahlen, Währung, Uhrzeit und Datum aus." +END diff --git a/reactos/lib/cpl/intl/en.rc b/reactos/lib/cpl/intl/en.rc new file mode 100644 index 00000000000..fd579b63ab3 --- /dev/null +++ b/reactos/lib/cpl/intl/en.rc @@ -0,0 +1,66 @@ +/* $Id: intl.rc 12852 2005-01-06 13:58:04Z mf $ */ + +LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT + +IDD_GENERALPAGE DIALOGEX 0, 0, 246, 228 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "General" +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "Property Page 1",-1,73,74,90,8 +END + + +IDD_NUMBERSPAGE DIALOGEX 0, 0, 246, 228 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Numbers" +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "Property Page 2",-1,73,74,90,8 +END + + +IDD_CURRENCYPAGE DIALOGEX 0, 0, 246, 228 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Currency" +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "Property Page 3",-1,73,74,90,8 +END + + +IDD_TIMEPAGE DIALOGEX 0, 0, 246, 228 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Time" +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "Property Page 4",-1,73,74,90,8 +END + + +IDD_DATEPAGE DIALOGEX 0, 0, 246, 228 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Date" +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "Property Page 5",-1,73,74,90,8 +END + + +IDD_LOCALEPAGE DIALOGEX 0, 0, 246, 228 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Input Locale" +FONT 8, "MS Shell Dlg" +BEGIN + GROUPBOX "Primary language", -1, 8, 11, 228, 74 + ICON IDC_FLAGS, IDC_ICON1, 12, 26, 21, 20, SS_ICON + LTEXT "Select the primary language and region you want to use:", -1, 38, 25, 193, 22 + COMBOBOX IDC_LANGUAGELIST, 39, 49, 191, 83, CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_TABSTOP +END + + +STRINGTABLE +BEGIN + IDS_CPLNAME "Regional Options" + IDS_CPLDESCRIPTION "Select languages and format numbers, currencies, times and date." +END diff --git a/reactos/lib/cpl/intl/intl.rc b/reactos/lib/cpl/intl/intl.rc index abd11734969..6fe063b6395 100644 --- a/reactos/lib/cpl/intl/intl.rc +++ b/reactos/lib/cpl/intl/intl.rc @@ -11,66 +11,16 @@ IDC_CPLICON ICON "resources/applet.ico" +IDC_FLAGS ICON "resources/flags.ico" -LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT -IDD_GENERALPAGE DIALOGEX 0, 0, 246, 228 -STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "General" -FONT 8, "MS Shell Dlg" -BEGIN - LTEXT "Property Page 1",-1,73,74,90,8 -END +/* + * Everything specific to any language goes in one of the specific + * files. Note that you can and may override resources which also have + * a neutral version. This is to get localized bitmaps for example. + */ +#include "en.rc" +#include "de.rc" -IDD_NUMBERSPAGE DIALOGEX 0, 0, 246, 228 -STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Numbers" -FONT 8, "MS Shell Dlg" -BEGIN - LTEXT "Property Page 2",-1,73,74,90,8 -END - - -IDD_CURRENCYPAGE DIALOGEX 0, 0, 246, 228 -STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Currency" -FONT 8, "MS Shell Dlg" -BEGIN - LTEXT "Property Page 3",-1,73,74,90,8 -END - - -IDD_TIMEPAGE DIALOGEX 0, 0, 246, 228 -STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Time" -FONT 8, "MS Shell Dlg" -BEGIN - LTEXT "Property Page 4",-1,73,74,90,8 -END - - -IDD_DATEPAGE DIALOGEX 0, 0, 246, 228 -STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Date" -FONT 8, "MS Shell Dlg" -BEGIN - LTEXT "Property Page 5",-1,73,74,90,8 -END - - -IDD_LOCALEPAGE DIALOGEX 0, 0, 246, 228 -STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Input Locale" -FONT 8, "MS Shell Dlg" -BEGIN - LTEXT "Property Page 6",-1,73,74,90,8 -END - - -STRINGTABLE -BEGIN - IDS_CPLNAME "Regional Options" - IDS_CPLDESCRIPTION "Select languages and format numbers, currencies, times and date." -END diff --git a/reactos/lib/cpl/intl/locale.c b/reactos/lib/cpl/intl/locale.c index a37b9eac401..86eecea69bb 100644 --- a/reactos/lib/cpl/intl/locale.c +++ b/reactos/lib/cpl/intl/locale.c @@ -1,6 +1,6 @@ /* * ReactOS - * Copyright (C) 2004 ReactOS Team + * Copyright (C) 2004, 2005 ReactOS Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -22,6 +22,7 @@ * FILE: lib/cpl/intl/locale.c * PURPOSE: Locale property page * PROGRAMMER: Eric Kohl + * Klemens Friedl */ #include @@ -32,6 +33,258 @@ #include "resource.h" +// FIXME: +// * change registry function (-> "HKCR\MIME\Database\Rfc1766") + + + +typedef struct _TZ_INFO +{ + LONG Bias; + LONG StandardBias; + LONG DaylightBias; + SYSTEMTIME StandardDate; + SYSTEMTIME DaylightDate; +} TZ_INFO, *PTZ_INFO; + +typedef struct _TIMEZONE_ENTRY +{ + struct _TIMEZONE_ENTRY *Prev; + struct _TIMEZONE_ENTRY *Next; + WCHAR Description[64]; /* 'Display' */ + WCHAR StandardName[32]; /* 'Std' */ + WCHAR DaylightName[32]; /* 'Dlt' */ + TZ_INFO TimezoneInfo; /* 'TZI' */ + ULONG Index; /* 'Index' */ +} TIMEZONE_ENTRY, *PTIMEZONE_ENTRY; + + + +PTIMEZONE_ENTRY TimeZoneListHead = NULL; +PTIMEZONE_ENTRY TimeZoneListTail = NULL; + + + + +static PTIMEZONE_ENTRY +GetLargerTimeZoneEntry(DWORD Index) +{ + PTIMEZONE_ENTRY Entry; + + Entry = TimeZoneListHead; + while (Entry != NULL) + { + if (Entry->Index >= Index) + return Entry; + + Entry = Entry->Next; + } + + return NULL; +} + + +static VOID +CreateTimeZoneList(VOID) +{ + + WCHAR szKeyName[256]; + DWORD dwIndex; + DWORD dwNameSize; + DWORD dwValueSize; + LONG lError; + HKEY hZonesKey; + HKEY hZoneKey; + + PTIMEZONE_ENTRY Entry; + PTIMEZONE_ENTRY Current; + + + + if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, + L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Time Zones", + 0, + KEY_ALL_ACCESS, + &hZonesKey)) + return; + + dwIndex = 0; + while (TRUE) + { + dwNameSize = 256; + lError = RegEnumKeyExW(hZonesKey, + dwIndex, + szKeyName, + &dwNameSize, + NULL, + NULL, + NULL, + NULL); + if (lError != ERROR_SUCCESS && lError != ERROR_MORE_DATA) + break; + + + if (RegOpenKeyExW(hZonesKey, + szKeyName, + 0, + KEY_ALL_ACCESS, + &hZoneKey)) + break; + + + Entry = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(TIMEZONE_ENTRY)); + if (Entry == NULL) + { + RegCloseKey(hZonesKey); + break; + } + + dwValueSize = 64 * sizeof(WCHAR); + if (RegQueryValueExW(hZonesKey, + L"Display", + NULL, + NULL, + (LPBYTE)&Entry->Description, + &dwValueSize)) + { + RegCloseKey(hZonesKey); + break; + } + + dwValueSize = 32 * sizeof(WCHAR); + if (RegQueryValueExW(hZonesKey, + L"Std", + NULL, + NULL, + (LPBYTE)&Entry->StandardName, + &dwValueSize)) + { + RegCloseKey(hZonesKey); + break; + } + + dwValueSize = 32 * sizeof(WCHAR); + if (RegQueryValueExW(hZonesKey, + L"Dlt", + NULL, + NULL, + (LPBYTE)&Entry->DaylightName, + &dwValueSize)) + { + RegCloseKey(hZonesKey); + break; + } + + dwValueSize = sizeof(DWORD); + if (RegQueryValueExW(hZonesKey, + L"Index", + NULL, + NULL, + (LPBYTE)&Entry->Index, + &dwValueSize)) + { + RegCloseKey(hZonesKey); + break; + } + + dwValueSize = sizeof(TZ_INFO); + if (RegQueryValueExW(hZonesKey, + L"TZI", + NULL, + NULL, + (LPBYTE)&Entry->TimezoneInfo, + &dwValueSize)) + { + RegCloseKey(hZonesKey); + break; + } + + RegCloseKey(hZoneKey); + + if (TimeZoneListHead == NULL && + TimeZoneListTail == NULL) + { + Entry->Prev = NULL; + Entry->Next = NULL; + TimeZoneListHead = Entry; + TimeZoneListTail = Entry; + } + else + { + Current = GetLargerTimeZoneEntry(Entry->Index); + if (Current != NULL) + { + if (Current == TimeZoneListHead) + { + /* Prepend to head */ + Entry->Prev = NULL; + Entry->Next = TimeZoneListHead; + TimeZoneListHead->Prev = Entry; + TimeZoneListHead = Entry; + } + else + { + /* Insert before current */ + Entry->Prev = Current->Prev; + Entry->Next = Current; + Current->Prev->Next = Entry; + Current->Prev = Entry; + } + } + else + { + /* Append to tail */ + Entry->Prev = TimeZoneListTail; + Entry->Next = NULL; + TimeZoneListTail->Next = Entry; + TimeZoneListTail = Entry; + } + } + + dwIndex++; + } + + RegCloseKey(hZonesKey); + +} + + +static VOID +ShowTimeZoneList(HWND hwnd) +{ + TIME_ZONE_INFORMATION TimeZoneInfo; + PTIMEZONE_ENTRY Entry; + DWORD dwIndex; + DWORD i; + + GetTimeZoneInformation(&TimeZoneInfo); + + dwIndex = 0; + i = 0; + Entry = TimeZoneListHead; + while (Entry != NULL) + { + SendMessageW(hwnd, + CB_ADDSTRING, + 0, + (LPARAM)Entry->Description); + + if (!wcscmp(Entry->StandardName, TimeZoneInfo.StandardName)) + dwIndex = i; + + i++; + Entry = Entry->Next; + } + + SendMessageW(hwnd, + CB_SETCURSEL, + (WPARAM)dwIndex, + 0); +} + + + + /* Property page dialog callback */ INT_PTR CALLBACK LocalePageProc(HWND hwndDlg, @@ -42,9 +295,14 @@ LocalePageProc(HWND hwndDlg, switch(uMsg) { case WM_INITDIALOG: + + CreateTimeZoneList(); + ShowTimeZoneList(GetDlgItem(hwndDlg, IDC_LANGUAGELIST)); + break; } return FALSE; } + /* EOF */