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_modern/src/modern_cachefuncs.cpp | 20 ++++---- plugins/Clist_modern/src/modern_clc.cpp | 8 ++-- plugins/Clist_modern/src/modern_clcidents.cpp | 16 +++---- plugins/Clist_modern/src/modern_clcitems.cpp | 35 +++++++------- plugins/Clist_modern/src/modern_clcmsgs.cpp | 54 +++++++++++----------- plugins/Clist_modern/src/modern_clcpaint.cpp | 40 ++++++++-------- plugins/Clist_modern/src/modern_clcutils.cpp | 6 +-- .../Clist_modern/src/modern_rowheight_funcs.cpp | 18 ++++---- 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 +- plugins/TipperYM/src/mir_smileys.h | 2 +- plugins/UserInfoEx/src/svc_constants.cpp | 2 +- plugins/Variables/src/tokenregister.cpp | 6 +-- 15 files changed, 123 insertions(+), 126 deletions(-) (limited to 'plugins') diff --git a/plugins/Clist_modern/src/modern_cachefuncs.cpp b/plugins/Clist_modern/src/modern_cachefuncs.cpp index 99d5a93fcc..de7d5078df 100644 --- a/plugins/Clist_modern/src/modern_cachefuncs.cpp +++ b/plugins/Clist_modern/src/modern_cachefuncs.cpp @@ -65,8 +65,8 @@ void Cache_GetText(ClcData *dat, ClcContact *contact) if (!dat->force_in_dialog) { if (dat->secondLine.show) - Cache_GetNthLineText(dat, contact->pce, 2); - if (dat->thirdLine.show) + Cache_GetNthLineText(dat, contact->pce, 2); + if (dat->thirdLine.show) Cache_GetNthLineText(dat, contact->pce, 3); } } @@ -602,19 +602,19 @@ static BOOL ExecuteOnAllContactsOfGroup(ClcGroup *group, ExecuteOnAllContactsFun if (!group) return TRUE; - for (int scanIndex = 0; scanIndex < group->cl.count; scanIndex++) { - if (group->cl.items[scanIndex]->type == CLCIT_CONTACT) { - if (!func(group->cl.items[scanIndex], FALSE, param)) + for (int scanIndex = 0; scanIndex < group->cl.getCount(); scanIndex++) { + if (group->cl[scanIndex]->type == CLCIT_CONTACT) { + if (!func(group->cl[scanIndex], FALSE, param)) return FALSE; - if (group->cl.items[scanIndex]->iSubAllocated > 0) { - for (int i = 0; i < group->cl.items[scanIndex]->iSubAllocated; i++) - if (!func(&group->cl.items[scanIndex]->subcontacts[i], TRUE, param)) + if (group->cl[scanIndex]->iSubAllocated > 0) { + for (int i = 0; i < group->cl[scanIndex]->iSubAllocated; i++) + if (!func(&group->cl[scanIndex]->subcontacts[i], TRUE, param)) return FALSE; } } - else if (group->cl.items[scanIndex]->type == CLCIT_GROUP) - if (!ExecuteOnAllContactsOfGroup(group->cl.items[scanIndex]->group, func, param)) + else if (group->cl[scanIndex]->type == CLCIT_GROUP) + if (!ExecuteOnAllContactsOfGroup(group->cl[scanIndex]->group, func, param)) return FALSE; } diff --git a/plugins/Clist_modern/src/modern_clc.cpp b/plugins/Clist_modern/src/modern_clc.cpp index b4fdd72147..187c06b76d 100644 --- a/plugins/Clist_modern/src/modern_clc.cpp +++ b/plugins/Clist_modern/src/modern_clc.cpp @@ -211,14 +211,14 @@ static int clcSearchNextContact(HWND hwnd, ClcData *dat, int index, const TCHAR if (index == -1) fReturnAsFound = TRUE; 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_DIVIDER) { bool found; if (cc->type == CLCIT_GROUP) { @@ -281,7 +281,7 @@ static BOOL clcItemNotHiddenOffline(ClcGroup *group, ClcContact *contact) static LRESULT clcOnCreate(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { - dat = (ClcData*)mir_calloc(sizeof(ClcData)); + dat = new ClcData(); SetWindowLongPtr(hwnd, 0, (LONG_PTR)dat); dat->hCheckBoxTheme = xpt_AddThemeHandle(hwnd, L"BUTTON"); dat->m_paintCouter = 0; @@ -1404,7 +1404,7 @@ static LRESULT clcOnIntmIconChanged(ClcData *dat, HWND hwnd, UINT, WPARAM wParam if (hSelItem) { 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_modern/src/modern_clcidents.cpp b/plugins/Clist_modern/src/modern_clcidents.cpp index 27d645eb3c..8cb539e218 100644 --- a/plugins/Clist_modern/src/modern_clcidents.cpp +++ b/plugins/Clist_modern/src/modern_clcidents.cpp @@ -26,8 +26,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. int GetContactIndex(ClcGroup *group, ClcContact *contact) { - for (int i = 0; i < group->cl.count; i++) - if (group->cl.items[i]->hContact == contact->hContact) + for (int i = 0; i < group->cl.getCount(); i++) + if (group->cl[i]->hContact == contact->hContact) return i; return -1; @@ -40,7 +40,7 @@ int cliGetRowsPriorTo(ClcGroup *group, ClcGroup *subgroup, int contactIndex) bool bMetaExpanding = db_get_b(NULL, "CLC", "MetaExpanding", SETTING_METAEXPANDING_DEFAULT) != 0; group->scanIndex = 0; for (;;) { - if (group->scanIndex == group->cl.count) { + if (group->scanIndex == group->cl.getCount()) { if ((group = group->parent) == NULL) break; group->scanIndex++; @@ -49,7 +49,7 @@ int cliGetRowsPriorTo(ClcGroup *group, ClcGroup *subgroup, int contactIndex) if (group == subgroup && contactIndex - subcontactscount == group->scanIndex) return count; count++; - ClcContact *cc = group->cl.items[group->scanIndex]; + ClcContact *cc = group->cl[group->scanIndex]; if (cc->type == CLCIT_GROUP) { if (cc->group == subgroup && contactIndex == -1) return count - 1; @@ -92,7 +92,7 @@ int FindItem(HWND hwnd, ClcData *dat, DWORD dwItem, ClcContact **contact, ClcGro group = &dat->list; for (;;) { - if (group->scanIndex == group->cl.count) { + if (group->scanIndex == group->cl.getCount()) { if ((group = group->parent) == NULL) break; @@ -110,7 +110,7 @@ int FindItem(HWND hwnd, ClcData *dat, DWORD dwItem, ClcContact **contact, ClcGro if (nowVisible) index++; - ClcContact *cc = group->cl.items[group->scanIndex]; + ClcContact *cc = group->cl[group->scanIndex]; if ((IsHContactGroup(dwItem) && cc->type == CLCIT_GROUP && (dwItem & ~HCONTACT_ISGROUP) == cc->groupId) || (IsHContactContact(dwItem) && cc->type == CLCIT_CONTACT && cc->hContact == dwItem) || (IsHContactInfo(dwItem) && cc->type == CLCIT_INFO && cc->hContact == (dwItem & ~HCONTACT_ISINFO))) { @@ -167,14 +167,14 @@ int cliGetRowByIndex(ClcData *dat, int testindex, ClcContact **contact, ClcGroup 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 (testindex == index) { if (contact) *contact = cc; if (subgroup) *subgroup = group; diff --git a/plugins/Clist_modern/src/modern_clcitems.cpp b/plugins/Clist_modern/src/modern_clcitems.cpp index fc14c85bc9..578a8b8fd0 100644 --- a/plugins/Clist_modern/src/modern_clcitems.cpp +++ b/plugins/Clist_modern/src/modern_clcitems.cpp @@ -172,14 +172,14 @@ static ClcContact* AddContactToGroup(ClcData *dat, ClcGroup *group, MCONTACT hCo dat->bNeedsResort = true; int i; - for (i = group->cl.count - 1; i >= 0; i--) - if (group->cl.items[i]->type != CLCIT_INFO || !(group->cl.items[i]->flags & CLCIIF_BELOWCONTACTS)) + for (i = group->cl.getCount() - 1; i >= 0; i--) + if (group->cl[i]->type != CLCIT_INFO || !(group->cl[i]->flags & CLCIIF_BELOWCONTACTS)) break; i = pcli->pfnAddItemToGroup(group, i + 1); - _LoadDataToContact(group->cl.items[i], group, dat, hContact); - return group->cl.items[i]; + _LoadDataToContact(group->cl[i], group, dat, hContact); + return group->cl[i]; } void cli_AddContactToTree(HWND hwnd, ClcData *dat, MCONTACT hContact, int updateTotalCount, int checkHideOffline) @@ -228,9 +228,9 @@ int RestoreSelection(ClcData *dat, MCONTACT hSelected) } if (!selcontact->iSubNumber) - 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 = pcli->pfnGetRowsPriorTo(&dat->list, selgroup, List_IndexOf((SortedList*)&selgroup->cl, selcontact->subcontacts)); + dat->selection = pcli->pfnGetRowsPriorTo(&dat->list, selgroup, selgroup->cl.indexOf(selcontact->subcontacts)); if (dat->selection != -1) dat->selection += selcontact->iSubNumber; } @@ -251,9 +251,8 @@ void cliRebuildEntireList(HWND hwnd, ClcData *dat) RowHeights_GetMaxRowHeight(dat, hwnd); dat->list.expanded = 1; - dat->list.hideOffline = db_get_b(NULL, "CLC", "HideOfflineRoot", SETTING_HIDEOFFLINEATROOT_DEFAULT) && style&CLS_USEGROUPS; - dat->list.cl.count = dat->list.cl.limit = 0; - dat->list.cl.increment = 50; + dat->list.hideOffline = db_get_b(NULL, "CLC", "HideOfflineRoot", SETTING_HIDEOFFLINEATROOT_DEFAULT) && style & CLS_USEGROUPS; + dat->list.cl.destroy(); dat->bNeedsResort = true; MCONTACT hSelected = SaveSelection(dat); @@ -307,16 +306,16 @@ void cliRebuildEntireList(HWND hwnd, 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; @@ -351,7 +350,7 @@ int GetNewSelection(ClcGroup *group, int selection, int direction) group->scanIndex = 0; for (;;) { - if (group->scanIndex == group->cl.count) { + if (group->scanIndex == group->cl.getCount()) { if ((group = group->parent) == NULL) break; group->scanIndex++; @@ -366,7 +365,7 @@ int GetNewSelection(ClcGroup *group, int selection, int direction) if (!direction && count > selection) return lastcount; - ClcContact *cc = group->cl.items[group->scanIndex]; + ClcContact *cc = group->cl[group->scanIndex]; if (cc->type == CLCIT_GROUP && (cc->group->expanded)) { group = cc->group; group->scanIndex = 0; @@ -431,12 +430,12 @@ void cli_SetContactCheckboxes(ClcContact *cc, int checked) int cliGetGroupContentsCount(ClcGroup *group, int visibleOnly) { - int count = group->cl.count; + int count = group->cl.getCount(); ClcGroup *topgroup = group; group->scanIndex = 0; for (;;) { - if (group->scanIndex == group->cl.count) { + if (group->scanIndex == group->cl.getCount()) { if (group == topgroup) break; group = group->parent; @@ -444,11 +443,11 @@ int cliGetGroupContentsCount(ClcGroup *group, int visibleOnly) continue; } - ClcContact *cc = group->cl.items[group->scanIndex]; + ClcContact *cc = group->cl[group->scanIndex]; if (cc->type == CLCIT_GROUP && (!(visibleOnly & 0x01) || cc->group->expanded)) { group = cc->group; group->scanIndex = 0; - count += group->cl.count; + count += group->cl.getCount(); continue; } if (cc->type == CLCIT_CONTACT && cc->subcontacts != NULL && (cc->bSubExpanded || !visibleOnly)) diff --git a/plugins/Clist_modern/src/modern_clcmsgs.cpp b/plugins/Clist_modern/src/modern_clcmsgs.cpp index 0f21a91832..8d540bf13b 100644 --- a/plugins/Clist_modern/src/modern_clcmsgs.cpp +++ b/plugins/Clist_modern/src/modern_clcmsgs.cpp @@ -108,68 +108,68 @@ LRESULT cli_ProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wP if (wParam != CLGN_ROOT) { if (!pcli->pfnFindItem(hwnd, dat, lParam, &contact, &group, NULL)) return NULL; - i = List_IndexOf((SortedList*)&group->cl, contact); + i = group->cl.indexOf(contact); if (i < 0) return 0; } switch (wParam) { case CLGN_ROOT: - if (dat->list.cl.count) - return (LRESULT)pcli->pfnContactToHItem(dat->list.cl.items[0]); + if (dat->list.cl.getCount()) + return (LRESULT)pcli->pfnContactToHItem(dat->list.cl[0]); else return NULL; case CLGN_CHILD: if (contact->type != CLCIT_GROUP) return NULL; group = contact->group; - if (group->cl.count == 0) + if (group->cl.getCount() == 0) return NULL; - return (LRESULT)pcli->pfnContactToHItem(group->cl.items[0]); + return (LRESULT)pcli->pfnContactToHItem(group->cl[0]); case CLGN_PARENT: return group->groupId | HCONTACT_ISGROUP; case CLGN_NEXT: do { - if (++i >= group->cl.count) + if (++i >= group->cl.getCount()) return NULL; - } while (group->cl.items[i]->type == CLCIT_DIVIDER); - return (LRESULT)pcli->pfnContactToHItem(group->cl.items[i]); + } while (group->cl[i]->type == CLCIT_DIVIDER); + return (LRESULT)pcli->pfnContactToHItem(group->cl[i]); case CLGN_PREVIOUS: do { if (--i < 0) return NULL; - } while (group->cl.items[i]->type == CLCIT_DIVIDER); - return (LRESULT)pcli->pfnContactToHItem(group->cl.items[i]); + } while (group->cl[i]->type == CLCIT_DIVIDER); + return (LRESULT)pcli->pfnContactToHItem(group->cl[i]); case CLGN_NEXTCONTACT: - for (i++; i < group->cl.count; i++) - if (group->cl.items[i]->type == CLCIT_CONTACT) + for (i++; i < group->cl.getCount(); i++) + if (group->cl[i]->type == CLCIT_CONTACT) break; - if (i >= group->cl.count) + if (i >= group->cl.getCount()) return NULL; - return (LRESULT)pcli->pfnContactToHItem(group->cl.items[i]); + return (LRESULT)pcli->pfnContactToHItem(group->cl[i]); case CLGN_PREVIOUSCONTACT: - if (i >= group->cl.count) + if (i >= group->cl.getCount()) return NULL; for (i--; i >= 0; i--) - if (group->cl.items[i]->type == CLCIT_CONTACT) + if (group->cl[i]->type == CLCIT_CONTACT) break; if (i < 0) return NULL; - return (LRESULT)pcli->pfnContactToHItem(group->cl.items[i]); + return (LRESULT)pcli->pfnContactToHItem(group->cl[i]); case CLGN_NEXTGROUP: - for (i++; i < group->cl.count; i++) - if (group->cl.items[i]->type == CLCIT_GROUP) + for (i++; i < group->cl.getCount(); i++) + if (group->cl[i]->type == CLCIT_GROUP) break; - if (i >= group->cl.count) + if (i >= group->cl.getCount()) return NULL; - return (LRESULT)pcli->pfnContactToHItem(group->cl.items[i]); + return (LRESULT)pcli->pfnContactToHItem(group->cl[i]); case CLGN_PREVIOUSGROUP: - if (i >= group->cl.count) + if (i >= group->cl.getCount()) return NULL; for (i--; i >= 0; i--) - if (group->cl.items[i]->type == CLCIT_GROUP) + if (group->cl[i]->type == CLCIT_GROUP) break; if (i < 0) return NULL; - return (LRESULT)pcli->pfnContactToHItem(group->cl.items[i]); + return (LRESULT)pcli->pfnContactToHItem(group->cl[i]); } } return NULL; @@ -185,11 +185,11 @@ LRESULT cli_ProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wP pcli->pfnSetGroupExpand(hwnd, dat, tgroup, 1); if (!contact->iSubNumber) { - index = List_IndexOf((SortedList*)&group->cl, contact); + index = group->cl.indexOf(contact); mainindex = index; } else { - index = List_IndexOf((SortedList*)&group->cl, contact->subcontacts); + index = group->cl.indexOf(contact->subcontacts); mainindex = index; index += contact->iSubNumber; } @@ -197,7 +197,7 @@ LRESULT cli_ProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wP BYTE k = db_get_b(NULL, "CLC", "MetaExpanding", SETTING_METAEXPANDING_DEFAULT); if (k) { for (int i = 0; i < mainindex; i++) { - ClcContact *tempCont = group->cl.items[i]; + ClcContact *tempCont = group->cl[i]; if (tempCont->type == CLCIT_CONTACT && tempCont->iSubAllocated && tempCont->bSubExpanded) index += tempCont->iSubAllocated; } diff --git a/plugins/Clist_modern/src/modern_clcpaint.cpp b/plugins/Clist_modern/src/modern_clcpaint.cpp index 2c89f39c2f..0091db8bce 100644 --- a/plugins/Clist_modern/src/modern_clcpaint.cpp +++ b/plugins/Clist_modern/src/modern_clcpaint.cpp @@ -544,7 +544,7 @@ MODERNMASK* CLCPaint::_GetCLCContactRowBackModernMask(ClcGroup *group, ClcContac _AddParamShort(mpModernMask, hi_Type, hi_Group); if (Drawing->group) { _AddParamShort(mpModernMask, hi_Open, Drawing->group->expanded ? hi_True : hi_False); - _AddParamShort(mpModernMask, hi_IsEmpty, (Drawing->group->cl.count == 0) ? hi_True : hi_False); + _AddParamShort(mpModernMask, hi_IsEmpty, (Drawing->group->cl.getCount() == 0) ? hi_True : hi_False); } break; @@ -598,11 +598,11 @@ MODERNMASK* CLCPaint::_GetCLCContactRowBackModernMask(ClcGroup *group, ClcContac break; } - if (group->scanIndex == 0 && group->cl.count == 1) + if (group->scanIndex == 0 && group->cl.getCount() == 1) _AddParamShort(mpModernMask, hi_GroupPos, hi_First_Single); else if (group->scanIndex == 0) _AddParamShort(mpModernMask, hi_GroupPos, hi_First); - else if (group->scanIndex + 1 == group->cl.count) + else if (group->scanIndex + 1 == group->cl.getCount()) _AddParamShort(mpModernMask, hi_GroupPos, hi_Last); else _AddParamShort(mpModernMask, hi_GroupPos, hi_Mid); @@ -625,7 +625,7 @@ MODERNMASK* CLCPaint::_GetCLCContactRowBackModernMask(ClcGroup *group, ClcContac } if (group->parent) { - TCHAR *b2 = NEWTSTR_ALLOCA(group->parent->cl.items[0]->szText); + TCHAR *b2 = NEWTSTR_ALLOCA(group->parent->cl[0]->szText); for (int i = 0; b2[i] != 0; i++) if (b2[i] == _T(',')) b2[i] = _T('.'); @@ -663,7 +663,7 @@ void CLCPaint::_PaintRowItemsEx(HDC hdcMem, ClcData *dat, ClcContact *Drawing, R if (Drawing->type == CLCIT_GROUP && Drawing->group->parent->groupId == 0 && - Drawing->group->parent->cl.items[0] != Drawing) { + Drawing->group->parent->cl[0] != Drawing) { dg = dat->row_before_group_space; free_row_rc.top += dg; height -= dg; @@ -1619,7 +1619,7 @@ void CLCPaint::_DrawLines(HWND hWnd, ClcData *dat, int paintMode, RECT *rcPaint, while (y < rcPaint->bottom) { if (subindex == -1) { - if (group->scanIndex >= group->cl.count) { + if (group->scanIndex >= group->cl.getCount()) { group = group->parent; indent--; if (group == NULL) break; // Finished list @@ -1638,11 +1638,11 @@ void CLCPaint::_DrawLines(HWND hWnd, ClcData *dat, int paintMode, RECT *rcPaint, // Get item to draw int subident = 0; ClcContact *Drawing; - if (group->scanIndex < group->cl.count) { + if (group->scanIndex < group->cl.getCount()) { if (subindex == -1) - Drawing = group->cl.items[group->scanIndex]; + Drawing = group->cl[group->scanIndex]; else { - Drawing = &group->cl.items[group->scanIndex]->subcontacts[subindex]; + Drawing = &group->cl[group->scanIndex]->subcontacts[subindex]; subident = dat->subIndent; } } @@ -1702,8 +1702,8 @@ void CLCPaint::_DrawLines(HWND hWnd, ClcData *dat, int paintMode, RECT *rcPaint, RECT mrc = row_rc; if (group->parent == 0 && group->scanIndex != 0 - && group->scanIndex < group->cl.count - && group->cl.items[group->scanIndex]->type == CLCIT_GROUP) { + && group->scanIndex < group->cl.getCount() + && group->cl[group->scanIndex]->type == CLCIT_GROUP) { mrc.top += dat->row_before_group_space; } SkinDrawGlyphMask(pc.hdcMem, &mrc, rcPaint, mpRequest); @@ -1712,7 +1712,7 @@ void CLCPaint::_DrawLines(HWND hWnd, ClcData *dat, int paintMode, RECT *rcPaint, RECT mrc = row_rc; if (Drawing->type == CLCIT_GROUP && Drawing->group->parent->groupId == 0 && - Drawing->group->parent->cl.items[0] != Drawing) { + Drawing->group->parent->cl[0] != Drawing) { mrc.top += dat->row_before_group_space; } // Selection background ( only if hole line - full/less ) @@ -1789,7 +1789,7 @@ void CLCPaint::_DrawLines(HWND hWnd, ClcData *dat, int paintMode, RECT *rcPaint, RECT mrc = row_rc; if (Drawing->type == CLCIT_GROUP && Drawing->group->parent->groupId == 0 && - Drawing->group->parent->cl.items[0] != Drawing) { + Drawing->group->parent->cl[0] != Drawing) { mrc.top += dat->row_before_group_space; } SkinDrawGlyphMask(pc.hdcMem, &mrc, rcPaint, mpRequest); @@ -1802,17 +1802,17 @@ void CLCPaint::_DrawLines(HWND hWnd, ClcData *dat, int paintMode, RECT *rcPaint, y += iRowHeight; // increment by subcontacts - if ((group->cl.items && group->scanIndex < group->cl.count && group->cl.items[group->scanIndex]->subcontacts != NULL && group->cl.items[group->scanIndex]->type != CLCIT_GROUP) - && (group->cl.items[group->scanIndex]->bSubExpanded && dat->expandMeta)) { - if (subindex < group->cl.items[group->scanIndex]->iSubAllocated - 1) + ClcContact *cc = group->cl[group->scanIndex]; + if (cc != NULL && cc->subcontacts != NULL && cc->type != CLCIT_GROUP && cc->bSubExpanded && dat->expandMeta) { + if (subindex < cc->iSubAllocated - 1) subindex++; else subindex = -1; } - if (subindex == -1 && group->scanIndex < group->cl.count) { - 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 && subindex == -1) { + if (cc->type == CLCIT_GROUP && cc->group->expanded) { + group = cc->group; indent++; group->scanIndex = 0; subindex = -1; @@ -1820,7 +1820,7 @@ void CLCPaint::_DrawLines(HWND hWnd, ClcData *dat, int paintMode, RECT *rcPaint, } group->scanIndex++; } - else if (group->scanIndex >= group->cl.count) { + else if (group->scanIndex >= group->cl.getCount()) { subindex = -1; } } diff --git a/plugins/Clist_modern/src/modern_clcutils.cpp b/plugins/Clist_modern/src/modern_clcutils.cpp index 6c0364836f..fa95b706b5 100644 --- a/plugins/Clist_modern/src/modern_clcutils.cpp +++ b/plugins/Clist_modern/src/modern_clcutils.cpp @@ -341,7 +341,7 @@ int GetDropTargetInformation(HWND hwnd, ClcData *dat, POINT pt) ok = 1; } else if ((pt.y + dat->yScroll >= cliGetRowTopY(dat, hit + 1) - dat->insertionMarkHitHeight) - || (contact->type == CLCIT_GROUP && contact->group->expanded && contact->group->cl.count > 0)) { + || (contact->type == CLCIT_GROUP && contact->group->expanded && contact->group->cl.getCount() > 0)) { //could be insertion mark (below) topItem = hit; bottomItem = hit + 1; topcontact = contact; topgroup = group; @@ -664,14 +664,14 @@ int cliFindRowByText(HWND hwnd, ClcData *dat, const TCHAR *text, int prefixOk) 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_DIVIDER) { bool found; if (dat->bFilterSearch) { diff --git a/plugins/Clist_modern/src/modern_rowheight_funcs.cpp b/plugins/Clist_modern/src/modern_rowheight_funcs.cpp index d57c546a3a..b239ea046e 100644 --- a/plugins/Clist_modern/src/modern_rowheight_funcs.cpp +++ b/plugins/Clist_modern/src/modern_rowheight_funcs.cpp @@ -78,7 +78,7 @@ int RowHeight_CalcRowHeight(ClcData *dat, ClcContact *contact, int item) tmp = max(tmp, ICON_HEIGHT); tmp = max(tmp, dat->row_min_heigh); tmp += dat->row_border * 2; - if (contact->type == CLCIT_GROUP && contact->group->parent->groupId == 0 && contact->group->parent->cl.items[0] != contact) + if (contact->type == CLCIT_GROUP && contact->group->parent->groupId == 0 && contact->group->parent->cl[0] != contact) tmp += dat->row_before_group_space; if (item != -1) dat->row_heights[item] = tmp; @@ -417,7 +417,7 @@ void RowHeights_CalcRowHeights(ClcData *dat, HWND hwnd) int subident; ClcContact *Drawing; if (subindex == -1) { - if (group->scanIndex == group->cl.count) { + if (group->scanIndex == group->cl.getCount()) { if ((group = group->parent) == NULL) break; group->scanIndex++; @@ -426,12 +426,12 @@ void RowHeights_CalcRowHeights(ClcData *dat, HWND hwnd) } // Get item to draw - Drawing = group->cl.items[group->scanIndex]; + Drawing = group->cl[group->scanIndex]; subident = 0; } else { // Get item to draw - Drawing = &group->cl.items[group->scanIndex]->subcontacts[subindex]; + Drawing = &group->cl[group->scanIndex]->subcontacts[subindex]; subident = dat->subIndent; } @@ -444,9 +444,9 @@ void RowHeights_CalcRowHeights(ClcData *dat, HWND hwnd) RowHeight_CalcRowHeight(dat, Drawing, line_num); // increment by subcontacts - if (group->cl.items[group->scanIndex]->subcontacts != NULL && group->cl.items[group->scanIndex]->type != CLCIT_GROUP) { - if (group->cl.items[group->scanIndex]->bSubExpanded && dat->expandMeta) { - if (subindex < group->cl.items[group->scanIndex]->iSubAllocated - 1) + if (group->cl[group->scanIndex]->subcontacts != NULL && group->cl[group->scanIndex]->type != CLCIT_GROUP) { + if (group->cl[group->scanIndex]->bSubExpanded && dat->expandMeta) { + if (subindex < group->cl[group->scanIndex]->iSubAllocated - 1) subindex++; else subindex = -1; @@ -454,8 +454,8 @@ void RowHeights_CalcRowHeights(ClcData *dat, HWND hwnd) } if (subindex == -1) { - if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP && group->cl.items[group->scanIndex]->group->expanded) { - group = group->cl.items[group->scanIndex]->group; + if (group->cl[group->scanIndex]->type == CLCIT_GROUP && group->cl[group->scanIndex]->group->expanded) { + group = group->cl[group->scanIndex]->group; indent++; group->scanIndex = 0; subindex = -1; 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 diff --git a/plugins/TipperYM/src/mir_smileys.h b/plugins/TipperYM/src/mir_smileys.h index 04d6256331..0e95710240 100644 --- a/plugins/TipperYM/src/mir_smileys.h +++ b/plugins/TipperYM/src/mir_smileys.h @@ -59,7 +59,7 @@ int InitTipperSmileys(); SMILEYPARSEINFO Smileys_PreParse(LPCTSTR lpString, int nCount, const char *protocol); void Smileys_FreeParse(SMILEYPARSEINFO parseInfo); -SortedList *ReplaceSmileys(const TCHAR *text, int text_size, const char *protocol, int *max_smiley_height); +SortedList* ReplaceSmileys(const TCHAR *text, int text_size, const char *protocol, int *max_smiley_height); SIZE GetTextSize(HDC hdcMem, const TCHAR *szText, SMILEYPARSEINFO info, UINT uTextFormat, int max_width); void DrawTextSmiley(HDC hdcMem, RECT free_rc, const TCHAR *szText, int len, SMILEYPARSEINFO info, UINT uTextFormat); void DestroySmileyList(SortedList* p_list); diff --git a/plugins/UserInfoEx/src/svc_constants.cpp b/plugins/UserInfoEx/src/svc_constants.cpp index c378cb0bb5..899d944700 100644 --- a/plugins/UserInfoEx/src/svc_constants.cpp +++ b/plugins/UserInfoEx/src/svc_constants.cpp @@ -271,7 +271,7 @@ static int __cdecl ListSortProc(const LPIDSTRLIST p1, const LPIDSTRLIST p2) * @return nothing **/ -static void SvcConstantsTranslateList(LPIDSTRLIST pList, UINT nListCount/*, SortedList *pSorted*/) +static void SvcConstantsTranslateList(LPIDSTRLIST pList, UINT nListCount) { if (!pList[0].ptszTranslated) { for (UINT i = 0; i < nListCount; i++) diff --git a/plugins/Variables/src/tokenregister.cpp b/plugins/Variables/src/tokenregister.cpp index 2e6bc5fd80..7cf2fb0300 100644 --- a/plugins/Variables/src/tokenregister.cpp +++ b/plugins/Variables/src/tokenregister.cpp @@ -77,7 +77,7 @@ int deRegisterToken(TCHAR *token) if (tre == NULL) return -1; - List_RemovePtr((SortedList*)&tokens, tre); + tokens.remove(tre); } if (!(tre->tr.flags & TRF_PARSEFUNC) && tre->tr.szService != NULL) @@ -99,7 +99,6 @@ int deRegisterToken(TCHAR *token) INT_PTR registerToken(WPARAM, LPARAM lParam) { DWORD hash; - int idx; TOKENREGISTEREX *newVr = (TOKENREGISTEREX*)lParam; if (newVr == NULL || newVr->szTokenString == NULL || newVr->cbSize <= 0) @@ -140,8 +139,7 @@ INT_PTR registerToken(WPARAM, LPARAM lParam) tre->tr.szCleanupService = mir_strdup(newVr->szCleanupService); mir_cslock lck(csRegister); - List_GetIndex((SortedList*)&tokens, tre, &idx); - List_Insert((SortedList*)&tokens, tre, idx); + tokens.insert(tre); return 0; } -- cgit v1.2.3