From fb8111c474a8e393e885707eb9796195a2e5a1c6 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 4 Oct 2024 18:58:01 +0300 Subject: SRMM: total constructors' unification, also fixes #4715 (no nicklist in tabSRMM) --- plugins/Scriver/src/chat_main.cpp | 2 +- plugins/Scriver/src/msgdialog.cpp | 38 +++++++++++--------------------------- plugins/Scriver/src/msgs.cpp | 2 +- plugins/Scriver/src/msgs.h | 6 ++---- 4 files changed, 15 insertions(+), 33 deletions(-) (limited to 'plugins/Scriver/src') diff --git a/plugins/Scriver/src/chat_main.cpp b/plugins/Scriver/src/chat_main.cpp index cee6777e6b..4f8757da27 100644 --- a/plugins/Scriver/src/chat_main.cpp +++ b/plugins/Scriver/src/chat_main.cpp @@ -117,7 +117,7 @@ static void ShowRoom(SESSION_INFO *si) // Do we need to create a window? CMsgDialog *pDlg; if (si->pDlg == nullptr) { - pDlg = new CMsgDialog(si); + pDlg = new CMsgDialog(si->hContact, false); pDlg->Show(); si->pDlg = pDlg; diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp index 5fbaf8855d..4e991a9477 100644 --- a/plugins/Scriver/src/msgdialog.cpp +++ b/plugins/Scriver/src/msgdialog.cpp @@ -62,7 +62,7 @@ static INT_PTR CALLBACK ConfirmSendAllDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa ///////////////////////////////////////////////////////////////////////////////////////// CMsgDialog::CMsgDialog(MCONTACT hContact, bool bIncoming) : - CSuper(g_plugin, IDD_MSG), + CSuper(g_plugin, IDD_MSG, hContact), m_bIncoming(bIncoming), m_splitterX(this, IDC_SPLITTERX), m_splitterY(this, IDC_SPLITTERY), @@ -72,36 +72,20 @@ CMsgDialog::CMsgDialog(MCONTACT hContact, bool bIncoming) : m_btnDetails(this, IDC_DETAILS), m_btnUserMenu(this, IDC_USERMENU) { - m_hContact = hContact; - - m_btnAdd.OnClick = Callback(this, &CMsgDialog::onClick_Add); m_btnQuote.OnClick = Callback(this, &CMsgDialog::onClick_Quote); - m_btnDetails.OnClick = Callback(this, &CMsgDialog::onClick_Details); - m_btnUserMenu.OnClick = Callback(this, &CMsgDialog::onClick_UserMenu); - - Init(); -} - -CMsgDialog::CMsgDialog(SESSION_INFO *si) : - CSuper(g_plugin, IDD_MSG, si), - m_splitterX(this, IDC_SPLITTERX), - m_splitterY(this, IDC_SPLITTERY), - - m_btnAdd(this, IDC_ADD), - m_btnQuote(this, IDC_QUOTE), - m_btnDetails(this, IDC_DETAILS), - m_btnUserMenu(this, IDC_USERMENU) -{ - m_btnFilter.OnClick = Callback(this, &CMsgDialog::onClick_Filter); - m_btnNickList.OnClick = Callback(this, &CMsgDialog::onClick_ShowList); - m_splitterX.OnChange = Callback(this, &CMsgDialog::onChange_SplitterX); + if (isChat()) { + m_btnFilter.OnClick = Callback(this, &CMsgDialog::onClick_Filter); + m_btnNickList.OnClick = Callback(this, &CMsgDialog::onClick_ShowList); - Init(); -} + m_splitterX.OnChange = Callback(this, &CMsgDialog::onChange_SplitterX); + } + else { + m_btnAdd.OnClick = Callback(this, &CMsgDialog::onClick_Add); + m_btnDetails.OnClick = Callback(this, &CMsgDialog::onClick_Details); + m_btnUserMenu.OnClick = Callback(this, &CMsgDialog::onClick_UserMenu); + } -void CMsgDialog::Init() -{ m_autoClose = CLOSE_ON_CANCEL; m_szProto = Proto_GetBaseAccountName(m_hContact); diff --git a/plugins/Scriver/src/msgs.cpp b/plugins/Scriver/src/msgs.cpp index c404105eb3..d1eab61301 100644 --- a/plugins/Scriver/src/msgs.cpp +++ b/plugins/Scriver/src/msgs.cpp @@ -156,7 +156,7 @@ static INT_PTR SendMessageCommandWorker(MCONTACT hContact, wchar_t *pszMsg) pDlg->PopupWindow(); } else { - pDlg = new CMsgDialog(hContact, false); + pDlg = new CMsgDialog(hContact, true); pDlg->m_wszInitialText = pszMsg; pDlg->Show(); } diff --git a/plugins/Scriver/src/msgs.h b/plugins/Scriver/src/msgs.h index 3a71949364..0cf7a9ad6a 100644 --- a/plugins/Scriver/src/msgs.h +++ b/plugins/Scriver/src/msgs.h @@ -51,7 +51,6 @@ class CMsgDialog : public CSrmmBaseDialog void ClearLog(void); HICON GetTabIcon(void); void GetTitlebarIcon(struct TitleBarData *tbd); - void Init(void); int InputAreaShortcuts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); void MessageDialogResize(int w, int h); void MessageSend(const SendQueue::Item &msg); @@ -68,7 +67,7 @@ class CMsgDialog : public CSrmmBaseDialog static INT_PTR CALLBACK FilterWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); - bool m_bIncoming, m_bWindowCascaded; + bool m_bIncoming = false, m_bWindowCascaded; MEVENT m_hDbUnreadEventFirst; int m_minLogBoxHeight, m_minEditBoxHeight; @@ -105,8 +104,7 @@ class CMsgDialog : public CSrmmBaseDialog CSplitter m_splitterX, m_splitterY; public: - CMsgDialog(MCONTACT hContact, bool bIncoming); - CMsgDialog(SESSION_INFO *); + CMsgDialog(MCONTACT hContact, bool); bool OnInitDialog() override; void OnDestroy() override; -- cgit v1.2.3