From 4f795c38d1a5ddde2e89b335eda36133f75fde55 Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Fri, 2 Jan 2015 16:37:03 +0000 Subject: fix for status icon in tray tooltip git-svn-id: http://svn.miranda-ng.org/main/trunk@11723 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Quotes/src/Forex.cpp | 125 +++++++++++------------------------- plugins/Quotes/src/ImportExport.cpp | 3 - plugins/Quotes/src/ImportExport.h | 2 - plugins/Quotes/src/stdafx.h | 1 - 4 files changed, 38 insertions(+), 93 deletions(-) (limited to 'plugins') diff --git a/plugins/Quotes/src/Forex.cpp b/plugins/Quotes/src/Forex.cpp index 36adb777ea..a2e01a22e6 100644 --- a/plugins/Quotes/src/Forex.cpp +++ b/plugins/Quotes/src/Forex.cpp @@ -20,10 +20,7 @@ HGENMENU g_hMenuRefresh = NULL; namespace { typedef std::vector THandles; - THandles g_ahEvents; - THandles g_ahServices; THandles g_ahThreads; - std::vector g_ahMenus; HGENMENU g_hEnableDisableMenu; HANDLE g_hTBButton; @@ -141,7 +138,6 @@ namespace mi.flags = CMIF_TCHAR | CMIF_ROOTPOPUP; mi.icolibItem = Quotes_GetIconHandle(IDI_ICON_MAIN); HGENMENU hMenuRoot = Menu_AddMainMenuItem(&mi); - g_ahMenus.push_back(hMenuRoot); mi.ptszName = LPGENT("Enable/Disable Auto Update"); mi.flags = CMIF_TCHAR | CMIF_ROOTHANDLE; @@ -150,9 +146,7 @@ namespace mi.pszService = g_pszAutoUpdateCmd; mi.hParentMenu = hMenuRoot; g_hEnableDisableMenu = Menu_AddMainMenuItem(&mi); - g_ahMenus.push_back(g_hEnableDisableMenu); - HANDLE h = CreateServiceFunction(mi.pszService, QuotesMenu_EnableDisable); - g_ahServices.push_back(h); + CreateServiceFunction(mi.pszService, QuotesMenu_EnableDisable); UpdateMenu(g_bAutoUpdate); mi.ptszName = LPGENT("Refresh All Quotes\\Rates"); @@ -161,47 +155,36 @@ namespace mi.icolibItem = Quotes_GetIconHandle(IDI_ICON_MAIN); mi.pszService = "Quotes/RefreshAll"; mi.hParentMenu = hMenuRoot; - auto hMenu = Menu_AddMainMenuItem(&mi); - g_ahMenus.push_back(hMenu); - h = CreateServiceFunction(mi.pszService, QuotesMenu_RefreshAll); - g_ahServices.push_back(h); + Menu_AddMainMenuItem(&mi); + CreateServiceFunction(mi.pszService, QuotesMenu_RefreshAll); mi.ptszName = LPGENT("Currency Converter..."); //mi.flags = CMIF_TCHAR|CMIF_ICONFROMICOLIB|CMIF_ROOTHANDLE; mi.position = 20100002; mi.icolibItem = Quotes_GetIconHandle(IDI_ICON_CURRENCY_CONVERTER); mi.pszService = g_pszCurrencyConverter; - hMenu = Menu_AddMainMenuItem(&mi); - g_ahMenus.push_back(hMenu); - h = CreateServiceFunction(mi.pszService, QuotesMenu_CurrencyConverter); - g_ahServices.push_back(h); + Menu_AddMainMenuItem(&mi); + CreateServiceFunction(mi.pszService, QuotesMenu_CurrencyConverter); -#ifdef TEST_IMPORT_EXPORT mi.ptszName = LPGENT("Export All Quotes"); //mi.flags = CMIF_TCHAR|CMIF_ICONFROMICOLIB|CMIF_ROOTHANDLE; mi.icolibItem = Quotes_GetIconHandle(IDI_ICON_EXPORT); mi.pszService = "Quotes/ExportAll"; mi.position = 20100003; - hMenu = Menu_AddMainMenuItem(&mi); - g_ahMenus.push_back(hMenu); - h = CreateServiceFunction(mi.pszService, QuotesMenu_ExportAll); - g_ahServices.push_back(h); + Menu_AddMainMenuItem(&mi); + CreateServiceFunction(mi.pszService, QuotesMenu_ExportAll); mi.ptszName = LPGENT("Import All Quotes"); //mi.flags = CMIF_TCHAR|CMIF_ICONFROMICOLIB|CMIF_ROOTHANDLE; mi.icolibItem = Quotes_GetIconHandle(IDI_ICON_IMPORT); mi.pszService = "Quotes/ImportAll"; mi.position = 20100004; - hMenu = Menu_AddMainMenuItem(&mi); - g_ahMenus.push_back(hMenu); - h = CreateServiceFunction(mi.pszService, QuotesMenu_ImportAll); - g_ahServices.push_back(h); -#endif + Menu_AddMainMenuItem(&mi); + CreateServiceFunction(mi.pszService, QuotesMenu_ImportAll); bool bSubGroups = 1 == ServiceExists(MS_CLIST_MENUBUILDSUBGROUP); - h = HookEvent(ME_CLIST_PREBUILDCONTACTMENU, Quotes_PrebuildContactMenu); - g_ahEvents.push_back(h); + HookEvent(ME_CLIST_PREBUILDCONTACTMENU, Quotes_PrebuildContactMenu); memset(&mi, 0, sizeof(mi)); mi.cbSize = sizeof(mi); @@ -230,32 +213,23 @@ namespace mi.popupPosition = 0; mi.icolibItem = Quotes_GetIconHandle(IDI_ICON_REFRESH); mi.pszService = "Quotes/RefreshContact"; - hMenu = Menu_AddContactMenuItem(&mi); - g_hMenuRefresh = hMenu; - g_ahMenus.push_back(hMenu); - h = CreateServiceFunction(mi.pszService, QuotesMenu_RefreshContact); - g_ahServices.push_back(h); + g_hMenuRefresh = Menu_AddContactMenuItem(&mi); + CreateServiceFunction(mi.pszService, QuotesMenu_RefreshContact); mi.ptszName = LPGENT("Open Log File..."); mi.popupPosition = 1; mi.icolibItem = NULL; mi.pszService = "Quotes/OpenLogFile"; - hMenu = Menu_AddContactMenuItem(&mi); - g_hMenuOpenLogFile = hMenu; - g_ahMenus.push_back(hMenu); - h = CreateServiceFunction(mi.pszService, QuotesMenu_OpenLogFile); - g_ahServices.push_back(h); + g_hMenuOpenLogFile = Menu_AddContactMenuItem(&mi); + CreateServiceFunction(mi.pszService, QuotesMenu_OpenLogFile); #ifdef CHART_IMPLEMENT mi.ptszName = LPGENT("Chart..."); mi.popupPosition = 2; mi.icolibItem = NULL; mi.pszService = "Quotes/Chart"; - hMenu = Menu_AddContactMenuItem(&mi); - g_hMenuChart = hMenu; - g_ahMenus.push_back(hMenu); - h = CreateServiceFunction(mi.pszService, QuotesMenu_Chart); - g_ahServices.push_back(h); + g_hMenuChart = Menu_AddContactMenuItem(&mi); + CreateServiceFunction(mi.pszService, QuotesMenu_Chart); #endif mi.ptszName = LPGENT("Edit Settings..."); @@ -266,11 +240,8 @@ namespace #endif mi.icolibItem = NULL; mi.pszService = "Quotes/EditSettings"; - hMenu = Menu_AddContactMenuItem(&mi); - g_hMenuEditSettings = hMenu; - g_ahMenus.push_back(hMenu); - h = CreateServiceFunction(mi.pszService, QuotesMenu_EditSettings); - g_ahServices.push_back(h); + g_hMenuEditSettings = Menu_AddContactMenuItem(&mi); + CreateServiceFunction(mi.pszService, QuotesMenu_EditSettings); } int Quotes_OnToolbarLoaded(WPARAM, LPARAM) @@ -301,18 +272,14 @@ namespace { CHTTPSession::Init(); - // HANDLE h = HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY,QuotesEventFunc_onExtraImageApply); - // g_ahEvents.push_back(h); + // HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY,QuotesEventFunc_onExtraImageApply); g_hEventWorkThreadStop = ::CreateEvent(NULL, TRUE, FALSE, NULL); - auto h = HookEvent(ME_USERINFO_INITIALISE, QuotesEventFunc_OnUserInfoInit); - g_ahEvents.push_back(h); + HookEvent(ME_USERINFO_INITIALISE, QuotesEventFunc_OnUserInfoInit); - h = HookEvent(ME_CLIST_DOUBLECLICKED, Quotes_OnContactDoubleClick); - g_ahEvents.push_back(h); + HookEvent(ME_CLIST_DOUBLECLICKED, Quotes_OnContactDoubleClick); - h = HookEvent(ME_TTB_MODULELOADED, Quotes_OnToolbarLoaded); - g_ahEvents.push_back(h); + HookEvent(ME_TTB_MODULELOADED, Quotes_OnToolbarLoaded); g_bAutoUpdate = 1 == db_get_b(NULL, QUOTES_MODULE_NAME, DB_STR_AUTO_UPDATE, 1); @@ -346,10 +313,10 @@ namespace return 0; } - // INT_PTR QuoteProtoFunc_GetStatus(WPARAM/* wp*/,LPARAM/* lp*/) - // { - // return g_bAutoUpdate ? ID_STATUS_ONLINE : ID_STATUS_OFFLINE; - // } + INT_PTR QuoteProtoFunc_GetStatus(WPARAM,LPARAM) + { + return g_bAutoUpdate ? ID_STATUS_ONLINE : ID_STATUS_OFFLINE; + } void WaitForWorkingThreads() { @@ -479,41 +446,25 @@ extern "C" pd.type = PROTOTYPE_VIRTUAL; CallService(MS_PROTO_REGISTERMODULE, 0, (LPARAM)&pd); - // HANDLE h = CreateProtoServiceFunction(QUOTES_PROTOCOL_NAME, PS_GETNAME, QuoteProtoFunc_GetName); - // g_ahServices.push_back(h); - // h = CreateProtoServiceFunction(QUOTES_PROTOCOL_NAME, PS_GETCAPS, QuoteProtoFunc_GetCaps); - // g_ahServices.push_back(h); - // h = CreateProtoServiceFunction(QUOTES_PROTOCOL_NAME, PS_SETSTATUS, QuoteProtoFunc_SetStatus); - // g_ahServices.push_back(h); - // h = CreateProtoServiceFunction(QUOTES_PROTOCOL_NAME, PS_GETSTATUS, QuoteProtoFunc_GetStatus); - // g_ahServices.push_back(h); - // h = CreateProtoServiceFunction(QUOTES_PROTOCOL_NAME, PS_LOADICON, QuoteProtoFunc_LoadIcon); - // g_ahServices.push_back(h); - - auto h = HookEvent(ME_SYSTEM_MODULESLOADED, QuotesEventFunc_OnModulesLoaded); - g_ahEvents.push_back(h); - h = HookEvent(ME_DB_CONTACT_DELETED, QuotesEventFunc_OnContactDeleted); - g_ahEvents.push_back(h); - h = HookEvent(ME_SYSTEM_PRESHUTDOWN, QuotesEventFunc_PreShutdown); - g_ahEvents.push_back(h); - h = HookEvent(ME_OPT_INITIALISE, QuotesEventFunc_OptInitialise); - g_ahEvents.push_back(h); - - h = CreateServiceFunction(MS_QUOTES_EXPORT, Quotes_Export); - g_ahServices.push_back(h); - h = CreateServiceFunction(MS_QUOTES_IMPORT, Quotes_Import); - g_ahServices.push_back(h); + // CreateProtoServiceFunction(QUOTES_PROTOCOL_NAME, PS_GETNAME, QuoteProtoFunc_GetName); + // CreateProtoServiceFunction(QUOTES_PROTOCOL_NAME, PS_GETCAPS, QuoteProtoFunc_GetCaps); + // CreateProtoServiceFunction(QUOTES_PROTOCOL_NAME, PS_SETSTATUS, QuoteProtoFunc_SetStatus); + CreateProtoServiceFunction(QUOTES_PROTOCOL_NAME, PS_GETSTATUS, QuoteProtoFunc_GetStatus); + // CreateProtoServiceFunction(QUOTES_PROTOCOL_NAME, PS_LOADICON, QuoteProtoFunc_LoadIcon); + + HookEvent(ME_SYSTEM_MODULESLOADED, QuotesEventFunc_OnModulesLoaded); + HookEvent(ME_DB_CONTACT_DELETED, QuotesEventFunc_OnContactDeleted); + HookEvent(ME_SYSTEM_PRESHUTDOWN, QuotesEventFunc_PreShutdown); + HookEvent(ME_OPT_INITIALISE, QuotesEventFunc_OptInitialise); + CreateServiceFunction(MS_QUOTES_EXPORT, Quotes_Export); + CreateServiceFunction(MS_QUOTES_IMPORT, Quotes_Import); return 0; } __declspec(dllexport) int Unload(void) { - std::for_each(g_ahServices.begin(), g_ahServices.end(), boost::bind(Quotes_DestroyServiceFunction, _1)); - std::for_each(g_ahEvents.begin(), g_ahEvents.end(), boost::bind(Quotes_UnhookEvent, _1)); - std::for_each(g_ahMenus.begin(), g_ahMenus.end(), boost::bind(Quotes_RemoveMenuItem, _1)); - WaitForWorkingThreads(); ::CloseHandle(g_hEventWorkThreadStop); diff --git a/plugins/Quotes/src/ImportExport.cpp b/plugins/Quotes/src/ImportExport.cpp index c0950673fc..af8faee952 100644 --- a/plugins/Quotes/src/ImportExport.cpp +++ b/plugins/Quotes/src/ImportExport.cpp @@ -791,7 +791,6 @@ INT_PTR Quotes_Import(WPARAM wp, LPARAM lp) return 1; } -#ifdef TEST_IMPORT_EXPORT INT_PTR QuotesMenu_ImportAll(WPARAM, LPARAM) { return CallService(MS_QUOTES_IMPORT, 0, 0); @@ -801,5 +800,3 @@ INT_PTR QuotesMenu_ExportAll(WPARAM, LPARAM) { return CallService(MS_QUOTES_EXPORT, 0, 0); } -#endif - diff --git a/plugins/Quotes/src/ImportExport.h b/plugins/Quotes/src/ImportExport.h index a04ac64eca..1d4043210a 100644 --- a/plugins/Quotes/src/ImportExport.h +++ b/plugins/Quotes/src/ImportExport.h @@ -4,8 +4,6 @@ INT_PTR Quotes_Export(WPARAM wp, LPARAM lp); INT_PTR Quotes_Import(WPARAM wp, LPARAM lp); -#ifdef TEST_IMPORT_EXPORT INT_PTR QuotesMenu_ImportAll(WPARAM wp, LPARAM lp); INT_PTR QuotesMenu_ExportAll(WPARAM wp, LPARAM lp); -#endif #endif //__F86374E6_713C_4600_85FB_903A5CDF7251_IMPORT_EXPORT_H__ diff --git a/plugins/Quotes/src/stdafx.h b/plugins/Quotes/src/stdafx.h index 9e624a9556..25a7a074fd 100644 --- a/plugins/Quotes/src/stdafx.h +++ b/plugins/Quotes/src/stdafx.h @@ -5,7 +5,6 @@ #pragma once -#define TEST_IMPORT_EXPORT //#define CHART_IMPLEMENT #define _CRT_SECURE_NO_WARNINGS #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers -- cgit v1.2.3