summaryrefslogtreecommitdiff
path: root/plugins/StatusPlugins/StartupStatus
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/StatusPlugins/StartupStatus')
-rw-r--r--plugins/StatusPlugins/StartupStatus/StartupStatus.rc10
-rw-r--r--plugins/StatusPlugins/StartupStatus/options.cpp2
-rw-r--r--plugins/StatusPlugins/StartupStatus/profiles.cpp11
-rw-r--r--plugins/StatusPlugins/StartupStatus/res/ttbDown.bmpbin1398 -> 0 bytes
-rw-r--r--plugins/StatusPlugins/StartupStatus/res/ttbUp.bmpbin1398 -> 0 bytes
-rw-r--r--plugins/StatusPlugins/StartupStatus/startupstatus.cpp6
-rw-r--r--plugins/StatusPlugins/StartupStatus/startupstatus.h1
-rw-r--r--plugins/StatusPlugins/StartupStatus/toolbars.cpp41
8 files changed, 29 insertions, 42 deletions
diff --git a/plugins/StatusPlugins/StartupStatus/StartupStatus.rc b/plugins/StatusPlugins/StartupStatus/StartupStatus.rc
index fd2f96e9f3..8f41f36229 100644
--- a/plugins/StatusPlugins/StartupStatus/StartupStatus.rc
+++ b/plugins/StatusPlugins/StartupStatus/StartupStatus.rc
@@ -27,18 +27,18 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
// TEXTINCLUDE
//
-1 TEXTINCLUDE
+1 TEXTINCLUDE
BEGIN
"..\\resource.h\0"
END
-2 TEXTINCLUDE
+2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
-3 TEXTINCLUDE
+3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
@@ -53,8 +53,7 @@ END
IDI_TTBDOWN ICON "res\\ttbDown.ico"
IDI_TTBUP ICON "res\\ttbUp.ico"
-IDB_TTBDOWN BITMAP "res\\ttbDown.bmp"
-IDB_TTBUP BITMAP "res\\ttbUp.bmp"
+
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
@@ -69,4 +68,3 @@ IDB_TTBUP BITMAP "res\\ttbUp.bmp"
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
-
diff --git a/plugins/StatusPlugins/StartupStatus/options.cpp b/plugins/StatusPlugins/StartupStatus/options.cpp
index 6422091cc6..91b437f7ed 100644
--- a/plugins/StatusPlugins/StartupStatus/options.cpp
+++ b/plugins/StatusPlugins/StartupStatus/options.cpp
@@ -33,8 +33,6 @@ static int CountSettings(const char *szSetting,LPARAM lParam);
static int DeleteSetting(const char *szSetting,LPARAM lParam);
static int ClearDatabase(char* filter);
-int LoadMainOptions();
-
/////////////////////////////////////////////////////////////////////////////////////////
static TSettingsList* GetCurrentProtoSettings()
diff --git a/plugins/StatusPlugins/StartupStatus/profiles.cpp b/plugins/StatusPlugins/StartupStatus/profiles.cpp
index c6f4298f19..339733b31a 100644
--- a/plugins/StatusPlugins/StartupStatus/profiles.cpp
+++ b/plugins/StatusPlugins/StartupStatus/profiles.cpp
@@ -366,7 +366,7 @@ static int UnregisterHotKeys()
return 0;
}
-int ReinitProfileModule()
+int LoadMainOptions()
{
if (ServiceExists(MS_TTB_ADDBUTTON)) {
RemoveTopToolbarButtons();
@@ -376,17 +376,15 @@ int ReinitProfileModule()
RemoveTopToolbarButtons();
CreateTopToolbarButtons(0,0);
}
+
UnregisterHotKeys();
RegisterHotKeys();
-
return 0;
}
int LoadProfileModule()
{
hLoadAndSetProfileService = CreateServiceFunction(MS_SS_LOADANDSETPROFILE, LoadAndSetProfile);
- hTBModuleLoadedHook = HookEvent(ME_TB_MODULELOADED, CreateToolbarButtons);
-
RegisterButtons();
return 0;
}
@@ -394,10 +392,11 @@ int LoadProfileModule()
int InitProfileModule()
{
hTTBModuleLoadedHook = HookEvent(ME_TTB_MODULELOADED, CreateTopToolbarButtons);
- ReinitProfileModule();
+ hTBModuleLoadedHook = HookEvent(ME_TB_MODULELOADED, CreateToolbarButtons);
hPrebuildProfilesMenu = HookEvent( ME_CLIST_PREBUILDSTATUSMENU, CreateMainMenuItems);
- CreateMainMenuItems(0,0);
+ CreateMainMenuItems(0,0);
+ RegisterHotKeys();
return 0;
}
diff --git a/plugins/StatusPlugins/StartupStatus/res/ttbDown.bmp b/plugins/StatusPlugins/StartupStatus/res/ttbDown.bmp
deleted file mode 100644
index 91f95e240b..0000000000
--- a/plugins/StatusPlugins/StartupStatus/res/ttbDown.bmp
+++ /dev/null
Binary files differ
diff --git a/plugins/StatusPlugins/StartupStatus/res/ttbUp.bmp b/plugins/StatusPlugins/StartupStatus/res/ttbUp.bmp
deleted file mode 100644
index 5b684407a5..0000000000
--- a/plugins/StatusPlugins/StartupStatus/res/ttbUp.bmp
+++ /dev/null
Binary files differ
diff --git a/plugins/StatusPlugins/StartupStatus/startupstatus.cpp b/plugins/StatusPlugins/StartupStatus/startupstatus.cpp
index 13b58e2e52..c9ad54ebb7 100644
--- a/plugins/StatusPlugins/StartupStatus/startupstatus.cpp
+++ b/plugins/StatusPlugins/StartupStatus/startupstatus.cpp
@@ -284,12 +284,6 @@ static VOID CALLBACK SetStatusTimed(HWND hwnd,UINT message, UINT_PTR idEvent,DWO
CallService(MS_CS_SETSTATUSEX, (WPARAM)&startupSettings, 0);
}
-int LoadMainOptions()
-{
- ReinitProfileModule();
- return 0;
-}
-
static int Exit(WPARAM wParam, LPARAM lParam)
{
DeinitProfilesModule();
diff --git a/plugins/StatusPlugins/StartupStatus/startupstatus.h b/plugins/StatusPlugins/StartupStatus/startupstatus.h
index 19ff57e76f..c1e8e69bb8 100644
--- a/plugins/StatusPlugins/StartupStatus/startupstatus.h
+++ b/plugins/StatusPlugins/StartupStatus/startupstatus.h
@@ -159,7 +159,6 @@ void RegisterButtons();
int LoadProfileModule();
int InitProfileModule();
-int ReinitProfileModule();
int DeinitProfilesModule();
#endif //__STARTUPSTATUSHEADER
diff --git a/plugins/StatusPlugins/StartupStatus/toolbars.cpp b/plugins/StatusPlugins/StartupStatus/toolbars.cpp
index 7a12697c52..9b8ab6c475 100644
--- a/plugins/StatusPlugins/StartupStatus/toolbars.cpp
+++ b/plugins/StatusPlugins/StartupStatus/toolbars.cpp
@@ -53,35 +53,34 @@ int RemoveTopToolbarButtons()
int CreateTopToolbarButtons(WPARAM wParam, LPARAM lParam)
{
- TTBButton ttb;
- int i, profileCount;
- DBVARIANT dbv;
- char setting[80];
-
- profileCount = CallService(MS_SS_GETPROFILECOUNT, 0, 0);
+ int profileCount = CallService(MS_SS_GETPROFILECOUNT, 0, 0);
ttbButtons = ( HANDLE* )realloc(ttbButtons, profileCount*sizeof(HANDLE));
- ZeroMemory(&ttb,sizeof(ttb));
- ZeroMemory(&dbv,sizeof(dbv));
+
+ TTBButton ttb = { 0 };
ttb.cbSize = sizeof(ttb);
- ttb.dwFlags = TTBBF_VISIBLE|TTBBF_SHOWTOOLTIP;
- ttb.hbBitmapDown = LoadBitmap(hInst,MAKEINTRESOURCE(IDB_TTBDOWN));
- ttb.hbBitmapUp = LoadBitmap(hInst,MAKEINTRESOURCE(IDB_TTBUP));
+ ttb.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP | TTBBF_ICONBYHANDLE;
ttb.pszServiceDown = ttb.pszServiceUp = MS_SS_LOADANDSETPROFILE;
- for (i=0;i<profileCount;i++) {
- char profileName[128];
- INT_PTR ttbAddResult = -1;
-
+ for (int i=0; i < profileCount; i++) {
+ char setting[80];
_snprintf(setting, sizeof(setting), "%d_%s", i, SETTING_CREATETTBBUTTON);
- if (!DBGetContactSettingByte(NULL, MODULENAME, setting, FALSE)) continue;
+ 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;
+ if (DBGetContactSetting(NULL, MODULENAME, setting, &dbv))
+ continue;
+
+ char profileName[128];
strncpy(profileName, dbv.pszVal, sizeof(profileName)-1);
ttb.name = profileName;
+ ttb.hIconHandleDn = hTtbDown;
+ ttb.hIconHandleUp = hTtbUp;
ttb.wParamDown = ttb.wParamUp = i;
- ttbAddResult = CallService(MS_TTB_ADDBUTTON, (WPARAM)&ttb, 0);
+ INT_PTR ttbAddResult = CallService(MS_TTB_ADDBUTTON, (WPARAM)&ttb, 0);
if (ttbAddResult != -1) {
ttbButtons[ttbButtonCount] = (HANDLE)ttbAddResult;
- // this tooltip makes miranda crash if changed > 3 times or so
+
CallService(MS_TTB_SETBUTTONOPTIONS,MAKEWPARAM(TTBO_TIPNAME,ttbButtons[ttbButtonCount]), (LPARAM)profileName);
DBFreeVariant(&dbv);
ttbButtonCount += 1;
@@ -182,10 +181,10 @@ void RegisterButtons()
sid.pszDescription = "Pressed toolbar icon";
sid.iDefaultIndex = -IDI_TTBDOWN;
sid.flags = SIDF_PATH_TCHAR;
- hTtbDown = (HANDLE)CallService(MS_SKIN2_ADDICON, 0, (LPARAM)&sid);
+ hTtbDown = Skin_AddIcon(&sid);
sid.pszName = "StartupStatus/TtbUp";
sid.pszDescription = "Released toolbar icon";
sid.iDefaultIndex = -IDI_TTBUP;
- hTtbUp = (HANDLE)CallService(MS_SKIN2_ADDICON, 0, (LPARAM)&sid);
+ hTtbUp = Skin_AddIcon(&sid);
}