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/SimpleStatusMsg/commonheaders.h | 1 - plugins/SimpleStatusMsg/main.cpp | 41 ++++----------------------------- 2 files changed, 5 insertions(+), 37 deletions(-) (limited to 'plugins/SimpleStatusMsg') diff --git a/plugins/SimpleStatusMsg/commonheaders.h b/plugins/SimpleStatusMsg/commonheaders.h index c509588ec4..13ddbceef8 100644 --- a/plugins/SimpleStatusMsg/commonheaders.h +++ b/plugins/SimpleStatusMsg/commonheaders.h @@ -55,7 +55,6 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "../../protocols/IcqOscarJ/icq_constants.h" #include "m_fortunemsg.h" #include "m_statusplugins.h" -#include "m_toolbar.h" #include "m_toptoolbar.h" #include "m_updater.h" #include "m_variables.h" diff --git a/plugins/SimpleStatusMsg/main.cpp b/plugins/SimpleStatusMsg/main.cpp index 53abdacbbb..4cda8ebc3a 100644 --- a/plugins/SimpleStatusMsg/main.cpp +++ b/plugins/SimpleStatusMsg/main.cpp @@ -1599,36 +1599,18 @@ VOID CALLBACK UpdateMsgTimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD d static int AddTopToolbarButton(WPARAM wParam, LPARAM lParam) { TTBButton ttbb = {0}; - ttbb.cbSize = sizeof(ttbb); - ttbb.hIconUp = ttbb.hIconDn = LoadIconEx("csmsg"); + ttbb.hIconHandleDn = ttbb.hIconHandleUp = GetIconHandle(IDI_CSMSG); ttbb.pszService = MS_SIMPLESTATUSMSG_SHOWDIALOGINT; - ttbb.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP; - ttbb.name = Translate("Change Status Message"); - hTTBButton = (HANDLE)CallService(MS_TTB_ADDBUTTON, (WPARAM)&ttbb, 0); + ttbb.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP | TTBBF_ICONBYHANDLE; + ttbb.name = LPGEN("Change Status Message"); + ttbb.pszTooltipUp = LPGEN("Change Status Message"); + hTTBButton = TopToolbar_AddButton(&ttbb); - if (hTTBButton != (HANDLE)-1) - CallService(MS_TTB_SETBUTTONOPTIONS, MAKEWPARAM((WORD)TTBO_TIPNAME, (WORD)hTTBButton), (LPARAM)Translate("Change Status Message")); ReleaseIconEx("csmsg"); - return 0; } -void AddToolbarButton(void) -{ - TBButton tbb = {0}; - - tbb.cbSize = sizeof(tbb); - tbb.tbbFlags = TBBF_VISIBLE | TBBF_SHOWTOOLTIP; - tbb.pszButtonID = "sachmsg_btn"; - tbb.pszButtonName = Translate("Change Status Message"); - tbb.pszServiceName = MS_SIMPLESTATUSMSG_SHOWDIALOGINT; - tbb.pszTooltipUp = Translate("Change Status Message"); - tbb.hPrimaryIconHandle = GetIconHandle(IDI_CSMSG); - tbb.defPos = 11000; - CallService(MS_TB_ADDBUTTON, 0, (LPARAM)&tbb); -} - void RegisterHotkey(void) { HOTKEYDESC hkd = {0}; @@ -1643,16 +1625,6 @@ void RegisterHotkey(void) Hotkey_Register(&hkd); } -static int OnIconsChanged(WPARAM wParam, LPARAM lParam) -{ - if (hTTBButton) - { - CallService(MS_TTB_REMOVEBUTTON, (WPARAM)hTTBButton, (LPARAM)0); - AddTopToolbarButton(0, 0); - } - return 0; -} - static int ChangeStatusMsgPrebuild(WPARAM wParam, LPARAM lParam) { #ifdef _DEBUG @@ -2009,14 +1981,11 @@ static int OnModulesLoaded(WPARAM wParam, LPARAM lParam) #endif IconsInit(); - HookEventEx(ME_SKIN2_ICONSCHANGED, OnIconsChanged); OnAccListChanged(0, 0); LoadAwayMsgModule(); HookEventEx(ME_TTB_MODULELOADED, AddTopToolbarButton); - if (ServiceExists(MS_TB_ADDBUTTON)) - AddToolbarButton(); RegisterHotkey(); -- cgit v1.2.3