[ros-diffs] [rharabien] 55583: [COMCTL32] - Add support for LVS_EX_TRANSPARENTSHADOWTEXT style [SHELL32] - Add drop shadows support for desktop - Set proper label color based on background color when drop shad...

rharabien at svn.reactos.org rharabien at svn.reactos.org
Mon Feb 13 20:52:21 UTC 2012


Author: rharabien
Date: Mon Feb 13 20:52:20 2012
New Revision: 55583

URL: http://svn.reactos.org/svn/reactos?rev=55583&view=rev
Log:
[COMCTL32]
- Add support for LVS_EX_TRANSPARENTSHADOWTEXT style
[SHELL32]
- Add drop shadows support for desktop
- Set proper label color based on background color when drop shadows is disabled
- Update desktop colors when WM_SYSCOLORCHANGE or WM_SETTINGCHANGE msg is received
[BOOTDATA]
- Enable drop shadows by default (this option was hardcoded to 1 before)
[DESK]
- Send WM_SETTINGCHANGE with wParam = 0 when applying changes
[EXPLORER]
- Broadcast WM_SETTINGCHANGE message to shell view window

Modified:
    trunk/reactos/base/shell/explorer/desktop/desktop.cpp
    trunk/reactos/boot/bootdata/hivedef_i386.inf
    trunk/reactos/dll/cpl/desk/background.c
    trunk/reactos/dll/win32/comctl32/listview.c
    trunk/reactos/dll/win32/shell32/desktop.cpp
    trunk/reactos/dll/win32/shell32/shlview.cpp

Modified: trunk/reactos/base/shell/explorer/desktop/desktop.cpp
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/desktop/desktop.cpp?rev=55583&r1=55582&r2=55583&view=diff
==============================================================================
--- trunk/reactos/base/shell/explorer/desktop/desktop.cpp [iso-8859-1] (original)
+++ trunk/reactos/base/shell/explorer/desktop/desktop.cpp [iso-8859-1] Mon Feb 13 20:52:20 2012
@@ -467,10 +467,14 @@
 		// redraw background window - it's done by system
 		//InvalidateRect(g_Globals._hwndShellView, NULL, TRUE);
 
-		 // forward message to common controls
+		// forward message to common controls
 		SendMessage(g_Globals._hwndShellView, WM_SYSCOLORCHANGE, 0, 0);
 		SendMessage(_desktopBar, WM_SYSCOLORCHANGE, 0, 0);
 		break;
+
+      case WM_SETTINGCHANGE:
+        SendMessage(g_Globals._hwndShellView, nmsg, wparam, lparam);
+        break;
 
 	  default: def:
 		return super::WndProc(nmsg, wparam, lparam);

Modified: trunk/reactos/boot/bootdata/hivedef_i386.inf
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/bootdata/hivedef_i386.inf?rev=55583&r1=55582&r2=55583&view=diff
==============================================================================
Binary files - no diff available.

Modified: trunk/reactos/dll/cpl/desk/background.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/desk/background.c?rev=55583&r1=55582&r2=55583&view=diff
==============================================================================
--- trunk/reactos/dll/cpl/desk/background.c [iso-8859-1] (original)
+++ trunk/reactos/dll/cpl/desk/background.c [iso-8859-1] Mon Feb 13 20:52:20 2012
@@ -812,6 +812,7 @@
                             SetWallpaper(pData);
                         if(pData->bClrBackgroundChanged)
                             SetDesktopBackColor(hwndDlg, pData);
+                        SendMessage(HWND_BROADCAST, WM_SETTINGCHANGE, 0, (LPARAM)_T(""));
                         return TRUE;
 
                     case LVN_ITEMCHANGED:

Modified: trunk/reactos/dll/win32/comctl32/listview.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/listview.c?rev=55583&r1=55582&r2=55583&view=diff
==============================================================================
--- trunk/reactos/dll/win32/comctl32/listview.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/comctl32/listview.c [iso-8859-1] Mon Feb 13 20:52:20 2012
@@ -4710,7 +4710,10 @@
     if (infoPtr->uView == LV_VIEW_DETAILS && infoPtr->dwLvExStyle & LVS_EX_GRIDLINES)
         rcLabel.bottom--;
 
