summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/stdmsg/src/chat_manager.cpp2
-rw-r--r--src/core/stdmsg/src/chat_window.cpp9
-rw-r--r--src/core/stdmsg/src/msgdialog.cpp17
-rw-r--r--src/core/stdmsg/src/msgs.cpp12
-rw-r--r--src/core/stdmsg/src/msgs.h16
-rw-r--r--src/core/stdmsg/src/stdafx.h6
-rw-r--r--src/core/stdmsg/src/tabs.cpp15
7 files changed, 51 insertions, 26 deletions
diff --git a/src/core/stdmsg/src/chat_manager.cpp b/src/core/stdmsg/src/chat_manager.cpp
index 119914b7c2..3afa17bccc 100644
--- a/src/core/stdmsg/src/chat_manager.cpp
+++ b/src/core/stdmsg/src/chat_manager.cpp
@@ -203,7 +203,7 @@ static void ShowRoom(SESSION_INFO *si)
PostMessage(pContainer->GetHwnd(), WM_SIZE, 0, 0);
}
else {
- CDlgBase *pDlg = pContainer->m_pEmbed = new CChatRoomDlg(pContainer, si);
+ CMsgDialog *pDlg = pContainer->m_pEmbed = new CChatRoomDlg(pContainer, si);
pContainer->Create();
pDlg->SetParent(pContainer->GetHwnd());
pDlg->Create();
diff --git a/src/core/stdmsg/src/chat_window.cpp b/src/core/stdmsg/src/chat_window.cpp
index aa91f6d397..99b46e48d7 100644
--- a/src/core/stdmsg/src/chat_window.cpp
+++ b/src/core/stdmsg/src/chat_window.cpp
@@ -29,16 +29,13 @@ static wchar_t szTrimString[] = L":;,.!?\'\"><()[]- \r\n";
/////////////////////////////////////////////////////////////////////////////////////////
CChatRoomDlg::CChatRoomDlg(CTabbedWindow *pContainer, SESSION_INFO *si) :
- CSuper(g_hInst, IDD_CHANNEL, si),
+ CSuper(IDD_CHANNEL, si),
m_pOwner(pContainer),
m_btnOk(this, IDOK),
m_splitterX(this, IDC_SPLITTERX),
m_splitterY(this, IDC_SPLITTERY)
{
- m_autoClose = 0;
- m_forceResizable = true;
-
m_btnOk.OnClick = Callback(this, &CChatRoomDlg::onClick_Ok);
m_btnFilter.OnClick = Callback(this, &CChatRoomDlg::onClick_Filter);
@@ -649,7 +646,7 @@ LRESULT CChatRoomDlg::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam)
if (wParam == '\n' || wParam == '\r') {
if ((isCtrl != 0) ^ (0 != db_get_b(0, CHAT_MODULE, "SendOnEnter", 1))) {
- PostMessage(m_hwnd, WM_COMMAND, IDOK, 0);
+ m_btnOk.OnClick(&m_btnOk);
return 0;
}
if (db_get_b(0, CHAT_MODULE, "SendOnDblEnter", 0)) {
@@ -658,7 +655,7 @@ LRESULT CChatRoomDlg::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam)
else {
m_message.SendMsg(WM_KEYDOWN, VK_BACK, 0);
m_message.SendMsg(WM_KEYUP, VK_BACK, 0);
- PostMessage(m_hwnd, WM_COMMAND, IDOK, 0);
+ m_btnOk.OnClick(&m_btnOk);
return 0;
}
}
diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp
index e1678665d8..7f418e285d 100644
--- a/src/core/stdmsg/src/msgdialog.cpp
+++ b/src/core/stdmsg/src/msgdialog.cpp
@@ -85,17 +85,14 @@ static void SetEditorText(HWND hwnd, const wchar_t* txt)
/////////////////////////////////////////////////////////////////////////////////////////
CSrmmWindow::CSrmmWindow(CTabbedWindow *pOwner, MCONTACT hContact) :
- CSuper(g_hInst, IDD_MSG),
+ CSuper(IDD_MSG),
m_splitter(this, IDC_SPLITTERY),
m_avatar(this, IDC_AVATAR),
- m_btnOk(this, IDOK),
m_cmdList(20),
m_bNoActivate(g_dat.bDoNotStealFocus),
m_pOwner(pOwner)
{
m_hContact = hContact;
- m_autoClose = 0;
- m_forceResizable = true;
m_btnOk.OnClick = Callback(this, &CSrmmWindow::onClick_Ok);
m_splitter.OnChange = Callback(this, &CSrmmWindow::OnSplitterMoved);
@@ -229,7 +226,7 @@ void CSrmmWindow::OnInitDialog()
if (!db_get_ws(m_hContact, SRMSGMOD, DBSAVEDMSG, &dbv)) {
if (dbv.ptszVal[0]) {
m_message.SetText(dbv.ptszVal);
- m_btnOk.Enable(TRUE);
+ m_btnOk.Enable(true);
UpdateReadChars();
PostMessage(m_message.GetHwnd(), EM_SETSEL, -1, -1);
}
@@ -330,7 +327,7 @@ void CSrmmWindow::onClick_Ok(CCtrlButton *pButton)
if (m_nTypeMode == PROTOTYPE_SELFTYPING_ON)
NotifyTyping(PROTOTYPE_SELFTYPING_OFF);
- m_btnOk.Enable(FALSE);
+ m_btnOk.Enable(false);
SetFocus(m_message.GetHwnd());
m_message.SetText(L"");
@@ -664,7 +661,7 @@ LRESULT CSrmmWindow::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam)
if (wParam == VK_RETURN) {
if (!isShift && isCtrl != g_dat.bSendOnEnter) {
- PostMessage(m_hwnd, WM_COMMAND, IDOK, 0);
+ onClick_Ok(&m_btnOk);
return 0;
}
if (g_dat.bSendOnDblEnter) {
@@ -673,7 +670,7 @@ LRESULT CSrmmWindow::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam)
else {
m_message.SendMsg(WM_KEYDOWN, VK_BACK, 0);
m_message.SendMsg(WM_KEYUP, VK_BACK, 0);
- PostMessage(m_hwnd, WM_COMMAND, IDOK, 0);
+ onClick_Ok(&m_btnOk);
return 0;
}
}
@@ -744,7 +741,7 @@ LRESULT CSrmmWindow::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam)
case WM_SYSCHAR:
m_iLastEnterTime = 0;
if ((wParam == 's' || wParam == 'S') && GetKeyState(VK_MENU) & 0x8000) {
- PostMessage(m_hwnd, WM_COMMAND, IDOK, 0);
+ onClick_Ok(&m_btnOk);
return 0;
}
break;
@@ -828,7 +825,7 @@ LRESULT CSrmmWindow::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam)
case IDM_PASTESEND:
m_message.SendMsg(EM_PASTESPECIAL, CF_TEXT, 0);
- PostMessage(m_hwnd, WM_COMMAND, IDOK, 0);
+ onClick_Ok(&m_btnOk);
break;
case IDM_DELETE:
diff --git a/src/core/stdmsg/src/msgs.cpp b/src/core/stdmsg/src/msgs.cpp
index 0e8d6cf3ea..7d40f861e7 100644
--- a/src/core/stdmsg/src/msgs.cpp
+++ b/src/core/stdmsg/src/msgs.cpp
@@ -28,6 +28,18 @@ const CLSID IID_IRichEditOle = { 0x00020D00, 0x00, 0x00, { 0xC0, 0x00, 0x00, 0x0
const CLSID IID_IRichEditOleCallback = { 0x00020D03, 0x00, 0x00, { 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46 } };
#endif
+/////////////////////////////////////////////////////////////////////////////////////////
+
+CMsgDialog::CMsgDialog(int iDialogId, SESSION_INFO *si)
+ : CSuper(g_hInst, iDialogId, si),
+ m_btnOk(this, IDOK)
+{
+ m_autoClose = 0;
+ m_forceResizable = true;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
int OnCheckPlugins(WPARAM, LPARAM);
HGENMENU hMsgMenuItem;
diff --git a/src/core/stdmsg/src/msgs.h b/src/core/stdmsg/src/msgs.h
index a94cb6a08d..b0bf16cfb7 100644
--- a/src/core/stdmsg/src/msgs.h
+++ b/src/core/stdmsg/src/msgs.h
@@ -47,10 +47,21 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define EVENTTYPE_JABBER_CHATSTATES 2000
#define EVENTTYPE_JABBER_PRESENCE 2001
-class CSrmmWindow : public CSrmmBaseDialog
+class CMsgDialog : public CSrmmBaseDialog
{
- friend class CTabbedWindow;
typedef CSrmmBaseDialog CSuper;
+ friend class CTabbedWindow;
+
+protected:
+ CCtrlButton m_btnOk;
+
+ CMsgDialog(int idDialog, SESSION_INFO *si = nullptr);
+};
+
+class CSrmmWindow : public CMsgDialog
+{
+ friend class CTabbedWindow;
+ typedef CMsgDialog CSuper;
static LRESULT CALLBACK TabSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
@@ -58,7 +69,6 @@ class CSrmmWindow : public CSrmmBaseDialog
virtual LRESULT WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam) override;
CCtrlBase m_avatar;
- CCtrlButton m_btnOk;
CSplitter m_splitter;
void NotifyTyping(int mode);
diff --git a/src/core/stdmsg/src/stdafx.h b/src/core/stdmsg/src/stdafx.h
index 14bde56a30..280bbf0263 100644
--- a/src/core/stdmsg/src/stdafx.h
+++ b/src/core/stdmsg/src/stdafx.h
@@ -151,7 +151,7 @@ class CTabbedWindow : public CDlgBase
public:
CCtrlPages m_tab;
HWND m_hwndStatus;
- CSrmmBaseDialog *m_pEmbed;
+ CMsgDialog *m_pEmbed;
CTabbedWindow();
@@ -185,9 +185,9 @@ void TB_SaveSession(SESSION_INFO *si);
#define GC_DROPPEDTAB (WM_USER+202)
#define GC_RENAMETAB (WM_USER+203)
-class CChatRoomDlg : public CSrmmBaseDialog
+class CChatRoomDlg : public CMsgDialog
{
- typedef CSrmmBaseDialog CSuper;
+ typedef CMsgDialog CSuper;
friend class CTabbedWindow;
static INT_PTR CALLBACK FilterWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
diff --git a/src/core/stdmsg/src/tabs.cpp b/src/core/stdmsg/src/tabs.cpp
index 8b0e38043e..013816a9c7 100644
--- a/src/core/stdmsg/src/tabs.cpp
+++ b/src/core/stdmsg/src/tabs.cpp
@@ -212,7 +212,6 @@ void CTabbedWindow::FixTabIcons(CSrmmBaseDialog *pDlg)
else RedrawWindow(m_tab.GetHwnd(), nullptr, nullptr, RDW_INVALIDATE);
}
-
void CTabbedWindow::SaveWindowPosition(bool bUpdateSession)
{
WINDOWPLACEMENT wp = {};
@@ -550,7 +549,7 @@ INT_PTR CTabbedWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
{
LPDRAWITEMSTRUCT dis = (LPDRAWITEMSTRUCT)lParam;
if (dis->hwndItem == m_hwndStatus) {
- CSrmmBaseDialog *pDlg = (g_Settings.bTabsEnable) ? (CSrmmBaseDialog*)m_tab.GetActivePage() : m_pEmbed;
+ CMsgDialog *pDlg = (g_Settings.bTabsEnable) ? (CMsgDialog*)m_tab.GetActivePage() : m_pEmbed;
if (pDlg != nullptr)
DrawStatusIcons(pDlg->m_hContact, dis->hDC, dis->rcItem, 2);
return TRUE;
@@ -558,6 +557,16 @@ INT_PTR CTabbedWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
}
break;
+ case WM_COMMAND:
+ if (LOWORD(wParam) == IDOK) {
+ CMsgDialog *pDlg = (g_Settings.bTabsEnable) ? (CMsgDialog*)m_tab.GetActivePage() : m_pEmbed;
+ if (pDlg != nullptr) {
+ pDlg->m_btnOk.OnClick(&pDlg->m_btnOk);
+ return TRUE;
+ }
+ }
+ break;
+
case WM_NOTIFY:
if (((LPNMHDR)lParam)->hwndFrom == m_hwndStatus) {
if (((LPNMHDR)lParam)->code == NM_CLICK || ((LPNMHDR)lParam)->code == NM_RCLICK) {
@@ -565,7 +574,7 @@ INT_PTR CTabbedWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
RECT rc;
SendMessage(m_hwndStatus, SB_GETRECT, SendMessage(m_hwndStatus, SB_GETPARTS, 0, 0) - 1, (LPARAM)&rc);
if (nm->pt.x >= rc.left) {
- CSrmmBaseDialog *pDlg = (g_Settings.bTabsEnable) ? (CSrmmBaseDialog*)m_tab.GetActivePage() : m_pEmbed;
+ CMsgDialog *pDlg = (g_Settings.bTabsEnable) ? (CMsgDialog*)m_tab.GetActivePage() : m_pEmbed;
if (pDlg != nullptr)
CheckStatusIconClick(pDlg->m_hContact, m_hwndStatus, nm->pt, rc, 2, ((LPNMHDR)lParam)->code == NM_RCLICK ? MBCF_RIGHTBUTTON : 0);
}