diff options
author | George Hazan <george.hazan@gmail.com> | 2016-04-22 11:28:05 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2016-04-22 11:28:05 +0000 |
commit | dc7a8b1f54463500d2c13339829db6c665f097da (patch) | |
tree | f93e3f2cbc72687e69bfd18945751a1f08743353 | |
parent | 5212643f256d5cf75b295aeb42783c81ce033519 (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
-rw-r--r-- | include/delphi/m_clist.inc | 7 | ||||
-rw-r--r-- | include/m_clist.h | 6 | ||||
-rw-r--r-- | plugins/Clist_modern/src/init.cpp | 1 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_clcitems.cpp | 33 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_clcutils.cpp | 2 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_clistsettings.cpp | 62 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_commonprototypes.h | 1 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_contact.cpp | 4 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_viewmodebar.cpp | 9 | ||||
-rw-r--r-- | plugins/Clist_modern/src/stdafx.h | 3 | ||||
-rw-r--r-- | plugins/Clist_nicer/src/clc.cpp | 2 | ||||
-rw-r--r-- | plugins/UserInfoEx/src/dlg_propsheet.cpp | 2 | ||||
-rw-r--r-- | src/mir_app/src/clcitems.cpp | 6 | ||||
-rw-r--r-- | src/mir_app/src/clistmod.cpp | 1 | ||||
-rw-r--r-- | src/mir_app/src/clistsettings.cpp | 6 | ||||
-rw-r--r-- | src/mir_app/src/contacts.cpp | 2 |
16 files changed, 22 insertions, 125 deletions
diff --git a/include/delphi/m_clist.inc b/include/delphi/m_clist.inc index d7d94563af..2603919212 100644 --- a/include/delphi/m_clist.inc +++ b/include/delphi/m_clist.inc @@ -94,13 +94,6 @@ const }
ME_CLIST_DOUBLECLICKED:PAnsiChar = 'CList/DoubleClicked';
- {
- Invalidates the display name cache
- wParam=(WPARAM)(HANDLE)hContact
- lParam=not used
- }
- MS_CLIST_INVALIDATEDISPLAYNAME:PAnsiChar = 'CList/InvalidateDiplayName';
-
type
PCLISTEVENT = ^TCLISTEVENT;
TCLISTEVENT = record
diff --git a/include/m_clist.h b/include/m_clist.h index 3d3e8cfbda..b5ae118ca6 100644 --- a/include/m_clist.h +++ b/include/m_clist.h @@ -195,12 +195,6 @@ typedef struct { #define ME_CLIST_DOUBLECLICKED "CList/DoubleClicked"
/////////////////////////////////////////////////////////////////////////////////////////
-// Invalidates the display name cache
-// wParam = (MCONTACT)hContact
-// lParam = not used
-#define MS_CLIST_INVALIDATEDISPLAYNAME "CList/InvalidateDiplayName"
-
-/////////////////////////////////////////////////////////////////////////////////////////
// The contact list will flash hIcon next to the contact hContact (use NULL for
// a system message). szServiceName will be called when the user double clicks
// the icon, at which point the event will be removed from the contact list's
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);
diff --git a/plugins/Clist_nicer/src/clc.cpp b/plugins/Clist_nicer/src/clc.cpp index 18bf3bb33f..8de01f2815 100644 --- a/plugins/Clist_nicer/src/clc.cpp +++ b/plugins/Clist_nicer/src/clc.cpp @@ -489,7 +489,7 @@ LBL_Def: break;
contact->proto = GetContactProto(wParam);
- CallService(MS_CLIST_INVALIDATEDISPLAYNAME, wParam, 0);
+ pcli->pfnInvalidateDisplayNameCacheEntry(wParam);
mir_tstrncpy(contact->szText, pcli->pfnGetContactDisplayName(wParam, 0), _countof(contact->szText));
RTL_DetectAndSet(contact, 0);
diff --git a/plugins/UserInfoEx/src/dlg_propsheet.cpp b/plugins/UserInfoEx/src/dlg_propsheet.cpp index ad2bb1ada9..148d7dad7f 100644 --- a/plugins/UserInfoEx/src/dlg_propsheet.cpp +++ b/plugins/UserInfoEx/src/dlg_propsheet.cpp @@ -1521,7 +1521,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar pPs->dwFlags &= ~PSF_CHANGED;
EnableWindow(GetDlgItem(hDlg, IDAPPLY), FALSE);
- CallService(MS_CLIST_INVALIDATEDISPLAYNAME, (WPARAM)pPs->hContact, NULL);
+ pcli->pfnInvalidateDisplayNameCacheEntry(pPs->hContact);
// need to upload owners settings
if (!pPs->hContact && myGlobals.CanChangeDetails && db_get_b(NULL, MODNAME, SET_PROPSHEET_CHANGEMYDETAILS, FALSE)) {
diff --git a/src/mir_app/src/clcitems.cpp b/src/mir_app/src/clcitems.cpp index 15b9f41bfc..7a3c203e8b 100644 --- a/src/mir_app/src/clcitems.cpp +++ b/src/mir_app/src/clcitems.cpp @@ -313,11 +313,11 @@ ClcGroup* fnRemoveItemFromGroup(HWND hwnd, ClcGroup *group, ClcContact *contact, void fnDeleteItemFromTree(HWND hwnd, MCONTACT hItem) { - ClcContact *contact; - ClcGroup *group; struct ClcData *dat = (struct ClcData *) GetWindowLongPtr(hwnd, 0); - dat->needsResort = 1; + + ClcGroup *group; + ClcContact *contact; if (!cli.pfnFindItem(hwnd, dat, hItem, &contact, &group, NULL)) { DBVARIANT dbv; int i, nameOffset; diff --git a/src/mir_app/src/clistmod.cpp b/src/mir_app/src/clistmod.cpp index 6ccdeb7e14..758e34075a 100644 --- a/src/mir_app/src/clistmod.cpp +++ b/src/mir_app/src/clistmod.cpp @@ -431,7 +431,6 @@ int LoadContactListModule2(void) CreateServiceFunction(MS_CLIST_CONTACTDOUBLECLICKED, ContactDoubleClicked);
CreateServiceFunction(MS_CLIST_CONTACTFILESDROPPED, ContactFilesDropped);
- CreateServiceFunction(MS_CLIST_INVALIDATEDISPLAYNAME, InvalidateDisplayName);
CreateServiceFunction(MS_CLIST_CONTACTSCOMPARE, CompareContacts);
CreateServiceFunction(MS_CLIST_CONTACTCHANGEGROUP, ContactChangeGroup);
CreateServiceFunction(MS_CLIST_SHOWHIDE, ShowHideStub);
diff --git a/src/mir_app/src/clistsettings.cpp b/src/mir_app/src/clistsettings.cpp index 390e4d5f38..55aa9ec808 100644 --- a/src/mir_app/src/clistsettings.cpp +++ b/src/mir_app/src/clistsettings.cpp @@ -137,12 +137,6 @@ TCHAR* fnGetContactDisplayName(MCONTACT hContact, int mode) return (cacheEntry == NULL) ? mir_tstrdup(buffer) : buffer;
}
-INT_PTR InvalidateDisplayName(WPARAM wParam, LPARAM)
-{
- cli.pfnInvalidateDisplayNameCacheEntry(wParam);
- return 0;
-}
-
int ContactAdded(WPARAM wParam, LPARAM)
{
cli.pfnChangeContactIcon(wParam, cli.pfnIconFromStatusMode(GetContactProto(wParam), ID_STATUS_OFFLINE, NULL));
diff --git a/src/mir_app/src/contacts.cpp b/src/mir_app/src/contacts.cpp index 1160dcca60..652cde3a4c 100644 --- a/src/mir_app/src/contacts.cpp +++ b/src/mir_app/src/contacts.cpp @@ -412,7 +412,7 @@ public: tvi.hItem = m_nameOrder.GetNextSibling(tvi.hItem);
}
db_set_blob(NULL, "Contact", "NameOrder", nameOrder, _countof(nameOrderDescr));
- CallService(MS_CLIST_INVALIDATEDISPLAYNAME, (WPARAM)INVALID_HANDLE_VALUE, 0);
+ cli.pfnInvalidateDisplayNameCacheEntry(INVALID_CONTACT_ID);
}
void OnBeginDrag(CCtrlTreeView::TEventInfo *evt)
|