From 374a75a4d6f709c30232828f5db64f1e7278b622 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 4 Jul 2014 20:38:01 +0000 Subject: clist_modern: toggle subs too in built-in clists git-svn-id: http://svn.miranda-ng.org/main/trunk@9680 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Clist_modern/src/modern_clc.cpp | 51 +++++++++++++++++---------------- 1 file changed, 27 insertions(+), 24 deletions(-) (limited to 'plugins') diff --git a/plugins/Clist_modern/src/modern_clc.cpp b/plugins/Clist_modern/src/modern_clc.cpp index 371fa6e79a..55ff08eb3c 100644 --- a/plugins/Clist_modern/src/modern_clc.cpp +++ b/plugins/Clist_modern/src/modern_clc.cpp @@ -866,7 +866,7 @@ static LRESULT clcOnLButtonDown(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam } if (hit != -1 && !(hitFlags & CLCHT_NOWHERE) && contact->type == CLCIT_CONTACT && contact->SubAllocated && !contact->isSubcontact) - if (hitFlags&CLCHT_ONITEMICON && dat->expandMeta) { + if (hitFlags & CLCHT_ONITEMICON && dat->expandMeta) { BYTE doubleClickExpand = db_get_b(NULL, "CLC", "MetaDoubleClick", SETTING_METAAVOIDDBLCLICK_DEFAULT); hitcontact = contact; @@ -882,29 +882,33 @@ static LRESULT clcOnLButtonDown(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam } else hitcontact = NULL; - if (hit != -1 && !(hitFlags & CLCHT_NOWHERE) && contact->type == CLCIT_GROUP) - if (hitFlags & CLCHT_ONITEMICON) { - ClcGroup *selgroup; - ClcContact *selcontact; - dat->selection = cliGetRowByIndex(dat, dat->selection, &selcontact, &selgroup); - pcli->pfnSetGroupExpand(hwnd, dat, contact->group, -1); - if (dat->selection != -1) { - dat->selection = cliGetRowsPriorTo(&dat->list, selgroup, GetContactIndex(selgroup, selcontact)); - if (dat->selection == -1) dat->selection = cliGetRowsPriorTo(&dat->list, contact->group, -1); - } + if (hit != -1 && !(hitFlags & CLCHT_NOWHERE) && contact->type == CLCIT_GROUP && (hitFlags & CLCHT_ONITEMICON)) { + ClcGroup *selgroup; + ClcContact *selcontact; + dat->selection = cliGetRowByIndex(dat, dat->selection, &selcontact, &selgroup); + pcli->pfnSetGroupExpand(hwnd, dat, contact->group, -1); + if (dat->selection != -1) { + dat->selection = cliGetRowsPriorTo(&dat->list, selgroup, GetContactIndex(selgroup, selcontact)); + if (dat->selection == -1) + dat->selection = cliGetRowsPriorTo(&dat->list, contact->group, -1); + } - if (dat->bCompactMode) - SendMessage(hwnd, WM_SIZE, 0, 0); - else { - CLUI__cliInvalidateRect(hwnd, NULL, FALSE); - UpdateWindow(hwnd); - } - return TRUE; + if (dat->bCompactMode) + SendMessage(hwnd, WM_SIZE, 0, 0); + else { + CLUI__cliInvalidateRect(hwnd, NULL, FALSE); + UpdateWindow(hwnd); } + return TRUE; + } if (hit != -1 && !(hitFlags & CLCHT_NOWHERE) && (hitFlags & CLCHT_ONITEMCHECK)) { contact->flags ^= CONTACTF_CHECKED; - if (contact->type == CLCIT_GROUP) pcli->pfnSetGroupChildCheckboxes(contact->group, contact->flags&CONTACTF_CHECKED); + for (int i = 0; i < contact->SubAllocated; i++) + contact->subcontacts[i].flags ^= CONTACTF_CHECKED; + + if (contact->type == CLCIT_GROUP) + pcli->pfnSetGroupChildCheckboxes(contact->group, contact->flags&CONTACTF_CHECKED); pcli->pfnRecalculateGroupCheckboxes(hwnd, dat); CLUI__cliInvalidateRect(hwnd, NULL, FALSE); @@ -923,9 +927,8 @@ static LRESULT clcOnLButtonDown(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam nm.hdr.hwndFrom = hwnd; nm.hdr.idFrom = GetDlgCtrlID(hwnd); nm.flags = 0; - if (hit == -1 || hitFlags&CLCHT_NOWHERE) nm.hItem = NULL; - else nm.hItem = ContactToItemHandle(contact, &nm.flags); - nm.iColumn = hitFlags&CLCHT_ONITEMEXTRA ? HIBYTE(HIWORD(hitFlags)) : -1; + nm.hItem = (hit == -1 || hitFlags & CLCHT_NOWHERE) ? NULL : ContactToItemHandle(contact, &nm.flags); + nm.iColumn = hitFlags & CLCHT_ONITEMEXTRA ? HIBYTE(HIWORD(hitFlags)) : -1; nm.pt = dat->ptDragStart; SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM)&nm); } @@ -933,7 +936,7 @@ static LRESULT clcOnLButtonDown(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam if (hitFlags & (CLCHT_ONITEMCHECK | CLCHT_ONITEMEXTRA)) return FALSE; - dat->selection = (hitFlags&CLCHT_NOWHERE) ? -1 : hit; + dat->selection = (hitFlags & CLCHT_NOWHERE) ? -1 : hit; CLUI__cliInvalidateRect(hwnd, NULL, FALSE); UpdateWindow(hwnd); @@ -1021,7 +1024,7 @@ static LRESULT clcOnMouseMove(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, dat->iHotTrack = isOutside ? -1 : cliHitTest(hwnd, dat, (short)LOWORD(lParam), (short)HIWORD(lParam), NULL, NULL, &flag); - if (flag&CLCHT_NOWHERE) + if (flag & CLCHT_NOWHERE) dat->iHotTrack = -1; if (iOldHotTrack != dat->iHotTrack || isOutside) { -- cgit v1.2.3