summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2016-04-30 15:24:19 +0000
committerGeorge Hazan <george.hazan@gmail.com>2016-04-30 15:24:19 +0000
commitd50afa23b4d7ab3bb24fdab54db5c7229ff8f5e2 (patch)
treefb07422ff53124ffbcb2da7f771e1c8b03e72525 /src
parente3bc0d7e9099b2d91dcc997fab851ddb78b852ea (diff)
code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@16795 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src')
-rw-r--r--src/mir_app/src/clcmsgs.cpp20
-rw-r--r--src/mir_app/src/clcutils.cpp25
2 files changed, 20 insertions, 25 deletions
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);