From fdbc3639a50f40879f390f17ce7aafd5a579a7ab Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Sat, 21 Sep 2013 17:37:33 +0000 Subject: Core cleanup git-svn-id: http://svn.miranda-ng.org/main/trunk@6165 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/core/stdmsg/src/commonheaders.h | 1 + src/core/stdmsg/src/msgdialog.cpp | 2 +- src/core/stdmsg/src/richutil.cpp | 60 ++++++++----------------------------- src/core/stdmsg/stdmsg_10.vcxproj | 8 ++--- src/core/stdmsg/stdmsg_11.vcxproj | 8 ++--- 5 files changed, 22 insertions(+), 57 deletions(-) (limited to 'src/core/stdmsg') diff --git a/src/core/stdmsg/src/commonheaders.h b/src/core/stdmsg/src/commonheaders.h index ac219783a4..35e9fe6031 100644 --- a/src/core/stdmsg/src/commonheaders.h +++ b/src/core/stdmsg/src/commonheaders.h @@ -33,6 +33,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include #include +#include #include #include diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp index 35b5cf8925..4b2c68c1b6 100644 --- a/src/core/stdmsg/src/msgdialog.cpp +++ b/src/core/stdmsg/src/msgdialog.cpp @@ -1487,7 +1487,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP if (db_get_dw(dat->hContact, dat->szProto, "IdleTS", 0)) { HIMAGELIST hImageList; - hImageList = ImageList_Create(GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON), IsWinVerXPPlus()? ILC_COLOR32 | ILC_MASK : ILC_COLOR16 | ILC_MASK, 1, 0); + hImageList = ImageList_Create(GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON), ILC_COLOR32 | ILC_MASK, 1, 0); ImageList_AddIcon(hImageList, hIcon); ImageList_DrawEx(hImageList, 0, dis->hDC, dis->rcItem.left, dis->rcItem.top, 0, 0, CLR_NONE, CLR_NONE, ILD_SELECTED); ImageList_Destroy(hImageList); diff --git a/src/core/stdmsg/src/richutil.cpp b/src/core/stdmsg/src/richutil.cpp index 42e3f890f3..53bf684119 100644 --- a/src/core/stdmsg/src/richutil.cpp +++ b/src/core/stdmsg/src/richutil.cpp @@ -47,17 +47,6 @@ static int RichUtil_CmpVal(void *p1, void *p2) return (int)((INT_PTR)tp1->hwnd - (INT_PTR)tp2->hwnd); } -// UxTheme Stuff -static HMODULE mTheme; - -static HANDLE (WINAPI *MyOpenThemeData)(HWND, LPCWSTR); -static HRESULT (WINAPI *MyCloseThemeData)(HANDLE); -static BOOL (WINAPI *MyIsThemeActive)(VOID); -static HRESULT (WINAPI *MyDrawThemeBackground)(HANDLE, HDC, int, int, LPCRECT, LPCRECT); -static HRESULT (WINAPI *MyGetThemeBackgroundContentRect)(HANDLE, HDC, int, int, LPCRECT, LPRECT); -static HRESULT (WINAPI *MyDrawThemeParentBackground)(HWND, HDC, LPRECT); -static BOOL (WINAPI *MyIsThemeBackgroundPartiallyTransparent)(HANDLE, int, int); - static CRITICAL_SECTION csRich; static LRESULT CALLBACK RichUtil_Proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); @@ -68,38 +57,13 @@ void RichUtil_Load(void) sListInt.increment = 10; sListInt.sortFunc = RichUtil_CmpVal; - mTheme = IsWinVerXPPlus() ? GetModuleHandleA("uxtheme") : 0; - InitializeCriticalSection(&csRich); - if (!mTheme) return; - - MyOpenThemeData = (HANDLE (WINAPI *)(HWND, LPCWSTR))GetProcAddress(mTheme, "OpenThemeData"); - MyCloseThemeData = (HRESULT (WINAPI *)(HANDLE))GetProcAddress(mTheme, "CloseThemeData"); - MyIsThemeActive = (BOOL (WINAPI *)(VOID))GetProcAddress(mTheme, "IsThemeActive"); - MyDrawThemeBackground = (HRESULT (WINAPI *)(HANDLE, HDC, int, int, const RECT*, const RECT *))GetProcAddress(mTheme, "DrawThemeBackground"); - MyGetThemeBackgroundContentRect = (HRESULT (WINAPI *)(HANDLE, HDC, int, int, const RECT *, RECT *))GetProcAddress(mTheme, "GetThemeBackgroundContentRect"); - MyDrawThemeParentBackground = (HRESULT (WINAPI *)(HWND, HDC, RECT*))GetProcAddress(mTheme, "DrawThemeParentBackground"); - MyIsThemeBackgroundPartiallyTransparent = (BOOL (WINAPI *)(HANDLE, int, int))GetProcAddress(mTheme, "IsThemeBackgroundPartiallyTransparent"); - - if (!MyOpenThemeData || - !MyCloseThemeData || - !MyIsThemeActive || - !MyDrawThemeBackground || - !MyGetThemeBackgroundContentRect || - !MyDrawThemeParentBackground || - !MyIsThemeBackgroundPartiallyTransparent) - { - FreeLibrary(mTheme); - mTheme = NULL; - } } void RichUtil_Unload(void) { List_Destroy(&sListInt); DeleteCriticalSection(&csRich); - if (mTheme) - FreeLibrary(mTheme); } int RichUtil_SubClass(HWND hwndEdit) @@ -157,9 +121,9 @@ static LRESULT CALLBACK RichUtil_Proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM case WM_NCPAINT: { LRESULT ret = mir_callNextSubclass(hwnd, RichUtil_Proc, msg, wParam, lParam); - if (ru->hasUglyBorder && MyIsThemeActive()) + if (ru->hasUglyBorder && IsThemeActive()) { - HANDLE hTheme = MyOpenThemeData(ru->hwnd, L"EDIT"); + HANDLE hTheme = OpenThemeData(ru->hwnd, L"EDIT"); if (hTheme) { RECT rcBorder; @@ -178,8 +142,8 @@ static LRESULT CALLBACK RichUtil_Proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM rcClient.bottom -= ru->rect.bottom; ExcludeClipRect(hdc, rcClient.left, rcClient.top, rcClient.right, rcClient.bottom); - if (MyIsThemeBackgroundPartiallyTransparent(hTheme, EP_EDITTEXT, ETS_NORMAL)) - MyDrawThemeParentBackground(hwnd, hdc, &rcBorder); + if (IsThemeBackgroundPartiallyTransparent(hTheme, EP_EDITTEXT, ETS_NORMAL)) + DrawThemeParentBackground(hwnd, hdc, &rcBorder); if (style & WS_DISABLED) nState = ETS_DISABLED; @@ -188,8 +152,8 @@ static LRESULT CALLBACK RichUtil_Proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM else nState = ETS_NORMAL; - MyDrawThemeBackground(hTheme, hdc, EP_EDITTEXT, nState, &rcBorder, NULL); - MyCloseThemeData(hTheme); + DrawThemeBackground(hTheme, hdc, EP_EDITTEXT, nState, &rcBorder, NULL); + CloseThemeData(hTheme); ReleaseDC(hwnd, hdc); return 0; } @@ -201,25 +165,25 @@ static LRESULT CALLBACK RichUtil_Proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM LRESULT ret = mir_callNextSubclass(hwnd, RichUtil_Proc, msg, wParam, lParam); NCCALCSIZE_PARAMS *ncsParam = (NCCALCSIZE_PARAMS*)lParam; - if (ru->hasUglyBorder && MyIsThemeActive()) { - HANDLE hTheme = MyOpenThemeData(hwnd, L"EDIT"); + if (ru->hasUglyBorder && IsThemeActive()) { + HANDLE hTheme = OpenThemeData(hwnd, L"EDIT"); if (hTheme) { RECT rcClient ={0}; HDC hdc = GetDC(GetParent(hwnd)); - if (MyGetThemeBackgroundContentRect(hTheme, hdc, EP_EDITTEXT, ETS_NORMAL, &ncsParam->rgrc[0], &rcClient) == S_OK) { + if (GetThemeBackgroundContentRect(hTheme, hdc, EP_EDITTEXT, ETS_NORMAL, &ncsParam->rgrc[0], &rcClient) == S_OK) { ru->rect.left = rcClient.left-ncsParam->rgrc[0].left; ru->rect.top = rcClient.top-ncsParam->rgrc[0].top; ru->rect.right = ncsParam->rgrc[0].right-rcClient.right; ru->rect.bottom = ncsParam->rgrc[0].bottom-rcClient.bottom; ncsParam->rgrc[0] = rcClient; - MyCloseThemeData(hTheme); + CloseThemeData(hTheme); ReleaseDC(GetParent(hwnd), hdc); return WVR_REDRAW; } ReleaseDC(GetParent(hwnd), hdc); - MyCloseThemeData(hTheme); + CloseThemeData(hTheme); } } return ret; @@ -247,7 +211,7 @@ static LRESULT CALLBACK RichUtil_Proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM static void RichUtil_ClearUglyBorder(TRichUtil *ru) { - if (mTheme && MyIsThemeActive() && GetWindowLongPtr(ru->hwnd, GWL_EXSTYLE) & WS_EX_CLIENTEDGE) + if (IsThemeActive() && GetWindowLongPtr(ru->hwnd, GWL_EXSTYLE) & WS_EX_CLIENTEDGE) { ru->hasUglyBorder = 1; SetWindowLongPtr(ru->hwnd, GWL_EXSTYLE, GetWindowLongPtr(ru->hwnd, GWL_EXSTYLE) ^ WS_EX_CLIENTEDGE); diff --git a/src/core/stdmsg/stdmsg_10.vcxproj b/src/core/stdmsg/stdmsg_10.vcxproj index 2af55a0b0f..a4a6083d3a 100644 --- a/src/core/stdmsg/stdmsg_10.vcxproj +++ b/src/core/stdmsg/stdmsg_10.vcxproj @@ -90,7 +90,7 @@ ..\..\..\include;..\..\..\include\msapi - comctl32.lib;%(AdditionalDependencies) + comctl32.lib;UxTheme.lib;%(AdditionalDependencies) true true true @@ -122,7 +122,7 @@ ..\..\..\include;..\..\..\include\msapi - comctl32.lib;%(AdditionalDependencies) + comctl32.lib;UxTheme.lib;%(AdditionalDependencies) true true true @@ -158,7 +158,7 @@ false $(IntDir)$(TargetName).lib Windows - comctl32.lib;%(AdditionalDependencies) + comctl32.lib;UxTheme.lib;%(AdditionalDependencies) $(ProfileDir)..\..\..\bin10\lib @@ -182,7 +182,7 @@ ..\..\..\include;..\..\..\include\msapi - comctl32.lib;%(AdditionalDependencies) + comctl32.lib;UxTheme.lib;%(AdditionalDependencies) true false $(IntDir)$(TargetName).lib diff --git a/src/core/stdmsg/stdmsg_11.vcxproj b/src/core/stdmsg/stdmsg_11.vcxproj index 1a3c162747..e43d11c649 100644 --- a/src/core/stdmsg/stdmsg_11.vcxproj +++ b/src/core/stdmsg/stdmsg_11.vcxproj @@ -94,7 +94,7 @@ ..\..\..\include;..\..\..\include\msapi - comctl32.lib;%(AdditionalDependencies) + comctl32.lib;UxTheme.lib;%(AdditionalDependencies) true true true @@ -125,7 +125,7 @@ ..\..\..\include;..\..\..\include\msapi - comctl32.lib;%(AdditionalDependencies) + comctl32.lib;UxTheme.lib;%(AdditionalDependencies) true true true @@ -160,7 +160,7 @@ false $(IntDir)$(TargetName).lib Windows - comctl32.lib;%(AdditionalDependencies) + comctl32.lib;UxTheme.lib;%(AdditionalDependencies) $(ProfileDir)..\..\..\bin11\lib false @@ -185,7 +185,7 @@ ..\..\..\include;..\..\..\include\msapi - comctl32.lib;%(AdditionalDependencies) + comctl32.lib;UxTheme.lib;%(AdditionalDependencies) true false $(IntDir)$(TargetName).lib -- cgit v1.2.3