diff options
author | George Hazan <george.hazan@gmail.com> | 2012-06-10 14:46:58 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-06-10 14:46:58 +0000 |
commit | 101ca36412b3e7b8851b6b48a4f6cbc17d9f9eff (patch) | |
tree | a846c60f7c2a7df17b694deba92e7f6df3bbb882 /plugins/StatusPlugins | |
parent | a3fdadd09f12f6b246b11a5156bf6f0358e9a5f8 (diff) |
bitmap operations were removed from TopToolBar and replaced with IcoLib
git-svn-id: http://svn.miranda-ng.org/main/trunk@379 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/StatusPlugins')
-rw-r--r-- | plugins/StatusPlugins/StartupStatus/StartupStatus.rc | 10 | ||||
-rw-r--r-- | plugins/StatusPlugins/StartupStatus/options.cpp | 2 | ||||
-rw-r--r-- | plugins/StatusPlugins/StartupStatus/profiles.cpp | 11 | ||||
-rw-r--r-- | plugins/StatusPlugins/StartupStatus/res/ttbDown.bmp | bin | 1398 -> 0 bytes | |||
-rw-r--r-- | plugins/StatusPlugins/StartupStatus/res/ttbUp.bmp | bin | 1398 -> 0 bytes | |||
-rw-r--r-- | plugins/StatusPlugins/StartupStatus/startupstatus.cpp | 6 | ||||
-rw-r--r-- | plugins/StatusPlugins/StartupStatus/startupstatus.h | 1 | ||||
-rw-r--r-- | plugins/StatusPlugins/StartupStatus/toolbars.cpp | 41 | ||||
-rw-r--r-- | plugins/StatusPlugins/resource.h | 2 |
9 files changed, 29 insertions, 44 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 Binary files differdeleted file mode 100644 index 91f95e240b..0000000000 --- a/plugins/StatusPlugins/StartupStatus/res/ttbDown.bmp +++ /dev/null diff --git a/plugins/StatusPlugins/StartupStatus/res/ttbUp.bmp b/plugins/StatusPlugins/StartupStatus/res/ttbUp.bmp Binary files differdeleted file mode 100644 index 5b684407a5..0000000000 --- a/plugins/StatusPlugins/StartupStatus/res/ttbUp.bmp +++ /dev/null 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);
}
diff --git a/plugins/StatusPlugins/resource.h b/plugins/StatusPlugins/resource.h index 38bdf18a3b..3fbeccde84 100644 --- a/plugins/StatusPlugins/resource.h +++ b/plugins/StatusPlugins/resource.h @@ -9,8 +9,6 @@ #define IDD_CMDLOPTIONS 106
#define IDD_ADDPROFILE 109
#define IDD_OPT_STARTUPSTATUS 110
-#define IDB_TTBDOWN 111
-#define IDB_TTBUP 112
#define IDD_PUOPT_KEEPSTATUS 113
#define IDD_OPT_AUTOAWAYMSG 114
#define IDI_TICK 117
|