summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2019-09-17 20:43:20 +0300
committerGeorge Hazan <ghazan@miranda.im>2019-09-17 20:43:20 +0300
commitac297d39f72433e077396a02c71526d50b157b17 (patch)
tree18d2fa80b717c9418d3456568e51998dce297e37
parentf4ba44ddae2289b44e11e42dc934cb03462793bf (diff)
Chat: common code moved to mir_app
-rw-r--r--include/m_chat_int.h5
-rw-r--r--libs/win32/mir_app.libbin193118 -> 192818 bytes
-rw-r--r--libs/win64/mir_app.libbin188890 -> 188584 bytes
-rw-r--r--plugins/Scriver/src/msgs.h1
-rw-r--r--plugins/Scriver/src/msgutils.cpp46
-rw-r--r--plugins/TabSRMM/src/msgdlgother.cpp47
-rw-r--r--plugins/TabSRMM/src/msgs.h1
-rw-r--r--src/core/stdmsg/src/chat_window.cpp44
-rw-r--r--src/core/stdmsg/src/msgs.h1
-rw-r--r--src/mir_app/src/chat.h1
-rw-r--r--src/mir_app/src/chat_svc.cpp4
-rw-r--r--src/mir_app/src/mir_app.def3
-rw-r--r--src/mir_app/src/mir_app64.def3
-rw-r--r--src/mir_app/src/srmm_base.cpp53
14 files changed, 62 insertions, 147 deletions
diff --git a/include/m_chat_int.h b/include/m_chat_int.h
index 838ee30e9c..55793409b4 100644
--- a/include/m_chat_int.h
+++ b/include/m_chat_int.h
@@ -455,20 +455,19 @@ public:
COLORREF m_iFG, m_iBG;
void ClearLog();
- void RedrawLog2();
+ void RedrawLog();
void ShowColorChooser(int iCtrlId);
virtual void AddLog();
virtual void CloseTab() {}
virtual bool IsActive() const PURE;
virtual void LoadSettings() PURE;
- virtual void RedrawLog() {}
virtual void ScrollToBottom() {}
virtual void SetStatusText(const wchar_t*, HICON) {}
virtual void ShowFilterMenu() {}
virtual void StreamInEvents(LOGINFO*, bool) {}
virtual void UpdateNickList() {}
- virtual void UpdateOptions() {}
+ virtual void UpdateOptions();
virtual void UpdateStatusBar() {}
virtual void UpdateTitle() PURE;
diff --git a/libs/win32/mir_app.lib b/libs/win32/mir_app.lib
index 6546d3d524..36e749ece1 100644
--- a/libs/win32/mir_app.lib
+++ b/libs/win32/mir_app.lib
Binary files differ
diff --git a/libs/win64/mir_app.lib b/libs/win64/mir_app.lib
index da31335128..e880f124d8 100644
--- a/libs/win64/mir_app.lib
+++ b/libs/win64/mir_app.lib
Binary files differ
diff --git a/plugins/Scriver/src/msgs.h b/plugins/Scriver/src/msgs.h
index f9c893b528..d404942836 100644
--- a/plugins/Scriver/src/msgs.h
+++ b/plugins/Scriver/src/msgs.h
@@ -153,7 +153,6 @@ public:
void CloseTab() override;
void LoadSettings() override;
- void RedrawLog() override;
void ScrollToBottom() override;
void SetStatusText(const wchar_t *, HICON) override;
void ShowFilterMenu() override;
diff --git a/plugins/Scriver/src/msgutils.cpp b/plugins/Scriver/src/msgutils.cpp
index 8dff1c3e35..d69eb28703 100644
--- a/plugins/Scriver/src/msgutils.cpp
+++ b/plugins/Scriver/src/msgutils.cpp
@@ -218,40 +218,6 @@ void CMsgDialog::Reattach(HWND hwndContainer)
/////////////////////////////////////////////////////////////////////////////////////////
-static void __cdecl phase2(SESSION_INFO *si)
-{
- Thread_SetName("Scriver: phase2");
-
- Sleep(30);
- if (si && si->pDlg)
- si->pDlg->RedrawLog2();
-}
-
-void CMsgDialog::RedrawLog()
-{
- m_si->LastTime = 0;
- if (m_si->pLog) {
- LOGINFO *pLog = m_si->pLog;
- if (m_si->iEventCount > 60) {
- int index = 0;
- while (index < 59) {
- if (pLog->next == nullptr)
- break;
-
- pLog = pLog->next;
- if ((m_si->iType != GCW_CHATROOM && m_si->iType != GCW_PRIVMESS) || !m_bFilterEnabled || (m_iLogFilterFlags & pLog->iType) != 0)
- index++;
- }
- StreamInEvents(pLog, true);
- mir_forkThread<SESSION_INFO>(phase2, m_si);
- }
- else StreamInEvents(m_si->pLogEnd, true);
- }
- else ClearLog();
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
void CMsgDialog::ScrollToBottom()
{
if (m_hwndIeview != nullptr) {
@@ -524,14 +490,6 @@ void CMsgDialog::UpdateOptions()
m_btnNickList.SendMsg(BM_SETIMAGE, IMAGE_ICON, (LPARAM)g_plugin.getIcon(m_bNicklistEnabled ? IDI_NICKLIST : IDI_NICKLIST2));
m_btnFilter.SendMsg(BM_SETIMAGE, IMAGE_ICON, (LPARAM)g_plugin.getIcon(m_bFilterEnabled ? IDI_FILTER : IDI_FILTER2));
- m_btnBold.Enable(m_si->pMI->bBold);
- m_btnItalic.Enable(m_si->pMI->bItalics);
- m_btnUnderline.Enable(m_si->pMI->bUnderline);
- m_btnColor.Enable(m_si->pMI->bColor);
- m_btnBkColor.Enable(m_si->pMI->bBkgColor);
- if (m_si->iType == GCW_CHATROOM)
- m_btnChannelMgr.Enable(m_si->pMI->bChanMgr);
-
UpdateStatusBar();
UpdateTitle();
FixTabIcons();
@@ -565,8 +523,8 @@ void CMsgDialog::UpdateOptions()
InvalidateRect(m_nickList.GetHwnd(), nullptr, TRUE);
}
m_message.SendMsg(EM_REQUESTRESIZE, 0, 0);
- Resize();
- RedrawLog2();
+
+ CSuper::UpdateOptions();
}
void CMsgDialog::UpdateStatusBar()
diff --git a/plugins/TabSRMM/src/msgdlgother.cpp b/plugins/TabSRMM/src/msgdlgother.cpp
index 64010ae736..e53df65031 100644
--- a/plugins/TabSRMM/src/msgdlgother.cpp
+++ b/plugins/TabSRMM/src/msgdlgother.cpp
@@ -1224,39 +1224,6 @@ void CMsgDialog::RemakeLog()
/////////////////////////////////////////////////////////////////////////////////////////
-static void __cdecl phase2(SESSION_INFO *si)
-{
- Thread_SetName("TabSRMM: phase2");
-
- Sleep(30);
- if (si && si->pDlg)
- si->pDlg->RedrawLog2();
-}
-
-void CMsgDialog::RedrawLog()
-{
- m_si->LastTime = 0;
- if (m_si->pLog) {
- LOGINFO *pLog = m_si->pLog;
- if (m_si->iEventCount > 60) {
- int index = 0;
- while (index < 59) {
- if (pLog->next == nullptr)
- break;
- pLog = pLog->next;
- if ((m_si->iType != GCW_CHATROOM && m_si->iType != GCW_PRIVMESS) || !m_bFilterEnabled || (m_iLogFilterFlags & pLog->iType) != 0)
- index++;
- }
- StreamInEvents(pLog, TRUE);
- mir_forkThread<SESSION_INFO>(phase2, m_si);
- }
- else StreamInEvents(m_si->pLogEnd, TRUE);
- }
- else ClearLog();
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
void CMsgDialog::ReplayQueue()
{
for (int i = 0; i < m_iNextQueuedEvent; i++)
@@ -1980,16 +1947,6 @@ void CMsgDialog::UpdateNickList()
void CMsgDialog::UpdateOptions()
{
- MODULEINFO *pInfo = m_si ? m_si->pMI : nullptr;
- if (pInfo) {
- m_btnBold.Enable(pInfo->bBold);
- m_btnItalic.Enable(pInfo->bItalics);
- m_btnUnderline.Enable(pInfo->bUnderline);
- m_btnColor.Enable(pInfo->bColor);
- m_btnBkColor.Enable(pInfo->bBkgColor);
- if (m_si->iType == GCW_CHATROOM)
- m_btnChannelMgr.Enable(pInfo->bChanMgr);
- }
m_log.SendMsg(EM_SETBKGNDCOLOR, 0, db_get_dw(0, FONTMODULE, SRMSGSET_BKGCOLOUR, SRMSGDEFSET_BKGCOLOUR));
DM_InitRichEdit();
@@ -1999,8 +1956,8 @@ void CMsgDialog::UpdateOptions()
InvalidateRect(m_nickList.GetHwnd(), nullptr, TRUE);
m_btnFilter.SendMsg(BUTTONSETOVERLAYICON, (LPARAM)(m_bFilterEnabled ? PluginConfig.g_iconOverlayEnabled : PluginConfig.g_iconOverlayDisabled), 0);
- Resize();
- RedrawLog2();
+
+ CSuper::UpdateOptions();
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/plugins/TabSRMM/src/msgs.h b/plugins/TabSRMM/src/msgs.h
index 0a1c2deff6..8ef3641d43 100644
--- a/plugins/TabSRMM/src/msgs.h
+++ b/plugins/TabSRMM/src/msgs.h
@@ -460,7 +460,6 @@ public:
void AddLog() override;
void CloseTab() override;
void LoadSettings() override;
- void RedrawLog() override;
void ScrollToBottom() override;
void SetStatusText(const wchar_t *, HICON) override;
void ShowFilterMenu() override;
diff --git a/src/core/stdmsg/src/chat_window.cpp b/src/core/stdmsg/src/chat_window.cpp
index 6205fd01b5..a33d411064 100644
--- a/src/core/stdmsg/src/chat_window.cpp
+++ b/src/core/stdmsg/src/chat_window.cpp
@@ -32,38 +32,6 @@ void CMsgDialog::LoadSettings()
/////////////////////////////////////////////////////////////////////////////////////////
-static void __cdecl phase2(SESSION_INFO *si)
-{
- Sleep(30);
- if (si && si->pDlg)
- si->pDlg->RedrawLog2();
-}
-
-void CMsgDialog::RedrawLog()
-{
- m_si->LastTime = 0;
- if (m_si->pLog) {
- LOGINFO * pLog = m_si->pLog;
- if (m_si->iEventCount > 60) {
- int index = 0;
- while (index < 59) {
- if (pLog->next == nullptr)
- break;
-
- pLog = pLog->next;
- if (m_si->iType != GCW_CHATROOM || !m_bFilterEnabled || (m_iLogFilterFlags & pLog->iType) != 0)
- index++;
- }
- StreamInEvents(pLog, true);
- mir_forkThread<SESSION_INFO>(phase2, m_si);
- }
- else StreamInEvents(m_si->pLogEnd, true);
- }
- else ClearLog();
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
void CMsgDialog::ShowFilterMenu()
{
HWND hwnd = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_FILTER), m_hwnd, FilterWndProc, (LPARAM)this);
@@ -88,15 +56,6 @@ void CMsgDialog::UpdateOptions()
m_btnNickList.SendMsg(BM_SETIMAGE, IMAGE_ICON, (LPARAM)g_plugin.getIcon(m_bNicklistEnabled ? IDI_NICKLIST : IDI_NICKLIST2, FALSE));
m_btnFilter.SendMsg(BM_SETIMAGE, IMAGE_ICON, (LPARAM)g_plugin.getIcon(m_bFilterEnabled ? IDI_FILTER : IDI_FILTER2, FALSE));
- MODULEINFO *mi = m_si->pMI;
- EnableWindow(m_btnBold.GetHwnd(), mi->bBold);
- EnableWindow(m_btnItalic.GetHwnd(), mi->bItalics);
- EnableWindow(m_btnUnderline.GetHwnd(), mi->bUnderline);
- EnableWindow(m_btnColor.GetHwnd(), mi->bColor);
- EnableWindow(m_btnBkColor.GetHwnd(), mi->bBkgColor);
- if (m_si->iType == GCW_CHATROOM)
- EnableWindow(m_btnChannelMgr.GetHwnd(), mi->bChanMgr);
-
HICON hIcon = ImageList_GetIcon(Clist_GetImageList(), GetImageId(), ILD_TRANSPARENT);
SendMessage(m_pOwner->m_hwndStatus, SB_SETICON, 0, (LPARAM)hIcon);
DestroyIcon(hIcon);
@@ -129,8 +88,7 @@ void CMsgDialog::UpdateOptions()
m_nickList.SendMsg(LB_SETITEMHEIGHT, 0, height > font ? height : font);
InvalidateRect(m_nickList.GetHwnd(), nullptr, TRUE);
- Resize();
- RedrawLog2();
+ CSuper::UpdateOptions();
}
void CMsgDialog::UpdateStatusBar()
diff --git a/src/core/stdmsg/src/msgs.h b/src/core/stdmsg/src/msgs.h
index e1e83a8fd3..5a876ac547 100644
--- a/src/core/stdmsg/src/msgs.h
+++ b/src/core/stdmsg/src/msgs.h
@@ -137,7 +137,6 @@ public:
void CloseTab() override;
bool IsActive() const override;
void LoadSettings() override;
- void RedrawLog() override;
void ScrollToBottom() override;
void SetStatusText(const wchar_t *, HICON) override;
void StreamInEvents(LOGINFO *lin, bool bRedraw) override;
diff --git a/src/mir_app/src/chat.h b/src/mir_app/src/chat.h
index 1c3a038a94..ee0cecafa6 100644
--- a/src/mir_app/src/chat.h
+++ b/src/mir_app/src/chat.h
@@ -49,6 +49,7 @@ extern HANDLE hevSendEvent, hevBuildMenuEvent;
// log.c
void LoadMsgLogBitmaps(void);
void FreeMsgLogBitmaps(void);
+void RedrawLog2(SESSION_INFO *si);
void ValidateFilename (wchar_t *filename);
wchar_t* MakeTimeStamp(wchar_t *pszStamp, time_t time);
wchar_t* GetChatLogsFilename(SESSION_INFO *si, time_t tTime);
diff --git a/src/mir_app/src/chat_svc.cpp b/src/mir_app/src/chat_svc.cpp
index 48231cf7a9..1710a30915 100644
--- a/src/mir_app/src/chat_svc.cpp
+++ b/src/mir_app/src/chat_svc.cpp
@@ -405,7 +405,7 @@ static BOOL AddEventToAllMatchingUID(GCEVENT *gce)
if (SM_AddEvent(si->ptszID, si->pszModule, gce, FALSE))
si->pDlg->AddLog();
else
- si->pDlg->RedrawLog2();
+ RedrawLog2(si);
}
if (!(gce->dwFlags & GCEF_NOTNOTIFY))
@@ -550,7 +550,7 @@ static INT_PTR CALLBACK sttEventStub(void *_param)
if (isOk)
si->pDlg->AddLog();
else
- si->pDlg->RedrawLog2();
+ RedrawLog2(si);
}
if (!(gce.dwFlags & GCEF_NOTNOTIFY))
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def
index 3522511b97..a59be4a7f1 100644
--- a/src/mir_app/src/mir_app.def
+++ b/src/mir_app/src/mir_app.def
@@ -342,14 +342,13 @@ Srmm_LogStreamCallback @412
?CloseTab@CSrmmBaseDialog@@UAEXXZ @416 NONAME
?UpdateStatusBar@CSrmmBaseDialog@@UAEXXZ @417 NONAME
Chat_UpdateOptions @418 NONAME
-?RedrawLog@CSrmmBaseDialog@@UAEXXZ @419 NONAME
+?RedrawLog@CSrmmBaseDialog@@QAEXXZ @419 NONAME
?UpdateOptions@CSrmmBaseDialog@@UAEXXZ @420 NONAME
?ShowColorChooser@CSrmmBaseDialog@@QAEXH@Z @421 NONAME
?ShowFilterMenu@CSrmmBaseDialog@@UAEXXZ @422 NONAME
?OnInitDialog@CSrmmBaseDialog@@MAE_NXZ @423 NONAME
?StreamInEvents@CSrmmBaseDialog@@UAEXPAULOGINFO@@_N@Z @424 NONAME
?AddLog@CSrmmBaseDialog@@UAEXXZ @425 NONAME
-?RedrawLog2@CSrmmBaseDialog@@QAEXXZ @426 NONAME
?ScrollToBottom@CSrmmBaseDialog@@UAEXXZ @427 NONAME
?UpdateNickList@CSrmmBaseDialog@@UAEXXZ @428 NONAME
?onClick_BIU@CSrmmBaseDialog@@IAEXPAVCCtrlButton@@@Z @430 NONAME
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def
index e0d0538061..cb548af9e7 100644
--- a/src/mir_app/src/mir_app64.def
+++ b/src/mir_app/src/mir_app64.def
@@ -342,14 +342,13 @@ Srmm_LogStreamCallback @412
?CloseTab@CSrmmBaseDialog@@UEAAXXZ @416 NONAME
?UpdateStatusBar@CSrmmBaseDialog@@UEAAXXZ @417 NONAME
Chat_UpdateOptions @418 NONAME
-?RedrawLog@CSrmmBaseDialog@@UEAAXXZ @419 NONAME
+?RedrawLog@CSrmmBaseDialog@@QEAAXXZ @419 NONAME
?UpdateOptions@CSrmmBaseDialog@@UEAAXXZ @420 NONAME
?ShowColorChooser@CSrmmBaseDialog@@QEAAXH@Z @421 NONAME
?ShowFilterMenu@CSrmmBaseDialog@@UEAAXXZ @422 NONAME
?OnInitDialog@CSrmmBaseDialog@@MEAA_NXZ @423 NONAME
?StreamInEvents@CSrmmBaseDialog@@UEAAXPEAULOGINFO@@_N@Z @424 NONAME
?AddLog@CSrmmBaseDialog@@UEAAXXZ @425 NONAME
-?RedrawLog2@CSrmmBaseDialog@@QEAAXXZ @426 NONAME
?ScrollToBottom@CSrmmBaseDialog@@UEAAXXZ @427 NONAME
?UpdateNickList@CSrmmBaseDialog@@UEAAXXZ @428 NONAME
?onClick_BIU@CSrmmBaseDialog@@IEAAXPEAVCCtrlButton@@@Z @430 NONAME
diff --git a/src/mir_app/src/srmm_base.cpp b/src/mir_app/src/srmm_base.cpp
index 65e2f0e359..cf4685ef6b 100644
--- a/src/mir_app/src/srmm_base.cpp
+++ b/src/mir_app/src/srmm_base.cpp
@@ -775,11 +775,58 @@ void CSrmmBaseDialog::ClearLog()
m_log.SetText(L"");
}
-void CSrmmBaseDialog::RedrawLog2()
+void CSrmmBaseDialog::UpdateOptions()
+{
+ MODULEINFO *mi = m_si->pMI;
+ EnableWindow(m_btnBold.GetHwnd(), mi->bBold);
+ EnableWindow(m_btnItalic.GetHwnd(), mi->bItalics);
+ EnableWindow(m_btnUnderline.GetHwnd(), mi->bUnderline);
+ EnableWindow(m_btnColor.GetHwnd(), mi->bColor);
+ EnableWindow(m_btnBkColor.GetHwnd(), mi->bBkgColor);
+ if (m_si->iType == GCW_CHATROOM)
+ EnableWindow(m_btnChannelMgr.GetHwnd(), mi->bChanMgr);
+
+ Resize();
+ RedrawLog2(m_si);
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+void RedrawLog2(SESSION_INFO *si)
+{
+ si->LastTime = 0;
+ if (si->pLog)
+ si->pDlg->StreamInEvents(si->pLogEnd, TRUE);
+}
+
+static void __cdecl phase2(SESSION_INFO *si)
+{
+ Sleep(30);
+ if (si && si->pDlg)
+ RedrawLog2(si);
+}
+
+void CSrmmBaseDialog::RedrawLog()
{
m_si->LastTime = 0;
- if (m_si->pLog)
- StreamInEvents(m_si->pLogEnd, TRUE);
+ if (m_si->pLog) {
+ LOGINFO *pLog = m_si->pLog;
+ if (m_si->iEventCount > 60) {
+ int index = 0;
+ while (index < 59) {
+ if (pLog->next == nullptr)
+ break;
+
+ pLog = pLog->next;
+ if (m_si->iType != GCW_CHATROOM || !m_bFilterEnabled || (m_iLogFilterFlags & pLog->iType) != 0)
+ index++;
+ }
+ StreamInEvents(pLog, true);
+ mir_forkThread<SESSION_INFO>(phase2, m_si);
+ }
+ else StreamInEvents(m_si->pLogEnd, true);
+ }
+ else ClearLog();
}
/////////////////////////////////////////////////////////////////////////////////////////