summaryrefslogtreecommitdiff
path: root/plugins/Clist_modern
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2016-04-22 11:28:05 +0000
committerGeorge Hazan <george.hazan@gmail.com>2016-04-22 11:28:05 +0000
commitdc7a8b1f54463500d2c13339829db6c665f097da (patch)
treef93e3f2cbc72687e69bfd18945751a1f08743353 /plugins/Clist_modern
parent5212643f256d5cf75b295aeb42783c81ce033519 (diff)
- major atavism removed: clist_modern own cache;
- cache items are never deleted; - MS_CLIST_INVALIDATEDISPLAYNAME service removed and replaced with pcli->pfnInvalidateDisplayNameCacheEntry() call git-svn-id: http://svn.miranda-ng.org/main/trunk@16744 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Clist_modern')
-rw-r--r--plugins/Clist_modern/src/init.cpp1
-rw-r--r--plugins/Clist_modern/src/modern_clcitems.cpp33
-rw-r--r--plugins/Clist_modern/src/modern_clcutils.cpp2
-rw-r--r--plugins/Clist_modern/src/modern_clistsettings.cpp62
-rw-r--r--plugins/Clist_modern/src/modern_commonprototypes.h1
-rw-r--r--plugins/Clist_modern/src/modern_contact.cpp4
-rw-r--r--plugins/Clist_modern/src/modern_viewmodebar.cpp9
-rw-r--r--plugins/Clist_modern/src/stdafx.h3
8 files changed, 16 insertions, 99 deletions
diff --git a/plugins/Clist_modern/src/init.cpp b/plugins/Clist_modern/src/init.cpp
index a0765400ec..ab0c22fb4d 100644
--- a/plugins/Clist_modern/src/init.cpp
+++ b/plugins/Clist_modern/src/init.cpp
@@ -156,7 +156,6 @@ static HRESULT SubclassClistInterface()
pcli->pfnGetRowTopY = cliGetRowTopY;
pcli->pfnGetRowTotalHeight = cliGetRowTotalHeight;
pcli->pfnInvalidateRect = CLUI__cliInvalidateRect;
- pcli->pfnGetCacheEntry = cliGetCacheEntry;
pcli->pfnOnCreateClc = CLUI::cliOnCreateClc;
pcli->pfnPaintClc = CLCPaint::cliPaintClc;
pcli->pfnRebuildEntireList = cliRebuildEntireList;
diff --git a/plugins/Clist_modern/src/modern_clcitems.cpp b/plugins/Clist_modern/src/modern_clcitems.cpp
index 14f8632f26..67f9a7afc6 100644
--- a/plugins/Clist_modern/src/modern_clcitems.cpp
+++ b/plugins/Clist_modern/src/modern_clcitems.cpp
@@ -243,15 +243,6 @@ void cli_DeleteItemFromTree(HWND hwnd, MCONTACT hContact)
ClearRowByIndexCache();
corecli.pfnDeleteItemFromTree(hwnd, hContact);
- // check here contacts are not resorting
- if (hwnd == pcli->hwndContactTree) {
- int idx = clistCache.getIndex((ClcCacheEntry*)&hContact);
- if (idx != -1) {
- pcli->pfnFreeCacheItem(clistCache[idx]);
- clistCache.remove(idx);
- }
- }
-
dat->needsResort = 1;
ClearRowByIndexCache();
}
@@ -573,19 +564,21 @@ ClcContact* cliCreateClcContact()
ClcCacheEntry* cliCreateCacheItem(MCONTACT hContact)
{
- ClcCacheEntry *p = (ClcCacheEntry *)mir_calloc(sizeof(ClcCacheEntry));
- if (p == NULL)
+ ClcCacheEntry *pdnce = (ClcCacheEntry *)mir_calloc(sizeof(ClcCacheEntry));
+ if (pdnce == NULL)
return NULL;
- p->hContact = hContact;
- p->m_pszProto = GetContactProto(hContact);
- p->dwLastMsgTime = -1;
- p->bIsHidden = -1;
- p->m_bNoHiddenOffline = -1;
- p->IdleTS = -1;
- p->NotOnList = -1;
- p->IsExpanded = -1;
- return p;
+ pdnce->hContact = hContact;
+ pdnce->m_pszProto = GetContactProto(hContact);
+ pdnce->bIsHidden = db_get_b(hContact, "CList", "Hidden", 0);
+ pdnce->m_bIsSub = db_mc_isSub(hContact) != 0;
+ pdnce->m_bNoHiddenOffline = db_get_b(hContact, "CList", "noOffline", 0);
+ pdnce->IdleTS = db_get_dw(hContact, pdnce->m_pszProto, "IdleTS", 0);
+ pdnce->ApparentMode = db_get_w(hContact, pdnce->m_pszProto, "ApparentMode", 0);
+ pdnce->NotOnList = db_get_b(hContact, "CList", "NotOnList", 0);
+ pdnce->IsExpanded = db_get_b(hContact, "CList", "Expanded", 0);
+ pdnce->dwLastMsgTime = -1;
+ return pdnce;
}
void cliInvalidateDisplayNameCacheEntry(MCONTACT hContact)
diff --git a/plugins/Clist_modern/src/modern_clcutils.cpp b/plugins/Clist_modern/src/modern_clcutils.cpp
index 8d29148d99..f395506d2e 100644
--- a/plugins/Clist_modern/src/modern_clcutils.cpp
+++ b/plugins/Clist_modern/src/modern_clcutils.cpp
@@ -687,8 +687,6 @@ void LoadCLCOptions(HWND hwnd, ClcData *dat, BOOL bFirst)
dat->dbbBlendInActiveState = db_get_b(NULL, "CLC", "BlendInActiveState", SETTING_BLENDINACTIVESTATE_DEFAULT);
dat->dbbBlend25 = db_get_b(NULL, "CLC", "Blend25%", SETTING_BLENDINACTIVESTATE_DEFAULT);
dat->bCompactMode = db_get_b(NULL, "CLC", "CompactMode", SETTING_COMPACTMODE_DEFAULT);
- if ((pcli->hwndContactTree == hwnd || pcli->hwndContactTree == NULL))
- IvalidateDisplayNameCache();
corecli.pfnLoadClcOptions(hwnd, dat, bFirst);
diff --git a/plugins/Clist_modern/src/modern_clistsettings.cpp b/plugins/Clist_modern/src/modern_clistsettings.cpp
index 5586f5cba8..f244b0b54f 100644
--- a/plugins/Clist_modern/src/modern_clistsettings.cpp
+++ b/plugins/Clist_modern/src/modern_clistsettings.cpp
@@ -31,10 +31,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
void InsertContactIntoTree(MCONTACT hContact, int status);
void CListSettings_FreeCacheItemDataOption(ClcCacheEntry *pDst, DWORD flag);
-static int displayNameCacheSize;
-
-LIST<ClcCacheEntry> clistCache(50, NumericKeySortT);
-
TCHAR* UnknownConctactTranslatedName = NULL;
void InitDisplayNameCache(void)
@@ -46,27 +42,6 @@ void InitDisplayNameCache(void)
void FreeDisplayNameCache()
{
UninitAwayMsgModule();
-
- for (int i = 0; i < clistCache.getCount(); i++) {
- pcli->pfnFreeCacheItem(clistCache[i]);
- mir_free(clistCache[i]);
- }
- clistCache.destroy();
-}
-
-ClcCacheEntry* cliGetCacheEntry(MCONTACT hContact)
-{
- ClcCacheEntry *p;
- int idx = clistCache.getIndex((ClcCacheEntry*)&hContact);
- if (idx == -1) {
- if ((p = pcli->pfnCreateCacheItem(hContact)) != NULL) {
- clistCache.insert(p);
- pcli->pfnInvalidateDisplayNameCacheEntry(hContact);
- }
- }
- else p = clistCache[idx];
- pcli->pfnCheckCacheItem(p);
- return p;
}
void CListSettings_FreeCacheItemData(ClcCacheEntry *pDst)
@@ -200,26 +175,7 @@ void cliCheckCacheItem(ClcCacheEntry *pdnce)
pdnce->tszGroup = mir_tstrdup(_T(""));
}
- if (pdnce->bIsHidden == -1)
- pdnce->bIsHidden = db_get_b(pdnce->hContact, "CList", "Hidden", 0);
-
- pdnce->m_bIsSub = db_mc_isSub(pdnce->hContact) != 0;
-
- if (pdnce->m_bNoHiddenOffline == -1)
- pdnce->m_bNoHiddenOffline = db_get_b(pdnce->hContact, "CList", "noOffline", 0);
-
- if (pdnce->IdleTS == -1)
- pdnce->IdleTS = db_get_dw(pdnce->hContact, pdnce->m_pszProto, "IdleTS", 0);
-
- if (pdnce->ApparentMode == -1)
- pdnce->ApparentMode = db_get_w(pdnce->hContact, pdnce->m_pszProto, "ApparentMode", 0);
-
- if (pdnce->NotOnList == -1)
- pdnce->NotOnList = db_get_b(pdnce->hContact, "CList", "NotOnList", 0);
-
- if (pdnce->IsExpanded == -1)
- pdnce->IsExpanded = db_get_b(pdnce->hContact, "CList", "Expanded", 0);
-
+ // this variable isn't filled inside cliCreateCacheItem() because the filter could be changed dynamically
if (pdnce->dwLastMsgTime == -1 && g_CluiData.bFilterEffective & (CLVM_FILTER_LASTMSG | CLVM_FILTER_LASTMSG_NEWERTHAN | CLVM_FILTER_LASTMSG_OLDERTHAN)) {
pdnce->dwLastMsgTime = db_get_dw(pdnce->hContact, "CList", "mf_lastmsg", 0);
if (pdnce->dwLastMsgTime == 0)
@@ -227,22 +183,6 @@ void cliCheckCacheItem(ClcCacheEntry *pdnce)
}
}
-void IvalidateDisplayNameCache()
-{
- for (int i = 0; i < clistCache.getCount(); i++) {
- ClcCacheEntry *pdnce = (ClcCacheEntry *)clistCache[i];
- pdnce->ssSecondLine.DestroySmileyList();
- mir_free_and_nil(pdnce->szSecondLineText);
- pdnce->ssThirdLine.DestroySmileyList();
- mir_free_and_nil(pdnce->szThirdLineText);
- pdnce->ssSecondLine.iMaxSmileyHeight = 0;
- pdnce->ssThirdLine.iMaxSmileyHeight = 0;
- pdnce->hTimeZone = NULL;
- pdnce->dwLastMsgTime = -1;
- Cache_GetTimezone(NULL, pdnce->hContact);
- }
-}
-
int GetStatusForContact(MCONTACT hContact, char *szProto)
{
return (szProto) ? db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE) : ID_STATUS_OFFLINE;
diff --git a/plugins/Clist_modern/src/modern_commonprototypes.h b/plugins/Clist_modern/src/modern_commonprototypes.h
index d28d2f08f5..9d1e0e8515 100644
--- a/plugins/Clist_modern/src/modern_commonprototypes.h
+++ b/plugins/Clist_modern/src/modern_commonprototypes.h
@@ -286,7 +286,6 @@ int cliTrayCalcChanged(const char *szChangedProto, int averageMode, int netProt
ClcContact* cliCreateClcContact(void);
ClcCacheEntry* cliCreateCacheItem(MCONTACT hContact);
-ClcCacheEntry* cliGetCacheEntry(MCONTACT hContact);
#define WM_DWMCOMPOSITIONCHANGED 0x031E
diff --git a/plugins/Clist_modern/src/modern_contact.cpp b/plugins/Clist_modern/src/modern_contact.cpp
index 3b17c800fb..3260689079 100644
--- a/plugins/Clist_modern/src/modern_contact.cpp
+++ b/plugins/Clist_modern/src/modern_contact.cpp
@@ -96,8 +96,8 @@ int cliCompareContacts(const ClcContact *contact1, const ClcContact *contact2)
if ((INT_PTR)contact1 < 100 || (INT_PTR)contact2 < 100)
return 0;
- ClcCacheEntry *c1 = cliGetCacheEntry(contact1->hContact);
- ClcCacheEntry *c2 = cliGetCacheEntry(contact2->hContact);
+ ClcCacheEntry *c1 = pcli->pfnGetCacheEntry(contact1->hContact);
+ ClcCacheEntry *c2 = pcli->pfnGetCacheEntry(contact2->hContact);
for (int i = 0; i < _countof(g_CluiData.bSortByOrder); i++) {
BYTE &by = g_CluiData.bSortByOrder[i];
diff --git a/plugins/Clist_modern/src/modern_viewmodebar.cpp b/plugins/Clist_modern/src/modern_viewmodebar.cpp
index 130129bb4b..a726afc1a6 100644
--- a/plugins/Clist_modern/src/modern_viewmodebar.cpp
+++ b/plugins/Clist_modern/src/modern_viewmodebar.cpp
@@ -1308,15 +1308,6 @@ void ApplyViewMode(const char *Name, bool onlySelector)
g_CluiData.current_viewmode[255] = 0;
if (g_CluiData.filterFlags & CLVM_USELASTMSG) {
- BYTE bSaved = g_CluiData.bSortByOrder[0];
-
- g_CluiData.bSortByOrder[0] = SORTBY_LASTMSG;
- for (int i = 0; i < clistCache.getCount(); i++) {
- ClcCacheEntry *pdnce = clistCache[i];
- pdnce->dwLastMsgTime = CompareContacts2_getLMTime(pdnce->hContact);
- }
- g_CluiData.bSortByOrder[0] = bSaved;
-
g_CluiData.bFilterEffective |= CLVM_FILTER_LASTMSG;
mir_snprintf(szSetting, "%c%s_LM", 246, Name);
g_CluiData.lastMsgFilter = db_get_dw(NULL, CLVM_MODULE, szSetting, 0);
diff --git a/plugins/Clist_modern/src/stdafx.h b/plugins/Clist_modern/src/stdafx.h
index 1ace3cf53d..8382e91ae4 100644
--- a/plugins/Clist_modern/src/stdafx.h
+++ b/plugins/Clist_modern/src/stdafx.h
@@ -175,9 +175,6 @@ void MakeButtonSkinned(HWND hWnd);
#define strsetT(a,b) {if (a) mir_free_and_nill(a); a=mir_tstrdup(b);}
void TRACE_ERROR();
-void IvalidateDisplayNameCache();
-
-extern LIST<ClcCacheEntry> clistCache;
HICON LoadSmallIcon(HINSTANCE hInstance, int idx);
BOOL DestroyIcon_protect(HICON icon);