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 --- protocols/JabberG/jabber.cpp | 4 ++-- protocols/JabberG/jabber.h | 2 +- protocols/JabberG/jabber_menu.cpp | 35 ++++++++++++++++------------------- protocols/YAMN/main.cpp | 2 +- protocols/YAMN/services.cpp | 31 +++++++------------------------ protocols/YAMN/yamn.cpp | 3 +-- protocols/YAMN/yamn.h | 3 +-- 7 files changed, 29 insertions(+), 51 deletions(-) (limited to 'protocols') diff --git a/protocols/JabberG/jabber.cpp b/protocols/JabberG/jabber.cpp index 33674a3a9e..9c687789b3 100644 --- a/protocols/JabberG/jabber.cpp +++ b/protocols/JabberG/jabber.cpp @@ -33,7 +33,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "m_assocmgr.h" #include "m_folders.h" -#include "m_toolbar.h" +#include "m_toptoolbar.h" #include "m_extraicons.h" HINSTANCE hInst; @@ -258,7 +258,7 @@ extern "C" int __declspec( dllexport ) Load() g_IconsInit(); g_MenuInit(); hModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded); - hModulesLoadedTB = HookEvent(ME_TB_MODULELOADED, g_OnModernToolbarInit); + hModulesLoadedTB = HookEvent(ME_TTB_MODULELOADED, g_OnToolbarInit); JabberUserInfoInit(); return 0; diff --git a/protocols/JabberG/jabber.h b/protocols/JabberG/jabber.h index 4fd50d6d78..745650b8ce 100644 --- a/protocols/JabberG/jabber.h +++ b/protocols/JabberG/jabber.h @@ -653,7 +653,7 @@ int lstrcmp_null(const TCHAR *s1, const TCHAR *s2); void g_MenuInit(); void g_MenuUninit(); -int g_OnModernToolbarInit(WPARAM, LPARAM); +int g_OnToolbarInit(WPARAM, LPARAM); //---- jabber_misc.c ------------------------------------------------ diff --git a/protocols/JabberG/jabber_menu.cpp b/protocols/JabberG/jabber_menu.cpp index 963d5d4219..0415b0a8ce 100644 --- a/protocols/JabberG/jabber_menu.cpp +++ b/protocols/JabberG/jabber_menu.cpp @@ -32,7 +32,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include -#include "m_toolbar.h" +#include "m_toptoolbar.h" #define MENUITEM_LASTSEEN 1 #define MENUITEM_SERVER 2 @@ -974,35 +974,32 @@ static INT_PTR g_ToolbarHandleServiceDiscovery(WPARAM w, LPARAM l) return 0; } -int g_OnModernToolbarInit(WPARAM, LPARAM) +int g_OnToolbarInit(WPARAM, LPARAM) { if ( g_Instances.getCount() == 0 ) return 0; - TBButton button = {0}; + TTBButton button = {0}; button.cbSize = sizeof(button); - button.defPos = 1000; - button.tbbFlags = TBBF_SHOWTOOLTIP|TBBF_VISIBLE; + button.dwFlags = TTBBF_SHOWTOOLTIP|TTBBF_VISIBLE; List_InsertPtr( &arServices, CreateServiceFunction("JABBER/*/Groupchat", g_ToolbarHandleJoinGroupchat )); - button.pszButtonID = button.pszServiceName = "JABBER/*/Groupchat"; - button.pszTooltipUp = button.pszTooltipUp = button.pszButtonName = "Join conference"; - button.hSecondaryIconHandle = button.hPrimaryIconHandle = (HANDLE)g_GetIconHandle(IDI_GROUP); - JCallService(MS_TB_ADDBUTTON, 0, (LPARAM)&button); + button.pszService = "JABBER/*/Groupchat"; + button.pszTooltipUp = button.pszTooltipUp = button.name = "Join conference"; + button.hIconHandleDn = button.hIconHandleUp = (HANDLE)g_GetIconHandle(IDI_GROUP); + TopToolbar_AddButton(&button); List_InsertPtr( &arServices, CreateServiceFunction("JABBER/*/Bookmarks", g_ToolbarHandleBookmarks )); - button.pszButtonID = button.pszServiceName = "JABBER/*/Bookmarks"; - button.pszTooltipUp = button.pszTooltipUp = button.pszButtonName = "Open bookmarks"; - button.hSecondaryIconHandle = button.hPrimaryIconHandle = (HANDLE)g_GetIconHandle(IDI_BOOKMARKS); - button.defPos++; - JCallService(MS_TB_ADDBUTTON, 0, (LPARAM)&button); + button.pszService = "JABBER/*/Bookmarks"; + button.pszTooltipUp = button.pszTooltipUp = button.name = "Open bookmarks"; + button.hIconHandleDn = button.hIconHandleUp = (HANDLE)g_GetIconHandle(IDI_BOOKMARKS); + TopToolbar_AddButton(&button); List_InsertPtr( &arServices, CreateServiceFunction("JABBER/*/ServiceDiscovery", g_ToolbarHandleServiceDiscovery )); - button.pszButtonID = button.pszServiceName = "JABBER/*/ServiceDiscovery"; - button.pszTooltipUp = button.pszTooltipUp = button.pszButtonName = "Service discovery"; - button.hSecondaryIconHandle = button.hPrimaryIconHandle = (HANDLE)g_GetIconHandle(IDI_SERVICE_DISCOVERY); - button.defPos++; - JCallService(MS_TB_ADDBUTTON, 0, (LPARAM)&button); + button.pszService = "JABBER/*/ServiceDiscovery"; + button.pszTooltipUp = button.pszTooltipUp = button.name = "Service discovery"; + button.hIconHandleDn = button.hIconHandleUp = (HANDLE)g_GetIconHandle(IDI_SERVICE_DISCOVERY); + TopToolbar_AddButton(&button); return 0; } diff --git a/protocols/YAMN/main.cpp b/protocols/YAMN/main.cpp index 267d0db355..978a2fa233 100644 --- a/protocols/YAMN/main.cpp +++ b/protocols/YAMN/main.cpp @@ -53,7 +53,7 @@ PLUGININFOEX pluginInfo = { HANDLE hNewMailHook; HANDLE NoWriterEV; -HANDLE hTTButton, hTButton; +HANDLE hTTButton; UINT SecTimer; diff --git a/protocols/YAMN/services.cpp b/protocols/YAMN/services.cpp index 48e38ea4d4..616b6ce9a9 100644 --- a/protocols/YAMN/services.cpp +++ b/protocols/YAMN/services.cpp @@ -308,40 +308,24 @@ HBITMAP LoadBmpFromIcon(HICON hIcon) int AddTopToolbarIcon(WPARAM,LPARAM) { if ( DBGetContactSettingByte(NULL, YAMN_DBMODULE, YAMN_TTBFCHECK, 1)) { - if ( ServiceExists(MS_TTB_ADDBUTTON) && hTTButton == NULL) { + if ( ServiceExists(MS_TTB_REMOVEBUTTON) && hTTButton == NULL) { TTBButton btn = { 0 }; - btn.cbSize = sizeof(TTBButton); + btn.cbSize = sizeof(btn); btn.pszService = MS_YAMN_FORCECHECK; btn.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP | TTBBF_ICONBYHANDLE; - btn.name = Translate("Check mail"); + btn.name = "Check mail"; btn.hIconHandleUp = g_GetIconHandle(5); btn.hIconHandleDn = g_GetIconHandle(6); - hTTButton = (HANDLE)CallService(MS_TTB_ADDBUTTON, (WPARAM)&btn, 0); - CallService(MS_TTB_SETBUTTONOPTIONS, MAKEWPARAM((WORD)TTBO_TIPNAME, (WORD)hTTButton), (LPARAM)Translate("Check mail")); - } - if ( ServiceExists(MS_TB_ADDBUTTON) && hTButton == NULL) { - TBButton btn = { 0 }; - btn.cbSize = sizeof(TBButton); - btn.pszServiceName = MS_YAMN_FORCECHECK; - btn.tbbFlags = TBBF_VISIBLE | TBBF_SHOWTOOLTIP; - btn.defPos = 10114; - btn.pszButtonID = "yamn_btn"; - btn.pszButtonName = "Check mail"; - btn.hPrimaryIconHandle = g_GetIconHandle(5); - btn.hSecondaryIconHandle = g_GetIconHandle(6); btn.pszTooltipDn = btn.pszTooltipUp = "Check mail"; - hTButton = (HANDLE)CallService(MS_TB_ADDBUTTON, 0, (WPARAM)&btn); + hTTButton = TopToolbar_AddButton(&btn); } } else { - if (ServiceExists(MS_TTB_ADDBUTTON) && hTTButton != NULL) { + if (hTTButton != NULL) { CallService(MS_TTB_REMOVEBUTTON, (WPARAM)hTTButton, 0); hTTButton = NULL; } - if (ServiceExists(MS_TB_ADDBUTTON) && hTButton != NULL) { - CallService(MS_TB_REMOVEBUTTON, (WPARAM)hTButton, 0); - hTButton = NULL; - } } + } return 0; } @@ -369,8 +353,7 @@ int SystemModulesLoaded(WPARAM, LPARAM); //in main.cpp typedef struct { HANDLE hookHandle; const char *hookName; MIRANDAHOOK mirandaFunction;} HookDataType; static HookDataType hookData[] = { {0, ME_SYSTEM_MODULESLOADED, SystemModulesLoaded}, //pop3 plugin must be included after all miranda modules are loaded - {0, ME_TB_MODULELOADED, AddTopToolbarIcon}, - {0, ME_TTB_MODULELOADED, AddTopToolbarIcon}, + {0, ME_TTB_MODULELOADED, AddTopToolbarIcon}, {0, ME_OPT_INITIALISE, YAMNOptInitSvc}, {0, ME_SYSTEM_PRESHUTDOWN, Shutdown}, {0, ME_CLIST_DOUBLECLICKED, Service_ContactDoubleclicked}, diff --git a/protocols/YAMN/yamn.cpp b/protocols/YAMN/yamn.cpp index c1ffda847a..c93225e609 100644 --- a/protocols/YAMN/yamn.cpp +++ b/protocols/YAMN/yamn.cpp @@ -328,7 +328,6 @@ INT_PTR ForceCheckSvc(WPARAM, LPARAM) LeaveCriticalSection(&PluginRegCS); CloseHandle(ThreadRunningEV); - if ( hTTButton ) CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)hTTButton, TTBST_RELEASED); - if ( hTButton ) CallService(MS_TB_SETBUTTONSTATE, (WPARAM)hTButton, TBST_RELEASED); + if (hTTButton) CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)hTTButton, TTBST_RELEASED); return 1; } diff --git a/protocols/YAMN/yamn.h b/protocols/YAMN/yamn.h index 4bb8d149e4..8cec3eda86 100644 --- a/protocols/YAMN/yamn.h +++ b/protocols/YAMN/yamn.h @@ -32,7 +32,6 @@ #include "m_protomod.h" //protocols module #include "m_protosvc.h" #include "m_toptoolbar.h" -#include "m_toolbar.h" #include "m_icolib.h" #include "m_kbdnotify.h" #include "m_popup.h" @@ -190,7 +189,7 @@ extern CRITICAL_SECTION PluginRegCS; extern YAMN_VARIABLES YAMNVar; extern HANDLE hNewMailHook; extern HANDLE WriteToFileEV; -extern HANDLE hTTButton, hTButton; +extern HANDLE hTTButton; extern HCURSOR hCurSplitNS, hCurSplitWE; extern UINT SecTimer; -- cgit v1.2.3