Author: bfreisen
Date: Fri Oct 28 19:48:25 2016
New Revision: 73055
URL:
http://svn.reactos.org/svn/reactos?rev=73055&view=rev
Log:
[MSPAINT] refactor RegistrySettings::SetWallpaper, also changing its signature to make it
more usable
Modified:
trunk/reactos/base/applications/mspaint/registry.cpp
trunk/reactos/base/applications/mspaint/registry.h
trunk/reactos/base/applications/mspaint/winproc.cpp
Modified: trunk/reactos/base/applications/mspaint/registry.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mspaint/…
==============================================================================
--- trunk/reactos/base/applications/mspaint/registry.cpp [iso-8859-1] (original)
+++ trunk/reactos/base/applications/mspaint/registry.cpp [iso-8859-1] Fri Oct 28 19:48:25
2016
@@ -35,23 +35,15 @@
strFile.ReleaseBuffer();
}
-void RegistrySettings::SetWallpaper(LPCTSTR szFileName, DWORD dwStyle, DWORD dwTile)
+void RegistrySettings::SetWallpaper(LPCTSTR szFileName, RegistrySettings::WallpaperStyle
style)
{
- if ((dwStyle > 2) || (dwTile > 2))
- return;
-
CRegKey desktop;
if (desktop.Open(HKEY_CURRENT_USER, _T("Control Panel\\Desktop")) ==
ERROR_SUCCESS)
{
- CString strStyle, strTile;
-
desktop.SetStringValue(_T("Wallpaper"), szFileName);
- strStyle.Format(_T("%lu"), dwStyle);
- strTile.Format(_T("%lu"), dwTile);
-
- desktop.SetStringValue(_T("WallpaperStyle"), strStyle);
- desktop.SetStringValue(_T("TileWallpaper"), strTile);
+ desktop.SetStringValue(_T("WallpaperStyle"), (style ==
RegistrySettings::STRETCHED) ? _T("2") : _T("1"));
+ desktop.SetStringValue(_T("TileWallpaper"), (style ==
RegistrySettings::TILED) ? _T("1") : _T("0"));
}
SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, (PVOID) szFileName, SPIF_UPDATEINIFILE
| SPIF_SENDWININICHANGE);
Modified: trunk/reactos/base/applications/mspaint/registry.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mspaint/…
==============================================================================
--- trunk/reactos/base/applications/mspaint/registry.h [iso-8859-1] (original)
+++ trunk/reactos/base/applications/mspaint/registry.h [iso-8859-1] Fri Oct 28 19:48:25
2016
@@ -30,7 +30,13 @@
CString strFile3;
CString strFile4;
- static void SetWallpaper(LPCTSTR szFileName, DWORD dwStyle, DWORD dwTile);
+ enum WallpaperStyle {
+ TILED,
+ CENTERED,
+ STRETCHED
+ };
+
+ static void SetWallpaper(LPCTSTR szFileName, WallpaperStyle style);
void Load();
void Store();
Modified: trunk/reactos/base/applications/mspaint/winproc.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mspaint/…
==============================================================================
--- trunk/reactos/base/applications/mspaint/winproc.cpp [iso-8859-1] (original)
+++ trunk/reactos/base/applications/mspaint/winproc.cpp [iso-8859-1] Fri Oct 28 19:48:25
2016
@@ -451,13 +451,13 @@
GlobalFree(pd.hDevNames);
break;
case IDM_FILEASWALLPAPERPLANE:
- RegistrySettings::SetWallpaper(filepathname, 1, 1);
+ RegistrySettings::SetWallpaper(filepathname, RegistrySettings::TILED);
break;
case IDM_FILEASWALLPAPERCENTERED:
- RegistrySettings::SetWallpaper(filepathname, 1, 0);
+ RegistrySettings::SetWallpaper(filepathname, RegistrySettings::CENTERED);
break;
case IDM_FILEASWALLPAPERSTRETCHED:
- RegistrySettings::SetWallpaper(filepathname, 2, 0);
+ RegistrySettings::SetWallpaper(filepathname, RegistrySettings::STRETCHED);
break;
case IDM_FILE1:
{