From 22d42330716a38bfe2faef08eec2b2d3cab1886d Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 28 May 2016 09:20:04 +0000 Subject: SortedList emulation expunged git-svn-id: http://svn.miranda-ng.org/main/trunk@16878 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Clist_nicer/src/clc.cpp | 4 ++-- plugins/Clist_nicer/src/clcitems.cpp | 14 +++++++------- plugins/Clist_nicer/src/clcpaint.cpp | 20 ++++++++++---------- plugins/Clist_nicer/src/rowheight_funcs.cpp | 4 ++-- 4 files changed, 21 insertions(+), 21 deletions(-) (limited to 'plugins/Clist_nicer') diff --git a/plugins/Clist_nicer/src/clc.cpp b/plugins/Clist_nicer/src/clc.cpp index 789afa91ac..d49cd4a0e7 100644 --- a/plugins/Clist_nicer/src/clc.cpp +++ b/plugins/Clist_nicer/src/clc.cpp @@ -232,7 +232,7 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L switch (msg) { case WM_CREATE: - dat = (struct ClcData *)mir_calloc(sizeof(struct ClcData)); + dat = new ClcData(); SetWindowLongPtr(hwnd, 0, (LONG_PTR)dat); RowHeight::Init(dat); @@ -358,7 +358,7 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L if (hSelItem) { ClcGroup *selgroup; if (pcli->pfnFindItem(hwnd, dat, hSelItem, &selcontact, &selgroup, NULL)) - dat->selection = pcli->pfnGetRowsPriorTo(&dat->list, selgroup, List_IndexOf((SortedList*)& selgroup->cl, selcontact)); + dat->selection = pcli->pfnGetRowsPriorTo(&dat->list, selgroup, selgroup->cl.indexOf(selcontact)); else dat->selection = -1; } diff --git a/plugins/Clist_nicer/src/clcitems.cpp b/plugins/Clist_nicer/src/clcitems.cpp index a73a0827e2..70b1a19421 100644 --- a/plugins/Clist_nicer/src/clcitems.cpp +++ b/plugins/Clist_nicer/src/clcitems.cpp @@ -57,7 +57,7 @@ int AddInfoItemToGroup(ClcGroup *group, int flags, const TCHAR *pszText) { int i = coreCli.pfnAddInfoItemToGroup(group, flags, pszText); - ClcContact* p = group->cl.items[i]; + ClcContact* p = group->cl[i]; p->avatarLeft = p->extraIconRightBegin = -1; return i; } @@ -66,7 +66,7 @@ ClcGroup *AddGroup(HWND hwnd, struct ClcData *dat, const TCHAR *szName, DWORD fl { ClcGroup *p = coreCli.pfnAddGroup(hwnd, dat, szName, flags, groupId, calcTotalMembers); if (p && p->parent) - RTL_DetectGroupName(p->parent->cl.items[p->parent->cl.count - 1]); + RTL_DetectGroupName(p->parent->cl[p->parent->cl.getCount() - 1]); return p; } @@ -100,7 +100,7 @@ void LoadAvatarForContact(ClcContact *p) int AddContactToGroup(struct ClcData *dat, ClcGroup *group, MCONTACT hContact) { int i = coreCli.pfnAddContactToGroup(dat, group, hContact); - ClcContact* p = group->cl.items[i]; + ClcContact* p = group->cl[i]; p->wStatus = db_get_w(hContact, p->proto, "Status", ID_STATUS_OFFLINE); p->xStatus = db_get_b(hContact, p->proto, "XStatusId", 0); @@ -154,7 +154,7 @@ void RebuildEntireList(HWND hwnd, struct ClcData *dat) dat->list.expanded = 1; dat->list.hideOffline = db_get_b(NULL, "CLC", "HideOfflineRoot", 0); - dat->list.cl.count = 0; + dat->list.cl.destroy(); dat->list.totalMembers = 0; dat->selection = -1; dat->SelectMode = db_get_b(NULL, "CLC", "SelectMode", 0); @@ -198,16 +198,16 @@ void RebuildEntireList(HWND hwnd, struct ClcData *dat) group = &dat->list; group->scanIndex = 0; for (;;) { - if (group->scanIndex == group->cl.count) { + if (group->scanIndex == group->cl.getCount()) { if ((group = group->parent) == NULL) break; group->scanIndex++; continue; } - ClcContact *cc = group->cl.items[group->scanIndex]; + ClcContact *cc = group->cl[group->scanIndex]; if (cc->type == CLCIT_GROUP) { - if (cc->group->cl.count == 0) + if (cc->group->cl.getCount() == 0) group = pcli->pfnRemoveItemFromGroup(hwnd, group, cc, 0); else { group = cc->group; diff --git a/plugins/Clist_nicer/src/clcpaint.cpp b/plugins/Clist_nicer/src/clcpaint.cpp index e79d0838b4..d54a4a6bcc 100644 --- a/plugins/Clist_nicer/src/clcpaint.cpp +++ b/plugins/Clist_nicer/src/clcpaint.cpp @@ -589,7 +589,7 @@ set_bg_l: // check for special cases (first item, single item, last item) // this will only change the shape for this status. Color will be blended over with ALPHA value - if (!ssingleitem->IGNORED && scanIndex == 0 && group->cl.count == 1 && group->parent != NULL) { + if (!ssingleitem->IGNORED && scanIndex == 0 && group->cl.getCount() == 1 && group->parent != NULL) { rc.left = ssingleitem->MARGIN_LEFT + bg_indent_l; rc.top = y + ssingleitem->MARGIN_TOP; rc.right = clRect->right - ssingleitem->MARGIN_RIGHT - bg_indent_r; @@ -613,7 +613,7 @@ set_bg_l: if (check_selected) DrawAlpha(hdcMem, &rc, ssingleitem->COLOR, ssingleitem->ALPHA, ssingleitem->COLOR2, ssingleitem->COLOR2_TRANSPARENT, ssingleitem->GRADIENT, ssingleitem->CORNER, ssingleitem->BORDERSTYLE, ssingleitem->imageItem); } - else if (scanIndex == 0 && group->cl.count > 1 && !sfirstitem->IGNORED && group->parent != NULL) { + else if (scanIndex == 0 && group->cl.getCount() > 1 && !sfirstitem->IGNORED && group->parent != NULL) { rc.left = sfirstitem->MARGIN_LEFT + bg_indent_l; rc.top = y + sfirstitem->MARGIN_TOP; rc.right = clRect->right - sfirstitem->MARGIN_RIGHT - bg_indent_r; @@ -637,7 +637,7 @@ set_bg_l: if (check_selected) DrawAlpha(hdcMem, &rc, sfirstitem->COLOR, sfirstitem->ALPHA, sfirstitem->COLOR2, sfirstitem->COLOR2_TRANSPARENT, sfirstitem->GRADIENT, sfirstitem->CORNER, sfirstitem->BORDERSTYLE, sfirstitem->imageItem); } - else if (scanIndex == group->cl.count - 1 && !slastitem->IGNORED && group->parent != NULL) { + else if (scanIndex == group->cl.getCount() - 1 && !slastitem->IGNORED && group->parent != NULL) { // last item of group rc.left = slastitem->MARGIN_LEFT + bg_indent_l; rc.top = y + slastitem->MARGIN_TOP; @@ -663,7 +663,7 @@ set_bg_l: DrawAlpha(hdcMem, &rc, slastitem->COLOR, slastitem->ALPHA, slastitem->COLOR2, slastitem->COLOR2_TRANSPARENT, slastitem->GRADIENT, slastitem->CORNER, slastitem->BORDERSTYLE, slastitem->imageItem); } // --- Non-grouped items --- - else if (type != CLCIT_GROUP && group->parent == NULL && !sfirstitem_NG->IGNORED && scanIndex != group->cl.count - 1 && !(*bFirstNGdrawn)) { + else if (type != CLCIT_GROUP && group->parent == NULL && !sfirstitem_NG->IGNORED && scanIndex != group->cl.getCount() - 1 && !(*bFirstNGdrawn)) { // first NON-grouped *bFirstNGdrawn = TRUE; rc.left = sfirstitem_NG->MARGIN_LEFT + bg_indent_l; @@ -689,7 +689,7 @@ set_bg_l: if (check_selected) DrawAlpha(hdcMem, &rc, sfirstitem_NG->COLOR, sfirstitem_NG->ALPHA, sfirstitem_NG->COLOR2, sfirstitem_NG->COLOR2_TRANSPARENT, sfirstitem_NG->GRADIENT, sfirstitem_NG->CORNER, sfirstitem->BORDERSTYLE, sfirstitem->imageItem); } - else if (type != CLCIT_GROUP && group->parent == NULL && !slastitem_NG->IGNORED && scanIndex == group->cl.count - 1 && (*bFirstNGdrawn)) { + else if (type != CLCIT_GROUP && group->parent == NULL && !slastitem_NG->IGNORED && scanIndex == group->cl.getCount() - 1 && (*bFirstNGdrawn)) { // last item of list (NON-group) // last NON-grouped rc.left = slastitem_NG->MARGIN_LEFT + bg_indent_l; @@ -766,7 +766,7 @@ set_bg_l: StatusItems_t *scollapsed = arStatusItems[ID_EXTBKCOLLAPSEDDGROUP - ID_STATUS_OFFLINE]; ChangeToFont(hdcMem, dat, FONTID_GROUPS, &fontHeight); - if (contact->group->cl.count == 0) { + if (contact->group->cl.getCount() == 0) { if (!sempty->IGNORED) { rc.left = sempty->MARGIN_LEFT + bg_indent_l; rc.top = y + sempty->MARGIN_TOP; @@ -1422,14 +1422,14 @@ bgdone: g_list_avatars = 0; while (true) { - if (group->scanIndex == group->cl.count) { + if (group->scanIndex == group->cl.getCount()) { if ((group = group->parent) == NULL) break; group->scanIndex++; continue; } - ClcContact *cc = group->cl.items[group->scanIndex]; + ClcContact *cc = group->cl[group->scanIndex]; if (cc->cFlags & ECF_AVATAR) g_list_avatars++; @@ -1447,7 +1447,7 @@ bgdone: int indent = 0; for (int index = 0; y < rcPaint->bottom;) { - if (group->scanIndex == group->cl.count) { + if (group->scanIndex == group->cl.getCount()) { if ((group = group->parent) == NULL) break; group->scanIndex++; @@ -1456,7 +1456,7 @@ bgdone: } line_num++; - ClcContact *cc = group->cl.items[group->scanIndex]; + ClcContact *cc = group->cl[group->scanIndex]; if (cfg::dat.bForceRefetchOnPaint) cc->ace = (struct avatarCacheEntry*) - 1; diff --git a/plugins/Clist_nicer/src/rowheight_funcs.cpp b/plugins/Clist_nicer/src/rowheight_funcs.cpp index 0fbe7ebe01..cce362b4f0 100644 --- a/plugins/Clist_nicer/src/rowheight_funcs.cpp +++ b/plugins/Clist_nicer/src/rowheight_funcs.cpp @@ -139,7 +139,7 @@ void RowHeight::calcRowHeights(ClcData *dat, HWND hwnd) Clear(dat); while (true) { - if (group->scanIndex == group->cl.count) { + if (group->scanIndex == group->cl.getCount()) { group = group->parent; if (group == NULL) break; // Finished list group->scanIndex++; @@ -147,7 +147,7 @@ void RowHeight::calcRowHeights(ClcData *dat, HWND hwnd) } // Get item to draw - ClcContact *cc = group->cl.items[group->scanIndex]; + ClcContact *cc = group->cl[group->scanIndex]; line_num++; // Calc row height -- cgit v1.2.3