diff options
author | George Hazan <george.hazan@gmail.com> | 2012-07-08 20:51:14 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-07-08 20:51:14 +0000 |
commit | 696f4ea57845f48d6d979ecd9d66bb22bd9f738d (patch) | |
tree | c32ac05d363bff47320c1b204561b966aa1c81fd /plugins/BossKeyPlus | |
parent | 3b396a2da6b0b8e0f4d2c051aca133772d317820 (diff) |
TopToolbar usage fixed everywhere
git-svn-id: http://svn.miranda-ng.org/main/trunk@861 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/BossKeyPlus')
-rw-r--r-- | plugins/BossKeyPlus/BossKey.cpp | 45 | ||||
-rw-r--r-- | plugins/BossKeyPlus/BossKey.h | 6 |
2 files changed, 20 insertions, 31 deletions
diff --git a/plugins/BossKeyPlus/BossKey.cpp b/plugins/BossKeyPlus/BossKey.cpp index e19c7bc094..b61d3f3624 100644 --- a/plugins/BossKeyPlus/BossKey.cpp +++ b/plugins/BossKeyPlus/BossKey.cpp @@ -34,7 +34,6 @@ HINSTANCE g_hInstance;
CLIST_INTERFACE *pcli;
HANDLE g_hmGenMenuInit, g_hIcon, g_hMenuItem, g_hHideService, g_hIsHiddenService;
-HANDLE g_hHooks[7];
HWINEVENTHOOK g_hWinHook;
HWND g_hListenWindow, hDlg, g_hDlgPass, hOldForegroundWindow;
HWND_ITEM *g_pMirWnds; // a pretty simple linked list
@@ -685,15 +684,13 @@ void RegisterCoreHotKeys (void) static int ModernToolbarInit(WPARAM, LPARAM) // Modern toolbar support
{
- TBButton button = {0};
+ TTBButton button = {0};
button.cbSize = sizeof(button);
- button.pszServiceName = MS_BOSSKEY_HIDE;
- button.pszButtonID = MOD_NAME;
- button.pszTooltipUp = button.pszTooltipDn = button.pszButtonName = "Hide Miranda IM";
- button.defPos = 1099;
- button.tbbFlags = TBBF_DISABLED|TBBF_SHOWTOOLTIP;
- button.hPrimaryIconHandle = button.hSecondaryIconHandle = g_hIcon;
- CallService(MS_TB_ADDBUTTON, 0, (LPARAM)&button);
+ button.pszService = MS_BOSSKEY_HIDE;
+ button.pszTooltipUp = button.pszTooltipDn = button.name = LPGEN("Hide Miranda IM");
+ button.dwFlags = TTBBF_DISABLED|TTBBF_SHOWTOOLTIP;
+ button.hIconHandleUp = button.hIconHandleDn = g_hIcon;
+ TopToolbar_AddButton(&button);
return 0;
}
@@ -755,16 +752,14 @@ int MirandaLoaded(WPARAM wParam,LPARAM lParam) RegisterCoreHotKeys();
+ g_hWinHook = SetWinEventHook(EVENT_OBJECT_CREATE, EVENT_OBJECT_SHOW,
+ NULL, WinEventProc, GetCurrentProcessId(), 0, 0);
- g_hWinHook = SetWinEventHook(EVENT_OBJECT_CREATE, EVENT_OBJECT_SHOW,
- NULL, WinEventProc, GetCurrentProcessId(), 0, 0);
-
- g_hHooks[0] = HookEvent(ME_OPT_INITIALISE,OptsDlgInit);
- g_hHooks[1] = HookEvent(ME_MSG_WINDOWEVENT,MsgWinOpening);
- g_hHooks[2] = HookEvent(ME_PROTO_ACCLISTCHANGED, EnumProtos);
- g_hHooks[3] = HookEvent(ME_MSG_TOOLBARLOADED, TabsrmmButtonsInit);
- if (g_hHooks[3])
- g_hHooks[4] = HookEvent(ME_MSG_BUTTONPRESSED, TabsrmmButtonPressed);
+ HookEvent(ME_OPT_INITIALISE,OptsDlgInit);
+ HookEvent(ME_MSG_WINDOWEVENT,MsgWinOpening);
+ HookEvent(ME_PROTO_ACCLISTCHANGED, EnumProtos);
+ HookEvent(ME_MSG_TOOLBARLOADED, TabsrmmButtonsInit);
+ HookEvent(ME_MSG_BUTTONPRESSED, TabsrmmButtonPressed);
pcli = (CLIST_INTERFACE *)CallService(MS_CLIST_RETRIEVE_INTERFACE, 0, (LPARAM)g_hInstance);
#if defined _DEBUG
@@ -876,23 +871,17 @@ extern "C" int __declspec(dllexport) Load(void) }
IcoLibInit();
- g_hHooks[5] = HookEvent(ME_SYSTEM_MODULESLOADED,MirandaLoaded);
+
g_hHideService = CreateServiceFunction(MS_BOSSKEY_HIDE,BossKeyHideMiranda); // Create service
- g_hHooks[6] = HookEvent(ME_TB_MODULELOADED, ModernToolbarInit); // Toolbar hook
+
+ HookEvent(ME_SYSTEM_MODULESLOADED,MirandaLoaded);
+ HookEvent(ME_TTB_MODULELOADED, ModernToolbarInit);
return 0;
}
-
-
extern "C" int __declspec(dllexport) Unload(void)
{
UninitIdleTimer();
- // nice boys and girls always unhook events :)
- for (int i = 0; i < SIZEOF(g_hHooks); i++)
- {
- if (g_hHooks[i])
- UnhookEvent(g_hHooks[i]);
- }
if(g_hmGenMenuInit)
UnhookEvent(g_hmGenMenuInit);
diff --git a/plugins/BossKeyPlus/BossKey.h b/plugins/BossKeyPlus/BossKey.h index f79e68a445..ac5cb38dad 100644 --- a/plugins/BossKeyPlus/BossKey.h +++ b/plugins/BossKeyPlus/BossKey.h @@ -51,9 +51,9 @@ #include <m_clistint.h>
#include <m_message.h>
#include <m_hotkeys.h>
-#include "m_trigger.h"
-#include "m_variables.h"
-#include "m_toolbar.h"
+#include <m_trigger.h>
+#include <m_variables.h>
+#include <m_toptoolbar.h>
#define MOD_NAME "BossKey"
#define KEY_DOWN(key) ((GetAsyncKeyState(key) & 0x8000) ? (true) : (false))
|