summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/m_chat_int.h1
-rw-r--r--libs/win32/mir_app.libbin116354 -> 116844 bytes
-rw-r--r--libs/win64/mir_app.libbin111932 -> 112442 bytes
-rw-r--r--plugins/Scriver/res/resource.rc28
-rw-r--r--plugins/Scriver/src/chat_main.cpp9
-rw-r--r--plugins/Scriver/src/chat_window.cpp128
-rw-r--r--plugins/Scriver/src/msgdialog.cpp12
-rw-r--r--plugins/Scriver/src/msgs.cpp2
-rw-r--r--plugins/Scriver/src/resource.h1
-rw-r--r--plugins/Scriver/src/stdafx.h2
-rw-r--r--plugins/Scriver/src/utils.cpp2
-rw-r--r--plugins/Scriver/src/utils.h2
-rw-r--r--plugins/TabSRMM/res/chat.rc52
-rw-r--r--plugins/TabSRMM/src/chat_main.cpp28
-rw-r--r--plugins/TabSRMM/src/chat_resource.h1
-rw-r--r--plugins/TabSRMM/src/chat_window.cpp167
-rw-r--r--plugins/TabSRMM/src/stdafx.h1
-rw-r--r--src/core/stdmsg/res/resource.rc16
-rw-r--r--src/core/stdmsg/src/chat_window.cpp130
-rw-r--r--src/core/stdmsg/src/tabs.cpp2
-rw-r--r--src/mir_app/res/resource.rc28
-rw-r--r--src/mir_app/src/chat.h1
-rw-r--r--src/mir_app/src/chat_svc.cpp7
-rw-r--r--src/mir_app/src/mir_app64.def1
-rw-r--r--src/mir_app/src/resource.h9
-rw-r--r--src/mir_app/src/srmm_base.cpp174
26 files changed, 261 insertions, 543 deletions
diff --git a/include/m_chat_int.h b/include/m_chat_int.h
index 0d61454f5e..267b145ff2 100644
--- a/include/m_chat_int.h
+++ b/include/m_chat_int.h
@@ -411,6 +411,7 @@ protected:
void DoEventHook(int iType, const USERINFO *pUser, const wchar_t *pszText, INT_PTR dwItem);
bool ProcessHotkeys(int key, bool bShift, bool bCtrl, bool bAlt);
void RefreshButtonStatus(void);
+ void RunUserMenu(HWND hwndOwner, USERINFO *ui, const POINT &pt);
protected:
CCtrlEdit m_message, m_log;
diff --git a/libs/win32/mir_app.lib b/libs/win32/mir_app.lib
index 1ef23f47d4..ca517f6537 100644
--- a/libs/win32/mir_app.lib
+++ b/libs/win32/mir_app.lib
Binary files differ
diff --git a/libs/win64/mir_app.lib b/libs/win64/mir_app.lib
index ce654a1a3a..995add470c 100644
--- a/libs/win64/mir_app.lib
+++ b/libs/win64/mir_app.lib
Binary files differ
diff --git a/plugins/Scriver/res/resource.rc b/plugins/Scriver/res/resource.rc
index 5821ba6db7..69aadc0e0d 100644
--- a/plugins/Scriver/res/resource.rc
+++ b/plugins/Scriver/res/resource.rc
@@ -559,34 +559,6 @@ BEGIN
END
END
-IDR_MENU MENU
-BEGIN
- POPUP "List"
- BEGIN
- MENUITEM "&Message", ID_MESS
- END
- POPUP "Log"
- BEGIN
- MENUITEM "Clear lo&g", IDM_CLEAR
- MENUITEM SEPARATOR
- MENUITEM "Co&py all", ID_COPYALL
- MENUITEM SEPARATOR
- POPUP "Word lookup", GRAYED
- BEGIN
- MENUITEM "Google", IDM_SEARCH_GOOGLE
- MENUITEM "Bing", IDM_SEARCH_BING
- MENUITEM "Yandex", IDM_SEARCH_YANDEX
- MENUITEM "Wikipedia (en)", IDM_SEARCH_WIKIPEDIA
- MENUITEM SEPARATOR
- MENUITEM "Google Maps", IDM_SEARCH_GOOGLE_MAPS
- MENUITEM "Google Translate", IDM_SEARCH_GOOGLE_TRANSLATE
- MENUITEM SEPARATOR
- MENUITEM "Yahoo", IDM_SEARCH_YAHOO
- MENUITEM "Foodnetwork", IDM_SEARCH_FOODNETWORK
- END
- END
-END
-
#endif // Neutral resources
/////////////////////////////////////////////////////////////////////////////
diff --git a/plugins/Scriver/src/chat_main.cpp b/plugins/Scriver/src/chat_main.cpp
index 5d0cb3b0e3..5c7e1183f7 100644
--- a/plugins/Scriver/src/chat_main.cpp
+++ b/plugins/Scriver/src/chat_main.cpp
@@ -23,7 +23,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// globals
CHAT_MANAGER *pci;
-HMENU g_hMenu = nullptr;
pfnDoTrayIcon oldDoTrayIcon;
pfnDoPopup oldDoPopup;
@@ -151,13 +150,5 @@ int Chat_Load()
oldDoTrayIcon = pci->DoTrayIcon; pci->DoTrayIcon = DoTrayIcon;
pci->ReloadSettings();
- g_hMenu = LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_MENU));
- TranslateMenu(g_hMenu);
- return 0;
-}
-
-int Chat_Unload(void)
-{
- DestroyMenu(g_hMenu);
return 0;
}
diff --git a/plugins/Scriver/src/chat_window.cpp b/plugins/Scriver/src/chat_window.cpp
index 88f1ac6d72..2ab211a1bd 100644
--- a/plugins/Scriver/src/chat_window.cpp
+++ b/plugins/Scriver/src/chat_window.cpp
@@ -233,7 +233,7 @@ CChatRoomDlg::CChatRoomDlg(SESSION_INFO *si)
void CChatRoomDlg::OnInitDialog()
{
- CScriverWindow::OnInitDialog();
+ CSuper::OnInitDialog();
m_si->pDlg = this;
NotifyLocalWinEvent(m_hContact, m_hwnd, MSG_WINDOW_EVT_OPENING);
@@ -797,8 +797,6 @@ LRESULT CChatRoomDlg::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam)
LRESULT CChatRoomDlg::WndProc_Log(UINT msg, WPARAM wParam, LPARAM lParam)
{
- static BOOL inMenu = FALSE;
-
int result = InputAreaShortcuts(m_log.GetHwnd(), msg, wParam, lParam);
if (result != -1)
return result;
@@ -813,13 +811,6 @@ LRESULT CChatRoomDlg::WndProc_Log(UINT msg, WPARAM wParam, LPARAM lParam)
case WM_DRAWITEM:
return DrawMenuItem(wParam, lParam);
- case WM_SETCURSOR:
- if (inMenu) {
- SetCursor(LoadCursor(nullptr, IDC_ARROW));
- return TRUE;
- }
- break;
-
case WM_LBUTTONUP:
SendMessage(m_log.GetHwnd(), EM_EXGETSEL, 0, (LPARAM)&sel);
if (sel.cpMin != sel.cpMax) {
@@ -829,71 +820,6 @@ LRESULT CChatRoomDlg::WndProc_Log(UINT msg, WPARAM wParam, LPARAM lParam)
}
SetFocus(m_message.GetHwnd());
break;
-
- case WM_CONTEXTMENU:
- POINT pt;
- POINTL ptl;
- m_message.SendMsg(EM_EXGETSEL, 0, (LPARAM)&sel);
- if (lParam == 0xFFFFFFFF) {
- m_message.SendMsg(EM_POSFROMCHAR, (WPARAM)&pt, (LPARAM)sel.cpMax);
- ClientToScreen(m_log.GetHwnd(), &pt);
- }
- else {
- pt.x = GET_X_LPARAM(lParam);
- pt.y = GET_Y_LPARAM(lParam);
- }
- ptl.x = (LONG)pt.x;
- ptl.y = (LONG)pt.y;
- ScreenToClient(m_log.GetHwnd(), (LPPOINT)&ptl);
- {
- ptrW pszWord(GetRichTextWord(m_log.GetHwnd(), &ptl));
- inMenu = TRUE;
-
- CHARRANGE all = { 0, -1 };
- HMENU hMenu = GetSubMenu(g_hMenu, 1);
- UINT uID = Chat_CreateGCMenu(m_log.GetHwnd(), hMenu, pt, m_si, nullptr, pszWord);
- inMenu = FALSE;
- switch (uID) {
- case 0:
- PostMessage(m_hwnd, WM_MOUSEACTIVATE, 0, 0);
- break;
-
- case ID_COPYALL:
- m_message.SendMsg(EM_EXGETSEL, 0, (LPARAM)&sel);
- m_message.SendMsg(EM_EXSETSEL, 0, (LPARAM)&all);
- m_message.SendMsg(WM_COPY, 0, 0);
- m_message.SendMsg(EM_EXSETSEL, 0, (LPARAM)&sel);
- PostMessage(m_hwnd, WM_MOUSEACTIVATE, 0, 0);
- break;
-
- case IDM_CLEAR:
- m_log.SetText(L"");
- pci->LM_RemoveAll(&m_si->pLog, &m_si->pLogEnd);
- m_si->iEventCount = 0;
- m_si->LastTime = 0;
- PostMessage(m_hwnd, WM_MOUSEACTIVATE, 0, 0);
- break;
-
- case IDM_SEARCH_GOOGLE:
- case IDM_SEARCH_BING:
- case IDM_SEARCH_YANDEX:
- case IDM_SEARCH_YAHOO:
- case IDM_SEARCH_WIKIPEDIA:
- case IDM_SEARCH_FOODNETWORK:
- case IDM_SEARCH_GOOGLE_MAPS:
- case IDM_SEARCH_GOOGLE_TRANSLATE:
- SearchWord(pszWord, uID - IDM_SEARCH_GOOGLE + SEARCHENGINE_GOOGLE);
- PostMessage(m_hwnd, WM_MOUSEACTIVATE, 0, 0);
- break;
-
- default:
- PostMessage(m_hwnd, WM_MOUSEACTIVATE, 0, 0);
- DoEventHook(GC_USER_LOGMENU, nullptr, nullptr, uID);
- break;
- }
- Chat_DestroyGCMenu(hMenu, 5);
- }
- break;
}
return CSuper::WndProc_Log(msg, wParam, lParam);
@@ -908,56 +834,6 @@ LRESULT CChatRoomDlg::WndProc_Nicklist(UINT msg, WPARAM wParam, LPARAM lParam)
return result;
switch (msg) {
- case WM_CONTEXTMENU:
- {
- int height = 0;
-
- TVHITTESTINFO hti;
- hti.pt.x = GET_X_LPARAM(lParam);
- hti.pt.y = GET_Y_LPARAM(lParam);
- if (hti.pt.x == -1 && hti.pt.y == -1) {
- int index = m_nickList.SendMsg(LB_GETCURSEL, 0, 0);
- int top = m_nickList.SendMsg(LB_GETTOPINDEX, 0, 0);
- height = m_nickList.SendMsg(LB_GETITEMHEIGHT, 0, 0);
- hti.pt.x = 4;
- hti.pt.y = (index - top)*height + 1;
- }
- else ScreenToClient(m_nickList.GetHwnd(), &hti.pt);
-
- int item = m_nickList.SendMsg(LB_ITEMFROMPOINT, 0, MAKELPARAM(hti.pt.x, hti.pt.y));
- if (HIWORD(item) == 1)
- item = -1;
- else
- item &= 0xFFFF;
-
- USERINFO *ui = pci->SM_GetUserFromIndex(m_si->ptszID, m_si->pszModule, item);
- if (ui) {
- HMENU hMenu = GetSubMenu(g_hMenu, 0);
- USERINFO uinew;
- memcpy(&uinew, ui, sizeof(USERINFO));
- if (hti.pt.x == -1 && hti.pt.y == -1)
- hti.pt.y += height - 4;
- ClientToScreen(m_nickList.GetHwnd(), &hti.pt);
- UINT uID = Chat_CreateGCMenu(m_nickList.GetHwnd(), hMenu, hti.pt, m_si, uinew.pszUID, uinew.pszNick);
-
- switch (uID) {
- case 0:
- break;
-
- case ID_MESS:
- DoEventHook(GC_USER_PRIVMESS, ui, nullptr, 0);
- break;
-
- default:
- DoEventHook(GC_USER_NICKLISTMENU, ui, nullptr, uID);
- break;
- }
- Chat_DestroyGCMenu(hMenu, 1);
- return TRUE;
- }
- }
- break;
-
case WM_GETDLGCODE:
{
BOOL isAlt = GetKeyState(VK_MENU) & 0x8000;
@@ -1251,7 +1127,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
}
break;
}
- return CScriverWindow::DlgProc(uMsg, wParam, lParam);
+ return CSuper::DlgProc(uMsg, wParam, lParam);
}
void ShowRoom(SESSION_INFO *si)
diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp
index c51e8da8f2..7968f3da0c 100644
--- a/plugins/Scriver/src/msgdialog.cpp
+++ b/plugins/Scriver/src/msgdialog.cpp
@@ -215,7 +215,7 @@ CSrmmWindow::CSrmmWindow(MCONTACT hContact, bool bIncoming, const char *szInitia
void CSrmmWindow::OnInitDialog()
{
- CScriverWindow::OnInitDialog();
+ CSuper::OnInitDialog();
SetWindowLongPtr(m_hwnd, GWLP_USERDATA, (LONG_PTR)this);
WindowList_Add(pci->hWindowList, m_hwnd, m_hContact);
@@ -997,9 +997,9 @@ LRESULT CSrmmWindow::WndProc_Log(UINT msg, WPARAM wParam, LPARAM lParam)
pt.y = GET_Y_LPARAM(lParam);
}
- POINTL ptl = { (LONG)pt.x, (LONG)pt.y };
- ScreenToClient(m_message.GetHwnd(), (LPPOINT)&ptl);
- ptrW pszWord(GetRichTextWord(m_message.GetHwnd(), &ptl));
+ POINT ptl = pt;
+ ScreenToClient(m_log.GetHwnd(), &ptl);
+ ptrW pszWord(GetRichTextWord(m_log.GetHwnd(), &ptl));
if (pszWord && pszWord[0]) {
wchar_t szMenuText[4096];
mir_snwprintf(szMenuText, TranslateT("Look up '%s':"), pszWord);
@@ -1009,7 +1009,7 @@ LRESULT CSrmmWindow::WndProc_Log(UINT msg, WPARAM wParam, LPARAM lParam)
else ModifyMenu(hSubMenu, 5, MF_STRING | MF_GRAYED | MF_BYPOSITION, 5, TranslateT("No word to look up"));
inMenu = TRUE;
- int uID = TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, m_message.GetHwnd(), nullptr);
+ int uID = TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, m_log.GetHwnd(), nullptr);
inMenu = FALSE;
switch (uID) {
@@ -1743,5 +1743,5 @@ INT_PTR CSrmmWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
break;
}
- return CScriverWindow::DlgProc(msg, wParam, lParam);
+ return CSuper::DlgProc(msg, wParam, lParam);
}
diff --git a/plugins/Scriver/src/msgs.cpp b/plugins/Scriver/src/msgs.cpp
index b8426c8924..6e1f443b8a 100644
--- a/plugins/Scriver/src/msgs.cpp
+++ b/plugins/Scriver/src/msgs.cpp
@@ -590,8 +590,6 @@ int OnSystemPreshutdown(WPARAM, LPARAM)
int OnUnloadModule(void)
{
- Chat_Unload();
-
DestroyCursor(hDragCursor);
DestroyHookableEvent(hHookWinEvt);
diff --git a/plugins/Scriver/src/resource.h b/plugins/Scriver/src/resource.h
index 140bbdb351..7966a71277 100644
--- a/plugins/Scriver/src/resource.h
+++ b/plugins/Scriver/src/resource.h
@@ -60,7 +60,6 @@
#define IDI_ADDSTATUS 441
#define IDI_REMSTATUS 442
#define IDI_ACTION 443
-#define IDR_MENU 451
#define IDI_STATUS3 453
#define IDI_STATUS2 454
#define IDI_STATUS4 455
diff --git a/plugins/Scriver/src/stdafx.h b/plugins/Scriver/src/stdafx.h
index c276c7e0fa..cd4c800ef1 100644
--- a/plugins/Scriver/src/stdafx.h
+++ b/plugins/Scriver/src/stdafx.h
@@ -91,7 +91,6 @@ extern HWND SM_FindWindowByContact(MCONTACT hContact);
extern HINSTANCE g_hInst;
extern HCURSOR hDragCursor;
extern ITaskbarList3 *pTaskbarInterface;
-extern HMENU g_hMenu;
extern HANDLE hHookWinPopup, hHookWinWrite, hHookWinEvt;
void ChangeStatusIcons();
@@ -106,7 +105,6 @@ void LoadInfobarFonts();
#define INFO_BAR_COLOR COLOR_INACTIVEBORDER
int Chat_Load();
-int Chat_Unload();
int OptInitialise(WPARAM wParam, LPARAM lParam);
int FontServiceFontsChanged(WPARAM wParam, LPARAM lParam);
int StatusIconPressed(WPARAM wParam, LPARAM lParam);
diff --git a/plugins/Scriver/src/utils.cpp b/plugins/Scriver/src/utils.cpp
index aabc26d15f..ddc542ad38 100644
--- a/plugins/Scriver/src/utils.cpp
+++ b/plugins/Scriver/src/utils.cpp
@@ -136,7 +136,7 @@ wchar_t* limitText(wchar_t *text, int limit)
return text;
}
-wchar_t* GetRichTextWord(HWND hwnd, POINTL *ptl)
+wchar_t* GetRichTextWord(HWND hwnd, POINT *ptl)
{
long iCharIndex, start, end, iRes;
wchar_t *pszWord = GetRichEditSelection(hwnd);
diff --git a/plugins/Scriver/src/utils.h b/plugins/Scriver/src/utils.h
index bf01163431..ba88ea469d 100644
--- a/plugins/Scriver/src/utils.h
+++ b/plugins/Scriver/src/utils.h
@@ -40,7 +40,7 @@ int GetRichTextLength(HWND hwnd, int codepage, BOOL inBytes);
wchar_t *GetRichEditSelection(HWND hwnd);
char* GetRichTextRTF(HWND hwnd);
char* GetRichTextUtf(HWND hwnd);
-wchar_t *GetRichTextWord(HWND hwnd, POINTL *pt);
+wchar_t *GetRichTextWord(HWND hwnd, POINT *pt);
int SetRichText(HWND hwnd, const wchar_t *text);
int SetRichTextRTF(HWND hwnd, const char *text);
void SearchWord(wchar_t * word, int engine);
diff --git a/plugins/TabSRMM/res/chat.rc b/plugins/TabSRMM/res/chat.rc
index 08439df081..85eed25154 100644
--- a/plugins/TabSRMM/res/chat.rc
+++ b/plugins/TabSRMM/res/chat.rc
@@ -313,58 +313,6 @@ END
#endif // APSTUDIO_INVOKED
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Menu
-//
-
-IDR_MENU MENU
-BEGIN
- POPUP "List"
- BEGIN
- MENUITEM "&Message", ID_MESS
- END
- POPUP "Log"
- BEGIN
- MENUITEM "Clear lo&g", ID_CLEARLOG
- MENUITEM SEPARATOR
- MENUITEM "Co&py all", ID_COPYALL
- MENUITEM SEPARATOR
- POPUP "Word lookup", GRAYED
- BEGIN
- MENUITEM "Google", ID_SEARCH_GOOGLE
- MENUITEM "Wikipedia", ID_SEARCH_WIKIPEDIA
- END
- END
- POPUP "Link"
- BEGIN
- MENUITEM "Open a &new browser window", ID_NEW
- MENUITEM "&Open in current browser window", ID_CURR
- MENUITEM "&Copy link", ID_COPY
- END
- MENUITEM "", 65535
- POPUP "Message"
- BEGIN
- MENUITEM "Undo", ID_MESSAGE_UNDO, GRAYED
- MENUITEM "Redo", ID_MESSAGE_REDO, GRAYED
- MENUITEM SEPARATOR
- MENUITEM "Copy", ID_MESSAGE_COPY, GRAYED
- MENUITEM "Cut", ID_MESSAGE_CUT, GRAYED
- MENUITEM "Paste", ID_MESSAGE_PASTE
- MENUITEM "Select all", ID_MESSAGE_SELECTALL
- MENUITEM SEPARATOR
- MENUITEM "Clear", ID_MESSAGE_CLEAR
- END
- POPUP "Tabs"
- BEGIN
- MENUITEM "&Close tab", ID_CLOSE
- MENUITEM "C&lose other tabs", ID_CLOSEOTHER
- MENUITEM SEPARATOR
- MENUITEM "&Open at this position", ID_LOCKPOSITION
- END
-END
-
#endif // Neutral resources
/////////////////////////////////////////////////////////////////////////////
diff --git a/plugins/TabSRMM/src/chat_main.cpp b/plugins/TabSRMM/src/chat_main.cpp
index bbc0162b93..3961448ba6 100644
--- a/plugins/TabSRMM/src/chat_main.cpp
+++ b/plugins/TabSRMM/src/chat_main.cpp
@@ -29,7 +29,6 @@
#include "stdafx.h"
HANDLE g_hWindowList;
-HMENU g_hMenu = nullptr;
pfnDoPopup oldDoPopup, oldLogToFile;
pfnDoTrayIcon oldDoTrayIcon;
@@ -222,6 +221,28 @@ static int OnCreateGCMenu(WPARAM, LPARAM lParam)
return 0;
}
+static int OnHandleGCMenu(WPARAM, LPARAM lParam)
+{
+ GCHOOK *gch = (GCHOOK*)lParam;
+ if (!gch)
+ return 1;
+
+ if (gch->dwData == 20020) { // add to highlight...
+ SESSION_INFO *si = pci->SM_FindSession(gch->pDest->ptszID, gch->pDest->pszModule);
+ THighLightEdit the = { THighLightEdit::CMD_ADD, si, pci->UM_FindUser(si->pUsers, gch->ptszUID) };
+ HWND hwndParent = si->pDlg->m_pContainer->m_hwnd;
+ HWND hwndDlg = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_ADDHIGHLIGHT), hwndParent, CMUCHighlight::dlgProcAdd, (LPARAM)&the);
+ TranslateDialogDefault(hwndDlg);
+
+ RECT rc, rcWnd;
+ GetClientRect(hwndParent, &rcWnd);
+ GetWindowRect(hwndDlg, &rc);
+ SetWindowPos(hwndDlg, HWND_TOP, (rcWnd.right - (rc.right - rc.left)) / 2, (rcWnd.bottom - (rc.bottom - rc.top)) / 2, 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW);
+ }
+
+ return 0;
+}
+
// load the module
int Chat_Load()
{
@@ -253,8 +274,7 @@ int Chat_Load()
pci->UM_CompareItem = UM_CompareItem;
pci->ReloadSettings();
- g_hMenu = LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_MENU));
-
+ HookEvent(ME_GC_EVENT, OnHandleGCMenu);
HookEvent(ME_GC_BUILDMENU, OnCreateGCMenu);
g_Settings.Highlight = new CMUCHighlight();
return 0;
@@ -271,7 +291,5 @@ int Chat_Unload(void)
DeleteObject(g_Settings.UserListFonts[i]);
delete g_Settings.Highlight;
-
- DestroyMenu(g_hMenu);
return 0;
}
diff --git a/plugins/TabSRMM/src/chat_resource.h b/plugins/TabSRMM/src/chat_resource.h
index 1142bf12b6..cd6cb2064b 100644
--- a/plugins/TabSRMM/src/chat_resource.h
+++ b/plugins/TabSRMM/src/chat_resource.h
@@ -2,7 +2,6 @@
// Microsoft Visual C++ generated include file.
// Used by chat.rc
//
-#define IDR_MENU 151
#define IDD_CHANNEL 401
#define IDD_OPTIONS1 402
#define IDD_OPTIONS2 403
diff --git a/plugins/TabSRMM/src/chat_window.cpp b/plugins/TabSRMM/src/chat_window.cpp
index b92e24d9cf..2a1e14e380 100644
--- a/plugins/TabSRMM/src/chat_window.cpp
+++ b/plugins/TabSRMM/src/chat_window.cpp
@@ -35,8 +35,6 @@ extern HRESULT(WINAPI *MyCloseThemeData)(HANDLE);
int g_cLinesPerPage = 0;
int g_iWheelCarryover = 0;
-extern HMENU g_hMenu;
-
static HKL hkl = nullptr;
char szIndicators[] = { 0, '+', '%', '@', '!', '*' };
@@ -1564,68 +1562,6 @@ LRESULT CChatRoomDlg::WndProc_Nicklist(UINT msg, WPARAM wParam, LPARAM lParam)
}
}
break;
-
- case WM_CONTEXTMENU:
- {
- int height = 0;
- TVHITTESTINFO hti;
- hti.pt.x = GET_X_LPARAM(lParam);
- hti.pt.y = GET_Y_LPARAM(lParam);
- if (hti.pt.x == -1 && hti.pt.y == -1) {
- int index = m_nickList.SendMsg(LB_GETCURSEL, 0, 0);
- int top = m_nickList.SendMsg(LB_GETTOPINDEX, 0, 0);
- height = m_nickList.SendMsg(LB_GETITEMHEIGHT, 0, 0);
- hti.pt.x = 4;
- hti.pt.y = (index - top) * height + 1;
- }
- else ScreenToClient(m_nickList.GetHwnd(), &hti.pt);
-
- int item = m_nickList.SendMsg(LB_ITEMFROMPOINT, 0, MAKELPARAM(hti.pt.x, hti.pt.y));
- if (HIWORD(item) == 1)
- item = -1;
- else
- item &= 0xFFFF;
-
- USERINFO *ui = pci->SM_GetUserFromIndex(m_si->ptszID, m_si->pszModule, item);
- if (ui) {
- HMENU hMenu = GetSubMenu(g_hMenu, 0);
- USERINFO uinew;
- memcpy(&uinew, ui, sizeof(USERINFO));
- if (hti.pt.x == -1 && hti.pt.y == -1)
- hti.pt.y += height - 4;
- ClientToScreen(m_nickList.GetHwnd(), &hti.pt);
-
- UINT uID = Chat_CreateGCMenu(m_nickList.GetHwnd(), hMenu, hti.pt, m_si, uinew.pszUID, uinew.pszNick);
- switch (uID) {
- case 0:
- break;
-
- case 20020: // add to highlight...
- {
- THighLightEdit the = { THighLightEdit::CMD_ADD, m_si, ui };
- HWND hwndDlg = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_ADDHIGHLIGHT), m_pContainer->m_hwnd, CMUCHighlight::dlgProcAdd, (LPARAM)&the);
- TranslateDialogDefault(hwndDlg);
-
- RECT rc, rcWnd;
- GetClientRect(m_pContainer->m_hwnd, &rcWnd);
- GetWindowRect(hwndDlg, &rc);
- SetWindowPos(hwndDlg, HWND_TOP, (rcWnd.right - (rc.right - rc.left)) / 2, (rcWnd.bottom - (rc.bottom - rc.top)) / 2, 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW);
- }
- break;
-
- case ID_MESS:
- DoEventHook(GC_USER_PRIVMESS, ui, nullptr, 0);
- break;
-
- default:
- DoEventHook(GC_USER_NICKLISTMENU, ui, nullptr, uID);
- break;
- }
- Chat_DestroyGCMenu(hMenu, 1);
- return TRUE;
- }
- }
- break;
}
return CSuper::WndProc_Nicklist(msg, wParam, lParam);
@@ -2117,86 +2053,8 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
}
}
- 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);
- ClientToScreen(((LPNMHDR)lParam)->hwndFrom, &pt);
-
- // fixing stuff for searches
- wchar_t *pszWord = (wchar_t*)_alloca(8192);
- pszWord[0] = '\0';
- POINTL ptl = { pt.x, pt.y };
- ScreenToClient(m_log.GetHwnd(), (LPPOINT)&ptl);
- int iCharIndex = m_log.SendMsg(EM_CHARFROMPOS, 0, (LPARAM)&ptl);
- if (iCharIndex < 0)
- break;
-
- int start = m_log.SendMsg(EM_FINDWORDBREAK, WB_LEFT, iCharIndex);
- int end = m_log.SendMsg(EM_FINDWORDBREAK, WB_RIGHT, iCharIndex);
-
- if (end - start > 0) {
- static char szTrimString[] = ":;,.!?\'\"><()[]- \r\n";
-
- CHARRANGE cr;
- cr.cpMin = start;
- cr.cpMax = end;
-
- TEXTRANGE tr = { 0 };
- tr.chrg = cr;
- tr.lpstrText = (wchar_t*)pszWord;
- int iRes = m_log.SendMsg(EM_GETTEXTRANGE, 0, (LPARAM)&tr);
-
- if (iRes > 0) {
- size_t iLen = mir_wstrlen(pszWord) - 1;
- while (strchr(szTrimString, pszWord[iLen])) {
- pszWord[iLen] = '\0';
- iLen--;
- }
- }
- }
-
- HMENU hMenu = GetSubMenu(g_hMenu, 1);
- UINT uID = Chat_CreateGCMenu(m_log.GetHwnd(), hMenu, pt, m_si, nullptr, pszWord);
- switch (uID) {
- case 0:
- PostMessage(m_hwnd, WM_MOUSEACTIVATE, 0, 0);
- break;
-
- case ID_COPYALL:
- SendMessage(((LPNMHDR)lParam)->hwndFrom, EM_EXGETSEL, 0, (LPARAM)&sel);
- SendMessage(((LPNMHDR)lParam)->hwndFrom, EM_EXSETSEL, 0, (LPARAM)&all);
- SendMessage(((LPNMHDR)lParam)->hwndFrom, WM_COPY, 0, 0);
- SendMessage(((LPNMHDR)lParam)->hwndFrom, EM_EXSETSEL, 0, (LPARAM)&sel);
- PostMessage(m_hwnd, WM_MOUSEACTIVATE, 0, 0);
- break;
-
- case ID_CLEARLOG:
- tabClearLog();
- break;
-
- case ID_SEARCH_GOOGLE:
- if (pszWord[0])
- Utils_OpenUrlW(CMStringW(FORMAT, L"http://www.google.com/search?q=%s", pszWord));
-
- PostMessage(m_hwnd, WM_MOUSEACTIVATE, 0, 0);
- break;
-
- case ID_SEARCH_WIKIPEDIA:
- if (pszWord[0])
- Utils_OpenUrlW(CMStringW(FORMAT, L"http://en.wikipedia.org/wiki/%s", pszWord));
-
- PostMessage(m_hwnd, WM_MOUSEACTIVATE, 0, 0);
- break;
-
- default:
- PostMessage(m_hwnd, WM_MOUSEACTIVATE, 0, 0);
- DoEventHook(GC_USER_LOGMENU, nullptr, nullptr, (LPARAM)uID);
- break;
- }
-
- Chat_DestroyGCMenu(hMenu, 5);
- }
+ if (((LPNMHDR)lParam)->idFrom == IDC_SRMM_LOG && ((MSGFILTER *)lParam)->msg == WM_RBUTTONUP)
+ return _dlgReturn(m_hwnd, 1);
}
break;
@@ -2230,8 +2088,6 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
// clicked a nick name
if (g_Settings.bClickableNicks) {
if (msg == WM_RBUTTONDOWN) {
- HMENU hMenu = GetSubMenu(g_hMenu, 0);
-
for (USERINFO *ui = m_si->pUsers; ui; ui = ui->next) {
if (mir_wstrcmp(ui->pszNick, tr.lpstrText))
continue;
@@ -2239,23 +2095,8 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
pt.x = (short)LOWORD(((ENLINK*)lParam)->lParam);
pt.y = (short)HIWORD(((ENLINK*)lParam)->lParam);
ClientToScreen(((NMHDR*)lParam)->hwndFrom, &pt);
- USERINFO uiNew;
- memcpy(&uiNew, ui, sizeof(USERINFO));
- UINT uID = Chat_CreateGCMenu(m_hwnd, hMenu, pt, m_si, uiNew.pszUID, uiNew.pszNick);
- switch (uID) {
- case 0:
- break;
-
- case ID_MESS:
- DoEventHook(GC_USER_PRIVMESS, ui, nullptr, 0);
- break;
-
- default:
- DoEventHook(GC_USER_NICKLISTMENU, ui, nullptr, (LPARAM)uID);
- break;
- }
- Chat_DestroyGCMenu(hMenu, 1);
- return TRUE;
+ RunUserMenu(m_hwnd, ui, pt);
+ break;
}
return TRUE;
}
diff --git a/plugins/TabSRMM/src/stdafx.h b/plugins/TabSRMM/src/stdafx.h
index c458b0ab28..b8af3d7540 100644
--- a/plugins/TabSRMM/src/stdafx.h
+++ b/plugins/TabSRMM/src/stdafx.h
@@ -234,7 +234,6 @@ extern char *TemplateNames[];
extern HANDLE hUserPrefsWindowList;
extern TCpTable cpTable[];
extern HMODULE g_hIconDLL;
-extern HMENU g_hMenu;
extern bool g_bShutdown;
extern pfnDoPopup oldDoPopup, oldLogToFile;
diff --git a/src/core/stdmsg/res/resource.rc b/src/core/stdmsg/res/resource.rc
index 7893ed2b21..6ac278411b 100644
--- a/src/core/stdmsg/res/resource.rc
+++ b/src/core/stdmsg/res/resource.rc
@@ -527,22 +527,6 @@ IDC_DROPUSER CURSOR "dropuser.cur"
IDR_MENU MENU
BEGIN
- POPUP "List"
- BEGIN
- MENUITEM "&Message", ID_MESS
- END
- POPUP "Log"
- BEGIN
- MENUITEM "Clear lo&g", ID_CLEARLOG
- MENUITEM SEPARATOR
- MENUITEM "Co&py all", ID_COPYALL
- MENUITEM SEPARATOR
- POPUP "Word lookup", GRAYED
- BEGIN
- MENUITEM "Google", ID_SEARCH_GOOGLE
- MENUITEM "Wikipedia", ID_SEARCH_WIKIPEDIA
- END
- END
POPUP "Message"
BEGIN
MENUITEM "Undo", ID_MESSAGE_UNDO, GRAYED
diff --git a/src/core/stdmsg/src/chat_window.cpp b/src/core/stdmsg/src/chat_window.cpp
index cbb246e241..725a92e71b 100644
--- a/src/core/stdmsg/src/chat_window.cpp
+++ b/src/core/stdmsg/src/chat_window.cpp
@@ -873,7 +873,7 @@ LRESULT CChatRoomDlg::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam)
case WM_RBUTTONDOWN:
{
- HMENU hSubMenu = GetSubMenu(g_hMenu, 2);
+ HMENU hSubMenu = GetSubMenu(g_hMenu, 0);
TranslateMenu(hSubMenu);
m_message.SendMsg(EM_EXGETSEL, 0, (LPARAM)&sel);
@@ -977,50 +977,6 @@ LRESULT CChatRoomDlg::WndProc_Nicklist(UINT msg, WPARAM wParam, LPARAM lParam)
return TRUE;
}
break;
-
- case WM_CONTEXTMENU:
- TVHITTESTINFO hti;
- {
- int height = 0;
- hti.pt.x = GET_X_LPARAM(lParam);
- hti.pt.y = GET_Y_LPARAM(lParam);
- if (hti.pt.x == -1 && hti.pt.y == -1) {
- int index = m_nickList.SendMsg(LB_GETCURSEL, 0, 0);
- int top = m_nickList.SendMsg(LB_GETTOPINDEX, 0, 0);
- height = m_nickList.SendMsg(LB_GETITEMHEIGHT, 0, 0);
- hti.pt.x = 4;
- hti.pt.y = (index - top)*height + 1;
- }
- else ScreenToClient(m_nickList.GetHwnd(), &hti.pt);
-
- int item = LOWORD(m_nickList.SendMsg(LB_ITEMFROMPOINT, 0, MAKELPARAM(hti.pt.x, hti.pt.y)));
- USERINFO *ui = pci->SM_GetUserFromIndex(m_si->ptszID, m_si->pszModule, item);
- if (ui) {
- USERINFO uinew;
- memcpy(&uinew, ui, sizeof(USERINFO));
- if (hti.pt.x == -1 && hti.pt.y == -1)
- hti.pt.y += height - 4;
- ClientToScreen(m_nickList.GetHwnd(), &hti.pt);
-
- HMENU hMenu = GetSubMenu(g_hMenu, 0);
- UINT uID = Chat_CreateGCMenu(m_nickList.GetHwnd(), hMenu, hti.pt, m_si, uinew.pszUID, uinew.pszNick);
- switch (uID) {
- case 0:
- break;
-
- case ID_MESS:
- DoEventHook(GC_USER_PRIVMESS, ui, nullptr, 0);
- break;
-
- default:
- DoEventHook(GC_USER_NICKLISTMENU, ui, nullptr, uID);
- break;
- }
- Chat_DestroyGCMenu(hMenu, 1);
- return TRUE;
- }
- }
- break;
}
return CSuper::WndProc_Nicklist(msg, wParam, lParam);
@@ -1030,9 +986,6 @@ LRESULT CChatRoomDlg::WndProc_Nicklist(UINT msg, WPARAM wParam, LPARAM lParam)
INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- SESSION_INFO *s;
- CHARRANGE sel;
-
switch (uMsg) {
case WM_CBD_LOADICONS:
Srmm_UpdateToolbarIcons(m_hwnd);
@@ -1210,85 +1163,8 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
switch (((LPNMHDR)lParam)->code) {
case EN_MSGFILTER:
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);
-
- // fixing stuff for searches
- POINTL ptl = { (LONG)pt.x, (LONG)pt.y };
- ScreenToClient(m_log.GetHwnd(), (LPPOINT)&ptl);
- long iCharIndex = m_log.SendMsg(EM_CHARFROMPOS, 0, (LPARAM)&ptl);
- if (iCharIndex < 0)
- break;
-
- long start = m_log.SendMsg(EM_FINDWORDBREAK, WB_LEFT, iCharIndex);//-iChars;
- long end = m_log.SendMsg(EM_FINDWORDBREAK, WB_RIGHT, iCharIndex);//-iChars;
-
- wchar_t pszWord[4096]; pszWord[0] = '\0';
- if (end - start > 0) {
- TEXTRANGE tr;
- tr.lpstrText = pszWord;
- tr.chrg.cpMin = start;
- tr.chrg.cpMax = end;
- long iRes = m_log.SendMsg(EM_GETTEXTRANGE, 0, (LPARAM)&tr);
- if (pszWord[0] == 0)
- break;
- if (iRes > 0)
- for (size_t iLen = mir_wstrlen(pszWord) - 1; wcschr(szTrimString, pszWord[iLen]); iLen--)
- pszWord[iLen] = 0;
- }
-
- CHARRANGE all = { 0, -1 };
- HMENU hMenu = GetSubMenu(g_hMenu, 1);
- UINT uID = Chat_CreateGCMenu(m_log.GetHwnd(), hMenu, pt, m_si, nullptr, pszWord);
- switch (uID) {
- case 0:
- PostMessage(m_hwnd, WM_MOUSEACTIVATE, 0, 0);
- break;
-
- case ID_COPYALL:
- SendMessage(((LPNMHDR)lParam)->hwndFrom, EM_EXGETSEL, 0, (LPARAM)&sel);
- SendMessage(((LPNMHDR)lParam)->hwndFrom, EM_EXSETSEL, 0, (LPARAM)&all);
- SendMessage(((LPNMHDR)lParam)->hwndFrom, WM_COPY, 0, 0);
- SendMessage(((LPNMHDR)lParam)->hwndFrom, EM_EXSETSEL, 0, (LPARAM)&sel);
- PostMessage(m_hwnd, WM_MOUSEACTIVATE, 0, 0);
- break;
-
- case ID_CLEARLOG:
- s = pci->SM_FindSession(m_si->ptszID, m_si->pszModule);
- if (s) {
- ClearLog();
- pci->LM_RemoveAll(&s->pLog, &s->pLogEnd);
- s->iEventCount = 0;
- s->LastTime = 0;
- m_si->iEventCount = 0;
- m_si->LastTime = 0;
- m_si->pLog = s->pLog;
- m_si->pLogEnd = s->pLogEnd;
- PostMessage(m_hwnd, WM_MOUSEACTIVATE, 0, 0);
- }
- break;
-
- case ID_SEARCH_GOOGLE:
- if (pszWord[0])
- Utils_OpenUrlW(CMStringW(FORMAT, L"http://www.google.com/search?q=%s", pszWord));
-
- PostMessage(m_hwnd, WM_MOUSEACTIVATE, 0, 0);
- break;
-
- case ID_SEARCH_WIKIPEDIA:
- if (pszWord[0])
- Utils_OpenUrlW(CMStringW(FORMAT, L"http://en.wikipedia.org/wiki/%s", pszWord));
-
- PostMessage(m_hwnd, WM_MOUSEACTIVATE, 0, 0);
- break;
-
- default:
- PostMessage(m_hwnd, WM_MOUSEACTIVATE, 0, 0);
- DoEventHook(GC_USER_LOGMENU, nullptr, nullptr, uID);
- break;
- }
- Chat_DestroyGCMenu(hMenu, 5);
+ SetWindowLongPtr(m_hwnd, DWLP_MSGRESULT, TRUE);
+ return TRUE;
}
break;
diff --git a/src/core/stdmsg/src/tabs.cpp b/src/core/stdmsg/src/tabs.cpp
index b3f9574f52..e12a1c2495 100644
--- a/src/core/stdmsg/src/tabs.cpp
+++ b/src/core/stdmsg/src/tabs.cpp
@@ -421,7 +421,7 @@ INT_PTR CTabbedWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
SESSION_INFO *si = ((CChatRoomDlg*)m_tab.GetNthPage(i))->m_si;
ClientToScreen(GetDlgItem(m_hwnd, IDC_TAB), &tci.pt);
- HMENU hSubMenu = GetSubMenu(g_hMenu, 3);
+ HMENU hSubMenu = GetSubMenu(g_hMenu, 1);
TranslateMenu(hSubMenu);
if (si) {
diff --git a/src/mir_app/res/resource.rc b/src/mir_app/res/resource.rc
index 113bde9218..7b9ac32d40 100644
--- a/src/mir_app/res/resource.rc
+++ b/src/mir_app/res/resource.rc
@@ -1304,6 +1304,34 @@ BEGIN
END
END
+IDR_SRMM MENU
+BEGIN
+ POPUP "List"
+ BEGIN
+ MENUITEM "&Message", IDM_SENDMESSAGE
+ END
+ POPUP "Log"
+ BEGIN
+ MENUITEM "Clear lo&g", IDM_CLEAR
+ MENUITEM SEPARATOR
+ MENUITEM "Co&py all", IDM_COPYALL
+ MENUITEM SEPARATOR
+ POPUP "Word lookup", GRAYED
+ BEGIN
+ MENUITEM "Google", IDM_SEARCH_GOOGLE
+ MENUITEM "Bing", IDM_SEARCH_BING
+ MENUITEM "Yandex", IDM_SEARCH_YANDEX
+ MENUITEM "Wikipedia (en)", IDM_SEARCH_WIKIPEDIA
+ MENUITEM SEPARATOR
+ MENUITEM "Google Maps", IDM_SEARCH_GOOGLE_MAPS
+ MENUITEM "Google Translate", IDM_SEARCH_GOOGLE_TRANSLATE
+ MENUITEM SEPARATOR
+ MENUITEM "Yahoo", IDM_SEARCH_YAHOO
+ MENUITEM "Foodnetwork", IDM_SEARCH_FOODNETWORK
+ END
+ END
+END
+
#endif // English (United States) resources
/////////////////////////////////////////////////////////////////////////////
diff --git a/src/mir_app/src/chat.h b/src/mir_app/src/chat.h
index cb7e26f97c..4a4b1acb14 100644
--- a/src/mir_app/src/chat.h
+++ b/src/mir_app/src/chat.h
@@ -38,6 +38,7 @@ extern int g_cbSession, g_cbModuleInfo, g_iFontMode, g_iChatLang;
extern wchar_t *g_szFontGroup;
extern mir_cs csChat;
+extern HMENU g_hMenu;
extern HCURSOR g_hCurHyperlinkHand;
extern char* pLogIconBmpBits[14];
extern LIST<SESSION_INFO> g_arSessions;
diff --git a/src/mir_app/src/chat_svc.cpp b/src/mir_app/src/chat_svc.cpp
index 3dc5539ce0..9434faed20 100644
--- a/src/mir_app/src/chat_svc.cpp
+++ b/src/mir_app/src/chat_svc.cpp
@@ -25,7 +25,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
INT_PTR SvcGetChatManager(WPARAM, LPARAM);
#include "chat.h"
+#include "resource.h"
+HMENU g_hMenu = nullptr;
HGENMENU hJoinMenuItem, hLeaveMenuItem;
mir_cs csChat;
@@ -783,6 +785,9 @@ int LoadChatModule(void)
HookEvent(ME_FONT_RELOAD, FontsChanged);
HookEvent(ME_SKIN2_ICONSCHANGED, IconsChanged);
+ g_hMenu = LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_SRMM));
+ TranslateMenu(g_hMenu);
+
bInited = true;
return 0;
}
@@ -803,4 +808,6 @@ void UnloadChatModule(void)
DestroyHookableEvent(chatApi.hSendEvent);
DestroyHookableEvent(chatApi.hBuildMenuEvent);
DestroyHookableEvent(hHookEvent);
+
+ DestroyMenu(g_hMenu);
}
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def
index 01e2359241..bce854eeef 100644
--- a/src/mir_app/src/mir_app64.def
+++ b/src/mir_app/src/mir_app64.def
@@ -439,3 +439,4 @@ Chat_UpdateOptions @418 NONAME
Chat_AddMenuItems @442 NONAME
Chat_DestroyGCMenu @443 NONAME
Chat_CreateGCMenu @444 NONAME
+?RunUserMenu@CSrmmBaseDialog@@IEAAXPEAUHWND__@@PEAUUSERINFO@@AEBUtagPOINT@@@Z @445 NONAME
diff --git a/src/mir_app/src/resource.h b/src/mir_app/src/resource.h
index a224363be6..5a56718d2d 100644
--- a/src/mir_app/src/resource.h
+++ b/src/mir_app/src/resource.h
@@ -34,6 +34,7 @@
#define IDI_INVISIBLE 130
#define IDI_NA 131
#define IDI_LOAD 132
+#define IDR_SRMM 133
#define IDD_OPT_SOUND 134
#define IDI_RECVMSG 136
#define IDI_URL 138
@@ -601,6 +602,14 @@
#define POPUP_DELETEGROUP 40053
#define ID_GROUP 40066
#define ID_UNGROUP 40067
+#define IDM_SEARCH_GOOGLE 40080
+#define IDM_SEARCH_BING 40081
+#define IDM_SEARCH_YANDEX 40082
+#define IDM_SEARCH_WIKIPEDIA 40083
+#define IDM_SEARCH_GOOGLE_MAPS 40084
+#define IDM_SEARCH_GOOGLE_TRANSLATE 40085
+#define IDM_SEARCH_YAHOO 40086
+#define IDM_SEARCH_FOODNETWORK 40087
// Next default values for new objects
//
diff --git a/src/mir_app/src/srmm_base.cpp b/src/mir_app/src/srmm_base.cpp
index d9e25d6c9d..d55a71ff53 100644
--- a/src/mir_app/src/srmm_base.cpp
+++ b/src/mir_app/src/srmm_base.cpp
@@ -24,6 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "stdafx.h"
#include "chat.h"
+#include "resource.h"
#include <m_history.h>
CSrmmBaseDialog::CSrmmBaseDialog(HINSTANCE hInst, int idDialog, SESSION_INFO *si)
@@ -92,6 +93,27 @@ CSrmmBaseDialog& CSrmmBaseDialog::operator=(const CSrmmBaseDialog&)
return *this;
}
+void CSrmmBaseDialog::RunUserMenu(HWND hwndOwner, USERINFO *ui, const POINT &pt)
+{
+ USERINFO uinew;
+ memcpy(&uinew, ui, sizeof(USERINFO));
+ HMENU hMenu = GetSubMenu(g_hMenu, 0);
+ UINT uID = Chat_CreateGCMenu(hwndOwner, hMenu, pt, m_si, uinew.pszUID, uinew.pszNick);
+ switch (uID) {
+ case 0:
+ break;
+
+ case IDM_SENDMESSAGE:
+ DoEventHook(GC_USER_PRIVMESS, ui, nullptr, 0);
+ break;
+
+ default:
+ DoEventHook(GC_USER_NICKLISTMENU, ui, nullptr, uID);
+ break;
+ }
+ Chat_DestroyGCMenu(hMenu, 1);
+}
+
/////////////////////////////////////////////////////////////////////////////////////////
static LRESULT CALLBACK Srmm_ButtonSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -136,10 +158,11 @@ static LRESULT CALLBACK stubLogProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l
LRESULT CSrmmBaseDialog::WndProc_Log(UINT msg, WPARAM wParam, LPARAM lParam)
{
+ CHARRANGE sel;
+
switch (msg) {
case WM_ACTIVATE:
if (LOWORD(wParam) == WA_INACTIVE) {
- CHARRANGE sel;
m_log.SendMsg(EM_EXGETSEL, 0, (LPARAM)&sel);
if (sel.cpMin != sel.cpMax) {
sel.cpMin = sel.cpMax;
@@ -152,6 +175,127 @@ LRESULT CSrmmBaseDialog::WndProc_Log(UINT msg, WPARAM wParam, LPARAM lParam)
SetFocus(m_message.GetHwnd());
m_message.SendMsg(WM_CHAR, wParam, lParam);
break;
+
+ case WM_CONTEXTMENU:
+ if (m_si == nullptr)
+ break;
+
+ POINT pt, ptl;
+ m_message.SendMsg(EM_EXGETSEL, 0, (LPARAM)&sel);
+ if (lParam == 0xFFFFFFFF) {
+ m_message.SendMsg(EM_POSFROMCHAR, (WPARAM)&pt, (LPARAM)sel.cpMax);
+ ClientToScreen(m_log.GetHwnd(), &pt);
+ }
+ else {
+ pt.x = GET_X_LPARAM(lParam);
+ pt.y = GET_Y_LPARAM(lParam);
+ }
+ ptl = pt;
+ ScreenToClient(m_log.GetHwnd(), (LPPOINT)&ptl);
+ {
+ wchar_t *pszWord = (wchar_t*)_alloca(8192);
+ pszWord[0] = '\0';
+
+ int iCharIndex = m_log.SendMsg(EM_CHARFROMPOS, 0, (LPARAM)&ptl);
+ if (iCharIndex < 0)
+ break;
+
+ int start = m_log.SendMsg(EM_FINDWORDBREAK, WB_LEFT, iCharIndex);
+ int end = m_log.SendMsg(EM_FINDWORDBREAK, WB_RIGHT, iCharIndex);
+
+ if (end - start > 0) {
+ static wchar_t szTrimString[] = L":;,.!?\'\"><()[]- \r\n";
+
+ CHARRANGE cr;
+ cr.cpMin = start;
+ cr.cpMax = end;
+
+ TEXTRANGE tr = { 0 };
+ tr.chrg = cr;
+ tr.lpstrText = (wchar_t*)pszWord;
+ int iRes = m_log.SendMsg(EM_GETTEXTRANGE, 0, (LPARAM)&tr);
+ if (iRes > 0) {
+ size_t iLen = mir_wstrlen(pszWord) - 1;
+ while (wcschr(szTrimString, pszWord[iLen])) {
+ pszWord[iLen] = '\0';
+ iLen--;
+ }
+ }
+ }
+
+ CHARRANGE all = { 0, -1 };
+ HMENU hMenu = GetSubMenu(g_hMenu, 1);
+ UINT uID = Chat_CreateGCMenu(m_log.GetHwnd(), hMenu, pt, m_si, nullptr, pszWord);
+ switch (uID) {
+ case 0:
+ PostMessage(m_hwnd, WM_MOUSEACTIVATE, 0, 0);
+ break;
+
+ case IDM_COPYALL:
+ m_message.SendMsg(EM_EXGETSEL, 0, (LPARAM)&sel);
+ m_message.SendMsg(EM_EXSETSEL, 0, (LPARAM)&all);
+ m_message.SendMsg(WM_COPY, 0, 0);
+ m_message.SendMsg(EM_EXSETSEL, 0, (LPARAM)&sel);
+ PostMessage(m_hwnd, WM_MOUSEACTIVATE, 0, 0);
+ break;
+
+ case IDM_CLEAR:
+ m_log.SetText(L"");
+ chatApi.LM_RemoveAll(&m_si->pLog, &m_si->pLogEnd);
+ m_si->iEventCount = 0;
+ m_si->LastTime = 0;
+ PostMessage(m_hwnd, WM_MOUSEACTIVATE, 0, 0);
+ break;
+
+ case IDM_SEARCH_GOOGLE:
+ case IDM_SEARCH_BING:
+ case IDM_SEARCH_YANDEX:
+ case IDM_SEARCH_YAHOO:
+ case IDM_SEARCH_WIKIPEDIA:
+ case IDM_SEARCH_FOODNETWORK:
+ case IDM_SEARCH_GOOGLE_MAPS:
+ case IDM_SEARCH_GOOGLE_TRANSLATE:
+ {
+ CMStringW szURL;
+ switch (uID) {
+ case IDM_SEARCH_WIKIPEDIA:
+ szURL.Format(L"http://en.wikipedia.org/wiki/%s", pszWord);
+ break;
+ case IDM_SEARCH_YAHOO:
+ szURL.Format(L"http://search.yahoo.com/search?p=%s&ei=UTF-8", pszWord);
+ break;
+ case IDM_SEARCH_FOODNETWORK:
+ szURL.Format(L"http://search.foodnetwork.com/search/delegate.do?fnSearchString=%s", pszWord);
+ break;
+ case IDM_SEARCH_BING:
+ szURL.Format(L"http://www.bing.com/search?q=%s&form=OSDSRC", pszWord);
+ break;
+ case IDM_SEARCH_GOOGLE_MAPS:
+ szURL.Format(L"http://maps.google.com/maps?q=%s&ie=utf-8&oe=utf-8", pszWord);
+ break;
+ case IDM_SEARCH_GOOGLE_TRANSLATE:
+ szURL.Format(L"http://translate.google.com/?q=%s&ie=utf-8&oe=utf-8", pszWord);
+ break;
+ case IDM_SEARCH_YANDEX:
+ szURL.Format(L"http://yandex.ru/yandsearch?text=%s", pszWord);
+ break;
+ case IDM_SEARCH_GOOGLE:
+ szURL.Format(L"http://www.google.com/search?q=%s&ie=utf-8&oe=utf-8", pszWord);
+ break;
+ }
+ Utils_OpenUrlW(szURL);
+ }
+ PostMessage(m_hwnd, WM_MOUSEACTIVATE, 0, 0);
+ break;
+
+ default:
+ PostMessage(m_hwnd, WM_MOUSEACTIVATE, 0, 0);
+ DoEventHook(GC_USER_LOGMENU, nullptr, nullptr, uID);
+ break;
+ }
+ Chat_DestroyGCMenu(hMenu, 5);
+ }
+ break;
}
return mir_callNextSubclass(m_log.GetHwnd(), stubLogProc, msg, wParam, lParam);
@@ -390,6 +534,34 @@ LRESULT CSrmmBaseDialog::WndProc_Nicklist(UINT msg, WPARAM wParam, LPARAM lParam
}
}
return 1;
+
+ case WM_CONTEXTMENU:
+ POINT pt;
+ {
+ int height = 0;
+ pt.x = GET_X_LPARAM(lParam);
+ pt.y = GET_Y_LPARAM(lParam);
+ if (pt.x == -1 && pt.y == -1) {
+ int index = m_nickList.GetCurSel();
+ int top = m_nickList.SendMsg(LB_GETTOPINDEX, 0, 0);
+ height = m_nickList.SendMsg(LB_GETITEMHEIGHT, 0, 0);
+ pt.x = 4;
+ pt.y = (index - top)*height + 1;
+ }
+ else ScreenToClient(m_nickList.GetHwnd(), &pt);
+
+ int item = LOWORD(m_nickList.SendMsg(LB_ITEMFROMPOINT, 0, MAKELPARAM(pt.x, pt.y)));
+ USERINFO *ui = chatApi.SM_GetUserFromIndex(m_si->ptszID, m_si->pszModule, item);
+ if (ui != nullptr) {
+ if (pt.x == -1 && pt.y == -1)
+ pt.y += height - 4;
+ ClientToScreen(m_nickList.GetHwnd(), &pt);
+
+ RunUserMenu(m_nickList.GetHwnd(), ui, pt);
+ return TRUE;
+ }
+ }
+ break;
}
return mir_callNextSubclass(m_nickList.GetHwnd(), stubNicklistProc, msg, wParam, lParam);