diff options
author | George Hazan <george.hazan@gmail.com> | 2024-10-30 14:18:29 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2024-10-30 14:18:29 +0300 |
commit | 851cf91ef94adc40d49f4d60e6f0f32694fba96b (patch) | |
tree | 7ddc3e0f45b164e2fac788ad310339f83eb5f9d1 /plugins/NewStory | |
parent | 56cc299b8d2624a59592d81440fdd86fee9d11b5 (diff) |
fixes #4644 (NewStory: added protocol icon for the global history search window)
Diffstat (limited to 'plugins/NewStory')
-rw-r--r-- | plugins/NewStory/src/history_array.cpp | 3 | ||||
-rw-r--r-- | plugins/NewStory/src/history_control.cpp | 21 | ||||
-rw-r--r-- | plugins/NewStory/src/history_control.h | 2 | ||||
-rw-r--r-- | plugins/NewStory/src/version.h | 2 | ||||
-rw-r--r-- | plugins/NewStory/src/webpage.cpp | 2 |
5 files changed, 28 insertions, 2 deletions
diff --git a/plugins/NewStory/src/history_array.cpp b/plugins/NewStory/src/history_array.cpp index 3d81d77b4b..bcf1120a9b 100644 --- a/plugins/NewStory/src/history_array.cpp +++ b/plugins/NewStory/src/history_array.cpp @@ -210,6 +210,9 @@ int ItemData::calcHeight(int width) if (dbe.flags & DBEF_BOOKMARK) // Bookmark icon
xPos += 18;
+ if (pOwner->m_hContact == INVALID_CONTACT_ID) // Protocol icon
+ xPos += 18;
+
cx -= xPos;
if (m_bOfflineDownloaded != 0 || m_bDelivered || m_bRemoteRead) // Download completed icon
cx -= 18;
diff --git a/plugins/NewStory/src/history_control.cpp b/plugins/NewStory/src/history_control.cpp index a944053381..b10e7a98a3 100644 --- a/plugins/NewStory/src/history_control.cpp +++ b/plugins/NewStory/src/history_control.cpp @@ -67,6 +67,12 @@ NewstoryListData::NewstoryListData(HWND _1) : iLineHeigth = GetFontHeight(g_fontTable[FONT_INMSG].lf);
}
+NewstoryListData::~NewstoryListData()
+{
+ for (auto &it : m_protoIcons)
+ IcoLib_ReleaseIcon(it.second);
+}
+
void NewstoryListData::onTimer_Draw(CTimer *pTimer)
{
pTimer->Stop();
@@ -772,6 +778,21 @@ void NewstoryListData::Paint(simpledib::dib &dib) if (!bReadOnly) {
HICON hIcon;
+ // Protocol icon
+ if (m_hContact == INVALID_CONTACT_ID) {
+ if (auto *pa = Proto_GetContactAccount(pItem->dbe.hContact)) {
+ if (m_protoIcons.count(pa->szModuleName))
+ hIcon = m_protoIcons[pa->szModuleName];
+ else {
+ hIcon = Skin_LoadProtoIcon(pa->szModuleName, ID_STATUS_ONLINE);
+ m_protoIcons[pa->szModuleName] = hIcon;
+ }
+
+ DrawIconEx(dib, xPos, yPos, hIcon, 16, 16, 0, 0, DI_NORMAL);
+ xPos += 18;
+ }
+ }
+
// Message type icon
if (g_plugin.bShowType) {
switch (pItem->dbe.eventType) {
diff --git a/plugins/NewStory/src/history_control.h b/plugins/NewStory/src/history_control.h index 49289baeb4..e74b7b754b 100644 --- a/plugins/NewStory/src/history_control.h +++ b/plugins/NewStory/src/history_control.h @@ -86,9 +86,11 @@ public: struct NewstoryListData : public MZeroedObject
{
NewstoryListData(HWND);
+ ~NewstoryListData();
mir_cs m_csItems;
HistoryArray items;
+ std::map<std::string, HICON> m_protoIcons;
int scrollTopItem; // topmost item
int scrollTopPixel; // y coord of topmost item, this should be negative or zero
diff --git a/plugins/NewStory/src/version.h b/plugins/NewStory/src/version.h index 7d9f500c7e..deec274fc5 100644 --- a/plugins/NewStory/src/version.h +++ b/plugins/NewStory/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 0
#define __MINOR_VERSION 2
#define __RELEASE_NUM 0
-#define __BUILD_NUM 2
+#define __BUILD_NUM 3
#include <stdver.h>
diff --git a/plugins/NewStory/src/webpage.cpp b/plugins/NewStory/src/webpage.cpp index b2fcd9892d..79dbdd095b 100644 --- a/plugins/NewStory/src/webpage.cpp +++ b/plugins/NewStory/src/webpage.cpp @@ -58,7 +58,7 @@ INT_PTR SvcFileReady(WPARAM wParam, LPARAM) static std::set<std::wstring> g_installed_fonts; -int CALLBACK EnumFontsProc(const LOGFONTW *lplf, const TEXTMETRIC *, DWORD, LPARAM) +static int CALLBACK EnumFontsProc(const LOGFONTW *lplf, const TEXTMETRIC *, DWORD, LPARAM) { g_installed_fonts.insert(lplf->lfFaceName); return 1; |