Author: fireball
Date: Wed Jul 19 12:45:21 2006
New Revision: 23171
URL:
http://svn.reactos.org/svn/reactos?rev=23171&view=rev
Log:
Alexey Minnekhanov (minlexx(a)rambler.ru):
- Implement setting of desktop background color. This feature is tested to work in Windows
XP, however in ReactOS the setting currently does no effect.
- Improve russian translation, also check and fix layout/placement (so that russian words
actually fit)
Modified:
trunk/reactos/dll/cpl/desk/Ru.rc
trunk/reactos/dll/cpl/desk/background.c
Modified: trunk/reactos/dll/cpl/desk/Ru.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/desk/Ru.rc?rev=231…
==============================================================================
--- trunk/reactos/dll/cpl/desk/Ru.rc (original)
+++ trunk/reactos/dll/cpl/desk/Ru.rc Wed Jul 19 12:45:21 2006
@@ -1,120 +1,142 @@
LANGUAGE LANG_RUSSIAN, SUBLANG_NEUTRAL
-IDD_BACKGROUND DIALOGEX DISCARDABLE 0, 0, 246, 188
-STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION
+IDD_BACKGROUND DIALOGEX 0, 0, 246, 188
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION
CAPTION "Ôîí"
-FONT 8, "MS Shell Dlg"
+FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
- CONTROL "",IDC_BACKGROUND_PREVIEW,"Static",SS_OWNERDRAW,
80, 10,
- 83, 57, WS_EX_STATICEDGE
- CONTROL "",IDC_BACKGROUND_LIST,"SysListView32",
LVS_REPORT |
- LVS_SINGLESEL | LVS_NOCOLUMNHEADER | LVS_SHAREIMAGELISTS |
- WS_BORDER | WS_TABSTOP, 8, 114, 174, 68
- LTEXT "Âûáåðèòå èçîáðàæåíèå äëÿ ðàáî÷åãî ñòîëà:",
- IDC_STATIC, 8, 103, 180, 9
- PUSHBUTTON "&Îáçîð...", IDC_BROWSE_BUTTON, 188, 114, 50, 15
- PUSHBUTTON "&Öâåò...", IDC_COLOR_BUTTON, 188, 167, 50, 15
- LTEXT "Ðàñïîëîæåíèå:", IDC_STATIC, 188, 138, 50, 9
- COMBOBOX IDC_PLACEMENT_COMBO, 188, 149, 50, 54, CBS_DROPDOWNLIST |
+ CONTROL
"",IDC_BACKGROUND_PREVIEW,"Static",SS_OWNERDRAW,80,10,83,
+ 57,WS_EX_STATICEDGE
+ CONTROL "",IDC_BACKGROUND_LIST,"SysListView32",LVS_REPORT
|
+ LVS_SINGLESEL | LVS_SHAREIMAGELISTS | LVS_NOCOLUMNHEADER |
+ WS_BORDER | WS_TABSTOP,8,114,174,68
+ LTEXT "Âûáåðèòå èçîáðàæåíèå äëÿ ðàáî÷åãî ñòîëà:",IDC_STATIC,8,
+ 103,180,9
+ PUSHBUTTON "&Îáçîð...",IDC_BROWSE_BUTTON,188,114,55,15
+ PUSHBUTTON "&Öâåò...",IDC_COLOR_BUTTON,188,167,55,15
+ LTEXT "Ðàñïîëîæåíèå:",IDC_STATIC,188,138,55,9
+ COMBOBOX IDC_PLACEMENT_COMBO,188,149,55,54,CBS_DROPDOWNLIST |
CBS_SORT | WS_VSCROLL | WS_TABSTOP
END
-IDD_SCREENSAVER DIALOGEX DISCARDABLE 0, 0, 246, 188
-STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION
+IDD_SCREENSAVER DIALOGEX 0, 0, 246, 188
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION
CAPTION "Çàñòàâêà"
-FONT 8, "MS Shell Dlg"
+FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
- GROUPBOX "&Çàñòàâêà",IDC_SCREENS_DUMMY, 5, 7, 238, 137
-
- LTEXT "Ñïèñîê çàñòàâîê:",IDC_STATIC,13, 24, 150, 9
+ GROUPBOX "&Çàñòàâêà",IDC_SCREENS_DUMMY,5,7,238,137
+ LTEXT "Ñïèñîê çàñòàâîê:",IDC_STATIC,13,24,150,9
CONTROL "",IDC_SCREENS_CHOICES,"SysListView32",LVS_REPORT
|
- LVS_SINGLESEL | LVS_NOCOLUMNHEADER | LVS_SHAREIMAGELISTS |
- WS_BORDER | WS_TABSTOP,13, 34, 170, 69
-
- PUSHBUTTON "&Íàñòðîéêà...",IDC_SCREENS_SETTINGS,188, 34, 50,
15,WS_GROUP
- PUSHBUTTON "Ïðî&ñìîòð",IDC_SCREENS_TESTSC,188, 52, 50, 15
-
- CONTROL "&Çàùèòà
ïàðîëåì.",IDC_SCREENS_USEPASSCHK,"button",
- BS_AUTOCHECKBOX | WS_TABSTOP, 13, 121, 119, 18
-
- LTEXT "&Èíòåðâàë:",IDC_STATIC, 13, 110, 20, 9
- EDITTEXT IDC_SCREENS_TIMEDELAY, 33, 109, 31, 12,ES_RIGHT | WS_GROUP
- CONTROL "",IDC_SCREENS_TIME ,UPDOWN_CLASS,UDS_SETBUDDYINT |
- UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS |
- WS_BORDER | WS_GROUP, 52, 109, 12, 12
- LTEXT "ìèíóò äî îòîáðàæåíèÿ çàñòàâêè.",IDC_STATIC, 70, 111, 147,
9
-
- GROUPBOX "&Ýíåðãîñáåðåãàþùèå ôóíêöèè
ìîíèòîðà",IDC_SCREENS_DUMMY2, 5, 146, 238, 50
+ LVS_SINGLESEL | LVS_SHAREIMAGELISTS | LVS_NOCOLUMNHEADER |
+ WS_BORDER | WS_TABSTOP,13,34,170,69
+ PUSHBUTTON "&Íàñòðîéêà...",IDC_SCREENS_SETTINGS,188,34,50,15,
+ WS_GROUP
+ PUSHBUTTON "Ïðî&ñìîòð",IDC_SCREENS_TESTSC,188,52,50,15
+ CONTROL "&Çàùèòà
ïàðîëåì.",IDC_SCREENS_USEPASSCHK,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,13,121,119,18
+ LTEXT "&Èíòåðâàë:",IDC_STATIC,13,110,35,9
+ EDITTEXT IDC_SCREENS_TIMEDELAY,53,109,31,12,ES_RIGHT | WS_GROUP
+ CONTROL
"",IDC_SCREENS_TIME,"msctls_updown32",UDS_SETBUDDYINT |
+ UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS |
+ WS_BORDER | WS_GROUP,87,108,13,12
+ LTEXT "ìèíóò äî îòîáðàæåíèÿ çàñòàâêè.",IDC_STATIC,109,110,118,
+ 9
+ GROUPBOX "&Ýíåðãîñáåðåãàþùèå ôóíêöèè
ìîíèòîðà",IDC_SCREENS_DUMMY2,
+ 5,146,238,50
LTEXT "Äëÿ èçìåíåíèÿ ïàðàìåòðîâ ïèòàíèÿ ìîíèòîðà íàæìèòå êíîïêó
Ïàðàìåòðû Ïèòàíèÿ.",
- IDC_STATIC, 16, 159, 145, 35
- PUSHBUTTON "Ïàðàìåòðû &Ïèòàíèÿ",IDC_SCREENS_POWER_BUTTON, 165,
162, 73, 15
+ IDC_STATIC,16,159,145,35
+ PUSHBUTTON "Ïàðàìåòðû
&ïèòàíèÿ",IDC_SCREENS_POWER_BUTTON,157,162,81,
+ 15
END
-IDD_APPEARANCE DIALOGEX DISCARDABLE 0, 0, 246, 188
-STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION
+IDD_APPEARANCE DIALOGEX 0, 0, 246, 188
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION
CAPTION "Îôîðìëåíèå"
-FONT 8, "MS Shell Dlg"
+FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
- LTEXT "Íàñòðîéêè âðåìåííî îòñóòñâóþò",IDC_STATIC,66,
- 90,112,8
+ LTEXT "Íàñòðîéêè âðåìåííî îòñóòñâóþò",IDC_STATIC,65,87,114,8
END
-IDD_SETTINGS DIALOGEX DISCARDABLE 0, 0, 246, 188
-STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION
+IDD_SETTINGS DIALOGEX 0, 0, 246, 188
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION
CAPTION "Íàñòðîéêè"
-FONT 8, "MS Shell Dlg"
+FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
LTEXT "&Äèñïëåé:",1820,3,100,30,8
LTEXT "<íåò>",IDC_SETTINGS_DEVICE,9,109,224,8
GROUPBOX "&Îáëàñòü ýêðàíà",1818,3,120,119,43
- CONTROL
"",IDC_SETTINGS_RESOLUTION,"msctls_trackbar32",TBS_AUTOTICKS |
WS_TABSTOP,
- 33,130,58,17
+ CONTROL "",IDC_SETTINGS_RESOLUTION,"msctls_trackbar32",
+ TBS_AUTOTICKS | WS_TABSTOP,33,130,58,17
LTEXT "Ìåíüøå",1815,7,130,27,8,NOT WS_GROUP
LTEXT "Áîëüøå",1816,91,130,27,8,NOT WS_GROUP
- LTEXT "",IDC_SETTINGS_RESOLUTION_TEXT,10,150,100,10,NOT WS_GROUP
| SS_CENTER
+ CTEXT "",IDC_SETTINGS_RESOLUTION_TEXT,10,150,100,10,NOT
+ WS_GROUP
GROUPBOX "&Öâåòà",1817,125,120,115,43
- COMBOBOX IDC_SETTINGS_BPP,133,130,103,80,CBS_DROPDOWNLIST | CBS_AUTOHSCROLL |
- WS_VSCROLL | WS_TABSTOP
+ COMBOBOX IDC_SETTINGS_BPP,133,130,103,80,CBS_DROPDOWNLIST |
+ CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
CONTROL "",1813,"Static",SS_BITMAP | SS_CENTERIMAGE |
SS_SUNKEN,
131,148,103,9
PUSHBUTTON
"Äî&ïîëíèòåëüíî...",IDC_SETTINGS_ADVANCED,306,165,56,14
END
-IDR_POPUP_MENU MENU DISCARDABLE
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Menu
+//
+
+IDR_POPUP_MENU MENU
BEGIN
- POPUP ""
- BEGIN
- MENUITEM "&Configure", ID_MENU_CONFIG
- MENUITEM "&Preview", ID_MENU_PREVIEW
- MENUITEM SEPARATOR
- MENUITEM "&Add", ID_MENU_ADD
- MENUITEM "&Delete\tDel", ID_MENU_DELETE
- END
+ POPUP ""
+ BEGIN
+ MENUITEM "&Íàñòðîèòü", ID_MENU_CONFIG
+ MENUITEM "&Ïðåäïðîñìîòð", ID_MENU_PREVIEW
+ MENUITEM SEPARATOR
+ MENUITEM "&Äîáàâèòü", ID_MENU_ADD
+ MENUITEM "&Óäàëèòü\tDel", ID_MENU_DELETE
+ END
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// String Table
+//
+
+STRINGTABLE
+BEGIN
+ IDS_CPLNAME "Äèñïëåé"
+ IDS_CPLDESCRIPTION "Âûáåðèòå äèñïëåé ðàáî÷åãî ñòîëà è çàñòàâêó."
+ IDS_NONE "(íåò)"
+ IDS_CENTER "Ïî öåíòðó"
+ IDS_STRETCH "Ðàñòÿíóòü"
+ IDS_TILE "Ïîâòîðÿòü"
END
STRINGTABLE
BEGIN
- IDS_CPLNAME "Äèñïëåé"
- IDS_CPLDESCRIPTION "Âûáåðèòå äèñïëåé ðàáî÷åãî ñòîëà è çàñòàâêó."
-
- IDS_NONE "(íåò)"
- IDS_CENTER "Ïî öåíòðó"
- IDS_STRETCH "Ðàñòÿíóòü"
- IDS_TILE "Ïîâòîðÿòü"
+ IDS_COLOR_4BIT "16 öâåòîâ"
+ IDS_COLOR_8BIT "256 öâåòîâ"
END
-STRINGTABLE DISCARDABLE
+STRINGTABLE
BEGIN
- IDS_COLOR_4BIT "16 öâåòîâ"
- IDS_COLOR_8BIT "256 öâåòîâ"
- IDS_COLOR_16BIT "High Color (16 áèò)"
- IDS_COLOR_24BIT "True Color (24 áèòà)"
- IDS_COLOR_32BIT "True Color (32 áèòà)"
- IDS_PIXEL "%lux%lu òî÷åê"
+ IDS_COLOR_16BIT "High Color (16 áèò)"
+ IDS_COLOR_24BIT "True Color (24 áèòà)"
END
-STRINGTABLE DISCARDABLE
+STRINGTABLE
BEGIN
- IDS_BACKGROUND_COMDLG_FILTER "Êàðòèíêè (*.bmp;*.dib)\0*.bmp;*.dib\0"
- IDS_SUPPORTED_EXT "*.bmp;*.dib"
+ IDS_COLOR_32BIT "True Color (32 áèòà)"
END
+
+STRINGTABLE
+BEGIN
+ IDS_PIXEL "%lux%lu òî÷åê"
+END
+
+STRINGTABLE
+BEGIN
+ IDS_BACKGROUND_COMDLG_FILTER "Êàðòèíêè (*.bmp;*.dib)\000*.bmp;*.dib"
+ IDS_SUPPORTED_EXT "*.bmp;*.dib"
+END
Modified: trunk/reactos/dll/cpl/desk/background.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/desk/background.c?…
==============================================================================
--- trunk/reactos/dll/cpl/desk/background.c (original)
+++ trunk/reactos/dll/cpl/desk/background.c Wed Jul 19 12:45:21 2006
@@ -6,6 +6,7 @@
* PURPOSE: Background property page
*
* PROGRAMMERS: Trevor McCort (lycan359(a)gmail.com)
+ * Alexey Minnekhanov (minlexx(a)rambler.ru)
*/
#include "desk.h"
@@ -31,6 +32,7 @@
int g_placementSelection = 0;
int g_backgroundSelection = 0;
+COLORREF g_backgroundDesktopColor = 0;
int g_listViewItemCount = 0;
@@ -52,7 +54,7 @@
WIN32_FIND_DATA fd;
HANDLE hFind;
TCHAR szSearchPath[MAX_PATH];
- TCHAR szFileTypes[MAX_PATH];
+ TCHAR szFileTypes[MAX_PATH];
LV_ITEM listItem;
LV_COLUMN dummy;
RECT clientRect;
@@ -65,8 +67,8 @@
LONG result;
UINT i = 0;
BackgroundItem *backgroundItem = NULL;
- TCHAR separators[] = TEXT(";");
- TCHAR *token;
+ TCHAR separators[] = TEXT(";");
+ TCHAR *token;
GetClientRect(g_hBackgroundList, &clientRect);
@@ -76,13 +78,10 @@
dummy.cx = (clientRect.right - clientRect.left) -
GetSystemMetrics(SM_CXVSCROLL);
(void)ListView_InsertColumn(g_hBackgroundList, 0, &dummy);
-
+
/* Add the "None" item */
-
- backgroundItem = &g_backgroundItems[g_listViewItemCount];
-
+ backgroundItem = &g_backgroundItems[g_listViewItemCount];
backgroundItem->bWallpaper = FALSE;
-
LoadString(hApplet,
IDS_NONE,
backgroundItem->szDisplayName,
@@ -102,9 +101,7 @@
g_listViewItemCount++;
/* Add current wallpaper if any */
-
RegOpenKeyEx(HKEY_CURRENT_USER, TEXT("Control Panel\\Desktop"), 0,
KEY_ALL_ACCESS, ®Key);
-
result = RegQueryValueEx(regKey, TEXT("Wallpaper"), 0, &varType,
(LPBYTE)wallpaperFilename, &bufferSize);
if((result == ERROR_SUCCESS) && (_tcslen(wallpaperFilename) > 0))
@@ -231,7 +228,9 @@
LONG result;
BITMAP bitmap;
- g_hBackgroundList = GetDlgItem(g_hBackgroundPage, IDC_BACKGROUND_LIST);
+ g_backgroundDesktopColor = GetSysColor( COLOR_BACKGROUND );
+
+ g_hBackgroundList = GetDlgItem(g_hBackgroundPage, IDC_BACKGROUND_LIST);
g_hBackgroundPreview = GetDlgItem(g_hBackgroundPage, IDC_BACKGROUND_PREVIEW);
g_hPlacementCombo = GetDlgItem(g_hBackgroundPage, IDC_PLACEMENT_COMBO);
g_hColorButton = GetDlgItem(g_hBackgroundPage, IDC_COLOR_BUTTON);
@@ -297,7 +296,30 @@
void OnColorButton()
{
- MessageBox(NULL, TEXT("That button doesn't do anything yet"),
TEXT("Whoops"), MB_OK);
+ CHOOSECOLOR cc;
+ COLORREF custom_colors[16];
+
+ cc.lStructSize = sizeof(CHOOSECOLOR);
+ cc.hwndOwner = g_hBackgroundPage;
+ cc.hInstance = NULL;
+ cc.rgbResult = g_backgroundDesktopColor;
+
+ memset(custom_colors, RGB(255,255,255), sizeof(custom_colors));
+
+ cc.lpCustColors = custom_colors;
+ cc.Flags = CC_ANYCOLOR | /* Causes the dialog box to display all available colors in
the set of basic colors. */
+ CC_FULLOPEN | /* opens dialog in full size */
+ CC_RGBINIT ; /* init chosen color by rgbResult value */
+ cc.lCustData = 0;
+ cc.lpfnHook = NULL;
+ cc.lpTemplateName = NULL;
+
+ if( ChooseColor( &cc ) )
+ {
+ g_backgroundDesktopColor = cc.rgbResult; /* save selected color to var */
+ PropSheet_Changed( GetParent( g_hBackgroundPage ), g_hBackgroundPage ); /* Apply
button will be activated */
+ InvalidateRect(g_hBackgroundPreview, NULL, TRUE); /* window will be updated :)
*/
+ }
}
BOOL CheckListBoxFilename(HWND list, TCHAR *filename)
@@ -314,9 +336,9 @@
TCHAR fileTitle[256];
TCHAR filter[MAX_PATH];
BackgroundItem *backgroundItem = NULL;
- SHFILEINFO sfi;
- LV_ITEM listItem;
-
+ SHFILEINFO sfi;
+ LV_ITEM listItem;
+
ZeroMemory(&ofn, sizeof(OPENFILENAME));
ofn.lStructSize = sizeof(OPENFILENAME);
@@ -324,7 +346,7 @@
ofn.lpstrFile = filename;
LoadString(hApplet, IDS_BACKGROUND_COMDLG_FILTER, filter, sizeof(filter) /
sizeof(TCHAR));
-
+
/* Set lpstrFile[0] to '\0' so that GetOpenFileName does not
* use the contents of szFile to initialize itself */
ofn.lpstrFile[0] = TEXT('\0');
@@ -337,7 +359,7 @@
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
if(GetOpenFileName(&ofn) == TRUE)
- {
+ {
/* Check if there is already a entry that holds this filename */
if(CheckListBoxFilename(g_hBackgroundList, filename) == TRUE)
return;
@@ -414,7 +436,11 @@
if(g_backgroundItems[g_backgroundSelection].bWallpaper == FALSE)
{
- FillRect(draw->hDC, &draw->rcItem,
GetSysColorBrush(COLOR_BACKGROUND));
+ HBRUSH hBrush = CreateSolidBrush( g_backgroundDesktopColor );
+ //HBRUSH hBrushOld = SelectObject( draw->hDC, hBrush );
+ FillRect(draw->hDC, &draw->rcItem, hBrush );
+ //SelectObject( draw->hDC, hBrushOld );
+ DeleteObject( hBrush );
return;
}
@@ -531,6 +557,30 @@
else
{
SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, TEXT(""),
SPIF_UPDATEINIFILE);
+ }
+}
+
+void SetDesktopBackColor()
+{
+ /* change system color */
+ INT iElement = COLOR_BACKGROUND;
+ if(!SetSysColors(1, &iElement, &g_backgroundDesktopColor))
+ {
+ MessageBox(g_hBackgroundPage, TEXT("SetSysColor() failed!"), /* these
error texts can need internationalization? */
+ TEXT("Error!"), MB_ICONSTOP );
+ }
+
+ /* write color to registry key: HKEY_CURRENT_USER\Control Panel\Colors\Background */
+ HKEY hKey = NULL;
+ if( RegOpenKeyEx( HKEY_CURRENT_USER, TEXT("Control Panel\\Colors"), 0,
KEY_WRITE, &hKey ) == ERROR_SUCCESS )
+ {
+ TCHAR clText[16] = {0}; // COLORREF(DWORD) holds colors as := 0x00BBGGRR
+ DWORD red = (g_backgroundDesktopColor & 0x000000FF);
+ DWORD green = (g_backgroundDesktopColor & 0x0000FF00) >> 8;
+ DWORD blue = (g_backgroundDesktopColor & 0x00FF0000) >> 16;
+ wsprintf( clText, TEXT("%d %d %d"), red, green, blue ); /* format
string to be set to registry */
+ RegSetValueEx( hKey, TEXT("Background"), 0, REG_SZ, (BYTE *)clText,
lstrlen( clText )*sizeof(TCHAR) + sizeof(TCHAR) );
+ RegCloseKey( hKey );
}
}
@@ -622,7 +672,7 @@
case PSN_APPLY:
{
SetWallpaper();
-
+ SetDesktopBackColor();
return TRUE;
} break;