diff options
author | George Hazan <george.hazan@gmail.com> | 2012-07-08 20:51:14 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-07-08 20:51:14 +0000 |
commit | 696f4ea57845f48d6d979ecd9d66bb22bd9f738d (patch) | |
tree | c32ac05d363bff47320c1b204561b966aa1c81fd /plugins/BASS_interface/src/Main.cpp | |
parent | 3b396a2da6b0b8e0f4d2c051aca133772d317820 (diff) |
TopToolbar usage fixed everywhere
git-svn-id: http://svn.miranda-ng.org/main/trunk@861 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/BASS_interface/src/Main.cpp')
-rw-r--r-- | plugins/BASS_interface/src/Main.cpp | 58 |
1 files changed, 21 insertions, 37 deletions
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 |