summaryrefslogtreecommitdiff
path: root/plugins/TabSRMM/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2017-03-24 12:41:14 +0300
committerGeorge Hazan <ghazan@miranda.im>2017-03-24 12:41:14 +0300
commit35ec83f41f78aff503d1bfa16714aadee360d2f7 (patch)
tree88cf6888fd2c5cedd4d04cfc7691e7e177bde7fe /plugins/TabSRMM/src
parentfc86783e3a70b466e101c20f3d9fe6382bff6d09 (diff)
m_message & m_log moved inside mir_app
Diffstat (limited to 'plugins/TabSRMM/src')
-rw-r--r--plugins/TabSRMM/src/chat_tools.cpp2
-rw-r--r--plugins/TabSRMM/src/chat_window.cpp49
-rw-r--r--plugins/TabSRMM/src/contactcache.cpp10
-rw-r--r--plugins/TabSRMM/src/container.cpp2
-rw-r--r--plugins/TabSRMM/src/controls.cpp2
-rw-r--r--plugins/TabSRMM/src/functions.h2
-rw-r--r--plugins/TabSRMM/src/generic_msghandlers.cpp30
-rw-r--r--plugins/TabSRMM/src/hotkeyhandler.cpp14
-rw-r--r--plugins/TabSRMM/src/infopanel.cpp2
-rw-r--r--plugins/TabSRMM/src/modplus.cpp8
-rw-r--r--plugins/TabSRMM/src/msgdialog.cpp240
-rw-r--r--plugins/TabSRMM/src/msgdlgutils.cpp30
-rw-r--r--plugins/TabSRMM/src/msgdlgutils.h1
-rw-r--r--plugins/TabSRMM/src/msglog.cpp2
-rw-r--r--plugins/TabSRMM/src/msgs.cpp9
-rw-r--r--plugins/TabSRMM/src/msgs.h4
-rw-r--r--plugins/TabSRMM/src/resource.h2
-rw-r--r--plugins/TabSRMM/src/sendqueue.cpp18
-rw-r--r--plugins/TabSRMM/src/tabctrl.cpp2
-rw-r--r--plugins/TabSRMM/src/taskbar.cpp4
-rw-r--r--plugins/TabSRMM/src/userprefs.cpp2
21 files changed, 201 insertions, 234 deletions
diff --git a/plugins/TabSRMM/src/chat_tools.cpp b/plugins/TabSRMM/src/chat_tools.cpp
index a2e87e9781..99f121c538 100644
--- a/plugins/TabSRMM/src/chat_tools.cpp
+++ b/plugins/TabSRMM/src/chat_tools.cpp
@@ -516,7 +516,7 @@ UINT CreateGCMenu(HWND hwndDlg, HMENU *hMenu, int iIndex, POINT pt, SESSION_INFO
gcmi.pszUID = pszUID;
if (iIndex == 1) {
- int i = GetRichTextLength(GetDlgItem(hwndDlg, IDC_LOG));
+ int i = GetRichTextLength(GetDlgItem(hwndDlg, IDC_SRMM_LOG));
EnableMenuItem(*hMenu, ID_CLEARLOG, MF_ENABLED);
EnableMenuItem(*hMenu, ID_COPYALL, MF_ENABLED);
diff --git a/plugins/TabSRMM/src/chat_window.cpp b/plugins/TabSRMM/src/chat_window.cpp
index f28590f15e..406e32b1e7 100644
--- a/plugins/TabSRMM/src/chat_window.cpp
+++ b/plugins/TabSRMM/src/chat_window.cpp
@@ -108,14 +108,14 @@ static BOOL CheckCustomLink(HWND hwndDlg, POINT *ptClient, UINT uMsg, WPARAM wPa
if (bIsCustomLink) {
ENLINK enlink = { 0 };
enlink.nmhdr.hwndFrom = hwndDlg;
- enlink.nmhdr.idFrom = IDC_LOG;
+ enlink.nmhdr.idFrom = IDC_SRMM_LOG;
enlink.nmhdr.code = EN_LINK;
enlink.msg = uMsg;
enlink.wParam = wParam;
enlink.lParam = lParam;
enlink.chrg.cpMin = cpMin;
enlink.chrg.cpMax = cpMax;
- SendMessage(GetParent(hwndDlg), WM_NOTIFY, IDC_LOG, (LPARAM)&enlink);
+ SendMessage(GetParent(hwndDlg), WM_NOTIFY, IDC_SRMM_LOG, (LPARAM)&enlink);
}
return bIsCustomLink;
}
@@ -212,7 +212,7 @@ void CChatRoomDlg::UpdateWindowState(UINT msg)
else
SendMessage(m_hwnd, DM_SETLOCALE, 0, 0);
}
- SetFocus(GetDlgItem(m_hwnd, IDC_MESSAGE));
+ SetFocus(m_message.GetHwnd());
m_dwLastActivity = GetTickCount();
m_pContainer->dwLastActivity = m_dwLastActivity;
m_pContainer->MenuBar->configureMenu();
@@ -285,7 +285,7 @@ int CChatRoomDlg::Resizer(UTILRESIZECONTROL *urc)
urc->rcItem.top = panelHeight - 2;
return RD_ANCHORX_WIDTH | RD_ANCHORY_TOP;
- case IDC_LOG:
+ case IDC_SRMM_LOG:
urc->rcItem.top = 0;
urc->rcItem.left = 0;
urc->rcItem.right = bNick ? urc->dlgNewSize.cx - iSplitterX : urc->dlgNewSize.cx;
@@ -345,7 +345,7 @@ int CChatRoomDlg::Resizer(UTILRESIZECONTROL *urc)
urc->rcItem.top++;
return RD_ANCHORX_CUSTOM | RD_ANCHORY_CUSTOM;
- case IDC_MESSAGE:
+ case IDC_SRMM_MESSAGE:
urc->rcItem.right = urc->dlgNewSize.cx;
urc->rcItem.top = urc->dlgNewSize.cy - m_iSplitterY + 3 + DPISCALEY_S(23);
urc->rcItem.bottom = urc->dlgNewSize.cy;
@@ -672,10 +672,10 @@ void CChatRoomDlg::onClick_OK(CCtrlButton*)
ptszText.Replace(L"%", L"%%");
if (mi->bAckMsg) {
- Utils::enableDlgControl(m_hwnd, IDC_MESSAGE, false);
+ m_message.Enable(false);
m_message.SendMsg(EM_SETREADONLY, TRUE, 0);
}
- else SetDlgItemText(m_hwnd, IDC_MESSAGE, L"");
+ else m_message.SetText(L"");
Utils::enableDlgControl(m_hwnd, IDOK, false);
@@ -1070,14 +1070,14 @@ LRESULT CChatRoomDlg::WndProc_Log(UINT msg, WPARAM wParam, LPARAM lParam)
case WM_SYSKEYUP:
if (wParam == VK_MENU) {
- ProcessHotkeysByMsgFilter(m_log.GetHwnd(), msg, wParam, lParam, IDC_LOG);
+ ProcessHotkeysByMsgFilter(m_log, msg, wParam, lParam);
return 0;
}
break;
case WM_SYSKEYDOWN:
m_bkeyProcessed = false;
- if (ProcessHotkeysByMsgFilter(m_log.GetHwnd(), msg, wParam, lParam, IDC_LOG)) {
+ if (ProcessHotkeysByMsgFilter(m_log, msg, wParam, lParam)) {
m_bkeyProcessed = true;
return 0;
}
@@ -1203,14 +1203,14 @@ LRESULT CChatRoomDlg::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam)
case WM_SYSKEYUP:
if (wParam == VK_MENU) {
- ProcessHotkeysByMsgFilter(m_message.GetHwnd(), msg, wParam, lParam, IDC_MESSAGE);
+ ProcessHotkeysByMsgFilter(m_message, msg, wParam, lParam);
return 0;
}
break;
case WM_SYSKEYDOWN:
m_bkeyProcessed = false;
- if (ProcessHotkeysByMsgFilter(m_message.GetHwnd(), msg, wParam, lParam, IDC_MESSAGE)) {
+ if (ProcessHotkeysByMsgFilter(m_message, msg, wParam, lParam)) {
m_bkeyProcessed = true;
return 0;
}
@@ -1288,7 +1288,7 @@ LRESULT CChatRoomDlg::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam)
else if (wParam == VK_DOWN)
wp = MAKEWPARAM(SB_LINEDOWN, 0);
- SendDlgItemMessage(m_hwnd, IDC_LOG, WM_VSCROLL, wp, 0);
+ m_log.SendMsg(WM_VSCROLL, wp, 0);
return 0;
}
}
@@ -1342,9 +1342,9 @@ LRESULT CChatRoomDlg::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam)
RedrawWindow(m_message.GetHwnd(), nullptr, nullptr, RDW_INVALIDATE);
if (!fCompleted && !PluginConfig.m_bAllowTab) {
if ((GetSendButtonState(GetHwnd()) != PBS_DISABLED))
- SetFocus(GetDlgItem(GetHwnd(), IDOK));
+ SetFocus(m_btnOk.GetHwnd());
else
- SetFocus(GetDlgItem(GetHwnd(), IDC_LOG));
+ SetFocus(m_log.GetHwnd());
}
return 0;
}
@@ -1361,8 +1361,7 @@ LRESULT CChatRoomDlg::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam)
}
if (wParam == VK_NEXT || wParam == VK_PRIOR) {
- HWND htemp = m_hwnd;
- SendDlgItemMessage(htemp, IDC_LOG, msg, wParam, lParam);
+ m_log.SendMsg(msg, wParam, lParam);
m_iLastEnterTime = 0;
return 0;
}
@@ -2178,7 +2177,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
}
}
- if (msg == WM_KEYDOWN && ((NMHDR*)lParam)->idFrom != IDC_MESSAGE) {
+ if (msg == WM_KEYDOWN && ((NMHDR*)lParam)->idFrom != IDC_SRMM_MESSAGE) {
if ((wp == VK_NEXT && isCtrl && !isShift) || (wp == VK_TAB && isCtrl && !isShift)) // CTRL-TAB (switch tab/window)
SendMessage(m_pContainer->m_hwnd, DM_SELECTTAB, DM_SELECT_NEXT, 0);
else if ((wp == VK_PRIOR && isCtrl && !isShift) || (wp == VK_TAB && isCtrl && isShift)) // CTRL_SHIFT-TAB (switch tab/window)
@@ -2186,13 +2185,13 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
}
if (msg == WM_KEYDOWN && wp == VK_TAB) {
- if (((NMHDR*)lParam)->idFrom == IDC_LOG) {
+ if (((NMHDR*)lParam)->idFrom == IDC_SRMM_LOG) {
SetFocus(m_message.GetHwnd());
return _dlgReturn(m_hwnd, 1);
}
}
- if (((LPNMHDR)lParam)->idFrom == IDC_LOG && ((MSGFILTER *)lParam)->msg == WM_RBUTTONUP) {
+ if (((LPNMHDR)lParam)->idFrom == IDC_SRMM_LOG && ((MSGFILTER *)lParam)->msg == WM_RBUTTONUP) {
CHARRANGE sel, all = { 0, -1 };
pt.x = LOWORD(((ENLINK*)lParam)->lParam), pt.y = HIWORD(((ENLINK*)lParam)->lParam);
@@ -2276,12 +2275,12 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
break;
case EN_REQUESTRESIZE:
- if (((LPNMHDR)lParam)->idFrom == IDC_MESSAGE)
+ if (((LPNMHDR)lParam)->idFrom == IDC_SRMM_MESSAGE)
DM_HandleAutoSizeRequest((REQRESIZE *)lParam);
break;
case EN_LINK:
- if (((LPNMHDR)lParam)->idFrom == IDC_LOG) {
+ if (((LPNMHDR)lParam)->idFrom == IDC_SRMM_LOG) {
switch (((ENLINK*)lParam)->msg) {
case WM_RBUTTONDOWN:
case WM_LBUTTONUP:
@@ -2461,11 +2460,11 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
case WM_ERASEBKGND:
RECT rcClient, rcWindow;
{
- HDC hdc = (HDC)wParam;
+ HDC hdc = (HDC)wParam;
UINT item_ids[3] = { ID_EXTBKUSERLIST, ID_EXTBKHISTORY, ID_EXTBKINPUTAREA };
- UINT ctl_ids[3] = { IDC_SRMM_NICKLIST, IDC_LOG, IDC_MESSAGE };
- HANDLE hbp = 0;
- HDC hdcMem = 0;
+ UINT ctl_ids[3] = { IDC_SRMM_NICKLIST, IDC_SRMM_LOG, IDC_SRMM_MESSAGE };
+ HANDLE hbp = nullptr;
+ HDC hdcMem = nullptr;
HBITMAP hbm, hbmOld;
GetClientRect(m_hwnd, &rcClient);
diff --git a/plugins/TabSRMM/src/contactcache.cpp b/plugins/TabSRMM/src/contactcache.cpp
index e2806b01ee..12c3361463 100644
--- a/plugins/TabSRMM/src/contactcache.cpp
+++ b/plugins/TabSRMM/src/contactcache.cpp
@@ -240,7 +240,7 @@ void CContactCache::saveHistory(WPARAM wParam, LPARAM)
m_iHistoryTop = (int)wParam;
}
- char *szFromStream = ::Message_GetFromStream(GetDlgItem(m_dat->GetHwnd(), IDC_MESSAGE), SF_RTFNOOBJS | SFF_PLAINRTF | SF_NCRFORNONASCII);
+ char *szFromStream = ::Message_GetFromStream(GetDlgItem(m_dat->GetHwnd(), IDC_SRMM_MESSAGE), SF_RTFNOOBJS | SFF_PLAINRTF | SF_NCRFORNONASCII);
if (szFromStream != nullptr) {
size_t iLength = 0, iStreamLength = 0;
iLength = iStreamLength = (mir_strlen(szFromStream) + 1);
@@ -290,7 +290,7 @@ void CContactCache::inputHistoryEvent(WPARAM wParam)
return;
if (m_history != nullptr && m_history[0].szText != nullptr) { // at least one entry needs to be alloced, otherwise we get a nice infinite loop ;)
- HWND hwndEdit = ::GetDlgItem(m_dat->GetHwnd(), IDC_MESSAGE);
+ HWND hwndEdit = ::GetDlgItem(m_dat->GetHwnd(), IDC_SRMM_MESSAGE);
SETTEXTEX stx = { ST_DEFAULT, CP_UTF8 };
if (m_dat->m_dwFlags & MWF_NEEDHISTORYSAVE) {
@@ -547,16 +547,16 @@ size_t CContactCache::getMaxMessageLength()
if (m_nMax) {
if (M.GetByte("autosplit", 0)) {
if (m_dat)
- ::SendDlgItemMessage(m_dat->GetHwnd(), IDC_MESSAGE, EM_EXLIMITTEXT, 0, 20000);
+ ::SendDlgItemMessage(m_dat->GetHwnd(), IDC_SRMM_MESSAGE, EM_EXLIMITTEXT, 0, 20000);
}
else {
if (m_dat)
- ::SendDlgItemMessage(m_dat->GetHwnd(), IDC_MESSAGE, EM_EXLIMITTEXT, 0, (LPARAM)m_nMax);
+ ::SendDlgItemMessage(m_dat->GetHwnd(), IDC_SRMM_MESSAGE, EM_EXLIMITTEXT, 0, (LPARAM)m_nMax);
}
}
else {
if (m_dat)
- ::SendDlgItemMessage(m_dat->GetHwnd(), IDC_MESSAGE, EM_EXLIMITTEXT, 0, 20000);
+ ::SendDlgItemMessage(m_dat->GetHwnd(), IDC_SRMM_MESSAGE, EM_EXLIMITTEXT, 0, 20000);
m_nMax = 20000;
}
}
diff --git a/plugins/TabSRMM/src/container.cpp b/plugins/TabSRMM/src/container.cpp
index 01c2db717b..cf7ed520da 100644
--- a/plugins/TabSRMM/src/container.cpp
+++ b/plugins/TabSRMM/src/container.cpp
@@ -116,7 +116,7 @@ void TSAPI SetAeroMargins(TContainerData *pContainer)
RECT rcWnd;
if (dat->m_pPanel.isActive())
- GetWindowRect(GetDlgItem(dat->GetHwnd(), IDC_LOG), &rcWnd);
+ GetWindowRect(GetDlgItem(dat->GetHwnd(), IDC_SRMM_LOG), &rcWnd);
else
GetWindowRect(dat->GetHwnd(), &rcWnd);
diff --git a/plugins/TabSRMM/src/controls.cpp b/plugins/TabSRMM/src/controls.cpp
index f47c5e1e1a..b53bd9faf3 100644
--- a/plugins/TabSRMM/src/controls.cpp
+++ b/plugins/TabSRMM/src/controls.cpp
@@ -992,7 +992,7 @@ LONG_PTR CALLBACK CTabBaseDlg::StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM
int iQueued = db_get_dw(dat->m_hContact, "SendLater", "count", 0);
gtxl.codepage = CP_UTF8;
gtxl.flags = GTL_DEFAULT | GTL_PRECISE | GTL_NUMBYTES;
- iLength = SendDlgItemMessage(dat->GetHwnd(), IDC_MESSAGE, EM_GETTEXTLENGTHEX, (WPARAM)&gtxl, 0);
+ iLength = SendDlgItemMessage(dat->GetHwnd(), IDC_SRMM_MESSAGE, EM_GETTEXTLENGTHEX, (WPARAM)&gtxl, 0);
tooltip_active = TRUE;
const wchar_t *szFormat = TranslateT("There are %d pending send jobs. Message length: %d bytes, message length limit: %d bytes\n\n%d messages are queued for later delivery");
diff --git a/plugins/TabSRMM/src/functions.h b/plugins/TabSRMM/src/functions.h
index af8ed530a1..e079a3f5d4 100644
--- a/plugins/TabSRMM/src/functions.h
+++ b/plugins/TabSRMM/src/functions.h
@@ -149,7 +149,7 @@ void TN_TypingMessage(MCONTACT hContact, int iMode);
// hotkeys
-LRESULT ProcessHotkeysByMsgFilter(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, UINT_PTR ctrlId);
+LRESULT ProcessHotkeysByMsgFilter(const CCtrlBase&, UINT msg, WPARAM wParam, LPARAM lParam);
void TSAPI DrawMenuItem(DRAWITEMSTRUCT *dis, HICON hIcon, DWORD dwIdle);
diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp
index 091e13848b..0fb0539c43 100644
--- a/plugins/TabSRMM/src/generic_msghandlers.cpp
+++ b/plugins/TabSRMM/src/generic_msghandlers.cpp
@@ -67,7 +67,7 @@ void CTabBaseDlg::DM_SaveLogAsRTF() const
stream.dwCookie = (DWORD_PTR)szFilename;
stream.dwError = 0;
stream.pfnCallback = Utils::StreamOut;
- SendDlgItemMessage(m_hwnd, IDC_LOG, EM_STREAMOUT, SF_RTF | SF_USECODEPAGE, (LPARAM)&stream);
+ m_log.SendMsg(EM_STREAMOUT, SF_RTF | SF_USECODEPAGE, (LPARAM)&stream);
}
}
}
@@ -438,7 +438,7 @@ LRESULT CTabBaseDlg::DM_MsgWindowCmdHandler(UINT cmd, WPARAM wParam, LPARAM lPar
if (m_bEditNotesActive) {
int iLen = GetWindowTextLength(m_message.GetHwnd());
if (iLen != 0) {
- SendMessage(m_hwnd, DM_ACTIVATETOOLTIP, IDC_MESSAGE, (LPARAM)TranslateT("You cannot edit user notes when there are unsent messages"));
+ SendMessage(m_hwnd, DM_ACTIVATETOOLTIP, IDC_SRMM_MESSAGE, (LPARAM)TranslateT("You cannot edit user notes when there are unsent messages"));
m_bEditNotesActive = false;
break;
}
@@ -449,20 +449,14 @@ LRESULT CTabBaseDlg::DM_MsgWindowCmdHandler(UINT cmd, WPARAM wParam, LPARAM lPar
SendMessage(m_hwnd, WM_SIZE, 1, 1);
}
- DBVARIANT dbv = { 0 };
-
- if (0 == db_get_ws(m_hContact, "UserInfo", "MyNotes", &dbv)) {
- SetDlgItemText(m_hwnd, IDC_MESSAGE, dbv.ptszVal);
- mir_free(dbv.ptszVal);
- }
+ ptrW wszText(db_get_wsa(m_hContact, "UserInfo", "MyNotes"));
+ if (wszText != nullptr)
+ m_message.SetText(wszText);
}
else {
- int iLen = GetWindowTextLength(m_message.GetHwnd());
-
- wchar_t *buf = (wchar_t*)mir_alloc((iLen + 2) * sizeof(wchar_t));
- GetDlgItemText(m_hwnd, IDC_MESSAGE, buf, iLen + 1);
+ ptrW buf(m_message.GetText());
db_set_ws(m_hContact, "UserInfo", "MyNotes", buf);
- SetDlgItemText(m_hwnd, IDC_MESSAGE, L"");
+ m_message.SetText(L"");
if (!m_bIsAutosizingInput) {
m_iSplitterY = m_iSplitterSaved;
@@ -613,7 +607,7 @@ void CTabBaseDlg::DM_InitRichEdit()
if (!fIsChat) {
ClearLog();
m_log.SendMsg(EM_SETPARAFORMAT, 0, (LPARAM)&pf2);
- m_log.SendMsg(EM_SETLANGOPTIONS, 0, (LPARAM)SendDlgItemMessage(m_hwnd, IDC_LOG, EM_GETLANGOPTIONS, 0, 0) & ~IMF_AUTOKEYBOARD);
+ m_log.SendMsg(EM_SETLANGOPTIONS, 0, (LPARAM)m_log.SendMsg(EM_GETLANGOPTIONS, 0, 0) & ~IMF_AUTOKEYBOARD);
// set the scrollbars etc to RTL/LTR (only for manual RTL mode)
if (m_dwFlags & MWF_LOG_RTL) {
SetWindowLongPtr(m_message.GetHwnd(), GWL_EXSTYLE, GetWindowLongPtr(m_message.GetHwnd(), GWL_EXSTYLE) | WS_EX_RIGHT | WS_EX_RTLREADING | WS_EX_LEFTSCROLLBAR);
@@ -874,7 +868,7 @@ LRESULT CTabBaseDlg::DM_MouseWheelHandler(WPARAM wParam, LPARAM lParam)
rc.bottom = rc1.bottom;
if (PtInRect(&rc, pt)) {
short amount = (short)(HIWORD(wParam));
- SendMessage(m_pContainer->m_hwnd, WM_COMMAND, MAKELONG(amount > 0 ? IDC_SIDEBARUP : IDC_SIDEBARDOWN, 0), IDC_MESSAGE);
+ SendMessage(m_pContainer->m_hwnd, WM_COMMAND, MAKELONG(amount > 0 ? IDC_SIDEBARUP : IDC_SIDEBARDOWN, 0), IDC_SRMM_MESSAGE);
return 0;
}
}
@@ -1027,7 +1021,7 @@ void CSrmmWindow::DM_OptionsApplied(WPARAM, LPARAM lParam)
m_message.SendMsg(EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELONG(3, 3));
GetSendFormat();
- SetDialogToType(m_hwnd);
+ SetDialogToType();
SendMessage(m_hwnd, DM_CONFIGURETOOLBAR, 0, 0);
DM_InitRichEdit();
@@ -1491,7 +1485,7 @@ void CTabBaseDlg::DM_ErrorDetected(int type, int flag)
m_iCurrentQueueError = -1;
sendQueue->showErrorControls(this, FALSE);
if (type != MSGERROR_CANCEL || (type == MSGERROR_CANCEL && flag == 0))
- SetDlgItemText(m_hwnd, IDC_MESSAGE, L"");
+ m_message.SetText(L"");
sendQueue->checkQueue(this);
int iNextFailed = sendQueue->findNextFailed(this);
if (iNextFailed >= 0)
@@ -1520,7 +1514,7 @@ void CTabBaseDlg::DM_ErrorDetected(int type, int flag)
job->iStatus = SendQueue::SQ_INPROGRESS;
m_iCurrentQueueError = -1;
sendQueue->showErrorControls(this, FALSE);
- SetDlgItemText(m_hwnd, IDC_MESSAGE, L"");
+ m_message.SetText(L"");
sendQueue->checkQueue(this);
int iNextFailed = sendQueue->findNextFailed(this);
diff --git a/plugins/TabSRMM/src/hotkeyhandler.cpp b/plugins/TabSRMM/src/hotkeyhandler.cpp
index 3243d93132..c1052eecd0 100644
--- a/plugins/TabSRMM/src/hotkeyhandler.cpp
+++ b/plugins/TabSRMM/src/hotkeyhandler.cpp
@@ -69,16 +69,16 @@ static HOTKEYDESC _hotkeydescs[] = {
{ 0, "tabsrmm_close_other", LPGEN("Close other tabs"), TABSRMM_HK_SECTION_GENERIC, 0, HOTKEYCODE(HOTKEYF_ALT | HOTKEYF_CONTROL, 'W'), TABSRMM_HK_CLOSE_OTHER },
};
-LRESULT ProcessHotkeysByMsgFilter(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, UINT_PTR ctrlId)
+LRESULT ProcessHotkeysByMsgFilter(const CCtrlBase &pCtrl, UINT msg, WPARAM wParam, LPARAM lParam)
{
MSGFILTER mf;
mf.nmhdr.code = EN_MSGFILTER;
- mf.nmhdr.hwndFrom = hwnd;
- mf.nmhdr.idFrom = ctrlId;
+ mf.nmhdr.hwndFrom = pCtrl.GetHwnd();
+ mf.nmhdr.idFrom = pCtrl.GetCtrlId();
mf.lParam = lParam;
mf.wParam = wParam;
mf.msg = msg;
- return SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM)&mf);
+ return SendMessage(pCtrl.GetParent()->GetHwnd(), WM_NOTIFY, 0, (LPARAM)&mf);
}
static INT_PTR HotkeyProcessor(WPARAM, LPARAM lParam)
@@ -117,7 +117,7 @@ void TSAPI HandleMenuEntryFromhContact(MCONTACT hContact)
ActivateExistingTab(pContainer, si->pDlg->GetHwnd());
if (GetForegroundWindow() != pContainer->m_hwnd)
SetForegroundWindow(pContainer->m_hwnd);
- SetFocus(GetDlgItem(pContainer->m_hwndActive, IDC_MESSAGE));
+ SetFocus(GetDlgItem(pContainer->m_hwndActive, IDC_SRMM_MESSAGE));
return;
}
}
@@ -268,11 +268,11 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP
if (IsIconic(pLastActiveContainer->m_hwnd) || !IsWindowVisible(pLastActiveContainer->m_hwnd)) {
SendMessage(pLastActiveContainer->m_hwnd, WM_SYSCOMMAND, SC_RESTORE, 0);
SetForegroundWindow(pLastActiveContainer->m_hwnd);
- SetFocus(GetDlgItem(pLastActiveContainer->m_hwndActive, IDC_MESSAGE));
+ SetFocus(GetDlgItem(pLastActiveContainer->m_hwndActive, IDC_SRMM_MESSAGE));
}
else if (GetForegroundWindow() != pLastActiveContainer->m_hwnd) {
SetForegroundWindow(pLastActiveContainer->m_hwnd);
- SetFocus(GetDlgItem(pLastActiveContainer->m_hwndActive, IDC_MESSAGE));
+ SetFocus(GetDlgItem(pLastActiveContainer->m_hwndActive, IDC_SRMM_MESSAGE));
}
else {
if (PluginConfig.m_bHideOnClose)
diff --git a/plugins/TabSRMM/src/infopanel.cpp b/plugins/TabSRMM/src/infopanel.cpp
index e75a5d13a1..83eeb5ebfd 100644
--- a/plugins/TabSRMM/src/infopanel.cpp
+++ b/plugins/TabSRMM/src/infopanel.cpp
@@ -1261,7 +1261,7 @@ int CInfoPanel::invokeConfigDialog(const POINT &pt)
::GetClientRect(m_hwndConfig, &rc);
RECT rcLog;
- ::GetWindowRect(GetDlgItem(m_dat->GetHwnd(), m_isChat ? IDC_LOG : IDC_LOG), &rcLog);
+ ::GetWindowRect(GetDlgItem(m_dat->GetHwnd(), IDC_SRMM_LOG), &rcLog);
m_fDialogCreated = true;
::SetWindowPos(m_hwndConfig, HWND_TOP, rcLog.left + 10, rcLog.top - (m_active ? 10 : 0), 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW);
diff --git a/plugins/TabSRMM/src/modplus.cpp b/plugins/TabSRMM/src/modplus.cpp
index c34353961c..05d1edd95f 100644
--- a/plugins/TabSRMM/src/modplus.cpp
+++ b/plugins/TabSRMM/src/modplus.cpp
@@ -73,12 +73,12 @@ static int CustomButtonPressed(WPARAM wParam, LPARAM lParam)
ptrW pszText;
CHARRANGE cr;
cr.cpMin = cr.cpMax = 0;
- SendDlgItemMessage(cbcd->hwndFrom, IDC_MESSAGE, EM_EXGETSEL, 0, (LPARAM)&cr);
+ SendDlgItemMessage(cbcd->hwndFrom, IDC_SRMM_MESSAGE, EM_EXGETSEL, 0, (LPARAM)&cr);
UINT textlenght = cr.cpMax - cr.cpMin;
if (textlenght) {
pszText = (wchar_t*)mir_alloc((textlenght + 1)*sizeof(wchar_t));
memset(pszText, 0, ((textlenght + 1) * sizeof(wchar_t)));
- SendDlgItemMessage(cbcd->hwndFrom, IDC_MESSAGE, EM_GETSELTEXT, 0, (LPARAM)pszText);
+ SendDlgItemMessage(cbcd->hwndFrom, IDC_SRMM_MESSAGE, EM_GETSELTEXT, 0, (LPARAM)pszText);
}
size_t bufSize;
@@ -107,7 +107,7 @@ static int CustomButtonPressed(WPARAM wParam, LPARAM lParam)
}
}
else if (textlenght) {
- SendDlgItemMessage(cbcd->hwndFrom, IDC_MESSAGE, EM_GETSELTEXT, 0, (LPARAM)pszText);
+ SendDlgItemMessage(cbcd->hwndFrom, IDC_SRMM_MESSAGE, EM_GETSELTEXT, 0, (LPARAM)pszText);
pwszFormatedText.Format(L"[img]%s[/img]", pszText);
@@ -130,7 +130,7 @@ static int CustomButtonPressed(WPARAM wParam, LPARAM lParam)
}
if (!pwszFormatedText.IsEmpty())
- SendDlgItemMessage(cbcd->hwndFrom, IDC_MESSAGE, EM_REPLACESEL, TRUE, (LPARAM)pwszFormatedText.c_str());
+ SendDlgItemMessage(cbcd->hwndFrom, IDC_SRMM_MESSAGE, EM_REPLACESEL, TRUE, (LPARAM)pwszFormatedText.c_str());
return 1;
}
diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp
index ba1b37c796..8c026f4d54 100644
--- a/plugins/TabSRMM/src/msgdialog.cpp
+++ b/plugins/TabSRMM/src/msgdialog.cpp
@@ -32,7 +32,7 @@
bool IsStringValidLink(wchar_t *pszText);
-static const UINT sendControls[] = { IDC_MESSAGE, IDC_LOG };
+static const UINT sendControls[] = { IDC_SRMM_MESSAGE, IDC_SRMM_LOG };
static const UINT formatControls[] = { IDC_SRMM_BOLD, IDC_SRMM_ITALICS, IDC_SRMM_UNDERLINE, IDC_FONTSTRIKEOUT };
static const UINT addControls[] = { IDC_ADD, IDC_CANCELADD };
static const UINT btnControls[] = { IDC_RETRY, IDC_CANCELSEND, IDC_MSGSENDLATER, IDC_ADD, IDC_CANCELADD };
@@ -40,24 +40,24 @@ static const UINT errorControls[] = { IDC_STATICERRORICON, IDC_STATICTEXT, IDC_R
static COLORREF rtfDefColors[] = { RGB(255, 0, 0), RGB(0, 0, 255), RGB(0, 255, 0), RGB(255, 0, 255), RGB(255, 255, 0), RGB(0, 255, 255), 0, RGB(255, 255, 255) };
-static struct
+struct
{
int id;
const wchar_t* text;
}
-tooltips[] =
+static tooltips[] =
{
{ IDC_ADD, LPGENW("Add this contact permanently to your contact list") },
{ IDC_CANCELADD, LPGENW("Do not add this contact permanently") },
{ IDC_TOGGLESIDEBAR, LPGENW("Expand or collapse the side bar") }
};
-static struct
+struct
{
int id;
HICON *pIcon;
}
-buttonicons[] =
+static buttonicons[] =
{
{ IDC_ADD, &PluginConfig.g_buttonBarIcons[ICON_BUTTON_ADD] },
{ IDC_CANCELADD, &PluginConfig.g_buttonBarIcons[ICON_BUTTON_CANCEL] }
@@ -72,106 +72,97 @@ static void _clrMsgFilter(MSGFILTER *m)
/////////////////////////////////////////////////////////////////////////////////////////
// show a modified context menu for the richedit control(s)
-// @param dat message window data
-// @param idFrom dlg ctrl id
-// @param hwndFrom src window handle
-// @param pt mouse pointer position
-static void ShowPopupMenu(CTabBaseDlg *dat, int idFrom, HWND hwndFrom, POINT pt)
+void CTabBaseDlg::ShowPopupMenu(const CCtrlBase &pCtrl, POINT pt)
{
CHARRANGE sel, all = { 0, -1 };
- HWND hwndDlg = dat->GetHwnd();
HMENU hSubMenu, hMenu = LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_CONTEXT));
- if (idFrom == IDC_LOG)
+ if (pCtrl.GetCtrlId() == IDC_SRMM_LOG)
hSubMenu = GetSubMenu(hMenu, 0);
else {
hSubMenu = GetSubMenu(hMenu, 2);
- EnableMenuItem(hSubMenu, IDM_PASTEFORMATTED, MF_BYCOMMAND | (dat->m_SendFormat != 0 ? MF_ENABLED : MF_GRAYED));
+ EnableMenuItem(hSubMenu, IDM_PASTEFORMATTED, MF_BYCOMMAND | (m_SendFormat != 0 ? MF_ENABLED : MF_GRAYED));
EnableMenuItem(hSubMenu, ID_EDITOR_PASTEANDSENDIMMEDIATELY, MF_BYCOMMAND | (PluginConfig.m_PasteAndSend ? MF_ENABLED : MF_GRAYED));
CheckMenuItem(hSubMenu, ID_EDITOR_SHOWMESSAGELENGTHINDICATOR, MF_BYCOMMAND | (PluginConfig.m_visualMessageSizeIndicator ? MF_CHECKED : MF_UNCHECKED));
- EnableMenuItem(hSubMenu, ID_EDITOR_SHOWMESSAGELENGTHINDICATOR, MF_BYCOMMAND | (dat->m_pContainer->hwndStatus ? MF_ENABLED : MF_GRAYED));
+ EnableMenuItem(hSubMenu, ID_EDITOR_SHOWMESSAGELENGTHINDICATOR, MF_BYCOMMAND | (m_pContainer->hwndStatus ? MF_ENABLED : MF_GRAYED));
}
TranslateMenu(hSubMenu);
- SendMessage(hwndFrom, EM_EXGETSEL, 0, (LPARAM)&sel);
+ pCtrl.SendMsg(EM_EXGETSEL, 0, (LPARAM)&sel);
if (sel.cpMin == sel.cpMax) {
EnableMenuItem(hSubMenu, IDM_COPY, MF_BYCOMMAND | MF_GRAYED);
EnableMenuItem(hSubMenu, IDM_QUOTE, MF_BYCOMMAND | MF_GRAYED);
- if (idFrom == IDC_MESSAGE)
+ if (pCtrl.GetCtrlId() == IDC_SRMM_MESSAGE)
EnableMenuItem(hSubMenu, IDM_CUT, MF_BYCOMMAND | MF_GRAYED);
}
- if (idFrom == IDC_LOG) {
+ if (pCtrl.GetCtrlId() == IDC_SRMM_LOG) {
InsertMenuA(hSubMenu, 6, MF_BYPOSITION | MF_SEPARATOR, 0, 0);
- CheckMenuItem(hSubMenu, ID_LOG_FREEZELOG, MF_BYCOMMAND | (dat->m_dwFlagsEx & MWF_SHOW_SCROLLINGDISABLED ? MF_CHECKED : MF_UNCHECKED));
+ CheckMenuItem(hSubMenu, ID_LOG_FREEZELOG, MF_BYCOMMAND | (m_dwFlagsEx & MWF_SHOW_SCROLLINGDISABLED ? MF_CHECKED : MF_UNCHECKED));
}
MessageWindowPopupData mwpd;
- if (idFrom == IDC_LOG || idFrom == IDC_MESSAGE) {
- // First notification
- mwpd.cbSize = sizeof(mwpd);
- mwpd.uType = MSG_WINDOWPOPUP_SHOWING;
- mwpd.uFlags = (idFrom == IDC_LOG ? MSG_WINDOWPOPUP_LOG : MSG_WINDOWPOPUP_INPUT);
- mwpd.hContact = dat->m_hContact;
- mwpd.hwnd = hwndFrom;
- mwpd.hMenu = hSubMenu;
- mwpd.selection = 0;
- mwpd.pt = pt;
- NotifyEventHooks(PluginConfig.m_event_MsgPopup, 0, (LPARAM)&mwpd);
- }
-
- int iSelection = TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, nullptr);
-
- if (idFrom == IDC_LOG || idFrom == IDC_MESSAGE) {
- // Second notification
- mwpd.selection = iSelection;
- mwpd.uType = MSG_WINDOWPOPUP_SELECTED;
- NotifyEventHooks(PluginConfig.m_event_MsgPopup, 0, (LPARAM)&mwpd);
- }
+ // First notification
+ mwpd.cbSize = sizeof(mwpd);
+ mwpd.uType = MSG_WINDOWPOPUP_SHOWING;
+ mwpd.uFlags = (pCtrl.GetCtrlId() == IDC_SRMM_LOG ? MSG_WINDOWPOPUP_LOG : MSG_WINDOWPOPUP_INPUT);
+ mwpd.hContact = m_hContact;
+ mwpd.hwnd = pCtrl.GetHwnd();
+ mwpd.hMenu = hSubMenu;
+ mwpd.selection = 0;
+ mwpd.pt = pt;
+ NotifyEventHooks(PluginConfig.m_event_MsgPopup, 0, (LPARAM)&mwpd);
+
+ int iSelection = TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, m_hwnd, nullptr);
+
+ // Second notification
+ mwpd.selection = iSelection;
+ mwpd.uType = MSG_WINDOWPOPUP_SELECTED;
+ NotifyEventHooks(PluginConfig.m_event_MsgPopup, 0, (LPARAM)&mwpd);
switch (iSelection) {
case IDM_COPY:
- SendMessage(hwndFrom, WM_COPY, 0, 0);
+ pCtrl.SendMsg(WM_COPY, 0, 0);
break;
case IDM_CUT:
- SendMessage(hwndFrom, WM_CUT, 0, 0);
+ pCtrl.SendMsg(WM_CUT, 0, 0);
break;
case IDM_PASTE:
case IDM_PASTEFORMATTED:
- if (idFrom == IDC_MESSAGE)
- SendMessage(hwndFrom, EM_PASTESPECIAL, (iSelection == IDM_PASTE) ? CF_UNICODETEXT : 0, 0);
+ if (pCtrl.GetCtrlId() == IDC_SRMM_MESSAGE)
+ pCtrl.SendMsg(EM_PASTESPECIAL, (iSelection == IDM_PASTE) ? CF_UNICODETEXT : 0, 0);
break;
case IDM_COPYALL:
- SendMessage(hwndFrom, EM_EXSETSEL, 0, (LPARAM)&all);
- SendMessage(hwndFrom, WM_COPY, 0, 0);
- SendMessage(hwndFrom, EM_EXSETSEL, 0, (LPARAM)&sel);
+ pCtrl.SendMsg(EM_EXSETSEL, 0, (LPARAM)&all);
+ pCtrl.SendMsg(WM_COPY, 0, 0);
+ pCtrl.SendMsg(EM_EXSETSEL, 0, (LPARAM)&sel);
break;
case IDM_QUOTE:
- SendMessage(hwndDlg, WM_COMMAND, IDC_QUOTE, 0);
+ SendMessage(m_hwnd, WM_COMMAND, IDC_QUOTE, 0);
break;
case IDM_SELECTALL:
- SendMessage(hwndFrom, EM_EXSETSEL, 0, (LPARAM)&all);
+ pCtrl.SendMsg(EM_EXSETSEL, 0, (LPARAM)&all);
break;
case IDM_CLEAR:
- dat->tabClearLog();
+ tabClearLog();
break;
case ID_LOG_FREEZELOG:
- SendDlgItemMessage(hwndDlg, IDC_LOG, WM_KEYDOWN, VK_F12, 0);
+ SendDlgItemMessage(m_hwnd, IDC_SRMM_LOG, WM_KEYDOWN, VK_F12, 0);
break;
case ID_EDITOR_SHOWMESSAGELENGTHINDICATOR:
PluginConfig.m_visualMessageSizeIndicator = !PluginConfig.m_visualMessageSizeIndicator;
db_set_b(0, SRMSGMOD_T, "msgsizebar", (BYTE)PluginConfig.m_visualMessageSizeIndicator);
M.BroadcastMessage(DM_CONFIGURETOOLBAR, 0, 0);
- SendMessage(hwndDlg, WM_SIZE, 0, 0);
- if (dat->m_pContainer->hwndStatus)
- RedrawWindow(dat->m_pContainer->hwndStatus, 0, 0, RDW_INVALIDATE | RDW_UPDATENOW);
+ SendMessage(m_hwnd, WM_SIZE, 0, 0);
+ if (m_pContainer->hwndStatus)
+ RedrawWindow(m_pContainer->hwndStatus, 0, 0, RDW_INVALIDATE | RDW_UPDATENOW);
break;
case ID_EDITOR_PASTEANDSENDIMMEDIATELY:
- dat->HandlePasteAndSend();
+ HandlePasteAndSend();
break;
}
- if (idFrom == IDC_LOG)
+ if (pCtrl.GetCtrlId() == IDC_SRMM_LOG)
RemoveMenu(hSubMenu, 7, MF_BYPOSITION);
DestroyMenu(hMenu);
}
@@ -231,7 +222,7 @@ LRESULT CALLBACK HPPKFSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
wParam != VK_MENU && wParam != VK_END && wParam != VK_HOME &&
wParam != VK_UP && wParam != VK_DOWN && wParam != VK_LEFT &&
wParam != VK_RIGHT && wParam != VK_TAB && wParam != VK_SPACE) {
- SetFocus(GetDlgItem(mwdat->GetHwnd(), IDC_MESSAGE));
+ SetFocus(GetDlgItem(mwdat->GetHwnd(), IDC_SRMM_MESSAGE));
keybd_event((BYTE)wParam, (BYTE)MapVirtualKey(wParam, 0), KEYEVENTF_EXTENDEDKEY | 0, 0);
return 0;
}
@@ -376,56 +367,55 @@ void TSAPI ShowMultipleControls(HWND hwndDlg, const UINT *controls, int cControl
Utils::showDlgControl(hwndDlg, controls[i], state);
}
-void TSAPI SetDialogToType(HWND hwndDlg)
+void CTabBaseDlg::SetDialogToType()
{
- CSrmmWindow *dat = (CSrmmWindow*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- if (dat->m_hContact) {
- if (db_get_b(dat->m_hContact, "CList", "NotOnList", 0)) {
- dat->m_bNotOnList = true;
- ShowMultipleControls(hwndDlg, addControls, _countof(addControls), SW_SHOW);
- Utils::showDlgControl(hwndDlg, IDC_LOGFROZENTEXT, SW_SHOW);
- SetDlgItemText(hwndDlg, IDC_LOGFROZENTEXT, TranslateT("Contact not on list. You may add it..."));
+ if (m_hContact) {
+ if (db_get_b(m_hContact, "CList", "NotOnList", 0)) {
+ m_bNotOnList = true;
+ ShowMultipleControls(m_hwnd, addControls, _countof(addControls), SW_SHOW);
+ Utils::showDlgControl(m_hwnd, IDC_LOGFROZENTEXT, SW_SHOW);
+ SetDlgItemText(m_hwnd, IDC_LOGFROZENTEXT, TranslateT("Contact not on list. You may add it..."));
}
else {
- ShowMultipleControls(hwndDlg, addControls, _countof(addControls), SW_HIDE);
- dat->m_bNotOnList = false;
- Utils::showDlgControl(hwndDlg, IDC_LOGFROZENTEXT, SW_HIDE);
+ ShowMultipleControls(m_hwnd, addControls, _countof(addControls), SW_HIDE);
+ m_bNotOnList = false;
+ Utils::showDlgControl(m_hwnd, IDC_LOGFROZENTEXT, SW_HIDE);
}
}
- Utils::enableDlgControl(hwndDlg, IDC_TIME, true);
+ Utils::enableDlgControl(m_hwnd, IDC_TIME, true);
- if (dat->m_hwndIEView || dat->m_hwndHPP) {
- Utils::showDlgControl(hwndDlg, IDC_LOG, SW_HIDE);
- Utils::enableDlgControl(hwndDlg, IDC_LOG, false);
- Utils::showDlgControl(hwndDlg, IDC_MESSAGE, SW_SHOW);
+ if (m_hwndIEView || m_hwndHPP) {
+ Utils::showDlgControl(m_hwnd, IDC_SRMM_LOG, SW_HIDE);
+ m_log.Enable(false);
+ Utils::showDlgControl(m_hwnd, IDC_SRMM_MESSAGE, SW_SHOW);
}
- else ShowMultipleControls(hwndDlg, sendControls, _countof(sendControls), SW_SHOW);
+ else ShowMultipleControls(m_hwnd, sendControls, _countof(sendControls), SW_SHOW);
- ShowMultipleControls(hwndDlg, errorControls, _countof(errorControls), dat->m_dwFlags & MWF_ERRORSTATE ? SW_SHOW : SW_HIDE);
+ ShowMultipleControls(m_hwnd, errorControls, _countof(errorControls), m_dwFlags & MWF_ERRORSTATE ? SW_SHOW : SW_HIDE);
- if (!dat->m_SendFormat)
- ShowMultipleControls(hwndDlg, formatControls, _countof(formatControls), SW_HIDE);
+ if (!m_SendFormat)
+ ShowMultipleControls(m_hwnd, formatControls, _countof(formatControls), SW_HIDE);
- if (dat->m_pContainer->m_hwndActive == hwndDlg)
- dat->UpdateReadChars();
+ if (m_pContainer->m_hwndActive == m_hwnd)
+ UpdateReadChars();
- SetDlgItemText(hwndDlg, IDC_STATICTEXT, TranslateT("A message failed to send successfully."));
+ SetDlgItemText(m_hwnd, IDC_STATICTEXT, TranslateT("A message failed to send successfully."));
- dat->DM_RecalcPictureSize();
- dat->GetAvatarVisibility();
+ DM_RecalcPictureSize();
+ GetAvatarVisibility();
- Utils::showDlgControl(hwndDlg, IDC_CONTACTPIC, dat->m_bShowAvatar ? SW_SHOW : SW_HIDE);
- Utils::showDlgControl(hwndDlg, IDC_SPLITTERY, dat->m_bIsAutosizingInput ? SW_HIDE : SW_SHOW);
- Utils::showDlgControl(hwndDlg, IDC_MULTISPLITTER, (dat->m_sendMode & SMODE_MULTIPLE) ? SW_SHOW : SW_HIDE);
+ Utils::showDlgControl(m_hwnd, IDC_CONTACTPIC, m_bShowAvatar ? SW_SHOW : SW_HIDE);
+ Utils::showDlgControl(m_hwnd, IDC_SPLITTERY, m_bIsAutosizingInput ? SW_HIDE : SW_SHOW);
+ Utils::showDlgControl(m_hwnd, IDC_MULTISPLITTER, (m_sendMode & SMODE_MULTIPLE) ? SW_SHOW : SW_HIDE);
- dat->EnableSendButton(GetWindowTextLength(GetDlgItem(hwndDlg, IDC_MESSAGE)) != 0);
- dat->UpdateTitle();
- SendMessage(hwndDlg, WM_SIZE, 0, 0);
+ EnableSendButton(GetWindowTextLength(m_message.GetHwnd()) != 0);
+ UpdateTitle();
+ SendMessage(m_hwnd, WM_SIZE, 0, 0);
- Utils::enableDlgControl(hwndDlg, IDC_CONTACTPIC, false);
+ Utils::enableDlgControl(m_hwnd, IDC_CONTACTPIC, false);
- dat->m_pPanel.Configure();
+ m_pPanel.Configure();
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -538,7 +528,7 @@ LRESULT CALLBACK SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
case ID_SPLITTERCONTEXT_SETPOSITIONFORTHISSESSION:
if (dat->m_bIsAutosizingInput) {
- GetWindowRect(GetDlgItem(dat->GetHwnd(), IDC_MESSAGE), &rc);
+ GetWindowRect(GetDlgItem(dat->GetHwnd(), IDC_SRMM_MESSAGE), &rc);
dat->m_iInputAreaHeight = 0;
}
break;
@@ -808,7 +798,7 @@ void CSrmmWindow::OnInitDialog()
}
}
if (wszInitialText) {
- SetDlgItemTextW(m_hwnd, IDC_MESSAGE, wszInitialText);
+ m_message.SetText(wszInitialText);
int len = GetWindowTextLength(m_message.GetHwnd());
PostMessage(m_message.GetHwnd(), EM_SETSEL, len, len);
if (len)
@@ -1096,13 +1086,13 @@ void CSrmmWindow::onClick_Ok(CCtrlButton*)
// don't parse text formatting when the message contains curly braces - these are used by the rtf syntax
// and the parser currently cannot handle them properly in the text - XXX needs to be fixed later.
- FINDTEXTEXA fi = { 0 };
+ FINDTEXTEX fi = { 0 };
fi.chrg.cpMin = 0;
fi.chrg.cpMax = -1;
- fi.lpstrText = "{";
- int final_sendformat = SendDlgItemMessageA(m_hwnd, IDC_MESSAGE, EM_FINDTEXTEX, FR_DOWN, (LPARAM)&fi) == -1 ? m_SendFormat : 0;
- fi.lpstrText = "}";
- final_sendformat = SendDlgItemMessageA(m_hwnd, IDC_MESSAGE, EM_FINDTEXTEX, FR_DOWN, (LPARAM)&fi) == -1 ? final_sendformat : 0;
+ fi.lpstrText = L"{";
+ int final_sendformat = m_message.SendMsg(EM_FINDTEXTEX, FR_DOWN, (LPARAM)&fi) == -1 ? m_SendFormat : 0;
+ fi.lpstrText = L"}";
+ final_sendformat = m_message.SendMsg(EM_FINDTEXTEX, FR_DOWN, (LPARAM)&fi) == -1 ? final_sendformat : 0;
if (GetSendButtonState(m_hwnd) == PBS_DISABLED)
return;
@@ -1167,7 +1157,7 @@ void CSrmmWindow::onClick_Ok(CCtrlButton*)
if (contacthwnd != m_hwnd) {
SETTEXTEX stx = { ST_DEFAULT, CP_UTF8 };
// send the buffer to the contacts msg typing area
- SendDlgItemMessage(contacthwnd, IDC_MESSAGE, EM_SETTEXTEX, (WPARAM)&stx, (LPARAM)szFromStream);
+ SendDlgItemMessage(contacthwnd, IDC_SRMM_MESSAGE, EM_SETTEXTEX, (WPARAM)&stx, (LPARAM)szFromStream);
SendMessage(contacthwnd, WM_COMMAND, IDOK, 0);
}
}
@@ -1346,7 +1336,7 @@ int CSrmmWindow::Resizer(UTILRESIZECONTROL *urc)
urc->rcItem.top = panelHeight - 2;
return RD_ANCHORX_WIDTH | RD_ANCHORY_TOP;
- case IDC_LOG:
+ case IDC_SRMM_LOG:
if (m_dwFlags & MWF_ERRORSTATE)
urc->rcItem.bottom -= ERRORPANEL_HEIGHT;
if (m_dwFlagsEx & MWF_SHOW_SCROLLINGDISABLED || m_bNotOnList)
@@ -1406,7 +1396,7 @@ int CSrmmWindow::Resizer(UTILRESIZECONTROL *urc)
urc->rcItem.right -= (m_pic.cx); // + DPISCALEX(2));
return RD_ANCHORX_CUSTOM | RD_ANCHORY_BOTTOM;
- case IDC_MESSAGE:
+ case IDC_SRMM_MESSAGE:
urc->rcItem.right = urc->dlgNewSize.cx;
if (m_bShowAvatar)
urc->rcItem.right -= m_pic.cx + 2;
@@ -1716,15 +1706,15 @@ int CSrmmWindow::OnFilter(MSGFILTER *pFilter)
// tabulation mod
if (msg == WM_KEYDOWN && wp == VK_TAB) {
if (PluginConfig.m_bAllowTab) {
- if (pFilter->nmhdr.idFrom == IDC_MESSAGE)
+ if (pFilter->nmhdr.idFrom == IDC_SRMM_MESSAGE)
m_message.SendMsg(EM_REPLACESEL, FALSE, (LPARAM)"\t");
_clrMsgFilter(pFilter);
- if (pFilter->nmhdr.idFrom != IDC_MESSAGE)
+ if (pFilter->nmhdr.idFrom != IDC_SRMM_MESSAGE)
SetFocus(m_message.GetHwnd());
return _dlgReturn(m_hwnd, 1);
}
- if (pFilter->nmhdr.idFrom == IDC_MESSAGE) {
+ if (pFilter->nmhdr.idFrom == IDC_SRMM_MESSAGE) {
if (GetSendButtonState(m_hwnd) != PBS_DISABLED && !(m_pContainer->dwFlags & CNT_HIDETOOLBAR))
SetFocus(GetDlgItem(m_hwnd, IDOK));
else
@@ -1732,7 +1722,7 @@ int CSrmmWindow::OnFilter(MSGFILTER *pFilter)
return _dlgReturn(m_hwnd, 1);
}
- if (pFilter->nmhdr.idFrom == IDC_LOG) {
+ if (pFilter->nmhdr.idFrom == IDC_SRMM_LOG) {
SetFocus(m_message.GetHwnd());
return _dlgReturn(m_hwnd, 1);
}
@@ -1740,7 +1730,7 @@ int CSrmmWindow::OnFilter(MSGFILTER *pFilter)
return _dlgReturn(m_hwnd, 0);
}
- if (msg == WM_MOUSEWHEEL && (pFilter->nmhdr.idFrom == IDC_LOG || pFilter->nmhdr.idFrom == IDC_MESSAGE)) {
+ if (msg == WM_MOUSEWHEEL && (pFilter->nmhdr.idFrom == IDC_SRMM_LOG || pFilter->nmhdr.idFrom == IDC_SRMM_MESSAGE)) {
GetCursorPos(&pt);
GetWindowRect(m_log.GetHwnd(), &rc);
if (PtInRect(&rc, pt)) {
@@ -1764,7 +1754,7 @@ int CSrmmWindow::OnFilter(MSGFILTER *pFilter)
}
}
- if ((msg == WM_LBUTTONDOWN || msg == WM_KEYUP || msg == WM_LBUTTONUP) && pFilter->nmhdr.idFrom == IDC_MESSAGE) {
+ if ((msg == WM_LBUTTONDOWN || msg == WM_KEYUP || msg == WM_LBUTTONUP) && pFilter->nmhdr.idFrom == IDC_SRMM_MESSAGE) {
int bBold = IsDlgButtonChecked(m_hwnd, IDC_SRMM_BOLD);
int bItalic = IsDlgButtonChecked(m_hwnd, IDC_SRMM_ITALICS);
int bUnder = IsDlgButtonChecked(m_hwnd, IDC_SRMM_UNDERLINE);
@@ -1822,7 +1812,7 @@ int CSrmmWindow::OnFilter(MSGFILTER *pFilter)
// to the clipboard.
// holding ctrl while releasing the button pastes the selection to the input area, using plain text
// holding ctrl-alt does the same, but pastes formatted text
- if (pFilter->nmhdr.idFrom == IDC_LOG && M.GetByte("autocopy", 1)) {
+ if (pFilter->nmhdr.idFrom == IDC_SRMM_LOG && M.GetByte("autocopy", 1)) {
CHARRANGE cr;
m_log.SendMsg(EM_EXGETSEL, 0, (LPARAM)&cr);
if (cr.cpMax == cr.cpMin)
@@ -1889,20 +1879,20 @@ LRESULT CSrmmWindow::WndProc_Log(UINT msg, WPARAM wParam, LPARAM lParam)
KbdState(isShift, isCtrl, isAlt);
if (wParam == 0x03 && isCtrl) // Ctrl+C
return Utils::WMCopyHandler(m_log.GetHwnd(), nullptr, msg, wParam, lParam);
- if (wParam == 0x11 && isCtrl)
- SendMessage(GetHwnd(), WM_COMMAND, IDC_QUOTE, 0);
+ if (wParam == 0x11 && isCtrl) // Ctrl+Q
+ m_btnQuote.OnClick(&m_btnQuote);
break;
case WM_SYSKEYUP:
if (wParam == VK_MENU) {
- ProcessHotkeysByMsgFilter(m_log.GetHwnd(), msg, wParam, lParam, IDC_LOG);
+ ProcessHotkeysByMsgFilter(m_log, msg, wParam, lParam);
return 0;
}
break;
case WM_SYSKEYDOWN:
m_bkeyProcessed = false;
- if (ProcessHotkeysByMsgFilter(m_log.GetHwnd(), msg, wParam, lParam, IDC_LOG)) {
+ if (ProcessHotkeysByMsgFilter(m_log, msg, wParam, lParam)) {
m_bkeyProcessed = true;
return 0;
}
@@ -1944,7 +1934,7 @@ LRESULT CSrmmWindow::WndProc_Log(UINT msg, WPARAM wParam, LPARAM lParam)
pt.y = GET_Y_LPARAM(lParam);
}
- ShowPopupMenu(this, IDC_LOG, m_log.GetHwnd(), pt);
+ ShowPopupMenu(m_log, pt);
return TRUE;
}
@@ -1989,15 +1979,15 @@ LRESULT CSrmmWindow::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam)
switch (wParam) {
case 0x02: // bold
if (m_SendFormat)
- SendMessage(m_hwnd, WM_COMMAND, MAKELONG(IDC_SRMM_BOLD, IDC_MESSAGE), 0);
+ m_btnBold.OnClick(&m_btnBold);
return 0;
case 0x09:
if (m_SendFormat)
- SendMessage(m_hwnd, WM_COMMAND, MAKELONG(IDC_SRMM_ITALICS, IDC_MESSAGE), 0);
+ m_btnItalic.OnClick(&m_btnItalic);
return 0;
case 21:
if (m_SendFormat)
- SendMessage(m_hwnd, WM_COMMAND, MAKELONG(IDC_SRMM_UNDERLINE, IDC_MESSAGE), 0);
+ m_btnUnderline.OnClick(&m_btnUnderline);
return 0;
case 0x0b:
m_message.SetText(L"");
@@ -2022,7 +2012,7 @@ LRESULT CSrmmWindow::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam)
mir_snwprintf(szBuffer, TranslateT("WARNING: The message you are trying to paste exceeds the message size limit for the active protocol. It will be sent in chunks of max %d characters"), m_nMax - 10);
else
mir_snwprintf(szBuffer, TranslateT("The message you are trying to paste exceeds the message size limit for the active protocol. Only the first %d characters will be sent."), m_nMax);
- SendMessage(m_hwnd, DM_ACTIVATETOOLTIP, IDC_MESSAGE, (LPARAM)szBuffer);
+ SendMessage(m_hwnd, DM_ACTIVATETOOLTIP, IDC_SRMM_MESSAGE, (LPARAM)szBuffer);
}
}
else if (hClip = GetClipboardData(CF_BITMAP))
@@ -2117,7 +2107,7 @@ LRESULT CSrmmWindow::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam)
wp = MAKEWPARAM(SB_LINEDOWN, 0);
if (m_hwndIEView == 0 && m_hwndHPP == 0)
- SendDlgItemMessage(m_hwnd, IDC_LOG, WM_VSCROLL, wp, 0);
+ m_log.SendMsg(WM_VSCROLL, wp, 0);
else
SendMessage(m_hwndIWebBrowserControl, WM_VSCROLL, wp, 0);
return 0;
@@ -2126,7 +2116,7 @@ LRESULT CSrmmWindow::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam)
case WM_SYSKEYDOWN:
m_bkeyProcessed = false;
- if (ProcessHotkeysByMsgFilter(m_message.GetHwnd(), msg, wParam, lParam, IDC_MESSAGE)) {
+ if (ProcessHotkeysByMsgFilter(m_message, msg, wParam, lParam)) {
m_bkeyProcessed = true;
return 0;
}
@@ -2134,7 +2124,7 @@ LRESULT CSrmmWindow::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam)
case WM_SYSKEYUP:
if (wParam == VK_MENU) {
- ProcessHotkeysByMsgFilter(m_message.GetHwnd(), msg, wParam, lParam, IDC_MESSAGE);
+ ProcessHotkeysByMsgFilter(m_message, msg, wParam, lParam);
return 0;
}
break;
@@ -2189,7 +2179,7 @@ LRESULT CSrmmWindow::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam)
pt.y = GET_Y_LPARAM(lParam);
}
- ShowPopupMenu(this, IDC_MESSAGE, m_message.GetHwnd(), pt);
+ ShowPopupMenu(m_message, pt);
return TRUE;
}
return 0;
@@ -2230,7 +2220,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
if (CSkin::m_skinEnabled) {
UINT item_ids[2] = { ID_EXTBKHISTORY, ID_EXTBKINPUTAREA };
- UINT ctl_ids[2] = { IDC_LOG, IDC_MESSAGE };
+ UINT ctl_ids[2] = { IDC_SRMM_LOG, IDC_SRMM_MESSAGE };
BOOL isEditNotesReason = m_bEditNotesActive;
BOOL isSendLaterReason = (m_sendMode & SMODE_SENDLATER);
BOOL isMultipleReason = (m_sendMode & SMODE_MULTIPLE || m_sendMode & SMODE_CONTAINER);
@@ -2410,8 +2400,8 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
}
switch (((NMHDR*)lParam)->idFrom) {
- case IDC_LOG:
- case IDC_MESSAGE:
+ case IDC_SRMM_LOG:
+ case IDC_SRMM_MESSAGE:
switch (((NMHDR*)lParam)->code) {
case EN_MSGFILTER:
if (OnFilter((MSGFILTER*)lParam))
@@ -2468,7 +2458,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
if (lParam == 1) {
GetSendFormat();
- SetDialogToType(m_hwnd);
+ SetDialogToType();
}
if (lParam == 1) {
@@ -2951,7 +2941,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
if (m_wStatus == ID_STATUS_OFFLINE) {
pcaps = CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_4, 0);
if (!(pcaps & PF4_OFFLINEFILES)) {
- SendMessage(m_hwnd, DM_ACTIVATETOOLTIP, IDC_MESSAGE, (LPARAM)TranslateT("Contact is offline and this protocol does not support sending files to offline users."));
+ SendMessage(m_hwnd, DM_ACTIVATETOOLTIP, IDC_SRMM_MESSAGE, (LPARAM)TranslateT("Contact is offline and this protocol does not support sending files to offline users."));
break;
}
}
@@ -2977,7 +2967,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
mir_free(szFileName);
}
char *szHTTPText = "DEBUG";
- SendDlgItemMessageA(m_hwnd, IDC_MESSAGE, EM_REPLACESEL, TRUE, (LPARAM)szHTTPText);
+ SendDlgItemMessageA(m_hwnd, IDC_SRMM_MESSAGE, EM_REPLACESEL, TRUE, (LPARAM)szHTTPText);
SetFocus(m_message.GetHwnd());
}
}
diff --git a/plugins/TabSRMM/src/msgdlgutils.cpp b/plugins/TabSRMM/src/msgdlgutils.cpp
index 30edac5603..74a02425a0 100644
--- a/plugins/TabSRMM/src/msgdlgutils.cpp
+++ b/plugins/TabSRMM/src/msgdlgutils.cpp
@@ -724,7 +724,7 @@ void CTabBaseDlg::ShowPicture(bool showNewPic)
if (m_minEditBoxSize.cy + DPISCALEY_S(3) > m_iSplitterY)
SendMessage(m_hwnd, DM_SPLITTERMOVED, (WPARAM)rc.bottom - m_minEditBoxSize.cy, (LPARAM)GetDlgItem(m_hwnd, IDC_SPLITTERY));
if (!showNewPic)
- SetDialogToType(m_hwnd);
+ SetDialogToType();
else
SendMessage(m_hwnd, WM_SIZE, 0, 0);
}
@@ -1028,39 +1028,31 @@ void CTabBaseDlg::SetMessageLog()
{
unsigned int iLogMode = GetIEViewMode(m_hContact);
- if (iLogMode == WANT_IEVIEW_LOG && m_hwndIEView == 0) {
- IEVIEWWINDOW ieWindow;
-
- memset(&ieWindow, 0, sizeof(ieWindow));
+ if (iLogMode == WANT_IEVIEW_LOG && m_hwndIEView == nullptr) {
+ IEVIEWWINDOW ieWindow = {};
ieWindow.cbSize = sizeof(IEVIEWWINDOW);
ieWindow.iType = IEW_CREATE;
- ieWindow.dwFlags = 0;
ieWindow.dwMode = IEWM_TABSRMM;
ieWindow.parent = m_hwnd;
- ieWindow.x = 0;
- ieWindow.y = 0;
ieWindow.cx = 200;
ieWindow.cy = 200;
CallService(MS_IEVIEW_WINDOW, 0, (LPARAM)&ieWindow);
m_hwndIEView = ieWindow.hwnd;
- Utils::showDlgControl(m_hwnd, IDC_LOG, SW_HIDE);
- Utils::enableDlgControl(m_hwnd, IDC_LOG, false);
+ Utils::showDlgControl(m_hwnd, IDC_SRMM_LOG, SW_HIDE);
+ m_log.Enable(false);
}
- else if (iLogMode == WANT_HPP_LOG && m_hwndHPP == 0) {
- IEVIEWWINDOW ieWindow;
+ else if (iLogMode == WANT_HPP_LOG && m_hwndHPP == nullptr) {
+ IEVIEWWINDOW ieWindow = {};
ieWindow.cbSize = sizeof(IEVIEWWINDOW);
ieWindow.iType = IEW_CREATE;
- ieWindow.dwFlags = 0;
ieWindow.dwMode = IEWM_TABSRMM;
ieWindow.parent = m_hwnd;
- ieWindow.x = 0;
- ieWindow.y = 0;
ieWindow.cx = 10;
ieWindow.cy = 10;
CallService(MS_HPP_EG_WINDOW, 0, (LPARAM)&ieWindow);
m_hwndHPP = ieWindow.hwnd;
- Utils::showDlgControl(m_hwnd, IDC_LOG, SW_HIDE);
- Utils::enableDlgControl(m_hwnd, IDC_LOG, false);
+ Utils::showDlgControl(m_hwnd, IDC_SRMM_LOG, SW_HIDE);
+ m_log.Enable(false);
}
}
@@ -1318,7 +1310,7 @@ void CTabBaseDlg::HandlePasteAndSend()
{
// is feature disabled?
if (!PluginConfig.m_PasteAndSend) {
- SendMessage(m_hwnd, DM_ACTIVATETOOLTIP, IDC_MESSAGE, (LPARAM)TranslateT("The 'paste and send' feature is disabled. You can enable it on the 'General' options page in the 'Sending messages' section"));
+ SendMessage(m_hwnd, DM_ACTIVATETOOLTIP, IDC_SRMM_MESSAGE, (LPARAM)TranslateT("The 'paste and send' feature is disabled. You can enable it on the 'General' options page in the 'Sending messages' section"));
return;
}
@@ -1630,7 +1622,7 @@ void CTabBaseDlg::SendNudge() const
if (ProtoServiceExists(m_cache->getActiveProto(), PS_SEND_NUDGE) && ServiceExists(MS_NUDGE_SEND))
CallService(MS_NUDGE_SEND, m_cache->getActiveContact(), 0);
else
- SendMessage(m_hwnd, DM_ACTIVATETOOLTIP, IDC_MESSAGE,
+ SendMessage(m_hwnd, DM_ACTIVATETOOLTIP, IDC_SRMM_MESSAGE,
(LPARAM)TranslateT("Either the nudge plugin is not installed or the contact's protocol does not support sending a nudge event."));
}
diff --git a/plugins/TabSRMM/src/msgdlgutils.h b/plugins/TabSRMM/src/msgdlgutils.h
index 32ca9e0631..452dc2502f 100644
--- a/plugins/TabSRMM/src/msgdlgutils.h
+++ b/plugins/TabSRMM/src/msgdlgutils.h
@@ -33,7 +33,6 @@
void TSAPI ProcessAvatarChange(HWND hwnd, LPARAM lParam);
int TSAPI CheckValidSmileyPack(const char *szProto, MCONTACT hContact);
wchar_t* TSAPI QuoteText(const wchar_t *text);
-void TSAPI SetDialogToType(HWND hwndDlg);
char* TSAPI Message_GetFromStream(HWND hwndRtf, DWORD dwPassedFlags = 0);
UINT TSAPI GetIEViewMode(MCONTACT hContact);
void TSAPI LoadOverrideTheme(TContainerData *pContainer);
diff --git a/plugins/TabSRMM/src/msglog.cpp b/plugins/TabSRMM/src/msglog.cpp
index 8a95c56780..9671241de0 100644
--- a/plugins/TabSRMM/src/msglog.cpp
+++ b/plugins/TabSRMM/src/msglog.cpp
@@ -1088,7 +1088,7 @@ static void ReplaceIcons(HWND hwndDlg, CTabBaseDlg *dat, LONG startAt, int fAppe
TEXTRANGE tr;
tr.lpstrText = trbuffer;
- HWND hwndrtf = GetDlgItem(hwndDlg, IDC_LOG);
+ HWND hwndrtf = GetDlgItem(hwndDlg, IDC_SRMM_LOG);
FINDTEXTEX fi;
fi.chrg.cpMin = startAt;
diff --git a/plugins/TabSRMM/src/msgs.cpp b/plugins/TabSRMM/src/msgs.cpp
index 6c902c6570..6262f82e4d 100644
--- a/plugins/TabSRMM/src/msgs.cpp
+++ b/plugins/TabSRMM/src/msgs.cpp
@@ -120,15 +120,10 @@ static INT_PTR GetWindowData(WPARAM wParam, LPARAM lParam)
CTabBaseDlg::CTabBaseDlg(int iResource, SESSION_INFO *si)
: CSrmmBaseDialog(g_hInst, iResource, si),
- m_log(this, IDC_LOG),
- m_message(this, IDC_MESSAGE),
m_pPanel(this),
m_dwFlags(MWF_INITMODE),
m_iInputAreaHeight(-1)
{
- m_pLog = &m_log;
- m_pEntry = &m_message;
-
m_autoClose = CLOSE_ON_CANCEL;
m_forceResizable = true;
}
@@ -531,7 +526,7 @@ INT_PTR SendMessageCommand_Worker(MCONTACT hContact, LPCSTR pszMsg, bool isWchar
HWND hwnd = M.FindWindow(hContact);
if (hwnd) {
if (pszMsg) {
- HWND hEdit = GetDlgItem(hwnd, IDC_MESSAGE);
+ HWND hEdit = GetDlgItem(hwnd, IDC_SRMM_MESSAGE);
SendMessage(hEdit, EM_SETSEL, -1, GetWindowTextLength(hEdit));
if (isWchar)
SendMessageW(hEdit, EM_REPLACESEL, FALSE, (LPARAM)pszMsg);
@@ -665,7 +660,7 @@ int TSAPI ActivateExistingTab(TContainerData *pContainer, HWND hwndChild)
SetForegroundWindow(pContainer->m_hwnd);
if (!dat->isChat())
- SetFocus(GetDlgItem(hwndChild, IDC_MESSAGE));
+ SetFocus(GetDlgItem(hwndChild, IDC_SRMM_MESSAGE));
return TRUE;
}
diff --git a/plugins/TabSRMM/src/msgs.h b/plugins/TabSRMM/src/msgs.h
index 308429b22c..2e88f7615f 100644
--- a/plugins/TabSRMM/src/msgs.h
+++ b/plugins/TabSRMM/src/msgs.h
@@ -241,8 +241,6 @@ class CTabBaseDlg : public CSrmmBaseDialog
friend class CInfoPanel;
protected:
- CCtrlEdit m_log, m_message;
-
virtual void LoadSettings() override;
void DM_AddDivider();
@@ -258,6 +256,7 @@ protected:
void GetSendFormat();
bool IsAutoSplitEnabled() const;
void ResizeIeView();
+ void ShowPopupMenu(const CCtrlBase&, POINT pt);
public:
DWORD m_dwFlags;
@@ -426,6 +425,7 @@ public:
void SendHBitmapAsFile(HBITMAP hbmp) const;
void SaveSplitter();
void SendNudge() const;
+ void SetDialogToType();
void SetMessageLog();
void ShowPicture(bool showNewPic);
void StreamInEvents(MEVENT hDbEventFirst, int count, int fAppend, DBEVENTINFO *dbei_s);
diff --git a/plugins/TabSRMM/src/resource.h b/plugins/TabSRMM/src/resource.h
index 648645486d..7bb37ca28b 100644
--- a/plugins/TabSRMM/src/resource.h
+++ b/plugins/TabSRMM/src/resource.h
@@ -68,7 +68,6 @@
#define IDC_APPLY 1001
#define IDC_MAXIMIZE 1001
#define IDC_SKINFILE 1002
-#define IDC_MESSAGE 1002
#define IDC_THEMEEXPORT 1002
#define IDC_THEMEEXPORT2 1003
#define IDC_THEMEIMPORT 1003
@@ -76,7 +75,6 @@
#define IDC_EXPORT 1005
#define IDC_IMPORT 1006
#define IDC_PREVIEW 1006
-#define IDC_LOG 1006
#define IDC_CHKNOTIFY_MESSAGE 1007
#define IDC_FASTGRADIENT 1008
#define IDC_SPLITTERY 1008
diff --git a/plugins/TabSRMM/src/sendqueue.cpp b/plugins/TabSRMM/src/sendqueue.cpp
index ee19c29a45..e061cd51b8 100644
--- a/plugins/TabSRMM/src/sendqueue.cpp
+++ b/plugins/TabSRMM/src/sendqueue.cpp
@@ -104,8 +104,8 @@ entry_found:
HWND hwndDlg = dat->GetHwnd();
dat->m_cache->saveHistory(0, 0);
- ::SetDlgItemText(hwndDlg, IDC_MESSAGE, L"");
- ::SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE));
+ ::SetDlgItemText(hwndDlg, IDC_SRMM_MESSAGE, L"");
+ ::SetFocus(GetDlgItem(hwndDlg, IDC_SRMM_MESSAGE));
UpdateSaveAndSendButton(dat);
sendQueued(dat, iFound);
@@ -216,7 +216,7 @@ int SendQueue::sendQueued(CTabBaseDlg *dat, const int iEntry)
if (iSendLength >= iMinLength) {
wchar_t tszError[256];
mir_snwprintf(tszError, TranslateT("The message cannot be sent delayed or to multiple contacts, because it exceeds the maximum allowed message length of %d bytes"), iMinLength);
- ::SendMessage(dat->GetHwnd(), DM_ACTIVATETOOLTIP, IDC_MESSAGE, LPARAM(tszError));
+ ::SendMessage(dat->GetHwnd(), DM_ACTIVATETOOLTIP, IDC_SRMM_MESSAGE, LPARAM(tszError));
sendQueue->clearJob(iEntry);
return 0;
}
@@ -271,7 +271,7 @@ int SendQueue::sendQueued(CTabBaseDlg *dat, const int iEntry)
size_t iSendLength = getSendLength(iEntry);
if ((int)iSendLength >= dat->m_nMax) {
mir_snwprintf(tszError, TranslateT("The message cannot be sent delayed or to multiple contacts, because it exceeds the maximum allowed message length of %d bytes"), dat->m_nMax);
- SendMessage(dat->GetHwnd(), DM_ACTIVATETOOLTIP, IDC_MESSAGE, LPARAM(tszError));
+ SendMessage(dat->GetHwnd(), DM_ACTIVATETOOLTIP, IDC_SRMM_MESSAGE, LPARAM(tszError));
clearJob(iEntry);
return 0;
}
@@ -374,7 +374,7 @@ void SendQueue::EnableSending(const CTabBaseDlg *dat, bool bMode)
{
if (dat) {
HWND hwndDlg = dat->GetHwnd();
- ::SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETREADONLY, !bMode, 0);
+ ::SendDlgItemMessage(hwndDlg, IDC_SRMM_MESSAGE, EM_SETREADONLY, !bMode, 0);
Utils::enableDlgControl(hwndDlg, IDC_CLIST, bMode);
dat->EnableSendButton(bMode);
}
@@ -416,16 +416,16 @@ void SendQueue::recallFailed(const CTabBaseDlg *dat, int iEntry) const
if (dat == nullptr)
return;
- int iLen = GetWindowTextLength(GetDlgItem(dat->GetHwnd(), IDC_MESSAGE));
+ int iLen = GetWindowTextLength(GetDlgItem(dat->GetHwnd(), IDC_SRMM_MESSAGE));
NotifyDeliveryFailure(dat);
if (iLen != 0)
return;
// message area is empty, so we can recall the failed message...
SETTEXTEX stx = { ST_DEFAULT, CP_UTF8 };
- SendDlgItemMessage(dat->GetHwnd(), IDC_MESSAGE, EM_SETTEXTEX, (WPARAM)&stx, (LPARAM)m_jobs[iEntry].szSendBuffer);
+ SendDlgItemMessage(dat->GetHwnd(), IDC_SRMM_MESSAGE, EM_SETTEXTEX, (WPARAM)&stx, (LPARAM)m_jobs[iEntry].szSendBuffer);
UpdateSaveAndSendButton(const_cast<CTabBaseDlg *>(dat));
- SendDlgItemMessage(dat->GetHwnd(), IDC_MESSAGE, EM_SETSEL, (WPARAM)-1, (LPARAM)-1);
+ SendDlgItemMessage(dat->GetHwnd(), IDC_SRMM_MESSAGE, EM_SETSEL, (WPARAM)-1, (LPARAM)-1);
}
void SendQueue::UpdateSaveAndSendButton(CTabBaseDlg *dat)
@@ -437,7 +437,7 @@ void SendQueue::UpdateSaveAndSendButton(CTabBaseDlg *dat)
gtxl.codepage = CP_UTF8;
gtxl.flags = GTL_DEFAULT | GTL_PRECISE | GTL_NUMBYTES;
- int len = SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_GETTEXTLENGTHEX, (WPARAM)&gtxl, 0);
+ int len = SendDlgItemMessage(hwndDlg, IDC_SRMM_MESSAGE, EM_GETTEXTLENGTHEX, (WPARAM)&gtxl, 0);
if (len && GetSendButtonState(hwndDlg) == PBS_DISABLED)
dat->EnableSendButton(TRUE);
else if (len == 0 && GetSendButtonState(hwndDlg) != PBS_DISABLED)
diff --git a/plugins/TabSRMM/src/tabctrl.cpp b/plugins/TabSRMM/src/tabctrl.cpp
index 0d046179ba..41348286a6 100644
--- a/plugins/TabSRMM/src/tabctrl.cpp
+++ b/plugins/TabSRMM/src/tabctrl.cpp
@@ -829,7 +829,7 @@ page_done:
FillRect(hdc, &rcPage, CSkin::m_BrushBack);
rcPage.top = 0;
}
- GetWindowRect(GetDlgItem(tabdat->helperDat->GetHwnd(), IDC_LOG), &rcLog);
+ GetWindowRect(GetDlgItem(tabdat->helperDat->GetHwnd(), IDC_SRMM_LOG), &rcLog);
pt.y = rcLog.top;
pt.x = rcLog.left;
diff --git a/plugins/TabSRMM/src/taskbar.cpp b/plugins/TabSRMM/src/taskbar.cpp
index 40d45d8004..2494a08429 100644
--- a/plugins/TabSRMM/src/taskbar.cpp
+++ b/plugins/TabSRMM/src/taskbar.cpp
@@ -327,7 +327,7 @@ void CProxyWindow::sendPreview()
HDC hdc, dc;
int twips = (int)(15.0f / PluginConfig.m_DPIscaleY);
bool fIsChat = m_dat->isChat();
- HWND hwndRich = ::GetDlgItem(m_dat->GetHwnd(), IDC_LOG);
+ HWND hwndRich = ::GetDlgItem(m_dat->GetHwnd(), IDC_SRMM_LOG);
LONG cx, cy;
POINT ptOrigin = { 0 }, ptBottom;
@@ -357,7 +357,7 @@ void CProxyWindow::sendPreview()
pt = m_dat->m_pContainer->ptLogSaved;
}
- ::GetWindowRect(::GetDlgItem(m_dat->m_pContainer->m_hwndActive, IDC_LOG), &rcTemp);
+ ::GetWindowRect(::GetDlgItem(m_dat->m_pContainer->m_hwndActive, IDC_SRMM_LOG), &rcTemp);
ptBottom.x = rcTemp.left;
ptBottom.y = rcTemp.bottom;
::ScreenToClient(m_dat->m_pContainer->m_hwnd, &ptBottom);
diff --git a/plugins/TabSRMM/src/userprefs.cpp b/plugins/TabSRMM/src/userprefs.cpp
index 2a774b739f..256b74ccfa 100644
--- a/plugins/TabSRMM/src/userprefs.cpp
+++ b/plugins/TabSRMM/src/userprefs.cpp
@@ -479,7 +479,7 @@ INT_PTR CALLBACK DlgProcUserPrefsFrame(HWND hwndDlg, UINT msg, WPARAM wParam, LP
CSrmmWindow *dat = (CSrmmWindow*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
if (dat) {
DWORD dwOldFlags = (dat->m_dwFlags & MWF_LOG_ALL);
- SetDialogToType(hwnd);
+ dat->SetDialogToType();
dat->LoadLocalFlags();
if ((dat->m_dwFlags & MWF_LOG_ALL) != dwOldFlags) {
bool fShouldHide = true;