From 97846e5e80ca89b0307d740e71cd488895ac42c6 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 23 Jul 2023 21:08:23 +0300 Subject: let boolean variables inside ClcGroup be boolean --- plugins/Clist_nicer/src/clc.cpp | 4 +-- plugins/Clist_nicer/src/clc.h | 1 - plugins/Clist_nicer/src/clcpaint.cpp | 8 +++--- plugins/Clist_nicer/src/clcutils.cpp | 40 ----------------------------- plugins/Clist_nicer/src/rowheight_funcs.cpp | 2 +- 5 files changed, 7 insertions(+), 48 deletions(-) (limited to 'plugins/Clist_nicer/src') diff --git a/plugins/Clist_nicer/src/clc.cpp b/plugins/Clist_nicer/src/clc.cpp index 4924dccd16..86d9a7fe68 100644 --- a/plugins/Clist_nicer/src/clc.cpp +++ b/plugins/Clist_nicer/src/clc.cpp @@ -340,7 +340,7 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L uint32_t style = GetWindowLongPtr(hwnd, GWL_STYLE); if (contact->iImage == (uint16_t)lParam) break; - if (!shouldShow && !(style & CLS_NOHIDEOFFLINE) && (style & CLS_HIDEOFFLINE || group->hideOffline || cfg::dat.bFilterEffective)) { // CLVM changed + if (!shouldShow && !(style & CLS_NOHIDEOFFLINE) && (style & CLS_HIDEOFFLINE || group->bHideOffline || cfg::dat.bFilterEffective)) { // CLVM changed if (dat->selection >= 0 && g_clistApi.pfnGetRowByIndex(dat, dat->selection, &selcontact, nullptr) != -1) hSelItem = Clist_ContactToHItem(selcontact); Clist_RemoveItemFromGroup(hwnd, group, contact, 0); @@ -665,7 +665,7 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L hMenu = Menu_BuildSubGroupMenu(contact->group); ClientToScreen(hwnd, &pt); TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, 0, g_clistApi.hwndContactList, nullptr); - CheckMenuItem(hMenu, POPUP_GROUPHIDEOFFLINE, contact->group->hideOffline ? MF_CHECKED : MF_UNCHECKED); + CheckMenuItem(hMenu, POPUP_GROUPHIDEOFFLINE, contact->group->bHideOffline ? MF_CHECKED : MF_UNCHECKED); DestroyMenu(hMenu); return 0; } diff --git a/plugins/Clist_nicer/src/clc.h b/plugins/Clist_nicer/src/clc.h index 8e138f374b..8df56f8ede 100644 --- a/plugins/Clist_nicer/src/clc.h +++ b/plugins/Clist_nicer/src/clc.h @@ -373,7 +373,6 @@ uint32_t INTSORT_GetLastMsgTime(MCONTACT hContact); LRESULT ProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPARAM wParam, LPARAM lParam); // clcutils.c -void SetGroupExpand(HWND hwnd, struct ClcData *dat, ClcGroup *group, int newState); void BeginRenameSelection(HWND hwnd, struct ClcData *dat); int HitTest(HWND hwnd, struct ClcData *dat, int testx, int testy, ClcContact **contact, ClcGroup **group, uint32_t *flags); void ScrollTo(HWND hwnd, struct ClcData *dat, int desty, int noSmooth); diff --git a/plugins/Clist_nicer/src/clcpaint.cpp b/plugins/Clist_nicer/src/clcpaint.cpp index e7f49f900c..71d811fe6c 100644 --- a/plugins/Clist_nicer/src/clcpaint.cpp +++ b/plugins/Clist_nicer/src/clcpaint.cpp @@ -718,7 +718,7 @@ set_bg_l: oldGroupColor = SetTextColor(hdcMem, sempty->TEXTCOLOR); } } - else if (contact->group->expanded) { + else if (contact->group->bExpanded) { if (!sexpanded->IGNORED) { rc.left = sexpanded->MARGIN_LEFT + bg_indent_l; rc.top = y + sexpanded->MARGIN_TOP; @@ -815,7 +815,7 @@ bgskipped: int iImage; if (type == CLCIT_GROUP) - iImage = (contact->group->expanded) ? IMAGE_GROUPOPEN : IMAGE_GROUPSHUT; + iImage = (contact->group->bExpanded) ? IMAGE_GROUPOPEN : IMAGE_GROUPSHUT; else if (type == CLCIT_CONTACT) iImage = contact->iImage; else @@ -1374,7 +1374,7 @@ bgdone: if (cc->cFlags & ECF_AVATAR) g_list_avatars++; - if (cc->type == CLCIT_GROUP && (cc->group->expanded)) { + if (cc->type == CLCIT_GROUP && cc->group->bExpanded) { group = cc->group; group->scanIndex = 0; continue; @@ -1409,7 +1409,7 @@ bgdone: } index++; y += dat->row_heights[line_num]; - if (cc->type == CLCIT_GROUP && (cc->group->expanded)) { + if (cc->type == CLCIT_GROUP && cc->group->bExpanded) { group = cc->group; indent++; group->scanIndex = 0; diff --git a/plugins/Clist_nicer/src/clcutils.cpp b/plugins/Clist_nicer/src/clcutils.cpp index 1ea0c9f1e2..d26133a099 100644 --- a/plugins/Clist_nicer/src/clcutils.cpp +++ b/plugins/Clist_nicer/src/clcutils.cpp @@ -375,46 +375,6 @@ void RecalcScrollBar(HWND hwnd, struct ClcData *dat) SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM)& nm); } -void SetGroupExpand(HWND hwnd, struct ClcData *dat, ClcGroup *group, int newState) -{ - int contentCount; - int groupy; - int newy; - int posy; - RECT clRect; - NMCLISTCONTROL nm; - - if (newState == -1) - group->expanded ^= 1; - else { - if (group->expanded == (newState != 0)) - return; - group->expanded = newState != 0; - } - InvalidateRect(hwnd, nullptr, FALSE); - contentCount = g_clistApi.pfnGetGroupContentsCount(group, 1); - - groupy = g_clistApi.pfnGetRowsPriorTo(&dat->list, group, -1); - if (dat->selection > groupy && dat->selection < groupy + contentCount) dat->selection = groupy; - g_clistApi.pfnRecalcScrollBar(hwnd, dat); - - 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); - - 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); -} - static LRESULT CALLBACK RenameEditSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch (uMsg) { diff --git a/plugins/Clist_nicer/src/rowheight_funcs.cpp b/plugins/Clist_nicer/src/rowheight_funcs.cpp index 6a44596915..865c7f30cf 100644 --- a/plugins/Clist_nicer/src/rowheight_funcs.cpp +++ b/plugins/Clist_nicer/src/rowheight_funcs.cpp @@ -152,7 +152,7 @@ void RowHeight::calcRowHeights(ClcData *dat, HWND hwnd) // Calc row height getRowHeight(dat, cc, line_num, dwStyle); - if (cc->type == CLCIT_GROUP && (cc->group->expanded & 0x0000ffff)) { + if (cc->type == CLCIT_GROUP && cc->group->bExpanded) { group = cc->group; group->scanIndex = 0; continue; -- cgit v1.2.3