diff options
Diffstat (limited to 'plugins/StatusPlugins/StartupStatus')
4 files changed, 10 insertions, 89 deletions
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 <m_options.h>
#include <m_clui.h>
#include <m_toptoolbar.h>
-#include <m_toolbar.h>
#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<orgButtonCount;i++)
+ for (int i=0; i < orgButtonCount; i++)
if (CallService(MS_TTB_REMOVEBUTTON, (WPARAM)ttbButtons[i], 0) != 1)
ttbButtonCount -= 1;
@@ -77,11 +77,10 @@ int CreateTopToolbarButtons(WPARAM wParam, LPARAM lParam) ttb.hIconHandleDn = hTtbDown;
ttb.hIconHandleUp = hTtbUp;
ttb.wParamDown = ttb.wParamUp = i;
- INT_PTR ttbAddResult = CallService(MS_TTB_ADDBUTTON, (WPARAM)&ttb, 0);
- if (ttbAddResult != -1) {
- ttbButtons[ttbButtonCount] = (HANDLE)ttbAddResult;
-
- CallService(MS_TTB_SETBUTTONOPTIONS,MAKEWPARAM(TTBO_TIPNAME,ttbButtons[ttbButtonCount]), (LPARAM)profileName);
+ ttb.pszTooltipDn = ttb.pszTooltipUp = profileName;
+ HANDLE ttbAddResult = TopToolbar_AddButton(&ttb);
+ if (ttbAddResult) {
+ ttbButtons[ttbButtonCount] = ttbAddResult;
DBFreeVariant(&dbv);
ttbButtonCount += 1;
}
@@ -98,76 +97,6 @@ int CreateTopToolbarButtons(WPARAM wParam, LPARAM lParam) /////////////////////////////////////////////////////////////////////////////////////////
-int RemoveToolbarButtons()
-{
- int profileCount, i, orgButtonCount;
-
- profileCount = CallService(MS_SS_GETPROFILECOUNT, 0, 0);
- orgButtonCount = ttbButtonCount;
- for ( i=0; i < orgButtonCount; i++ )
- if ( !CallService( MS_TB_REMOVEBUTTON, (WPARAM)ttbButtons[i], 0 ))
- ttbButtonCount --;
-
- if ( ttbButtonCount == 0 ) {
- free( ttbButtons );
- ttbButtons = NULL;
- }
- else ttbButtons = ( HANDLE* )realloc(ttbButtons, profileCount*sizeof(HANDLE));
-
- return 0;
-}
-
-int CreateToolbarButtons(WPARAM wParam, LPARAM lParam)
-{
- char setting[80];
-
- int profileCount = CallService(MS_SS_GETPROFILECOUNT, 0, 0);
- ttbButtons = ( HANDLE* )realloc(ttbButtons, profileCount*sizeof(HANDLE));
-
- TBButton ttb = { 0 };
- ttb.cbSize = sizeof(ttb);
- ttb.tbbFlags = TBBF_VISIBLE | TBBF_SHOWTOOLTIP;
- ttb.pszServiceName = MS_SS_LOADANDSETPROFILE;
- for (int i=0; i < profileCount; i++ ) {
- char profileName[128];
- INT_PTR ttbAddResult = -1;
-
- _snprintf(setting, sizeof(setting), "%d_%s", i, SETTING_CREATETTBBUTTON);
- if (!DBGetContactSettingByte(NULL, MODULENAME, setting, FALSE))
- continue;
-
- DBVARIANT dbv;
- _snprintf(setting, sizeof(setting), "%d_%s", i, SETTING_PROFILENAME);
- if (DBGetContactSetting(NULL, MODULENAME, setting, &dbv))
- continue;
-
- strncpy(profileName, dbv.pszVal, sizeof(profileName)-1);
- ttb.pszButtonID = "LaunchProfile";
- ttb.pszButtonName = profileName;
- ttb.pszTooltipUp = ttb.pszTooltipDn = profileName;
- ttb.hPrimaryIconHandle = hTtbUp;
- ttb.hSecondaryIconHandle = hTtbDown;
- ttb.defPos = 200;
- ttb.lParam = i;
- ttbAddResult = CallService( MS_TB_ADDBUTTON, 0, (LPARAM)&ttb );
- if (ttbAddResult != -1) {
- ttbButtons[ttbButtonCount] = (HANDLE)ttbAddResult;
- ttbButtonCount += 1;
- }
- DBFreeVariant( &dbv );
- }
- if (ttbButtonCount > 0)
- ttbButtons = ( HANDLE* )realloc(ttbButtons, ttbButtonCount*sizeof(HANDLE));
- else {
- free(ttbButtons);
- ttbButtons = NULL;
- }
-
- return 0;
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
void RegisterButtons()
{
TCHAR szFile[MAX_PATH];
|