summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mir_app/src/srmm_log_rtf.cpp26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/mir_app/src/srmm_log_rtf.cpp b/src/mir_app/src/srmm_log_rtf.cpp
index b98f6ca28d..f2f1fae8d6 100644
--- a/src/mir_app/src/srmm_log_rtf.cpp
+++ b/src/mir_app/src/srmm_log_rtf.cpp
@@ -95,11 +95,35 @@ int CRtfLogWindow::GetType()
return 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
+static DWORD CALLBACK StreamOutCallback(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb)
+{
+ CMStringW *str = (CMStringW *)dwCookie;
+ str->Append((wchar_t*)pbBuff, cb / 2);
+ *pcb = cb;
+ return 0;
+}
+
wchar_t* CRtfLogWindow::GetSelection()
{
- return nullptr;
+ CHARRANGE sel;
+ SendMessage(m_rtf.GetHwnd(), EM_EXGETSEL, 0, (LPARAM)&sel);
+ if (sel.cpMin == sel.cpMax)
+ return nullptr;
+
+ CMStringW result;
+
+ EDITSTREAM stream;
+ memset(&stream, 0, sizeof(stream));
+ stream.pfnCallback = StreamOutCallback;
+ stream.dwCookie = (DWORD_PTR)&result;
+ SendMessage(m_rtf.GetHwnd(), EM_STREAMOUT, SF_TEXT | SF_UNICODE | SFF_SELECTION, (LPARAM)&stream);
+ return result.Detach();
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
INT_PTR CRtfLogWindow::Notify(WPARAM, LPARAM lParam)
{
LPNMHDR hdr = (LPNMHDR)lParam;