-    DrawTextW(hdc, lvItem.pszText, -1, &rcLabel, uFormat);
+    if (!lprcFocus && (infoPtr->dwLvExStyle & LVS_EX_TRANSPARENTSHADOWTEXT))
+        DrawShadowText(hdc, lvItem.pszText, -1, &rcLabel, uFormat, RGB(255, 255, 255), RGB(0, 0, 0), 2, 2);
+    else
+        DrawTextW(hdc, lvItem.pszText, -1, &rcLabel, uFormat);
 
 postpaint:
     if (cdsubitemmode & CDRF_NOTIFYPOSTPAINT)

Modified: trunk/reactos/dll/win32/shell32/desktop.cpp
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/desktop.cpp?rev=55583&r1=55582&r2=55583&view=diff
==============================================================================
--- trunk/reactos/dll/win32/shell32/desktop.cpp [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/desktop.cpp [iso-8859-1] Mon Feb 13 20:52:20 2012
@@ -422,18 +422,18 @@
                 break;
 
             case WM_SYSCOLORCHANGE:
+            case WM_SETTINGCHANGE:
             {
-                InvalidateRect(pThis->hWnd,
-                               NULL,
-                               TRUE);
-
-                if (pThis->hWndShellView != NULL)
+                if (uMsg == WM_SYSCOLORCHANGE || wParam == SPI_SETDESKWALLPAPER || wParam == 0)
                 {
-                    /* Forward the message */
-                    SendMessageW(pThis->hWndShellView,
-                                 WM_SYSCOLORCHANGE,
-                                 wParam,
-                                 lParam);
+                    if (pThis->hWndShellView != NULL)
+                    {
+                        /* Forward the message */
+                        SendMessageW(pThis->hWndShellView,
+                                     uMsg,
+                                     wParam,
+                                     lParam);
+                    }
                 }
                 break;
             }

Modified: trunk/reactos/dll/win32/shell32/shlview.cpp
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shlview.cpp?rev=55583&r1=55582&r2=55583&view=diff
==============================================================================
--- trunk/reactos/dll/win32/shell32/shlview.cpp [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/shlview.cpp [iso-8859-1] Mon Feb 13 20:52:20 2012
@@ -111,6 +111,7 @@
         void CheckToolbar();
         void SetStyle(DWORD dwAdd, DWORD dwRemove);
         BOOL CreateList();
+        void UpdateListColors();
         BOOL InitList();
         static INT CALLBACK CompareItems(LPVOID lParam1, LPVOID lParam2, LPARAM lpData);
         static INT CALLBACK ListViewCompareItems(LPVOID lParam1, LPVOID lParam2, LPARAM lpData);
@@ -207,6 +208,7 @@
         LRESULT OnNotify(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
         LRESULT OnChangeNotify(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
         LRESULT OnCustomItem(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
+        LRESULT OnSettingChange(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
 
         static ATL::CWndClassInfo& GetWndClassInfo()
         {
@@ -257,6 +259,7 @@
         MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackground)
         MESSAGE_HANDLER(WM_SYSCOLORCHANGE, OnSysColorChange)
         MESSAGE_HANDLER(CWM_GETISHELLBROWSER, OnGetShellBrowser)
+        MESSAGE_HANDLER(WM_SETTINGCHANGE, OnSettingChange)
         END_MSG_MAP()
 
         BEGIN_COM_MAP(CDefView)
@@ -509,29 +512,42 @@
     ListViewSortInfo.nHeaderID = -1;
     ListViewSortInfo.nLastHeaderID = -1;
 
+    UpdateListColors();
+
+    /*  UpdateShellSettings(); */
+    return TRUE;
+}
+
+void CDefView::UpdateListColors()
+{
     if (FolderSettings.fFlags & FWF_DESKTOP)
     {
-        /*
-        * FIXME: look at the registry value
-        * HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ListviewShadow
-        * and activate drop shadows if necessary
-        */
-        if (1)
+        /* Check if drop shadows option is enabled */
+        BOOL bDropShadow = FALSE;
+        DWORD cbDropShadow = sizeof(bDropShadow);
+        WCHAR wszBuf[16] = L"";
+
+        RegGetValueW(HKEY_CURRENT_USER, L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced",
+                     L"ListviewShadow", RRF_RT_DWORD, NULL, &bDropShadow, &cbDropShadow);
+        if (bDropShadow && SystemParametersInfoW(SPI_GETDESKWALLPAPER, _countof(wszBuf), wszBuf, 0) && wszBuf[0])
         {
             SendMessageW(hWndList, LVM_SETTEXTBKCOLOR, 0, CLR_NONE);
             SendMessageW(hWndList, LVM_SETBKCOLOR, 0, CLR_NONE);
+            SendMessageW(hWndList, LVM_SETTEXTCOLOR, 0, RGB(255, 255, 255));
+            SendMessageW(hWndList, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_TRANSPARENTSHADOWTEXT, LVS_EX_TRANSPARENTSHADOWTEXT);
         }
         else
         {
-            SendMessageW(hWndList, LVM_SETTEXTBKCOLOR, 0, GetSysColor(COLOR_DESKTOP));
-            SendMessageW(hWndList, LVM_SETBKCOLOR, 0, GetSysColor(COLOR_DESKTOP));
+            COLORREF crDesktop = GetSysColor(COLOR_DESKTOP);
+            SendMessageW(hWndList, LVM_SETTEXTBKCOLOR, 0, crDesktop);
+            SendMessageW(hWndList, LVM_SETBKCOLOR, 0, crDesktop);
+            if (GetRValue(crDesktop) + GetGValue(crDesktop) + GetBValue(crDesktop) > 128 * 3)
+                SendMessageW(hWndList, LVM_SETTEXTCOLOR, 0, RGB(0, 0, 0));
+            else
+                SendMessageW(hWndList, LVM_SETTEXTCOLOR, 0, RGB(255, 255, 255));
+            SendMessageW(hWndList, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_TRANSPARENTSHADOWTEXT, 0);
         }
-
-        SendMessageW(hWndList, LVM_SETTEXTCOLOR, 0, RGB(255, 255, 255));
-    }
-
-    /*  UpdateShellSettings(); */
-    return TRUE;
+    }
 }
 
 /**********************************************************
@@ -888,6 +904,9 @@
 
 LRESULT CDefView::OnSysColorChange(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 {
+    /* Update desktop labels color */
+    UpdateListColors();
+
     /* Forward WM_SYSCOLORCHANGE to common controls */
     return SendMessageW(hWndList, uMsg, 0, 0);
 }
@@ -1285,7 +1304,9 @@
                         SetMenuDefaultItem(hMenu, FCIDM_SHVIEW_OPEN, MF_BYCOMMAND);
 
                     TRACE("-- track popup\n");
-                    uCommand = TrackPopupMenu( hMenu, TPM_LEFTALIGN | TPM_RETURNCMD, x, y, 0, m_hWnd, NULL);
+                    uCommand = TrackPopupMenu(hMenu,
+                                              TPM_LEFTALIGN | TPM_RETURNCMD | TPM_LEFTBUTTON | TPM_RIGHTBUTTON,
+                                              x, y, 0, m_hWnd, NULL);
 
                     if (uCommand > 0)
                     {
@@ -1322,7 +1343,9 @@
         CDefFolderMenu_Create2(NULL, NULL, cidl, (LPCITEMIDLIST*)apidl, pSFParent, NULL, 0, NULL, (IContextMenu**)&pCM);
         pCM->QueryContextMenu(hMenu, 0, FCIDM_SHVIEWFIRST, FCIDM_SHVIEWLAST, 0);
 
-        uCommand = TrackPopupMenu(hMenu, TPM_LEFTALIGN | TPM_RETURNCMD, x, y, 0, m_hWnd, NULL);
+        uCommand = TrackPopupMenu(hMenu,
+                                  TPM_LEFTALIGN | TPM_RETURNCMD | TPM_LEFTBUTTON | TPM_RIGHTBUTTON,
+                                  x, y, 0, m_hWnd, NULL);
         DestroyMenu(hMenu);
 
         TRACE("-- (%p)->(uCommand=0x%08x )\n", this, uCommand);
@@ -2064,7 +2087,7 @@
 }
 
 /**********************************************************
-*  ShellView_DoMeasureItem
+*  CDefView::OnCustomItem
 */
 LRESULT CDefView::OnCustomItem(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 {
@@ -2079,6 +2102,15 @@
         return TRUE;
     else
         return FALSE;
+}
+
+LRESULT CDefView::OnSettingChange(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
+{
+    /* Wallpaper setting affects drop shadows effect */
+    if (wParam == SPI_SETDESKWALLPAPER || wParam == 0)
+        UpdateListColors();
+
+    return S_OK;
 }
 
 /**********************************************************




More information about the Ros-diffs mailing list