diff options
author | George Hazan <ghazan@miranda.im> | 2019-09-04 12:35:26 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2019-09-04 12:35:26 +0300 |
commit | 9ee02952867845ab162c7ca7b2081cce638c93a9 (patch) | |
tree | dd2913d459065571f308c2f43a2a86369e155755 /src/core/stdmsg | |
parent | 02a8f67b42ccda0d460eee810136ce055a0da95a (diff) |
fixes #2041 (StdMsg: right-click is broken)
Diffstat (limited to 'src/core/stdmsg')
-rw-r--r-- | src/core/stdmsg/res/resource.rc | 2 | ||||
-rw-r--r-- | src/core/stdmsg/src/msgdialog.cpp | 74 |
2 files changed, 40 insertions, 36 deletions
diff --git a/src/core/stdmsg/res/resource.rc b/src/core/stdmsg/res/resource.rc index b878d99041..8bd9ee1ae9 100644 --- a/src/core/stdmsg/res/resource.rc +++ b/src/core/stdmsg/res/resource.rc @@ -9,7 +9,6 @@ // Generated from the TEXTINCLUDE 2 resource.
//
#include <winres.h>
-#include <richedit.h>
#include "..\..\include\statusmodes.h"
/////////////////////////////////////////////////////////////////////////////
@@ -380,7 +379,6 @@ END 2 TEXTINCLUDE
BEGIN
"#include <winres.h>\r\n"
- "#include <richedit.h>\r\n"
"#include ""statusmodes.h""\r\n"
"\0"
END
diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp index 6db387d095..60507a7a21 100644 --- a/src/core/stdmsg/src/msgdialog.cpp +++ b/src/core/stdmsg/src/msgdialog.cpp @@ -541,8 +541,6 @@ int CMsgDialog::Resizer(UTILRESIZECONTROL *urc) INT_PTR CMsgDialog::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- ENLINK *pLink;
- CHARRANGE sel;
RECT rc;
switch (uMsg) {
@@ -926,37 +924,6 @@ INT_PTR CMsgDialog::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) break;
case WM_RBUTTONUP:
- CHARRANGE all = { 0, -1 };
- HMENU hMenu = LoadMenu(g_plugin.getInst(), MAKEINTRESOURCE(IDR_CONTEXT));
- HMENU hSubMenu = GetSubMenu(hMenu, 0);
- TranslateMenu(hSubMenu);
- SendMessage(((NMHDR *)lParam)->hwndFrom, EM_EXGETSEL, 0, (LPARAM)& sel);
- if (sel.cpMin == sel.cpMax)
- EnableMenuItem(hSubMenu, IDM_COPY, MF_BYCOMMAND | MF_GRAYED);
-
- pLink = (ENLINK *)lParam;
- POINT pt = { GET_X_LPARAM(pLink->lParam), GET_Y_LPARAM(pLink->lParam) };
- ClientToScreen(pLink->nmhdr.hwndFrom, &pt);
-
- switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, m_hwnd, nullptr)) {
- case IDM_COPY:
- SendMessage(pLink->nmhdr.hwndFrom, WM_COPY, 0, 0);
- break;
- case IDM_COPYALL:
- SendMessage(pLink->nmhdr.hwndFrom, EM_EXSETSEL, 0, (LPARAM)& all);
- SendMessage(pLink->nmhdr.hwndFrom, WM_COPY, 0, 0);
- SendMessage(pLink->nmhdr.hwndFrom, EM_EXSETSEL, 0, (LPARAM)& sel);
- break;
- case IDM_SELECTALL:
- SendMessage(pLink->nmhdr.hwndFrom, EM_EXSETSEL, 0, (LPARAM)& all);
- break;
- case IDM_CLEAR:
- ClearLog();
- m_hDbEventFirst = 0;
- break;
- }
- DestroyMenu(hSubMenu);
- DestroyMenu(hMenu);
SetWindowLongPtr(m_hwnd, DWLP_MSGRESULT, TRUE);
return TRUE;
}
@@ -1027,9 +994,48 @@ static const CHARRANGE rangeAll = { 0, -1 }; LRESULT CMsgDialog::WndProc_Log(UINT msg, WPARAM wParam, LPARAM lParam)
{
+ CHARRANGE sel;
+
switch(msg) {
+ case WM_CONTEXTMENU:
+ // we display context menu here only for private chats, group chats are processed by the core
+ if (!isChat()) {
+ POINT pt;
+ GetCursorPos(&pt);
+
+ HMENU hMenu = LoadMenu(g_plugin.getInst(), MAKEINTRESOURCE(IDR_CONTEXT));
+ HMENU hSubMenu = GetSubMenu(hMenu, 0);
+ TranslateMenu(hSubMenu);
+
+ CHARRANGE all = { 0, -1 };
+ m_log.SendMsg(EM_EXGETSEL, 0, (LPARAM)&sel);
+ if (sel.cpMin == sel.cpMax)
+ EnableMenuItem(hSubMenu, IDM_COPY, MF_BYCOMMAND | MF_GRAYED);
+
+ switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, m_hwnd, nullptr)) {
+ case IDM_COPY:
+ m_log.SendMsg(WM_COPY, 0, 0);
+ break;
+ case IDM_COPYALL:
+ m_log.SendMsg(EM_EXSETSEL, 0, (LPARAM)&all);
+ m_log.SendMsg(WM_COPY, 0, 0);
+ m_log.SendMsg(EM_EXSETSEL, 0, (LPARAM)&sel);
+ break;
+ case IDM_SELECTALL:
+ m_log.SendMsg(EM_EXSETSEL, 0, (LPARAM)&all);
+ break;
+ case IDM_CLEAR:
+ ClearLog();
+ m_hDbEventFirst = 0;
+ break;
+ }
+ DestroyMenu(hSubMenu);
+ DestroyMenu(hMenu);
+ return TRUE;
+ }
+ break;
+
case WM_LBUTTONUP:
- CHARRANGE sel;
m_log.SendMsg(EM_EXGETSEL, 0, (LPARAM)&sel);
if (sel.cpMin != sel.cpMax) {
m_log.SendMsg(WM_COPY, 0, 0);
|