From b3efd156b2ded1777ee2b4522acba1fa2d666ca7 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 24 May 2016 13:54:36 +0000 Subject: group processing code standardization git-svn-id: http://svn.miranda-ng.org/main/trunk@16869 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Clist_nicer/src/clcitems.cpp | 15 +++++++++------ plugins/Clist_nicer/src/clcpaint.cpp | 34 +++++++++++++++++----------------- 2 files changed, 26 insertions(+), 23 deletions(-) (limited to 'plugins/Clist_nicer') diff --git a/plugins/Clist_nicer/src/clcitems.cpp b/plugins/Clist_nicer/src/clcitems.cpp index 5bcbdfd9ad..a73a0827e2 100644 --- a/plugins/Clist_nicer/src/clcitems.cpp +++ b/plugins/Clist_nicer/src/clcitems.cpp @@ -199,15 +199,18 @@ void RebuildEntireList(HWND hwnd, struct ClcData *dat) group->scanIndex = 0; for (;;) { if (group->scanIndex == group->cl.count) { - group = group->parent; - if (group == NULL) + if ((group = group->parent) == NULL) break; + group->scanIndex++; + continue; } - else if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP) { - if (group->cl.items[group->scanIndex]->group->cl.count == 0) - group = pcli->pfnRemoveItemFromGroup(hwnd, group, group->cl.items[group->scanIndex], 0); + + ClcContact *cc = group->cl.items[group->scanIndex]; + if (cc->type == CLCIT_GROUP) { + if (cc->group->cl.count == 0) + group = pcli->pfnRemoveItemFromGroup(hwnd, group, cc, 0); else { - group = group->cl.items[group->scanIndex]->group; + group = cc->group; group->scanIndex = 0; } continue; diff --git a/plugins/Clist_nicer/src/clcpaint.cpp b/plugins/Clist_nicer/src/clcpaint.cpp index 2a17249a7e..e79d0838b4 100644 --- a/plugins/Clist_nicer/src/clcpaint.cpp +++ b/plugins/Clist_nicer/src/clcpaint.cpp @@ -1423,17 +1423,18 @@ bgdone: g_list_avatars = 0; while (true) { if (group->scanIndex == group->cl.count) { - group = group->parent; - if (group == NULL) break; // Finished list + if ((group = group->parent) == NULL) + break; group->scanIndex++; continue; } - if (group->cl.items[group->scanIndex]->cFlags & ECF_AVATAR) + ClcContact *cc = group->cl.items[group->scanIndex]; + if (cc->cFlags & ECF_AVATAR) g_list_avatars++; - if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP && (group->cl.items[group->scanIndex]->group->expanded)) { - group = group->cl.items[group->scanIndex]->group; + if (cc->type == CLCIT_GROUP && (cc->group->expanded)) { + group = cc->group; group->scanIndex = 0; continue; } @@ -1443,33 +1444,32 @@ bgdone: group = &dat->list; group->scanIndex = 0; - int indent = 0; + int indent = 0; for (int index = 0; y < rcPaint->bottom;) { if (group->scanIndex == group->cl.count) { - group = group->parent; - indent--; - if (group == NULL) + if ((group = group->parent) == NULL) break; - group->scanIndex++; + indent--; continue; } line_num++; + ClcContact *cc = group->cl.items[group->scanIndex]; if (cfg::dat.bForceRefetchOnPaint) - group->cl.items[group->scanIndex]->ace = (struct avatarCacheEntry*) - 1; + cc->ace = (struct avatarCacheEntry*) - 1; if (y > rcPaint->top - dat->row_heights[line_num] && y <= rcPaint->bottom) { - if (group->cl.items[group->scanIndex]->ace == (struct avatarCacheEntry*) - 1) - group->cl.items[group->scanIndex]->ace = (struct avatarCacheEntry *)CallService(MS_AV_GETAVATARBITMAP, (WPARAM)group->cl.items[group->scanIndex]->hContact, 0); - RowHeight::getRowHeight(dat, group->cl.items[group->scanIndex], line_num, style); - PaintItem(hdcMem, group, group->cl.items[group->scanIndex], indent, y, dat, index, hwnd, style, &clRect, &bFirstNGdrawn, groupCountsFontTopShift, dat->row_heights[line_num]); + if (cc->ace == (struct avatarCacheEntry*) - 1) + cc->ace = (struct avatarCacheEntry *)CallService(MS_AV_GETAVATARBITMAP, (WPARAM)cc->hContact, 0); + RowHeight::getRowHeight(dat, cc, line_num, style); + PaintItem(hdcMem, group, cc, indent, y, dat, index, hwnd, style, &clRect, &bFirstNGdrawn, groupCountsFontTopShift, dat->row_heights[line_num]); } index++; y += dat->row_heights[line_num]; - if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP && (group->cl.items[group->scanIndex]->group->expanded)) { - group = group->cl.items[group->scanIndex]->group; + if (cc->type == CLCIT_GROUP && (cc->group->expanded)) { + group = cc->group; indent++; group->scanIndex = 0; continue; -- cgit v1.2.3