From 696f4ea57845f48d6d979ecd9d66bb22bd9f738d Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 8 Jul 2012 20:51:14 +0000 Subject: TopToolbar usage fixed everywhere git-svn-id: http://svn.miranda-ng.org/main/trunk@861 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/FavContacts/src/headers.h | 4 +--- plugins/FavContacts/src/main.cpp | 24 +++++++++--------------- 2 files changed, 10 insertions(+), 18 deletions(-) (limited to 'plugins/FavContacts/src') diff --git a/plugins/FavContacts/src/headers.h b/plugins/FavContacts/src/headers.h index 59d3693926..5e9771fd6e 100644 --- a/plugins/FavContacts/src/headers.h +++ b/plugins/FavContacts/src/headers.h @@ -52,14 +52,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include #include -#include +#include #include #include #include "../resource.h" -#define NEWTSTR_ALLOCA(A) (A==NULL)?NULL:_tcscpy((TCHAR*)alloca(sizeof(TCHAR)*(_tcslen(A)+1)),A) - struct Options { BYTE bSecondLine; diff --git a/plugins/FavContacts/src/main.cpp b/plugins/FavContacts/src/main.cpp index d1bfd4ee2a..7f844cbeb0 100644 --- a/plugins/FavContacts/src/main.cpp +++ b/plugins/FavContacts/src/main.cpp @@ -121,20 +121,16 @@ static __forceinline COLORREF sttShadeColor(COLORREF clLine1, COLORREF clBack) ); } -HANDLE hhkProcessTBLoaded = NULL; int ProcessTBLoaded(WPARAM wParam, LPARAM lParam) { - TBButton button = {0}; + TTBButton button = {0}; button.cbSize = sizeof(button); - button.pszButtonID = "FavContacts/ShowMenu"; button.pszTooltipUp = button.pszTooltipUp = - button.pszButtonName = "Favourite Contacts"; - button.pszServiceName = MS_FAVCONTACTS_SHOWMENU; - button.defPos = 200; - button.tbbFlags = TBBF_SHOWTOOLTIP|TBBF_VISIBLE; - button.hSecondaryIconHandle = button.hPrimaryIconHandle = (HANDLE)g_icoFavourite; - CallService(MS_TB_ADDBUTTON, 0, (LPARAM)&button); - + button.name = LPGEN("Favourite Contacts"); + button.pszService = MS_FAVCONTACTS_SHOWMENU; + button.dwFlags = TTBBF_SHOWTOOLTIP | TTBBF_VISIBLE; + button.hIconHandleDn = button.hIconHandleUp = (HANDLE)g_icoFavourite; + TopToolbar_AddButton(&button); return 0; } @@ -177,6 +173,8 @@ int ProcessReloadFonts(WPARAM wParam, LPARAM lParam) int ProcessModulesLoaded(WPARAM wParam, LPARAM lParam) { + HookEvent(ME_TTB_MODULELOADED, ProcessTBLoaded); + if (ServiceExists(MS_MSG_ADDICON)) { StatusIconData sid = {0}; sid.cbSize = sizeof(sid); @@ -263,16 +261,13 @@ int ProcessModulesLoaded(WPARAM wParam, LPARAM lParam) hotkey.DefHotKey = MAKEWORD('Q', HOTKEYF_EXT); Hotkey_Register(&hotkey); - if (ServiceExists(MS_AV_GETAVATARBITMAP)) - { + if (ServiceExists(MS_AV_GETAVATARBITMAP)) { HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); for ( ; hContact; hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0)) if (DBGetContactSettingByte(hContact, "FavContacts", "IsFavourite", 0)) CallService(MS_AV_GETAVATARBITMAP, (WPARAM)hContact, 0); } - if (!hhkProcessTBLoaded) hhkProcessTBLoaded = HookEvent(ME_TB_MODULELOADED, ProcessTBLoaded); - return 0; } @@ -327,7 +322,6 @@ extern "C" __declspec(dllexport) int Load(void) HookEvent(ME_OPT_INITIALISE, ProcessOptInitialise); HookEvent(ME_SYSTEM_MODULESLOADED, ProcessModulesLoaded); - hhkProcessTBLoaded = HookEvent(ME_TB_MODULELOADED, ProcessTBLoaded); ///////////////////////////////////////////////////////////////////////////////////// -- cgit v1.2.3