From 32f40b0ecb51fe9bee56e4f7ce2476c4cff53bed Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 19 Nov 2012 15:52:04 +0000 Subject: fixes for clist classic: - lines are drawn correctly alongside the groups; - extra icons columns clicks are calculated correctly; git-svn-id: http://svn.miranda-ng.org/main/trunk@2378 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/core/stdclist/src/clcpaint.cpp | 72 ++++++++++++++++++-------------------- src/modules/clist/clcutils.cpp | 2 +- 2 files changed, 36 insertions(+), 38 deletions(-) diff --git a/src/core/stdclist/src/clcpaint.cpp b/src/core/stdclist/src/clcpaint.cpp index 9cd3b59d8f..a090bc91d4 100644 --- a/src/core/stdclist/src/clcpaint.cpp +++ b/src/core/stdclist/src/clcpaint.cpp @@ -106,16 +106,15 @@ static int GetStatusOnlineness(int status) static int GetGeneralisedStatus(void) { - int i, status, thisStatus, statusOnlineness, thisOnlineness; + int status = ID_STATUS_OFFLINE; + int statusOnlineness = 0; - status = ID_STATUS_OFFLINE; - statusOnlineness = 0; - - for (i = 0; i < pcli->hClcProtoCount; i++) { - thisStatus = pcli->clcProto[i].dwStatus; + for (int i = 0; i < pcli->hClcProtoCount; i++) { + int thisStatus = pcli->clcProto[i].dwStatus; if (thisStatus == ID_STATUS_INVISIBLE) return ID_STATUS_INVISIBLE; - thisOnlineness = GetStatusOnlineness(thisStatus); + + int thisOnlineness = GetStatusOnlineness(thisStatus); if (thisOnlineness > statusOnlineness) { status = thisStatus; statusOnlineness = thisOnlineness; @@ -130,11 +129,10 @@ static int GetRealStatus(struct ClcContact *contact, int status) if (!szProto) return status; - for (int i = 0; i < pcli->hClcProtoCount; i++) { - if (!lstrcmpA(pcli->clcProto[i].szProto, szProto)) { + for (int i = 0; i < pcli->hClcProtoCount; i++) + if (!lstrcmpA(pcli->clcProto[i].szProto, szProto)) return pcli->clcProto[i].dwStatus; - } - } + return status; } @@ -372,9 +370,8 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint) } } // Make sure all of these methods are valid (i would hope either all or none work) - if (MyOpenThemeData && MyCloseThemeData && MyDrawThemeBackground) { + if (MyOpenThemeData && MyCloseThemeData && MyDrawThemeBackground) hTheme = MyOpenThemeData(hwnd, L"BUTTON"); - } } rc.left = dat->leftMargin + indent * dat->groupIndent; rc.right = rc.left + dat->checkboxSize; @@ -415,6 +412,29 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint) y + ((dat->rowHeight - 16) >> 1), 0, 0, CLR_NONE, colourFg, mode); } + //extra icons + int rightOffset = 0; + for (int i = dat->extraColumnsCount-1; i >= 0; i--) { + COLORREF colourFg = dat->selBkColour; + if (group->cl.items[group->scanIndex]->iExtraImage[i] == EMPTY_EXTRA_ICON) + continue; + + int mode = ILD_NORMAL; + if (selected) + mode = (dat->exStyle & CLS_EX_NOTRANSLUCENTSEL) ? ILD_NORMAL : ILD_SELECTED; + else if (hottrack) { + colourFg = dat->hotTextColour; + mode = (dat->exStyle & CLS_EX_NOTRANSLUCENTSEL) ? ILD_NORMAL : ILD_BLEND50; + } + else if (group->cl.items[group->scanIndex]->type == CLCIT_CONTACT && group->cl.items[group->scanIndex]->flags & CONTACTF_NOTONLIST) + colourFg = dat->fontInfo[FONTID_NOTONLIST].colour; + + rightOffset += dat->extraColumnSpacing; + ImageList_DrawEx(dat->himlExtraColumns, group->cl.items[group->scanIndex]->iExtraImage[i], hdcMem, + clRect.right - rightOffset, y + ((dat->rowHeight - 16) >> 1), 0, 0, + CLR_NONE, colourFg, mode); + } + //text if (group->cl.items[group->scanIndex]->type == CLCIT_DIVIDER) { RECT rc; @@ -458,7 +478,7 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint) rc.top = y + (dat->rowHeight >> 1); rc.bottom = rc.top + 2; rc.left = dat->leftMargin + indent * dat->groupIndent + checkboxWidth + dat->iconXSpace + width + 3; - rc.right = clRect.right - 1; + rc.right = clRect.right - rightOffset - 1; if (rc.right - rc.left > 1) DrawEdge(hdcMem, &rc, BDR_SUNKENOUTER, BF_RECT); } @@ -487,30 +507,8 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint) DrawText(hdcMem, szText, qlen, &rc, DT_EDITCONTROL | DT_NOPREFIX | DT_NOCLIP | DT_WORD_ELLIPSIS | DT_SINGLELINE); } } - - //extra icons - int rightOffset = 0; - for (int i = dat->extraColumnsCount-1; i >= 0; i--) { - COLORREF colourFg = dat->selBkColour; - if (group->cl.items[group->scanIndex]->iExtraImage[i] == EMPTY_EXTRA_ICON) - continue; - - int mode = ILD_NORMAL; - if (selected) - mode = (dat->exStyle & CLS_EX_NOTRANSLUCENTSEL) ? ILD_NORMAL : ILD_SELECTED; - else if (hottrack) { - colourFg = dat->hotTextColour; - mode = (dat->exStyle & CLS_EX_NOTRANSLUCENTSEL) ? ILD_NORMAL : ILD_BLEND50; - } - else if (group->cl.items[group->scanIndex]->type == CLCIT_CONTACT && group->cl.items[group->scanIndex]->flags & CONTACTF_NOTONLIST) - colourFg = dat->fontInfo[FONTID_NOTONLIST].colour; - - rightOffset += dat->extraColumnSpacing; - ImageList_DrawEx(dat->himlExtraColumns, group->cl.items[group->scanIndex]->iExtraImage[i], hdcMem, - clRect.right - rightOffset, y + ((dat->rowHeight - 16) >> 1), 0, 0, - CLR_NONE, colourFg, mode); - } } + index++; y += dat->rowHeight; if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP && group->cl.items[group->scanIndex]->group->expanded) { diff --git a/src/modules/clist/clcutils.cpp b/src/modules/clist/clcutils.cpp index e3ae2be605..f5ef96f917 100644 --- a/src/modules/clist/clcutils.cpp +++ b/src/modules/clist/clcutils.cpp @@ -152,7 +152,7 @@ int fnHitTest(HWND hwnd, struct ClcData *dat, int testx, int testy, ClcContact * } int eiOffset = 0; - for (i=0; i < dat->extraColumnsCount; i++) { + for (i = dat->extraColumnsCount-1; i >= 0; i--) { if (hitcontact->iExtraImage[i] == EMPTY_EXTRA_ICON) continue; -- cgit v1.2.3