From 869094d2aabef8ab10a1178907cb31ae84f504f9 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 22 May 2018 16:28:18 +0300 Subject: IcoLib_AddIcon => CMPlugin::addIcon --- include/m_icolib.h | 2 +- include/newpluginapi.h | 2 ++ libs/win32/mir_app.lib | Bin 164768 -> 165134 bytes libs/win64/mir_app.lib | Bin 159848 -> 160228 bytes plugins/CSList/src/cslist.cpp | 2 +- plugins/ClientChangeNotify/src/stdafx.h | 1 + plugins/Clist_modern/src/modern_clc.cpp | 6 +++--- plugins/Clist_modern/src/modern_clui.cpp | 2 +- plugins/CountryFlags/src/icons.cpp | 2 +- plugins/FingerprintNG/src/fingerprint.cpp | 2 +- plugins/HistoryStats/src/mu_common.cpp | 2 +- plugins/QuickMessages/src/Utils.cpp | 2 +- plugins/SecureIM/src/loadicons.cpp | 2 +- plugins/SpellChecker/src/spellchecker.cpp | 2 +- plugins/TabSRMM/src/msgs.cpp | 14 +++++++------- plugins/TopToolBar/src/toolbar.cpp | 2 +- plugins/UserInfoEx/src/Flags/svc_flagsicons.cpp | 2 +- plugins/UserInfoEx/src/classPsTreeItem.cpp | 2 +- plugins/UserInfoEx/src/mir_icolib.cpp | 2 +- plugins/WhenWasIt/src/icons.cpp | 2 +- protocols/IcqOscarJ/src/icq_xstatus.cpp | 2 +- protocols/JabberG/src/jabber_icolib.cpp | 4 ++-- protocols/MRA/src/MraIcons.cpp | 2 +- protocols/Steam/src/steam_proto.cpp | 4 ++-- src/mir_app/src/CMPluginBase.cpp | 5 +++++ src/mir_app/src/mir_app.def | 1 + src/mir_app/src/mir_app64.def | 1 + 27 files changed, 40 insertions(+), 30 deletions(-) diff --git a/include/m_icolib.h b/include/m_icolib.h index d06160ffcd..3e8bdef226 100644 --- a/include/m_icolib.h +++ b/include/m_icolib.h @@ -60,7 +60,7 @@ extern "C" // Adds an icon into the icon library // returns a handle to the newly added item -MIR_APP_DLL(HANDLE) IcoLib_AddIcon(SKINICONDESC *sid, int _lang = hLangpack); +MIR_APP_DLL(HANDLE) IcoLib_AddIcon(SKINICONDESC *sid, int langId); /////////////////////////////////////////////////////////////////////////////// // Removes an icon from icon library by icon's name or handle diff --git a/include/newpluginapi.h b/include/newpluginapi.h index 585adaa27e..3e8f2d6993 100644 --- a/include/newpluginapi.h +++ b/include/newpluginapi.h @@ -199,6 +199,8 @@ public: void openOptions(const wchar_t *pszGroup, const wchar_t *pszPage = 0, const wchar_t *pszTab = 0); void openOptionsPage(const wchar_t *pszGroup, const wchar_t *pszPage = 0, const wchar_t *pszTab = 0); + HANDLE addIcon(struct SKINICONDESC*); + int addSound(const char *name, const wchar_t *section, const wchar_t *description, const wchar_t *defaultFile = nullptr); int addUserInfo(WPARAM wParam, struct OPTIONSDIALOGPAGE *odp); diff --git a/libs/win32/mir_app.lib b/libs/win32/mir_app.lib index 65b4dd78f9..e6a8f5d1bc 100644 Binary files a/libs/win32/mir_app.lib and b/libs/win32/mir_app.lib differ diff --git a/libs/win64/mir_app.lib b/libs/win64/mir_app.lib index 07a48a5396..b224143391 100644 Binary files a/libs/win64/mir_app.lib and b/libs/win64/mir_app.lib differ diff --git a/plugins/CSList/src/cslist.cpp b/plugins/CSList/src/cslist.cpp index 657f36374b..5182886fde 100644 --- a/plugins/CSList/src/cslist.cpp +++ b/plugins/CSList/src/cslist.cpp @@ -129,7 +129,7 @@ extern "C" __declspec(dllexport) int Load() sid.pszName = szSettingName; sid.description.w = forms[i].ptszDescr; sid.iDefaultIndex = -forms[i].iconNoIcoLib; - forms[i].hIcoLibItem = IcoLib_AddIcon(&sid); + forms[i].hIcoLibItem = g_plugin.addIcon(&sid); } HookEvent(ME_OPT_INITIALISE, OnInitOptions); diff --git a/plugins/ClientChangeNotify/src/stdafx.h b/plugins/ClientChangeNotify/src/stdafx.h index f02330f144..6032939f7f 100644 --- a/plugins/ClientChangeNotify/src/stdafx.h +++ b/plugins/ClientChangeNotify/src/stdafx.h @@ -52,6 +52,7 @@ #include "m_fingerprint.h" +struct CMPlugin : public PLUGIN { CMPlugin(); }; diff --git a/plugins/Clist_modern/src/modern_clc.cpp b/plugins/Clist_modern/src/modern_clc.cpp index 32b5503318..e980177c96 100644 --- a/plugins/Clist_modern/src/modern_clc.cpp +++ b/plugins/Clist_modern/src/modern_clc.cpp @@ -1573,14 +1573,14 @@ static int clcHookModulesLoaded(WPARAM, LPARAM) sid.description.a = LPGEN("Listening to"); sid.pszName = "LISTENING_TO_ICON"; sid.iDefaultIndex = -IDI_LISTENING_TO; - IcoLib_AddIcon(&sid); + g_plugin.addIcon(&sid); sid.section.a = LPGEN("Contact list") "/" LPGEN("Avatar overlay"); for (auto &it : g_pAvatarOverlayIcons) { sid.description.a = it.description; sid.pszName = it.name; sid.iDefaultIndex = -it.id; - IcoLib_AddIcon(&sid); + g_plugin.addIcon(&sid); } sid.section.a = LPGEN("Contact list") "/" LPGEN("Status overlay"); @@ -1588,7 +1588,7 @@ static int clcHookModulesLoaded(WPARAM, LPARAM) sid.description.a = it.description; sid.pszName = it.name; sid.iDefaultIndex = -it.id; - IcoLib_AddIcon(&sid); + g_plugin.addIcon(&sid); } clcHookIconsChanged(0, 0); diff --git a/plugins/Clist_modern/src/modern_clui.cpp b/plugins/Clist_modern/src/modern_clui.cpp index 08e19d6521..a64770f200 100644 --- a/plugins/Clist_modern/src/modern_clui.cpp +++ b/plugins/Clist_modern/src/modern_clui.cpp @@ -1516,7 +1516,7 @@ HANDLE RegisterIcolibIconHandle(char *szIcoID, char *szSectionName, char *szDesc sid.iDefaultIndex = -iDefaultResource; } - return IcoLib_AddIcon(&sid); + return g_plugin.addIcon(&sid); } // MAIN WINPROC MESSAGE HANDLERS diff --git a/plugins/CountryFlags/src/icons.cpp b/plugins/CountryFlags/src/icons.cpp index c295ddebb1..53e94b5d5e 100644 --- a/plugins/CountryFlags/src/icons.cpp +++ b/plugins/CountryFlags/src/icons.cpp @@ -254,7 +254,7 @@ void InitIcons(void) } else sid.hDefaultIcon = nullptr; index = CountryNumberToIndex(countries[i].id); - phIconHandles[index] = IcoLib_AddIcon(&sid); + phIconHandles[index] = g_plugin.addIcon(&sid); if (sid.hDefaultIcon != nullptr) DestroyIcon(sid.hDefaultIcon); } diff --git a/plugins/FingerprintNG/src/fingerprint.cpp b/plugins/FingerprintNG/src/fingerprint.cpp index 35227e54e3..74bc1332dd 100644 --- a/plugins/FingerprintNG/src/fingerprint.cpp +++ b/plugins/FingerprintNG/src/fingerprint.cpp @@ -85,7 +85,7 @@ void __fastcall Prepare(KN_FP_MASK* mask, bool bEnable) sid.description.w = mask->szClientDescription; sid.defaultFile.w = destfile; sid.iDefaultIndex = -mask->iIconIndex; - mask->hIcolibItem = IcoLib_AddIcon(&sid); + mask->hIcolibItem = g_plugin.addIcon(&sid); } /* diff --git a/plugins/HistoryStats/src/mu_common.cpp b/plugins/HistoryStats/src/mu_common.cpp index de199bd0df..4df8bede52 100644 --- a/plugins/HistoryStats/src/mu_common.cpp +++ b/plugins/HistoryStats/src/mu_common.cpp @@ -63,7 +63,7 @@ namespace mu sid.defaultFile.a = const_cast(szDefaultFile); sid.iDefaultIndex = iDefaultIndex; sid.flags = SIDF_UNICODE; - IcoLib_AddIcon(&sid); + g_plugin.addIcon(&sid); } HICON getIcon(const char* szIconName) diff --git a/plugins/QuickMessages/src/Utils.cpp b/plugins/QuickMessages/src/Utils.cpp index 148dae525a..618f8ba92f 100644 --- a/plugins/QuickMessages/src/Utils.cpp +++ b/plugins/QuickMessages/src/Utils.cpp @@ -234,7 +234,7 @@ static HANDLE AddIcon(char* szIcoName) sid.pszName = szIcoName; sid.defaultFile.w = tszPath; sid.iDefaultIndex = -IDI_QICON; - return IcoLib_AddIcon(&sid); + return g_plugin.addIcon(&sid); } DWORD BalanceButtons(int buttonsWas, int buttonsNow) diff --git a/plugins/SecureIM/src/loadicons.cpp b/plugins/SecureIM/src/loadicons.cpp index 7614b3a630..5140dc7754 100644 --- a/plugins/SecureIM/src/loadicons.cpp +++ b/plugins/SecureIM/src/loadicons.cpp @@ -105,7 +105,7 @@ void InitIcons(void) sid.pszName = icons[i].name; sid.description.a = icons[i].text; sid.iDefaultIndex = -icons[i].key; - HANDLE hIcolib = IcoLib_AddIcon(&sid); + HANDLE hIcolib = g_plugin.addIcon(&sid); HICON hIcon = IcoLib_GetIconByHandle(hIcolib); if (icons[i].tbl == TBL_IEC) diff --git a/plugins/SpellChecker/src/spellchecker.cpp b/plugins/SpellChecker/src/spellchecker.cpp index de9b3582bd..3d2325641e 100644 --- a/plugins/SpellChecker/src/spellchecker.cpp +++ b/plugins/SpellChecker/src/spellchecker.cpp @@ -168,7 +168,7 @@ static int ModulesLoaded(WPARAM, LPARAM) } // Oki, lets add to IcoLib, then - p->hIcolib = IcoLib_AddIcon(&sid); + p->hIcolib = g_plugin.addIcon(&sid); if (hFlag != nullptr) DestroyIcon(hFlag); diff --git a/plugins/TabSRMM/src/msgs.cpp b/plugins/TabSRMM/src/msgs.cpp index 270e04113a..083b648062 100644 --- a/plugins/TabSRMM/src/msgs.cpp +++ b/plugins/TabSRMM/src/msgs.cpp @@ -897,9 +897,9 @@ static int TSAPI SetupIconLibConfig() sid.iDefaultIndex = it.idesc[i].uId == -IDI_HISTORY ? 0 : it.idesc[i].uId; // workaround problem /w icoLib and a resource id of 1 (actually, a Windows problem) if (n > 0 && n < 4) - PluginConfig.g_buttonBarIconHandles[j++] = IcoLib_AddIcon(&sid); + PluginConfig.g_buttonBarIconHandles[j++] = g_plugin.addIcon(&sid); else - IcoLib_AddIcon(&sid); + g_plugin.addIcon(&sid); } } @@ -907,30 +907,30 @@ static int TSAPI SetupIconLibConfig() sid.pszName = "tabSRMM_clock_symbol"; sid.description.a = LPGEN("Clock symbol (for the info panel clock)"); sid.iDefaultIndex = -IDI_CLOCK; - IcoLib_AddIcon(&sid); + g_plugin.addIcon(&sid); wcsncpy(szFilename, L"plugins\\tabsrmm.dll", MAX_PATH); sid.pszName = "tabSRMM_overlay_disabled"; sid.description.a = LPGEN("Feature disabled (used as overlay)"); sid.iDefaultIndex = -IDI_FEATURE_DISABLED; - IcoLib_AddIcon(&sid); + g_plugin.addIcon(&sid); sid.pszName = "tabSRMM_overlay_enabled"; sid.description.a = LPGEN("Feature enabled (used as overlay)"); sid.iDefaultIndex = -IDI_FEATURE_ENABLED; - IcoLib_AddIcon(&sid); + g_plugin.addIcon(&sid); sid.section.a = LPGEN("Message Sessions") "/" LPGEN("Popups"); sid.pszName = "tabSRMM_popups_disabled"; sid.description.a = LPGEN("Enable typing notification"); sid.iDefaultIndex = -IDI_DISABLED; - IcoLib_AddIcon(&sid); + g_plugin.addIcon(&sid); sid.pszName = "tabSRMM_popups_enabled"; sid.description.a = LPGEN("Disable typing notification"); sid.iDefaultIndex = -IDI_ENABLED; - IcoLib_AddIcon(&sid); + g_plugin.addIcon(&sid); return 1; } diff --git a/plugins/TopToolBar/src/toolbar.cpp b/plugins/TopToolBar/src/toolbar.cpp index a3fbea4ad6..5fab8accab 100644 --- a/plugins/TopToolBar/src/toolbar.cpp +++ b/plugins/TopToolBar/src/toolbar.cpp @@ -163,7 +163,7 @@ static void Icon2button(TTBButton *but, HANDLE &hIcoLib, HICON &hIcon, bool bIsU mir_snprintf(buf, "%s%s", but->name, bIsUp ? "" : " (pressed)"); sid.description.a = buf; sid.hDefaultIcon = bIsUp ? but->hIconUp : but->hIconDn; - hIcoLib = IcoLib_AddIcon(&sid); + hIcoLib = g_plugin.addIcon(&sid); } hIcon = IcoLib_GetIconByHandle(hIcoLib); diff --git a/plugins/UserInfoEx/src/Flags/svc_flagsicons.cpp b/plugins/UserInfoEx/src/Flags/svc_flagsicons.cpp index 751d6f8d19..405f2a6f07 100644 --- a/plugins/UserInfoEx/src/Flags/svc_flagsicons.cpp +++ b/plugins/UserInfoEx/src/Flags/svc_flagsicons.cpp @@ -355,7 +355,7 @@ void InitIcons() sid.hDefaultIcon = ImageList_ExtractIcon(NULL, himl, index); index = CountryNumberToIndex(countries[i].id); - phIconHandles[index] = IcoLib_AddIcon(&sid); + phIconHandles[index] = g_plugin.addIcon(&sid); if (sid.hDefaultIcon != nullptr) DestroyIcon(sid.hDefaultIcon); mir_free(sid.description.w); sid.description.w = nullptr; diff --git a/plugins/UserInfoEx/src/classPsTreeItem.cpp b/plugins/UserInfoEx/src/classPsTreeItem.cpp index 5a40b27b19..2645b3f8d7 100644 --- a/plugins/UserInfoEx/src/classPsTreeItem.cpp +++ b/plugins/UserInfoEx/src/classPsTreeItem.cpp @@ -351,7 +351,7 @@ int CPsTreeItem::Icon(HIMAGELIST hIml, OPTIONSDIALOGPAGE *odp, BYTE bInitIconsOn sid.hDefaultIcon = ImageList_GetIcon(hIml, 0, ILD_NORMAL), bNeedFree = true; } // add file to icolib - IcoLib_AddIcon(&sid); + g_plugin.addIcon(&sid); if (!bInitIconsOnly) hIcon = IcoLib_GetIcon(pszIconName); diff --git a/plugins/UserInfoEx/src/mir_icolib.cpp b/plugins/UserInfoEx/src/mir_icolib.cpp index 998fb45807..dea1d2d8f8 100644 --- a/plugins/UserInfoEx/src/mir_icolib.cpp +++ b/plugins/UserInfoEx/src/mir_icolib.cpp @@ -260,7 +260,7 @@ static HANDLE IcoLib_RegisterIconHandleEx(LPSTR szIconID, LPSTR szDescription, L sid.hDefaultIcon = hDefIcon; sid.iDefaultIndex = -1; } - hIconHandle = IcoLib_AddIcon(&sid); + hIconHandle = g_plugin.addIcon(&sid); } MIR_FREE(sid.description.w); MIR_FREE(sid.section.w); diff --git a/plugins/WhenWasIt/src/icons.cpp b/plugins/WhenWasIt/src/icons.cpp index 5b2092ced6..72d4b83de2 100644 --- a/plugins/WhenWasIt/src/icons.cpp +++ b/plugins/WhenWasIt/src/icons.cpp @@ -38,7 +38,7 @@ static HANDLE AddIcon(char *name, char *description, wchar_t *tszPath, int iDefa sid.pszName = name; sid.defaultFile.w = tszPath; sid.iDefaultIndex = -iDefaultIdx; - return IcoLib_AddIcon(&sid); + return g_plugin.addIcon(&sid); } int AddIcons() diff --git a/protocols/IcqOscarJ/src/icq_xstatus.cpp b/protocols/IcqOscarJ/src/icq_xstatus.cpp index 2e0dba715b..06e986c238 100644 --- a/protocols/IcqOscarJ/src/icq_xstatus.cpp +++ b/protocols/IcqOscarJ/src/icq_xstatus.cpp @@ -902,7 +902,7 @@ void InitXStatusIcons() sid.pszName = szTemp; sid.description.a = (LPSTR)nameXStatus[i]; sid.iDefaultIndex = -(IDI_XSTATUS1 + i); - hXStatusIcons[i] = IcoLib_AddIcon(&sid); + hXStatusIcons[i] = g_plugin.addIcon(&sid); } // initialize arrays for CList custom status icons diff --git a/protocols/JabberG/src/jabber_icolib.cpp b/protocols/JabberG/src/jabber_icolib.cpp index 62ed6e151e..b4b07af1d3 100644 --- a/protocols/JabberG/src/jabber_icolib.cpp +++ b/protocols/JabberG/src/jabber_icolib.cpp @@ -126,7 +126,7 @@ void CIconPool::RegisterIcon(const char *name, wchar_t *filename, int iconid, wc sid.description.w = szDescription; sid.flags = SIDF_ALL_UNICODE; sid.iDefaultIndex = iconid; - item->m_hIcolibItem = IcoLib_AddIcon(&sid); + item->m_hIcolibItem = IcoLib_AddIcon(&sid, g_plugin.m_hLang); m_items.insert(item); } @@ -293,7 +293,7 @@ static HICON LoadTransportIcon(char *filename, int i, char *IconName, wchar_t *S sid.defaultFile.a = szMyPath; sid.iDefaultIndex = i; sid.flags = SIDF_UNICODE; - IcoLib_AddIcon(&sid); + g_plugin.addIcon(&sid); } return IcoLib_GetIcon(IconName); } diff --git a/protocols/MRA/src/MraIcons.cpp b/protocols/MRA/src/MraIcons.cpp index 7acdd7e366..7569b3fe53 100644 --- a/protocols/MRA/src/MraIcons.cpp +++ b/protocols/MRA/src/MraIcons.cpp @@ -128,7 +128,7 @@ void InitXStatusIcons() sid.description.w = (wchar_t*)lpcszXStatusNameDef[i]; sid.iDefaultIndex = -iCurIndex; - hXStatusAdvancedStatusIcons[i] = IcoLib_AddIcon(&sid); + hXStatusAdvancedStatusIcons[i] = g_plugin.addIcon(&sid); } } diff --git a/protocols/Steam/src/steam_proto.cpp b/protocols/Steam/src/steam_proto.cpp index 43657ce5ad..e1e115af3f 100644 --- a/protocols/Steam/src/steam_proto.cpp +++ b/protocols/Steam/src/steam_proto.cpp @@ -34,12 +34,12 @@ CSteamProto::CSteamProto(const char* protoName, const wchar_t* userName) sid.section.w = sectionName; sid.description.w = LPGENW("Protocol icon"); sid.iDefaultIndex = -IDI_STEAM; - IcoLib_AddIcon(&sid); + g_plugin.addIcon(&sid); mir_snprintf(settingName, "%s_%s", MODULE, "gaming"); sid.description.w = LPGENW("Gaming icon"); sid.iDefaultIndex = -IDI_GAMING; - IcoLib_AddIcon(&sid); + g_plugin.addIcon(&sid); // temporary DB settings db_set_resident(m_szModuleName, "XStatusId"); diff --git a/src/mir_app/src/CMPluginBase.cpp b/src/mir_app/src/CMPluginBase.cpp index 4476db9c38..3c39dc1675 100644 --- a/src/mir_app/src/CMPluginBase.cpp +++ b/src/mir_app/src/CMPluginBase.cpp @@ -165,6 +165,11 @@ void CMPluginBase::openOptionsPage(const wchar_t *pszGroup, const wchar_t *pszPa ///////////////////////////////////////////////////////////////////////////////////////// +HANDLE CMPluginBase::addIcon(SKINICONDESC *sid) +{ + return IcoLib_AddIcon(sid, m_hLang); +} + int CMPluginBase::addUserInfo(WPARAM wParam, OPTIONSDIALOGPAGE *odp) { odp->langId = m_hLang; diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index 4419a6009f..162a756d66 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -602,3 +602,4 @@ GetPluginByInstance @626 ?getInfo@CMPluginBase@@QBEABUPLUGININFOEX@@XZ @631 NONAME RegisterPlugin @632 UnregisterPlugin @633 +?addIcon@CMPluginBase@@QAEPAXPAUSKINICONDESC@@@Z @634 NONAME diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index 219835d093..c3f3b19748 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -602,3 +602,4 @@ GetPluginByInstance @626 ?getInfo@CMPluginBase@@QEBAAEBUPLUGININFOEX@@XZ @631 NONAME RegisterPlugin @632 UnregisterPlugin @633 +?addIcon@CMPluginBase@@QEAAPEAXPEAUSKINICONDESC@@@Z @634 NONAME -- cgit v1.2.3