summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/m_gui.h1
-rw-r--r--libs/win32/mir_core.libbin497794 -> 498110 bytes
-rw-r--r--libs/win64/mir_core.libbin503114 -> 503440 bytes
-rw-r--r--plugins/TabSRMM/src/msgdialog.cpp4
-rw-r--r--plugins/TabSRMM/src/msgdlgother.cpp4
-rw-r--r--plugins/TabSRMM/src/msgs.h8
-rw-r--r--src/mir_core/src/Windows/CCtrlRichEdit.cpp20
-rw-r--r--src/mir_core/src/mir_core.def1
-rw-r--r--src/mir_core/src/mir_core64.def1
9 files changed, 27 insertions, 12 deletions
diff --git a/include/m_gui.h b/include/m_gui.h
index 211e2e4520..601e22456e 100644
--- a/include/m_gui.h
+++ b/include/m_gui.h
@@ -856,6 +856,7 @@ public:
int GetRichTextLength(int iCodePage = CP_ACP) const;
// returns a buffer that should be freed using mir_free() or ptrA/ptrW
+ char* GetPlainRtf(bool bSelection = false);
char* GetRichTextRtf(bool bText = false, bool bSelection = false) const; // returns text with formatting
wchar_t* GetRichText() const; // returns only text in ucs2
diff --git a/libs/win32/mir_core.lib b/libs/win32/mir_core.lib
index b6102f14f3..364a71df83 100644
--- a/libs/win32/mir_core.lib
+++ b/libs/win32/mir_core.lib
Binary files differ
diff --git a/libs/win64/mir_core.lib b/libs/win64/mir_core.lib
index 2568657177..5a428145c5 100644
--- a/libs/win64/mir_core.lib
+++ b/libs/win64/mir_core.lib
Binary files differ
diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp
index cc86a06bf9..46088dabc7 100644
--- a/plugins/TabSRMM/src/msgdialog.cpp
+++ b/plugins/TabSRMM/src/msgdialog.cpp
@@ -924,7 +924,7 @@ void CMsgDialog::onClick_Quote(CCtrlButton*)
CHARRANGE sel;
LOG()->WndProc(EM_EXGETSEL, 0, (LPARAM)&sel);
if (sel.cpMin != sel.cpMax) {
- ptrA szFromStream(LOG()->GetRichTextRtf(true, true));
+ ptrA szFromStream(LOG()->RTF().GetRichTextRtf(true, true));
ptrW converted(mir_utf8decodeW(szFromStream));
Utils::FilterEventMarkers(converted);
szQuoted = Srmm_Quote(converted, iOutputWidth);
@@ -1674,7 +1674,7 @@ int CMsgDialog::OnFilter(MSGFILTER *pFilter)
cr.cpMin = cr.cpMax;
if (isCtrl) {
SETTEXTEX stx = { ST_KEEPUNDO | ST_SELECTION, CP_UTF8 };
- ptrA streamOut(LOG()->GetRichTextRtf(!isAlt, true));
+ ptrA streamOut(LOG()->RTF().GetRichTextRtf(!isAlt, true));
if (streamOut) {
Utils::FilterEventMarkers(streamOut);
m_message.SendMsg(EM_SETTEXTEX, (WPARAM)&stx, (LPARAM)streamOut);
diff --git a/plugins/TabSRMM/src/msgdlgother.cpp b/plugins/TabSRMM/src/msgdlgother.cpp
index 5e728eedc1..4ee9fc0d87 100644
--- a/plugins/TabSRMM/src/msgdlgother.cpp
+++ b/plugins/TabSRMM/src/msgdlgother.cpp
@@ -3024,13 +3024,13 @@ LRESULT CMsgDialog::WMCopyHandler(UINT msg, WPARAM wParam, LPARAM lParam)
{
LRESULT result = mir_callNextSubclass(m_pLog->GetHwnd(), stubLogProc, msg, wParam, lParam);
- ptrA szFromStream(LOG()->GetRichTextRtf(true, true));
+ ptrA szFromStream(LOG()->RTF().GetRichTextRtf(true, true));
if (szFromStream != nullptr) {
ptrW converted(mir_utf8decodeW(szFromStream));
if (converted != nullptr) {
Utils::FilterEventMarkers(converted);
- ptrA szRtf(LOG()->GetRichTextRtf(false, true));
+ ptrA szRtf(LOG()->RTF().GetPlainRtf(true));
Utils_ClipboardCopy(MClipUnicode(converted) + MClipRtf(szRtf));
}
}
diff --git a/plugins/TabSRMM/src/msgs.h b/plugins/TabSRMM/src/msgs.h
index e7895a7fa4..cdeed7ec54 100644
--- a/plugins/TabSRMM/src/msgs.h
+++ b/plugins/TabSRMM/src/msgs.h
@@ -694,14 +694,12 @@ public:
void ScrollToBottom() override;
void UpdateOptions() override;
- void DisableStaticEdge()
- {
+ void DisableStaticEdge() {
SetWindowLongPtr(m_rtf.GetHwnd(), GWL_EXSTYLE, GetWindowLongPtr(m_rtf.GetHwnd(), GWL_EXSTYLE) & ~WS_EX_STATICEDGE);
}
- char *GetRichTextRtf(bool bText, bool bSelection)
- {
- return m_rtf.GetRichTextRtf(bText, bSelection);
+ CCtrlRichEdit& RTF() const {
+ return m_rtf;
}
void LogEvents(MEVENT hDbEventFirst, int count, bool bAppend, DB::EventInfo *dbei);
diff --git a/src/mir_core/src/Windows/CCtrlRichEdit.cpp b/src/mir_core/src/Windows/CCtrlRichEdit.cpp
index d1a761781b..ae58f516cf 100644
--- a/src/mir_core/src/Windows/CCtrlRichEdit.cpp
+++ b/src/mir_core/src/Windows/CCtrlRichEdit.cpp
@@ -89,18 +89,32 @@ static DWORD CALLBACK MessageStreamCallback(DWORD_PTR dwCookie, LPBYTE pbBuff, L
return 0;
}
+char* CCtrlRichEdit::GetPlainRtf(bool bSelection)
+{
+ char *pszText = nullptr;
+ uint32_t dwFlags = SF_RTFNOOBJS | SFF_PLAINRTF;
+ if (bSelection)
+ dwFlags |= SFF_SELECTION;
+
+ EDITSTREAM stream = {};
+ stream.pfnCallback = MessageStreamCallback;
+ stream.dwCookie = (DWORD_PTR)&pszText; // pass pointer to pointer
+ SendMessage(m_hwnd, EM_STREAMOUT, dwFlags, (LPARAM)&stream);
+ return pszText; // pszText contains the text
+}
+
char* CCtrlRichEdit::GetRichTextRtf(bool bText, bool bSelection) const
{
char *pszText = nullptr;
- uint32_t dwFlags = 0;
+ uint32_t dwFlags = SF_USECODEPAGE | (CP_UTF8 << 16);
if (bText)
- dwFlags |= SF_USECODEPAGE | (CP_UTF8 << 16) / SF_TEXT;
+ dwFlags |= SF_TEXT;
else
dwFlags |= SF_RTFNOOBJS | SFF_PLAINRTF;
if (bSelection)
dwFlags |= SFF_SELECTION;
- EDITSTREAM stream = { 0 };
+ EDITSTREAM stream = {};
stream.pfnCallback = MessageStreamCallback;
stream.dwCookie = (DWORD_PTR)&pszText; // pass pointer to pointer
SendMessage(m_hwnd, EM_STREAMOUT, dwFlags, (LPARAM)&stream);
diff --git a/src/mir_core/src/mir_core.def b/src/mir_core/src/mir_core.def
index dc56ef8ee3..9296b22011 100644
--- a/src/mir_core/src/mir_core.def
+++ b/src/mir_core/src/mir_core.def
@@ -1576,3 +1576,4 @@ _newStr@4 @1789 NONAME
?Copy@MClipAnsi@@UBEXXZ @1801 NONAME
?Copy@MClipRtf@@UBEXXZ @1802 NONAME
?Copy@MClipUnicode@@UBEXXZ @1803 NONAME
+?GetPlainRtf@CCtrlRichEdit@@QAEPAD_N@Z @1804 NONAME
diff --git a/src/mir_core/src/mir_core64.def b/src/mir_core/src/mir_core64.def
index 7d9885b02d..0a4d9dcabc 100644
--- a/src/mir_core/src/mir_core64.def
+++ b/src/mir_core/src/mir_core64.def
@@ -1576,3 +1576,4 @@ newStr @1789 NONAME
?Copy@MClipAnsi@@UEBAXXZ @1801 NONAME
?Copy@MClipRtf@@UEBAXXZ @1802 NONAME
?Copy@MClipUnicode@@UEBAXXZ @1803 NONAME
+?GetPlainRtf@CCtrlRichEdit@@QEAAPEAD_N@Z @1804 NONAME