summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2023-11-21 19:01:35 +0300
committerGeorge Hazan <george.hazan@gmail.com>2023-11-21 19:01:35 +0300
commitee23690fa6c847a5284f8145e73328cdaab2b617 (patch)
treefc9fa53601eb0babccec11021dc9638c07522f9c
parenta455124c53674338f581a1970768182223c3a49a (diff)
SRMM toolbar buttons that require input window to be visible are marked as BBBF_NOREADONLY
-rw-r--r--include/m_message.h5
-rw-r--r--include/m_srmm_int.h2
-rw-r--r--include/newpluginapi.h1
-rw-r--r--libs/win32/mir_app.libbin273396 -> 273752 bytes
-rw-r--r--libs/win64/mir_app.libbin272630 -> 273000 bytes
-rw-r--r--plugins/BossKeyPlus/src/BossKey.cpp2
-rw-r--r--plugins/FTPFileYM/src/ftpfile.cpp16
-rw-r--r--plugins/IEView/src/ieview_main.cpp4
-rw-r--r--plugins/MenuItemEx/src/main.cpp2
-rw-r--r--plugins/MirLua/src/Modules/m_srmm.cpp2
-rw-r--r--plugins/MirOTR/src/svcs_srmm.cpp4
-rw-r--r--plugins/Nudge/src/main.cpp2
-rw-r--r--plugins/PasteIt/src/PasteIt.cpp16
-rw-r--r--plugins/QuickMessages/src/Utils.cpp22
-rw-r--r--plugins/QuickReplies/src/events.cpp4
-rw-r--r--plugins/Scriver/src/msgs.cpp36
-rw-r--r--plugins/SendScreenshotPlus/src/Main.cpp2
-rw-r--r--plugins/SmileyAdd/src/dlgboxsubclass.cpp4
-rw-r--r--plugins/TabSRMM/src/buttonsbar.cpp48
-rw-r--r--plugins/TabSRMM/src/modplus.cpp4
-rw-r--r--plugins/TranslitSwitcher/src/TranslitSwitcher.cpp8
-rw-r--r--protocols/CloudFile/src/srmm.cpp2
-rw-r--r--src/core/stdmsg/src/msgs.cpp26
-rw-r--r--src/mir_app/src/CMPluginBase.cpp7
-rw-r--r--src/mir_app/src/chat.h4
-rw-r--r--src/mir_app/src/file.cpp2
-rw-r--r--src/mir_app/src/mir_app.def1
-rw-r--r--src/mir_app/src/mir_app64.def1
-rw-r--r--src/mir_app/src/srmm_base.cpp4
-rw-r--r--src/mir_app/src/srmm_toolbar.cpp13
30 files changed, 128 insertions, 116 deletions
diff --git a/include/m_message.h b/include/m_message.h
index 684069bb36..61cad42f2d 100644
--- a/include/m_message.h
+++ b/include/m_message.h
@@ -211,6 +211,7 @@ EXTERN_C MIR_APP_DLL(void) Srmm_ClickStatusIcon(MCONTACT hContact, const StatusI
#define BBBF_ISSEPARATOR (1<<9)
#define BBBF_CANTBEHIDDEN (1<<10)
#define BBBF_CREATEBYID (1<<11) // only for the internal use
+#define BBBF_NOREADONLY (1<<12)
struct BBButton
{
@@ -226,10 +227,6 @@ struct BBButton
const char *pszHotkey; // name of the registered hotkey or NULL
};
-// adds a new toolbar button
-// returns button's handle on success or NULL otherwise
-EXTERN_C MIR_APP_DLL(HANDLE) Srmm_AddButton(const BBButton *bbdi, HPLUGIN);
-
// modifies the existing toolbar button
// returns 0 on success and nonzero value otherwise
EXTERN_C MIR_APP_DLL(int) Srmm_ModifyButton(BBButton *bbdi);
diff --git a/include/m_srmm_int.h b/include/m_srmm_int.h
index ce1a6a8423..a21098ea32 100644
--- a/include/m_srmm_int.h
+++ b/include/m_srmm_int.h
@@ -64,7 +64,7 @@ struct CustomButtonData : public MZeroedObject
HANDLE m_hIcon; // Handle to icolib registred icon
bool m_bIMButton, m_bChatButton;
- bool m_bCanBeHidden, m_bCantBeHidden, m_bHidden, m_bSeparator, m_bDisabled, m_bPushButton;
+ bool m_bCanBeHidden, m_bCantBeHidden, m_bHidden, m_bSeparator, m_bDisabled, m_bPushButton, m_bNoReadonly;
bool m_bRSided;
uint8_t m_opFlags;
HPLUGIN m_pPlugin;
diff --git a/include/newpluginapi.h b/include/newpluginapi.h
index e04ff075c0..76ca3e3343 100644
--- a/include/newpluginapi.h
+++ b/include/newpluginapi.h
@@ -197,6 +197,7 @@ public:
HANDLE addIcon(const struct SKINICONDESC*);
HANDLE addTTB(const struct TTBButton*);
+ HANDLE addButton(const struct BBButton *);
HGENMENU addRootMenu(int hMenuObject, LPCWSTR ptszName, int position, HANDLE hIcoLib = nullptr);
diff --git a/libs/win32/mir_app.lib b/libs/win32/mir_app.lib
index db0f15fec3..c97fb46afb 100644
--- a/libs/win32/mir_app.lib
+++ b/libs/win32/mir_app.lib
Binary files differ
diff --git a/libs/win64/mir_app.lib b/libs/win64/mir_app.lib
index 72e66630fd..e320520823 100644
--- a/libs/win64/mir_app.lib
+++ b/libs/win64/mir_app.lib
Binary files differ
diff --git a/plugins/BossKeyPlus/src/BossKey.cpp b/plugins/BossKeyPlus/src/BossKey.cpp
index 30f3332fe7..c6ad5ef4f2 100644
--- a/plugins/BossKeyPlus/src/BossKey.cpp
+++ b/plugins/BossKeyPlus/src/BossKey.cpp
@@ -560,7 +560,7 @@ static int TabsrmmButtonsInit(WPARAM, LPARAM)
bbd.pwszTooltip = LPGENW("Hide Miranda NG");
bbd.bbbFlags = BBBF_ISRSIDEBUTTON | BBBF_CANBEHIDDEN;
bbd.hIcon = iconList[0].hIcolib;
- Srmm_AddButton(&bbd, &g_plugin);
+ g_plugin.addButton(&bbd);
return 0;
}
diff --git a/plugins/FTPFileYM/src/ftpfile.cpp b/plugins/FTPFileYM/src/ftpfile.cpp
index f9df1e5591..dbb5921940 100644
--- a/plugins/FTPFileYM/src/ftpfile.cpp
+++ b/plugins/FTPFileYM/src/ftpfile.cpp
@@ -164,14 +164,14 @@ void InitHotkeys()
void InitTabsrmmButton()
{
- BBButton btn = {};
- btn.dwButtonID = 1;
- btn.pszModuleName = MODULENAME;
- btn.dwDefPos = 105;
- btn.hIcon = g_plugin.getIconHandle(IDI_MENU);
- btn.bbbFlags = BBBF_ISARROWBUTTON | BBBF_ISIMBUTTON | BBBF_CANBEHIDDEN;
- btn.pwszTooltip = TranslateT("FTP File");
- Srmm_AddButton(&btn, &g_plugin);
+ BBButton bbd = {};
+ bbd.dwButtonID = 1;
+ bbd.pszModuleName = MODULENAME;
+ bbd.dwDefPos = 105;
+ bbd.hIcon = g_plugin.getIconHandle(IDI_MENU);
+ bbd.bbbFlags = BBBF_ISARROWBUTTON | BBBF_ISIMBUTTON | BBBF_CANBEHIDDEN;
+ bbd.pwszTooltip = TranslateT("FTP File");
+ g_plugin.addButton(&bbd);
HookEvent(ME_MSG_BUTTONPRESSED, TabsrmmButtonPressed);
}
diff --git a/plugins/IEView/src/ieview_main.cpp b/plugins/IEView/src/ieview_main.cpp
index 5932978502..9056ca1950 100644
--- a/plugins/IEView/src/ieview_main.cpp
+++ b/plugins/IEView/src/ieview_main.cpp
@@ -72,12 +72,12 @@ static int ModulesLoaded(WPARAM, LPARAM)
BBButton bbd = {};
bbd.pszModuleName = MODULENAME;
bbd.dwButtonID = 1;
- bbd.bbbFlags = BBBF_ISCHATBUTTON | BBBF_ISIMBUTTON;
+ bbd.bbbFlags = BBBF_ISCHATBUTTON | BBBF_ISIMBUTTON | BBBF_NOREADONLY | BBBF_NOREADONLY;
bbd.dwDefPos = 40;
bbd.hIcon = g_plugin.getIconHandle(IDI_CODE);
bbd.pwszText = L"[Code]";
bbd.pwszTooltip = LPGENW("Format text as code");
- Srmm_AddButton(&bbd, &g_plugin);
+ g_plugin.addButton(&bbd);
HookEvent(ME_MSG_BUTTONPRESSED, CustomButtonPressed);
diff --git a/plugins/MenuItemEx/src/main.cpp b/plugins/MenuItemEx/src/main.cpp
index 0a76189564..2e0e54e8da 100644
--- a/plugins/MenuItemEx/src/main.cpp
+++ b/plugins/MenuItemEx/src/main.cpp
@@ -764,7 +764,7 @@ static int TabsrmmButtonsInit(WPARAM, LPARAM)
bbd.pwszTooltip = LPGENW("Browse Received Files");
bbd.bbbFlags = BBBF_CANBEHIDDEN;
bbd.hIcon = IcoLib_GetIconHandle("miex_recfiles");
- Srmm_AddButton(&bbd, &g_plugin);
+ g_plugin.addButton(&bbd);
return 0;
}
diff --git a/plugins/MirLua/src/Modules/m_srmm.cpp b/plugins/MirLua/src/Modules/m_srmm.cpp
index e61dad3dfd..d948b0961b 100644
--- a/plugins/MirLua/src/Modules/m_srmm.cpp
+++ b/plugins/MirLua/src/Modules/m_srmm.cpp
@@ -2,6 +2,8 @@
#define MT_BBBUTTON "BBButton"
+EXTERN_C MIR_APP_DLL(HANDLE) Srmm_AddButton(const BBButton *, HPLUGIN);
+
static void MakeBBButton(lua_State *L, BBButton &bbb)
{
bbb.dwDefPos = 100;
diff --git a/plugins/MirOTR/src/svcs_srmm.cpp b/plugins/MirOTR/src/svcs_srmm.cpp
index f3aa6d6f98..5be56308c6 100644
--- a/plugins/MirOTR/src/svcs_srmm.cpp
+++ b/plugins/MirOTR/src/svcs_srmm.cpp
@@ -75,7 +75,7 @@ void SetEncryptionStatus(MCONTACT hContact, TrustLevel level)
int SVC_ButtonsBarLoaded(WPARAM, LPARAM)
{
- Srmm_AddButton(&OTRButton, &g_plugin);
+ g_plugin.addButton(&OTRButton);
return 0;
}
@@ -121,7 +121,7 @@ void InitSRMM()
memset(&OTRButton, 0, sizeof(OTRButton));
OTRButton.pszModuleName = MODULENAME;
OTRButton.dwDefPos = 200;
- OTRButton.bbbFlags = BBBF_ISRSIDEBUTTON | BBBF_CANBEHIDDEN | BBBF_ISIMBUTTON;
+ OTRButton.bbbFlags = BBBF_ISRSIDEBUTTON | BBBF_CANBEHIDDEN | BBBF_ISIMBUTTON | BBBF_NOREADONLY;
OTRButton.pwszTooltip = TranslateT(LANG_OTR_TOOLTIP);
OTRButton.hIcon = iconList[ICON_NOT_PRIVATE].hIcolib;
diff --git a/plugins/Nudge/src/main.cpp b/plugins/Nudge/src/main.cpp
index 7506888879..02f5d36cec 100644
--- a/plugins/Nudge/src/main.cpp
+++ b/plugins/Nudge/src/main.cpp
@@ -385,7 +385,7 @@ static int TabsrmmButtonInit(WPARAM, LPARAM)
bbd.hIcon = iconList[0].hIcolib;
bbd.dwButtonID = 6000;
bbd.pszHotkey = hkd.pszName;
- Srmm_AddButton(&bbd, &g_plugin);
+ g_plugin.addButton(&bbd);
return 0;
}
diff --git a/plugins/PasteIt/src/PasteIt.cpp b/plugins/PasteIt/src/PasteIt.cpp
index 3c2fdf7df8..ca180f5c48 100644
--- a/plugins/PasteIt/src/PasteIt.cpp
+++ b/plugins/PasteIt/src/PasteIt.cpp
@@ -282,14 +282,14 @@ void DefWebPageChanged()
static void InitTabsrmmButton()
{
- BBButton btn = {};
- btn.dwButtonID = 1;
- btn.pszModuleName = MODULENAME;
- btn.dwDefPos = 110;
- btn.hIcon = iconList[0].hIcolib;
- btn.bbbFlags = BBBF_ISARROWBUTTON | BBBF_ISIMBUTTON | BBBF_CANBEHIDDEN | BBBF_ISCHATBUTTON;
- btn.pwszTooltip = TranslateT("Paste It");
- Srmm_AddButton(&btn, &g_plugin);
+ BBButton bbd = {};
+ bbd.dwButtonID = 1;
+ bbd.pszModuleName = MODULENAME;
+ bbd.dwDefPos = 110;
+ bbd.hIcon = iconList[0].hIcolib;
+ bbd.bbbFlags = BBBF_ISARROWBUTTON | BBBF_ISIMBUTTON | BBBF_CANBEHIDDEN | BBBF_ISCHATBUTTON | BBBF_NOREADONLY;
+ bbd.pwszTooltip = TranslateT("Paste It");
+ g_plugin.addButton(&bbd);
if (hTabsrmmButtonPressed != nullptr)
UnhookEvent(hTabsrmmButtonPressed);
diff --git a/plugins/QuickMessages/src/Utils.cpp b/plugins/QuickMessages/src/Utils.cpp
index 0de8c5dcb7..04d56f14a9 100644
--- a/plugins/QuickMessages/src/Utils.cpp
+++ b/plugins/QuickMessages/src/Utils.cpp
@@ -239,22 +239,22 @@ static HANDLE AddIcon(char* szIcoName)
uint32_t BalanceButtons(int buttonsWas, int buttonsNow)
{
- BBButton bb = {};
- bb.pszModuleName = MODULENAME;
+ BBButton bbd = {};
+ bbd.pszModuleName = MODULENAME;
while (buttonsWas > buttonsNow) {
- bb.dwButtonID = --buttonsWas;
- Srmm_RemoveButton(&bb);
+ bbd.dwButtonID = --buttonsWas;
+ Srmm_RemoveButton(&bbd);
}
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, &g_plugin);
+ bbd.bbbFlags = BBBF_ISIMBUTTON | BBBF_ISCHATBUTTON | BBBF_NOREADONLY;
+ bbd.dwButtonID = buttonsWas++;
+ bbd.dwDefPos = 300 + buttonsWas;
+ bbd.hIcon = AddIcon(iconname);
+ g_plugin.addButton(&bbd);
}
return buttonsNow;
@@ -370,13 +370,13 @@ int RegisterCustomButton(WPARAM, LPARAM)
mir_snprintf(iconname, LPGEN("Quick Messages Button %u"), i);
BBButton bbd = {};
- bbd.bbbFlags = BBBF_ISIMBUTTON | BBBF_ISCHATBUTTON;
+ bbd.bbbFlags = BBBF_ISIMBUTTON | BBBF_ISCHATBUTTON | BBBF_NOREADONLY;
bbd.dwButtonID = i;
bbd.dwDefPos = 320 + i;
bbd.hIcon = AddIcon(iconname);
bbd.pszModuleName = MODULENAME;
bbd.pwszTooltip = ld->ptszButtonName;
- Srmm_AddButton(&bbd, &g_plugin);
+ g_plugin.addButton(&bbd);
}
return 0;
}
diff --git a/plugins/QuickReplies/src/events.cpp b/plugins/QuickReplies/src/events.cpp
index 5865a6298c..784bb51d72 100644
--- a/plugins/QuickReplies/src/events.cpp
+++ b/plugins/QuickReplies/src/events.cpp
@@ -39,13 +39,13 @@ int OnModulesLoaded(WPARAM, LPARAM)
mir_snprintf(buttonName, MODULENAME" %x", iNumber + 1);
BBButton bbd = {};
- bbd.bbbFlags = BBBF_ISIMBUTTON | BBBF_ISCHATBUTTON;
+ bbd.bbbFlags = BBBF_ISIMBUTTON | BBBF_ISCHATBUTTON | BBBF_NOREADONLY;
bbd.pszModuleName = buttonName;
bbd.pwszTooltip = LPGENW("Quick Replies");
bbd.hIcon = iconList[0].hIcolib;
bbd.dwButtonID = iNumber;
bbd.dwDefPos = 220;
- Srmm_AddButton(&bbd, &g_plugin);
+ g_plugin.addButton(&bbd);
return 0;
}
diff --git a/plugins/Scriver/src/msgs.cpp b/plugins/Scriver/src/msgs.cpp
index 80dbe87ee0..1ed017280d 100644
--- a/plugins/Scriver/src/msgs.cpp
+++ b/plugins/Scriver/src/msgs.cpp
@@ -345,43 +345,43 @@ int RegisterToolbarIcons(WPARAM, LPARAM)
{
BBButton bbd = {};
bbd.pszModuleName = "SRMM";
- bbd.bbbFlags = BBBF_ISCHATBUTTON | BBBF_ISIMBUTTON | BBBF_CREATEBYID | BBBF_ISRSIDEBUTTON | BBBF_CANTBEHIDDEN;
+ bbd.bbbFlags = BBBF_ISCHATBUTTON | BBBF_ISIMBUTTON | BBBF_CREATEBYID | BBBF_ISRSIDEBUTTON | BBBF_CANTBEHIDDEN | BBBF_NOREADONLY;
bbd.dwButtonID = IDOK;
bbd.dwDefPos = 5;
bbd.hIcon = g_plugin.getIconHandle(IDI_SEND);
bbd.pwszText = LPGENW("&OK");
bbd.pwszTooltip = LPGENW("Send message");
- Srmm_AddButton(&bbd, &g_plugin);
+ g_plugin.addButton(&bbd);
- bbd.bbbFlags = BBBF_ISIMBUTTON | BBBF_CREATEBYID;
+ bbd.bbbFlags = BBBF_ISIMBUTTON | BBBF_CREATEBYID | BBBF_NOREADONLY;
bbd.dwButtonID = IDC_QUOTE;
bbd.dwDefPos = 10;
bbd.hIcon = g_plugin.getIconHandle(IDI_QUOTE);
bbd.pwszText = LPGENW("&Quote");
bbd.pwszTooltip = LPGENW("Quote");
- Srmm_AddButton(&bbd, &g_plugin);
+ g_plugin.addButton(&bbd);
- bbd.bbbFlags |= BBBF_ISRSIDEBUTTON;
+ bbd.bbbFlags = BBBF_ISIMBUTTON | BBBF_CREATEBYID | BBBF_ISRSIDEBUTTON;
bbd.dwButtonID = IDC_ADD;
bbd.dwDefPos = 20;
bbd.hIcon = g_plugin.getIconHandle(IDI_ADDCONTACT);
bbd.pwszText = LPGENW("&Add");
bbd.pwszTooltip = LPGENW("Add contact permanently to list");
- Srmm_AddButton(&bbd, &g_plugin);
+ g_plugin.addButton(&bbd);
bbd.dwButtonID = IDC_USERMENU;
bbd.dwDefPos = 30;
bbd.hIcon = Skin_GetIconHandle(SKINICON_OTHER_DOWNARROW);
bbd.pwszText = LPGENW("&User menu");
bbd.pwszTooltip = LPGENW("User menu");
- Srmm_AddButton(&bbd, &g_plugin);
+ g_plugin.addButton(&bbd);
bbd.dwButtonID = IDC_DETAILS;
bbd.dwDefPos = 40;
bbd.hIcon = g_plugin.getIconHandle(IDI_USERDETAILS);
bbd.pwszText = LPGENW("User &details");
bbd.pwszTooltip = LPGENW("View user's details");
- Srmm_AddButton(&bbd, &g_plugin);
+ g_plugin.addButton(&bbd);
bbd.bbbFlags |= BBBF_ISCHATBUTTON | BBBF_ISRSIDEBUTTON;
bbd.dwButtonID = IDC_SRMM_HISTORY;
@@ -389,44 +389,44 @@ int RegisterToolbarIcons(WPARAM, LPARAM)
bbd.hIcon = g_plugin.getIconHandle(IDI_HISTORY);
bbd.pwszText = LPGENW("&History");
bbd.pwszTooltip = LPGENW("View user's history (Ctrl+H)");
- Srmm_AddButton(&bbd, &g_plugin);
+ g_plugin.addButton(&bbd);
// chat buttons
- bbd.bbbFlags = BBBF_ISPUSHBUTTON | BBBF_ISCHATBUTTON | BBBF_CREATEBYID;
+ bbd.bbbFlags = BBBF_ISPUSHBUTTON | BBBF_ISCHATBUTTON | BBBF_CREATEBYID | BBBF_NOREADONLY;
bbd.dwButtonID = IDC_SRMM_BOLD;
bbd.dwDefPos = 10;
bbd.hIcon = g_plugin.getIconHandle(IDI_BBOLD);
bbd.pwszText = LPGENW("&Bold");
bbd.pwszTooltip = LPGENW("Make the text bold (Ctrl+B)");
- Srmm_AddButton(&bbd, &g_plugin);
+ g_plugin.addButton(&bbd);
bbd.dwButtonID = IDC_SRMM_ITALICS;
bbd.dwDefPos = 15;
bbd.hIcon = g_plugin.getIconHandle(IDI_BITALICS);
bbd.pwszText = LPGENW("&Italic");
bbd.pwszTooltip = LPGENW("Make the text italicized (Ctrl+I)");
- Srmm_AddButton(&bbd, &g_plugin);
+ g_plugin.addButton(&bbd);
bbd.dwButtonID = IDC_SRMM_UNDERLINE;
bbd.dwDefPos = 20;
bbd.hIcon = g_plugin.getIconHandle(IDI_BUNDERLINE);
bbd.pwszText = LPGENW("&Underline");
bbd.pwszTooltip = LPGENW("Make the text underlined (Ctrl+U)");
- Srmm_AddButton(&bbd, &g_plugin);
+ g_plugin.addButton(&bbd);
bbd.dwButtonID = IDC_SRMM_COLOR;
bbd.dwDefPos = 25;
bbd.hIcon = g_plugin.getIconHandle(IDI_COLOR);
bbd.pwszText = LPGENW("&Color");
bbd.pwszTooltip = LPGENW("Select a foreground color for the text (Ctrl+K)");
- Srmm_AddButton(&bbd, &g_plugin);
+ g_plugin.addButton(&bbd);
bbd.dwButtonID = IDC_SRMM_BKGCOLOR;
bbd.dwDefPos = 30;
bbd.hIcon = g_plugin.getIconHandle(IDI_BKGCOLOR);
bbd.pwszText = LPGENW("&Background color");
bbd.pwszTooltip = LPGENW("Select a background color for the text (Ctrl+L)");
- Srmm_AddButton(&bbd, &g_plugin);
+ g_plugin.addButton(&bbd);
bbd.bbbFlags = BBBF_ISCHATBUTTON | BBBF_ISRSIDEBUTTON | BBBF_CREATEBYID;
bbd.dwButtonID = IDC_SRMM_CHANMGR;
@@ -434,21 +434,21 @@ int RegisterToolbarIcons(WPARAM, LPARAM)
bbd.hIcon = g_plugin.getIconHandle(IDI_TOPICBUT);
bbd.pwszText = LPGENW("&Room settings");
bbd.pwszTooltip = LPGENW("Control this room (Ctrl+O)");
- Srmm_AddButton(&bbd, &g_plugin);
+ g_plugin.addButton(&bbd);
bbd.dwButtonID = IDC_SRMM_SHOWNICKLIST;
bbd.dwDefPos = 20;
bbd.hIcon = g_plugin.getIconHandle(IDI_NICKLIST);
bbd.pwszText = LPGENW("&Show/hide nick list");
bbd.pwszTooltip = LPGENW("Show/hide the nick list (Ctrl+N)");
- Srmm_AddButton(&bbd, &g_plugin);
+ g_plugin.addButton(&bbd);
bbd.dwButtonID = IDC_SRMM_FILTER;
bbd.dwDefPos = 10;
bbd.hIcon = g_plugin.getIconHandle(IDI_FILTER);
bbd.pwszText = LPGENW("&Filter");
bbd.pwszTooltip = LPGENW("Enable/disable the event filter (Ctrl+F)");
- Srmm_AddButton(&bbd, &g_plugin);
+ g_plugin.addButton(&bbd);
return 0;
}
diff --git a/plugins/SendScreenshotPlus/src/Main.cpp b/plugins/SendScreenshotPlus/src/Main.cpp
index f2455932b2..7795120f20 100644
--- a/plugins/SendScreenshotPlus/src/Main.cpp
+++ b/plugins/SendScreenshotPlus/src/Main.cpp
@@ -252,7 +252,7 @@ static int TabsrmmButtonsInit(WPARAM, LPARAM)
bbd.bbbFlags = BBBF_ISIMBUTTON | BBBF_ISCHATBUTTON;
bbd.dwDefPos = 201;
bbd.hIcon = GetIconHandle(ICO_MAINXS);
- Srmm_AddButton(&bbd, &g_plugin);
+ g_plugin.addButton(&bbd);
return 0;
}
diff --git a/plugins/SmileyAdd/src/dlgboxsubclass.cpp b/plugins/SmileyAdd/src/dlgboxsubclass.cpp
index 2e44a1c699..6a560a4127 100644
--- a/plugins/SmileyAdd/src/dlgboxsubclass.cpp
+++ b/plugins/SmileyAdd/src/dlgboxsubclass.cpp
@@ -90,9 +90,9 @@ int SmileyButtonCreate(WPARAM, LPARAM)
bbd.pwszTooltip = LPGENW("Show smiley selection window");
bbd.dwDefPos = 31;
bbd.hIcon = IcoLib_GetIconHandle("SmileyAdd_ButtonSmiley");
- bbd.bbbFlags = BBBF_ISIMBUTTON | BBBF_ISCHATBUTTON;
+ bbd.bbbFlags = BBBF_ISIMBUTTON | BBBF_ISCHATBUTTON | BBBF_NOREADONLY;
bbd.pszHotkey = desc.pszName;
- Srmm_AddButton(&bbd, &g_plugin);
+ g_plugin.addButton(&bbd);
return 0;
}
diff --git a/plugins/TabSRMM/src/buttonsbar.cpp b/plugins/TabSRMM/src/buttonsbar.cpp
index b81dfd7fbf..f8fd6e8a01 100644
--- a/plugins/TabSRMM/src/buttonsbar.cpp
+++ b/plugins/TabSRMM/src/buttonsbar.cpp
@@ -12,80 +12,80 @@ static int CB_InitDefaultButtons(WPARAM, LPARAM)
bbd.hIcon = Skin_GetIconHandle(SKINICON_OTHER_CONNECTING);
bbd.pszModuleName = "Tabsrmm";
bbd.pwszTooltip = LPGENW("Protocol button");
- Srmm_AddButton(&bbd, &g_plugin);
+ g_plugin.addButton(&bbd);
bbd.dwButtonID = IDC_NAME;
bbd.dwDefPos = 20;
bbd.hIcon = PluginConfig.g_buttonBarIconHandles[20];
bbd.pwszTooltip = LPGENW("Info button");
- Srmm_AddButton(&bbd, &g_plugin);
+ g_plugin.addButton(&bbd);
- bbd.bbbFlags = BBBF_ISIMBUTTON | BBBF_ISCHATBUTTON | BBBF_ISPUSHBUTTON | BBBF_CANBEHIDDEN | BBBF_CREATEBYID;
+ bbd.bbbFlags = BBBF_ISIMBUTTON | BBBF_ISCHATBUTTON | BBBF_ISPUSHBUTTON | BBBF_CANBEHIDDEN | BBBF_CREATEBYID | BBBF_NOREADONLY;
bbd.dwButtonID = IDC_SRMM_BOLD;
bbd.dwDefPos = 40;
bbd.hIcon = PluginConfig.g_buttonBarIconHandles[10];
bbd.pwszTooltip = LPGENW("Bold text");
- Srmm_AddButton(&bbd, &g_plugin);
+ g_plugin.addButton(&bbd);
bbd.dwButtonID = IDC_SRMM_ITALICS;
bbd.dwDefPos = 50;
bbd.hIcon = PluginConfig.g_buttonBarIconHandles[11];
bbd.pwszTooltip = LPGENW("Italic text");
- Srmm_AddButton(&bbd, &g_plugin);
+ g_plugin.addButton(&bbd);
bbd.dwButtonID = IDC_SRMM_UNDERLINE;
bbd.dwDefPos = 60;
bbd.hIcon = PluginConfig.g_buttonBarIconHandles[12];
bbd.pwszTooltip = LPGENW("Underlined text");
- Srmm_AddButton(&bbd, &g_plugin);
+ g_plugin.addButton(&bbd);
- bbd.bbbFlags = BBBF_ISIMBUTTON | BBBF_ISPUSHBUTTON | BBBF_CANBEHIDDEN | BBBF_CREATEBYID;
+ bbd.bbbFlags = BBBF_ISIMBUTTON | BBBF_ISPUSHBUTTON | BBBF_CANBEHIDDEN | BBBF_CREATEBYID | BBBF_NOREADONLY;
bbd.dwButtonID = IDC_FONTSTRIKEOUT;
bbd.dwDefPos = 70;
bbd.hIcon = PluginConfig.g_buttonBarIconHandles[15];
bbd.pwszTooltip = LPGENW("Strike-through text");
- Srmm_AddButton(&bbd, &g_plugin);
+ g_plugin.addButton(&bbd);
- bbd.bbbFlags = BBBF_ISIMBUTTON | BBBF_ISCHATBUTTON | BBBF_ISRSIDEBUTTON | BBBF_ISARROWBUTTON | BBBF_CREATEBYID;
+ bbd.bbbFlags = BBBF_ISIMBUTTON | BBBF_ISCHATBUTTON | BBBF_ISRSIDEBUTTON | BBBF_ISARROWBUTTON | BBBF_CREATEBYID | BBBF_NOREADONLY;
bbd.dwButtonID = IDOK;
bbd.dwDefPos = 10;
bbd.hIcon = PluginConfig.g_buttonBarIconHandles[6];
bbd.pwszTooltip = LPGENW("Send message\nClick dropdown arrow for sending options");
- Srmm_AddButton(&bbd, &g_plugin);
+ g_plugin.addButton(&bbd);
bbd.bbbFlags = BBBF_ISIMBUTTON | BBBF_ISCHATBUTTON | BBBF_ISRSIDEBUTTON | BBBF_CREATEBYID;
bbd.dwButtonID = IDC_CLOSE;
bbd.dwDefPos = 20;
bbd.hIcon = PluginConfig.g_buttonBarIconHandles[8];
bbd.pwszTooltip = LPGENW("Close session");
- Srmm_AddButton(&bbd, &g_plugin);
+ g_plugin.addButton(&bbd);
- bbd.bbbFlags = BBBF_ISIMBUTTON | BBBF_ISRSIDEBUTTON | BBBF_CREATEBYID;
+ bbd.bbbFlags = BBBF_ISIMBUTTON | BBBF_ISRSIDEBUTTON | BBBF_CREATEBYID | BBBF_NOREADONLY;
bbd.dwButtonID = IDC_QUOTE;
bbd.dwDefPos = 30;
bbd.hIcon = PluginConfig.g_buttonBarIconHandles[4];
bbd.pwszTooltip = LPGENW("Quote last message OR selected text");
- Srmm_AddButton(&bbd, &g_plugin);
+ g_plugin.addButton(&bbd);
bbd.dwButtonID = IDC_TIME;
bbd.dwDefPos = 40;
bbd.hIcon = PluginConfig.g_buttonBarIconHandles[2];
bbd.pwszTooltip = LPGENW("Message log options");
- Srmm_AddButton(&bbd, &g_plugin);
+ g_plugin.addButton(&bbd);
bbd.bbbFlags = BBBF_ISIMBUTTON | BBBF_ISCHATBUTTON | BBBF_ISRSIDEBUTTON | BBBF_CREATEBYID;
bbd.dwButtonID = IDC_SRMM_HISTORY;
bbd.dwDefPos = 50;
bbd.hIcon = PluginConfig.g_buttonBarIconHandles[0];
bbd.pwszTooltip = LPGENW("View user's history");
- Srmm_AddButton(&bbd, &g_plugin);
+ g_plugin.addButton(&bbd);
bbd.bbbFlags = BBBF_ISIMBUTTON | BBBF_ISRSIDEBUTTON | BBBF_CREATEBYID;
bbd.dwButtonID = IDC_PIC;
bbd.dwDefPos = 60;
bbd.hIcon = PluginConfig.g_buttonBarIconHandles[7];
bbd.pwszTooltip = LPGENW("Edit user notes");
- Srmm_AddButton(&bbd, &g_plugin);
+ g_plugin.addButton(&bbd);
// chat buttons
bbd.bbbFlags = BBBF_ISCHATBUTTON | BBBF_ISSEPARATOR;
@@ -94,15 +94,15 @@ static int CB_InitDefaultButtons(WPARAM, LPARAM)
bbd.dwDefPos = 35;
bbd.hIcon = nullptr;
bbd.pwszTooltip = nullptr;
- Srmm_AddButton(&bbd, &g_plugin);
+ g_plugin.addButton(&bbd);
bbd.dwButtonID = 2;
bbd.dwDefPos = 22;
- Srmm_AddButton(&bbd, &g_plugin);
+ g_plugin.addButton(&bbd);
bbd.dwButtonID = 3;
bbd.dwDefPos = 71;
- Srmm_AddButton(&bbd, &g_plugin);
+ g_plugin.addButton(&bbd);
bbd.bbbFlags = BBBF_ISCHATBUTTON | BBBF_ISPUSHBUTTON | BBBF_CREATEBYID;
bbd.dwButtonID = IDC_SRMM_COLOR;
@@ -110,32 +110,32 @@ static int CB_InitDefaultButtons(WPARAM, LPARAM)
bbd.dwDefPos = 80;
bbd.hIcon = PluginConfig.g_buttonBarIconHandles[14];
bbd.pwszTooltip = LPGENW("Select a foreground color for the text (Ctrl+K)");
- Srmm_AddButton(&bbd, &g_plugin);
+ g_plugin.addButton(&bbd);
bbd.dwButtonID = IDC_SRMM_BKGCOLOR;
bbd.dwDefPos = 81;
bbd.hIcon = PluginConfig.g_buttonBarIconHandles[16];
bbd.pwszTooltip = LPGENW("Select a background color for the text (Ctrl+L)");
- Srmm_AddButton(&bbd, &g_plugin);
+ g_plugin.addButton(&bbd);
bbd.bbbFlags = BBBF_ISCHATBUTTON | BBBF_ISRSIDEBUTTON | BBBF_CREATEBYID;
bbd.dwButtonID = IDC_SRMM_SHOWNICKLIST;
bbd.dwDefPos = 22;
bbd.hIcon = PluginConfig.g_buttonBarIconHandles[19];
bbd.pwszTooltip = LPGENW("Show/hide the nick list (Ctrl+N)");
- Srmm_AddButton(&bbd, &g_plugin);
+ g_plugin.addButton(&bbd);
bbd.dwButtonID = IDC_SRMM_FILTER;
bbd.dwDefPos = 24;
bbd.hIcon = PluginConfig.g_buttonBarIconHandles[18];
bbd.pwszTooltip = LPGENW("Enable/disable the event filter (Ctrl+F)");
- Srmm_AddButton(&bbd, &g_plugin);
+ g_plugin.addButton(&bbd);
bbd.dwButtonID = IDC_SRMM_CHANMGR;
bbd.dwDefPos = 33;
bbd.hIcon = PluginConfig.g_buttonBarIconHandles[17];
bbd.pwszTooltip = LPGENW("Control this room (Ctrl+O)");
- Srmm_AddButton(&bbd, &g_plugin);
+ g_plugin.addButton(&bbd);
return 0;
}
diff --git a/plugins/TabSRMM/src/modplus.cpp b/plugins/TabSRMM/src/modplus.cpp
index a8daa352ef..b938c3d543 100644
--- a/plugins/TabSRMM/src/modplus.cpp
+++ b/plugins/TabSRMM/src/modplus.cpp
@@ -50,13 +50,13 @@ static wchar_t* getMenuEntry(int i)
static int RegisterCustomButton(WPARAM, LPARAM)
{
BBButton bbd = {};
- bbd.bbbFlags = BBBF_ISIMBUTTON | BBBF_ISPUSHBUTTON;
+ bbd.bbbFlags = BBBF_ISIMBUTTON | BBBF_ISPUSHBUTTON | BBBF_NOREADONLY;
bbd.dwButtonID = 1;
bbd.dwDefPos = 200;
bbd.hIcon = PluginConfig.g_buttonBarIconHandles[3];
bbd.pszModuleName = "Tabmodplus";
bbd.pwszTooltip = LPGENW("Insert [img] tag / surround selected text with [img][/img]");
- Srmm_AddButton(&bbd, &g_plugin);
+ g_plugin.addButton(&bbd);
return 0;
}
diff --git a/plugins/TranslitSwitcher/src/TranslitSwitcher.cpp b/plugins/TranslitSwitcher/src/TranslitSwitcher.cpp
index eee021c5bd..833907bd98 100644
--- a/plugins/TranslitSwitcher/src/TranslitSwitcher.cpp
+++ b/plugins/TranslitSwitcher/src/TranslitSwitcher.cpp
@@ -85,27 +85,27 @@ int OnModulesLoaded(WPARAM, LPARAM)
g_plugin.registerIcon("TabSRMM/TranslitSwitcher", iconList);
BBButton bbd = {};
- bbd.bbbFlags = BBBF_ISIMBUTTON | BBBF_ISCHATBUTTON | BBBF_ISRSIDEBUTTON;
+ bbd.bbbFlags = BBBF_ISIMBUTTON | BBBF_ISCHATBUTTON | BBBF_ISRSIDEBUTTON | BBBF_NOREADONLY;
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, &g_plugin);
+ g_plugin.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, &g_plugin);
+ g_plugin.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, &g_plugin);
+ g_plugin.addButton(&bbd);
return 0;
}
diff --git a/protocols/CloudFile/src/srmm.cpp b/protocols/CloudFile/src/srmm.cpp
index b36211de30..558b86fdd4 100644
--- a/protocols/CloudFile/src/srmm.cpp
+++ b/protocols/CloudFile/src/srmm.cpp
@@ -11,7 +11,7 @@ int OnSrmmToolbarLoaded(WPARAM, LPARAM)
bbd.hIcon = g_plugin.getIconHandle(IDI_UPLOAD);
bbd.dwButtonID = BBB_ID_FILE_SEND;
bbd.dwDefPos = 100 + bbd.dwButtonID;
- Srmm_AddButton(&bbd, &g_plugin);
+ g_plugin.addButton(&bbd);
return 0;
}
diff --git a/src/core/stdmsg/src/msgs.cpp b/src/core/stdmsg/src/msgs.cpp
index 066550d3bd..fcf23c51d8 100644
--- a/src/core/stdmsg/src/msgs.cpp
+++ b/src/core/stdmsg/src/msgs.cpp
@@ -327,21 +327,21 @@ int RegisterToolbarIcons(WPARAM, LPARAM)
bbd.hIcon = Skin_GetIconHandle(SKINICON_OTHER_ADDCONTACT);
bbd.pwszText = LPGENW("&Add");
bbd.pwszTooltip = LPGENW("Add contact permanently to list");
- Srmm_AddButton(&bbd, &g_plugin);
+ g_plugin.addButton(&bbd);
bbd.dwButtonID = IDC_USERMENU;
bbd.dwDefPos = 20;
bbd.hIcon = Skin_GetIconHandle(SKINICON_OTHER_DOWNARROW);
bbd.pwszText = LPGENW("&User menu");
bbd.pwszTooltip = LPGENW("User menu");
- Srmm_AddButton(&bbd, &g_plugin);
+ g_plugin.addButton(&bbd);
bbd.dwButtonID = IDC_DETAILS;
bbd.dwDefPos = 30;
bbd.hIcon = Skin_GetIconHandle(SKINICON_OTHER_USERDETAILS);
bbd.pwszText = LPGENW("User &details");
bbd.pwszTooltip = LPGENW("View user's details");
- Srmm_AddButton(&bbd, &g_plugin);
+ g_plugin.addButton(&bbd);
bbd.bbbFlags |= BBBF_ISCHATBUTTON | BBBF_ISRSIDEBUTTON;
bbd.dwButtonID = IDC_SRMM_HISTORY;
@@ -349,44 +349,44 @@ int RegisterToolbarIcons(WPARAM, LPARAM)
bbd.hIcon = Skin_GetIconHandle(SKINICON_OTHER_HISTORY);
bbd.pwszText = LPGENW("&History");
bbd.pwszTooltip = LPGENW("View user's history (Ctrl+H)");
- Srmm_AddButton(&bbd, &g_plugin);
+ g_plugin.addButton(&bbd);
// chat buttons
- bbd.bbbFlags = BBBF_ISPUSHBUTTON | BBBF_ISCHATBUTTON | BBBF_CREATEBYID;
+ bbd.bbbFlags = BBBF_ISPUSHBUTTON | BBBF_ISCHATBUTTON | BBBF_CREATEBYID | BBBF_NOREADONLY;
bbd.dwButtonID = IDC_SRMM_BOLD;
bbd.dwDefPos = 10;
bbd.hIcon = g_plugin.getIconHandle(IDI_BBOLD);
bbd.pwszText = LPGENW("&Bold");
bbd.pwszTooltip = LPGENW("Make the text bold (Ctrl+B)");
- Srmm_AddButton(&bbd, &g_plugin);
+ g_plugin.addButton(&bbd);
bbd.dwButtonID = IDC_SRMM_ITALICS;
bbd.dwDefPos = 15;
bbd.hIcon = g_plugin.getIconHandle(IDI_BITALICS);
bbd.pwszText = LPGENW("&Italic");
bbd.pwszTooltip = LPGENW("Make the text italicized (Ctrl+I)");
- Srmm_AddButton(&bbd, &g_plugin);
+ g_plugin.addButton(&bbd);
bbd.dwButtonID = IDC_SRMM_UNDERLINE;
bbd.dwDefPos = 20;
bbd.hIcon = g_plugin.getIconHandle(IDI_BUNDERLINE);
bbd.pwszText = LPGENW("&Underline");
bbd.pwszTooltip = LPGENW("Make the text underlined (Ctrl+U)");
- Srmm_AddButton(&bbd, &g_plugin);
+ g_plugin.addButton(&bbd);
bbd.dwButtonID = IDC_SRMM_COLOR;
bbd.dwDefPos = 25;
bbd.hIcon = g_plugin.getIconHandle(IDI_COLOR);
bbd.pwszText = LPGENW("&Color");
bbd.pwszTooltip = LPGENW("Select a foreground color for the text (Ctrl+K)");
- Srmm_AddButton(&bbd, &g_plugin);
+ g_plugin.addButton(&bbd);
bbd.dwButtonID = IDC_SRMM_BKGCOLOR;
bbd.dwDefPos = 30;
bbd.hIcon = g_plugin.getIconHandle(IDI_BKGCOLOR);
bbd.pwszText = LPGENW("&Background color");
bbd.pwszTooltip = LPGENW("Select a background color for the text (Ctrl+L)");
- Srmm_AddButton(&bbd, &g_plugin);
+ g_plugin.addButton(&bbd);
bbd.bbbFlags = BBBF_ISCHATBUTTON | BBBF_ISRSIDEBUTTON | BBBF_CREATEBYID;
bbd.dwButtonID = IDC_SRMM_CHANMGR;
@@ -394,21 +394,21 @@ int RegisterToolbarIcons(WPARAM, LPARAM)
bbd.hIcon = g_plugin.getIconHandle(IDI_TOPICBUT);
bbd.pwszText = LPGENW("&Room settings");
bbd.pwszTooltip = LPGENW("Control this room (Ctrl+O)");
- Srmm_AddButton(&bbd, &g_plugin);
+ g_plugin.addButton(&bbd);
bbd.dwButtonID = IDC_SRMM_SHOWNICKLIST;
bbd.dwDefPos = 20;
bbd.hIcon = g_plugin.getIconHandle(IDI_NICKLIST);
bbd.pwszText = LPGENW("&Show/hide nick list");
bbd.pwszTooltip = LPGENW("Show/hide the nick list (Ctrl+N)");
- Srmm_AddButton(&bbd, &g_plugin);
+ g_plugin.addButton(&bbd);
bbd.dwButtonID = IDC_SRMM_FILTER;
bbd.dwDefPos = 10;
bbd.hIcon = g_plugin.getIconHandle(IDI_FILTER);
bbd.pwszText = LPGENW("&Filter");
bbd.pwszTooltip = LPGENW("Enable/disable the event filter (Ctrl+F)");
- Srmm_AddButton(&bbd, &g_plugin);
+ g_plugin.addButton(&bbd);
return 0;
}
diff --git a/src/mir_app/src/CMPluginBase.cpp b/src/mir_app/src/CMPluginBase.cpp
index 8c50bfdd2e..fcf162b4d4 100644
--- a/src/mir_app/src/CMPluginBase.cpp
+++ b/src/mir_app/src/CMPluginBase.cpp
@@ -23,6 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "stdafx.h"
+#include "chat.h"
#include "plugins.h"
#include "IcoLib.h"
@@ -288,6 +289,12 @@ HGENMENU CMPluginBase::addRootMenu(int hMenuObject, LPCWSTR ptszName, int positi
return Menu_CreateRoot(hMenuObject, ptszName, position, hIcoLib, this);
}
+HANDLE CMPluginBase::addButton(const struct BBButton *pButton)
+{
+ return Srmm_AddButton(pButton, this);
+}
+
+
HANDLE CMPluginBase::addTTB(const struct TTBButton *pButton)
{
return (HANDLE)CallService(MS_TTB_ADDBUTTON, (WPARAM)pButton, (LPARAM)this);
diff --git a/src/mir_app/src/chat.h b/src/mir_app/src/chat.h
index 3f4fcc8dda..1766669bc5 100644
--- a/src/mir_app/src/chat.h
+++ b/src/mir_app/src/chat.h
@@ -32,7 +32,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define DM_OPTIONSAPPLIED (WM_USER+14)
-void Srmm_CreateToolbarIcons(HWND hwndDlg, int flags);
+void Srmm_CreateToolbarIcons(CSrmmBaseDialog *pDlg, int flags);
void Srmm_ProcessToolbarHotkey(MCONTACT hContact, INT_PTR iButtonFrom, HWND hwndDlg);
void CheckChatCompatibility();
@@ -136,4 +136,6 @@ CMStringW Chat_GetFolderName(SESSION_INFO *si = nullptr);
void Chat_Serialize(SESSION_INFO *si);
bool Chat_Unserialize(SESSION_INFO *si);
+EXTERN_C MIR_APP_DLL(HANDLE) Srmm_AddButton(const BBButton *bbdi, HPLUGIN _hLang);
+
#pragma comment(lib,"comctl32.lib")
diff --git a/src/mir_app/src/file.cpp b/src/mir_app/src/file.cpp
index 7cde57d9f4..491a130183 100644
--- a/src/mir_app/src/file.cpp
+++ b/src/mir_app/src/file.cpp
@@ -173,7 +173,7 @@ static int SRFileModulesLoaded(WPARAM, LPARAM)
bbd.hIcon = g_plugin.getIconHandle(IDI_ATTACH);
bbd.pszModuleName = SRFILEMODULE;
bbd.pwszTooltip = LPGENW("Send file");
- Srmm_AddButton(&bbd, &g_plugin);
+ g_plugin.addButton(&bbd);
HookEvent(ME_MSG_BUTTONPRESSED, OnToolbarButtonPressed);
HookEvent(ME_CLIST_PREBUILDCONTACTMENU, SRFilePreBuildMenu);
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def
index bd9234ca7e..33ebc19958 100644
--- a/src/mir_app/src/mir_app.def
+++ b/src/mir_app/src/mir_app.def
@@ -911,3 +911,4 @@ Clist_GroupSaveExpanded @1003 NONAME
?addFont@CMPluginBase@@QAEHPBD0PB_W111HHPAUtagLOGFONTW@@K@Z @1029 NONAME
?IsReadonly@Contact@@YG_NI@Z @1030 NONAME
?Readonly@Contact@@YGXI_N@Z @1031 NONAME
+?addButton@CMPluginBase@@QAEPAXPBUBBButton@@@Z @1032 NONAME
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def
index 478cde2493..fc9a419bce 100644
--- a/src/mir_app/src/mir_app64.def
+++ b/src/mir_app/src/mir_app64.def
@@ -911,3 +911,4 @@ Clist_GroupSaveExpanded @1003 NONAME
?addFont@CMPluginBase@@QEAAHPEBD0PEB_W111HHPEAUtagLOGFONTW@@K@Z @1029 NONAME
?IsReadonly@Contact@@YA_NI@Z @1030 NONAME
?Readonly@Contact@@YAXI_N@Z @1031 NONAME
+?addButton@CMPluginBase@@QEAAPEAXPEBUBBButton@@@Z @1032 NONAME
diff --git a/src/mir_app/src/srmm_base.cpp b/src/mir_app/src/srmm_base.cpp
index 9851972d7f..5e152d3870 100644
--- a/src/mir_app/src/srmm_base.cpp
+++ b/src/mir_app/src/srmm_base.cpp
@@ -550,7 +550,7 @@ bool CSrmmBaseDialog::OnInitDialog()
}
// three buttons below are initiated inside this call, so button creation must precede subclassing
- Srmm_CreateToolbarIcons(m_hwnd, isChat() ? BBBF_ISCHATBUTTON : BBBF_ISIMBUTTON);
+ Srmm_CreateToolbarIcons(this, isChat() ? BBBF_ISCHATBUTTON : BBBF_ISIMBUTTON);
mir_subclassWindow(m_btnFilter.GetHwnd(), stubButtonSubclassProc);
mir_subclassWindow(m_btnColor.GetHwnd(), stubButtonSubclassProc);
@@ -613,7 +613,7 @@ INT_PTR CSrmmBaseDialog::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
break;
case WM_CBD_RECREATE:
- Srmm_CreateToolbarIcons(m_hwnd, isChat() ? BBBF_ISCHATBUTTON : BBBF_ISIMBUTTON);
+ Srmm_CreateToolbarIcons(this, isChat() ? BBBF_ISCHATBUTTON : BBBF_ISIMBUTTON);
break;
case WM_NOTIFY:
diff --git a/src/mir_app/src/srmm_toolbar.cpp b/src/mir_app/src/srmm_toolbar.cpp
index 29fa5bdffb..ac428385c0 100644
--- a/src/mir_app/src/srmm_toolbar.cpp
+++ b/src/mir_app/src/srmm_toolbar.cpp
@@ -68,7 +68,7 @@ static void CB_RegisterSeparators()
bbd.bbbFlags = BBBF_ISSEPARATOR | BBBF_ISIMBUTTON;
bbd.dwButtonID = i + 1;
bbd.dwDefPos = 410 + i;
- Srmm_AddButton(&bbd, &g_plugin);
+ g_plugin.addButton(&bbd);
}
}
@@ -172,6 +172,7 @@ MIR_APP_DLL(int) Srmm_ModifyButton(BBButton *bbdi)
cbd->m_bChatButton = (bbdi->bbbFlags & BBBF_ISCHATBUTTON) != 0;
cbd->m_bIMButton = (bbdi->bbbFlags & BBBF_ISIMBUTTON) != 0;
cbd->m_bDisabled = (bbdi->bbbFlags & BBBF_DISABLED) != 0;
+ cbd->m_bNoReadonly = (bbdi->bbbFlags & BBBF_NOREADONLY) != 0;
}
}
}
@@ -261,12 +262,11 @@ MIR_APP_DLL(void) Srmm_ResetToolbar()
}
}
-void Srmm_CreateToolbarIcons(HWND hwndDlg, int flags)
+void Srmm_CreateToolbarIcons(CSrmmBaseDialog *pDlg, int flags)
{
+ MWindow hwndDlg = pDlg->GetHwnd();
HINSTANCE hInstance = (HINSTANCE)GetWindowLongPtr(hwndDlg, GWLP_HINSTANCE);
- CDlgBase *pDlg = CDlgBase::Find(hwndDlg);
-
for (auto &cbd : arButtonsList) {
if (cbd->m_bSeparator)
continue;
@@ -300,7 +300,7 @@ void Srmm_CreateToolbarIcons(HWND hwndDlg, int flags)
if (cbd->m_bDisabled)
EnableWindow(hwndButton, FALSE);
- if (cbd->m_bHidden)
+ if (cbd->m_bHidden || (pDlg->m_bReadOnly && cbd->m_bNoReadonly))
ShowWindow(hwndButton, SW_HIDE);
}
else if (hwndButton)
@@ -603,7 +603,7 @@ public:
bbd.bbbFlags = BBBF_ISSEPARATOR | BBBF_ISIMBUTTON;
bbd.dwButtonID = ++dwSepCount;
- CustomButtonData *cbd = (CustomButtonData*)Srmm_AddButton(&bbd, &g_plugin);
+ CustomButtonData *cbd = (CustomButtonData*)g_plugin.addButton(&bbd);
TVINSERTSTRUCT tvis;
tvis.hParent = nullptr;
@@ -741,6 +741,7 @@ MIR_APP_DLL(HANDLE) Srmm_AddButton(const BBButton *bbdi, HPLUGIN _hLang)
cbd->m_dwArrowCID = (bbdi->bbbFlags & BBBF_ISARROWBUTTON) ? cbd->m_dwButtonCID + 1 : 0;
cbd->m_bHidden = (bbdi->bbbFlags & BBBF_HIDDEN) != 0;
cbd->m_bSeparator = (bbdi->bbbFlags & BBBF_ISSEPARATOR) != 0;
+ cbd->m_bNoReadonly = (bbdi->bbbFlags & BBBF_NOREADONLY) != 0;
cbd->m_bDisabled = (bbdi->bbbFlags & BBBF_DISABLED) != 0;
cbd->m_bPushButton = (bbdi->bbbFlags & BBBF_ISPUSHBUTTON) != 0;