summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2019-04-12 22:17:02 +0300
committerGeorge Hazan <ghazan@miranda.im>2019-04-12 22:17:02 +0300
commit6cbc80198df3a18724e667743f8068eb60e23b88 (patch)
tree672535bf873cf3cf59af352edb6ef5e2c9f2c8e5 /plugins
parent0b9866156def4ef721c408b650751f2ae48b7b4e (diff)
wiping custom icolib functions: all another plugins
Diffstat (limited to 'plugins')
-rw-r--r--plugins/MirLua/src/Modules/m_icolib.cpp4
-rw-r--r--plugins/MirLua/src/icons.cpp18
-rw-r--r--plugins/MirLua/src/options.cpp10
-rw-r--r--plugins/MirLua/src/stdafx.h2
-rw-r--r--plugins/StartupSilence/src/main.cpp24
-rw-r--r--plugins/StartupSilence/src/stdafx.h11
6 files changed, 21 insertions, 48 deletions
diff --git a/plugins/MirLua/src/Modules/m_icolib.cpp b/plugins/MirLua/src/Modules/m_icolib.cpp
index 3f94e26894..97fa50ccb3 100644
--- a/plugins/MirLua/src/Modules/m_icolib.cpp
+++ b/plugins/MirLua/src/Modules/m_icolib.cpp
@@ -57,7 +57,7 @@ static int lua_AddIcon(lua_State *L)
sid.description.w = mir_utf8decodeW(luaL_checkstring(L, 2));
sid.section.w = mir_utf8decodeW(luaL_optstring(L, 3, MODULENAME));
sid.defaultFile.w = mir_utf8decodeW(lua_tostring(L, 4));
- sid.hDefaultIcon = GetIcon(IDI_SCRIPT);
+ sid.hDefaultIcon = g_plugin.getIcon(IDI_SCRIPT);
if (sid.defaultFile.w == nullptr) {
sid.defaultFile.w = (wchar_t*)mir_calloc(MAX_PATH + 1);
@@ -133,7 +133,7 @@ static int lua_RemoveIcon(lua_State *L)
static luaL_Reg icolibApi[] =
{
{ "AddIcon", lua_AddIcon },
- { "GetIcon", lua_GetIcon },
+ { "g_plugin.getIcon", lua_GetIcon },
{ "GetHandle", lua_GetIconHandle },
{ "GetIconHandle", lua_GetIconHandle },
{ "RemoveIcon", lua_RemoveIcon },
diff --git a/plugins/MirLua/src/icons.cpp b/plugins/MirLua/src/icons.cpp
index 52940084f3..74e4d28136 100644
--- a/plugins/MirLua/src/icons.cpp
+++ b/plugins/MirLua/src/icons.cpp
@@ -14,21 +14,3 @@ void LoadIcons()
{
g_plugin.registerIcon(MODULENAME, Icons, MODULENAME);
}
-
-HICON GetIcon(int iconId)
-{
- for (auto &it : Icons)
- if (it.defIconID == iconId)
- return IcoLib_GetIconByHandle(it.hIcolib);
-
- return nullptr;
-}
-
-HANDLE GetIconHandle(int iconId)
-{
- for (auto &it : Icons)
- if (it.defIconID == iconId)
- return it.hIcolib;
-
- return nullptr;
-} \ No newline at end of file
diff --git a/plugins/MirLua/src/options.cpp b/plugins/MirLua/src/options.cpp
index 83a8b9d7c8..f96a4a15a3 100644
--- a/plugins/MirLua/src/options.cpp
+++ b/plugins/MirLua/src/options.cpp
@@ -50,11 +50,11 @@ bool CMLuaOptionsMain::OnInitDialog()
m_scriptsList.SetExtendedListViewStyle(LVS_EX_SUBITEMIMAGES | LVS_EX_FULLROWSELECT | LVS_EX_CHECKBOXES | LVS_EX_INFOTIP);
HIMAGELIST hImageList = m_scriptsList.CreateImageList(LVSIL_SMALL);
- ImageList_AddIcon(hImageList, GetIcon(IDI_LOADED));
- ImageList_AddIcon(hImageList, GetIcon(IDI_FAILED));
- ImageList_AddIcon(hImageList, GetIcon(IDI_OPEN));
- ImageList_AddIcon(hImageList, GetIcon(IDI_RELOAD));
- ImageList_AddIcon(hImageList, GetIcon(IDI_COMPILE));
+ ImageList_AddIcon(hImageList, g_plugin.getIcon(IDI_LOADED));
+ ImageList_AddIcon(hImageList, g_plugin.getIcon(IDI_FAILED));
+ ImageList_AddIcon(hImageList, g_plugin.getIcon(IDI_OPEN));
+ ImageList_AddIcon(hImageList, g_plugin.getIcon(IDI_RELOAD));
+ ImageList_AddIcon(hImageList, g_plugin.getIcon(IDI_COMPILE));
wchar_t scriptDir[MAX_PATH];
FoldersGetCustomPathT(g_hScriptsFolder, scriptDir, _countof(scriptDir), VARSW(MIRLUA_PATHT));
diff --git a/plugins/MirLua/src/stdafx.h b/plugins/MirLua/src/stdafx.h
index cd4873de17..9c88b62ad4 100644
--- a/plugins/MirLua/src/stdafx.h
+++ b/plugins/MirLua/src/stdafx.h
@@ -72,8 +72,6 @@ void LoadNetlib();
void UnloadNetlib();
void LoadIcons();
-HICON GetIcon(int iconId);
-HANDLE GetIconHandle(int iconId);
/* utils */
diff --git a/plugins/StartupSilence/src/main.cpp b/plugins/StartupSilence/src/main.cpp
index e2f8ab22be..5a2241f494 100644
--- a/plugins/StartupSilence/src/main.cpp
+++ b/plugins/StartupSilence/src/main.cpp
@@ -27,7 +27,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
CMPlugin g_plugin;
HGENMENU hSSMenuToggleOnOff;
-HANDLE GetIconHandle(char *szIcon);
HANDLE hOptionsInitialize;
HANDLE hTTBarloaded = nullptr;
HANDLE Buttons = nullptr;
@@ -93,7 +92,7 @@ static void __cdecl AdvSt(void*)
if (PopUp == 1) {
lpwzText = NonStatusAllow == 1 ? ALL_DISABLED_FLT : ALL_DISABLED;
- ppd.lchIcon = IcoLib_GetIconByHandle((NonStatusAllow == 1) ? GetIconHandle(ALL_ENABLED_FLT) : GetIconHandle(MENU_NAME));
+ ppd.lchIcon = IcoLib_GetIconByHandle((NonStatusAllow == 1) ? g_plugin.getIconHandle(IDI_SSFILTEREDON) : g_plugin.getIconHandle(IDI_SSICON));
ppd.lchContact = NULL;
ppd.iSeconds = PopUpTime;
wcsncpy_s(ppd.lpwzText, lpwzText, _TRUNCATE);
@@ -108,7 +107,7 @@ static void __cdecl AdvSt(void*)
if (PopUp == 1) {
lpwzText = (DefEnabled == 1 && DefPopup == 1) ? TranslateT(ALL_ENABLED_FLT) : ALL_ENABLED;
- ppd.lchIcon = IcoLib_GetIconByHandle((DefEnabled == 1 && DefPopup == 1) ? GetIconHandle(ALL_ENABLED_FLT) : GetIconHandle(MENU_NAME));
+ ppd.lchIcon = IcoLib_GetIconByHandle((DefEnabled == 1 && DefPopup == 1) ? g_plugin.getIconHandle(IDI_SSFILTEREDON) : g_plugin.getIconHandle(IDI_SSICON));
wcsncpy_s(ppd.lpwzText, lpwzText, _TRUNCATE);
PUAddPopupW(&ppd);
}
@@ -213,7 +212,7 @@ static INT_PTR StartupSilenceEnabled(WPARAM, LPARAM)
if (PopUp == 1) {
wchar_t * lpwzText = Enabled == 1 ? S_MODE_CHANGEDON : S_MODE_CHANGEDOFF;
POPUPDATAW ppd;
- ppd.lchIcon = IcoLib_GetIconByHandle((Enabled == 1) ? GetIconHandle(ENABLE_SILENCE) : GetIconHandle(DISABLE_SILENCE));
+ ppd.lchIcon = IcoLib_GetIconByHandle((Enabled == 1) ? g_plugin.getIconHandle(IDI_SSENABLE) : g_plugin.getIconHandle(IDI_SSDISABLE));
ppd.lchContact = NULL;
ppd.iSeconds = PopUpTime;
wcsncpy_s(ppd.lpwzText, lpwzText, _TRUNCATE);
@@ -237,7 +236,7 @@ static INT_PTR InitMenu()
CMenuItem mi(&g_plugin);
SET_UID(mi, 0x9100c881, 0x6f76, 0x4cb5, 0x97, 0x66, 0xeb, 0xf5, 0xc5, 0x22, 0x46, 0x1f);
mi.position = 100000000;
- mi.hIcolibItem = GetIconHandle(MENU_NAME);
+ mi.hIcolibItem = g_plugin.getIconHandle(IDI_SSICON);
mi.name.a = MENU_NAME;
mi.pszService = SS_SERVICE_NAME;
hSSMenuToggleOnOff = Menu_AddMainMenuItem(&mi);
@@ -248,9 +247,9 @@ static INT_PTR InitMenu()
void UpdateMenu()
{
if (Enabled == 1)
- Menu_ModifyItem(hSSMenuToggleOnOff, _A2W(DISABLE_SILENCE), GetIconHandle(DISABLE_SILENCE));
+ Menu_ModifyItem(hSSMenuToggleOnOff, _A2W(DISABLE_SILENCE), g_plugin.getIconHandle(IDI_SSDISABLE));
else
- Menu_ModifyItem(hSSMenuToggleOnOff, _A2W(ENABLE_SILENCE), GetIconHandle(ENABLE_SILENCE));
+ Menu_ModifyItem(hSSMenuToggleOnOff, _A2W(ENABLE_SILENCE), g_plugin.getIconHandle(IDI_SSENABLE));
UpdateTTB();
}
@@ -266,8 +265,8 @@ static int CreateTTButtons(WPARAM, LPARAM)
TTBButton ttb = {};
ttb.dwFlags = (Enabled == 1 ? 0 : TTBBF_PUSHED) | TTBBF_VISIBLE | TTBBF_ASPUSHBUTTON;
ttb.pszService = SS_SERVICE_NAME;
- ttb.hIconHandleDn = GetIconHandle(DISABLE_SILENCETTB);
- ttb.hIconHandleUp = GetIconHandle(ENABLE_SILENCETTB);
+ ttb.hIconHandleDn = g_plugin.getIconHandle(IDI_SSDISABLETTB);
+ ttb.hIconHandleUp = g_plugin.getIconHandle(IDI_SSENABLETTB);
ttb.name = TTBNAME;
ttb.pszTooltipUp = SS_IS_ON;
ttb.pszTooltipDn = SS_IS_OFF;
@@ -284,13 +283,6 @@ void RemoveTTButtons()
ttbButtons.destroy();
}
-HANDLE GetIconHandle(char *szIcon)
-{
- char szSettingName[64];
- mir_snprintf(szSettingName, "%s_%s", MENU_NAME, szIcon);
- return IcoLib_GetIconHandle(szSettingName);
-}
-
static INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg) {
diff --git a/plugins/StartupSilence/src/stdafx.h b/plugins/StartupSilence/src/stdafx.h
index 0eff5b5fce..97a37291c3 100644
--- a/plugins/StartupSilence/src/stdafx.h
+++ b/plugins/StartupSilence/src/stdafx.h
@@ -67,11 +67,12 @@ struct CMPlugin : public PLUGIN<CMPlugin>
#define NEEDTTBMOD TranslateT("You have to install TopToolBar plugin to use this option.")
#define NEEDPOPUP TranslateT("You have to install popup plugin to use this option.")
-static IconItem iconList[] = {
- { MENU_NAME, MENU_NAME, IDI_SSICON},
- { ALL_ENABLED_FLT, ALL_ENABLED_FLT, IDI_SSFILTEREDON},
- { DISABLE_SILENCE, DISABLE_SILENCE, IDI_SSDISABLE},
- { ENABLE_SILENCE, ENABLE_SILENCE, IDI_SSENABLE}
+static IconItem iconList[] =
+{
+ { MENU_NAME, MENU_NAME, IDI_SSICON },
+ { ALL_ENABLED_FLT, ALL_ENABLED_FLT, IDI_SSFILTEREDON },
+ { DISABLE_SILENCE, DISABLE_SILENCE, IDI_SSDISABLE },
+ { ENABLE_SILENCE, ENABLE_SILENCE, IDI_SSENABLE }
};
static IconItem iconttbList[] = {