diff options
Diffstat (limited to 'plugins/NewStory/src')
-rw-r--r-- | plugins/NewStory/src/fonts.cpp | 1 | ||||
-rw-r--r-- | plugins/NewStory/src/history.h | 2 | ||||
-rw-r--r-- | plugins/NewStory/src/history_control.cpp | 14 | ||||
-rw-r--r-- | plugins/NewStory/src/history_control.h | 2 | ||||
-rw-r--r-- | plugins/NewStory/src/history_dlg.cpp | 9 | ||||
-rw-r--r-- | plugins/NewStory/src/history_log.cpp | 6 | ||||
-rw-r--r-- | plugins/NewStory/src/main.cpp | 4 | ||||
-rw-r--r-- | plugins/NewStory/src/options.cpp | 1 | ||||
-rw-r--r-- | plugins/NewStory/src/utils.cpp | 26 | ||||
-rw-r--r-- | plugins/NewStory/src/utils.h | 2 |
10 files changed, 35 insertions, 32 deletions
diff --git a/plugins/NewStory/src/fonts.cpp b/plugins/NewStory/src/fonts.cpp index 380dc85b21..09720e3406 100644 --- a/plugins/NewStory/src/fonts.cpp +++ b/plugins/NewStory/src/fonts.cpp @@ -77,6 +77,7 @@ int evtFontsChanged(WPARAM, LPARAM) }
WindowList_Broadcast(g_hNewstoryLogs, UM_REDRAW_LIST, 0, 0);
+ WindowList_Broadcast(g_hNewstoryHistLogs, UM_REDRAW_LIST, 0, 0);
return 0;
}
diff --git a/plugins/NewStory/src/history.h b/plugins/NewStory/src/history.h index 0b3bebe5d9..f332a252cf 100644 --- a/plugins/NewStory/src/history.h +++ b/plugins/NewStory/src/history.h @@ -32,7 +32,7 @@ enum UM_LOCATETIME = WM_USER + 0x662,
};
-extern MWindowList g_hNewstoryWindows, g_hNewstoryLogs;
+extern MWindowList g_hNewstoryWindows, g_hNewstoryLogs, g_hNewstoryHistLogs;
void InitMenus();
void InitHotkeys();
diff --git a/plugins/NewStory/src/history_control.cpp b/plugins/NewStory/src/history_control.cpp index 903e0db33d..534febf153 100644 --- a/plugins/NewStory/src/history_control.cpp +++ b/plugins/NewStory/src/history_control.cpp @@ -1007,19 +1007,6 @@ void NewstoryListData::SetCaret(int idx, bool bEnsureVisible) }
}
-void NewstoryListData::SetContact(MCONTACT hContact)
-{
- m_hContact = hContact;
-
- WindowList_Add(g_hNewstoryLogs, m_hwnd, hContact);
-}
-
-void NewstoryListData::SetDialog(CSrmmBaseDialog *pDlg)
-{
- if (pMsgDlg = pDlg)
- SetContact(pDlg->m_hContact);
-}
-
void NewstoryListData::SetPos(int pos)
{
SetSelection((selStart == -1) ? pos : selStart, pos);
@@ -1717,7 +1704,6 @@ LRESULT CALLBACK NewstoryListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM break;
case WM_DESTROY:
- WindowList_Remove(g_hNewstoryLogs, hwnd);
delete data;
SetWindowLongPtr(hwnd, 0, 0);
break;
diff --git a/plugins/NewStory/src/history_control.h b/plugins/NewStory/src/history_control.h index 5c26afb970..b512b37cd9 100644 --- a/plugins/NewStory/src/history_control.h +++ b/plugins/NewStory/src/history_control.h @@ -174,8 +174,6 @@ struct NewstoryListData : public MZeroedObject void ScrollTop();
void ScrollUp(int deltaY);
void SetCaret(int idx, bool bEnsureVisible = true);
- void SetContact(MCONTACT hContact);
- void SetDialog(CSrmmBaseDialog *pDialog);
void SetPos(int pos);
void SetSelection(int iFirst, int iLast);
void ToggleBookmark();
diff --git a/plugins/NewStory/src/history_dlg.cpp b/plugins/NewStory/src/history_dlg.cpp index ef3eb67172..08351bbd81 100644 --- a/plugins/NewStory/src/history_dlg.cpp +++ b/plugins/NewStory/src/history_dlg.cpp @@ -568,8 +568,6 @@ public: // Ask for layout
PostMessage(m_hwnd, WM_SIZE, 0, 0);
- WindowList_Add(g_hNewstoryWindows, m_hwnd, m_hContact);
-
ShowHideControls();
UpdateTitle();
@@ -584,6 +582,11 @@ public: if (m_hContact != INVALID_CONTACT_ID) {
Utils_RestoreWindowPosition(m_hwnd, m_hContact, MODULENAME, "wnd_");
+ WindowList_Add(g_hNewstoryWindows, m_hwnd, m_hContact);
+
+ m_histCtrl->m_hContact = m_hContact;
+ WindowList_Add(g_hNewstoryHistLogs, m_histCtrl->m_hwnd, m_hContact);
+
m_histCtrl->AddEvent(m_hContact, 0, -1);
BuildTimeTree();
@@ -594,7 +597,6 @@ public: OnResize();
BuildBookmarksList();
- m_histCtrl->SetContact(m_hContact);
m_histCtrl->ScrollBottom();
Window_SetIcon_IcoLib(m_hwnd, g_plugin.getIconHandle(IDI_NEWSTORY));
@@ -798,6 +800,7 @@ public: Window_FreeIcon_IcoLib(m_hwnd);
WindowList_Remove(g_hNewstoryWindows, m_hwnd);
+ WindowList_Remove(g_hNewstoryHistLogs, m_histCtrl->m_hwnd);
if (m_hwndStatus != nullptr) {
DestroyWindow(m_hwndStatus);
diff --git a/plugins/NewStory/src/history_log.cpp b/plugins/NewStory/src/history_log.cpp index ad6af1dd38..3cfe682e46 100644 --- a/plugins/NewStory/src/history_log.cpp +++ b/plugins/NewStory/src/history_log.cpp @@ -37,12 +37,14 @@ public: 0, 0, rc.left - rc.right, rc.bottom - rc.top, m_pDlg.GetHwnd(), 0, m_pDlg.GetInst(), 0);
m_histCtrl = (NewstoryListData *)GetWindowLongPtr(m_hwnd, 0);
- m_histCtrl->SetDialog(&m_pDlg);
+ m_histCtrl->pMsgDlg = &m_pDlg;
+ m_histCtrl->m_hContact = m_pDlg.m_hContact;
+ WindowList_Add(g_hNewstoryLogs, m_hwnd, m_histCtrl->m_hContact);
}
void Detach() override
{
- WindowList_Remove(g_hNewstoryLogs, m_pDlg.GetHwnd());
+ WindowList_Remove(g_hNewstoryLogs, m_hwnd);
::DestroyWindow(m_hwnd);
}
diff --git a/plugins/NewStory/src/main.cpp b/plugins/NewStory/src/main.cpp index bec5c9d337..cb03cebe7d 100644 --- a/plugins/NewStory/src/main.cpp +++ b/plugins/NewStory/src/main.cpp @@ -38,7 +38,7 @@ CMOption<uint32_t> g_clCustom4(MODULENAME, "CustomColor4", -1); CMOption<int> g_iPreviewHeight(MODULENAME, "PreviewHeight", 300);
-MWindowList g_hNewstoryWindows = 0, g_hNewstoryLogs = 0;
+MWindowList g_hNewstoryWindows = 0, g_hNewstoryLogs = 0, g_hNewstoryHistLogs = 0;
/////////////////////////////////////////////////////////////////////////////////////////
@@ -188,6 +188,7 @@ int CMPlugin::Load() g_hNewstoryLogs = WindowList_Create();
g_hNewstoryWindows = WindowList_Create();
+ g_hNewstoryHistLogs = WindowList_Create();
HookEvent(ME_DB_EVENT_ADDED, evtEventAdded);
HookEvent(ME_DB_EVENT_DELETED, evtEventDeleted);
@@ -208,6 +209,7 @@ int CMPlugin::Unload() {
WindowList_Destroy(g_hNewstoryLogs);
WindowList_Destroy(g_hNewstoryWindows);
+ WindowList_Destroy(g_hNewstoryHistLogs);
GdiplusShutdown(m_gdiplusToken);
diff --git a/plugins/NewStory/src/options.cpp b/plugins/NewStory/src/options.cpp index 193ca1ec0b..ba682a6b76 100644 --- a/plugins/NewStory/src/options.cpp +++ b/plugins/NewStory/src/options.cpp @@ -33,6 +33,7 @@ protected: void OnFinish(void *)
{
WindowList_BroadcastAsync(g_hNewstoryLogs, NSM_SET_OPTIONS, 0, 0);
+ WindowList_BroadcastAsync(g_hNewstoryHistLogs, NSM_SET_OPTIONS, 0, 0);
}
};
diff --git a/plugins/NewStory/src/utils.cpp b/plugins/NewStory/src/utils.cpp index cfe158f433..927b2b0ab2 100644 --- a/plugins/NewStory/src/utils.cpp +++ b/plugins/NewStory/src/utils.cpp @@ -49,19 +49,29 @@ Bitmap* LoadImageFromResource(HINSTANCE hInst, int resourceId, const wchar_t *pw /////////////////////////////////////////////////////////////////////////////////////////
-int SmartSendEvent(int iEventType, MCONTACT hContact, LPARAM hEvent)
+static void SmartSendEventWorker(MWindowList wndList, int iEventType, MCONTACT cc1, MCONTACT cc2, MEVENT hEvent)
{
- if (HWND hwnd = WindowList_Find(g_hNewstoryLogs, hContact))
- SendMessage(hwnd, iEventType, hContact, hEvent);
+ if (HWND hwnd = WindowList_Find(wndList, cc1))
+ PostMessage(hwnd, iEventType, cc1, hEvent);
- if (db_mc_isMeta(hContact)) {
- // Send a message to a real contact too
+ if (cc2 != INVALID_CONTACT_ID)
+ if (HWND hwnd = WindowList_Find(wndList, cc2))
+ PostMessage(hwnd, iEventType, cc2, hEvent);
+}
+
+int SmartSendEvent(int iEventType, MCONTACT cc1, MEVENT hEvent)
+{
+ MCONTACT cc2 = INVALID_CONTACT_ID;
+
+ // Send a message to a real contact too
+ if (db_mc_isMeta(cc1)) {
MCONTACT cc = db_event_getContact(hEvent);
- if (cc != hContact)
- if (HWND hwnd = WindowList_Find(g_hNewstoryLogs, cc))
- SendMessage(hwnd, iEventType, cc, hEvent);
+ if (cc != cc1)
+ cc2 = cc;
}
+ SmartSendEventWorker(g_hNewstoryLogs, iEventType, cc1, cc2, hEvent);
+ SmartSendEventWorker(g_hNewstoryHistLogs, iEventType, cc1, cc2, hEvent);
return 0;
}
diff --git a/plugins/NewStory/src/utils.h b/plugins/NewStory/src/utils.h index 1858c34d9c..7ebc0a4980 100644 --- a/plugins/NewStory/src/utils.h +++ b/plugins/NewStory/src/utils.h @@ -14,4 +14,4 @@ void RemoveBbcodes(CMStringW &pwszText); Bitmap* LoadImageFromResource(HINSTANCE, int, const wchar_t *);
-int SmartSendEvent(int iEvent, MCONTACT hContact, LPARAM lParam);
+int SmartSendEvent(int iEvent, MCONTACT hContact, MEVENT lParam);
|