From 6a7f572f84f3f23b55ab0f42c1203035463c38d8 Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Fri, 20 Sep 2013 19:21:48 +0000 Subject: using Uxtheme in modern too git-svn-id: http://svn.miranda-ng.org/main/trunk@6143 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Clist_modern/clist_modern_10.vcxproj | 15 +-- plugins/Clist_modern/clist_modern_11.vcxproj | 16 +--- .../Clist_modern/src/hdr/modern_commonheaders.h | 2 +- plugins/Clist_modern/src/modern_clc.cpp | 2 +- plugins/Clist_modern/src/modern_clui.cpp | 2 - plugins/Clist_modern/src/modern_cluiframes.cpp | 2 +- plugins/Clist_modern/src/modern_skinengine.cpp | 4 +- plugins/Clist_modern/src/modern_viewmodebar.cpp | 2 +- plugins/Clist_modern/src/modern_xptheme.cpp | 103 +++------------------ 9 files changed, 29 insertions(+), 119 deletions(-) diff --git a/plugins/Clist_modern/clist_modern_10.vcxproj b/plugins/Clist_modern/clist_modern_10.vcxproj index b2c112c768..9bf3882097 100644 --- a/plugins/Clist_modern/clist_modern_10.vcxproj +++ b/plugins/Clist_modern/clist_modern_10.vcxproj @@ -78,8 +78,6 @@ EnableFastChecks MultiThreadedDebugDLL true - - Use hdr/modern_commonheaders.h Level3 @@ -90,7 +88,7 @@ ..\..\include;..\..\include\msapi - MSImg32.Lib;comctl32.lib;shlwapi.lib;gdiplus.lib;%(AdditionalDependencies) + MSImg32.Lib;comctl32.lib;shlwapi.lib;gdiplus.lib;UxTheme.lib;%(AdditionalDependencies) type=%27Win32%27 name=%27Microsoft.Windows.Common-Controls%27 version=%276.0.0.0%27 processorArchitecture=%27*%27 publicKeyToken=%276595b64144ccf1df%27 language=%27*%27;%(AdditionalManifestDependencies) true false @@ -108,8 +106,6 @@ EnableFastChecks MultiThreadedDebugDLL true - - Use hdr/modern_commonheaders.h Level3 @@ -119,7 +115,7 @@ ..\..\include;..\..\include\msapi - MSImg32.Lib;comctl32.lib;shlwapi.lib;gdiplus.lib;%(AdditionalDependencies) + MSImg32.Lib;comctl32.lib;shlwapi.lib;gdiplus.lib;UxTheme.lib;%(AdditionalDependencies) type=%27Win32%27 name=%27Microsoft.Windows.Common-Controls%27 version=%276.0.0.0%27 processorArchitecture=%27*%27 publicKeyToken=%276595b64144ccf1df%27 language=%27*%27;%(AdditionalManifestDependencies) true false @@ -140,8 +136,6 @@ false true Fast - - Use hdr/modern_commonheaders.h Level3 @@ -151,7 +145,7 @@ ..\..\include;..\..\include\msapi - MSImg32.Lib;comctl32.lib;shlwapi.lib;gdiplus.lib;%(AdditionalDependencies) + MSImg32.Lib;comctl32.lib;shlwapi.lib;gdiplus.lib;UxTheme.lib;%(AdditionalDependencies) type=%27Win32%27 name=%27Microsoft.Windows.Common-Controls%27 version=%276.0.0.0%27 processorArchitecture=%27*%27 publicKeyToken=%276595b64144ccf1df%27 language=%27*%27;%(AdditionalManifestDependencies) true true @@ -174,7 +168,6 @@ false true Fast - Use hdr/modern_commonheaders.h Level3 @@ -185,7 +178,7 @@ ..\..\include;..\..\include\msapi - MSImg32.Lib;comctl32.lib;shlwapi.lib;gdiplus.lib;%(AdditionalDependencies) + MSImg32.Lib;comctl32.lib;shlwapi.lib;gdiplus.lib;UxTheme.lib;%(AdditionalDependencies) type=%27Win32%27 name=%27Microsoft.Windows.Common-Controls%27 version=%276.0.0.0%27 processorArchitecture=%27*%27 publicKeyToken=%276595b64144ccf1df%27 language=%27*%27;%(AdditionalManifestDependencies) true true diff --git a/plugins/Clist_modern/clist_modern_11.vcxproj b/plugins/Clist_modern/clist_modern_11.vcxproj index c1b3c74935..813c95327c 100644 --- a/plugins/Clist_modern/clist_modern_11.vcxproj +++ b/plugins/Clist_modern/clist_modern_11.vcxproj @@ -82,8 +82,6 @@ EnableFastChecks MultiThreadedDebugDLL true - - Use hdr/modern_commonheaders.h Level3 @@ -94,7 +92,7 @@ ..\..\include;..\..\include\msapi - MSImg32.Lib;comctl32.lib;shlwapi.lib;gdiplus.lib;%(AdditionalDependencies) + MSImg32.Lib;comctl32.lib;shlwapi.lib;gdiplus.lib;UxTheme.lib;%(AdditionalDependencies) type=%27Win32%27 name=%27Microsoft.Windows.Common-Controls%27 version=%276.0.0.0%27 processorArchitecture=%27*%27 publicKeyToken=%276595b64144ccf1df%27 language=%27*%27;%(AdditionalManifestDependencies) true false @@ -113,8 +111,6 @@ EnableFastChecks MultiThreadedDebugDLL true - - Use hdr/modern_commonheaders.h Level3 @@ -124,7 +120,7 @@ ..\..\include;..\..\include\msapi - MSImg32.Lib;comctl32.lib;shlwapi.lib;gdiplus.lib;%(AdditionalDependencies) + MSImg32.Lib;comctl32.lib;shlwapi.lib;gdiplus.lib;UxTheme.lib;%(AdditionalDependencies) type=%27Win32%27 name=%27Microsoft.Windows.Common-Controls%27 version=%276.0.0.0%27 processorArchitecture=%27*%27 publicKeyToken=%276595b64144ccf1df%27 language=%27*%27;%(AdditionalManifestDependencies) true false @@ -145,8 +141,6 @@ false true Fast - - Use hdr/modern_commonheaders.h Level3 @@ -156,7 +150,7 @@ ..\..\include;..\..\include\msapi - MSImg32.Lib;comctl32.lib;shlwapi.lib;gdiplus.lib;%(AdditionalDependencies) + MSImg32.Lib;comctl32.lib;shlwapi.lib;gdiplus.lib;UxTheme.lib;%(AdditionalDependencies) type=%27Win32%27 name=%27Microsoft.Windows.Common-Controls%27 version=%276.0.0.0%27 processorArchitecture=%27*%27 publicKeyToken=%276595b64144ccf1df%27 language=%27*%27;%(AdditionalManifestDependencies) true true @@ -178,8 +172,6 @@ false true Fast - - Use hdr/modern_commonheaders.h Level3 @@ -190,7 +182,7 @@ ..\..\include;..\..\include\msapi - MSImg32.Lib;comctl32.lib;shlwapi.lib;gdiplus.lib;%(AdditionalDependencies) + MSImg32.Lib;comctl32.lib;shlwapi.lib;gdiplus.lib;UxTheme.lib;%(AdditionalDependencies) type=%27Win32%27 name=%27Microsoft.Windows.Common-Controls%27 version=%276.0.0.0%27 processorArchitecture=%27*%27 publicKeyToken=%276595b64144ccf1df%27 language=%27*%27;%(AdditionalManifestDependencies) true true diff --git a/plugins/Clist_modern/src/hdr/modern_commonheaders.h b/plugins/Clist_modern/src/hdr/modern_commonheaders.h index ae7a33adb1..ec22ca3692 100644 --- a/plugins/Clist_modern/src/hdr/modern_commonheaders.h +++ b/plugins/Clist_modern/src/hdr/modern_commonheaders.h @@ -68,7 +68,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include #include - +#include #include #include #include diff --git a/plugins/Clist_modern/src/modern_clc.cpp b/plugins/Clist_modern/src/modern_clc.cpp index a0bde6cc4e..f34a72bb0d 100644 --- a/plugins/Clist_modern/src/modern_clc.cpp +++ b/plugins/Clist_modern/src/modern_clc.cpp @@ -525,7 +525,7 @@ static LRESULT clcOnSize(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LPARA ReleaseDC(hwnd, hdc); if (dat->himlHighlight) ImageList_Destroy(dat->himlHighlight); - dat->himlHighlight = ImageList_Create(rc.right, rc.bottom, (IsWinVerXPPlus()? ILC_COLOR32 : ILC_COLOR16) | ILC_MASK, 1, 1); + dat->himlHighlight = ImageList_Create(rc.right, rc.bottom, ILC_COLOR32 | ILC_MASK, 1, 1); ImageList_Add(dat->himlHighlight, hBmp, hBmpMask); DeleteObject(hBmpMask); DeleteObject(hBmp); diff --git a/plugins/Clist_modern/src/modern_clui.cpp b/plugins/Clist_modern/src/modern_clui.cpp index 59eb6ed3ab..ba54fa857b 100644 --- a/plugins/Clist_modern/src/modern_clui.cpp +++ b/plugins/Clist_modern/src/modern_clui.cpp @@ -551,7 +551,6 @@ int CLUI_ShowWindowMod(HWND hWnd, int nCmd) && !g_mutex_bChangingMode && nCmd == SW_HIDE && !g_CluiData.fLayered - && IsWinVerXPPlus() && db_get_b(NULL,"CList","WindowShadow",SETTING_WINDOWSHADOW_DEFAULT)) { ShowWindow(hWnd,SW_MINIMIZE); //removing of shadow @@ -561,7 +560,6 @@ int CLUI_ShowWindowMod(HWND hWnd, int nCmd) && !g_mutex_bChangingMode && nCmd == SW_RESTORE && !g_CluiData.fLayered - && IsWinVerXPPlus() && g_CluiData.fSmoothAnimation && !g_bTransparentFlag) { diff --git a/plugins/Clist_modern/src/modern_cluiframes.cpp b/plugins/Clist_modern/src/modern_cluiframes.cpp index 1f701e9a59..eda033938d 100644 --- a/plugins/Clist_modern/src/modern_cluiframes.cpp +++ b/plugins/Clist_modern/src/modern_cluiframes.cpp @@ -3954,7 +3954,7 @@ int LoadCLUIFramesModule(void) //container helper - cntclass.style = CS_DBLCLKS/*|CS_HREDRAW|CS_VREDRAW*/|( IsWinVerXPPlus() ? CS_DROPSHADOW : 0); + cntclass.style = CS_DBLCLKS/*|CS_HREDRAW|CS_VREDRAW*/|CS_DROPSHADOW; cntclass.lpfnWndProc = CLUIFrameContainerWndProc; cntclass.cbClsExtra = 0; cntclass.cbWndExtra = 0; diff --git a/plugins/Clist_modern/src/modern_skinengine.cpp b/plugins/Clist_modern/src/modern_skinengine.cpp index 3d45aaca75..e270ee4ba9 100644 --- a/plugins/Clist_modern/src/modern_skinengine.cpp +++ b/plugins/Clist_modern/src/modern_skinengine.cpp @@ -2978,7 +2978,7 @@ HICON ske_ImageList_GetIcon(HIMAGELIST himl, int i, UINT fStyle) { IMAGEINFO imi = {0}; BITMAP bm = {0}; - if ( IsWinVerXPPlus() && i != -1 ) + if (i != -1) { ImageList_GetImageInfo(himl,i,&imi); GetObject(imi.hbmImage,sizeof(bm),&bm); @@ -4327,7 +4327,7 @@ HICON ske_CreateJoinedIcon(HICON hBottom, HICON hTop, BYTE alpha) GetObject(iciTop.hbmColor,sizeof(BITMAP),&bmp_top); GetObject(iciTop.hbmMask,sizeof(BITMAP),&bmp_top_mask); - if (bmp_bottom.bmBitsPixel == 32 && bmp_top.bmBitsPixel == 32 && IsWinVerXPPlus()) + if (bmp_bottom.bmBitsPixel == 32 && bmp_top.bmBitsPixel == 32) { BYTE * BottomBuffer, * TopBuffer, * BottomMaskBuffer, * TopMaskBuffer; BYTE * bb, * tb, * bmb, * tmb; diff --git a/plugins/Clist_modern/src/modern_viewmodebar.cpp b/plugins/Clist_modern/src/modern_viewmodebar.cpp index 91d1f7a24f..433c219aa9 100644 --- a/plugins/Clist_modern/src/modern_viewmodebar.cpp +++ b/plugins/Clist_modern/src/modern_viewmodebar.cpp @@ -669,7 +669,7 @@ INT_PTR CALLBACK DlgProcViewModesSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LP switch(msg) { case WM_INITDIALOG: xpt_EnableThemeDialogTexture(hwndDlg, ETDT_ENABLETAB); - himlViewModes = ImageList_Create(16, 16, ILC_MASK | (IsWinVerXPPlus() ? ILC_COLOR32 : ILC_COLOR16), 12, 0); + himlViewModes = ImageList_Create(16, 16, ILC_MASK | ILC_COLOR32, 12, 0); { int i; for (i = ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++) { diff --git a/plugins/Clist_modern/src/modern_xptheme.cpp b/plugins/Clist_modern/src/modern_xptheme.cpp index dac9f7f525..89cc699c56 100644 --- a/plugins/Clist_modern/src/modern_xptheme.cpp +++ b/plugins/Clist_modern/src/modern_xptheme.cpp @@ -14,101 +14,40 @@ typedef struct _tagXPTObject static OBJLIST xptObjectList(1); static CRITICAL_SECTION xptCS; -static BOOL xptModuleLoaded = FALSE; - -static HMODULE _xpt_ThemeAPIHandle = NULL; // handle to uxtheme.dll -static HANDLE (WINAPI *_xpt_OpenThemeData)(HWND, LPCWSTR) = NULL; -static HRESULT (WINAPI *_xpt_CloseThemeData)(HANDLE) = NULL; -static BOOL (WINAPI *_xpt_IsThemeBackgroundPartiallyTransparent)(HANDLE, int,int) = NULL; -static BOOL (WINAPI *_xpt_EnableThemeDialogTexture)(HANDLE, DWORD) = NULL; -static HRESULT (WINAPI *_xpt_GetThemePartSize)(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, RECT *prc, int eSize, SIZE *psz ) = NULL; -static HRESULT (WINAPI *_xpt_DrawThemeParentBackground)(HWND, HDC, const RECT *) = NULL; -static HRESULT (WINAPI *_xpt_DrawThemeBackground)(HANDLE, HDC, int, int,const RECT *, const RECT *) = NULL; -static HRESULT (WINAPI *_xpt_DrawThemeText)(HANDLE, HDC, int, int, LPCWSTR, int,DWORD, DWORD, const RECT *) = NULL; - - -#undef MGPROC -#define MGPROC(x) GetProcAddress(_xpt_ThemeAPIHandle,x) - -#define xptcheck if ( !xptModuleLoaded) return #define xptlock() EnterCriticalSection(&xptCS) #define xptunlock() LeaveCriticalSection(&xptCS) -static void _sttXptObjectDestructor (void * pt) -{ - mir_free(pt); -} - -static int _xpt_ThemeSupport() -{ - if (IsWinVerXPPlus()) { - if ( !_xpt_ThemeAPIHandle) { - _xpt_ThemeAPIHandle = GetModuleHandleA("uxtheme"); - if (_xpt_ThemeAPIHandle) { - _xpt_OpenThemeData = (HANDLE(WINAPI *)(HWND, LPCWSTR))MGPROC("OpenThemeData"); - _xpt_CloseThemeData = (HRESULT(WINAPI *)(HANDLE))MGPROC("CloseThemeData"); - _xpt_IsThemeBackgroundPartiallyTransparent = (BOOL(WINAPI *)(HANDLE, int, int))MGPROC("IsThemeBackgroundPartiallyTransparent"); - _xpt_DrawThemeParentBackground = (HRESULT(WINAPI *)(HWND, HDC, const RECT *))MGPROC("DrawThemeParentBackground"); - _xpt_DrawThemeBackground = (HRESULT(WINAPI *)(HANDLE, HDC, int, int, const RECT *, const RECT *))MGPROC("DrawThemeBackground"); - _xpt_DrawThemeText = (HRESULT(WINAPI *)(HANDLE, HDC, int, int, LPCWSTR, int, DWORD, DWORD, const RECT *))MGPROC("DrawThemeText"); - _xpt_GetThemePartSize = (HRESULT(WINAPI *)(HTHEME , HDC , int , int , RECT *, int , SIZE * ))MGPROC("GetThemePartSize"); - _xpt_EnableThemeDialogTexture = (BOOL (WINAPI *)(HANDLE, DWORD)) MGPROC("EnableThemeDialogTexture"); - } - } - // Make sure all of these methods are valid (i would hope either all or none work) - if (_xpt_OpenThemeData && - _xpt_CloseThemeData && - _xpt_IsThemeBackgroundPartiallyTransparent && - _xpt_DrawThemeParentBackground && - _xpt_DrawThemeBackground && - _xpt_DrawThemeText && - _xpt_GetThemePartSize) - { - return 1; - } - } - return 0; -} - static void _sttXptCloseThemeData(XPTObject * xptObject) { - _xpt_CloseThemeData(xptObject->hThemeHandle); + CloseThemeData(xptObject->hThemeHandle); xptObject->hThemeHandle = NULL; } static void _sttXptReloadThemeData(XPTObject * xptObject) { - _xpt_CloseThemeData(xptObject->hThemeHandle); - xptObject->hThemeHandle = _xpt_OpenThemeData(xptObject->hOwnerWindow, xptObject->lpcwClassObject); + CloseThemeData(xptObject->hThemeHandle); + xptObject->hThemeHandle = OpenThemeData(xptObject->hOwnerWindow, xptObject->lpcwClassObject); } HRESULT XPThemesLoadModule() { - if (_xpt_ThemeSupport()) - { - InitializeCriticalSection(&xptCS); - xptModuleLoaded = TRUE; - } + InitializeCriticalSection(&xptCS); return S_OK; } void XPThemesUnloadModule() { - xptcheck; xptlock(); - xptModuleLoaded = FALSE; xptunlock(); xptObjectList.destroy(); DeleteCriticalSection(&xptCS); - FreeLibrary(_xpt_ThemeAPIHandle); } BOOL xpt_IsThemed(XPTHANDLE xptHandle) { BOOL res = FALSE; - xptcheck FALSE; if ( !xptHandle) return FALSE; xptlock(); { @@ -122,7 +61,6 @@ BOOL xpt_IsThemed(XPTHANDLE xptHandle) BOOL xpt_IsValidHandle(XPTHANDLE xptHandle) { BOOL res = FALSE; - xptcheck FALSE; if ( !xptHandle) return FALSE; xptlock(); { @@ -136,7 +74,6 @@ BOOL xpt_IsValidHandle(XPTHANDLE xptHandle) XPTHANDLE xpt_AddThemeHandle(HWND hwnd, LPCWSTR className) { XPTHANDLE res = NULL; - xptcheck NULL; xptlock(); { XPTObject* xptObject = new XPTObject; @@ -152,20 +89,18 @@ XPTHANDLE xpt_AddThemeHandle(HWND hwnd, LPCWSTR className) void xpt_FreeThemeHandle(XPTHANDLE xptHandle) { - xptcheck; xptlock(); if (xpt_IsValidHandle(xptHandle)) { XPTObject* xptObject = (XPTObject*)xptHandle; _sttXptCloseThemeData(xptObject); - _sttXptObjectDestructor((void *) xptHandle); + mir_free(xptHandle); xptObjectList.remove( xptObjectList.indexOf(xptObject)); } xptunlock(); } void xpt_FreeThemeForWindow(HWND hwnd) { - xptcheck; xptlock(); { for (int i=0; i < xptObjectList.getCount(); ) @@ -184,7 +119,6 @@ void xpt_FreeThemeForWindow(HWND hwnd) void xpt_OnWM_THEMECHANGED() { - xptcheck; xptlock(); { for (int i=0; i < xptObjectList.getCount(); i++) @@ -192,41 +126,36 @@ void xpt_OnWM_THEMECHANGED() } xptunlock(); } + HRESULT xpt_DrawThemeBackground(XPTHANDLE xptHandle, HDC hdc, int type, int state, const RECT *sizeRect, const RECT *clipRect) { HRESULT res = S_FALSE; - xptcheck S_FALSE; xptlock(); if (xpt_IsThemed(xptHandle)) - res = _xpt_DrawThemeBackground(((XPTObject*)xptHandle)->hThemeHandle, hdc, type, state, sizeRect, clipRect); + res = DrawThemeBackground(((XPTObject*)xptHandle)->hThemeHandle, hdc, type, state, sizeRect, clipRect); xptunlock(); return res; } -HRESULT xpt_DrawThemeParentBackground(HWND hWnd, HDC hdc, const RECT *sizeRect) -{ - xptcheck S_FALSE; - return xpt_DrawThemeParentBackground(hWnd, hdc, sizeRect); -} + BOOL xpt_IsThemeBackgroundPartiallyTransparent(XPTHANDLE xptHandle, int type, int state) { BOOL res = FALSE; - xptcheck FALSE; xptlock(); if (xpt_IsThemed(xptHandle)) - res = _xpt_IsThemeBackgroundPartiallyTransparent(((XPTObject*)xptHandle)->hThemeHandle, type, state); + res = IsThemeBackgroundPartiallyTransparent(((XPTObject*)xptHandle)->hThemeHandle, type, state); xptunlock(); return res; } + HRESULT xpt_DrawTheme(XPTHANDLE xptHandle, HWND hwnd, HDC hdc, int type, int state, const RECT *sizeRect, const RECT *clipRect) { HRESULT res = S_FALSE; - xptcheck S_FALSE; xptlock(); if (xpt_IsThemed(xptHandle)) { - if (_xpt_IsThemeBackgroundPartiallyTransparent(((XPTObject*)xptHandle)->hThemeHandle, type, state)) - res = _xpt_DrawThemeParentBackground(hwnd,hdc,sizeRect); - res = _xpt_DrawThemeBackground(((XPTObject*)xptHandle)->hThemeHandle, hdc, type, state, sizeRect, clipRect); + if (IsThemeBackgroundPartiallyTransparent(((XPTObject*)xptHandle)->hThemeHandle, type, state)) + res = DrawThemeParentBackground(hwnd,hdc,sizeRect); + res = DrawThemeBackground(((XPTObject*)xptHandle)->hThemeHandle, hdc, type, state, sizeRect, clipRect); } xptunlock(); return res; @@ -235,10 +164,9 @@ HRESULT xpt_DrawTheme(XPTHANDLE xptHandle, HWND hwnd, HDC hdc, int type, int sta HRESULT xpt_DrawThemeText(XPTHANDLE xptHandle, HDC hdc, int type, int state, LPCTSTR lpStr, int len, DWORD flag1, DWORD flag2, const RECT *textRect) { HRESULT res = S_FALSE; - xptcheck S_FALSE; xptlock(); if (xpt_IsThemed(xptHandle)) - _xpt_DrawThemeText(((XPTObject*)xptHandle)->hThemeHandle, hdc, type, state, (LPCWSTR)lpStr, len, flag1, flag2, textRect); + DrawThemeText(((XPTObject*)xptHandle)->hThemeHandle, hdc, type, state, (LPCWSTR)lpStr, len, flag1, flag2, textRect); else ske_DrawText(hdc,lpStr,len, (RECT*)textRect, flag1); xptunlock(); @@ -247,9 +175,8 @@ HRESULT xpt_DrawThemeText(XPTHANDLE xptHandle, HDC hdc, int type, int state, LPC BOOL xpt_EnableThemeDialogTexture(HWND hwnd, DWORD flags) { BOOL res = FALSE; - xptcheck res; xptlock(); - res = _xpt_EnableThemeDialogTexture(hwnd, flags); + res = EnableThemeDialogTexture(hwnd, flags); xptunlock(); return res; } -- cgit v1.2.3