From c661d1479bbbe836f143c333d6643bcc6faa2393 Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Fri, 5 Apr 2013 13:06:29 +0000 Subject: added removing buttons when plugin unloads (fixed #302) git-svn-id: http://svn.miranda-ng.org/main/trunk@4315 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/TranslitSwitcher/src/TranslitSwitcher.cpp | 31 +++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/plugins/TranslitSwitcher/src/TranslitSwitcher.cpp b/plugins/TranslitSwitcher/src/TranslitSwitcher.cpp index 71ea12157a..7e6afc2bcc 100644 --- a/plugins/TranslitSwitcher/src/TranslitSwitcher.cpp +++ b/plugins/TranslitSwitcher/src/TranslitSwitcher.cpp @@ -164,6 +164,36 @@ int OnModulesLoaded(WPARAM wParam, LPARAM lParam) return 0; } +int OnPreShutdown(WPARAM wParam, LPARAM lParam) +{ + if (ServiceExists(MS_BB_REMOVEBUTTON)) { + BBButton bbd = {0}; + bbd.cbSize = sizeof(BBButton); + bbd.bbbFlags = BBBF_ISIMBUTTON | BBBF_ISCHATBUTTON | BBBF_ISRSIDEBUTTON; + bbd.pszModuleName = "Switch Layout and Send"; + bbd.ptszTooltip = TranslateT("Switch Layout and Send"); + bbd.hIcon = iconList[0].hIcolib; + bbd.dwButtonID = 1; + bbd.dwDefPos = 30; + CallService(MS_BB_REMOVEBUTTON, 0, (LPARAM)&bbd); + + bbd.pszModuleName = "Translit and Send"; + bbd.ptszTooltip = TranslateT("Translit and Send"); + bbd.hIcon = iconList[1].hIcolib; + bbd.dwButtonID = 1; + bbd.dwDefPos = 40; + CallService(MS_BB_REMOVEBUTTON, 0, (LPARAM)&bbd); + + bbd.pszModuleName = "Invert Case and Send"; + bbd.ptszTooltip = TranslateT("Invert Case and Send"); + bbd.hIcon = iconList[2].hIcolib; + bbd.dwButtonID = 1; + bbd.dwDefPos = 50; + CallService(MS_BB_REMOVEBUTTON, 0, (LPARAM)&bbd); + + } + return 0; +} //------------------------------------------------------------------------------------------------------- extern "C" __declspec(dllexport) int Load(void) @@ -171,6 +201,7 @@ extern "C" __declspec(dllexport) int Load(void) mir_getLP(&pluginInfoEx); HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded); + HookEvent(ME_SYSTEM_PRESHUTDOWN, OnPreShutdown); return 0; } -- cgit v1.2.3