summaryrefslogtreecommitdiff
path: root/src/mir_app
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2017-03-26 18:03:09 +0300
committerGeorge Hazan <ghazan@miranda.im>2017-03-26 18:03:09 +0300
commit10afc1ded386e911703abd99f56843cab6a266e3 (patch)
tree6cdc970ff7af373a262af1453ae5b312a852998a /src/mir_app
parentbb0ad44266842e40a90d94be1b6bceb43e1549f2 (diff)
common code from WndProc_Log moved to mir_app
Diffstat (limited to 'src/mir_app')
-rw-r--r--src/mir_app/src/chat_tools.cpp13
-rw-r--r--src/mir_app/src/srmm_base.cpp18
2 files changed, 22 insertions, 9 deletions
diff --git a/src/mir_app/src/chat_tools.cpp b/src/mir_app/src/chat_tools.cpp
index df67d45517..ce81249be2 100644
--- a/src/mir_app/src/chat_tools.cpp
+++ b/src/mir_app/src/chat_tools.cpp
@@ -796,14 +796,9 @@ MIR_APP_DLL(UINT) Chat_CreateGCMenu(HWND hwnd, HMENU hMenu, POINT pt, SESSION_IN
gcmi.hMenu = hMenu;
if (pszUID == nullptr) {
- int iLen = GetRichTextLength(hwnd);
-
- EnableMenuItem(hMenu, IDM_CLEAR, MF_ENABLED);
- EnableMenuItem(hMenu, IDM_COPYALL, MF_ENABLED);
- if (!iLen) {
- EnableMenuItem(hMenu, IDM_COPYALL, MF_BYCOMMAND | MF_GRAYED);
- EnableMenuItem(hMenu, IDM_CLEAR, MF_BYCOMMAND | MF_GRAYED);
- }
+ int flags = MF_BYPOSITION | (GetRichTextLength(hwnd) == 0 ? MF_GRAYED : MF_ENABLED);
+ EnableMenuItem(hMenu, 0, flags);
+ EnableMenuItem(hMenu, 2, flags);
if (pszWordText && pszWordText[0]) {
wchar_t szMenuText[4096];
@@ -822,7 +817,7 @@ MIR_APP_DLL(UINT) Chat_CreateGCMenu(HWND hwnd, HMENU hMenu, POINT pt, SESSION_IN
if (mir_wstrlen(szTemp) > 40)
mir_wstrncpy(szTemp + 40, L"...", 4);
- ModifyMenu(hMenu, IDM_SENDMESSAGE, MF_STRING | MF_BYCOMMAND, IDM_SENDMESSAGE, szTemp);
+ ModifyMenu(hMenu, 0, MF_STRING | MF_BYPOSITION, IDM_SENDMESSAGE, szTemp);
gcmi.Type = MENU_ON_NICKLIST;
}
diff --git a/src/mir_app/src/srmm_base.cpp b/src/mir_app/src/srmm_base.cpp
index 01ef9a8063..d9e25d6c9d 100644
--- a/src/mir_app/src/srmm_base.cpp
+++ b/src/mir_app/src/srmm_base.cpp
@@ -136,6 +136,24 @@ static LRESULT CALLBACK stubLogProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l
LRESULT CSrmmBaseDialog::WndProc_Log(UINT msg, WPARAM wParam, LPARAM lParam)
{
+ 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;
+ m_log.SendMsg(EM_EXSETSEL, 0, (LPARAM)&sel);
+ }
+ }
+ break;
+
+ case WM_CHAR:
+ SetFocus(m_message.GetHwnd());
+ m_message.SendMsg(WM_CHAR, wParam, lParam);
+ break;
+ }
+
return mir_callNextSubclass(m_log.GetHwnd(), stubLogProc, msg, wParam, lParam);
}