diff options
author | George Hazan <ghazan@miranda.im> | 2016-12-01 20:51:42 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2016-12-01 21:49:54 +0300 |
commit | f9c7760f54c279327a977b0cb5ee028c8f0c0bfb (patch) | |
tree | 0a1cf4602a5eac89dc38606cc91981c2166a83e0 | |
parent | 40203d30ad1a569cfea61442782393b200e9fbe3 (diff) |
more fixes
31 files changed, 220 insertions, 279 deletions
diff --git a/bin10/lib/mir_app.lib b/bin10/lib/mir_app.lib Binary files differindex f31d787490..2c67e57368 100644 --- a/bin10/lib/mir_app.lib +++ b/bin10/lib/mir_app.lib diff --git a/bin10/lib/mir_app64.lib b/bin10/lib/mir_app64.lib Binary files differindex d653ce9d6e..87d51a3788 100644 --- a/bin10/lib/mir_app64.lib +++ b/bin10/lib/mir_app64.lib diff --git a/bin12/lib/mir_app.lib b/bin12/lib/mir_app.lib Binary files differindex f31d787490..2c67e57368 100644 --- a/bin12/lib/mir_app.lib +++ b/bin12/lib/mir_app.lib diff --git a/bin12/lib/mir_app64.lib b/bin12/lib/mir_app64.lib Binary files differindex d653ce9d6e..87d51a3788 100644 --- a/bin12/lib/mir_app64.lib +++ b/bin12/lib/mir_app64.lib diff --git a/bin14/lib/mir_app.lib b/bin14/lib/mir_app.lib Binary files differindex f31d787490..2c67e57368 100644 --- a/bin14/lib/mir_app.lib +++ b/bin14/lib/mir_app.lib diff --git a/bin14/lib/mir_app64.lib b/bin14/lib/mir_app64.lib Binary files differindex d653ce9d6e..87d51a3788 100644 --- a/bin14/lib/mir_app64.lib +++ b/bin14/lib/mir_app64.lib diff --git a/include/m_message.h b/include/m_message.h index 402c62f880..f5106c4ce9 100644 --- a/include/m_message.h +++ b/include/m_message.h @@ -285,8 +285,37 @@ EXTERN_C MIR_APP_DLL(void) Srmm_RedrawToolbarIcons(HWND hwndDlg); #define ME_MSG_TOOLBARLOADED "SRMM/ButtonsBar/ModuleLoaded"
/////////////////////////////////////////////////////////////////////////////////////////
+// toolbar button clicked event
+
+EXTERN_C MIR_APP_DLL(void) Srmm_ClickToolbarIcon(MCONTACT hContact, DWORD idFrom, HWND hwndFrom, BOOL code);
+
+// wParam = (HANDLE)hContact;
+// lParam = (CustomButtonClickData *)&CustomButtonClickData;
+// catch to show a popup menu, etc.
+#define ME_MSG_BUTTONPRESSED "SRMM/ButtonsBar/ButtonPressed"
+
+// event flags
+#define BBCF_RIGHTBUTTON (1<<0)
+#define BBCF_SHIFTPRESSED (1<<1)
+#define BBCF_CONTROLPRESSED (1<<2)
+#define BBCF_ARROWCLICKED (1<<3)
+
+struct CustomButtonClickData
+{
+ char *pszModule; // button owners name
+ POINT pt; // screen coordinates for menus
+ DWORD dwButtonId; // registered button ID
+ HWND hwndFrom; // button parents HWND
+ MCONTACT hContact;
+ DWORD flags; // BBCF_ flags
+};
+
+/////////////////////////////////////////////////////////////////////////////////////////
// toolbar button internal representation
+#define MIN_CBUTTONID 4000
+#define MAX_CBUTTONID 5000
+
#define BBSF_IMBUTTON (1<<0)
#define BBSF_CHATBUTTON (1<<1)
#define BBSF_CANBEHIDDEN (1<<2)
diff --git a/plugins/BossKeyPlus/src/BossKey.cpp b/plugins/BossKeyPlus/src/BossKey.cpp index 5d7921af84..0c2766fa25 100644 --- a/plugins/BossKeyPlus/src/BossKey.cpp +++ b/plugins/BossKeyPlus/src/BossKey.cpp @@ -585,25 +585,24 @@ static int TabsrmmButtonPressed(WPARAM, LPARAM lParam) static int TabsrmmButtonsInit(WPARAM, LPARAM)
{
- BBButton bbd = { 0 };
-
- bbd.cbSize = sizeof(BBButton);
+ BBButton bbd = {};
bbd.pszModuleName = MOD_NAME;
bbd.dwDefPos = 5000;
bbd.pwszTooltip = LPGENW("Hide Miranda NG");
bbd.bbbFlags = BBBF_ISRSIDEBUTTON | BBBF_CANBEHIDDEN;
bbd.hIcon = iconList[0].hIcolib;
- CallService(MS_BB_ADDBUTTON, 0, (LPARAM)&bbd);
-
+ Srmm_AddButton(&bbd);
return 0;
}
-static wchar_t *VariablesBossKey(ARGUMENTSINFO *ai) {
- if (ai->cbSize < sizeof(ARGUMENTSINFO)) return NULL;
- if (ai->argc != 1) return NULL;
+static wchar_t* VariablesBossKey(ARGUMENTSINFO *ai)
+{
+ if (ai->cbSize < sizeof(ARGUMENTSINFO))
+ return NULL;
+ if (ai->argc != 1)
+ return NULL;
ai->flags |= AIF_DONTPARSE;
-
return GetBossKeyText();
}
diff --git a/plugins/ExternalAPI/m_msg_buttonsbar.h b/plugins/ExternalAPI/m_msg_buttonsbar.h index 11413d853b..8b73f987a3 100644 --- a/plugins/ExternalAPI/m_msg_buttonsbar.h +++ b/plugins/ExternalAPI/m_msg_buttonsbar.h @@ -1,32 +1,4 @@ #ifndef M_MSG_BUTTONSBAR_H__
#define M_MSG_BUTTONSBAR_H__
-////////////////////////////////////////////////////////////////
-//Events
-//
-
-///////////////////////////////////////////////////
-// ButtonClicked event
-// wParam = (HANDLE)hContact;
-// lParam = (CustomButtonClickData *)&CustomButtonClickData;
-// catch to show a popup menu, etc.
-#define ME_MSG_BUTTONPRESSED "TabSRMM/ButtonsBar/ButtonPressed"
-
-
-// event flags
-#define BBCF_RIGHTBUTTON (1<<0)
-#define BBCF_SHIFTPRESSED (1<<1)
-#define BBCF_CONTROLPRESSED (1<<2)
-#define BBCF_ARROWCLICKED (1<<3)
-
-typedef struct {
- int cbSize;
- POINT pt; // screen coordinates for menus
- char* pszModule; // button owners name
- DWORD dwButtonId; // registered button ID
- HWND hwndFrom; // button parents HWND
- MCONTACT hContact;
- DWORD flags; // BBCF_ flags
-} CustomButtonClickData;
-
#endif //M_MSG_BUTTONSBAR_H__
\ No newline at end of file diff --git a/plugins/FTPFileYM/src/ftpfile.cpp b/plugins/FTPFileYM/src/ftpfile.cpp index 143108bf41..90dc4e12eb 100644 --- a/plugins/FTPFileYM/src/ftpfile.cpp +++ b/plugins/FTPFileYM/src/ftpfile.cpp @@ -181,18 +181,15 @@ void InitHotkeys() void InitTabsrmmButton()
{
- if (ServiceExists(MS_BB_ADDBUTTON)) {
- BBButton btn = { 0 };
- btn.cbSize = sizeof(btn);
- btn.dwButtonID = 1;
- btn.pszModuleName = MODULE;
- btn.dwDefPos = 105;
- btn.hIcon = iconList[ServerList::FTP_COUNT].hIcolib;
- btn.bbbFlags = BBBF_ISARROWBUTTON | BBBF_ISIMBUTTON | BBBF_CANBEHIDDEN;
- btn.pwszTooltip = TranslateT("FTP File");
- CallService(MS_BB_ADDBUTTON, 0, (LPARAM)&btn);
- HookEvent(ME_MSG_BUTTONPRESSED, TabsrmmButtonPressed);
- }
+ BBButton btn = {};
+ btn.dwButtonID = 1;
+ btn.pszModuleName = MODULE;
+ btn.dwDefPos = 105;
+ btn.hIcon = iconList[ServerList::FTP_COUNT].hIcolib;
+ btn.bbbFlags = BBBF_ISARROWBUTTON | BBBF_ISIMBUTTON | BBBF_CANBEHIDDEN;
+ btn.pwszTooltip = TranslateT("FTP File");
+ Srmm_AddButton(&btn);
+ HookEvent(ME_MSG_BUTTONPRESSED, TabsrmmButtonPressed);
}
//------------ MENU & BUTTON HANDLERS ------------//
diff --git a/plugins/MirLua/Modules/m_msg_buttonsbar/src/main.cpp b/plugins/MirLua/Modules/m_msg_buttonsbar/src/main.cpp index 81da1b92a9..2fcbfe320a 100644 --- a/plugins/MirLua/Modules/m_msg_buttonsbar/src/main.cpp +++ b/plugins/MirLua/Modules/m_msg_buttonsbar/src/main.cpp @@ -1,9 +1,10 @@ #include "stdafx.h"
+int hLangpack = 0;
+
static BBButton* MakeBBButton(lua_State *L)
{
BBButton *bbb = (BBButton*)mir_calloc(sizeof(BBButton));
- bbb->cbSize = sizeof(BBButton);
bbb->dwDefPos = 100;
lua_getfield(L, -1, "Module");
@@ -39,7 +40,7 @@ static int lua_AddButton(lua_State *L) BBButton* bbb = MakeBBButton(L);
- INT_PTR res = CallService(MS_BB_ADDBUTTON, 0, (LPARAM)bbb);
+ INT_PTR res = Srmm_AddButton(bbb);
lua_pushinteger(L, res);
return 1;
@@ -55,7 +56,7 @@ static int lua_ModifyButton(lua_State *L) BBButton* bbb = MakeBBButton(L);
- INT_PTR res = CallService(MS_BB_MODIFYBUTTON, 0, (LPARAM)bbb);
+ INT_PTR res = Srmm_ModifyButton(bbb);
lua_pushinteger(L, res);
mir_free(bbb->pszModuleName);
@@ -69,11 +70,11 @@ static int lua_RemoveButton(lua_State *L) {
ptrA szModuleName(mir_utf8decodeA(luaL_checkstring(L, 1)));
- BBButton mbb = { sizeof(BBButton) };
+ BBButton mbb = {};
mbb.pszModuleName = szModuleName;
mbb.dwButtonID = luaL_checkinteger(L, 2);
- INT_PTR res = ::CallService(MS_BB_REMOVEBUTTON, 0, (LPARAM)&mbb);
+ INT_PTR res = ::Srmm_RemoveButton(&mbb);
lua_pushinteger(L, res);
return 1;
diff --git a/plugins/MirLua/Modules/m_msg_buttonsbar/src/stdafx.h b/plugins/MirLua/Modules/m_msg_buttonsbar/src/stdafx.h index 89ca58c4fd..50b75904b4 100644 --- a/plugins/MirLua/Modules/m_msg_buttonsbar/src/stdafx.h +++ b/plugins/MirLua/Modules/m_msg_buttonsbar/src/stdafx.h @@ -7,6 +7,7 @@ #include <m_core.h>
#include <m_utils.h>
+#include <m_message.h>
#include <m_msg_buttonsbar.h>
#endif //_COMMON_H_
\ No newline at end of file diff --git a/plugins/MirOTR/src/options.cpp b/plugins/MirOTR/src/options.cpp index f0382af233..ea2050bbf6 100644 --- a/plugins/MirOTR/src/options.cpp +++ b/plugins/MirOTR/src/options.cpp @@ -89,7 +89,6 @@ void LoadOptions() options.bHavePopups = 0 != ServiceExists(MS_POPUP_ADDPOPUPT) && ServiceExists(MS_POPUP_SHOWMESSAGE); options.bHaveSecureIM = 0 != ServiceExists("SecureIM/IsContactSecured"); - options.bHaveButtonsBar = 0 != ServiceExists(MS_BB_ADDBUTTON); LoadFilenames(); } diff --git a/plugins/MirOTR/src/options.h b/plugins/MirOTR/src/options.h index 1aca058985..17efb1c139 100644 --- a/plugins/MirOTR/src/options.h +++ b/plugins/MirOTR/src/options.h @@ -32,7 +32,7 @@ typedef struct { bool end_offline, end_window_close; // temporary options - bool bHavePopups, bHaveSecureIM, bHaveButtonsBar; + bool bHavePopups, bHaveSecureIM; } Options; diff --git a/plugins/MirOTR/src/svcs_srmm.cpp b/plugins/MirOTR/src/svcs_srmm.cpp index 485f7b73bb..882d0eaf70 100644 --- a/plugins/MirOTR/src/svcs_srmm.cpp +++ b/plugins/MirOTR/src/svcs_srmm.cpp @@ -65,8 +65,8 @@ void SetEncryptionStatus(MCONTACT hContact, TrustLevel level) Srmm_ModifyIcon(hContact, &sid); Srmm_ModifyIcon(hContact, &sid2); + Srmm_SetButtonState(hContact, &button); - if (options.bHaveButtonsBar) CallService(MS_BB_SETBUTTONSTATE, hContact, (LPARAM)&button); db_set_dw(hContact, MODULENAME, "TrustLevel", level); if (!chat_room) { @@ -88,14 +88,14 @@ void SetEncryptionStatus(MCONTACT hContact, TrustLevel level) int SVC_ButtonsBarLoaded(WPARAM, LPARAM) { - CallService(MS_BB_ADDBUTTON, 0, (LPARAM)&OTRButton); + Srmm_AddButton(&OTRButton); return 0; } int SVC_ButtonsBarPressed(WPARAM w, LPARAM l) { - CustomButtonClickData* cbcd = (CustomButtonClickData *)l; - if (cbcd->cbSize == sizeof(CustomButtonClickData) && cbcd->dwButtonId == 0 && mir_strcmp(cbcd->pszModule, MODULENAME)==0) { + CustomButtonClickData *cbcd = (CustomButtonClickData *)l; + if (cbcd->dwButtonId == 0 && !mir_strcmp(cbcd->pszModule, MODULENAME)) { MCONTACT hContact = (MCONTACT)w; char *proto = GetContactProto(hContact); @@ -133,19 +133,17 @@ void InitSRMM() // hook the window events so that we can can change the status of the icon HookEvent(ME_MSG_ICONPRESSED, SVC_IconPressed); - if (options.bHaveButtonsBar) { - memset(&OTRButton, 0, sizeof(OTRButton)); - OTRButton.cbSize = sizeof(OTRButton); - OTRButton.dwButtonID = 0; - OTRButton.pszModuleName = MODULENAME; - OTRButton.dwDefPos = 200; - OTRButton.bbbFlags = BBBF_ISRSIDEBUTTON|BBBF_CANBEHIDDEN|BBBF_ISIMBUTTON; - OTRButton.pwszTooltip = TranslateT(LANG_OTR_TOOLTIP); - OTRButton.hIcon = IcoLib_GetIconHandle(ICON_NOT_PRIVATE); - HookEvent(ME_MSG_TOOLBARLOADED, SVC_ButtonsBarLoaded); - HookEvent(ME_MSG_BUTTONPRESSED, SVC_ButtonsBarPressed); - } + memset(&OTRButton, 0, sizeof(OTRButton)); + OTRButton.pszModuleName = MODULENAME; + OTRButton.dwDefPos = 200; + OTRButton.bbbFlags = BBBF_ISRSIDEBUTTON | BBBF_CANBEHIDDEN | BBBF_ISIMBUTTON; + OTRButton.pwszTooltip = TranslateT(LANG_OTR_TOOLTIP); + OTRButton.hIcon = IcoLib_GetIconHandle(ICON_NOT_PRIVATE); + + HookEvent(ME_MSG_TOOLBARLOADED, SVC_ButtonsBarLoaded); + HookEvent(ME_MSG_BUTTONPRESSED, SVC_ButtonsBarPressed); } + void DeinitSRMM() { IcoLib_Release(ICON_NOT_PRIVATE, 0); diff --git a/plugins/PasteIt/src/PasteIt.cpp b/plugins/PasteIt/src/PasteIt.cpp index eb34cf7634..c36034cd26 100644 --- a/plugins/PasteIt/src/PasteIt.cpp +++ b/plugins/PasteIt/src/PasteIt.cpp @@ -336,23 +336,19 @@ void DefWebPageChanged() void InitTabsrmmButton()
{
- if (ServiceExists(MS_BB_ADDBUTTON))
- {
- BBButton btn = { 0 };
- btn.cbSize = sizeof(btn);
- btn.dwButtonID = 1;
- btn.pszModuleName = MODULE;
- btn.dwDefPos = 110;
- btn.hIcon = icon.hIcolib;
- btn.bbbFlags = BBBF_ISARROWBUTTON | BBBF_ISIMBUTTON | BBBF_CANBEHIDDEN | BBBF_ISCHATBUTTON;
- btn.pwszTooltip = TranslateT("Paste It");
- CallService(MS_BB_ADDBUTTON, 0, (LPARAM)&btn);
-
- if (hTabsrmmButtonPressed != NULL)
- UnhookEvent(hTabsrmmButtonPressed);
-
- hTabsrmmButtonPressed = HookEvent(ME_MSG_BUTTONPRESSED, TabsrmmButtonPressed);
- }
+ BBButton btn = {};
+ btn.dwButtonID = 1;
+ btn.pszModuleName = MODULE;
+ btn.dwDefPos = 110;
+ btn.hIcon = icon.hIcolib;
+ btn.bbbFlags = BBBF_ISARROWBUTTON | BBBF_ISIMBUTTON | BBBF_CANBEHIDDEN | BBBF_ISCHATBUTTON;
+ btn.pwszTooltip = TranslateT("Paste It");
+ Srmm_AddButton(&btn);
+
+ if (hTabsrmmButtonPressed != NULL)
+ UnhookEvent(hTabsrmmButtonPressed);
+
+ hTabsrmmButtonPressed = HookEvent(ME_MSG_BUTTONPRESSED, TabsrmmButtonPressed);
}
int WindowEvent(WPARAM, MessageWindowEventData* lParam)
diff --git a/plugins/QuickMessages/src/Utils.cpp b/plugins/QuickMessages/src/Utils.cpp index e7eb41f334..015c19f6e0 100644 --- a/plugins/QuickMessages/src/Utils.cpp +++ b/plugins/QuickMessages/src/Utils.cpp @@ -239,27 +239,24 @@ static HANDLE AddIcon(char* szIcoName) DWORD BalanceButtons(int buttonsWas, int buttonsNow) { - if (!ServiceExists(MS_BB_ADDBUTTON)) { - BBButton bb = { sizeof(bb) }; - bb.pszModuleName = PLGNAME; + BBButton bb = {}; + bb.pszModuleName = PLGNAME; - while (buttonsWas > buttonsNow) { - bb.dwButtonID = --buttonsWas; - CallService(MS_BB_REMOVEBUTTON, 0, (LPARAM)&bb); - } + while (buttonsWas > buttonsNow) { + bb.dwButtonID = --buttonsWas; + Srmm_RemoveButton(&bb); + } - while (buttonsWas < buttonsNow) { - if (ServiceExists(MS_BB_ADDBUTTON)) { - char iconname[40]; - mir_snprintf(iconname, LPGEN("Quick Messages Button %u"), buttonsWas); - bb.bbbFlags = BBBF_ISIMBUTTON | BBBF_ISCHATBUTTON; - bb.dwButtonID = buttonsWas++; - bb.dwDefPos = 300 + buttonsWas; - bb.hIcon = AddIcon(iconname); - CallService(MS_BB_ADDBUTTON, 0, (LPARAM)&bb); - } - } + while (buttonsWas < buttonsNow) { + char iconname[40]; + mir_snprintf(iconname, LPGEN("Quick Messages Button %u"), buttonsWas); + bb.bbbFlags = BBBF_ISIMBUTTON | BBBF_ISCHATBUTTON; + bb.dwButtonID = buttonsWas++; + bb.dwDefPos = 300 + buttonsWas; + bb.hIcon = AddIcon(iconname); + Srmm_AddButton(&bb); } + return buttonsNow; } @@ -366,23 +363,20 @@ wchar_t* getMenuEntry(int buttonnum, int entrynum, BYTE mode) int RegisterCustomButton(WPARAM, LPARAM) { - if (!ServiceExists(MS_BB_ADDBUTTON)) - return 1; - for (int i = 0; i < g_iButtonsCount; i++) { ListData* ld = ButtonsList[i]; char iconname[40]; mir_snprintf(iconname, LPGEN("Quick Messages Button %u"), i); - BBButton bbd = { sizeof(bbd) }; + BBButton bbd = {}; bbd.bbbFlags = BBBF_ISIMBUTTON | BBBF_ISCHATBUTTON; bbd.dwButtonID = i; bbd.dwDefPos = 320 + i; bbd.hIcon = AddIcon(iconname); bbd.pszModuleName = PLGNAME; bbd.pwszTooltip = ld->ptszButtonName; - CallService(MS_BB_ADDBUTTON, 0, (LPARAM)&bbd); + Srmm_AddButton(&bbd); } return 0; } diff --git a/plugins/QuickMessages/src/options.cpp b/plugins/QuickMessages/src/options.cpp index 944727dcbb..482d750c79 100644 --- a/plugins/QuickMessages/src/options.cpp +++ b/plugins/QuickMessages/src/options.cpp @@ -252,13 +252,12 @@ void SaveMenuTree() }
- if (ServiceExists(MS_BB_MODIFYBUTTON) && ((ld->dwOPFlags&QMF_NEW) || (ld->dwOPFlags&QMF_RENAMED) || bDeleted)) {
+ if (((ld->dwOPFlags & QMF_NEW) || (ld->dwOPFlags & QMF_RENAMED) || bDeleted)) {
BBButton bb = { 0 };
- bb.cbSize = sizeof(BBButton);
bb.pszModuleName = PLGNAME;
bb.dwButtonID = iBl;
bb.pwszTooltip = ld->ptszButtonName;
- CallService(MS_BB_MODIFYBUTTON, 0, (LPARAM)&bb);
+ Srmm_ModifyButton(&bb);
}
@@ -278,7 +277,7 @@ void SaveMenuTree() for (i = 0; i < sl->realCount; i++) {
ButtonData * bd = (ButtonData *)sl->items[i];
- if (bd->dwOPFlags&QMF_DELETNEEDED) {
+ if (bd->dwOPFlags & QMF_DELETNEEDED) {
RemoveMenuEntryNode(sl, i--);
continue;
}
diff --git a/plugins/QuickReplies/src/events.cpp b/plugins/QuickReplies/src/events.cpp index 1839bc891a..121d9a56ae 100644 --- a/plugins/QuickReplies/src/events.cpp +++ b/plugins/QuickReplies/src/events.cpp @@ -48,25 +48,21 @@ int OnModulesLoaded(WPARAM, LPARAM) hOnOptInitialized = HookEvent(ME_OPT_INITIALISE, OnOptInitialized);
hOnButtonPressed = HookEvent(ME_MSG_BUTTONPRESSED, OnButtonPressed);
- if ( ServiceExists(MS_BB_ADDBUTTON)) {
- Icon_Register(hInstance, "TabSRMM/Quick Replies", &icon, 1);
-
- char buttonNameTranslated[32], buttonName[32];
- mir_snprintf(buttonNameTranslated, "%s %x", Translate("Button"), iNumber + 1);
- mir_snprintf(buttonName, MODULE" %x", iNumber + 1);
-
- BBButton bbd = {0};
- bbd.cbSize = sizeof(BBButton);
- bbd.bbbFlags = BBBF_ISIMBUTTON | BBBF_ISCHATBUTTON;
- bbd.pszModuleName = buttonName;
- bbd.pwszTooltip = LPGENW("Quick Replies\r\nLeft button - open menu\r\nRight button - options page");
- bbd.hIcon = icon.hIcolib;
- bbd.dwButtonID = iNumber;
- bbd.dwDefPos = 220;
-
- CallService(MS_BB_ADDBUTTON, 0, (LPARAM)&bbd);
- }
+ Icon_Register(hInstance, "TabSRMM/Quick Replies", &icon, 1);
+
+ char buttonNameTranslated[32], buttonName[32];
+ mir_snprintf(buttonNameTranslated, "%s %x", Translate("Button"), iNumber + 1);
+ mir_snprintf(buttonName, MODULE" %x", iNumber + 1);
+
+ BBButton bbd = {};
+ bbd.bbbFlags = BBBF_ISIMBUTTON | BBBF_ISCHATBUTTON;
+ bbd.pszModuleName = buttonName;
+ bbd.pwszTooltip = LPGENW("Quick Replies\r\nLeft button - open menu\r\nRight button - options page");
+ bbd.hIcon = icon.hIcolib;
+ bbd.dwButtonID = iNumber;
+ bbd.dwDefPos = 220;
+ Srmm_AddButton(&bbd);
return 0;
}
@@ -139,18 +135,6 @@ int OnButtonPressed(WPARAM wParam, LPARAM lParam) int OnPreShutdown(WPARAM, LPARAM)
{
- if (ServiceExists(MS_BB_REMOVEBUTTON))
- {
- char buttonName[32];
- mir_snprintf(buttonName, MODULE" %x", iNumber + 1);
-
- BBButton bbd = {0};
- bbd.cbSize = sizeof(BBButton);
- bbd.pszModuleName = buttonName;
- bbd.dwButtonID = iNumber;
-
- CallService(MS_BB_REMOVEBUTTON, 0, (LPARAM)&bbd);
- }
UnhookEvent(hOnButtonPressed);
UnhookEvent(hOnOptInitialized);
UnhookEvent(hOnPreShutdown);
diff --git a/plugins/TabSRMM/src/buttonbar.h b/plugins/TabSRMM/src/buttonbar.h index 52201ebb12..b29538554e 100644 --- a/plugins/TabSRMM/src/buttonbar.h +++ b/plugins/TabSRMM/src/buttonbar.h @@ -1,20 +1,14 @@ #ifndef _BUTTONSBAR_H
#define _BUTTONSBAR_H
-#define MIN_CBUTTONID 4000
-#define MAX_CBUTTONID 5000
-
-struct CustomButtonData;
struct TWindowData;
-void CB_DeInitCustomButtons();
void CB_InitCustomButtons();
void BB_InitDlgButtons(TWindowData *dat);
void BB_RefreshTheme(const TWindowData *dat);
BOOL BB_SetButtonsPos(TWindowData *dat);
void BB_RedrawButtons(TWindowData *dat);
-void BB_CustomButtonClick(TWindowData *dat, DWORD idFrom, HWND hwndFrom, BOOL code);
void CB_DestroyAllButtons(HWND hwndDlg);
void CB_DestroyButton(HWND hwndDlg, TWindowData *dat, DWORD dwButtonCID, DWORD dwFlags);
diff --git a/plugins/TabSRMM/src/buttonsbar.cpp b/plugins/TabSRMM/src/buttonsbar.cpp index c44e2cba44..7c39d01b8c 100644 --- a/plugins/TabSRMM/src/buttonsbar.cpp +++ b/plugins/TabSRMM/src/buttonsbar.cpp @@ -1,7 +1,5 @@ #include "stdafx.h" -HANDLE hHookButtonPressedEvt; - ///////////////////////////////////////////////////////////////////////////////////////// // Global functions @@ -396,38 +394,6 @@ BOOL BB_SetButtonsPos(TWindowData *dat) return EndDeferWindowPos(hdwp); } -void BB_CustomButtonClick(TWindowData *dat, DWORD idFrom, HWND hwndFrom, BOOL code) -{ - RECT rc; - GetWindowRect(hwndFrom, &rc); - - bool bFromArrow = false; - - CustomButtonClickData cbcd = { 0 }; - cbcd.cbSize = sizeof(cbcd); - cbcd.pt.x = rc.left; - cbcd.pt.y = rc.bottom; - - CustomButtonData *cbd; - for (int i = 0; cbd = Srmm_GetNthButton(i); i++) { - if (cbd->m_dwButtonCID == idFrom) { - cbcd.pszModule = cbd->m_pszModuleName; - cbcd.dwButtonId = cbd->m_dwButtonOrigID; - } - else if (cbd->m_dwArrowCID == idFrom) { - bFromArrow = true; - cbcd.pszModule = cbd->m_pszModuleName; - cbcd.dwButtonId = cbd->m_dwButtonOrigID; - } - } - - cbcd.hwndFrom = dat->hwnd; - cbcd.hContact = dat->hContact; - cbcd.flags = (code ? BBCF_RIGHTBUTTON : 0) | (GetKeyState(VK_SHIFT) & 0x8000 ? BBCF_SHIFTPRESSED : 0) | (GetKeyState(VK_CONTROL) & 0x8000 ? BBCF_CONTROLPRESSED : 0) | (bFromArrow ? BBCF_ARROWCLICKED : 0); - - NotifyEventHooks(hHookButtonPressedEvt, dat->hContact, (LPARAM)&cbcd); -} - void CB_DestroyAllButtons(HWND hwndDlg) { CustomButtonData *cbd; @@ -474,12 +440,5 @@ void CB_ChangeButton(HWND hwndDlg, TWindowData *dat, CustomButtonData *cbd) void CB_InitCustomButtons() { - hHookButtonPressedEvt = CreateHookableEvent(ME_MSG_BUTTONPRESSED); - HookEvent(ME_MSG_TOOLBARLOADED, CB_InitDefaultButtons); } - -void CB_DeInitCustomButtons() -{ - DestroyHookableEvent(hHookButtonPressedEvt); -} diff --git a/plugins/TabSRMM/src/chat/window.cpp b/plugins/TabSRMM/src/chat/window.cpp index 646a4398f1..423320a909 100644 --- a/plugins/TabSRMM/src/chat/window.cpp +++ b/plugins/TabSRMM/src/chat/window.cpp @@ -2074,7 +2074,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar { DWORD idFrom = GetDlgCtrlID((HWND)wParam); if (idFrom >= MIN_CBUTTONID && idFrom <= MAX_CBUTTONID) - BB_CustomButtonClick(dat, idFrom, (HWND)wParam, 1); + Srmm_ClickToolbarIcon(dat->hContact, idFrom, (HWND)wParam, 1); } break; @@ -2611,7 +2611,7 @@ LABEL_SHOWWINDOW: case WM_COMMAND: if (LOWORD(wParam) >= MIN_CBUTTONID && LOWORD(wParam) <= MAX_CBUTTONID){ - BB_CustomButtonClick(dat, LOWORD(wParam), GetDlgItem(hwndDlg, LOWORD(wParam)), 0); + Srmm_ClickToolbarIcon(dat->hContact, LOWORD(wParam), GetDlgItem(hwndDlg, LOWORD(wParam)), 0); break; } @@ -3196,7 +3196,7 @@ LABEL_SHOWWINDOW: UpdateStatusBar(dat); break; - case DM_BBNEEDUPDATE: + case WM_CBD_UPDATED: if (lParam) CB_ChangeButton(hwndDlg, dat, (CustomButtonData*)lParam); else @@ -3205,7 +3205,7 @@ LABEL_SHOWWINDOW: BB_SetButtonsPos(dat); return 0; - case DM_CBDESTROY: + case WM_CBD_REMOVED: if (lParam) CB_DestroyButton(hwndDlg, dat, (DWORD)wParam, (DWORD)lParam); else diff --git a/plugins/TabSRMM/src/containeroptions.cpp b/plugins/TabSRMM/src/containeroptions.cpp index c3adeb98e6..b8c57dd415 100644 --- a/plugins/TabSRMM/src/containeroptions.cpp +++ b/plugins/TabSRMM/src/containeroptions.cpp @@ -93,7 +93,7 @@ void TSAPI ApplyContainerSetting(TContainerData *pContainer, DWORD flags, UINT m if (fForceResize)
SendMessage(pContainer->hwnd, WM_SIZE, 0, 1);
- BroadCastContainer(pContainer, DM_BBNEEDUPDATE, 0, 0);
+ BroadCastContainer(pContainer, WM_CBD_UPDATED, 0, 0);
}
#define NR_O_PAGES 10
diff --git a/plugins/TabSRMM/src/globals.cpp b/plugins/TabSRMM/src/globals.cpp index fe655afa41..71b2a095c1 100644 --- a/plugins/TabSRMM/src/globals.cpp +++ b/plugins/TabSRMM/src/globals.cpp @@ -470,7 +470,6 @@ int CGlobals::PreshutdownSendRecv(WPARAM, LPARAM) db_set_dw(hContact, SRMSGMOD_T, "messagecount", 0);
::SI_DeinitStatusIcons();
- ::CB_DeInitCustomButtons();
// the event API
DestroyHookableEvent(PluginConfig.m_event_MsgWin);
diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index 567673c5a5..cb92cdf4e0 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -2595,7 +2595,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l // custom button handling
if (LOWORD(wParam) >= MIN_CBUTTONID && LOWORD(wParam) <= MAX_CBUTTONID) {
- BB_CustomButtonClick(dat, LOWORD(wParam), GetDlgItem(hwndDlg, LOWORD(wParam)), 0);
+ Srmm_ClickToolbarIcon(dat->hContact, LOWORD(wParam), GetDlgItem(hwndDlg, LOWORD(wParam)), 0);
break;
}
@@ -2848,7 +2848,7 @@ quote_from_last: {
DWORD idFrom = GetDlgCtrlID((HWND)wParam);
if (idFrom >= MIN_CBUTTONID && idFrom <= MAX_CBUTTONID) {
- BB_CustomButtonClick(dat, idFrom, (HWND)wParam, 1);
+ Srmm_ClickToolbarIcon(dat->hContact, idFrom, (HWND)wParam, 1);
break;
}
}
@@ -3004,7 +3004,7 @@ quote_from_last: }
return 0;
- case DM_BBNEEDUPDATE:
+ case WM_CBD_UPDATED:
if (lParam)
CB_ChangeButton(hwndDlg, dat, (CustomButtonData*)lParam);
else
@@ -3013,7 +3013,7 @@ quote_from_last: BB_SetButtonsPos(dat);
return 0;
- case DM_CBDESTROY:
+ case WM_CBD_REMOVED:
if (lParam)
CB_DestroyButton(hwndDlg, dat, (DWORD)wParam, (DWORD)lParam);
else
diff --git a/plugins/TabSRMM/src/msgs.h b/plugins/TabSRMM/src/msgs.h index a765921139..38911e1741 100644 --- a/plugins/TabSRMM/src/msgs.h +++ b/plugins/TabSRMM/src/msgs.h @@ -573,8 +573,6 @@ struct TNewWindowData #define DM_PLAYINCOMINGSOUND (TM_USER+92)
#define DM_SENDMESSAGECOMMANDW (TM_USER+93)
#define DM_REMOVEPOPUPS (TM_USER+94)
-#define DM_BBNEEDUPDATE (TM_USER+96)
-#define DM_CBDESTROY (TM_USER+97)
#define DM_LOGSTATUSCHANGE (TM_USER+98)
#define DM_SC_BUILDLIST (TM_USER+100)
#define DM_SC_INITDIALOG (TM_USER+101)
diff --git a/plugins/TranslitSwitcher/src/TranslitSwitcher.cpp b/plugins/TranslitSwitcher/src/TranslitSwitcher.cpp index 497e429a3d..21bdd2b69e 100644 --- a/plugins/TranslitSwitcher/src/TranslitSwitcher.cpp +++ b/plugins/TranslitSwitcher/src/TranslitSwitcher.cpp @@ -80,63 +80,31 @@ INT_PTR ServiceInvert(WPARAM, LPARAM lParam) int OnModulesLoaded(WPARAM, LPARAM)
{
HookEvent(ME_MSG_BUTTONPRESSED, OnButtonPressed);
- if (ServiceExists(MS_BB_ADDBUTTON)) {
- Icon_Register(hInst, "TabSRMM/TranslitSwitcher", iconList, _countof(iconList));
-
- BBButton bbd = { 0 };
- bbd.cbSize = sizeof(BBButton);
- bbd.bbbFlags = BBBF_ISIMBUTTON | BBBF_ISCHATBUTTON | BBBF_ISRSIDEBUTTON;
- bbd.pszModuleName = "Switch Layout and Send";
- bbd.pwszTooltip = TranslateT("Switch Layout and Send");
- bbd.hIcon = iconList[0].hIcolib;
- bbd.dwButtonID = 1;
- bbd.dwDefPos = 30;
- CallService(MS_BB_ADDBUTTON, 0, (LPARAM)&bbd);
-
- bbd.pszModuleName = "Translit and Send";
- bbd.pwszTooltip = TranslateT("Translit and Send");
- bbd.hIcon = iconList[1].hIcolib;
- bbd.dwButtonID = 1;
- bbd.dwDefPos = 40;
- CallService(MS_BB_ADDBUTTON, 0, (LPARAM)&bbd);
-
- bbd.pszModuleName = "Invert Case and Send";
- bbd.pwszTooltip = TranslateT("Invert Case and Send");
- bbd.hIcon = iconList[2].hIcolib;
- bbd.dwButtonID = 1;
- bbd.dwDefPos = 50;
- CallService(MS_BB_ADDBUTTON, 0, (LPARAM)&bbd);
- }
- return 0;
-}
-int OnPreShutdown(WPARAM, LPARAM)
-{
- if (ServiceExists(MS_BB_REMOVEBUTTON)) {
- BBButton bbd = { 0 };
- bbd.cbSize = sizeof(BBButton);
- bbd.bbbFlags = BBBF_ISIMBUTTON | BBBF_ISCHATBUTTON | BBBF_ISRSIDEBUTTON;
- bbd.pszModuleName = "Switch Layout and Send";
- bbd.pwszTooltip = TranslateT("Switch Layout and Send");
- bbd.hIcon = iconList[0].hIcolib;
- bbd.dwButtonID = 1;
- bbd.dwDefPos = 30;
- CallService(MS_BB_REMOVEBUTTON, 0, (LPARAM)&bbd);
-
- bbd.pszModuleName = "Translit and Send";
- bbd.pwszTooltip = TranslateT("Translit and Send");
- bbd.hIcon = iconList[1].hIcolib;
- bbd.dwButtonID = 1;
- bbd.dwDefPos = 40;
- CallService(MS_BB_REMOVEBUTTON, 0, (LPARAM)&bbd);
-
- bbd.pszModuleName = "Invert Case and Send";
- bbd.pwszTooltip = TranslateT("Invert Case and Send");
- bbd.hIcon = iconList[2].hIcolib;
- bbd.dwButtonID = 1;
- bbd.dwDefPos = 50;
- CallService(MS_BB_REMOVEBUTTON, 0, (LPARAM)&bbd);
- }
+ Icon_Register(hInst, "TabSRMM/TranslitSwitcher", iconList, _countof(iconList));
+
+ BBButton bbd = {};
+ bbd.bbbFlags = BBBF_ISIMBUTTON | BBBF_ISCHATBUTTON | BBBF_ISRSIDEBUTTON;
+ bbd.pszModuleName = "Switch Layout and Send";
+ bbd.pwszTooltip = TranslateT("Switch Layout and Send");
+ bbd.hIcon = iconList[0].hIcolib;
+ bbd.dwButtonID = 1;
+ bbd.dwDefPos = 30;
+ Srmm_AddButton(&bbd);
+
+ bbd.pszModuleName = "Translit and Send";
+ bbd.pwszTooltip = TranslateT("Translit and Send");
+ bbd.hIcon = iconList[1].hIcolib;
+ bbd.dwButtonID = 1;
+ bbd.dwDefPos = 40;
+ Srmm_AddButton(&bbd);
+
+ bbd.pszModuleName = "Invert Case and Send";
+ bbd.pwszTooltip = TranslateT("Invert Case and Send");
+ bbd.hIcon = iconList[2].hIcolib;
+ bbd.dwButtonID = 1;
+ bbd.dwDefPos = 50;
+ Srmm_AddButton(&bbd);
return 0;
}
@@ -151,7 +119,6 @@ extern "C" __declspec(dllexport) int Load(void) CreateServiceFunction(MS_TS_INVERTCASE, ServiceInvert);
HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
- HookEvent(ME_SYSTEM_PRESHUTDOWN, OnPreShutdown);
HOTKEYDESC hkd = { sizeof(hkd) };
hkd.dwFlags = HKD_UNICODE;
diff --git a/plugins/TranslitSwitcher/src/stdafx.h b/plugins/TranslitSwitcher/src/stdafx.h index 662bef8ed7..b0c897172d 100644 --- a/plugins/TranslitSwitcher/src/stdafx.h +++ b/plugins/TranslitSwitcher/src/stdafx.h @@ -32,6 +32,7 @@ Boston, MA 02111-1307, USA. #include <m_popup.h>
#include <m_string.h>
+#include <m_message.h>
#include <m_msg_buttonsbar.h>
#include <m_smileyadd.h>
#include <m_ieview.h>
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index 75a8b9629c..6cd5b0ddf1 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -337,3 +337,4 @@ Srmm_UpdateToolbarIcons @337 Srmm_RedrawToolbarIcons @338
Srmm_GetNthButton @339
Srmm_GetButtonCount @340
+Srmm_ClickToolbarIcon @341
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index 5d571223a0..b7ca0d8171 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -337,3 +337,4 @@ Srmm_UpdateToolbarIcons @337 Srmm_RedrawToolbarIcons @338
Srmm_GetNthButton @339
Srmm_GetButtonCount @340
+Srmm_ClickToolbarIcon @341
diff --git a/src/mir_app/src/srmm_toolbar.cpp b/src/mir_app/src/srmm_toolbar.cpp index ce6cf921cf..8cc0d224b4 100644 --- a/src/mir_app/src/srmm_toolbar.cpp +++ b/src/mir_app/src/srmm_toolbar.cpp @@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h" -#define MODULENAME "SRMsg" +#define MODULENAME "SRMM_Toolbar" #define DPISCALEY_S(argY) ((int)((double)(argY) * g_DPIscaleY)) #define DPISCALEX_S(argX) ((int)((double)(argX) * g_DPIscaleX)) @@ -39,11 +39,11 @@ static int SortButtons(const CustomButtonData *p1, const CustomButtonData *p2) static LIST<CustomButtonData> arButtonsList(1, SortButtons); -DWORD LastCID = 4000; +DWORD LastCID = MIN_CBUTTONID; DWORD dwSepCount = 0; static mir_cs csToolBar; -static HANDLE hHookToolBarLoadedEvt; +static HANDLE hHookToolBarLoadedEvt, hHookButtonPressedEvt; static void wipeList(LIST<CustomButtonData> &list) { @@ -80,7 +80,7 @@ static void CB_GetButtonSettings(MCONTACT hContact, CustomButtonData *cbd) mir_snprintf(SettingName, "%s_%d", cbd->m_pszModuleName, cbd->m_dwButtonOrigID); - if (!db_get_s(hContact, "TabSRMM_Toolbar", SettingName, &dbv)) { + if (!db_get_s(hContact, MODULENAME, SettingName, &dbv)) { token = strtok(dbv.pszVal, "_"); cbd->m_dwPosition = (DWORD)atoi(token); token = strtok(NULL, "_"); @@ -278,12 +278,43 @@ MIR_APP_DLL(int) Srmm_ModifyButton(BBButton *bbdi) return 0; } +MIR_APP_DLL(void) Srmm_ClickToolbarIcon(MCONTACT hContact, DWORD idFrom, HWND hwndFrom, BOOL code) +{ + RECT rc; + GetWindowRect(hwndFrom, &rc); + + bool bFromArrow = false; + + CustomButtonClickData cbcd = {}; + cbcd.pt.x = rc.left; + cbcd.pt.y = rc.bottom; + + for (int i = 0; i < arButtonsList.getCount(); i++) { + CustomButtonData *cbd = arButtonsList[i]; + if (cbd->m_dwButtonCID == idFrom) { + cbcd.pszModule = cbd->m_pszModuleName; + cbcd.dwButtonId = cbd->m_dwButtonOrigID; + } + else if (cbd->m_dwArrowCID == idFrom) { + bFromArrow = true; + cbcd.pszModule = cbd->m_pszModuleName; + cbcd.dwButtonId = cbd->m_dwButtonOrigID; + } + } + + cbcd.hwndFrom = GetParent(hwndFrom); + cbcd.hContact = hContact; + cbcd.flags = (code ? BBCF_RIGHTBUTTON : 0) | (GetKeyState(VK_SHIFT) & 0x8000 ? BBCF_SHIFTPRESSED : 0) | (GetKeyState(VK_CONTROL) & 0x8000 ? BBCF_CONTROLPRESSED : 0) | (bFromArrow ? BBCF_ARROWCLICKED : 0); + + NotifyEventHooks(hHookButtonPressedEvt, hContact, (LPARAM)&cbcd); +} + MIR_APP_DLL(void) Srmm_ResetToolbar() { { mir_cslock lck(csToolBar); wipeList(arButtonsList); } - LastCID = 4000; + LastCID = MIN_CBUTTONID; dwSepCount = 0; } @@ -291,13 +322,12 @@ MIR_APP_DLL(void) Srmm_UpdateToolbarIcons(HWND hwndDlg) { for (int i = 0; i < arButtonsList.getCount(); i++) { CustomButtonData *cbd = arButtonsList[i]; - if (cbd) { - if (!cbd->m_bSeparator) { - HWND hwndBtn = GetDlgItem(hwndDlg, cbd->m_dwButtonCID); - if (hwndBtn && cbd->m_hIcon) - SendMessage(hwndBtn, BM_SETIMAGE, IMAGE_ICON, (LPARAM)IcoLib_GetIconByHandle(cbd->m_hIcon)); - } - } + if (cbd->m_bSeparator || cbd->m_hIcon == NULL) + continue; + + HWND hwndBtn = GetDlgItem(hwndDlg, cbd->m_dwButtonCID); + if (hwndBtn) + SendMessage(hwndBtn, BM_SETIMAGE, IMAGE_ICON, (LPARAM)IcoLib_GetIconByHandle(cbd->m_hIcon)); } } @@ -349,9 +379,9 @@ static void CB_WriteButtonSettings(MCONTACT hContact, CustomButtonData *cbd) mir_snprintf(SettingName, "%s_%d", cbd->m_pszModuleName, cbd->m_dwButtonOrigID); mir_snprintf(SettingParameter, "%d_%u_%u_%u_%u_%u", cbd->m_dwPosition, cbd->m_bIMButton, cbd->m_bChatButton, 0, cbd->m_bRSided, cbd->m_bCanBeHidden); if (!(cbd->m_opFlags & BBSF_NTBDESTRUCT)) - db_set_s(hContact, "TabSRMM_Toolbar", SettingName, SettingParameter); + db_set_s(hContact, MODULENAME, SettingName, SettingParameter); else - db_unset(hContact, "TabSRMM_Toolbar", SettingName); + db_unset(hContact, MODULENAME, SettingName); } #define MIDDLE_SEPARATOR L">-------M-------<" @@ -436,7 +466,7 @@ class CSrmmToolbarOptions : public CDlgBase qsort(arButtonsList.getArray(), arButtonsList.getCount(), sizeof(void*), sstSortButtons); } - db_set_dw(0, "TabSRMM_Toolbar", "SeparatorsCount", loc_sepcout); + db_set_dw(0, MODULENAME, "SeparatorsCount", loc_sepcout); dwSepCount = loc_sepcout; } @@ -511,6 +541,8 @@ public: m_hImgl(NULL) { m_toolBar.SetFlags(MTREE_DND); // enable drag-n-drop + m_toolBar.OnSelChanged = Callback(this, &CSrmmToolbarOptions::OnTreeSelChanged); + m_toolBar.OnSelChanging = Callback(this, &CSrmmToolbarOptions::OnTreeSelChanging); m_btnReset.OnClick = Callback(this, &CSrmmToolbarOptions::btnResetClicked); m_btnSeparator.OnClick = Callback(this, &CSrmmToolbarOptions::btnSeparatorClicked); @@ -712,15 +744,27 @@ void KillModuleToolbarIcons(int _hLang) static int SrmmModulesLoaded(WPARAM, LPARAM) { + HookEvent(ME_OPT_INITIALISE, SrmmOptionsInit); + NotifyEventHooks(hHookToolBarLoadedEvt, 0, 0); return 0; } +static int ConvertToolbarData(const char *szSetting, LPARAM) +{ + DBVARIANT dbv; + if (!db_get(NULL, "Tab" MODULENAME, szSetting, &dbv)) { + db_set(NULL, MODULENAME, szSetting, &dbv); + db_free(&dbv); + } + return 0; +} + void LoadSrmmToolbarModule() { - HookEvent(ME_OPT_INITIALISE, SrmmOptionsInit); HookEvent(ME_SYSTEM_MODULESLOADED, SrmmModulesLoaded); + hHookButtonPressedEvt = CreateHookableEvent(ME_MSG_BUTTONPRESSED); hHookToolBarLoadedEvt = CreateHookableEvent(ME_MSG_TOOLBARLOADED); HDC hScrnDC = GetDC(0); @@ -728,12 +772,20 @@ void LoadSrmmToolbarModule() g_DPIscaleY = GetDeviceCaps(hScrnDC, LOGPIXELSY) / 96.0; ReleaseDC(0, hScrnDC); - dwSepCount = db_get_dw(NULL, "TabSRMM_Toolbar", "SeparatorsCount", 0); + // old data? convert them + if (db_get_dw(NULL, "Tab" MODULENAME, "SeparatorsCount", -1) != -1) { + db_enum_settings(NULL, ConvertToolbarData, "Tab" MODULENAME, NULL); + db_delete_module(NULL, "Tab" MODULENAME); + } + + dwSepCount = db_get_dw(NULL, MODULENAME, "SeparatorsCount", 0); CB_RegisterSeparators(); } void UnloadSrmmToolbarModule() { + DestroyHookableEvent(hHookButtonPressedEvt); DestroyHookableEvent(hHookToolBarLoadedEvt); + wipeList(arButtonsList); } |