From 28f6bfdc3ea1f2d34a05855f0459caa96c8fe2b6 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 2 Jun 2015 21:38:16 +0000 Subject: minor cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@13976 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Clist_nicer/src/CLCButton.cpp | 22 +- plugins/Clist_nicer/src/Docking.cpp | 437 +++++++++---------- plugins/Clist_nicer/src/Include/extBackg.h | 6 +- plugins/Clist_nicer/src/alphablend.cpp | 654 ++++++++++++++--------------- plugins/Clist_nicer/src/clc.cpp | 43 +- plugins/Clist_nicer/src/clcidents.cpp | 22 +- plugins/Clist_nicer/src/clcitems.cpp | 26 +- plugins/Clist_nicer/src/clcmsgs.cpp | 5 +- plugins/Clist_nicer/src/clcopts.cpp | 85 ++-- plugins/Clist_nicer/src/clcpaint.cpp | 7 +- plugins/Clist_nicer/src/clcutils.cpp | 89 ++-- plugins/Clist_nicer/src/clistevents.cpp | 79 ++-- plugins/Clist_nicer/src/clistmenus.cpp | 36 +- plugins/Clist_nicer/src/clistmod.cpp | 6 +- plugins/Clist_nicer/src/clistopts.cpp | 2 +- plugins/Clist_nicer/src/clisttray.cpp | 4 +- plugins/Clist_nicer/src/clnplus.cpp | 28 +- plugins/Clist_nicer/src/clui.cpp | 384 ++++++++--------- plugins/Clist_nicer/src/config.cpp | 80 ++-- plugins/Clist_nicer/src/contact.cpp | 4 +- plugins/Clist_nicer/src/extBackg.cpp | 209 +++++---- plugins/Clist_nicer/src/init.cpp | 6 +- plugins/Clist_nicer/src/statusbar.cpp | 6 +- 23 files changed, 1119 insertions(+), 1121 deletions(-) diff --git a/plugins/Clist_nicer/src/CLCButton.cpp b/plugins/Clist_nicer/src/CLCButton.cpp index 4936c913da..1e21fd318c 100644 --- a/plugins/Clist_nicer/src/CLCButton.cpp +++ b/plugins/Clist_nicer/src/CLCButton.cpp @@ -45,7 +45,7 @@ static int g_index = -1; static void InitDefaultButtons() { - for (int i = 0; i < SIZEOF(BTNS); i++ ) { + for (int i = 0; i < SIZEOF(BTNS); i++) { TTBButton tbb = { sizeof(tbb) }; g_index = i; @@ -352,7 +352,7 @@ static void PaintWorker(MButtonExtension *ctl, HDC hdcPaint) ix++; iy++; } - DrawState(hdcMem, NULL, NULL, (LPARAM) ctl->hBitmap, 0, ix, iy, bminfo.bmWidth, bminfo.bmHeight, IsWindowEnabled(ctl->hwnd) ? DST_BITMAP : DST_BITMAP | DSS_DISABLED); + DrawState(hdcMem, NULL, NULL, (LPARAM)ctl->hBitmap, 0, ix, iy, bminfo.bmWidth, bminfo.bmHeight, IsWindowEnabled(ctl->hwnd) ? DST_BITMAP : DST_BITMAP | DSS_DISABLED); } if (GetWindowTextLength(ctl->hwnd)) { // Draw the text and optinally the arrow @@ -403,27 +403,27 @@ static LRESULT CALLBACK TSButtonWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR bct->hIml = 0; bct->iIcon = 0; if (wParam == IMAGE_ICON) { - ICONINFO ii = {0}; - BITMAP bm = {0}; + ICONINFO ii = { 0 }; + BITMAP bm = { 0 }; if (bct->hIconPrivate) { DestroyIcon(bct->hIconPrivate); bct->hIconPrivate = 0; } - GetIconInfo((HICON) lParam, &ii); + GetIconInfo((HICON)lParam, &ii); GetObject(ii.hbmColor, sizeof(bm), &bm); if (bm.bmWidth > g_cxsmIcon || bm.bmHeight > g_cysmIcon) { HIMAGELIST hImageList; hImageList = ImageList_Create(g_cxsmIcon, g_cysmIcon, ILC_COLOR32 | ILC_MASK, 1, 0); - ImageList_AddIcon(hImageList, (HICON) lParam); + ImageList_AddIcon(hImageList, (HICON)lParam); bct->hIconPrivate = ImageList_GetIcon(hImageList, 0, ILD_NORMAL); ImageList_RemoveAll(hImageList); ImageList_Destroy(hImageList); bct->hIcon = 0; } else { - bct->hIcon = (HICON) lParam; + bct->hIcon = (HICON)lParam; bct->hIconPrivate = 0; } @@ -433,7 +433,7 @@ static LRESULT CALLBACK TSButtonWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR InvalidateRect(bct->hwnd, NULL, TRUE); } else if (wParam == IMAGE_BITMAP) { - bct->hBitmap = (HBITMAP) lParam; + bct->hBitmap = (HBITMAP)lParam; if (bct->hIconPrivate) DestroyIcon(bct->hIconPrivate); bct->hIcon = bct->hIconPrivate = NULL; @@ -567,7 +567,7 @@ static void CustomizeToolbar(HANDLE hButton, HWND hWnd, LPARAM) SetButtonToSkinned(); return; } - + SendMessage(hWnd, BUTTONSETCUSTOMPAINT, sizeof(MButtonExtension), (LPARAM)PaintWorker); mir_subclassWindow(hWnd, TSButtonWndProc); @@ -597,13 +597,13 @@ void CustomizeButton(HWND hWnd, bool bIsSkinned, bool bIsThemed, bool bIsFlat, b } static int Nicer_CustomizeToolbar(WPARAM, LPARAM) -{ +{ TopToolbar_SetCustomProc(CustomizeToolbar, 0); return 0; } static int Nicer_ReloadToolbar(WPARAM wParam, LPARAM) -{ +{ PLUGININFOEX *pInfo = (PLUGININFOEX*)wParam; if (!_stricmp(pInfo->shortName, "TopToolBar")) TopToolbar_SetCustomProc(CustomizeToolbar, 0); diff --git a/plugins/Clist_nicer/src/Docking.cpp b/plugins/Clist_nicer/src/Docking.cpp index 747b5a5d9b..2455efa43d 100644 --- a/plugins/Clist_nicer/src/Docking.cpp +++ b/plugins/Clist_nicer/src/Docking.cpp @@ -55,229 +55,240 @@ static void Docking_GetMonitorRectFromPoint(POINT pt, RECT *rc) static void Docking_GetMonitorRectFromWindow(HWND hWnd, RECT *rc) { - POINT ptWindow; - GetWindowRect(hWnd, rc); - ptWindow.x = rc->left; - ptWindow.y = rc->top; - Docking_GetMonitorRectFromPoint(ptWindow, rc); + POINT ptWindow; + GetWindowRect(hWnd, rc); + ptWindow.x = rc->left; + ptWindow.y = rc->top; + Docking_GetMonitorRectFromPoint(ptWindow, rc); } static void Docking_AdjustPosition(HWND hwnd, RECT *rcDisplay, RECT *rc) { - APPBARDATA abd; - - memset(&abd, 0, sizeof(abd)); - abd.cbSize = sizeof(abd); - abd.hWnd = hwnd; - abd.uEdge = docked == DOCKED_LEFT ? ABE_LEFT : ABE_RIGHT; - abd.rc = *rc; - abd.rc.top = rcDisplay->top; - abd.rc.bottom = rcDisplay->bottom; - if (docked == DOCKED_LEFT) { - abd.rc.right = rcDisplay->left + (abd.rc.right - abd.rc.left) - cfg::dat.bClipBorder; - abd.rc.left = rcDisplay->left - cfg::dat.bClipBorder; - } else { - abd.rc.left = rcDisplay->right - (abd.rc.right - abd.rc.left) + cfg::dat.bClipBorder; - abd.rc.right = rcDisplay->right + cfg::dat.bClipBorder; - } - SHAppBarMessage(ABM_SETPOS, &abd); - *rc = abd.rc; + APPBARDATA abd; + + memset(&abd, 0, sizeof(abd)); + abd.cbSize = sizeof(abd); + abd.hWnd = hwnd; + abd.uEdge = docked == DOCKED_LEFT ? ABE_LEFT : ABE_RIGHT; + abd.rc = *rc; + abd.rc.top = rcDisplay->top; + abd.rc.bottom = rcDisplay->bottom; + if (docked == DOCKED_LEFT) { + abd.rc.right = rcDisplay->left + (abd.rc.right - abd.rc.left) - cfg::dat.bClipBorder; + abd.rc.left = rcDisplay->left - cfg::dat.bClipBorder; + } + else { + abd.rc.left = rcDisplay->right - (abd.rc.right - abd.rc.left) + cfg::dat.bClipBorder; + abd.rc.right = rcDisplay->right + cfg::dat.bClipBorder; + } + SHAppBarMessage(ABM_SETPOS, &abd); + *rc = abd.rc; } int Docking_IsDocked(WPARAM, LPARAM) { - return docked; + return docked; } int Docking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam) { - APPBARDATA abd; - static int draggingTitle; - MSG *msg = (MSG *) wParam; - - if (msg->message == WM_DESTROY) - cfg::writeByte("CList", "Docked", (BYTE) docked); - if ( !docked && msg->message != WM_CREATE && msg->message != WM_MOVING && msg->message != WM_CREATEDOCKED && msg->message != WM_MOVE) - return 0; - switch (msg->message) { - case WM_CREATE: - //if (GetSystemMetrics(SM_CMONITORS)>1) return 0; - if (cfg::getByte("CList", "Docked", 0)) - PostMessage(msg->hwnd, WM_CREATEDOCKED, 0, 0); - draggingTitle = 0; - return 0; - case WM_CREATEDOCKED: - //we need to post a message just after creation to let main message function do some work - docked = (int) (char) cfg::getByte("CList", "Docked", 0); - if (IsWindowVisible(msg->hwnd) && !IsIconic(msg->hwnd)) { - RECT rc, rcMonitor; - memset(&abd, 0, sizeof(abd)); - abd.cbSize = sizeof(abd); - abd.hWnd = msg->hwnd; - abd.lParam = 0; - abd.uCallbackMessage = WM_DOCKCALLBACK; - SHAppBarMessage(ABM_NEW, &abd); - GetWindowRect(msg->hwnd, &rc); - Docking_GetMonitorRectFromWindow(msg->hwnd, &rcMonitor); - Docking_AdjustPosition(msg->hwnd, &rcMonitor, &rc); - MoveWindow(msg->hwnd, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, TRUE); - } - break; - case WM_ACTIVATE: - memset(&abd, 0, sizeof(abd)); - abd.cbSize = sizeof(abd); - abd.hWnd = msg->hwnd; - SHAppBarMessage(ABM_ACTIVATE, &abd); - return 0; - case WM_WINDOWPOSCHANGED: - memset(&abd, 0, sizeof(abd)); - abd.cbSize = sizeof(abd); - abd.hWnd = msg->hwnd; - SHAppBarMessage(ABM_WINDOWPOSCHANGED, &abd); - return 0; - case WM_MOVING: - { - RECT rcMonitor; - POINT ptCursor; - - // stop early - if (GetAsyncKeyState(VK_CONTROL) & 0x8000) - return 0; - - // GetMessagePos() is no good, position is always unsigned - GetCursorPos(&ptCursor); - Docking_GetMonitorRectFromPoint(ptCursor, &rcMonitor); - - if ((ptCursor.x < rcMonitor.left + EDGESENSITIVITY) || (ptCursor.x >= rcMonitor.right - EDGESENSITIVITY)) { - if ( !(GetWindowLongPtr(msg->hwnd, GWL_EXSTYLE) & WS_EX_TOOLWINDOW)) { - SendMessage(msg->hwnd, CLUIINTM_REDRAW, 0, 0); - MessageBox(0, TranslateT("The contact list cannot be docked when using the default title bar and border. Use a toolwindow or borderless style instead."), - TranslateT("Contact list docking"), MB_OK); - return 0; - } - memset(&abd, 0, sizeof(abd)); - abd.cbSize = sizeof(abd); - abd.hWnd = msg->hwnd; - abd.lParam = 0; - abd.uCallbackMessage = WM_DOCKCALLBACK; - SHAppBarMessage(ABM_NEW, &abd); - if (ptCursor.x < rcMonitor.left + EDGESENSITIVITY) - docked = DOCKED_LEFT; - else - docked = DOCKED_RIGHT; - SendMessage(msg->hwnd, WM_LBUTTONUP, 0, MAKELPARAM(ptCursor.x, ptCursor.y)); - GetWindowRect(msg->hwnd, (LPRECT) msg->lParam); - Docking_AdjustPosition(msg->hwnd, (LPRECT) &rcMonitor, (LPRECT) msg->lParam); - PostMessage(msg->hwnd, CLUIINTM_REDRAW, 0, 0); - return TRUE; - } - return 0; - } - case WM_MOVE: - { - if (docked) { - RECT rc, rcMonitor; - Docking_GetMonitorRectFromWindow(msg->hwnd, &rcMonitor); - GetWindowRect(msg->hwnd, &rc); - Docking_AdjustPosition(msg->hwnd, &rcMonitor, &rc); - MoveWindow(msg->hwnd, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, TRUE); - return 1; - } - return 0; - } - case WM_SIZING: - { - RECT rcMonitor; - Docking_GetMonitorRectFromWindow(msg->hwnd, &rcMonitor); - Docking_AdjustPosition(msg->hwnd, &rcMonitor, (LPRECT) msg->lParam); - *((LRESULT *) lParam) = TRUE; - return TRUE; - } - case WM_SHOWWINDOW: - if (msg->lParam) - return 0; - if ((msg->wParam && docked < 0) || (!msg->wParam && docked > 0)) - docked = -docked; - memset(&abd, 0, sizeof(abd)); - abd.cbSize = sizeof(abd); - abd.hWnd = msg->hwnd; - if (msg->wParam) { - RECT rc, rcMonitor; - Docking_GetMonitorRectFromWindow(msg->hwnd, &rcMonitor); - abd.lParam = 0; - abd.uCallbackMessage = WM_DOCKCALLBACK; - SHAppBarMessage(ABM_NEW, &abd); - GetWindowRect(msg->hwnd, &rc); - Docking_AdjustPosition(msg->hwnd, &rcMonitor, &rc); - MoveWindow(msg->hwnd, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, FALSE); - } else { - SHAppBarMessage(ABM_REMOVE, &abd); - } - return 0; - case WM_NCHITTEST: - { - LONG result; - result = DefWindowProc(msg->hwnd, WM_NCHITTEST, msg->wParam, msg->lParam); - if (result == HTSIZE || result == HTTOP || result == HTTOPLEFT || result == HTTOPRIGHT || result == HTBOTTOM || result == HTBOTTOMRIGHT || result == HTBOTTOMLEFT) { - *((LRESULT *) lParam) = HTCLIENT; return TRUE; - } - if (docked == DOCKED_LEFT && result == HTLEFT) { - *((LRESULT *) lParam) = HTCLIENT; return TRUE; - } - if (docked == DOCKED_RIGHT && result == HTRIGHT) { - *((LRESULT *) lParam) = HTCLIENT; return TRUE; - } - return 0; - } - case WM_SYSCOMMAND: - if ((msg->wParam & 0xFFF0) != SC_MOVE) - return 0; - SetActiveWindow(msg->hwnd); - SetCapture(msg->hwnd); - draggingTitle = 1; - *((LRESULT *) lParam) = 0; - return TRUE; - case WM_MOUSEMOVE: - if ( !draggingTitle) - return 0; { - RECT rc; - POINT pt; - GetClientRect(msg->hwnd, &rc); - if (((docked == DOCKED_LEFT || docked == -DOCKED_LEFT) && (short) LOWORD(msg->lParam) > rc.right) || ((docked == DOCKED_RIGHT || docked == -DOCKED_RIGHT) && (short) LOWORD(msg->lParam) < 0)) { - ReleaseCapture(); - draggingTitle = 0; - memset(&abd, 0, sizeof(abd)); - abd.cbSize = sizeof(abd); - abd.hWnd = msg->hwnd; - SHAppBarMessage(ABM_REMOVE, &abd); - docked = 0; - GetCursorPos(&pt); - PostMessage(msg->hwnd, WM_NCLBUTTONDOWN, HTCAPTION, MAKELPARAM(pt.x, pt.y)); - SetWindowPos(msg->hwnd, 0, pt.x - rc.right / 2, pt.y - GetSystemMetrics(SM_CYFRAME) - GetSystemMetrics(SM_CYSMCAPTION) / 2, cluiPos.right, cluiPos.bottom, SWP_NOZORDER); - } - return 1; - } - case WM_LBUTTONUP: - if (draggingTitle) { - ReleaseCapture(); - draggingTitle = 0; - } - return 0; - case WM_DOCKCALLBACK: - switch (msg->wParam) { - case ABN_WINDOWARRANGE: - ShowWindow(msg->hwnd, msg->lParam ? SW_HIDE : SW_SHOW); - break; - } - return TRUE; - case WM_DESTROY: - if (docked > 0) { - memset(&abd, 0, sizeof(abd)); - abd.cbSize = sizeof(abd); - abd.hWnd = msg->hwnd; - SHAppBarMessage(ABM_REMOVE, &abd); - } - return 0; - } - return 0; + APPBARDATA abd; + static int draggingTitle; + MSG *msg = (MSG *)wParam; + + if (msg->message == WM_DESTROY) + cfg::writeByte("CList", "Docked", (BYTE)docked); + if (!docked && msg->message != WM_CREATE && msg->message != WM_MOVING && msg->message != WM_CREATEDOCKED && msg->message != WM_MOVE) + return 0; + + switch (msg->message) { + case WM_CREATE: + //if (GetSystemMetrics(SM_CMONITORS)>1) return 0; + if (cfg::getByte("CList", "Docked", 0)) + PostMessage(msg->hwnd, WM_CREATEDOCKED, 0, 0); + draggingTitle = 0; + return 0; + + case WM_CREATEDOCKED: + //we need to post a message just after creation to let main message function do some work + docked = (int)(char)cfg::getByte("CList", "Docked", 0); + if (IsWindowVisible(msg->hwnd) && !IsIconic(msg->hwnd)) { + RECT rc, rcMonitor; + memset(&abd, 0, sizeof(abd)); + abd.cbSize = sizeof(abd); + abd.hWnd = msg->hwnd; + abd.lParam = 0; + abd.uCallbackMessage = WM_DOCKCALLBACK; + SHAppBarMessage(ABM_NEW, &abd); + GetWindowRect(msg->hwnd, &rc); + Docking_GetMonitorRectFromWindow(msg->hwnd, &rcMonitor); + Docking_AdjustPosition(msg->hwnd, &rcMonitor, &rc); + MoveWindow(msg->hwnd, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, TRUE); + } + break; + + case WM_ACTIVATE: + memset(&abd, 0, sizeof(abd)); + abd.cbSize = sizeof(abd); + abd.hWnd = msg->hwnd; + SHAppBarMessage(ABM_ACTIVATE, &abd); + return 0; + + case WM_WINDOWPOSCHANGED: + memset(&abd, 0, sizeof(abd)); + abd.cbSize = sizeof(abd); + abd.hWnd = msg->hwnd; + SHAppBarMessage(ABM_WINDOWPOSCHANGED, &abd); + return 0; + + case WM_MOVING: + { + RECT rcMonitor; + POINT ptCursor; + + // stop early + if (GetAsyncKeyState(VK_CONTROL) & 0x8000) + return 0; + + // GetMessagePos() is no good, position is always unsigned + GetCursorPos(&ptCursor); + Docking_GetMonitorRectFromPoint(ptCursor, &rcMonitor); + + if ((ptCursor.x < rcMonitor.left + EDGESENSITIVITY) || (ptCursor.x >= rcMonitor.right - EDGESENSITIVITY)) { + if (!(GetWindowLongPtr(msg->hwnd, GWL_EXSTYLE) & WS_EX_TOOLWINDOW)) { + SendMessage(msg->hwnd, CLUIINTM_REDRAW, 0, 0); + MessageBox(0, TranslateT("The contact list cannot be docked when using the default title bar and border. Use a toolwindow or borderless style instead."), + TranslateT("Contact list docking"), MB_OK); + return 0; + } + memset(&abd, 0, sizeof(abd)); + abd.cbSize = sizeof(abd); + abd.hWnd = msg->hwnd; + abd.lParam = 0; + abd.uCallbackMessage = WM_DOCKCALLBACK; + SHAppBarMessage(ABM_NEW, &abd); + if (ptCursor.x < rcMonitor.left + EDGESENSITIVITY) + docked = DOCKED_LEFT; + else + docked = DOCKED_RIGHT; + SendMessage(msg->hwnd, WM_LBUTTONUP, 0, MAKELPARAM(ptCursor.x, ptCursor.y)); + GetWindowRect(msg->hwnd, (LPRECT)msg->lParam); + Docking_AdjustPosition(msg->hwnd, (LPRECT)&rcMonitor, (LPRECT)msg->lParam); + PostMessage(msg->hwnd, CLUIINTM_REDRAW, 0, 0); + return TRUE; + } + } + return 0; + + case WM_MOVE: + if (docked) { + RECT rc, rcMonitor; + Docking_GetMonitorRectFromWindow(msg->hwnd, &rcMonitor); + GetWindowRect(msg->hwnd, &rc); + Docking_AdjustPosition(msg->hwnd, &rcMonitor, &rc); + MoveWindow(msg->hwnd, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, TRUE); + return 1; + } + return 0; + + case WM_SIZING: + { + RECT rcMonitor; + Docking_GetMonitorRectFromWindow(msg->hwnd, &rcMonitor); + Docking_AdjustPosition(msg->hwnd, &rcMonitor, (LPRECT)msg->lParam); + *((LRESULT *)lParam) = TRUE; + } + return TRUE; + + case WM_SHOWWINDOW: + if (msg->lParam) + return 0; + if ((msg->wParam && docked < 0) || (!msg->wParam && docked > 0)) + docked = -docked; + memset(&abd, 0, sizeof(abd)); + abd.cbSize = sizeof(abd); + abd.hWnd = msg->hwnd; + if (msg->wParam) { + RECT rc, rcMonitor; + Docking_GetMonitorRectFromWindow(msg->hwnd, &rcMonitor); + abd.lParam = 0; + abd.uCallbackMessage = WM_DOCKCALLBACK; + SHAppBarMessage(ABM_NEW, &abd); + GetWindowRect(msg->hwnd, &rc); + Docking_AdjustPosition(msg->hwnd, &rcMonitor, &rc); + MoveWindow(msg->hwnd, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, FALSE); + } + else SHAppBarMessage(ABM_REMOVE, &abd); + return 0; + + case WM_NCHITTEST: + { + LONG result = DefWindowProc(msg->hwnd, WM_NCHITTEST, msg->wParam, msg->lParam); + if (result == HTSIZE || result == HTTOP || result == HTTOPLEFT || result == HTTOPRIGHT || result == HTBOTTOM || result == HTBOTTOMRIGHT || result == HTBOTTOMLEFT) { + *((LRESULT *)lParam) = HTCLIENT; return TRUE; + } + if (docked == DOCKED_LEFT && result == HTLEFT) { + *((LRESULT *)lParam) = HTCLIENT; return TRUE; + } + if (docked == DOCKED_RIGHT && result == HTRIGHT) { + *((LRESULT *)lParam) = HTCLIENT; return TRUE; + } + } + return 0; + + case WM_SYSCOMMAND: + if ((msg->wParam & 0xFFF0) != SC_MOVE) + return 0; + SetActiveWindow(msg->hwnd); + SetCapture(msg->hwnd); + draggingTitle = 1; + *((LRESULT *)lParam) = 0; + return TRUE; + + case WM_MOUSEMOVE: + if (!draggingTitle) + return 0; { + RECT rc; + POINT pt; + GetClientRect(msg->hwnd, &rc); + if (((docked == DOCKED_LEFT || docked == -DOCKED_LEFT) && (short)LOWORD(msg->lParam) > rc.right) || ((docked == DOCKED_RIGHT || docked == -DOCKED_RIGHT) && (short)LOWORD(msg->lParam) < 0)) { + ReleaseCapture(); + draggingTitle = 0; + memset(&abd, 0, sizeof(abd)); + abd.cbSize = sizeof(abd); + abd.hWnd = msg->hwnd; + SHAppBarMessage(ABM_REMOVE, &abd); + docked = 0; + GetCursorPos(&pt); + PostMessage(msg->hwnd, WM_NCLBUTTONDOWN, HTCAPTION, MAKELPARAM(pt.x, pt.y)); + SetWindowPos(msg->hwnd, 0, pt.x - rc.right / 2, pt.y - GetSystemMetrics(SM_CYFRAME) - GetSystemMetrics(SM_CYSMCAPTION) / 2, cluiPos.right, cluiPos.bottom, SWP_NOZORDER); + } + } + return 1; + + case WM_LBUTTONUP: + if (draggingTitle) { + ReleaseCapture(); + draggingTitle = 0; + } + return 0; + + case WM_DOCKCALLBACK: + switch (msg->wParam) { + case ABN_WINDOWARRANGE: + ShowWindow(msg->hwnd, msg->lParam ? SW_HIDE : SW_SHOW); + break; + } + return TRUE; + + case WM_DESTROY: + if (docked > 0) { + memset(&abd, 0, sizeof(abd)); + abd.cbSize = sizeof(abd); + abd.hWnd = msg->hwnd; + SHAppBarMessage(ABM_REMOVE, &abd); + } + return 0; + } + return 0; } diff --git a/plugins/Clist_nicer/src/Include/extBackg.h b/plugins/Clist_nicer/src/Include/extBackg.h index ba27c463e0..9b98c283ee 100644 --- a/plugins/Clist_nicer/src/Include/extBackg.h +++ b/plugins/Clist_nicer/src/Include/extBackg.h @@ -71,14 +71,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. BOOL CheckItem(int item, HWND hwndDlg); BOOL isValidItem(void); -void extbk_export(char *file); -void extbk_import(char *file, HWND hwndDlg); +void extbk_export(const TCHAR *file); +void extbk_import(const TCHAR *file, HWND hwndDlg); void LoadExtBkSettingsFromDB(); void IMG_LoadItems(); void __fastcall IMG_RenderImageItem(HDC hdc, ImageItem *item, RECT *rc); void IMG_InitDecoder(); -void LoadPerContactSkins(TCHAR *file); +void LoadPerContactSkins(const TCHAR *file); static void SaveCompleteStructToDB(); StatusItems_t *GetProtocolStatusItem(const char *szProto); diff --git a/plugins/Clist_nicer/src/alphablend.cpp b/plugins/Clist_nicer/src/alphablend.cpp index a7bcb016ca..403f244fa5 100644 --- a/plugins/Clist_nicer/src/alphablend.cpp +++ b/plugins/Clist_nicer/src/alphablend.cpp @@ -32,112 +32,97 @@ extern ImageItem *g_glyphItem; BYTE __forceinline percent_to_byte(UINT32 percent) { - return(BYTE) ((FLOAT) (((FLOAT) percent) / 100) * 255); + return(BYTE)((FLOAT)(((FLOAT)percent) / 100) * 255); } COLORREF __forceinline revcolref(COLORREF colref) { - return RGB(GetBValue(colref), GetGValue(colref), GetRValue(colref)); + return RGB(GetBValue(colref), GetGValue(colref), GetRValue(colref)); } DWORD __forceinline argb_from_cola(COLORREF col, UINT32 alpha) { - return((BYTE) percent_to_byte(alpha) << 24 | col); + return((BYTE)percent_to_byte(alpha) << 24 | col); } void __forceinline DrawBorderStyle(HDC hdcwnd, RECT *rc, DWORD BORDERSTYLE) { - HPEN hPenOld = 0; - POINT pt; - - switch(BORDERSTYLE) { - case BDR_RAISEDOUTER: // raised - MoveToEx(hdcwnd, rc->left, rc->bottom - 1, &pt); - hPenOld = reinterpret_cast(SelectObject(hdcwnd, cfg::dat.hPen3DBright)); - LineTo(hdcwnd, rc->left, rc->top); - LineTo(hdcwnd, rc->right, rc->top); - SelectObject(hdcwnd, cfg::dat.hPen3DDark); - MoveToEx(hdcwnd, rc->right - 1, rc->top + 1, &pt); - LineTo(hdcwnd, rc->right - 1, rc->bottom - 1); - LineTo(hdcwnd, rc->left - 1, rc->bottom - 1); - break; - case BDR_SUNKENINNER: - MoveToEx(hdcwnd, rc->left, rc->bottom - 1, &pt); - hPenOld = reinterpret_cast(SelectObject(hdcwnd, cfg::dat.hPen3DDark)); - LineTo(hdcwnd, rc->left, rc->top); - LineTo(hdcwnd, rc->right, rc->top); - MoveToEx(hdcwnd, rc->right - 1, rc->top + 1, &pt); - SelectObject(hdcwnd, cfg::dat.hPen3DBright); - LineTo(hdcwnd, rc->right - 1, rc->bottom - 1); - LineTo(hdcwnd, rc->left, rc->bottom - 1); - break; - default: - DrawEdge(hdcwnd, rc, BORDERSTYLE, BF_RECT | BF_SOFT); - break; - } - if (hPenOld) - SelectObject(hdcwnd, hPenOld); + HPEN hPenOld = 0; + POINT pt; + + switch (BORDERSTYLE) { + case BDR_RAISEDOUTER: // raised + MoveToEx(hdcwnd, rc->left, rc->bottom - 1, &pt); + hPenOld = reinterpret_cast(SelectObject(hdcwnd, cfg::dat.hPen3DBright)); + LineTo(hdcwnd, rc->left, rc->top); + LineTo(hdcwnd, rc->right, rc->top); + SelectObject(hdcwnd, cfg::dat.hPen3DDark); + MoveToEx(hdcwnd, rc->right - 1, rc->top + 1, &pt); + LineTo(hdcwnd, rc->right - 1, rc->bottom - 1); + LineTo(hdcwnd, rc->left - 1, rc->bottom - 1); + break; + case BDR_SUNKENINNER: + MoveToEx(hdcwnd, rc->left, rc->bottom - 1, &pt); + hPenOld = reinterpret_cast(SelectObject(hdcwnd, cfg::dat.hPen3DDark)); + LineTo(hdcwnd, rc->left, rc->top); + LineTo(hdcwnd, rc->right, rc->top); + MoveToEx(hdcwnd, rc->right - 1, rc->top + 1, &pt); + SelectObject(hdcwnd, cfg::dat.hPen3DBright); + LineTo(hdcwnd, rc->right - 1, rc->bottom - 1); + LineTo(hdcwnd, rc->left, rc->bottom - 1); + break; + default: + DrawEdge(hdcwnd, rc, BORDERSTYLE, BF_RECT | BF_SOFT); + break; + } + if (hPenOld) + SelectObject(hdcwnd, hPenOld); } void DrawAlpha(HDC hdcwnd, PRECT rc, DWORD basecolor, int alpha, DWORD basecolor2, BOOL transparent, BYTE FLG_GRADIENT, BYTE FLG_CORNER, DWORD BORDERSTYLE, ImageItem *imageItem) { - if (rc == NULL) - return; - - BLENDFUNCTION bf; - HBITMAP hbitmap; - HBITMAP holdbitmap; - BITMAPINFO bmi; - VOID *pvBits; - UINT32 x, y; - ULONG ulBitmapWidth, ulBitmapHeight; - UCHAR ubAlpha = 0xFF; - UCHAR ubRedFinal = 0xFF; - UCHAR ubGreenFinal = 0xFF; - UCHAR ubBlueFinal = 0xFF; - UCHAR ubRed; - UCHAR ubGreen; - UCHAR ubBlue; - UCHAR ubRed2; - UCHAR ubGreen2; - UCHAR ubBlue2; - - int realx; - - FLOAT fAlphaFactor; - LONG realHeight = (rc->bottom - rc->top); - LONG realWidth = (rc->right - rc->left); - LONG realHeightHalf = realHeight >> 1; - - if (g_hottrack && g_inCLCpaint) { - StatusItems_t *ht = arStatusItems[ID_EXTBKHOTTRACK - ID_STATUS_OFFLINE]; - if (ht->IGNORED == 0) { - basecolor = ht->COLOR; - basecolor2 = ht->COLOR2; - alpha = ht->ALPHA; - FLG_GRADIENT = ht->GRADIENT; - transparent = ht->COLOR2_TRANSPARENT; - BORDERSTYLE = ht->BORDERSTYLE; - imageItem = ht->imageItem; - } - g_hottrack_done = 1; - } + if (rc == NULL) + return; - if (imageItem) { - IMG_RenderImageItem(hdcwnd, imageItem, rc); - return; - } + BLENDFUNCTION bf; + int ulBitmapWidth, ulBitmapHeight; + UCHAR ubAlpha = 0xFF; + UCHAR ubRedFinal = 0xFF; + UCHAR ubGreenFinal = 0xFF; + UCHAR ubBlueFinal = 0xFF; + + LONG realHeight = (rc->bottom - rc->top); + LONG realWidth = (rc->right - rc->left); + LONG realHeightHalf = realHeight >> 1; + + if (g_hottrack && g_inCLCpaint) { + StatusItems_t *ht = arStatusItems[ID_EXTBKHOTTRACK - ID_STATUS_OFFLINE]; + if (ht->IGNORED == 0) { + basecolor = ht->COLOR; + basecolor2 = ht->COLOR2; + alpha = ht->ALPHA; + FLG_GRADIENT = ht->GRADIENT; + transparent = ht->COLOR2_TRANSPARENT; + BORDERSTYLE = ht->BORDERSTYLE; + imageItem = ht->imageItem; + } + g_hottrack_done = 1; + } + if (imageItem) { + IMG_RenderImageItem(hdcwnd, imageItem, rc); + return; + } - if (rc->right < rc->left || rc->bottom < rc->top || (realHeight <= 0) || (realWidth <= 0)) - return; + if (rc->right < rc->left || rc->bottom < rc->top || (realHeight <= 0) || (realWidth <= 0)) + return; if (cfg::dat.bUseFastGradients && !(FLG_CORNER & CORNER_ACTIVE)) { GRADIENT_RECT grect; TRIVERTEX tvtx[2]; int orig = 1, dest = 0; - if ( !(FLG_GRADIENT & GRADIENT_ACTIVE)) { + if (!(FLG_GRADIENT & GRADIENT_ACTIVE)) { tvtx[0].Red = tvtx[1].Red = (COLOR16)GetRValue(basecolor) << 8; tvtx[0].Blue = tvtx[1].Blue = (COLOR16)GetBValue(basecolor) << 8; tvtx[0].Green = tvtx[1].Green = (COLOR16)GetGValue(basecolor) << 8; @@ -162,7 +147,7 @@ void DrawAlpha(HDC hdcwnd, PRECT rc, DWORD basecolor, int alpha, DWORD basecolor grect.UpperLeft = 0; grect.LowerRight = 1; - saved_alpha = (UCHAR) (basecolor >> 24); + saved_alpha = (UCHAR)(basecolor >> 24); if (alpha < 100) { LONG width = rc->right - rc->left, height = rc->bottom - rc->top; @@ -179,12 +164,12 @@ void DrawAlpha(HDC hdcwnd, PRECT rc, DWORD basecolor, int alpha, DWORD basecolor bf.SourceConstantAlpha = percent_to_byte((UINT32)alpha); bf.AlphaFormat = 0; // so it will use our specified alpha value HDC hdc = CreateCompatibleDC(hdcwnd); - if ( !hdc) + if (!hdc) return; HBITMAP hbm = CreateCompatibleBitmap(hdcwnd, width, height); HBITMAP hbmOld = reinterpret_cast(SelectObject(hdc, hbm)); 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); + GdiAlphaBlend(hdcwnd, rc->left, rc->top, width, height, hdc, 0, 0, width, height, bf); SelectObject(hdc, hbmOld); DeleteObject(hbm); @@ -202,233 +187,244 @@ void DrawAlpha(HDC hdcwnd, PRECT rc, DWORD basecolor, int alpha, DWORD basecolor return; } - HDC hdc = CreateCompatibleDC(hdcwnd); - if (!hdc) - return; - - memset(&bmi, 0, sizeof(BITMAPINFO)); - - bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); - - if (FLG_GRADIENT & GRADIENT_ACTIVE && (FLG_GRADIENT & GRADIENT_LR || FLG_GRADIENT & GRADIENT_RL)) { - bmi.bmiHeader.biWidth = ulBitmapWidth = realWidth; - bmi.bmiHeader.biHeight = ulBitmapHeight = 1; - } else if (FLG_GRADIENT & GRADIENT_ACTIVE && (FLG_GRADIENT & GRADIENT_TB || FLG_GRADIENT & GRADIENT_BT)) { - bmi.bmiHeader.biWidth = ulBitmapWidth = 1; - bmi.bmiHeader.biHeight = ulBitmapHeight = realHeight; - } else { - bmi.bmiHeader.biWidth = ulBitmapWidth = 1; - bmi.bmiHeader.biHeight = ulBitmapHeight = 1; - } - - bmi.bmiHeader.biPlanes = 1; - bmi.bmiHeader.biBitCount = 32; - bmi.bmiHeader.biCompression = BI_RGB; - bmi.bmiHeader.biSizeImage = ulBitmapWidth * ulBitmapHeight * 4; - - hbitmap = CreateDIBSection(hdc, &bmi, DIB_RGB_COLORS, &pvBits, NULL, 0x0); - if (hbitmap == NULL || pvBits == NULL) { - DeleteDC(hdc); - return; - } - - holdbitmap = reinterpret_cast(SelectObject(hdc, hbitmap)); - - // convert basecolor to RGB and then merge alpha so its ARGB - basecolor = argb_from_cola(revcolref(basecolor), alpha); - basecolor2 = argb_from_cola(revcolref(basecolor2), alpha); - - ubRed = (UCHAR) (basecolor >> 16); - ubGreen = (UCHAR) (basecolor >> 8); - ubBlue = (UCHAR) basecolor; - - ubRed2 = (UCHAR) (basecolor2 >> 16); - ubGreen2 = (UCHAR) (basecolor2 >> 8); - ubBlue2 = (UCHAR) basecolor2; - - //DRAW BASE - make corner space 100% transparent - for (y = 0; y < ulBitmapHeight; y++) { - for (x = 0 ; x < ulBitmapWidth ; x++) { - if (FLG_GRADIENT & GRADIENT_ACTIVE) { - if (FLG_GRADIENT & GRADIENT_LR || FLG_GRADIENT & GRADIENT_RL) { - realx = x + realHeightHalf; - realx = (ULONG) realx > ulBitmapWidth ? ulBitmapWidth : realx; - gradientHorizontal(&ubRedFinal, &ubGreenFinal, &ubBlueFinal, ulBitmapWidth, ubRed, ubGreen, ubBlue, ubRed2, ubGreen2, ubBlue2, FLG_GRADIENT, transparent, realx, &ubAlpha); - } else if (FLG_GRADIENT & GRADIENT_TB || FLG_GRADIENT & GRADIENT_BT) - gradientVertical(&ubRedFinal, &ubGreenFinal, &ubBlueFinal, ulBitmapHeight, ubRed, ubGreen, ubBlue, ubRed2, ubGreen2, ubBlue2, FLG_GRADIENT, transparent, y, &ubAlpha); - - fAlphaFactor = (float) ubAlpha / (float) 0xff; - ((UINT32 *) pvBits)[x + y * ulBitmapWidth] = (ubAlpha << 24) | ((UCHAR) (ubRedFinal * fAlphaFactor) << 16) | ((UCHAR) (ubGreenFinal * fAlphaFactor) << 8) | ((UCHAR) (ubBlueFinal * fAlphaFactor)); - } else { - ubAlpha = percent_to_byte(alpha); - ubRedFinal = ubRed; - ubGreenFinal = ubGreen; - ubBlueFinal = ubBlue; - fAlphaFactor = (float) ubAlpha / (float) 0xff; - - ((UINT32 *) pvBits)[x + y * ulBitmapWidth] = (ubAlpha << 24) | ((UCHAR) (ubRedFinal * fAlphaFactor) << 16) | ((UCHAR) (ubGreenFinal * fAlphaFactor) << 8) | ((UCHAR) (ubBlueFinal * fAlphaFactor)); - } - } - } - bf.BlendOp = AC_SRC_OVER; - bf.BlendFlags = 0; - bf.SourceConstantAlpha = (UCHAR) (basecolor >> 24); - bf.AlphaFormat = AC_SRC_ALPHA; // so it will use our specified alpha value - - GdiAlphaBlend(hdcwnd, rc->left + realHeightHalf, rc->top, (realWidth - realHeightHalf * 2), realHeight, hdc, 0, 0, ulBitmapWidth, ulBitmapHeight, bf); - - SelectObject(hdc, holdbitmap); - DeleteObject(hbitmap); - - saved_alpha = (UCHAR) (basecolor >> 24); - - // corners - HBRUSH holdbrush; - HBRUSH BrMask = CreateSolidBrush(RGB(0xFF, 0x00, 0xFF)); - { - bmi.bmiHeader.biWidth = ulBitmapWidth = realHeightHalf; - bmi.bmiHeader.biHeight = ulBitmapHeight = realHeight; - bmi.bmiHeader.biSizeImage = ulBitmapWidth * ulBitmapHeight * 4; - - if (ulBitmapWidth <= 0 || ulBitmapHeight <= 0) { - DeleteDC(hdc); - DeleteObject(BrMask); - return; - } - - // TL+BL CORNER - hbitmap = CreateDIBSection(hdc, &bmi, DIB_RGB_COLORS, &pvBits, NULL, 0x0); - - if (hbitmap == 0 || pvBits == NULL) { - DeleteObject(BrMask); - DeleteDC(hdc); - return; - } - - holdbrush = reinterpret_cast(SelectObject(hdc, BrMask)); - holdbitmap = reinterpret_cast(SelectObject(hdc, hbitmap)); - RoundRect(hdc, -1, -1, ulBitmapWidth * 2 + 1, (realHeight + 1), cfg::dat.cornerRadius << 1, cfg::dat.cornerRadius << 1); - - for (y = 0; y < ulBitmapHeight; y++) { - for (x = 0; x < ulBitmapWidth; x++) { - if (((((UINT32 *) pvBits)[x + y * ulBitmapWidth]) << 8) == 0xFF00FF00 || (y< ulBitmapHeight >> 1 && !(FLG_CORNER & CORNER_BL && FLG_CORNER & CORNER_ACTIVE)) || (y > ulBitmapHeight >> 2 && !(FLG_CORNER & CORNER_TL && FLG_CORNER & CORNER_ACTIVE))) { - if (FLG_GRADIENT & GRADIENT_ACTIVE) { - if (FLG_GRADIENT & GRADIENT_LR || FLG_GRADIENT & GRADIENT_RL) - gradientHorizontal(&ubRedFinal, &ubGreenFinal, &ubBlueFinal, realWidth, ubRed, ubGreen, ubBlue, ubRed2, ubGreen2, ubBlue2, FLG_GRADIENT, transparent, x, &ubAlpha); - else if (FLG_GRADIENT & GRADIENT_TB || FLG_GRADIENT & GRADIENT_BT) - gradientVertical(&ubRedFinal, &ubGreenFinal, &ubBlueFinal, ulBitmapHeight, ubRed, ubGreen, ubBlue, ubRed2, ubGreen2, ubBlue2, FLG_GRADIENT, transparent, y, &ubAlpha); - - fAlphaFactor = (float) ubAlpha / (float) 0xff; - ((UINT32 *) pvBits)[x + y * ulBitmapWidth] = (ubAlpha << 24) | ((UCHAR) (ubRedFinal * fAlphaFactor) << 16) | ((UCHAR) (ubGreenFinal * fAlphaFactor) << 8) | ((UCHAR) (ubBlueFinal * fAlphaFactor)); - } else { - ubAlpha = percent_to_byte(alpha); - ubRedFinal = ubRed; - ubGreenFinal = ubGreen; - ubBlueFinal = ubBlue; - fAlphaFactor = (float) ubAlpha / (float) 0xff; - - ((UINT32 *) pvBits)[x + y * ulBitmapWidth] = (ubAlpha << 24) | ((UCHAR) (ubRedFinal * fAlphaFactor) << 16) | ((UCHAR) (ubGreenFinal * fAlphaFactor) << 8) | ((UCHAR) (ubBlueFinal * fAlphaFactor)); - } - } - } - } - GdiAlphaBlend(hdcwnd, rc->left, rc->top, ulBitmapWidth, ulBitmapHeight, hdc, 0, 0, ulBitmapWidth, ulBitmapHeight, bf); - SelectObject(hdc, holdbitmap); - DeleteObject(hbitmap); - - // TR+BR CORNER - hbitmap = CreateDIBSection(hdc, &bmi, DIB_RGB_COLORS, &pvBits, NULL, 0x0); - - //SelectObject(hdc, BrMask); // already BrMask? - holdbitmap = reinterpret_cast(SelectObject(hdc, hbitmap)); - RoundRect(hdc, -1 - ulBitmapWidth, -1, ulBitmapWidth + 1, (realHeight + 1), cfg::dat.cornerRadius << 1, cfg::dat.cornerRadius << 1); - - for (y = 0; y < ulBitmapHeight; y++) { - for (x = 0; x < ulBitmapWidth; x++) { - if (((((UINT32 *) pvBits)[x + y * ulBitmapWidth]) << 8) == 0xFF00FF00 || (y< ulBitmapHeight >> 1 && !(FLG_CORNER & CORNER_BR && FLG_CORNER & CORNER_ACTIVE)) || (y > ulBitmapHeight >> 1 && !(FLG_CORNER & CORNER_TR && FLG_CORNER & CORNER_ACTIVE))) { - if (FLG_GRADIENT & GRADIENT_ACTIVE) { - if (FLG_GRADIENT & GRADIENT_LR || FLG_GRADIENT & GRADIENT_RL) { - realx = x + realWidth; - realx = realx > realWidth ? realWidth : realx; - gradientHorizontal(&ubRedFinal, &ubGreenFinal, &ubBlueFinal, realWidth, ubRed, ubGreen, ubBlue, ubRed2, ubGreen2, ubBlue2, FLG_GRADIENT, transparent, realx, &ubAlpha); - } else if (FLG_GRADIENT & GRADIENT_TB || FLG_GRADIENT & GRADIENT_BT) - gradientVertical(&ubRedFinal, &ubGreenFinal, &ubBlueFinal, ulBitmapHeight, ubRed, ubGreen, ubBlue, ubRed2, ubGreen2, ubBlue2, FLG_GRADIENT, transparent, y, &ubAlpha); - - fAlphaFactor = (float) ubAlpha / (float) 0xff; - ((UINT32 *) pvBits)[x + y * ulBitmapWidth] = (ubAlpha << 24) | ((UCHAR) (ubRedFinal * fAlphaFactor) << 16) | ((UCHAR) (ubGreenFinal * fAlphaFactor) << 8) | ((UCHAR) (ubBlueFinal * fAlphaFactor)); - } else { - ubAlpha = percent_to_byte(alpha); - ubRedFinal = ubRed; - ubGreenFinal = ubGreen; - ubBlueFinal = ubBlue; - fAlphaFactor = (float) ubAlpha / (float) 0xff; - - ((UINT32 *) pvBits)[x + y * ulBitmapWidth] = (ubAlpha << 24) | ((UCHAR) (ubRedFinal * fAlphaFactor) << 16) | ((UCHAR) (ubGreenFinal * fAlphaFactor) << 8) | ((UCHAR) (ubBlueFinal * fAlphaFactor)); - } - } - } - } - GdiAlphaBlend(hdcwnd, rc->right - realHeightHalf, rc->top, ulBitmapWidth, ulBitmapHeight, hdc, 0, 0, ulBitmapWidth, ulBitmapHeight, bf); - } + HDC hdc = CreateCompatibleDC(hdcwnd); + if (!hdc) + return; + + BITMAPINFO bmi; + memset(&bmi, 0, sizeof(BITMAPINFO)); + bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); + + if (FLG_GRADIENT & GRADIENT_ACTIVE && (FLG_GRADIENT & GRADIENT_LR || FLG_GRADIENT & GRADIENT_RL)) { + bmi.bmiHeader.biWidth = ulBitmapWidth = realWidth; + bmi.bmiHeader.biHeight = ulBitmapHeight = 1; + } + else if (FLG_GRADIENT & GRADIENT_ACTIVE && (FLG_GRADIENT & GRADIENT_TB || FLG_GRADIENT & GRADIENT_BT)) { + bmi.bmiHeader.biWidth = ulBitmapWidth = 1; + bmi.bmiHeader.biHeight = ulBitmapHeight = realHeight; + } + else { + bmi.bmiHeader.biWidth = ulBitmapWidth = 1; + bmi.bmiHeader.biHeight = ulBitmapHeight = 1; + } + + bmi.bmiHeader.biPlanes = 1; + bmi.bmiHeader.biBitCount = 32; + bmi.bmiHeader.biCompression = BI_RGB; + bmi.bmiHeader.biSizeImage = ulBitmapWidth * ulBitmapHeight * 4; + + void *pvBits; + HBITMAP hbitmap = CreateDIBSection(hdc, &bmi, DIB_RGB_COLORS, &pvBits, NULL, 0x0); + if (hbitmap == NULL || pvBits == NULL) { + DeleteDC(hdc); + return; + } + + HBITMAP holdbitmap = reinterpret_cast(SelectObject(hdc, hbitmap)); + + // convert basecolor to RGB and then merge alpha so its ARGB + basecolor = argb_from_cola(revcolref(basecolor), alpha); + basecolor2 = argb_from_cola(revcolref(basecolor2), alpha); + + UCHAR ubRed = (UCHAR)(basecolor >> 16); + UCHAR ubGreen = (UCHAR)(basecolor >> 8); + UCHAR ubBlue = (UCHAR)basecolor; + + UCHAR ubRed2 = (UCHAR)(basecolor2 >> 16); + UCHAR ubGreen2 = (UCHAR)(basecolor2 >> 8); + UCHAR ubBlue2 = (UCHAR)basecolor2; + + //DRAW BASE - make corner space 100% transparent + for (int y = 0; y < ulBitmapHeight; y++) { + for (int x = 0; x < ulBitmapWidth; x++) { + if (FLG_GRADIENT & GRADIENT_ACTIVE) { + if (FLG_GRADIENT & GRADIENT_LR || FLG_GRADIENT & GRADIENT_RL) { + int realx = x + realHeightHalf; + realx = realx > ulBitmapWidth ? ulBitmapWidth : realx; + gradientHorizontal(&ubRedFinal, &ubGreenFinal, &ubBlueFinal, ulBitmapWidth, ubRed, ubGreen, ubBlue, ubRed2, ubGreen2, ubBlue2, FLG_GRADIENT, transparent, realx, &ubAlpha); + } + else if (FLG_GRADIENT & GRADIENT_TB || FLG_GRADIENT & GRADIENT_BT) + gradientVertical(&ubRedFinal, &ubGreenFinal, &ubBlueFinal, ulBitmapHeight, ubRed, ubGreen, ubBlue, ubRed2, ubGreen2, ubBlue2, FLG_GRADIENT, transparent, y, &ubAlpha); + + float fAlphaFactor = (float)ubAlpha / (float)0xff; + ((UINT32 *)pvBits)[x + y * ulBitmapWidth] = (ubAlpha << 24) | ((UCHAR)(ubRedFinal * fAlphaFactor) << 16) | ((UCHAR)(ubGreenFinal * fAlphaFactor) << 8) | ((UCHAR)(ubBlueFinal * fAlphaFactor)); + } + else { + ubAlpha = percent_to_byte(alpha); + ubRedFinal = ubRed; + ubGreenFinal = ubGreen; + ubBlueFinal = ubBlue; + + float fAlphaFactor = (float)ubAlpha / (float)0xff; + ((UINT32 *)pvBits)[x + y * ulBitmapWidth] = (ubAlpha << 24) | ((UCHAR)(ubRedFinal * fAlphaFactor) << 16) | ((UCHAR)(ubGreenFinal * fAlphaFactor) << 8) | ((UCHAR)(ubBlueFinal * fAlphaFactor)); + } + } + } + bf.BlendOp = AC_SRC_OVER; + bf.BlendFlags = 0; + bf.SourceConstantAlpha = (UCHAR)(basecolor >> 24); + bf.AlphaFormat = AC_SRC_ALPHA; // so it will use our specified alpha value + + GdiAlphaBlend(hdcwnd, rc->left + realHeightHalf, rc->top, (realWidth - realHeightHalf * 2), realHeight, hdc, 0, 0, ulBitmapWidth, ulBitmapHeight, bf); + + SelectObject(hdc, holdbitmap); + DeleteObject(hbitmap); + + saved_alpha = (UCHAR)(basecolor >> 24); + + // corners + HBRUSH holdbrush; + HBRUSH BrMask = CreateSolidBrush(RGB(0xFF, 0x00, 0xFF)); + { + bmi.bmiHeader.biWidth = ulBitmapWidth = realHeightHalf; + bmi.bmiHeader.biHeight = ulBitmapHeight = realHeight; + bmi.bmiHeader.biSizeImage = ulBitmapWidth * ulBitmapHeight * 4; + + if (ulBitmapWidth <= 0 || ulBitmapHeight <= 0) { + DeleteDC(hdc); + DeleteObject(BrMask); + return; + } + + // TL+BL CORNER + hbitmap = CreateDIBSection(hdc, &bmi, DIB_RGB_COLORS, &pvBits, NULL, 0x0); + + if (hbitmap == 0 || pvBits == NULL) { + DeleteObject(BrMask); + DeleteDC(hdc); + return; + } + + holdbrush = reinterpret_cast(SelectObject(hdc, BrMask)); + holdbitmap = reinterpret_cast(SelectObject(hdc, hbitmap)); + RoundRect(hdc, -1, -1, ulBitmapWidth * 2 + 1, (realHeight + 1), cfg::dat.cornerRadius << 1, cfg::dat.cornerRadius << 1); + + for (int y = 0; y < ulBitmapHeight; y++) { + for (int x = 0; x < ulBitmapWidth; x++) { + if (((((UINT32 *)pvBits)[x + y * ulBitmapWidth]) << 8) == 0xFF00FF00 || (y< ulBitmapHeight >> 1 && !(FLG_CORNER & CORNER_BL && FLG_CORNER & CORNER_ACTIVE)) || (y > ulBitmapHeight >> 2 && !(FLG_CORNER & CORNER_TL && FLG_CORNER & CORNER_ACTIVE))) { + if (FLG_GRADIENT & GRADIENT_ACTIVE) { + if (FLG_GRADIENT & GRADIENT_LR || FLG_GRADIENT & GRADIENT_RL) + gradientHorizontal(&ubRedFinal, &ubGreenFinal, &ubBlueFinal, realWidth, ubRed, ubGreen, ubBlue, ubRed2, ubGreen2, ubBlue2, FLG_GRADIENT, transparent, x, &ubAlpha); + else if (FLG_GRADIENT & GRADIENT_TB || FLG_GRADIENT & GRADIENT_BT) + gradientVertical(&ubRedFinal, &ubGreenFinal, &ubBlueFinal, ulBitmapHeight, ubRed, ubGreen, ubBlue, ubRed2, ubGreen2, ubBlue2, FLG_GRADIENT, transparent, y, &ubAlpha); + + float fAlphaFactor = (float)ubAlpha / (float)0xff; + ((UINT32 *)pvBits)[x + y * ulBitmapWidth] = (ubAlpha << 24) | ((UCHAR)(ubRedFinal * fAlphaFactor) << 16) | ((UCHAR)(ubGreenFinal * fAlphaFactor) << 8) | ((UCHAR)(ubBlueFinal * fAlphaFactor)); + } + else { + ubAlpha = percent_to_byte(alpha); + ubRedFinal = ubRed; + ubGreenFinal = ubGreen; + ubBlueFinal = ubBlue; + float fAlphaFactor = (float)ubAlpha / (float)0xff; + ((UINT32 *)pvBits)[x + y * ulBitmapWidth] = (ubAlpha << 24) | ((UCHAR)(ubRedFinal * fAlphaFactor) << 16) | ((UCHAR)(ubGreenFinal * fAlphaFactor) << 8) | ((UCHAR)(ubBlueFinal * fAlphaFactor)); + } + } + } + } + GdiAlphaBlend(hdcwnd, rc->left, rc->top, ulBitmapWidth, ulBitmapHeight, hdc, 0, 0, ulBitmapWidth, ulBitmapHeight, bf); + SelectObject(hdc, holdbitmap); + DeleteObject(hbitmap); + + // TR+BR CORNER + hbitmap = CreateDIBSection(hdc, &bmi, DIB_RGB_COLORS, &pvBits, NULL, 0x0); + + //SelectObject(hdc, BrMask); // already BrMask? + holdbitmap = reinterpret_cast(SelectObject(hdc, hbitmap)); + RoundRect(hdc, -1 - ulBitmapWidth, -1, ulBitmapWidth + 1, (realHeight + 1), cfg::dat.cornerRadius << 1, cfg::dat.cornerRadius << 1); + + for (int y = 0; y < ulBitmapHeight; y++) { + for (int x = 0; x < ulBitmapWidth; x++) { + if (((((UINT32 *)pvBits)[x + y * ulBitmapWidth]) << 8) == 0xFF00FF00 || (y< ulBitmapHeight >> 1 && !(FLG_CORNER & CORNER_BR && FLG_CORNER & CORNER_ACTIVE)) || (y > ulBitmapHeight >> 1 && !(FLG_CORNER & CORNER_TR && FLG_CORNER & CORNER_ACTIVE))) { + if (FLG_GRADIENT & GRADIENT_ACTIVE) { + if (FLG_GRADIENT & GRADIENT_LR || FLG_GRADIENT & GRADIENT_RL) { + int realx = x + realWidth; + realx = realx > realWidth ? realWidth : realx; + gradientHorizontal(&ubRedFinal, &ubGreenFinal, &ubBlueFinal, realWidth, ubRed, ubGreen, ubBlue, ubRed2, ubGreen2, ubBlue2, FLG_GRADIENT, transparent, realx, &ubAlpha); + } + else if (FLG_GRADIENT & GRADIENT_TB || FLG_GRADIENT & GRADIENT_BT) + gradientVertical(&ubRedFinal, &ubGreenFinal, &ubBlueFinal, ulBitmapHeight, ubRed, ubGreen, ubBlue, ubRed2, ubGreen2, ubBlue2, FLG_GRADIENT, transparent, y, &ubAlpha); + + float fAlphaFactor = (float)ubAlpha / (float)0xff; + ((UINT32 *)pvBits)[x + y * ulBitmapWidth] = (ubAlpha << 24) | ((UCHAR)(ubRedFinal * fAlphaFactor) << 16) | ((UCHAR)(ubGreenFinal * fAlphaFactor) << 8) | ((UCHAR)(ubBlueFinal * fAlphaFactor)); + } + else { + ubAlpha = percent_to_byte(alpha); + ubRedFinal = ubRed; + ubGreenFinal = ubGreen; + ubBlueFinal = ubBlue; + + float fAlphaFactor = (float)ubAlpha / (float)0xff; + ((UINT32 *)pvBits)[x + y * ulBitmapWidth] = (ubAlpha << 24) | ((UCHAR)(ubRedFinal * fAlphaFactor) << 16) | ((UCHAR)(ubGreenFinal * fAlphaFactor) << 8) | ((UCHAR)(ubBlueFinal * fAlphaFactor)); + } + } + } + } + GdiAlphaBlend(hdcwnd, rc->right - realHeightHalf, rc->top, ulBitmapWidth, ulBitmapHeight, hdc, 0, 0, ulBitmapWidth, ulBitmapHeight, bf); + } DrawBorderStyle(hdcwnd, rc, BORDERSTYLE); - SelectObject(hdc, holdbitmap); - DeleteObject(hbitmap); - SelectObject(hdc, holdbrush); - DeleteObject(BrMask); - DeleteDC(hdc); + SelectObject(hdc, holdbitmap); + DeleteObject(hbitmap); + SelectObject(hdc, holdbrush); + DeleteObject(BrMask); + DeleteDC(hdc); } void __inline gradientHorizontal(UCHAR *ubRedFinal, UCHAR *ubGreenFinal, UCHAR *ubBlueFinal, ULONG ulBitmapWidth, UCHAR ubRed, UCHAR ubGreen, UCHAR ubBlue, UCHAR ubRed2, UCHAR ubGreen2, UCHAR ubBlue2, DWORD FLG_GRADIENT, BOOL transparent, UINT32 x, UCHAR *ubAlpha) { - FLOAT fSolidMulti, fInvSolidMulti; - - // solid to transparent - if (transparent) { - *ubAlpha = (UCHAR) ((float) x / (float) ulBitmapWidth * 255); - *ubAlpha = FLG_GRADIENT & GRADIENT_LR ? 0xFF - (*ubAlpha) : (*ubAlpha); - *ubRedFinal = ubRed; *ubGreenFinal = ubGreen; *ubBlueFinal = ubBlue; - } else { // solid to solid2 - if (FLG_GRADIENT & GRADIENT_LR) { - fSolidMulti = ((float) x / (float) ulBitmapWidth); - fInvSolidMulti = 1 - fSolidMulti; - } else { - fInvSolidMulti = ((float) x / (float) ulBitmapWidth); - fSolidMulti = 1 - fInvSolidMulti; - } - - *ubRedFinal = (UCHAR) (((float) ubRed * (float) fInvSolidMulti) + ((float) ubRed2 * (float) fSolidMulti)); - *ubGreenFinal = (UCHAR) (((float) ubGreen * (float) fInvSolidMulti) + ((float) ubGreen2 * (float) fSolidMulti)); - *ubBlueFinal = (UCHAR) (((float) ubBlue * (float) fInvSolidMulti) + ((float) ubBlue2 * (float) fSolidMulti)); - - *ubAlpha = 0xFF; - } + FLOAT fSolidMulti, fInvSolidMulti; + + // solid to transparent + if (transparent) { + *ubAlpha = (UCHAR)((float)x / (float)ulBitmapWidth * 255); + *ubAlpha = FLG_GRADIENT & GRADIENT_LR ? 0xFF - (*ubAlpha) : (*ubAlpha); + *ubRedFinal = ubRed; *ubGreenFinal = ubGreen; *ubBlueFinal = ubBlue; + } + else { // solid to solid2 + if (FLG_GRADIENT & GRADIENT_LR) { + fSolidMulti = ((float)x / (float)ulBitmapWidth); + fInvSolidMulti = 1 - fSolidMulti; + } + else { + fInvSolidMulti = ((float)x / (float)ulBitmapWidth); + fSolidMulti = 1 - fInvSolidMulti; + } + + *ubRedFinal = (UCHAR)(((float)ubRed * (float)fInvSolidMulti) + ((float)ubRed2 * (float)fSolidMulti)); + *ubGreenFinal = (UCHAR)(((float)ubGreen * (float)fInvSolidMulti) + ((float)ubGreen2 * (float)fSolidMulti)); + *ubBlueFinal = (UCHAR)(((float)ubBlue * (float)fInvSolidMulti) + ((float)ubBlue2 * (float)fSolidMulti)); + + *ubAlpha = 0xFF; + } } void __inline gradientVertical(UCHAR *ubRedFinal, UCHAR *ubGreenFinal, UCHAR *ubBlueFinal, ULONG ulBitmapHeight, UCHAR ubRed, UCHAR ubGreen, UCHAR ubBlue, UCHAR ubRed2, UCHAR ubGreen2, UCHAR ubBlue2, DWORD FLG_GRADIENT, BOOL transparent, UINT32 y, UCHAR *ubAlpha) { - FLOAT fSolidMulti, fInvSolidMulti; - - // solid to transparent - if (transparent) { - *ubAlpha = (UCHAR) ((float) y / (float) ulBitmapHeight * 255); - *ubAlpha = FLG_GRADIENT & GRADIENT_BT ? 0xFF - *ubAlpha : *ubAlpha; - *ubRedFinal = ubRed; *ubGreenFinal = ubGreen; *ubBlueFinal = ubBlue; - } else { // solid to solid2 - if (FLG_GRADIENT & GRADIENT_BT) { - fSolidMulti = ((float) y / (float) ulBitmapHeight); - fInvSolidMulti = 1 - fSolidMulti; - } else { - fInvSolidMulti = ((float) y / (float) ulBitmapHeight); - fSolidMulti = 1 - fInvSolidMulti; - } - - *ubRedFinal = (UCHAR) (((float) ubRed * (float) fInvSolidMulti) + ((float) ubRed2 * (float) fSolidMulti)); - *ubGreenFinal = (UCHAR) (((float) ubGreen * (float) fInvSolidMulti) + ((float) ubGreen2 * (float) fSolidMulti)); - *ubBlueFinal = (UCHAR) (((float) ubBlue * (float) fInvSolidMulti) + ((float) ubBlue2 * (float) fSolidMulti)); - - *ubAlpha = 0xFF; - } + FLOAT fSolidMulti, fInvSolidMulti; + + // solid to transparent + if (transparent) { + *ubAlpha = (UCHAR)((float)y / (float)ulBitmapHeight * 255); + *ubAlpha = FLG_GRADIENT & GRADIENT_BT ? 0xFF - *ubAlpha : *ubAlpha; + *ubRedFinal = ubRed; *ubGreenFinal = ubGreen; *ubBlueFinal = ubBlue; + } + else { // solid to solid2 + if (FLG_GRADIENT & GRADIENT_BT) { + fSolidMulti = ((float)y / (float)ulBitmapHeight); + fInvSolidMulti = 1 - fSolidMulti; + } + else { + fInvSolidMulti = ((float)y / (float)ulBitmapHeight); + fSolidMulti = 1 - fInvSolidMulti; + } + + *ubRedFinal = (UCHAR)(((float)ubRed * (float)fInvSolidMulti) + ((float)ubRed2 * (float)fSolidMulti)); + *ubGreenFinal = (UCHAR)(((float)ubGreen * (float)fInvSolidMulti) + ((float)ubGreen2 * (float)fSolidMulti)); + *ubBlueFinal = (UCHAR)(((float)ubBlue * (float)fInvSolidMulti) + ((float)ubBlue2 * (float)fSolidMulti)); + + *ubAlpha = 0xFF; + } } /* @@ -480,39 +476,39 @@ void __fastcall IMG_RenderImageItem(HDC hdc, ImageItem *item, RECT *rc) switch (item->bStretch) { case IMAGE_STRETCH_H: // tile image vertically, stretch to width - { - LONG top = rc->top; - - do { - if (top + item->height <= rc->bottom) { - GdiAlphaBlend(hdc, rc->left, top, width, item->height, hdcSrc, srcOrigX, srcOrigY, item->width, item->height, item->bf); - top += item->height; - } - else { - GdiAlphaBlend(hdc, rc->left, top, width, rc->bottom - top, hdcSrc, srcOrigX, srcOrigY, item->width, rc->bottom - top, item->bf); - break; - } + { + LONG top = rc->top; + + do { + if (top + item->height <= rc->bottom) { + GdiAlphaBlend(hdc, rc->left, top, width, item->height, hdcSrc, srcOrigX, srcOrigY, item->width, item->height, item->bf); + top += item->height; + } + else { + GdiAlphaBlend(hdc, rc->left, top, width, rc->bottom - top, hdcSrc, srcOrigX, srcOrigY, item->width, rc->bottom - top, item->bf); + break; + } + } while (true); } - while (true); break; - } - case IMAGE_STRETCH_V: // tile horizontally, stretch to height - { - LONG left = rc->left; - do { - if (left + item->width <= rc->right) { - GdiAlphaBlend(hdc, left, rc->top, item->width, height, hdcSrc, srcOrigX, srcOrigY, item->width, item->height, item->bf); - left += item->width; - } - else { - GdiAlphaBlend(hdc, left, rc->top, rc->right - left, height, hdcSrc, srcOrigX, srcOrigY, rc->right - left, item->height, item->bf); - break; - } + case IMAGE_STRETCH_V: // tile horizontally, stretch to height + { + LONG left = rc->left; + + do { + if (left + item->width <= rc->right) { + GdiAlphaBlend(hdc, left, rc->top, item->width, height, hdcSrc, srcOrigX, srcOrigY, item->width, item->height, item->bf); + left += item->width; + } + else { + GdiAlphaBlend(hdc, left, rc->top, rc->right - left, height, hdcSrc, srcOrigX, srcOrigY, rc->right - left, item->height, item->bf); + break; + } + } while (true); } - while (TRUE); break; - } + case IMAGE_STRETCH_B: // stretch the image in both directions... GdiAlphaBlend(hdc, rc->left, rc->top, width, height, hdcSrc, srcOrigX, srcOrigY, item->width, item->height, item->bf); diff --git a/plugins/Clist_nicer/src/clc.cpp b/plugins/Clist_nicer/src/clc.cpp index 91b1dfface..87136ab986 100644 --- a/plugins/Clist_nicer/src/clc.cpp +++ b/plugins/Clist_nicer/src/clc.cpp @@ -61,7 +61,7 @@ int AvatarChanged(WPARAM wParam, LPARAM lParam) int __forceinline __strcmp(const char * src, const char * dst) { - int ret = 0 ; + int ret = 0; while (!(ret = *(unsigned char *)src - *(unsigned char *)dst) && *dst) ++src, ++dst; @@ -109,21 +109,21 @@ static int ClcMetamodeChanged(WPARAM bMetaEnabled, LPARAM) static int ClcSettingChanged(WPARAM hContact, LPARAM lParam) { char *szProto = NULL; - DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *) lParam; + DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *)lParam; if (hContact) { - if ( !__strcmp(cws->szModule, "CList")) { - if ( !__strcmp(cws->szSetting, "StatusMsg")) + if (!__strcmp(cws->szModule, "CList")) { + if (!__strcmp(cws->szSetting, "StatusMsg")) SendMessage(pcli->hwndContactTree, INTM_STATUSMSGCHANGED, hContact, lParam); } - else if ( !__strcmp(cws->szModule, "UserInfo")) { - if ( !__strcmp(cws->szSetting, "ANSIcodepage")) + else if (!__strcmp(cws->szModule, "UserInfo")) { + if (!__strcmp(cws->szSetting, "ANSIcodepage")) pcli->pfnClcBroadcast(INTM_CODEPAGECHANGED, hContact, lParam); - else if ( !__strcmp(cws->szSetting, "Timezone") || !__strcmp(cws->szSetting, "TzName")) + else if (!__strcmp(cws->szSetting, "Timezone") || !__strcmp(cws->szSetting, "TzName")) ReloadExtraInfo(hContact); } else if (hContact != 0 && (szProto = GetContactProto(hContact)) != NULL) { - if ( !__strcmp(cws->szModule, "Protocol") && !__strcmp(cws->szSetting, "p")) { + if (!__strcmp(cws->szModule, "Protocol") && !__strcmp(cws->szSetting, "p")) { char *szProto_s; pcli->pfnClcBroadcast(INTM_PROTOCHANGED, hContact, lParam); if (cws->value.type == DBVT_DELETED) @@ -133,10 +133,10 @@ static int ClcSettingChanged(WPARAM hContact, LPARAM lParam) pcli->pfnChangeContactIcon(hContact, IconFromStatusMode(szProto_s, szProto_s == NULL ? ID_STATUS_OFFLINE : cfg::getWord(hContact, szProto_s, "Status", ID_STATUS_OFFLINE), hContact, NULL), 0); } // something is being written to a protocol module - if ( !__strcmp(szProto, cws->szModule)) { + if (!__strcmp(szProto, cws->szModule)) { // was a unique setting key written? pcli->pfnInvalidateDisplayNameCacheEntry(hContact); - if ( !__strcmp(cws->szSetting, "Status")) { + if (!__strcmp(cws->szSetting, "Status")) { if (!cfg::getByte(hContact, "CList", "Hidden", 0)) { if (cfg::getByte("CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT)) { // User's state is changing, and we are hideOffline-ing @@ -156,7 +156,7 @@ static int ClcSettingChanged(WPARAM hContact, LPARAM lParam) SendMessage(pcli->hwndContactTree, INTM_STATUSMSGCHANGED, hContact, lParam); else if (strstr(cws->szSetting, "XStatus")) SendMessage(pcli->hwndContactTree, INTM_XSTATUSCHANGED, hContact, lParam); - else if ( !__strcmp(cws->szSetting, "Timezone") || !__strcmp(cws->szSetting, "TzName")) + else if (!__strcmp(cws->szSetting, "Timezone") || !__strcmp(cws->szSetting, "TzName")) ReloadExtraInfo(hContact); if (!(cfg::dat.dwFlags & CLUI_USEMETAICONS) && !__strcmp(szProto, META_PROTO)) @@ -180,7 +180,7 @@ static int ClcSettingChanged(WPARAM hContact, LPARAM lParam) SetButtonToSkinned(); } else if (szProto == NULL) { - if ( !__strcmp(cws->szSetting, "XStatusId")) + if (!__strcmp(cws->szSetting, "XStatusId")) CluiProtocolStatusChanged(0, cws->szModule); } return 0; @@ -206,7 +206,7 @@ int ClcShutdown(WPARAM, LPARAM) CSH_Destroy(); IMG_DeleteItems(); - for (int i=0; i < arStatusItems.getCount(); i++) + for (int i = 0; i < arStatusItems.getCount(); i++) mir_free(arStatusItems[i]); return 0; } @@ -448,6 +448,7 @@ LBL_Def: if (!FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) return 0; + contact->ace = cEntry; if (cEntry == NULL) contact->cFlags &= ~ECF_AVATAR; @@ -523,7 +524,7 @@ LBL_Def: break; if (contact && group) { - int iItem = pcli->pfnGetRowsPriorTo(&dat->list, group, List_IndexOf((SortedList*) & group->cl, contact)); + int iItem = pcli->pfnGetRowsPriorTo(&dat->list, group, List_IndexOf((SortedList*)& group->cl, contact)); pcli->pfnInvalidateItem(hwnd, dat, iItem); goto LBL_Def; } @@ -544,7 +545,7 @@ LBL_Def: case INTM_IDLECHANGED: if (FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) { - DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *) lParam; + DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *)lParam; char *szProto = (char*)cws->szModule; if (szProto == NULL) break; @@ -560,7 +561,7 @@ LBL_Def: case INTM_XSTATUSCHANGED: { - DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *) lParam; + DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *)lParam; char *szProto = (char *)cws->szModule; MCONTACT hContact = wParam; TExtraCache *p; @@ -638,7 +639,7 @@ LBL_Def: dat->szQuickSearch[0] = 0; { DWORD hitFlags; - dat->selection = HitTest(hwnd, dat, (short) LOWORD(lParam), (short) HIWORD(lParam), &contact, NULL, &hitFlags); + dat->selection = HitTest(hwnd, dat, (short)LOWORD(lParam), (short)HIWORD(lParam), &contact, NULL, &hitFlags); if (hitFlags & CLCHT_ONITEMEXTRA) break; @@ -696,9 +697,11 @@ LBL_Def: CheckMenuItem(hMenu, POPUP_GROUPHIDEOFFLINE, contact->group->hideOffline ? MF_CHECKED : MF_UNCHECKED); DestroyMenu(hMenu); return 0; - } else if (contact->type == CLCIT_CONTACT) - hMenu = (HMENU) CallService(MS_CLIST_MENUBUILDCONTACT, (WPARAM) contact->hContact, 0); - } else { + } + else if (contact->type == CLCIT_CONTACT) + hMenu = (HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, (WPARAM)contact->hContact, 0); + } + else { //call parent for new group/hide offline menu PostMessage(GetParent(hwnd), WM_CONTEXTMENU, wParam, lParam); return 0; diff --git a/plugins/Clist_nicer/src/clcidents.cpp b/plugins/Clist_nicer/src/clcidents.cpp index 228cccae1d..bf2200cec5 100644 --- a/plugins/Clist_nicer/src/clcidents.cpp +++ b/plugins/Clist_nicer/src/clcidents.cpp @@ -48,7 +48,7 @@ int FindItem(HWND hwnd, struct ClcData *dat, HANDLE hItem, ClcContact **contact, ClcGroup *group = &dat->list; group->scanIndex = 0; - for (; ;) { + for (;;) { if (group->scanIndex == group->cl.count) { ClcGroup *tgroup; group = group->parent; @@ -56,7 +56,7 @@ int FindItem(HWND hwnd, struct ClcData *dat, HANDLE hItem, ClcContact **contact, break; nowVisible = 1; for (tgroup = group; tgroup; tgroup = tgroup->parent) { - if ( !(group->expanded)) { + if (!(group->expanded)) { nowVisible = 0; break; } } @@ -65,23 +65,19 @@ int FindItem(HWND hwnd, struct ClcData *dat, HANDLE hItem, ClcContact **contact, } if (nowVisible) index++; - if ((IsHContactGroup(hItem) && group->cl.items[group->scanIndex]->type == CLCIT_GROUP && ((UINT_PTR) hItem & ~HCONTACT_ISGROUP) == group->cl.items[group->scanIndex]->groupId) || - (IsHContactContact(hItem) && group->cl.items[group->scanIndex]->type == CLCIT_CONTACT && group->cl.items[group->scanIndex]->hContact == (MCONTACT)hItem) || - (IsHContactInfo(hItem) && group->cl.items[group->scanIndex]->type == CLCIT_INFO && group->cl.items[group->scanIndex]->hContact == (MCONTACT)((UINT_PTR) hItem & ~HCONTACT_ISINFO))) - { + if ((IsHContactGroup(hItem) && group->cl.items[group->scanIndex]->type == CLCIT_GROUP && ((UINT_PTR)hItem & ~HCONTACT_ISGROUP) == group->cl.items[group->scanIndex]->groupId) || + (IsHContactContact(hItem) && group->cl.items[group->scanIndex]->type == CLCIT_CONTACT && group->cl.items[group->scanIndex]->hContact == (MCONTACT)hItem) || + (IsHContactInfo(hItem) && group->cl.items[group->scanIndex]->type == CLCIT_INFO && group->cl.items[group->scanIndex]->hContact == (MCONTACT)((UINT_PTR)hItem & ~HCONTACT_ISINFO))) { if (isVisible) { - if ( !nowVisible) + if (!nowVisible) *isVisible = 0; else { - int posy = RowHeight::getItemTopY(dat,index+1); - if (posyyScroll) - *isVisible=0; - //if ((index + 1) * dat->rowHeight< dat->yScroll) - // *isVisible = 0; + int posy = RowHeight::getItemTopY(dat, index + 1); + if (posy < dat->yScroll) + *isVisible = 0; else { RECT clRect; GetClientRect(hwnd, &clRect); - //if (index * dat->rowHeight >= dat->yScroll + clRect.bottom) if (posy >= dat->yScroll + clRect.bottom) *isVisible = 0; else diff --git a/plugins/Clist_nicer/src/clcitems.cpp b/plugins/Clist_nicer/src/clcitems.cpp index 19e2d7ceec..2d1cf246f3 100644 --- a/plugins/Clist_nicer/src/clcitems.cpp +++ b/plugins/Clist_nicer/src/clcitems.cpp @@ -43,10 +43,10 @@ static void TZ_LoadTimeZone(MCONTACT hContact, struct TExtraCache *c) //routines for managing adding/removal of items in the list, including sorting -ClcContact* CreateClcContact( void ) +ClcContact* CreateClcContact(void) { - ClcContact* p = (ClcContact*)mir_alloc( sizeof( ClcContact )); - if ( p != NULL ) { + ClcContact* p = (ClcContact*)mir_alloc(sizeof(ClcContact)); + if (p != NULL) { memset(p, 0, sizeof(ClcContact)); p->avatarLeft = p->extraIconRightBegin = p->xStatusIcon = -1; } @@ -70,8 +70,8 @@ int AddInfoItemToGroup(ClcGroup *group, int flags, const TCHAR *pszText) ClcGroup *AddGroup(HWND hwnd, struct ClcData *dat, const TCHAR *szName, DWORD flags, int groupId, int calcTotalMembers) { ClcGroup *p = coreCli.pfnAddGroup(hwnd, dat, szName, flags, groupId, calcTotalMembers); - if ( p && p->parent ) - RTL_DetectGroupName( p->parent->cl.items[ p->parent->cl.count-1] ); + if (p && p->parent) + RTL_DetectGroupName(p->parent->cl.items[p->parent->cl.count - 1]); return p; } @@ -99,7 +99,7 @@ void LoadAvatarForContact(ClcContact *p) p->ace->t_lastAccess = cfg::dat.t_now; } if (p->ace == NULL) - p->cFlags &= ~ECF_AVATAR; + p->cFlags &= ~ECF_AVATAR; } int AddContactToGroup(struct ClcData *dat, ClcGroup *group, MCONTACT hContact) @@ -152,7 +152,7 @@ void RebuildEntireList(HWND hwnd, struct ClcData *dat) { DWORD style = GetWindowLongPtr(hwnd, GWL_STYLE); ClcGroup *group; - DBVARIANT dbv = {0}; + DBVARIANT dbv = { 0 }; RowHeight::Clear(dat); RowHeight::getMaxRowHeight(dat, hwnd); @@ -164,7 +164,7 @@ void RebuildEntireList(HWND hwnd, struct ClcData *dat) dat->selection = -1; dat->SelectMode = cfg::getByte("CLC", "SelectMode", 0); { - for (int i = 1; ; i++) { + for (int i = 1;; i++) { DWORD groupFlags; TCHAR *szGroupName = pcli->pfnGetGroupName(i, &groupFlags); if (szGroupName == NULL) @@ -179,19 +179,19 @@ void RebuildEntireList(HWND hwnd, struct ClcData *dat) if (cfg::getTString(hContact, "CList", "Group", &dbv)) group = &dat->list; else { - group = pcli->pfnAddGroup(hwnd, dat, dbv.ptszVal, (DWORD) - 1, 0, 0); + group = pcli->pfnAddGroup(hwnd, dat, dbv.ptszVal, (DWORD)-1, 0, 0); mir_free(dbv.ptszVal); } if (group != NULL) { group->totalMembers++; - if ( !(style & CLS_NOHIDEOFFLINE) && (style & CLS_HIDEOFFLINE || group->hideOffline)) { + if (!(style & CLS_NOHIDEOFFLINE) && (style & CLS_HIDEOFFLINE || group->hideOffline)) { char *szProto = GetContactProto(hContact); if (szProto == NULL) { - if ( !pcli->pfnIsHiddenMode(dat, ID_STATUS_OFFLINE)) + if (!pcli->pfnIsHiddenMode(dat, ID_STATUS_OFFLINE)) AddContactToGroup(dat, group, hContact); } - else if ( !pcli->pfnIsHiddenMode(dat, (WORD) cfg::getWord(hContact, szProto, "Status", ID_STATUS_OFFLINE))) + else if (!pcli->pfnIsHiddenMode(dat, (WORD)cfg::getWord(hContact, szProto, "Status", ID_STATUS_OFFLINE))) AddContactToGroup(dat, group, hContact); } else AddContactToGroup(dat, group, hContact); @@ -202,7 +202,7 @@ void RebuildEntireList(HWND hwnd, struct ClcData *dat) if (style & CLS_HIDEEMPTYGROUPS) { group = &dat->list; group->scanIndex = 0; - for (; ;) { + for (;;) { if (group->scanIndex == group->cl.count) { group = group->parent; if (group == NULL) diff --git a/plugins/Clist_nicer/src/clcmsgs.cpp b/plugins/Clist_nicer/src/clcmsgs.cpp index dc85033317..c7e9df06f7 100644 --- a/plugins/Clist_nicer/src/clcmsgs.cpp +++ b/plugins/Clist_nicer/src/clcmsgs.cpp @@ -87,15 +87,16 @@ LRESULT ProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPARAM return 0; case CLM_SETFONT: - if (HIWORD(lParam)>FONTID_LAST) + if (HIWORD(lParam) > FONTID_LAST) return 0; + dat->fontInfo[HIWORD(lParam)].hFont = (HFONT)wParam; dat->fontInfo[HIWORD(lParam)].changed = 1; RowHeight::getMaxRowHeight(dat, hwnd); if (LOWORD(lParam)) - InvalidateRect(hwnd,NULL,FALSE); + InvalidateRect(hwnd, NULL, FALSE); return 0; case CLM_ISMULTISELECT: diff --git a/plugins/Clist_nicer/src/clcopts.cpp b/plugins/Clist_nicer/src/clcopts.cpp index ccff06c1b1..eb8047691e 100644 --- a/plugins/Clist_nicer/src/clcopts.cpp +++ b/plugins/Clist_nicer/src/clcopts.cpp @@ -33,7 +33,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static INT_PTR CALLBACK DlgProcClcMainOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); -//static INT_PTR CALLBACK DlgProcClcTextOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); extern INT_PTR CALLBACK DlgProcViewModesSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); extern INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); extern INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); @@ -45,10 +44,10 @@ struct CheckBoxToStyleEx_t { DWORD flag; int not_t; } static const checkBoxToStyleEx[] = { - {IDC_DISABLEDRAGDROP,CLS_EX_DISABLEDRAGDROP,0}, {IDC_NOTEDITLABELS,CLS_EX_EDITLABELS,1}, - {IDC_SHOWSELALWAYS,CLS_EX_SHOWSELALWAYS,0}, {IDC_TRACKSELECT,CLS_EX_TRACKSELECT,0}, - {IDC_DIVIDERONOFF,CLS_EX_DIVIDERONOFF,0}, {IDC_NOTNOTRANSLUCENTSEL,CLS_EX_NOTRANSLUCENTSEL,1}, - {IDC_NOTNOSMOOTHSCROLLING,CLS_EX_NOSMOOTHSCROLLING,1} + { IDC_DISABLEDRAGDROP, CLS_EX_DISABLEDRAGDROP, 0 }, { IDC_NOTEDITLABELS, CLS_EX_EDITLABELS, 1 }, + { IDC_SHOWSELALWAYS, CLS_EX_SHOWSELALWAYS, 0 }, { IDC_TRACKSELECT, CLS_EX_TRACKSELECT, 0 }, + { IDC_DIVIDERONOFF, CLS_EX_DIVIDERONOFF, 0 }, { IDC_NOTNOTRANSLUCENTSEL, CLS_EX_NOTRANSLUCENTSEL, 1 }, + { IDC_NOTNOSMOOTHSCROLLING, CLS_EX_NOSMOOTHSCROLLING, 1 } }; struct CheckBoxToGroupStyleEx_t { @@ -56,9 +55,9 @@ struct CheckBoxToGroupStyleEx_t { DWORD flag; int not_t; } static const checkBoxToGroupStyleEx[] = { - {IDC_SHOWGROUPCOUNTS,CLS_EX_SHOWGROUPCOUNTS,0}, {IDC_HIDECOUNTSWHENEMPTY,CLS_EX_HIDECOUNTSWHENEMPTY,0}, - {IDC_LINEWITHGROUPS,CLS_EX_LINEWITHGROUPS,0}, {IDC_QUICKSEARCHVISONLY,CLS_EX_QUICKSEARCHVISONLY,0}, - {IDC_SORTGROUPSALPHA,CLS_EX_SORTGROUPSALPHA,0} + { IDC_SHOWGROUPCOUNTS, CLS_EX_SHOWGROUPCOUNTS, 0 }, { IDC_HIDECOUNTSWHENEMPTY, CLS_EX_HIDECOUNTSWHENEMPTY, 0 }, + { IDC_LINEWITHGROUPS, CLS_EX_LINEWITHGROUPS, 0 }, { IDC_QUICKSEARCHVISONLY, CLS_EX_QUICKSEARCHVISONLY, 0 }, + { IDC_SORTGROUPSALPHA, CLS_EX_SORTGROUPSALPHA, 0 } }; struct CheckBoxValues_t { @@ -67,17 +66,17 @@ struct CheckBoxValues_t { }; static const struct CheckBoxValues_t greyoutValues[] = { - {GREYF_UNFOCUS,LPGENT("Not focused")}, {MODEF_OFFLINE,LPGENT("Offline")}, {PF2_ONLINE,LPGENT("Online")}, {PF2_SHORTAWAY,LPGENT("Away")}, - {PF2_LONGAWAY,LPGENT("NA")}, {PF2_LIGHTDND,LPGENT("Occupied")}, {PF2_HEAVYDND,LPGENT("DND")}, {PF2_FREECHAT,LPGENT("Free for chat")}, - {PF2_INVISIBLE,LPGENT("Invisible")}, {PF2_OUTTOLUNCH,LPGENT("Out to lunch")}, {PF2_ONTHEPHONE,LPGENT("On the phone")} + { GREYF_UNFOCUS, LPGENT("Not focused") }, { MODEF_OFFLINE, LPGENT("Offline") }, { PF2_ONLINE, LPGENT("Online") }, { PF2_SHORTAWAY, LPGENT("Away") }, + { PF2_LONGAWAY, LPGENT("NA") }, { PF2_LIGHTDND, LPGENT("Occupied") }, { PF2_HEAVYDND, LPGENT("DND") }, { PF2_FREECHAT, LPGENT("Free for chat") }, + { PF2_INVISIBLE, LPGENT("Invisible") }, { PF2_OUTTOLUNCH, LPGENT("Out to lunch") }, { PF2_ONTHEPHONE, LPGENT("On the phone") } }; static const struct CheckBoxValues_t offlineValues[] = { - {MODEF_OFFLINE,LPGENT("Offline")}, {PF2_ONLINE,LPGENT("Online")}, {PF2_SHORTAWAY,LPGENT("Away")}, {PF2_LONGAWAY,LPGENT("NA")}, - {PF2_LIGHTDND,LPGENT("Occupied")}, {PF2_HEAVYDND,LPGENT("DND")}, {PF2_FREECHAT,LPGENT("Free for chat")}, {PF2_INVISIBLE,LPGENT("Invisible")}, - {PF2_OUTTOLUNCH,LPGENT("Out to lunch")}, {PF2_ONTHEPHONE,LPGENT("On the phone")} + { MODEF_OFFLINE, LPGENT("Offline") }, { PF2_ONLINE, LPGENT("Online") }, { PF2_SHORTAWAY, LPGENT("Away") }, { PF2_LONGAWAY, LPGENT("NA") }, + { PF2_LIGHTDND, LPGENT("Occupied") }, { PF2_HEAVYDND, LPGENT("DND") }, { PF2_FREECHAT, LPGENT("Free for chat") }, { PF2_INVISIBLE, LPGENT("Invisible") }, + { PF2_OUTTOLUNCH, LPGENT("Out to lunch") }, { PF2_ONTHEPHONE, LPGENT("On the phone") } }; -static UINT sortCtrlIDs[] = {IDC_SORTPRIMARY, IDC_SORTTHEN, IDC_SORTFINALLY, 0}; +static UINT sortCtrlIDs[] = { IDC_SORTPRIMARY, IDC_SORTTHEN, IDC_SORTFINALLY, 0 }; static void FillCheckBoxTree(HWND hwndTree, const struct CheckBoxValues_t *values, int nValues, DWORD style) { @@ -143,7 +142,8 @@ void GetDefaultFontSetting(int i, LOGFONT *lf, COLORREF *colour) case FONTID_NOTONLIST: *colour = GetSysColor(COLOR_3DSHADOW); break; -} } + } +} static INT_PTR CALLBACK DlgProcDspGroups(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { @@ -597,7 +597,7 @@ static INT_PTR CALLBACK DlgProcClcMainOpts(HWND hwndDlg, UINT msg, WPARAM wParam SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_GREYOUTOPTS), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_GREYOUTOPTS), GWL_STYLE) | TVS_NOHSCROLL | TVS_CHECKBOXES); { DWORD exStyle = cfg::getDword("CLC", "ExStyle", pcli->pfnGetDefaultExStyle()); - UDACCEL accel[2] = { {0,10}, {2,50} }; + UDACCEL accel[2] = { { 0, 10 }, { 2, 50 } }; SendDlgItemMessage(hwndDlg, IDC_SMOOTHTIMESPIN, UDM_SETRANGE, 0, MAKELONG(999, 0)); SendDlgItemMessage(hwndDlg, IDC_SMOOTHTIMESPIN, UDM_SETACCEL, SIZEOF(accel), (LPARAM)&accel); SendDlgItemMessage(hwndDlg, IDC_SMOOTHTIMESPIN, UDM_SETPOS, 0, MAKELONG(cfg::getWord("CLC", "ScrollTime", CLCDEFAULT_SCROLLTIME), 0)); @@ -740,7 +740,7 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, Utils::enableDlgControl(hwndDlg, IDC_SCROLL, IsDlgButtonChecked(hwndDlg, IDC_BITMAP)); Utils::enableDlgControl(hwndDlg, IDC_PROPORTIONAL, IsDlgButtonChecked(hwndDlg, IDC_BITMAP)); break; - + case WM_COMMAND: if (LOWORD(wParam) == IDC_BROWSE) { TCHAR str[MAX_PATH], filter[512]; @@ -785,32 +785,31 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, cfg::writeByte("CLC", "UseBitmap", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_BITMAP)); cfg::writeByte("CLC", "UseWinColours", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_WINCOLOUR)); - { - char str[MAX_PATH], strrel[MAX_PATH]; - GetDlgItemTextA(hwndDlg, IDC_FILENAME, str, SIZEOF(str)); - if ( PathToRelative(str, strrel)) - cfg::writeString(NULL, "CLC", "BkBitmap", strrel); - else - cfg::writeString(NULL, "CLC", "BkBitmap", str); - } { - WORD flags = 0; - if (IsDlgButtonChecked(hwndDlg, IDC_STRETCHH)) - flags |= CLB_STRETCHH; - if (IsDlgButtonChecked(hwndDlg, IDC_STRETCHV)) - flags |= CLB_STRETCHV; - if (IsDlgButtonChecked(hwndDlg, IDC_TILEH)) - flags |= CLBF_TILEH; - if (IsDlgButtonChecked(hwndDlg, IDC_TILEV)) - flags |= CLBF_TILEV; - if (IsDlgButtonChecked(hwndDlg, IDC_SCROLL)) - flags |= CLBF_SCROLL; - if (IsDlgButtonChecked(hwndDlg, IDC_PROPORTIONAL)) - flags |= CLBF_PROPORTIONAL; - cfg::writeWord("CLC", "BkBmpUse", flags); - cfg::dat.bWallpaperMode = IsDlgButtonChecked(hwndDlg, IDC_SKINMODE) ? 1 : 0; - cfg::writeByte("CLUI", "UseBkSkin", (BYTE)cfg::dat.bWallpaperMode); - } + char str[MAX_PATH], strrel[MAX_PATH]; + GetDlgItemTextA(hwndDlg, IDC_FILENAME, str, SIZEOF(str)); + if (PathToRelative(str, strrel)) + cfg::writeString(NULL, "CLC", "BkBitmap", strrel); + else + cfg::writeString(NULL, "CLC", "BkBitmap", str); + + WORD flags = 0; + if (IsDlgButtonChecked(hwndDlg, IDC_STRETCHH)) + flags |= CLB_STRETCHH; + if (IsDlgButtonChecked(hwndDlg, IDC_STRETCHV)) + flags |= CLB_STRETCHV; + if (IsDlgButtonChecked(hwndDlg, IDC_TILEH)) + flags |= CLBF_TILEH; + if (IsDlgButtonChecked(hwndDlg, IDC_TILEV)) + flags |= CLBF_TILEV; + if (IsDlgButtonChecked(hwndDlg, IDC_SCROLL)) + flags |= CLBF_SCROLL; + if (IsDlgButtonChecked(hwndDlg, IDC_PROPORTIONAL)) + flags |= CLBF_PROPORTIONAL; + cfg::writeWord("CLC", "BkBmpUse", flags); + cfg::dat.bWallpaperMode = IsDlgButtonChecked(hwndDlg, IDC_SKINMODE) ? 1 : 0; + cfg::writeByte("CLUI", "UseBkSkin", (BYTE)cfg::dat.bWallpaperMode); + pcli->pfnClcOptionsChanged(); PostMessage(pcli->hwndContactList, CLUIINTM_REDRAW, 0, 0); opt_clc_bkg_changed = 0; diff --git a/plugins/Clist_nicer/src/clcpaint.cpp b/plugins/Clist_nicer/src/clcpaint.cpp index 1b63554991..9d5e5946b3 100644 --- a/plugins/Clist_nicer/src/clcpaint.cpp +++ b/plugins/Clist_nicer/src/clcpaint.cpp @@ -32,7 +32,7 @@ extern ImageItem *g_glyphItem; extern int hClcProtoCount; extern HIMAGELIST hCListImages; -static BYTE divide3[765] = {255}; +static BYTE divide3[765] = { 255 }; extern char *im_clients[]; extern HICON im_clienthIcons[]; extern HICON overlayicons[]; @@ -1152,7 +1152,7 @@ bgskipped: rcContent.right = min(clRect->right - dat->rightMargin, rc.left - 3); } else { - nodisplay: +nodisplay: verticalfit = (rowHeight - fontHeight >= g_cysmIcon + 1); if (avatar_done) { if (verticalfit && av_right) @@ -1213,8 +1213,7 @@ bgskipped: DrawTextEx(hdcMem, &szText[textCounter], -1, &rcContent, i_dtFlags, &dtp); rcContent.top += statusFontHeight; textCounter += dtp.uiLengthDrawn; - } - while (textCounter <= ulLen && dtp.uiLengthDrawn && rcContent.top + statusFontHeight <= old_bottom); + } while (textCounter <= ulLen && dtp.uiLengthDrawn && rcContent.top + statusFontHeight <= old_bottom); } } } diff --git a/plugins/Clist_nicer/src/clcutils.cpp b/plugins/Clist_nicer/src/clcutils.cpp index 2a213032ed..57a5023c87 100644 --- a/plugins/Clist_nicer/src/clcutils.cpp +++ b/plugins/Clist_nicer/src/clcutils.cpp @@ -37,7 +37,7 @@ extern void ( *saveRecalcScrollBar )(HWND hwnd, struct ClcData *dat); static int MY_pathIsAbsolute(const TCHAR *path) { - if ( !path || !(mir_tstrlen(path) > 2)) + if (!path || !(mir_tstrlen(path) > 2)) return 0; if ((path[1] == ':' && path[2] == '\\') || (path[0] == '\\' && path[1] == '\\')) @@ -146,12 +146,12 @@ int RTL_HitTest(HWND hwnd, struct ClcData *dat, int testx, ClcContact *hitcontac int rightOffset = hitcontact->extraIconRightBegin; if (rightOffset) { - for (int i = dat->extraColumnsCount-1; i >= 0; i--) { + for (int i = dat->extraColumnsCount - 1; i >= 0; i--) { if (hitcontact->iExtraImage[i] == EMPTY_EXTRA_ICON) continue; rightOffset -= dat->extraColumnSpacing; - if (testx > rightOffset && testx < rightOffset + dat->extraColumnSpacing ) { + if (testx > rightOffset && testx < rightOffset + dat->extraColumnSpacing) { if (flags) *flags |= (CLCHT_ONITEMEXTRA | (i << 24)); return hit; @@ -244,7 +244,7 @@ int HitTest(HWND hwnd, struct ClcData *dat, int testx, int testy, ClcContact **c for (indent = 0; hitgroup->parent; indent++, hitgroup = hitgroup->parent) ; - if ( !dat->bisEmbedded) { + if (!dat->bisEmbedded) { if (hitcontact->type == CLCIT_CONTACT) { if (mirror_mode == 1 || (mirror_mode == 2 && hitcontact->pExtra->dwCFlags & ECF_RTLNICK)) return RTL_HitTest(hwnd, dat, testx, hitcontact, flags, indent, hit); @@ -257,7 +257,7 @@ int HitTest(HWND hwnd, struct ClcData *dat, int testx, int testy, ClcContact **c // avatar check if (hitcontact->type == CLCIT_CONTACT && cfg::dat.dwFlags & CLUI_FRAME_AVATARS && hitcontact->ace != NULL && hitcontact->avatarLeft != -1) { - if (testx >hitcontact->avatarLeft && testx < hitcontact->avatarLeft + cfg::dat.avatarSize) { + if (testx > hitcontact->avatarLeft && testx < hitcontact->avatarLeft + cfg::dat.avatarSize) { if (flags) *flags |= CLCHT_ONAVATAR; } @@ -287,7 +287,7 @@ int HitTest(HWND hwnd, struct ClcData *dat, int testx, int testy, ClcContact **c int rightOffset = hitcontact->extraIconRightBegin; if (rightOffset) { - for (i = dat->extraColumnsCount-1; i >= 0; i--) { + for (i = dat->extraColumnsCount - 1; i >= 0; i--) { if (hitcontact->iExtraImage[i] == EMPTY_EXTRA_ICON) continue; @@ -340,7 +340,6 @@ void ScrollTo(HWND hwnd, struct ClcData *dat, int desty, int noSmooth) DWORD startTick, nowTick; int oldy = dat->yScroll; RECT clRect, rcInvalidate; - int maxy, previousy; if (dat->iHotTrack != -1 && dat->yScroll != desty) { pcli->pfnInvalidateItem(hwnd, dat, dat->iHotTrack); @@ -350,23 +349,23 @@ void ScrollTo(HWND hwnd, struct ClcData *dat, int desty, int noSmooth) GetClientRect(hwnd, &clRect); rcInvalidate = clRect; - maxy = RowHeight::getTotalHeight(dat)-clRect.bottom; + int maxy = RowHeight::getTotalHeight(dat) - clRect.bottom; if (desty > maxy) desty = maxy; if (desty < 0) desty = 0; if (abs(desty - dat->yScroll) < 4) noSmooth = 1; - if ( !noSmooth && dat->exStyle & CLS_EX_NOSMOOTHSCROLLING) + if (!noSmooth && dat->exStyle & CLS_EX_NOSMOOTHSCROLLING) noSmooth = 1; - previousy = dat->yScroll; - if ( !noSmooth) { + int previousy = dat->yScroll; + if (!noSmooth) { startTick = GetTickCount(); - for (; ;) { + for (;;) { nowTick = GetTickCount(); if (nowTick >= startTick + dat->scrollTime) break; - dat->yScroll = oldy + (desty - oldy) * (int) (nowTick - startTick) / dat->scrollTime; + dat->yScroll = oldy + (desty - oldy) * (int)(nowTick - startTick) / dat->scrollTime; if (dat->backgroundBmpUse & CLBF_SCROLL || dat->hBmpBackground == NULL) ScrollWindowEx(hwnd, 0, previousy - dat->yScroll, NULL, NULL, NULL, NULL, SW_INVALIDATE); else @@ -381,7 +380,7 @@ void ScrollTo(HWND hwnd, struct ClcData *dat, int desty, int noSmooth) } dat->yScroll = desty; if (dat->backgroundBmpUse & CLBF_SCROLL || dat->hBmpBackground == NULL) { - if ( !noSmooth) + if (!noSmooth) ScrollWindowEx(hwnd, 0, previousy - dat->yScroll, NULL, NULL, NULL, NULL, SW_INVALIDATE); else InvalidateRect(hwnd, NULL, FALSE); @@ -408,7 +407,7 @@ void RecalcScrollBar(HWND hwnd, struct ClcData *dat) si.cbSize = sizeof(si); si.fMask = SIF_ALL; si.nMin = 0; - si.nMax = pcli->pfnGetRowTotalHeight(dat)-1; + si.nMax = pcli->pfnGetRowTotalHeight(dat) - 1; si.nPage = clRect.bottom; si.nPos = dat->yScroll; @@ -431,11 +430,11 @@ void RecalcScrollBar(HWND hwnd, struct ClcData *dat) nm.hdr.hwndFrom = hwnd; nm.hdr.idFrom = GetDlgCtrlID(hwnd); nm.pt.y = si.nMax; - SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM) & nm); + SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM)& nm); //saveRecalcScrollBar(hwnd, dat); } -void SetGroupExpand(HWND hwnd,struct ClcData *dat,ClcGroup *group,int newState) +void SetGroupExpand(HWND hwnd, struct ClcData *dat, ClcGroup *group, int newState) { int contentCount; int groupy; @@ -451,28 +450,28 @@ void SetGroupExpand(HWND hwnd,struct ClcData *dat,ClcGroup *group,int newState) return; group->expanded = newState != 0; } - InvalidateRect(hwnd,NULL,FALSE); - contentCount = pcli->pfnGetGroupContentsCount(group,1); + InvalidateRect(hwnd, NULL, FALSE); + contentCount = pcli->pfnGetGroupContentsCount(group, 1); - groupy=pcli->pfnGetRowsPriorTo(&dat->list,group,-1); - if (dat->selection>groupy && dat->selectionselection=groupy; - pcli->pfnRecalcScrollBar(hwnd,dat); + groupy = pcli->pfnGetRowsPriorTo(&dat->list, group, -1); + if (dat->selection > groupy && dat->selection < groupy + contentCount) dat->selection = groupy; + pcli->pfnRecalcScrollBar(hwnd, dat); - GetClientRect(hwnd,&clRect); - newy=dat->yScroll; - posy = RowHeight::getItemBottomY(dat, groupy+contentCount); - if (posy>=newy+clRect.bottom) - newy=posy-clRect.bottom; + GetClientRect(hwnd, &clRect); + newy = dat->yScroll; + posy = RowHeight::getItemBottomY(dat, groupy + contentCount); + if (posy >= newy + clRect.bottom) + newy = posy - clRect.bottom; posy = RowHeight::getItemTopY(dat, groupy); - if (newy>posy) newy=posy; - ScrollTo(hwnd,dat,newy,0); + if (newy > posy) newy = posy; + ScrollTo(hwnd, dat, newy, 0); - nm.hdr.code=CLN_EXPANDED; - nm.hdr.hwndFrom=hwnd; - nm.hdr.idFrom=GetDlgCtrlID(hwnd); - nm.hItem=(HANDLE)group->groupId; + nm.hdr.code = CLN_EXPANDED; + nm.hdr.hwndFrom = hwnd; + nm.hdr.idFrom = GetDlgCtrlID(hwnd); + nm.hItem = (HANDLE)group->groupId; nm.action = (group->expanded); - SendMessage(GetParent(hwnd),WM_NOTIFY,0,(LPARAM)&nm); + SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM)&nm); } static LRESULT CALLBACK RenameEditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) @@ -490,7 +489,7 @@ static LRESULT CALLBACK RenameEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPara break; case WM_GETDLGCODE: if (lParam) { - MSG *msg = (MSG *) lParam; + MSG *msg = (MSG *)lParam; if (msg->message == WM_KEYDOWN && msg->wParam == VK_TAB) return 0; if (msg->message == WM_CHAR && msg->wParam == '\t') @@ -519,19 +518,19 @@ void BeginRenameSelection(HWND hwnd, struct ClcData *dat) return; if (contact->type != CLCIT_CONTACT && contact->type != CLCIT_GROUP) return; - for (indent = 0; group->parent; indent++,group = group->parent) { + for (indent = 0; group->parent; indent++, group = group->parent) { ; } GetClientRect(hwnd, &clRect); x = indent * dat->groupIndent + dat->iconXSpace - 2; //y = dat->selection * dat->rowHeight - dat->yScroll; - y = RowHeight::getItemTopY(dat, dat->selection)-dat->yScroll; + y = RowHeight::getItemTopY(dat, dat->selection) - dat->yScroll; - h=dat->row_heights[dat->selection]; + h = dat->row_heights[dat->selection]; { int i; - for (i=0; i <= FONTID_LAST; i++) - if (hfontInfo[i].fontHeight+2) h=dat->fontInfo[i].fontHeight+2; + for (i = 0; i <= FONTID_LAST; i++) + if (h < dat->fontInfo[i].fontHeight + 2) h = dat->fontInfo[i].fontHeight + 2; } dat->hwndRenameEdit = CreateWindowEx(0, _T("RICHEDIT50W"), contact->szText, WS_CHILD | WS_BORDER | ES_MULTILINE | ES_AUTOHSCROLL, x, y, clRect.right - x, h, hwnd, NULL, g_hInst, NULL); @@ -550,9 +549,9 @@ void BeginRenameSelection(HWND hwnd, struct ClcData *dat) //dat->hwndRenameEdit = CreateWindow(_T("EDIT"), contact->szText, WS_CHILD | WS_BORDER | ES_AUTOHSCROLL, x, y, clRect.right - x, dat->rowHeight, hwnd, NULL, g_hInst, NULL); mir_subclassWindow(dat->hwndRenameEdit, RenameEditSubclassProc); - SendMessage(dat->hwndRenameEdit, WM_SETFONT, (WPARAM) (contact->type == CLCIT_GROUP ? dat->fontInfo[FONTID_GROUPS].hFont : dat->fontInfo[FONTID_CONTACTS].hFont), 0); + SendMessage(dat->hwndRenameEdit, WM_SETFONT, (WPARAM)(contact->type == CLCIT_GROUP ? dat->fontInfo[FONTID_GROUPS].hFont : dat->fontInfo[FONTID_CONTACTS].hFont), 0); SendMessage(dat->hwndRenameEdit, EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN | EC_USEFONTINFO, 0); - SendMessage(dat->hwndRenameEdit, EM_SETSEL, 0, (LPARAM) (-1)); + SendMessage(dat->hwndRenameEdit, EM_SETSEL, 0, (LPARAM)(-1)); ShowWindow(dat->hwndRenameEdit, SW_SHOW); SetFocus(dat->hwndRenameEdit); } @@ -580,11 +579,11 @@ void LoadClcOptions(HWND hwnd, struct ClcData *dat, BOOL bFirst) } ReleaseDC(hwnd, hdc); - dat->min_row_heigh = (int)cfg::getByte("CLC","RowHeight",CLCDEFAULT_ROWHEIGHT); - dat->group_row_height = (int)cfg::getByte("CLC","GRowHeight",CLCDEFAULT_ROWHEIGHT); + dat->min_row_heigh = (int)cfg::getByte("CLC", "RowHeight", CLCDEFAULT_ROWHEIGHT); + dat->group_row_height = (int)cfg::getByte("CLC", "GRowHeight", CLCDEFAULT_ROWHEIGHT); dat->row_border = 0; dat->rightMargin = cfg::getByte("CLC", "RightMargin", CLCDEFAULT_LEFTMARGIN); - dat->bkColour = cfg::getByte("CLC", "UseWinColours", CLCDEFAULT_USEWINDOWSCOLOURS) ? + dat->bkColour = cfg::getByte("CLC", "UseWinColours", CLCDEFAULT_USEWINDOWSCOLOURS) ? GetSysColor(COLOR_3DFACE) : cfg::getDword("CLC", "BkColour", CLCDEFAULT_BKCOLOUR); coreCli.pfnLoadClcOptions(hwnd, dat, bFirst); diff --git a/plugins/Clist_nicer/src/clistevents.cpp b/plugins/Clist_nicer/src/clistevents.cpp index 16c1735c73..9f5b3c85d5 100644 --- a/plugins/Clist_nicer/src/clistevents.cpp +++ b/plugins/Clist_nicer/src/clistevents.cpp @@ -55,7 +55,7 @@ extern HIMAGELIST hCListImages; HANDLE hNotifyFrame = (HANDLE)-1; -CListEvent* fnCreateEvent( void ) +CListEvent* fnCreateEvent(void) { CListEvent *p = reinterpret_cast(mir_alloc(sizeof(CListEvent))); if (p) @@ -67,15 +67,15 @@ CListEvent* fnCreateEvent( void ) void HideShowNotifyFrame() { int dwVisible = CallService(MS_CLIST_FRAMES_GETFRAMEOPTIONS, MAKEWPARAM(FO_FLAGS, hNotifyFrame), 0) & F_VISIBLE; - int desired; + int desired; - if (cfg::dat.dwFlags & CLUI_FRAME_AUTOHIDENOTIFY) - desired = cfg::dat.notifyActive ? TRUE : FALSE; - else - desired = dwVisible; + if (cfg::dat.dwFlags & CLUI_FRAME_AUTOHIDENOTIFY) + desired = cfg::dat.notifyActive ? TRUE : FALSE; + else + desired = dwVisible; - if (desired) { - if ( !dwVisible) + if (desired) { + if (!dwVisible) CallService(MS_CLIST_FRAMES_SHFRAME, (WPARAM)hNotifyFrame, 0); } else { @@ -98,15 +98,15 @@ static CLISTEVENT* MyGetEvent(int iSelection) LRESULT CALLBACK EventAreaWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { - switch(msg) { + switch (msg) { case WM_CREATE: hwndEventFrame = hwnd; return FALSE; case WM_MEASUREITEM: { - MEASUREITEMSTRUCT *lpi = (LPMEASUREITEMSTRUCT) lParam; - MENUITEMINFOA mii = {0}; + MEASUREITEMSTRUCT *lpi = (LPMEASUREITEMSTRUCT)lParam; + MENUITEMINFOA mii = { 0 }; mii.cbSize = sizeof(mii); mii.fMask = MIIM_DATA | MIIM_ID; @@ -119,18 +119,18 @@ LRESULT CALLBACK EventAreaWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa } break; } - case WM_NCCALCSIZE: - return FrameNCCalcSize(hwnd, DefWindowProc, wParam, lParam, - wndFrameEventArea ? wndFrameEventArea->TitleBar.ShowTitleBar : 0); - case WM_NCPAINT: - return FrameNCPaint(hwnd, DefWindowProc, wParam, lParam, - wndFrameEventArea ? wndFrameEventArea->TitleBar.ShowTitleBar : 0); + case WM_NCCALCSIZE: + return FrameNCCalcSize(hwnd, DefWindowProc, wParam, lParam, + wndFrameEventArea ? wndFrameEventArea->TitleBar.ShowTitleBar : 0); + case WM_NCPAINT: + return FrameNCPaint(hwnd, DefWindowProc, wParam, lParam, + wndFrameEventArea ? wndFrameEventArea->TitleBar.ShowTitleBar : 0); case WM_DRAWITEM: { - LPDRAWITEMSTRUCT dis = (LPDRAWITEMSTRUCT) lParam; + LPDRAWITEMSTRUCT dis = (LPDRAWITEMSTRUCT)lParam; - if (dis->hwndItem == (HWND) cfg::dat.hMenuNotify) { - MENUITEMINFOA mii = {0}; + if (dis->hwndItem == (HWND)cfg::dat.hMenuNotify) { + MENUITEMINFOA mii = { 0 }; struct NotifyMenuItemExData *nmi = 0; int iIcon; @@ -138,7 +138,7 @@ LRESULT CALLBACK EventAreaWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa mii.cbSize = sizeof(mii); mii.fMask = MIIM_DATA; - if (GetMenuItemInfoA(cfg::dat.hMenuNotify, (UINT) dis->itemID, FALSE, &mii) != 0) { + if (GetMenuItemInfoA(cfg::dat.hMenuNotify, (UINT)dis->itemID, FALSE, &mii) != 0) { nmi = (struct NotifyMenuItemExData *) mii.dwItemData; if (nmi) { iIcon = pcli->pfnGetContactIcon(nmi->hContact); @@ -154,10 +154,11 @@ LRESULT CALLBACK EventAreaWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa if (cfg::dat.bEventAreaEnabled) SendMessage(hwnd, WM_COMMAND, MAKEWPARAM(IDC_NOTIFYBUTTON, 0), 0); break; + case WM_COMMAND: if (LOWORD(wParam) == IDC_NOTIFYBUTTON) { int iSelection; - MENUITEMINFO mii = {0}; + MENUITEMINFO mii = { 0 }; POINT pt; struct NotifyMenuItemExData *nmi = 0; int iCount = GetMenuItemCount(cfg::dat.hMenuNotify); @@ -170,25 +171,25 @@ LRESULT CALLBACK EventAreaWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa iSelection = TrackPopupMenu(cfg::dat.hMenuNotify, TPM_RETURNCMD, pt.x, pt.y, 0, hwnd, NULL); else iSelection = GetMenuItemID(cfg::dat.hMenuNotify, 0); - result = GetMenuItemInfo(cfg::dat.hMenuNotify, (UINT) iSelection, FALSE, &mii); + result = GetMenuItemInfo(cfg::dat.hMenuNotify, (UINT)iSelection, FALSE, &mii); if (result != 0) { nmi = (struct NotifyMenuItemExData *) mii.dwItemData; if (nmi) { CLISTEVENT *cle = MyGetEvent(iSelection); if (cle) { CLISTEVENT *cle1 = NULL; - CallService(cle->pszService, (WPARAM) NULL, (LPARAM) cle); + CallService(cle->pszService, (WPARAM)NULL, (LPARAM)cle); // re-obtain the pointer, it may already be invalid/point to another event if the // event we're interested in was removed by the service (nasty one...) cle1 = MyGetEvent(iSelection); if (cle1 != NULL) - CallService(MS_CLIST_REMOVEEVENT, (WPARAM) cle->hContact, (LPARAM) cle->hDbEvent); + CallService(MS_CLIST_REMOVEEVENT, (WPARAM)cle->hContact, (LPARAM)cle->hDbEvent); } } } - break; } break; + case WM_ERASEBKGND: return TRUE; @@ -243,8 +244,9 @@ LRESULT CALLBACK EventAreaWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa DeleteDC(hdcMem); ps.fErase = FALSE; EndPaint(hwnd, &ps); - return 0; } + return 0; + default: return DefWindowProc(hwnd, msg, wParam, lParam); } @@ -264,15 +266,17 @@ CListEvent* AddEvent(CLISTEVENT *cle) // dup check only for msg events for (int j = 0; j < GetMenuItemCount(cfg::dat.hMenuNotify); j++) { if (GetMenuItemInfo(cfg::dat.hMenuNotify, j, TRUE, &mii) != 0) { - NotifyMenuItemExData *nmi = (NotifyMenuItemExData*) mii.dwItemData; + NotifyMenuItemExData *nmi = (NotifyMenuItemExData*)mii.dwItemData; if (nmi != 0 && (HANDLE)nmi->hContact == (HANDLE)p->cle.hContact && nmi->iIcon == p->imlIconIndex) return p; - } } } + } + } + } char *szProto = GetContactProto(p->cle.hContact); TCHAR *szName = pcli->pfnGetContactDisplayName(p->cle.hContact, 0); if (szProto && szName) { - NotifyMenuItemExData *nmi = (NotifyMenuItemExData*) malloc(sizeof(NotifyMenuItemExData)); + NotifyMenuItemExData *nmi = (NotifyMenuItemExData*)malloc(sizeof(NotifyMenuItemExData)); if (nmi) { TCHAR szBuffer[128]; TCHAR* szStatus = pcli->pfnGetStatusModeDescription(cfg::getWord(p->cle.hContact, szProto, "Status", ID_STATUS_OFFLINE), 0); @@ -306,10 +310,10 @@ CListEvent* AddEvent(CLISTEVENT *cle) } if (cfg::dat.dwFlags & CLUI_STICKYEVENTS) { - HANDLE hItem = (HANDLE)SendMessage(pcli->hwndContactTree, CLM_FINDCONTACT, (WPARAM) p->cle.hContact, 0); + HANDLE hItem = (HANDLE)SendMessage(pcli->hwndContactTree, CLM_FINDCONTACT, (WPARAM)p->cle.hContact, 0); if (hItem) { - SendMessage(pcli->hwndContactTree, CLM_SETSTICKY, (WPARAM) hItem, 1); - pcli->pfnClcBroadcast(INTM_PROTOCHANGED, (WPARAM) p->cle.hContact, 0); + SendMessage(pcli->hwndContactTree, CLM_SETSTICKY, (WPARAM)hItem, 1); + pcli->pfnClcBroadcast(INTM_PROTOCHANGED, (WPARAM)p->cle.hContact, 0); } } @@ -343,7 +347,7 @@ int RemoveEvent(MCONTACT hContact, MEVENT hDbEvent) // remove event from the notify menu if (pcli->events.items[i]->menuId > 0) { - MENUITEMINFO mii = {0}; + MENUITEMINFO mii = { 0 }; mii.cbSize = sizeof(mii); mii.fMask = MIIM_DATA; if (GetMenuItemInfo(cfg::dat.hMenuNotify, pcli->events.items[i]->menuId, FALSE, &mii) != 0) { @@ -351,7 +355,9 @@ int RemoveEvent(MCONTACT hContact, MEVENT hDbEvent) if (nmi && nmi->hContact == hContact && nmi->hDbEvent == hDbEvent) { free(nmi); DeleteMenu(cfg::dat.hMenuNotify, pcli->events.items[i]->menuId, MF_BYCOMMAND); - } } } + } + } + } coreCli.pfnRemoveEvent(hContact, hDbEvent); @@ -360,7 +366,8 @@ int RemoveEvent(MCONTACT hContact, MEVENT hDbEvent) if (cfg::dat.dwFlags & CLUI_FRAME_AUTOHIDENOTIFY) { cfg::dat.notifyActive = 0; HideShowNotifyFrame(); - } } + } + } // clear "sticky" (sort) status HANDLE hItem = (HANDLE)SendMessage(pcli->hwndContactTree, CLM_FINDCONTACT, hContact, 0); diff --git a/plugins/Clist_nicer/src/clistmenus.cpp b/plugins/Clist_nicer/src/clistmenus.cpp index 42b0567f11..e8ce910955 100644 --- a/plugins/Clist_nicer/src/clistmenus.cpp +++ b/plugins/Clist_nicer/src/clistmenus.cpp @@ -39,8 +39,7 @@ void DestroyTrayMenu(HMENU hMenu) int i, cnt; cnt = GetMenuItemCount(hMenu); - for (i = 0; i < cnt; ++i) - { + for (i = 0; i < cnt; ++i) { HMENU hSubMenu = GetSubMenu(hMenu, i); if (hSubMenu == hMainStatusMenu || hSubMenu == hMainMenu) RemoveMenu(hMenu, i--, MF_BYPOSITION); @@ -191,7 +190,7 @@ static INT_PTR CALLBACK IgnoreDialogProc(HWND hWnd, UINT msg, WPARAM wParam, LPA case IDC_IGN_ADDPERMANENTLY: { - ADDCONTACTSTRUCT acs = {0}; + ADDCONTACTSTRUCT acs = { 0 }; acs.hContact = hContact; acs.handleType = HANDLE_CONTACT; CallService(MS_ADDCONTACT_SHOW, (WPARAM)hWnd, (LPARAM)&acs); @@ -279,20 +278,19 @@ static INT_PTR CALLBACK IgnoreDialogProc(HWND hWnd, UINT msg, WPARAM wParam, LPA break; } break; + case WM_USER + 100: // fill dialog (wParam = hContact, lParam = mask) - { - CheckDlgButton(hWnd, IDC_IGN_MSGEVENTS, lParam & (1 << (IGNOREEVENT_MESSAGE - 1)) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hWnd, IDC_IGN_FILEEVENTS, lParam & (1 << (IGNOREEVENT_FILE - 1)) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hWnd, IDC_IGN_URLEVENTS, lParam & (1 << (IGNOREEVENT_URL - 1)) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hWnd, IDC_IGN_AUTH, lParam & (1 << (IGNOREEVENT_AUTHORIZATION - 1)) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hWnd, IDC_IGN_ADD, lParam & (1 << (IGNOREEVENT_YOUWEREADDED - 1)) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hWnd, IDC_IGN_ONLINE, lParam & (1 << (IGNOREEVENT_USERONLINE - 1)) ? BST_CHECKED : BST_UNCHECKED); - return 0; - } + CheckDlgButton(hWnd, IDC_IGN_MSGEVENTS, lParam & (1 << (IGNOREEVENT_MESSAGE - 1)) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hWnd, IDC_IGN_FILEEVENTS, lParam & (1 << (IGNOREEVENT_FILE - 1)) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hWnd, IDC_IGN_URLEVENTS, lParam & (1 << (IGNOREEVENT_URL - 1)) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hWnd, IDC_IGN_AUTH, lParam & (1 << (IGNOREEVENT_AUTHORIZATION - 1)) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hWnd, IDC_IGN_ADD, lParam & (1 << (IGNOREEVENT_YOUWEREADDED - 1)) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hWnd, IDC_IGN_ONLINE, lParam & (1 << (IGNOREEVENT_USERONLINE - 1)) ? BST_CHECKED : BST_UNCHECKED); + return 0; + case WM_USER + 110: // retrieve value { DWORD *dwNewMask = (DWORD *)lParam, dwMask = 0; - dwMask = (IsDlgButtonChecked(hWnd, IDC_IGN_MSGEVENTS) ? (1 << (IGNOREEVENT_MESSAGE - 1)) : 0) | (IsDlgButtonChecked(hWnd, IDC_IGN_FILEEVENTS) ? (1 << (IGNOREEVENT_FILE - 1)) : 0) | (IsDlgButtonChecked(hWnd, IDC_IGN_URLEVENTS) ? (1 << (IGNOREEVENT_URL - 1)) : 0) | @@ -302,8 +300,9 @@ static INT_PTR CALLBACK IgnoreDialogProc(HWND hWnd, UINT msg, WPARAM wParam, LPA if (dwNewMask) *dwNewMask = dwMask; - return 0; } + return 0; + case WM_USER + 120: // set visibility status { ClcContact *contact = NULL; @@ -315,8 +314,9 @@ static INT_PTR CALLBACK IgnoreDialogProc(HWND hWnd, UINT msg, WPARAM wParam, LPA CheckDlgButton(hWnd, IDC_IGN_ALWAYSONLINE, wApparentMode == ID_STATUS_ONLINE ? BST_CHECKED : BST_UNCHECKED); } } - return 0; } + return 0; + case WM_USER + 130: // update apparent mode { ClcContact *contact = NULL; @@ -334,8 +334,9 @@ static INT_PTR CALLBACK IgnoreDialogProc(HWND hWnd, UINT msg, WPARAM wParam, LPA SendMessage(hWnd, WM_USER + 120, 0, 0); } } - return 0; } + return 0; + case WM_DESTROY: SetWindowLongPtr(hWnd, GWLP_USERDATA, 0); WindowList_Remove(hWindowListIGN, hWnd); @@ -354,7 +355,8 @@ static INT_PTR CALLBACK IgnoreDialogProc(HWND hWnd, UINT msg, WPARAM wParam, LPA * of this type to the contacts database record). * * if dialog is already open, focus it. -*/ + */ + static INT_PTR SetContactIgnore(WPARAM wParam, LPARAM) { HWND hWnd = 0; diff --git a/plugins/Clist_nicer/src/clistmod.cpp b/plugins/Clist_nicer/src/clistmod.cpp index 2b7036978b..c04ac1ba56 100644 --- a/plugins/Clist_nicer/src/clistmod.cpp +++ b/plugins/Clist_nicer/src/clistmod.cpp @@ -55,11 +55,11 @@ int IconFromStatusMode(const char *szProto, int status, MCONTACT hContact, HICON if (szProto != NULL && !mir_strcmp(szProto, META_PROTO) && hContact != 0 && !(cfg::dat.dwFlags & CLUI_USEMETAICONS)) { MCONTACT hSubContact = db_mc_getMostOnline(hContact); szFinalProto = GetContactProto(hSubContact); - finalStatus = (status == 0) ? (WORD) cfg::getWord(hSubContact, szFinalProto, "Status", ID_STATUS_OFFLINE) : status; + finalStatus = (status == 0) ? (WORD)cfg::getWord(hSubContact, szFinalProto, "Status", ID_STATUS_OFFLINE) : status; hContact = hSubContact; } else { - szFinalProto = (char*) szProto; + szFinalProto = (char*)szProto; finalStatus = status; } @@ -98,7 +98,7 @@ static INT_PTR GetCaps(WPARAM wParam, LPARAM) case CLUICAPS_FLAGS1: return CLUIF_HIDEEMPTYGROUPS | CLUIF_DISABLEGROUPS | CLUIF_HASONTOPOPTION | CLUIF_HASAUTOHIDEOPTION; case CLUICAPS_FLAGS2: - return MAKELONG(EXTRA_ICON_COUNT,1); + return MAKELONG(EXTRA_ICON_COUNT, 1); } return 0; } diff --git a/plugins/Clist_nicer/src/clistopts.cpp b/plugins/Clist_nicer/src/clistopts.cpp index 42799811f1..73f65a6185 100644 --- a/plugins/Clist_nicer/src/clistopts.cpp +++ b/plugins/Clist_nicer/src/clistopts.cpp @@ -105,7 +105,7 @@ INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP int item = SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_ADDSTRING, 0, (LPARAM)TranslateT("Global")); SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_SETITEMDATA, item, (LPARAM)0); - + int count; PROTOACCOUNT **accs; ProtoEnumAccounts(&count, &accs); diff --git a/plugins/Clist_nicer/src/clisttray.cpp b/plugins/Clist_nicer/src/clisttray.cpp index 1e470a54b0..f9c6ba956e 100644 --- a/plugins/Clist_nicer/src/clisttray.cpp +++ b/plugins/Clist_nicer/src/clisttray.cpp @@ -83,7 +83,7 @@ int TrayCalcChanged(const char *szChangedProto, int averageMode, int netProtoCou break; case SETTING_TRAYICON_SINGLE: - ptrA szProto( db_get_sa(NULL, "CList", "PrimaryStatus")); + ptrA szProto(db_get_sa(NULL, "CList", "PrimaryStatus")); iIcon = IconFromStatusMode(szProto, szProto ? CallProtoService(szProto, PS_GETSTATUS, 0, 0) : CallService(MS_CLIST_GETSTATUSMODE, 0, 0), 0, &hIcon); hIcon = (hIcon) ? CopyIcon(hIcon) : ImageList_GetIcon(hCListImages, iIcon, ILD_NORMAL); return pcli->pfnTrayIconSetBaseInfo(hIcon, NULL); @@ -104,7 +104,7 @@ int TrayCalcChanged(const char *szChangedProto, int averageMode, int netProtoCou INT_PTR TrayIconProcessMessage(WPARAM wParam, LPARAM lParam) { MSG *msg = (MSG*)wParam; - if (msg->message == TIM_CALLBACK && msg->lParam == WM_MOUSEMOVE ) { + if (msg->message == TIM_CALLBACK && msg->lParam == WM_MOUSEMOVE) { if (cfg::dat.bNoTrayTips) { *((LRESULT*)lParam) = 0; return TRUE; diff --git a/plugins/Clist_nicer/src/clnplus.cpp b/plugins/Clist_nicer/src/clnplus.cpp index 158f9cac3e..eed275b1e3 100644 --- a/plugins/Clist_nicer/src/clnplus.cpp +++ b/plugins/Clist_nicer/src/clnplus.cpp @@ -4,34 +4,24 @@ #include #include +#include "msapi/comptr.h" #define _CLN_GDIP - #undef Translate void RemoveFromTaskBar(HWND hWnd) { - ITaskbarList *pTaskbarList = NULL; - - if (SUCCEEDED(CoCreateInstance(CLSID_TaskbarList, 0, CLSCTX_INPROC_SERVER, IID_ITaskbarList, - (void **)(&pTaskbarList))) && pTaskbarList != NULL) { - if (SUCCEEDED(pTaskbarList->HrInit())) { - pTaskbarList->DeleteTab(hWnd); - } - pTaskbarList->Release(); - } + CComPtr pTaskbarList; + if (SUCCEEDED(pTaskbarList.CoCreateInstance(CLSID_TaskbarList, NULL, CLSCTX_INPROC_SERVER))) + if (SUCCEEDED(pTaskbarList->HrInit())) + pTaskbarList->DeleteTab(hWnd); } void AddToTaskBar(HWND hWnd) { - ITaskbarList *pTaskbarList = NULL; - - if (SUCCEEDED(CoCreateInstance(CLSID_TaskbarList, 0, CLSCTX_INPROC_SERVER, IID_ITaskbarList, - (void **)(&pTaskbarList))) && pTaskbarList != NULL) { - if (SUCCEEDED(pTaskbarList->HrInit())) { - pTaskbarList->AddTab(hWnd); - } - pTaskbarList->Release(); - } + CComPtr pTaskbarList; + if (SUCCEEDED(pTaskbarList.CoCreateInstance(CLSID_TaskbarList, NULL, CLSCTX_INPROC_SERVER))) + if (SUCCEEDED(pTaskbarList->HrInit())) + pTaskbarList->AddTab(hWnd); } diff --git a/plugins/Clist_nicer/src/clui.cpp b/plugins/Clist_nicer/src/clui.cpp index 812c732e9c..3d3f28348a 100644 --- a/plugins/Clist_nicer/src/clui.cpp +++ b/plugins/Clist_nicer/src/clui.cpp @@ -77,8 +77,8 @@ void DestroyTrayMenu(HMENU hMenu); extern LONG g_cxsmIcon, g_cysmIcon; -SIZE g_oldSize = {0}; -POINT g_oldPos = {0}; +SIZE g_oldSize = { 0 }; +POINT g_oldPos = { 0 }; int during_sizing = 0; extern int dock_prevent_moving; @@ -88,20 +88,20 @@ static HBITMAP hbmLockedPoint = 0, hbmOldLockedPoint = 0; HICON overlayicons[10]; static IconItem myIcons[] = { - { LPGEN("Toggle show online/offline"), "CLN_online", IDI_HIDEOFFLINE }, - { LPGEN("Toggle groups"), "CLN_groups", IDI_HIDEGROUPS }, - { LPGEN("Find contacts"), "CLN_findadd", IDI_FINDANDADD }, - { LPGEN("Open preferences"), "CLN_options", IDI_TBOPTIONS }, - { LPGEN("Toggle sounds"), "CLN_sound", IDI_SOUNDSON }, - { LPGEN("Minimize contact list"), "CLN_minimize", IDI_MINIMIZE }, - { LPGEN("Show TabSRMM session list"), "CLN_slist", IDI_TABSRMMSESSIONLIST }, - { LPGEN("Show TabSRMM menu"), "CLN_menu", IDI_TABSRMMMENU }, - { LPGEN("Sounds are off"), "CLN_soundsoff", IDI_SOUNDSOFF }, - { LPGEN("Select view mode"), "CLN_CLVM_select", IDI_CLVM_SELECT }, - { LPGEN("Reset view mode"), "CLN_CLVM_reset", IDI_DELETE }, - { LPGEN("Configure view modes"), "CLN_CLVM_options", IDI_CLVM_OPTIONS }, - { LPGEN("Show menu"), "CLN_topmenu", IDI_TBTOPMENU }, - { LPGEN("Setup accounts"), "CLN_accounts", IDI_TBACCOUNTS } + { LPGEN("Toggle show online/offline"), "CLN_online", IDI_HIDEOFFLINE }, + { LPGEN("Toggle groups"), "CLN_groups", IDI_HIDEGROUPS }, + { LPGEN("Find contacts"), "CLN_findadd", IDI_FINDANDADD }, + { LPGEN("Open preferences"), "CLN_options", IDI_TBOPTIONS }, + { LPGEN("Toggle sounds"), "CLN_sound", IDI_SOUNDSON }, + { LPGEN("Minimize contact list"), "CLN_minimize", IDI_MINIMIZE }, + { LPGEN("Show TabSRMM session list"), "CLN_slist", IDI_TABSRMMSESSIONLIST }, + { LPGEN("Show TabSRMM menu"), "CLN_menu", IDI_TABSRMMMENU }, + { LPGEN("Sounds are off"), "CLN_soundsoff", IDI_SOUNDSOFF }, + { LPGEN("Select view mode"), "CLN_CLVM_select", IDI_CLVM_SELECT }, + { LPGEN("Reset view mode"), "CLN_CLVM_reset", IDI_DELETE }, + { LPGEN("Configure view modes"), "CLN_CLVM_options", IDI_CLVM_OPTIONS }, + { LPGEN("Show menu"), "CLN_topmenu", IDI_TBTOPMENU }, + { LPGEN("Setup accounts"), "CLN_accounts", IDI_TBACCOUNTS } }; HWND hTbMenu, hTbGlobalStatus; @@ -333,7 +333,7 @@ void ConfigureEventArea() void ConfigureFrame() { int show = cfg::dat.dwFlags & CLUI_FRAME_SHOWBOTTOMBUTTONS ? SW_SHOW : SW_HIDE; - ShowWindow(hTbMenu,show); + ShowWindow(hTbMenu, show); ShowWindow(hTbGlobalStatus, show); } @@ -415,7 +415,7 @@ void SetDBButtonStates(MCONTACT hPassedContact) hFinalContact = 0; if (buttonItem->type == DBVT_ASCIIZ) { - DBVARIANT dbv = {0}; + DBVARIANT dbv = { 0 }; if (!cfg::getString(hFinalContact, szModule, szSetting, &dbv)) { result = !mir_strcmp((char *)buttonItem->bValuePush, dbv.pszVal); @@ -425,15 +425,15 @@ void SetDBButtonStates(MCONTACT hPassedContact) else { switch (buttonItem->type) { case DBVT_BYTE: { - BYTE val = cfg::getByte(hFinalContact, szModule, szSetting, 0); - result = (val == buttonItem->bValuePush[0]); - break; - } + BYTE val = cfg::getByte(hFinalContact, szModule, szSetting, 0); + result = (val == buttonItem->bValuePush[0]); + break; + } case DBVT_WORD: { - WORD val = cfg::getWord(hFinalContact, szModule, szSetting, 0); - result = (val == *((WORD *)&buttonItem->bValuePush)); - break; - } + WORD val = cfg::getWord(hFinalContact, szModule, szSetting, 0); + result = (val == *((WORD *)&buttonItem->bValuePush)); + break; + } case DBVT_DWORD: DWORD val = cfg::getDword(hFinalContact, szModule, szSetting, 0); result = (val == *((DWORD *)&buttonItem->bValuePush)); @@ -498,47 +498,49 @@ void BlitWallpaper(HDC hdc, RECT *rc, struct ClcData *dat) maxx = dat->backgroundBmpUse & CLBF_TILEH ? rc->right : rc->left + 1; maxy = dat->backgroundBmpUse & CLBF_TILEV ? rc->bottom : y + 1; switch (dat->backgroundBmpUse & CLBM_TYPE) { - case CLB_STRETCH: - if (dat->backgroundBmpUse & CLBF_PROPORTIONAL) { - if (width * bmp->bmHeight < height * bmp->bmWidth) { - desth = height; - destw = desth * bmp->bmWidth / bmp->bmHeight; - } - else { - destw = width; - desth = destw * bmp->bmHeight / bmp->bmWidth; - } - } - else { - destw = width; - desth = height; - } - break; - case CLB_STRETCHH: - if (dat->backgroundBmpUse & CLBF_PROPORTIONAL) { - destw = width; - desth = destw * bmp->bmHeight / bmp->bmWidth; - } - else { - destw = width; - desth = bmp->bmHeight; - } - break; - case CLB_STRETCHV: - if (dat->backgroundBmpUse & CLBF_PROPORTIONAL) { + case CLB_STRETCH: + if (dat->backgroundBmpUse & CLBF_PROPORTIONAL) { + if (width * bmp->bmHeight < height * bmp->bmWidth) { desth = height; destw = desth * bmp->bmWidth / bmp->bmHeight; } else { - destw = bmp->bmWidth; - desth = height; + destw = width; + desth = destw * bmp->bmHeight / bmp->bmWidth; } - break; - default: - //clb_topleft - destw = bmp->bmWidth; + } + else { + destw = width; + desth = height; + } + break; + case CLB_STRETCHH: + if (dat->backgroundBmpUse & CLBF_PROPORTIONAL) { + destw = width; + desth = destw * bmp->bmHeight / bmp->bmWidth; + } + else { + destw = width; desth = bmp->bmHeight; - break; + } + break; + + case CLB_STRETCHV: + if (dat->backgroundBmpUse & CLBF_PROPORTIONAL) { + desth = height; + destw = desth * bmp->bmWidth / bmp->bmHeight; + } + else { + destw = bmp->bmWidth; + desth = height; + } + break; + + default: + //clb_topleft + destw = bmp->bmWidth; + desth = bmp->bmHeight; + break; } bitx = 0; @@ -553,26 +555,26 @@ void BlitWallpaper(HDC hdc, RECT *rc, struct ClcData *dat) void ReloadThemedOptions() { - cfg::dat.bSkinnedStatusBar = cfg::getByte("CLUI", "sb_skinned", 0); - cfg::dat.bUsePerProto = cfg::getByte("CLCExt", "useperproto", 0); + cfg::dat.bSkinnedStatusBar = cfg::getByte("CLUI", "sb_skinned", 0); + cfg::dat.bUsePerProto = cfg::getByte("CLCExt", "useperproto", 0); cfg::dat.bOverridePerStatusColors = cfg::getByte("CLCExt", "override_status", 0); - cfg::dat.bRowSpacing = cfg::getByte("CLC", "RowGap", 0); - cfg::dat.bApplyIndentToBg = cfg::getByte("CLCExt", "applyindentbg", 0); - cfg::dat.bWallpaperMode = cfg::getByte("CLUI", "UseBkSkin", 1); - cfg::dat.bClipBorder = cfg::getByte("CLUI", "clipborder", 0); - cfg::dat.cornerRadius = cfg::getByte("CLCExt", "CornerRad", 6); - cfg::dat.gapBetweenFrames = (BYTE)cfg::getDword("CLUIFrames", "GapBetweenFrames", 1); - cfg::dat.bUseDCMirroring = cfg::getByte("CLC", "MirrorDC", 0); - cfg::dat.bGroupAlign = cfg::getByte("CLC", "GroupAlign", 0); + cfg::dat.bRowSpacing = cfg::getByte("CLC", "RowGap", 0); + cfg::dat.bApplyIndentToBg = cfg::getByte("CLCExt", "applyindentbg", 0); + cfg::dat.bWallpaperMode = cfg::getByte("CLUI", "UseBkSkin", 1); + cfg::dat.bClipBorder = cfg::getByte("CLUI", "clipborder", 0); + cfg::dat.cornerRadius = cfg::getByte("CLCExt", "CornerRad", 6); + cfg::dat.gapBetweenFrames = (BYTE)cfg::getDword("CLUIFrames", "GapBetweenFrames", 1); + cfg::dat.bUseDCMirroring = cfg::getByte("CLC", "MirrorDC", 0); + cfg::dat.bGroupAlign = cfg::getByte("CLC", "GroupAlign", 0); if (cfg::dat.hBrushColorKey) DeleteObject(cfg::dat.hBrushColorKey); cfg::dat.hBrushColorKey = CreateSolidBrush(RGB(255, 0, 255)); - cfg::dat.bWantFastGradients = cfg::getByte("CLCExt", "FastGradients", 0); - cfg::dat.titleBarHeight = cfg::getByte("CLCExt", "frame_height", DEFAULT_TITLEBAR_HEIGHT); - cfg::dat.group_padding = cfg::getDword("CLCExt", "grp_padding", 0); + cfg::dat.bWantFastGradients = cfg::getByte("CLCExt", "FastGradients", 0); + cfg::dat.titleBarHeight = cfg::getByte("CLCExt", "frame_height", DEFAULT_TITLEBAR_HEIGHT); + cfg::dat.group_padding = cfg::getDword("CLCExt", "grp_padding", 0); } -static RECT rcWindow = {0}; +static RECT rcWindow = { 0 }; static void sttProcessResize(HWND hwnd, NMCLISTCONTROL *nmc) { @@ -706,7 +708,7 @@ int CustomDrawScrollBars(NMCSBCUSTOMDRAW *nmcsbcd) arrowItem = arStatusItems[ID_EXTBKSCROLLARROWDOWN - ID_STATUS_OFFLINE]; if (arrowItem && !arrowItem->IGNORED) DrawAlpha(hdcScroll, &nmcsbcd->rect, arrowItem->COLOR, arrowItem->ALPHA, arrowItem->COLOR2, arrowItem->COLOR2_TRANSPARENT, - arrowItem->GRADIENT, arrowItem->CORNER, arrowItem->BORDERSTYLE, arrowItem->imageItem); + arrowItem->GRADIENT, arrowItem->CORNER, arrowItem->BORDERSTYLE, arrowItem->imageItem); else if (arrowItem) DrawFrameControl(hdcScroll, &nmcsbcd->rect, DFC_SCROLL, (nmcsbcd->uItem == HTSCROLL_UP ? DFCS_SCROLLUP : DFCS_SCROLLDOWN) | dfcFlags); @@ -827,77 +829,77 @@ LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l break; case M_CREATECLC: { - if (cfg::getByte("CLUI", "useskin", 0)) - IMG_LoadItems(); - CreateButtonBar(hwnd); - //FYR: to be checked: otherwise it raises double xStatus items - //NotifyEventHooks(pcli->hPreBuildStatusMenuEvent, 0, 0); - SendMessage(hwnd, WM_SETREDRAW, FALSE, FALSE); - { - LONG style; - BYTE windowStyle = cfg::getByte("CLUI", "WindowStyle", SETTING_WINDOWSTYLE_TOOLWINDOW); - ShowWindow(pcli->hwndContactList, SW_HIDE); - style = GetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE); - if (windowStyle != SETTING_WINDOWSTYLE_DEFAULT) { - style |= WS_EX_TOOLWINDOW | WS_EX_WINDOWEDGE; - style &= ~WS_EX_APPWINDOW; - } - else { - style &= ~(WS_EX_TOOLWINDOW | WS_EX_WINDOWEDGE); - if (cfg::getByte("CList", "AlwaysHideOnTB", 1)) + if (cfg::getByte("CLUI", "useskin", 0)) + IMG_LoadItems(); + CreateButtonBar(hwnd); + //FYR: to be checked: otherwise it raises double xStatus items + //NotifyEventHooks(pcli->hPreBuildStatusMenuEvent, 0, 0); + SendMessage(hwnd, WM_SETREDRAW, FALSE, FALSE); + { + LONG style; + BYTE windowStyle = cfg::getByte("CLUI", "WindowStyle", SETTING_WINDOWSTYLE_TOOLWINDOW); + ShowWindow(pcli->hwndContactList, SW_HIDE); + style = GetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE); + if (windowStyle != SETTING_WINDOWSTYLE_DEFAULT) { + style |= WS_EX_TOOLWINDOW | WS_EX_WINDOWEDGE; style &= ~WS_EX_APPWINDOW; - else - style |= WS_EX_APPWINDOW; + } + else { + style &= ~(WS_EX_TOOLWINDOW | WS_EX_WINDOWEDGE); + if (cfg::getByte("CList", "AlwaysHideOnTB", 1)) + style &= ~WS_EX_APPWINDOW; + else + style |= WS_EX_APPWINDOW; + } + + SetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE, style); + ApplyCLUIBorderStyle(); + + SetWindowPos(pcli->hwndContactList, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED | SWP_NOACTIVATE); } - SetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE, style); - ApplyCLUIBorderStyle(); + if (cfg::dat.bSkinnedButtonMode) + SetButtonToSkinned(); + ConfigureFrame(); + SetButtonStates(); - SetWindowPos(pcli->hwndContactList, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED | SWP_NOACTIVATE); - } + CreateCLC(); + cfg::clcdat = (struct ClcData *)GetWindowLongPtr(pcli->hwndContactTree, 0); - if (cfg::dat.bSkinnedButtonMode) - SetButtonToSkinned(); - ConfigureFrame(); - SetButtonStates(); - - CreateCLC(); - cfg::clcdat = (struct ClcData *)GetWindowLongPtr(pcli->hwndContactTree, 0); - - if (cfg::dat.bFullTransparent) { - if (g_CLUISkinnedBkColorRGB) - Tweak_It(g_CLUISkinnedBkColorRGB); - else if (cfg::dat.bClipBorder || (cfg::dat.dwFlags & CLUI_FRAME_ROUNDEDFRAME)) - Tweak_It(RGB(255, 0, 255)); - else - Tweak_It(cfg::clcdat->bkColour); - } + if (cfg::dat.bFullTransparent) { + if (g_CLUISkinnedBkColorRGB) + Tweak_It(g_CLUISkinnedBkColorRGB); + else if (cfg::dat.bClipBorder || (cfg::dat.dwFlags & CLUI_FRAME_ROUNDEDFRAME)) + Tweak_It(RGB(255, 0, 255)); + else + Tweak_It(cfg::clcdat->bkColour); + } - cfg::writeByte("CList", "State", old_cliststate); + cfg::writeByte("CList", "State", old_cliststate); - if (cfg::getByte("CList", "AutoApplyLastViewMode", 0)) { - DBVARIANT dbv = {0}; - if (!db_get(NULL, "CList", "LastViewMode", &dbv)) { - if (mir_strlen(dbv.pszVal) > 2) { - if (cfg::getDword(NULL, CLVM_MODULE, dbv.pszVal, -1) != 0xffffffff) - ApplyViewMode((char *)dbv.pszVal); + if (cfg::getByte("CList", "AutoApplyLastViewMode", 0)) { + DBVARIANT dbv = { 0 }; + if (!db_get(NULL, "CList", "LastViewMode", &dbv)) { + if (mir_strlen(dbv.pszVal) > 2) { + if (cfg::getDword(NULL, CLVM_MODULE, dbv.pszVal, -1) != 0xffffffff) + ApplyViewMode((char *)dbv.pszVal); + } + db_free(&dbv); } - db_free(&dbv); } + if (!cfg::dat.autosize) + ShowCLUI(hwnd); + else { + show_on_first_autosize = TRUE; + RecalcScrollBar(pcli->hwndContactTree, cfg::clcdat); + } + return 0; } - if (!cfg::dat.autosize) - ShowCLUI(hwnd); - else { - show_on_first_autosize = TRUE; - RecalcScrollBar(pcli->hwndContactTree, cfg::clcdat); - } - return 0; - } case WM_ERASEBKGND: return TRUE; /* if (cfg::dat.bSkinnedButtonMode) - return TRUE; + return TRUE; return DefWindowProc(hwnd, msg, wParam, lParam); */ @@ -1021,7 +1023,7 @@ skipbg: case WM_ENTERSIZEMOVE: { RECT rc; - POINT pt = {0}; + POINT pt = { 0 }; GetWindowRect(hwnd, &g_PreSizeRect); GetClientRect(hwnd, &rc); @@ -1098,7 +1100,7 @@ skipbg: SendMessage(hwnd, WM_ENTERSIZEMOVE, 0, 0); RECT rc; GetWindowRect(hwnd, &rc); - WINDOWPOS wp = {0}; + WINDOWPOS wp = { 0 }; wp.cx = rc.right - rc.left; wp.cy = rc.bottom - rc.top; wp.x = rc.left; @@ -1140,11 +1142,11 @@ skipbg: return 0; case CLUIINTM_REMOVEFROMTASKBAR: { - BYTE windowStyle = cfg::getByte("CLUI", "WindowStyle", SETTING_WINDOWSTYLE_DEFAULT); - if (windowStyle == SETTING_WINDOWSTYLE_DEFAULT && cfg::getByte("CList", "AlwaysHideOnTB", 0)) - RemoveFromTaskBar(hwnd); - return 0; - } + BYTE windowStyle = cfg::getByte("CLUI", "WindowStyle", SETTING_WINDOWSTYLE_DEFAULT); + if (windowStyle == SETTING_WINDOWSTYLE_DEFAULT && cfg::getByte("CList", "AlwaysHideOnTB", 0)) + RemoveFromTaskBar(hwnd); + return 0; + } case WM_ACTIVATE: if (g_fading_active) { if (wParam != WA_INACTIVE && cfg::dat.isTransparent) @@ -1179,40 +1181,40 @@ skipbg: return DefWindowProc(hwnd, msg, wParam, lParam); case WM_NCHITTEST: { - LRESULT result; - RECT r; - POINT pt; - int clip = cfg::dat.bClipBorder; - - GetWindowRect(hwnd, &r); - GetCursorPos(&pt); - if (pt.y <= r.bottom && pt.y >= r.bottom - clip - 6 && !cfg::getByte("CLUI", "AutoSize", 0)) { - if (pt.x > r.left + clip + 10 && pt.x < r.right - clip - 10) - return HTBOTTOM; - if (pt.x < r.left + clip + 10) - return HTBOTTOMLEFT; - if (pt.x > r.right - clip - 10) - return HTBOTTOMRIGHT; - } - else if (pt.y >= r.top && pt.y <= r.top + 3 && !cfg::getByte("CLUI", "AutoSize", 0)) { - if (pt.x > r.left + clip + 10 && pt.x < r.right - clip - 10) - return HTTOP; - if (pt.x < r.left + clip + 10) - return HTTOPLEFT; - if (pt.x > r.right - clip - 10) - return HTTOPRIGHT; + LRESULT result; + RECT r; + POINT pt; + int clip = cfg::dat.bClipBorder; + + GetWindowRect(hwnd, &r); + GetCursorPos(&pt); + if (pt.y <= r.bottom && pt.y >= r.bottom - clip - 6 && !cfg::getByte("CLUI", "AutoSize", 0)) { + if (pt.x > r.left + clip + 10 && pt.x < r.right - clip - 10) + return HTBOTTOM; + if (pt.x < r.left + clip + 10) + return HTBOTTOMLEFT; + if (pt.x > r.right - clip - 10) + return HTBOTTOMRIGHT; + } + else if (pt.y >= r.top && pt.y <= r.top + 3 && !cfg::getByte("CLUI", "AutoSize", 0)) { + if (pt.x > r.left + clip + 10 && pt.x < r.right - clip - 10) + return HTTOP; + if (pt.x < r.left + clip + 10) + return HTTOPLEFT; + if (pt.x > r.right - clip - 10) + return HTTOPRIGHT; + } + else if (pt.x >= r.left && pt.x <= r.left + clip + 6) + return HTLEFT; + else if (pt.x >= r.right - clip - 6 && pt.x <= r.right) + return HTRIGHT; + + result = DefWindowProc(hwnd, WM_NCHITTEST, wParam, lParam); + if (result == HTSIZE || result == HTTOP || result == HTTOPLEFT || result == HTTOPRIGHT || result == HTBOTTOM || result == HTBOTTOMRIGHT || result == HTBOTTOMLEFT) + if (cfg::dat.autosize) + return HTCLIENT; + return result; } - else if (pt.x >= r.left && pt.x <= r.left + clip + 6) - return HTLEFT; - else if (pt.x >= r.right - clip - 6 && pt.x <= r.right) - return HTRIGHT; - - result = DefWindowProc(hwnd, WM_NCHITTEST, wParam, lParam); - if (result == HTSIZE || result == HTTOP || result == HTTOPLEFT || result == HTTOPRIGHT || result == HTBOTTOM || result == HTBOTTOMRIGHT || result == HTBOTTOMLEFT) - if (cfg::dat.autosize) - return HTCLIENT; - return result; - } case WM_TIMER: if (wParam == TM_AUTOALPHA) { @@ -1284,7 +1286,7 @@ skipbg: sourceAlpha = cfg::dat.isTransparent ? (transparentFocus ? cfg::dat.alpha : cfg::dat.autoalpha) : 255; destAlpha = 0; } - for (startTick = GetTickCount(); ;) { + for (startTick = GetTickCount();;) { thisTick = GetTickCount(); if (thisTick >= startTick + 200) { SetLayeredWindowAttributes(hwnd, cfg::dat.bFullTransparent ? cfg::dat.colorkey : RGB(0, 0, 0), (BYTE)destAlpha, LWA_ALPHA | (cfg::dat.bFullTransparent ? LWA_COLORKEY : 0)); @@ -1879,8 +1881,7 @@ INT_PTR CALLBACK DlgProcAbout(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar || (HWND)lParam == GetDlgItem(hwndDlg, IDC_VERSION) || (HWND)lParam == GetDlgItem(hwndDlg, IDC_COPYRIGHT) || (HWND)lParam == GetDlgItem(hwndDlg, IDC_SUPPORT) - || (HWND)lParam == GetDlgItem(hwndDlg, IDC_LOGO)) - { + || (HWND)lParam == GetDlgItem(hwndDlg, IDC_LOGO)) { if ((HWND)lParam == GetDlgItem(hwndDlg, IDC_CLNICER)) SetTextColor((HDC)wParam, RGB(180, 10, 10)); else if ((HWND)lParam == GetDlgItem(hwndDlg, IDC_VERSION)) @@ -1992,19 +1993,20 @@ struct const TCHAR *tszName; int iMask; } -static clistFontDescr[] = { - { LPGENT("Standard contacts"), FIDF_CLASSGENERAL }, - { LPGENT("Online contacts to whom you have a different visibility"), FIDF_CLASSGENERAL }, - { LPGENT("Offline contacts"), FIDF_CLASSGENERAL }, - { LPGENT("Contacts which are 'not on list'"), FIDF_CLASSGENERAL }, - { LPGENT("Groups"), FIDF_CLASSHEADER }, - { LPGENT("Group member counts"), FIDF_CLASSHEADER }, - { LPGENT("Dividers"), FIDF_CLASSSMALL }, - { LPGENT("Offline contacts to whom you have a different visibility"), FIDF_CLASSGENERAL }, - { LPGENT("Status mode"), FIDF_CLASSGENERAL }, - { LPGENT("Frame titles"), FIDF_CLASSGENERAL }, - { LPGENT("Event area"), FIDF_CLASSGENERAL }, - { LPGENT("Contact list local time"), FIDF_CLASSGENERAL } +static clistFontDescr[] = +{ + { LPGENT("Standard contacts"), FIDF_CLASSGENERAL }, + { LPGENT("Online contacts to whom you have a different visibility"), FIDF_CLASSGENERAL }, + { LPGENT("Offline contacts"), FIDF_CLASSGENERAL }, + { LPGENT("Contacts which are 'not on list'"), FIDF_CLASSGENERAL }, + { LPGENT("Groups"), FIDF_CLASSHEADER }, + { LPGENT("Group member counts"), FIDF_CLASSHEADER }, + { LPGENT("Dividers"), FIDF_CLASSSMALL }, + { LPGENT("Offline contacts to whom you have a different visibility"), FIDF_CLASSGENERAL }, + { LPGENT("Status mode"), FIDF_CLASSGENERAL }, + { LPGENT("Frame titles"), FIDF_CLASSGENERAL }, + { LPGENT("Event area"), FIDF_CLASSGENERAL }, + { LPGENT("Contact list local time"), FIDF_CLASSGENERAL } }; void FS_RegisterFonts() @@ -2029,7 +2031,7 @@ void FS_RegisterFonts() fid.flags |= clistFontDescr[i].iMask; _tcsncpy(fid.name, clistFontDescr[i].tszName, SIZEOF(fid.name)); - + char idstr[10]; mir_snprintf(idstr, SIZEOF(idstr), "Font%d", i); strncpy(fid.prefix, idstr, SIZEOF(fid.prefix)); @@ -2039,7 +2041,7 @@ void FS_RegisterFonts() ReleaseDC(NULL, hdc); // and colours - ColourIDT colourid = {0}; + ColourIDT colourid = { 0 }; colourid.cbSize = sizeof(colourid); colourid.order = 0; strncpy(colourid.dbSettingsGroup, "CLC", sizeof(colourid.dbSettingsGroup)); diff --git a/plugins/Clist_nicer/src/config.cpp b/plugins/Clist_nicer/src/config.cpp index 96eac98fce..b7163ef979 100644 --- a/plugins/Clist_nicer/src/config.cpp +++ b/plugins/Clist_nicer/src/config.cpp @@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include -TCluiData cfg::dat = {0}; +TCluiData cfg::dat = { 0 }; ClcData* cfg::clcdat = 0; static mir_cs cachecs; @@ -32,14 +32,14 @@ LIST cfg::arCache(100, NumericKeySortT); bool cfg::shutDown = false; -TSysConfig API::sysConfig = {0}; -TSysState API::sysState = {0}; +TSysConfig API::sysConfig = { 0 }; +TSysState API::sysState = { 0 }; pfnDwmExtendFrameIntoClientArea_t API::pfnDwmExtendFrameIntoClientArea = 0; pfnDwmIsCompositionEnabled_t API::pfnDwmIsCompositionEnabled = 0; -EXCEPTION_RECORD API::exRecord = {0}; -CONTEXT API::exCtx = {0}; +EXCEPTION_RECORD API::exRecord = { 0 }; +CONTEXT API::exCtx = { 0 }; LRESULT API::exLastResult = 0; char API::exSzFile[MAX_PATH] = ""; TCHAR API::exReason[256] = _T(""); @@ -241,7 +241,7 @@ void API::updateState() void API::Ex_CopyEditToClipboard(HWND hWnd) { SendMessage(hWnd, EM_SETSEL, 0, 65535L); - SendMessage(hWnd, WM_COPY, 0 , 0); + SendMessage(hWnd, WM_COPY, 0, 0); SendMessage(hWnd, EM_SETSEL, 0, 0); } @@ -250,41 +250,41 @@ INT_PTR CALLBACK API::Ex_DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM) WORD wNotifyCode, wID; switch (uMsg) { - case WM_INITDIALOG: { - char szBuffer[2048]; + case WM_INITDIALOG: { + char szBuffer[2048]; #ifdef _WIN64 - mir_snprintf(szBuffer, SIZEOF(szBuffer), - "Exception %16.16X at address %16.16X occured in %s at line %d.\r\n\r\nEAX=%16.16X EBX=%16.16X ECX=%16.16X\r\nEDX=%16.16X ESI=%16.16X EDI=%16.16X\r\nEBP=%16.16X ESP=%16.16X EIP=%16.16X", - exRecord.ExceptionCode, exRecord.ExceptionAddress, exSzFile, exLine, - exCtx.Rax,exCtx.Rbx, exCtx.Rcx, exCtx.Rdx, - exCtx.Rsi, exCtx.Rdi, exCtx.Rbp, exCtx.Rsp, exCtx.Rip); + mir_snprintf(szBuffer, SIZEOF(szBuffer), + "Exception %16.16X at address %16.16X occured in %s at line %d.\r\n\r\nEAX=%16.16X EBX=%16.16X ECX=%16.16X\r\nEDX=%16.16X ESI=%16.16X EDI=%16.16X\r\nEBP=%16.16X ESP=%16.16X EIP=%16.16X", + exRecord.ExceptionCode, exRecord.ExceptionAddress, exSzFile, exLine, + exCtx.Rax, exCtx.Rbx, exCtx.Rcx, exCtx.Rdx, + exCtx.Rsi, exCtx.Rdi, exCtx.Rbp, exCtx.Rsp, exCtx.Rip); #else - mir_snprintf(szBuffer, SIZEOF(szBuffer), - "Exception %8.8X at address %8.8X occured in %s at line %d.\r\n\r\nEAX=%8.8X EBX=%8.8X ECX=%8.8X\r\nEDX=%8.8X ESI=%8.8X EDI=%8.8X\r\nEBP=%8.8X ESP=%8.8X EIP=%8.8X", - exRecord.ExceptionCode, exRecord.ExceptionAddress, exSzFile, exLine, - exCtx.Eax,exCtx.Ebx, exCtx.Ecx, exCtx.Edx, - exCtx.Esi, exCtx.Edi, exCtx.Ebp, exCtx.Esp, exCtx.Eip); + mir_snprintf(szBuffer, SIZEOF(szBuffer), + "Exception %8.8X at address %8.8X occured in %s at line %d.\r\n\r\nEAX=%8.8X EBX=%8.8X ECX=%8.8X\r\nEDX=%8.8X ESI=%8.8X EDI=%8.8X\r\nEBP=%8.8X ESP=%8.8X EIP=%8.8X", + exRecord.ExceptionCode, exRecord.ExceptionAddress, exSzFile, exLine, + exCtx.Eax,exCtx.Ebx, exCtx.Ecx, exCtx.Edx, + exCtx.Esi, exCtx.Edi, exCtx.Ebp, exCtx.Esp, exCtx.Eip); #endif - SetDlgItemTextA(hwndDlg, IDC_EXCEPTION_DETAILS, szBuffer); - SetFocus(GetDlgItem(hwndDlg, IDC_EXCEPTION_DETAILS)); - SendDlgItemMessage(hwndDlg, IDC_EXCEPTION_DETAILS, WM_SETFONT, (WPARAM)GetStockObject(OEM_FIXED_FONT), 0); - SetDlgItemText(hwndDlg, IDC_EX_REASON, exReason); - Utils::enableDlgControl(hwndDlg, IDOK, exAllowContinue ? TRUE : FALSE); - } - break; - - case WM_COMMAND: - wNotifyCode = HIWORD(wParam); - wID = LOWORD(wParam); - if (wNotifyCode == BN_CLICKED) { - if (wID == IDOK || wID == IDCANCEL) - EndDialog(hwndDlg, wID); - - if (wID == IDC_COPY_EXCEPTION) - Ex_CopyEditToClipboard(GetDlgItem(hwndDlg, IDC_EXCEPTION_DETAILS)); - } - - break; + SetDlgItemTextA(hwndDlg, IDC_EXCEPTION_DETAILS, szBuffer); + SetFocus(GetDlgItem(hwndDlg, IDC_EXCEPTION_DETAILS)); + SendDlgItemMessage(hwndDlg, IDC_EXCEPTION_DETAILS, WM_SETFONT, (WPARAM)GetStockObject(OEM_FIXED_FONT), 0); + SetDlgItemText(hwndDlg, IDC_EX_REASON, exReason); + Utils::enableDlgControl(hwndDlg, IDOK, exAllowContinue ? TRUE : FALSE); + } + break; + + case WM_COMMAND: + wNotifyCode = HIWORD(wParam); + wID = LOWORD(wParam); + if (wNotifyCode == BN_CLICKED) { + if (wID == IDOK || wID == IDCANCEL) + EndDialog(hwndDlg, wID); + + if (wID == IDC_COPY_EXCEPTION) + Ex_CopyEditToClipboard(GetDlgItem(hwndDlg, IDC_EXCEPTION_DETAILS)); + } + + break; } return FALSE; } @@ -367,9 +367,9 @@ CRTException::CRTException(const char *szMsg, const TCHAR *szParam) : std::runti void CRTException::display() const { - TCHAR* tszMsg = mir_a2t(what()); - TCHAR tszBoxMsg[500]; + TCHAR *tszMsg = mir_a2t(what()); + TCHAR tszBoxMsg[500]; mir_sntprintf(tszBoxMsg, SIZEOF(tszBoxMsg), _T("%s\n\n(%s)"), tszMsg, m_szParam); ::MessageBox(0, tszBoxMsg, _T("Clist_nicer runtime error"), MB_OK | MB_ICONERROR); mir_free(tszMsg); diff --git a/plugins/Clist_nicer/src/contact.cpp b/plugins/Clist_nicer/src/contact.cpp index bf060534fd..cb915bdd73 100644 --- a/plugins/Clist_nicer/src/contact.cpp +++ b/plugins/Clist_nicer/src/contact.cpp @@ -27,7 +27,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. struct { int status, order; -} statusModeOrder[] = { +} +statusModeOrder[] = +{ { ID_STATUS_OFFLINE, 500 }, { ID_STATUS_ONLINE, 10 }, { ID_STATUS_AWAY, 200 }, diff --git a/plugins/Clist_nicer/src/extBackg.cpp b/plugins/Clist_nicer/src/extBackg.cpp index 3b3d478c1c..f569932195 100644 --- a/plugins/Clist_nicer/src/extBackg.cpp +++ b/plugins/Clist_nicer/src/extBackg.cpp @@ -332,7 +332,8 @@ void LoadExtBkSettingsFromDB() } // writes whole struct to the database -static void SaveCompleteStructToDB() { +static void SaveCompleteStructToDB() +{ for (int n = 0; n < arStatusItems.getCount(); n++) { StatusItems_t *p = arStatusItems[n]; if (p->statusID != ID_EXTBKSEPARATOR) { @@ -372,7 +373,7 @@ void SetButtonToSkinned() bool bSkinned = (cfg::dat.bSkinnedButtonMode = cfg::getByte("CLCExt", "bskinned", 0)) != 0; bool bFlat = bSkinned || (cfg::getByte("TopToolBar", "UseFlatButton", 0) != 0); - for (int i = 0; ; i++) { + for (int i = 0;; i++) { if (BTNS[i].pszButtonID == NULL) break; if (BTNS[i].hwndButton != 0 && BTNS[i].ctrlid != IDC_TBGLOBALSTATUS && BTNS[i].ctrlid != IDC_TBMENU) @@ -417,7 +418,7 @@ void SaveNonStatusItemsSettings(HWND hwndDlg) cfg::writeByte("CLCExt", "override_status", (BYTE)cfg::dat.bOverridePerStatusColors); cfg::writeByte("CLCExt", "bskinned", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_SETALLBUTTONSKINNED) ? 1 : 0)); cfg::writeByte("CLCExt", "FastGradients", cfg::dat.bWantFastGradients); - cfg::writeByte("CLC", "IgnoreSelforGroups", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_IGNORESELFORGROUPS)); + cfg::writeByte("CLC", "IgnoreSelforGroups", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_IGNORESELFORGROUPS)); cfg::writeDword("CLCExt", "grp_padding", cfg::dat.group_padding); cfg::writeByte("CLCExt", "frame_height", cfg::dat.titleBarHeight); @@ -427,7 +428,7 @@ void SaveNonStatusItemsSettings(HWND hwndDlg) } // skin/theme related settings which are exported to/imported from the .ini style .clist file -struct {char *szModule; char *szSetting; unsigned int size; int defaultval;} _tagSettings[] = { +struct { char *szModule; char *szSetting; unsigned int size; int defaultval; } _tagSettings[] = { "CLCExt", "3dbright", 4, RGB(224, 225, 225), "CLCExt", "3ddark", 4, RGB(224, 225, 225), "CLCExt", "bskinned", 1, 0, @@ -458,7 +459,7 @@ void extbk_export(char *file) char buffer[255]; char szSection[255]; char szKey[255]; - DBVARIANT dbv = {0}; + DBVARIANT dbv = { 0 }; DWORD data; data = 3; @@ -578,9 +579,9 @@ static void PreMultiply(HBITMAP hBitmap, int mode) for (int x = 0; x < width; ++x) { if (mode) { BYTE alpha = px[3]; - px[0] = px[0] * alpha/255; - px[1] = px[1] * alpha/255; - px[2] = px[2] * alpha/255; + px[0] = px[0] * alpha / 255; + px[1] = px[1] * alpha / 255; + px[2] = px[2] * alpha / 255; } else px[3] = 255; px += 4; @@ -688,7 +689,7 @@ static void ReadItem(StatusItems_t *this_item, char *szItem, char *file) if (mir_strcmp(buffer, "None")) { for (int i = 0; i < arStatusItems.getCount(); i++) { StatusItems_t *p = arStatusItems[i]; - if (!_stricmp(p->szName[0] == '{' ? p->szName+3 : p->szName, buffer)) { + if (!_stricmp(p->szName[0] == '{' ? p->szName + 3 : p->szName, buffer)) { defaults = p; break; } @@ -723,7 +724,7 @@ static void ReadItem(StatusItems_t *this_item, char *szItem, char *file) if (this_item->CORNER) this_item->CORNER |= CORNER_ACTIVE; - this_item->GRADIENT = defaults->GRADIENT & GRADIENT_ACTIVE ? defaults->GRADIENT : 0; + this_item->GRADIENT = defaults->GRADIENT & GRADIENT_ACTIVE ? defaults->GRADIENT : 0; GetPrivateProfileStringA(szItem, "Gradient", "None", buffer, 400, file); if (strstr(buffer, "left")) this_item->GRADIENT = GRADIENT_RL; @@ -808,7 +809,7 @@ done_with_glyph: COLORREF fillColor = HexStringToLong(buffer); tmpItem.fillBrush = CreateSolidBrush(fillColor); tmpItem.dwFlags |= IMAGE_FILLSOLID; - } + } else tmpItem.fillBrush = 0; @@ -851,7 +852,7 @@ done_with_glyph: } goto imgread_done; } - for (n = 0; ; n++) { + for (n = 0;; n++) { mir_snprintf(szItemNr, SIZEOF(szItemNr), "Item%d", n); GetPrivateProfileStringA(itemname, szItemNr, "None", buffer, 500, szFileName); if (!mir_strcmp(buffer, "None")) @@ -883,7 +884,7 @@ done_with_glyph: } for (i = 0; i < arStatusItems.getCount(); i++) { StatusItems_t *p = arStatusItems[i]; - if (!_stricmp(p->szName[0] == '{' ? p->szName+3 : p->szName, buffer)) { + if (!_stricmp(p->szName[0] == '{' ? p->szName + 3 : p->szName, buffer)) { if (!alloced) { if (!(tmpItem.dwFlags & IMAGE_GLYPH)) IMG_CreateItem(&tmpItem, szFinalName, hdc); @@ -1105,7 +1106,7 @@ static void BTN_ReadItem(char *itemName, char *file) tmpItem.uId = nextButtonID++; } } - else if(_stricmp(szBuffer, "Custom")) { + else if (_stricmp(szBuffer, "Custom")) { int i = 0; while (BTNS[i].ctrlid) { @@ -1236,7 +1237,7 @@ void LoadPerContactSkins(TCHAR *tszFileName) ReadItem(&default_item, "%Default", file); GetPrivateProfileSectionNamesA(szSections, 3000, file); szSections[3001] = szSections[3000] = 0; - + while (mir_strlen(p) > 1) { if (p[0] == '%') { p += (mir_strlen(p) + 1); @@ -1266,7 +1267,7 @@ void LoadPerContactSkins(TCHAR *tszFileName) char *uid = (char *)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0); if ((INT_PTR)uid != CALLSERVICE_NOTFOUND && uid != NULL) { - DBVARIANT dbv = {0}; + DBVARIANT dbv = { 0 }; if (db_get(hContact, szProto, uid, &dbv)) break; @@ -1287,7 +1288,7 @@ void LoadPerContactSkins(TCHAR *tszFileName) int j; for (j = 0; j < i - 1; j++) { if (!mir_strcmp(szProto, items[j].szName) && !mir_strcmp(UIN, items[j].szDBname) && - mir_strlen(szProto) == mir_strlen(items[j].szName) && mir_strlen(UIN) == mir_strlen(items[j].szDBname)) { + mir_strlen(szProto) == mir_strlen(items[j].szName) && mir_strlen(UIN) == mir_strlen(items[j].szDBname)) { cfg::writeDword(hContact, "EXTBK", "TEXT", items[j].TEXTCOLOR); cfg::writeDword(hContact, "EXTBK", "COLOR1", items[j].COLOR); cfg::writeDword(hContact, "EXTBK", "COLOR2", items[j].COLOR2); @@ -1439,7 +1440,7 @@ void extbk_import(char *file, HWND hwndDlg) static void ApplyCLUISkin() { - DBVARIANT dbv = {0}; + DBVARIANT dbv = { 0 }; TCHAR tszFinalName[MAX_PATH]; char szFinalName[MAX_PATH]; if (!cfg::getTString(NULL, "CLC", "AdvancedSkin", &dbv)) { @@ -1465,53 +1466,53 @@ static INT_PTR CALLBACK DlgProcSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L { switch (msg) { case WM_INITDIALOG: { - DBVARIANT dbv; - TranslateDialogDefault(hwndDlg); + DBVARIANT dbv; + TranslateDialogDefault(hwndDlg); - CheckDlgButton(hwndDlg, IDC_EQUALSELECTION, (cfg::getByte("CLCExt", "EXBK_EqualSelection", 1) == 1) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_SELBLEND, cfg::getByte("CLCExt", "EXBK_SelBlend", 1) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_SETALLBUTTONSKINNED, cfg::getByte("CLCExt", "bskinned", 0) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_EQUALSELECTION, (cfg::getByte("CLCExt", "EXBK_EqualSelection", 1) == 1) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_SELBLEND, cfg::getByte("CLCExt", "EXBK_SelBlend", 1) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_SETALLBUTTONSKINNED, cfg::getByte("CLCExt", "bskinned", 0) ? BST_CHECKED : BST_UNCHECKED); - SendDlgItemMessage(hwndDlg, IDC_CORNERSPIN, UDM_SETRANGE, 0, MAKELONG(10, 0)); - SendDlgItemMessage(hwndDlg, IDC_CORNERSPIN, UDM_SETPOS, 0, cfg::dat.cornerRadius); + SendDlgItemMessage(hwndDlg, IDC_CORNERSPIN, UDM_SETRANGE, 0, MAKELONG(10, 0)); + SendDlgItemMessage(hwndDlg, IDC_CORNERSPIN, UDM_SETPOS, 0, cfg::dat.cornerRadius); - SendDlgItemMessage(hwndDlg, IDC_GRPPADDINGSPIN, UDM_SETRANGE, 0, MAKELONG(20, 0)); - SendDlgItemMessage(hwndDlg, IDC_GRPPADDINGSPIN, UDM_SETPOS, 0, cfg::dat.group_padding); + SendDlgItemMessage(hwndDlg, IDC_GRPPADDINGSPIN, UDM_SETRANGE, 0, MAKELONG(20, 0)); + SendDlgItemMessage(hwndDlg, IDC_GRPPADDINGSPIN, UDM_SETPOS, 0, cfg::dat.group_padding); - SendDlgItemMessage(hwndDlg, IDC_LASTITEMPADDINGSPIN, UDM_SETRANGE, 0, MAKELONG(40, 0)); - SendDlgItemMessage(hwndDlg, IDC_LASTITEMPADDINGSPIN, UDM_SETPOS, 0, cfg::dat.titleBarHeight); + SendDlgItemMessage(hwndDlg, IDC_LASTITEMPADDINGSPIN, UDM_SETRANGE, 0, MAKELONG(40, 0)); + SendDlgItemMessage(hwndDlg, IDC_LASTITEMPADDINGSPIN, UDM_SETPOS, 0, cfg::dat.titleBarHeight); - CheckDlgButton(hwndDlg, IDC_APPLYINDENTBG, cfg::dat.bApplyIndentToBg ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_USEPERPROTO, cfg::dat.bUsePerProto ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_OVERRIDEPERSTATUSCOLOR, cfg::dat.bOverridePerStatusColors ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_FASTGRADIENT, cfg::dat.bWantFastGradients ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_IGNORESELFORGROUPS, cfg::getByte("CLC", "IgnoreSelforGroups", 0) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_APPLYINDENTBG, cfg::dat.bApplyIndentToBg ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_USEPERPROTO, cfg::dat.bUsePerProto ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_OVERRIDEPERSTATUSCOLOR, cfg::dat.bOverridePerStatusColors ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_FASTGRADIENT, cfg::dat.bWantFastGradients ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_IGNORESELFORGROUPS, cfg::getByte("CLC", "IgnoreSelforGroups", 0) ? BST_CHECKED : BST_UNCHECKED); - if (!cfg::getString(NULL, "CLC", "ContactSkins", &dbv)) { - SetDlgItemTextA(hwndDlg, IDC_SKINFILE, dbv.pszVal); - db_free(&dbv); - Utils::enableDlgControl(hwndDlg, IDC_RELOAD, TRUE); - } - else - Utils::enableDlgControl(hwndDlg, IDC_RELOAD, FALSE); - CheckDlgButton(hwndDlg, IDC_USESKIN, cfg::getByte("CLUI", "useskin", 0) ? BST_CHECKED : BST_UNCHECKED); - if (!cfg::getTString(NULL, "CLC", "AdvancedSkin", &dbv)) { - SetDlgItemText(hwndDlg, IDC_SKINFILENAME, dbv.ptszVal); - db_free(&dbv); + if (!cfg::getString(NULL, "CLC", "ContactSkins", &dbv)) { + SetDlgItemTextA(hwndDlg, IDC_SKINFILE, dbv.pszVal); + db_free(&dbv); + Utils::enableDlgControl(hwndDlg, IDC_RELOAD, TRUE); + } + else + Utils::enableDlgControl(hwndDlg, IDC_RELOAD, FALSE); + CheckDlgButton(hwndDlg, IDC_USESKIN, cfg::getByte("CLUI", "useskin", 0) ? BST_CHECKED : BST_UNCHECKED); + if (!cfg::getTString(NULL, "CLC", "AdvancedSkin", &dbv)) { + SetDlgItemText(hwndDlg, IDC_SKINFILENAME, dbv.ptszVal); + db_free(&dbv); + } + else + SetDlgItemText(hwndDlg, IDC_SKINFILENAME, _T("")); + return TRUE; } - else - SetDlgItemText(hwndDlg, IDC_SKINFILENAME, _T("")); - return TRUE; - } case WM_COMMAND: switch (LOWORD(wParam)) { - case IDC_USESKIN: + case IDC_USESKIN: { int useskin = IsDlgButtonChecked(hwndDlg, IDC_USESKIN); - cfg::writeByte("CLUI", "useskin", (BYTE)(useskin ? 1 : 0)); - break; } + break; + case IDC_UNLOAD: IMG_DeleteItems(); ConfigureFrame(); @@ -1519,9 +1520,10 @@ static INT_PTR CALLBACK DlgProcSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L SendMessage(pcli->hwndContactList, WM_SIZE, 0, 0); PostMessage(pcli->hwndContactList, CLUIINTM_REDRAW, 0, 0); break; + case IDC_SELECTSKINFILE: { - OPENFILENAME ofn = {0}; + OPENFILENAME ofn = { 0 }; TCHAR str[MAX_PATH] = _T("*.clist"), final_path[MAX_PATH]; ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400; @@ -1538,7 +1540,7 @@ static INT_PTR CALLBACK DlgProcSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L MY_pathToRelative(str, final_path); if (PathFileExists(str)) { int skinChanged = 0; - DBVARIANT dbv = {0}; + DBVARIANT dbv = { 0 }; if (!cfg::getTString(NULL, "CLC", "AdvancedSkin", &dbv)) { if (mir_tstrcmp(dbv.ptszVal, final_path)) @@ -1551,32 +1553,33 @@ static INT_PTR CALLBACK DlgProcSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L cfg::writeByte("CLUI", "skin_changed", (BYTE)skinChanged); SetDlgItemText(hwndDlg, IDC_SKINFILENAME, final_path); } - break; } + break; + case IDC_RELOADSKIN: cfg::writeByte("CLUI", "skin_changed", 1); ApplyCLUISkin(); break; + case IDC_RELOAD: - { - TCHAR tszFilename[MAX_PATH], tszFinalPath[MAX_PATH]; - - GetDlgItemText(hwndDlg, IDC_SKINFILE, tszFilename, SIZEOF(tszFilename)); - tszFilename[MAX_PATH - 1] = 0; - MY_pathToAbsolute(tszFilename, tszFinalPath); - if (PathFileExists(tszFinalPath)) { - LoadPerContactSkins(tszFinalPath); - ReloadSkinItemsToCache(); - pcli->pfnClcBroadcast(CLM_AUTOREBUILD, 0, 0); - } - break; + TCHAR tszFilename[MAX_PATH], tszFinalPath[MAX_PATH]; + GetDlgItemText(hwndDlg, IDC_SKINFILE, tszFilename, SIZEOF(tszFilename)); + tszFilename[MAX_PATH - 1] = 0; + MY_pathToAbsolute(tszFilename, tszFinalPath); + if (PathFileExists(tszFinalPath)) { + LoadPerContactSkins(tszFinalPath); + ReloadSkinItemsToCache(); + pcli->pfnClcBroadcast(CLM_AUTOREBUILD, 0, 0); } + break; } if ((LOWORD(wParam) == IDC_SKINFILE || LOWORD(wParam) == IDC_SKINFILENAME) - && (HIWORD(wParam) != EN_CHANGE || (HWND) lParam != GetFocus())) + && (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus())) return 0; + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; + case WM_NOTIFY: switch (((LPNMHDR)lParam)->idFrom) { case 0: @@ -1610,8 +1613,8 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara iInit = TRUE; TCITEM tci; - tci.mask = TCIF_PARAM|TCIF_TEXT; - tci.lParam = (LPARAM)CreateDialog(g_hInst,MAKEINTRESOURCE(IDD_OPT_SKIN), hwnd, DlgProcSkinOpts); + tci.mask = TCIF_PARAM | TCIF_TEXT; + tci.lParam = (LPARAM)CreateDialog(g_hInst, MAKEINTRESOURCE(IDD_OPT_SKIN), hwnd, DlgProcSkinOpts); tci.pszText = TranslateT("Load and apply"); TabCtrl_InsertItem(GetDlgItem(hwnd, IDC_OPTIONSTAB), 0, &tci); MoveWindow((HWND)tci.lParam, 5, 25, rcClient.right - 9, rcClient.bottom - 60, 1); @@ -1620,7 +1623,7 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara EnableThemeDialogTexture((HWND)tci.lParam, ETDT_ENABLETAB); if (ServiceExists(MS_CLNSE_INVOKE)) { - SKINDESCRIPTION sd = {0}; + SKINDESCRIPTION sd = { 0 }; sd.cbSize = sizeof(sd); sd.StatusItems = arStatusItems.getArray(); sd.hWndParent = hwnd; @@ -1656,7 +1659,7 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara case IDC_EXPORT: { char str[MAX_PATH] = "*.clist"; - OPENFILENAMEA ofn = {0}; + OPENFILENAMEA ofn = { 0 }; ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400; ofn.hwndOwner = hwnd; ofn.hInstance = NULL; @@ -1674,8 +1677,7 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara case IDC_IMPORT: { char str[MAX_PATH] = "*.clist"; - OPENFILENAMEA ofn = {0}; - + OPENFILENAMEA ofn = { 0 }; ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400; ofn.hwndOwner = hwnd; ofn.hInstance = NULL; @@ -1695,42 +1697,35 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara break; case WM_NOTIFY: switch (((LPNMHDR)lParam)->idFrom) { + TCITEM tci; case 0: switch (((LPNMHDR)lParam)->code) { case PSN_APPLY: - { - TCITEM tci; - int i,count; - tci.mask = TCIF_PARAM; - count = TabCtrl_GetItemCount(GetDlgItem(hwnd, IDC_OPTIONSTAB)); - for (i = 0; i < count; i++) { - TabCtrl_GetItem(GetDlgItem(hwnd, IDC_OPTIONSTAB), i, &tci); - SendMessage((HWND)tci.lParam, WM_NOTIFY, 0, lParam); - } + tci.mask = TCIF_PARAM; + int count = TabCtrl_GetItemCount(GetDlgItem(hwnd, IDC_OPTIONSTAB)); + for (int i = 0; i < count; i++) { + TabCtrl_GetItem(GetDlgItem(hwnd, IDC_OPTIONSTAB), i, &tci); + SendMessage((HWND)tci.lParam, WM_NOTIFY, 0, lParam); } break; } break; + case IDC_OPTIONSTAB: switch (((LPNMHDR)lParam)->code) { case TCN_SELCHANGING: - { - TCITEM tci; - tci.mask = TCIF_PARAM; - TabCtrl_GetItem(GetDlgItem(hwnd, IDC_OPTIONSTAB), TabCtrl_GetCurSel(GetDlgItem(hwnd, IDC_OPTIONSTAB)), &tci); - ShowWindow((HWND)tci.lParam, SW_HIDE); - } + tci.mask = TCIF_PARAM; + TabCtrl_GetItem(GetDlgItem(hwnd, IDC_OPTIONSTAB), TabCtrl_GetCurSel(GetDlgItem(hwnd, IDC_OPTIONSTAB)), &tci); + ShowWindow((HWND)tci.lParam, SW_HIDE); break; + case TCN_SELCHANGE: - { - TCITEM tci; - tci.mask = TCIF_PARAM; - TabCtrl_GetItem(GetDlgItem(hwnd, IDC_OPTIONSTAB), TabCtrl_GetCurSel(GetDlgItem(hwnd, IDC_OPTIONSTAB)), &tci); - ShowWindow((HWND)tci.lParam, SW_SHOW); - cfg::writeByte("CLUI", "opage", (BYTE)TabCtrl_GetCurSel(GetDlgItem(hwnd, IDC_OPTIONSTAB))); - Utils::enableDlgControl(hwnd, IDC_EXPORT, TabCtrl_GetCurSel(GetDlgItem(hwnd, IDC_OPTIONSTAB)) != 0); - Utils::enableDlgControl(hwnd, IDC_IMPORT, TabCtrl_GetCurSel(GetDlgItem(hwnd, IDC_OPTIONSTAB)) != 0); - } + tci.mask = TCIF_PARAM; + TabCtrl_GetItem(GetDlgItem(hwnd, IDC_OPTIONSTAB), TabCtrl_GetCurSel(GetDlgItem(hwnd, IDC_OPTIONSTAB)), &tci); + ShowWindow((HWND)tci.lParam, SW_SHOW); + cfg::writeByte("CLUI", "opage", (BYTE)TabCtrl_GetCurSel(GetDlgItem(hwnd, IDC_OPTIONSTAB))); + Utils::enableDlgControl(hwnd, IDC_EXPORT, TabCtrl_GetCurSel(GetDlgItem(hwnd, IDC_OPTIONSTAB)) != 0); + Utils::enableDlgControl(hwnd, IDC_IMPORT, TabCtrl_GetCurSel(GetDlgItem(hwnd, IDC_OPTIONSTAB)) != 0); break; } break; @@ -1760,17 +1755,15 @@ int CoolSB_SetupScrollBar() !arStatusItems[ID_EXTBKSCROLLBUTTONHOVER - ID_STATUS_OFFLINE]->IGNORED && !arStatusItems[ID_EXTBKSCROLLBUTTONPRESSED - ID_STATUS_OFFLINE]->IGNORED; - if (!arStatusItems[ID_EXTBKSCROLLBACK - ID_STATUS_OFFLINE]->imageItem || - !arStatusItems[ID_EXTBKSCROLLBACKLOWER - ID_STATUS_OFFLINE]->imageItem || - !arStatusItems[ID_EXTBKSCROLLTHUMB - ID_STATUS_OFFLINE]->imageItem || - !arStatusItems[ID_EXTBKSCROLLTHUMBHOVER - ID_STATUS_OFFLINE]->imageItem || - !arStatusItems[ID_EXTBKSCROLLTHUMBPRESSED - ID_STATUS_OFFLINE]->imageItem || - !arStatusItems[ID_EXTBKSCROLLBUTTON - ID_STATUS_OFFLINE]->imageItem || - !arStatusItems[ID_EXTBKSCROLLBUTTONHOVER - ID_STATUS_OFFLINE]->imageItem || - !arStatusItems[ID_EXTBKSCROLLBUTTONPRESSED - ID_STATUS_OFFLINE]->imageItem) - - cfg::dat.bSkinnedScrollbar = FALSE; + !arStatusItems[ID_EXTBKSCROLLBACKLOWER - ID_STATUS_OFFLINE]->imageItem || + !arStatusItems[ID_EXTBKSCROLLTHUMB - ID_STATUS_OFFLINE]->imageItem || + !arStatusItems[ID_EXTBKSCROLLTHUMBHOVER - ID_STATUS_OFFLINE]->imageItem || + !arStatusItems[ID_EXTBKSCROLLTHUMBPRESSED - ID_STATUS_OFFLINE]->imageItem || + !arStatusItems[ID_EXTBKSCROLLBUTTON - ID_STATUS_OFFLINE]->imageItem || + !arStatusItems[ID_EXTBKSCROLLBUTTONHOVER - ID_STATUS_OFFLINE]->imageItem || + !arStatusItems[ID_EXTBKSCROLLBUTTONPRESSED - ID_STATUS_OFFLINE]->imageItem) + cfg::dat.bSkinnedScrollbar = FALSE; if (cfg::getByte("CLC", "NoVScrollBar", 0)) { UninitializeCoolSB(pcli->hwndContactTree); diff --git a/plugins/Clist_nicer/src/init.cpp b/plugins/Clist_nicer/src/init.cpp index b90842317c..aedaa410f6 100644 --- a/plugins/Clist_nicer/src/init.cpp +++ b/plugins/Clist_nicer/src/init.cpp @@ -37,8 +37,6 @@ extern HICON overlayicons[10]; extern int Docking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam); extern int SetHideOffline(WPARAM wParam, LPARAM lParam); -extern DWORD g_gdiplusToken; - TIME_API tmi; HMENU BuildGroupPopupMenu(ClcGroup *group); @@ -79,7 +77,7 @@ PLUGININFOEX pluginInfo = __AUTHORWEB, UNICODE_AWARE, // {8F79B4EE-EB48-4A03-873E-27BE6B7E9A25} - {0x8f79b4ee, 0xeb48, 0x4a03, {0x87, 0x3e, 0x27, 0xbe, 0x6b, 0x7e, 0x9a, 0x25}} + { 0x8f79b4ee, 0xeb48, 0x4a03, { 0x87, 0x3e, 0x27, 0xbe, 0x6b, 0x7e, 0x9a, 0x25 } } }; BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD, LPVOID) @@ -127,7 +125,7 @@ static int fnIconFromStatusMode(const char *szProto, int status, MCONTACT hConta extern "C" int __declspec(dllexport) CListInitialise() { - mir_getLP( &pluginInfo ); + mir_getLP(&pluginInfo); mir_getTMI(&tmi); mir_getCLI(); diff --git a/plugins/Clist_nicer/src/statusbar.cpp b/plugins/Clist_nicer/src/statusbar.cpp index 4f3e17f25a..52a96f8b7d 100644 --- a/plugins/Clist_nicer/src/statusbar.cpp +++ b/plugins/Clist_nicer/src/statusbar.cpp @@ -46,7 +46,7 @@ LRESULT CALLBACK NewStatusBarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM return 1; ptMouse = pt; - if (tooltip_active){ + if (tooltip_active) { KillTimer(hwnd, TIMERID_HOVER); if (!NotifyEventHooks(hStatusBarHideToolTipEvent, 0, 0)) CallService("mToolTip/HideTip", 0, 0); @@ -87,7 +87,7 @@ LRESULT CALLBACK NewStatusBarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM HDC hdc = BeginPaint(hwnd, &ps); HDC hdcMem = CreateCompatibleDC(hdc); RECT rcClient, rcWindow; - DRAWITEMSTRUCT dis = {0}; + DRAWITEMSTRUCT dis = { 0 }; BYTE windowStyle = cfg::getByte("CLUI", "WindowStyle", SETTING_WINDOWSTYLE_DEFAULT); LONG b_offset = cfg::dat.bClipBorder + (windowStyle == SETTING_WINDOWSTYLE_NOBORDER ? 2 : (windowStyle == SETTING_WINDOWSTYLE_THINBORDER ? 1 : 0)); @@ -148,7 +148,7 @@ LRESULT CALLBACK NewStatusBarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM for (int i = 0; i < nParts; i++) { RECT rc; SendMessage(hwnd, SB_GETRECT, i, (LPARAM)&rc); - if (PtInRect(&rc,pt)) { + if (PtInRect(&rc, pt)) { ProtocolData *PD = (ProtocolData *)SendMessageA(hwnd, SB_GETTEXTA, i, 0); if (PD == NULL) continue; -- cgit v1.2.3