diff options
author | George Hazan <ghazan@miranda.im> | 2018-03-10 14:19:03 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-03-10 14:19:03 +0300 |
commit | ab48946296156b94919b0ee31d2ac6404a3cc4c2 (patch) | |
tree | a3c58f4cb3daeb4ea6d7e5e3bdc81a5fde8a91f5 /plugins/Clist_modern | |
parent | 97a16a6e09df80ffa3429e23a0174bd8daaa29a1 (diff) |
ClistModern: fix for a very old bug when selection jumps to the first line during group's expansion/contraction
Diffstat (limited to 'plugins/Clist_modern')
-rw-r--r-- | plugins/Clist_modern/src/modern_clc.cpp | 6 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_clcidents.cpp | 9 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_commonprototypes.h | 1 |
3 files changed, 3 insertions, 13 deletions
diff --git a/plugins/Clist_modern/src/modern_clc.cpp b/plugins/Clist_modern/src/modern_clc.cpp index 2b80d741cd..e7bef1a7d9 100644 --- a/plugins/Clist_modern/src/modern_clc.cpp +++ b/plugins/Clist_modern/src/modern_clc.cpp @@ -523,7 +523,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, nullptr)) {
- int i = cliGetRowsPriorTo(&dat->list, group2, GetContactIndex(group2, contact2));
+ int i = cliGetRowsPriorTo(&dat->list, group2, group2->cl.indexOf(contact2));
pcli->pfnEnsureVisible(hwnd, dat, i + contact->iSubAllocated, 0);
}
}
@@ -617,7 +617,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, nullptr)) {
- i = cliGetRowsPriorTo(&dat->list, group, GetContactIndex(group, contact));
+ i = cliGetRowsPriorTo(&dat->list, group, group->cl.indexOf(contact));
pcli->pfnEnsureVisible(hwnd, dat, i + hitcontact->iSubAllocated, 0);
}
}
@@ -739,7 +739,7 @@ static LRESULT clcOnLButtonDown(ClcData *dat, HWND hwnd, UINT, WPARAM, LPARAM lP 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));
+ dat->selection = cliGetRowsPriorTo(&dat->list, selgroup, selgroup->cl.indexOf(selcontact));
if (dat->selection == -1)
dat->selection = cliGetRowsPriorTo(&dat->list, contact->group, -1);
}
diff --git a/plugins/Clist_modern/src/modern_clcidents.cpp b/plugins/Clist_modern/src/modern_clcidents.cpp index 3b636275e6..26fbb705c4 100644 --- a/plugins/Clist_modern/src/modern_clcidents.cpp +++ b/plugins/Clist_modern/src/modern_clcidents.cpp @@ -24,15 +24,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h"
-int GetContactIndex(ClcGroup *group, ClcContact *contact)
-{
- for (int i = 0; i < group->cl.getCount(); i++)
- if (group->cl[i]->hContact == contact->hContact)
- return i;
-
- return -1;
-}
-
int cliGetRowsPriorTo(ClcGroup *group, ClcGroup *subgroup, int contactIndex)
{
int count = 0;
diff --git a/plugins/Clist_modern/src/modern_commonprototypes.h b/plugins/Clist_modern/src/modern_commonprototypes.h index 53377d6ce1..d1cdfe9726 100644 --- a/plugins/Clist_modern/src/modern_commonprototypes.h +++ b/plugins/Clist_modern/src/modern_commonprototypes.h @@ -180,7 +180,6 @@ int ClcDoProtoAck(ACKDATA *ack); //clc.c int ModernSkinButtonDeleteAll(); //modernbutton.c
int GetContactCachedStatus(MCONTACT hContact); //clistsettings.c
int GetContactIconC(ClcCacheEntry *cacheEntry); //clistmod.c
-int GetContactIndex(ClcGroup *group, ClcContact *contact); //clcidents.c
int GetStatusForContact(MCONTACT hContact, char *szProto); //clistsettings.c
int InitCustomMenus(void); //clistmenus.c
int LoadMoveToGroup(); //movetogroup.c
|