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 --- bin10/mir_full.sln | 27 +++-- plugins/AddContactPlus/src/addcontactplus.h | 2 +- plugins/AddContactPlus/src/main.cpp | 33 +++-- plugins/Alarms/src/alarms.cpp | 11 +- plugins/AutoShutdown/src/settingsdlg.cpp | 6 +- plugins/BASS_interface/src/Bass_interface.h | 2 +- plugins/BASS_interface/src/Main.cpp | 58 ++++----- plugins/BasicHistory/src/BasicHistory.cpp | 61 ++++------ plugins/BasicHistory/src/stdafx.h | 2 +- plugins/BossKeyPlus/BossKey.cpp | 45 +++---- plugins/BossKeyPlus/BossKey.h | 6 +- plugins/Console/Console.cpp | 135 +++++++-------------- plugins/Console/commonheaders.h | 3 +- plugins/ExternalAPI/m_toolbar.h | 88 -------------- plugins/FavContacts/src/headers.h | 4 +- plugins/FavContacts/src/main.cpp | 24 ++-- plugins/ListeningTo/listeningto.cpp | 52 +++----- plugins/NewXstatusNotify/common.h | 2 +- plugins/NewXstatusNotify/main.cpp | 73 +++++------ plugins/Popup/src/headers.h | 1 - plugins/Popup/src/main.cpp | 67 +++------- plugins/RecentContacts/RecentContacts.cpp | 20 ++- plugins/Sessions/Src/Main.cpp | 101 +++++++-------- plugins/Sessions/Src/Sessions.h | 2 +- plugins/SimpleStatusMsg/commonheaders.h | 1 - plugins/SimpleStatusMsg/main.cpp | 41 +------ plugins/StatusPlugins/StartupStatus/options.cpp | 2 +- plugins/StatusPlugins/StartupStatus/profiles.cpp | 9 +- .../StatusPlugins/StartupStatus/startupstatus.h | 5 +- plugins/StatusPlugins/StartupStatus/toolbars.cpp | 83 +------------ plugins/Svc_crshdmp/crshdmp.cpp | 63 ++++------ plugins/Svc_dbepp/main.cpp | 15 +-- plugins/Updater/updater.cpp | 40 +++--- plugins/UserInfoEx/commonheaders.h | 1 - plugins/UserInfoEx/dlg_anniversarylist.cpp | 24 +--- plugins/UserInfoEx/dlg_anniversarylist.h | 1 - plugins/UserInfoEx/init.cpp | 31 +---- plugins/UserInfoEx/svc_reminder.cpp | 34 +----- plugins/UserInfoEx/svc_reminder.h | 1 - plugins/WhenWasIt/hooked_events.cpp | 4 +- plugins/WhoUsesMyFiles/wumfplug.c | 12 +- 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 +- 48 files changed, 388 insertions(+), 884 deletions(-) delete mode 100644 plugins/ExternalAPI/m_toolbar.h diff --git a/bin10/mir_full.sln b/bin10/mir_full.sln index 0096096507..8e9717afab 100644 --- a/bin10/mir_full.sln +++ b/bin10/mir_full.sln @@ -1319,63 +1319,72 @@ Global {D9EFEA4B-B817-4DE1-BD62-68A5DB8F5F60}.Release|x64.Build.0 = Release|x64 {86E0715E-C769-11E1-A41D-6CED6188709B}.Debug|Win32.ActiveCfg = Debug|Win32 {86E0715E-C769-11E1-A41D-6CED6188709B}.Debug|Win32.Build.0 = Debug|Win32 - {86E0715E-C769-11E1-A41D-6CED6188709B}.Debug|x64.ActiveCfg = Debug|Win32 + {86E0715E-C769-11E1-A41D-6CED6188709B}.Debug|x64.ActiveCfg = Debug|x64 + {86E0715E-C769-11E1-A41D-6CED6188709B}.Debug|x64.Build.0 = Debug|x64 {86E0715E-C769-11E1-A41D-6CED6188709B}.Release|Win32.ActiveCfg = Release|Win32 {86E0715E-C769-11E1-A41D-6CED6188709B}.Release|Win32.Build.0 = Release|Win32 {86E0715E-C769-11E1-A41D-6CED6188709B}.Release|x64.ActiveCfg = Release|x64 {86E0715E-C769-11E1-A41D-6CED6188709B}.Release|x64.Build.0 = Release|x64 {A5B558C6-C767-11E1-A335-F6EB6188709B}.Debug|Win32.ActiveCfg = Debug|Win32 {A5B558C6-C767-11E1-A335-F6EB6188709B}.Debug|Win32.Build.0 = Debug|Win32 - {A5B558C6-C767-11E1-A335-F6EB6188709B}.Debug|x64.ActiveCfg = Debug|Win32 + {A5B558C6-C767-11E1-A335-F6EB6188709B}.Debug|x64.ActiveCfg = Debug|x64 + {A5B558C6-C767-11E1-A335-F6EB6188709B}.Debug|x64.Build.0 = Debug|x64 {A5B558C6-C767-11E1-A335-F6EB6188709B}.Release|Win32.ActiveCfg = Release|Win32 {A5B558C6-C767-11E1-A335-F6EB6188709B}.Release|Win32.Build.0 = Release|Win32 {A5B558C6-C767-11E1-A335-F6EB6188709B}.Release|x64.ActiveCfg = Release|x64 {A5B558C6-C767-11E1-A335-F6EB6188709B}.Release|x64.Build.0 = Release|x64 {6022990D-3FD5-46A9-8AB5-E444C51646F3}.Debug|Win32.ActiveCfg = Debug|Win32 {6022990D-3FD5-46A9-8AB5-E444C51646F3}.Debug|Win32.Build.0 = Debug|Win32 - {6022990D-3FD5-46A9-8AB5-E444C51646F3}.Debug|x64.ActiveCfg = Debug|Win32 + {6022990D-3FD5-46A9-8AB5-E444C51646F3}.Debug|x64.ActiveCfg = Debug|x64 + {6022990D-3FD5-46A9-8AB5-E444C51646F3}.Debug|x64.Build.0 = Debug|x64 {6022990D-3FD5-46A9-8AB5-E444C51646F3}.Release|Win32.ActiveCfg = Release|Win32 {6022990D-3FD5-46A9-8AB5-E444C51646F3}.Release|Win32.Build.0 = Release|Win32 {6022990D-3FD5-46A9-8AB5-E444C51646F3}.Release|x64.ActiveCfg = Release|x64 {6022990D-3FD5-46A9-8AB5-E444C51646F3}.Release|x64.Build.0 = Release|x64 {769FAC86-C761-11E1-A66F-0BE76188709B}.Debug|Win32.ActiveCfg = Debug|Win32 {769FAC86-C761-11E1-A66F-0BE76188709B}.Debug|Win32.Build.0 = Debug|Win32 - {769FAC86-C761-11E1-A66F-0BE76188709B}.Debug|x64.ActiveCfg = Debug|Win32 + {769FAC86-C761-11E1-A66F-0BE76188709B}.Debug|x64.ActiveCfg = Debug|x64 + {769FAC86-C761-11E1-A66F-0BE76188709B}.Debug|x64.Build.0 = Debug|x64 {769FAC86-C761-11E1-A66F-0BE76188709B}.Release|Win32.ActiveCfg = Release|Win32 {769FAC86-C761-11E1-A66F-0BE76188709B}.Release|Win32.Build.0 = Release|Win32 {769FAC86-C761-11E1-A66F-0BE76188709B}.Release|x64.ActiveCfg = Release|x64 {769FAC86-C761-11E1-A66F-0BE76188709B}.Release|x64.Build.0 = Release|x64 {A8F23706-E590-4A87-96CC-5F8E5082503F}.Debug|Win32.ActiveCfg = Debug|Win32 {A8F23706-E590-4A87-96CC-5F8E5082503F}.Debug|Win32.Build.0 = Debug|Win32 - {A8F23706-E590-4A87-96CC-5F8E5082503F}.Debug|x64.ActiveCfg = Debug|Win32 + {A8F23706-E590-4A87-96CC-5F8E5082503F}.Debug|x64.ActiveCfg = Debug|x64 + {A8F23706-E590-4A87-96CC-5F8E5082503F}.Debug|x64.Build.0 = Debug|x64 {A8F23706-E590-4A87-96CC-5F8E5082503F}.Release|Win32.ActiveCfg = Release|Win32 {A8F23706-E590-4A87-96CC-5F8E5082503F}.Release|Win32.Build.0 = Release|Win32 {A8F23706-E590-4A87-96CC-5F8E5082503F}.Release|x64.ActiveCfg = Release|x64 {A8F23706-E590-4A87-96CC-5F8E5082503F}.Release|x64.Build.0 = Release|x64 {1C092EC9-0BCC-4C75-AAE9-FCCE9B3E9B3D}.Debug|Win32.ActiveCfg = Debug|Win32 {1C092EC9-0BCC-4C75-AAE9-FCCE9B3E9B3D}.Debug|Win32.Build.0 = Debug|Win32 - {1C092EC9-0BCC-4C75-AAE9-FCCE9B3E9B3D}.Debug|x64.ActiveCfg = Debug|Win32 + {1C092EC9-0BCC-4C75-AAE9-FCCE9B3E9B3D}.Debug|x64.ActiveCfg = Debug|x64 + {1C092EC9-0BCC-4C75-AAE9-FCCE9B3E9B3D}.Debug|x64.Build.0 = Debug|x64 {1C092EC9-0BCC-4C75-AAE9-FCCE9B3E9B3D}.Release|Win32.ActiveCfg = Release|Win32 {1C092EC9-0BCC-4C75-AAE9-FCCE9B3E9B3D}.Release|Win32.Build.0 = Release|Win32 {1C092EC9-0BCC-4C75-AAE9-FCCE9B3E9B3D}.Release|x64.ActiveCfg = Release|x64 {1C092EC9-0BCC-4C75-AAE9-FCCE9B3E9B3D}.Release|x64.Build.0 = Release|x64 {36C40BA6-E0B5-438A-919C-6A991933B313}.Debug|Win32.ActiveCfg = Debug|Win32 {36C40BA6-E0B5-438A-919C-6A991933B313}.Debug|Win32.Build.0 = Debug|Win32 - {36C40BA6-E0B5-438A-919C-6A991933B313}.Debug|x64.ActiveCfg = Debug|Win32 + {36C40BA6-E0B5-438A-919C-6A991933B313}.Debug|x64.ActiveCfg = Debug|x64 + {36C40BA6-E0B5-438A-919C-6A991933B313}.Debug|x64.Build.0 = Debug|x64 {36C40BA6-E0B5-438A-919C-6A991933B313}.Release|Win32.ActiveCfg = Release|Win32 {36C40BA6-E0B5-438A-919C-6A991933B313}.Release|Win32.Build.0 = Release|Win32 {36C40BA6-E0B5-438A-919C-6A991933B313}.Release|x64.ActiveCfg = Release|x64 {36C40BA6-E0B5-438A-919C-6A991933B313}.Release|x64.Build.0 = Release|x64 {DADAC956-3A54-440A-8B56-A07234DEE861}.Debug|Win32.ActiveCfg = Debug|Win32 {DADAC956-3A54-440A-8B56-A07234DEE861}.Debug|Win32.Build.0 = Debug|Win32 - {DADAC956-3A54-440A-8B56-A07234DEE861}.Debug|x64.ActiveCfg = Debug|Win32 + {DADAC956-3A54-440A-8B56-A07234DEE861}.Debug|x64.ActiveCfg = Debug|x64 + {DADAC956-3A54-440A-8B56-A07234DEE861}.Debug|x64.Build.0 = Debug|x64 {DADAC956-3A54-440A-8B56-A07234DEE861}.Release|Win32.ActiveCfg = Release|Win32 {DADAC956-3A54-440A-8B56-A07234DEE861}.Release|Win32.Build.0 = Release|Win32 {DADAC956-3A54-440A-8B56-A07234DEE861}.Release|x64.ActiveCfg = Release|x64 {DADAC956-3A54-440A-8B56-A07234DEE861}.Release|x64.Build.0 = Release|x64 {D22C1BBB-E06A-4A28-8F33-17D1EA3E8563}.Debug|Win32.ActiveCfg = Debug|Win32 {D22C1BBB-E06A-4A28-8F33-17D1EA3E8563}.Debug|Win32.Build.0 = Debug|Win32 - {D22C1BBB-E06A-4A28-8F33-17D1EA3E8563}.Debug|x64.ActiveCfg = Debug|Win32 + {D22C1BBB-E06A-4A28-8F33-17D1EA3E8563}.Debug|x64.ActiveCfg = Debug|x64 + {D22C1BBB-E06A-4A28-8F33-17D1EA3E8563}.Debug|x64.Build.0 = Debug|x64 {D22C1BBB-E06A-4A28-8F33-17D1EA3E8563}.Release|Win32.ActiveCfg = Release|Win32 {D22C1BBB-E06A-4A28-8F33-17D1EA3E8563}.Release|Win32.Build.0 = Release|Win32 {D22C1BBB-E06A-4A28-8F33-17D1EA3E8563}.Release|x64.ActiveCfg = Release|x64 diff --git a/plugins/AddContactPlus/src/addcontactplus.h b/plugins/AddContactPlus/src/addcontactplus.h index 6e9d90e9fd..a42f0d14bb 100644 --- a/plugins/AddContactPlus/src/addcontactplus.h +++ b/plugins/AddContactPlus/src/addcontactplus.h @@ -43,7 +43,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include #include -#include "m_toolbar.h" +#include "m_toptoolbar.h" #include "m_updater.h" #include "m_addcontactplus.h" diff --git a/plugins/AddContactPlus/src/main.cpp b/plugins/AddContactPlus/src/main.cpp index 56d8b0ad1b..de529836c9 100644 --- a/plugins/AddContactPlus/src/main.cpp +++ b/plugins/AddContactPlus/src/main.cpp @@ -108,21 +108,6 @@ static int OnAccListChanged(WPARAM, LPARAM) mi.ptszName = LPGENT("&Add Contact..."); mi.pszService = MS_ADDCONTACTPLUS_SHOW; hMainMenuItem = Menu_AddMainMenuItem(&mi); - - if (ServiceExists(MS_TB_ADDBUTTON)) - { - TBButton tbb = {0}; - - tbb.cbSize = sizeof(TBButton); - tbb.tbbFlags = TBBF_VISIBLE | TBBF_SHOWTOOLTIP; - tbb.pszButtonID = "acplus_btn"; - tbb.pszButtonName = Translate("Add Contact"); - tbb.pszServiceName = MS_ADDCONTACTPLUS_SHOW; - tbb.pszTooltipUp = Translate("Add Contact"); - tbb.hPrimaryIconHandle = hIconLibItem; - tbb.defPos = 10100; - hToolBarItem = (HANDLE)CallService(MS_TB_ADDBUTTON, 0, (LPARAM)&tbb); - } } else { @@ -130,7 +115,7 @@ static int OnAccListChanged(WPARAM, LPARAM) return 0; CallService(MS_CLIST_REMOVEMAINMENUITEM, (WPARAM)hMainMenuItem, 0); - CallService(MS_TB_REMOVEBUTTON, (WPARAM)hToolBarItem, 0); + CallService(MS_TTB_REMOVEBUTTON, (WPARAM)hToolBarItem, 0); hMainMenuItem = 0; } @@ -138,6 +123,19 @@ static int OnAccListChanged(WPARAM, LPARAM) return 0; } +static int CreateButton(WPARAM, LPARAM) +{ + TTBButton tbb = {0}; + tbb.cbSize = sizeof(tbb); + tbb.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP; + tbb.name = "Add Contact"; + tbb.pszService = MS_ADDCONTACTPLUS_SHOW; + tbb.pszTooltipUp = "Add Contact"; + tbb.hIconHandleUp = hIconLibItem; + hToolBarItem = TopToolbar_AddButton(&tbb); + return 0; +} + static int OnModulesLoaded(WPARAM, LPARAM) { if (ServiceExists(MS_UPDATE_REGISTERFL)) @@ -171,7 +169,8 @@ static int OnModulesLoaded(WPARAM, LPARAM) Hotkey_Register(&hkd); OnAccListChanged(0, 0); - + + HookEvent(ME_TTB_MODULELOADED, CreateButton); return 0; } diff --git a/plugins/Alarms/src/alarms.cpp b/plugins/Alarms/src/alarms.cpp index c9305afce2..b139485105 100644 --- a/plugins/Alarms/src/alarms.cpp +++ b/plugins/Alarms/src/alarms.cpp @@ -200,21 +200,20 @@ HBITMAP LoadBmpFromIcon(int IdRes) static int InitTopToolbarButton(WPARAM wParam, LPARAM lParam) { TTBButton ttb = {0}; - ttb.cbSize = sizeof(ttb); ttb.hIconUp = LoadIcon(hInst, MAKEINTRESOURCE(IDI_TBUP)); ttb.hIconDn = LoadIcon(hInst, MAKEINTRESOURCE(IDI_TBDN)); ttb.pszService = MODULE "/NewAlarm"; - ttb.dwFlags = TTBBF_VISIBLE;// | TTBBF_DRAWBORDER; - ttb.name = Translate("Set Alarm"); + ttb.dwFlags = TTBBF_VISIBLE; + ttb.name = "Set Alarm"; - hTopToolbarButton = (HANDLE)CallService(MS_TTB_ADDBUTTON, (WPARAM)&ttb, 0); + hTopToolbarButton = TopToolbar_AddButton(&ttb); CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)hTopToolbarButton, (LPARAM)TTBST_RELEASED); - return 0; } -static int MainInit(WPARAM wparam,LPARAM lparam) { +static int MainInit(WPARAM wparam,LPARAM lparam) +{ if (ServiceExists(MS_UPDATE_REGISTER)) { // register with updater Update update = {0}; diff --git a/plugins/AutoShutdown/src/settingsdlg.cpp b/plugins/AutoShutdown/src/settingsdlg.cpp index 2871c65e33..7c6ff90591 100644 --- a/plugins/AutoShutdown/src/settingsdlg.cpp +++ b/plugins/AutoShutdown/src/settingsdlg.cpp @@ -403,7 +403,7 @@ static INT_PTR ServiceShowSettingsDialog(WPARAM wParam,LPARAM lParam) /************************* Toolbar ************************************/ -static WORD hToolbarButton; +static HANDLE hToolbarButton; static int ToolbarLoaded(WPARAM wParam,LPARAM lParam) { @@ -418,7 +418,7 @@ static int ToolbarLoaded(WPARAM wParam,LPARAM lParam) ttbb.dwFlags=TTBBF_VISIBLE|TTBBF_SHOWTOOLTIP; ttbb.name=Translate("Start/Stop automatic shutdown"); - hToolbarButton=(WORD)CallService(MS_TTB_ADDBUTTON,(WPARAM)&ttbb,0); + hToolbarButton = TopToolbar_AddButton(&ttbb); if(ttbb.hIconUp!=NULL) DestroyIcon(ttbb.hIconUp); if(ttbb.hIconDn!=NULL) DestroyIcon(ttbb.hIconDn); return 0; @@ -427,7 +427,7 @@ static int ToolbarLoaded(WPARAM wParam,LPARAM lParam) void SetShutdownToolbarButton(BOOL fActive) { if(hToolbarButton) { - CallService(MS_TTB_SETBUTTONSTATE,hToolbarButton,fActive?TTBST_PUSHED:TTBST_RELEASED); + CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)hToolbarButton,fActive?TTBST_PUSHED:TTBST_RELEASED); CallService(MS_TTB_SETBUTTONOPTIONS,MAKEWPARAM(TTBO_TIPNAME,hToolbarButton),(LPARAM)(fActive?Translate("Sdop automatic shutdown"):Translate("Start automatic shutdown"))); } } diff --git a/plugins/BASS_interface/src/Bass_interface.h b/plugins/BASS_interface/src/Bass_interface.h index 75585eb693..1058037bea 100644 --- a/plugins/BASS_interface/src/Bass_interface.h +++ b/plugins/BASS_interface/src/Bass_interface.h @@ -18,7 +18,7 @@ Copyright (C) 2010, 2011 tico-tico #include #include -#include "m_toolbar.h" +#include "m_toptoolbar.h" #include "resource.h" #include "version.h" diff --git a/plugins/BASS_interface/src/Main.cpp b/plugins/BASS_interface/src/Main.cpp index 46e1b050e9..218ede544e 100644 --- a/plugins/BASS_interface/src/Main.cpp +++ b/plugins/BASS_interface/src/Main.cpp @@ -20,9 +20,8 @@ PLUGININFOEX pluginInfo={ MIID_BASSINT }; - -static HANDLE hHooks[5] = {0}; static HANDLE hService; +static HANDLE hTBButton; static HINSTANCE hBass = NULL; extern "C" BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved) @@ -239,8 +238,7 @@ INT_PTR CALLBACK OptionsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara device = SendDlgItemMessage(hwndDlg, IDC_OUTDEVICE, CB_GETCURSEL, 0, 0); if (device == 0) device = -1; else device += newBass; - if (CallService(MS_TB_GETBUTTONSTATEBYID, (WPARAM)"BASSSoundOnOff", 0)==TBST_RELEASED) - { + if (CallService(MS_TTB_GETBUTTONSTATE, (WPARAM)hTBButton, 0) == TTBST_RELEASED) { BASS_Free(); BASS_Init(device, 44100, 0, ClistHWND, NULL); BASS_SetConfig(BASS_CONFIG_GVOL_STREAM, Volume * 100 ); @@ -351,9 +349,8 @@ int OptionsInit(WPARAM wParam, LPARAM lParam) INT_PTR BASSSoundOnOff(WPARAM wParam, LPARAM lParam) { - if (hBass != NULL) - { - BOOL opened = CallService(MS_TB_GETBUTTONSTATEBYID, (WPARAM)"BASSSoundOnOff", 0) == TBST_RELEASED; + if (hBass != NULL) { + BOOL opened = CallService(MS_TTB_GETBUTTONSTATE, (WPARAM)"BASSSoundOnOff", 0) == TTBST_RELEASED; if ( opened ) { @@ -365,7 +362,7 @@ INT_PTR BASSSoundOnOff(WPARAM wParam, LPARAM lParam) BASS_SetConfig(BASS_CONFIG_GVOL_STREAM, Volume * 100 ); } - CallService(MS_TB_SETBUTTONSTATEBYID, (WPARAM)"BASSSoundOnOff", opened ? TBST_PUSHED : TBST_RELEASED); + CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)"BASSSoundOnOff", opened ? TTBST_PUSHED : TTBST_RELEASED); DBWriteContactSettingByte(NULL, ModuleName, OPT_DEVOPEN, !opened); } return 0; @@ -373,20 +370,16 @@ INT_PTR BASSSoundOnOff(WPARAM wParam, LPARAM lParam) int OnToolbarLoaded(WPARAM wParam, LPARAM lParam) { - TBButton tbb = {0}; - tbb.cbSize = sizeof(TBButton); - tbb.pszButtonID = "BASSSoundOnOff"; - tbb.pszButtonName = Translate("Open/close audio device"); - tbb.pszServiceName = "BASSinterface/BASSSoundOnOff"; - tbb.pszTooltipUp = Translate("Audio device is opened"); - tbb.pszTooltipDn = Translate("Audio device is closed"); - tbb.hPrimaryIconHandle = hIconLibItem[0]; - tbb.hSecondaryIconHandle = hIconLibItem[1]; - tbb.tbbFlags = TBBF_SHOWTOOLTIP; - tbb.defPos = 1000; - - CallService(MS_TB_ADDBUTTON, 0, (LPARAM)&tbb); - + TTBButton tbb = {0}; + tbb.cbSize = sizeof(TTBButton); + tbb.name = LPGEN("Open/close audio device"); + tbb.pszService = "BASSinterface/BASSSoundOnOff"; + tbb.pszTooltipUp = LPGEN("Audio device is opened"); + tbb.pszTooltipDn = LPGEN("Audio device is closed"); + tbb.hIconHandleUp = hIconLibItem[0]; + tbb.hIconHandleDn = hIconLibItem[1]; + tbb.dwFlags = TTBBF_SHOWTOOLTIP | TTBBF_ICONBYHANDLE; + hTBButton = TopToolbar_AddButton(&tbb); return 0; } @@ -441,11 +434,11 @@ int OnModulesLoaded(WPARAM wParam, LPARAM lParam) if (DBGetContactSettingByte(NULL, ModuleName, OPT_DEVOPEN, 1)) BASS_Init(device, 44100, 0, ClistHWND, NULL); else - CallService(MS_TB_SETBUTTONSTATEBYID, (WPARAM)"BASSSoundOnOff", TBST_PUSHED); + CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)hTBButton, TTBST_PUSHED); Volume = DBGetContactSettingByte(NULL, ModuleName, OPT_VOLUME, 33); BASS_SetConfig(BASS_CONFIG_GVOL_STREAM, Volume * 100 ); - hHooks[3] = HookEvent(ME_SKIN_PLAYINGSOUND, OnPlaySnd); + HookEvent(ME_SKIN_PLAYINGSOUND, OnPlaySnd); } else { @@ -454,8 +447,7 @@ int OnModulesLoaded(WPARAM wParam, LPARAM lParam) } } - hHooks[4] = HookEvent(ME_OPT_INITIALISE, OptionsInit); - + HookEvent(ME_OPT_INITIALISE, OptionsInit); return 0; } @@ -474,9 +466,9 @@ extern "C" int __declspec(dllexport) Load(void) { mir_getLP(&pluginInfo); - hHooks[0] = HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded); - hHooks[1] = HookEvent(ME_SYSTEM_SHUTDOWN, OnShutdown); - hHooks[2] = HookEvent(ME_TB_MODULELOADED, OnToolbarLoaded); + HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded); + HookEvent(ME_SYSTEM_SHUTDOWN, OnShutdown); + HookEvent(ME_TTB_MODULELOADED, OnToolbarLoaded); hService = CreateServiceFunction("BASSinterface/BASSSoundOnOff", BASSSoundOnOff); @@ -487,14 +479,6 @@ extern "C" int __declspec(dllexport) Load(void) extern "C" int __declspec(dllexport) Unload(void) { - int i; - for (i = 0; i < SIZEOF(hHooks); i++) - { - if (hHooks[i]) - UnhookEvent(hHooks[i]); - } - DestroyServiceFunction(hService); - return 0; } \ No newline at end of file diff --git a/plugins/BasicHistory/src/BasicHistory.cpp b/plugins/BasicHistory/src/BasicHistory.cpp index e28278e68b..43664f664e 100644 --- a/plugins/BasicHistory/src/BasicHistory.cpp +++ b/plugins/BasicHistory/src/BasicHistory.cpp @@ -33,7 +33,7 @@ HANDLE g_hMainThread=NULL; extern HINSTANCE hInst; -HANDLE hModulesLoaded, hOptionsInit, hPrebuildContactMenu, hServiceShowContactHistory, hServiceDeleteAllContactHistory, hServiceExecuteTask, hPreShutdownHistoryModule, hHistoryContactDelete, hFontsChanged,hToolBarLoaded, hSysOK; +HANDLE hServiceShowContactHistory, hServiceDeleteAllContactHistory, hServiceExecuteTask; HANDLE *hEventIcons = NULL; int iconsNum; HANDLE hPlusIcon, hMinusIcon, hFindNextIcon, hFindPrevIcon; @@ -103,21 +103,16 @@ int PrebuildContactMenu(WPARAM wParam, LPARAM lParam) int ToolbarModuleLoaded(WPARAM wParam,LPARAM lParam) { - if(ServiceExists(MS_TB_ADDBUTTON)) - { - TBButton tbb = {0}; + if(ServiceExists(MS_TTB_REMOVEBUTTON)) { + TTBButton tbb = {0}; tbb.cbSize = sizeof(tbb); - tbb.pszButtonID = "open_history"; - tbb.pszButtonName = LPGEN("Open History"); - tbb.pszServiceName = MS_HISTORY_SHOWCONTACTHISTORY; - tbb.lParam = 0; + tbb.name = LPGEN("Open History"); + tbb.pszService = MS_HISTORY_SHOWCONTACTHISTORY; tbb.pszTooltipUp = LPGEN("Open History"); tbb.pszTooltipDn = LPGEN("Open History"); - tbb.defPos = 200; - tbb.tbbFlags = TBBF_SHOWTOOLTIP; - tbb.hPrimaryIconHandle = LoadSkinnedIconHandle(SKINICON_OTHER_HISTORY); - tbb.hSecondaryIconHandle = LoadSkinnedIconHandle(SKINICON_OTHER_HISTORY); - hToolbarButton = (HANDLE) CallService(MS_TB_ADDBUTTON,0, (LPARAM)&tbb); + tbb.dwFlags = TTBBF_SHOWTOOLTIP; + tbb.hIconHandleUp = tbb.hIconHandleDn = LoadSkinnedIconHandle(SKINICON_OTHER_HISTORY); + hToolbarButton = TopToolbar_AddButton(&tbb); } return 0; } @@ -144,7 +139,7 @@ void InitMenuItems() mi.pszService = MS_HISTORY_DELETEALLCONTACTHISTORY; hDeleteContactMenu = Menu_AddContactMenuItem(&mi); - hPrebuildContactMenu = HookEvent(ME_CLIST_PREBUILDCONTACTMENU, PrebuildContactMenu); + HookEvent(ME_CLIST_PREBUILDCONTACTMENU, PrebuildContactMenu); } void InitTaskMenuItems() @@ -353,18 +348,17 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) Options::instance->Load(); InitTaskMenuItems(); - hPreShutdownHistoryModule = HookEvent(ME_SYSTEM_PRESHUTDOWN,PreShutdownHistoryModule); - hHistoryContactDelete = HookEvent(ME_DB_CONTACT_DELETED,HistoryContactDelete); - hFontsChanged = HookEvent(ME_FONT_RELOAD, HistoryWindow::FontsChanged); - hSysOK = HookEvent(ME_SYSTEM_OKTOEXIT, DoLastTask); + HookEvent(ME_TTB_MODULELOADED,ToolbarModuleLoaded); + HookEvent(ME_SYSTEM_PRESHUTDOWN,PreShutdownHistoryModule); + HookEvent(ME_DB_CONTACT_DELETED,HistoryContactDelete); + HookEvent(ME_FONT_RELOAD, HistoryWindow::FontsChanged); + HookEvent(ME_SYSTEM_OKTOEXIT, DoLastTask); + if (ServiceExists(MS_SMILEYADD_REPLACESMILEYS)) - { g_SmileyAddAvail = true; - } + if (ServiceExists(MS_MC_GETPROTOCOLNAME)) - { metaContactProto = (char*)CallService(MS_MC_GETPROTOCOLNAME, 0, 0); - } InitScheduler(); return 0; @@ -382,9 +376,8 @@ extern "C" int __declspec(dllexport) Load(void) hServiceDeleteAllContactHistory = CreateServiceFunction(MS_HISTORY_DELETEALLCONTACTHISTORY, HistoryWindow::DeleteAllUserHistory); hServiceExecuteTask = CreateServiceFunction(MS_HISTORY_EXECUTE_TASK, ExecuteTaskService); Options::instance = new Options(); - hModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded); - hOptionsInit = HookEvent(ME_OPT_INITIALISE, Options::InitOptions); - hToolBarLoaded = HookEvent(ME_TB_MODULELOADED,ToolbarModuleLoaded); + HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded); + HookEvent(ME_OPT_INITIALISE, Options::InitOptions); EventList::Init(); InitIcolib(); return 0; @@ -392,23 +385,21 @@ extern "C" int __declspec(dllexport) Load(void) extern "C" int __declspec(dllexport) Unload(void) { - if(g_hMainThread) CloseHandle(g_hMainThread); - g_hMainThread=NULL; - UnhookEvent(hModulesLoaded); - UnhookEvent(hPrebuildContactMenu); - UnhookEvent(hPreShutdownHistoryModule); - UnhookEvent(hHistoryContactDelete); - UnhookEvent(hOptionsInit); - UnhookEvent(hFontsChanged); - UnhookEvent(hToolBarLoaded); - UnhookEvent(hSysOK); + if (g_hMainThread) + CloseHandle(g_hMainThread); + g_hMainThread=NULL; + DestroyServiceFunction(hServiceShowContactHistory); DestroyServiceFunction(hServiceDeleteAllContactHistory); DestroyServiceFunction(hServiceExecuteTask); + HistoryWindow::Deinit(); + DestroyCursor(hCurSplitNS); DestroyCursor(hCurSplitWE); + EventList::Deinit(); + if(Options::instance != NULL) { Options::instance->Unload(); diff --git a/plugins/BasicHistory/src/stdafx.h b/plugins/BasicHistory/src/stdafx.h index bc670d4358..eede252cd2 100644 --- a/plugins/BasicHistory/src/stdafx.h +++ b/plugins/BasicHistory/src/stdafx.h @@ -60,9 +60,9 @@ #include +#include "m_toptoolbar.h" #include "m_updater.h" #include "m_smileyadd.h" -#include "m_toolbar.h" #include "m_metacontacts.h" #define HISTORY_HK_FIND 100 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 #include #include -#include "m_trigger.h" -#include "m_variables.h" -#include "m_toolbar.h" +#include +#include +#include #define MOD_NAME "BossKey" #define KEY_DOWN(key) ((GetAsyncKeyState(key) & 0x8000) ? (true) : (false)) diff --git a/plugins/Console/Console.cpp b/plugins/Console/Console.cpp index 59756e996c..2a2093e7c0 100644 --- a/plugins/Console/Console.cpp +++ b/plugins/Console/Console.cpp @@ -25,9 +25,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define MS_CONSOLE_SHOW_HIDE "Console/Show/Hide" -// console toptoolbarbutton(old) integration -#define TTB 1 - #define DEFAULT_WRAPLEN 90 #define MIN_WRAPLEN 25 #define MAX_WRAPLEN 255 @@ -106,9 +103,6 @@ static DWORD OutMsgs = 0; static DWORD InMsgs = 0; static HICON hIcons[15] = {0}; -static HANDLE hHooks[4] = {0}; - -static HANDLE hTButton = 0; static HANDLE hMenu = NULL; static void LoadSettings(); @@ -118,7 +112,6 @@ static int Openfile(TCHAR *outputFile, int selection); //////////////////////////////////////////////////////////////////////////////// -#ifdef TTB static HANDLE hTTBButt = 0; static INT_PTR HideConsoleButt(WPARAM wParam,LPARAM lParam) @@ -135,33 +128,46 @@ static INT_PTR ShowConsoleButt(WPARAM wParam,LPARAM lParam) static int OnTTBLoaded(WPARAM wParam,LPARAM lParam) { + if ( !IsWindow(hwndConsole)) + return 0; - if (IsWindow(hwndConsole)) - { - TTBButton ttbb = {0}; - int state = IsWindowVisible(hwndConsole); - - CreateServiceFunction("Console/Hide", HideConsoleButt); - CreateServiceFunction("Console/Show", ShowConsoleButt); - - ttbb.cbSize = sizeof(ttbb); - ttbb.hIconUp = LoadIcon(hInst, MAKEINTRESOURCE(IDI_CONSOLE_UP)); - ttbb.hIconDn = LoadIcon(hInst, MAKEINTRESOURCE(IDI_CONSOLE_DOWN)); - ttbb.dwFlags = (state ? TTBBF_PUSHED : 0) | TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP; - ttbb.pszService = "Console/Hide"; - ttbb.name = Translate("Show/Hide Console"); - hTTBButt = (HANDLE)CallService(MS_TTB_ADDBUTTON, (WPARAM)&ttbb, 0); - - if (hTTBButt) { - CallService(MS_TTB_SETBUTTONOPTIONS,MAKEWPARAM(TTBO_TIPNAME,hTTBButt), - (LPARAM)(state?Translate("Hide Console"):Translate("Show Console"))); + int state = IsWindowVisible(hwndConsole); + + CreateServiceFunction("Console/Hide", HideConsoleButt); + CreateServiceFunction("Console/Show", ShowConsoleButt); + + TTBButton ttbb = {0}; + ttbb.cbSize = sizeof(ttbb); + + TCHAR szModuleFileName[MAX_PATH]={0}; + GetModuleFileName(hInst, szModuleFileName, SIZEOF(szModuleFileName)); + + SKINICONDESC sid={0}; + sid.cbSize = sizeof(sid); + sid.pszSection = "Console"; + sid.ptszDefaultFile = szModuleFileName; + sid.flags = SIDF_PATH_TCHAR; + sid.pszDescription = "Show"; + sid.pszName = "Console_Up"; + sid.iDefaultIndex = -IDI_BTN_UP; + ttbb.hIconHandleUp = Skin_AddIcon(&sid); + + sid.pszDescription = "Hide"; + sid.pszName = "Console_Down"; + sid.iDefaultIndex = -IDI_BTN_DN; + ttbb.hIconHandleDn = Skin_AddIcon(&sid); + + ttbb.dwFlags = (state ? TTBBF_PUSHED : 0) | TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP | TTBBF_ICONBYHANDLE; + ttbb.pszService = "Console/Hide"; + ttbb.name = LPGEN("Show/Hide Console"); + ttbb.pszTooltipDn = LPGEN("Hide Console"); + ttbb.pszTooltipUp = LPGEN("Show Console"); + hTTBButt = TopToolbar_AddButton(&ttbb); + if (hTTBButt) + CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)hTTBButt, (LPARAM)(state?TTBST_PUSHED:TTBST_RELEASED)); - CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)hTTBButt, (LPARAM)(state?TTBST_PUSHED:TTBST_RELEASED)); - } - } return 0; } -#endif //////////////////////////////////////////////////////////////////////////////// @@ -204,19 +210,8 @@ static void ShowConsole(int show) CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenu, (LPARAM)&mi); } - if (hTButton) - { - CallService(MS_TB_SETBUTTONSTATEBYID, (WPARAM)"console_btn", (show)?TBST_PUSHED:TBST_RELEASED); - } - -#ifdef TTB if (hTTBButt) - { CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)hTTBButt, (show)?TTBST_PUSHED:TTBST_RELEASED); - CallService(MS_TTB_SETBUTTONOPTIONS,MAKEWPARAM(TTBO_TIPNAME,hTTBButt), - (LPARAM)(show?Translate("Hide Console"):Translate("Show Console"))); - } -#endif } //////////////////////////////////////////////////////////////////////////////// @@ -1250,9 +1245,7 @@ static int OnFontChange(WPARAM wParam,LPARAM lParam) static int OnSystemModulesLoaded(WPARAM wParam,LPARAM lParam) { - int i = 1; - if ( !hHooks[0] ) - hHooks[0] = HookEvent( ME_NETLIB_FASTDUMP, OnFastDump ); + HookEvent( ME_NETLIB_FASTDUMP, OnFastDump ); CreateServiceFunction(MS_CONSOLE_SHOW_HIDE, ShowHideConsole); @@ -1272,7 +1265,7 @@ static int OnSystemModulesLoaded(WPARAM wParam,LPARAM lParam) _tcsncpy(fid.deffontsettings.szFace, _T("Courier"), LF_FACESIZE); FontRegisterT(&fid); - hHooks[i++] = HookEvent(ME_FONT_RELOAD,OnFontChange); + HookEvent(ME_FONT_RELOAD,OnFontChange); ColourIDT cid = {0}; cid.cbSize=sizeof(cid); @@ -1283,7 +1276,7 @@ static int OnSystemModulesLoaded(WPARAM wParam,LPARAM lParam) cid.defcolour = RGB(255,255,255); ColourRegisterT(&cid); - hHooks[i++] = HookEvent(ME_COLOUR_RELOAD, OnColourChange); + HookEvent(ME_COLOUR_RELOAD, OnColourChange); HOTKEYDESC hkd = {0}; hkd.cbSize = sizeof(hkd); @@ -1294,46 +1287,10 @@ static int OnSystemModulesLoaded(WPARAM wParam,LPARAM lParam) hkd.DefHotKey = HOTKEYCODE(HOTKEYF_EXT, 'C'); Hotkey_Register(&hkd); - if (ServiceExists(MS_TB_ADDBUTTON)) { - TBButton tbb = {0}; - SKINICONDESC sid={0}; - TCHAR szModuleFileName[MAX_PATH]={0}; - GetModuleFileName(hInst, szModuleFileName, SIZEOF(szModuleFileName)); - - sid.cbSize = sizeof(sid); - sid.pszSection = "Console"; - sid.ptszDefaultFile = szModuleFileName; - sid.flags = SIDF_PATH_TCHAR; - - sid.pszDescription = "Show"; - sid.pszName = "Console_Up"; - sid.iDefaultIndex = -IDI_BTN_UP; - Skin_AddIcon(&sid); - - sid.pszDescription = "Hide"; - sid.pszName = "Console_Down"; - sid.iDefaultIndex = -IDI_BTN_DN; - Skin_AddIcon(&sid); - - tbb.cbSize = sizeof(TBButton); - tbb.pszButtonID = "console_btn"; - tbb.pszButtonName = Translate("Show/Hide Console"); - tbb.pszServiceName = MS_CONSOLE_SHOW_HIDE; - tbb.hPrimaryIconHandle = (HANDLE)CallService(MS_SKIN2_GETICONHANDLE,0, (LPARAM)"Console_Up"); - tbb.hSecondaryIconHandle = (HANDLE)CallService(MS_SKIN2_GETICONHANDLE,0, (LPARAM)"Console_Down"); - tbb.pszTooltipUp = Translate("Show Console"); - tbb.pszTooltipDn = Translate("Hide Console"); - tbb.tbbFlags = TBBF_VISIBLE|TBBF_SHOWTOOLTIP; - tbb.defPos = 20000; - hTButton = (HANDLE)CallService(MS_TB_ADDBUTTON,0, (LPARAM)&tbb); - } - if (hwndConsole && IsWindow(hwndConsole)) { CLISTMENUITEM mi={0}; -#ifdef TTB - hHooks[i++] = HookEvent(ME_TTB_MODULELOADED, OnTTBLoaded); -#endif + HookEvent(ME_TTB_MODULELOADED, OnTTBLoaded); mi.cbSize=sizeof(mi); mi.flags=CMIF_TCHAR; mi.hIcon=hIcons[0]; @@ -1358,15 +1315,8 @@ static int OnSystemModulesLoaded(WPARAM wParam,LPARAM lParam) static int PreshutdownConsole(WPARAM wParam,LPARAM lParam) { - int i; - - if (hwndConsole) { + if (hwndConsole) PostMessage(hwndConsole, WM_CLOSE, 0, 1 ); - } - - for (i=0;i #include #include -#include "m_toolbar.h" -#include "m_toptoolbar.h" +#include #include "resource.h" #include "version.h" diff --git a/plugins/ExternalAPI/m_toolbar.h b/plugins/ExternalAPI/m_toolbar.h deleted file mode 100644 index fc417cf873..0000000000 --- a/plugins/ExternalAPI/m_toolbar.h +++ /dev/null @@ -1,88 +0,0 @@ -#ifndef M_TOOLBAR_H -#define M_TOOLBAR_H - -#define TOOLBARBUTTON_ICONIDPREFIX "MTB_" -#define TOOLBARBUTTON_ICONIDPRIMARYSUFFIX "_Primary" -#define TOOLBARBUTTON_ICONIDSECONDARYSUFFIX "_Secondary" -#define TOOLBARBUTTON_ICONNAMEPRESSEDSUFFIX "Pressed" - -//button flags -#define TBBF_DISABLED (1<<0) -#define TBBF_VISIBLE (1<<1) -#define TBBF_PUSHED (1<<2) -#define TBBF_SHOWTOOLTIP (1<<3) -#define TBBF_ISSEPARATOR (1<<5) -#define TBBF_ISLBUTTON (1<<6) -#define TBBF_FLEXSIZESEPARATOR (TBBF_ISSEPARATOR|TBBF_PUSHED) -typedef struct _tagTBButton -{ - int cbSize; // size of structure - char * pszButtonID; // char id of button used to store button info in DB and know about icon - char * pszButtonName; // name of button (not translated) - char * pszServiceName; // service name to be executed - LPARAM lParam; // param of service to be called - char * pszTooltipUp, *pszTooltipDn; - DWORD defPos; // default order pos of button (less values are nearer to edge).. please use values greater that 100. the default buttons has pos: 10,20..90 - DWORD tbbFlags; // combine of TBBF_ flags above - void (*ParamDestructor)(void *); //will be called on parameters deletion - HANDLE hPrimaryIconHandle; - HANDLE hSecondaryIconHandle; -}TBButton; - -////////////////////////////////////////////////////////////////////////// -// Events -// Only after this event module subscribers should register their buttons -// wparam=lparam=0 -// don't forget to return 0 to continue processing -#define ME_TB_MODULELOADED "ToolBar/ModuleLoaded" - -////////////////////////////////////////////////////////////////////////// -// Services -// -////////////////////////////////////////////////////////////////////////// -// Adding a button -// WPARAM = 0 -// LPARAM = (TBButton *) &description -// LRESULT = (HANDLE) hButton -// in order to correctly process default icons via iconlib it should be -// registered icolib icon with id named: -// 'TBButton_'+pszButtonID+ 'Up' or +'Down' for Push (2-state) buttons -#define MS_TB_ADDBUTTON "ToolBar/AddButton" - -////////////////////////////////////////////////////////////////////////// -// Remove button -// WPARAM = (HANDLE) hButton; -// LPARAM = 0; -#define MS_TB_REMOVEBUTTON "ToolBar/RemoveButton" - -////////////////////////////////////////////////////////////////////////// -// SetState -// WPARAM = (HANDLE) hButton; -// LPARAM = one of below TBST_ states -// LRESULT= old state -#define TBST_PUSHED 1 -#define TBST_RELEASED 0 -#define MS_TB_SETBUTTONSTATE "ToolBar/SetButtonState" - -////////////////////////////////////////////////////////////////////////// -// SetStatebyId -// WPARAM = (char *) szButtonID; -// LPARAM = one of below TBST_ states -// LRESULT= old state -#define MS_TB_SETBUTTONSTATEBYID "ToolBar/SetButtonStateId" -////////////////////////////////////////////////////////////////////////// -// GetState -// WPARAM = (HANLDE) hButton; -// LPARAM = 0 -// LRESULT= current state -#define MS_TB_GETBUTTONSTATE "ToolBar/GetButtonState" - -////////////////////////////////////////////////////////////////////////// -// GetState -// WPARAM = (char *) szButtonID;; -// LPARAM = 0 -// LRESULT= current state -#define MS_TB_GETBUTTONSTATEBYID "ToolBar/GetButtonStateId" - - -#endif \ No newline at end of file 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); ///////////////////////////////////////////////////////////////////////////////////// diff --git a/plugins/ListeningTo/listeningto.cpp b/plugins/ListeningTo/listeningto.cpp index 9a85a38c27..a1a790081b 100644 --- a/plugins/ListeningTo/listeningto.cpp +++ b/plugins/ListeningTo/listeningto.cpp @@ -52,9 +52,6 @@ PLUGININFOEX pluginInfo={ HINSTANCE hInst; - -static std::vector hHooks; -static std::vector hServices; static HANDLE hEnableStateChangedEvent; HANDLE hExtraIcon, hIcon1, hIcon2; static HGENMENU hMainMenuGroup = NULL; @@ -139,22 +136,22 @@ extern "C" int __declspec(dllexport) Load(void) CoInitialize(NULL); // Services - hServices.push_back( CreateServiceFunction(MS_LISTENINGTO_ENABLED, ListeningToEnabled)); - hServices.push_back( CreateServiceFunction(MS_LISTENINGTO_ENABLE, EnableListeningTo)); - hServices.push_back( CreateServiceFunction(MS_LISTENINGTO_GETTEXTFORMAT, GetTextFormat)); - hServices.push_back( CreateServiceFunction(MS_LISTENINGTO_GETPARSEDTEXT, GetParsedFormat)); - hServices.push_back( CreateServiceFunction(MS_LISTENINGTO_OVERRIDECONTACTOPTION, GetOverrideContactOption)); - hServices.push_back( CreateServiceFunction(MS_LISTENINGTO_GETUNKNOWNTEXT, GetUnknownText)); - hServices.push_back( CreateServiceFunction(MS_LISTENINGTO_MAINMENU, MainMenuClicked)); - hServices.push_back( CreateServiceFunction(MS_LISTENINGTO_SET_NEW_SONG, SetNewSong)); - hServices.push_back( CreateServiceFunction(MS_LISTENINGTO_HOTKEYS_ENABLE, HotkeysEnable)); - hServices.push_back( CreateServiceFunction(MS_LISTENINGTO_HOTKEYS_DISABLE, HotkeysDisable)); - hServices.push_back( CreateServiceFunction(MS_LISTENINGTO_HOTKEYS_TOGGLE, HotkeysToggle)); + CreateServiceFunction(MS_LISTENINGTO_ENABLED, ListeningToEnabled); + CreateServiceFunction(MS_LISTENINGTO_ENABLE, EnableListeningTo); + CreateServiceFunction(MS_LISTENINGTO_GETTEXTFORMAT, GetTextFormat); + CreateServiceFunction(MS_LISTENINGTO_GETPARSEDTEXT, GetParsedFormat); + CreateServiceFunction(MS_LISTENINGTO_OVERRIDECONTACTOPTION, GetOverrideContactOption); + CreateServiceFunction(MS_LISTENINGTO_GETUNKNOWNTEXT, GetUnknownText); + CreateServiceFunction(MS_LISTENINGTO_MAINMENU, MainMenuClicked); + CreateServiceFunction(MS_LISTENINGTO_SET_NEW_SONG, SetNewSong); + CreateServiceFunction(MS_LISTENINGTO_HOTKEYS_ENABLE, HotkeysEnable); + CreateServiceFunction(MS_LISTENINGTO_HOTKEYS_DISABLE, HotkeysDisable); + CreateServiceFunction(MS_LISTENINGTO_HOTKEYS_TOGGLE, HotkeysToggle); // Hooks - hHooks.push_back( HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded)); - hHooks.push_back( HookEvent(ME_SYSTEM_PRESHUTDOWN, PreShutdown)); - hHooks.push_back( HookEvent(ME_DB_CONTACT_SETTINGCHANGED, SettingChanged)); + HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded); + HookEvent(ME_SYSTEM_PRESHUTDOWN, PreShutdown); + HookEvent(ME_DB_CONTACT_SETTINGCHANGED, SettingChanged); hEnableStateChangedEvent = CreateHookableEvent(ME_LISTENINGTO_ENABLE_STATE_CHANGED); hListeningInfoChangedEvent = CreateHookableEvent(ME_LISTENINGTO_LISTENING_INFO_CHANGED); @@ -348,7 +345,7 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) } else if (hExtraIcon == NULL && ServiceExists(MS_CLIST_EXTRA_ADD_ICON)) { - hHooks.push_back( HookEvent(ME_CLIST_EXTRA_LIST_REBUILD, ClistExtraListRebuild)); + HookEvent(ME_CLIST_EXTRA_LIST_REBUILD, ClistExtraListRebuild); } { @@ -400,12 +397,12 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) RegisterProtocol(protos[i]->szModuleName, protos[i]->tszAccountName); } - hHooks.push_back( HookEvent(ME_PROTO_ACCLISTCHANGED, AccListChanged)); + HookEvent(ME_PROTO_ACCLISTCHANGED, AccListChanged); } RebuildMenu(); - hHooks.push_back( HookEvent(ME_TTB_MODULELOADED, TopToolBarLoaded)); + HookEvent(ME_TTB_MODULELOADED, TopToolBarLoaded); // Variables support if (ServiceExists(MS_VARS_REGISTERTOKEN)) @@ -511,15 +508,7 @@ int PreShutdown(WPARAM wParam, LPARAM lParam) DestroyHookableEvent(hEnableStateChangedEvent); DestroyHookableEvent(hListeningInfoChangedEvent); - size_t i; - for(i = 0; i < hHooks.size(); i++) - UnhookEvent(hHooks[i]); - - for(i = 0; i < hServices.size(); i++) - DestroyServiceFunction(hServices[i]); - FreeMusic(); - return 0; } @@ -534,7 +523,7 @@ int TopToolBarLoaded(WPARAM wParam, LPARAM lParam) { BOOL enabled = ListeningToEnabled(NULL, TRUE); - hServices.push_back( CreateServiceFunction(MS_LISTENINGTO_TTB, TopToolBarClick)); + CreateServiceFunction(MS_LISTENINGTO_TTB, TopToolBarClick); TTBButton ttb = {0}; ttb.cbSize = sizeof(ttb); @@ -542,9 +531,8 @@ int TopToolBarLoaded(WPARAM wParam, LPARAM lParam) ttb.hIconHandleUp = hIcon1; ttb.pszService = MS_LISTENINGTO_TTB; ttb.dwFlags = TTBBF_VISIBLE | TTBBF_ICONBYHANDLE | TTBBF_SHOWTOOLTIP | (enabled ? TTBBF_PUSHED : 0); - ttb.name = Translate("Enable/Disable sending Listening To info (to all protocols)"); - - hTTB = (HANDLE)CallService(MS_TTB_ADDBUTTON, (WPARAM)&ttb, 0); + ttb.name = "Enable/Disable sending Listening To info (to all protocols)"; + hTTB = TopToolbar_AddButton(&ttb); return 0; } diff --git a/plugins/NewXstatusNotify/common.h b/plugins/NewXstatusNotify/common.h index 343ee4fe58..b7358a3b7e 100644 --- a/plugins/NewXstatusNotify/common.h +++ b/plugins/NewXstatusNotify/common.h @@ -71,7 +71,7 @@ #include "m_metacontacts.h" #include "m_updater.h" -#include "m_toolbar.h" +#include "m_toptoolbar.h" #include "resource.h" #define MIID_NXSN { 0xebf19652, 0xe434, 0x4d79, { 0x98, 0x97, 0x91, 0xa0, 0xff, 0x22, 0x6f, 0x51 } } diff --git a/plugins/NewXstatusNotify/main.cpp b/plugins/NewXstatusNotify/main.cpp index 1837bd03f9..7519dca662 100644 --- a/plugins/NewXstatusNotify/main.cpp +++ b/plugins/NewXstatusNotify/main.cpp @@ -33,10 +33,8 @@ HINSTANCE hInst; LIST eventList( 10 ); LIST xstatusList( 10 ); -HANDLE hEnableDisableMenu, hOptionsInitialize, hModulesLoaded, hUserInfoInitialise; -HANDLE hContactSettingChanged, hHookContactStatusChanged, hContactStatusChanged; -HANDLE hStatusModeChange, hServiceMenu, hProtoAck; -HANDLE hMessageWindowOpen; +HANDLE hStatusModeChange, hServiceMenu, hHookContactStatusChanged, hEnableDisableMenu; +HANDLE hToolbarButton; char szMetaModuleName[256] = {0}; STATUS StatusList[STATUS_COUNT]; @@ -304,16 +302,13 @@ static int __inline CheckStrW(WCHAR *str, int not_empty, int empty) { WCHAR *mir_dupToUnicodeEx(char *ptr, UINT CodePage) { - size_t size; - WCHAR *tmp; - if (ptr == NULL) return NULL; - size = strlen(ptr) + 1; - tmp = (WCHAR *) mir_alloc(size * sizeof(WCHAR)); + size_t size = strlen(ptr) + 1; + WCHAR *tmp = (WCHAR *) mir_alloc(size * sizeof(WCHAR)); - MultiByteToWideChar(CodePage, 0, ptr, -1, tmp, size * sizeof(WCHAR)); + MultiByteToWideChar(CodePage, 0, ptr, -1, tmp, (int)size * sizeof(WCHAR)); return tmp; } @@ -1263,7 +1258,7 @@ INT_PTR EnableDisableMenuCommand(WPARAM wParam, LPARAM lParam) } CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hEnableDisableMenu, (LPARAM)&mi); - CallService(MS_TB_SETBUTTONSTATEBYID, (WPARAM)"StatusNotificationToggle", opt.TempDisabled ? TBST_PUSHED : TBST_RELEASED); + CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)hToolbarButton, opt.TempDisabled ? TTBST_PUSHED : TTBST_RELEASED); return 0; } @@ -1328,42 +1323,37 @@ void InitSound() SkinAddNewSoundEx(XSTATUS_SOUND_REMOVED, LPGEN("Status Notify"), LPGEN("Extra status removed")); } -void InitTopToolbar() +int InitTopToolbar(WPARAM, LPARAM) { - if (ServiceExists(MS_TB_ADDBUTTON)) { - TBButton tbb = {0}; - tbb.cbSize = sizeof(TBButton); - tbb.pszServiceName = MS_STATUSCHANGE_MENUCOMMAND; - tbb.pszButtonID = "StatusNotificationToggle"; - tbb.pszButtonName = "Toggle status notification"; - tbb.pszTooltipUp = "Status notification enabled"; - tbb.pszTooltipDn = "Status notification disabled"; - tbb.hPrimaryIconHandle = GetIconHandle(ICO_NOTIFICATION_ON); - tbb.hSecondaryIconHandle = GetIconHandle(ICO_NOTIFICATION_OFF); - tbb.tbbFlags = (opt.TempDisabled ? TBBF_PUSHED : 0); - tbb.defPos = 20; - CallService(MS_TB_ADDBUTTON, 0, (LPARAM)&tbb); - } + TTBButton tbb = {0}; + tbb.cbSize = sizeof(TTBButton); + tbb.pszService = MS_STATUSCHANGE_MENUCOMMAND; + tbb.name = LPGEN("Toggle status notification"); + tbb.pszTooltipUp = LPGEN("Status notification enabled"); + tbb.pszTooltipDn = LPGEN("Status notification disabled"); + tbb.hIconHandleUp = GetIconHandle(ICO_NOTIFICATION_ON); + tbb.hIconHandleDn = GetIconHandle(ICO_NOTIFICATION_OFF); + tbb.dwFlags = TTBBF_ICONBYHANDLE | (opt.TempDisabled ? TTBBF_PUSHED : 0); + hToolbarButton = TopToolbar_AddButton(&tbb); + return 0; } int ModulesLoaded(WPARAM wParam, LPARAM lParam) { InitUpdaterSupport(); InitMainMenuItem(); - InitTopToolbar(); - hUserInfoInitialise = HookEvent(ME_USERINFO_INITIALISE, UserInfoInitialise); - hContactStatusChanged = HookEvent(ME_STATUSCHANGE_CONTACTSTATUSCHANGED, ContactStatusChanged); - hMessageWindowOpen = HookEvent(ME_MSG_WINDOWEVENT, OnWindowEvent); + HookEvent(ME_USERINFO_INITIALISE, UserInfoInitialise); + HookEvent(ME_STATUSCHANGE_CONTACTSTATUSCHANGED, ContactStatusChanged); + HookEvent(ME_MSG_WINDOWEVENT, OnWindowEvent); + HookEvent(ME_TTB_MODULELOADED, InitTopToolbar); int count = 0; PROTOACCOUNT **accounts = NULL; CallService(MS_PROTO_ENUMACCOUNTS, (WPARAM)&count, (LPARAM)&accounts); for (int i = 0; i < count; i++) - { if (IsAccountEnabled(accounts[i])) DBWriteContactSettingByte(NULL, MODULE, accounts[i]->szModuleName, 0); - } if (ServiceExists(MS_MC_GETPROTOCOLNAME)) strcpy(szMetaModuleName, (char *)CallService(MS_MC_GETPROTOCOLNAME, 0, 0)); @@ -1373,19 +1363,18 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) extern "C" int __declspec(dllexport) Load(void) { - mir_getLP(&pluginInfoEx); //"Service" Hook, used when the DB settings change: we'll monitor the "status" setting. - hContactSettingChanged = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, ContactSettingChanged); + HookEvent(ME_DB_CONTACT_SETTINGCHANGED, ContactSettingChanged); //We create this Hook which will notify everyone when a contact changes his status. hHookContactStatusChanged = CreateHookableEvent(ME_STATUSCHANGE_CONTACTSTATUSCHANGED); - hModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded); + HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded); //We add the option page and the user info page (it's needed because options are loaded after plugins) - hOptionsInitialize = HookEvent(ME_OPT_INITIALISE, OptionsInitialize); + HookEvent(ME_OPT_INITIALISE, OptionsInitialize); //This is needed for "NoSound"-like routines. - hStatusModeChange = HookEvent(ME_CLIST_STATUSMODECHANGE, StatusModeChanged); - hProtoAck = HookEvent(ME_PROTO_ACK, ProtoAck); + HookEvent(ME_CLIST_STATUSMODECHANGE, StatusModeChanged); + HookEvent(ME_PROTO_ACK, ProtoAck); LoadOptions(); InitStatusList(); @@ -1399,15 +1388,7 @@ extern "C" int __declspec(dllexport) Load(void) extern "C" int __declspec(dllexport) Unload(void) { - UnhookEvent(hContactSettingChanged); - UnhookEvent(hOptionsInitialize); - UnhookEvent(hModulesLoaded); - UnhookEvent(hUserInfoInitialise); - UnhookEvent(hStatusModeChange); - UnhookEvent(hProtoAck); DestroyHookableEvent(hHookContactStatusChanged); DestroyServiceFunction(hServiceMenu); - UnhookEvent(hMessageWindowOpen); - return 0; } \ No newline at end of file diff --git a/plugins/Popup/src/headers.h b/plugins/Popup/src/headers.h index e0c8f65d7f..032b050899 100644 --- a/plugins/Popup/src/headers.h +++ b/plugins/Popup/src/headers.h @@ -130,7 +130,6 @@ Last change by : $Author: Merlin_de $ #define MTEXT_NOHELPERS #endif // MTEXT_NOHELPERS #include - #include #include #include #include //core define see miranda\include\ diff --git a/plugins/Popup/src/main.cpp b/plugins/Popup/src/main.cpp index 0e7218ed4e..b44725c0bc 100644 --- a/plugins/Popup/src/main.cpp +++ b/plugins/Popup/src/main.cpp @@ -80,15 +80,11 @@ HANDLE hGetStatus = NULL; //===== Event Handles ===== HANDLE hOptionsInitialize; -//HANDLE hNotifyOptionsInitialize; deprecatet HANDLE hModulesLoaded; -HANDLE hTTBLoaded; -HANDLE hTBLoaded; HANDLE hOkToExit; HANDLE hIconsChanged, hFontsChanged; HANDLE hEventStatusChanged; //To automatically disable on status change. -int hTTButton = -1; -HANDLE hTButton = NULL; +HANDLE hTTButton = NULL; GLOBAL g_popup = {0}; @@ -207,47 +203,21 @@ static int IconsChanged(WPARAM wParam,LPARAM lParam) static int TTBLoaded(WPARAM wParam,LPARAM lParam) { - if (hTTButton == -1) { - TTBButton btn = {0}; - btn.cbSize = sizeof(btn); - btn.pszService = MENUCOMMAND_SVC; - btn.lParamUp = 1; - btn.lParamDown = 0; - btn.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP; - btn.name = "Toggle Popups"; - btn.hIconUp = IcoLib_GetIcon(ICO_POPUP_OFF,0); - btn.hIconDn = IcoLib_GetIcon(ICO_POPUP_ON,0); - hTTButton = CallService(MS_TTB_ADDBUTTON, (WPARAM)&btn, 0); + if ( !hTTButton) { + TTBButton btn = {0}; + btn.cbSize = sizeof(btn); + btn.pszService = MENUCOMMAND_SVC; + btn.lParamUp = 1; + btn.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP | TTBBF_ICONBYHANDLE; + btn.name = LPGEN("Toggle Popups"); + btn.hIconHandleUp = Skin_GetIconHandle(ICO_TB_POPUP_OFF); + btn.hIconHandleDn = Skin_GetIconHandle(ICO_TB_POPUP_ON); + btn.pszTooltipUp = LPGEN("Enable popups"); + btn.pszTooltipDn = LPGEN("Disable popups"); + hTTButton = TopToolbar_AddButton(&btn); } - if (PopUpOptions.ModuleIsEnabled) { - CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)hTTButton, TTBST_RELEASED); - CallService(MS_TTB_SETBUTTONOPTIONS, MAKEWPARAM(TTBO_TIPNAME,hTTButton), (LPARAM)LPGEN("Disable popups")); - } - else { - CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)hTTButton, TTBST_PUSHED); - CallService(MS_TTB_SETBUTTONOPTIONS, MAKEWPARAM(TTBO_TIPNAME,hTTButton), (LPARAM)LPGEN("Enable popups")); - } - return 0; -} - -//register Modern Toolbarbutton -static int ToolbarSet(WPARAM, LPARAM){ - if (hTButton == NULL){ - TBButton tbb = {0}; - tbb.cbSize = sizeof(TBButton); - tbb.pszButtonID = "PopupToogle"; - tbb.pszButtonName = Translate("Toggle Popups"); - tbb.pszServiceName = MENUCOMMAND_SVC; - tbb.pszTooltipUp = Translate("Popups are disabled"); - tbb.pszTooltipDn = Translate("Popups are enabled"); - tbb.hPrimaryIconHandle = (HANDLE)CallService(MS_SKIN2_GETICONHANDLE, 0, (LPARAM)ICO_TB_POPUP_OFF); - tbb.hSecondaryIconHandle = (HANDLE)CallService(MS_SKIN2_GETICONHANDLE, 0, (LPARAM)ICO_TB_POPUP_ON); - tbb.tbbFlags = TBBF_VISIBLE; - tbb.defPos = 10000; - hTButton = (HANDLE)CallService(MS_TB_ADDBUTTON,0, (LPARAM)&tbb); - } - CallService(MS_TB_SETBUTTONSTATEBYID, (WPARAM)"PopupToogle", PopUpOptions.ModuleIsEnabled?TBST_PUSHED:TBST_RELEASED); + CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)hTTButton, (PopUpOptions.ModuleIsEnabled) ? TTBST_RELEASED : TTBST_PUSHED); return 0; } @@ -280,7 +250,6 @@ INT_PTR svcEnableDisableMenuCommand(WPARAM wp, LPARAM lp) mi.flags = CMIM_ICON; iResultRoot = CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)hMenuRoot,(LPARAM)&mi); TTBLoaded(0,0); - ToolbarSet(0,0); if(iResult && iResultRoot) return 1; else @@ -420,7 +389,7 @@ static int ModulesLoaded(WPARAM wParam,LPARAM lParam) LoadActions(); LoadNotifications(); //hook TopToolBar - hTTBLoaded = HookEvent(ME_TTB_MODULELOADED, TTBLoaded); + HookEvent(ME_TTB_MODULELOADED, TTBLoaded); //Folder plugin support LPTSTR pszPath = mir_a2t(MIRANDA_PATH "\\Skins\\PopUp"); folderId = FoldersRegisterCustomPathT(MODULNAME_LONG, "Skins", pszPath); @@ -439,11 +408,6 @@ static int ModulesLoaded(WPARAM wParam,LPARAM lParam) SrmmMenu_Load(); //Hotkey LoadHotkey(); - //Modern Toolbar support - if(ServiceExists(MS_TB_ADDBUTTON)) { - hTBLoaded = HookEvent(ME_TB_MODULELOADED, ToolbarSet); - ToolbarSet(0,0); - } //Updater support if(ServiceExists(MS_UPDATE_REGISTER)) registerUpdate(); @@ -589,7 +553,6 @@ MIRAPI int Unload(void) UnhookEvent(hEventStatusChanged); UnhookEvent(hIconsChanged); UnhookEvent(hFontsChanged); - UnhookEvent(hTBLoaded); DestroyServiceFunction(hShowHistory); DestroyServiceFunction(hTogglePopup); diff --git a/plugins/RecentContacts/RecentContacts.cpp b/plugins/RecentContacts/RecentContacts.cpp index b2dfc76e9e..fb893f87e0 100644 --- a/plugins/RecentContacts/RecentContacts.cpp +++ b/plugins/RecentContacts/RecentContacts.cpp @@ -454,19 +454,13 @@ static int OnContactSettingChanged( WPARAM wParam, LPARAM lParam ) int Create_TopToolbarShowList(WPARAM wParam, LPARAM lParam) { - if (ServiceExists(MS_TTB_ADDBUTTON)) { - TTBButton ttbb = { 0 }; - ttbb.cbSize = sizeof(ttbb); - ttbb.hIconHandleDn = ttbb.hIconHandleDn = hIcon; - ttbb.pszService = msLastUC_ShowList; - ttbb.dwFlags = TTBBF_VISIBLE|TTBBF_SHOWTOOLTIP; - ttbb.name = Translate(msLastUC_ShowListName); - - hTopToolbarButtonShowList = (HANDLE)CallService(MS_TTB_ADDBUTTON, (WPARAM)&ttbb, 0); - if ((int)hTopToolbarButtonShowList == -1) - hTopToolbarButtonShowList = NULL; - } - + TTBButton ttbb = { 0 }; + ttbb.cbSize = sizeof(ttbb); + ttbb.hIconHandleDn = ttbb.hIconHandleDn = hIcon; + ttbb.pszService = msLastUC_ShowList; + ttbb.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP; + ttbb.name = msLastUC_ShowListName; + hTopToolbarButtonShowList = TopToolbar_AddButton(&ttbb); return 0; } diff --git a/plugins/Sessions/Src/Main.cpp b/plugins/Sessions/Src/Main.cpp index c5935ce722..da51bde5fe 100644 --- a/plugins/Sessions/Src/Main.cpp +++ b/plugins/Sessions/Src/Main.cpp @@ -23,10 +23,9 @@ HINSTANCE hinstance = NULL; WNDPROC mainProc; -HANDLE hEventDbWindowEvent,hEventDbOkToExit, hEventDbOptionsInit, hEventDbPluginsLoaded, -hEventDbPreShutdown,hServiceOpenManager,hServiceShowFavMenu,hServiceCloseCurrentSession,hServiceSaveUserSession, -hServiceLoadLastSession,hmSaveCurrentSession, -hmLoadLastSession,hmLoadSession,hmSessionsManager,hibSessionsLoad,hibSessionsSave,hibSessionsLoadLast,hibChecked,hibNotChecked ; +HANDLE hServiceOpenManager,hServiceShowFavMenu,hServiceCloseCurrentSession,hServiceSaveUserSession, +hServiceLoadLastSession,hmSaveCurrentSession, hmLoadLastSession,hmLoadSession,hmSessionsManager, +hibSessionsLoad,hibSessionsSave,hibSessionsLoadLast,hibChecked,hibNotChecked; HICON hiChecked,hiNotChecked,hiSessions,hiSessionsLoad ,hiSessionsSave,hiSessionsLoadLast; @@ -773,21 +772,14 @@ int DeleteAutoSession(int ses_count) int SessionPreShutdown(WPARAM wparam,LPARAM lparam) { DONT=1; - if (hEventDbWindowEvent) UnhookEvent(hEventDbWindowEvent); DestroyServiceFunction(hServiceOpenManager); DestroyServiceFunction(hServiceCloseCurrentSession); DestroyServiceFunction(hServiceShowFavMenu); DestroyServiceFunction(hServiceLoadLastSession); DestroyServiceFunction(hServiceSaveUserSession); - if (hEventDbPluginsLoaded) UnhookEvent(hEventDbPluginsLoaded); - - if (hEventDbOptionsInit) UnhookEvent(hEventDbOptionsInit); - if (hEventDbOkToExit) UnhookEvent(hEventDbOkToExit); - if (hEventDbPreShutdown) UnhookEvent(hEventDbPreShutdown); - - if (g_hDlg) DestroyWindow(g_hDlg); - if (g_hSDlg) DestroyWindow(g_hSDlg); + if (g_hDlg) DestroyWindow(g_hDlg); + if (g_hSDlg) DestroyWindow(g_hSDlg); DestroyIcon(hiSessions); DestroyIcon(hiSessionsLoad); @@ -861,12 +853,40 @@ INT_PTR BuildFavMenu(WPARAM wparam,LPARAM lparam) return 0; } +static int CreateButtons(WPARAM wparam,LPARAM lparam) +{ + TTBButton button = {0}; + button.dwFlags = TTBBF_SHOWTOOLTIP | TTBBF_VISIBLE | TTBBF_ICONBYHANDLE; + + button.pszService = MS_SESSIONS_OPENMANAGER; + button.pszTooltipUp = button.pszTooltipUp = button.name = LPGEN("Open Sessions Manager"); + button.hIconHandleDn = button.hIconHandleUp = hibSessionsLoad; + TopToolbar_AddButton(&button); + + button.pszService = MS_SESSIONS_SAVEUSERSESSION; + button.pszTooltipUp = button.pszTooltipUp = button.name = LPGEN("Save Session"); + button.hIconHandleDn = button.hIconHandleUp = hibSessionsSave; + TopToolbar_AddButton(&button); + + button.pszService = MS_SESSIONS_RESTORELASTSESSION; + button.pszTooltipUp = button.pszTooltipUp = button.name = LPGEN("Restore Last Session"); + button.hIconHandleDn = button.hIconHandleUp = hibSessionsLoadLast; + TopToolbar_AddButton(&button); + + button.pszService = MS_SESSIONS_SHOWFAVORITESMENU; + button.pszTooltipUp = button.pszTooltipUp = button.name = LPGEN("Show Favorite Sessions Menu"); + button.hIconHandleDn = button.hIconHandleUp = hibChecked; + TopToolbar_AddButton(&button); + return 0; +} + static int PluginInit(WPARAM wparam,LPARAM lparam) { int startup=0; - hEventDbWindowEvent=HookEvent(ME_MSG_WINDOWEVENT, GetContactHandle); - hEventDbOptionsInit=HookEvent(ME_OPT_INITIALISE, OptionsInit); + HookEvent(ME_MSG_WINDOWEVENT, GetContactHandle); + HookEvent(ME_OPT_INITIALISE, OptionsInit); + HookEvent(ME_TTB_MODULELOADED, CreateButtons); hServiceShowFavMenu=CreateServiceFunction(MS_SESSIONS_SHOWFAVORITESMENU, BuildFavMenu); hServiceOpenManager=CreateServiceFunction(MS_SESSIONS_OPENMANAGER, OpenSessionsManagerWindow); @@ -875,7 +895,8 @@ static int PluginInit(WPARAM wparam,LPARAM lparam) hServiceCloseCurrentSession=CreateServiceFunction(MS_SESSIONS_CLOSESESSION, CloseCurrentSession); g_ses_count=DBGetContactSettingByte(0, __INTERNAL_NAME, "UserSessionsCount", 0); - if (!g_ses_count) g_ses_count=DBGetContactSettingByte(0, "Sessions (Unicode)", "UserSessionsCount", 0); + if (!g_ses_count) + g_ses_count=DBGetContactSettingByte(0, "Sessions (Unicode)", "UserSessionsCount", 0); ses_limit=DBGetContactSettingByte(0, __INTERNAL_NAME, "TrackCount", 10); g_bExclHidden=DBGetContactSettingByte(NULL, __INTERNAL_NAME, "ExclHidden", 0); g_bWarnOnHidden=DBGetContactSettingByte(NULL, __INTERNAL_NAME, "WarnOnHidden", 0); @@ -922,22 +943,22 @@ static int PluginInit(WPARAM wparam,LPARAM lparam) hkd.dwFlags = HKD_TCHAR; hkd.ptszSection = _T("Sessions"); hkd.pszName = "OpenSessionsManager"; - hkd.ptszDescription = _T("Open Sessions Manager"); + hkd.ptszDescription = LPGENT("Open Sessions Manager"); hkd.pszService = MS_SESSIONS_OPENMANAGER; Hotkey_Register(&hkd); hkd.pszName = "RestoreLastSession"; - hkd.ptszDescription = _T("Restore last Session"); + hkd.ptszDescription = LPGENT("Restore last Session"); hkd.pszService = MS_SESSIONS_RESTORELASTSESSION; Hotkey_Register(&hkd); hkd.pszName = "SaveSession"; - hkd.ptszDescription = _T("Save Session"); + hkd.ptszDescription = LPGENT("Save Session"); hkd.pszService = MS_SESSIONS_SAVEUSERSESSION; Hotkey_Register(&hkd); hkd.pszName = "CloseSession"; - hkd.ptszDescription = _T("Close Session"); + hkd.ptszDescription = LPGENT("Close Session"); hkd.pszService = MS_SESSIONS_CLOSESESSION; Hotkey_Register(&hkd); @@ -989,40 +1010,6 @@ static int PluginInit(WPARAM wparam,LPARAM lparam) cl.hIcon = hiSessionsSave; CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hmSaveCurrentSession, (LPARAM)&cl); - if (ServiceExists(MS_TB_ADDBUTTON)) - { - TBButton button = {0}; - button.defPos = 102200; - button.tbbFlags = TBBF_SHOWTOOLTIP|TBBF_VISIBLE; - - button.pszButtonID = MS_SESSIONS_OPENMANAGER; - button.pszServiceName = MS_SESSIONS_OPENMANAGER; - button.pszTooltipUp = button.pszTooltipUp = button.pszButtonName = "Open Sessions Manager"; - button.hSecondaryIconHandle = button.hPrimaryIconHandle = hibSessionsLoad; - CallService(MS_TB_ADDBUTTON, 0, (LPARAM)&button); - button.defPos++; - - button.pszButtonID = MS_SESSIONS_SAVEUSERSESSION; - button.pszServiceName = MS_SESSIONS_SAVEUSERSESSION; - button.pszTooltipUp = button.pszTooltipUp = button.pszButtonName = "Save Session"; - button.hSecondaryIconHandle = button.hPrimaryIconHandle = hibSessionsSave; - CallService(MS_TB_ADDBUTTON, 0, (LPARAM)&button); - button.defPos++; - - button.pszButtonID = MS_SESSIONS_RESTORELASTSESSION; - button.pszServiceName = MS_SESSIONS_RESTORELASTSESSION; - button.pszTooltipUp = button.pszTooltipUp = button.pszButtonName = "Restore Last Session"; - button.hSecondaryIconHandle = button.hPrimaryIconHandle = hibSessionsLoadLast; - CallService(MS_TB_ADDBUTTON, 0, (LPARAM)&button); - button.defPos++; - - button.pszButtonID = MS_SESSIONS_SHOWFAVORITESMENU; - button.pszServiceName = MS_SESSIONS_SHOWFAVORITESMENU; - button.pszTooltipUp = button.pszTooltipUp = button.pszButtonName = "Show Favorite Sessions Menu"; - button.hSecondaryIconHandle = button.hPrimaryIconHandle = hibChecked; - CallService(MS_TB_ADDBUTTON, 0, (LPARAM)&button); - } - if(ServiceExists(MS_UPDATE_REGISTER)) { char buffer[1024]; @@ -1069,8 +1056,8 @@ extern "C" __declspec(dllexport) int Load(void) { mir_getLP(&pluginInfo); - hEventDbPluginsLoaded = HookEvent(ME_SYSTEM_MODULESLOADED,PluginInit); - hEventDbOkToExit = HookEvent(ME_SYSTEM_OKTOEXIT,OkToExit); - hEventDbPreShutdown= HookEvent(ME_SYSTEM_PRESHUTDOWN,SessionPreShutdown); + HookEvent(ME_SYSTEM_MODULESLOADED,PluginInit); + HookEvent(ME_SYSTEM_OKTOEXIT,OkToExit); + HookEvent(ME_SYSTEM_PRESHUTDOWN,SessionPreShutdown); return 0; } diff --git a/plugins/Sessions/Src/Sessions.h b/plugins/Sessions/Src/Sessions.h index 345c31bc54..a1c71f970d 100644 --- a/plugins/Sessions/Src/Sessions.h +++ b/plugins/Sessions/Src/Sessions.h @@ -40,7 +40,7 @@ along with this program. If not, see . #include "win2k.h" #include "m_updater.h" -#include "m_toolbar.h" +#include "m_toptoolbar.h" #include "m_sessions.h" #include "Utils.h" 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(); diff --git a/plugins/StatusPlugins/StartupStatus/options.cpp b/plugins/StatusPlugins/StartupStatus/options.cpp index e1e9f0dbbe..2a712bbe87 100644 --- a/plugins/StatusPlugins/StartupStatus/options.cpp +++ b/plugins/StatusPlugins/StartupStatus/options.cpp @@ -569,7 +569,7 @@ static INT_PTR CALLBACK StatusProfilesOptDlgProc(HWND hwndDlg,UINT msg,WPARAM wP } arProfiles.insert(ppo); } - if ( !ServiceExists( MS_TTB_ADDBUTTON ) && !ServiceExists( MS_TB_ADDBUTTON )) + if (hTTBModuleLoadedHook) EnableWindow(GetDlgItem(hwndDlg, IDC_CREATETTB), FALSE); SendMessage(hwndDlg, UM_REINITPROFILES, 0, 0); diff --git a/plugins/StatusPlugins/StartupStatus/profiles.cpp b/plugins/StatusPlugins/StartupStatus/profiles.cpp index 3d93f1b37d..c1235b848d 100644 --- a/plugins/StatusPlugins/StartupStatus/profiles.cpp +++ b/plugins/StatusPlugins/StartupStatus/profiles.cpp @@ -274,7 +274,7 @@ INT_PTR LoadAndSetProfile(WPARAM wParam, LPARAM lParam) CallService(MS_CS_SHOWCONFIRMDLGEX, (WPARAM)&profileSettings, (LPARAM)DBGetContactSettingDword(NULL, MODULENAME, SETTING_DLGTIMEOUT, 5)); } - if ( ServiceExists( MS_TTB_ADDBUTTON ) || ServiceExists( MS_TB_ADDBUTTON )) + if (hTTBModuleLoadedHook) // add timer here releaseTtbTimerId = SetTimer(NULL, 0, 100, releaseTtbTimerFunction); @@ -361,11 +361,7 @@ static int UnregisterHotKeys() int LoadMainOptions() { - if (ServiceExists(MS_TTB_ADDBUTTON)) { - RemoveTopToolbarButtons(); - CreateTopToolbarButtons(0,0); - } - if (ServiceExists(MS_TTB_ADDBUTTON)) { + if (hTTBModuleLoadedHook) { RemoveTopToolbarButtons(); CreateTopToolbarButtons(0,0); } @@ -385,7 +381,6 @@ int LoadProfileModule() int InitProfileModule() { hTTBModuleLoadedHook = HookEvent(ME_TTB_MODULELOADED, CreateTopToolbarButtons); - hTBModuleLoadedHook = HookEvent(ME_TB_MODULELOADED, CreateToolbarButtons); hPrebuildProfilesMenu = HookEvent( ME_CLIST_PREBUILDSTATUSMENU, CreateMainMenuItems); CreateMainMenuItems(0,0); diff --git a/plugins/StatusPlugins/StartupStatus/startupstatus.h b/plugins/StatusPlugins/StartupStatus/startupstatus.h index b7681952c9..02d8e36c41 100644 --- a/plugins/StatusPlugins/StartupStatus/startupstatus.h +++ b/plugins/StatusPlugins/StartupStatus/startupstatus.h @@ -25,7 +25,6 @@ #include #include #include -#include #include "version.h" #define MODULENAME "StartupStatus" @@ -159,11 +158,9 @@ INT_PTR LoadAndSetProfile(WPARAM wParam, LPARAM lParam); INT_PTR GetProfileCount(WPARAM wParam, LPARAM lParam); INT_PTR GetProfileName(WPARAM wParam, LPARAM lParam); +extern HANDLE hTTBModuleLoadedHook; int RemoveTopToolbarButtons(); int CreateTopToolbarButtons(WPARAM wParam, LPARAM lParam); - -int RemoveToolbarButtons(); -int CreateToolbarButtons(WPARAM wParam, LPARAM lParam); void RegisterButtons(); int LoadProfileModule(); diff --git a/plugins/StatusPlugins/StartupStatus/toolbars.cpp b/plugins/StatusPlugins/StartupStatus/toolbars.cpp index 175615df6b..a135ee1a23 100644 --- a/plugins/StatusPlugins/StartupStatus/toolbars.cpp +++ b/plugins/StatusPlugins/StartupStatus/toolbars.cpp @@ -34,11 +34,11 @@ static int ttbButtonCount = 0; int RemoveTopToolbarButtons() { - int profileCount, i, orgButtonCount; + int profileCount, orgButtonCount; profileCount = CallService(MS_SS_GETPROFILECOUNT, 0, 0); orgButtonCount = ttbButtonCount; - for (i=0;i 0) - ttbButtons = ( HANDLE* )realloc(ttbButtons, ttbButtonCount*sizeof(HANDLE)); - else { - free(ttbButtons); - ttbButtons = NULL; - } - - return 0; -} - -///////////////////////////////////////////////////////////////////////////////////////// - void RegisterButtons() { TCHAR szFile[MAX_PATH]; diff --git a/plugins/Svc_crshdmp/crshdmp.cpp b/plugins/Svc_crshdmp/crshdmp.cpp index 18b9f230da..4f0acab235 100644 --- a/plugins/Svc_crshdmp/crshdmp.cpp +++ b/plugins/Svc_crshdmp/crshdmp.cpp @@ -19,7 +19,7 @@ along with this program. If not, see . #include "utils.h" #include #include "m_folders.h" -#include "m_toolbar.h" +#include "m_toptoolbar.h" #include "version.h" int hLangpack; @@ -210,45 +210,34 @@ int OptionsInit(WPARAM wParam, LPARAM) static int ToolbarModulesLoaded(WPARAM, LPARAM) { - TBButton tbb = {0}; - tbb.cbSize = sizeof(TBButton); + TTBButton tbb = {0}; + tbb.cbSize = sizeof(TTBButton); - tbb.pszButtonID = "clipvi_btn"; - tbb.pszButtonName = LPGEN("Version Information To Clipboard"); - tbb.pszServiceName = MS_CRASHDUMPER_STORETOCLIP; + tbb.name = LPGEN("Version Information To Clipboard"); + tbb.pszService = MS_CRASHDUMPER_STORETOCLIP; tbb.pszTooltipUp = LPGEN("Version Information To Clipboard"); - tbb.hPrimaryIconHandle = GetIconHandle("storeToClip"); - tbb.tbbFlags = TBBF_VISIBLE; - tbb.defPos = 10000; - CallService(MS_TB_ADDBUTTON,0, (LPARAM)&tbb); - - tbb.pszButtonID = "filevi_btn"; - tbb.pszButtonName = LPGEN("Version Information To File"); - tbb.pszServiceName = MS_CRASHDUMPER_STORETOFILE; + tbb.hIconHandleUp = GetIconHandle("storeToClip"); + tbb.dwFlags = TTBBF_VISIBLE | TTBBF_ICONBYHANDLE; + TopToolbar_AddButton(&tbb); + + tbb.name = LPGEN("Version Information To File"); + tbb.pszService = MS_CRASHDUMPER_STORETOFILE; tbb.pszTooltipUp = LPGEN("Version Information To File"); - tbb.hPrimaryIconHandle = GetIconHandle("storeToFile"); - tbb.tbbFlags = 0; - tbb.defPos = 10001; - CallService(MS_TB_ADDBUTTON,0, (LPARAM)&tbb); - - tbb.pszButtonID = "showvi_btn"; - tbb.pszButtonName = LPGEN("Show Version Information"); - tbb.pszServiceName = MS_CRASHDUMPER_VIEWINFO; + tbb.hIconHandleUp = GetIconHandle("storeToFile"); + tbb.dwFlags = TTBBF_ICONBYHANDLE; + TopToolbar_AddButton(&tbb); + + tbb.name = LPGEN("Show Version Information"); + tbb.pszService = MS_CRASHDUMPER_VIEWINFO; tbb.pszTooltipUp = LPGEN("Show Version Information"); - tbb.hPrimaryIconHandle = GetIconHandle("showInfo"); - tbb.tbbFlags = 0; - tbb.defPos = 10002; - CallService(MS_TB_ADDBUTTON,0, (LPARAM)&tbb); - - tbb.pszButtonID = "upldvi_btn"; - tbb.pszButtonName = LPGEN("Upload Version Information"); - tbb.pszServiceName = MS_CRASHDUMPER_UPLOAD; - tbb.pszTooltipUp = LPGEN("Upload Version Information"); - tbb.hPrimaryIconHandle = GetIconHandle("uploadInfo"); - tbb.tbbFlags = 0; - tbb.defPos = 10003; - CallService(MS_TB_ADDBUTTON,0, (LPARAM)&tbb); + tbb.hIconHandleUp = GetIconHandle("showInfo"); + TopToolbar_AddButton(&tbb); + tbb.name = LPGEN("Upload Version Information"); + tbb.pszService = MS_CRASHDUMPER_UPLOAD; + tbb.pszTooltipUp = LPGEN("Upload Version Information"); + tbb.hIconHandleUp = GetIconHandle("uploadInfo"); + TopToolbar_AddButton(&tbb); return 0; } @@ -282,7 +271,7 @@ static int ModulesLoaded(WPARAM, LPARAM) hHooks[2] = HookEvent(ME_FOLDERS_PATH_CHANGED, FoldersPathChanged); - if (hHooks[3] == NULL) hHooks[3] = HookEvent(ME_TB_MODULELOADED, ToolbarModulesLoaded); + if (hHooks[3] == NULL) hHooks[3] = HookEvent(ME_TTB_MODULELOADED, ToolbarModulesLoaded); UploadInit(); @@ -399,7 +388,7 @@ extern "C" int __declspec(dllexport) Load(void) hHooks[0] = HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded); hHooks[1] = HookEvent(ME_OPT_INITIALISE, OptionsInit); - hHooks[3] = HookEvent(ME_TB_MODULELOADED, ToolbarModulesLoaded); + hHooks[3] = HookEvent(ME_TTB_MODULELOADED, ToolbarModulesLoaded); hHooks[4] = HookEvent(ME_SYSTEM_PRESHUTDOWN, PreShutdown); packlcid = (LCID)CallService(MS_LANGPACK_GETLOCALE, 0, 0); diff --git a/plugins/Svc_dbepp/main.cpp b/plugins/Svc_dbepp/main.cpp index 358ff1a5d5..f289c1eb77 100644 --- a/plugins/Svc_dbepp/main.cpp +++ b/plugins/Svc_dbepp/main.cpp @@ -156,17 +156,10 @@ static int OnTTBLoaded(WPARAM wParam,LPARAM lParam) ttbb.cbSize = sizeof(ttbb); ttbb.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP; ttbb.pszService = "DBEditorpp/MenuCommand"; - ttbb.name = Translate("Database Editor++"); - ttbb.hIconUp = ico; - ttbb.hIconDn = ico; -// ttbb.tooltipDn = Translate("Show DataBase Editor"); - - hTTBButt = (HANDLE)CallService(MS_TTB_ADDBUTTON, (WPARAM)&ttbb, 0); - - if (hTTBButt) - CallService(MS_TTB_SETBUTTONOPTIONS,MAKEWPARAM(TTBO_TIPNAME,hTTBButt), - (LPARAM)(Translate("Show DataBase Editor"))); - + ttbb.name = "Database Editor++"; + ttbb.hIconUp = ttbb.hIconDn = ico; + ttbb.pszTooltipUp = "Show DataBase Editor"; + hTTBButt = TopToolbar_AddButton(&ttbb); return 0; } diff --git a/plugins/Updater/updater.cpp b/plugins/Updater/updater.cpp index 2d5ac9cc55..db4968c373 100644 --- a/plugins/Updater/updater.cpp +++ b/plugins/Updater/updater.cpp @@ -2,7 +2,7 @@ #include "updater.h" #include -#include "m_toolbar.h" +#include "m_toptoolbar.h" HINSTANCE hInst; @@ -179,33 +179,27 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) { static int ToolbarModulesLoaded(WPARAM, LPARAM) { - TBButton tbb = {0}; - tbb.cbSize = sizeof(TBButton); - tbb.tbbFlags = TBBF_SHOWTOOLTIP; + TTBButton tbb = {0}; + tbb.cbSize = sizeof(TTBButton); + tbb.dwFlags = TTBBF_SHOWTOOLTIP | TTBBF_ICONBYHANDLE; - tbb.pszButtonID = "updater_checkforupdates"; - tbb.pszButtonName = LPGEN("Check for Updates"); - tbb.pszServiceName = MS_UPDATE_CHECKFORUPDATES; + tbb.name = LPGEN("Check for Updates"); + tbb.pszService = MS_UPDATE_CHECKFORUPDATES; tbb.pszTooltipUp = LPGEN("Check for Updates of Plugins"); - tbb.hPrimaryIconHandle = GetIconHandle(I_CHKUPD); - tbb.defPos = 1000; - CallService(MS_TB_ADDBUTTON, 0, (LPARAM)&tbb); + tbb.hIconHandleUp = GetIconHandle(I_CHKUPD); + TopToolbar_AddButton(&tbb); - tbb.pszButtonID = "updater_restart"; - tbb.pszButtonName = LPGEN("Restart"); - tbb.pszServiceName = MS_UPDATE_MENURESTART; + tbb.name = LPGEN("Restart"); + tbb.pszService = MS_UPDATE_MENURESTART; tbb.pszTooltipUp = LPGEN("Restart Miranda IM"); - tbb.hPrimaryIconHandle = GetIconHandle(I_RSTRT); - tbb.defPos = 1001; - CallService(MS_TB_ADDBUTTON, 0, (LPARAM)&tbb); + tbb.hIconHandleUp = GetIconHandle(I_RSTRT); + TopToolbar_AddButton(&tbb); - tbb.pszButtonID = "updater_updateandexit"; - tbb.pszButtonName = LPGEN("Update and Exit"); - tbb.pszServiceName = MS_UPDATE_MENUUPDATEANDEXIT; + tbb.name = LPGEN("Update and Exit"); + tbb.pszService = MS_UPDATE_MENUUPDATEANDEXIT; tbb.pszTooltipUp = LPGEN("Update and Exit Miranda IM"); - tbb.hPrimaryIconHandle = GetIconHandle(I_CHKUPDEXT); - tbb.defPos = 1002; - CallService(MS_TB_ADDBUTTON,0, (LPARAM)&tbb); + tbb.hIconHandleUp = GetIconHandle(I_CHKUPDEXT); + TopToolbar_AddButton(&tbb); return 0; } @@ -229,7 +223,7 @@ extern "C" int __declspec(dllexport) Load(void) hEventOptInit = HookEvent(ME_OPT_INITIALISE, OptInit); hEventModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded); - hToolBarLoaded = HookEvent(ME_TB_MODULELOADED, ToolbarModulesLoaded); + hToolBarLoaded = HookEvent(ME_TTB_MODULELOADED, ToolbarModulesLoaded); InitServices(); InitIcons(); diff --git a/plugins/UserInfoEx/commonheaders.h b/plugins/UserInfoEx/commonheaders.h index e7b4f51bad..6501954a7b 100644 --- a/plugins/UserInfoEx/commonheaders.h +++ b/plugins/UserInfoEx/commonheaders.h @@ -107,7 +107,6 @@ typedef std::basic_string tstring; #include "m_flags.h" #include "m_metacontacts.h" #include "m_magneticwindows.h" -#include "m_toolbar.h" #include "m_toptoolbar.h" #include "m_userinfoex.h" diff --git a/plugins/UserInfoEx/dlg_anniversarylist.cpp b/plugins/UserInfoEx/dlg_anniversarylist.cpp index 0ea9b5b645..827e4e7b78 100644 --- a/plugins/UserInfoEx/dlg_anniversarylist.cpp +++ b/plugins/UserInfoEx/dlg_anniversarylist.cpp @@ -1095,29 +1095,9 @@ VOID DlgAnniversaryListOnTopToolBarLoaded() ttb.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP | TTBBF_ICONBYHANDLE; ttb.pszService = MS_USERINFO_REMINDER_LIST; ttb.hIconHandleDn = ttb.hIconHandleUp = Skin_GetIconHandle(ICO_COMMON_ANNIVERSARY); + ttb.pszTooltipDn = ttb.pszTooltipUp = LPGEN("Anniversary list"); ttb.name = "Anniversary list"; - CallService(MS_TTB_ADDBUTTON, (WPARAM) &ttb, 0); -} - -/** - * This function is called by the ME_TB_MODULELOADED event. - * It adds a set of buttons to the Toolbar of the Modern Contact List. - * - * @param wParam - none - * - * @return nothing - **/ -VOID DlgAnniversaryListOnToolBarLoaded() -{ - TBButton tbb = { 0 }; - tbb.cbSize = sizeof(tbb); - tbb.tbbFlags = TBBF_VISIBLE | TBBF_SHOWTOOLTIP; - tbb.defPos = 2100; - tbb.pszButtonName = tbb.pszButtonID = TBB_IDBTN; - tbb.pszServiceName = MS_USERINFO_REMINDER_LIST; - tbb.pszTooltipDn = tbb.pszTooltipUp = LPGEN("Anniversary list"); - tbb.hPrimaryIconHandle = tbb.hSecondaryIconHandle = Skin_GetIconHandle(ICO_COMMON_ANNIVERSARY); - CallService(MS_TB_ADDBUTTON, 0, (LPARAM) &tbb); + TopToolbar_AddButton(&ttb); } /** diff --git a/plugins/UserInfoEx/dlg_anniversarylist.h b/plugins/UserInfoEx/dlg_anniversarylist.h index 63d095a7ef..e7ff89e99c 100644 --- a/plugins/UserInfoEx/dlg_anniversarylist.h +++ b/plugins/UserInfoEx/dlg_anniversarylist.h @@ -38,7 +38,6 @@ Last change by : $Author: ing.u.horn $ INT_PTR DlgAnniversaryListShow(WPARAM wParam, LPARAM lParam); VOID DlgAnniversaryListOnTopToolBarLoaded(); -VOID DlgAnniversaryListOnToolBarLoaded(); VOID DlgAnniversaryListLoadModule(); #endif /* _DLGANNIVERSARYLIST_H_ */ \ No newline at end of file diff --git a/plugins/UserInfoEx/init.cpp b/plugins/UserInfoEx/init.cpp index 514260af99..a36e828fe7 100644 --- a/plugins/UserInfoEx/init.cpp +++ b/plugins/UserInfoEx/init.cpp @@ -89,29 +89,11 @@ int hLangpack; **/ static INT OnTopToolBarLoaded(WPARAM wParam, LPARAM lParam) { - UnhookEvent(ghTopToolBarLoaded); DlgAnniversaryListOnTopToolBarLoaded(); SvcReminderOnTopToolBarLoaded(); return 0; } -/** - * This function is called by the ME_TB_MODULELOADED event. - * It adds a set of buttons to the Toolbar of the Modern Contact List. - * - * @param wParam - not used - * @param lParam - not used - * - * @return always 0 - **/ -static INT OnModernToolBarLoaded(WPARAM wParam, LPARAM lParam) -{ - UnhookEvent(ghModernToolBarLoaded); - DlgAnniversaryListOnToolBarLoaded(); - SvcReminderOnToolBarLoaded(); - return 0; -} - /** * This function is called by Miranda just after loading all system modules. * @@ -122,17 +104,13 @@ static INT OnModernToolBarLoaded(WPARAM wParam, LPARAM lParam) **/ static INT OnModulesLoaded(WPARAM wParam, LPARAM lParam) { - INT_PTR ptr; - - UnhookEvent(ghModulesLoadedHook); - myGlobals.HaveCListExtraIcons = ServiceExists(MS_CLIST_EXTRA_SET_ICON); myGlobals.ExtraIconsServiceExist = ServiceExists(MS_EXTRAICON_REGISTER); myGlobals.PopUpActionsExist = ServiceExists(MS_POPUP_REGISTERACTIONS); myGlobals.MsgAddIconExist = ServiceExists(MS_MSG_ADDICON); // init meta contacts - ptr = CallService(MS_MC_GETPROTOCOLNAME, 0, 0); + INT_PTR ptr = CallService(MS_MC_GETPROTOCOLNAME, 0, 0); myGlobals.szMetaProto = (ptr != CALLSERVICE_NOTFOUND) ? (LPCSTR)ptr : NULL; // options @@ -352,10 +330,9 @@ extern "C" INT __declspec(dllexport) Load(void) SvcReminderLoadModule(); // Now the module is loaded! Start initializing certain things - ghModulesLoadedHook = HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded); - ghTopToolBarLoaded = HookEvent(ME_TTB_MODULELOADED, OnTopToolBarLoaded); - ghModernToolBarLoaded = HookEvent(ME_TB_MODULELOADED, OnModernToolBarLoaded); - ghShutdownHook = HookEvent(ME_SYSTEM_SHUTDOWN, OnShutdown); + ghModulesLoadedHook = HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded); + ghTopToolBarLoaded = HookEvent(ME_TTB_MODULELOADED, OnTopToolBarLoaded); + ghShutdownHook = HookEvent(ME_SYSTEM_SHUTDOWN, OnShutdown); return 0; } diff --git a/plugins/UserInfoEx/svc_reminder.cpp b/plugins/UserInfoEx/svc_reminder.cpp index deda692bee..132ee62d56 100644 --- a/plugins/UserInfoEx/svc_reminder.cpp +++ b/plugins/UserInfoEx/svc_reminder.cpp @@ -901,7 +901,7 @@ static INT OnContactSettingChanged(HANDLE hContact, DBCONTACTWRITESETTING* pdbcw * * @return nothing **/ -int hTTButton = -1; + VOID SvcReminderOnTopToolBarLoaded() { TTBButton ttb = { 0 }; @@ -910,37 +910,9 @@ VOID SvcReminderOnTopToolBarLoaded() ttb.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP | TTBBF_ICONBYHANDLE; ttb.pszService = MS_USERINFO_REMINDER_CHECK; ttb.name = "Check anniversaries"; + ttb.pszTooltipUp = ttb.pszTooltipDn = LPGEN("Check anniversaries"); ttb.hIconHandleDn = ttb.hIconHandleUp = Skin_GetIconHandle(ICO_COMMON_BIRTHDAY); - - hTTButton = CallService(MS_TTB_ADDBUTTON, (WPARAM) &ttb, 0); - if (hTTButton) - CallService(MS_TTB_SETBUTTONOPTIONS, MAKEWPARAM(TTBO_TIPNAME, hTTButton), (LPARAM)"Check anniversaries"); -} - -/** - * This function is called by the ME_TB_MODULELOADED event. - * It adds a set of buttons to the Toolbar of the Modern Contact List. - * - * @param none - * - * @return nothing - **/ -VOID SvcReminderOnToolBarLoaded() -{ - TBButton tbb; - - ZeroMemory(&tbb, sizeof(tbb)); - tbb.cbSize = sizeof(tbb); - tbb.defPos = 2000; - tbb.tbbFlags = TBBF_VISIBLE | TBBF_SHOWTOOLTIP; - tbb.pszButtonName = - tbb.pszButtonID = TBB_IDBTN; - tbb.pszServiceName = MS_USERINFO_REMINDER_CHECK; - tbb.pszTooltipDn = - tbb.pszTooltipUp = LPGEN("Check anniversaries"); - tbb.hPrimaryIconHandle = tbb.hSecondaryIconHandle = Skin_GetIconHandle(ICO_COMMON_BIRTHDAY); - - CallService(MS_TB_ADDBUTTON, 0, (LPARAM) &tbb); + TopToolbar_AddButton(&ttb); } diff --git a/plugins/UserInfoEx/svc_reminder.h b/plugins/UserInfoEx/svc_reminder.h index f55762be20..210250b9f3 100644 --- a/plugins/UserInfoEx/svc_reminder.h +++ b/plugins/UserInfoEx/svc_reminder.h @@ -108,7 +108,6 @@ VOID SvcReminderCheckAll(const ENotify notify); LPCSTR SvcReminderGetMyBirthdayModule(VOID); VOID SvcReminderOnTopToolBarLoaded(VOID); -VOID SvcReminderOnToolBarLoaded(VOID); VOID SvcReminderOnModulesLoaded(VOID); VOID SvcReminderEnable(BOOLEAN bEnable); diff --git a/plugins/WhenWasIt/hooked_events.cpp b/plugins/WhenWasIt/hooked_events.cpp index dca0cbf879..e80c3e3258 100644 --- a/plugins/WhenWasIt/hooked_events.cpp +++ b/plugins/WhenWasIt/hooked_events.cpp @@ -175,12 +175,12 @@ int OnModulesLoaded(WPARAM wParam, LPARAM lParam) int OnTopToolBarModuleLoaded(WPARAM wParam, LPARAM lParam) { TTBButton ttb = {0}; - ttb.cbSize = sizeof(TTBButton); + ttb.cbSize = sizeof(ttb); ttb.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP; ttb.pszService = MS_WWI_CHECK_BIRTHDAYS; ttb.hIconUp = ttb.hIconDn = hiCheckMenu; ttb.name = "Check for birthdays"; - CallService(MS_TTB_ADDBUTTON, (WPARAM) &ttb, 0); + TopToolbar_AddButton(&ttb); return 0; } diff --git a/plugins/WhoUsesMyFiles/wumfplug.c b/plugins/WhoUsesMyFiles/wumfplug.c index 568917f031..1a547d1ad0 100644 --- a/plugins/WhoUsesMyFiles/wumfplug.c +++ b/plugins/WhoUsesMyFiles/wumfplug.c @@ -6,7 +6,7 @@ const char ModuleName[] = "WUMF Plugin"; HANDLE hMenuItem = 0; extern HANDLE hLog; static HWND hDlg; -static int hWumfBut; +static HANDLE hWumfBut; extern PWumf list; int hLangpack; @@ -263,7 +263,7 @@ static INT_PTR WumfShowConnections(WPARAM wParam,LPARAM lParam) DWORD threadID = 0; CloseHandle(CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)ThreadProc, (LPVOID)NULL,0,&threadID)); Sleep(100); - CallService(MS_TTB_SETBUTTONSTATE,hWumfBut,TTBST_RELEASED); + CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)hWumfBut, TTBST_RELEASED); return 0; } @@ -550,15 +550,15 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg,UINT msg,WPARAM wparam,LPARAM lpara int InitTopToolbar(WPARAM wparam,LPARAM lparam) { - TTBButton ttb = { 0 }; - char buttonname[] = "WUMF: Show connections list"; - ttb.cbSize = sizeof(ttb); + TTBButton ttb = { 0 }; + char buttonname[] = "WUMF: Show connections list"; + ttb.cbSize = sizeof(ttb); ttb.hIconUp = LoadIcon(hInst, MAKEINTRESOURCE(IDB_DRIVE)); ttb.hIconDn = ttb.hIconUp; ttb.pszService = MS_WUMF_CONNECTIONSSHOW; ttb.dwFlags = TTBBF_VISIBLE|TTBBF_SHOWTOOLTIP; ttb.name = buttonname; - hWumfBut = CallService(MS_TTB_ADDBUTTON, (WPARAM)&ttb,(LPARAM)0); + hWumfBut = TopToolbar_AddButton(&ttb); return 0; } 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