summaryrefslogtreecommitdiff
path: root/plugins/QuickMessages/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2016-12-01 20:51:42 +0300
committerGeorge Hazan <ghazan@miranda.im>2016-12-01 21:49:54 +0300
commitf9c7760f54c279327a977b0cb5ee028c8f0c0bfb (patch)
tree0a1cf4602a5eac89dc38606cc91981c2166a83e0 /plugins/QuickMessages/src
parent40203d30ad1a569cfea61442782393b200e9fbe3 (diff)
more fixes
Diffstat (limited to 'plugins/QuickMessages/src')
-rw-r--r--plugins/QuickMessages/src/Utils.cpp40
-rw-r--r--plugins/QuickMessages/src/options.cpp7
2 files changed, 20 insertions, 27 deletions
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;
}