diff options
author | George Hazan <ghazan@miranda.im> | 2023-04-18 15:00:44 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2023-04-18 15:00:44 +0300 |
commit | b38f2534004135415ae8d576c7f3bb41785ca7e7 (patch) | |
tree | 895e89ce5da30f91995943686ef558a6ca8cd2ca /plugins/Scriver/src/msglog.cpp | |
parent | cd5679ac850cd43c1b681de6485c8ec30a9e8e1d (diff) |
- further group chats unification;
- LOGSTREAMDATA / GCLogStreamDataBase removed from g_chatApi;
- CRtfLogWindow now in charge of all RTF processing- Srmm_LogStreamCallback is also removed and hidden inside the core
Diffstat (limited to 'plugins/Scriver/src/msglog.cpp')
-rw-r--r-- | plugins/Scriver/src/msglog.cpp | 33 |
1 files changed, 12 insertions, 21 deletions
diff --git a/plugins/Scriver/src/msglog.cpp b/plugins/Scriver/src/msglog.cpp index 8a16ebd013..cf5d714c83 100644 --- a/plugins/Scriver/src/msglog.cpp +++ b/plugins/Scriver/src/msglog.cpp @@ -643,22 +643,21 @@ public: ////////////////////////////////////////////////////////////////////////////////////////
- void LogEvents(SESSION_INFO *si, int iStart, bool bRedraw) override
+ void LogEvents(SESSION_INFO *si, int iStart, bool bAppend) override
{
- if (m_rtf.GetHwnd() == nullptr || si == nullptr || si == nullptr)
+ if (m_rtf.GetHwnd() == nullptr || si == nullptr)
return;
auto &lin = si->arEvents[iStart];
- if (!bRedraw && (si->iType == GCW_CHATROOM || si->iType == GCW_PRIVMESS) && !(m_pDlg.m_iLogFilterFlags & lin.iType))
+ if (!bAppend && (si->iType == GCW_CHATROOM || si->iType == GCW_PRIVMESS) && !(m_pDlg.m_iLogFilterFlags & lin.iType))
return;
- LOGSTREAMDATA streamData;
- memset(&streamData, 0, sizeof(streamData));
- streamData.hwnd = m_rtf.GetHwnd();
+ RtfChatLogStreamData streamData;
+ streamData.pLog = this;
streamData.si = si;
streamData.iStartEvent = iStart;
streamData.bStripFormat = FALSE;
- streamData.isFirst = bRedraw ? 1 : m_rtf.GetRichTextLength() == 0;
+ streamData.bIsFirst = bAppend ? 1 : m_rtf.GetRichTextLength() == 0;
SCROLLINFO scroll;
scroll.cbSize = sizeof(SCROLLINFO);
@@ -681,28 +680,20 @@ public: // fix for the indent... must be a M$ bug
if (sel.cpMax == 0)
- bRedraw = TRUE;
-
- // should the event(s) be appended to the current log
- WPARAM wp = bRedraw ? SF_RTF : SFF_SELECTION | SF_RTF;
+ bAppend = TRUE;
// get the number of pixels per logical inch
bool bFlag = false;
- if (bRedraw) {
+ if (bAppend) {
m_rtf.SetDraw(false);
bFlag = true;
}
// stream in the event(s)
- streamData.bRedraw = bRedraw;
-
- EDITSTREAM stream = {};
- stream.pfnCallback = Srmm_LogStreamCallback;
- stream.dwCookie = (DWORD_PTR)&streamData;
- m_rtf.SendMsg(EM_STREAMIN, wp, (LPARAM)&stream);
+ StreamChatRtfEvents(&streamData, bAppend);
// do smileys
- if (g_dat.smileyAddInstalled && (bRedraw || (lin.ptszText && lin.iType != GC_EVENT_JOIN && lin.iType != GC_EVENT_NICK && lin.iType != GC_EVENT_ADDSTATUS && lin.iType != GC_EVENT_REMOVESTATUS))) {
+ if (g_dat.smileyAddInstalled && (bAppend || (lin.ptszText && lin.iType != GC_EVENT_JOIN && lin.iType != GC_EVENT_NICK && lin.iType != GC_EVENT_ADDSTATUS && lin.iType != GC_EVENT_REMOVESTATUS))) {
newsel.cpMax = -1;
newsel.cpMin = sel.cpMin;
if (newsel.cpMin < 0)
@@ -711,7 +702,7 @@ public: SMADD_RICHEDIT3 sm = { sizeof(sm) };
sm.hwndRichEditControl = m_rtf.GetHwnd();
sm.Protocolname = si->pszModule;
- sm.rangeToReplace = bRedraw ? nullptr : &newsel;
+ sm.rangeToReplace = bAppend ? nullptr : &newsel;
sm.flags = 0;
sm.disableRedraw = TRUE;
sm.hContact = m_pDlg.m_hContact;
@@ -719,7 +710,7 @@ public: }
// scroll log to bottom if the log was previously scrolled to bottom, else restore old position
- if (bRedraw || (UINT)scroll.nPos >= (UINT)scroll.nMax - scroll.nPage - 5 || scroll.nMax - scroll.nMin - scroll.nPage < 50)
+ if (bAppend || (UINT)scroll.nPos >= (UINT)scroll.nMax - scroll.nPage - 5 || scroll.nMax - scroll.nMin - scroll.nPage < 50)
ScrollToBottom();
else
m_rtf.SendMsg(EM_SETSCROLLPOS, 0, (LPARAM)&point);
|