diff options
45 files changed, 354 insertions, 420 deletions
diff --git a/include/chat_resource.h b/include/chat_resource.h index 60e340c9c1..86ac792a41 100644 --- a/include/chat_resource.h +++ b/include/chat_resource.h @@ -32,3 +32,5 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define IDC_SRMM_SHOWNICKLIST 3008 #define IDC_SRMM_HISTORY 3009 #define IDC_SRMM_NICKLIST 3010 +#define IDC_SRMM_LOG 3011 +#define IDC_SRMM_MESSAGE 3012 diff --git a/include/m_chat_int.h b/include/m_chat_int.h index 48759177bc..0538621c60 100644 --- a/include/m_chat_int.h +++ b/include/m_chat_int.h @@ -409,7 +409,7 @@ protected: void RefreshButtonStatus(void);
protected:
- CCtrlEdit *m_pLog, *m_pEntry;
+ CCtrlEdit m_message, m_log;
SESSION_INFO *m_si;
COLORREF m_clrInputBG, m_clrInputFG;
time_t m_iLastEnterTime;
diff --git a/plugins/Scriver/res/resource.rc b/plugins/Scriver/res/resource.rc index 97fc4a8d18..5821ba6db7 100644 --- a/plugins/Scriver/res/resource.rc +++ b/plugins/Scriver/res/resource.rc @@ -131,7 +131,7 @@ BEGIN EDITTEXT IDC_INDENTSIZE,262,79,33,12,ES_RIGHT | ES_NUMBER | WS_DISABLED
CONTROL "Spin1",IDC_INDENTSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK | WS_DISABLED,290,79,10,12
CONTROL "Customize fonts and colors",IDC_FONTSCOLORS,"Hyperlink",0x0,8,91,200,8
- CONTROL "",IDC_LOG,"RichEdit50W",WS_VSCROLL | WS_TABSTOP | 0x844,8,105,288,68,WS_EX_STATICEDGE
+ CONTROL "",IDC_SRMM_LOG,"RichEdit50W",WS_VSCROLL | WS_TABSTOP | 0x844,8,105,288,68,WS_EX_STATICEDGE
GROUPBOX "Preload",IDC_STATIC,0,181,304,50
CONTROL "Unread events only",IDC_LOADUNREAD,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,8,192,138,10
CONTROL "Last",IDC_LOADCOUNT,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,8,204,138,10
@@ -203,8 +203,8 @@ STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN EXSTYLE WS_EX_ACCEPTFILES
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
- CONTROL "",IDC_LOG,"RichEdit50W",WS_CLIPSIBLINGS | WS_VSCROLL | WS_TABSTOP | 0x844,1,41,181,28,WS_EX_STATICEDGE
- CONTROL "",IDC_MESSAGE,"RichEdit50W",WS_VSCROLL | WS_TABSTOP | 0x1144,0,87,181,13,WS_EX_ACCEPTFILES | WS_EX_STATICEDGE
+ CONTROL "",IDC_SRMM_LOG,"RichEdit50W",WS_CLIPSIBLINGS | WS_VSCROLL | WS_TABSTOP | 0x844,1,41,181,28,WS_EX_STATICEDGE
+ CONTROL "",IDC_SRMM_MESSAGE,"RichEdit50W",WS_VSCROLL | WS_TABSTOP | 0x1144,0,87,181,13,WS_EX_ACCEPTFILES | WS_EX_STATICEDGE
CONTROL "",IDC_SPLITTERY,"Static",SS_ENHMETAFILE | WS_CLIPSIBLINGS,0,85,183,2
CONTROL "",IDC_AVATAR,"Static",SS_OWNERDRAW,180,80,0,0
END
@@ -226,8 +226,8 @@ IDD_CHANNEL DIALOGEX 0, 0, 252, 140 STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
- CONTROL "",IDC_MESSAGE,"RichEdit50W",WS_VSCROLL | WS_TABSTOP | 0x1144,0,128,127,12,WS_EX_STATICEDGE
- CONTROL "",IDC_LOG,"RichEdit50W",WS_VSCROLL | WS_TABSTOP | 0x844,8,23,164,73,WS_EX_STATICEDGE
+ CONTROL "",IDC_SRMM_MESSAGE,"RichEdit50W",WS_VSCROLL | WS_TABSTOP | 0x1144,0,128,127,12,WS_EX_STATICEDGE
+ CONTROL "",IDC_SRMM_LOG,"RichEdit50W",WS_VSCROLL | WS_TABSTOP | 0x844,8,23,164,73,WS_EX_STATICEDGE
CONTROL "",IDC_SPLITTERX,"Static",SS_ENHMETAFILE,172,23,10,73
CONTROL "",IDC_SPLITTERY,"Static",SS_ENHMETAFILE,0,102,251,6
LISTBOX IDC_SRMM_NICKLIST,182,23,69,73,LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | NOT WS_BORDER | WS_VSCROLL | WS_TABSTOP,WS_EX_STATICEDGE
diff --git a/plugins/Scriver/src/chat_window.cpp b/plugins/Scriver/src/chat_window.cpp index bb9b543bea..5453087d6f 100644 --- a/plugins/Scriver/src/chat_window.cpp +++ b/plugins/Scriver/src/chat_window.cpp @@ -217,18 +217,10 @@ void CChatRoomDlg::MessageDialogResize(int w, int h) CChatRoomDlg::CChatRoomDlg(SESSION_INFO *si)
: CScriverWindow(IDD_CHANNEL, si),
-
- m_log(this, IDC_LOG),
- m_message(this, IDC_MESSAGE),
-
m_splitterX(this, IDC_SPLITTERX),
m_splitterY(this, IDC_SPLITTERY),
-
m_btnOk(this, IDOK)
{
- m_pLog = &m_log;
- m_pEntry = &m_message;
-
m_btnOk.OnClick = Callback(this, &CChatRoomDlg::onClick_Ok);
m_btnFilter.OnClick = Callback(this, &CChatRoomDlg::onClick_Filter);
m_btnNickList.OnClick = Callback(this, &CChatRoomDlg::onClick_ShowList);
@@ -376,7 +368,7 @@ void CChatRoomDlg::onClick_Ok(CCtrlButton *pButton) EnableWindow(m_message.GetHwnd(), FALSE);
m_message.SendMsg(EM_SETREADONLY, TRUE, 0);
}
- else SetDlgItemText(m_hwnd, IDC_MESSAGE, L"");
+ else m_message.SetText(L"");
EnableWindow(m_btnOk.GetHwnd(), FALSE);
@@ -691,7 +683,7 @@ LRESULT CChatRoomDlg::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam) switch (msg) {
case WM_MOUSEWHEEL:
if ((GetWindowLongPtr(m_message.GetHwnd(), GWL_STYLE) & WS_VSCROLL) == 0)
- SendDlgItemMessage(m_hwnd, IDC_LOG, WM_MOUSEWHEEL, wParam, lParam);
+ m_log.SendMsg(WM_MOUSEWHEEL, wParam, lParam);
m_iLastEnterTime = 0;
return TRUE;
@@ -770,7 +762,7 @@ LRESULT CChatRoomDlg::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam) }
if (wParam == VK_NEXT || wParam == VK_PRIOR) {
- SendDlgItemMessage(m_hwnd, IDC_LOG, msg, wParam, lParam);
+ m_log.SendMsg(msg, wParam, lParam);
return TRUE;
}
break;
@@ -835,7 +827,7 @@ LRESULT CChatRoomDlg::WndProc_Log(UINT msg, WPARAM wParam, LPARAM lParam) sel.cpMin = sel.cpMax;
SendMessage(m_log.GetHwnd(), EM_EXSETSEL, 0, (LPARAM)&sel);
}
- SetFocus(GetDlgItem(m_hwnd, IDC_MESSAGE));
+ SetFocus(m_message.GetHwnd());
break;
case WM_ACTIVATE:
@@ -917,8 +909,8 @@ LRESULT CChatRoomDlg::WndProc_Log(UINT msg, WPARAM wParam, LPARAM lParam) break;
case WM_CHAR:
- SetFocus(GetDlgItem(m_hwnd, IDC_MESSAGE));
- SendDlgItemMessage(m_hwnd, IDC_MESSAGE, WM_CHAR, wParam, lParam);
+ SetFocus(m_message.GetHwnd());
+ m_message.SendMsg(WM_CHAR, wParam, lParam);
break;
}
@@ -1261,7 +1253,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) LPNMHDR pNmhdr = (LPNMHDR)lParam;
switch (pNmhdr->code) {
case EN_MSGFILTER:
- if (pNmhdr->idFrom == IDC_LOG && ((MSGFILTER *)lParam)->msg == WM_RBUTTONUP) {
+ if (pNmhdr->idFrom == IDC_SRMM_LOG && ((MSGFILTER *)lParam)->msg == WM_RBUTTONUP) {
SetWindowLongPtr(m_hwnd, DWLP_MSGRESULT, TRUE);
return TRUE;
}
@@ -1353,5 +1345,5 @@ void ShowRoom(SESSION_INFO *si) SendMessage(GetParent(si->pDlg->GetHwnd()), CM_ACTIVATECHILD, 0, (LPARAM)si->pDlg->GetHwnd());
SendMessage(GetParent(si->pDlg->GetHwnd()), CM_POPUPWINDOW, 0, (LPARAM)si->pDlg->GetHwnd());
SendMessage(si->pDlg->GetHwnd(), WM_MOUSEACTIVATE, 0, 0);
- SetFocus(GetDlgItem(si->pDlg->GetHwnd(), IDC_MESSAGE));
+ SetFocus(GetDlgItem(si->pDlg->GetHwnd(), IDC_SRMM_MESSAGE));
}
diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp index 36a11f9e6c..69f8681857 100644 --- a/plugins/Scriver/src/msgdialog.cpp +++ b/plugins/Scriver/src/msgdialog.cpp @@ -102,8 +102,8 @@ void NotifyLocalWinEvent(MCONTACT hContact, HWND hwnd, unsigned int type) mwe.szModule = SRMM_MODULE;
mwe.uType = type;
mwe.uFlags = MSG_WINDOW_UFLAG_MSG_BOTH;
- mwe.hwndInput = GetDlgItem(hwnd, IDC_MESSAGE);
- mwe.hwndLog = GetDlgItem(hwnd, IDC_LOG);
+ mwe.hwndInput = GetDlgItem(hwnd, IDC_SRMM_MESSAGE);
+ mwe.hwndLog = GetDlgItem(hwnd, IDC_SRMM_LOG);
NotifyEventHooks(hHookWinEvt, 0, (LPARAM)&mwe);
}
@@ -189,8 +189,6 @@ static INT_PTR CALLBACK ConfirmSendAllDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa CSrmmWindow::CSrmmWindow(MCONTACT hContact, bool bIncoming, const char *szInitialText, bool bIsUnicode)
: CScriverWindow(IDD_MSG),
m_bIncoming(bIncoming),
- m_log(this, IDC_LOG),
- m_message(this, IDC_MESSAGE),
m_splitter(this, IDC_SPLITTERY),
m_btnOk(this, IDOK),
@@ -199,8 +197,6 @@ CSrmmWindow::CSrmmWindow(MCONTACT hContact, bool bIncoming, const char *szInitia m_btnDetails(this, IDC_DETAILS),
m_btnUserMenu(this, IDC_USERMENU)
{
- m_pLog = &m_log;
- m_pEntry = &m_message;
m_hContact = hContact;
m_hwndParent = GetParentWindow(hContact, FALSE);
@@ -517,7 +513,7 @@ void CSrmmWindow::onClick_Ok(CCtrlButton *pButton) if (m_nTypeMode == PROTOTYPE_SELFTYPING_ON)
NotifyTyping(PROTOTYPE_SELFTYPING_OFF);
- SetDlgItemText(m_hwnd, IDC_MESSAGE, L"");
+ m_message.SetText(L"");
EnableWindow(GetDlgItem(m_hwnd, IDOK), FALSE);
if (db_get_b(0, SRMM_MODULE, SRMSGSET_AUTOMIN, SRMSGDEFSET_AUTOMIN))
ShowWindow(m_hwndParent, SW_MINIMIZE);
@@ -1085,7 +1081,7 @@ LRESULT CSrmmWindow::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam) case WM_MOUSEWHEEL:
if ((GetWindowLongPtr(m_message.GetHwnd(), GWL_STYLE) & WS_VSCROLL) == 0)
- SendDlgItemMessage(m_hwnd, IDC_LOG, WM_MOUSEWHEEL, wParam, lParam);
+ m_log.SendMsg(WM_MOUSEWHEEL, wParam, lParam);
break;
case WM_LBUTTONDOWN:
@@ -1703,7 +1699,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) case WM_NOTIFY:
pNmhdr = (LPNMHDR)lParam;
switch (pNmhdr->idFrom) {
- case IDC_LOG:
+ case IDC_SRMM_LOG:
switch (pNmhdr->code) {
case EN_MSGFILTER:
{
@@ -1731,7 +1727,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) }
break;
- case IDC_MESSAGE:
+ case IDC_SRMM_MESSAGE:
if (pNmhdr->code == EN_MSGFILTER && ((MSGFILTER *)lParam)->msg == WM_RBUTTONUP) {
SetWindowLongPtr(m_hwnd, DWLP_MSGRESULT, TRUE);
return TRUE;
diff --git a/plugins/Scriver/src/msgoptions.cpp b/plugins/Scriver/src/msgoptions.cpp index 6e1f546b26..66b215694a 100644 --- a/plugins/Scriver/src/msgoptions.cpp +++ b/plugins/Scriver/src/msgoptions.cpp @@ -602,9 +602,9 @@ static void ShowPreview(HWND hwndDlg) pf2.cbSize = sizeof(pf2);
pf2.dwMask = PFM_OFFSET;
pf2.dxOffset = (gdat.flags & SMF_INDENTTEXT) ? gdat.indentSize * 1440 / g_dat.logPixelSX : 0;
- SetDlgItemText(hwndDlg, IDC_LOG, L"");
- SendDlgItemMessage(hwndDlg, IDC_LOG, EM_SETPARAFORMAT, 0, (LPARAM)&pf2);
- StreamInTestEvents(GetDlgItem(hwndDlg, IDC_LOG), &gdat);
+ SetDlgItemText(hwndDlg, IDC_SRMM_LOG, L"");
+ SendDlgItemMessage(hwndDlg, IDC_SRMM_LOG, EM_SETPARAFORMAT, 0, (LPARAM)&pf2);
+ StreamInTestEvents(GetDlgItem(hwndDlg, IDC_SRMM_LOG), &gdat);
}
static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -614,7 +614,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
- RichUtil_SubClass(GetDlgItem(hwndDlg, IDC_LOG));
+ RichUtil_SubClass(GetDlgItem(hwndDlg, IDC_SRMM_LOG));
switch (db_get_b(0, SRMM_MODULE, SRMSGSET_LOADHISTORY, SRMSGDEFSET_LOADHISTORY)) {
case LOADHISTORY_UNREAD:
CheckDlgButton(hwndDlg, IDC_LOADUNREAD, BST_CHECKED);
@@ -677,11 +677,11 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, pf2.dwMask = PFM_OFFSETINDENT | PFM_RIGHTINDENT;
pf2.dxStartIndent = 30;
pf2.dxRightIndent = 30;
- SendDlgItemMessage(hwndDlg, IDC_LOG, EM_SETPARAFORMAT, 0, (LPARAM)&pf2);
- SendDlgItemMessage(hwndDlg, IDC_LOG, EM_SETEDITSTYLE, SES_EXTENDBACKCOLOR, SES_EXTENDBACKCOLOR);
- SendDlgItemMessage(hwndDlg, IDC_LOG, EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELONG(0, 0));
- SendDlgItemMessage(hwndDlg, IDC_LOG, EM_AUTOURLDETECT, TRUE, 0);
- SendDlgItemMessage(hwndDlg, IDC_LOG, EM_SETOLECALLBACK, 0, (LPARAM)&reOleCallback);
+ SendDlgItemMessage(hwndDlg, IDC_SRMM_LOG, EM_SETPARAFORMAT, 0, (LPARAM)&pf2);
+ SendDlgItemMessage(hwndDlg, IDC_SRMM_LOG, EM_SETEDITSTYLE, SES_EXTENDBACKCOLOR, SES_EXTENDBACKCOLOR);
+ SendDlgItemMessage(hwndDlg, IDC_SRMM_LOG, EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELONG(0, 0));
+ SendDlgItemMessage(hwndDlg, IDC_SRMM_LOG, EM_AUTOURLDETECT, TRUE, 0);
+ SendDlgItemMessage(hwndDlg, IDC_SRMM_LOG, EM_SETOLECALLBACK, 0, (LPARAM)&reOleCallback);
}
ShowPreview(hwndDlg);
return TRUE;
@@ -749,7 +749,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, return TRUE;
break;
- case IDC_LOG:
+ case IDC_SRMM_LOG:
return 0;
}
MarkChanges(4, hwndDlg);
diff --git a/plugins/Scriver/src/msgs.cpp b/plugins/Scriver/src/msgs.cpp index c2ef1ab5c5..7572fabf0a 100644 --- a/plugins/Scriver/src/msgs.cpp +++ b/plugins/Scriver/src/msgs.cpp @@ -146,7 +146,7 @@ static INT_PTR SendMessageCommandWorker(MCONTACT hContact, LPCSTR pszMsg, bool i HWND hwnd = WindowList_Find(pci->hWindowList, hContact);
if (hwnd != nullptr) {
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);
diff --git a/plugins/Scriver/src/msgs.h b/plugins/Scriver/src/msgs.h index b2c824a3d5..58c80d4d6a 100644 --- a/plugins/Scriver/src/msgs.h +++ b/plugins/Scriver/src/msgs.h @@ -108,7 +108,6 @@ class CSrmmWindow : public CScriverWindow {
typedef CScriverWindow CSuper;
- CCtrlEdit m_log, m_message;
CCtrlButton m_btnOk, m_btnAdd, m_btnUserMenu, m_btnQuote, m_btnDetails;
CSplitter m_splitter;
@@ -188,7 +187,6 @@ class CChatRoomDlg : public CScriverWindow {
typedef CScriverWindow CSuper;
- CCtrlEdit m_message, m_log;
CCtrlButton m_btnOk;
CSplitter m_splitterX, m_splitterY;
diff --git a/plugins/Scriver/src/resource.h b/plugins/Scriver/src/resource.h index 71f80fb75d..140bbdb351 100644 --- a/plugins/Scriver/src/resource.h +++ b/plugins/Scriver/src/resource.h @@ -74,8 +74,6 @@ #define IDC_HYPERLINKHAND 600
#define IDC_DRAGCURSOR 601
#define IDC_TABS 1000
-#define IDC_LOG 1001
-#define IDC_MESSAGE 1002
#define IDC_AUTOPOPUP 1003
#define IDC_AUTOMIN 1005
#define IDC_STAYMINIMIZED 1006
diff --git a/plugins/Scriver/src/tabs.cpp b/plugins/Scriver/src/tabs.cpp index a436c3c6d9..3b164494c6 100644 --- a/plugins/Scriver/src/tabs.cpp +++ b/plugins/Scriver/src/tabs.cpp @@ -792,7 +792,7 @@ static INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wPara GetChildWindowRect(dat, &rcChild);
dat->childRect = rcChild;
MoveWindow(dat->hwndActive, rcChild.left, rcChild.top, rcChild.right - rcChild.left, rcChild.bottom - rcChild.top, TRUE);
- RedrawWindow(GetDlgItem(dat->hwndActive, IDC_LOG), nullptr, nullptr, RDW_INVALIDATE);
+ RedrawWindow(GetDlgItem(dat->hwndActive, IDC_SRMM_LOG), nullptr, nullptr, RDW_INVALIDATE);
if (dat->flags2 & SMF2_SHOWSTATUSBAR) {
SendMessage(dat->hwndStatus, WM_SIZE, 0, 0);
RedrawWindow(dat->hwndStatus, nullptr, nullptr, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE);
diff --git a/plugins/TabSRMM/res/chat.rc b/plugins/TabSRMM/res/chat.rc index 5f0631b371..08439df081 100644 --- a/plugins/TabSRMM/res/chat.rc +++ b/plugins/TabSRMM/res/chat.rc @@ -32,8 +32,8 @@ FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN
CONTROL "",IDC_SPLITTERX,"Static",SS_ENHMETAFILE,172,23,10,73
CONTROL "",IDC_SPLITTERY,"Static",SS_ENHMETAFILE,0,132,251,6
- CONTROL "",IDC_MESSAGE,"RichEdit50W",WS_VSCROLL | WS_TABSTOP | 0x1144,0,128,127,12,WS_EX_STATICEDGE
- CONTROL "",IDC_LOG,"RichEdit50W",WS_VSCROLL | 0x844,8,23,164,72,WS_EX_STATICEDGE
+ CONTROL "",IDC_SRMM_MESSAGE,"RichEdit50W",WS_VSCROLL | WS_TABSTOP | 0x1144,0,128,127,12,WS_EX_STATICEDGE
+ CONTROL "",IDC_SRMM_LOG,"RichEdit50W",WS_VSCROLL | 0x844,8,23,164,72,WS_EX_STATICEDGE
LISTBOX IDC_SRMM_NICKLIST,182,23,69,73,LBS_MULTIPLESEL | LBS_OWNERDRAWFIXED | LBS_NOINTEGRALHEIGHT | LBS_EXTENDEDSEL | LBS_NODATA | NOT WS_BORDER | WS_VSCROLL | WS_TABSTOP,WS_EX_STATICEDGE
CONTROL "",IDC_PANELSPLITTER,"Static",SS_ENHMETAFILE,0,32,252,1,WS_EX_TRANSPARENT
END
diff --git a/plugins/TabSRMM/res/msgwindow.rc b/plugins/TabSRMM/res/msgwindow.rc index c5ce2018e5..f934f22b30 100644 --- a/plugins/TabSRMM/res/msgwindow.rc +++ b/plugins/TabSRMM/res/msgwindow.rc @@ -12,6 +12,7 @@ #include "richedit.h"
#undef APSTUDIO_HIDDEN_SYMBOLS
#include "..\..\..\include\statusmodes.h"
+#include "..\..\..\include\chat_resource.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
@@ -35,7 +36,7 @@ STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
CONTROL "",IDC_SPLITTERY,"Static",SS_ENHMETAFILE,0,46,187,1
- CONTROL "",IDC_MESSAGE,"RichEdit50W",ES_MULTILINE |
+ CONTROL "",IDC_SRMM_MESSAGE,"RichEdit50W",ES_MULTILINE |
ES_AUTOVSCROLL | ES_NOHIDESEL | ES_WANTRETURN |
WS_VSCROLL | WS_TABSTOP,0,48,144,31,WS_EX_ACCEPTFILES |
WS_EX_STATICEDGE
@@ -46,7 +47,7 @@ BEGIN CONTROL "&Send",IDC_MSGSENDLATER,"MButtonClass",WS_TABSTOP,146,10,60,12,0x18000000L
CONTROL "",IDC_STATICTEXT,"Static",SS_OWNERDRAW | WS_GROUP,27,0,160,9
CONTROL "",IDC_STATICERRORICON,"Static",SS_OWNERDRAW,4,3,20,20
- CONTROL "",IDC_LOG,"RichEdit50W",ES_MULTILINE | ES_AUTOVSCROLL | ES_NOHIDESEL | ES_READONLY | WS_VSCROLL | WS_TABSTOP,0,0,188,30,WS_EX_STATICEDGE
+ CONTROL "",IDC_SRMM_LOG,"RichEdit50W",ES_MULTILINE | ES_AUTOVSCROLL | ES_NOHIDESEL | ES_READONLY | WS_VSCROLL | WS_TABSTOP,0,0,188,30,WS_EX_STATICEDGE
CONTROL "&Add",IDC_ADD,"MButtonClass",WS_TABSTOP,155,64,16,14,0x18000000L
CONTROL "&Remove",IDC_CANCELADD,"MButtonClass",WS_TABSTOP,171,64,16,14,0x18000000L
CONTROL "",IDC_LOGFROZENTEXT,"Static",SS_OWNERDRAW | WS_GROUP,10,3,188,18
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)>xl, 0);
+ iLength = SendDlgItemMessage(dat->GetHwnd(), IDC_SRMM_MESSAGE, EM_GETTEXTLENGTHEX, (WPARAM)>xl, 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)>xl, 0); + int len = SendDlgItemMessage(hwndDlg, IDC_SRMM_MESSAGE, EM_GETTEXTLENGTHEX, (WPARAM)>xl, 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;
diff --git a/src/core/stdmsg/res/resource.rc b/src/core/stdmsg/res/resource.rc index cab5c99329..7893ed2b21 100644 --- a/src/core/stdmsg/res/resource.rc +++ b/src/core/stdmsg/res/resource.rc @@ -85,10 +85,10 @@ EXSTYLE WS_EX_NOPARENTNOTIFY | WS_EX_ACCEPTFILES | WS_EX_CONTROLPARENT CAPTION "Message session"
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
- CONTROL "",IDC_MESSAGE,"RichEdit50W",WS_VSCROLL | WS_TABSTOP | 0x1144,1,49,141,13,WS_EX_ACCEPTFILES | WS_EX_STATICEDGE
+ CONTROL "",IDC_SRMM_MESSAGE,"RichEdit50W",WS_VSCROLL | WS_TABSTOP | 0x1144,1,49,141,13,WS_EX_ACCEPTFILES | WS_EX_STATICEDGE
DEFPUSHBUTTON "&Send",IDOK,143,48,39,15
PUSHBUTTON "Close",IDCANCEL,129,0,54,15,NOT WS_VISIBLE
- CONTROL "",IDC_LOG,"RichEdit50W",WS_VSCROLL | WS_TABSTOP | 0x844,1,18,183,26,WS_EX_STATICEDGE
+ CONTROL "",IDC_SRMM_LOG,"RichEdit50W",WS_VSCROLL | WS_TABSTOP | 0x844,1,18,183,26,WS_EX_STATICEDGE
CONTROL "",IDC_SPLITTERY,"Static",SS_ENHMETAFILE,0,45,183,2
CONTROL "",IDC_AVATAR,"Button",BS_OWNERDRAW | NOT WS_VISIBLE,1,50,1,13
END
@@ -198,9 +198,9 @@ STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
- CONTROL "",IDC_MESSAGE,"RichEdit50W",WS_VSCROLL | WS_TABSTOP | 0x3144,0,128,127,12,WS_EX_STATICEDGE
+ CONTROL "",IDC_SRMM_MESSAGE,"RichEdit50W",WS_VSCROLL | WS_TABSTOP | 0x3144,0,128,127,12,WS_EX_STATICEDGE
PUSHBUTTON "&Send",IDOK,136,126,115,14,WS_DISABLED
- CONTROL "",IDC_LOG,"RichEdit50W",WS_VSCROLL | WS_TABSTOP | 0x2844,8,2,164,94,WS_EX_STATICEDGE
+ CONTROL "",IDC_SRMM_LOG,"RichEdit50W",WS_VSCROLL | WS_TABSTOP | 0x2844,8,2,164,94,WS_EX_STATICEDGE
CONTROL "",IDC_SPLITTERX,"Static",SS_ENHMETAFILE,172,23,10,73
CONTROL "",IDC_SPLITTERY,"Static",SS_ENHMETAFILE,0,102,251,6
LISTBOX IDC_SRMM_NICKLIST,182,2,69,94,LBS_OWNERDRAWFIXED | LBS_NOINTEGRALHEIGHT | LBS_NODATA | NOT WS_BORDER | WS_VSCROLL | WS_TABSTOP,WS_EX_STATICEDGE
@@ -210,9 +210,9 @@ IDD_CHANNEL DIALOGEX 0, 0, 252, 140 STYLE DS_SETFONT | DS_FIXEDSYS | DS_3DLOOK | DS_CENTER | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
- CONTROL "",IDC_MESSAGE,"RichEdit50W",WS_VSCROLL | WS_TABSTOP | 0x3144,0,128,127,12,WS_EX_STATICEDGE
+ CONTROL "",IDC_SRMM_MESSAGE,"RichEdit50W",WS_VSCROLL | WS_TABSTOP | 0x3144,0,128,127,12,WS_EX_STATICEDGE
PUSHBUTTON "&Send",IDOK,136,126,115,14,WS_DISABLED
- CONTROL "",IDC_LOG,"RichEdit50W",WS_VSCROLL | WS_TABSTOP | 0x2844,8,23,164,73,WS_EX_STATICEDGE
+ CONTROL "",IDC_SRMM_LOG,"RichEdit50W",WS_VSCROLL | WS_TABSTOP | 0x2844,8,23,164,73,WS_EX_STATICEDGE
CONTROL "",IDC_SPLITTERX,"Static",SS_ENHMETAFILE,172,23,10,73
CONTROL "",IDC_SPLITTERY,"Static",SS_ENHMETAFILE,0,102,251,6
LISTBOX IDC_SRMM_NICKLIST,182,23,69,73,LBS_OWNERDRAWFIXED | LBS_NOINTEGRALHEIGHT | LBS_NODATA | NOT WS_BORDER | WS_VSCROLL | WS_TABSTOP,WS_EX_STATICEDGE
diff --git a/src/core/stdmsg/src/chat_util.cpp b/src/core/stdmsg/src/chat_util.cpp index cdd53ef2cf..602c2c14c5 100644 --- a/src/core/stdmsg/src/chat_util.cpp +++ b/src/core/stdmsg/src/chat_util.cpp @@ -136,7 +136,7 @@ char* Message_GetFromStream(HWND hwndDlg, SESSION_INFO *si) stream.dwCookie = (DWORD_PTR)&pszText; // pass pointer to pointer DWORD dwFlags = SF_RTFNOOBJS | SFF_PLAINRTF | SF_USECODEPAGE | (CP_UTF8 << 16); - SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_STREAMOUT, dwFlags, (LPARAM)&stream); + SendDlgItemMessage(hwndDlg, IDC_SRMM_MESSAGE, EM_STREAMOUT, dwFlags, (LPARAM)&stream); return pszText; // pszText contains the text } @@ -199,7 +199,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/src/core/stdmsg/src/chat_window.cpp b/src/core/stdmsg/src/chat_window.cpp index 3247b0ef98..bb1065bf7f 100644 --- a/src/core/stdmsg/src/chat_window.cpp +++ b/src/core/stdmsg/src/chat_window.cpp @@ -52,17 +52,11 @@ static void __cdecl phase2(void *lParam) CChatRoomDlg::CChatRoomDlg(SESSION_INFO *si) : CSrmmBaseDialog(g_hInst, g_Settings.bTabsEnable ? IDD_CHANNEL_TAB : IDD_CHANNEL, si), - m_message(this, IDC_MESSAGE), - m_log(this, IDC_LOG), - m_btnOk(this, IDOK), m_splitterX(this, IDC_SPLITTERX), m_splitterY(this, IDC_SPLITTERY) { - m_pLog = &m_log; - m_pEntry = &m_message; - m_autoClose = 0; m_forceResizable = true; @@ -201,7 +195,7 @@ void CChatRoomDlg::onClick_Ok(CCtrlButton *pButton) EnableWindow(m_message.GetHwnd(), FALSE); m_message.SendMsg(EM_SETREADONLY, TRUE, 0); } - else SetDlgItemText(m_hwnd, IDC_MESSAGE, L""); + else m_message.SetText(L""); EnableWindow(m_btnOk.GetHwnd(), FALSE); @@ -508,7 +502,7 @@ int CChatRoomDlg::Resizer(UTILRESIZECONTROL *urc) urc->rcItem.bottom = urc->dlgNewSize.cy - (rc.bottom - rc.top) - 1; return RD_ANCHORX_RIGHT | RD_ANCHORY_CUSTOM; - case IDC_LOG: + case IDC_SRMM_LOG: urc->rcItem.top = 2; urc->rcItem.left = 0; urc->rcItem.right = bNick ? urc->dlgNewSize.cx - m_iSplitterX : urc->dlgNewSize.cx; @@ -537,7 +531,7 @@ int CChatRoomDlg::Resizer(UTILRESIZECONTROL *urc) urc->rcItem.bottom = urc->rcItem.top + 2; return RD_ANCHORX_WIDTH | RD_ANCHORY_CUSTOM; - case IDC_MESSAGE: + case IDC_SRMM_MESSAGE: GetWindowRect(m_hwndStatus, &rc); urc->rcItem.right = bSend ? urc->dlgNewSize.cx - 64 : urc->dlgNewSize.cx; urc->rcItem.top = urc->dlgNewSize.cy - m_iSplitterY + 22; @@ -627,7 +621,7 @@ LRESULT CChatRoomDlg::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam) switch (msg) { case WM_MOUSEWHEEL: - SendDlgItemMessage(m_hwnd, IDC_LOG, WM_MOUSEWHEEL, wParam, lParam); + m_log.SendMsg(WM_MOUSEWHEEL, wParam, lParam); m_iLastEnterTime = 0; return TRUE; @@ -815,8 +809,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 TRUE; } @@ -1284,7 +1277,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) case WM_NOTIFY: switch (((LPNMHDR)lParam)->code) { case EN_MSGFILTER: - if (((LPNMHDR)lParam)->idFrom == IDC_LOG && ((MSGFILTER *)lParam)->msg == WM_RBUTTONUP) { + if (((LPNMHDR)lParam)->idFrom == IDC_SRMM_LOG && ((MSGFILTER *)lParam)->msg == WM_RBUTTONUP) { ENLINK *pLink = (ENLINK*)lParam; POINT pt = { GET_X_LPARAM(pLink->lParam), GET_Y_LPARAM(pLink->lParam) }; ClientToScreen(((LPNMHDR)lParam)->hwndFrom, &pt); @@ -1390,7 +1383,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) case WM_COMMAND: switch (LOWORD(wParam)) { - case IDC_MESSAGE: + case IDC_SRMM_MESSAGE: EnableWindow(m_btnOk.GetHwnd(), GetRichTextLength(m_message.GetHwnd()) != 0); break; } diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp index fa99f057f7..e4631281f8 100644 --- a/src/core/stdmsg/src/msgdialog.cpp +++ b/src/core/stdmsg/src/msgdialog.cpp @@ -33,7 +33,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define ENTERCLICKTIME 1000 //max time in ms during which a double-tap on enter will cause a send
-static const UINT sendControls[] = { IDC_MESSAGE };
+static const UINT sendControls[] = { IDC_SRMM_MESSAGE };
void NotifyLocalWinEvent(MCONTACT hContact, HWND hwnd, unsigned int type)
{
@@ -45,8 +45,8 @@ void NotifyLocalWinEvent(MCONTACT hContact, HWND hwnd, unsigned int type) mwe.szModule = SRMMMOD;
mwe.uType = type;
mwe.uFlags = MSG_WINDOW_UFLAG_MSG_BOTH;
- mwe.hwndInput = GetDlgItem(hwnd, IDC_MESSAGE);
- mwe.hwndLog = GetDlgItem(hwnd, IDC_LOG);
+ mwe.hwndInput = GetDlgItem(hwnd, IDC_SRMM_MESSAGE);
+ mwe.hwndLog = GetDlgItem(hwnd, IDC_SRMM_LOG);
NotifyEventHooks(hHookWinEvt, 0, (LPARAM)&mwe);
}
}
@@ -117,15 +117,11 @@ static void SetEditorText(HWND hwnd, const wchar_t* txt) CSrmmWindow::CSrmmWindow(MCONTACT hContact, bool noActivate, const char *szInitialText, bool bIsUnicode) :
CSrmmBaseDialog(g_hInst, IDD_MSG),
- m_log(this, IDC_LOG),
- m_message(this, IDC_MESSAGE),
m_splitter(this, IDC_SPLITTERY),
m_btnOk(this, IDOK),
m_cmdList(20),
m_bNoActivate(noActivate)
{
- m_pLog = &m_log;
- m_pEntry = &m_message;
m_hContact = hContact;
m_btnOk.OnClick = Callback(this, &CSrmmWindow::onClick_Ok);
@@ -611,7 +607,7 @@ void CSrmmWindow::UpdateReadChars() int CSrmmWindow::Resizer(UTILRESIZECONTROL *urc)
{
switch (urc->wId) {
- case IDC_LOG:
+ case IDC_SRMM_LOG:
if (!g_dat.bShowButtons)
urc->rcItem.top -= m_lineHeight;
urc->rcItem.bottom -= m_splitterPos - m_originalSplitterPos;
@@ -622,7 +618,7 @@ int CSrmmWindow::Resizer(UTILRESIZECONTROL *urc) urc->rcItem.bottom -= m_splitterPos - m_originalSplitterPos;
return RD_ANCHORX_WIDTH | RD_ANCHORY_BOTTOM;
- case IDC_MESSAGE:
+ case IDC_SRMM_MESSAGE:
if (!g_dat.bSendButton)
urc->rcItem.right = urc->dlgNewSize.cx - urc->rcItem.left;
if (g_dat.bShowAvatar && m_avatarPic)
@@ -1321,7 +1317,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) ShowWindow(GetDlgItem(m_hwnd, IDC_ADD), FALSE);
break;
- case IDC_MESSAGE:
+ case IDC_SRMM_MESSAGE:
if (HIWORD(wParam) == EN_CHANGE) {
int len = GetWindowTextLength(m_message.GetHwnd());
UpdateReadChars();
@@ -1353,7 +1349,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) HCURSOR hCur;
switch (((LPNMHDR)lParam)->idFrom) {
- case IDC_LOG:
+ case IDC_SRMM_LOG:
switch (((LPNMHDR)lParam)->code) {
case EN_MSGFILTER:
switch (((MSGFILTER *)lParam)->msg) {
@@ -1409,7 +1405,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) break;
case EN_VSCROLL:
- if (LOWORD(wParam) == IDC_LOG && GetWindowLongPtr((HWND)lParam, GWL_STYLE) & WS_VSCROLL) {
+ if (LOWORD(wParam) == IDC_SRMM_LOG && GetWindowLongPtr((HWND)lParam, GWL_STYLE) & WS_VSCROLL) {
SCROLLINFO si = {};
si.cbSize = sizeof(si);
si.fMask = SIF_PAGE | SIF_RANGE | SIF_POS;
diff --git a/src/core/stdmsg/src/msglog.cpp b/src/core/stdmsg/src/msglog.cpp index b4eb69150f..8db9ac92a7 100644 --- a/src/core/stdmsg/src/msglog.cpp +++ b/src/core/stdmsg/src/msglog.cpp @@ -398,59 +398,57 @@ void CSrmmWindow::StreamInEvents(MEVENT hDbEventFirst, int count, bool bAppend) BOOL bottomScroll = TRUE;
POINT scrollPos;
- HWND hwndLog = GetDlgItem(m_hwnd, IDC_LOG);
-
- SendMessage(hwndLog, WM_SETREDRAW, FALSE, 0);
- SendMessage(hwndLog, EM_EXGETSEL, 0, (LPARAM)&oldSel);
+ m_log.SendMsg(WM_SETREDRAW, FALSE, 0);
+ m_log.SendMsg(EM_EXGETSEL, 0, (LPARAM)&oldSel);
LogStreamData streamData = {};
streamData.hContact = m_hContact;
streamData.hDbEvent = hDbEventFirst;
streamData.dlgDat = this;
streamData.eventsToInsert = count;
- streamData.isEmpty = !bAppend || GetWindowTextLength(hwndLog) == 0;
+ streamData.isEmpty = !bAppend || GetWindowTextLength(m_log.GetHwnd()) == 0;
EDITSTREAM stream = {};
stream.pfnCallback = LogStreamInEvents;
stream.dwCookie = (DWORD_PTR)&streamData;
if (!streamData.isEmpty) {
- bottomScroll = (GetFocus() != hwndLog);
- if (bottomScroll && (GetWindowLongPtr(hwndLog, GWL_STYLE) & WS_VSCROLL)) {
+ bottomScroll = (GetFocus() != m_log.GetHwnd());
+ if (bottomScroll && (GetWindowLongPtr(m_log.GetHwnd(), GWL_STYLE) & WS_VSCROLL)) {
SCROLLINFO si = {};
si.cbSize = sizeof(si);
si.fMask = SIF_PAGE | SIF_RANGE | SIF_POS;
- GetScrollInfo(hwndLog, SB_VERT, &si);
+ GetScrollInfo(m_log.GetHwnd(), SB_VERT, &si);
bottomScroll = (si.nPos + (int)si.nPage) >= si.nMax;
}
if (!bottomScroll)
- SendMessage(hwndLog, EM_GETSCROLLPOS, 0, (LPARAM)&scrollPos);
+ m_log.SendMsg(EM_GETSCROLLPOS, 0, (LPARAM)&scrollPos);
}
if (bAppend) {
sel.cpMin = sel.cpMax = -1;
- SendMessage(hwndLog, EM_EXSETSEL, 0, (LPARAM)&sel);
+ m_log.SendMsg(EM_EXSETSEL, 0, (LPARAM)&sel);
}
mir_strcpy(szSep2, bAppend ? "\\par\\sl0" : "\\sl1000");
mir_strcpy(szSep2_RTL, bAppend ? "\\rtlpar\\rtlmark\\par\\sl1000" : "\\sl1000");
- SendMessage(hwndLog, EM_STREAMIN, bAppend ? SFF_SELECTION | SF_RTF : SF_RTF, (LPARAM)&stream);
+ m_log.SendMsg(EM_STREAMIN, bAppend ? SFF_SELECTION | SF_RTF : SF_RTF, (LPARAM)&stream);
if (bottomScroll) {
sel.cpMin = sel.cpMax = -1;
- SendMessage(hwndLog, EM_EXSETSEL, 0, (LPARAM)&sel);
- if (GetWindowLongPtr(hwndLog, GWL_STYLE) & WS_VSCROLL) {
+ m_log.SendMsg(EM_EXSETSEL, 0, (LPARAM)&sel);
+ if (GetWindowLongPtr(m_log.GetHwnd(), GWL_STYLE) & WS_VSCROLL) {
SendMessage(m_hwnd, DM_SCROLLLOGTOBOTTOM, 0, 0);
PostMessage(m_hwnd, DM_SCROLLLOGTOBOTTOM, 0, 0);
}
}
else {
- SendMessage(hwndLog, EM_EXSETSEL, 0, (LPARAM)&oldSel);
- SendMessage(hwndLog, EM_SETSCROLLPOS, 0, (LPARAM)&scrollPos);
+ m_log.SendMsg(EM_EXSETSEL, 0, (LPARAM)&oldSel);
+ m_log.SendMsg(EM_SETSCROLLPOS, 0, (LPARAM)&scrollPos);
}
- SendMessage(hwndLog, WM_SETREDRAW, TRUE, 0);
+ m_log.SendMsg(WM_SETREDRAW, TRUE, 0);
if (bottomScroll)
- RedrawWindow(hwndLog, NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW);
+ RedrawWindow(m_log.GetHwnd(), NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW);
m_hDbEventLast = streamData.hDbEventLast;
}
diff --git a/src/core/stdmsg/src/msgs.cpp b/src/core/stdmsg/src/msgs.cpp index 5e0c8e767d..e9f25b410a 100644 --- a/src/core/stdmsg/src/msgs.cpp +++ b/src/core/stdmsg/src/msgs.cpp @@ -113,11 +113,11 @@ INT_PTR SendMessageCmd(MCONTACT hContact, char *msg, int isWchar) HWND hwnd = WindowList_Find(pci->hWindowList, hContact);
if (hwnd) {
if (msg) {
- SendDlgItemMessage(hwnd, IDC_MESSAGE, EM_SETSEL, -1, SendDlgItemMessage(hwnd, IDC_MESSAGE, WM_GETTEXTLENGTH, 0, 0));
+ SendDlgItemMessage(hwnd, IDC_SRMM_MESSAGE, EM_SETSEL, -1, SendDlgItemMessage(hwnd, IDC_SRMM_MESSAGE, WM_GETTEXTLENGTH, 0, 0));
if (isWchar)
- SendDlgItemMessageW(hwnd, IDC_MESSAGE, EM_REPLACESEL, FALSE, (LPARAM)msg);
+ SendDlgItemMessageW(hwnd, IDC_SRMM_MESSAGE, EM_REPLACESEL, FALSE, (LPARAM)msg);
else
- SendDlgItemMessageA(hwnd, IDC_MESSAGE, EM_REPLACESEL, FALSE, (LPARAM)msg);
+ SendDlgItemMessageA(hwnd, IDC_SRMM_MESSAGE, EM_REPLACESEL, FALSE, (LPARAM)msg);
}
ShowWindow(hwnd, SW_RESTORE);
SetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW);
diff --git a/src/core/stdmsg/src/msgs.h b/src/core/stdmsg/src/msgs.h index 83bdc4f3d2..aa365e17d1 100644 --- a/src/core/stdmsg/src/msgs.h +++ b/src/core/stdmsg/src/msgs.h @@ -57,7 +57,6 @@ class CSrmmWindow : public CSrmmBaseDialog virtual LRESULT WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam) override;
CCtrlButton m_btnOk;
- CCtrlEdit m_log, m_message;
CSplitter m_splitter;
void NotifyTyping(int mode);
diff --git a/src/core/stdmsg/src/resource.h b/src/core/stdmsg/src/resource.h index af3f02dbc0..9deadabd3e 100644 --- a/src/core/stdmsg/src/resource.h +++ b/src/core/stdmsg/src/resource.h @@ -63,8 +63,6 @@ #define IDD_MODERNOPT_MSGDLG 288
#define IDD_MODERNOPT_MSGLOG 289
-#define IDC_LOG 1001
-#define IDC_MESSAGE 1002
#define IDC_SPLITTERX 1003
#define IDC_AUTOCLOSE 1004
#define IDC_AUTOMIN 1005
diff --git a/src/core/stdmsg/src/richutil.cpp b/src/core/stdmsg/src/richutil.cpp index 551daf33de..b461d91e26 100644 --- a/src/core/stdmsg/src/richutil.cpp +++ b/src/core/stdmsg/src/richutil.cpp @@ -97,7 +97,7 @@ static LRESULT CALLBACK RichUtil_Proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM switch (msg) {
case WM_CHAR:
{
- HWND hwndMsg = GetDlgItem(GetParent(hwnd), IDC_MESSAGE);
+ HWND hwndMsg = GetDlgItem(GetParent(hwnd), IDC_SRMM_MESSAGE);
if (hwndMsg != hwnd) {
SetFocus(hwndMsg);
if (wParam != '\t') SendMessage(hwndMsg, WM_CHAR, wParam, lParam);
diff --git a/src/core/stdmsg/src/stdafx.h b/src/core/stdmsg/src/stdafx.h index c09f311e83..08f35ac924 100644 --- a/src/core/stdmsg/src/stdafx.h +++ b/src/core/stdmsg/src/stdafx.h @@ -218,7 +218,6 @@ class CChatRoomDlg : public CSrmmBaseDialog HWND m_hwndStatus;
wchar_t szTabSave[20];
- CCtrlEdit m_message, m_log;
CCtrlButton m_btnOk;
CSplitter m_splitterX, m_splitterY;
diff --git a/src/mir_app/src/colorchooser.cpp b/src/mir_app/src/colorchooser.cpp index 6422e4020a..311f61ea69 100644 --- a/src/mir_app/src/colorchooser.cpp +++ b/src/mir_app/src/colorchooser.cpp @@ -267,6 +267,6 @@ public: void CSrmmBaseDialog::ShowColorChooser(int iCtrlId)
{
- CColorChooserDlg *pDialog = new CColorChooserDlg(m_si, iCtrlId == IDC_SRMM_COLOR, m_hwnd, m_pEntry->GetHwnd(), GetDlgItem(m_hwnd, iCtrlId));
+ CColorChooserDlg *pDialog = new CColorChooserDlg(m_si, iCtrlId == IDC_SRMM_COLOR, m_hwnd, m_message.GetHwnd(), GetDlgItem(m_hwnd, iCtrlId));
pDialog->Show();
}
diff --git a/src/mir_app/src/srmm_base.cpp b/src/mir_app/src/srmm_base.cpp index 689776bedd..8bbc5c4d92 100644 --- a/src/mir_app/src/srmm_base.cpp +++ b/src/mir_app/src/srmm_base.cpp @@ -30,6 +30,8 @@ extern HCURSOR g_hCurHyperlinkHand; CSrmmBaseDialog::CSrmmBaseDialog(HINSTANCE hInst, int idDialog, SESSION_INFO *si) : CDlgBase(hInst, idDialog), + m_log(this, IDC_SRMM_LOG), + m_message(this, IDC_SRMM_MESSAGE), m_nickList(this, IDC_SRMM_NICKLIST), m_btnFilter(this, IDC_SRMM_FILTER), @@ -45,8 +47,6 @@ CSrmmBaseDialog::CSrmmBaseDialog(HINSTANCE hInst, int idDialog, SESSION_INFO *si m_btnUnderline(this, IDC_SRMM_UNDERLINE), m_si(si), - m_pLog(nullptr), - m_pEntry(nullptr), m_hContact(0), m_clrInputBG(GetSysColor(COLOR_WINDOW)) { @@ -82,9 +82,10 @@ CSrmmBaseDialog::CSrmmBaseDialog(HINSTANCE hInst, int idDialog, SESSION_INFO *si CSrmmBaseDialog::CSrmmBaseDialog(const CSrmmBaseDialog&) : CDlgBase(0, 0), - m_btnColor(0, 0), m_btnBkColor(0, 0), m_nickList(0, 0), + m_btnColor(0, 0), m_btnBkColor(0, 0), m_btnBold(0, 0), m_btnItalic(0, 0), m_btnUnderline(0, 0), - m_btnFilter(0, 0), m_btnChannelMgr(0, 0), m_btnHistory(0, 0), m_btnNickList(0, 0) + m_btnFilter(0, 0), m_btnChannelMgr(0, 0), m_btnHistory(0, 0), m_btnNickList(0, 0), + m_nickList(0, 0), m_log(0, 0), m_message(0, 0) { } @@ -176,11 +177,11 @@ static LRESULT CALLBACK stubNicklistProc(HWND hwnd, UINT msg, WPARAM wParam, LPA void CSrmmBaseDialog::OnInitDialog() { - SetWindowLongPtr(m_pLog->GetHwnd(), GWLP_USERDATA, LPARAM(this)); - mir_subclassWindow(m_pLog->GetHwnd(), stubLogProc); + SetWindowLongPtr(m_log.GetHwnd(), GWLP_USERDATA, LPARAM(this)); + mir_subclassWindow(m_log.GetHwnd(), stubLogProc); - SetWindowLongPtr(m_pEntry->GetHwnd(), GWLP_USERDATA, LPARAM(this)); - mir_subclassWindow(m_pEntry->GetHwnd(), stubMessageProc); + SetWindowLongPtr(m_message.GetHwnd(), GWLP_USERDATA, LPARAM(this)); + mir_subclassWindow(m_message.GetHwnd(), stubMessageProc); SetWindowLongPtr(m_nickList.GetHwnd(), GWLP_USERDATA, LPARAM(this)); mir_subclassWindow(m_nickList.GetHwnd(), stubNicklistProc); @@ -195,8 +196,8 @@ void CSrmmBaseDialog::OnInitDialog() void CSrmmBaseDialog::OnDestroy() { SetWindowLongPtr(m_hwnd, GWLP_USERDATA, 0); - mir_unsubclassWindow(m_pLog->GetHwnd(), stubLogProc); - mir_unsubclassWindow(m_pEntry->GetHwnd(), stubMessageProc); + mir_unsubclassWindow(m_log.GetHwnd(), stubLogProc); + mir_unsubclassWindow(m_message.GetHwnd(), stubMessageProc); mir_unsubclassWindow(m_nickList.GetHwnd(), stubNicklistProc); } @@ -216,67 +217,64 @@ INT_PTR CSrmmBaseDialog::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) break; case WM_NOTIFY: - if (m_pLog != nullptr) { - LPNMHDR hdr = (LPNMHDR)lParam; - if (hdr->hwndFrom == m_pLog->GetHwnd() && hdr->code == EN_LINK) { - ENLINK *pLink = (ENLINK*)lParam; - switch (pLink->msg) { - case WM_SETCURSOR: - SetCursor(g_hCurHyperlinkHand); - SetWindowLongPtr(m_hwnd, DWLP_MSGRESULT, TRUE); - return TRUE; - - case WM_RBUTTONDOWN: - case WM_LBUTTONUP: - case WM_LBUTTONDBLCLK: - CHARRANGE sel; - m_pLog->SendMsg(EM_EXGETSEL, 0, (LPARAM)&sel); - if (sel.cpMin != sel.cpMax) + LPNMHDR hdr = (LPNMHDR)lParam; + if (hdr->hwndFrom == m_log.GetHwnd() && hdr->code == EN_LINK) { + ENLINK *pLink = (ENLINK*)lParam; + switch (pLink->msg) { + case WM_SETCURSOR: + SetCursor(g_hCurHyperlinkHand); + SetWindowLongPtr(m_hwnd, DWLP_MSGRESULT, TRUE); + return TRUE; + + case WM_RBUTTONDOWN: + case WM_LBUTTONUP: + case WM_LBUTTONDBLCLK: + CHARRANGE sel; + m_log.SendMsg(EM_EXGETSEL, 0, (LPARAM)&sel); + if (sel.cpMin != sel.cpMax) + break; + + CMStringW wszText(' ', pLink->chrg.cpMax - pLink->chrg.cpMin + 1); + + TEXTRANGE tr; + tr.chrg = pLink->chrg; + tr.lpstrText = wszText.GetBuffer(); + m_log.SendMsg(EM_GETTEXTRANGE, 0, (LPARAM)&tr); + if (wcschr(tr.lpstrText, '@') != nullptr && wcschr(tr.lpstrText, ':') == nullptr && wcschr(tr.lpstrText, '/') == nullptr) + wszText.Insert(0, L"mailto:"); + + if (pLink->msg == WM_RBUTTONDOWN) { + HMENU hMenu = LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_CONTEXT)); + HMENU hSubMenu = GetSubMenu(hMenu, 6); + TranslateMenu(hSubMenu); + + POINT pt = { GET_X_LPARAM(pLink->lParam), GET_Y_LPARAM(pLink->lParam) }; + ClientToScreen(((NMHDR *)lParam)->hwndFrom, &pt); + + switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, m_hwnd, nullptr)) { + case IDM_OPENLINK: + Utils_OpenUrlW(wszText); break; - CMStringW wszText(' ', pLink->chrg.cpMax - pLink->chrg.cpMin + 1); - - TEXTRANGE tr; - tr.chrg = pLink->chrg; - tr.lpstrText = wszText.GetBuffer(); - m_pLog->SendMsg(EM_GETTEXTRANGE, 0, (LPARAM)&tr); - if (wcschr(tr.lpstrText, '@') != nullptr && wcschr(tr.lpstrText, ':') == nullptr && wcschr(tr.lpstrText, '/') == nullptr) - wszText.Insert(0, L"mailto:"); - - if (pLink->msg == WM_RBUTTONDOWN) { - HMENU hMenu = LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_CONTEXT)); - HMENU hSubMenu = GetSubMenu(hMenu, 6); - TranslateMenu(hSubMenu); - - POINT pt = { GET_X_LPARAM(pLink->lParam), GET_Y_LPARAM(pLink->lParam) }; - ClientToScreen(((NMHDR *)lParam)->hwndFrom, &pt); - - switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, m_hwnd, nullptr)) { - case IDM_OPENLINK: - Utils_OpenUrlW(wszText); - break; - - case IDM_COPYLINK: - if (OpenClipboard(m_hwnd)) { - EmptyClipboard(); - HGLOBAL hData = GlobalAlloc(GMEM_MOVEABLE, (wszText.GetLength() + 1) * sizeof(wchar_t)); - mir_wstrcpy((wchar_t*)GlobalLock(hData), wszText); - GlobalUnlock(hData); - SetClipboardData(CF_UNICODETEXT, hData); - CloseClipboard(); - } - break; + case IDM_COPYLINK: + if (OpenClipboard(m_hwnd)) { + EmptyClipboard(); + HGLOBAL hData = GlobalAlloc(GMEM_MOVEABLE, (wszText.GetLength() + 1) * sizeof(wchar_t)); + mir_wstrcpy((wchar_t*)GlobalLock(hData), wszText); + GlobalUnlock(hData); + SetClipboardData(CF_UNICODETEXT, hData); + CloseClipboard(); } - - DestroyMenu(hMenu); - SetWindowLongPtr(m_hwnd, DWLP_MSGRESULT, TRUE); - return TRUE; + break; } - Utils_OpenUrlW(wszText); - if (m_pEntry != nullptr) - SetFocus(m_pEntry->GetHwnd()); + DestroyMenu(hMenu); + SetWindowLongPtr(m_hwnd, DWLP_MSGRESULT, TRUE); + return TRUE; } + + Utils_OpenUrlW(wszText); + SetFocus(m_message.GetHwnd()); } } break; @@ -295,8 +293,7 @@ void CSrmmBaseDialog::AddLog() void CSrmmBaseDialog::ClearLog() { - if (m_pLog != nullptr) - m_pLog->SetText(L""); + m_log.SetText(L""); } void CSrmmBaseDialog::DoEventHook(int iType, const USERINFO *pUser, const wchar_t *pszText, INT_PTR dwItem) @@ -347,7 +344,7 @@ void CSrmmBaseDialog::onClick_Color(CCtrlButton *pButton) } else cf.crTextColor = m_clrInputFG; - m_pEntry->SendMsg(EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf); + m_message.SendMsg(EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf); } void CSrmmBaseDialog::onClick_BkColor(CCtrlButton *pButton) @@ -370,7 +367,7 @@ void CSrmmBaseDialog::onClick_BkColor(CCtrlButton *pButton) } else cf.crBackColor = m_clrInputBG; - m_pEntry->SendMsg(EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf); + m_message.SendMsg(EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf); } void CSrmmBaseDialog::onClick_BIU(CCtrlButton *pButton) @@ -389,7 +386,7 @@ void CSrmmBaseDialog::onClick_BIU(CCtrlButton *pButton) cf.dwEffects |= CFE_ITALIC; if (IsDlgButtonChecked(m_hwnd, IDC_SRMM_UNDERLINE)) cf.dwEffects |= CFE_UNDERLINE; - m_pEntry->SendMsg(EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf); + m_message.SendMsg(EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf); } void CSrmmBaseDialog::onClick_History(CCtrlButton *pButton) @@ -425,15 +422,15 @@ void CSrmmBaseDialog::onDblClick_List(CCtrlListBox *pList) bool bShift = (GetKeyState(VK_SHIFT) & 0x8000) != 0; if (g_Settings->bDoubleClick4Privat ? bShift : !bShift) { - int selStart = LOWORD(m_pEntry->SendMsg(EM_GETSEL, 0, 0)); + int selStart = LOWORD(m_message.SendMsg(EM_GETSEL, 0, 0)); CMStringW tszName(ui->pszNick); if (selStart == 0) tszName.AppendChar(':'); tszName.AppendChar(' '); - m_pEntry->SendMsg(EM_REPLACESEL, FALSE, (LPARAM)tszName.GetString()); + m_message.SendMsg(EM_REPLACESEL, FALSE, (LPARAM)tszName.GetString()); PostMessage(m_hwnd, WM_MOUSEACTIVATE, 0, 0); - SetFocus(m_pEntry->GetHwnd()); + SetFocus(m_message.GetHwnd()); } else DoEventHook(GC_USER_PRIVMESS, ui, nullptr, 0); } @@ -502,7 +499,7 @@ void CSrmmBaseDialog::RefreshButtonStatus(void) CHARFORMAT2 cf; cf.cbSize = sizeof(CHARFORMAT2); cf.dwMask = CFM_BOLD | CFM_ITALIC | CFM_UNDERLINE | CFM_BACKCOLOR | CFM_COLOR; - m_pEntry->SendMsg(EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf); + m_message.SendMsg(EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf); MODULEINFO *mi = chatApi.MM_FindModule(m_si->pszModule); if (mi == nullptr) |