diff options
author | George Hazan <ghazan@miranda.im> | 2020-05-04 20:52:39 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2020-05-04 20:52:46 +0300 |
commit | 633d14f19afc80362a5d4872def663a5271c7225 (patch) | |
tree | 0dcd65265836da3503af39d060c45e19de149ba5 /plugins | |
parent | 7c0d4f4d63669f84d0796776a47d12d75891c40e (diff) |
fixes #2381 (NewStory: add right-click menu for groupchats)
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/NewStory/src/history_array.cpp | 2 | ||||
-rw-r--r-- | plugins/NewStory/src/history_control.cpp | 25 | ||||
-rw-r--r-- | plugins/NewStory/src/history_control.h | 3 | ||||
-rw-r--r-- | plugins/NewStory/src/history_log.cpp | 2 |
4 files changed, 28 insertions, 4 deletions
diff --git a/plugins/NewStory/src/history_array.cpp b/plugins/NewStory/src/history_array.cpp index 6f9de4be95..83c44da0e0 100644 --- a/plugins/NewStory/src/history_array.cpp +++ b/plugins/NewStory/src/history_array.cpp @@ -147,8 +147,6 @@ void HistoryArray::addChatEvent(SESSION_INFO *si, LOGINFO *lin) p.hContact = si->hContact; p.wtext = wszText.Detach(); p.bLoaded = true; - p.dbe.cbBlob = 1; - p.dbe.pBlob = (BYTE *)p.wtext; p.dbe.eventType = EVENTTYPE_MESSAGE; p.dbe.timestamp = lin->time; diff --git a/plugins/NewStory/src/history_control.cpp b/plugins/NewStory/src/history_control.cpp index a965e7eb81..a616e9a6b7 100644 --- a/plugins/NewStory/src/history_control.cpp +++ b/plugins/NewStory/src/history_control.cpp @@ -37,6 +37,7 @@ struct NewstoryListData : public MZeroedObject HWND hwndEditBox; CTimer redrawTimer; + CSrmmBaseDialog *pMsgDlg = nullptr; void OnContextMenu(int index, POINT pt) { @@ -46,8 +47,18 @@ struct NewstoryListData : public MZeroedObject HMENU hMenu = LoadMenu(g_plugin.getInst(), MAKEINTRESOURCE(IDR_CONTEXTMENU)); TranslateMenu(hMenu); - - int ret = TrackPopupMenu(GetSubMenu(hMenu, 0), TPM_RETURNCMD, pt.x, pt.y, 0, hwnd, nullptr); + + HMENU hSubMenu = GetSubMenu(hMenu, 0); + UINT ret; + if (pMsgDlg != nullptr && pMsgDlg->isChat()) { + EnableMenuItem(hSubMenu, 2, MF_BYPOSITION | MF_GRAYED); + + pMsgDlg->m_bInMenu = true; + ret = Chat_CreateMenu(hwnd, hSubMenu, pt, pMsgDlg->getChat(), nullptr); + pMsgDlg->m_bInMenu = false; + } + else ret = TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwnd, nullptr); + switch(ret) { case ID_CONTEXT_COPY: SendMessage(hwnd, NSM_COPY, 0, 0); @@ -63,6 +74,12 @@ struct NewstoryListData : public MZeroedObject case ID_CONTEXT_SELECTALL: SendMessage(hwnd, NSM_SELECTITEMS, 0, items.getCount() - 1); break; + + default: + if (pMsgDlg != nullptr) { + PostMessage(pMsgDlg->GetHwnd(), WM_MOUSEACTIVATE, 0, 0); + Chat_DoEventHook(pMsgDlg->getChat(), GC_USER_LOGMENU, nullptr, nullptr, ret); + } } DestroyMenu(hMenu); @@ -660,6 +677,10 @@ LRESULT CALLBACK NewstoryListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM SendMessage(hwnd, NSM_SETCARET, data->items.getCount() - 1, 1); break; + case NSM_SET_SRMM: + data->pMsgDlg = (CSrmmBaseDialog *)lParam; + break; + case NSM_DELETE: if (IDYES == MessageBoxW(hwnd, TranslateW(wszDelete), _T(MODULETITLE), MB_YESNOCANCEL | MB_ICONQUESTION)) { db_set_safety_mode(false); diff --git a/plugins/NewStory/src/history_control.h b/plugins/NewStory/src/history_control.h index c1ed6be620..46b1bb045f 100644 --- a/plugins/NewStory/src/history_control.h +++ b/plugins/NewStory/src/history_control.h @@ -74,6 +74,9 @@ enum NSM_SEEKEND, NSM_SEEKTIME, + // + NSM_SET_SRMM, // act inside SRMM dialog + NSM_LAST }; diff --git a/plugins/NewStory/src/history_log.cpp b/plugins/NewStory/src/history_log.cpp index d1d0f69b36..43d75a545a 100644 --- a/plugins/NewStory/src/history_log.cpp +++ b/plugins/NewStory/src/history_log.cpp @@ -13,6 +13,8 @@ public: void Attach() override { m_hwnd = ::CreateWindow(_T(NEWSTORYLIST_CLASS), L"NewStory", WS_VISIBLE | WS_CHILD | WS_TABSTOP, 0, 0, 300, 150, m_pDlg.GetHwnd(), 0, m_pDlg.GetInst(), 0); + + SendMessage(m_hwnd, NSM_SET_SRMM, 0, (LPARAM)&m_pDlg); } void Detach() override |