From e7be294a1f1f545836dd07588be572c8534b6232 Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Sat, 21 Sep 2013 09:38:59 +0000 Subject: using Uxtheme in nicer git-svn-id: http://svn.miranda-ng.org/main/trunk@6146 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Clist_nicer/src/CLCButton.cpp | 16 ++-- plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp | 5 +- plugins/Clist_nicer/src/Docking.cpp | 15 ++-- plugins/Clist_nicer/src/Include/commonheaders.h | 3 - plugins/Clist_nicer/src/Include/config.h | 63 +--------------- plugins/Clist_nicer/src/alphablend.cpp | 40 +++++----- plugins/Clist_nicer/src/clcpaint.cpp | 22 +++--- plugins/Clist_nicer/src/clui.cpp | 57 ++++++--------- plugins/Clist_nicer/src/cluiopts.cpp | 32 +++----- plugins/Clist_nicer/src/config.cpp | 89 +---------------------- plugins/Clist_nicer/src/extBackg.cpp | 6 +- plugins/Clist_nicer/src/viewmodes.cpp | 4 +- 12 files changed, 90 insertions(+), 262 deletions(-) (limited to 'plugins/Clist_nicer/src') diff --git a/plugins/Clist_nicer/src/CLCButton.cpp b/plugins/Clist_nicer/src/CLCButton.cpp index 44762739e6..e706fb7760 100644 --- a/plugins/Clist_nicer/src/CLCButton.cpp +++ b/plugins/Clist_nicer/src/CLCButton.cpp @@ -176,10 +176,10 @@ static void PaintWorker(MButtonExtension *ctl, HDC hdcPaint) RECT rc = rcClient; int state = IsWindowEnabled(ctl->hwnd) ? (ctl->stateId == PBS_NORMAL && ctl->bIsDefault ? PBS_DEFAULTED : ctl->stateId) : PBS_DISABLED; SkinDrawBg(ctl->hwnd, hdcMem); - if (API::pfnIsThemeBackgroundPartiallyTransparent(ctl->hThemeToolbar, TP_BUTTON, TBStateConvert2Flat(state))) { - API::pfnDrawThemeParentBackground(ctl->hwnd, hdcMem, &rc); + if (IsThemeBackgroundPartiallyTransparent(ctl->hThemeToolbar, TP_BUTTON, TBStateConvert2Flat(state))) { + DrawThemeParentBackground(ctl->hwnd, hdcMem, &rc); } - API::pfnDrawThemeBackground(ctl->hThemeToolbar, hdcMem, TP_BUTTON, TBStateConvert2Flat(state), &rc, &rc); + DrawThemeBackground(ctl->hThemeToolbar, hdcMem, TP_BUTTON, TBStateConvert2Flat(state), &rc, &rc); } else { HBRUSH hbr; RECT rc = rcClient; @@ -201,7 +201,7 @@ static void PaintWorker(MButtonExtension *ctl, HDC hdcPaint) if (imgItem) DrawAlpha(hdcMem, &rc, 0, 0, 0, 0, 0, 0, 0, imgItem); if (g_glyphItem) { - API::pfnAlphaBlend(hdcMem, (rc.right - glyphMetrics[2]) / 2, (rc.bottom - glyphMetrics[3]) / 2, + GdiAlphaBlend(hdcMem, (rc.right - glyphMetrics[2]) / 2, (rc.bottom - glyphMetrics[3]) / 2, glyphMetrics[2], glyphMetrics[3], g_glyphItem->hdc, glyphMetrics[0], glyphMetrics[1], glyphMetrics[2], glyphMetrics[3], g_glyphItem->bf); @@ -284,10 +284,10 @@ static void PaintWorker(MButtonExtension *ctl, HDC hdcPaint) ScreenToClient(pcli->hwndContactList, &pt); BitBlt(hdcMem, 0, 0, rcClient.right, rcClient.bottom, cfg::dat.hdcBg, pt.x, pt.y, SRCCOPY); - if (API::pfnIsThemeBackgroundPartiallyTransparent(ctl->hThemeButton, BP_PUSHBUTTON, state)) { - API::pfnDrawThemeParentBackground(ctl->hwnd, hdcMem, &rcClient); + if (IsThemeBackgroundPartiallyTransparent(ctl->hThemeButton, BP_PUSHBUTTON, state)) { + DrawThemeParentBackground(ctl->hwnd, hdcMem, &rcClient); } - API::pfnDrawThemeBackground(ctl->hThemeButton, hdcMem, BP_PUSHBUTTON, state, &rcClient, &rcClient); + DrawThemeBackground(ctl->hThemeButton, hdcMem, BP_PUSHBUTTON, state, &rcClient, &rcClient); } else { UINT uState = DFCS_BUTTONPUSH | ((ctl->stateId == PBS_HOT) ? DFCS_HOT : 0) | ((ctl->stateId == PBS_PRESSED) ? DFCS_PUSHED : 0); if (ctl->bIsDefault && ctl->stateId == PBS_NORMAL) @@ -403,7 +403,7 @@ static LRESULT CALLBACK TSButtonWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR GetObject(ii.hbmColor, sizeof(bm), &bm); if (bm.bmWidth > g_cxsmIcon || bm.bmHeight > g_cysmIcon) { HIMAGELIST hImageList; - hImageList = ImageList_Create(g_cxsmIcon, g_cysmIcon, IsWinVerXPPlus() ? ILC_COLOR32 | ILC_MASK : ILC_COLOR16 | ILC_MASK, 1, 0); + hImageList = ImageList_Create(g_cxsmIcon, g_cysmIcon, ILC_COLOR32 | ILC_MASK, 1, 0); ImageList_AddIcon(hImageList, (HICON) lParam); bct->hIconPrivate = ImageList_GetIcon(hImageList, 0, ILD_NORMAL); ImageList_RemoveAll(hImageList); diff --git a/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp b/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp index 0d9699bd97..ed66938009 100644 --- a/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp +++ b/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp @@ -1,7 +1,4 @@ /* -astyle --force-indent=tab=4 --brackets=linux --indent-switches - --pad=oper --one-line=keep-blocks --unpad=paren - Miranda IM: the free IM client for Microsoft* Windows* Copyright 2000-2003 Miranda ICQ/IM project, @@ -3285,7 +3282,7 @@ void RegisterCLUIFrameClasses() wndclass.lpszClassName = CLUIFrameTitleBarClassName; RegisterClass(&wndclass); - 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_nicer/src/Docking.cpp b/plugins/Clist_nicer/src/Docking.cpp index e821ed4118..98afde8379 100644 --- a/plugins/Clist_nicer/src/Docking.cpp +++ b/plugins/Clist_nicer/src/Docking.cpp @@ -1,5 +1,4 @@ /* - Miranda IM: the free IM client for Microsoft* Windows* Copyright 2000-2003 Miranda ICQ/IM project, @@ -38,15 +37,13 @@ extern RECT cluiPos; static void Docking_GetMonitorRectFromPoint(POINT pt, RECT *rc) { - if ( API::pfnMonitorFromPoint ) { - MONITORINFO monitorInfo; - HMONITOR hMonitor = API::pfnMonitorFromPoint(pt, MONITOR_DEFAULTTONEAREST); // always returns a valid value - monitorInfo.cbSize = sizeof(MONITORINFO); + MONITORINFO monitorInfo; + HMONITOR hMonitor = MonitorFromPoint(pt, MONITOR_DEFAULTTONEAREST); // always returns a valid value + monitorInfo.cbSize = sizeof(MONITORINFO); - if ( API::pfnGetMonitorInfo( hMonitor, &monitorInfo )) { - CopyMemory(rc, &monitorInfo.rcMonitor, sizeof(RECT)); - return; - } + if (GetMonitorInfo(hMonitor, &monitorInfo)) { + CopyMemory(rc, &monitorInfo.rcMonitor, sizeof(RECT)); + return; } // "generic" win95/NT support, also serves as failsafe diff --git a/plugins/Clist_nicer/src/Include/commonheaders.h b/plugins/Clist_nicer/src/Include/commonheaders.h index b18d89fae1..0dbcc52508 100644 --- a/plugins/Clist_nicer/src/Include/commonheaders.h +++ b/plugins/Clist_nicer/src/Include/commonheaders.h @@ -1,7 +1,4 @@ /* - * astyle --force-indent=tab=4 --brackets=linux --indent-switches - * --pad=oper --one-line=keep-blocks --unpad=paren - * * Miranda IM: the free IM client for Microsoft* Windows* * * Copyright 2000-2010 Miranda ICQ/IM project, diff --git a/plugins/Clist_nicer/src/Include/config.h b/plugins/Clist_nicer/src/Include/config.h index c7dd518a25..40412b6bf6 100644 --- a/plugins/Clist_nicer/src/Include/config.h +++ b/plugins/Clist_nicer/src/Include/config.h @@ -1,7 +1,4 @@ /* - * astyle --force-indent=tab=4 --brackets=linux --indent-switches - * --pad=oper --one-line=keep-blocks --unpad=paren - * * Miranda IM: the free IM client for Microsoft* Windows* * * Copyright 2000-2010 Miranda ICQ/IM project, @@ -40,27 +37,6 @@ #define IS_THEMED (API::sysState.isThemed) #define IS_AERO (API::sysState.isAero) -typedef int (__cdecl *pfnDrawAvatar)(HDC hdcOrig, HDC hdcMem, RECT *rc, ClcContact *contact, int y, struct ClcData *dat, int selected, WORD cstatus, int rowHeight); -typedef BOOL (WINAPI *pfnSetLayeredWindowAttributes_t)(HWND, COLORREF, BYTE, DWORD); -typedef BOOL (WINAPI *pfnUpdateLayeredWindow_t)(HWND, HDC, POINT *, SIZE *, HDC, POINT *, COLORREF, BLENDFUNCTION *, DWORD); -typedef HMONITOR (WINAPI *pfnMonitorFromPoint_t)(POINT,DWORD); -typedef HMONITOR (WINAPI *pfnMonitorFromWindow_t)(HWND,DWORD); -typedef BOOL (WINAPI *pfnGetMonitorInfo_t)(HMONITOR,LPMONITORINFO); -typedef BOOL (WINAPI *pfnTrackMouseEvent_t)(LPTRACKMOUSEEVENT); -typedef DWORD (WINAPI *pfnSetLayout_t )(HDC, DWORD); -typedef void (__cdecl *pfnDrawAlpha_t)(HDC hdcwnd, PRECT rc, DWORD basecolor, BYTE alpha, DWORD basecolor2, BOOL transparent, DWORD FLG_GRADIENT, DWORD FLG_CORNER, DWORD BORDERSTYLE, ImageItem *item); -typedef BOOL (WINAPI *pfnAlphaBlend_t)(HDC, int, int, int, int, HDC, int, int, int, int, BLENDFUNCTION); - -typedef BOOL (WINAPI *pfnIsThemeActive_t)(); -typedef HANDLE (WINAPI *pfnOpenThemeData_t)(HWND, LPCWSTR); -typedef UINT (WINAPI *pfnDrawThemeBackground_t)(HANDLE, HDC, int, int, RECT *, RECT *); -typedef UINT (WINAPI *pfnCloseThemeData_t)(HANDLE); -typedef UINT (WINAPI *pfnDrawThemeText_t)(HANDLE, HDC, int, int, LPCWSTR, int, DWORD, DWORD, RECT *); -typedef UINT (WINAPI *pfnDrawThemeTextEx_t)(HANDLE, HDC, int, int, LPCWSTR, int, DWORD, RECT *, const DTTOPTS *); -typedef BOOL (WINAPI *pfnIsThemeBackgroundPartiallyTransparent_t)(HANDLE, int, int); -typedef HRESULT (WINAPI *pfnDrawThemeParentBackground_t)(HWND, HDC, RECT *); -typedef HRESULT (WINAPI *pfnGetThemeBackgroundContentRect_t)(HANDLE, HDC, int, int, const RECT *, const RECT *); -typedef BOOL (WINAPI *pfnEnableThemeDialogTexture_t)(HANDLE, DWORD); typedef HRESULT (WINAPI *pfnDwmExtendFrameIntoClientArea_t)(HWND hwnd, const MARGINS *margins); typedef HRESULT (WINAPI *pfnDwmIsCompositionEnabled_t)(BOOL *); @@ -122,9 +98,6 @@ public: struct TSysConfig { bool isVistaPlus; bool isSevenPlus; - bool isXPPlus; - bool uxThemeValid; - bool isWin2KPlus; }; struct TSysState { @@ -137,7 +110,6 @@ class API { public: static void onInit (); - static void onUnload (); static void updateState (); static void Ex_CopyEditToClipboard (HWND hWnd); @@ -145,39 +117,6 @@ public: static void Ex_Handler (); static int Ex_ShowDialog (EXCEPTION_POINTERS *ep, const char *szFile, int line, TCHAR* szReason, bool fAllowContinue); - - /* - * helpers - */ - - static BOOL SetLayeredWindowAttributes(HWND hWnd, COLORREF clr, BYTE alpha, DWORD dwFlags); - - static pfnSetLayeredWindowAttributes_t pfnSetLayeredWindowAttributes; - static pfnUpdateLayeredWindow_t pfnUpdateLayeredWindow; - static pfnMonitorFromPoint_t pfnMonitorFromPoint; - static pfnMonitorFromWindow_t pfnMonitorFromWindow; - static pfnGetMonitorInfo_t pfnGetMonitorInfo; - static pfnTrackMouseEvent_t pfnTrackMouseEvent; - // static pfnDrawAlpha_t pfnDrawAlpha; - static pfnSetLayout_t pfnSetLayout; - static PGF pfnGradientFill; - static pfnAlphaBlend_t pfnAlphaBlend; - - /* - * uxtheme - */ - - static pfnIsThemeActive_t pfnIsThemeActive; - static pfnOpenThemeData_t pfnOpenThemeData; - static pfnDrawThemeBackground_t pfnDrawThemeBackground; - static pfnCloseThemeData_t pfnCloseThemeData; - static pfnDrawThemeText_t pfnDrawThemeText; - static pfnDrawThemeTextEx_t pfnDrawThemeTextEx; - static pfnIsThemeBackgroundPartiallyTransparent_t pfnIsThemeBackgroundPartiallyTransparent; - static pfnDrawThemeParentBackground_t pfnDrawThemeParentBackground; - static pfnGetThemeBackgroundContentRect_t pfnGetThemeBackgroundContentRect; - static pfnEnableThemeDialogTexture_t pfnEnableThemeDialogTexture; - static pfnDwmExtendFrameIntoClientArea_t pfnDwmExtendFrameIntoClientArea; static pfnDwmIsCompositionEnabled_t pfnDwmIsCompositionEnabled; @@ -192,7 +131,7 @@ public: static int exLine; static bool exAllowContinue; - static HMODULE hUxTheme, hDwm; + static HMODULE hDwm; }; diff --git a/plugins/Clist_nicer/src/alphablend.cpp b/plugins/Clist_nicer/src/alphablend.cpp index ddd40dbc3c..1b93fbf652 100644 --- a/plugins/Clist_nicer/src/alphablend.cpp +++ b/plugins/Clist_nicer/src/alphablend.cpp @@ -188,8 +188,8 @@ void DrawAlpha(HDC hdcwnd, PRECT rc, DWORD basecolor, int alpha, DWORD basecolor return; hbm = CreateCompatibleBitmap(hdcwnd, width, height); hbmOld = reinterpret_cast(SelectObject(hdc, hbm)); - API::pfnGradientFill(hdc, tvtx, 2, &grect, 1, (FLG_GRADIENT & GRADIENT_TB || FLG_GRADIENT & GRADIENT_BT) ? GRADIENT_FILL_RECT_V : GRADIENT_FILL_RECT_H); - API::pfnAlphaBlend(hdcwnd, rc->left, rc->top, width, height, hdc, 0, 0, width, height, bf); + GdiGradientFill(hdc, tvtx, 2, &grect, 1, (FLG_GRADIENT & GRADIENT_TB || FLG_GRADIENT & GRADIENT_BT) ? GRADIENT_FILL_RECT_V : GRADIENT_FILL_RECT_H); + GdiAlphaBlend(hdcwnd, rc->left, rc->top, width, height, hdc, 0, 0, width, height, bf); SelectObject(hdc, hbmOld); DeleteObject(hbm); @@ -200,7 +200,7 @@ void DrawAlpha(HDC hdcwnd, PRECT rc, DWORD basecolor, int alpha, DWORD basecolor tvtx[0].y = rc->top; tvtx[1].x = rc->right; tvtx[1].y = rc->bottom; - API::pfnGradientFill(hdcwnd, tvtx, 2, &grect, 1, (FLG_GRADIENT & GRADIENT_TB || FLG_GRADIENT & GRADIENT_BT) ? GRADIENT_FILL_RECT_V : GRADIENT_FILL_RECT_H); + GdiGradientFill(hdcwnd, tvtx, 2, &grect, 1, (FLG_GRADIENT & GRADIENT_TB || FLG_GRADIENT & GRADIENT_BT) ? GRADIENT_FILL_RECT_V : GRADIENT_FILL_RECT_H); } DrawBorderStyle(hdcwnd, rc, BORDERSTYLE); //_DebugPopup(0, "using gradient fill"); @@ -283,7 +283,7 @@ void DrawAlpha(HDC hdcwnd, PRECT rc, DWORD basecolor, int alpha, DWORD basecolor bf.SourceConstantAlpha = (UCHAR) (basecolor >> 24); bf.AlphaFormat = AC_SRC_ALPHA; // so it will use our specified alpha value - API::pfnAlphaBlend(hdcwnd, rc->left + realHeightHalf, rc->top, (realWidth - realHeightHalf * 2), realHeight, hdc, 0, 0, ulBitmapWidth, ulBitmapHeight, bf); + GdiAlphaBlend(hdcwnd, rc->left + realHeightHalf, rc->top, (realWidth - realHeightHalf * 2), realHeight, hdc, 0, 0, ulBitmapWidth, ulBitmapHeight, bf); SelectObject(hdc, holdbitmap); DeleteObject(hbitmap); @@ -339,7 +339,7 @@ void DrawAlpha(HDC hdcwnd, PRECT rc, DWORD basecolor, int alpha, DWORD basecolor } } } - API::pfnAlphaBlend(hdcwnd, rc->left, rc->top, ulBitmapWidth, ulBitmapHeight, hdc, 0, 0, ulBitmapWidth, ulBitmapHeight, bf); + GdiAlphaBlend(hdcwnd, rc->left, rc->top, ulBitmapWidth, ulBitmapHeight, hdc, 0, 0, ulBitmapWidth, ulBitmapHeight, bf); SelectObject(hdc, holdbitmap); DeleteObject(hbitmap); @@ -375,7 +375,7 @@ void DrawAlpha(HDC hdcwnd, PRECT rc, DWORD basecolor, int alpha, DWORD basecolor } } } - API::pfnAlphaBlend(hdcwnd, rc->right - realHeightHalf, rc->top, ulBitmapWidth, ulBitmapHeight, hdc, 0, 0, ulBitmapWidth, ulBitmapHeight, bf); + GdiAlphaBlend(hdcwnd, rc->right - realHeightHalf, rc->top, ulBitmapWidth, ulBitmapHeight, hdc, 0, 0, ulBitmapWidth, ulBitmapHeight, bf); } DrawBorderStyle(hdcwnd, rc, BORDERSTYLE); @@ -458,13 +458,13 @@ void __fastcall IMG_RenderImageItem(HDC hdc, ImageItem *item, RECT *rc) if (item->dwFlags & IMAGE_FLAG_DIVIDED) { // top 3 items - API::pfnAlphaBlend(hdc, rc->left, rc->top, l, t, hdcSrc, srcOrigX, srcOrigY, l, t, item->bf); - API::pfnAlphaBlend(hdc, rc->left + l, rc->top, width - l - r, t, hdcSrc, srcOrigX + l, srcOrigY, item->inner_width, t, item->bf); - API::pfnAlphaBlend(hdc, rc->right - r, rc->top, r, t, hdcSrc, srcOrigX + (item->width - r), srcOrigY, r, t, item->bf); + GdiAlphaBlend(hdc, rc->left, rc->top, l, t, hdcSrc, srcOrigX, srcOrigY, l, t, item->bf); + GdiAlphaBlend(hdc, rc->left + l, rc->top, width - l - r, t, hdcSrc, srcOrigX + l, srcOrigY, item->inner_width, t, item->bf); + GdiAlphaBlend(hdc, rc->right - r, rc->top, r, t, hdcSrc, srcOrigX + (item->width - r), srcOrigY, r, t, item->bf); // middle 3 items - API::pfnAlphaBlend(hdc, rc->left, rc->top + t, l, height - t - b, hdcSrc, srcOrigX, srcOrigY + t, l, item->inner_height, item->bf); + GdiAlphaBlend(hdc, rc->left, rc->top + t, l, height - t - b, hdcSrc, srcOrigX, srcOrigY + t, l, item->inner_height, item->bf); if (item->dwFlags & IMAGE_FILLSOLID && item->fillBrush) { RECT rcFill; @@ -473,15 +473,15 @@ void __fastcall IMG_RenderImageItem(HDC hdc, ImageItem *item, RECT *rc) FillRect(hdc, &rcFill, item->fillBrush); } else - API::pfnAlphaBlend(hdc, rc->left + l, rc->top + t, width - l - r, height - t - b, hdcSrc, srcOrigX + l, srcOrigY + t, item->inner_width, item->inner_height, item->bf); + GdiAlphaBlend(hdc, rc->left + l, rc->top + t, width - l - r, height - t - b, hdcSrc, srcOrigX + l, srcOrigY + t, item->inner_width, item->inner_height, item->bf); - API::pfnAlphaBlend(hdc, rc->right - r, rc->top + t, r, height - t - b, hdcSrc, srcOrigX + (item->width - r), srcOrigY + t, r, item->inner_height, item->bf); + GdiAlphaBlend(hdc, rc->right - r, rc->top + t, r, height - t - b, hdcSrc, srcOrigX + (item->width - r), srcOrigY + t, r, item->inner_height, item->bf); // bottom 3 items - API::pfnAlphaBlend(hdc, rc->left, rc->bottom - b, l, b, hdcSrc, srcOrigX, srcOrigY + (item->height - b), l, b, item->bf); - API::pfnAlphaBlend(hdc, rc->left + l, rc->bottom - b, width - l - r, b, hdcSrc, srcOrigX + l, srcOrigY + (item->height - b), item->inner_width, b, item->bf); - API::pfnAlphaBlend(hdc, rc->right - r, rc->bottom - b, r, b, hdcSrc, srcOrigX + (item->width - r), srcOrigY + (item->height - b), r, b, item->bf); + GdiAlphaBlend(hdc, rc->left, rc->bottom - b, l, b, hdcSrc, srcOrigX, srcOrigY + (item->height - b), l, b, item->bf); + GdiAlphaBlend(hdc, rc->left + l, rc->bottom - b, width - l - r, b, hdcSrc, srcOrigX + l, srcOrigY + (item->height - b), item->inner_width, b, item->bf); + GdiAlphaBlend(hdc, rc->right - r, rc->bottom - b, r, b, hdcSrc, srcOrigX + (item->width - r), srcOrigY + (item->height - b), r, b, item->bf); } else { switch(item->bStretch) { @@ -492,11 +492,11 @@ void __fastcall IMG_RenderImageItem(HDC hdc, ImageItem *item, RECT *rc) do { if (top + item->height <= rc->bottom) { - API::pfnAlphaBlend(hdc, rc->left, top, width, item->height, hdcSrc, srcOrigX, srcOrigY, item->width, item->height, item->bf); + GdiAlphaBlend(hdc, rc->left, top, width, item->height, hdcSrc, srcOrigX, srcOrigY, item->width, item->height, item->bf); top += item->height; } else { - API::pfnAlphaBlend(hdc, rc->left, top, width, rc->bottom - top, hdcSrc, srcOrigX, srcOrigY, item->width, rc->bottom - top, item->bf); + GdiAlphaBlend(hdc, rc->left, top, width, rc->bottom - top, hdcSrc, srcOrigX, srcOrigY, item->width, rc->bottom - top, item->bf); break; } } while (TRUE); @@ -509,11 +509,11 @@ void __fastcall IMG_RenderImageItem(HDC hdc, ImageItem *item, RECT *rc) do { if (left + item->width <= rc->right) { - API::pfnAlphaBlend(hdc, left, rc->top, item->width, height, hdcSrc, srcOrigX, srcOrigY, item->width, item->height, item->bf); + GdiAlphaBlend(hdc, left, rc->top, item->width, height, hdcSrc, srcOrigX, srcOrigY, item->width, item->height, item->bf); left += item->width; } else { - API::pfnAlphaBlend(hdc, left, rc->top, rc->right - left, height, hdcSrc, srcOrigX, srcOrigY, rc->right - left, item->height, item->bf); + GdiAlphaBlend(hdc, left, rc->top, rc->right - left, height, hdcSrc, srcOrigX, srcOrigY, rc->right - left, item->height, item->bf); break; } } while (TRUE); @@ -521,7 +521,7 @@ void __fastcall IMG_RenderImageItem(HDC hdc, ImageItem *item, RECT *rc) } case IMAGE_STRETCH_B: // stretch the image in both directions... - API::pfnAlphaBlend(hdc, rc->left, rc->top, width, height, hdcSrc, srcOrigX, srcOrigY, item->width, item->height, item->bf); + GdiAlphaBlend(hdc, rc->left, rc->top, width, height, hdcSrc, srcOrigX, srcOrigY, item->width, item->height, item->bf); break; /* case IMAGE_STRETCH_V: diff --git a/plugins/Clist_nicer/src/clcpaint.cpp b/plugins/Clist_nicer/src/clcpaint.cpp index 5c2913e44f..8be64075d9 100644 --- a/plugins/Clist_nicer/src/clcpaint.cpp +++ b/plugins/Clist_nicer/src/clcpaint.cpp @@ -338,7 +338,7 @@ static int __fastcall DrawAvatar(HDC hdcMem, RECT *rc, ClcContact *contact, int else { SetStretchBltMode(hdcTempAV, HALFTONE); StretchBlt(hdcTempAV, 0, 0, bmWidth, bmHeight, hdcMem, leftoffset + rc->left, y + topoffset, (int)newWidth, (int)newHeight, SRCCOPY); - API::pfnAlphaBlend(hdcTempAV, 0, 0, bmWidth, bmHeight, hdcAvatar, 0, 0, bmWidth, bmHeight, bf); + GdiAlphaBlend(hdcTempAV, 0, 0, bmWidth, bmHeight, hdcAvatar, 0, 0, bmWidth, bmHeight, bf); StretchBlt(hdcMem, leftoffset + rc->left - (g_RTL ? 1 : 0), y + topoffset, (int)newWidth, (int)newHeight, hdcTempAV, 0, 0, bmWidth, bmHeight, SRCCOPY); } SelectObject(hdcAV, hbmOldAV); @@ -382,10 +382,10 @@ static int __fastcall DrawAvatar(HDC hdcMem, RECT *rc, ClcContact *contact, int hdcTemp = CreateCompatibleDC(g_HDC); hbmTemp = CreateCompatibleBitmap(g_HDC, rcTemp.right, rcTemp.bottom); hbmOld = reinterpret_cast(SelectObject(hdcTemp, hbmTemp)); - API::pfnSetLayout(hdcTemp, LAYOUT_RTL); + SetLayout(hdcTemp, LAYOUT_RTL); BitBlt(hdcTemp, 0, 0, rcTemp.right, rcTemp.bottom, hdcMem, rcFrame.left, rcFrame.top, SRCCOPY); - API::pfnSetLayout(hdcTemp, 0); + SetLayout(hdcTemp, 0); DrawAlpha(hdcTemp, &rcTemp, item->COLOR, item->ALPHA, item->COLOR2, item->COLOR2_TRANSPARENT, item->GRADIENT, item->CORNER, item->BORDERSTYLE, item->imageItem); BitBlt(hdcMem, rcFrame.left, rcFrame.top, rcFrame.right - rcFrame.left, rcFrame.bottom - rcFrame.top, @@ -462,7 +462,7 @@ void __inline PaintItem(HDC hdcMem, ClcGroup *group, ClcContact *contact, int in goto set_bg_l; if (type == CLCIT_CONTACT && (cEntry->dwCFlags & ECF_RTLNICK || mirror_always)) { - if (API::pfnSetLayout != NULL && (mirror_rtl || mirror_always)) { + if (mirror_rtl || mirror_always) { g_RTL = TRUE; bg_indent_r = cfg::dat.bApplyIndentToBg ? indent * dat->groupIndent : 0; } @@ -472,7 +472,7 @@ void __inline PaintItem(HDC hdcMem, ClcGroup *group, ClcContact *contact, int in } else bg_indent_l = cfg::dat.bApplyIndentToBg ? indent * dat->groupIndent : 0; } - else if (type == CLCIT_GROUP && API::pfnSetLayout != NULL) { + else if (type == CLCIT_GROUP) { if ((contact->isRtl && cfg::dat.bGroupAlign == CLC_GROUPALIGN_AUTO) || cfg::dat.bGroupAlign == CLC_GROUPALIGN_RIGHT) { g_RTL = TRUE; bg_indent_r = cfg::dat.bApplyIndentToBg ? indent * dat->groupIndent : 0; @@ -852,7 +852,7 @@ set_bg_l: } if (g_RTL) - API::pfnSetLayout(hdcMem, LAYOUT_RTL | LAYOUT_BITMAPORIENTATIONPRESERVED); + SetLayout(hdcMem, LAYOUT_RTL | LAYOUT_BITMAPORIENTATIONPRESERVED); bgskipped: rcContent.top = y + g_padding_y; @@ -867,7 +867,7 @@ bgskipped: if (checkboxWidth) { HANDLE hTheme = 0; if (IS_THEMED) - hTheme = API::pfnOpenThemeData(hwnd, L"BUTTON"); + hTheme = OpenThemeData(hwnd, L"BUTTON"); RECT rc; rc.left = leftX; @@ -875,8 +875,8 @@ bgskipped: rc.top = y + ((rowHeight - dat->checkboxSize) >> 1); rc.bottom = rc.top + dat->checkboxSize; if (hTheme) { - API::pfnDrawThemeBackground(hTheme, hdcMem, BP_CHECKBOX, flags & CONTACTF_CHECKED ? (g_hottrack ? CBS_CHECKEDHOT : CBS_CHECKEDNORMAL) : (g_hottrack ? CBS_UNCHECKEDHOT : CBS_UNCHECKEDNORMAL), &rc, &rc); - API::pfnCloseThemeData(hTheme); + DrawThemeBackground(hTheme, hdcMem, BP_CHECKBOX, flags & CONTACTF_CHECKED ? (g_hottrack ? CBS_CHECKEDHOT : CBS_CHECKEDNORMAL) : (g_hottrack ? CBS_UNCHECKEDHOT : CBS_UNCHECKEDNORMAL), &rc, &rc); + CloseThemeData(hTheme); hTheme = 0; } else DrawFrameControl(hdcMem, &rc, DFC_BUTTON, DFCS_BUTTONCHECK | DFCS_FLAT | (flags & CONTACTF_CHECKED ? DFCS_CHECKED : 0) | (g_hottrack ? DFCS_HOT : 0)); @@ -1258,7 +1258,7 @@ nodisplay: } if (g_RTL) - API::pfnSetLayout(hdcMem, 0); + SetLayout(hdcMem, 0); } void SkinDrawBg(HWND hwnd, HDC hdc) @@ -1301,7 +1301,7 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT *rcPaint) GetSystemTime(&cfg::dat.st); SystemTimeToFileTime(&cfg::dat.st, &cfg::dat.ft); - cfg::dat.bUseFastGradients = cfg::dat.bWantFastGradients && (API::pfnGradientFill != 0); + cfg::dat.bUseFastGradients = cfg::dat.bWantFastGradients && (GdiGradientFill != 0); av_left = (cfg::dat.dwFlags & CLUI_FRAME_AVATARSLEFT); av_right = (cfg::dat.dwFlags & CLUI_FRAME_AVATARSRIGHT); diff --git a/plugins/Clist_nicer/src/clui.cpp b/plugins/Clist_nicer/src/clui.cpp index 41df2be7b2..e813455b89 100644 --- a/plugins/Clist_nicer/src/clui.cpp +++ b/plugins/Clist_nicer/src/clui.cpp @@ -1,7 +1,4 @@ /* - * astyle --force-indent=tab=4 --brackets=linux --indent-switches - * --pad=oper --one-line=keep-blocks --unpad=paren - * * Miranda IM: the free IM client for Microsoft* Windows* * * Copyright 2000-2010 Miranda ICQ/IM project, @@ -131,7 +128,7 @@ HWND hTbMenu, hTbGlobalStatus; static void Tweak_It(COLORREF clr) { SetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE, GetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE) | WS_EX_LAYERED); - API::pfnSetLayeredWindowAttributes(pcli->hwndContactList, clr, 0, LWA_COLORKEY); + SetLayeredWindowAttributes(pcli->hwndContactList, clr, 0, LWA_COLORKEY); cfg::dat.colorkey = clr; } @@ -602,14 +599,11 @@ static void sttProcessResize(HWND hwnd, NMCLISTCONTROL *nmc) winstyle = GetWindowLongPtr(pcli->hwndContactTree, GWL_STYLE); SystemParametersInfo(SPI_GETWORKAREA, 0, &rcWorkArea, FALSE); - if (API::pfnMonitorFromWindow) - { - HMONITOR hMon = API::pfnMonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST); - MONITORINFO mi; - mi.cbSize = sizeof(mi); - if (API::pfnGetMonitorInfo(hMon, &mi)) - rcWorkArea = mi.rcWork; - } + HMONITOR hMon = MonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST); + MONITORINFO mi; + mi.cbSize = sizeof(mi); + if (GetMonitorInfo(hMon, &mi)) + rcWorkArea = mi.rcWork; if (nmc->pt.y > (rcWorkArea.bottom - rcWorkArea.top)) { nmc->pt.y = (rcWorkArea.bottom - rcWorkArea.top); @@ -813,12 +807,12 @@ LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l //delay creation of CLC so that it can get the status icons right the first time (needs protocol modules loaded) if (cfg::dat.bLayeredHack) { SetWindowLongPtr(hwnd, GWL_EXSTYLE, GetWindowLongPtr(hwnd, GWL_EXSTYLE) | (WS_EX_LAYERED)); - API::SetLayeredWindowAttributes(hwnd, RGB(0, 0, 0), 255, LWA_ALPHA); + SetLayeredWindowAttributes(hwnd, RGB(0, 0, 0), 255, LWA_ALPHA); } if (cfg::dat.isTransparent) { SetWindowLongPtr(hwnd, GWL_EXSTYLE, GetWindowLongPtr(hwnd, GWL_EXSTYLE) | WS_EX_LAYERED); - API::SetLayeredWindowAttributes(hwnd, cfg::dat.bFullTransparent ? cfg::dat.colorkey : RGB(0, 0, 0), cfg::dat.alpha, LWA_ALPHA | (cfg::dat.bFullTransparent ? LWA_COLORKEY : 0)); + SetLayeredWindowAttributes(hwnd, cfg::dat.bFullTransparent ? cfg::dat.colorkey : RGB(0, 0, 0), cfg::dat.alpha, LWA_ALPHA | (cfg::dat.bFullTransparent ? LWA_COLORKEY : 0)); } transparentFocus = 1; @@ -870,7 +864,7 @@ LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l CreateCLC(hwnd); cfg::clcdat = (struct ClcData *)GetWindowLongPtr(pcli->hwndContactTree, 0); - if (API::sysConfig.isWin2KPlus && cfg::dat.bFullTransparent) { + if (cfg::dat.bFullTransparent) { if (g_CLUISkinnedBkColorRGB) Tweak_It(g_CLUISkinnedBkColorRGB); else if (cfg::dat.bClipBorder || (cfg::dat.dwFlags & CLUI_FRAME_ROUNDEDFRAME)) @@ -923,14 +917,11 @@ LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l RECT rcWorkArea; SystemParametersInfo(SPI_GETWORKAREA, 0, &rcWorkArea, FALSE); - if (API::pfnMonitorFromWindow) - { - HMONITOR hMon = API::pfnMonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST); - MONITORINFO mi; - mi.cbSize = sizeof(mi); - if (API::pfnGetMonitorInfo(hMon, &mi)) - rcWorkArea = mi.rcWork; - } + HMONITOR hMon = MonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST); + MONITORINFO mi; + mi.cbSize = sizeof(mi); + if (GetMonitorInfo(hMon, &mi)) + rcWorkArea = mi.rcWork; cfg::dat.dcSize.cy = max(rc.bottom + cfg::dat.statusBarHeight, rcWorkArea.bottom - rcWorkArea.top); cfg::dat.dcSize.cx = max(rc.right, (rcWorkArea.right - rcWorkArea.left) / 2); @@ -1174,7 +1165,7 @@ skipbg: } else { if (cfg::dat.isTransparent) { KillTimer(hwnd, TM_AUTOALPHA); - API::SetLayeredWindowAttributes(hwnd, cfg::dat.bFullTransparent ? cfg::dat.colorkey : RGB(0, 0, 0), cfg::dat.alpha, LWA_ALPHA | (cfg::dat.bFullTransparent ? LWA_COLORKEY : 0)); + SetLayeredWindowAttributes(hwnd, cfg::dat.bFullTransparent ? cfg::dat.colorkey : RGB(0, 0, 0), cfg::dat.alpha, LWA_ALPHA | (cfg::dat.bFullTransparent ? LWA_COLORKEY : 0)); transparentFocus = 1; } SetWindowPos(pcli->hwndContactList, cfg::getByte("CList", "OnTop", SETTING_ONTOP_DEFAULT) ? HWND_TOPMOST : HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOREDRAW | SWP_NOSENDCHANGING); @@ -1185,7 +1176,7 @@ skipbg: case WM_SETCURSOR: if (cfg::dat.isTransparent) { if ( !transparentFocus && GetForegroundWindow() != hwnd) { - API::SetLayeredWindowAttributes(hwnd, cfg::dat.bFullTransparent ? cfg::dat.colorkey : RGB(0, 0, 0), cfg::dat.alpha, LWA_ALPHA | (cfg::dat.bFullTransparent ? LWA_COLORKEY : 0)); + SetLayeredWindowAttributes(hwnd, cfg::dat.bFullTransparent ? cfg::dat.colorkey : RGB(0, 0, 0), cfg::dat.alpha, LWA_ALPHA | (cfg::dat.bFullTransparent ? LWA_COLORKEY : 0)); transparentFocus = 1; SetTimer(hwnd, TM_AUTOALPHA, 250, NULL); } @@ -1248,9 +1239,9 @@ skipbg: //change transparentFocus = inwnd; if (transparentFocus) - API::SetLayeredWindowAttributes(hwnd, cfg::dat.bFullTransparent ? cfg::dat.colorkey : RGB(0, 0, 0), cfg::dat.alpha, LWA_ALPHA | (cfg::dat.bFullTransparent ? LWA_COLORKEY : 0)); + SetLayeredWindowAttributes(hwnd, cfg::dat.bFullTransparent ? cfg::dat.colorkey : RGB(0, 0, 0), cfg::dat.alpha, LWA_ALPHA | (cfg::dat.bFullTransparent ? LWA_COLORKEY : 0)); else - API::SetLayeredWindowAttributes(hwnd, cfg::dat.bFullTransparent ? cfg::dat.colorkey : RGB(0, 0, 0), cfg::dat.autoalpha, LWA_ALPHA | (cfg::dat.bFullTransparent ? LWA_COLORKEY : 0)); + SetLayeredWindowAttributes(hwnd, cfg::dat.bFullTransparent ? cfg::dat.colorkey : RGB(0, 0, 0), cfg::dat.autoalpha, LWA_ALPHA | (cfg::dat.bFullTransparent ? LWA_COLORKEY : 0)); } if ( !transparentFocus) KillTimer(hwnd, TM_AUTOALPHA); @@ -1271,11 +1262,11 @@ skipbg: if (cfg::dat.forceResize && wParam != SW_HIDE) { cfg::dat.forceResize = FALSE; if (0) { //!g_CluiData.fadeinout && MySetLayeredWindowAttributes && g_CluiData.bLayeredHack) { - API::SetLayeredWindowAttributes(hwnd, cfg::dat.bFullTransparent ? cfg::dat.colorkey : RGB(0, 0, 0), 0, LWA_ALPHA | (cfg::dat.bFullTransparent ? LWA_COLORKEY : 0)); + SetLayeredWindowAttributes(hwnd, cfg::dat.bFullTransparent ? cfg::dat.colorkey : RGB(0, 0, 0), 0, LWA_ALPHA | (cfg::dat.bFullTransparent ? LWA_COLORKEY : 0)); SendMessage(hwnd, WM_SIZE, 0, 0); ShowWindow(hwnd, SW_SHOW); RedrawWindow(hwnd, NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ALLCHILDREN); - API::SetLayeredWindowAttributes(hwnd, cfg::dat.bFullTransparent ? cfg::dat.colorkey : RGB(0, 0, 0), 255, LWA_ALPHA | (cfg::dat.bFullTransparent ? LWA_COLORKEY : 0)); + SetLayeredWindowAttributes(hwnd, cfg::dat.bFullTransparent ? cfg::dat.colorkey : RGB(0, 0, 0), 255, LWA_ALPHA | (cfg::dat.bFullTransparent ? LWA_COLORKEY : 0)); } else { SendMessage(hwnd, WM_SIZE, 0, 0); PostMessage(hwnd, CLUIINTM_REDRAW, 0, 0); @@ -1295,7 +1286,7 @@ skipbg: if (wParam) { sourceAlpha = 0; destAlpha = cfg::dat.isTransparent ? cfg::dat.alpha : 255; - API::SetLayeredWindowAttributes(hwnd, cfg::dat.bFullTransparent ? (COLORREF)cfg::dat.colorkey : RGB(0, 0, 0), (BYTE)sourceAlpha, LWA_ALPHA | (cfg::dat.bFullTransparent ? LWA_COLORKEY : 0)); + SetLayeredWindowAttributes(hwnd, cfg::dat.bFullTransparent ? (COLORREF)cfg::dat.colorkey : RGB(0, 0, 0), (BYTE)sourceAlpha, LWA_ALPHA | (cfg::dat.bFullTransparent ? LWA_COLORKEY : 0)); noRecurse = 1; ShowWindow(hwnd, SW_SHOW); RedrawWindow(hwnd, NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ALLCHILDREN); @@ -1307,13 +1298,13 @@ skipbg: for (startTick = GetTickCount(); ;) { thisTick = GetTickCount(); if (thisTick >= startTick + 200) { - API::SetLayeredWindowAttributes(hwnd, cfg::dat.bFullTransparent ? cfg::dat.colorkey : RGB(0, 0, 0), (BYTE)(destAlpha), LWA_ALPHA | (cfg::dat.bFullTransparent ? LWA_COLORKEY : 0)); + SetLayeredWindowAttributes(hwnd, cfg::dat.bFullTransparent ? cfg::dat.colorkey : RGB(0, 0, 0), (BYTE)(destAlpha), LWA_ALPHA | (cfg::dat.bFullTransparent ? LWA_COLORKEY : 0)); g_fading_active = 0; return DefWindowProc(hwnd, msg, wParam, lParam); } - API::SetLayeredWindowAttributes(hwnd, cfg::dat.bFullTransparent ? cfg::dat.colorkey : RGB(0, 0, 0), (BYTE)(sourceAlpha + (destAlpha - sourceAlpha) * (int)(thisTick - startTick) / 200), LWA_ALPHA | (cfg::dat.bFullTransparent ? LWA_COLORKEY : 0)); + SetLayeredWindowAttributes(hwnd, cfg::dat.bFullTransparent ? cfg::dat.colorkey : RGB(0, 0, 0), (BYTE)(sourceAlpha + (destAlpha - sourceAlpha) * (int)(thisTick - startTick) / 200), LWA_ALPHA | (cfg::dat.bFullTransparent ? LWA_COLORKEY : 0)); } - API::SetLayeredWindowAttributes(hwnd, cfg::dat.bFullTransparent ? cfg::dat.colorkey : RGB(0, 0, 0), (BYTE)(destAlpha), LWA_ALPHA | (cfg::dat.bFullTransparent ? LWA_COLORKEY : 0)); + SetLayeredWindowAttributes(hwnd, cfg::dat.bFullTransparent ? cfg::dat.colorkey : RGB(0, 0, 0), (BYTE)(destAlpha), LWA_ALPHA | (cfg::dat.bFullTransparent ? LWA_COLORKEY : 0)); } return DefWindowProc(hwnd, msg, wParam, lParam); diff --git a/plugins/Clist_nicer/src/cluiopts.cpp b/plugins/Clist_nicer/src/cluiopts.cpp index 1efd0b020e..b49b5e36e2 100644 --- a/plugins/Clist_nicer/src/cluiopts.cpp +++ b/plugins/Clist_nicer/src/cluiopts.cpp @@ -1,5 +1,4 @@ /* - Miranda IM: the free IM client for Microsoft* Windows* Copyright 2000-2003 Miranda ICQ/IM project, @@ -98,16 +97,9 @@ INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l SetDlgItemTextA(hwndDlg, IDC_TITLETEXT, MIRANDANAME); } - if ( !API::sysConfig.isWin2KPlus) { - Utils::enableDlgControl(hwndDlg, IDC_FADEINOUT, FALSE); - Utils::enableDlgControl(hwndDlg, IDC_TRANSPARENT, FALSE); - Utils::enableDlgControl(hwndDlg, IDC_DROPSHADOW, FALSE); - Utils::enableDlgControl(hwndDlg, IDC_FULLTRANSPARENT, FALSE); - } - else { - CheckDlgButton(hwndDlg, IDC_TRANSPARENT, cfg::dat.isTransparent ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_FULLTRANSPARENT, cfg::dat.bFullTransparent ? BST_CHECKED : BST_UNCHECKED); - } + CheckDlgButton(hwndDlg, IDC_TRANSPARENT, cfg::dat.isTransparent ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_FULLTRANSPARENT, cfg::dat.bFullTransparent ? BST_CHECKED : BST_UNCHECKED); + if ( !IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENT)) { Utils::enableDlgControl(hwndDlg, IDC_STATIC11, FALSE); Utils::enableDlgControl(hwndDlg, IDC_STATIC12, FALSE); @@ -300,17 +292,15 @@ INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l cfg::dat.colorkey = RGB(255, 0, 255); } if (cfg::dat.isTransparent || cfg::dat.bFullTransparent) { - if (API::sysConfig.isWin2KPlus) { - SetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE, GetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE) & ~WS_EX_LAYERED); - SetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE, GetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE) | WS_EX_LAYERED); - API::SetLayeredWindowAttributes(pcli->hwndContactList, 0, 255, LWA_ALPHA | LWA_COLORKEY); - API::SetLayeredWindowAttributes(pcli->hwndContactList, - (COLORREF)(cfg::dat.bFullTransparent ? cfg::dat.colorkey : 0), - (BYTE)(cfg::dat.isTransparent ? cfg::dat.autoalpha : 255), - (DWORD)((cfg::dat.isTransparent ? LWA_ALPHA : 0L) | (cfg::dat.bFullTransparent ? LWA_COLORKEY : 0L))); - } + SetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE, GetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE) & ~WS_EX_LAYERED); + SetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE, GetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE) | WS_EX_LAYERED); + SetLayeredWindowAttributes(pcli->hwndContactList, 0, 255, LWA_ALPHA | LWA_COLORKEY); + SetLayeredWindowAttributes(pcli->hwndContactList, + (COLORREF)(cfg::dat.bFullTransparent ? cfg::dat.colorkey : 0), + (BYTE)(cfg::dat.isTransparent ? cfg::dat.autoalpha : 255), + (DWORD)((cfg::dat.isTransparent ? LWA_ALPHA : 0L) | (cfg::dat.bFullTransparent ? LWA_COLORKEY : 0L))); } else { - API::SetLayeredWindowAttributes(pcli->hwndContactList, RGB(0, 0, 0), (BYTE)255, LWA_ALPHA); + SetLayeredWindowAttributes(pcli->hwndContactList, RGB(0, 0, 0), (BYTE)255, LWA_ALPHA); if ( !cfg::dat.bLayeredHack) SetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE, GetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE) & ~WS_EX_LAYERED); } diff --git a/plugins/Clist_nicer/src/config.cpp b/plugins/Clist_nicer/src/config.cpp index 7707923fbd..95f9926747 100644 --- a/plugins/Clist_nicer/src/config.cpp +++ b/plugins/Clist_nicer/src/config.cpp @@ -1,7 +1,4 @@ /* - * astyle --force-indent=tab=4 --brackets=linux --indent-switches - * --pad=oper --one-line=keep-blocks --unpad=paren - * * Miranda IM: the free IM client for Microsoft* Windows* * * Copyright 2000-2010 Miranda ICQ/IM project, @@ -40,31 +37,9 @@ LIST cfg::arCache(100, LIST::FTSortFunc(HandleKeySortT bool cfg::shutDown = false; -pfnSetLayeredWindowAttributes_t API::pfnSetLayeredWindowAttributes = 0; -pfnUpdateLayeredWindow_t API::pfnUpdateLayeredWindow = 0; -pfnMonitorFromPoint_t API::pfnMonitorFromPoint = 0; -pfnMonitorFromWindow_t API::pfnMonitorFromWindow = 0; -pfnGetMonitorInfo_t API::pfnGetMonitorInfo = 0; -pfnTrackMouseEvent_t API::pfnTrackMouseEvent = 0; -//pfnDrawAlpha_t API::pfnDrawAlpha = 0; -PGF API::pfnGradientFill = 0; -pfnSetLayout_t API::pfnSetLayout = 0; -pfnAlphaBlend_t API::pfnAlphaBlend = 0; - TSysConfig API::sysConfig = {0}; TSysState API::sysState = {0}; -pfnIsThemeActive_t API::pfnIsThemeActive = 0; -pfnOpenThemeData_t API::pfnOpenThemeData = 0; -pfnDrawThemeBackground_t API::pfnDrawThemeBackground = 0; -pfnCloseThemeData_t API::pfnCloseThemeData = 0; -pfnDrawThemeText_t API::pfnDrawThemeText = 0; -pfnDrawThemeTextEx_t API::pfnDrawThemeTextEx = 0; -pfnIsThemeBackgroundPartiallyTransparent_t API::pfnIsThemeBackgroundPartiallyTransparent = 0; -pfnDrawThemeParentBackground_t API::pfnDrawThemeParentBackground = 0; -pfnGetThemeBackgroundContentRect_t API::pfnGetThemeBackgroundContentRect = 0; -pfnEnableThemeDialogTexture_t API::pfnEnableThemeDialogTexture = 0; - pfnDwmExtendFrameIntoClientArea_t API::pfnDwmExtendFrameIntoClientArea = 0; pfnDwmIsCompositionEnabled_t API::pfnDwmIsCompositionEnabled = 0; @@ -75,7 +50,7 @@ char API::exSzFile[MAX_PATH] = ""; TCHAR API::exReason[256] = _T(""); int API::exLine = 0; bool API::exAllowContinue = false; -HMODULE API::hUxTheme = 0, API::hDwm = 0; +HMODULE API::hDwm = 0; void cfg::init() { @@ -252,52 +227,9 @@ void CSH_Destroy() void API::onInit() { - HMODULE hUserDll = 0; - - pfnSetLayout = (DWORD ( WINAPI *)(HDC, DWORD))GetProcAddress( GetModuleHandleA( "GDI32.DLL" ), "SetLayout" ); - - hUserDll = GetModuleHandleA("user32.dll"); - if (hUserDll) { - pfnMonitorFromPoint = ( pfnMonitorFromPoint_t )GetProcAddress(hUserDll, "MonitorFromPoint"); - pfnMonitorFromWindow = ( pfnMonitorFromWindow_t )GetProcAddress(hUserDll, "MonitorFromWindow"); - pfnGetMonitorInfo = ( pfnGetMonitorInfo_t )GetProcAddress(hUserDll, "GetMonitorInfoA"); - pfnSetLayeredWindowAttributes = ( pfnSetLayeredWindowAttributes_t )GetProcAddress(hUserDll, "SetLayeredWindowAttributes"); - pfnUpdateLayeredWindow = ( pfnUpdateLayeredWindow_t )GetProcAddress(hUserDll, "UpdateLayeredWindow"); - pfnTrackMouseEvent = ( pfnTrackMouseEvent_t )GetProcAddress(hUserDll, "TrackMouseEvent"); - } - - pfnAlphaBlend = (pfnAlphaBlend_t) GetProcAddress(GetModuleHandleA("gdi32"), "GdiAlphaBlend"); - pfnGradientFill = (PGF) GetProcAddress(GetModuleHandleA("gdi32"), "GdiGradientFill"); - if (0 == pfnAlphaBlend) { - HMODULE hMsImgDll = LoadLibraryA("msimg32.dll"); - pfnAlphaBlend = (pfnAlphaBlend_t)GetProcAddress(hMsImgDll, "AlphaBlend"); - pfnGradientFill = (PGF) GetProcAddress(hMsImgDll, "GradientFill"); - } - sysConfig.isVistaPlus = (IsWinVerVistaPlus() ? true : false); sysConfig.isSevenPlus = (IsWinVer7Plus() ? true : false); - sysConfig.isXPPlus = (IsWinVerXPPlus() ? true : false); - sysConfig.isWin2KPlus = (IsWinVer2000Plus() ? true : false); - - if (sysConfig.isXPPlus) { - if ((hUxTheme = Utils::loadSystemLibrary(_T("\\uxtheme.dll")), true) != 0) { - pfnIsThemeActive = (pfnIsThemeActive_t)GetProcAddress(hUxTheme, "IsThemeActive"); - pfnOpenThemeData = (pfnOpenThemeData_t)GetProcAddress(hUxTheme, "OpenThemeData"); - pfnDrawThemeBackground = (pfnDrawThemeBackground_t)GetProcAddress(hUxTheme, "DrawThemeBackground"); - pfnCloseThemeData = (pfnCloseThemeData_t)GetProcAddress(hUxTheme, "CloseThemeData"); - pfnDrawThemeText = (pfnDrawThemeText_t)GetProcAddress(hUxTheme, "DrawThemeText"); - pfnIsThemeBackgroundPartiallyTransparent = (pfnIsThemeBackgroundPartiallyTransparent_t)GetProcAddress(hUxTheme, "IsThemeBackgroundPartiallyTransparent"); - pfnDrawThemeParentBackground = (pfnDrawThemeParentBackground_t)GetProcAddress(hUxTheme, "DrawThemeParentBackground"); - pfnGetThemeBackgroundContentRect = (pfnGetThemeBackgroundContentRect_t)GetProcAddress(hUxTheme, "GetThemeBackgroundContentRect"); - pfnEnableThemeDialogTexture = (pfnEnableThemeDialogTexture_t)GetProcAddress(hUxTheme, "EnableThemeDialogTexture"); - - if (pfnIsThemeActive != 0 && pfnOpenThemeData != 0 && pfnDrawThemeBackground != 0 && pfnCloseThemeData != 0 - && pfnDrawThemeText != 0 && pfnIsThemeBackgroundPartiallyTransparent != 0 && pfnDrawThemeParentBackground != 0 - && pfnGetThemeBackgroundContentRect != 0) { - sysConfig.uxThemeValid = true; - } - } - } + if (sysConfig.isVistaPlus) { if ((hDwm = Utils::loadSystemLibrary(_T("\\dwmapi.dll")), true) != 0) { pfnDwmIsCompositionEnabled = (pfnDwmIsCompositionEnabled_t)GetProcAddress(hDwm, "DwmIsCompositionEnabled"); @@ -308,12 +240,6 @@ void API::onInit() updateState(); } -void API::onUnload() -{ - if (hUxTheme) - FreeLibrary(hUxTheme); -} - /** * update system's state (theme status, aero status, DWM check... * @@ -326,8 +252,7 @@ void API::updateState() ::ZeroMemory(&sysState, sizeof(TSysState)); - if (sysConfig.uxThemeValid) - sysState.isThemed = pfnIsThemeActive() ? true : false; + sysState.isThemed = IsThemeActive() ? true : false; if (sysConfig.isVistaPlus) { sysState.isDwmActive = (pfnDwmIsCompositionEnabled && (pfnDwmIsCompositionEnabled(&result) == S_OK) && result) ? true : false; @@ -335,14 +260,6 @@ void API::updateState() } } -BOOL API::SetLayeredWindowAttributes(HWND hWnd, COLORREF clr, BYTE alpha, DWORD dwFlags) -{ - if (sysConfig.isWin2KPlus) - return(pfnSetLayeredWindowAttributes(hWnd, clr, alpha, dwFlags)); - - return(FALSE); -} - /** * exception handling for SEH exceptions */ diff --git a/plugins/Clist_nicer/src/extBackg.cpp b/plugins/Clist_nicer/src/extBackg.cpp index 7093cc95df..0da73ccb76 100644 --- a/plugins/Clist_nicer/src/extBackg.cpp +++ b/plugins/Clist_nicer/src/extBackg.cpp @@ -1216,7 +1216,7 @@ void IMG_LoadItems() cfg::writeByte("CLUI", "WindowStyle", SETTING_WINDOWSTYLE_NOBORDER); ApplyCLUIBorderStyle(pcli->hwndContactList); SetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE, GetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE) | WS_EX_LAYERED); - API::SetLayeredWindowAttributes(pcli->hwndContactList, cfg::dat.colorkey, 0, LWA_COLORKEY); + SetLayeredWindowAttributes(pcli->hwndContactList, cfg::dat.colorkey, 0, LWA_COLORKEY); } CoolSB_SetupScrollBar(); } @@ -1606,7 +1606,7 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara MoveWindow((HWND)tci.lParam,5,25,rcClient.right-9,rcClient.bottom-60,1); ShowWindow((HWND)tci.lParam, oPage == 0 ? SW_SHOW : SW_HIDE); if (IS_THEMED) - API::pfnEnableThemeDialogTexture((HWND)tci.lParam, ETDT_ENABLETAB); + EnableThemeDialogTexture((HWND)tci.lParam, ETDT_ENABLETAB); if ( ServiceExists(MS_CLNSE_INVOKE)) { SKINDESCRIPTION sd = { 0 }; @@ -1626,7 +1626,7 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara ShowWindow(hwndSkinEdit, oPage == 1 ? SW_SHOW : SW_HIDE); TabCtrl_SetCurSel(GetDlgItem(hwnd, IDC_OPTIONSTAB), oPage); if (IS_THEMED) - API::pfnEnableThemeDialogTexture(hwndSkinEdit, ETDT_ENABLETAB); + EnableThemeDialogTexture(hwndSkinEdit, ETDT_ENABLETAB); } TabCtrl_SetCurSel(GetDlgItem(hwnd, IDC_OPTIONSTAB), oPage); diff --git a/plugins/Clist_nicer/src/viewmodes.cpp b/plugins/Clist_nicer/src/viewmodes.cpp index 1e167b3825..3ea740882e 100644 --- a/plugins/Clist_nicer/src/viewmodes.cpp +++ b/plugins/Clist_nicer/src/viewmodes.cpp @@ -585,9 +585,9 @@ INT_PTR CALLBACK DlgProcViewModesSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LP HICON hIcon; if (IS_THEMED) - API::pfnEnableThemeDialogTexture(hwndDlg, ETDT_ENABLETAB); + 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); for (i = ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++) ImageList_AddIcon(himlViewModes, LoadSkinnedProtoIcon(NULL, i)); -- cgit v1.2.3