From d50afa23b4d7ab3bb24fdab54db5c7229ff8f5e2 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 30 Apr 2016 15:24:19 +0000 Subject: code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@16795 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Clist_modern/src/modern_clui.cpp | 47 ++++++++++++++++---------------- plugins/Clist_nicer/src/clcitems.cpp | 7 +---- src/mir_app/src/clcmsgs.cpp | 20 ++++---------- src/mir_app/src/clcutils.cpp | 25 +++++++++-------- 4 files changed, 45 insertions(+), 54 deletions(-) diff --git a/plugins/Clist_modern/src/modern_clui.cpp b/plugins/Clist_modern/src/modern_clui.cpp index ab054410b0..1b7121dbc7 100644 --- a/plugins/Clist_modern/src/modern_clui.cpp +++ b/plugins/Clist_modern/src/modern_clui.cpp @@ -1667,35 +1667,36 @@ LRESULT CLUI::OnSizingMoving(UINT msg, WPARAM wParam, LPARAM lParam) return TRUE; case WM_EXITSIZEMOVE: - { - int res = DefWindowProc(m_hWnd, msg, wParam, lParam); - ReleaseCapture(); - TRACE("WM_EXITSIZEMOVE\n"); - SendMessage(m_hWnd, WM_ACTIVATE, (WPARAM)WA_ACTIVE, (LPARAM)m_hWnd); - return res; - } + { + int res = DefWindowProc(m_hWnd, msg, wParam, lParam); + ReleaseCapture(); + TRACE("WM_EXITSIZEMOVE\n"); + SendMessage(m_hWnd, WM_ACTIVATE, (WPARAM)WA_ACTIVE, (LPARAM)m_hWnd); + return res; + } case WM_SIZING: return DefWindowProc(m_hWnd, msg, wParam, lParam); case WM_MOVE: - { - RECT rc; - CallWindowProc(DefWindowProc, m_hWnd, msg, wParam, lParam); - mutex_bDuringSizing = 0; - GetWindowRect(m_hWnd, &rc); - CheckFramesPos(&rc); - Sync(CLUIFrames_OnMoving, m_hWnd, &rc); - if (!IsIconic(m_hWnd)) { - if (!CallService(MS_CLIST_DOCKINGISDOCKED, 0, 0)) { // if g_CluiData.fDocked, dont remember pos (except for width) - db_set_dw(NULL, "CList", "Height", (DWORD)(rc.bottom - rc.top)); - db_set_dw(NULL, "CList", "x", (DWORD)rc.left); - db_set_dw(NULL, "CList", "y", (DWORD)rc.top); + { + RECT rc; + CallWindowProc(DefWindowProc, m_hWnd, msg, wParam, lParam); + mutex_bDuringSizing = 0; + GetWindowRect(m_hWnd, &rc); + CheckFramesPos(&rc); + Sync(CLUIFrames_OnMoving, m_hWnd, &rc); + if (!IsIconic(m_hWnd)) { + if (!CallService(MS_CLIST_DOCKINGISDOCKED, 0, 0)) { // if g_CluiData.fDocked, dont remember pos (except for width) + db_set_dw(NULL, "CList", "Height", (DWORD)(rc.bottom - rc.top)); + db_set_dw(NULL, "CList", "x", (DWORD)rc.left); + db_set_dw(NULL, "CList", "y", (DWORD)rc.top); + } + db_set_dw(NULL, "CList", "Width", (DWORD)(rc.right - rc.left)); } - db_set_dw(NULL, "CList", "Width", (DWORD)(rc.right - rc.left)); } - } - return TRUE; + return TRUE; + case WM_SIZE: if (g_mutex_bSizing) return 0; if (wParam != SIZE_MINIMIZED /* && IsWindowVisible(m_hWnd)*/) { @@ -2315,7 +2316,7 @@ LRESULT CLUI::OnListSizeChangeNotify(NMCLISTCONTROL * pnmc) if (newHeight < (rcWorkArea.bottom - rcWorkArea.top)*minHeight / 100) newHeight = (rcWorkArea.bottom - rcWorkArea.top)*minHeight / 100; - if (newHeight>(rcWorkArea.bottom - rcWorkArea.top)*maxHeight / 100) + if (newHeight > (rcWorkArea.bottom - rcWorkArea.top)*maxHeight / 100) newHeight = (rcWorkArea.bottom - rcWorkArea.top)*maxHeight / 100; if (newHeight == (rcWindow.bottom - rcWindow.top)) return 0; diff --git a/plugins/Clist_nicer/src/clcitems.cpp b/plugins/Clist_nicer/src/clcitems.cpp index 0d2f452208..5bcbdfd9ad 100644 --- a/plugins/Clist_nicer/src/clcitems.cpp +++ b/plugins/Clist_nicer/src/clcitems.cpp @@ -56,13 +56,8 @@ ClcContact* CreateClcContact(void) int AddInfoItemToGroup(ClcGroup *group, int flags, const TCHAR *pszText) { int i = coreCli.pfnAddInfoItemToGroup(group, flags, pszText); + ClcContact* p = group->cl.items[i]; - p->codePage = 0; - //p->clientId = -1; - p->bIsMeta = 0; - p->xStatus = 0; - p->ace = NULL; - p->pExtra = 0; p->avatarLeft = p->extraIconRightBegin = -1; return i; } diff --git a/src/mir_app/src/clcmsgs.cpp b/src/mir_app/src/clcmsgs.cpp index 762bbc8965..9f35437b3c 100644 --- a/src/mir_app/src/clcmsgs.cpp +++ b/src/mir_app/src/clcmsgs.cpp @@ -103,11 +103,9 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR break; case CLM_EXPAND: - if (!cli.pfnFindItem(hwnd, dat, wParam, &contact, NULL, NULL)) - break; - if (contact->type != CLCIT_GROUP) - break; - cli.pfnSetGroupExpand(hwnd, dat, contact->group, lParam); + if (cli.pfnFindItem(hwnd, dat, wParam, &contact, NULL, NULL)) + if (contact->type == CLCIT_GROUP) + cli.pfnSetGroupExpand(hwnd, dat, contact->group, lParam); break; case CLM_FINDCONTACT: @@ -338,15 +336,9 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR break; case CLM_SETEXTRAIMAGE: - if (LOWORD(lParam) < dat->extraColumnsCount) { - int bVisible; - if (!cli.pfnFindItem(hwnd, dat, wParam, &contact, NULL, &bVisible)) - return 0; - - contact->iExtraImage[LOWORD(lParam)] = HIWORD(lParam); - if (bVisible) - cli.pfnInvalidateRect(hwnd, NULL, FALSE); - } + if (LOWORD(lParam) < dat->extraColumnsCount) + if (cli.pfnFindItem(hwnd, dat, wParam, &contact, NULL, NULL)) + contact->iExtraImage[LOWORD(lParam)] = HIWORD(lParam); break; case CLM_SETEXTRAIMAGELIST: diff --git a/src/mir_app/src/clcutils.cpp b/src/mir_app/src/clcutils.cpp index 951bb61f7a..8c52cd2b6f 100644 --- a/src/mir_app/src/clcutils.cpp +++ b/src/mir_app/src/clcutils.cpp @@ -191,19 +191,18 @@ int fnHitTest(HWND hwnd, struct ClcData *dat, int testx, int testy, ClcContact * void fnScrollTo(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) { cli.pfnInvalidateItem(hwnd, dat, dat->iHotTrack); dat->iHotTrack = -1; ReleaseCapture(); } + + RECT clRect; GetClientRect(hwnd, &clRect); - rcInvalidate = clRect; - maxy = cli.pfnGetRowTotalHeight(dat) - clRect.bottom; + + int maxy = cli.pfnGetRowTotalHeight(dat) - clRect.bottom; if (desty > maxy) desty = maxy; if (desty < 0) @@ -212,13 +211,15 @@ void fnScrollTo(HWND hwnd, struct ClcData *dat, int desty, int noSmooth) noSmooth = 1; if (!noSmooth && dat->exStyle & CLS_EX_NOSMOOTHSCROLLING) noSmooth = 1; - previousy = dat->yScroll; + + int previousy = dat->yScroll; if (!noSmooth) { - startTick = GetTickCount(); + DWORD startTick = GetTickCount(); for (;;) { - nowTick = GetTickCount(); + DWORD nowTick = GetTickCount(); if (nowTick >= startTick + dat->scrollTime) break; + 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); @@ -229,6 +230,7 @@ void fnScrollTo(HWND hwnd, struct ClcData *dat, int desty, int noSmooth) UpdateWindow(hwnd); } } + dat->yScroll = desty; if (dat->backgroundBmpUse & CLBF_SCROLL || dat->hBmpBackground == NULL) ScrollWindowEx(hwnd, 0, previousy - dat->yScroll, NULL, NULL, NULL, NULL, SW_INVALIDATE); @@ -270,11 +272,10 @@ void fnEnsureVisible(HWND hwnd, struct ClcData *dat, int iItem, int partialOk) void fnRecalcScrollBar(HWND hwnd, struct ClcData *dat) { - SCROLLINFO si = { 0 }; RECT clRect; - NMCLISTCONTROL nm; - GetClientRect(hwnd, &clRect); + + SCROLLINFO si = { 0 }; si.cbSize = sizeof(si); si.fMask = SIF_ALL; si.nMin = 0; @@ -289,6 +290,8 @@ void fnRecalcScrollBar(HWND hwnd, struct ClcData *dat) else SetScrollInfo(hwnd, SB_VERT, &si, TRUE); cli.pfnScrollTo(hwnd, dat, dat->yScroll, 1); + + NMCLISTCONTROL nm; nm.hdr.code = CLN_LISTSIZECHANGE; nm.hdr.hwndFrom = hwnd; nm.hdr.idFrom = GetDlgCtrlID(hwnd); -- cgit v1.2.3