diff options
| author | George Hazan <george.hazan@gmail.com> | 2025-05-18 15:12:42 +0300 |
|---|---|---|
| committer | George Hazan <george.hazan@gmail.com> | 2025-05-18 15:12:42 +0300 |
| commit | 85449b314d11fedb6bb00c8d31b28577214a5053 (patch) | |
| tree | fddb75a065dba1892444453397c061b385e1c1db | |
| parent | 54694fba871917eac0ed422465064f0235b005d1 (diff) | |
code cleaning
| -rw-r--r-- | include/m_clistint.h | 2 | ||||
| -rw-r--r-- | plugins/Clist_modern/src/modern_clc.cpp | 16 | ||||
| -rw-r--r-- | plugins/Clist_modern/src/modern_clc.h | 1 | ||||
| -rw-r--r-- | plugins/Clist_modern/src/modern_clcidents.cpp | 3 | ||||
| -rw-r--r-- | plugins/Clist_modern/src/modern_clcitems.cpp | 4 | ||||
| -rw-r--r-- | plugins/Clist_modern/src/modern_clcmsgs.cpp | 2 | ||||
| -rw-r--r-- | plugins/Clist_modern/src/modern_clcutils.cpp | 4 | ||||
| -rw-r--r-- | plugins/Clist_modern/src/modern_commonprototypes.h | 2 | ||||
| -rw-r--r-- | plugins/Clist_nicer/src/clc.cpp | 2 | ||||
| -rw-r--r-- | src/mir_app/src/clc.cpp | 8 | ||||
| -rw-r--r-- | src/mir_app/src/clc.h | 2 | ||||
| -rw-r--r-- | src/mir_app/src/clcidents.cpp | 3 | ||||
| -rw-r--r-- | src/mir_app/src/clcitems.cpp | 2 | ||||
| -rw-r--r-- | src/mir_app/src/clcmsgs.cpp | 4 | ||||
| -rw-r--r-- | src/mir_app/src/clcutils.cpp | 4 |
15 files changed, 30 insertions, 29 deletions
diff --git a/include/m_clistint.h b/include/m_clistint.h index a6e006f434..49745c61ca 100644 --- a/include/m_clistint.h +++ b/include/m_clistint.h @@ -332,7 +332,7 @@ struct CLIST_INTERFACE // clcidents.c
ClcContact* (*pfnFindItem)(uint32_t dwItem, ClcContact *contact);
- int (*pfnGetRowsPriorTo)(ClcGroup *group, ClcGroup *subgroup, int contactIndex);
+ int (*pfnGetRowsPriorTo)(ClcData *dat, ClcGroup *subgroup, int contactIndex);
int (*pfnGetRowByIndex)(ClcData *dat, int testindex, ClcContact **contact, ClcGroup **subgroup);
int (*pfnGetContactHiddenStatus)(MCONTACT hContact, char *szProto, ClcData *dat);
int (*pfnIsVisibleContact)(ClcCacheEntry *pce, ClcGroup *group);
diff --git a/plugins/Clist_modern/src/modern_clc.cpp b/plugins/Clist_modern/src/modern_clc.cpp index ea9d96c37f..fdf0aead83 100644 --- a/plugins/Clist_modern/src/modern_clc.cpp +++ b/plugins/Clist_modern/src/modern_clc.cpp @@ -240,7 +240,7 @@ static int clcSearchNextContact(HWND hwnd, ClcData *dat, int index, const wchar_ int foundindex;
for (; group; group = group->parent)
Clist_SetGroupExpand(hwnd, dat, group, 1);
- foundindex = g_clistApi.pfnGetRowsPriorTo(&dat->list, contactGroup, contactScanIndex);
+ foundindex = g_clistApi.pfnGetRowsPriorTo(dat, contactGroup, contactScanIndex);
if (fReturnAsFound)
return foundindex;
else if (nLastFound != -1 && fSearchUp && foundindex == index)
@@ -508,7 +508,7 @@ static LRESULT clcOnKeyDown(ClcData *dat, HWND hwnd, UINT, WPARAM wParam, LPARAM }
else if (!contact->iSubNumber && contact->iSubAllocated > 0) {
if (changeGroupExpand == 1 && !contact->bSubExpanded) {
- dat->selection = cliGetRowsPriorTo(&dat->list, group, -1);
+ dat->selection = cliGetRowsPriorTo(dat, group, -1);
selMoved = 1;
}
else if (changeGroupExpand == 1 && contact->bSubExpanded) {
@@ -540,7 +540,7 @@ static LRESULT clcOnKeyDown(ClcData *dat, HWND hwnd, UINT, WPARAM wParam, LPARAM ClcContact *contact2;
ClcGroup *group2;
if (Clist_FindItem(hwnd, dat, contact->hContact, &contact2, &group2)) {
- int i = cliGetRowsPriorTo(&dat->list, group2, group2->cl.indexOf(contact2));
+ int i = cliGetRowsPriorTo(dat, group2, group2->cl.indexOf(contact2));
Clist_EnsureVisible(hwnd, dat, i + contact->iSubAllocated, 0);
}
}
@@ -551,7 +551,7 @@ static LRESULT clcOnKeyDown(ClcData *dat, HWND hwnd, UINT, WPARAM wParam, LPARAM else {
if (changeGroupExpand == 1 && contact->type == CLCIT_CONTACT) {
if (group == &dat->list) { SetCapture(hwnd); return 0; }
- dat->selection = cliGetRowsPriorTo(&dat->list, group, -1);
+ dat->selection = cliGetRowsPriorTo(dat, group, -1);
selMoved = 1;
}
else if (contact->type == CLCIT_GROUP) {
@@ -635,7 +635,7 @@ static LRESULT clcOnTimer(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LPAR ClcContact *contact;
ClcGroup *group;
if (Clist_FindItem(hwnd, dat, hitcontact->hContact, &contact, &group)) {
- int i = cliGetRowsPriorTo(&dat->list, group, group->cl.indexOf(contact));
+ int i = cliGetRowsPriorTo(dat, group, group->cl.indexOf(contact));
Clist_EnsureVisible(hwnd, dat, i + hitcontact->iSubAllocated, 0);
}
}
@@ -757,9 +757,9 @@ static LRESULT clcOnLButtonDown(ClcData *dat, HWND hwnd, UINT, WPARAM, LPARAM lP dat->selection = cliGetRowByIndex(dat, dat->selection, &selcontact, &selgroup);
Clist_SetGroupExpand(hwnd, dat, contact->group, -1);
if (dat->selection != -1) {
- dat->selection = cliGetRowsPriorTo(&dat->list, selgroup, selgroup->cl.indexOf(selcontact));
+ dat->selection = cliGetRowsPriorTo(dat, selgroup, selgroup->cl.indexOf(selcontact));
if (dat->selection == -1)
- dat->selection = cliGetRowsPriorTo(&dat->list, contact->group, -1);
+ dat->selection = cliGetRowsPriorTo(dat, contact->group, -1);
}
if (dat->bCompactMode)
@@ -1401,7 +1401,7 @@ static LRESULT clcOnIntmIconChanged(ClcData *dat, HWND hwnd, UINT, WPARAM wParam if (hSelItem) {
ClcGroup *selgroup;
if (Clist_FindItem(hwnd, dat, hSelItem, &selcontact, &selgroup))
- dat->selection = g_clistApi.pfnGetRowsPriorTo(&dat->list, selgroup, selgroup->cl.indexOf(selcontact));
+ dat->selection = g_clistApi.pfnGetRowsPriorTo(dat, selgroup, selgroup->cl.indexOf(selcontact));
else
dat->selection = -1;
}
diff --git a/plugins/Clist_modern/src/modern_clc.h b/plugins/Clist_modern/src/modern_clc.h index ccefd45dc2..40c17311c3 100644 --- a/plugins/Clist_modern/src/modern_clc.h +++ b/plugins/Clist_modern/src/modern_clc.h @@ -316,7 +316,6 @@ typedef struct tagOVERLAYICONINFO void ClcOptionsChanged(void);
// clcidents.c
-int cliGetRowsPriorTo(ClcGroup *group, ClcGroup *subgroup, int contactIndex);
int cliGetRowByIndex(ClcData *dat, int testindex, ClcContact **contact, ClcGroup **subgroup);
// clcitems.c
diff --git a/plugins/Clist_modern/src/modern_clcidents.cpp b/plugins/Clist_modern/src/modern_clcidents.cpp index e0b6c283d8..71b1051653 100644 --- a/plugins/Clist_modern/src/modern_clcidents.cpp +++ b/plugins/Clist_modern/src/modern_clcidents.cpp @@ -24,8 +24,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h"
-int cliGetRowsPriorTo(ClcGroup *group, ClcGroup *subgroup, int contactIndex)
+int cliGetRowsPriorTo(ClcData *dat, ClcGroup *subgroup, int contactIndex)
{
+ auto *group = &dat->list;
int count = 0;
int subcontactscount = 0;
bool bMetaExpanding = db_get_b(0, "CLC", "MetaExpanding", SETTING_METAEXPANDING_DEFAULT) != 0;
diff --git a/plugins/Clist_modern/src/modern_clcitems.cpp b/plugins/Clist_modern/src/modern_clcitems.cpp index 88804d7f8d..13c04b8ea9 100644 --- a/plugins/Clist_modern/src/modern_clcitems.cpp +++ b/plugins/Clist_modern/src/modern_clcitems.cpp @@ -202,9 +202,9 @@ int RestoreSelection(ClcData *dat, MCONTACT hSelected) }
if (!selcontact->iSubNumber)
- dat->selection = g_clistApi.pfnGetRowsPriorTo(&dat->list, selgroup, selgroup->cl.indexOf(selcontact));
+ dat->selection = g_clistApi.pfnGetRowsPriorTo(dat, selgroup, selgroup->cl.indexOf(selcontact));
else {
- dat->selection = g_clistApi.pfnGetRowsPriorTo(&dat->list, selgroup, selgroup->cl.indexOf(selcontact->subcontacts));
+ dat->selection = g_clistApi.pfnGetRowsPriorTo(dat, selgroup, selgroup->cl.indexOf(selcontact->subcontacts));
if (dat->selection != -1)
dat->selection += selcontact->iSubNumber;
}
diff --git a/plugins/Clist_modern/src/modern_clcmsgs.cpp b/plugins/Clist_modern/src/modern_clcmsgs.cpp index 22bfe3805c..8885269a05 100644 --- a/plugins/Clist_modern/src/modern_clcmsgs.cpp +++ b/plugins/Clist_modern/src/modern_clcmsgs.cpp @@ -196,7 +196,7 @@ LRESULT cli_ProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wP }
}
- dat->selection = g_clistApi.pfnGetRowsPriorTo(&dat->list, group, index);
+ dat->selection = g_clistApi.pfnGetRowsPriorTo(dat, group, index);
Clist_EnsureVisible(hwnd, dat, dat->selection, 0);
}
return 0;
diff --git a/plugins/Clist_modern/src/modern_clcutils.cpp b/plugins/Clist_modern/src/modern_clcutils.cpp index 78d8e973e6..f248821d45 100644 --- a/plugins/Clist_modern/src/modern_clcutils.cpp +++ b/plugins/Clist_modern/src/modern_clcutils.cpp @@ -649,7 +649,7 @@ int cliFindRowByText(HWND hwnd, ClcData *dat, const wchar_t *text, int prefixOk) int ccScanIndex = group->scanIndex;
for (; group; group = group->parent)
Clist_SetGroupExpand(hwnd, dat, group, 1);
- return g_clistApi.pfnGetRowsPriorTo(&dat->list, ccGroup, ccScanIndex + SubCount);
+ return g_clistApi.pfnGetRowsPriorTo(dat, ccGroup, ccScanIndex + SubCount);
}
if (cc->type == CLCIT_GROUP) {
@@ -682,7 +682,7 @@ int cliFindRowByText(HWND hwnd, ClcData *dat, const wchar_t *text, int prefixOk) Clist_SetGroupExpand(hwnd, dat, group, 1);
if (!cc->bSubExpanded)
ExpandMetaContact(hwnd, cc, dat);
- return g_clistApi.pfnGetRowsPriorTo(&dat->list, ccGroup, ccScanIndex + SubCount + i + 1);
+ return g_clistApi.pfnGetRowsPriorTo(dat, ccGroup, ccScanIndex + SubCount + i + 1);
}
}
}
diff --git a/plugins/Clist_modern/src/modern_commonprototypes.h b/plugins/Clist_modern/src/modern_commonprototypes.h index bd108c3770..3569a6c74e 100644 --- a/plugins/Clist_modern/src/modern_commonprototypes.h +++ b/plugins/Clist_modern/src/modern_commonprototypes.h @@ -213,7 +213,7 @@ void cliRebuildEntireList(HWND hwnd, ClcData *dat); void cliRecalcScrollBar(HWND hwnd, ClcData *dat);
int cliGetGroupContentsCount(ClcGroup *group, int visibleOnly);
int cliFindRowByText(HWND hwnd, ClcData *dat, const wchar_t *text, int prefixOk);
-int cliGetRowsPriorTo(ClcGroup *group, ClcGroup *subgroup, int contactIndex);
+int cliGetRowsPriorTo(ClcData *dat, ClcGroup *subgroup, int contactIndex);
int cli_IconFromStatusMode(const char *szProto, int nStatus, MCONTACT hContact);
int cli_RemoveEvent(CListEvent *cle);
void cli_FreeContact(ClcContact*);
diff --git a/plugins/Clist_nicer/src/clc.cpp b/plugins/Clist_nicer/src/clc.cpp index 59e9809b7b..d580f9b270 100644 --- a/plugins/Clist_nicer/src/clc.cpp +++ b/plugins/Clist_nicer/src/clc.cpp @@ -358,7 +358,7 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L if (hSelItem) {
ClcGroup *selgroup;
if (Clist_FindItem(hwnd, dat, hSelItem, &selcontact, &selgroup))
- dat->selection = g_clistApi.pfnGetRowsPriorTo(&dat->list, selgroup, selgroup->cl.indexOf(selcontact));
+ dat->selection = g_clistApi.pfnGetRowsPriorTo(dat, selgroup, selgroup->cl.indexOf(selcontact));
else
dat->selection = -1;
}
diff --git a/src/mir_app/src/clc.cpp b/src/mir_app/src/clc.cpp index c990c7a81b..12a8013834 100644 --- a/src/mir_app/src/clc.cpp +++ b/src/mir_app/src/clc.cpp @@ -503,7 +503,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam if (hSelItem) {
ClcGroup *selgroup;
if (Clist_FindItem(hwnd, dat, hSelItem, &selcontact, &selgroup))
- dat->selection = g_clistApi.pfnGetRowsPriorTo(&dat->list, selgroup, selgroup->cl.indexOf(selcontact));
+ dat->selection = g_clistApi.pfnGetRowsPriorTo(dat, selgroup, selgroup->cl.indexOf(selcontact));
else
dat->selection = -1;
}
@@ -703,7 +703,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam case CLCIT_CONTACT:
if (group == &dat->list)
return 0;
- dat->selection = g_clistApi.pfnGetRowsPriorTo(&dat->list, group, -1);
+ dat->selection = g_clistApi.pfnGetRowsPriorTo(dat, group, -1);
goto LBL_MoveSelection;
}
}
@@ -895,9 +895,9 @@ LBL_MoveSelection: Clist_SetGroupExpand(hwnd, dat, contact->group, -1);
if (dat->selection != -1) {
dat->selection =
- g_clistApi.pfnGetRowsPriorTo(&dat->list, selgroup, selgroup->cl.indexOf(selcontact));
+ g_clistApi.pfnGetRowsPriorTo(dat, selgroup, selgroup->cl.indexOf(selcontact));
if (dat->selection == -1)
- dat->selection = g_clistApi.pfnGetRowsPriorTo(&dat->list, contact->group, -1);
+ dat->selection = g_clistApi.pfnGetRowsPriorTo(dat, contact->group, -1);
}
g_clistApi.pfnInvalidateRect(hwnd, nullptr, FALSE);
UpdateWindow(hwnd);
diff --git a/src/mir_app/src/clc.h b/src/mir_app/src/clc.h index 721f6b462b..3ca338e2f1 100644 --- a/src/mir_app/src/clc.h +++ b/src/mir_app/src/clc.h @@ -48,7 +48,7 @@ extern OBJLIST<MenuProto> g_menuProtos; LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
/* clcidents.c */
-int fnGetRowsPriorTo(ClcGroup *group, ClcGroup *subgroup, int contactIndex);
+int fnGetRowsPriorTo(ClcData *dat, ClcGroup *subgroup, int contactIndex);
int fnGetRowByIndex(ClcData *dat, int testindex, ClcContact **contact, ClcGroup **subgroup);
ClcContact* fnFindItem(uint32_t dwItem, ClcContact *contact);
diff --git a/src/mir_app/src/clcidents.cpp b/src/mir_app/src/clcidents.cpp index 6bcc6eeebe..bb9345fc6a 100644 --- a/src/mir_app/src/clcidents.cpp +++ b/src/mir_app/src/clcidents.cpp @@ -42,10 +42,11 @@ contains routines to convert between them. 2->1: GetRowByIndex()
*/
-int fnGetRowsPriorTo(ClcGroup *group, ClcGroup *subgroup, int contactIndex)
+int fnGetRowsPriorTo(ClcData *dat, ClcGroup *subgroup, int contactIndex)
{
int count = 0;
+ auto *group = &dat->list;
group->scanIndex = 0;
for (;;) {
if (group->scanIndex == group->cl.getCount()) {
diff --git a/src/mir_app/src/clcitems.cpp b/src/mir_app/src/clcitems.cpp index df60a7ee3d..9678c5e87e 100644 --- a/src/mir_app/src/clcitems.cpp +++ b/src/mir_app/src/clcitems.cpp @@ -574,7 +574,7 @@ void fnSortCLC(HWND hwnd, ClcData *dat, int useInsertionSort) if (hSelItem) {
ClcGroup *selgroup;
if (Clist_FindItem(hwnd, dat, hSelItem, &selcontact, &selgroup))
- dat->selection = g_clistApi.pfnGetRowsPriorTo(&dat->list, selgroup, selgroup->cl.indexOf(selcontact));
+ dat->selection = g_clistApi.pfnGetRowsPriorTo(dat, selgroup, selgroup->cl.indexOf(selcontact));
}
g_clistApi.pfnRecalcScrollBar(hwnd, dat);
diff --git a/src/mir_app/src/clcmsgs.cpp b/src/mir_app/src/clcmsgs.cpp index 638dab4493..762ca67596 100644 --- a/src/mir_app/src/clcmsgs.cpp +++ b/src/mir_app/src/clcmsgs.cpp @@ -101,7 +101,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wPar for (ClcGroup *tgroup = group; tgroup; tgroup = tgroup->parent)
Clist_SetGroupExpand(hwnd, dat, tgroup, 1);
- Clist_EnsureVisible(hwnd, dat, g_clistApi.pfnGetRowsPriorTo(&dat->list, group, group->cl.indexOf(contact)), 0);
+ Clist_EnsureVisible(hwnd, dat, g_clistApi.pfnGetRowsPriorTo(dat, group, group->cl.indexOf(contact)), 0);
break;
case CLM_EXPAND:
@@ -316,7 +316,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wPar for (ClcGroup *tgroup = group; tgroup; tgroup = tgroup->parent)
Clist_SetGroupExpand(hwnd, dat, tgroup, 1);
- dat->selection = g_clistApi.pfnGetRowsPriorTo(&dat->list, group, group->cl.indexOf(contact));
+ dat->selection = g_clistApi.pfnGetRowsPriorTo(dat, group, group->cl.indexOf(contact));
Clist_EnsureVisible(hwnd, dat, dat->selection, 0);
break;
diff --git a/src/mir_app/src/clcutils.cpp b/src/mir_app/src/clcutils.cpp index 3000d7132c..b493dec69c 100644 --- a/src/mir_app/src/clcutils.cpp +++ b/src/mir_app/src/clcutils.cpp @@ -301,7 +301,7 @@ MIR_APP_DLL(void) Clist_SetGroupExpand(HWND hwnd, ClcData *dat, ClcGroup *group, g_clistApi.pfnInvalidateRect(hwnd, nullptr, FALSE);
int contentCount = g_clistApi.pfnGetGroupContentsCount(group, 1);
- int groupy = g_clistApi.pfnGetRowsPriorTo(&dat->list, group, -1);
+ int groupy = g_clistApi.pfnGetRowsPriorTo(dat, group, -1);
if (dat->selection > groupy && dat->selection < groupy + contentCount)
dat->selection = groupy;
@@ -377,7 +377,7 @@ int fnFindRowByText(HWND hwnd, ClcData *dat, const wchar_t *text, int prefixOk) int contactScanIndex = group->scanIndex;
for (; group; group = group->parent)
Clist_SetGroupExpand(hwnd, dat, group, 1);
- return g_clistApi.pfnGetRowsPriorTo(&dat->list, contactGroup, contactScanIndex);
+ return g_clistApi.pfnGetRowsPriorTo(dat, contactGroup, contactScanIndex);
}
if (cc->type == CLCIT_GROUP) {
if (!(dat->exStyle & CLS_EX_QUICKSEARCHVISONLY) || cc->group->bExpanded) {
|
