From f9c7760f54c279327a977b0cb5ee028c8f0c0bfb Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 1 Dec 2016 20:51:42 +0300 Subject: more fixes --- plugins/TranslitSwitcher/src/TranslitSwitcher.cpp | 81 +++++++---------------- 1 file changed, 24 insertions(+), 57 deletions(-) (limited to 'plugins/TranslitSwitcher/src/TranslitSwitcher.cpp') diff --git a/plugins/TranslitSwitcher/src/TranslitSwitcher.cpp b/plugins/TranslitSwitcher/src/TranslitSwitcher.cpp index 497e429a3d..21bdd2b69e 100644 --- a/plugins/TranslitSwitcher/src/TranslitSwitcher.cpp +++ b/plugins/TranslitSwitcher/src/TranslitSwitcher.cpp @@ -80,63 +80,31 @@ INT_PTR ServiceInvert(WPARAM, LPARAM lParam) int OnModulesLoaded(WPARAM, LPARAM) { HookEvent(ME_MSG_BUTTONPRESSED, OnButtonPressed); - if (ServiceExists(MS_BB_ADDBUTTON)) { - Icon_Register(hInst, "TabSRMM/TranslitSwitcher", iconList, _countof(iconList)); - - BBButton bbd = { 0 }; - bbd.cbSize = sizeof(BBButton); - bbd.bbbFlags = BBBF_ISIMBUTTON | BBBF_ISCHATBUTTON | BBBF_ISRSIDEBUTTON; - bbd.pszModuleName = "Switch Layout and Send"; - bbd.pwszTooltip = TranslateT("Switch Layout and Send"); - bbd.hIcon = iconList[0].hIcolib; - bbd.dwButtonID = 1; - bbd.dwDefPos = 30; - CallService(MS_BB_ADDBUTTON, 0, (LPARAM)&bbd); - - bbd.pszModuleName = "Translit and Send"; - bbd.pwszTooltip = TranslateT("Translit and Send"); - bbd.hIcon = iconList[1].hIcolib; - bbd.dwButtonID = 1; - bbd.dwDefPos = 40; - CallService(MS_BB_ADDBUTTON, 0, (LPARAM)&bbd); - - bbd.pszModuleName = "Invert Case and Send"; - bbd.pwszTooltip = TranslateT("Invert Case and Send"); - bbd.hIcon = iconList[2].hIcolib; - bbd.dwButtonID = 1; - bbd.dwDefPos = 50; - CallService(MS_BB_ADDBUTTON, 0, (LPARAM)&bbd); - } - return 0; -} -int OnPreShutdown(WPARAM, 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.pwszTooltip = 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.pwszTooltip = 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.pwszTooltip = TranslateT("Invert Case and Send"); - bbd.hIcon = iconList[2].hIcolib; - bbd.dwButtonID = 1; - bbd.dwDefPos = 50; - CallService(MS_BB_REMOVEBUTTON, 0, (LPARAM)&bbd); - } + Icon_Register(hInst, "TabSRMM/TranslitSwitcher", iconList, _countof(iconList)); + + BBButton bbd = {}; + bbd.bbbFlags = BBBF_ISIMBUTTON | BBBF_ISCHATBUTTON | BBBF_ISRSIDEBUTTON; + bbd.pszModuleName = "Switch Layout and Send"; + bbd.pwszTooltip = TranslateT("Switch Layout and Send"); + bbd.hIcon = iconList[0].hIcolib; + bbd.dwButtonID = 1; + bbd.dwDefPos = 30; + Srmm_AddButton(&bbd); + + bbd.pszModuleName = "Translit and Send"; + bbd.pwszTooltip = TranslateT("Translit and Send"); + bbd.hIcon = iconList[1].hIcolib; + bbd.dwButtonID = 1; + bbd.dwDefPos = 40; + Srmm_AddButton(&bbd); + + bbd.pszModuleName = "Invert Case and Send"; + bbd.pwszTooltip = TranslateT("Invert Case and Send"); + bbd.hIcon = iconList[2].hIcolib; + bbd.dwButtonID = 1; + bbd.dwDefPos = 50; + Srmm_AddButton(&bbd); return 0; } @@ -151,7 +119,6 @@ extern "C" __declspec(dllexport) int Load(void) CreateServiceFunction(MS_TS_INVERTCASE, ServiceInvert); HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded); - HookEvent(ME_SYSTEM_PRESHUTDOWN, OnPreShutdown); HOTKEYDESC hkd = { sizeof(hkd) }; hkd.dwFlags = HKD_UNICODE; -- cgit v1.2.3