summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2023-07-26 13:07:55 +0300
committerGeorge Hazan <george.hazan@gmail.com>2023-07-26 13:07:55 +0300
commitb05abc26fef6128e2327990ff9fb76e5156ca5d7 (patch)
tree65de92b26428a645f20132a70f98fdcce6f8702d /src
parent69581b8648e0c2fe96f454455763359ebeeba46a (diff)
mechanism of the whole log window redrawing is actual for the RTF-based logs only, so let's move inside CRtfLogWindow
Diffstat (limited to 'src')
-rw-r--r--src/mir_app/src/srmm_log_rtf.cpp18
-rw-r--r--src/mir_app/src/srmm_main.cpp18
2 files changed, 18 insertions, 18 deletions
diff --git a/src/mir_app/src/srmm_log_rtf.cpp b/src/mir_app/src/srmm_log_rtf.cpp
index 6a879a535f..ee76d28bc3 100644
--- a/src/mir_app/src/srmm_log_rtf.cpp
+++ b/src/mir_app/src/srmm_log_rtf.cpp
@@ -30,14 +30,32 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define EVENTTYPE_STATUSCHANGE 25368
#define EVENTTYPE_ERRMSG 25366
+static int OnRedrawLog(void *pObj, WPARAM hContact, LPARAM)
+{
+ auto *pLog = (CRtfLogWindow *)pObj;
+ auto &pDlg = pLog->GetDialog();
+
+ if (pDlg.m_hContact == hContact)
+ pDlg.ScheduleRedrawLog();
+ else if (auto hParent = db_mc_getMeta(hContact))
+ if (pDlg.m_hContact == hParent)
+ pDlg.ScheduleRedrawLog();
+
+ return 0;
+}
+
CRtfLogWindow::CRtfLogWindow(CMsgDialog &pDlg) :
CSrmmLogWindow(pDlg),
m_rtf(*(CCtrlRichEdit*)pDlg.FindControl(IDC_SRMM_LOG))
{
+ hevEdited = HookEventObj(ME_DB_EVENT_EDITED, OnRedrawLog, this);
+ hevDelete = HookEventObj(ME_DB_EVENT_DELETED, OnRedrawLog, this);
}
CRtfLogWindow::~CRtfLogWindow()
{
+ UnhookEvent(hevEdited);
+ UnhookEvent(hevDelete);
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/mir_app/src/srmm_main.cpp b/src/mir_app/src/srmm_main.cpp
index 9de2c1bdb0..54fe37b369 100644
--- a/src/mir_app/src/srmm_main.cpp
+++ b/src/mir_app/src/srmm_main.cpp
@@ -52,21 +52,6 @@ static int OnPrebuildContactMenu(WPARAM hContact, LPARAM)
}
/////////////////////////////////////////////////////////////////////////////////////////
-// Built-in hook to redraw RTF-based event logs on event's change/deletion
-
-static int OnRedrawLog(WPARAM hContact, LPARAM)
-{
- if (auto *pDlg = Srmm_FindDialog(hContact))
- pDlg->ScheduleRedrawLog();
-
- if (db_mc_isSub(hContact))
- if (auto *pDlg = Srmm_FindDialog(db_mc_getMeta(hContact)))
- pDlg->ScheduleRedrawLog();
-
- return 0;
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
void SrmmModulesLoaded()
{
@@ -104,9 +89,6 @@ int LoadSrmmModule()
hHookSrmmEvent = CreateHookableEvent(ME_MSG_WINDOWEVENT);
hHookIconsChanged = CreateHookableEvent(ME_MSG_ICONSCHANGED);
hHookIconPressedEvt = CreateHookableEvent(ME_MSG_ICONPRESSED);
-
- HookEvent(ME_DB_EVENT_EDITED, OnRedrawLog);
- HookEvent(ME_DB_EVENT_DELETED, OnRedrawLog);
return 0;
}