summaryrefslogtreecommitdiff
path: root/protocols/CurrencyRates/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2021-02-15 16:31:41 +0300
committerGeorge Hazan <ghazan@miranda.im>2021-02-15 16:31:41 +0300
commitd24bd8956e47ead82a3c73630d6c4aa67fb994b6 (patch)
tree36c44d4827ebbb5d11ebe71d006db377bdeabf46 /protocols/CurrencyRates/src
parent87809ac5ca3ce0cc74b12e7634ae75c9ff9eb344 (diff)
CurrencyRates: useless code removed
Diffstat (limited to 'protocols/CurrencyRates/src')
-rw-r--r--protocols/CurrencyRates/src/CurrencyConverter.cpp4
-rw-r--r--protocols/CurrencyRates/src/CurrencyRatesProviderBase.cpp6
-rw-r--r--protocols/CurrencyRates/src/ExtraImages.cpp8
-rw-r--r--protocols/CurrencyRates/src/Forex.cpp30
-rw-r--r--protocols/CurrencyRates/src/IconLib.cpp42
-rw-r--r--protocols/CurrencyRates/src/IconLib.h11
-rw-r--r--protocols/CurrencyRates/src/stdafx.h1
7 files changed, 37 insertions, 65 deletions
diff --git a/protocols/CurrencyRates/src/CurrencyConverter.cpp b/protocols/CurrencyRates/src/CurrencyConverter.cpp
index f1af844080..e92efff053 100644
--- a/protocols/CurrencyRates/src/CurrencyConverter.cpp
+++ b/protocols/CurrencyRates/src/CurrencyConverter.cpp
@@ -84,7 +84,7 @@ INT_PTR CALLBACK CurrencyConverterDlgProc(HWND hDlg, UINT msg, WPARAM wp, LPARAM
assert(hWL);
WindowList_Add(hWL, hDlg);
- Window_SetIcon_IcoLib(hDlg, CurrencyRates_GetIconHandle(IDI_ICON_CURRENCY_CONVERTER));
+ Window_SetIcon_IcoLib(hDlg, g_plugin.getIconHandle(IDI_ICON_CURRENCY_CONVERTER));
HWND hcbxFrom = ::GetDlgItem(hDlg, IDC_COMBO_CONVERT_FROM);
HWND hcbxTo = ::GetDlgItem(hDlg, IDC_COMBO_CONVERT_INTO);
@@ -121,7 +121,7 @@ INT_PTR CALLBACK CurrencyConverterDlgProc(HWND hDlg, UINT msg, WPARAM wp, LPARAM
::SetDlgItemText(hDlg, IDC_SYSLINK_PROVIDER, o.str().c_str());
- ::SendDlgItemMessage(hDlg, IDC_BUTTON_SWAP, BM_SETIMAGE, IMAGE_ICON, LPARAM(CurrencyRates_LoadIconEx(IDI_ICON_SWAP)));
+ ::SendDlgItemMessage(hDlg, IDC_BUTTON_SWAP, BM_SETIMAGE, IMAGE_ICON, LPARAM(g_plugin.getIcon(IDI_ICON_SWAP)));
update_convert_button(hDlg);
update_swap_button(hDlg);
diff --git a/protocols/CurrencyRates/src/CurrencyRatesProviderBase.cpp b/protocols/CurrencyRates/src/CurrencyRatesProviderBase.cpp
index 5afc061877..912536150f 100644
--- a/protocols/CurrencyRates/src/CurrencyRatesProviderBase.cpp
+++ b/protocols/CurrencyRates/src/CurrencyRatesProviderBase.cpp
@@ -450,11 +450,11 @@ bool show_popup(const ICurrencyRatesProvider *pProvider,
if (tendency.IsValid()) {
CTendency::EResult nComparison = tendency.Compare();
if (CTendency::NotChanged == nComparison)
- ppd.lchIcon = CurrencyRates_LoadIconEx(IDI_ICON_NOTCHANGED);
+ ppd.lchIcon = g_plugin.getIcon(IDI_ICON_NOTCHANGED);
else if (CTendency::Up == nComparison)
- ppd.lchIcon = CurrencyRates_LoadIconEx(IDI_ICON_UP);
+ ppd.lchIcon = g_plugin.getIcon(IDI_ICON_UP);
else if (CTendency::Down == nComparison)
- ppd.lchIcon = CurrencyRates_LoadIconEx(IDI_ICON_DOWN);
+ ppd.lchIcon = g_plugin.getIcon(IDI_ICON_DOWN);
}
mir_wstrncpy(ppd.lpwzContactName, pProvider->FormatSymbol(hContact, 's').c_str(), MAX_CONTACTNAME);
diff --git a/protocols/CurrencyRates/src/ExtraImages.cpp b/protocols/CurrencyRates/src/ExtraImages.cpp
index 966e1050b4..e6002cdcef 100644
--- a/protocols/CurrencyRates/src/ExtraImages.cpp
+++ b/protocols/CurrencyRates/src/ExtraImages.cpp
@@ -4,7 +4,7 @@ static HANDLE hExtraIcon;
void CurrencyRates_InitExtraIcons()
{
- hExtraIcon = ExtraIcon_RegisterIcolib(ICON_STR_CURRENCYRATE, MODULENAME, MODULENAME "_" ICON_STR_MAIN);
+ hExtraIcon = ExtraIcon_RegisterIcolib("currencyrate", MODULENAME, MODULENAME "_main");
}
bool SetContactExtraImage(MCONTACT hContact, EImageIndex nIndex)
@@ -15,13 +15,13 @@ bool SetContactExtraImage(MCONTACT hContact, EImageIndex nIndex)
HANDLE hIcolib;
switch (nIndex) {
case eiUp:
- hIcolib = CurrencyRates_GetIconHandle(IDI_ICON_UP);
+ hIcolib = g_plugin.getIconHandle(IDI_ICON_UP);
break;
case eiDown:
- hIcolib = CurrencyRates_GetIconHandle(IDI_ICON_DOWN);
+ hIcolib = g_plugin.getIconHandle(IDI_ICON_DOWN);
break;
case eiNotChanged:
- hIcolib = CurrencyRates_GetIconHandle(IDI_ICON_NOTCHANGED);
+ hIcolib = g_plugin.getIconHandle(IDI_ICON_NOTCHANGED);
break;
default:
hIcolib = nullptr;
diff --git a/protocols/CurrencyRates/src/Forex.cpp b/protocols/CurrencyRates/src/Forex.cpp
index 2d2622b6b4..e83c319bc8 100644
--- a/protocols/CurrencyRates/src/Forex.cpp
+++ b/protocols/CurrencyRates/src/Forex.cpp
@@ -28,9 +28,9 @@ LPSTR g_pszCurrencyConverter = "CurrencyRates/CurrencyConverter";
void UpdateMenu(bool bAutoUpdate)
{
if (bAutoUpdate) // to enable auto-update
- Menu_ModifyItem(g_hEnableDisableMenu, LPGENW("Auto Update Enabled"), CurrencyRates_GetIconHandle(IDI_ICON_MAIN));
+ Menu_ModifyItem(g_hEnableDisableMenu, LPGENW("Auto Update Enabled"), g_plugin.getIconHandle(IDI_ICON_MAIN));
else // to disable auto-update
- Menu_ModifyItem(g_hEnableDisableMenu, LPGENW("Auto Update Disabled"), CurrencyRates_GetIconHandle(IDI_ICON_DISABLED));
+ Menu_ModifyItem(g_hEnableDisableMenu, LPGENW("Auto Update Disabled"), g_plugin.getIconHandle(IDI_ICON_DISABLED));
CallService(MS_TTB_SETBUTTONSTATE, reinterpret_cast<WPARAM>(g_hTBButton), !bAutoUpdate ? TTBST_PUSHED : 0);
}
@@ -61,13 +61,13 @@ void InitMenu()
{
CMenuItem mi(&g_plugin);
mi.flags = CMIF_UNICODE;
- mi.root = g_plugin.addRootMenu(MO_MAIN, LPGENW("Currency Rates"), 0, CurrencyRates_GetIconHandle(IDI_ICON_MAIN));
+ mi.root = g_plugin.addRootMenu(MO_MAIN, LPGENW("Currency Rates"), 0, g_plugin.getIconHandle(IDI_ICON_MAIN));
Menu_ConfigureItem(mi.root, MCI_OPT_UID, "B474F556-22B6-42A1-A91E-22FE4F671388");
SET_UID(mi, 0x9de6716, 0x3591, 0x48c4, 0x9f, 0x64, 0x1b, 0xfd, 0xc6, 0xd1, 0x34, 0x97);
mi.name.w = LPGENW("Enable/Disable Auto Update");
mi.position = 10100001;
- mi.hIcolibItem = CurrencyRates_GetIconHandle(IDI_ICON_MAIN);
+ mi.hIcolibItem = g_plugin.getIconHandle(IDI_ICON_MAIN);
mi.pszService = g_pszAutoUpdateCmd;
g_hEnableDisableMenu = Menu_AddMainMenuItem(&mi);
CreateServiceFunction(mi.pszService, CurrencyRatesMenu_EnableDisable);
@@ -76,7 +76,7 @@ void InitMenu()
SET_UID(mi, 0x91cbabf6, 0x5073, 0x4a78, 0x84, 0x8, 0x34, 0x61, 0xc1, 0x8a, 0x34, 0xd9);
mi.name.w = LPGENW("Refresh All Rates");
mi.position = 20100001;
- mi.hIcolibItem = CurrencyRates_GetIconHandle(IDI_ICON_MAIN);
+ mi.hIcolibItem = g_plugin.getIconHandle(IDI_ICON_MAIN);
mi.pszService = "CurrencyRates/RefreshAll";
Menu_AddMainMenuItem(&mi);
CreateServiceFunction(mi.pszService, CurrencyRatesMenu_RefreshAll);
@@ -84,33 +84,33 @@ void InitMenu()
SET_UID(mi, 0x3663409c, 0xbd36, 0x473b, 0x9b, 0x4f, 0xff, 0x80, 0xf6, 0x2c, 0xdf, 0x9b);
mi.name.w = LPGENW("Currency Converter...");
mi.position = 20100002;
- mi.hIcolibItem = CurrencyRates_GetIconHandle(IDI_ICON_CURRENCY_CONVERTER);
+ mi.hIcolibItem = g_plugin.getIconHandle(IDI_ICON_CURRENCY_CONVERTER);
mi.pszService = g_pszCurrencyConverter;
Menu_AddMainMenuItem(&mi);
CreateServiceFunction(mi.pszService, CurrencyRatesMenu_CurrencyConverter);
SET_UID(mi, 0x7cca4fd9, 0x903f, 0x4b7d, 0x93, 0x7a, 0x18, 0x63, 0x23, 0xd4, 0xa9, 0xa9);
mi.name.w = LPGENW("Export All Currency Rates");
- mi.hIcolibItem = CurrencyRates_GetIconHandle(IDI_ICON_EXPORT);
+ mi.hIcolibItem = g_plugin.getIconHandle(IDI_ICON_EXPORT);
mi.pszService = MS_CURRENCYRATES_EXPORT;
mi.position = 20100003;
Menu_AddMainMenuItem(&mi);
SET_UID(mi, 0xa994d3b, 0x77c2, 0x4612, 0x8d, 0x5, 0x6a, 0xae, 0x8c, 0x21, 0xbd, 0xc9);
mi.name.w = LPGENW("Import All Currency Rates");
- mi.hIcolibItem = CurrencyRates_GetIconHandle(IDI_ICON_IMPORT);
+ mi.hIcolibItem = g_plugin.getIconHandle(IDI_ICON_IMPORT);
mi.pszService = MS_CURRENCYRATES_IMPORT;
mi.position = 20100004;
Menu_AddMainMenuItem(&mi);
HookEvent(ME_CLIST_PREBUILDCONTACTMENU, CurrencyRates_PrebuildContactMenu);
- g_hMenuRoot = mi.root = g_plugin.addRootMenu(MO_CONTACT, LPGENW("Currency Rates"), 0, CurrencyRates_GetIconHandle(IDI_ICON_MAIN));
+ g_hMenuRoot = mi.root = g_plugin.addRootMenu(MO_CONTACT, LPGENW("Currency Rates"), 0, g_plugin.getIconHandle(IDI_ICON_MAIN));
Menu_ConfigureItem(mi.root, MCI_OPT_UID, "C259BE01-642C-461E-997D-0E756B2A3AD6");
SET_UID(mi, 0xb9812194, 0x3235, 0x4e76, 0xa3, 0xa4, 0x73, 0x32, 0x96, 0x1c, 0x1c, 0xf4);
mi.name.w = LPGENW("Refresh");
- mi.hIcolibItem = CurrencyRates_GetIconHandle(IDI_ICON_REFRESH);
+ mi.hIcolibItem = g_plugin.getIconHandle(IDI_ICON_REFRESH);
mi.pszService = "CurrencyRates/RefreshContact";
g_hMenuRefresh = Menu_AddContactMenuItem(&mi, MODULENAME);
Menu_ConfigureItem(g_hMenuRefresh, MCI_OPT_EXECPARAM, INT_PTR(0));
@@ -153,8 +153,8 @@ int CurrencyRates_OnToolbarLoaded(WPARAM, LPARAM)
ttb.pszService = g_pszAutoUpdateCmd;
ttb.pszTooltipUp = LPGEN("Currency Rates Auto Update Enabled");
ttb.pszTooltipDn = LPGEN("Currency Rates Auto Update Disabled");
- ttb.hIconHandleUp = CurrencyRates_GetIconHandle(IDI_ICON_MAIN);
- ttb.hIconHandleDn = CurrencyRates_GetIconHandle(IDI_ICON_DISABLED);
+ ttb.hIconHandleUp = g_plugin.getIconHandle(IDI_ICON_MAIN);
+ ttb.hIconHandleDn = g_plugin.getIconHandle(IDI_ICON_DISABLED);
ttb.dwFlags = ((g_bAutoUpdate) ? 0 : TTBBF_PUSHED) | TTBBF_ASPUSHBUTTON | TTBBF_VISIBLE;
g_hTBButton = g_plugin.addTTB(&ttb);
@@ -162,8 +162,8 @@ int CurrencyRates_OnToolbarLoaded(WPARAM, LPARAM)
ttb.pszService = g_pszCurrencyConverter;
ttb.pszTooltipUp = LPGEN("Currency Converter");
ttb.pszTooltipDn = LPGEN("Currency Converter");
- ttb.hIconHandleUp = CurrencyRates_GetIconHandle(IDI_ICON_CURRENCY_CONVERTER);
- ttb.hIconHandleDn = CurrencyRates_GetIconHandle(IDI_ICON_CURRENCY_CONVERTER);
+ ttb.hIconHandleUp = g_plugin.getIconHandle(IDI_ICON_CURRENCY_CONVERTER);
+ ttb.hIconHandleDn = g_plugin.getIconHandle(IDI_ICON_CURRENCY_CONVERTER);
ttb.dwFlags = TTBBF_VISIBLE;
g_plugin.addTTB(&ttb);
@@ -289,6 +289,8 @@ CMPlugin::CMPlugin() :
/////////////////////////////////////////////////////////////////////////////////////////
+void CurrencyRates_IconsInit();
+
int CMPlugin::Load(void)
{
if (!CModuleInfo::Verify())
diff --git a/protocols/CurrencyRates/src/IconLib.cpp b/protocols/CurrencyRates/src/IconLib.cpp
index bc69d474dd..4d86d6e0c4 100644
--- a/protocols/CurrencyRates/src/IconLib.cpp
+++ b/protocols/CurrencyRates/src/IconLib.cpp
@@ -2,39 +2,21 @@
static IconItem iconList[] =
{
- { LPGEN("Protocol icon"), ICON_STR_MAIN, IDI_ICON_MAIN },
- { LPGEN("Auto Update Disabled"), "auto_update_disabled", IDI_ICON_DISABLED },
- { LPGEN("Currency Rate up"), "currencyrate_up", IDI_ICON_UP },
- { LPGEN("Currency Rate down"), "currencyrate_down", IDI_ICON_DOWN },
- { LPGEN("Currency Rate not changed"), "currencyrate_not_changed", IDI_ICON_NOTCHANGED },
- { LPGEN("Currency Rate Section"), "currencyrate_section", IDI_ICON_SECTION },
- { LPGEN("Currency Rate"), ICON_STR_CURRENCYRATE, IDI_ICON_CURRENCYRATE },
- { LPGEN("Currency Converter"), "currency_converter", IDI_ICON_CURRENCY_CONVERTER },
- { LPGEN("Refresh"), "refresh", IDI_ICON_REFRESH },
- { LPGEN("Export"), "export", IDI_ICON_EXPORT },
- { LPGEN("Swap button"), "swap", IDI_ICON_SWAP },
- { LPGEN("Import"), "import", IDI_ICON_IMPORT }
+ { LPGEN("Protocol icon"), "main", IDI_ICON_MAIN },
+ { LPGEN("Auto Update Disabled"), "auto_update_disabled", IDI_ICON_DISABLED },
+ { LPGEN("Currency Rate up"), "currencyrate_up", IDI_ICON_UP },
+ { LPGEN("Currency Rate down"), "currencyrate_down", IDI_ICON_DOWN },
+ { LPGEN("Currency Rate not changed"), "currencyrate_not_changed",IDI_ICON_NOTCHANGED },
+ { LPGEN("Currency Rate Section"), "currencyrate_section", IDI_ICON_SECTION },
+ { LPGEN("Currency Rate"), "currencyrate", IDI_ICON_CURRENCYRATE },
+ { LPGEN("Currency Converter"), "currency_converter", IDI_ICON_CURRENCY_CONVERTER },
+ { LPGEN("Refresh"), "refresh", IDI_ICON_REFRESH },
+ { LPGEN("Export"), "export", IDI_ICON_EXPORT },
+ { LPGEN("Swap button"), "swap", IDI_ICON_SWAP },
+ { LPGEN("Import"), "import", IDI_ICON_IMPORT }
};
void CurrencyRates_IconsInit()
{
::g_plugin.registerIcon(MODULENAME, iconList, MODULENAME);
}
-
-HICON CurrencyRates_LoadIconEx(int iconId, bool bBig /*= false*/)
-{
- for (int i = 0; i < _countof(iconList); i++)
- if (iconList[i].defIconID == iconId)
- return IcoLib_GetIconByHandle(iconList[i].hIcolib, bBig);
-
- return nullptr;
-}
-
-HANDLE CurrencyRates_GetIconHandle(int iconId)
-{
- for (int i = 0; i < _countof(iconList); i++)
- if (iconList[i].defIconID == iconId)
- return iconList[i].hIcolib;
-
- return nullptr;
-}
diff --git a/protocols/CurrencyRates/src/IconLib.h b/protocols/CurrencyRates/src/IconLib.h
deleted file mode 100644
index 4e0146fba8..0000000000
--- a/protocols/CurrencyRates/src/IconLib.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef __8821d334_afac_439e_9a81_76318e1ac4ef_IconLib_h__
-#define __8821d334_afac_439e_9a81_76318e1ac4ef_IconLib_h__
-
-#define ICON_STR_MAIN "main"
-#define ICON_STR_CURRENCYRATE "currencyrate"
-
-void CurrencyRates_IconsInit();
-HICON CurrencyRates_LoadIconEx(int iconId, bool bBig = false);
-HANDLE CurrencyRates_GetIconHandle(int iconId);
-
-#endif //__8821d334_afac_439e_9a81_76318e1ac4ef_IconLib_h__
diff --git a/protocols/CurrencyRates/src/stdafx.h b/protocols/CurrencyRates/src/stdafx.h
index d2bc83fd18..69cfb91df0 100644
--- a/protocols/CurrencyRates/src/stdafx.h
+++ b/protocols/CurrencyRates/src/stdafx.h
@@ -75,7 +75,6 @@ inline tstring currencyrates_a2t(const char* s)
#include "resource.h"
#include "version.h"
-#include "IconLib.h"
#include "CurrencyRateInfoDlg.h"
#include "ModuleInfo.h"
#include "DBUtils.h"