summaryrefslogtreecommitdiff
path: root/plugins/TabSRMM/src
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/TabSRMM/src')
-rw-r--r--plugins/TabSRMM/src/chat_window.cpp2
-rw-r--r--plugins/TabSRMM/src/msgdialog.cpp74
-rw-r--r--plugins/TabSRMM/src/msgdlgother.cpp2
-rw-r--r--plugins/TabSRMM/src/msgs.cpp3
-rw-r--r--plugins/TabSRMM/src/msgs.h32
-rw-r--r--plugins/TabSRMM/src/templates.cpp2
6 files changed, 68 insertions, 47 deletions
diff --git a/plugins/TabSRMM/src/chat_window.cpp b/plugins/TabSRMM/src/chat_window.cpp
index 1b2c830b33..c5e98ffe32 100644
--- a/plugins/TabSRMM/src/chat_window.cpp
+++ b/plugins/TabSRMM/src/chat_window.cpp
@@ -597,7 +597,7 @@ void ShowRoom(TContainerData *pContainer, SESSION_INFO *si)
TabCtrl_SetCurSel(hwndTab, iTabId);
pContainer->m_iChilds++;
- CMsgDialog *pDlg = new CMsgDialog(IDD_CHANNEL, si);
+ CMsgDialog *pDlg = new CMsgDialog(si);
pDlg->m_iTabID = iTabId;
pDlg->m_pContainer = pContainer;
pDlg->SetParent(hwndTab);
diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp
index 84c7db6689..c43ab064c8 100644
--- a/plugins/TabSRMM/src/msgdialog.cpp
+++ b/plugins/TabSRMM/src/msgdialog.cpp
@@ -325,30 +325,49 @@ LRESULT CALLBACK SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
/////////////////////////////////////////////////////////////////////////////////////////
-CMsgDialog::CMsgDialog(int iDlgId, SESSION_INFO *si) :
- CSuper(g_plugin, iDlgId, si),
+CMsgDialog::CMsgDialog(int iDlgId, MCONTACT hContact) :
+ CSuper(g_plugin, iDlgId),
m_pPanel(this),
- m_dwFlags(MWF_INITMODE),
m_btnOk(this, IDOK),
m_btnAdd(this, IDC_ADD),
m_btnQuote(this, IDC_QUOTE),
m_btnCancelAdd(this, IDC_CANCELADD)
{
- m_autoClose = CLOSE_ON_CANCEL;
- m_forceResizable = true;
-
- m_szProto = GetContactProto(m_hContact);
- m_bFilterEnabled = db_get_b(m_hContact, CHAT_MODULE, "FilterEnabled", m_bFilterEnabled) != 0;
+ m_hContact = hContact;
- m_btnOk.OnClick = Callback(this, &CMsgDialog::onClick_Ok);
m_btnAdd.OnClick = Callback(this, &CMsgDialog::onClick_Add);
m_btnQuote.OnClick = Callback(this, &CMsgDialog::onClick_Quote);
+ m_btnCancelAdd.OnClick = Callback(this, &CMsgDialog::onClick_CancelAdd);
+
+ Init();
+}
+
+CMsgDialog::CMsgDialog(SESSION_INFO *si) :
+ CSuper(g_plugin, IDD_CHANNEL, si),
+ m_pPanel(this),
+ m_btnOk(this, IDOK),
+ m_btnAdd(this, IDC_ADD),
+ m_btnQuote(this, IDC_QUOTE),
+ m_btnCancelAdd(this, IDC_CANCELADD)
+{
+ m_btnQuote.OnClick = Callback(this, &CMsgDialog::onClick_Quote);
m_btnFilter.OnClick = Callback(this, &CMsgDialog::onClick_Filter);
m_btnNickList.OnClick = Callback(this, &CMsgDialog::onClick_ShowNickList);
- m_btnCancelAdd.OnClick = Callback(this, &CMsgDialog::onClick_CancelAdd);
m_nickList.OnDblClick = Callback(this, &CMsgDialog::onDblClick_List);
+ Init();
+}
+
+void CMsgDialog::Init()
+{
+ m_szProto = GetContactProto(m_hContact);
+ m_autoClose = CLOSE_ON_CANCEL;
+ m_forceResizable = true;
+ m_bFilterEnabled = db_get_b(m_hContact, CHAT_MODULE, "FilterEnabled", m_bFilterEnabled) != 0;
+
+ m_btnOk.OnClick = Callback(this, &CMsgDialog::onClick_Ok);
+
m_message.OnChange = Callback(this, &CMsgDialog::onChange_Message);
}
@@ -403,9 +422,9 @@ bool CMsgDialog::OnInitDialog()
if (m_si) {
m_si->pDlg = this;
Chat_SetFilters(m_si);
-
- m_pPanel.getVisibility();
- m_pPanel.Configure();
+
+ m_pPanel.getVisibility();
+ m_pPanel.Configure();
for (auto &it : btnControls)
ShowWindow(GetDlgItem(m_hwnd,it), SW_HIDE);
@@ -2041,21 +2060,22 @@ LRESULT CMsgDialog::WndProc_Log(UINT msg, WPARAM wParam, LPARAM lParam)
return CSkin::DrawRichEditFrame(m_log.GetHwnd(), this, ID_EXTBKHISTORY, msg, wParam, lParam, stubLogProc);
case WM_CONTEXTMENU:
- POINT pt;
+ if (!isChat()) {
+ POINT pt;
+ if (lParam == 0xFFFFFFFF) {
+ CHARRANGE sel;
+ m_log.SendMsg(EM_EXGETSEL, 0, (LPARAM)& sel);
+ m_log.SendMsg(EM_POSFROMCHAR, (WPARAM)& pt, (LPARAM)sel.cpMax);
+ ClientToScreen(m_log.GetHwnd(), &pt);
+ }
+ else {
+ pt.x = GET_X_LPARAM(lParam);
+ pt.y = GET_Y_LPARAM(lParam);
+ }
- if (lParam == 0xFFFFFFFF) {
- CHARRANGE sel;
- m_log.SendMsg(EM_EXGETSEL, 0, (LPARAM)&sel);
- m_log.SendMsg(EM_POSFROMCHAR, (WPARAM)&pt, (LPARAM)sel.cpMax);
- ClientToScreen(m_log.GetHwnd(), &pt);
- }
- else {
- pt.x = GET_X_LPARAM(lParam);
- pt.y = GET_Y_LPARAM(lParam);
+ ShowPopupMenu(m_log, pt);
+ return TRUE;
}
-
- ShowPopupMenu(m_log, pt);
- return TRUE;
}
return CSuper::WndProc_Log(msg, wParam, lParam);
@@ -3221,7 +3241,7 @@ INT_PTR CMsgDialog::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
return TRUE;
}
}
- break;
+ return MsgWindowDrawHandler((DRAWITEMSTRUCT *)lParam);
case WM_NCHITTEST:
SendMessage(m_pContainer->m_hwnd, WM_NCHITTEST, wParam, lParam);
diff --git a/plugins/TabSRMM/src/msgdlgother.cpp b/plugins/TabSRMM/src/msgdlgother.cpp
index 7a24071d4d..bd25248102 100644
--- a/plugins/TabSRMM/src/msgdlgother.cpp
+++ b/plugins/TabSRMM/src/msgdlgother.cpp
@@ -867,8 +867,8 @@ void CMsgDialog::LoadSplitter()
int CMsgDialog::MsgWindowDrawHandler(DRAWITEMSTRUCT *dis)
{
- HBITMAP hbmAvatar = m_ace ? m_ace->hbmPic : PluginConfig.g_hbmUnknown;
if ((dis->hwndItem == GetDlgItem(m_hwnd, IDC_CONTACTPIC) && m_bShowAvatar) || (dis->hwndItem == m_hwnd && m_pPanel.isActive())) {
+ HBITMAP hbmAvatar = m_ace ? m_ace->hbmPic : PluginConfig.g_hbmUnknown;
if (hbmAvatar == nullptr)
return TRUE;
diff --git a/plugins/TabSRMM/src/msgs.cpp b/plugins/TabSRMM/src/msgs.cpp
index 565b0bbfa7..401b4d2563 100644
--- a/plugins/TabSRMM/src/msgs.cpp
+++ b/plugins/TabSRMM/src/msgs.cpp
@@ -429,8 +429,7 @@ HWND TSAPI CreateNewTabForContact(TContainerData *pContainer, MCONTACT hContact,
if (bActivateTab)
TabCtrl_SetCurSel(hwndTab, iTabId);
- CMsgDialog *pWindow = new CMsgDialog(IDD_MSGSPLITNEW);
- pWindow->m_hContact = hContact;
+ CMsgDialog *pWindow = new CMsgDialog(IDD_MSGSPLITNEW, hContact);
pWindow->m_iTabID = iTabId;
pWindow->m_pContainer = pContainer;
pContainer->m_iChilds++;
diff --git a/plugins/TabSRMM/src/msgs.h b/plugins/TabSRMM/src/msgs.h
index 27e7ba9d38..1ff67b180a 100644
--- a/plugins/TabSRMM/src/msgs.h
+++ b/plugins/TabSRMM/src/msgs.h
@@ -244,27 +244,28 @@ class CMsgDialog : public CSrmmBaseDialog
typedef CSrmmBaseDialog CSuper;
friend class CInfoPanel;
- void DM_AddDivider();
+ void DM_AddDivider(void);
void DM_DismissTip(const POINT& pt);
void DM_ErrorDetected(int type, int flag);
bool DM_GenericHotkeysCheck(MSG *message);
int DM_SplitterGlobalEvent(WPARAM wParam, LPARAM lParam);
- void DM_UpdateLastMessage() const;
-
- void DetermineMinHeight();
- void FindFirstEvent();
- int FindRTLLocale();
- void GetSendFormat();
- bool IsAutoSplitEnabled() const;
- void LoadContactAvatar();
- void LoadOwnAvatar();
+ void DM_UpdateLastMessage(void) const;
+
+ void DetermineMinHeight(void);
+ void FindFirstEvent(void);
+ int FindRTLLocale(void);
+ void GetSendFormat(void);
+ void Init(void);
+ bool IsAutoSplitEnabled(void) const;
+ void LoadContactAvatar(void);
+ void LoadOwnAvatar(void);
void MsgWindowUpdateState(UINT msg);
void ReplaceIcons(LONG startAt, int fAppend, BOOL isSent);
- void ReplayQueue();
- void ResizeIeView();
+ void ReplayQueue(void);
+ void ResizeIeView(void);
void SaveAvatarToFile(HBITMAP hbm, int isOwnPic);
void ShowPopupMenu(const CCtrlBase&, POINT pt);
- void VerifyProxy();
+ void VerifyProxy(void);
LRESULT WMCopyHandler(UINT uMsg, WPARAM wParam, LPARAM lParam);
WORD m_wStatus, m_wOldStatus;
@@ -334,7 +335,7 @@ public:
HKL m_hkl; // keyboard layout identifier
DWORD m_isAutoRTL;
DWORD m_idle;
- DWORD m_dwFlags, m_dwFlagsEx;
+ DWORD m_dwFlags = MWF_INITMODE, m_dwFlagsEx;
DWORD m_dwUnread;
HANDLE m_hTheme, m_hThemeIP, m_hThemeToolbar;
HWND m_hwndIEView, m_hwndIWebBrowserControl, m_hwndHPP;
@@ -385,7 +386,8 @@ public:
CCtrlButton m_btnOk, m_btnAdd, m_btnQuote, m_btnCancelAdd;
public:
- CMsgDialog(int dlgId, SESSION_INFO* = nullptr);
+ CMsgDialog(int dlgId, MCONTACT hContact);
+ CMsgDialog(SESSION_INFO *si);
~CMsgDialog();
void onClick_Ok(CCtrlButton *);
diff --git a/plugins/TabSRMM/src/templates.cpp b/plugins/TabSRMM/src/templates.cpp
index 48433b5192..52c5ca98b9 100644
--- a/plugins/TabSRMM/src/templates.cpp
+++ b/plugins/TabSRMM/src/templates.cpp
@@ -114,7 +114,7 @@ void LoadDefaultTemplates()
}
CTemplateEditDlg::CTemplateEditDlg(BOOL _rtl, HWND hwndParent) :
- CSuper(IDD_TEMPLATEEDIT),
+ CSuper(IDD_TEMPLATEEDIT, 0),
rtl(_rtl),
edtText(this, IDC_EDITTEMPLATE),
urlHelp(this, IDC_VARIABLESHELP, "https://wiki.miranda-ng.org/index.php?title=Plugin:TabSRMM/en/Templates"),