summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2019-09-16 16:34:08 +0300
committerGeorge Hazan <ghazan@miranda.im>2019-09-16 16:34:08 +0300
commitb1255c28dc19a3f13c4548019bb00e48a62d717d (patch)
treeca5d2bf5ef4dd017faf7b55690294fa17e94e8c4 /src
parent9dbd84f15e41fcda9d930995e12da8b33f5851c7 (diff)
SRMM:
- fixes #2066 (tabSRMM: chat menu remains wide after closing); - no need to export Chat_CreateGCMenu anymore; - useless function Chat_DestroyGCMenu removed
Diffstat (limited to 'src')
-rw-r--r--src/mir_app/res/resource.rc6
-rw-r--r--src/mir_app/src/chat.h2
-rw-r--r--src/mir_app/src/chat_svc.cpp6
-rw-r--r--src/mir_app/src/chat_tools.cpp14
-rw-r--r--src/mir_app/src/mir_app.def2
-rw-r--r--src/mir_app/src/mir_app64.def2
-rw-r--r--src/mir_app/src/resource.h3
-rw-r--r--src/mir_app/src/srmm_base.cpp17
8 files changed, 20 insertions, 32 deletions
diff --git a/src/mir_app/res/resource.rc b/src/mir_app/res/resource.rc
index 90b54f150f..3e5cd8d7fd 100644
--- a/src/mir_app/res/resource.rc
+++ b/src/mir_app/res/resource.rc
@@ -1267,12 +1267,16 @@ BEGIN
END
END
-IDR_SRMM MENU
+IDR_USERMENU MENU
BEGIN
POPUP "List"
BEGIN
MENUITEM "&Message", IDM_SENDMESSAGE
END
+END
+
+IDR_LOGMENU MENU
+BEGIN
POPUP "Log"
BEGIN
MENUITEM "Clear lo&g", IDM_CLEAR
diff --git a/src/mir_app/src/chat.h b/src/mir_app/src/chat.h
index 8cc58a0d8b..1c3a038a94 100644
--- a/src/mir_app/src/chat.h
+++ b/src/mir_app/src/chat.h
@@ -40,7 +40,6 @@ extern int g_cbSession, g_cbModuleInfo, g_iFontMode;
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;
@@ -112,6 +111,7 @@ int LoadChatModule(void);
void UnloadChatModule(void);
// tools.c
+UINT CreateGCMenu(HWND hwnd, HMENU hMenu, POINT pt, SESSION_INFO *si, const wchar_t *pszUID, const wchar_t *pszWordText);
int DoRtfToTags(CMStringW &pszText, int iNumColors, COLORREF *pColors);
wchar_t* RemoveFormatting(const wchar_t* pszText);
BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT *gce, BOOL bHighlight, int bManyFix);
diff --git a/src/mir_app/src/chat_svc.cpp b/src/mir_app/src/chat_svc.cpp
index 9deb887ec7..48231cf7a9 100644
--- a/src/mir_app/src/chat_svc.cpp
+++ b/src/mir_app/src/chat_svc.cpp
@@ -28,7 +28,6 @@ INT_PTR SvcGetChatManager(WPARAM, LPARAM);
#include "resource.h"
mir_cs csChat;
-HMENU g_hMenu = nullptr;
HGENMENU hJoinMenuItem, hLeaveMenuItem;
MWindowList g_hWindowList;
HANDLE hevSendEvent, hevBuildMenuEvent;
@@ -774,9 +773,6 @@ int LoadChatModule(void)
g_chatApi.hevPreCreate = CreateHookableEvent(ME_MSG_PRECREATEEVENT);
g_chatApi.hevWinPopup = CreateHookableEvent(ME_MSG_WINDOWPOPUP);
- g_hMenu = LoadMenu(g_plugin.getInst(), MAKEINTRESOURCE(IDR_SRMM));
- TranslateMenu(g_hMenu);
-
g_plugin.addSound("ChatMessage", LPGENW("Group chats"), LPGENW("Incoming message"));
g_plugin.addSound("ChatHighlight", LPGENW("Group chats"), LPGENW("Message is highlighted"));
g_plugin.addSound("ChatAction", LPGENW("Group chats"), LPGENW("User has performed an action"));
@@ -812,6 +808,4 @@ void UnloadChatModule(void)
DestroyHookableEvent(g_chatApi.hevPreCreate);
DestroyHookableEvent(g_chatApi.hevWinPopup);
-
- DestroyMenu(g_hMenu);
}
diff --git a/src/mir_app/src/chat_tools.cpp b/src/mir_app/src/chat_tools.cpp
index e0ff086d1d..25ca0a15f3 100644
--- a/src/mir_app/src/chat_tools.cpp
+++ b/src/mir_app/src/chat_tools.cpp
@@ -748,7 +748,7 @@ MIR_APP_DLL(void) Chat_AddMenuItems(HMENU hMenu, int nItems, const gc_item *Item
/////////////////////////////////////////////////////////////////////////////////////////
-MIR_APP_DLL(UINT) Chat_CreateGCMenu(HWND hwnd, HMENU hMenu, POINT pt, SESSION_INFO *si, const wchar_t *pszUID, const wchar_t *pszWordText)
+UINT CreateGCMenu(HWND hwnd, HMENU hMenu, POINT pt, SESSION_INFO *si, const wchar_t *pszUID, const wchar_t *pszWordText)
{
GCMENUITEMS gcmi = {};
gcmi.pszID = si->ptszID;
@@ -787,18 +787,6 @@ MIR_APP_DLL(UINT) Chat_CreateGCMenu(HWND hwnd, HMENU hMenu, POINT pt, SESSION_IN
return TrackPopupMenu(hMenu, TPM_RETURNCMD | TPM_RIGHTBUTTON, pt.x, pt.y, 0, hwnd, nullptr);
}
-MIR_APP_DLL(void) Chat_DestroyGCMenu(HMENU hMenu, int iIndex)
-{
- MENUITEMINFO mii = { 0 };
- mii.cbSize = sizeof(mii);
- mii.fMask = MIIM_SUBMENU;
- while (GetMenuItemInfo(hMenu, iIndex, TRUE, &mii)) {
- if (mii.hSubMenu != nullptr)
- DestroyMenu(mii.hSubMenu);
- RemoveMenu(hMenu, iIndex, MF_BYPOSITION);
- }
-}
-
/////////////////////////////////////////////////////////////////////////////////////////
// calculates the required rectangle for a string using the given font. This is more
// precise than using GetTextExtentPoint...()
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def
index 28af807c0e..3522511b97 100644
--- a/src/mir_app/src/mir_app.def
+++ b/src/mir_app/src/mir_app.def
@@ -365,8 +365,6 @@ Chat_UpdateOptions @418 NONAME
?onDblClick_List@CSrmmBaseDialog@@IAEXPAVCCtrlListBox@@@Z @440 NONAME
?OnDestroy@CSrmmBaseDialog@@MAEXXZ @441 NONAME
Chat_AddMenuItems @442 NONAME
-Chat_DestroyGCMenu @443 NONAME
-Chat_CreateGCMenu @444 NONAME
Chat_DoEventHook @445 NONAME
_stubLogProc@16 @446 NONAME
_stubMessageProc@16 @447 NONAME
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def
index fd015ee41c..e0d0538061 100644
--- a/src/mir_app/src/mir_app64.def
+++ b/src/mir_app/src/mir_app64.def
@@ -365,8 +365,6 @@ Chat_UpdateOptions @418 NONAME
?onDblClick_List@CSrmmBaseDialog@@IEAAXPEAVCCtrlListBox@@@Z @440 NONAME
?OnDestroy@CSrmmBaseDialog@@MEAAXXZ @441 NONAME
Chat_AddMenuItems @442 NONAME
-Chat_DestroyGCMenu @443 NONAME
-Chat_CreateGCMenu @444 NONAME
Chat_DoEventHook @445 NONAME
stubLogProc @446 NONAME
stubMessageProc @447 NONAME
diff --git a/src/mir_app/src/resource.h b/src/mir_app/src/resource.h
index 289436277c..83c2227983 100644
--- a/src/mir_app/src/resource.h
+++ b/src/mir_app/src/resource.h
@@ -31,8 +31,9 @@
#define IDI_INVISIBLE 130
#define IDI_NA 131
#define IDI_LOAD 132
-#define IDR_SRMM 133
+#define IDR_USERMENU 133
#define IDD_OPT_SOUND 134
+#define IDR_LOGMENU 135
#define IDI_RECVMSG 136
#define IDI_URL 138
#define IDI_MCMENUOFF 144
diff --git a/src/mir_app/src/srmm_base.cpp b/src/mir_app/src/srmm_base.cpp
index 350f40ef20..ded2e01386 100644
--- a/src/mir_app/src/srmm_base.cpp
+++ b/src/mir_app/src/srmm_base.cpp
@@ -79,10 +79,13 @@ CSrmmBaseDialog::CSrmmBaseDialog(CMPluginBase &pPlugin, int idDialog, SESSION_IN
void CSrmmBaseDialog::RunUserMenu(HWND hwndOwner, USERINFO *ui, const POINT &pt)
{
+ HMENU hMenu = LoadMenu(g_plugin.getInst(), MAKEINTRESOURCE(IDR_USERMENU));
+ HMENU hSubMenu = GetSubMenu(hMenu, 0);
+ TranslateMenu(hSubMenu);
+
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);
+ UINT uID = CreateGCMenu(hwndOwner, hSubMenu, pt, m_si, uinew.pszUID, uinew.pszNick);
switch (uID) {
case 0:
break;
@@ -95,7 +98,7 @@ void CSrmmBaseDialog::RunUserMenu(HWND hwndOwner, USERINFO *ui, const POINT &pt)
Chat_DoEventHook(m_si, GC_USER_NICKLISTMENU, ui, nullptr, uID);
break;
}
- Chat_DestroyGCMenu(hMenu, 1);
+ DestroyMenu(hMenu);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -232,9 +235,11 @@ LRESULT CSrmmBaseDialog::WndProc_Log(UINT msg, WPARAM wParam, LPARAM lParam)
}
CHARRANGE all = { 0, -1 };
- HMENU hMenu = GetSubMenu(g_hMenu, 1);
+ HMENU hMenu = LoadMenu(g_plugin.getInst(), MAKEINTRESOURCE(IDR_LOGMENU));
+ HMENU hSubMenu = GetSubMenu(hMenu, 0);
+ TranslateMenu(hSubMenu);
m_bInMenu = true;
- UINT uID = Chat_CreateGCMenu(m_log.GetHwnd(), hMenu, pt, m_si, nullptr, pszWord);
+ UINT uID = CreateGCMenu(m_log.GetHwnd(), hSubMenu, pt, m_si, nullptr, pszWord);
m_bInMenu = false;
switch (uID) {
case 0:
@@ -303,7 +308,7 @@ LRESULT CSrmmBaseDialog::WndProc_Log(UINT msg, WPARAM wParam, LPARAM lParam)
Chat_DoEventHook(m_si, GC_USER_LOGMENU, nullptr, nullptr, uID);
break;
}
- Chat_DestroyGCMenu(hMenu, 5);
+ DestroyMenu(hMenu);
}
break;
}