From 6a8ea9b06515655f35a7e6998813eb69c80b8010 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 6 Apr 2018 18:14:12 +0300 Subject: CLIST_INTERFACE::pfnGetCacheEntry => Clist_GetCacheEntry --- src/mir_app/src/clc.h | 5 +++-- src/mir_app/src/clcitems.cpp | 6 +++--- src/mir_app/src/clistcore.cpp | 3 --- src/mir_app/src/clistevents.cpp | 4 ++-- src/mir_app/src/clistgroups.cpp | 2 +- src/mir_app/src/clistmod.cpp | 2 +- src/mir_app/src/clistsettings.cpp | 10 +++++----- src/mir_app/src/clisttray.cpp | 2 +- src/mir_app/src/clui.cpp | 2 +- src/mir_app/src/keyboard.cpp | 4 +++- src/mir_app/src/mir_app.def | 1 + src/mir_app/src/mir_app64.def | 1 + 12 files changed, 22 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/mir_app/src/clc.h b/src/mir_app/src/clc.h index 29530ba84a..4b1f11877f 100644 --- a/src/mir_app/src/clc.h +++ b/src/mir_app/src/clc.h @@ -133,11 +133,12 @@ void fnUnregisterFileDropping(HWND hwnd); struct CListEvent* fnAddEvent(CLISTEVENT *cle); CLISTEVENT* fnGetEvent(MCONTACT hContact, int idx); -int fnEventsProcessContactDoubleClick(MCONTACT hContact); -int fnEventsProcessTrayDoubleClick(int); int fnGetImlIconIndex(HICON hIcon); int fnRemoveEvent(MCONTACT hContact, MEVENT dbEvent); +int EventsProcessContactDoubleClick(MCONTACT hContact); +int EventsProcessTrayDoubleClick(int); + /* clistmod.c */ int fnIconFromStatusMode(const char *szProto, int status, MCONTACT hContact); int fnShowHide(void); diff --git a/src/mir_app/src/clcitems.cpp b/src/mir_app/src/clcitems.cpp index cc521205d4..beb352ea49 100644 --- a/src/mir_app/src/clcitems.cpp +++ b/src/mir_app/src/clcitems.cpp @@ -106,7 +106,7 @@ ClcGroup* fnAddGroup(HWND hwnd, ClcData *dat, const wchar_t *szName, DWORD flags if (flags != (DWORD)-1 && pNextField == nullptr && calcTotalMembers) { DWORD style = GetWindowLongPtr(hwnd, GWL_STYLE); for (auto &hContact : Contacts()) { - ClcCacheEntry *cache = cli.pfnGetCacheEntry(hContact); + ClcCacheEntry *cache = Clist_GetCacheEntry(hContact); if (!mir_wstrcmp(cache->tszGroup, szName) && (style & CLS_SHOWHIDDEN || !cache->bIsHidden)) group->totalMembers++; } @@ -181,7 +181,7 @@ ClcContact* fnAddContactToGroup(ClcData *dat, ClcGroup *group, MCONTACT hContact char *szProto = GetContactProto(hContact); - ClcCacheEntry *pce = cli.pfnGetCacheEntry(hContact); + ClcCacheEntry *pce = Clist_GetCacheEntry(hContact); replaceStrW(pce->tszGroup, nullptr); ClcContact *cc = cli.pfnAddItemToGroup(group, index + 1); @@ -362,7 +362,7 @@ void fnRebuildEntireList(HWND hwnd, ClcData *dat) for (auto &hContact : Contacts()) { int nHiddenStatus = cli.pfnGetContactHiddenStatus(hContact, nullptr, dat); if (((style & CLS_SHOWHIDDEN) && nHiddenStatus != -1) || !nHiddenStatus) { - ClcCacheEntry *pce = cli.pfnGetCacheEntry(hContact); + ClcCacheEntry *pce = Clist_GetCacheEntry(hContact); if (pce->szProto == nullptr) continue; diff --git a/src/mir_app/src/clistcore.cpp b/src/mir_app/src/clistcore.cpp index 5a58f6e157..4d846c0ece 100644 --- a/src/mir_app/src/clistcore.cpp +++ b/src/mir_app/src/clistcore.cpp @@ -124,8 +124,6 @@ void InitClistCore() cli.pfnRowHitTest = fnRowHitTest; cli.pfnAddEvent = fnAddEvent; - cli.pfnEventsProcessContactDoubleClick = fnEventsProcessContactDoubleClick; - cli.pfnEventsProcessTrayDoubleClick = fnEventsProcessTrayDoubleClick; cli.pfnGetEvent = fnGetEvent; cli.pfnGetImlIconIndex = fnGetImlIconIndex; cli.pfnRemoveEvent = fnRemoveEvent; @@ -134,7 +132,6 @@ void InitClistCore() cli.pfnCreateCacheItem = fnCreateCacheItem; cli.pfnCheckCacheItem = fnCheckCacheItem; cli.pfnFreeCacheItem = fnFreeCacheItem; - cli.pfnGetCacheEntry = fnGetCacheEntry; cli.szTip = szTip; diff --git a/src/mir_app/src/clistevents.cpp b/src/mir_app/src/clistevents.cpp index fff355e70f..0bd3951cc9 100644 --- a/src/mir_app/src/clistevents.cpp +++ b/src/mir_app/src/clistevents.cpp @@ -263,7 +263,7 @@ CLISTEVENT* fnGetEvent(MCONTACT hContact, int idx) return nullptr; } -int fnEventsProcessContactDoubleClick(MCONTACT hContact) +int EventsProcessContactDoubleClick(MCONTACT hContact) { for (auto &it : g_cliEvents) { if (it->hContact == hContact) { @@ -277,7 +277,7 @@ int fnEventsProcessContactDoubleClick(MCONTACT hContact) return 1; } -int fnEventsProcessTrayDoubleClick(int index) +int EventsProcessTrayDoubleClick(int index) { BOOL click_in_first_icon = FALSE; if (g_cliEvents.getCount() == 0) diff --git a/src/mir_app/src/clistgroups.cpp b/src/mir_app/src/clistgroups.cpp index 65c2010e2e..1474f15630 100644 --- a/src/mir_app/src/clistgroups.cpp +++ b/src/mir_app/src/clistgroups.cpp @@ -343,7 +343,7 @@ static int RenameGroupWithMove(int groupId, const wchar_t *szName, int move) // must rename setting in all child contacts too for (auto &hContact : Contacts()) { - ClcCacheEntry *cache = cli.pfnGetCacheEntry(hContact); + ClcCacheEntry *cache = Clist_GetCacheEntry(hContact); if (!mir_wstrcmp(cache->tszGroup, oldName)) { db_set_ws(hContact, "CList", "Group", szName); replaceStrW(cache->tszGroup, szName); diff --git a/src/mir_app/src/clistmod.cpp b/src/mir_app/src/clistmod.cpp index b9bb9727f9..683c99e108 100644 --- a/src/mir_app/src/clistmod.cpp +++ b/src/mir_app/src/clistmod.cpp @@ -223,7 +223,7 @@ static int ContactListAccountsChanged(WPARAM eventCode, LPARAM lParam) MIR_APP_DLL(void) Clist_ContactDoubleClicked(MCONTACT hContact) { // Try to process event myself - if (cli.pfnEventsProcessContactDoubleClick(hContact) == 0) + if (EventsProcessContactDoubleClick(hContact) == 0) return; // Allow third-party plugins to process a dblclick diff --git a/src/mir_app/src/clistsettings.cpp b/src/mir_app/src/clistsettings.cpp index 105f06fd91..ef7dc74b7b 100644 --- a/src/mir_app/src/clistsettings.cpp +++ b/src/mir_app/src/clistsettings.cpp @@ -72,7 +72,7 @@ void fnFreeCacheItem(ClcCacheEntry *p) p->bIsHidden = -1; } -ClcCacheEntry* fnGetCacheEntry(MCONTACT hContact) +MIR_APP_DLL(ClcCacheEntry*) Clist_GetCacheEntry(MCONTACT hContact) { ClcCacheEntry *p; int idx = clistCache.getIndex((ClcCacheEntry*)&hContact); @@ -112,7 +112,7 @@ MIR_APP_DLL(wchar_t*) Clist_GetContactDisplayName(MCONTACT hContact, int mode) if (mode & GCDNF_NOCACHE) mode &= ~GCDNF_NOCACHE; else if (mode != GCDNF_NOMYHANDLE) { - cacheEntry = cli.pfnGetCacheEntry(hContact); + cacheEntry = Clist_GetCacheEntry(hContact); if (cacheEntry && cacheEntry->tszName) return cacheEntry->tszName; } @@ -191,7 +191,7 @@ int ContactSettingChanged(WPARAM hContact, LPARAM lParam) char *szProto = GetContactProto(hContact); if (!mir_strcmp(cws->szModule, szProto)) { if (!strcmp(cws->szSetting, "UIN") || !strcmp(cws->szSetting, "Nick") || !strcmp(cws->szSetting, "FirstName") || !strcmp(cws->szSetting, "LastName") || !strcmp(cws->szSetting, "e-mail")) { - ClcCacheEntry *pdnce = cli.pfnGetCacheEntry(hContact); + ClcCacheEntry *pdnce = Clist_GetCacheEntry(hContact); replaceStrW(pdnce->tszName, nullptr); cli.pfnCheckCacheItem(pdnce); } @@ -206,12 +206,12 @@ int ContactSettingChanged(WPARAM hContact, LPARAM lParam) Clist_ChangeContactIcon(hContact, cli.pfnIconFromStatusMode(szProto, szProto == nullptr ? ID_STATUS_OFFLINE : db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE), hContact)); } else if (!strcmp(cws->szSetting, "MyHandle")) { - ClcCacheEntry *pdnce = cli.pfnGetCacheEntry(hContact); + ClcCacheEntry *pdnce = Clist_GetCacheEntry(hContact); replaceStrW(pdnce->tszName, nullptr); cli.pfnCheckCacheItem(pdnce); } else if (!strcmp(cws->szSetting, "Group")) { - ClcCacheEntry *pdnce = cli.pfnGetCacheEntry(hContact); + ClcCacheEntry *pdnce = Clist_GetCacheEntry(hContact); Dbwcs2tstr(cws, pdnce->tszGroup); } } diff --git a/src/mir_app/src/clisttray.cpp b/src/mir_app/src/clisttray.cpp index c57c684a1d..72ad947983 100644 --- a/src/mir_app/src/clisttray.cpp +++ b/src/mir_app/src/clisttray.cpp @@ -711,7 +711,7 @@ INT_PTR fnTrayIconProcessMessage(WPARAM wParam, LPARAM lParam) GetCursorPos(&pt); TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_LEFTBUTTON, pt.x, pt.y, 0, msg->hwnd, nullptr); } - else if (cli.pfnEventsProcessTrayDoubleClick(msg->wParam)) + else if (EventsProcessTrayDoubleClick(msg->wParam)) cli.pfnShowHide(); } else if (msg->lParam == WM_RBUTTONUP) { diff --git a/src/mir_app/src/clui.cpp b/src/mir_app/src/clui.cpp index 77e539c784..2295c2b198 100644 --- a/src/mir_app/src/clui.cpp +++ b/src/mir_app/src/clui.cpp @@ -832,7 +832,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM if (hItem) { if (hitFlags & CLCHT_ONITEMEXTRA) { if (!IsHContactGroup((UINT_PTR)hItem) && !IsHContactInfo((UINT_PTR)hItem)) - if (cli.pfnGetCacheEntry((UINT_PTR)nmc->hItem)) + if (Clist_GetCacheEntry((UINT_PTR)nmc->hItem)) NotifyEventHooks(hEventExtraClick, (WPARAM)nmc->hItem, nmc->iColumn + 1); } break; diff --git a/src/mir_app/src/keyboard.cpp b/src/mir_app/src/keyboard.cpp index 0c805443d8..5c5c47a9b1 100644 --- a/src/mir_app/src/keyboard.cpp +++ b/src/mir_app/src/keyboard.cpp @@ -34,7 +34,9 @@ static INT_PTR hkHideShow(WPARAM, LPARAM) static INT_PTR hkRead(WPARAM, LPARAM) { - if (cli.pfnEventsProcessTrayDoubleClick(0) == 0) return TRUE; + if (EventsProcessTrayDoubleClick(0) == 0) + return true; + SetForegroundWindow(cli.hwndContactList); SetFocus(cli.hwndContactList); return 0; diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index ce81e5405c..d6d6715df8 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -555,3 +555,4 @@ Clist_TrayIconDestroy @574 Clist_TrayIconAdd @575 Clist_TraySetTimer @576 Clist_GetContactDisplayName @577 +Clist_GetCacheEntry @578 diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index a46b4aa1e0..f1ffdd88ea 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -555,3 +555,4 @@ Clist_TrayIconDestroy @574 Clist_TrayIconAdd @575 Clist_TraySetTimer @576 Clist_GetContactDisplayName @577 +Clist_GetCacheEntry @578 -- cgit v1.2.3