diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mir_app/src/CMPluginBase.cpp | 28 | ||||
-rw-r--r-- | src/mir_app/src/icolib.cpp | 3 | ||||
-rw-r--r-- | src/mir_app/src/menu_utils.cpp | 2 | ||||
-rw-r--r-- | src/mir_app/src/mir_app.def | 4 | ||||
-rw-r--r-- | src/mir_app/src/mir_app64.def | 4 |
5 files changed, 39 insertions, 2 deletions
diff --git a/src/mir_app/src/CMPluginBase.cpp b/src/mir_app/src/CMPluginBase.cpp index 062d89471e..2b5fe51b29 100644 --- a/src/mir_app/src/CMPluginBase.cpp +++ b/src/mir_app/src/CMPluginBase.cpp @@ -24,6 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h" #include "plugins.h" +#include "IcoLib.h" static int sttFakeID = -100; @@ -111,9 +112,15 @@ EXTERN_C MIR_APP_DLL(void) UnregisterPlugin(CMPluginBase *pPlugin) ///////////////////////////////////////////////////////////////////////////////////////// +static int CompareIcons(const void *p1, const void *p2) +{ + return ((IcolibItem*)p1)->default_indx - ((IcolibItem*)p2)->default_indx; +} + CMPluginBase::CMPluginBase(const char *moduleName, const PLUGININFOEX &pInfo) : m_szModuleName(moduleName), - m_pInfo(pInfo) + m_pInfo(pInfo), + m_arIcons(10, CompareIcons) { if (m_hInst != nullptr) g_arPlugins.insert(this); @@ -272,6 +279,25 @@ void CMPluginBase::debugLogW(LPCWSTR wszFormat, ...) ///////////////////////////////////////////////////////////////////////////////////////// +HICON CMPluginBase::getIcon(int iconId) +{ + return IcoLib_GetIconByHandle(getIconHandle(iconId)); +} + +HANDLE CMPluginBase::getIconHandle(int iconId) +{ + IcolibItem *p = (IcolibItem*)alloca(sizeof(IcolibItem)); + p->default_indx = iconId; + return m_arIcons.find(p); +} + +void CMPluginBase::releaseIcon(int iconId) +{ + IcoLib_ReleaseIcon(getIcon(iconId)); +} + +///////////////////////////////////////////////////////////////////////////////////////// + void CMPluginBase::RegisterProtocol(int type, pfnInitProto fnInit, pfnUninitProto fnUninit) { if (isPluginBanned(m_pInfo.uuid)) diff --git a/src/mir_app/src/icolib.cpp b/src/mir_app/src/icolib.cpp index e8605688c4..6069202925 100644 --- a/src/mir_app/src/icolib.cpp +++ b/src/mir_app/src/icolib.cpp @@ -522,6 +522,9 @@ MIR_APP_DLL(HANDLE) IcoLib_AddIcon(const SKINICONDESC *sid, HPLUGIN pPlugin) if (item->section)
item->section->flags = sid->flags & SIDF_SORTED;
+ if (pPlugin && item->default_indx)
+ ((CMPluginBase*)pPlugin)->addIcolib(item);
+
return item;
}
diff --git a/src/mir_app/src/menu_utils.cpp b/src/mir_app/src/menu_utils.cpp index b2328884d0..56681136af 100644 --- a/src/mir_app/src/menu_utils.cpp +++ b/src/mir_app/src/menu_utils.cpp @@ -1240,7 +1240,7 @@ static int MO_RegisterIcon(TMO_IntMenuItem *pmi, void*) sid.pszName = iconame;
sid.description.w = descr;
sid.hDefaultIcon = hIcon;
- pmi->hIcolibItem = IcoLib_AddIcon(&sid, 0);
+ pmi->hIcolibItem = IcoLib_AddIcon(&sid, pmi->mi.pPlugin);
Safe_DestroyIcon(hIcon);
if (hIcon = IcoLib_GetIcon(iconame)) {
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index b99133764f..2754e8aa53 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -675,3 +675,7 @@ Popup_Add @764 Popup_Change @765
Skin_GetProtoIcon @766
Srmm_SetIconFlags @767
+?addIcolib@CMPluginBase@@QAEXPAX@Z @768 NONAME
+?getIcon@CMPluginBase@@QAEPAUHICON__@@H@Z @769 NONAME
+?getIconHandle@CMPluginBase@@QAEPAXH@Z @770 NONAME
+?releaseIcon@CMPluginBase@@QAEXH@Z @771 NONAME
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index 9b8928ccae..dbb8284250 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -675,3 +675,7 @@ Popup_Add @764 Popup_Change @765
Skin_GetProtoIcon @766
Srmm_SetIconFlags @767
+?addIcolib@CMPluginBase@@QEAAXPEAX@Z @768 NONAME
+?getIcon@CMPluginBase@@QEAAPEAUHICON__@@H@Z @769 NONAME
+?getIconHandle@CMPluginBase@@QEAAPEAXH@Z @770 NONAME
+?releaseIcon@CMPluginBase@@QEAAXH@Z @771 NONAME
|