diff options
author | George Hazan <ghazan@miranda.im> | 2023-01-09 19:03:47 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2023-01-09 19:03:47 +0300 |
commit | 34c0bff10aa70a201f6ea95756a17200513267dd (patch) | |
tree | 15b3bf62f59ae47fd4d46261f3ceadd75e85fee8 /plugins/TabSRMM | |
parent | 66e6995d7d8cbfe96146599cbc5b70b8cafbcba2 (diff) |
fixes #3114 (tabSRMM: добавить в лог пункт контекстного меню "Копировать")
Diffstat (limited to 'plugins/TabSRMM')
-rw-r--r-- | plugins/TabSRMM/res/resource.rc | 2 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgdialog.cpp | 74 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgdlgother.cpp | 24 | ||||
-rw-r--r-- | plugins/TabSRMM/src/resource.h | 1 |
4 files changed, 22 insertions, 79 deletions
diff --git a/plugins/TabSRMM/res/resource.rc b/plugins/TabSRMM/res/resource.rc index b637d7c526..b9daaf6d79 100644 --- a/plugins/TabSRMM/res/resource.rc +++ b/plugins/TabSRMM/res/resource.rc @@ -565,7 +565,6 @@ BEGIN BEGIN
MENUITEM "&Copy", IDM_COPY
MENUITEM "&Quote", IDM_QUOTE
- MENUITEM "Co&py all", IDM_COPYALL
MENUITEM "Select &all", IDM_SELECTALL
MENUITEM SEPARATOR
MENUITEM "Clear log", IDM_CLEAR
@@ -585,7 +584,6 @@ BEGIN MENUITEM "Paste formatted text", IDM_PASTEFORMATTED
MENUITEM "Paste and send immediately", ID_EDITOR_PASTEANDSENDIMMEDIATELY
MENUITEM SEPARATOR
- MENUITEM "Copy all", IDM_COPYALL
MENUITEM "Select all", IDM_SELECTALL
MENUITEM SEPARATOR
MENUITEM "Show message length indicator", ID_EDITOR_SHOWMESSAGELENGTHINDICATOR
diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index 9c8aa11318..0ea8c25470 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -1941,76 +1941,18 @@ LRESULT CMsgDialog::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam) case WM_CONTEXTMENU:
POINT pt;
- if (isChat()) {
- GetCursorPos(&pt);
-
- HMENU hMenu = LoadMenu(g_plugin.getInst(), MAKEINTRESOURCE(IDR_CONTEXT));
- HMENU hSubMenu = GetSubMenu(hMenu, 2);
- RemoveMenu(hSubMenu, 9, MF_BYPOSITION);
- RemoveMenu(hSubMenu, 8, MF_BYPOSITION);
- RemoveMenu(hSubMenu, 4, MF_BYPOSITION);
-
- EnableMenuItem(hSubMenu, IDM_PASTEFORMATTED, m_si->pMI->bBold ? MF_ENABLED : MF_GRAYED);
- TranslateMenu(hSubMenu);
-
- CHARRANGE sel, all = { 0, -1 };
+ if (lParam == 0xFFFFFFFF) {
+ CHARRANGE sel;
m_message.SendMsg(EM_EXGETSEL, 0, (LPARAM)&sel);
- if (sel.cpMin == sel.cpMax) {
- EnableMenuItem(hSubMenu, IDM_COPY, MF_GRAYED);
- EnableMenuItem(hSubMenu, IDM_CUT, MF_GRAYED);
- }
-
- MessageWindowPopupData mwpd = { sizeof(mwpd) };
- mwpd.uType = MSG_WINDOWPOPUP_SHOWING;
- mwpd.uFlags = MSG_WINDOWPOPUP_INPUT;
- mwpd.hContact = m_hContact;
- mwpd.hwnd = m_message.GetHwnd();
- mwpd.hMenu = hSubMenu;
- mwpd.pt = pt;
- NotifyEventHooks(g_chatApi.hevWinPopup, 0, (LPARAM)&mwpd);
-
- int iSelection = TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, m_hwnd, nullptr);
-
- mwpd.selection = iSelection;
- mwpd.uType = MSG_WINDOWPOPUP_SELECTED;
- NotifyEventHooks(g_chatApi.hevWinPopup, 0, (LPARAM)&mwpd);
-
- switch (iSelection) {
- case IDM_COPY:
- m_message.SendMsg(WM_COPY, 0, 0);
- break;
- case IDM_CUT:
- m_message.SendMsg(WM_CUT, 0, 0);
- break;
- case IDM_PASTE:
- case IDM_PASTEFORMATTED:
- m_message.SendMsg(EM_PASTESPECIAL, (iSelection == IDM_PASTE) ? CF_UNICODETEXT : 0, 0);
- break;
- case IDM_COPYALL:
- m_message.SendMsg(EM_EXSETSEL, 0, (LPARAM)&all);
- m_message.SendMsg(WM_COPY, 0, 0);
- m_message.SendMsg(EM_EXSETSEL, 0, (LPARAM)&sel);
- break;
- case IDM_SELECTALL:
- m_message.SendMsg(EM_EXSETSEL, 0, (LPARAM)&all);
- break;
- }
- DestroyMenu(hMenu);
+ m_message.SendMsg(EM_POSFROMCHAR, (WPARAM)&pt, (LPARAM)sel.cpMax);
+ ClientToScreen(m_message.GetHwnd(), &pt);
}
else {
- if (lParam == 0xFFFFFFFF) {
- CHARRANGE sel;
- m_message.SendMsg(EM_EXGETSEL, 0, (LPARAM)&sel);
- m_message.SendMsg(EM_POSFROMCHAR, (WPARAM)&pt, (LPARAM)sel.cpMax);
- ClientToScreen(m_message.GetHwnd(), &pt);
- }
- else {
- pt.x = GET_X_LPARAM(lParam);
- pt.y = GET_Y_LPARAM(lParam);
- }
-
- ShowPopupMenu(m_message, pt);
+ pt.x = GET_X_LPARAM(lParam);
+ pt.y = GET_Y_LPARAM(lParam);
}
+
+ ShowPopupMenu(m_message, pt);
return TRUE;
}
diff --git a/plugins/TabSRMM/src/msgdlgother.cpp b/plugins/TabSRMM/src/msgdlgother.cpp index caf4c15242..b7a01a7e4a 100644 --- a/plugins/TabSRMM/src/msgdlgother.cpp +++ b/plugins/TabSRMM/src/msgdlgother.cpp @@ -1987,7 +1987,7 @@ void CMsgDialog::ShowPicture(bool showNewPic) void CMsgDialog::ShowPopupMenu(const CCtrlBase &pCtrl, POINT pt)
{
- CHARRANGE sel, all = { 0, -1 };
+ bool bCopyAll = g_plugin.bAutoCopy;
HMENU hSubMenu, hMenu = LoadMenu(g_plugin.getInst(), MAKEINTRESOURCE(IDR_CONTEXT));
if (pCtrl.GetCtrlId() == IDC_SRMM_LOG)
@@ -1999,10 +1999,14 @@ void CMsgDialog::ShowPopupMenu(const CCtrlBase &pCtrl, POINT pt) CheckMenuItem(hSubMenu, ID_EDITOR_SHOWMESSAGELENGTHINDICATOR, PluginConfig.m_visualMessageSizeIndicator ? MF_CHECKED : MF_UNCHECKED);
EnableMenuItem(hSubMenu, ID_EDITOR_SHOWMESSAGELENGTHINDICATOR, m_pContainer->m_hwndStatus ? MF_ENABLED : MF_GRAYED);
}
+
TranslateMenu(hSubMenu);
- pCtrl.SendMsg(EM_EXGETSEL, 0, (LPARAM)& sel);
+
+ CHARRANGE sel, all = {0, -1};
+ pCtrl.SendMsg(EM_EXGETSEL, 0, (LPARAM)&sel);
if (sel.cpMin == sel.cpMax) {
- EnableMenuItem(hSubMenu, IDM_COPY, MF_GRAYED);
+ bCopyAll = true;
+ ModifyMenuW(hSubMenu, IDM_COPY, MF_BYCOMMAND | MF_STRING, IDM_COPY, TranslateT("Copy all"));
EnableMenuItem(hSubMenu, IDM_QUOTE, MF_GRAYED);
if (pCtrl.GetCtrlId() == IDC_SRMM_MESSAGE)
EnableMenuItem(hSubMenu, IDM_CUT, MF_GRAYED);
@@ -2013,8 +2017,8 @@ void CMsgDialog::ShowPopupMenu(const CCtrlBase &pCtrl, POINT pt) CheckMenuItem(hSubMenu, ID_LOG_FREEZELOG, m_bScrollingDisabled ? MF_CHECKED : MF_UNCHECKED);
}
- MessageWindowPopupData mwpd;
// First notification
+ MessageWindowPopupData mwpd;
mwpd.uType = MSG_WINDOWPOPUP_SHOWING;
mwpd.uFlags = (pCtrl.GetCtrlId() == IDC_SRMM_LOG ? MSG_WINDOWPOPUP_LOG : MSG_WINDOWPOPUP_INPUT);
mwpd.hContact = m_hContact;
@@ -2033,7 +2037,12 @@ void CMsgDialog::ShowPopupMenu(const CCtrlBase &pCtrl, POINT pt) switch (iSelection) {
case IDM_COPY:
- pCtrl.SendMsg(WM_COPY, 0, 0);
+ if (bCopyAll) {
+ pCtrl.SendMsg(EM_EXSETSEL, 0, (LPARAM)&all);
+ pCtrl.SendMsg(WM_COPY, 0, 0);
+ pCtrl.SendMsg(EM_EXSETSEL, 0, (LPARAM)&sel);
+ }
+ else pCtrl.SendMsg(WM_COPY, 0, 0);
break;
case IDM_CUT:
pCtrl.SendMsg(WM_CUT, 0, 0);
@@ -2043,11 +2052,6 @@ void CMsgDialog::ShowPopupMenu(const CCtrlBase &pCtrl, POINT pt) if (pCtrl.GetCtrlId() == IDC_SRMM_MESSAGE)
pCtrl.SendMsg(EM_PASTESPECIAL, (iSelection == IDM_PASTE) ? CF_UNICODETEXT : 0, 0);
break;
- case IDM_COPYALL:
- 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(m_hwnd, WM_COMMAND, IDC_QUOTE, 0);
break;
diff --git a/plugins/TabSRMM/src/resource.h b/plugins/TabSRMM/src/resource.h index ff73a0e710..113960344a 100644 --- a/plugins/TabSRMM/src/resource.h +++ b/plugins/TabSRMM/src/resource.h @@ -31,7 +31,6 @@ #define IDD_MSGSPLITNEW 184
#define IDM_QUOTE 185
#define IDM_COPY 186
-#define IDM_COPYALL 187
#define IDM_SELECTALL 188
#define IDM_CLEAR 189
#define IDM_OPENNEW 190
|