diff options
author | George Hazan <george.hazan@gmail.com> | 2016-04-28 11:51:26 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2016-04-28 11:51:26 +0000 |
commit | 774d7813af333a65459c09782b44cf236dc63887 (patch) | |
tree | 22b5a1719f9b99c4a4a5dce207d54ef48f94d824 | |
parent | 7c2e75f14ad9dd186a85b17587c21c2561286581 (diff) |
strange unused groups' cache. removed
git-svn-id: http://svn.miranda-ng.org/main/trunk@16786 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | plugins/Clist_modern/src/init.cpp | 5 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_clc.h | 5 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_clcidents.cpp | 25 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_clcitems.cpp | 64 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_commonprototypes.h | 5 | ||||
-rw-r--r-- | src/mir_app/src/clcitems.cpp | 2 |
6 files changed, 14 insertions, 92 deletions
diff --git a/plugins/Clist_modern/src/init.cpp b/plugins/Clist_modern/src/init.cpp index 97211ed845..49ed1febea 100644 --- a/plugins/Clist_modern/src/init.cpp +++ b/plugins/Clist_modern/src/init.cpp @@ -177,14 +177,9 @@ static HRESULT SubclassClistInterface() pcli->pfnIconFromStatusMode = cli_IconFromStatusMode;
pcli->pfnLoadCluiGlobalOpts = CLUI_cli_LoadCluiGlobalOpts;
pcli->pfnSortCLC = cli_SortCLC;
- pcli->pfnAddGroup = cli_AddGroup;
pcli->pfnAddContactToTree = cli_AddContactToTree;
- pcli->pfnAddInfoItemToGroup = cli_AddInfoItemToGroup;
- pcli->pfnAddItemToGroup = cli_AddItemToGroup;
pcli->pfnContactListWndProc = CLUI::cli_ContactListWndProc;
- pcli->pfnDeleteItemFromTree = cli_DeleteItemFromTree;
pcli->pfnFreeContact = cli_FreeContact;
- pcli->pfnFreeGroup = cli_FreeGroup;
pcli->pfnSetContactCheckboxes = cli_SetContactCheckboxes;
pcli->pfnTrayIconProcessMessage = cli_TrayIconProcessMessage;
pcli->pfnSaveStateAndRebuildList = cli_SaveStateAndRebuildList;
diff --git a/plugins/Clist_modern/src/modern_clc.h b/plugins/Clist_modern/src/modern_clc.h index b61584cf57..6a34f47988 100644 --- a/plugins/Clist_modern/src/modern_clc.h +++ b/plugins/Clist_modern/src/modern_clc.h @@ -350,14 +350,9 @@ int FindItem(HWND hwnd, ClcData *dat, DWORD hItem, ClcContact **contact, Clc int cliGetRowByIndex(ClcData *dat, int testindex, ClcContact **contact, ClcGroup **subgroup);
HANDLE ContactToHItem(ClcContact *contact);
HANDLE ContactToItemHandle(ClcContact *contact, DWORD *nmFlags);
-void ClearRowByIndexCache();
//clcitems.c
-ClcGroup *cli_AddGroup(HWND hwnd, ClcData *dat, const TCHAR *szName, DWORD flags, int groupId, int calcTotalMembers);
-void cli_FreeGroup(ClcGroup *group);
-int cli_AddInfoItemToGroup(ClcGroup *group, int flags, const TCHAR *pszText);
void cliRebuildEntireList(HWND hwnd, ClcData *dat);
-void cli_DeleteItemFromTree(HWND hwnd, MCONTACT hItem);
void cli_AddContactToTree(HWND hwnd, ClcData *dat, MCONTACT hContact, int updateTotalCount, int checkHideOffline);
void cli_SortCLC(HWND hwnd, ClcData *dat, int useInsertionSort);
int GetNewSelection(ClcGroup *group, int selection, int direction);
diff --git a/plugins/Clist_modern/src/modern_clcidents.cpp b/plugins/Clist_modern/src/modern_clcidents.cpp index b716ddfa59..3b0a0090a7 100644 --- a/plugins/Clist_modern/src/modern_clcidents.cpp +++ b/plugins/Clist_modern/src/modern_clcidents.cpp @@ -26,10 +26,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "modern_clc.h"
#include "modern_commonprototypes.h"
-#define CacheArrSize 255
-ClcGroup* CacheIndex[CacheArrSize] = { NULL };
-bool CacheIndexClear = TRUE;
-
/* the CLC uses 3 different ways to identify elements in its list, this file
contains routines to convert between them.
@@ -50,7 +46,9 @@ exclusively externally int GetContactIndex(ClcGroup *group, ClcContact *contact)
{
for (int i = 0; i < group->cl.count; i++)
- if (group->cl.items[i]->hContact == contact->hContact) return i;
+ if (group->cl.items[i]->hContact == contact->hContact)
+ return i;
+
return -1;
}
@@ -180,14 +178,6 @@ int FindItem(HWND hwnd, ClcData *dat, DWORD dwItem, ClcContact **contact, ClcGro return 0;
}
-void ClearRowByIndexCache()
-{
- if (!CacheIndexClear) {
- memset(CacheIndex, 0, sizeof(CacheIndex));
- CacheIndexClear = TRUE;
- }
-}
-
int cliGetRowByIndex(ClcData *dat, int testindex, ClcContact **contact, ClcGroup **subgroup)
{
int index = 0, i;
@@ -204,11 +194,6 @@ int cliGetRowByIndex(ClcData *dat, int testindex, ClcContact **contact, ClcGroup continue;
}
- if (index > 0 && index < CacheArrSize) {
- CacheIndex[index] = group;
- CacheIndexClear = FALSE;
- }
-
ClcContact *c = group->cl.items[group->scanIndex];
if (testindex == index) {
if (contact) *contact = c;
@@ -220,10 +205,6 @@ int cliGetRowByIndex(ClcData *dat, int testindex, ClcContact **contact, ClcGroup if (c->SubAllocated)
if (c->SubExpanded && dat->expandMeta) {
for (i = 0; i < c->SubAllocated; i++) {
- if ((index>0) && (index < CacheArrSize)) {
- CacheIndex[index] = group;
- CacheIndexClear = FALSE;
- }
index++;
if (testindex == index) {
if (contact) {
diff --git a/plugins/Clist_modern/src/modern_clcitems.cpp b/plugins/Clist_modern/src/modern_clcitems.cpp index 79df85ad71..4c9e685e2f 100644 --- a/plugins/Clist_modern/src/modern_clcitems.cpp +++ b/plugins/Clist_modern/src/modern_clcitems.cpp @@ -91,24 +91,6 @@ void AddSubcontacts(ClcData *dat, ClcContact *cont, BOOL showOfflineHereGroup) mir_free_and_nil(cont->subcontacts);
}
-int cli_AddItemToGroup(ClcGroup *group, int iAboveItem)
-{
- if (group == NULL)
- return 0;
-
- iAboveItem = corecli.pfnAddItemToGroup(group, iAboveItem);
- ClearRowByIndexCache();
- return iAboveItem;
-}
-
-ClcGroup* cli_AddGroup(HWND hwnd, ClcData *dat, const TCHAR *szName, DWORD flags, int groupId, int calcTotalMembers)
-{
- ClearRowByIndexCache();
- ClcGroup *result = corecli.pfnAddGroup(hwnd, dat, szName, flags, groupId, calcTotalMembers);
- ClearRowByIndexCache();
- return result;
-}
-
void cli_FreeContact(ClcContact *p)
{
if (p->SubAllocated) {
@@ -131,19 +113,6 @@ void cli_FreeContact(ClcContact *p) corecli.pfnFreeContact(p);
}
-void cli_FreeGroup(ClcGroup *group)
-{
- corecli.pfnFreeGroup(group);
- ClearRowByIndexCache();
-}
-
-int cli_AddInfoItemToGroup(ClcGroup *group, int flags, const TCHAR *pszText)
-{
- int i = corecli.pfnAddInfoItemToGroup(group, flags, pszText);
- ClearRowByIndexCache();
- return i;
-}
-
static void _LoadDataToContact(ClcContact *cont, ClcGroup *group, ClcData *dat, MCONTACT hContact)
{
if (!cont)
@@ -213,10 +182,9 @@ static ClcContact* AddContactToGroup(ClcData *dat, ClcGroup *group, MCONTACT hCo if (group->cl.items[i]->type != CLCIT_INFO || !(group->cl.items[i]->flags & CLCIIF_BELOWCONTACTS))
break;
- i = cli_AddItemToGroup(group, i + 1);
+ i = pcli->pfnAddItemToGroup(group, i + 1);
_LoadDataToContact(group->cl.items[i], group, dat, hContact);
- ClearRowByIndexCache();
return group->cl.items[i];
}
@@ -237,16 +205,6 @@ void cli_AddContactToTree(HWND hwnd, ClcData *dat, MCONTACT hContact, int update _LoadDataToContact(cont, group, dat, hContact);
}
-void cli_DeleteItemFromTree(HWND hwnd, MCONTACT hContact)
-{
- ClcData *dat = (ClcData *)GetWindowLongPtr(hwnd, 0);
- ClearRowByIndexCache();
- corecli.pfnDeleteItemFromTree(hwnd, hContact);
-
- dat->needsResort = 1;
- ClearRowByIndexCache();
-}
-
bool CLCItems_IsShowOfflineGroup(ClcGroup *group)
{
if (!group) return false;
@@ -291,17 +249,14 @@ void cliRebuildEntireList(HWND hwnd, ClcData *dat) {
DWORD style = GetWindowLongPtr(hwnd, GWL_STYLE);
ClcGroup *group = NULL;
- static int rebuildCounter = 0;
BOOL PlaceOfflineToRoot = db_get_b(NULL, "CList", "PlaceOfflineToRoot", SETTING_PLACEOFFLINETOROOT_DEFAULT);
KillTimer(hwnd, TIMERID_REBUILDAFTER);
pcli->bAutoRebuild = false;
- ClearRowByIndexCache();
ImageArray_Clear(&dat->avatar_cache);
RowHeights_Clear(dat);
RowHeights_GetMaxRowHeight(dat, hwnd);
- TRACEVAR("Rebuild Entire List %d times\n", ++rebuildCounter);
dat->list.expanded = 1;
dat->list.hideOffline = db_get_b(NULL, "CLC", "HideOfflineRoot", SETTING_HIDEOFFLINEATROOT_DEFAULT) && style&CLS_USEGROUPS;
@@ -315,10 +270,10 @@ void cliRebuildEntireList(HWND hwnd, ClcData *dat) for (int i = 1;; i++) {
DWORD groupFlags;
- TCHAR *szGroupName = Clist_GroupGetName(i, &groupFlags); //UNICODE
+ TCHAR *szGroupName = Clist_GroupGetName(i, &groupFlags);
if (szGroupName == NULL)
break;
- cli_AddGroup(hwnd, dat, szGroupName, groupFlags, i, 0);
+ pcli->pfnAddGroup(hwnd, dat, szGroupName, groupFlags, i, 0);
}
for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
@@ -330,7 +285,7 @@ void cliRebuildEntireList(HWND hwnd, ClcData *dat) if (mir_tstrlen(cacheEntry->tszGroup) == 0)
group = &dat->list;
else
- group = cli_AddGroup(hwnd, dat, cacheEntry->tszGroup, (DWORD)-1, 0, 0);
+ group = pcli->pfnAddGroup(hwnd, dat, cacheEntry->tszGroup, (DWORD)-1, 0, 0);
if (group != NULL) {
if (cacheEntry->m_iStatus == ID_STATUS_OFFLINE && PlaceOfflineToRoot)
@@ -447,7 +402,6 @@ void cli_SaveStateAndRebuildList(HWND hwnd, ClcData *dat) {
LOCK_RECALC_SCROLLBAR = TRUE;
- NMCLISTCONTROL nm;
int i, j;
OBJLIST<SavedGroupState_t> savedGroup(4);
OBJLIST<SavedContactState_t> savedContact(4);
@@ -474,14 +428,14 @@ void cli_SaveStateAndRebuildList(HWND hwnd, ClcData *dat) group = group->cl.items[group->scanIndex]->group;
group->scanIndex = 0;
- SavedGroupState_t* p = new SavedGroupState_t;
+ SavedGroupState_t *p = new SavedGroupState_t;
p->groupId = group->groupId;
p->expanded = group->expanded;
savedGroup.insert(p);
continue;
}
else if (group->cl.items[group->scanIndex]->type == CLCIT_CONTACT) {
- SavedContactState_t* p = new SavedContactState_t;
+ SavedContactState_t *p = new SavedContactState_t;
p->hContact = group->cl.items[group->scanIndex]->hContact;
memcpy(p->iExtraImage, group->cl.items[group->scanIndex]->iExtraImage, sizeof(p->iExtraImage));
p->checked = group->cl.items[group->scanIndex]->flags & CONTACTF_CHECKED;
@@ -549,6 +503,8 @@ void cli_SaveStateAndRebuildList(HWND hwnd, ClcData *dat) pcli->pfnRecalculateGroupCheckboxes(hwnd, dat);
pcli->pfnRecalcScrollBar(hwnd, dat);
+
+ NMCLISTCONTROL nm;
nm.hdr.code = CLN_LISTREBUILT;
nm.hdr.hwndFrom = hwnd;
nm.hdr.idFrom = GetDlgCtrlID(hwnd);
@@ -557,7 +513,7 @@ void cli_SaveStateAndRebuildList(HWND hwnd, ClcData *dat) ClcContact* cliCreateClcContact()
{
- ClcContact* contact = (ClcContact*)mir_calloc(sizeof(ClcContact));
+ ClcContact *contact = (ClcContact*)mir_calloc(sizeof(ClcContact));
memset(contact->iExtraImage, 0xFF, sizeof(contact->iExtraImage));
return contact;
}
@@ -632,7 +588,7 @@ int cliGetGroupContentsCount(ClcGroup *group, int visibleOnly) // checks the currently active view mode filter and returns true, if the contact should be hidden
// if no view mode is active, it returns the CList/Hidden setting
// also cares about sub contacts (if meta is active)
-//
+
int __fastcall CLVM_GetContactHiddenStatus(MCONTACT hContact, char *szProto, ClcData *dat)
{
int dbHidden = db_get_b(hContact, "CList", "Hidden", 0); // default hidden state, always respect it.
diff --git a/plugins/Clist_modern/src/modern_commonprototypes.h b/plugins/Clist_modern/src/modern_commonprototypes.h index 628ab82fc8..78261efc32 100644 --- a/plugins/Clist_modern/src/modern_commonprototypes.h +++ b/plugins/Clist_modern/src/modern_commonprototypes.h @@ -251,8 +251,6 @@ void cliFreeCacheItem(ClcCacheEntry *p); void cliRebuildEntireList(HWND hwnd, ClcData *dat);
void cliRecalcScrollBar(HWND hwnd, ClcData *dat);
void CLUI_cliOnCreateClc(void);
-int cli_AddItemToGroup(ClcGroup *group, int iAboveItem);
-int cli_AddInfoItemToGroup(ClcGroup *group, int flags, const TCHAR *pszText);
int cliGetGroupContentsCount(ClcGroup *group, int visibleOnly);
int cliFindRowByText(HWND hwnd, ClcData *dat, const TCHAR *text, int prefixOk);
int cliGetRowsPriorTo(ClcGroup *group, ClcGroup *subgroup, int contactIndex);
@@ -260,9 +258,7 @@ int cli_IconFromStatusMode(const char *szProto, int nStatus, MCONTACT hConta int cli_GetContactIcon(MCONTACT hContact);
int cli_RemoveEvent(MCONTACT hContact, MEVENT hDbEvent);
void cli_AddContactToTree(HWND hwnd, ClcData *dat, MCONTACT hContact, int updateTotalCount, int checkHideOffline);
-void cli_DeleteItemFromTree(HWND hwnd, MCONTACT hItem);
void cli_FreeContact(ClcContact*);
-void cli_FreeGroup(ClcGroup*);
void cli_SetContactCheckboxes(ClcContact*, int);
LRESULT cli_ProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wParam, LPARAM lParam);
CListEvent* cli_AddEvent(CLISTEVENT *cle);
@@ -274,7 +270,6 @@ int cliFindItem(HWND hwnd, ClcData *dat, DWORD dwItem, ClcContact **contact, int cliTrayIconPauseAutoHide(WPARAM wParam, LPARAM lParam);
void cliCluiProtocolStatusChanged(int status, const char *proto);
void cliInvalidateDisplayNameCacheEntry(MCONTACT hContact);
-void cliCheckCacheItem(ClcCacheEntry *pdnce);
void cli_SaveStateAndRebuildList(HWND hwnd, ClcData *dat);
void CLUI_cli_LoadCluiGlobalOpts(void);
INT_PTR cli_TrayIconProcessMessage(WPARAM wParam, LPARAM lParam);
diff --git a/src/mir_app/src/clcitems.cpp b/src/mir_app/src/clcitems.cpp index acb04a8f5f..2016cb34e5 100644 --- a/src/mir_app/src/clcitems.cpp +++ b/src/mir_app/src/clcitems.cpp @@ -308,7 +308,7 @@ ClcGroup* fnRemoveItemFromGroup(HWND hwnd, ClcGroup *group, ClcContact *contact, void fnDeleteItemFromTree(HWND hwnd, MCONTACT hItem) { - struct ClcData *dat = (struct ClcData *) GetWindowLongPtr(hwnd, 0); + ClcData *dat = (ClcData*)GetWindowLongPtr(hwnd, 0); dat->needsResort = 1; ClcGroup *group; |